<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title></title>
    <description>The musings and work of Ryan Marcus, an assistant professor at UPenn.</description>
    <link>/blog</link>
    <atom:link href="/blog/feed.xml" rel="self" type="application/rss+xml" />
    
      <item>
        <title>Compiled and vectorized evaluation in columnar engines</title>
        <description>&lt;p&gt;How do modern columnar database management systems process a query like this?&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Columnar systems today are generally either use &lt;em&gt;compiling&lt;/em&gt; query engines or &lt;em&gt;vectorized&lt;/em&gt; query engines.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;em&gt;Compiling query engines&lt;/em&gt; generate code that executes the query, allowing tools like LLVM to optimize queries “end to end.”&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Vectorized query engines&lt;/em&gt; use hand-optimized subroutines that process large chunks of single columns at a time, then combine the intermediate results together to form the final output.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First, we’ll look at the strategies used by both engine types, and measure their performance over random data (both &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b &amp;lt; 7&lt;/code&gt; will have 50% selectivity – more on that later). Then, we’ll analyze some of the surprises we find along the way. This blog post is a microcosm of the excellent 2018 VLDB paper, &lt;a href=&quot;https://www.vldb.org/pvldb/vol11/p2209-kersten.pdf&quot;&gt;“Everything You Always Wanted to Know About Compiled and Vectorized Queries But Were Afraid to Ask.”&lt;/a&gt; by Kersten et al.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/sel-vecs/partial-vs-full-predicate.svg&quot; alt=&quot;Animation demonstrating compiled and vectorized query execution (explained in the text below)&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;compiling-engine-strategy&quot;&gt;Compiling engine strategy&lt;/h1&gt;

&lt;p&gt;Most compiling engines, like &lt;a href=&quot;https://assets.amazon.science/4b/37/223ac61e450898244a31bed53734/amazon-redshift-re-invented.pdf#subsection.2.2&quot;&gt;Amazon Redshift&lt;/a&gt; or &lt;a href=&quot;https://hyper-db.de/&quot;&gt;Tableau Hyper&lt;/a&gt;, follow the code generation technique described in Thomas Neumann’s 2011 paper, “&lt;a href=&quot;doi.org/10.14778/2002938.2002940&quot;&gt;Efficiently compiling efficient query plans for modern hardware&lt;/a&gt;.” The code generated for a query like ours would be pretty close to what you might write by hand. Ignoring all the scaffolding required to read data, handle multiple chunks, etc., a compiling execution engine might generate code like this:&lt;/p&gt;

&lt;div class=&quot;language-rust highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;pub&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fn&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compiled_engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;f32&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.iter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.zip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.zip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.filter_map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(|((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a_el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b_el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c_el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)|&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a_el&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b_el&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.then_some&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c_el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you check the &lt;a href=&quot;https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:&apos;1&apos;,fontScale:14,fontUsePx:&apos;0&apos;,j:1,lang:rust,selection:(endColumn:1,endLineNumber:9,positionColumn:1,positionLineNumber:9,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:&apos;pub+fn+compiled_engine(a:+%26%5Bi32%5D,+b:+%26%5Bi32%5D,+c:+%26%5Bf32%5D)+-%3E+f32+%7B%0A++++a.iter()%0A++++++++.zip(b)%0A++++++++.zip(c)%0A++++++++.filter_map(%7C((a_el,+b_el),+c_el)%7C+%7B%0A++++++++++++(*a_el+%3E+5+%26%26+*b_el+%3C+7).then_some(c_el)%0A++++++++%7D).sum()%0A%7D%0A&apos;),l:&apos;5&apos;,n:&apos;0&apos;,o:&apos;Rust+source+%231&apos;,t:&apos;0&apos;)),k:43.69886858137511,l:&apos;4&apos;,n:&apos;0&apos;,o:&apos;&apos;,s:0,t:&apos;0&apos;),(g:!((h:compiler,i:(compiler:r1960,filters:(b:&apos;0&apos;,binary:&apos;1&apos;,binaryObject:&apos;1&apos;,commentOnly:&apos;0&apos;,debugCalls:&apos;1&apos;,demangle:&apos;0&apos;,directives:&apos;0&apos;,execute:&apos;1&apos;,intel:&apos;0&apos;,libraryCode:&apos;0&apos;,trim:&apos;1&apos;,verboseDemangling:&apos;0&apos;),flagsViewOpen:&apos;1&apos;,fontScale:14,fontUsePx:&apos;0&apos;,j:1,lang:rust,libs:!(),options:&apos;-C+opt-level%3D3+-C+target-cpu%3Dskylake&apos;,overrides:!((name:edition,value:&apos;2024&apos;)),selection:(endColumn:12,endLineNumber:76,positionColumn:1,positionLineNumber:1,selectionStartColumn:12,selectionStartLineNumber:76,startColumn:1,startLineNumber:1),source:1),l:&apos;5&apos;,n:&apos;0&apos;,o:&apos;+rustc+1.96.0+(Editor+%231)&apos;,t:&apos;0&apos;)),k:56.301131418624905,l:&apos;4&apos;,n:&apos;0&apos;,o:&apos;&apos;,s:0,t:&apos;0&apos;)),l:&apos;2&apos;,n:&apos;0&apos;,o:&apos;&apos;,t:&apos;0&apos;)),version:4&quot;&gt;generated assembly&lt;/a&gt; (make sure to use optimizations and set the target CPU to something modern!), you’ll see that Rust produces a compact, short-circuiting loop with SIMD instructions for the summation. At first glance, it also seems like this is just about the optimal code we could write to answer this query (aside from system-level changes like parallelism or index structures).&lt;/p&gt;

&lt;div class=&quot;details-container&quot;&gt;&lt;details&gt;&lt;summary&gt;&lt;div class=&quot;summary-text&quot;&gt;Doesn&apos;t Rust do bounds checking? &lt;/div&gt;&lt;/summary&gt;&lt;div class=&quot;details-text&quot;&gt;

      &lt;p&gt;You might wonder if Rust’s iterators or bounds checking make this code slower than the “C style” version using a for-loop. In this case, the compiler is smart enough to optimize away the bounds check. You can &lt;a href=&quot;https://godbolt.org/&quot;&gt;check yourself&lt;/a&gt; if you’d like, using this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unsafe&lt;/code&gt; code:&lt;/p&gt;

      &lt;div class=&quot;language-rust highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;pub&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fn&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compiled_engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;f32&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;unsafe&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;mut&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;accum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.get_unchecked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.get_unchecked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;accum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.get_unchecked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;accum&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;      &lt;/div&gt;

    &lt;/div&gt;&lt;/details&gt;&lt;/div&gt;

&lt;h1 id=&quot;vectorized-engine-strategy&quot;&gt;Vectorized engine strategy&lt;/h1&gt;
&lt;p&gt;Vectorized engines, like &lt;a href=&quot;https://www.actian.com/databases/vector/&quot;&gt;Actian Vector&lt;/a&gt;, &lt;a href=&quot;https://www.monetdb.org/&quot;&gt;MonetDB&lt;/a&gt;, and &lt;a href=&quot;https://duckdb.org/&quot;&gt;DuckDB&lt;/a&gt;, don’t generate or compile code, but instead use hand-optimized “kernel functions” that operate on large chunks of data at once (primarily following &lt;a href=&quot;https://www.cidrdb.org/cidr2005/papers/P19.pdf&quot;&gt;Peter Boncz et al.’s X100 paper&lt;/a&gt;). There are two ways a vectorized engine might handle our query: &lt;em&gt;full evaluation&lt;/em&gt; and &lt;em&gt;partial evaluation&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Full evaluation&lt;/strong&gt; is the most straightforward, and may even seem naive at first. At a high level, the idea is to build one bitmap for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt;, another bitmap for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b &amp;lt; 7&lt;/code&gt;, then bitwise-AND the two bitmaps together. Finally, we can iterate over the set bits in the resulting bitmap and sum up the corresponding entries of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-rust highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;pub&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fn&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;vec_engine_full&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;f32&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// kernel 1: compare column with constant, store result in bitmap&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a_bm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;BooleanBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;collect_bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// kernel 2: compare column with constant, store result in bitmap&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b_bm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;BooleanBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;collect_bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// kernel 3: bitwise AND of two bitmaps&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a_bm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b_bm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// kernel 4: sum of a vector at positions given by bitmap&lt;/span&gt;
    &lt;span class=&quot;nn&quot;&gt;BitIndexIterator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.values&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here, we use &lt;a href=&quot;https://arrow.apache.org/rust/arrow/index.html&quot;&gt;Apache Arrow’s&lt;/a&gt; &lt;a href=&quot;https://arrow.apache.org/rust/arrow/buffer/struct.BooleanBuffer.html&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BooleanBuffer&lt;/code&gt;&lt;/a&gt; to construct and iterate over the bitmaps. At first glance, one might think this code is a significant regression from the compiled code. Not only are we doing “extra work” by testing entries of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b&lt;/code&gt; that the compiled version gets to skip via short-circuiting, but we’re also allocating two ~125KB data structures. Well, vectorized database engine designers had the same thought, so they also built kernels for partial evaluation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Partial evaluation&lt;/strong&gt; avoids the wasted work by building vectors (sometimes called &lt;em&gt;selections&lt;/em&gt; or &lt;em&gt;selection vectors&lt;/em&gt;) of indexes that track which positions are not filtered out.&lt;sup id=&quot;fnref:3&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; Once the vector of indexes that pass the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt; filter is computed, we can check just those indexes for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b &amp;lt; 7&lt;/code&gt;, and then compute the sum over &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-rust highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;pub&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fn&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;vec_engine_partial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;f32&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// kernel 1: find indexes of a where the predicate is true&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Vec&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;usize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.iter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.enumerate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.filter_map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(|(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a_el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)|&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a_el&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.then_some&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.collect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// kernel 2: narrow input indexes by predicate&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Vec&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;usize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sel&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.into_iter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.filter_map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.then_some&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.collect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// kernel 3: sum using indexes&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sel&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.into_iter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Unfortunately, I could not for the life of me get the compiler to properly vectorize this code&lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;, so I had to write the SIMD manually. This is totally fine for a vectorized database, since every kernel is expected to be hand-tuned. You can find the SIMD implementation &lt;a href=&quot;https://github.com/RyanMarcus/vector-predicate-blog-example/blob/870cce903295c083216ee32e9998fc5728a73f9e/src/lib.rs#L66&quot;&gt;here&lt;/a&gt;. But the SIMD version simply does what the above code does, just more efficiently.&lt;/p&gt;

&lt;h1 id=&quot;bakeoff-1-50-selectivity&quot;&gt;Bakeoff #1: 50% Selectivity&lt;/h1&gt;

&lt;p&gt;OK, how do our times compare? Let’s evaluate over a million randomly generated rows, generating the data so that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b &amp;lt; 7&lt;/code&gt; have 50% selectivity. This benchmark was ran on my laptop, equipped with a &lt;a href=&quot;https://www.intel.com/content/www/us/en/products/sku/232146/intel-core-i71370p-processor-24m-cache-up-to-5-20-ghz/specifications.html&quot;&gt;i7-1370P&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;predicates/compiled
    time:   [4.2265 ms 4.2431 ms 4.2578 ms]
    thrpt:  [234.86 Melem/s 235.68 Melem/s 236.60 Melem/s]

predicates/vec_full
    time:   [852.99 µs 858.36 µs 863.24 µs]
    thrpt:  [1.1584 Gelem/s 1.1650 Gelem/s 1.1723 Gelem/s]

predicates/vec_partial
    time:   [1.4747 ms 1.4793 ms 1.4830 ms]
    thrpt:  [674.32 Melem/s 675.98 Melem/s 678.09 Melem/s]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img class=&quot;float-right&quot; alt=&quot;Bar graph of throughput values&quot; src=&quot;/blog/assets/sel-vecs/sel50_tput.svg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Wow! It might be quite surprising that the vectorized “full” strategy is not just the fastest, but is the fastest but a wide margin. What’s going on here? Since some of the &lt;a href=&quot;https://umbra-db.com/&quot;&gt;fastest databases in the world&lt;/a&gt; use a compiled engine, we should be quite surprised by this seemingly-poor showing.&lt;/p&gt;

&lt;p&gt;Let’s try and figure out why our compiled engine is doing so poorly compared with the vectorized strategies. After all, the compiled code doesn’t create any extra data structures, and the compiled code avoids all wasted work via short-circuiting. We can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;perf&lt;/code&gt; and &lt;a href=&quot;https://doi.org/10.1109/ISPASS.2014.6844459&quot;&gt;top-down analysis&lt;/a&gt; to figure out what is going on.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Performance counter stats for &apos;cargo bench compiled&apos;:
 12K  page-faults:u           #  830.127 /sec
 74G  cycles/u                #    5.111 GHz
 15G  instructions/u          #    0.46  insn per cycle ❶
  6G  branches/u              #  462.162 M/sec
  2G  branch-misses/u         #   26.75% of all branches ❹
  TopdownL1 (cpu_core)        #    9.9 %  tma_backend_bound
                              #   37.3 %  tma_bad_speculation ❷
                              #   47.7 %  tma_frontend_bound ❸
                              #    5.0 %  tma_retiring
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The first thing we notice is that ❶ instructions per cycle is quite low. This means that our CPU is not doing useful work most of the time; instead, the CPU might be recovering from branch mispredictions, or might be stuck waiting for memory accesses (either data or instruction). Second, when looking at the topdown analysis, we see very high ❸ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;frontend_bound&lt;/code&gt; and ❷ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bad_speculation&lt;/code&gt;. Since &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;frontend_bound&lt;/code&gt; includes instruction misses from branch resteers, and our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bad_speculation&lt;/code&gt; is also pretty high, we can conclude that the primary bottleneck here is likely branch misprediction – ❹ about 26% of branches are missing mispredicted. Instruction count could also be a problem, but the presence of so much bad speculation is a “red flag” that should catch our eye first.&lt;/p&gt;

&lt;div class=&quot;details-container&quot;&gt;&lt;details&gt;&lt;summary&gt;&lt;div class=&quot;summary-text&quot;&gt;Why is high bad speculation a red flag? &lt;/div&gt;&lt;/summary&gt;&lt;div class=&quot;details-text&quot;&gt;

      &lt;p&gt;When bad speculation occurs, it could be counted as &lt;em&gt;either&lt;/em&gt; a branch resteer (loading a different set of instructions), or a branch misprediction (undoing the effects of an incorrect speculation). Thus, when bad speculation is high, we don’t really know if the true problem is in the front end or the back end. As Ahmad Yasin puts it in “A Top-Down Method for Performance Analysis and Counters Architecture”:&lt;/p&gt;

      &lt;blockquote&gt;
        &lt;p&gt;Having Bad Speculation category at the Top-Level is a key principle in our Top-Down Analysis. It determines the fraction of the workload under analysis that is affected by incorrect execution paths, which in turn dictates the accuracy of observations listed in other categories. Furthermore, this permits nodes at lower levels to make use of some of the many traditional counters, given that most counters in out-of-order CPUs count speculatively. Hence, &lt;strong&gt;a high value in Bad Speculation would be interpreted by the user as a “red flag” that need to be investigated first&lt;/strong&gt;, before looking at other categories. In other words, assuring Bad Speculation is minor not only improves utilization of the available resources, but also increases confidence in metrics reported throughout the hierarchy.&lt;/p&gt;
      &lt;/blockquote&gt;

    &lt;/div&gt;&lt;/details&gt;&lt;/div&gt;

&lt;p&gt;Let’s compare this with a top-down analysis of the vectorized full code (using bitmaps):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Performance counter stats for &apos;cargo bench bitmap&apos;:
 12,260  page-faults:u   #  542.632 /sec
 101G    cycles/u        #    4.485 GHz
 381G    instructions/u  #    8.35  insn per cycle ❶
 63G     branches/u      #    2.829 G/sec
 443M    branch-misses/u #    2.41% of all branches
 TopdownL1 (cpu_core)    #   22.3 %  tma_backend_bound ❸
                         #    6.0 %  tma_bad_speculation
                         #   12.4 %  tma_frontend_bound
                         #   59.2 %  tma_retiring ❷
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can immediately see that our bitmap code is making better use of the CPU. First, instead of executing ½ an instruction per cycle, ❶ we’re now executing over 8 instructions per cycle! Our topdown analysis shows that most of our time is ❷ going to “retiring” instructions, meaning that the instructions are leaving the CPU pipeline normally! Our next biggest bottleneck is ❸ “backend,” means that instructions are waiting on resources (like memory reads) in order to proceed.&lt;/p&gt;

&lt;p&gt;It’s important to note that &lt;strong&gt;higher instructions per cycle (IPC) is not always better.&lt;/strong&gt; Higher IPC more instructions are making it through the CPU, but two different techniques may require a different number of instructions! In our case, the bitmap approach requires some extra “work” to be done (bitmaps must be allocated, constructed, compared, and destroyed), whereas the compiled approach does very little extra work. The reason that the bitmap approach performs better is not because it has an higher IPC, but because it does work in a way that is better aligned with what the CPU is expecting.&lt;/p&gt;

&lt;h1 id=&quot;bakeoff-2-004-selectivity&quot;&gt;Bakeoff #2: 0.04% Selectivity&lt;/h1&gt;

&lt;p&gt;If we want to make the compiled version of the code look as good as possible, we note two things:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The compiled version only gets to avoid work if the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt; predicate is false – that is, if the conditional short-circuits.&lt;/li&gt;
  &lt;li&gt;The compiled version had tons of branch misprediction, so making the branch behavior more consistent should improve performance.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We can maximize the number of short-circuits and make the branch behavior more consistent by lowering the selectivity of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt;. Keeping everything else the same, we’ll lower the selectivity of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt; to 0.04:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;predicates/compiled
    time:   [152.77 µs 153.70 µs 154.50 µs]
    thrpt:  [6.4723 Gelem/s 6.5063 Gelem/s 6.5456 Gelem/s]

predicates/vec_full
    time:   [401.64 µs 403.45 µs 405.38 µs]
    thrpt:  [2.4668 Gelem/s 2.4786 Gelem/s 2.4898 Gelem/s]

predicates/vec_partial
    time:   [195.99 µs 197.01 µs 197.92 µs]
    thrpt:  [5.0524 Gelem/s 5.0759 Gelem/s 5.1023 Gelem/s]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img class=&quot;float-right&quot; alt=&quot;Bar graph of throughput values&quot; src=&quot;/blog/assets/sel-vecs/sel004_tput.svg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And, under some circumstances, this code is indeed essentially optimal!&lt;/p&gt;

&lt;p&gt;To understand why this code might sometimes perform well or poorly, it is important to make a few observations about this query and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;compiled_engine&lt;/code&gt; approach:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Memory bound&lt;/strong&gt;. We’re doing very little with each value that we read from memory. Essentially, we are performing two inequalities and one addition (both cheap operations) per three memory reads. We can thus hypothesize that our code will be bound by the speed of memory, either by the “front end” (loading new instructions) or the “back end” (reading data).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Branching&lt;/strong&gt;. The short-circuiting evaluation of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*a_el &amp;gt; 5 &amp;amp;&amp;amp; *b_el &amp;lt; 7&lt;/code&gt; means that we &lt;em&gt;may&lt;/em&gt; have a branch. I say “may” because the optimizer &lt;em&gt;could&lt;/em&gt; choose to rewrite this code in a branchless fashion, but branching is something we should think about. This is also our first hint that the performance of this code might have something to do with how often &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt; is true or false.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Inconsistent memory access&lt;/strong&gt;. We always read the entries of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a&lt;/code&gt; in order, but we might access &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b&lt;/code&gt; sparsely (since we only access &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b&lt;/code&gt; if &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt;), and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&lt;/code&gt; even more sparsely (since we only access &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&lt;/code&gt; is both conditions are true).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We can confirm or deny our hypotheses using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;perf stat&lt;/code&gt;. If we run with a highly selective &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt; (that is, most rows are filtered out):&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;predicates/compiled time:   [144.20 µs 144.76 µs 145.35 µs]
Performance counter stats for &apos;cargo bench compiled&apos;:
 19,254.19 msec task-clock:u       #  1.306 CPUs utilized
      81K          page-faults:u   #  4.239 K/sec
      80G          cycles/u        #  4.158 GHz              (93.14%)
      292G         instructions/u  #  7.34  insn per cycle   (93.14%)
      126G         branches/u      #  6.591 G/sec            (93.14%)
      204,605,913  branch-misses/u #  2.13% of all branches  (93.14%)
      TopdownL1                    #    3.9 %  tma_backend_bound
                                   #    5.5 %  tma_bad_speculation
                                   #   14.6 %  tma_frontend_bound
                                   #   76.0 %  tma_retiring
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Compared to if we use a non-selective &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a &amp;gt; 5&lt;/code&gt; (zero rows are filtered):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;predicates/compiled time:   [3.6357 ms 3.6439 ms 3.6532 ms]
Performance counter stats for &apos;cargo bench compiled&apos;:
 16,432.68 msec task-clock:u       #   0.999 CPUs utilized
  12,161      page-faults:u        # 740.050 /sec
     79G      cycles/u             #   4.851 GHz              (99.85%)
     30G      instructions/u       #   0.89  insn per cycle   (99.85%)
     13G      branches/u           # 815.276 M/sec            (99.85%)
      2G      branch-misses/u      #  24.00% of all branches  (99.85%)
         TopdownL1 (cpu_core)      #     9.6 %  tma_backend_bound
                                   #    49.9 %  tma_bad_speculation
                                   #    31.2 %  tma_frontend_bound
                                   #     9.3 %  tma_retiring
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When the predicate over &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a&lt;/code&gt; is selective, we get 7.34 instructions per cycle, but when the predicate is not selective, we drop to 0.89 instructions per clock cycle! This reflects in the total time taken to process 1M rows going from 144 &lt;strong&gt;micro&lt;/strong&gt;seconds to 3.6 &lt;strong&gt;milli&lt;/strong&gt;seconds! Luckily, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;perf&lt;/code&gt; also points us to the culprit: the topdown analysis shows that, in the slow case, we’re spending 50% of our time recovering from bad speculations (i.e., branch mispredictions). In the fast case, only 5% of total time is spent on mispredictions.&lt;/p&gt;

&lt;h1 id=&quot;bakeoff-3-end-to-end-optimizations&quot;&gt;Bakeoff #3: End-to-end optimizations&lt;/h1&gt;

&lt;p&gt;Compiling execution engines really shine when the compiler (e.g., LLVM) can do something smarter than just lowering our code to machine instructions. In the above examples, LLVM was able to use SIMD instructions for some of our code, unroll loops, etc., but it was never able to fundamentally change the shape of the compilation for this particular query. But what if our query was instead:&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;… now we only need to count how often both predicates are true. Our vectorized code might look like this:&lt;/p&gt;

&lt;div class=&quot;language-rust highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;pub&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fn&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;vec_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;usize&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a_bm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;BooleanBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;collect_bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b_bm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;BooleanBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;collect_bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;idx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a_bm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b_bm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.count_set_bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;… and the compiler-generated code might look like this:&lt;/p&gt;

&lt;div class=&quot;language-rust highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;pub&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fn&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compiled_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;i32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;usize&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.iter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.zip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(|(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a_el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b_el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)|&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a_el&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b_el&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;.count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this case, LLVM can lower this code into &lt;a href=&quot;https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:&apos;1&apos;,fontScale:14,fontUsePx:&apos;0&apos;,j:1,lang:rust,selection:(endColumn:2,endLineNumber:6,positionColumn:2,positionLineNumber:6,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:&apos;pub+fn+compiled_engine_count(a:+%26%5Bi32%5D,+b:+%26%5Bi32%5D,+_c:+%26%5Bf32%5D)+-%3E+usize+%7B%0A++++a.iter()%0A++++++++.zip(b)%0A++++++++.filter(%7C(a_el,+b_el)%7C+**a_el+%3E+5+%26%26+**b_el+%3C+7)%0A++++++++.count()%0A%7D&apos;),l:&apos;5&apos;,n:&apos;0&apos;,o:&apos;Rust+source+%231&apos;,t:&apos;0&apos;)),k:45.80392156862745,l:&apos;4&apos;,n:&apos;0&apos;,o:&apos;&apos;,s:0,t:&apos;0&apos;),(g:!((h:compiler,i:(compiler:r1960,filters:(b:&apos;0&apos;,binary:&apos;1&apos;,binaryObject:&apos;1&apos;,commentOnly:&apos;0&apos;,debugCalls:&apos;1&apos;,demangle:&apos;0&apos;,directives:&apos;0&apos;,execute:&apos;1&apos;,intel:&apos;0&apos;,libraryCode:&apos;0&apos;,trim:&apos;1&apos;,verboseDemangling:&apos;0&apos;),flagsViewOpen:&apos;1&apos;,fontScale:14,fontUsePx:&apos;0&apos;,j:1,lang:rust,libs:!(),options:&apos;-C+opt-level%3D3+-C+target-cpu%3Dskylake&apos;,overrides:!((name:edition,value:&apos;2024&apos;)),selection:(endColumn:12,endLineNumber:127,positionColumn:12,positionLineNumber:127,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1),l:&apos;5&apos;,n:&apos;0&apos;,o:&apos;+rustc+1.96.0+(Editor+%231)&apos;,t:&apos;0&apos;)),k:54.196078431372555,l:&apos;4&apos;,n:&apos;0&apos;,o:&apos;&apos;,s:0,t:&apos;0&apos;)),l:&apos;2&apos;,n:&apos;0&apos;,o:&apos;&apos;,t:&apos;0&apos;)),version:4&quot;&gt;beautiful SIMD code&lt;/a&gt; that loads 16 elements from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a&lt;/code&gt;, 16 elements from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b&lt;/code&gt;, compares them, and then counts the number of set bits in the resulting mask and adds that count to an accumulator.&lt;/p&gt;

&lt;p&gt;This pays off – at any selectivity, the compiled code operates at around &lt;span id=&quot;il180&quot;&gt;&lt;/span&gt; rows/sec, compared to the vectorized code which operates at around &lt;span id=&quot;il181&quot;&gt;&lt;/span&gt; rows/sec. But such optimizations are not always possible.&lt;/p&gt;

&lt;h1 id=&quot;the-best-of-both-worlds&quot;&gt;The best of both worlds?&lt;/h1&gt;

&lt;p&gt;Can we get the best of both vectorized and compiled execution engines? Surely, a compiling engine could generate the same code that a vectorized engine uses, so why not? A paper by &lt;a href=&quot;https://dl.acm.org/doi/10.14778/3151113.3151114&quot;&gt;Menon et al.&lt;/a&gt; called “Relaxed Operator Fusion” explores this idea. The short answer is that you can, but it’s not as simple as either strategy alone.&lt;/p&gt;

&lt;p&gt;Database, and especially their execution engines, are filled with surprising performance “gotchas” and highly-optimized tricks that have been passed down from system to system. If you’d like, you can read some of &lt;a href=&quot;https://www.vldb.org/pvldb/vol19/p523-marcus.pdf&quot;&gt;my work on engineering a hash table for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GROUP BY&lt;/code&gt; aggregation&lt;/a&gt;, or check out the excellent &lt;a href=&quot;http://dl.acm.org/citation.cfm?doid=3275366.3284966&quot;&gt;everything you’ve always wanted to know about vectorized and compiled execution engines, but were afraid to ask.&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;notes&quot;&gt;Notes&lt;/h1&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
      &lt;p&gt;You can technically use a partial strategy with bitmaps instead of selection vectors, and you can use selection vectors instead of bitmaps in a full strategy. But intersecting bitmaps is generally cheaper than intersecting vectors, and iterating over (sparse) vectors is generally cheaper than iterating over bitmaps. Of course, there are exceptions. &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
      &lt;p&gt;Vectorizing the selection vector code gets significantly easier on AVX-512 hardware due to the “compress store” primitives, but unfortunately, I’m trapped in AVX2 land. Vectorizing this code with AVX2 requires precomputing a permutation lookup table, which is probably why the compiler doesn’t do it automatically. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Thu, 18 Jun 2026 00:00:00 +0000</pubDate>
        <link>/blog/2026/06/18/partial-vs-full-predicate.html</link>
        <guid isPermaLink="true">/blog/2026/06/18/partial-vs-full-predicate.html</guid>
      </item>
    
      <item>
        <title>Neo, 6 years and 600 citations later</title>
        <description>&lt;p&gt;I was excited to see that &lt;a href=&quot;https://rm.cab/neo&quot;&gt;Neo, the &lt;strong&gt;ne&lt;/strong&gt;ural query &lt;strong&gt;o&lt;/strong&gt;ptimizer&lt;/a&gt;, got its 600th citation! It’s nice to have a quantification, but what I’m most proud of is the impact Neo had on the research community.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/neo600/neo600.avif&quot; alt=&quot;Google Scholar screenshot of Neo with 600 citations&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Neo was simultaneously the last paper of my PhD at Brandeis and the first paper of my postdoc at MIT. Working with my advisor &lt;a href=&quot;https://www.cs.brandeis.edu/~olga/&quot;&gt;Olga&lt;/a&gt; and then-1st-year-PhD student &lt;a href=&quot;https://sites.google.com/view/chi-zhang/home&quot;&gt;Chi&lt;/a&gt; at Brandeis, along with &lt;a href=&quot;https://people.csail.mit.edu/alizadeh/&quot;&gt;Mohammad&lt;/a&gt;, &lt;a href=&quot;https://people.csail.mit.edu/hongzi/&quot;&gt;Hongzi&lt;/a&gt;, &lt;a href=&quot;https://parimarjan.github.io/&quot;&gt;Pari&lt;/a&gt;, &lt;a href=&quot;https://people.csail.mit.edu/tatbul/&quot;&gt;Nesime&lt;/a&gt;, and &lt;a href=&quot;https://people.csail.mit.edu/kraska/&quot;&gt;Tim&lt;/a&gt; (my future postdoc supervisor) at MIT, was a great experience. I couldn’t think of a better way to end a PhD, or to start a postdoc!&lt;/p&gt;

&lt;h2 id=&quot;what-is-neo&quot;&gt;What is Neo?&lt;/h2&gt;

&lt;p&gt;Learning a query optimizer with deep reinforcement learning is interesting because making a query optimizer is a long and complex task. Modern query optimizers, like the one found in SQL Server, represent decades of engineering effort. If one builds a new type of system, are they doomed to spend decades of engineering effort building a query optimizer as well? Or is there another way?&lt;/p&gt;

&lt;p&gt;Neo showed that deep reinforcement learning, with a little bit of demonstration from a simple query optimizer, could eventually learn policies that matched the performance of state-of-the-art (in 2019) query optimizers. Neo thus represented a hope that query optimizers for future data systems could be “learned” instead of manually built.&lt;/p&gt;

&lt;h2 id=&quot;howd-we-get-there&quot;&gt;How’d we get there?&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/neo600/neotimeline.svg&quot; alt=&quot;Timeline of Neo&apos;s development&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Neo was the culmination of two prior works from my PhD investigating how deep reinforcement learning could be applied to query optimization. Initially, in &lt;a href=&quot;https://rm.cab/rejoin&quot;&gt;ReJOIN&lt;/a&gt;, we showed that an off-the-shelf PPO algorithm could find plans with low costs according to the query optimizer’s cost model. Concurrently, a team at UW (Ortiz et al.) &lt;a href=&quot;https://arxiv.org/abs/1803.08604&quot;&gt;discovered&lt;/a&gt; that the state learned by a deep RL agent contained rich information about the query’s structure. A little later that year, a team from Cal (Krishnan et al.) &lt;a href=&quot;https://arxiv.org/abs/1808.03196&quot;&gt;showed&lt;/a&gt; how Q-learning could be used to optimize queries against a cost model.&lt;/p&gt;

&lt;p&gt;In order to get from here to Neo, we needed to solve two key problems.&lt;/p&gt;

&lt;h3 id=&quot;key-problem-1-sample-inefficiency&quot;&gt;Key Problem 1: Sample Inefficiency&lt;/h3&gt;

&lt;p&gt;&lt;img width=&quot;40%&quot; src=&quot;/blog/assets/neo600/lfd.avif&quot; alt=&quot;Learning from demonstration diagram from the vision paper&quot; style=&quot;float: right;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Deep reinforcement learning algorithms are notoriously &lt;em&gt;sample inefficient&lt;/em&gt;. While RL models could learn to solve complex problems, they might need millions (or even trillions) of “episodes” in order to get there. This sample inefficiency is easy to get around in traditional RL areas like video games. If you are bad at Pacman, you’ll get eaten by a ghost quickly. This means you can get a lot of episodes per wall-clock hour.&lt;sup id=&quot;fnref:sim&quot;&gt;&lt;a href=&quot;#fn:sim&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; This is not the case in query optimization: if you pick a really bad query plan, it could &lt;a href=&quot;https://rm.cab/howgood&quot;&gt;take days to execute instead of seconds&lt;/a&gt;. In other words, in query optimization, &lt;em&gt;doing worse takes longer.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Because of this, throwing an off-the-shelf RL algorithm at query optimization is not really viable. In our &lt;a href=&quot;https://api.zotero.org/users/3604318/publications/items/RQUDH9S7/file/view&quot;&gt;vision paper&lt;/a&gt; early the next year, we laid out three different potential ways to solve the problem. One of those ways – learning from expert demonstration – became Neo. Later, another idea, bootstrapping from a cost model, was explored by Berkeley in &lt;a href=&quot;https://arxiv.org/pdf/2201.01441&quot;&gt;Balsa&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;key-problem-2-inductive-bias&quot;&gt;Key Problem 2: Inductive Bias&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/neo600/tcnn.avif&quot; alt=&quot;TCNN examples from the Neo paper&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Half the battle of getting deep learning to work well is getting the right inductive bias. Throwing a fully connected network at a problem, while theoretically sufficient, is rarely the right choice. Think about the areas where deep learning has had the most success: in computer vision, convolutional neural networks (CNNs) excel at modeling low-level vision primitives like oriented edge filters, and thus tend to perform better than fully connected networks (although today you’ll likely see a convolutional head on top of a transformer). In natural language processing, transformer models excel at modeling long-range dependencies, and thus tend to perform better than fully connected networks.&lt;/p&gt;

&lt;p&gt;So how can we get a good inductive bias for query optimization? Fortunately, researchers in 2016 at Peking University proposed a technique called &lt;a href=&quot;https://arxiv.org/pdf/1409.5718&quot;&gt;tree convolution&lt;/a&gt;. Originally designed for program language processing, tree convolution is also a great fit for modeling the performance of query plans. Section 4.1 of the &lt;a href=&quot;https://rm.cab/neo&quot;&gt;Neo paper&lt;/a&gt; provides an intuitive overview of tree convolution and how it can be applied to query optimization.&lt;/p&gt;

&lt;h2 id=&quot;what-happened-next&quot;&gt;What happened next?&lt;/h2&gt;

&lt;p&gt;By all measures of an academic project, Neo was a success. I graduated and got a postdoc. The paper has been cited many times, and research on replacing a query optimizer with a deep reinforcement learning agent continues to thrive to this day (for example, check out &lt;a href=&quot;https://arxiv.org/abs/2401.15210&quot;&gt;Roq&lt;/a&gt; from IBM). While Neo demonstrated excellent performance, it also revealed (at least to me) two new important facts about query optimization:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;The tail matters more than the mean.&lt;/strong&gt; Neo’s RL algorithm seeks to minimize the mean latency of a query plan, and it does so admirably, often matching or even exceeding the performance of expert systems. However, in real systems, tail performance (e.g., the 99th percentile) tends to matter more than the mean latency. Neo would happily increase P99 latency by a few minutes to cut mean latency by a few seconds – a trade that looks great on paper,&lt;sup id=&quot;fnref:mean&quot;&gt;&lt;a href=&quot;#fn:mean&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; but is often unacceptable in practice.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Regressions are killer.&lt;/strong&gt; Users don’t want their query that was fast today to potentially be slow tomorrow. Reinforcement learning requires exploration to try new ideas, and Neo does exploration the same way that most RL algorithms do: by considering, for each query, a balance between &lt;em&gt;exploiting&lt;/em&gt; existing knowledge to try to get the best plan possible, and &lt;em&gt;exploring&lt;/em&gt; new ideas to try to get better plans in the future. This is a non-starter for a lot of database engineers who would get paged at 3am when the system decided to explore.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We addressed both these concerns in our follow-up work, &lt;a href=&quot;https://rm.cab/bao&quot;&gt;Bao&lt;/a&gt;, which sat on top of an existing query optimizer instead of wholly replacing one. Bao would later lead to a limited deployment at &lt;a href=&quot;https://arxiv.org/abs/2210.13625&quot;&gt;Microsoft&lt;/a&gt; and &lt;a href=&quot;https://rm.cab/autosteer&quot;&gt;Meta&lt;/a&gt;. In Bao’s industrial adoptions, offline execution was used to ensure that a new candidate plan was evaluated before being deployed, mitigating the risk of regressions. My lab at UPenn has started to explore how to best allocate this offline execution budget, at both the &lt;a href=&quot;http://rm.cab/bayesqo&quot;&gt;query level&lt;/a&gt; and the &lt;a href=&quot;http://rm.cab/limeqo&quot;&gt;workload level&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Overall, the future of learned query optimization looks bright. The biggest recent change is, of course, the emergence of LLMs, which have already been integrated into &lt;a href=&quot;https://www.vldb.org/pvldb/vol18/p5031-li.pdf&quot;&gt;query rewriting systems&lt;/a&gt;, &lt;a href=&quot;https://api.zotero.org/users/3604318/publications/items/N7AVH4AL/file/view&quot;&gt;steering systems&lt;/a&gt;, and &lt;a href=&quot;https://arxiv.org/pdf/2508.17556&quot;&gt;RAG-based query optimizers&lt;/a&gt; that learn from their mistakes.&lt;/p&gt;

&lt;h1 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h1&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:sim&quot;&gt;
      &lt;p&gt;Video games, and most traditional RL environments, can also be simulated concurrently, potentially running many simulations in parallel on the same machine. In query optimization, the machine itself is part of the “state” – if you run 8 queries in parallel on the same machine, they will interfere with each other, messing up the reward signal. &lt;a href=&quot;#fnref:sim&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:mean&quot;&gt;
      &lt;p&gt;These improvements look good on paper in the sense that plots of the total workload time improve. Obviously, we’ve wisened up since then, and now regularly report tail latency results. &lt;a href=&quot;#fnref:mean&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Mon, 15 Dec 2025 00:00:00 +0000</pubDate>
        <link>/blog/2025/12/15/neo600.html</link>
        <guid isPermaLink="true">/blog/2025/12/15/neo600.html</guid>
      </item>
    
      <item>
        <title>2024&apos;s hottest topics in databases (a bibliometric approach)</title>
        <description>&lt;link rel=&quot;stylesheet&quot; href=&quot;/blog/assets/hottest_papers/papers.css&quot; /&gt;

&lt;p&gt;From &lt;a href=&quot;https://www.bytebase.com/blog/database-tool-review-2024/&quot;&gt;database
companies&lt;/a&gt; to
&lt;a href=&quot;https://www.cs.cmu.edu/~pavlo/blog/2025/01/2024-databases-retrospective.html&quot;&gt;renowned professor of databaseology Andy
Pavlo&lt;/a&gt;,
everyone seems to be writing their “year in review” of the database world. While
I could never match Andy’s wit nor his no-doubt earnest adoration for Larry
Ellison, I thought I might be able to provide some additional insights into the
hottest topics in database research from a
&lt;a href=&quot;https://en.wikipedia.org/wiki/Bibliometrics&quot;&gt;bibliometric&lt;/a&gt; perspective.&lt;/p&gt;

&lt;p&gt;For the past few years, I’ve maintained a &lt;a href=&quot;https://rmarcus.info/blog/2023/07/25/papers.html&quot;&gt;“ranking” of database researchers and
papers&lt;/a&gt; using the citation
graph and PageRank. We can use the same data to identify papers with the fastest
growing citation counts, which is arguably a reasonable proxy for “hotness.”
Note that these papers are the papers being cited a lot, so they
might represent the &lt;strong&gt;baseline for a particular area, or they might be the first
paper in a line of work, and might not represent the actual “hotness”
themselves.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Below, I’ve organized the 20 papers with the fastest growing non-self-citations.&lt;/p&gt;

&lt;h2 id=&quot;learned-indexes&quot;&gt;Learned indexes&lt;/h2&gt;
&lt;table class=&quot;paper-table&quot;&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Rank&lt;/th&gt;
            &lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;
            &lt;th&gt;Year&lt;/th&gt;
            &lt;th class=&quot;small&quot;&gt;Non-self&lt;br /&gt;Citations&lt;/th&gt;
            &lt;th class=&quot;small&quot;&gt;Per&lt;br /&gt;Year&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;1&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/3183713.3196909&quot;&gt;The Case for Learned Index Structures.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2018&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;142&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;20&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;12&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/3318464.3389711&quot;&gt;ALEX: An Updatable Adaptive Learned Index.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2020&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;59&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;11&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Since Tim Kraska’s paper on learned indexes (written during a sabbatical at
Google, and preceding his &lt;a href=&quot;https://engineering.mit.edu/faculty/tim-kraska/&quot;&gt;subsequent move from Brown to
MIT&lt;/a&gt;), the database community
has been hard at work developing new learned indexes, benchmarking them, and
implementing them into real systems. A &lt;a href=&quot;https://arxiv.org/abs/2403.06456&quot;&gt;recent survey
paper&lt;/a&gt; from Purdue shows just how explosive
the subject has become:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/hottest_papers/lis.svg&quot; alt=&quot;A genealogy tree of learned indexes&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The ALEX paper was (to the best of my knowledge) the first paper to make learned
indexes updatable, leveraging an adaptive tree structure. The first author,
&lt;a href=&quot;https://jialinding.github.io/&quot;&gt;Jialin Ding&lt;/a&gt;, was a PhD student in Kraska’s lab,
and is now &lt;a href=&quot;https://research.princeton.edu/news/board-approves-22-new-faculty-appointments&quot;&gt;faculty at
Princeton&lt;/a&gt;.
Jialin is also the led author on a paper describing &lt;a href=&quot;https://www.amazon.science/publications/automated-multidimensional-data-layouts-in-amazon-redshift&quot;&gt;how multi-dimensional
learned indexes were integrated into AWS
Redshift&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It’s been a while since Kraska’s paper made its initial splash, but (for a
SIGMOD paper) it was surprisingly controversial. Blog posts about &lt;a href=&quot;https://dawnd9.sites.stanford.edu/news/dont-throw-out-your-algorithms-book-just-yet-classical-data-structures-can-outperform-learned&quot;&gt;if we should
throw out our algorithm
textbooks&lt;/a&gt;
or simply &lt;a href=&quot;https://databasearchitects.blogspot.com/2017/12/the-case-for-b-tree-index-structures.html&quot;&gt;use
B-trees&lt;/a&gt;
were everywhere. In my opinion, part of this confusion was because the original
SIGMOD paper did not come with any code. And, if you don’t believe in an idea,
it’s very easy to whip up a crappy implementation. Fortunately, since 2018, we
now have a much better idea &lt;a href=&quot;https://proceedings.mlr.press/v119/ferragina20a&quot;&gt;why learned indexes
work&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;learned-query-optimization&quot;&gt;(Learned) query optimization&lt;/h2&gt;

&lt;table class=&quot;paper-table&quot;&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Rank&lt;/th&gt;
            &lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;
            &lt;th&gt;Year&lt;/th&gt;
            &lt;th class=&quot;small&quot;&gt;Non-self&lt;br /&gt;Citations&lt;/th&gt;
            &lt;th class=&quot;small&quot;&gt;Per&lt;br /&gt;Year&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;2&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://arxiv.org/pdf/1809.00677&quot;&gt;Learned Cardinalities: Estimating Correlated Joins with Deep Learning.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2019&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;124&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;20&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;3&lt;/td&gt;
&lt;td&gt;
        &lt;p&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.14778/3342263.3342644&quot;&gt;Neo: A Learned Query Optimizer.&lt;/a&gt;&lt;sup id=&quot;fnref:me&quot;&gt;&lt;a href=&quot;#fn:me&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
      &lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2019&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;116&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;19&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;4&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.14778/2850583.2850594&quot;&gt;How Good Are Query Optimizers, Really?&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2015&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;188&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;18&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;7&lt;/td&gt;
&lt;td&gt;
        &lt;p&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/3448016.3452838&quot;&gt;Bao: Making Learned Query Optimization Practical.&lt;/a&gt;&lt;sup id=&quot;fnref:me:1&quot;&gt;&lt;a href=&quot;#fn:me&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
      &lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2021&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;57&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;14&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;19&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.14778/3368289.3368296&quot;&gt;An End-to-End Learning-based Cost Estimator.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2019&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;61&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;10&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;20&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/abs/10.14778/3461535.3461552&quot;&gt;Are We Ready For Learned Cardinality Estimation?&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2021&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;42&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;10&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Arguably since the 2001 &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=645927.672349&quot;&gt;IBM Leo
paper&lt;/a&gt;, we’ve been trying to
figure out how to build query optimizers that learn from their mistakes. After
all, if the optimizer chooses a bad query plan, why shouldn’t it pick a better
one next time?&lt;/p&gt;

&lt;p&gt;The database community has been attacking this problem from (at least) three
different directions, each of which is represented in the “hottest” papers:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Using machine learning methods, like deep learning, to replace &lt;strong&gt;cardinality
estimates&lt;/strong&gt;,&lt;/li&gt;
  &lt;li&gt;using semi-supervised or guided learning techniques to replace
&lt;strong&gt;cost models&lt;/strong&gt;,&lt;/li&gt;
  &lt;li&gt;and using &lt;strong&gt;reinforcement learning&lt;/strong&gt; to either replace or steer the query optimization process.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While academics continue to wax poetic about the merits of each approach,
practitioners in industry also made some inroads with learned query optimization,
including a deployment of “steered” optimizers at
&lt;a href=&quot;https://dl.acm.org/doi/10.1145/3514221.3526052&quot;&gt;Microsoft&lt;/a&gt; and
&lt;a href=&quot;https://dl.acm.org/doi/10.14778/3611540.3611544&quot;&gt;Meta&lt;/a&gt;&lt;sup id=&quot;fnref:me:2&quot;&gt;&lt;a href=&quot;#fn:me&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, as well as
integrations of learned performance predictors into AWS Redshift’s &lt;a href=&quot;https://www.amazon.science/publications/intelligent-scaling-in-amazon-redshift&quot;&gt;intelligent
scaling&lt;/a&gt;
and &lt;a href=&quot;https://arxiv.org/abs/2403.02286&quot;&gt;workload manager&lt;/a&gt;&lt;sup id=&quot;fnref:me:3&quot;&gt;&lt;a href=&quot;#fn:me&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;The classic “How Good Are Query Optimizers, Really?” paper also makes an
appearance, as the use of the join order benchmark (JOB) has become ubiquitous
in query optimization research. Of course, this is also a seminal paper in query
optimization!&lt;/p&gt;

&lt;h2 id=&quot;dbms-engines&quot;&gt;DBMS engines&lt;/h2&gt;

&lt;table class=&quot;paper-table&quot;&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Rank&lt;/th&gt;
            &lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;
            &lt;th&gt;Year&lt;/th&gt;
            &lt;th class=&quot;small&quot;&gt;Non-self&lt;br /&gt;Citations&lt;/th&gt;
            &lt;th class=&quot;small&quot;&gt;Per&lt;br /&gt;Year&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;5&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/2723372.2742797&quot;&gt;Spark SQL: Relational Data Processing in Spark.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2015&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;172&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;17&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;6&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/1807167.1807184&quot;&gt;Pregel: a system for large-scale graph processing.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2010&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;214&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;14&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;10&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/2882903.2903741&quot;&gt;The Snowflake Elastic Data Warehouse.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2016&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;102&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;11&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;11&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://www.microsoft.com/en-us/research/wp-content/uploads/2013/06/Hekaton-Sigmod2013-final.pdf&quot;&gt;Hekaton: SQL server&amp;apos;s memory-optimized OLTP engine.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2013&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;138&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;11&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;13&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/3035918.3056101&quot;&gt;Amazon Aurora: Design Considerations for High Throughput Cloud-Native Relational Databases.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2017&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;94&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;11&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;16&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/3299869.3320212&quot;&gt;DuckDB: an Embeddable Analytical Database.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2019&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;65&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;10&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;18&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.14778/2002938.2002940&quot;&gt;Efficiently Compiling Efficient Query Plans for Modern Hardware.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2011&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;151&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;10&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The execution model and engines of DBMSes will always be a core part of the
database community’s interests. Recently, researchers have started to build on
“new” foundations!&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Papers building on Spark SQL continue to emphasize ease-of-use and
compatibility with distributed and open source (mostly Apache) runtimes.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Papers building on Pregel continue to tackle graph database problems, which is
far from solved – graph databases are interesting because they seem to warrant
both a new query language and a new execution model.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Papers building on Hekaton continue to push the boundaries of in-memory data
processing, often integrating &lt;a href=&quot;https://en.wikipedia.org/wiki/In-memory_processing&quot;&gt;PIM
elements&lt;/a&gt; or pushing the
performance envelope.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The database community’s obsession with clouds continues to show in works
building off of Snowflake and Aurora.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Perhaps most notably, at least from my perspective, is the most-recent addition,
DuckDB. For a long time, vectorized out-of-core&lt;sup id=&quot;fnref:monet&quot;&gt;&lt;a href=&quot;#fn:monet&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; analytics databases were
only available as proprietary products (like Vertica) or locked away in TU
Munich’s code repositories (like Hyper, which was eventually sold to Tableau,
then Salesforce). DuckDB not only provides a state-of-the-art implementation of
a vectorized database, but also packages it up as an easy-to-use, embedded tool.
As a result, DuckDB has become the de facto testbed for implementing new OLAP
techniques, like new research on &lt;a href=&quot;https://www.vldb.org/pvldb/vol17/p1350-justen.pdf&quot;&gt;join
ordering&lt;/a&gt; or &lt;a href=&quot;https://arxiv.org/abs/2405.11988&quot;&gt;confidential
computing&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;ml-powered-system-tuning&quot;&gt;ML-powered system tuning&lt;/h2&gt;

&lt;table class=&quot;paper-table&quot;&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Rank&lt;/th&gt;
            &lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;
            &lt;th&gt;Year&lt;/th&gt;
            &lt;th class=&quot;small&quot;&gt;Non-self&lt;br /&gt;Citations&lt;/th&gt;
            &lt;th class=&quot;small&quot;&gt;Per&lt;br /&gt;Year&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;8&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/3035918.3064029&quot;&gt;Automatic Database Management System Tuning Through Large-scale Machine Learning.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2017&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;109&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;13&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;17&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/3299869.3300085&quot;&gt;An End-to-End Automatic Cloud Database Tuning System Using Deep Reinforcement Learning.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2019&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;60&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;10&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Databases have knobs. Lots and lots of knobs. Whether it’s the classic
PostgreSQL &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shared_buffers&lt;/code&gt; or something more obscure like Vertica’s resource
pools, getting the knobs set to the “right” values for your workload has always
been an essential performance tuning step.&lt;/p&gt;

&lt;p&gt;The two hottest papers in this category both represent machine learning powered
techniques, either using reinforcement learning or Bayesian optimization. The
approaches building on these two works have made a lot of progress in both cloud
and on-premises environments. Of particular note is the
&lt;a href=&quot;https://arxiv.org/abs/2112.10925&quot;&gt;DB-BERT&lt;/a&gt; line of work from &lt;a href=&quot;https://itrummer.github.io/&quot;&gt;Immanuel
Trummer’s&lt;/a&gt; lab at Cornell, which integrates LLMs
into the already-ML heavy area, resulting in a database tuner that can, almost
literally, “read the manual.”&lt;/p&gt;

&lt;h2 id=&quot;data-cleaning-and-matching&quot;&gt;Data cleaning and matching&lt;/h2&gt;

&lt;table class=&quot;paper-table&quot;&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Rank&lt;/th&gt;
            &lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;
            &lt;th&gt;Year&lt;/th&gt;
            &lt;th class=&quot;small&quot;&gt;Non-self&lt;br /&gt;Citations&lt;/th&gt;
            &lt;th class=&quot;small&quot;&gt;Per&lt;br /&gt;Year&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;9&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.14778/3421424.3421431&quot;&gt;Deep Entity Matching with Pre-Trained Language Models.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2020&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;66&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;13&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;14&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.14778/3137628.3137631&quot;&gt;HoloClean: Holistic Data Repairs with Probabilistic Inference.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2017&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;90&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;11&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;numeric&quot;&gt;15&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;https://dl.acm.org/doi/10.1145/3183713.3196926&quot;&gt;Deep Learning for Entity Matching: A Design Space Exploration.&lt;/a&gt;&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;2018&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;71&lt;/td&gt;
            &lt;td class=&quot;numeric&quot;&gt;10&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Database systems are only as useful as the data they contain! Garbage in,
garbage out. Tools for data cleaning and entity matching are critical for
bringing structure to chaos, enabling analysis and hopefully dredging up some of
that good good Actionable Business Insight we love to talk about.&lt;/p&gt;

&lt;p&gt;The prevailing trend, as you might imagine, is integrating LLMs and other recent
ML inventions into traditional data cleaning and matching tools. While the
latency of these systems still leaves something to be desired, the accuracy
provided by these new LLM-enabled tools is sometimes orders of magnitude ahead
of what we could do before.&lt;/p&gt;

&lt;p&gt;Some good examples of this trend include &lt;a href=&quot;https://knight-hennessy.stanford.edu/people/avanika-narayan&quot;&gt;Avanika
Narayan&lt;/a&gt;’s work in
&lt;a href=&quot;https://cs.stanford.edu/~chrismre/&quot;&gt;Chris Re’s lab&lt;/a&gt;, which show that &lt;a href=&quot;https://www.vldb.org/pvldb/vol16/p738-narayan.pdf&quot;&gt;LLMs
(“foundation models”) are quite effective at a number of data wrangling
tasks&lt;/a&gt;. A slightly more
involved approach is &lt;a href=&quot;https://nantang.github.io/publications/&quot;&gt;Nan Tang&lt;/a&gt;’s
recent paper on &lt;a href=&quot;https://arxiv.org/pdf/2012.02469&quot;&gt;relational pre-trained
transformer&lt;/a&gt; (which is apparently almost all
you need), which is directly trained for data cleaning tasks and can even
operate on complex, non-1NF types like JSON (but we always put our databases
into 3NF, right?).&lt;/p&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next?&lt;/h2&gt;

&lt;p&gt;Another year goes by and databases get a little faster, a little cleaner, a
little easier to use, and a little smarter. Maybe next year the
&lt;a href=&quot;https://datafusion.apache.org/&quot;&gt;DataFusion&lt;/a&gt; team or the DuckDB team will make
them a little cheaper! But nobody tell the VCs.&lt;/p&gt;

&lt;p&gt;Perhaps you want to hear the no-doubt enlightened opinion of me, your humble
author? Well, I think smarter, faster, cheaper, and more accessible databases
are great, but how come nobody is looking into making databases more polite?
Look what happens if I misspell &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WHERE&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;imdb=# select count(*) from title were production_year=2022;
ERROR:  syntax error at or near &quot;production_year&quot;
LINE 1: select count(*) from title were production_year=2022;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Frankly &lt;em&gt;rude&lt;/em&gt; – no respect from PostgreSQL here. I guess if Mike Stonebraker
raised me in a basement at Berkeley in the 80s, I might also be missing a few
“pleases” and “thank yous” around the edges. Or maybe the &lt;a href=&quot;https://www.jfsowa.com/ikl/Stonebraker.pdf&quot;&gt;middle is already
hollow and the papers are all
diarrhea&lt;/a&gt;, what do I know?&lt;/p&gt;

&lt;p&gt;(If you &lt;em&gt;actually&lt;/em&gt; want to know what I’ve been up to, check out our &lt;a href=&quot;https://rm.cab/limeqo&quot;&gt;latest work
on offline query optimization&lt;/a&gt; – SIGMOD papers coming soon!)&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:me&quot;&gt;
      &lt;p&gt;I am an author of this paper. &lt;a href=&quot;#fnref:me&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt; &lt;a href=&quot;#fnref:me:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt; &lt;a href=&quot;#fnref:me:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;3&lt;/sup&gt;&lt;/a&gt; &lt;a href=&quot;#fnref:me:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;4&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:monet&quot;&gt;
      &lt;p&gt;MonetDB is arguably an exception to this claim, since MonetDB could &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mmap&lt;/code&gt; larger-than-memory chunks, but I think it is reasonable to categorize MonetDB as a &lt;em&gt;mostly&lt;/em&gt; in-memory analytics database. &lt;a href=&quot;#fnref:monet&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Fri, 28 Mar 2025 00:00:00 +0000</pubDate>
        <link>/blog/2025/03/28/hottest-db-topics.html</link>
        <guid isPermaLink="true">/blog/2025/03/28/hottest-db-topics.html</guid>
      </item>
    
      <item>
        <title>Related work search for database papers</title>
        <description>&lt;link rel=&quot;stylesheet&quot; href=&quot;/blog/assets/relatedwork/relatedwork.css&quot; /&gt;

&lt;p&gt;This tool takes your paper’s title and abstract, and searches past VLDB, PODS,
SIGMOD, and CIDR papers for potential related work. Obviously, this tool does
not replace a thorough literature review, but it can help you find papers you
might have missed.&lt;/p&gt;

&lt;p&gt;Names that are &lt;span class=&quot;pc&quot;&gt;highlighted&lt;/span&gt; are on the VLDB or SIGMOD
program committee.&lt;/p&gt;

&lt;h1 id=&quot;search-related-work&quot;&gt;Search related work&lt;/h1&gt;

&lt;div id=&quot;search-widget&quot;&gt;
  &lt;div id=&quot;title-bar&quot;&gt;&lt;label for=&quot;title&quot;&gt;Title:&lt;/label&gt; &lt;input id=&quot;title&quot; value=&quot;Benchmarking Learned Indexes&quot; type=&quot;text&quot; /&gt;&lt;/div&gt;
  &lt;div&gt;&lt;label for=&quot;abstract&quot;&gt;Abstract:&lt;/label&gt; &lt;textarea id=&quot;abstract&quot;&gt;
Recent advancements in learned index structures propose replacing existing index structures, like B-Trees, with approximate learned models. In this work, we present a unified benchmark that compares well-tuned implementations of three learned index structures against several state-of-the-art “traditional” baselines. Using four real-world datasets, we demonstrate that learned index structures can indeed outperform non-learned indexes in read-only in-memory workloads over a dense array. We investigate the  impact of caching, pipelining, dataset size, and key size. We study the performance profile of learned index structures, and build an explanation for why learned models achieve such good performance. Finally, we investigate other important properties of learned index structures, such as their performance in multi-threaded systems and their build times.
  &lt;/textarea&gt;&lt;/div&gt;
  &lt;div id=&quot;search-bar&quot;&gt;&lt;input id=&quot;search-go&quot; type=&quot;button&quot; value=&quot;Search&quot; /&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id=&quot;results&quot;&gt;
    &lt;div id=&quot;high-results&quot; style=&quot;display: none;&quot;&gt;
        &lt;h2&gt;Highly relevant&lt;/h2&gt;
    &lt;/div&gt;
    &lt;div id=&quot;med-results&quot; style=&quot;display: none;&quot;&gt;
        &lt;h2&gt;Somewhat relevant&lt;/h2&gt;
    &lt;/div&gt;
    &lt;div id=&quot;low-results&quot; style=&quot;display: none;&quot;&gt;
        &lt;h2&gt;Tangentially relevant&lt;/h2&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;h1 id=&quot;how-it-works&quot;&gt;How it works&lt;/h1&gt;

&lt;p&gt;This tool embeds prior database papers and stores the embeddings in a search
index. When you enter your own title and abstract, the tool computes the
embeddings for your paper and searches the index for similar papers. Relevant
results are then explained and categorized by an OpenAI model (currently
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gpt-4o-mini&lt;/code&gt;).&lt;/p&gt;

&lt;script src=&quot;/blog/assets/relatedwork/relatedwork.js&quot;&gt;&lt;/script&gt;

</description>
        <pubDate>Sun, 02 Feb 2025 00:00:00 +0000</pubDate>
        <link>/blog/2025/02/02/related-work.html</link>
        <guid isPermaLink="true">/blog/2025/02/02/related-work.html</guid>
      </item>
    
      <item>
        <title>Ten years of improvements in PostgreSQL&apos;s optimizer</title>
        <description>&lt;p&gt;As a query optimization researcher, I’ve spent the last 10 years of my life playing with, learning from, and building on top of the most sophisticated open source query optimizer out there, &lt;a href=&quot;https://postgresql.org&quot;&gt;PostgreSQL&lt;/a&gt;. I recently wondered how much PostgreSQL had improved over the decade since I started working on databases. While changelogs and opinion pieces were plentiful, I couldn’t find any strong empirical comparisons, so I decided to run the &lt;a href=&quot;https://www.vldb.org/pvldb/vol9/p204-leis.pdf&quot;&gt;join order benchmark&lt;/a&gt; (JOB)&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; on PostgreSQL 8 through 16. I recorded the 90th percentile query latency for each database version.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/pg_over_time/job.svg&quot; alt=&quot;Graph of P90 tail latency for different PostgreSQL versions. Speed improves drastically over time.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I built each version&lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; of PostgreSQL using GCC 13.2 inside a Docker container with Arch Linux. Since I wanted to measure the quality of the query optimizer, and not index/IO performance, I set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shared_buffers&lt;/code&gt; to 8GB (large enough to hold the entire database). I also set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work_mem&lt;/code&gt; to 8MB for all versions. Each query is executed once to warm the cache, then the median latency of 5 additional runs in recorded.&lt;/p&gt;

&lt;p&gt;Overall, &lt;strong&gt;PostgreSQL’s tail performance has improved drastically&lt;/strong&gt;, although versions 13 through 16 have been mostly stable. Comparing version 8 to version 16, &lt;strong&gt;PostgreSQL has dropped tail latency by nearly half in the last 10 years!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can also investigate the entire query distribution (note the log scale):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/pg_over_time/box.svg&quot; alt=&quot;Box plots of query latency for each major version. There is a slight slope downwards.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We can use regression analysis to (1) confirm that the downward slope in latency is significant, and (2) quantify how much improvement is brought by each version of PostgreSQL. If we regress the PostgreSQL major version number against query latency, we see that each new major version of PostgreSQL brings, on average, a &lt;strong&gt;15% performance improvement&lt;/strong&gt; on the Join Order Benchmark (&lt;span id=&quot;il178&quot;&gt;&lt;/span&gt;). However, a linear model is arguably a poor measure of the change (&lt;span id=&quot;il179&quot;&gt;&lt;/span&gt;).&lt;/p&gt;

&lt;p&gt;Of course, not all of these improvements are attributable to the query optimizer. Improvements to the execution engine – from parallel workers to just-in-time (JIT) compilation – also play a role. It would be interesting to investigate how each query plan in JOB has changed over the year… maybe next time!&lt;/p&gt;

&lt;p&gt;Quantifying the improvement aside:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Upgrade your database! Going from PostgreSQL 8 to 16 has the potential to massively improve your workload’s tail latency.&lt;/li&gt;
  &lt;li&gt;Researchers should note that PostgreSQL is a bit of a moving target. Learned query optimization research has compared with different versions of PostgreSQL over time (e.g., Neo and Bao compare with version 11, whereas newer work compare with version 14, 15, or 16.) So just because an older technique improves on PostgreSQL by 30%, and a newer technique only improves on PostgreSQL by 25%, the newer technique may be comparing against a stronger PostgreSQL.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also check out &lt;a href=&quot;/blog/assets/pg_over_time/job_pg.csv&quot;&gt;the raw data&lt;/a&gt; for yourself.&lt;/p&gt;

&lt;h2 id=&quot;notes&quot;&gt;Notes&lt;/h2&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;The join order benchmark is a set of complex queries with many joins. The benchmark was introduced in the seminal paper “&lt;a href=&quot;https://www.vldb.org/pvldb/vol9/p204-leis.pdf&quot;&gt;How Good are Query Optimizers, Really?&lt;/a&gt;”, in which the authors showcase the difficult nature of the join order benchmark. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
      &lt;p&gt;I used the most recent minor version for each major version of PostgreSQL. For example, for PostgreSQL 8, I used version 8.4.22. These minor versions are often released after new major versions are available, but generally only contain bug fixes (not new features or performance improvements). &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Fri, 12 Apr 2024 00:00:00 +0000</pubDate>
        <link>/blog/2024/04/12/pg-over-time.html</link>
        <guid isPermaLink="true">/blog/2024/04/12/pg-over-time.html</guid>
      </item>
    
      <item>
        <title>Most influential database papers</title>
        <description>&lt;link rel=&quot;stylesheet&quot; href=&quot;/blog/assets/pagerank-papers/pagerank.css&quot; /&gt;

&lt;p&gt;Ever wondered which database systems papers have been the most influential? This page explores the PageRank of a paper in the citation graph, one possible measure of influence.&lt;/p&gt;

&lt;p class=&quot;very-emph-box&quot;&gt;
    This blog post has been replaced by &lt;a href=&quot;https://rmarcus.info/dbscholar&quot;&gt;DBScholar&lt;/a&gt;, which uses its own metadata extraction pipeline instead of the (now defunct) APIs used in this post.
&lt;/p&gt;

&lt;p&gt;All rankings, including this one, &lt;a href=&quot;https://jeffhuang.com/computer-science-open-data/#bias-in-computer-science-rankings&quot;&gt;codify an ideology&lt;/a&gt; and thus won’t match up with everyone’s understanding of “influence.” Most notably, this ranking has nothing to do with industrial adoption, actual usage, or quality of an idea, other than by correlation with citation. Note that the citation graph grows every year, so papers published more recently will, on average, have a lower score.&lt;/p&gt;

&lt;p&gt;PageRank is computed with the Python package &lt;a href=&quot;https://networkx.org/&quot;&gt;NetworkX&lt;/a&gt; on top of the citation graph of all SIGMOD, VLDB, CIDR, and PODS papers. Self-citations are excluded. Absolute and percentile ranks are then computed for each paper using the PageRank score. Authors are ranked according to the sum of their paper’s PageRank score, where each paper’s score is divided by the number of authors, similar to &lt;a href=&quot;https://csrankings.org/faq.html&quot;&gt;CSRankings&lt;/a&gt;. Click one of the links below to explore the ranking!&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#papers-all-time&quot;&gt;Most influential papers of all time&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#papers-by-year&quot;&gt;Most influential papers by year&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#people-anchor&quot;&gt;Most influential researchers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Latest update: Mar 4th, 2025.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;papers-all-time&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;most-influential-papers-of-all-time&quot;&gt;Most influential papers of all time&lt;/h2&gt;

&lt;p&gt;This is a list of all papers, sorted by their PageRank score. Search papers by title using the text box below.&lt;/p&gt;

&lt;p&gt;&lt;input type=&quot;text&quot; id=&quot;paper-search&quot; placeholder=&quot;Search for papers...&quot; /&gt;
&lt;select style=&quot;float: right;&quot; id=&quot;since-selector&quot;&gt;
  &lt;option selected=&quot;selected&quot; value=&quot;1900&quot;&gt;All time&lt;/option&gt;
  &lt;option value=&quot;2010&quot;&gt;Since 2010&lt;/option&gt;
  &lt;option value=&quot;2015&quot;&gt;Since 2015&lt;/option&gt;
  &lt;option value=&quot;2020&quot;&gt;Since 2020&lt;/option&gt;
&lt;/select&gt;&lt;/p&gt;
&lt;table id=&quot;papers&quot;&gt;
  &lt;!--&lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Rank&lt;/th&gt;
      &lt;th&gt;Title&lt;/th&gt;
      &lt;th&gt;%&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;--&gt;
  &lt;tbody&gt;
    &lt;noscript&gt;Sorry, you&apos;ll need JavaScript to view the data on this page.&lt;/noscript&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;a id=&quot;papers-by-year&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;most-influential-papers-by-year&quot;&gt;Most influential papers, by year&lt;/h2&gt;

&lt;p&gt;This is a list of papers published in a particular year, sorted by their PageRank score. You can select a different year from the dropdown. Papers published in recent years have fewer citations, and thus more noise in their score.&lt;/p&gt;

&lt;div id=&quot;top3&quot;&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a id=&quot;people-anchor&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;most-influential-people&quot;&gt;Most influential people&lt;/h2&gt;

&lt;p&gt;This table ranks all authors of a paper that has been cited at least once (by another paper). An author’s score is the sum of their paper’s normalized PageRank score. The normalized PageRank score of a paper is the PageRank score of the paper divided by the number of authors on the paper.&lt;/p&gt;

&lt;p&gt;Due to the exponential distribution of PageRank scores, the most influential papers have significantly higher scores than the median paper. As a result, authors of the most influential papers will rank highly here, even if they have few papers overall.&lt;/p&gt;

&lt;p&gt;&lt;input type=&quot;text&quot; id=&quot;people-search&quot; placeholder=&quot;Search for people...&quot; /&gt;&lt;/p&gt;
&lt;table class=&quot;ranking-table&quot;&gt;
  &lt;!--&lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Rank&lt;/th&gt;
      &lt;th&gt;Title&lt;/th&gt;
      &lt;th&gt;%&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;--&gt;
  &lt;tbody id=&quot;people&quot;&gt;
    &lt;noscript&gt;Sorry, you&apos;ll need JavaScript to view the data on this page.&lt;/noscript&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;div id=&quot;person-view&quot;&gt;
  &lt;h2 id=&quot;person-view-name&quot;&gt;&lt;/h2&gt;
  &lt;div id=&quot;person-stats&quot;&gt;
    &lt;div id=&quot;person-rank&quot;&gt;&lt;/div&gt;
    &lt;div id=&quot;person-prank&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;trophy-case&quot;&gt;
    &lt;ul id=&quot;person-trophy&quot;&gt;&lt;/ul&gt;
  &lt;/div&gt;
  &lt;table class=&quot;ranking-table&quot; id=&quot;person-view-table&quot;&gt;
  &lt;tbody id=&quot;person-view-papers&quot;&gt;
    &lt;noscript&gt;Sorry, you&apos;ll need JavaScript to view the data on this page.&lt;/noscript&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;div id=&quot;paper-view&quot; style=&quot;display: none;&quot;&gt;
  &lt;h2 id=&quot;paper-view-title&quot;&gt;&lt;/h2&gt;
  &lt;p id=&quot;paper-view-summary&quot;&gt;&lt;/p&gt;
  &lt;div id=&quot;paper-rank&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;paper-prank&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;paper-rank-year&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;paper-rank-venue&quot;&gt;&lt;/div&gt;
  &lt;div&gt;
   &lt;span id=&quot;paper-venue&quot;&gt;&lt;/span&gt;
   &lt;span id=&quot;paper-year&quot;&gt;&lt;/span&gt;
  &lt;/div&gt;
  &lt;div id=&quot;paper-doi&quot;&gt;&lt;/div&gt;
  &lt;h3&gt;Incoming citations (&lt;span id=&quot;paper-incoming-count&quot;&gt;&lt;/span&gt;)&lt;/h3&gt;
  &lt;table class=&quot;ranking-table&quot;&gt;
    &lt;tbody id=&quot;paper-view-incoming&quot;&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;h3&gt;Outgoing citations (&lt;span id=&quot;paper-outgoing-count&quot;&gt;&lt;/span&gt;)&lt;/h3&gt;
  &lt;table class=&quot;ranking-table&quot;&gt;
    &lt;tbody id=&quot;paper-view-outgoing&quot;&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;h3&gt;Similar papers&lt;/h3&gt;
  &lt;table class=&quot;ranking-table&quot;&gt;
    &lt;tbody id=&quot;paper-view-related&quot;&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h1 id=&quot;notes&quot;&gt;Notes&lt;/h1&gt;

&lt;p&gt;PageRank is computed with &lt;span id=&quot;il175&quot;&gt;&lt;/span&gt; and with the initial weight for each paper &lt;span id=&quot;il176&quot;&gt;&lt;/span&gt; set to &lt;span id=&quot;il177&quot;&gt;&lt;/span&gt;. These hyperparameters come from:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Walker, Dylan, Huafeng Xie, Koon-Kiu Yan, and Sergei Maslov. “Ranking scientific publications using a model of network traffic.” Journal of Statistical Mechanics: Theory and Experiment 2007, no. 06 (2007): P06010.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;script src=&quot;/blog/assets/pagerank-papers/lodash.min.js&quot;&gt;&lt;/script&gt;

&lt;script src=&quot;/blog/assets/pagerank-papers/fuzzysort.min.js&quot;&gt;&lt;/script&gt;

&lt;script src=&quot;/blog/assets/pagerank-papers/index.js&quot;&gt;&lt;/script&gt;

</description>
        <pubDate>Tue, 25 Jul 2023 00:00:00 +0000</pubDate>
        <link>/blog/2023/07/25/papers.html</link>
        <guid isPermaLink="true">/blog/2023/07/25/papers.html</guid>
      </item>
    
      <item>
        <title>Generating bios with large language models</title>
        <description>
&lt;style&gt;
#search-widget{background-color:#ffefef;padding:15px 15px 15px 15px;border-style:dashed;border-width:3px;border-color:#804515}#search-bar{display:flex;align-items:center;justify-content:space-around}#search-widget input[type=text]{height:24px;padding-left:4px;padding-top:2px;padding-bottom:2px;padding-right:2px;width:70%}#search-widget input[type=button]{transition-duration:.2s;background-color:#804515;color:#fff;border:2px #804515 solid;padding:8px 15px 8px 15px;text-align:center;display:inline-block;font-size:12pt;font-family:monospace}#search-widget input[type=button]:hover{text-align:center;background-color:#fff;color:#000;cursor:pointer}
&lt;/style&gt;

&lt;p&gt;&lt;em&gt;Update March 19th, 2024: this page now uses the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gpt-3.5-turbo&lt;/code&gt; model.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It’s the holiday season of 2022, and everyone is talking about large language models! &lt;a href=&quot;https://openai.com/api/&quot;&gt;OpenAI’s GPT-3&lt;/a&gt; and others are generating quite a bit of interest in the CS research community. Larger datasets and models are significantly improving results on many NLP tasks. Even in databases (my field), large language models are being used to &lt;a href=&quot;http://vldb.org/pvldb/vol14/p1159-trummer.pdf&quot;&gt;tune databases&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/2204.00498&quot;&gt;translate natural language to SQL&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Large language models are so good, some folks are &lt;a href=&quot;https://www.businessinsider.com/suspended-google-engineer-says-sentient-ai-hired-lawyer-2022-6&quot;&gt;tricking themselves into thinking&lt;/a&gt; that large language models are sentient. It is important to remember that &lt;a href=&quot;https://dl.acm.org/doi/pdf/10.1145/3442188.3445922&quot;&gt;there is no there there&lt;/a&gt; – GPT-3 and the like only model the distribution of the next word given the previous word.&lt;sup id=&quot;fnref:brain&quot;&gt;&lt;a href=&quot;#fn:brain&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; As a result, large language models can at times easily produce misinformation, state biased viewpoints, or conjure total nonsense!&lt;/p&gt;

&lt;p&gt;Let’s try it out. Enter the name of a computer scientist below to search for their DBLP entry. Click their name to ask GPT-3 to generate a bio for them using a list of their citations as an input.&lt;/p&gt;

&lt;div id=&quot;search-widget&quot;&gt;
    &lt;div id=&quot;search-bar&quot;&gt;
        &lt;input id=&quot;bio-search&quot; value=&quot;Ryan Marcus&quot; type=&quot;text&quot; /&gt;
        &lt;input id=&quot;bio-search-go&quot; type=&quot;button&quot; value=&quot;Search&quot; /&gt;
    &lt;/div&gt;
    &lt;div id=&quot;bio-search-results&quot;&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;blockquote&gt;
&lt;div id=&quot;bio-results&quot;&gt;&lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;A standalone version of this bio generator is available at &lt;a href=&quot;https://bio.rmarcus.info&quot;&gt;https://bio.rmarcus.info&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In order to generate a bio, we fetch the 15 most recent publications for the author from DBLP, and then ask GPT-3 to complete the following text (“prompt”):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Given the below list of publications, produce a short summary of the research of {name}. Use succinct language when possible. Focus on common themes across all of their works. Do not enumerate specific topics or papers. Don&apos;t use phrases like &quot;such as&quot; or &quot;including.&quot; Do not include specific dates, conferences, venues, or journals. Use gender-neutral language.

{publication list}

Bio: 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So GPT-3 starts generating text after &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Bio:&lt;/code&gt;, which normally results in some plausible descriptions of researchers. However, the model can certainly make mistakes. For example, despite the instruction to use gender-neutral language, the language model still outputs the pronoun “he” for &lt;a href=&quot;https://people.csail.mit.edu/tatbul/&quot;&gt;Nesime Tatbul&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Nesime Tatbul is a computer scientist and researcher. His work focuses on machine programming, query optimization, explainable anomaly detection, cloud observability, and other topics related to data management. He has been involved in multiple projects, from developing a benchmarking platform for explainable anomaly detection to creating a pluggable metrics storage engine for the age of observability.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Additionally, despite being instructed not to list specific projects or papers, the model frequently does exactly that. This is somewhat understandable, since it might be impossible to determine an author’s general subfield from only their 15 more recent publications.&lt;/p&gt;

&lt;p&gt;Because large language models are prone to produce bias, capable of producing nonsense, and are generally unpredictable, you probably shouldn’t use them in any “real” application yet. But that doesn’t mean you can’t play around with them and have fun! If you haven’t tried out ChatGPT, give it a shot here: &lt;a href=&quot;https://chat.openai.com&quot;&gt;https://chat.openai.com&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h1&gt;

&lt;script&gt;document.addEventListener(&quot;DOMContentLoaded&quot;,function(){let searchField=document.getElementById(&quot;bio-search&quot;),searchButton=document.getElementById(&quot;bio-search-go&quot;),searchResults=document.getElementById(&quot;bio-search-results&quot;),bioResults=document.getElementById(&quot;bio-results&quot;);function searchFor(q){searchResults.innerHTML=&quot;Loading...&quot;,bioResults.innerHTML=&quot;&quot;;q=new URLSearchParams({q:q});fetch(&quot;https://rmarcus.info/bioapi/search?&quot;+q).then(r=&gt;r.json()).then(r=&gt;{searchResults.innerHTML=&quot;&quot;;var header=document.createElement(&quot;p&quot;),resultList=(header.appendChild(document.createTextNode(&quot;Search results:&quot;)),searchResults.appendChild(header),document.createElement(&quot;ol&quot;));for(let el of r){var resultNode=document.createElement(&quot;li&quot;),bioLinkNode=document.createElement(&quot;a&quot;),bioLinkNode=(bioLinkNode.setAttribute(&quot;href&quot;,&quot;#0&quot;),bioLinkNode.addEventListener(&quot;click&quot;,()=&gt;{return pid=el.url,pid=new URLSearchParams({pid:pid}),searchResults.innerHTML=&quot;&quot;,bioResults.innerHTML=&quot;Loading...&quot;,void fetch(&quot;https://rmarcus.info/bioapi/bio?&quot;+pid).then(r=&gt;r.json()).then(r=&gt;{bioResults.innerHTML=&quot;&quot;;var header=document.createElement(&quot;h3&quot;),header=(header.appendChild(document.createTextNode(&quot;Generated bio for &quot;+r.name)),bioResults.appendChild(header),document.createElement(&quot;p&quot;)),header=(header.appendChild(document.createTextNode(r.bio)),bioResults.appendChild(header),document.createElement(&quot;a&quot;));header.setAttribute(&quot;href&quot;,&quot;https://dblp.org/&quot;+r.pid),header.setAttribute(&quot;target&quot;,&quot;_blank&quot;),header.appendChild(document.createTextNode(&quot;DBLP&quot;)),bioResults.appendChild(header),console.log(r)});var pid}),bioLinkNode.appendChild(document.createTextNode(el.name)),resultNode.appendChild(bioLinkNode),null!==el.alias&amp;&amp;resultNode.appendChild(document.createTextNode(&quot; (a.k.a. &quot;+el.alias+&quot;) &quot;)),resultNode.appendChild(document.createTextNode(&quot; (or go to &quot;)),document.createElement(&quot;a&quot;));bioLinkNode.setAttribute(&quot;href&quot;,&quot;https://dblp.org/&quot;+el.url),bioLinkNode.setAttribute(&quot;target&quot;,&quot;_blank&quot;),bioLinkNode.appendChild(document.createTextNode(&quot;DBLP&quot;)),resultNode.appendChild(bioLinkNode),resultNode.appendChild(document.createTextNode(&quot;)&quot;)),resultList.appendChild(resultNode)}searchResults.appendChild(resultList)})}searchButton.addEventListener(&quot;click&quot;,function(){searchFor(searchField.value)}),searchField.addEventListener(&quot;keypress&quot;,function(event){&quot;Enter&quot;===event.key&amp;&amp;(event.preventDefault(),searchButton.click())})});
&lt;/script&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:brain&quot;&gt;
      &lt;p&gt;A portion of the machine learning community subscribes to the belief that human beings are similar to such models (“there is no ghost in the machine”). We simply map inputs to outputs, and our consciousness is a manifested illusion. Once we multiply sufficiently large matrices together, AGI is achieved! I’m not an expert here, so I’ve gone with my intuition, which is that we are at least not &lt;em&gt;entirely&lt;/em&gt; stochastic machines. &lt;a href=&quot;#fnref:brain&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
        <link>/blog/2022/12/20/instant-bio.html</link>
        <guid isPermaLink="true">/blog/2022/12/20/instant-bio.html</guid>
      </item>
    
      <item>
        <title>Applying Bao to distributed systems</title>
        <description>&lt;p&gt;&lt;em&gt;This post was also published on the &lt;a href=&quot;https://learnedsystems.mit.edu/bao-distributed/&quot;&gt;MIT DSAIL blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A good portion of my postdoc at MIT has been spent developing &lt;a href=&quot;https://rm.cab/bao&quot;&gt;Bao&lt;/a&gt;, a system for learned query optimization with an eye towards practicality.  Bao was recently published at SIGMOD 2021, where we were thrilled to receive a &lt;a href=&quot;https://2021.sigmod.org/sigmod_best_papers.shtml&quot;&gt;best paper award&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In our paper, we show how Bao can be applied to the open-source &lt;a href=&quot;https://www.postgresql.org/&quot;&gt;PostgreSQL DBMS&lt;/a&gt;, as well as an &lt;a href=&quot;https://en.wikipedia.org/wiki/David_DeWitt&quot;&gt;unnamed&lt;/a&gt; commercial system. Both DBMSes ran in a traditional, single-node environment. Here, we’ll give a brief overview of the Bao system and then walk through our early attempts at applying Bao to commercial, cloud-based, distributed database management systems.&lt;/p&gt;

&lt;p&gt;For more information on Bao in the traditional, single-node context, check out:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://rm.cab/bao&quot;&gt;Our research paper&lt;/a&gt;, published in SIGMOD 2021.&lt;/li&gt;
  &lt;li&gt;For a video overview, the recording of Ryan’s SIGMOD talk (&lt;a href=&quot;https://www.youtube.com/watch?v=nEy90-WNkjo&quot;&gt;20 minute version&lt;/a&gt; or &lt;a href=&quot;https://www.youtube.com/watch?v=-tvt8QzZcXM&quot;&gt;3 minute version&lt;/a&gt;).&lt;/li&gt;
  &lt;li&gt;For an overview of tree convolution as applied to query plans, Ryan’s &lt;a href=&quot;https://www.youtube.com/watch?v=g4iiDVWtQZo&quot;&gt;AIDB 2019 talk&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, since we wrote the paper almost a year ago, much has happened. First, We worked together with Microsoft to explore how Bao can help with Big Data workloads. 
This work will also be presented at SIGMOD as part of the industry session, and received a honorable mention for the industry best paper award.&lt;/p&gt;

&lt;p&gt;Second, after the discussion we had with Mike Stonebraker around the potential impact Bao could have on distributed database warehouse systems (obviously, he was very skeptical), we ran a whole range of additional experiments on Vertica, Redshift, and Azure Synapse using a real-world dataset we received from an anonymous corporation.&lt;/p&gt;

&lt;h1 id=&quot;how-bao-works&quot;&gt;How Bao works&lt;/h1&gt;

&lt;p&gt;Previous approaches&lt;sup id=&quot;fnref:prev&quot;&gt;&lt;a href=&quot;#fn:prev&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; to learned query optimization attempted to replace large parts of traditional query optimizers. In contrast, Bao sits on top of a traditional query optimizer (called the &lt;em&gt;underlying optimizer&lt;/em&gt;) and learns to steer the underlying optimizer in the right direction.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/bao/bao_blog_diag.svg&quot; alt=&quot;Overview of the Bao process. Text in image repeated below.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The image above illustrates the process Bao uses to steer the underlying query optimizer.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;When a query arrives, the underlying optimizer is used to generate a number of plan variants for the query. For example, we might have the optimizer generate a plan using index nested-loop joins, another plan using sort-merge joins, and a third plan using hash joins.&lt;sup id=&quot;fnref:arms&quot;&gt;&lt;a href=&quot;#fn:arms&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
  &lt;li&gt;Once these plan variants are constructed, a predictive model (a deep neural network) predicts the latency of each plan.&lt;/li&gt;
  &lt;li&gt;The plan with the best predicted latency is selected and executed. The result is sent to the user, and the actual latency is recorded.&lt;/li&gt;
  &lt;li&gt;The actual latency of the recorded query is added to Bao’s experience set, which is used to further refine the predictive model using &lt;a href=&quot;https://en.wikipedia.org/wiki/Thompson_sampling&quot;&gt;Thompson sampling&lt;/a&gt;.&lt;sup id=&quot;fnref:nosup&quot;&gt;&lt;a href=&quot;#fn:nosup&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Over time, Bao’s predictive model learns from its mistakes, hopefully making increasingly accurate predictions. Experimentally, we’ve &lt;a href=&quot;https://rm.cab/bao&quot;&gt;shown&lt;/a&gt; that Bao can learn in the presence of dynamic workloads, shifting data distributions, and schema modifications.&lt;/p&gt;

&lt;h1 id=&quot;from-single-node-to-distributed&quot;&gt;From single-node to distributed&lt;/h1&gt;

&lt;p&gt;In the original Bao paper, we evaluated Bao on a single-node database system (e.g., Oracle and PostgreSQL). However, many data warehouse databases are, in fact, distributed. Luckily, Bao is largely agnostic to the underlying execution engine or storage layout: as long as you have a set of hints, Bao can pick and choose from them and learn from its mistakes. In the paper, we discuss what good hints for a single-node DBMS look like: for example, forcing particular join types, or forcing particular access paths (i.e., index vs. table scan). These choices can impact the performance of the plan on their own, but can also impact the join order selected by the underlying query optimizer, &lt;a href=&quot;https://www.vldb.org/pvldb/vol9/p204-leis.pdf&quot;&gt;potentially resulting in drastically different run times&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adapting Bao to a distributed DBMS is simply a matter of finding the right hints.&lt;/strong&gt; While many aspects of the single-node case apply to the distributed case as well (operator choice matters, join order matters), distributed DBMSes bring about other important performance considerations:&lt;/p&gt;

&lt;p&gt;Suppose a fact table is distributed across multiple nodes based on a key column. Should a join of that fact table with a dimension table be done via sending the dimension table to all nodes and using a hash algorithm? By partitioning the dimension table on the foreign key and using a merge join and union? By collecting the matching rows of the fact table on a single node, then performing a non-distributed merge?&lt;/p&gt;

&lt;p&gt;Depending on network costs, query selectivity, materialization strategy, what data is already present at each node, and a wide range of other factors, any of these strategies might be applicable. Different DBMSes will lean towards different options depending on which code paths have been optimized. Most distributed DBMSes choose between these different strategies using the same tools that non-distributed DBMSes use: heuristics, cost models, and cardinality estimation. These tools are already highly error-prone (and require significant tuning) in non-distributed settings, so you can imagine how tricky things get when entire clusters are involved!&lt;/p&gt;

&lt;p&gt;Next, we’ll walk through how Bao can be applied to three different state-of-the-art commercial cloud distributed DBMSes: Vertica, Amazon RedShift, and Azure Synapse (an analytics-focused offering of SQL Server). After discussing each system, we’ll show a small experiment highlighting potential gains (or lack thereof) from applying Bao. &lt;em&gt;We’ll be running each DBMS on different hardware, so please do not attempt to draw comparisons between these DBMSes&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;In each test, we’ll be executing an analytic dashboarding workload called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Corp&lt;/code&gt;. The workload was donated to our research team by a large corporation under the condition of anonymity. The workload contains about 1 TB of data and 2000 unique queries which change over time. A large schema change (normalizing a fact table) happens in the middle of the workload – we do not count the time required to perform this modification. The workload makes use of analytic functions, (materialized) views, and other advanced SQL features.&lt;/p&gt;

&lt;h2 id=&quot;vertica&quot;&gt;Vertica&lt;/h2&gt;

&lt;p&gt;Vertica is a distributed columnar DBMS, and is the commercial adaptation of the &lt;a href=&quot;https://dl.acm.org/doi/pdf/10.1145/3226595.3226638&quot;&gt;C-Store paper&lt;/a&gt;. Vertica’s optimizer is reasonably transparent, and the &lt;a href=&quot;https://www.vertica.com/docs/10.0.x/HTML/Content/Authoring/SQLReferenceManual/LanguageElements/Hints/Hints.htm&quot;&gt;documented set of hints&lt;/a&gt; gives us a lot of control over what the optimizer considers.&lt;/p&gt;

&lt;p&gt;For Vertica, we select query hints to:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Force a particular join operator (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JTYPE&lt;/code&gt; hint),&lt;/li&gt;
  &lt;li&gt;force a particular group by operator (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GBYTYPE&lt;/code&gt; hint),&lt;/li&gt;
  &lt;li&gt;force a particular distributed join algorithm (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DISTRIB&lt;/code&gt; hint, with options &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;L&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;R&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;, or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt;, representing a local join, a resegment join, a broadcast join, or letting the optimizer pick, respectively).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We started up two identical 3-node clusters on AWS using the official Vertica image (which, at time of writing, uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;r4.4xlarge&lt;/code&gt; nodes by default). We loaded the data into both clusters, and used the &lt;a href=&quot;https://www.vertica.com/docs/10.0.x/HTML/Content/Authoring/AdministratorsGuide/ConfiguringTheDB/PhysicalSchema/DBD/AboutDatabaseDesigner.htm&quot;&gt;Vertica DBD tool&lt;/a&gt; to create a good layout, which we manually verified through testing. One cluster ran Bao on top of Vertica (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Bao&lt;/code&gt;), while the other cluster did not run Bao (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Vertica&lt;/code&gt;). The resulting time and costs are plotted below:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/bao/bao_vert.svg&quot; alt=&quot;Cost and latency data for Vertica and Vertica with Bao, described below&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Bao was able to reduce the end-to-end processing time of this workload by over three hours, while reducing cost by over 25% (about $25, in our case). The time savings with Bao are more significant than the cost savings because Bao must periodically retrain its predictive model, which (temporarily) requires a GPU.&lt;/p&gt;

&lt;p&gt;Around 45% of Bao’s gains (the plurality) come from forcing the Vertica optimizer to use a broadcast join instead of a resegment join when the Vertica optimizer wrongly over-estimates the cardinality of a particular subplan. The small subplan result can be easily materialized and sent to all nodes, allowing for a faster computation than shuffling around parts of the subplan evenly to each node in the cluster (a resegment).&lt;/p&gt;

&lt;p&gt;In the future, we intend to experiment with specific hints to include or exclude projections (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PROJS&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SKIP_PROJS&lt;/code&gt;) to allow Bao to further custom-tailor its strategy to the user’s data.&lt;/p&gt;

&lt;h2 id=&quot;azure-synapse-sql-server&quot;&gt;Azure Synapse (SQL Server)&lt;/h2&gt;

&lt;p&gt;Azure Synapse is a analytics offering from Microsoft, based on SQL Server. SQL Server is one of the most widespread commercial database systems. Unlike Vertica, SQL Server can store data in either a row-based or a column-based format. Here, we’ll focus on the column store format provided by the Azure Synapse Analytics cloud database. Unfortunately, the types of hints available for Synapse Analytics &lt;a href=&quot;https://docs.microsoft.com/en-us/sql/t-sql/queries/option-clause-transact-sql&quot;&gt;are quite limited&lt;/a&gt; – so we had to get a bit creative.&lt;/p&gt;

&lt;p&gt;For Synapse, we select query hints to:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Disable or enable a particular type of join operator (hash, merge, and/or loop),&lt;/li&gt;
  &lt;li&gt;use a replicated or partitioned versions of all dimension tables,&lt;/li&gt;
  &lt;li&gt;use an indexed or non-indexed version of the fact table&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In order to implement the last two hints, we cheat a little bit: we created two versions of each dimension table, one replicated and one partitioned, along with two versions of the fact table (one indexed and one non-indexed). Based on the hint Bao selects, we rewrite the query to use the correct versions of each table.&lt;/p&gt;

&lt;p&gt;We spun up two Azure Synapse Analytic instances, each with a dedicated 1000 DWUs (“data warehouse units,” a measure of query processing resources available to queries). We ran one instance with Bao and the other instance without Bao. After loading the data, we added the specialized tables described above to the instance using Bao. The other instance, which would use the stock optimizer, had all dimension tables replicated and an indexed version of the fact table. The resulting time and costs are plotted below:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/bao/bao_ss.svg&quot; alt=&quot;Cost and latency data for Azure and Azure with Bao, described below&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Bao was able to reduce the end-to-end runtime of this workload by a little over two hours, while reducing the cost by around 10% (a little under $35). Again, the cost reduction is smaller than the latency reduction because of the cost of training the Bao model.&lt;/p&gt;

&lt;p&gt;A plurality of Bao’s gains (40%) came from avoiding the index on the fact table (sometimes by removing loop join as an option, sometimes by rewriting the query to use the non-indexed table). Removing the index from the instance running with the stock optimizer led to a decrease in performance, meaning that while the index normally helped, it hurt some queries, and Bao was able to identify those queries automatically.&lt;/p&gt;

&lt;p&gt;In the future, Bao could be applied to Azure Synapse in serverless mode, but this mode currently does not support query hints.&lt;/p&gt;

&lt;h2 id=&quot;redshift&quot;&gt;RedShift&lt;/h2&gt;

&lt;p&gt;RedShift is Amazon’s data analytics offering, and is often cited as one of the first “cloud native” analytics databases. As far as we can tell, RedShift only offers &lt;em&gt;two&lt;/em&gt; query optimization hints, which we’ll use alongside the same trick we used for Synapse.&lt;sup id=&quot;fnref:noindex&quot;&gt;&lt;a href=&quot;#fn:noindex&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;For RedShift, we select query hints to:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Disable or enable AQUA, the RedShift query accelerator (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;activate_aqua&lt;/code&gt;),&lt;/li&gt;
  &lt;li&gt;disable or enable using (up-to-date) materialized views in query processing (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mv_enable_aqmv_for_session&lt;/code&gt;),&lt;/li&gt;
  &lt;li&gt;use a replicated or partitioned version of all dimension tables (as with Synapse).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Unfortunately, RedShift offers by-far the least visibility and control into its query optimizer, leaving our Bao implementation (seemingly) limited. We started two 3-node clusters (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ra3.4xlarge&lt;/code&gt; nodes), one running Bao and one running the stock optimizer. The results are plotted below:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/bao/bao_rs.svg&quot; alt=&quot;Cost and latency data for RedShift and RedShift with Bao, described below&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Bao speeds up total workload latency by over an hour, and reduces costs by around 10% (in this case, about $10). Most of the gains (65%) came from disabling the usage of materialized views within subtree expressions, which the RedShift optimizer seems to do a little too aggressively (e.g., scanning the entire materialized view is slower than applying the predicates to the relations involved and performing the join). Disabling the use of materialized views in query processing globally hurts query performance overall, again showing that Bao is able to learn when the feature helps and when it hurts.&lt;/p&gt;

&lt;p&gt;RedShift seems like a really cool system, but unfortunately it does not provide the visibility or control required by researchers for deep study in query optimization. In the future, it would be awesome to see Amazon build a few more windows and knobs (with sane defaults!) into the optimizer for scientists to use.&lt;/p&gt;

&lt;h1 id=&quot;discussion&quot;&gt;Discussion&lt;/h1&gt;
&lt;p&gt;Looking over the results, we find ourself returning to the same set of takeaways:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Don’t spend too much time comparing results between systems. The experiments are ran on different clouds, using different hardware, at different times of day. While we followed best practice guidelines to tune the systems, an expert might still do better, in particular for Redshift and Azure Synapse, as we have less experience with them.&lt;/li&gt;
  &lt;li&gt;Just because Bao produces large gains on system X but smaller gains on system Y doesn’t mean the default optimizer of system X is better than the default optimizer of system Y. In our opinion, it is more likely that system X provides more visibility into the optimizer, whereas system Y keeps things pretty opaque, limiting Bao’s possible gains.&lt;/li&gt;
  &lt;li&gt;Everyone wants a “knob-free” query optimizer, but nobody tells you that the cost of such is decreased query performance. Without incorporating feedback from query execution in some way, heuristic optimizers are doomed to have edge cases that make them fall flat. “Knob-free” sometimes just means “not sophisticated enough to give you the tools you need to fix the mistakes.” A real “knob-free” query optimizer should take query latency feedback into account.&lt;/li&gt;
  &lt;li&gt;The idea behind Bao – use a deep neural network as a predictive model to choose between a number of different variants, then retrain that model progressively using Thompson sampling – seems widely applicable. We focused on database systems, but maybe there are other applications as well?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course, Bao does come with some drawbacks. Bao causes query optimization to take a little bit more time (~300ms), requiring quite a bit more computation. We studied this overhead in our SIGMOD paper. For data warehouse workloads, which largely consists of long-running, resource intensive queries, Bao’s increased overhead is hardly noticeable. However, for workloads with a lot of short running queries, like OLTP workloads, this might not be the case. We are currently working on new approaches to mitigate that problem – so stay tuned!&lt;/p&gt;

&lt;p&gt;If you feel so inclined, you can &lt;a href=&quot;https://rm.cab/bao&quot;&gt;read the Bao paper&lt;/a&gt;, check out our &lt;a href=&quot;https://learned.systems/bao&quot;&gt;open source prototype&lt;/a&gt; for PostgreSQL, or take a look at the &lt;a href=&quot;http://dsail.csail.mit.edu/index.php/publications-new/&quot;&gt;other publications&lt;/a&gt; from our group.&lt;/p&gt;

&lt;h1 id=&quot;notes&quot;&gt;Notes&lt;/h1&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:prev&quot;&gt;
      &lt;p&gt;Approaches such as &lt;a href=&quot;https://rm.cab/rejoin&quot;&gt;ReJOIN&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1808.03196&quot;&gt;DQ&lt;/a&gt;, and &lt;a href=&quot;https://rm.cab/neo&quot;&gt;Neo&lt;/a&gt; (in chronological order) fall into this category. &lt;a href=&quot;#fnref:prev&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:arms&quot;&gt;
      &lt;p&gt;The choice of which plan variants to generate is important. Generally, one variant is always just what the underlying query optimizer would have chosen with no intervention, and the other variants are generated by forcing the optimizer to ignore particular optimization paths. See the paper for more details. &lt;a href=&quot;#fnref:arms&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:nosup&quot;&gt;
      &lt;p&gt;Note that training the predictive model using standard supervised learning techniques will not balance the exploration of new policies (i.e., trying something new to see how well it works) against the exploitation of existing knowledge (i.e., doing what we know works well). Thus, &lt;a href=&quot;https://en.wikipedia.org/wiki/Reinforcement_learning&quot;&gt;reinforcement learning&lt;/a&gt; techniques are preferred. It is easy to think that, to avoid regression, you would want to maximize exploitation. But this can get you trapped in a local minima: if you mis-predict the value of the optimal plan, you will never select it. In other words, without exploration, you might initially have fewer regressions, but you’ll never recover from them! &lt;a href=&quot;#fnref:nosup&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:noindex&quot;&gt;
      &lt;p&gt;Redshift, like Vertica, does not support traditional indexes on tables like Synapse does, so we do not add those indexed variants here. &lt;a href=&quot;#fnref:noindex&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Thu, 17 Jun 2021 00:00:00 +0000</pubDate>
        <link>/blog/2021/06/17/bao-distributed.html</link>
        <guid isPermaLink="true">/blog/2021/06/17/bao-distributed.html</guid>
      </item>
    
      <item>
        <title>Machine learning for systems</title>
        <description>
&lt;style&gt;
#regret-chart-container{margin-top:20px;text-align:center}.line{stroke:#000;stroke-width:2px;fill:none}.qs-line{stroke:red;stroke-width:2px;fill:none}.axis{font-size:.8em}.legend-label{font-size:.8em}button{margin-left:10px;margin-top:10px}#control-holder{margin-top:10px;margin-bottom:10px;display:flex;justify-content:space-around;flex-wrap:wrap}#control-holder progress{margin-top:10px}
&lt;/style&gt;

&lt;p&gt;Imagine you are writing a system to repeatedly sort large datasets. You could just blindly choose a search algorithm, like Quicksort, and apply it every time. However, if the data is nearly sorted already, something like bubble sort or insertion sort might be a better idea. But how do we know when this is the case? One approach would be to sample the data and compute some statistics over it, like the expected size of a run&lt;sup id=&quot;fnref:run&quot;&gt;&lt;a href=&quot;#fn:run&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; and the average pairwise difference. Then, you could run a lot of experiments and try to come up with a hand-tuned heuristic to pick a sorting algorithm based on the sampled information.&lt;/p&gt;

&lt;p&gt;But how well will the heuristic you designed work when the data distribution changes? Or when your system is moved to new hardware (possibly with larger caches, etc.)? Or you want to add &lt;a href=&quot;https://en.wikipedia.org/wiki/Timsort&quot;&gt;some other sorting algorithm&lt;/a&gt;? Some of the thresholds you picked might need to be tuned… every single time.&lt;/p&gt;

&lt;p&gt;So why don’t we just &lt;em&gt;learn&lt;/em&gt; the function that maps our sampled statistics to the optimal sorting algorithm? And better yet, let’s do it in an online fashion, using a corrective feedback loop where we &lt;em&gt;learn from our mistakes.&lt;/em&gt;&lt;/p&gt;

&lt;div id=&quot;regret-chart-container&quot;&gt;
  &lt;svg id=&quot;regret-chart&quot;&gt;&lt;/svg&gt;
&lt;/div&gt;

&lt;div&gt;
    &lt;div id=&quot;control-holder&quot;&gt;
    &lt;progress id=&quot;training-progress&quot; value=&quot;0&quot; max=&quot;100&quot;&gt;&lt;/progress&gt;
    &lt;div&gt;
        &lt;button class=&quot;rcm-button&quot; id=&quot;toggle-eval&quot;&gt;Pause&lt;/button&gt;
        &lt;button class=&quot;rcm-button&quot; id=&quot;forget&quot;&gt;Forget&lt;/button&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;table width=&quot;100%&quot;&gt;
    &lt;tr&gt;&lt;th width=&quot;140px&quot;&gt;State&lt;/th&gt;&lt;th&gt;&lt;div id=&quot;learn-sort-state&quot;&gt;&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th&gt;Quicksort&lt;/th&gt;&lt;td&gt;&lt;span id=&quot;learn-sort-quick&quot;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th&gt;Insertion&lt;/th&gt;&lt;td&gt;&lt;span id=&quot;learn-sort-insert&quot;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th&gt;Bubble&lt;/th&gt;&lt;td&gt;&lt;span id=&quot;learn-sort-bubble&quot;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th&gt;&lt;div class=&quot;tooltip&quot;&gt;Experience&lt;span class=&quot;tooltip-text&quot;&gt;The total number of sorts the agent has performed, and thus the amount of training data acquired, so far.&lt;/span&gt;&lt;/div&gt;&lt;/th&gt;
        &lt;td&gt;&lt;span id=&quot;experience-size&quot;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th&gt;&lt;div class=&quot;tooltip&quot;&gt;Net regret&lt;span class=&quot;tooltip-text&quot;&gt;The time difference between the action taken by the policy (the agent or Quicksort, QS) and the optimal action over every episode so far.&lt;/span&gt;&lt;/div&gt;&lt;/th&gt;
    &lt;td&gt;Agent: &lt;span id=&quot;agent-regret&quot;&gt;&lt;/span&gt; / QS: &lt;span id=&quot;qs-regret&quot;&gt;&lt;/span&gt;
    &lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th&gt;&lt;div class=&quot;tooltip&quot;&gt;Net savings&lt;span class=&quot;tooltip-text&quot;&gt;The amount of time saved (if positive) or lost (if negative) by using the learning agent instead of picking Quicksort every time.&lt;/span&gt;&lt;/div&gt;&lt;/th&gt;&lt;td id=&quot;advantage&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Right now&lt;noscript&gt; (if you had JavaScript enabled)&lt;/noscript&gt;, your computer is busily training and evaluating a deep reinforcement learning model&lt;sup id=&quot;fnref:drl&quot;&gt;&lt;a href=&quot;#fn:drl&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; which, when fed the sampled statistics as input, will predict how long each of three sorting algorithms (Quicksort, bubble sort, and insertion sort) will take to sort the data. The graph shows the &lt;em&gt;regret&lt;/em&gt;, the difference between the decision made and the optimal decision, for two policies: the learned model, and a policy that uses Quicksort every time. The “net savings” measures how much time has been saved (or lost) by using the learned policy compared to Quicksort. Over time, this number should increase, indicating that the agent is learning.&lt;/p&gt;

&lt;h2 id=&quot;whats-going-on-here&quot;&gt;What’s going on here?&lt;/h2&gt;

&lt;picture&gt;
    &lt;source srcset=&quot;/blog/assets/learn_sort/diagram.svg&quot; type=&quot;image/svg+xml&quot; /&gt;
    &lt;img src=&quot;/blog/assets/learn_sort/diagram.png&quot; alt=&quot;Learned system diagram&quot; /&gt;
&lt;/picture&gt;

&lt;p&gt;Every time a new set arrives for sorting (an &lt;em&gt;episode&lt;/em&gt;), we feed the sampled statistics (the &lt;em&gt;context&lt;/em&gt;) to the neural network, and we use the network’s prediction to select a sorting algorithm (an &lt;em&gt;action&lt;/em&gt;). After we select an algorithm, we sort the set and see how good our decision was by measuring the latency (the &lt;em&gt;reward&lt;/em&gt;). This problem setup, a restriction of general reinforcement learning, is often referred to as the &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Multi-armed_bandit#Contextual_bandit&quot;&gt;contextual multi-armed bandit problem&lt;/a&gt;&lt;/em&gt;&lt;sup id=&quot;fnref:cmab&quot;&gt;&lt;a href=&quot;#fn:cmab&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;, in which:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;At the start of each episode, an agent receives a &lt;em&gt;context&lt;/em&gt; (sampled statistics), containing information relevant to the current episode.&lt;/li&gt;
  &lt;li&gt;The agent selects an &lt;em&gt;action&lt;/em&gt; (a sorting algorithm) from a finite set.&lt;/li&gt;
  &lt;li&gt;The agent receives some reward (the time it takes to sort).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The agent’s goal is to maximize the reward it earns over time (i.e., minimize the latency of sorts over time). In order to do so, the agent must &lt;em&gt;explore&lt;/em&gt; the relationship between contexts, actions, and rewards, while simultaneously &lt;em&gt;exploiting&lt;/em&gt; the knowledge it has gathered. Our solution to this problem is &lt;a href=&quot;https://en.wikipedia.org/wiki/Thompson_sampling&quot;&gt;Thompson sampling&lt;/a&gt;, a straight-forward technique that keeps track of (context, action, reward) triples and samples a model to predict the reward of each action based on the context.&lt;/p&gt;

&lt;p&gt;We re-train the model every 40 episodes. As the model gains more and more experience (observed triples), the model’s prediction gets better and better, and thus the resulting policy improves as well.&lt;/p&gt;

&lt;p&gt;If you watch the graph for long enough (normally around 250 episodes), the regret of the learned policy should go to zero, meaning that the optimal policy has been learned. Since we use Thompson sampling to build a new model every 40 episodes, there are occassionally spikes, or variance, in the learned model’s policy. However, the net savings of the learned model tends to remain significant.&lt;/p&gt;

&lt;p&gt;In a sense, this means our learned model is trading worst-case performance for average-case performance: most of the time, the learned model will choose a good algorithm, but every once in a while, Thompson sampling will produce a catestrophic policy,&lt;sup id=&quot;fnref:explore&quot;&gt;&lt;a href=&quot;#fn:explore&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;4&lt;/a&gt;&lt;/sup&gt; and performance will degrade significantly for a short period of time. But, on average, the learned agent will perform better than the static policy.&lt;/p&gt;

&lt;h2 id=&quot;the-big-picture&quot;&gt;The Big Picture&lt;/h2&gt;

&lt;p&gt;Machine learning for systems – that is, applying machine learning techniques to problems &lt;em&gt;within&lt;/em&gt; computer systems – is coming, and it’s coming fast. Whether its &lt;a href=&quot;https://arxiv.org/abs/1712.01208&quot;&gt;index structures&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1810.01963&quot;&gt;scheduling&lt;/a&gt;, &lt;a href=&quot;http://rm.cab/rejoin&quot;&gt;or&lt;/a&gt; &lt;a href=&quot;http://rm.cab/neo&quot;&gt;even&lt;/a&gt; &lt;a href=&quot;https://arxiv.org/abs/1803.08604&quot;&gt;database&lt;/a&gt; &lt;a href=&quot;https://arxiv.org/abs/1808.03196&quot;&gt;query&lt;/a&gt; &lt;a href=&quot;http://cidrdb.org/cidr2019/papers/p96-marcus-cidr19.pdf&quot;&gt;optimization&lt;/a&gt; (including &lt;a href=&quot;http://cidrdb.org/cidr2019/papers/p101-kipf-cidr19.pdf&quot;&gt;cardinality estimation&lt;/a&gt;), machine learning is creeping its way into the domain of systems. It has been called &lt;a href=&quot;/blog/assets/learn_sort/sds.pdf&quot;&gt;Software-Defined Software&lt;/a&gt;, &lt;a href=&quot;https://medium.com/@karpathy/software-2-0-a64152b37c35&quot;&gt;Software 2.0&lt;/a&gt;, &lt;a href=&quot;http://people.csail.mit.edu/kraska/research.html&quot;&gt;learned systems components&lt;/a&gt;, or &lt;a href=&quot;http://dsail.csail.mit.edu/index.php/projects/&quot;&gt;self-assembling systems&lt;/a&gt;. But regardless of the name, “machine learning for systems” brings about both exciting possibilities and significant new challenges.&lt;/p&gt;

&lt;p&gt;The advantages of machine learning powered systems could be huge: for database systems, query optimizers contain a huge number of heuristics that must be painstakingly maintained by hand, and often even require application-specific tuning by a DBA. Some of &lt;a href=&quot;http://rm.cab/neo&quot;&gt;our recent research&lt;/a&gt; shows how deep reinforcement learning can produce query optimizers that automatically tune themselves to specific applications, matching and sometimes exceeding the performance of complex commercial optimizers. In &lt;a href=&quot;https://ai.google/research/pubs/pub47669&quot;&gt;their recent paper&lt;/a&gt;, Kraska et al. argue that similar applications of machine learning could improve almost every aspect of a database, including data access, query optimization, query execution, and advanced analytics.&lt;/p&gt;

&lt;p&gt;However, there are numerous challenges to overcome.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Like in the example shown here, learned systems can perform better &lt;em&gt;on average, but might have significantly higher variance,&lt;/em&gt; especially in early episodes. Figuring out how to reduce this variation will be critical for systems applications that depend on low tail latencies. Several approaches, like &lt;a href=&quot;https://arxiv.org/abs/1808.07903&quot;&gt;learning from demonstration&lt;/a&gt; or &lt;a href=&quot;http://cidrdb.org/cidr2019/papers/p96-marcus-cidr19.pdf&quot;&gt;bootstrapping a model from a cost function&lt;/a&gt;, have recently been investigated.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Understanding when models will – &lt;em&gt;and won’t&lt;/em&gt; – work is still a major open question. While we know that neural networks can approximate any continuous function, and that algorithms like table-based Q learning converge to optimal policies for any MDP, we are still a long way from having theoretically-justified bounds on practical learning systems. It is possible that such bounds may never be known, and that it is easier to adjust the existing learning systems to have better behavior at the margins. Such techniques could be a simple as &lt;a href=&quot;https://arxiv.org/abs/1812.10568&quot;&gt;using different models for outliers&lt;/a&gt;, or may be as complex as &lt;a href=&quot;https://arxiv.org/abs/1901.05152&quot;&gt;modifying database internals to work adaptively&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;Doing worse takes longer than doing well.&lt;/em&gt; If you are playing a video game and not doing very well, the score printout on the screen will tell you just how bad you doing. If you are doing well, the score printout will convey this information as well, and equally quickly. For systems problems, however, if your initial policy is poor, evaluating it may take a long time. For example, for join order selection in a relational database, &lt;a href=&quot;http://cidrdb.org/cidr2019/papers/p96-marcus-cidr19.pdf&quot;&gt;a bad join ordering may take orders of magnitude longer to complete than a good one&lt;/a&gt;. Thus, how long it takes to “read the score” is a function of the score itself. This means that the initial episodes of learning (in which many RL algorithms start with a random policy) could take a prohibitively long amount of time.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These challenges, and many others, are discussed in &lt;a href=&quot;http://rm.cab/park&quot;&gt;our recent workshop paper&lt;/a&gt; at RL4RealLife (ICML ‘19). We’ve also released an &lt;a href=&quot;https://git.io/park-platform&quot;&gt;open source platform called Park&lt;/a&gt; to enable researchers to test reinforcement learning algorithms on systems problems, including network congestion control, Spark scheduling, load balancing, and a dozen more. The future of systems is learned!&lt;/p&gt;

&lt;h2 id=&quot;faqs&quot;&gt;FAQs&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;This seems really dumb. Why don’t you just…&lt;/strong&gt; This is not supposed to be a practical system. It’s supposed to be a demonstration of a learned policy being useful in a systems context. Clearly, a real world system would need significantly more testing, and would likely use a much simpler model. Please see the many linked works in the first paragraph of “The Big Picture” section for more practical examples.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are you including the featurization and inference time in your measurement?&lt;/strong&gt; Inference time is not included, but featurization time is included: the always-quicksort policy benefits from not having to compute features, and the learned policy is punished. Note that the zero-regret line on the plot assumes the featurization times – in other words, an oracle policy that didn’t even require the features as inputs would have a (slightly negative) regret.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shouldn’t you just be using Timsort?&lt;/strong&gt; Maybe. Depends on the hardware, data distribution… probably a large number of other factors. This system is flexible – you could add in Timsort, and, if a particular piece of hardware and data distribution caused Timsort to always be optimal, Timsort would always be selected. In this case, you would be wasting time computing features. It might be interesting to have the policy select which features it wanted to gather for itself, so that the network could learn which when/which features were useful.&lt;/p&gt;

&lt;script&gt;!function(){return function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u=&quot;function&quot;==typeof require&amp;&amp;require;if(!s&amp;&amp;u)return u(a,!0);if(o)return o(a,!0);var l=new Error(&quot;Cannot find module &apos;&quot;+a+&quot;&apos;&quot;);throw l.code=&quot;MODULE_NOT_FOUND&quot;,l}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){return i(e[a][1][t]||t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o=&quot;function&quot;==typeof require&amp;&amp;require,a=0;a&lt;r.length;a++)i(r[a]);return i}}()({1:[function(t,e,n){const r=t(&quot;./model&quot;),i=t(&quot;./datagen&quot;),o=t(&quot;lodash&quot;),a=t(&quot;./sort&quot;).sorts;e.exports=class{constructor(e,n){this.retrainFreq=e||30,this.usePrefab=n||!1,this.model=!1,this.roundsWithoutRetrain=0;const{inputs:r,outputs:i}=n?t(&quot;./prefab&quot;):{inputs:[],outputs:[]};this.experience=[];for(let t=0;t&lt;r.length;t++)for(let e in i[t])this.experience.push([i[t][e],e,r[t]]);this.regret=[],this.qsRegret=[]}forget(){this.experience=[]}_sampleExperience(){const t=[];for(;t.length!=this.experience.length;){const e=o.random(this.experience.length-1);t.push(this.experience[e])}return t}_sepExperienceByAction(t){const e={};for(let t of a)e[t]=[[],[]];for(let[n,r,i]of t)e[r][0].push(i),e[r][1].push(n);return e}async _trainModels(t){const e=this._sampleExperience(),n=this._sepExperienceByAction(e),i={};let s=0;function u(e,n){t({state:&quot;epoch&quot;,value:s+=e,total:3*n})}for(let e of a){let[a,s]=n[e];t({state:&quot;training&quot;,model:e,modelStatus:`Training (${a.length} samples)`}),i[e]=await r.trainWithData(a,s,u),i[e].random?t({state:&quot;training&quot;,model:e,modelStatus:&quot;Random (not enough data)&quot;}):t({state:&quot;training&quot;,model:e,modelStatus:&quot;Trained, validation loss: &quot;+o.round(i[e].valLoss,3)})}return i}async doRound(t){t||(t=function(){}),t({state:&quot;eval&quot;,value:this.roundsWithoutRetrain,total:this.retrainFreq}),(!this.models||++this.roundsWithoutRetrain&gt;=this.retrainFreq)&amp;&amp;(t({state:&quot;start-training&quot;}),this.models=await this._trainModels(t),this.roundsWithoutRetrain=0),t({state:&quot;evaluating&quot;});const{inputs:e,outputs:n}=await i(1,2e3),r=e[0],a=n[0],s=o.mapValues(this.models,t=&gt;t.predictor(r)),[u,l,c]=this._computeRegret(s,a);this.regret.push(c);const[f,p,h]=this._computeRegret({quick:0,tim:1,bubble:1,insert:1},a);this.qsRegret.push(h),this.experience.push([l,u,r]),t({state:&quot;experience&quot;,length:this.experience.length})}_computeRegret(t,e){const n=o.minBy(o.keys(t),e=&gt;t[e]),r=o.minBy(o.keys(e),t=&gt;e[t]),i=e[n]-e[r];return[n,e[n],i]}meanRegret(){function t(t){return t.length&gt;30?t.slice(t.length-30):t}return{&quot;agent regret&quot;:o.mean(t(this.regret)),&quot;qs regret&quot;:o.mean(t(this.qsRegret))}}totalRegret(){return{agent:o.sum(this.regret),qs:o.sum(this.qsRegret)}}producePlotData(){let t=[];for(let e=0;e&lt;1;e+=.01)for(let n=0;n&lt;1;n+=.01)t.push({&quot;sign sum&quot;:e,&quot;mean run&quot;:n});const e={};for(let n in this.models)e[n]=o.values(this.models[n].predictor(t));return e}}},{&quot;./datagen&quot;:3,&quot;./model&quot;:6,&quot;./prefab&quot;:349,&quot;./sort&quot;:350,lodash:337}],2:[function(t,e,n){e.exports=function(t){const e={},n={},r={},i={},o={};for(let a in t){const s=&quot;el&quot;in t[a]?t[a].el:a;if(e[a]=document.getElementById(s),!e[a])throw new Error(&quot;No element &quot;+s);if(&quot;process&quot;in t[a]){if(&quot;function&quot;!=typeof t[a].process)throw new Error(&quot;The binding&apos;s process value must be a function&quot;);n[a]=t[a].process}else n[a]=(t=&gt;t);&quot;property&quot;in t[a]?r[a]=function(e,n){e[t[a].property]=n}:&quot;attribute&quot;in t[a]?r[a]=function(e,n){e.setAttribute(t[a].attribute,n)}:&quot;attributePresent&quot;in t[a]?r[a]=function(e,n){n?e.setAttribute(t[a].attributePresent,&quot;true&quot;):e.removeAttribute(t[a].attributePresent)}:&quot;style&quot;in t[a]?r[a]=function(e,n){e.style[t[a].style]=n}:r[a]=function(t,e){t.innerHTML=e},&quot;watcher&quot;in t[a]&amp;&amp;(o[a]=t[a].watcher),i[a]=&quot;&quot;}return new Proxy({},{get:function(t,e,n){return i[e]},set:function(t,a,s,u){if(!(a in e))throw new Error(`Unknown binding ${a}`);i[a]=s;const l=n[a],c=r[a],f=e[a];c(f,l(i[a])),a in o&amp;&amp;o[a]()}})}},{}],3:[function(t,e,n){t(&quot;./sort&quot;);const r=t(&quot;./features&quot;),i=t(&quot;lodash&quot;);function o(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}const a=[function(t){const e=[];for(;e.length&lt;t;)e.push(1e3*Math.random());return e},function(t){const e=[];for(;e.length&lt;t;)e.push(e.length);const n=0*Math.floor(40*Math.random());for(let t=0;t&lt;n;t++)o(e,Math.floor(Math.random()*e.length),Math.floor(Math.random()*e.length));return e},function(t){const e=[];for(;e.length&lt;t;)e.push(-e.length);const n=Math.floor(40*Math.random());for(let t=0;t&lt;n;t++)o(e,Math.floor(Math.random()*e.length),Math.floor(Math.random()*e.length));return e},function(t){let e=[];for(;e.length&lt;t;){const t=Math.floor(100*Math.random())+100,n=[],r=1e3*Math.random(),i=20*Math.random();for(let e=0;e&lt;t;e++)n.push(r+e*i);Math.random()&lt;.5&amp;&amp;n.reverse(),e.push(...n)}return e.length&gt;t&amp;&amp;(e=e.slice(0,t)),e},function(t){const e=[];for(;e.length&lt;t;)e.push(e.length);const n=Math.floor(5*Math.random());for(let t=0;t&lt;n;t++){const t=Math.floor(Math.random()*(e.length-10));for(let n=0;n&lt;5;n++)o(e,Math.floor(10*Math.random()+t),Math.floor(10*Math.random()+t))}return e}],s=new(t(&quot;promise-worker&quot;))(new Worker(&quot;/blog/assets/learn_sort/sort.min.js&quot;));e.exports=async function(t,e){const n=[],o=[];for(let u=0;u&lt;t;u++){const t=(0,a[i.random(a.length-1)])(e),u=r(t),l=await s.postMessage(t);n.push(u),o.push(l)}return{inputs:n,outputs:o}}},{&quot;./features&quot;:4,&quot;./sort&quot;:350,lodash:337,&quot;promise-worker&quot;:339}],4:[function(t,e,n){const r=t(&quot;lodash&quot;);e.exports=function(t){return{&quot;sign sum&quot;:function(t){let e=0;for(let n=0;n&lt;t.length-1;n++)e+=Math.sign(t[n]-t[n+1]);return(e/t.length+1)/2}(t),&quot;mean run&quot;:function(t){let e=[],n=1,i=Math.sign(t[1]-t[0]);for(let r=1;r&lt;t.length-1;r++){const o=Math.sign(t[r+1]-t[r]);o==i?n++:(e.push(n),n=0,i=o)}return 0!=n&amp;&amp;e.push(n),r.mean(e)/t.length}(t)}}},{lodash:337}],5:[function(t,e,n){const r=t(&quot;./agent&quot;),i=t(&quot;d3&quot;),o=t(&quot;./binder&quot;),a=200,s=[500,450,300],u=[400,360,240],l=[60,60,50],c=[60,55,50];document.addEventListener(&quot;DOMContentLoaded&quot;,function(){const t=new class{constructor(t){const e=window.innerWidth&gt;=520?0:window.innerWidth&gt;=470?1:2;this.width=s[e],this.height=u[e];const n=document.getElementById(t);n.innerHTML=&quot;&quot;,n.setAttribute(&quot;width&quot;,`${this.width}px`),n.setAttribute(&quot;height&quot;,`${this.height}px`),this.svg=i.select(document.getElementById(t)),this.xPadding=l[e],this.yPadding=c[e],this.textPadding=40,this.data=[],this.removedData=0,this.xScale=i.scaleLinear().domain([0,a]).range([this.xPadding,this.width-20]),this.yScale=i.scaleLinear().domain([0,5]).range([this.height-this.yPadding,20]),this.xAxis=this.svg.append(&quot;g&quot;).attr(&quot;class&quot;,&quot;axis&quot;).attr(&quot;transform&quot;,`translate(0, ${this.height-this.yPadding})`).call(i.axisBottom(this.xScale).tickPadding(5).ticks(5)),this.svg.append(&quot;g&quot;).attr(&quot;class&quot;,&quot;axis&quot;).attr(&quot;transform&quot;,`translate(${this.xPadding}, 0)`).call(i.axisLeft(this.yScale).tickPadding(5).ticks(this.big?10:5)),this.svg.append(&quot;text&quot;).attr(&quot;transform&quot;,&quot;rotate(-90)&quot;).attr(&quot;y&quot;,20).attr(&quot;x&quot;,-this.height/2).style(&quot;text-anchor&quot;,&quot;middle&quot;).text(&quot;Regret&quot;);const r=(this.width-this.xPadding)/2+this.xPadding;this.svg.append(&quot;text&quot;).attr(&quot;transform&quot;,`translate(${r}, ${this.height-5})`).attr(&quot;y&quot;,0).attr(&quot;x&quot;,0).style(&quot;text-anchor&quot;,&quot;middle&quot;).text(&quot;Episode&quot;),this.svg.append(&quot;text&quot;).attr(&quot;x&quot;,this.width-150).attr(&quot;y&quot;,20).attr(&quot;class&quot;,&quot;legend-label&quot;).text(&quot;Learned model&quot;),this.svg.append(&quot;text&quot;).attr(&quot;x&quot;,this.width-150).attr(&quot;y&quot;,40).attr(&quot;class&quot;,&quot;legend-label&quot;).text(&quot;Quicksort&quot;),this.svg.append(&quot;line&quot;).attr(&quot;x1&quot;,this.width-160).attr(&quot;y1&quot;,35).attr(&quot;x2&quot;,this.width-180).attr(&quot;y2&quot;,35).attr(&quot;class&quot;,&quot;qs-line&quot;),this.svg.append(&quot;line&quot;).attr(&quot;x1&quot;,this.width-160).attr(&quot;y1&quot;,15).attr(&quot;x2&quot;,this.width-180).attr(&quot;y2&quot;,15).attr(&quot;class&quot;,&quot;line&quot;),this.lineGen=i.line().x((t,e)=&gt;this.xScale(e+this.removedData)).y(t=&gt;this.yScale(t)),this.agentLine=this.svg.append(&quot;path&quot;).attr(&quot;class&quot;,&quot;line&quot;),this.qsLine=this.svg.append(&quot;path&quot;).attr(&quot;class&quot;,&quot;qs-line&quot;)}addPoint(t){for(this.data.push(t);this.data.length&gt;a;)this.data=this.data.slice(this.data.length-a),this.removedData++;this.removedData&gt;0&amp;&amp;(this.xScale=i.scaleLinear().domain([this.removedData,this.removedData+a]).range([this.xPadding,this.width-20]),this.xAxis.call(i.axisBottom(this.xScale).tickPadding(5).ticks(5))),this.agentLine.datum(this.data.map(t=&gt;Math.min(4.5,t[&quot;agent regret&quot;]))).attr(&quot;d&quot;,this.lineGen),this.qsLine.datum(this.data.map(t=&gt;t[&quot;qs regret&quot;])).attr(&quot;d&quot;,this.lineGen)}}(&quot;regret-chart&quot;),e=new r(40,!1),n=o({state:{el:&quot;learn-sort-state&quot;},insert:{el:&quot;learn-sort-insert&quot;},quick:{el:&quot;learn-sort-quick&quot;},bubble:{el:&quot;learn-sort-bubble&quot;},numExperience:{el:&quot;experience-size&quot;},progressTotal:{el:&quot;training-progress&quot;,attribute:&quot;max&quot;},progressValue:{el:&quot;training-progress&quot;,attribute:&quot;value&quot;},buttonText:{el:&quot;toggle-eval&quot;},buttonDisabled:{el:&quot;toggle-eval&quot;,attributePresent:&quot;disabled&quot;},forgetDisabled:{el:&quot;forget&quot;,attributePresent:&quot;disabled&quot;},agentRegret:{el:&quot;agent-regret&quot;,process:t=&gt;Math.round(t)+&quot; ms&quot;},qsRegret:{el:&quot;qs-regret&quot;,process:t=&gt;Math.round(t)+&quot; ms&quot;},advantage:{process:t=&gt;Math.round(t)+&quot; ms&quot;}});let f=!0;function p(){f?setTimeout(d,10):h({state:&quot;stopped&quot;})}function h(t){if(&quot;start-training&quot;==t.state){n.buttonDisabled=!0,n.forgetDisabled=!0,n.state=&quot;Training models&quot;;for(let t of[&quot;insert&quot;,&quot;quick&quot;,&quot;bubble&quot;])n[t]=&quot;Waiting&quot;}else&quot;training&quot;==t.state?(n.buttonDisabled=!0,n.forgetDisabled=!0,t.model&amp;&amp;(n[t.model]=t.modelStatus)):&quot;epoch&quot;==t.state||&quot;eval&quot;==t.state?(n.progressTotal=t.total,n.progressValue=t.value):&quot;evaluating&quot;==t.state?(n.buttonDisabled=!1,n.forgetDisabled=!1,n.state=&quot;Evaluating models&quot;):&quot;stopped&quot;==t.state?(n.buttonDisabled=!1,n.forgetDisabled=!1,n.state=&quot;Idle&quot;):&quot;experience&quot;==t.state?n.numExperience=t.length:n.state=&quot;Unknown state!&quot;}async function d(){await e.doRound(h),t.addPoint(e.meanRegret());const r=e.totalRegret();n.agentRegret=r.agent,n.qsRegret=r.qs,n.advantage=r.qs-r.agent,p()}document.getElementById(&quot;toggle-eval&quot;).addEventListener(&quot;click&quot;,()=&gt;{f=!f,n.buttonText=f?&quot;Pause&quot;:&quot;Resume&quot;,p()}),document.getElementById(&quot;forget&quot;).addEventListener(&quot;click&quot;,()=&gt;{e.forget(),n.numExperience=0}),p()})},{&quot;./agent&quot;:1,&quot;./binder&quot;:2,d3:335}],6:[function(t,e,n){const r=t(&quot;@tensorflow/tfjs&quot;),i=t(&quot;lodash&quot;);function o(){return-Math.random()}const a=45;function s(t){const e=Object.keys(t[0]).sort();let n=[];for(let r of t)n.push(e.map(t=&gt;r[t]));return n}e.exports.trainWithData=async function(t,e,n){n||(n=function(){});if(!t||t.length&lt;5)return n(a,a),{predictor:o,valLoss:NaN,random:!0};const u=(t=s(t))[0].length,l=r.sequential();l.add(r.layers.dense({units:10,inputShape:[u]})),l.add(r.layers.batchNormalization()),l.add(r.layers.activation({activation:&quot;relu&quot;})),l.add(r.layers.dense({units:10})),l.add(r.layers.batchNormalization()),l.add(r.layers.activation({activation:&quot;relu&quot;})),l.add(r.layers.dense({units:1}));l.compile({loss:&quot;meanSquaredError&quot;,optimizer:&quot;adam&quot;});const c=r.tensor2d(t,[t.length,u]),f=r.tensor2d(e,[e.length,1]);const p=await l.fit(c,f,{epochs:a,batchSize:32,validationSplit:.1,shuffle:!0,callbacks:{onEpochEnd:function(){n(1,a)}}}),h=await Promise.all(l.getWeights().map(t=&gt;t.data())),d=i.mean(e),m=(i.mean(e.map(t=&gt;Math.pow(t-d,2))),i.last(p.history.val_loss));0;return{predictor:function(t){let e=s([t])[0];e=r.tensor2d([e],[1,e.length]);const n=l.predict(e).dataSync();return n[0]},valLoss:m,weights:h}},e.exports.trainStumpWithData=function(t,e,n){t=s(t),console.log(t),console.log(e)}},{&quot;@tensorflow/tfjs&quot;:299,lodash:337}],7:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),function(t){t[t.DT_INVALID=0]=&quot;DT_INVALID&quot;,t[t.DT_FLOAT=1]=&quot;DT_FLOAT&quot;,t[t.DT_DOUBLE=2]=&quot;DT_DOUBLE&quot;,t[t.DT_INT32=3]=&quot;DT_INT32&quot;,t[t.DT_UINT8=4]=&quot;DT_UINT8&quot;,t[t.DT_INT16=5]=&quot;DT_INT16&quot;,t[t.DT_INT8=6]=&quot;DT_INT8&quot;,t[t.DT_STRING=7]=&quot;DT_STRING&quot;,t[t.DT_COMPLEX64=8]=&quot;DT_COMPLEX64&quot;,t[t.DT_INT64=9]=&quot;DT_INT64&quot;,t[t.DT_BOOL=10]=&quot;DT_BOOL&quot;,t[t.DT_QINT8=11]=&quot;DT_QINT8&quot;,t[t.DT_QUINT8=12]=&quot;DT_QUINT8&quot;,t[t.DT_QINT32=13]=&quot;DT_QINT32&quot;,t[t.DT_BFLOAT16=14]=&quot;DT_BFLOAT16&quot;,t[t.DT_FLOAT_REF=101]=&quot;DT_FLOAT_REF&quot;,t[t.DT_DOUBLE_REF=102]=&quot;DT_DOUBLE_REF&quot;,t[t.DT_INT32_REF=103]=&quot;DT_INT32_REF&quot;,t[t.DT_UINT8_REF=104]=&quot;DT_UINT8_REF&quot;,t[t.DT_INT16_REF=105]=&quot;DT_INT16_REF&quot;,t[t.DT_INT8_REF=106]=&quot;DT_INT8_REF&quot;,t[t.DT_STRING_REF=107]=&quot;DT_STRING_REF&quot;,t[t.DT_COMPLEX64_REF=108]=&quot;DT_COMPLEX64_REF&quot;,t[t.DT_INT64_REF=109]=&quot;DT_INT64_REF&quot;,t[t.DT_BOOL_REF=110]=&quot;DT_BOOL_REF&quot;,t[t.DT_QINT8_REF=111]=&quot;DT_QINT8_REF&quot;,t[t.DT_QUINT8_REF=112]=&quot;DT_QUINT8_REF&quot;,t[t.DT_QINT32_REF=113]=&quot;DT_QINT32_REF&quot;,t[t.DT_BFLOAT16_REF=114]=&quot;DT_BFLOAT16_REF&quot;}(n.DataType||(n.DataType={})),function(t){!function(t){t[t.LEGACY=0]=&quot;LEGACY&quot;,t[t.V1=1]=&quot;V1&quot;,t[t.V2=2]=&quot;V2&quot;}(t.CheckpointFormatVersion||(t.CheckpointFormatVersion={}))}(n.SaverDef||(n.SaverDef={}))},{}],8:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){function t(t,e){this.weightMap=t,this.tensorArrayMap=e,this.rootContext={id:0,frameName:&quot;&quot;,iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}return t.prototype.newFrame=function(t,e){return{id:t,frameName:e,iterationId:0}},Object.defineProperty(t.prototype,&quot;currentContext&quot;,{get:function(){return this.contexts},set:function(t){this.contexts!==t&amp;&amp;(this.contexts=t,this.generateCurrentContextIds())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;currentContextId&quot;,{get:function(){return this._currentContextIds[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;currentContextIds&quot;,{get:function(){return this._currentContextIds},enumerable:!0,configurable:!0}),t.prototype.generateCurrentContextIds=function(){for(var t=[],e=0;e&lt;this.contexts.length-1;e++){var n=this.contexts.slice(0,this.contexts.length-e);t.push(this.contextIdforContexts(n))}t.push(&quot;&quot;),this._currentContextIds=t},t.prototype.contextIdforContexts=function(t){return t?t.map(function(t){return 0===t.id&amp;&amp;0===t.iterationId?&quot;&quot;:t.frameName+&quot;-&quot;+t.iterationId}).join(&quot;/&quot;):&quot;&quot;},t.prototype.enterFrame=function(t){this.contexts&amp;&amp;(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,t)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))},t.prototype.exitFrame=function(){if(!(this.contexts&amp;&amp;this.contexts.length&gt;1))throw new Error(&quot;Cannot exit frame, the context is empty&quot;);this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()},t.prototype.nextIteration=function(){if(!(this.contexts&amp;&amp;this.contexts.length&gt;0))throw new Error(&quot;Cannot increase frame iteration, the context is empty&quot;);this.contexts=this.contexts.slice(),this.lastId++;var t=Object.assign({},this.contexts[this.contexts.length-1]);t.iterationId+=1,t.id=this.lastId,this.contexts.splice(-1,1,t),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))},t.prototype.getWeight=function(t){return this.weightMap[t]},t.prototype.addTensorArray=function(t){this.tensorArrayMap[t.id]=t},t.prototype.getTensorArray=function(t){return this.tensorArrayMap[t]},t}();n.ExecutionContext=r},{}],9:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n&lt;r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&amp;&amp;(t[i]=e[i]);return t}).apply(this,arguments)},i=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},o=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../operations/executors/utils&quot;),u=t(&quot;../operations/operation_executor&quot;),l=t(&quot;./execution_context&quot;),c=function(){function t(t){this.graph=t,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=&quot;,&quot;,this.placeholders=t.placeholders,this._outputs=t.outputs,this.compile()}return Object.defineProperty(t.prototype,&quot;weightMap&quot;,{get:function(){return this._weightMap},set:function(t){var e=Object.keys(t).map(function(e){return t[e].map(function(t){return t.id})});this.weightIds=[].concat.apply([],e),this._weightMap=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;inputs&quot;,{get:function(){return this.placeholders.map(function(t){return{name:t.name,shape:t.attrParams.shape?t.attrParams.shape.value:void 0,dtype:t.attrParams.dtype?t.attrParams.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;outputs&quot;,{get:function(){return this._outputs.map(function(t){return{name:t.name,shape:t.attrParams.shape?t.attrParams.shape.value:void 0,dtype:t.attrParams.dtype?t.attrParams.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;inputNodes&quot;,{get:function(){return this.placeholders.map(function(t){return t.name})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;outputNodes&quot;,{get:function(){return this.outputs.map(function(t){return t.name})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;isControlFlowModel&quot;,{get:function(){return this.graph.withControlFlow},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;isDynamicShapeModel&quot;,{get:function(){return this.graph.withDynamicShape},enumerable:!0,configurable:!0}),t.prototype.compile=function(t){if(!this.graph.withControlFlow&amp;&amp;!this.graph.withDynamicShape){var e=[],n=t||this.graph.placeholders,r=n.map(function(t){return t.name}).sort().join(this.SEPERATOR);if(!this.compiledMap.get(r)){for(var i=n.concat(this.graph.weights),o={};i.length&gt;0;){var a=i.pop();o[a.name]=!0,e.push(a),a.children.forEach(function(t){!o[t.name]&amp;&amp;t.inputNames.every(function(t){var e=s.getNodeNameAndIndex(t)[0];return o[e]})&amp;&amp;i.push(t)})}this.compiledMap.set(r,e)}}},t.prototype.execute=function(t,e,n){var i=this;void 0===e&amp;&amp;(e=!0);var o=Object.keys(t).sort();this.checkInput(t,e),this.checkInputShapeAndType(t,e),this.compile(o.map(function(t){return i.graph.nodes[t]}));var s=this.calculateOutputs(n);this.checkOutput(this.compiledMap.get(o.join(this.SEPERATOR)),s);var c={};return a.tidy(function(){for(var e=new l.ExecutionContext(i._weightMap,c),n=r({},i.weightMap,t),a=i.getFrozenTensorIds(n),f={},p=i.compiledMap.get(o.join(i.SEPERATOR)),h=0;h&lt;p.length;h++){var d=p[h];if(n[d.name]||(n[d.name]=u.executeOp(d,n,e),i.checkTensorForDisposal(d.name,d,n,e,a,s,f)),s.every(function(t){return!!n[t]}))break}return i.findOutputs(n,e,s)})},t.prototype.getFrozenTensorIds=function(t){var e=[].concat.apply([],Object.keys(t).map(function(e){return t[e]}).map(function(t){return t.map(function(t){return t.id})}));return new Set(e)},t.prototype.checkTensorForDisposal=function(t,e,n,r,i,o,a){&quot;control&quot;!==e.category&amp;&amp;-1===o.indexOf(t)&amp;&amp;(n[t].forEach(function(t){null!=t&amp;&amp;(a[t.id]=(a[t.id]||0)+e.children.length)}),e.inputs.forEach(function(t){if(&quot;control&quot;!==t.category){var e=s.getTensorsForCurrentContenxt(t.name,n,r);null!=e&amp;&amp;e.forEach(function(t){if(t&amp;&amp;!i.has(t.id)){var e=a[t.id];1===e?(t.dispose(),delete a[t.id]):null!=e&amp;&amp;a[t.id]--}})}}))},t.prototype.executeAsync=function(t,e){return i(this,void 0,void 0,function(){var n,r,i,a,s,u,c,f,p=this;return o(this,function(o){switch(o.label){case 0:return this.checkInput(t,!1),this.checkInputShapeAndType(t,!1),n={},r=new l.ExecutionContext(this._weightMap,n),i=this.calculateOutputs(e),[4,this.executeWithControlFlow(t,r,i)];case 1:return a=o.sent(),s=this.findOutputs(a,r,e),u=Object.keys(s).map(function(t){return s[t].id}),c=Object.keys(t).map(function(e){return t[e].map(function(t){return t.id})}),f=[].concat.apply([],c),Object.keys(a).forEach(function(t){a[t].forEach(function(t){t&amp;&amp;!t.isDisposed&amp;&amp;-1===u.indexOf(t.id)&amp;&amp;-1===f.indexOf(t.id)&amp;&amp;-1===p.weightIds.indexOf(t.id)&amp;&amp;t.dispose()})}),[2,s]}})})},t.prototype.executeWithControlFlow=function(t,e,n){return i(this,void 0,void 0,function(){var i,a,s,u,l,c,f,p,h=this;return o(this,function(o){switch(o.label){case 0:i=Object.keys(t),a=i.map(function(t){return h.graph.nodes[t]}),s=a.concat(this.graph.weights).map(function(t){return{node:t,contexts:e.currentContext}}),u=r({},this.weightMap,t),l={},c=this.getFrozenTensorIds(u),f={},o.label=1;case 1:return s.length&gt;0?(p=this.processStack(a,s,e,u,f,c,n,l),[4,Promise.all(p)]):[3,3];case 2:return o.sent(),[3,1];case 3:return[2,u]}})})},t.prototype.processStack=function(t,e,n,r,i,o,a,l){for(var c=this,f=[],p=function(){var p=e.pop();n.currentContext=p.contexts;var d=&quot;&quot;;if(&quot;Enter&quot;===p.node.op&amp;&amp;s.getParamValue(&quot;isConstant&quot;,p.node,r,n)&amp;&amp;(d=s.getNodeNameAndIndex(p.node.name,n)[0]),-1===t.indexOf(p.node)){var m=u.executeOp(p.node,r,n);d||(d=s.getNodeNameAndIndex(p.node.name,n)[0]);var g=n.currentContext;m instanceof Promise?f.push(m.then(function(t){return r[d]=t,n.currentContext=g,c.checkTensorForDisposal(d,p.node,r,n,o,a,l),c.processChildNodes(p.node,e,n,r,i),t})):(r[d]=m,h.checkTensorForDisposal(d,p.node,r,n,o,a,l),h.processChildNodes(p.node,e,n,r,i))}else h.processChildNodes(p.node,e,n,r,i)},h=this;e.length&gt;0;)p();return f},t.prototype.processChildNodes=function(t,e,n,r,i){t.children.forEach(function(t){var o=s.getNodeNameAndIndex(t.name,n)[0];i[o]||(&quot;Merge&quot;===t.op?t.inputNames.some(function(t){return!!s.getTensor(t,r,n)})&amp;&amp;(i[o]=!0,e.push({contexts:n.currentContext,node:t})):t.inputNames.every(function(t){return!!s.getTensor(t,r,n)})&amp;&amp;(i[o]=!0,e.push({contexts:n.currentContext,node:t})))})},t.prototype.calculateOutputs=function(t){return!t||t instanceof Array||(t=[t]),t||this.graph.outputs.map(function(t){return t.name})},t.prototype.findOutputs=function(t,e,n){return this.calculateOutputs(n).reduce(function(n,r){return n[r]=s.getTensor(r,t,e),n},{})},t.prototype.dispose=function(){var t=this;Object.keys(this.weightMap).forEach(function(e){return t.weightMap[e].forEach(function(t){return t.dispose()})})},t.prototype.checkInputShapeAndType=function(t,e){void 0===e&amp;&amp;(e=!0),this.placeholders.forEach(function(n){var r=t[n.name];if(e||r){var i=r[0];if(n.attrParams.shape&amp;&amp;n.attrParams.shape.value){var o=n.attrParams.shape.value,s=o.length===i.shape.length&amp;&amp;i.shape.every(function(t,e){return-1===o[e]||o[e]===t});a.util.assert(s,function(){return&quot;The shape of dict[&apos;&quot;+n.name+&quot;&apos;] provided in model.execute(dict) must be [&quot;+o+&quot;], but was [&quot;+i.shape+&quot;]&quot;})}n.attrParams.dtype&amp;&amp;n.attrParams.dtype.value&amp;&amp;a.util.assert(i.dtype===n.attrParams.dtype.value,function(){return&quot;The dtype of dict[&apos;&quot;+n.name+&quot;&apos;] provided in model.execute(dict) must be &quot;+n.attrParams.dtype.value+&quot;, but was &quot;+i.dtype})}})},t.prototype.checkInput=function(t,e){var n=this;void 0===e&amp;&amp;(e=!0);var r=Object.keys(t),i=[],o=[];this.inputNodes.forEach(function(t){-1===r.indexOf(t)&amp;&amp;i.push(t)}),r.forEach(function(t){-1===n.inputNodes.indexOf(t)&amp;&amp;o.push(t)});var a=o.filter(function(t){return!n.graph.nodes[t]});if(i.length&gt;0&amp;&amp;e)throw new Error(&quot;The dict provided in model.execute(dict) has the keys [&quot;+r+&quot;], but is missing the required keys: [&quot;+i+&quot;].&quot;);if(o.length&gt;0&amp;&amp;e)throw new Error(&quot;The dict provided in model.execute(dict) has unused keys: [&quot;+o+&quot;]. Please provide only the following keys: [&quot;+this.inputNodes+&quot;].&quot;);if(a.length&gt;0)throw new Error(&quot;The dict provided in model.execute(dict) has keys: [&quot;+a+&quot;] not part of model graph.&quot;)},t.prototype.checkOutput=function(t,e){var n=t.map(function(t){return t.name}),r=[];if(e.forEach(function(t){var e=s.parseNodeName(t)[0];-1===n.indexOf(e)&amp;&amp;r.push(e)}),r.length&gt;0)throw new Error(&quot;The following outputs are not generated by the execution: [&quot;+r+&quot;].&quot;)},t}();n.GraphExecutor=c},{&quot;../operations/executors/utils&quot;:29,&quot;../operations/operation_executor&quot;:46,&quot;./execution_context&quot;:8,&quot;@tensorflow/tfjs-core&quot;:138}],10:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;../operations/operation_mapper&quot;),s=t(&quot;./graph_executor&quot;);n.TFHUB_SEARCH_PARAM=&quot;?tfjs-format=file&quot;,n.DEFAULT_MODEL_NAME=&quot;model.json&quot;;var u=function(){function t(t,e){void 0===e&amp;&amp;(e={}),this.modelUrl=t,this.loadOptions=e,this.version=&quot;n/a&quot;,null==e&amp;&amp;(this.loadOptions={})}return Object.defineProperty(t.prototype,&quot;modelVersion&quot;,{get:function(){return this.version},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;inputNodes&quot;,{get:function(){return this.executor.inputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;outputNodes&quot;,{get:function(){return this.executor.outputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;inputs&quot;,{get:function(){return this.executor.inputs},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;outputs&quot;,{get:function(){return this.executor.outputs},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,&quot;weights&quot;,{get:function(){return this.executor.weightMap},enumerable:!0,configurable:!0}),t.prototype.findIOHandler=function(){var t=this.modelUrl;if(null!=t.load)this.handler=t;else if(null!=this.loadOptions.requestInit)this.handler=o.io.browserHTTPRequest(t,this.loadOptions);else{var e=o.io.getLoadHandlers(t,this.loadOptions.onProgress);if(0===e.length)e.push(o.io.browserHTTPRequest(t,this.loadOptions));else if(e.length&gt;1)throw new Error(&quot;Found more than one (&quot;+e.length+&quot;) load handlers for URL &apos;&quot;+[t]+&quot;&apos;&quot;);this.handler=e[0]}},t.prototype.load=function(){return r(this,void 0,void 0,function(){var t,e,n;return i(this,function(r){switch(r.label){case 0:if(this.findIOHandler(),null==this.handler.load)throw new Error(&quot;Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.&quot;);return[4,this.handler.load()];case 1:return t=r.sent(),e=t.modelTopology,this.version=e.versions.producer+&quot;.&quot;+e.versions.minConsumer,n=o.io.decodeWeights(t.weightData,t.weightSpecs),this.executor=new s.GraphExecutor(a.OperationMapper.Instance.transformGraph(e)),this.executor.weightMap=this.convertTensorMapToTensorsMap(n),[2,!0]}})})},t.prototype.predict=function(t,e){return this.execute_(t,!0,this.outputNodes)},t.prototype.constructTensorMap=function(t){var e=t instanceof o.Tensor?[t]:t;if(e.length!==this.inputNodes.length)throw new Error(&quot;Input tensor count mismatch,the graph model has &quot;+this.inputNodes.length+&quot; placeholders, while there are &quot;+e.length+&quot; input tensors.&quot;);return this.inputNodes.reduce(function(t,n,r){return t[n]=e[r],t},{})},t.prototype.execute=function(t,e){return this.execute_(t,!1,e)},t.prototype.execute_=function(t,e,n){if(void 0===e&amp;&amp;(e=!0),n=n||this.outputNodes,(t instanceof o.Tensor||Array.isArray(t))&amp;&amp;(t=this.constructTensorMap(t)),this.executor.isControlFlowModel||this.executor.isDynamicShapeModel)throw new Error(&quot;The model contains control flow or dynamic shape ops, please use executeAsync method&quot;);var r=this.executor.execute(this.convertTensorMapToTensorsMap(t),e,n),i=Object.keys(r);return Array.isArray(n)&amp;&amp;n.length&gt;1?n.map(function(t){return r[t]}):r[i[0]]},t.prototype.executeAsync=function(t,e){return r(this,void 0,void 0,function(){var n,r;return i(this,function(i){switch(i.label){case 0:if(!this.executor.isControlFlowModel&amp;&amp;!this.executor.isDynamicShapeModel)throw new Error(&quot;The model does not contain control flow or dynamic shape ops, please use execute method for better performance.&quot;);return e=e||this.outputNodes,(t instanceof o.Tensor||Array.isArray(t))&amp;&amp;(t=this.constructTensorMap(t)),[4,this.executor.executeAsync(this.convertTensorMapToTensorsMap(t),e)];case 1:return n=i.sent(),r=Object.keys(n),[2,Array.isArray(e)&amp;&amp;e.length&gt;1?e.map(function(t){return n[t]}):n[r[0]]]}})})},t.prototype.convertTensorMapToTensorsMap=function(t){return Object.keys(t).reduce(function(e,n){return e[n]=[t[n]],e},{})},t.prototype.dispose=function(){this.executor.dispose()},t}();n.GraphModel=u,n.loadGraphModel=function(t,e){return void 0===e&amp;&amp;(e={}),r(this,void 0,void 0,function(){var r;return i(this,function(i){switch(i.label){case 0:if(null==t)throw new Error(&quot;modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model&quot;);return null==e&amp;&amp;(e={}),e.fromTFHub&amp;&amp;null==t.load&amp;&amp;(t.endsWith(&quot;/&quot;)||(t+=&quot;/&quot;),t=&quot;&quot;+t+n.DEFAULT_MODEL_NAME+n.TFHUB_SEARCH_PARAM),[4,(r=new u(t,e)).load()];case 1:return i.sent(),[2,r]}})})}},{&quot;../operations/operation_mapper&quot;:47,&quot;./graph_executor&quot;:9,&quot;@tensorflow/tfjs-core&quot;:138}],11:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=function(){function t(e,n,r,i,o,a,s){this.name=e,this.dtype=n,this.maxSize=r,this.elementShape=i,this.identicalElementShapes=o,this.dynamicSize=a,this.clearAfterRead=s,this.tensors=[],this.closed_=!1,this.id=t.nextId++}return Object.defineProperty(t.prototype,&quot;closed&quot;,{get:function(){return this.closed_},enumerable:!0,configurable:!0}),t.prototype.clearAndClose=function(){this.tensors.forEach(function(t){return t.tensor.dispose()}),this.tensors=[],this.closed_=!0},t.prototype.size=function(){return this.tensors.length},t.prototype.read=function(t){if(this.closed_)throw new Error(&quot;TensorArray &quot;+this.name+&quot; has already been closed.&quot;);if(t&lt;0||t&gt;=this.tensors.length)throw new Error(&quot;Tried to read from index &quot;+t+&quot;, but array size is: &quot;+this.tensors.length);var e=this.tensors[t];if(e.cleared)throw new Error(&quot;TensorArray &quot;+this.name+&quot;: Could not read index &quot;+t+&quot; twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).&quot;);return this.clearAfterRead&amp;&amp;(e.cleared=!0),e.read=!0,e.tensor},t.prototype.readMany=function(t){var e=this;return t.map(function(t){return e.read(t)})},t.prototype.write=function(t,e){if(this.closed_)throw new Error(&quot;TensorArray &quot;+this.name+&quot; has already been closed.&quot;);if(t&lt;0||!this.dynamicSize&amp;&amp;t&gt;=this.maxSize)throw new Error(&quot;Tried to write to index &quot;+t+&quot;, but array is not resizeable and size is: &quot;+this.maxSize);var n=this.tensors[t]||{};if(e.dtype!==this.dtype)throw new Error(&quot;TensorArray &quot;+this.name+&quot;: Could not write to TensorArray index &quot;+t+&quot;,\n          because the value dtype is &quot;+e.dtype+&quot;, but TensorArray dtype is &quot;+this.dtype+&quot;.&quot;);if(0!==this.size()||null!=this.elementShape&amp;&amp;0!==this.elementShape.length||(this.elementShape=e.shape),this.assertShapesMatchAllowUndefinedSize(this.elementShape,e.shape,&quot;TensorArray &quot;+this.name+&quot;: Could not write to TensorArray index &quot;+t+&quot;.&quot;),n&amp;&amp;n.read)throw new Error(&quot;TensorArray &quot;+this.name+&quot;: Could not write to TensorArray index &quot;+t+&quot;, because it has already been read.&quot;);if(n&amp;&amp;n.written)throw new Error(&quot;TensorArray &quot;+this.name+&quot;: Could not write to TensorArray index &quot;+t+&quot;, because it has already been written.&quot;);n.tensor=e,n.written=!0,this.tensors[t]=n},t.prototype.writeMany=function(t,e){var n=this;if(t.length!==e.length)throw new Error(&quot;TensorArray &quot;+this.name+&quot;: could not write multiple tensors,because the index size: &quot;+t.length+&quot; is not the same as tensors size: &quot;+e.length+&quot;.&quot;);t.forEach(function(t,r){return n.write(t,e[r])})},t.prototype.gather=function(t,e){if(e&amp;&amp;e!==this.dtype)throw new Error(&quot;TensorArray dtype is &quot;+this.dtype+&quot; but gather requested dtype &quot;+e);if(!t){t=[];for(var n=0;n&lt;this.size();n++)t.push(n)}if(0===t.length)return r.tensor([],[0].concat(this.elementShape));var i=this.readMany(t);return this.assertShapesMatchAllowUndefinedSize(this.elementShape,i[0].shape,&quot;TensorArray shape mismatch: &quot;),r.stack(i,0)},t.prototype.concat=function(t){if(t&amp;&amp;t!==this.dtype)throw new Error(&quot;TensorArray dtype is &quot;+this.dtype+&quot; but concat requested dtype &quot;+t);if(0===this.size())return r.tensor([],[0].concat(this.elementShape));for(var e=[],n=0;n&lt;this.size();n++)e.push(n);var i=this.readMany(e);return this.assertShapesMatchAllowUndefinedSize(this.elementShape,i[0].shape,&quot;TensorArray shape mismatch: tensor array shape (&quot;+this.elementShape+&quot;) vs first tensor shape (&quot;+i[0].shape+&quot;)&quot;),r.concat(i,0)},t.prototype.scatter=function(t,e){if(e.dtype!==this.dtype)throw new Error(&quot;TensorArray dtype is &quot;+this.dtype+&quot; but tensor has dtype &quot;+e.dtype);if(t.length!==e.shape[0])throw new Error(&quot;Expected len(indices) == tensor.shape[0], but saw: &quot;+t.length+&quot; vs. &quot;+e.shape[0]);var n=Math.max.apply(Math,t);if(!this.dynamicSize&amp;&amp;n&gt;=this.maxSize)throw new Error(&quot;Max index must be &lt; array size (&quot;+n+&quot;  vs. &quot;+this.maxSize+&quot;)&quot;);this.writeMany(t,r.unstack(e,0))},t.prototype.split=function(t,e){var n=this;if(e.dtype!==this.dtype)throw new Error(&quot;TensorArray dtype is &quot;+this.dtype+&quot; but tensor has dtype &quot;+e.dtype);var i=0,o=t.map(function(t){return i+=t});if(i!==e.shape[0])throw new Error(&quot;Expected sum of lengths to be equal to\n          tensor.shape[0], but sum of lengths is\n        &quot;+i+&quot;, and tensor&apos;s shape is: &quot;+e.shape);if(!this.dynamicSize&amp;&amp;t.length!==this.maxSize)throw new Error(&quot;TensorArray&apos;s size is not equal to the size of lengths (&quot;+this.maxSize+&quot; vs. &quot;+t.length+&quot;), and the TensorArray is not marked as dynamically resizeable&quot;);var a=0===i?0:e.size/i,s=[];r.tidy(function(){e=e.reshape([1,i,a]);for(var u=0;u&lt;t.length;++u){var l=[0,0===u?0:o[u-1],0],c=[1,t[u],a];s[u]=r.slice(e,l,c).reshape(n.elementShape)}return s});for(var u=[],l=0;l&lt;t.length;l++)u[l]=l;this.writeMany(u,s)},t.prototype.assertShapesMatchAllowUndefinedSize=function(t,e,n){void 0===n&amp;&amp;(n=&quot;&quot;),r.util.assert(this.shapesEqualAllowUndefinedSize(t,e),function(){return n+&quot; Shapes &quot;+t+&quot; and &quot;+e+&quot; must match&quot;})},t.prototype.shapesEqualAllowUndefinedSize=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n&lt;t.length;n++)if(-1!==t[n]&amp;&amp;-1!==e[n]&amp;&amp;t[n]!==e[n])return!1;return!0},t.nextId=0,t}();n.TensorArray=i},{&quot;@tensorflow/tfjs-core&quot;:138}],12:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./executor/graph_model&quot;);n.GraphModel=r.GraphModel,n.loadGraphModel=r.loadGraphModel;var i=t(&quot;./version&quot;);n.version_converter=i.version},{&quot;./executor/graph_model&quot;:10,&quot;./version&quot;:48}],13:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;BiasAdd&quot;:case&quot;Add&quot;:return[r.add(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;AddN&quot;:return[r.addN(i.getParamValue(&quot;tensors&quot;,t,e,n))];case&quot;FloorMod&quot;:case&quot;Mod&quot;:return[r.mod(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;Mul&quot;:return[r.mul(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;RealDiv&quot;:case&quot;Div&quot;:return[r.div(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;FloorDiv&quot;:return[r.floorDiv(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;Sub&quot;:return[r.sub(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;Minimum&quot;:return[r.minimum(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;Maximum&quot;:return[r.maximum(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;Pow&quot;:return[r.pow(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;SquaredDifference&quot;:return[r.squaredDifference(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;arithmetic&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],14:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;Abs&quot;:return[r.abs(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Acos&quot;:return[r.acos(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Acosh&quot;:return[r.acosh(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Asin&quot;:return[r.asin(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Asinh&quot;:return[r.asinh(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Atan&quot;:return[r.atan(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Atan2&quot;:return[r.atan2(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;y&quot;,t,e,n))];case&quot;Atanh&quot;:return[r.atanh(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Ceil&quot;:return[r.ceil(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Cos&quot;:return[r.cos(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Cosh&quot;:return[r.cosh(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Elu&quot;:return[r.elu(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Erf&quot;:return[r.erf(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Exp&quot;:return[r.exp(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Expm1&quot;:return[r.expm1(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Floor&quot;:return[r.floor(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Log&quot;:return[r.log(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Log1p&quot;:return[r.log1p(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Neg&quot;:return[r.neg(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Reciprocal&quot;:return[r.reciprocal(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Relu&quot;:return[r.relu(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Round&quot;:return[r.round(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Selu&quot;:return[r.selu(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Sigmoid&quot;:return[r.sigmoid(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Sin&quot;:return[r.sin(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Sign&quot;:return[r.sign(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Sinh&quot;:return[r.sinh(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Softplus&quot;:return[r.softplus(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Sqrt&quot;:return[r.sqrt(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Square&quot;:return[r.square(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Tanh&quot;:return[r.tanh(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Tan&quot;:return[r.tan(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;Relu6&quot;:case&quot;ClipByValue&quot;:return[r.clipByValue(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;clipValueMin&quot;,t,e,n),i.getParamValue(&quot;clipValueMax&quot;,t,e,n))];case&quot;Rsqrt&quot;:return[r.rsqrt(i.getTensor(t.inputNames[0],e,n))];case&quot;Prod&quot;:return[r.prod(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;axes&quot;,t,e,n))];case&quot;LeakyRelu&quot;:return[r.leakyRelu(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;alpha&quot;,t,e,n))];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;basic_math&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],15:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;../../executor/tensor_array&quot;),s=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){return r(this,void 0,void 0,function(){var r,u,l,c,f,p,h,d,m,g,v,y,b,_,w,x,E,k,T,N,S,C,A,I,O,M,R,P,D,z,L,F,V,B,j;return i(this,function(i){switch(i.label){case 0:switch(t.op){case&quot;LoopCond&quot;:return[3,1];case&quot;Switch&quot;:return[3,2];case&quot;Merge&quot;:return[3,4];case&quot;Enter&quot;:return[3,5];case&quot;Exit&quot;:return[3,6];case&quot;NextIteration&quot;:return[3,7];case&quot;TensorArrayV3&quot;:return[3,8];case&quot;TensorArrayWriteV3&quot;:return[3,9];case&quot;TensorArrayReadV3&quot;:return[3,10];case&quot;TensorArrayGatherV3&quot;:return[3,11];case&quot;TensorArrayScatterV3&quot;:return[3,12];case&quot;TensorArrayConcatV3&quot;:return[3,13];case&quot;TensorArraySplitV3&quot;:return[3,14];case&quot;TensorArraySizeV3&quot;:return[3,15];case&quot;TensorArrayCloseV3&quot;:return[3,16]}return[3,17];case 1:return[2,[s.getParamValue(&quot;pred&quot;,t,e,n).clone()]];case 2:return r=s.getParamValue(&quot;pred&quot;,t,e,n),u=s.getParamValue(&quot;data&quot;,t,e,n),[4,r.data()];case 3:return[2,i.sent()[0]?[void 0,u.clone()]:[u.clone(),void 0]];case 4:return[2,(l=t.inputNames.find(function(t){return void 0!==s.getTensor(t,e,n)}))?[s.getTensor(l,e,n).clone()]:void 0];case 5:return c=s.getParamValue(&quot;frameName&quot;,t,e,n),f=s.getParamValue(&quot;tensor&quot;,t,e,n),n.enterFrame(c),[2,[f.clone()]];case 6:return p=s.getParamValue(&quot;tensor&quot;,t,e,n),n.exitFrame(),[2,[p.clone()]];case 7:return h=s.getParamValue(&quot;tensor&quot;,t,e,n),n.nextIteration(),[2,[h.clone()]];case 8:return d=s.getParamValue(&quot;size&quot;,t,e,n),m=s.getParamValue(&quot;dtype&quot;,t,e,n),g=s.getParamValue(&quot;elementShape&quot;,t,e,n),v=s.getParamValue(&quot;dynamicSize&quot;,t,e,n),y=s.getParamValue(&quot;clearAfterRead&quot;,t,e,n),b=s.getParamValue(&quot;identicalElementShapes&quot;,t,e,n),_=s.getParamValue(&quot;name&quot;,t,e,n),w=new a.TensorArray(_,m,d,g,b,v,y),n.addTensorArray(w),[2,[o.scalar(w.id),o.scalar(1)]];case 9:return x=s.getParamValue(&quot;tensorArrayId&quot;,t,e,n),E=s.getParamValue(&quot;index&quot;,t,e,n),k=s.getParamValue(&quot;tensor&quot;,t,e,n),n.getTensorArray(x).write(E,k),[2,[o.scalar(1)]];case 10:return T=s.getParamValue(&quot;tensorArrayId&quot;,t,e,n),N=s.getParamValue(&quot;index&quot;,t,e,n),[2,[n.getTensorArray(T).read(N)]];case 11:return S=s.getParamValue(&quot;tensorArrayId&quot;,t,e,n),C=s.getParamValue(&quot;indices&quot;,t,e,n),A=s.getParamValue(&quot;dtype&quot;,t,e,n),[2,[n.getTensorArray(S).gather(C,A)]];case 12:return I=s.getParamValue(&quot;tensorArrayId&quot;,t,e,n),O=s.getParamValue(&quot;indices&quot;,t,e,n),M=s.getParamValue(&quot;tensor&quot;,t,e,n),n.getTensorArray(I).scatter(O,M),[2,[o.scalar(1)]];case 13:return R=s.getParamValue(&quot;tensorArrayId&quot;,t,e,n),P=n.getTensorArray(R),D=s.getParamValue(&quot;dtype&quot;,t,e,n),[2,[P.concat(D)]];case 14:return z=s.getParamValue(&quot;tensorArrayId&quot;,t,e,n),L=s.getParamValue(&quot;tensor&quot;,t,e,n),F=s.getParamValue(&quot;lengths&quot;,t,e,n),n.getTensorArray(z).split(F,L),[2,[o.scalar(1)]];case 15:return V=s.getParamValue(&quot;tensorArrayId&quot;,t,e,n),B=n.getTensorArray(V),[2,[o.scalar(B.size(),&quot;int32&quot;)]];case 16:return j=s.getParamValue(&quot;tensorArrayId&quot;,t,e,n),n.getTensorArray(j).clearAndClose(),[2,[]];case 17:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}})})},n.CATEGORY=&quot;control&quot;},{&quot;../../executor/tensor_array&quot;:11,&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],16:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;Conv1D&quot;:var o=i.getParamValue(&quot;stride&quot;,t,e,n),a=i.getParamValue(&quot;pad&quot;,t,e,n),s=i.getParamValue(&quot;dataFormat&quot;,t,e,n).toUpperCase(),u=i.getParamValue(&quot;dilation&quot;,t,e,n);return[r.conv1d(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;filter&quot;,t,e,n),o,a,s,u)];case&quot;Conv2D&quot;:o=i.getParamValue(&quot;strides&quot;,t,e,n),a=i.getParamValue(&quot;pad&quot;,t,e,n),s=i.getParamValue(&quot;dataFormat&quot;,t,e,n).toUpperCase();var l=i.getParamValue(&quot;dilations&quot;,t,e,n);return[r.conv2d(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;filter&quot;,t,e,n),[o[1],o[2]],a,s,[l[0],l[1]])];case&quot;Conv2DBackpropInput&quot;:case&quot;Conv2dTranspose&quot;:var c=i.getParamValue(&quot;outputShape&quot;,t,e,n);o=i.getParamValue(&quot;strides&quot;,t,e,n),a=i.getParamValue(&quot;pad&quot;,t,e,n);return[r.conv2dTranspose(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;filter&quot;,t,e,n),c,[o[1],o[2]],a)];case&quot;DepthwiseConv2dNative&quot;:case&quot;DepthwiseConv2d&quot;:o=i.getParamValue(&quot;strides&quot;,t,e,n),a=i.getParamValue(&quot;pad&quot;,t,e,n),l=i.getParamValue(&quot;dilations&quot;,t,e,n),s=i.getParamValue(&quot;dataFormat&quot;,t,e,n).toUpperCase();return[r.depthwiseConv2d(i.getParamValue(&quot;input&quot;,t,e,n),i.getParamValue(&quot;filter&quot;,t,e,n),[o[1],o[2]],a,s,[l[0],l[1]])];case&quot;AvgPool&quot;:o=i.getParamValue(&quot;strides&quot;,t,e,n),a=i.getParamValue(&quot;pad&quot;,t,e,n);var f=i.getParamValue(&quot;kernelSize&quot;,t,e,n);return[r.avgPool(i.getParamValue(&quot;x&quot;,t,e,n),[f[1],f[2]],[o[1],o[2]],a)];case&quot;MaxPool&quot;:o=i.getParamValue(&quot;strides&quot;,t,e,n),a=i.getParamValue(&quot;pad&quot;,t,e,n),f=i.getParamValue(&quot;kernelSize&quot;,t,e,n);return[r.maxPool(i.getParamValue(&quot;x&quot;,t,e,n),[f[1],f[2]],[o[1],o[2]],a)];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;convolution&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],17:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;Fill&quot;:var o=i.getParamValue(&quot;shape&quot;,t,e,n),a=i.getParamValue(&quot;dtype&quot;,t,e,n),s=i.getParamValue(&quot;value&quot;,t,e,n);return[r.fill(o,s,a)];case&quot;LinSpace&quot;:var u=i.getParamValue(&quot;start&quot;,t,e,n),l=i.getParamValue(&quot;stop&quot;,t,e,n),c=i.getParamValue(&quot;num&quot;,t,e,n);return[r.linspace(u,l,c)];case&quot;OneHot&quot;:var f=i.getParamValue(&quot;indices&quot;,t,e,n),p=i.getParamValue(&quot;depth&quot;,t,e,n),h=i.getParamValue(&quot;onValue&quot;,t,e,n),d=i.getParamValue(&quot;offValue&quot;,t,e,n);return[r.oneHot(f,p,h,d)];case&quot;Ones&quot;:return[r.ones(i.getParamValue(&quot;shape&quot;,t,e,n),i.getParamValue(&quot;dtype&quot;,t,e,n))];case&quot;OnesLike&quot;:return[r.onesLike(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;RandomUniform&quot;:return[r.randomUniform(i.getParamValue(&quot;shape&quot;,t,e,n),i.getParamValue(&quot;minval&quot;,t,e,n),i.getParamValue(&quot;maxval&quot;,t,e,n),i.getParamValue(&quot;dtype&quot;,t,e,n))];case&quot;Range&quot;:u=i.getParamValue(&quot;start&quot;,t,e,n);var m=i.getParamValue(&quot;stop&quot;,t,e,n),g=i.getParamValue(&quot;step&quot;,t,e,n);return[r.range(u,m,g,i.getParamValue(&quot;dtype&quot;,t,e,n))];case&quot;TruncatedNormal&quot;:o=i.getParamValue(&quot;shape&quot;,t,e,n);var v=i.getParamValue(&quot;mean&quot;,t,e,n),y=i.getParamValue(&quot;stdDev&quot;,t,e,n),b=i.getParamValue(&quot;seed&quot;,t,e,n);return[r.truncatedNormal(o,v,y,i.getParamValue(&quot;dtype&quot;,t,e,n),b)];case&quot;Zeros&quot;:return[r.zeros(i.getParamValue(&quot;shape&quot;,t,e,n),i.getParamValue(&quot;dtype&quot;,t,e,n))];case&quot;ZerosLike&quot;:return[r.zerosLike(i.getParamValue(&quot;x&quot;,t,e,n))];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;creation&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],18:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){return r(this,void 0,void 0,function(){var r,s,u,l,c;return i(this,function(i){switch(i.label){case 0:switch(t.op){case&quot;NonMaxSuppressionV3&quot;:case&quot;NonMaxSuppressionV2&quot;:return[3,1];case&quot;Where&quot;:return[3,3];case&quot;ListDiff&quot;:return[3,5]}return[3,7];case 1:return r=a.getParamValue(&quot;boxes&quot;,t,e,n),s=a.getParamValue(&quot;scores&quot;,t,e,n),u=a.getParamValue(&quot;maxOutputSize&quot;,t,e,n),l=a.getParamValue(&quot;iouThreshold&quot;,t,e,n),c=a.getParamValue(&quot;scoreThreshold&quot;,t,e,n),[4,o.image.nonMaxSuppressionAsync(r,s,u,l,c)];case 2:return[2,[i.sent()]];case 3:return[4,o.whereAsync(a.getParamValue(&quot;condition&quot;,t,e,n))];case 4:return[2,[i.sent()]];case 5:return[4,o.setdiff1dAsync(a.getParamValue(&quot;x&quot;,t,e,n),a.getParamValue(&quot;y&quot;,t,e,n))];case 6:return[2,i.sent()];case 7:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}})})},n.CATEGORY=&quot;dynamic&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],19:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;TopKV2&quot;:var o=i.getParamValue(&quot;x&quot;,t,e,n),a=i.getParamValue(&quot;k&quot;,t,e,n),s=i.getParamValue(&quot;sorted&quot;,t,e,n),u=r.topk(o,a,s);return[u.values,u.indices];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;evaluation&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],20:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;Const&quot;:return e[t.name];case&quot;PlaceholderWithDefault&quot;:var o=i.getParamValue(&quot;default&quot;,t,e,n);return[i.getTensor(t.name,e,n)||o];case&quot;Placeholder&quot;:return[i.getTensor(t.name,e,n)];case&quot;Identity&quot;:case&quot;StopGradient&quot;:case&quot;FakeQuantWithMinMaxVars&quot;:return[i.getParamValue(&quot;x&quot;,t,e,n).clone()];case&quot;IdentityN&quot;:return i.getParamValue(&quot;x&quot;,t,e,n).map(function(t){return t.clone()});case&quot;Snapshot&quot;:return[i.getParamValue(&quot;x&quot;,t,e,n).clone()];case&quot;Shape&quot;:return[r.tensor1d(i.getParamValue(&quot;x&quot;,t,e,n).shape,&quot;int32&quot;)];case&quot;ShapeN&quot;:return i.getParamValue(&quot;x&quot;,t,e,n).map(function(t){return r.tensor1d(t.shape)});case&quot;Size&quot;:return[r.scalar(i.getParamValue(&quot;x&quot;,t,e,n).size,&quot;int32&quot;)];case&quot;Rank&quot;:return[r.scalar(i.getParamValue(&quot;x&quot;,t,e,n).rank,&quot;int32&quot;)];case&quot;NoOp&quot;:return[];case&quot;Print&quot;:var a=i.getParamValue(&quot;x&quot;,t,e,n),s=i.getParamValue(&quot;data&quot;,t,e,n),u=i.getParamValue(&quot;message&quot;,t,e,n),l=i.getParamValue(&quot;summarize&quot;,t,e,n);console.warn(&quot;The graph has a tf.print() operation,usually used for debugging, which slows down performance.&quot;),console.log(u);for(var c=0;c&lt;s.length;c++)console.log(Array.prototype.slice.call(s[c].dataSync()).slice(0,l));return[a];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;graph&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],21:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;ResizeBilinear&quot;:var o=i.getParamValue(&quot;images&quot;,t,e,n),a=i.getParamValue(&quot;size&quot;,t,e,n),s=i.getParamValue(&quot;alignCorners&quot;,t,e,n);return[r.image.resizeBilinear(o,[a[0],a[1]],s)];case&quot;ResizeNearestNeighbor&quot;:o=i.getParamValue(&quot;images&quot;,t,e,n),a=i.getParamValue(&quot;size&quot;,t,e,n),s=i.getParamValue(&quot;alignCorners&quot;,t,e,n);return[r.image.resizeNearestNeighbor(o,[a[0],a[1]],s)];case&quot;CropAndResize&quot;:var u=i.getParamValue(&quot;image&quot;,t,e,n),l=i.getParamValue(&quot;boxes&quot;,t,e,n),c=i.getParamValue(&quot;boxInd&quot;,t,e,n),f=i.getParamValue(&quot;cropSize&quot;,t,e,n),p=i.getParamValue(&quot;method&quot;,t,e,n),h=i.getParamValue(&quot;extrapolationValue&quot;,t,e,n);return[r.image.cropAndResize(u,l,c,f,p,h)];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;image&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],22:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;Equal&quot;:return[r.equal(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;NotEqual&quot;:return[r.notEqual(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;Greater&quot;:return[r.greater(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;GreaterEqual&quot;:return[r.greaterEqual(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;Less&quot;:return[r.less(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;LessEqual&quot;:return[r.lessEqual(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;LogicalAnd&quot;:return[r.logicalAnd(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;LogicalNot&quot;:return[r.logicalNot(i.getParamValue(&quot;a&quot;,t,e,n))];case&quot;LogicalOr&quot;:return[r.logicalOr(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];case&quot;Select&quot;:return[r.where(i.getParamValue(&quot;condition&quot;,t,e,n),i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n))];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;logical&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],23:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;BatchMatMul&quot;:case&quot;MatMul&quot;:return[r.matMul(i.getParamValue(&quot;a&quot;,t,e,n),i.getParamValue(&quot;b&quot;,t,e,n),i.getParamValue(&quot;transposeA&quot;,t,e,n),i.getParamValue(&quot;transposeB&quot;,t,e,n))];case&quot;Transpose&quot;:return[r.transpose(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;perm&quot;,t,e,n))];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;matrices&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],24:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;FusedBatchNorm&quot;:case&quot;FusedBatchNormV2&quot;:return[r.batchNorm(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;mean&quot;,t,e,n),i.getParamValue(&quot;variance&quot;,t,e,n),i.getParamValue(&quot;offset&quot;,t,e,n),i.getParamValue(&quot;scale&quot;,t,e,n),i.getParamValue(&quot;epsilon&quot;,t,e,n))];case&quot;LRN&quot;:return[r.localResponseNormalization(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;radius&quot;,t,e,n),i.getParamValue(&quot;bias&quot;,t,e,n),i.getParamValue(&quot;alpha&quot;,t,e,n),i.getParamValue(&quot;beta&quot;,t,e,n))];case&quot;Softmax&quot;:return[r.softmax(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;LogSoftmax&quot;:return[r.logSoftmax(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;SparseToDense&quot;:return[r.sparseToDense(i.getParamValue(&quot;sparseIndices&quot;,t,e,n),i.getParamValue(&quot;outputShape&quot;,t,e,n),i.getParamValue(&quot;sparseValues&quot;,t,e,n),i.getParamValue(&quot;defaultValue&quot;,t,e,n))];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;normalization&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],25:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;Max&quot;:var o=i.getParamValue(&quot;axis&quot;,t,e,n),a=i.getParamValue(&quot;keepDims&quot;,t,e,n);return[r.max(i.getParamValue(&quot;x&quot;,t,e,n),o,a)];case&quot;Mean&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n),a=i.getParamValue(&quot;keepDims&quot;,t,e,n);return[r.mean(i.getParamValue(&quot;x&quot;,t,e,n),o,a)];case&quot;Min&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n),a=i.getParamValue(&quot;keepDims&quot;,t,e,n);return[r.min(i.getParamValue(&quot;x&quot;,t,e,n),o,a)];case&quot;Sum&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n),a=i.getParamValue(&quot;keepDims&quot;,t,e,n);return[r.sum(i.getParamValue(&quot;x&quot;,t,e,n),o,a)];case&quot;All&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n),a=i.getParamValue(&quot;keepDims&quot;,t,e,n);return[r.all(i.getParamValue(&quot;x&quot;,t,e,n),o,a)];case&quot;Any&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n),a=i.getParamValue(&quot;keepDims&quot;,t,e,n);return[r.any(i.getParamValue(&quot;x&quot;,t,e,n),o,a)];case&quot;ArgMax&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n);return[r.argMax(i.getParamValue(&quot;x&quot;,t,e,n),o)];case&quot;ArgMin&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n);return[r.argMin(i.getParamValue(&quot;x&quot;,t,e,n),o)];case&quot;Prod&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n),a=i.getParamValue(&quot;keepDims&quot;,t,e,n);return[r.prod(i.getParamValue(&quot;x&quot;,t,e,n),o,a)];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;reduction&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],26:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;ConcatV2&quot;:case&quot;Concat&quot;:var o=i.getParamValue(&quot;axis&quot;,t,e,n),a=i.getParamValue(&quot;tensors&quot;,t,e,n);return[r.concat(a,o)];case&quot;GatherV2&quot;:case&quot;Gather&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n);var s=i.getParamValue(&quot;x&quot;,t,e,n),u=i.getParamValue(&quot;indices&quot;,t,e,n);return[r.gather(s,u.asType(&quot;int32&quot;),o)];case&quot;ReverseV2&quot;:case&quot;Reverse&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n),s=i.getParamValue(&quot;x&quot;,t,e,n);return[r.reverse(s,o)];case&quot;Slice&quot;:var l=i.getParamValue(&quot;begin&quot;,t,e,n),c=i.getParamValue(&quot;size&quot;,t,e,n);return[r.slice(i.getParamValue(&quot;x&quot;,t,e,n),l,c)];case&quot;StridedSlice&quot;:l=i.getParamValue(&quot;begin&quot;,t,e,n);var f=i.getParamValue(&quot;end&quot;,t,e,n),p=i.getParamValue(&quot;strides&quot;,t,e,n),h=i.getParamValue(&quot;beginMask&quot;,t,e,n),d=i.getParamValue(&quot;endMask&quot;,t,e,n),m=i.getParamValue(&quot;ellipsisMask&quot;,t,e,n),g=i.getParamValue(&quot;newAxisMask&quot;,t,e,n),v=i.getParamValue(&quot;shrinkAxisMask&quot;,t,e,n),y=i.getParamValue(&quot;x&quot;,t,e,n);if(1===l.length&amp;&amp;y.shape.length&gt;1)for(var b=1;b&lt;y.shape.length;b++)l.push(0),f.push(y.shape[b]),p.push(p[0]);return[r.stridedSlice(y,l,f,p,h,d,m,g,v)];case&quot;Pack&quot;:return r.tidy(function(){var o=i.getParamValue(&quot;axis&quot;,t,e,n),a=i.getParamValue(&quot;tensors&quot;,t,e,n),s=a[0].shape,u=a[0].squeeze().shape,l=a.map(function(t){var e=r.util.arraysEqual(t.shape,s);if(!e&amp;&amp;!r.util.arraysEqual(t.squeeze().shape,u))throw new Error(&quot;the input tensors shape does not match&quot;);return e?t:t.reshape(s)});return[r.stack(l,o)]});case&quot;Unpack&quot;:return r.tidy(function(){var o=i.getParamValue(&quot;axis&quot;,t,e,n),a=i.getParamValue(&quot;tensor&quot;,t,e,n);return r.unstack(a,o)});case&quot;Tile&quot;:var _=i.getParamValue(&quot;reps&quot;,t,e,n);return[r.tile(i.getParamValue(&quot;x&quot;,t,e,n),_)];case&quot;Split&quot;:case&quot;SplitV&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n);var w=i.getParamValue(&quot;numOrSizeSplits&quot;,t,e,n);return r.split(i.getParamValue(&quot;x&quot;,t,e,n),w,o);case&quot;ScatterNd&quot;:u=i.getParamValue(&quot;indices&quot;,t,e,n);var x=i.getParamValue(&quot;values&quot;,t,e,n),E=i.getParamValue(&quot;shape&quot;,t,e,n);return[r.scatterND(u,x,E)];case&quot;GatherNd&quot;:var k=i.getParamValue(&quot;x&quot;,t,e,n);u=i.getParamValue(&quot;indices&quot;,t,e,n);return[r.gatherND(k,u)];case&quot;SparseToDense&quot;:u=i.getParamValue(&quot;sparseIndices&quot;,t,e,n),E=i.getParamValue(&quot;outputShape&quot;,t,e,n);var T=i.getParamValue(&quot;sparseValues&quot;,t,e,n),N=i.getParamValue(&quot;defaultValue&quot;,t,e,n);return[r.sparseToDense(u,T,E,T.dtype===N.dtype?N:N.asType(T.dtype))];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;slice_join&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],27:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;FFT&quot;:return[r.fft(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;IFFT&quot;:return[r.ifft(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;RFFT&quot;:return[r.rfft(i.getParamValue(&quot;x&quot;,t,e,n))];case&quot;IRFFT&quot;:return[r.irfft(i.getParamValue(&quot;x&quot;,t,e,n))];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;spectral&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],28:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./utils&quot;);n.executeOp=function(t,e,n){switch(t.op){case&quot;Cast&quot;:return[r.cast(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;dtype&quot;,t,e,n))];case&quot;ExpandDims&quot;:var o=i.getParamValue(&quot;axis&quot;,t,e,n);return[r.expandDims(i.getParamValue(&quot;x&quot;,t,e,n),o)];case&quot;Squeeze&quot;:o=i.getParamValue(&quot;axis&quot;,t,e,n);return[r.squeeze(i.getParamValue(&quot;x&quot;,t,e,n),o)];case&quot;Reshape&quot;:return[r.reshape(i.getParamValue(&quot;x&quot;,t,e,n),i.getParamValue(&quot;shape&quot;,t,e,n))];case&quot;PadV2&quot;:case&quot;Pad&quot;:return[r.pad(i.getParamValue(&quot;x&quot;,t,e,n),i.split(i.getParamValue(&quot;padding&quot;,t,e,n),2),i.getParamValue(&quot;constantValue&quot;,t,e,n))];case&quot;SpaceToBatchND&quot;:var a=i.getParamValue(&quot;blockShape&quot;,t,e,n),s=i.split(i.getParamValue(&quot;paddings&quot;,t,e,n),2);return[r.spaceToBatchND(i.getParamValue(&quot;x&quot;,t,e,n),a,s)];case&quot;BatchToSpaceND&quot;:a=i.getParamValue(&quot;blockShape&quot;,t,e,n);var u=i.split(i.getParamValue(&quot;crops&quot;,t,e,n),2);return[r.batchToSpaceND(i.getParamValue(&quot;x&quot;,t,e,n),a,u)];case&quot;DepthToSpace&quot;:var l=i.getParamValue(&quot;blockSize&quot;,t,e,n),c=i.getParamValue(&quot;dataFormat&quot;,t,e,n).toUpperCase();return[r.depthToSpace(i.getParamValue(&quot;x&quot;,t,e,n),l,c)];default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}},n.CATEGORY=&quot;transformation&quot;},{&quot;./utils&quot;:29,&quot;@tensorflow/tfjs-core&quot;:138}],29:[function(t,e,n){&quot;use strict&quot;;function r(t,e,n){var r=o(t),a=r[0],s=r[1],u=n.currentContextIds.find(function(t){return!!e[i(a,t)]});return void 0!==u?e[i(a,u)][s]:void 0}function i(t,e){return e?t+&quot;-&quot;+e:t}function o(t){var e=t.lastIndexOf(&quot;:&quot;);return-1===e?[t,0]:[t.substring(0,e),Number(t.substring(e+1))]}Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.getParamValue=function(t,e,n,i){var o=e.inputParams[t];if(o&amp;&amp;void 0!==o.inputIndexStart){var a=o.inputIndexStart,s=0===o.inputIndexEnd?void 0:void 0===o.inputIndexEnd?a+1:o.inputIndexEnd;if(&quot;tensor&quot;===o.type)return r(e.inputNames[o.inputIndexStart],n,i);if(&quot;tensors&quot;===o.type)return e.inputNames.slice(a,s).map(function(t){return r(t,n,i)});var u=Array.prototype.slice.call(r(e.inputNames.slice(a)[0],n,i).dataSync());return&quot;number&quot;===o.type?u[0]:u}var l=e.attrParams[t];return l&amp;&amp;l.value},n.getTensor=r,n.getTensorsForCurrentContenxt=function(t,e,n){return e[i(t,n.currentContextId)]},n.getNodeNameAndIndex=function(t,e){var n=o(t),r=n[0],a=n[1];return[i(r,e&amp;&amp;e.currentContextId),a]},n.parseNodeName=o,n.split=function(t,e){for(var n=[],r=0;r&lt;t.length;r+=e)n.push(t.slice(r,r+e));return n}},{}],30:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;Add&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;AddN&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,end:0,name:&quot;tensors&quot;,type:&quot;tensors&quot;}]},{tfOpName:&quot;BiasAdd&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Sub&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;RealDiv&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Div&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;FloorDiv&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Mul&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Maximum&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;Minimum&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;Pow&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;SquaredDifference&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Mod&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;FloorMod&quot;,category:&quot;arithmetic&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]}]},{}],31:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;Abs&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Acos&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Asin&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Atan&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Atan2&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;y&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Ceil&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;ClipByValue&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;clip_value_min&quot;,name:&quot;clipValueMin&quot;,type:&quot;number&quot;},{tfName:&quot;clip_value_max&quot;,name:&quot;clipValueMax&quot;,type:&quot;number&quot;}]},{tfOpName:&quot;Cos&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Cosh&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Elu&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Exp&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Floor&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Log&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Neg&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Relu&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Relu6&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0},{tfName:&quot;clipValueMin&quot;,name:&quot;clipValueMin&quot;,type:&quot;number&quot;,defaultValue:0},{tfName:&quot;clipValueMax&quot;,name:&quot;clipValueMax&quot;,type:&quot;number&quot;,defaultValue:6}]},{tfOpName:&quot;Selu&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Sigmoid&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Sin&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Sinh&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Sqrt&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Rsqrt&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Square&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Tan&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Tanh&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Sign&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Round&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Expm1&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Log1p&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Reciprocal&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Softplus&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Asinh&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Acosh&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Atanh&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Erf&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Prod&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axes&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;keep_dims&quot;,name:&quot;keepDims&quot;,type:&quot;bool&quot;,notSupported:!0},{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;LeakyRelu&quot;,category:&quot;basic_math&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;alpha&quot;,name:&quot;alpha&quot;,type:&quot;number&quot;,defaultValue:.2},{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]}]},{}],32:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;LoopCond&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;pred&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;Switch&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;data&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;pred&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;Merge&quot;,category:&quot;control&quot;,inputs:[{start:0,end:0,name:&quot;tensors&quot;,type:&quot;tensors&quot;}]},{tfOpName:&quot;Enter&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensor&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0},{tfName:&quot;frame_name&quot;,name:&quot;frameName&quot;,type:&quot;string&quot;},{tfName:&quot;is_constant&quot;,name:&quot;isConstant&quot;,type:&quot;bool&quot;}]},{tfOpName:&quot;Exit&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensor&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;NextIteration&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensor&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;TensorArrayV3&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;size&quot;,type:&quot;number&quot;}],attrs:[{tfName:&quot;dtype&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;},{tfName:&quot;element_shape&quot;,name:&quot;elementShape&quot;,type:&quot;shape&quot;},{tfName:&quot;dynamic_size&quot;,name:&quot;dynamicSize&quot;,type:&quot;bool&quot;},{tfName:&quot;clear_after_read&quot;,name:&quot;clearAfterRead&quot;,type:&quot;bool&quot;},{tfName:&quot;identical_element_shapes&quot;,name:&quot;identicalElementShapes&quot;,type:&quot;bool&quot;},{tfName:&quot;tensor_array_name&quot;,name:&quot;name&quot;,type:&quot;string&quot;}]},{tfOpName:&quot;TensorArrayWriteV3&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensorArrayId&quot;,type:&quot;number&quot;},{start:1,name:&quot;index&quot;,type:&quot;number&quot;},{start:2,name:&quot;tensor&quot;,type:&quot;tensor&quot;},{start:3,name:&quot;flowIn&quot;,type:&quot;number&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;TensorArrayReadV3&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensorArrayId&quot;,type:&quot;number&quot;},{start:1,name:&quot;index&quot;,type:&quot;number&quot;},{start:2,name:&quot;flowIn&quot;,type:&quot;number&quot;}],attrs:[{tfName:&quot;dtype&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;TensorArrayGatherV3&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensorArrayId&quot;,type:&quot;number&quot;},{start:1,name:&quot;indices&quot;,type:&quot;number[]&quot;},{start:2,name:&quot;flowIn&quot;,type:&quot;number&quot;}],attrs:[{tfName:&quot;dtype&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;},{tfName:&quot;element_shape&quot;,name:&quot;elementShape&quot;,type:&quot;shape&quot;}]},{tfOpName:&quot;TensorArrayScatterV3&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensorArrayId&quot;,type:&quot;number&quot;},{start:1,name:&quot;indices&quot;,type:&quot;number[]&quot;},{start:2,name:&quot;tensor&quot;,type:&quot;tensor&quot;},{start:3,name:&quot;flowIn&quot;,type:&quot;number&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]},{tfOpName:&quot;TensorArrayConcatV3&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensorArrayId&quot;,type:&quot;number&quot;},{start:1,name:&quot;flowIn&quot;,type:&quot;number&quot;}],attrs:[{tfName:&quot;dtype&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;},{tfName:&quot;element_shape_except0&quot;,name:&quot;elementShapeExcept0&quot;,type:&quot;shape&quot;,notSupported:!0}]},{tfOpName:&quot;TensorArraySplitV3&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensorArrayId&quot;,type:&quot;number&quot;},{start:1,name:&quot;tensor&quot;,type:&quot;tensor&quot;},{start:2,name:&quot;lengths&quot;,type:&quot;number[]&quot;},{start:3,name:&quot;flowIn&quot;,type:&quot;number&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]},{tfOpName:&quot;TensorArraySizeV3&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensorArrayId&quot;,type:&quot;number&quot;},{start:1,name:&quot;flowIn&quot;,type:&quot;number&quot;}]},{tfOpName:&quot;TensorArrayCloseV3&quot;,category:&quot;control&quot;,inputs:[{start:0,name:&quot;tensorArrayId&quot;,type:&quot;number&quot;}]}]},{}],33:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;AvgPool&quot;,category:&quot;convolution&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;strides&quot;,name:&quot;strides&quot;,type:&quot;number[]&quot;},{tfName:&quot;padding&quot;,name:&quot;pad&quot;,type:&quot;string&quot;},{tfName:&quot;data_format&quot;,name:&quot;dataFormat&quot;,type:&quot;string&quot;,notSupported:!0},{tfName:&quot;ksize&quot;,name:&quot;kernelSize&quot;,type:&quot;number[]&quot;},{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;MaxPool&quot;,category:&quot;convolution&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;strides&quot;,name:&quot;strides&quot;,type:&quot;number[]&quot;},{tfName:&quot;padding&quot;,name:&quot;pad&quot;,type:&quot;string&quot;},{tfName:&quot;data_format&quot;,name:&quot;dataFormat&quot;,type:&quot;string&quot;,notSupported:!0},{tfName:&quot;ksize&quot;,name:&quot;kernelSize&quot;,type:&quot;number[]&quot;},{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Conv1D&quot;,category:&quot;convolution&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;filter&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;stride&quot;,name:&quot;stride&quot;,type:&quot;number&quot;},{tfName:&quot;padding&quot;,name:&quot;pad&quot;,type:&quot;string&quot;},{tfName:&quot;data_format&quot;,name:&quot;dataFormat&quot;,type:&quot;string&quot;,defaultValue:&quot;NWC&quot;},{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0},{tfName:&quot;dilation&quot;,name:&quot;dilation&quot;,type:&quot;number&quot;,defaultValue:1}]},{tfOpName:&quot;Conv2D&quot;,category:&quot;convolution&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;filter&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0},{tfName:&quot;strides&quot;,name:&quot;strides&quot;,type:&quot;number[]&quot;},{tfName:&quot;padding&quot;,name:&quot;pad&quot;,type:&quot;string&quot;},{tfName:&quot;useCudnnOnGpu&quot;,name:&quot;useCudnnOnGpu&quot;,type:&quot;bool&quot;},{tfName:&quot;data_format&quot;,name:&quot;dataFormat&quot;,type:&quot;string&quot;,defaultValue:&quot;NHWC&quot;},{tfName:&quot;dilations&quot;,name:&quot;dilations&quot;,type:&quot;number[]&quot;}]},{tfOpName:&quot;Conv2DBackpropInput&quot;,category:&quot;convolution&quot;,inputs:[{start:2,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;filter&quot;,type:&quot;tensor&quot;},{start:0,name:&quot;outputShape&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;strides&quot;,name:&quot;strides&quot;,type:&quot;number[]&quot;},{tfName:&quot;padding&quot;,name:&quot;pad&quot;,type:&quot;string&quot;},{tfName:&quot;data_format&quot;,name:&quot;dataFormat&quot;,type:&quot;string&quot;,notSupported:!0}]},{tfOpName:&quot;DepthwiseConv2d&quot;,category:&quot;convolution&quot;,inputs:[{start:0,name:&quot;input&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;filter&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;strides&quot;,name:&quot;strides&quot;,type:&quot;number[]&quot;},{tfName:&quot;padding&quot;,name:&quot;pad&quot;,type:&quot;string&quot;},{tfName:&quot;data_format&quot;,name:&quot;dataFormat&quot;,type:&quot;string&quot;,defaultValue:&quot;NHWC&quot;},{tfName:&quot;dilations&quot;,name:&quot;dilations&quot;,type:&quot;number[]&quot;}]},{tfOpName:&quot;DepthwiseConv2dNative&quot;,category:&quot;convolution&quot;,inputs:[{start:0,name:&quot;input&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;filter&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;strides&quot;,name:&quot;strides&quot;,type:&quot;number[]&quot;},{tfName:&quot;padding&quot;,name:&quot;pad&quot;,type:&quot;string&quot;},{tfName:&quot;data_format&quot;,name:&quot;dataFormat&quot;,type:&quot;string&quot;,defaultValue:&quot;NHWC&quot;},{tfName:&quot;dilations&quot;,name:&quot;dilations&quot;,type:&quot;number[]&quot;}]}]},{}],34:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;Fill&quot;,category:&quot;creation&quot;,inputs:[{start:0,name:&quot;shape&quot;,type:&quot;number[]&quot;},{start:1,name:&quot;value&quot;,type:&quot;number&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]},{tfOpName:&quot;LinSpace&quot;,category:&quot;creation&quot;,inputs:[{start:0,name:&quot;start&quot;,type:&quot;number&quot;},{start:1,name:&quot;stop&quot;,type:&quot;number&quot;},{start:2,name:&quot;num&quot;,type:&quot;number&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;OneHot&quot;,category:&quot;creation&quot;,inputs:[{start:0,name:&quot;indices&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;depth&quot;,type:&quot;number&quot;},{start:2,name:&quot;onValue&quot;,type:&quot;number&quot;,defaultValue:1},{start:3,name:&quot;offValue&quot;,type:&quot;number&quot;,defaultValue:0}],attrs:[{tfName:&quot;axis&quot;,name:&quot;axis&quot;,type:&quot;number&quot;,notSupported:!0},{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Ones&quot;,category:&quot;creation&quot;,inputs:[{start:0,name:&quot;shape&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]},{tfOpName:&quot;OnesLike&quot;,category:&quot;creation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;dtype&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]},{tfOpName:&quot;RandomUniform&quot;,category:&quot;creation&quot;,inputs:[{start:0,name:&quot;shape&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;minval&quot;,name:&quot;minval&quot;,type:&quot;number&quot;,defaultValue:0},{tfName:&quot;maxval&quot;,name:&quot;maxval&quot;,type:&quot;number&quot;,defaultValue:1},{tfName:&quot;dtype&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;},{tfName:&quot;seed&quot;,name:&quot;seed&quot;,type:&quot;number&quot;,defaultValue:0},{tfName:&quot;seed2&quot;,name:&quot;seed2&quot;,type:&quot;number&quot;,defaultValue:0,notSupported:!0},{tfName:&quot;T&quot;,name:&quot;T&quot;,type:&quot;number&quot;,notSupported:!0}]},{tfOpName:&quot;Range&quot;,category:&quot;creation&quot;,inputs:[{start:0,name:&quot;start&quot;,type:&quot;number&quot;},{start:1,name:&quot;stop&quot;,type:&quot;number&quot;},{start:2,name:&quot;step&quot;,type:&quot;number&quot;,defaultValue:0}],attrs:[{tfName:&quot;Tidx&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]},{tfOpName:&quot;TruncatedNormal&quot;,category:&quot;creation&quot;,inputs:[{start:0,name:&quot;shape&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;means&quot;,name:&quot;mean&quot;,type:&quot;number&quot;,defaultValue:0},{tfName:&quot;stddev&quot;,name:&quot;stdDev&quot;,type:&quot;number&quot;,defaultValue:1},{tfName:&quot;seed&quot;,name:&quot;seed&quot;,type:&quot;number&quot;},{tfName:&quot;seed2&quot;,name:&quot;seed2&quot;,type:&quot;number&quot;,defaultValue:0,notSupported:!0},{tfName:&quot;dtype&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;},{tfName:&quot;T&quot;,name:&quot;T&quot;,type:&quot;number&quot;,notSupported:!0}]},{tfOpName:&quot;Zeros&quot;,category:&quot;creation&quot;,inputs:[{start:0,name:&quot;shape&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]},{tfOpName:&quot;ZerosLike&quot;,category:&quot;creation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]}]},{}],35:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;NonMaxSuppressionV2&quot;,category:&quot;dynamic&quot;,inputs:[{start:0,name:&quot;boxes&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;scores&quot;,type:&quot;tensor&quot;},{start:2,name:&quot;maxOutputSize&quot;,type:&quot;number&quot;},{start:3,name:&quot;iouThreshold&quot;,type:&quot;number&quot;}]},{tfOpName:&quot;NonMaxSuppressionV3&quot;,category:&quot;dynamic&quot;,inputs:[{start:0,name:&quot;boxes&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;scores&quot;,type:&quot;tensor&quot;},{start:2,name:&quot;maxOutputSize&quot;,type:&quot;number&quot;},{start:3,name:&quot;iouThreshold&quot;,type:&quot;number&quot;},{start:4,name:&quot;scoreThreshold&quot;,type:&quot;number&quot;}]},{tfOpName:&quot;Where&quot;,category:&quot;dynamic&quot;,inputs:[{start:0,name:&quot;condition&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;ListDiff&quot;,category:&quot;dynamic&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;y&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]}]},{}],36:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;TopKV2&quot;,category:&quot;evaluation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;k&quot;,type:&quot;number&quot;}],attrs:[{tfName:&quot;sorted&quot;,name:&quot;sorted&quot;,type:&quot;bool&quot;}]}]},{}],37:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;PlaceholderWithDefault&quot;,category:&quot;graph&quot;,inputs:[{start:0,name:&quot;default&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;shape&quot;,name:&quot;shape&quot;,type:&quot;shape&quot;},{tfName:&quot;dtype&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]},{tfOpName:&quot;Placeholder&quot;,category:&quot;graph&quot;,attrs:[{tfName:&quot;shape&quot;,name:&quot;shape&quot;,type:&quot;shape&quot;},{tfName:&quot;dtype&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]},{tfOpName:&quot;Const&quot;,category:&quot;graph&quot;},{tfOpName:&quot;Identity&quot;,category:&quot;graph&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;IdentityN&quot;,category:&quot;graph&quot;,inputs:[{start:0,end:0,name:&quot;x&quot;,type:&quot;tensors&quot;}]},{tfOpName:&quot;Snapshot&quot;,category:&quot;graph&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;Rank&quot;,category:&quot;graph&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;Size&quot;,category:&quot;graph&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;Shape&quot;,category:&quot;graph&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;ShapeN&quot;,category:&quot;graph&quot;,inputs:[{start:0,end:0,name:&quot;x&quot;,type:&quot;tensors&quot;}]},{tfOpName:&quot;Print&quot;,category:&quot;graph&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;data&quot;,type:&quot;tensors&quot;}],attrs:[{tfName:&quot;message&quot;,name:&quot;message&quot;,type:&quot;string&quot;},{tfName:&quot;first_n&quot;,name:&quot;firstN&quot;,type:&quot;number&quot;,notSupported:!0},{tfName:&quot;summarize&quot;,name:&quot;summarize&quot;,type:&quot;number&quot;,defaultValue:3}]},{tfOpName:&quot;NoOp&quot;,category:&quot;graph&quot;,inputs:[]},{tfOpName:&quot;StopGradient&quot;,category:&quot;graph&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;FakeQuantWithMinMaxVars&quot;,category:&quot;graph&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;min&quot;,name:&quot;min&quot;,type:&quot;number&quot;},{tfName:&quot;max&quot;,name:&quot;max&quot;,type:&quot;number&quot;}]}]},{}],38:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;ResizeBilinear&quot;,category:&quot;image&quot;,inputs:[{start:0,name:&quot;images&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;size&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;align_corners&quot;,name:&quot;alignCorners&quot;,type:&quot;bool&quot;},{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;ResizeNearestNeighbor&quot;,category:&quot;image&quot;,inputs:[{start:0,name:&quot;images&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;size&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;align_corners&quot;,name:&quot;alignCorners&quot;,type:&quot;bool&quot;},{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;CropAndResize&quot;,category:&quot;image&quot;,inputs:[{start:0,name:&quot;image&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;boxes&quot;,type:&quot;tensor&quot;},{start:2,name:&quot;boxInd&quot;,type:&quot;tensor&quot;},{start:3,name:&quot;cropSize&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;method&quot;,name:&quot;method&quot;,type:&quot;string&quot;},{tfName:&quot;extrapolation_value&quot;,name:&quot;extrapolationValue&quot;,type:&quot;number&quot;}]}]},{}],39:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;Equal&quot;,category:&quot;logical&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;NotEqual&quot;,category:&quot;logical&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Greater&quot;,category:&quot;logical&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;GreaterEqual&quot;,category:&quot;logical&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Less&quot;,category:&quot;logical&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;LessEqual&quot;,category:&quot;logical&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;LogicalAnd&quot;,category:&quot;logical&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;LogicalNot&quot;,category:&quot;logical&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;LogicalOr&quot;,category:&quot;logical&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Select&quot;,category:&quot;logical&quot;,inputs:[{start:0,name:&quot;condition&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:2,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]}]},{}],40:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;MatMul&quot;,category:&quot;matrices&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;transpose_a&quot;,name:&quot;transposeA&quot;,type:&quot;bool&quot;,defaultValue:!1},{tfName:&quot;transpose_b&quot;,name:&quot;transposeB&quot;,type:&quot;bool&quot;,defaultValue:!1},{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;BatchMatMul&quot;,category:&quot;matrices&quot;,inputs:[{start:0,name:&quot;a&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;b&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;adj_x&quot;,name:&quot;transposeA&quot;,type:&quot;bool&quot;,defaultValue:!1},{tfName:&quot;adj_y&quot;,name:&quot;transposeB&quot;,type:&quot;bool&quot;,defaultValue:!1},{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]},{tfOpName:&quot;Transpose&quot;,category:&quot;matrices&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;perm&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;T&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;,notSupported:!0}]}]},{}],41:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;FusedBatchNorm&quot;,category:&quot;normalization&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;scale&quot;,type:&quot;tensor&quot;},{start:2,name:&quot;offset&quot;,type:&quot;tensor&quot;},{start:3,name:&quot;mean&quot;,type:&quot;tensor&quot;},{start:4,name:&quot;variance&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;epsilon&quot;,name:&quot;epsilon&quot;,type:&quot;number&quot;,defaultValue:.001},{tfName:&quot;data_format&quot;,name:&quot;dataFormat&quot;,type:&quot;string&quot;,notSupported:!0}]},{tfOpName:&quot;FusedBatchNormV2&quot;,category:&quot;normalization&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;scale&quot;,type:&quot;tensor&quot;},{start:2,name:&quot;offset&quot;,type:&quot;tensor&quot;},{start:3,name:&quot;mean&quot;,type:&quot;tensor&quot;},{start:4,name:&quot;variance&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;epsilon&quot;,name:&quot;epsilon&quot;,type:&quot;number&quot;,defaultValue:.001},{tfName:&quot;data_format&quot;,name:&quot;dataFormat&quot;,type:&quot;string&quot;,notSupported:!0}]},{tfOpName:&quot;LRN&quot;,category:&quot;normalization&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;depth_radius&quot;,name:&quot;radius&quot;,type:&quot;number&quot;,defaultValue:5},{tfName:&quot;bias&quot;,name:&quot;bias&quot;,type:&quot;number&quot;,defaultValue:1},{tfName:&quot;alpha&quot;,name:&quot;alpha&quot;,type:&quot;number&quot;,defaultValue:1},{tfName:&quot;beta&quot;,name:&quot;beta&quot;,type:&quot;number&quot;,defaultValue:.5}]},{tfOpName:&quot;Softmax&quot;,category:&quot;normalization&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;LogSoftmax&quot;,category:&quot;normalization&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;SparseToDense&quot;,category:&quot;normalization&quot;,inputs:[{start:0,name:&quot;sparseIndices&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;outputShape&quot;,type:&quot;number[]&quot;},{start:2,name:&quot;sparseValues&quot;,type:&quot;tensor&quot;},{start:3,name:&quot;defaultValue&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;validate_indices&quot;,name:&quot;validateIndices&quot;,type:&quot;bool&quot;,defaultValue:!0,notSupported:!0}]}]},{}],42:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;Max&quot;,category:&quot;reduction&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;keep_dims&quot;,name:&quot;keepDims&quot;,type:&quot;bool&quot;}]},{tfOpName:&quot;Mean&quot;,category:&quot;reduction&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;keep_dims&quot;,name:&quot;keepDims&quot;,type:&quot;bool&quot;}]},{tfOpName:&quot;Min&quot;,category:&quot;reduction&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;keep_dims&quot;,name:&quot;keepDims&quot;,type:&quot;bool&quot;}]},{tfOpName:&quot;Sum&quot;,category:&quot;reduction&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;keep_dims&quot;,name:&quot;keepDims&quot;,type:&quot;bool&quot;}]},{tfOpName:&quot;All&quot;,category:&quot;reduction&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;keep_dims&quot;,name:&quot;keepDims&quot;,type:&quot;bool&quot;}]},{tfOpName:&quot;Any&quot;,category:&quot;reduction&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;keep_dims&quot;,name:&quot;keepDims&quot;,type:&quot;bool&quot;}]},{tfOpName:&quot;ArgMax&quot;,category:&quot;reduction&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number&quot;}]},{tfOpName:&quot;ArgMin&quot;,category:&quot;reduction&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number&quot;}]},{tfOpName:&quot;Prod&quot;,category:&quot;reduction&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;keep_dims&quot;,name:&quot;keepDims&quot;,type:&quot;bool&quot;}]}]},{}],43:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;ConcatV2&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,end:-1,name:&quot;tensors&quot;,type:&quot;tensors&quot;},{start:-1,name:&quot;axis&quot;,type:&quot;number&quot;}]},{tfOpName:&quot;Concat&quot;,category:&quot;slice_join&quot;,inputs:[{start:1,end:0,name:&quot;tensors&quot;,type:&quot;tensors&quot;},{start:0,name:&quot;axis&quot;,type:&quot;number&quot;}]},{tfOpName:&quot;GatherV2&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;indices&quot;,type:&quot;tensor&quot;},{start:2,name:&quot;axis&quot;,type:&quot;number&quot;,defaultValue:0}]},{tfOpName:&quot;Gather&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;indices&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;axis&quot;,name:&quot;axis&quot;,type:&quot;number&quot;,defaultValue:0},{tfName:&quot;validate_indices&quot;,name:&quot;validateIndices&quot;,type:&quot;bool&quot;,notSupported:!0}]},{tfOpName:&quot;Reverse&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;dims&quot;,type:&quot;bool&quot;,notSupported:!0}]},{tfOpName:&quot;ReverseV2&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number[]&quot;}]},{tfOpName:&quot;Slice&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;begin&quot;,type:&quot;number[]&quot;},{start:2,name:&quot;size&quot;,type:&quot;number[]&quot;}]},{tfOpName:&quot;StridedSlice&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;begin&quot;,type:&quot;number[]&quot;},{start:2,name:&quot;end&quot;,type:&quot;number[]&quot;},{start:3,name:&quot;strides&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;begin_mask&quot;,name:&quot;beginMask&quot;,type:&quot;number&quot;,defaultValue:0},{tfName:&quot;end_mask&quot;,name:&quot;endMask&quot;,type:&quot;number&quot;,defaultValue:0},{tfName:&quot;new_axis_mask&quot;,name:&quot;newAxisMask&quot;,type:&quot;number&quot;,defaultValue:0},{tfName:&quot;ellipsis_mask&quot;,name:&quot;ellipsisMask&quot;,type:&quot;number&quot;,defaultValue:0},{tfName:&quot;shrink_axis_mask&quot;,name:&quot;shrinkAxisMask&quot;,type:&quot;number&quot;,defaultValue:0}]},{tfOpName:&quot;Pack&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,end:0,name:&quot;tensors&quot;,type:&quot;tensors&quot;}],attrs:[{tfName:&quot;axis&quot;,name:&quot;axis&quot;,type:&quot;number&quot;,defaultValue:0}]},{tfOpName:&quot;Unpack&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;tensor&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;axis&quot;,name:&quot;axis&quot;,type:&quot;number&quot;,defaultValue:0},{tfName:&quot;num&quot;,name:&quot;num&quot;,type:&quot;number&quot;,defaultValue:0,notSupported:!0}]},{tfOpName:&quot;Tile&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;reps&quot;,type:&quot;number[]&quot;}]},{tfOpName:&quot;Split&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;axis&quot;,type:&quot;number&quot;,defaultValue:0},{start:1,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;num_split&quot;,name:&quot;numOrSizeSplits&quot;,type:&quot;number&quot;,defaultValue:1}]},{tfOpName:&quot;SplitV&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;numOrSizeSplits&quot;,type:&quot;number[]&quot;},{start:2,name:&quot;axis&quot;,type:&quot;number&quot;,defaultValue:0}]},{tfOpName:&quot;ScatterNd&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;indices&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;values&quot;,type:&quot;tensor&quot;},{start:2,name:&quot;shape&quot;,type:&quot;number[]&quot;}]},{tfOpName:&quot;GatherNd&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;indices&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;SparseToDense&quot;,category:&quot;slice_join&quot;,inputs:[{start:0,name:&quot;sparseIndices&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;outputShape&quot;,type:&quot;number[]&quot;},{start:2,name:&quot;sparseValues&quot;,type:&quot;tensor&quot;},{start:3,name:&quot;defaultValue&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;validate_indices&quot;,name:&quot;validateIndices&quot;,type:&quot;bool&quot;,defaultValue:!1,notSupported:!0}]}]},{}],44:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;FFT&quot;,category:&quot;spectral&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;IFFT&quot;,category:&quot;spectral&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}]},{tfOpName:&quot;RFFT&quot;,category:&quot;spectral&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;fft_length&quot;,type:&quot;number&quot;,notSupported:!0}]},{tfOpName:&quot;IRFFT&quot;,category:&quot;spectral&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;fft_length&quot;,type:&quot;number&quot;,notSupported:!0}]}]},{}],45:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.json=[{tfOpName:&quot;Cast&quot;,category:&quot;transformation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;SrcT&quot;,name:&quot;sdtype&quot;,type:&quot;dtype&quot;,notSupported:!0},{tfName:&quot;DstT&quot;,name:&quot;dtype&quot;,type:&quot;dtype&quot;}]},{tfOpName:&quot;ExpandDims&quot;,category:&quot;transformation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;axis&quot;,type:&quot;number&quot;}]},{tfOpName:&quot;Pad&quot;,category:&quot;transformation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;padding&quot;,type:&quot;number[]&quot;}],attrs:[{tfName:&quot;constant_value&quot;,name:&quot;constantValue&quot;,type:&quot;number&quot;,defaultValue:0}]},{tfOpName:&quot;PadV2&quot;,category:&quot;transformation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;padding&quot;,type:&quot;number[]&quot;},{start:2,name:&quot;constantValue&quot;,type:&quot;number&quot;,defaultValue:0}]},{tfOpName:&quot;Reshape&quot;,category:&quot;transformation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;shape&quot;,type:&quot;number[]&quot;}]},{tfOpName:&quot;Squeeze&quot;,category:&quot;transformation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;axis&quot;,tfDeprecatedName:&quot;squeeze_dims&quot;,name:&quot;axis&quot;,type:&quot;number[]&quot;}]},{tfOpName:&quot;SpaceToBatchND&quot;,category:&quot;transformation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;blockShape&quot;,type:&quot;number[]&quot;},{start:2,name:&quot;paddings&quot;,type:&quot;number[]&quot;}]},{tfOpName:&quot;BatchToSpaceND&quot;,category:&quot;transformation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;},{start:1,name:&quot;blockShape&quot;,type:&quot;number[]&quot;},{start:2,name:&quot;crops&quot;,type:&quot;number[]&quot;}]},{tfOpName:&quot;DepthToSpace&quot;,category:&quot;transformation&quot;,inputs:[{start:0,name:&quot;x&quot;,type:&quot;tensor&quot;}],attrs:[{tfName:&quot;block_size&quot;,name:&quot;blockSize&quot;,type:&quot;number&quot;},{tfName:&quot;data_format&quot;,name:&quot;dataFormat&quot;,type:&quot;string&quot;}]}]},{}],46:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./executors/arithmetic_executor&quot;),i=t(&quot;./executors/basic_math_executor&quot;),o=t(&quot;./executors/control_executor&quot;),a=t(&quot;./executors/convolution_executor&quot;),s=t(&quot;./executors/creation_executor&quot;),u=t(&quot;./executors/dynamic_executor&quot;),l=t(&quot;./executors/evaluation_executor&quot;),c=t(&quot;./executors/graph_executor&quot;),f=t(&quot;./executors/image_executor&quot;),p=t(&quot;./executors/logical_executor&quot;),h=t(&quot;./executors/matrices_executor&quot;),d=t(&quot;./executors/normalization_executor&quot;),m=t(&quot;./executors/reduction_executor&quot;),g=t(&quot;./executors/slice_join_executor&quot;),v=t(&quot;./executors/spectral_executor&quot;),y=t(&quot;./executors/transformation_executor&quot;);n.executeOp=function(t,e,n){var b=function(t,e,n){switch(t.category){case&quot;arithmetic&quot;:return r.executeOp(t,e,n);case&quot;basic_math&quot;:return i.executeOp(t,e,n);case&quot;control&quot;:return o.executeOp(t,e,n);case&quot;convolution&quot;:return a.executeOp(t,e,n);case&quot;creation&quot;:return s.executeOp(t,e,n);case&quot;dynamic&quot;:return u.executeOp(t,e,n);case&quot;evaluation&quot;:return l.executeOp(t,e,n);case&quot;image&quot;:return f.executeOp(t,e,n);case&quot;graph&quot;:return c.executeOp(t,e,n);case&quot;logical&quot;:return p.executeOp(t,e,n);case&quot;matrices&quot;:return h.executeOp(t,e,n);case&quot;normalization&quot;:return d.executeOp(t,e,n);case&quot;reduction&quot;:return m.executeOp(t,e,n);case&quot;slice_join&quot;:return g.executeOp(t,e,n);case&quot;spectral&quot;:return v.executeOp(t,e,n);case&quot;transformation&quot;:return y.executeOp(t,e,n);default:throw TypeError(&quot;Node type &quot;+t.op+&quot; is not implemented&quot;)}}(t,e,n);return b instanceof Promise?b.then(function(t){return[].concat(t)}):[].concat(b)}},{&quot;./executors/arithmetic_executor&quot;:13,&quot;./executors/basic_math_executor&quot;:14,&quot;./executors/control_executor&quot;:15,&quot;./executors/convolution_executor&quot;:16,&quot;./executors/creation_executor&quot;:17,&quot;./executors/dynamic_executor&quot;:18,&quot;./executors/evaluation_executor&quot;:19,&quot;./executors/graph_executor&quot;:20,&quot;./executors/image_executor&quot;:21,&quot;./executors/logical_executor&quot;:22,&quot;./executors/matrices_executor&quot;:23,&quot;./executors/normalization_executor&quot;:24,&quot;./executors/reduction_executor&quot;:25,&quot;./executors/slice_join_executor&quot;:26,&quot;./executors/spectral_executor&quot;:27,&quot;./executors/transformation_executor&quot;:28}],47:[function(t,e,n){(function(e){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;../data/compiled_api&quot;),o=t(&quot;./executors/utils&quot;),a=t(&quot;./op_list/arithmetic&quot;),s=t(&quot;./op_list/basic_math&quot;),u=t(&quot;./op_list/control&quot;),l=t(&quot;./op_list/convolution&quot;),c=t(&quot;./op_list/creation&quot;),f=t(&quot;./op_list/dynamic&quot;),p=t(&quot;./op_list/evaluation&quot;),h=t(&quot;./op_list/graph&quot;),d=t(&quot;./op_list/image&quot;),m=t(&quot;./op_list/logical&quot;),g=t(&quot;./op_list/matrices&quot;),v=t(&quot;./op_list/normalization&quot;),y=t(&quot;./op_list/reduction&quot;),b=t(&quot;./op_list/slice_join&quot;),_=t(&quot;./op_list/spectral&quot;),w=t(&quot;./op_list/transformation&quot;),x=[&quot;Switch&quot;,&quot;Merge&quot;,&quot;Enter&quot;,&quot;Exit&quot;,&quot;NextIteration&quot;],E=[&quot;NonMaxSuppressionV2&quot;,&quot;NonMaxSuppressionV3&quot;,&quot;Where&quot;],k=function(){function t(){var t=[a,s,u,l,c,f,p,m,d,h,g,v,y,b,_,w],e=[].concat.apply([],t.map(function(t){return t.json}));this.opMappers=e.reduce(function(t,e){return t[e.tfOpName]=e,t},{})}return Object.defineProperty(t,&quot;Instance&quot;,{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),t.prototype.isControlFlow=function(t){return x.some(function(e){return e===t.op})},t.prototype.isDynamicShape=function(t){return E.some(function(e){return e===t.op})},t.prototype.transformGraph=function(t){var e=this,n=!1,r=!1,i=[],a=[],s=t.node.reduce(function(t,o){return t[o.name]=e.mapNode(o),e.isControlFlow(o)&amp;&amp;(n=!0),e.isDynamicShape(o)&amp;&amp;(r=!0),&quot;Placeholder&quot;===o.op&amp;&amp;i.push(t[o.name]),&quot;Const&quot;===o.op&amp;&amp;a.push(t[o.name]),t},{}),u=[],l=[];return Object.keys(s).forEach(function(t){var e=s[t];e.inputNames.forEach(function(t){var n=o.getNodeNameAndIndex(t)[0];e.inputs.push(s[n]),s[n].children.push(e)}),0===e.inputs.length&amp;&amp;u.push(e)}),Object.keys(s).forEach(function(t){var e=s[t];0===e.children.length&amp;&amp;l.push(e)}),{nodes:s,inputs:u,outputs:l,weights:a,placeholders:i,withControlFlow:n,withDynamicShape:r}},t.prototype.mapNode=function(t){var e=this,n=this.opMappers[t.op];if(void 0===n)throw new Error(&quot;Tensorflow Op is not supported: &quot;+t.op);var r={name:t.name,op:t.op,category:n.category,inputNames:(t.input||[]).map(function(t){return t.startsWith(&quot;^&quot;)?t.substr(1):t}),inputs:[],children:[],inputParams:{},attrParams:{}};return null==t.attr&amp;&amp;(t.attr={}),null!=n.inputs&amp;&amp;(r.inputParams=n.inputs.reduce(function(t,e){return t[e.name]={type:e.type,inputIndexStart:e.start,inputIndexEnd:e.end},t},{})),null!=n.attrs&amp;&amp;(r.attrParams=n.attrs.reduce(function(n,r){var i=r.type,o=void 0;switch(r.type){case&quot;string&quot;:void 0===(o=e.getStringParam(t.attr,r.tfName,r.defaultValue))&amp;&amp;r.tfDeprecatedName&amp;&amp;(o=e.getStringParam(t.attr,r.tfDeprecatedName,r.defaultValue));break;case&quot;number&quot;:void 0===(o=e.getNumberParam(t.attr,r.tfName,r.defaultValue||0))&amp;&amp;r.tfDeprecatedName&amp;&amp;(o=e.getNumberParam(t.attr,r.tfDeprecatedName,r.defaultValue));break;case&quot;number[]&quot;:void 0===(o=e.getNumericArrayParam(t.attr,r.tfName,r.defaultValue))&amp;&amp;r.tfDeprecatedName&amp;&amp;(o=e.getNumericArrayParam(t.attr,r.tfDeprecatedName,r.defaultValue));break;case&quot;bool&quot;:void 0===(o=e.getBoolParam(t.attr,r.tfName,r.defaultValue))&amp;&amp;r.tfDeprecatedName&amp;&amp;(o=e.getBoolParam(t.attr,r.tfDeprecatedName,r.defaultValue));break;case&quot;shape&quot;:void 0===(o=e.getTensorShapeParam(t.attr,r.tfName,r.defaultValue))&amp;&amp;r.tfDeprecatedName&amp;&amp;(o=e.getTensorShapeParam(t.attr,r.tfDeprecatedName,r.defaultValue));break;case&quot;dtype&quot;:void 0===(o=e.getDtypeParam(t.attr,r.tfName,r.defaultValue))&amp;&amp;r.tfDeprecatedName&amp;&amp;(o=e.getDtypeParam(t.attr,r.tfDeprecatedName,r.defaultValue));break;case&quot;tensor&quot;:case&quot;tensors&quot;:break;default:throw new Error(&quot;Unsupported param type: &quot;+r.type+&quot; for op: &quot;+t.op)}return n[r.name]={value:o,type:i},n},{})),r},t.prototype.decodeBase64=function(t){var n=r.ENV.global;if(void 0!==n.atob)return n.atob(t);if(void 0!==e)return new e(t,&quot;base64&quot;).toString();throw new Error(&quot;Unable to decode base64 in this environment. Missing built-in atob() or Buffer()&quot;)},t.prototype.getStringParam=function(t,e,n,r){void 0===r&amp;&amp;(r=!1);var i=t[e];if(void 0!==i){var o=Array.isArray(i.s)?String.fromCharCode.apply(null,i.s):this.decodeBase64(i.s);return r?o:o.toLowerCase()}return n},t.prototype.getBoolParam=function(t,e,n){var r=t[e];return r?r.b:n},t.prototype.getNumberParam=function(t,e,n){var r=t[e]||{},i=r.i?r.i:r.f?r.f:n;return&quot;number&quot;==typeof i?i:parseInt(i,10)},t.prototype.getDtypeParam=function(t,e,n){var r=t[e];if(r&amp;&amp;r.type){var o=r.type;switch(&quot;string&quot;==typeof r.type&amp;&amp;(o=i.DataType[r.type]),o){case i.DataType.DT_FLOAT:return&quot;float32&quot;;case i.DataType.DT_INT32:return&quot;int32&quot;;case i.DataType.DT_BOOL:return&quot;bool&quot;;default:return n}}return n},t.prototype.getTensorShapeParam=function(t,e,n){var r=t[e];if(r&amp;&amp;r.shape){if(r.shape.unknownRank)return;if(null!=r.shape.dim)return r.shape.dim.map(function(t){return&quot;number&quot;==typeof t.size?t.size:parseInt(t.size,10)})}return n},t.prototype.getNumericArrayParam=function(t,e,n){var r=t[e];return r?(r.list.f&amp;&amp;r.list.f.length?r.list.f:r.list.i).map(function(t){return&quot;number&quot;==typeof t?t:parseInt(t,10)}):n},t}();n.OperationMapper=k}).call(this,t(&quot;buffer&quot;).Buffer)},{&quot;../data/compiled_api&quot;:7,&quot;./executors/utils&quot;:29,&quot;./op_list/arithmetic&quot;:30,&quot;./op_list/basic_math&quot;:31,&quot;./op_list/control&quot;:32,&quot;./op_list/convolution&quot;:33,&quot;./op_list/creation&quot;:34,&quot;./op_list/dynamic&quot;:35,&quot;./op_list/evaluation&quot;:36,&quot;./op_list/graph&quot;:37,&quot;./op_list/image&quot;:38,&quot;./op_list/logical&quot;:39,&quot;./op_list/matrices&quot;:40,&quot;./op_list/normalization&quot;:41,&quot;./op_list/reduction&quot;:42,&quot;./op_list/slice_join&quot;:43,&quot;./op_list/spectral&quot;:44,&quot;./op_list/transformation&quot;:45,&quot;@tensorflow/tfjs-core&quot;:138,buffer:303}],48:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});n.version=&quot;1.1.0&quot;},{}],49:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.EPSILON_FLOAT32=1e-7,n.EPSILON_FLOAT16=1e-4;var r=function(){function t(t){this.dataMover=t,this.data=new WeakMap}return t.prototype.get=function(t){return this.data.has(t)||this.dataMover.moveData(t),this.data.get(t)},t.prototype.set=function(t,e){this.data.set(t,e)},t.prototype.has=function(t){return this.data.has(t)},t.prototype.delete=function(t){return this.data.delete(t)},t}();n.DataStorage=r;var i=function(){function t(){}return t.prototype.time=function(t){throw new Error(&quot;Not yet implemented.&quot;)},t.prototype.read=function(t){throw new Error(&quot;Not yet implemented.&quot;)},t.prototype.readSync=function(t){throw new Error(&quot;Not yet implemented.&quot;)},t.prototype.disposeData=function(t){throw new Error(&quot;Not yet implemented.&quot;)},t.prototype.write=function(t,e){throw new Error(&quot;Not yet implemented.&quot;)},t.prototype.fromPixels=function(t,e){throw new Error(&quot;Not yet implemented.&quot;)},t.prototype.register=function(t,e,n){throw new Error(&quot;Not yet implemented.&quot;)},t.prototype.memory=function(){throw new Error(&quot;Not yet implemented.&quot;)},t.prototype.floatPrecision=function(){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.epsilon=function(){return 32===this.floatPrecision()?n.EPSILON_FLOAT32:n.EPSILON_FLOAT16},t.prototype.batchMatMul=function(t,e,n,r){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.fusedBatchMatMul=function(t,e,n,r,i,o){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.slice=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.stridedSlice=function(t,e,n,r,i,o,a,s,u){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.unstack=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.reverse=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.concat=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.neg=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.add=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.addN=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.subtract=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.multiply=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.realDivide=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.floorDiv=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.sum=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.prod=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.unsortedSegmentSum=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.argMin=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.argMax=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.equal=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.notEqual=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.less=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.lessEqual=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.greater=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.greaterEqual=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.logicalNot=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.logicalAnd=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.logicalOr=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.where=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.select=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.topk=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.min=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.minimum=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.mod=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.max=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.maximum=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.all=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.any=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.squaredDifference=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.ceil=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.floor=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.round=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.sign=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.isNaN=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.isInf=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.isFinite=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.pow=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.exp=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.expm1=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.log=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.log1p=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.sqrt=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.rsqrt=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.square=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.reciprocal=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.relu=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.prelu=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.elu=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.eluDer=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.selu=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.int=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.clip=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.abs=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.complexAbs=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.sigmoid=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.softplus=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.sin=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.cos=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.tan=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.asin=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.acos=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.atan=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.atan2=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.sinh=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.cosh=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.tanh=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.asinh=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.acosh=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.atanh=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.erf=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.step=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.conv2d=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.conv2dDerInput=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.conv2dDerFilter=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.depthwiseConv2D=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.depthwiseConv2DDerInput=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.depthwiseConv2DDerFilter=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.conv3d=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.conv3dDerInput=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.conv3dDerFilter=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.maxPool=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.maxPoolBackprop=function(t,e,n,r){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.avgPool=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.avgPoolBackprop=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.reshape=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.cast=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.tile=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.pad=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.transpose=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.gather=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.gatherND=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.scatterND=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.batchToSpaceND=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.spaceToBatchND=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.resizeBilinear=function(t,e,n,r){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.resizeBilinearBackprop=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.resizeNearestNeighbor=function(t,e,n,r){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.resizeNearestNeighborBackprop=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.batchNormalization=function(t,e,n,r,i,o){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.localResponseNormalization4D=function(t,e,n,r,i){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.LRNGrad=function(t,e,n,r,i,o,a){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.multinomial=function(t,e,n,r){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.oneHot=function(t,e,n,r){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.cumsum=function(t,e,n,r){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.nonMaxSuppression=function(t,e,n,r,i){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.fft=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.ifft=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.complex=function(t,e){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.real=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.imag=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.cropAndResize=function(t,e,n,r,i,o){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.depthToSpace=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.split=function(t,e,n){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.sparseToDense=function(t,e,n,r){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.fill=function(t,e,n){throw new Error(&quot;Not yet implemented.&quot;)},t.prototype.onesLike=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.zerosLike=function(t){throw new Error(&quot;Not yet implemented&quot;)},t.prototype.dispose=function(){throw new Error(&quot;Not yet implemented&quot;)},t}();n.KernelBackend=i},{}],50:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../ops/tensor_ops&quot;),i=t(&quot;../tensor&quot;),o=t(&quot;../util&quot;);n.castTensor=function(t,e,n){if(&quot;complex64&quot;===e){if(&quot;complex64&quot;===t.dtype)return t.clone();var a=r.zeros(t.shape),s=t.toFloat(),u=n.complex(s,a);return a.dispose(),s.dispose(),u}if(!o.hasEncodingLoss(t.dtype,e))return i.Tensor.make(t.shape,{dataId:t.dataId},e);if(&quot;complex64&quot;===t.dtype){var l=n.real(t);return u=l.cast(e),l.dispose(),u}if(&quot;int32&quot;===e)return n.int(t);if(&quot;bool&quot;===e){var c=r.scalar(0,t.dtype);return u=n.notEqual(t,c),c.dispose(),u}throw new Error(&quot;Error in Cast: unknown dtype argument (&quot;+e+&quot;)&quot;)},n.reshapeTensor=function(t,e){return i.Tensor.make(e,{dataId:t.dataId},t.dtype)}},{&quot;../ops/tensor_ops&quot;:200,&quot;../tensor&quot;:216,&quot;../util&quot;:223}],51:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.mergeRealAndImagArrays=function(t,e){if(t.length!==e.length)throw new Error(&quot;Cannot merge real and imag arrays of different lengths. real:&quot;+t.length+&quot;, imag: &quot;+e.length+&quot;.&quot;);for(var n=new Float32Array(2*t.length),r=0;r&lt;n.length;r+=2)n[r]=t[r/2],n[r+1]=e[r/2];return n},n.splitRealAndImagArrays=function(t){for(var e=new Float32Array(t.length/2),n=new Float32Array(t.length/2),r=0;r&lt;t.length;r+=2)e[r/2]=t[r],n[r/2]=t[r+1];return{real:e,imag:n}},n.complexWithEvenIndex=function(t){for(var e=Math.ceil(t.length/4),n=new Float32Array(e),r=new Float32Array(e),i=0;i&lt;t.length;i+=4)n[Math.floor(i/4)]=t[i],r[Math.floor(i/4)]=t[i+1];return{real:n,imag:r}},n.complexWithOddIndex=function(t){for(var e=Math.floor(t.length/4),n=new Float32Array(e),r=new Float32Array(e),i=2;i&lt;t.length;i+=4)n[Math.floor(i/4)]=t[i],r[Math.floor(i/4)]=t[i+1];return{real:n,imag:r}},n.getComplexWithIndex=function(t,e){return{real:t[2*e],imag:t[2*e+1]}},n.assignToTypedArray=function(t,e,n,r){t[2*r]=e,t[2*r+1]=n},n.exponents=function(t,e){for(var n=new Float32Array(t/2),r=new Float32Array(t/2),i=0;i&lt;Math.ceil(t/2);i++){var o=(e?2:-2)*Math.PI*(i/t);n[i]=Math.cos(o),r[i]=Math.sin(o)}return{real:n,imag:r}},n.exponent=function(t,e,n){var r=(n?2:-2)*Math.PI*(t/e);return{real:Math.cos(r),imag:Math.sin(r)}}},{}],52:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;seedrandom&quot;),a=t(&quot;../../engine&quot;),s=t(&quot;../../environment&quot;),u=t(&quot;../../log&quot;),l=t(&quot;../../ops/array_ops_util&quot;),c=t(&quot;../../ops/axis_util&quot;),f=t(&quot;../../ops/broadcast_util&quot;),p=t(&quot;../../ops/concat_util&quot;),h=t(&quot;../../ops/erf_util&quot;),d=t(&quot;../../ops/gather_nd_util&quot;),m=t(&quot;../../ops/ops&quot;),g=t(&quot;../../ops/ops&quot;),v=t(&quot;../../ops/scatter_nd_util&quot;),y=t(&quot;../../ops/selu_util&quot;),b=t(&quot;../../ops/slice_util&quot;),_=t(&quot;../../tensor&quot;),w=t(&quot;../../types&quot;),x=t(&quot;../../util&quot;),E=t(&quot;../../util&quot;),k=t(&quot;../backend&quot;),T=t(&quot;../backend_util&quot;),N=t(&quot;../complex_util&quot;),S=t(&quot;../non_max_suppression_impl&quot;),C=t(&quot;../split_shared&quot;),A=t(&quot;../topk_impl&quot;),I=t(&quot;../where_impl&quot;);var O=function(){function t(){this.blockSize=48,this.firstUse=!0,s.ENV.get(&quot;IS_BROWSER&quot;)&amp;&amp;(this.fromPixels2DContext=document.createElement(&quot;canvas&quot;).getContext(&quot;2d&quot;)),this.data=new k.DataStorage(a.ENGINE)}return t.prototype.register=function(t,e,n){if(this.firstUse&amp;&amp;(this.firstUse=!1,s.ENV.get(&quot;IS_NODE&quot;)&amp;&amp;u.warn(&quot;\n============================\nHi 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(&apos;@tensorflow/tfjs-node&apos;); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.\n============================\n&quot;)),this.data.has(t))throw new Error(&quot;Data buffer is already registered&quot;);this.data.set(t,{dtype:n})},t.prototype.write=function(t,e){if(null==e)throw new Error(&quot;MathBackendCPU.write(): values can not be null&quot;);this.data.get(t).values=e},t.prototype.fromPixels=function(t,e){if(null==t)throw new Error(&quot;pixels passed to tf.browser.fromPixels() can not be null&quot;);var n,r;if(s.ENV.get(&quot;IS_NODE&quot;)&amp;&amp;null==t.getContext)throw new Error(&quot;When running in node, pixels must be an HTMLCanvasElement like the one returned by the `canvas` npm package&quot;);if(null!=t.getContext)n=t.getContext(&quot;2d&quot;).getImageData(0,0,t.width,t.height).data;else if(t instanceof ImageData)n=t.data;else{if(!(t instanceof HTMLImageElement||t instanceof HTMLVideoElement))throw new Error(&quot;pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement or ImageData, but was &quot;+t.constructor.name);if(null==this.fromPixels2DContext)throw new Error(&quot;Can&apos;t read pixels from HTMLImageElement outside the browser.&quot;);this.fromPixels2DContext.canvas.width=t.width,this.fromPixels2DContext.canvas.height=t.height,this.fromPixels2DContext.drawImage(t,0,0,t.width,t.height),n=this.fromPixels2DContext.getImageData(0,0,t.width,t.height).data}if(4===e)r=new Int32Array(n);else{var i=t.width*t.height;r=new Int32Array(i*e);for(var o=0;o&lt;i;o++)for(var a=0;a&lt;e;++a)r[o*e+a]=n[4*o+a]}var u=[t.height,t.width,e];return g.tensor3d(r,u,&quot;int32&quot;)},t.prototype.read=function(t){return r(this,void 0,void 0,function(){return i(this,function(e){return[2,this.readSync(t)]})})},t.prototype.readSync=function(t){var e=this.data.get(t),n=e.dtype,r=e.complexTensors;if(&quot;complex64&quot;===n){var i=r.real.dataSync(),o=r.imag.dataSync();return N.mergeRealAndImagArrays(i,o)}return this.data.get(t).values},t.prototype.disposeData=function(t){if(this.data.has(t)){var e=this.data.get(t).complexTensors;null!=e&amp;&amp;(e.real.dispose(),e.imag.dispose()),this.data.delete(t)}},t.prototype.time=function(t){return r(this,void 0,void 0,function(){var e;return i(this,function(n){return e=E.now(),t(),[2,{kernelMs:E.now()-e}]})})},t.prototype.memory=function(){return{unreliable:!0,reasons:[&quot;The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less.&quot;]}},t.prototype.complex=function(t,e){var n=_.Tensor.make(t.shape,{},&quot;complex64&quot;);return this.data.get(n.dataId).complexTensors={real:a.ENGINE.keep(t.clone()),imag:a.ENGINE.keep(e.clone())},n},t.prototype.real=function(t){return this.data.get(t.dataId).complexTensors.real.clone()},t.prototype.imag=function(t){return this.data.get(t.dataId).complexTensors.imag.clone()},t.prototype.assertNotComplex=function(t,e){Array.isArray(t)||(t=[t]),t.forEach(function(t){null!=t&amp;&amp;x.assert(&quot;complex64&quot;!==t.dtype,function(){return e+&quot; does not support complex64 tensors.&quot;})})},t.prototype.slice=function(t,e,n){if(this.assertNotComplex(t,&quot;slice&quot;),b.isSliceContinous(t.shape,e,n)){var r=b.computeFlatOffset(e,t.strides),i=x.sizeFromShape(n),o=t.dataSync();return g.tensor(o.subarray(r,r+i),n,t.dtype)}for(var a=m.buffer(n,t.dtype),s=t.bufferSync(),u=0;u&lt;a.size;++u){var l=a.indexToLoc(u).map(function(t,n){return t+e[n]});a.values[u]=s.get.apply(s,l)}return a.toTensor()},t.prototype.stridedSlice=function(t,e,n,r,i,o,a,s,u){this.assertNotComplex(t,&quot;stridedSlice&quot;);var l=b.getStridedSlicedInfo(t.shape,e,n,r,i,o,a,s,u),c=l[0],f=l[1],p=l[2],h=f.filter(function(t,e){return-1===p.indexOf(e)});if(h.some(function(t){return 0===t}))return m.tensor([],h);for(var d=m.buffer(f,t.dtype),g=t.bufferSync(),v=0;v&lt;d.size;v++){for(var y=d.indexToLoc(v),_=new Array(y.length),w=0;w&lt;_.length;w++)_[w]=y[w]*r[w]+c[w];d.set.apply(d,[g.get.apply(g,_)].concat(y))}return d.toTensor().reshape(h)},t.prototype.unstack=function(t,e){for(var n=t.shape[e],r=new Array(t.rank-1),i=0,o=0;o&lt;t.rank;o++)o!==e&amp;&amp;(r[i++]=t.shape[o]);var a=new Array(t.rank).fill(0),s=t.shape.slice();s[e]=1;var u=new Array(n);for(o=0;o&lt;u.length;o++)a[e]=o,u[o]=this.slice(t,a,s).reshape(r);return u},t.prototype.reverse=function(t,e){this.assertNotComplex(t,&quot;reverse&quot;);for(var n=m.buffer(t.shape,t.dtype),r=t.bufferSync(),i=function(i){var o=n.indexToLoc(i),a=o.slice();e.forEach(function(e){return a[e]=t.shape[e]-1-a[e]}),n.set.apply(n,[r.get.apply(r,a)].concat(o))},o=0;o&lt;n.size;o++)i(o);return n.toTensor()},t.prototype.concat=function(t,e){this.assertNotComplex(t,&quot;concat&quot;);var n=t.map(function(t){var n=x.sizeFromShape(t.shape.slice(e));return t.as2D(-1,n)}),r=p.computeOutShape(n.map(function(t){return t.shape}),1),i=m.buffer(r,t[0].dtype).values;if(1===n[0].shape[0]){var o=0;n.forEach(function(t){i.set(t.dataSync(),o),o+=t.size})}else{var a=0;n.forEach(function(t){for(var e=t.dataSync(),n=0,o=0;o&lt;t.shape[0];++o)for(var s=o*r[1]+a,u=0;u&lt;t.shape[1];++u)i[s+u]=e[n++];a+=t.shape[1]})}var s=p.computeOutShape(t.map(function(t){return t.shape}),e);return g.tensor(i,s,t[0].dtype)},t.prototype.neg=function(t){return this.assertNotComplex(t,&quot;neg&quot;),this.multiply(m.scalar(-1),t)},t.prototype.add=function(t,e){return&quot;complex64&quot;===t.dtype||&quot;complex64&quot;===e.dtype?this.broadcastedBinaryComplexOp(t.cast(&quot;complex64&quot;),e.cast(&quot;complex64&quot;),function(t,e,n,r){return{real:t+n,imag:e+r}}):this.broadcastedBinaryOp(t,e,w.upcastType(t.dtype,e.dtype),function(t,e){return t+e})},t.prototype.addN=function(t){this.assertNotComplex(t,&quot;addN&quot;);for(var e=t.map(function(t){return t.dataSync()}),n=m.buffer(t[0].shape,t[0].dtype),r=n.values,i=0;i&lt;t.length;i++)for(var o=e[i],a=0;a&lt;r.length;a++)r[a]+=o[a];return n.toTensor()},t.prototype.subtract=function(t,e){return&quot;complex64&quot;===t.dtype||&quot;complex64&quot;===e.dtype?this.broadcastedBinaryComplexOp(t.cast(&quot;complex64&quot;),e.cast(&quot;complex64&quot;),function(t,e,n,r){return{real:t-n,imag:e-r}}):this.broadcastedBinaryOp(t,e,w.upcastType(t.dtype,e.dtype),function(t,e){return t-e})},t.prototype.pow=function(t,e){return this.assertNotComplex([t,e],&quot;pow&quot;),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.pow(t,e)})},t.prototype.batchMatMul=function(t,e,n,r){this.assertNotComplex([t,e],&quot;matMul&quot;);for(var i=n?t.shape[1]:t.shape[2],o=n?t.shape[2]:t.shape[1],a=r?e.shape[1]:e.shape[2],s=t.shape[0],u=t.dataSync(),l=e.dataSync(),c=n?[t.strides[0],1,t.strides[1]]:[t.strides[0],t.strides[1],1],f=c[0],p=c[1],h=c[2],d=r?[1,e.strides[1],e.strides[0]]:[e.strides[1],1,e.strides[0]],m=d[0],v=d[1],y=d[2],b=o*a,_=g.buffer([s,o,a],t.dtype),w=_.values,x=this.blockSize,E=0;E&lt;s;E++)for(var k=0;k&lt;o;k+=x)for(var T=0;T&lt;a;T+=x)for(var N=0;N&lt;i;N+=x)for(var S=Math.min(k+x,o),C=Math.min(T+x,a),A=Math.min(N+x,i),I=k;I&lt;S;I++)for(var O=T;O&lt;C;O++){for(var M=0,R=N;R&lt;A;R++)M+=u[E*f+I*p+R*h]*l[R*m+O*v+E*y];w[E*b+(I*a+O)]+=M}return _.toTensor()},t.prototype.fusedBatchMatMul=function(t,e,n,r,i,o){var a=this.batchMatMul(t,e,n,r);return i&amp;&amp;(a=this.add(a,i)),o&amp;&amp;(a=function(t,e,n){if(&quot;linear&quot;===e)return t.linear(n);if(&quot;relu&quot;===e)return t.relu(n);throw new Error(&quot;Activation &quot;+e+&quot; has not been implemented for the CPU backend.&quot;)}(this,o,a)),a},t.prototype.multiply=function(t,e){return&quot;complex64&quot;===t.dtype||&quot;complex64&quot;===e.dtype?this.broadcastedBinaryComplexOp(t.cast(&quot;complex64&quot;),e.cast(&quot;complex64&quot;),function(t,e,n,r){return{real:t*n-e*r,imag:t*r+e*n}}):this.broadcastedBinaryOp(t,e,w.upcastType(t.dtype,e.dtype),function(t,e){return t*e})},t.prototype.realDivide=function(t,e){this.assertNotComplex([t,e],&quot;realDivide&quot;);return this.broadcastedBinaryOp(t,e,&quot;float32&quot;,function(t,e){return t/e})},t.prototype.floorDiv=function(t,e){this.assertNotComplex([t,e],&quot;floorDiv&quot;);return this.broadcastedBinaryOp(t,e,&quot;int32&quot;,function(t,e){return Math.floor(t/e)})},t.prototype.sum=function(t,e){this.assertNotComplex(t,&quot;sum&quot;),c.assertAxesAreInnerMostDims(&quot;sum&quot;,e,t.rank);for(var n=c.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=w.upcastType(t.dtype,&quot;int32&quot;),a=m.zeros(r,o),s=x.sizeFromShape(i),u=a.dataSync(),l=t.dataSync(),f=0;f&lt;u.length;++f){for(var p=f*s,h=0,d=0;d&lt;s;++d)h+=l[p+d];u[f]=h}return a},t.prototype.prod=function(t,e){this.assertNotComplex(t,&quot;sum&quot;);for(var n=c.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=w.upcastType(t.dtype,&quot;int32&quot;),a=m.zeros(r,o),s=x.sizeFromShape(i),u=a.dataSync(),l=t.dataSync(),f=0;f&lt;u.length;++f){for(var p=f*s,h=1,d=0;d&lt;s;++d)h*=l[p+d];u[f]=h}return a},t.prototype.unsortedSegmentSum=function(t,e,n){this.assertNotComplex(t,&quot;unsortedSegmentSum&quot;);for(var r=[],i=t.rank-e.rank,o=0;o&lt;i;++o)e=e.expandDims(o+1);for(o=0;o&lt;n;++o){var a=m.scalar(o,&quot;int32&quot;),s=m.equal(a,e).asType(&quot;float32&quot;).mul(t).sum(0);r.push(s)}return m.stack(r)},t.prototype.argMin=function(t,e){this.assertNotComplex(t,&quot;argMin&quot;);var n=[e];c.assertAxesAreInnerMostDims(&quot;argMin&quot;,n,t.rank);for(var r=c.computeOutAndReduceShapes(t.shape,n),i=r[0],o=r[1],a=m.zeros(i,&quot;int32&quot;),s=x.sizeFromShape(o),u=a.dataSync(),l=t.dataSync(),f=0;f&lt;u.length;++f){for(var p=f*s,h=l[p],d=0,g=0;g&lt;s;++g){var v=l[p+g];v&lt;h&amp;&amp;(h=v,d=g)}u[f]=d}return a},t.prototype.argMax=function(t,e){this.assertNotComplex(t,&quot;argMax&quot;);var n=[e];c.assertAxesAreInnerMostDims(&quot;argMax&quot;,n,t.rank);for(var r=c.computeOutAndReduceShapes(t.shape,n),i=r[0],o=r[1],a=m.zeros(i,&quot;int32&quot;),s=x.sizeFromShape(o),u=a.dataSync(),l=t.dataSync(),f=0;f&lt;u.length;++f){for(var p=f*s,h=l[p],d=0,g=0;g&lt;s;++g){var v=l[p+g];v&gt;h&amp;&amp;(h=v,d=g)}u[f]=d}return a},t.prototype.cumsum=function(t,e,n,r){if(this.assertNotComplex(t,&quot;cumsum&quot;),e!==t.rank-1)throw new Error(&quot;backend.cumsum in CPU expects an inner-most axis=&quot;+(t.rank-1)+&quot; but got axis=&quot;+e);for(var i=w.upcastType(t.dtype,&quot;int32&quot;),o=m.zeros(t.shape,i),a=o.dataSync(),s=t.dataSync(),u=t.shape[t.rank-1],l=r?function(t,e){return t+u-e-1}:function(t,e){return t+e},c=0;c&lt;s.length;c+=u)for(var f=0;f&lt;u;f++){var p=l(c,f);if(0===f)a[p]=n?0:s[p];else{var h=l(c,f-1);a[p]=n?s[h]+a[h]:s[p]+a[h]}}return o},t.prototype.equal=function(t,e){return this.assertNotComplex([t,e],&quot;equal&quot;),this.broadcastedBinaryOp(t,e,&quot;bool&quot;,function(t,e){return t===e?1:0})},t.prototype.notEqual=function(t,e){return this.assertNotComplex([t,e],&quot;notEqual&quot;),this.broadcastedBinaryOp(t,e,&quot;bool&quot;,function(t,e){return t!==e?1:0})},t.prototype.less=function(t,e){return this.assertNotComplex([t,e],&quot;less&quot;),this.broadcastedBinaryOp(t,e,&quot;bool&quot;,function(t,e){return t&lt;e?1:0})},t.prototype.lessEqual=function(t,e){return this.assertNotComplex([t,e],&quot;lessEqual&quot;),this.broadcastedBinaryOp(t,e,&quot;bool&quot;,function(t,e){return t&lt;=e?1:0})},t.prototype.greater=function(t,e){return this.assertNotComplex([t,e],&quot;greater&quot;),this.broadcastedBinaryOp(t,e,&quot;bool&quot;,function(t,e){return t&gt;e?1:0})},t.prototype.greaterEqual=function(t,e){return this.assertNotComplex([t,e],&quot;greaterEqual&quot;),this.broadcastedBinaryOp(t,e,&quot;bool&quot;,function(t,e){return t&gt;=e?1:0})},t.prototype.logicalNot=function(t){this.assertNotComplex(t,&quot;logicalNot&quot;);for(var e=t.dataSync(),n=new Uint8Array(e.length),r=0;r&lt;e.length;++r)n[r]=e[r]?0:1;return _.Tensor.make(t.shape,{values:n},&quot;bool&quot;)},t.prototype.logicalAnd=function(t,e){return this.assertNotComplex([t,e],&quot;logicalAnd&quot;),this.broadcastedBinaryOp(t,e,&quot;bool&quot;,function(t,e){return t&amp;&amp;e})},t.prototype.logicalOr=function(t,e){return this.assertNotComplex([t,e],&quot;logicalOr&quot;),this.broadcastedBinaryOp(t,e,&quot;bool&quot;,function(t,e){return t||e})},t.prototype.select=function(t,e,n){this.assertNotComplex([t,e,n],&quot;select&quot;);for(var r=t.dataSync(),i=e.dataSync(),o=n.dataSync(),a=m.zeros(e.shape,w.upcastType(e.dtype,n.dtype)),s=a.dataSync(),u=0,l=0===t.rank||t.rank&gt;1||1===e.rank?1:e.shape[1],c=0;c&lt;r.length;c++)for(var f=0;f&lt;l;f++)1===r[c]?s[u++]=i[c]:s[u++]=o[c];return a},t.prototype.where=function(t){this.assertNotComplex([t],&quot;where&quot;);var e=t.dataSync();return I.whereImpl(t.shape,e)},t.prototype.topk=function(t,e,n){this.assertNotComplex(t,&quot;topk&quot;);var r=t.dataSync();return A.topkImpl(r,t.shape,t.dtype,e,n)},t.prototype.min=function(t,e){this.assertNotComplex(t,&quot;min&quot;),c.assertAxesAreInnerMostDims(&quot;min&quot;,e,t.rank);for(var n=c.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=m.zeros(r,t.dtype),a=x.sizeFromShape(i),s=o.dataSync(),u=t.dataSync(),l=0;l&lt;s.length;++l){for(var f=l*a,p=u[f],h=0;h&lt;a;++h){var d=u[f+h];d&lt;p&amp;&amp;(p=d)}s[l]=p}return o},t.prototype.minimum=function(t,e){return this.assertNotComplex([t,e],&quot;minimum&quot;),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.min(t,e)})},t.prototype.mod=function(t,e){return this.assertNotComplex([t,e],&quot;mod&quot;),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){var n=t%e;return t&lt;0&amp;&amp;e&lt;0||t&gt;=0&amp;&amp;e&gt;=0?n:(n+e)%e})},t.prototype.max=function(t,e){this.assertNotComplex(t,&quot;max&quot;),c.assertAxesAreInnerMostDims(&quot;max&quot;,e,t.rank);for(var n=c.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=m.zeros(r,t.dtype),a=x.sizeFromShape(i),s=o.dataSync(),u=t.dataSync(),l=0;l&lt;s.length;++l){for(var f=l*a,p=u[f],h=0;h&lt;a;++h){var d=u[f+h];d&gt;p&amp;&amp;(p=d)}s[l]=p}return o},t.prototype.maximum=function(t,e){return this.assertNotComplex([t,e],&quot;maximum&quot;),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.max(t,e)})},t.prototype.all=function(t,e){this.assertNotComplex(t,&quot;all&quot;),c.assertAxesAreInnerMostDims(&quot;all&quot;,e,t.rank);for(var n=c.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=m.zeros(r,t.dtype),a=x.sizeFromShape(i),s=o.dataSync(),u=t.dataSync(),l=0;l&lt;s.length;++l){for(var f=l*a,p=u[f],h=0;h&lt;a;++h){var d=u[f+h];p=p&amp;&amp;d}s[l]=p}return o},t.prototype.any=function(t,e){this.assertNotComplex(t,&quot;any&quot;),c.assertAxesAreInnerMostDims(&quot;any&quot;,e,t.rank);for(var n=c.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=m.zeros(r,t.dtype),a=x.sizeFromShape(i),s=o.dataSync(),u=t.dataSync(),l=0;l&lt;s.length;++l){for(var f=l*a,p=u[f],h=0;h&lt;a;++h){var d=u[f+h];p=p||d}s[l]=p}return o},t.prototype.squaredDifference=function(t,e){return this.assertNotComplex([t,e],&quot;squaredDifference&quot;),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){var n=t-e;return n*n})},t.prototype.ceil=function(t){this.assertNotComplex(t,&quot;ceil&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r)n[r]=Math.ceil(e[r]);return _.Tensor.make(t.shape,{values:n})},t.prototype.floor=function(t){this.assertNotComplex(t,&quot;floor&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r)n[r]=Math.floor(e[r]);return _.Tensor.make(t.shape,{values:n})},t.prototype.sign=function(t){this.assertNotComplex(t,&quot;x&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r)e[r]&lt;0?n[r]=-1:e[r]&gt;0?n[r]=1:n[r]=0;return _.Tensor.make(t.shape,{values:n})},t.prototype.isNaN=function(t){this.assertNotComplex(t,&quot;x&quot;);for(var e=t.dataSync(),n=new Uint8Array(e.length),r=0;r&lt;e.length;++r)Number.isNaN(e[r])&amp;&amp;(n[r]=1);return _.Tensor.make(t.shape,{values:n},&quot;bool&quot;)},t.prototype.isInf=function(t){this.assertNotComplex(t,&quot;x&quot;);for(var e=t.dataSync(),n=new Uint8Array(e.length),r=0;r&lt;e.length;++r)Math.abs(e[r])===1/0&amp;&amp;(n[r]=1);return _.Tensor.make(t.shape,{values:n},&quot;bool&quot;)},t.prototype.isFinite=function(t){this.assertNotComplex(t,&quot;x&quot;);for(var e=t.dataSync(),n=new Uint8Array(e.length),r=0;r&lt;e.length;++r)Number.isFinite(e[r])&amp;&amp;(n[r]=1);return _.Tensor.make(t.shape,{values:n},&quot;bool&quot;)},t.prototype.round=function(t){this.assertNotComplex(t,&quot;round&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r){var i=Math.floor(e[r]);e[r]-i&lt;.5?n[r]=Math.floor(e[r]):e[r]-i&gt;.5?n[r]=Math.ceil(e[r]):n[r]=i%2==0?i:i+1}return _.Tensor.make(t.shape,{values:n})},t.prototype.exp=function(t){this.assertNotComplex(t,&quot;exp&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r)n[r]=Math.exp(e[r]);return _.Tensor.make(t.shape,{values:n})},t.prototype.expm1=function(t){this.assertNotComplex(t,&quot;expm1&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r)n[r]=Math.expm1(e[r]);return _.Tensor.make(t.shape,{values:n})},t.prototype.log=function(t){this.assertNotComplex(t,&quot;log&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r){var i=e[r];n[r]=Math.log(i)}return _.Tensor.make(t.shape,{values:n})},t.prototype.log1p=function(t){this.assertNotComplex(t,&quot;log1p&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r){var i=e[r];n[r]=Math.log1p(i)}return _.Tensor.make(t.shape,{values:n})},t.prototype.sqrt=function(t){this.assertNotComplex(t,&quot;sqrt&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r){var i=e[r];n[r]=Math.sqrt(i)}return _.Tensor.make(t.shape,{values:n})},t.prototype.rsqrt=function(t){this.assertNotComplex(t,&quot;rsqrt&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r){var i=e[r];n[r]=1/Math.sqrt(i)}return _.Tensor.make(t.shape,{values:n})},t.prototype.square=function(t){this.assertNotComplex(t,&quot;square&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r){var i=e[r];n[r]=i*i}return _.Tensor.make(t.shape,{values:n})},t.prototype.reciprocal=function(t){this.assertNotComplex(t,&quot;reciprocal&quot;);for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r&lt;e.length;++r)n[r]=1/e[r];return _.Tensor.make(t.shape,{values:n})},t.prototype.linear=function(t){return t},t.prototype.relu=function(t){this.assertNotComplex(t,&quot;relu&quot;);for(var e=m.zeros(t.shape,t.dtype),n=e.dataSync(),r=t.dataSync(),i=0;i&lt;r.length;++i)n[i]=Math.max(0,r[i]);return e},t.prototype.prelu=function(t,e){return this.assertNotComplex([t,e],&quot;prelu&quot;),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return t&lt;0?e*t:t})},t.prototype.elu=function(t){this.assertNotComplex(t,&quot;elu&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r){var i=n[r];e[r]=i&gt;=0?i:Math.exp(i)-1}return _.Tensor.make(t.shape,{values:e})},t.prototype.eluDer=function(t,e){this.assertNotComplex([t,e],&quot;eluDer&quot;);for(var n=new Float32Array(e.size),r=e.dataSync(),i=t.dataSync(),o=0;o&lt;r.length;++o){var a=r[o];n[o]=a&gt;=1?i[o]:i[o]*(a+1)}return _.Tensor.make(e.shape,{values:n})},t.prototype.selu=function(t){this.assertNotComplex(t,&quot;selu&quot;);for(var e=y.SELU_SCALEALPHA,n=y.SELU_SCALE,r=new Float32Array(t.size),i=t.dataSync(),o=0;o&lt;i.length;++o){var a=i[o];r[o]=a&gt;=0?n*a:e*(Math.exp(a)-1)}return _.Tensor.make(t.shape,{values:r})},t.prototype.clip=function(t,e,n){this.assertNotComplex(t,&quot;clip&quot;);for(var r=new Float32Array(t.size),i=t.dataSync(),o=0;o&lt;i.length;++o){var a=i[o];r[o]=a&gt;n?n:a&lt;e?e:a}return _.Tensor.make(t.shape,{values:r})},t.prototype.abs=function(t){for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.abs(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.complexAbs=function(t){for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;t.size;++r){var i=n[2*r],o=n[2*r+1];e[r]=Math.hypot(i,o)}return _.Tensor.make(t.shape,{values:e})},t.prototype.int=function(t){this.assertNotComplex(t,&quot;int&quot;);for(var e=new Int32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=n[r];return _.Tensor.make(t.shape,{values:e},&quot;int32&quot;)},t.prototype.sigmoid=function(t){this.assertNotComplex(t,&quot;sigmoid&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=1/(1+Math.exp(-n[r]));return _.Tensor.make(t.shape,{values:e})},t.prototype.softplus=function(t){this.assertNotComplex(t,&quot;softplus&quot;);for(var e=Math.log(1.1920928955078125e-7)+2,n=new Float32Array(t.size),r=t.dataSync(),i=0;i&lt;r.length;++i){var o=r[i]&gt;-e,a=r[i]&lt;e,s=Math.exp(r[i]),u=void 0;u=a?s:o?r[i]:Math.log(1+s),n[i]=u}return _.Tensor.make(t.shape,{values:n})},t.prototype.sin=function(t){this.assertNotComplex(t,&quot;sin&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.sin(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.cos=function(t){this.assertNotComplex(t,&quot;cos&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.cos(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.tan=function(t){this.assertNotComplex(t,&quot;tan&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.tan(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.asin=function(t){this.assertNotComplex(t,&quot;asin&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.asin(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.acos=function(t){this.assertNotComplex(t,&quot;acos&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.acos(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.atan=function(t){this.assertNotComplex(t,&quot;atan&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.atan(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.atan2=function(t,e){return this.assertNotComplex([t,e],&quot;atan2&quot;),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.atan2(t,e)})},t.prototype.sinh=function(t){this.assertNotComplex(t,&quot;sinh&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.sinh(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.cosh=function(t){this.assertNotComplex(t,&quot;cosh&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.cosh(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.tanh=function(t){this.assertNotComplex(t,&quot;tanh&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=x.tanh(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.asinh=function(t){this.assertNotComplex(t,&quot;asinh&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.asinh(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.acosh=function(t){this.assertNotComplex(t,&quot;acosh&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.acosh(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.atanh=function(t){this.assertNotComplex(t,&quot;atanh&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r&lt;n.length;++r)e[r]=Math.atanh(n[r]);return _.Tensor.make(t.shape,{values:e})},t.prototype.erf=function(t){this.assertNotComplex(t,&quot;erf&quot;);for(var e=new Float32Array(t.size),n=t.dataSync(),r=h.ERF_P,i=h.ERF_A1,o=h.ERF_A2,a=h.ERF_A3,s=h.ERF_A4,u=h.ERF_A5,l=0;l&lt;n.length;++l){var c=n[l],f=1/(1+r*c);e[l]=1-((((u*f+s)*f+a)*f+o)*f+i)*f*Math.exp(-c*c)}return _.Tensor.make(t.shape,{values:e})},t.prototype.step=function(t,e){void 0===e&amp;&amp;(e=0),this.assertNotComplex(t,&quot;step&quot;);for(var n=new Float32Array(t.size),r=t.dataSync(),i=0;i&lt;r.length;++i){var o=r[i];isNaN(o)?n[i]=NaN:n[i]=o&gt;0?1:e}return _.Tensor.make(t.shape,{values:n})},t.prototype.conv2d=function(t,e,n){this.assertNotComplex([t,e],&quot;conv2d&quot;);for(var r=n.filterHeight,i=n.filterWidth,o=n.dilationHeight,a=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,l=m.buffer(n.outShape,t.dtype),c=t.dataSync(),f=e.dataSync(),p=l.values,h=0;h&lt;n.batchSize;++h)for(var d=h*t.strides[0],g=h*l.strides[0],v=0;v&lt;n.outHeight;++v)for(var y=g+v*l.strides[1],b=v*n.strideHeight-s,_=0;_&lt;r;_++){var w=b+_*o;if(!(w&lt;0||w&gt;=n.inHeight))for(var x=_*e.strides[0],E=d+w*t.strides[1],k=0;k&lt;n.outWidth;++k)for(var T=y+k*n.outChannels,N=k*n.strideWidth-u,S=0;S&lt;i;S++){var C=N+S*a;if(!(C&lt;0||C&gt;=n.inWidth))for(var A=x+S*e.strides[1],I=E+C*n.inChannels,O=A,M=0;M&lt;n.inChannels;++M){for(var R=c[I+M],P=0;P&lt;n.outChannels;++P)p[T+P]+=R*f[O+P];O+=n.outChannels}}}return l.toTensor()},t.prototype.conv3d=function(t,e,n){for(var r=n.filterDepth,i=n.filterHeight,o=n.filterWidth,a=n.dilationDepth,s=n.dilationHeight,u=n.dilationWidth,l=n.padInfo.front,c=n.padInfo.left,f=n.padInfo.top,p=m.buffer(n.outShape,t.dtype),h=t.dataSync(),d=e.dataSync(),g=p.values,v=0;v&lt;n.batchSize;++v)for(var y=v*t.strides[0],b=v*p.strides[0],_=0;_&lt;n.outDepth;++_)for(var w=b+_*p.strides[1],x=_*n.strideDepth-l,E=0;E&lt;r;E++){var k=x+E*a;if(!(k&lt;0||k&gt;=n.inDepth))for(var T=E*e.strides[0],N=y+k*t.strides[1],S=0;S&lt;n.outHeight;++S)for(var C=w+S*p.strides[2],A=S*n.strideHeight-f,I=0;I&lt;i;I++){var O=A+I*s;if(!(O&lt;0||O&gt;=n.inHeight))for(var M=T+I*e.strides[1],R=N+O*t.strides[2],P=0;P&lt;n.outWidth;++P)for(var D=C+P*n.outChannels,z=P*n.strideWidth-c,L=0;L&lt;o;L++){var F=z+L*u;if(!(F&lt;0||F&gt;=n.inWidth))for(var V=M+L*e.strides[2],B=R+F*n.inChannels,j=V,q=0;q&lt;n.inChannels;++q){for(var U=h[B+q],G=0;G&lt;n.outChannels;++G)g[D+G]+=U*d[j+G];j+=n.outChannels}}}}return p.toTensor()},t.prototype.conv2dDerInput=function(t,e,n){this.assertNotComplex([t,e],&quot;conv2dDerInput&quot;);for(var r=m.buffer(n.inShape,&quot;float32&quot;),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],l=t.dataSync(),c=t.strides,f=c[0],p=c[1],h=c[2],d=e.dataSync(),g=e.strides,v=g[0],y=g[1],b=g[2],_=n.batchSize,w=n.filterHeight,x=n.filterWidth,E=n.inChannels,k=n.inHeight,T=n.inWidth,N=n.outChannels,S=n.outHeight,C=n.outWidth,A=n.strideHeight,I=n.strideWidth,O=w-1-n.padInfo.top,M=x-1-n.padInfo.left,R=0;R&lt;_;++R)for(var P=0;P&lt;E;++P)for(var D=0;D&lt;k;++D)for(var z=D-O,L=Math.max(0,Math.ceil(z/A)),F=Math.min(S,(w+z)/A),V=0;V&lt;T;++V){for(var B=V-M,j=Math.max(0,Math.ceil(B/I)),q=Math.min(C,(x+B)/I),U=0,G=L;G&lt;F;++G)for(var W=G*A-z,H=j;H&lt;q;++H)for(var $=f*R+p*G+h*H,K=v*(w-1-W)+y*(x-1-(H*I-B))+b*P,Y=0;Y&lt;N;++Y){U+=l[$+Y]*d[K+Y]}i[a*R+s*D+u*V+P]=U}return r.toTensor()},t.prototype.conv3dDerInput=function(t,e,n){for(var r=m.buffer(n.inShape,&quot;float32&quot;),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],l=o[3],c=t.dataSync(),f=t.strides,p=f[0],h=f[1],d=f[2],g=f[3],v=e.dataSync(),y=e.strides,b=y[0],_=y[1],w=y[2],x=y[3],E=n.batchSize,k=n.filterDepth,T=n.filterHeight,N=n.filterWidth,S=n.inChannels,C=n.inDepth,A=n.inHeight,I=n.inWidth,O=n.outChannels,M=n.outDepth,R=n.outHeight,P=n.outWidth,D=n.strideDepth,z=n.strideHeight,L=n.strideWidth,F=k-1-n.padInfo.front,V=T-1-n.padInfo.top,B=N-1-n.padInfo.left,j=0;j&lt;E;++j)for(var q=0;q&lt;S;++q)for(var U=0;U&lt;C;++U)for(var G=U-F,W=Math.max(0,Math.ceil(G/D)),H=Math.min(M,(k+G)/D),$=0;$&lt;A;++$)for(var K=$-V,Y=Math.max(0,Math.ceil(K/z)),X=Math.min(R,(T+K)/z),Z=0;Z&lt;I;++Z){for(var Q=Z-B,J=Math.max(0,Math.ceil(Q/L)),tt=Math.min(P,(N+Q)/L),et=0,nt=W;nt&lt;H;++nt)for(var rt=nt*D-G,it=Y;it&lt;X;++it)for(var ot=it*z-K,at=J;at&lt;tt;++at)for(var st=p*j+h*nt+d*it+g*at,ut=b*(k-1-rt)+_*(T-1-ot)+w*(N-1-(at*L-Q))+x*q,lt=0;lt&lt;O;++lt){et+=c[st+lt]*v[ut+lt]}i[a*j+s*U+u*$+l*Z+q]=et}return r.toTensor()},t.prototype.conv2dDerFilter=function(t,e,n){this.assertNotComplex([t,e],&quot;conv2dDerFilter&quot;);for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=m.buffer(n.filterShape,&quot;float32&quot;),u=n.padInfo.left,l=n.padInfo.top,c=t.bufferSync(),f=e.bufferSync(),p=0;p&lt;o;++p)for(var h=Math.max(0,Math.ceil((l-p)/r)),d=Math.min(n.outHeight,(n.inHeight+l-p)/r),g=0;g&lt;a;++g)for(var v=Math.max(0,Math.ceil((u-g)/i)),y=Math.min(n.outWidth,(n.inWidth+u-g)/i),b=0;b&lt;n.inChannels;++b)for(var _=0;_&lt;n.outChannels;++_){for(var w=0,x=0;x&lt;n.batchSize;++x)for(var E=h;E&lt;d;++E)for(var k=p+E*r-l,T=v;T&lt;y;++T){var N=g+T*i-u;w+=c.get(x,k,N,b)*f.get(x,E,T,_)}s.set(w,p,g,b,_)}return s.toTensor()},t.prototype.conv3dDerFilter=function(t,e,n){for(var r=n.strideDepth,i=n.strideHeight,o=n.strideWidth,a=n.filterDepth,s=n.filterHeight,u=n.filterWidth,l=m.buffer(n.filterShape,&quot;float32&quot;),c=l.values,f=l.strides,p=f[0],h=f[1],d=f[2],g=f[3],v=e.dataSync(),y=e.strides,b=y[0],_=y[1],w=y[2],x=y[3],E=t.dataSync(),k=t.strides,T=k[0],N=k[1],S=k[2],C=k[3],A=n.padInfo.front,I=n.padInfo.left,O=n.padInfo.top,M=0;M&lt;a;++M)for(var R=Math.max(0,Math.ceil((A-M)/r)),P=Math.min(n.outDepth,(n.inDepth+A-M)/r),D=M*p,z=0;z&lt;s;++z)for(var L=Math.max(0,Math.ceil((O-z)/i)),F=Math.min(n.outHeight,(n.inHeight+O-z)/i),V=z*h+D,B=0;B&lt;u;++B)for(var j=Math.max(0,Math.ceil((I-B)/o)),q=Math.min(n.outWidth,(n.inWidth+I-B)/o),U=B*d+V,G=0;G&lt;n.inChannels;++G)for(var W=G*g+U,H=0;H&lt;n.outChannels;++H){for(var $=0,K=0;K&lt;n.batchSize;++K)for(var Y=K*T,X=K*b,Z=R;Z&lt;P;++Z)for(var Q=(M+Z*r-A)*N+Y,J=Z*_+X,tt=L;tt&lt;F;++tt)for(var et=(z+tt*i-O)*S+Q,nt=tt*w+J,rt=j;rt&lt;q;++rt){var it=rt*x+nt;$+=E[(B+rt*o-I)*C+et+G]*v[it+H]}c[W+H]=$}return l.toTensor()},t.prototype.depthwiseConv2D=function(t,e,n){this.assertNotComplex([t,e],&quot;depthwiseConv2D&quot;);for(var r=n.filterHeight,i=n.filterWidth,o=n.dilationHeight,a=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,l=n.outChannels/n.inChannels,c=m.buffer(n.outShape,t.dtype),f=t.dataSync(),p=e.dataSync(),h=c.values,d=0;d&lt;n.batchSize;++d)for(var g=d*t.strides[0],v=d*c.strides[0],y=0;y&lt;n.outHeight;++y)for(var b=v+y*c.strides[1],_=y*n.strideHeight-s,w=0;w&lt;r;++w){var x=_+w*o;if(!(x&lt;0||x&gt;=n.inHeight))for(var E=w*e.strides[0],k=g+x*t.strides[1],T=0;T&lt;n.outWidth;++T)for(var N=b+T*c.strides[2],S=T*n.strideWidth-u,C=0;C&lt;i;++C){var A=S+C*a;if(!(A&lt;0||A&gt;=n.inWidth))for(var I=E+C*e.strides[1],O=k+A*n.inChannels,M=N,R=I,P=0;P&lt;n.inChannels;++P){for(var D=f[O+P],z=0;z&lt;l;++z)h[M+z]+=D*p[R+z];M+=l,R+=l}}}return c.toTensor()},t.prototype.depthwiseConv2DDerInput=function(t,e,n){this.assertNotComplex([t,e],&quot;depthwiseConv2DDerInput&quot;);for(var r=m.buffer(n.inShape,&quot;float32&quot;),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],l=t.dataSync(),c=t.strides,f=c[0],p=c[1],h=c[2],d=e.dataSync(),g=e.strides,v=g[0],y=g[1],b=g[2],_=n.batchSize,w=n.filterHeight,x=n.filterWidth,E=n.inChannels,k=n.inHeight,T=n.inWidth,N=n.outChannels,S=n.outHeight,C=n.outWidth,A=n.strideHeight,I=n.strideWidth,O=w-1-n.padInfo.top,M=x-1-n.padInfo.left,R=N/E,P=0;P&lt;_;++P)for(var D=0;D&lt;E;++D)for(var z=0;z&lt;k;++z)for(var L=z-O,F=Math.max(0,Math.ceil(L/A)),V=Math.min(S,(w+L)/A),B=0;B&lt;T;++B){for(var j=B-M,q=Math.max(0,Math.ceil(j/I)),U=Math.min(C,(x+j)/I),G=0,W=F;W&lt;V;++W)for(var H=W*A-L,$=q;$&lt;U;++$)for(var K=f*P+p*W+h*$,Y=v*(w-1-H)+y*(x-1-($*I-j))+b*D,X=0;X&lt;R;++X){G+=l[K+(D*R+X)]*d[Y+X]}i[a*P+s*z+u*B+D]=G}return r.toTensor()},t.prototype.depthwiseConv2DDerFilter=function(t,e,n){this.assertNotComplex([t,e],&quot;depthwiseConv2DDerFilter&quot;);for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=m.buffer(n.filterShape,&quot;float32&quot;),u=n.padInfo.left,l=n.padInfo.top,c=n.outChannels/n.inChannels,f=t.bufferSync(),p=e.bufferSync(),h=0;h&lt;o;++h)for(var d=Math.max(0,Math.ceil((l-h)/r)),g=Math.min(n.outHeight,(n.inHeight+l-h)/r),v=0;v&lt;a;++v)for(var y=Math.max(0,Math.ceil((u-v)/i)),b=Math.min(n.outWidth,(n.inWidth+u-v)/i),_=0;_&lt;n.outChannels;++_){for(var w=Math.trunc(_/c),x=_%c,E=0,k=0;k&lt;n.batchSize;++k)for(var T=d;T&lt;g;++T)for(var N=h+T*r-l,S=y;S&lt;b;++S){var C=v+S*i-u;E+=f.get(k,N,C,w)*p.get(k,T,S,_)}s.set(E,h,v,w,x)}return s.toTensor()},t.prototype.tile=function(t,e){this.assertNotComplex(t,&quot;tile&quot;);for(var n=new Array(t.rank),r=0;r&lt;n.length;r++)n[r]=t.shape[r]*e[r];var i=m.buffer(n,t.dtype),o=t.bufferSync();for(r=0;r&lt;i.values.length;++r){for(var a=i.indexToLoc(r),s=new Array(t.rank),u=0;u&lt;s.length;u++)s[u]=a[u]%t.shape[u];var l=o.locToIndex(s);i.values[r]=o.values[l]}return i.toTensor()},t.prototype.pad=function(t,e,n){this.assertNotComplex(t,&quot;pad&quot;);var r=e.map(function(e,n){return e[0]+t.shape[n]+e[1]}),i=e.map(function(t){return t[0]}),o=t.bufferSync(),a=m.buffer(r,t.dtype);0!==n&amp;&amp;a.values.fill(n);for(var s=0;s&lt;t.size;s++){var u=o.indexToLoc(s),l=u.map(function(t,e){return t+i[e]});a.set.apply(a,[o.get.apply(o,u)].concat(l))}return a.toTensor()},t.prototype.transpose=function(t,e){this.assertNotComplex(t,&quot;transpose&quot;);for(var n=new Array(t.rank),r=0;r&lt;n.length;r++)n[r]=t.shape[e[r]];var i=t.dataSync(),o=g.buffer(n,t.dtype),a=t.bufferSync();for(r=0;r&lt;t.size;++r){for(var s=a.indexToLoc(r),u=new Array(s.length),l=0;l&lt;u.length;l++)u[l]=s[e[l]];var c=o.locToIndex(u);o.values[c]=i[r]}return o.toTensor()},t.prototype.gather=function(t,e,n){this.assertNotComplex([t,e],&quot;gather&quot;);var r=t.shape.slice(),i=e.dataSync();r[n]=i.length;for(var o=g.buffer(r,t.dtype),a=t.bufferSync(),s=0;s&lt;o.size;++s){var u=o.indexToLoc(s),l=u.slice();l[n]=i[u[n]];var c=a.locToIndex(l);o.values[s]=a.values[c]}return o.toTensor()},t.prototype.batchToSpaceND=function(t,e,n){this.assertNotComplex([t],&quot;batchToSpaceND&quot;);var r=e.reduce(function(t,e){return t*e}),i=l.getReshaped(t.shape,e,r),o=l.getPermuted(i.length,e.length),a=l.getReshapedPermuted(t.shape,e,r),s=l.getSliceBeginCoords(n,e.length),u=l.getSliceSize(a,n,e.length);return t.reshape(i).transpose(o).reshape(a).slice(s,u)},t.prototype.spaceToBatchND=function(t,e,n){this.assertNotComplex([t],&quot;spaceToBatchND&quot;);var r=e.reduce(function(t,e){return t*e}),i=[[0,0]];i.push.apply(i,n);for(var o=1+e.length;o&lt;t.shape.length;++o)i.push([0,0]);var a=t.pad(i),s=l.getReshaped(a.shape,e,r,!1),u=l.getPermuted(s.length,e.length,!1),c=l.getReshapedPermuted(a.shape,e,r,!1);return a.reshape(s).transpose(u).reshape(c)},t.prototype.pool=function(t,e,n){this.assertNotComplex(t,&quot;pool&quot;);for(var r=e.strideHeight,i=e.strideWidth,o=e.dilationHeight,a=e.dilationWidth,s=e.effectiveFilterHeight,u=e.effectiveFilterWidth,l=e.padInfo.top,c=e.padInfo.left,f=&quot;max&quot;===n?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,p=t.dataSync(),h=m.buffer(e.outShape,t.dtype),d=h.values,g=e.outShape[1]*e.outShape[2]*e.outShape[3],v=e.outShape[2]*e.outShape[3],y=e.outShape[3],b=0;b&lt;e.batchSize;++b)for(var _=b*g,w=b*t.strides[0],x=0;x&lt;e.inChannels;++x)for(var E=0;E&lt;e.outHeight;++E)for(var k=E*r-l,T=Math.max(0,k),N=Math.min(e.inHeight,s+k),S=_+E*v,C=0;C&lt;e.outWidth;++C){for(var A=C*i-c,I=Math.max(0,A),O=Math.min(e.inWidth,u+A),M=f,R=0,P=0,D=T;D&lt;N;D+=o){for(var z=w+D*t.strides[1],L=I;L&lt;O;L+=a){var F=p[z+L*t.strides[2]+x];&quot;max&quot;===n&amp;&amp;F&gt;M?M=F:&quot;avg&quot;===n&amp;&amp;(R+=F,P++)}if(isNaN(M))break}d[S+C*y+x]=&quot;avg&quot;===n?R/P:M}return h.toTensor()},t.prototype.maxPool=function(t,e){return this.pool(t,e,&quot;max&quot;)},t.prototype.maxPoolPositions=function(t,e){for(var n=m.buffer(e.outShape,&quot;int32&quot;),r=e.strideHeight,i=e.strideWidth,o=e.dilationHeight,a=e.dilationWidth,s=e.effectiveFilterHeight,u=e.effectiveFilterWidth,l=e.padInfo.top,c=e.padInfo.left,f=t.bufferSync(),p=0;p&lt;e.batchSize;++p)for(var h=0;h&lt;e.inChannels;++h)for(var d=0;d&lt;e.outHeight;++d){for(var g=d*r-l,v=g;v&lt;0;)v+=o;for(var y=Math.min(e.inHeight,s+g),b=0;b&lt;e.outWidth;++b){for(var _=b*i-c,w=_;w&lt;0;)w+=a;for(var x=Math.min(e.inWidth,u+_),E=Number.NEGATIVE_INFINITY,k=-1,T=v;T&lt;y;T+=o)for(var N=T-g,S=w;S&lt;x;S+=a){var C=S-_,A=f.get(p,T,S,h);A&gt;E&amp;&amp;(E=A,k=N*u+C)}n.set(k,p,d,b,h)}}return n.toTensor()},t.prototype.maxPoolBackprop=function(t,e,n,r){this.assertNotComplex([e,n],&quot;maxPoolBackprop&quot;);for(var i=this.maxPoolPositions(e,r),o=r.strideHeight,a=r.strideWidth,s=r.dilationHeight,u=r.dilationWidth,l=r.effectiveFilterHeight,c=r.effectiveFilterWidth,f=c-1-r.padInfo.left,p=l-1-r.padInfo.top,h=m.buffer(e.shape,&quot;float32&quot;),d=i.bufferSync(),g=t.bufferSync(),v=0;v&lt;r.batchSize;++v)for(var y=0;y&lt;r.inChannels;++y)for(var b=0;b&lt;r.inHeight;++b)for(var _=0;_&lt;r.inWidth;++_){for(var w=b-p,x=_-f,E=0,k=0;k&lt;l;k+=s){var T=(w+k)/o;if(!(T&lt;0||T&gt;=r.outHeight||Math.floor(T)!==T))for(var N=0;N&lt;c;N+=u){var S=(x+N)/a;if(!(S&lt;0||S&gt;=r.outWidth||Math.floor(S)!==S)){var C=l*c-1-d.get(v,T,S,y)===k*c+N?1:0;if(0!==C)E+=g.get(v,T,S,y)*C}}}h.set(E,v,b,_,y)}return h.toTensor()},t.prototype.avgPoolBackprop=function(t,e,n){this.assertNotComplex([t,e],&quot;avgPoolBackprop&quot;);for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=n.dilationHeight,u=n.dilationWidth,l=n.effectiveFilterHeight,c=n.effectiveFilterWidth,f=c-1-n.padInfo.left,p=l-1-n.padInfo.top,h=m.buffer(e.shape,&quot;float32&quot;),d=1/(o*a),g=t.bufferSync(),v=0;v&lt;n.batchSize;++v)for(var y=0;y&lt;n.inChannels;++y)for(var b=0;b&lt;n.inHeight;++b)for(var _=0;_&lt;n.inWidth;++_){for(var w=b-p,x=_-f,E=0,k=0;k&lt;l;k+=s){var T=(w+k)/r;if(!(T&lt;0||T&gt;=n.outHeight||Math.floor(T)!==T))for(var N=0;N&lt;c;N+=u){var S=(x+N)/i;if(!(S&lt;0||S&gt;=n.outWidth||Math.floor(S)!==S))E+=g.get(v,T,S,y)}}h.set(E*d,v,b,_,y)}return h.toTensor()},t.prototype.cast=function(t,e){return T.castTensor(t,e,this)},t.prototype.reshape=function(t,e){return T.reshapeTensor(t,e)},t.prototype.avgPool=function(t,e){return this.assertNotComplex(t,&quot;avgPool&quot;),this.pool(t,e,&quot;avg&quot;).toFloat()},t.prototype.resizeBilinear=function(t,e,n,r){this.assertNotComplex(t,&quot;resizeBilinear&quot;);for(var i=t.shape,o=i[0],a=i[1],s=i[2],u=i[3],l=t.dataSync(),c=new Float32Array(x.sizeFromShape([o,e,n,u])),f=[r&amp;&amp;e&gt;1?a-1:a,r&amp;&amp;n&gt;1?s-1:s],p=[r&amp;&amp;e&gt;1?e-1:e,r&amp;&amp;n&gt;1?n-1:n],h=0,d=f[0]/p[0],g=f[1]/p[1],v=0;v&lt;o;v++)for(var y=0;y&lt;e;y++)for(var b=d*y,_=Math.floor(b),w=b-_,E=Math.min(a-1,Math.ceil(b)),k=v*t.strides[0]+_*t.strides[1],T=v*t.strides[0]+E*t.strides[1],N=0;N&lt;n;N++)for(var S=g*N,C=Math.floor(S),A=S-C,I=Math.min(s-1,Math.ceil(S)),O=k+C*t.strides[2],M=T+C*t.strides[2],R=k+ +I*t.strides[2],P=T+I*t.strides[2],D=0;D&lt;u;D++){var z=l[O+D],L=l[M+D],F=z+(l[R+D]-z)*A,V=F+(L+(l[P+D]-L)*A-F)*w;c[h++]=V}return m.tensor(c,[o,e,n,u])},t.prototype.resizeBilinearBackprop=function(t,e,n){this.assertNotComplex([t,e],&quot;resizeBilinearBackprop&quot;);for(var r=e.shape,i=r[0],o=r[1],a=r[2],s=r[3],u=t.shape,l=u[1],c=u[2],f=new Float32Array(i*o*a*s),p=[n&amp;&amp;l&gt;1?o-1:o,n&amp;&amp;c&gt;1?a-1:a],h=[n&amp;&amp;l&gt;1?l-1:l,n&amp;&amp;c&gt;1?c-1:c],d=p[0]/h[0],g=p[1]/h[1],v=t.dataSync(),y=0,b=0;b&lt;i;b++)for(var _=b*e.strides[0],w=0;w&lt;l;w++)for(var x=w*d,E=Math.floor(x),k=Math.min(Math.ceil(x),o-1),T=_+E*e.strides[1],N=_+k*e.strides[1],S=x-E,C=1-S,A=0;A&lt;c;A++)for(var I=A*g,O=Math.floor(I),M=Math.min(Math.ceil(I),a-1),R=I-O,P=1-R,D=T+O*e.strides[2],z=T+M*e.strides[2],L=N+O*e.strides[2],F=N+M*e.strides[2],V=C*P,B=C*R,j=S*P,q=S*R,U=0;U&lt;s;U++){var G=v[y++];f[D+U]+=G*V,f[z+U]+=G*B,f[L+U]+=G*j,f[F+U]+=G*q}return m.tensor4d(f,[i,a,o,s],e.dtype)},t.prototype.resizeNearestNeighbor=function(t,e,n,r){this.assertNotComplex(t,&quot;resizeNearestNeighbor&quot;);for(var i=t.shape,o=i[0],a=i[1],s=i[2],u=i[3],l=t.dataSync(),c=new Float32Array(o*e*n*u),f=[r&amp;&amp;e&gt;1?a-1:a,r&amp;&amp;n&gt;1?s-1:s],p=[r&amp;&amp;e&gt;1?e-1:e,r&amp;&amp;n&gt;1?n-1:n],h=f[0]/p[0],d=f[1]/p[1],g=0,v=0;v&lt;o;v++)for(var y=v*t.strides[0],b=0;b&lt;e;b++)for(var _=h*b,w=y+Math.min(a-1,r?Math.round(_):Math.floor(_))*t.strides[1],x=0;x&lt;n;x++)for(var E=d*x,k=w+Math.min(s-1,r?Math.round(E):Math.floor(E))*t.strides[2],T=0;T&lt;u;T++){var N=l[k+T];c[g++]=N}return m.tensor(c,[o,e,n,u],t.dtype)},t.prototype.resizeNearestNeighborBackprop=function(t,e,n){this.assertNotComplex([t,e],&quot;resizeNearestNeighborBackprop&quot;);for(var r=e.shape,i=r[0],o=r[1],a=r[2],s=r[3],u=t.shape,l=u[1],c=u[2],f=new Float32Array(i*o*a*s),p=t.dataSync(),h=[n&amp;&amp;l&gt;1?o-1:o,n&amp;&amp;c&gt;1?a-1:a],d=[n&amp;&amp;l&gt;1?l-1:l,n&amp;&amp;c&gt;1?c-1:c],g=h[0]/d[0],v=h[1]/d[1],y=1/g,b=1/v,_=2*Math.ceil(y)+2,w=2*Math.ceil(b)+2,x=0;x&lt;i;x++)for(var E=x*e.strides[0],k=0;k&lt;o;k++)for(var T=E+k*e.strides[1],N=Math.floor(k*y),S=Math.floor(N-_/2),C=0;C&lt;a;C++)for(var A=T+C*e.strides[2],I=Math.floor(C*b),O=Math.floor(I-w/2),M=0;M&lt;s;M++){for(var R=0,P=0;P&lt;_;P++){var D=P+S;if(!(D&lt;0||D&gt;=l)){var z=E+D*t.strides[1],L=D*g;if(k===Math.min(o-1,n?Math.round(L):Math.floor(L)))for(var F=0;F&lt;w;F++){var V=F+O;if(!(V&lt;0||V&gt;=c)){var B=z+V*t.strides[2],j=V*v;C===Math.min(a-1,n?Math.round(j):Math.floor(j))&amp;&amp;(R+=p[B+M])}}}}f[A+M]=R}return m.tensor4d(f,e.shape,e.dtype)},t.prototype.batchNormalization=function(t,e,n,r,i,o){this.assertNotComplex([t,e,n,i,o],&quot;batchNorm&quot;);for(var a=t.dataSync(),s=e.dataSync(),u=n.dataSync(),l=i?i.dataSync():new Float32Array([1]),c=o?o.dataSync():new Float32Array([0]),f=new Float32Array(a.length),p=c.length,h=l.length,d=u.length,m=s.length,v=0,y=0,b=0,_=0,w=0;w&lt;a.length;++w)f[w]=c[v++]+(a[w]-s[y++])*l[b++]/Math.sqrt(u[_++]+r),v&gt;=p&amp;&amp;(v=0),y&gt;=m&amp;&amp;(y=0),b&gt;=h&amp;&amp;(b=0),_&gt;=d&amp;&amp;(_=0);return g.tensor4d(f,t.shape)},t.prototype.localResponseNormalization4D=function(t,e,n,r,i){this.assertNotComplex(t,&quot;localResponseNormalization4D&quot;);var o=t.shape[3],a=o-1,s=t.dataSync(),u=t.size,l=new Float32Array(u);function c(t){for(var n=t%o,r=t-n+Math.max(0,n-e),i=t-n+Math.min(n+e,a),u=0;r&lt;=i;r++){var l=s[r];u+=l*l}return u}for(var f=0;f&lt;u;f++){var p=c(f),h=s[f]*Math.pow(n+r*p,-i);l[f]=h}return m.tensor4d(l,t.shape)},t.prototype.LRNGrad=function(t,e,n,r,i,o,a){this.assertNotComplex(t,&quot;LRNGrad&quot;);for(var s=t.shape[3],u=t.dataSync(),l=e.dataSync(),c=n.dataSync(),f=new Float32Array(t.size),p=t.size,h=0;h&lt;p;h++){for(var d=h%s,g=h-d+Math.max(0,d-r),v=h-d+Math.min(s,d+r+1),y=0,b=g;b&lt;v;b++)y+=Math.pow(l[b],2);y=o*y+i;for(b=g;b&lt;v;b++){var _=-2*o*a*l[b]*c[h]/y;h===b&amp;&amp;(_+=Math.pow(y,-a)),_*=u[h],f[b]+=_}}return m.tensor4d(f,t.shape)},t.prototype.multinomial=function(t,e,n,r){this.assertNotComplex(t,&quot;multinomial&quot;);for(var i=e?t:m.softmax(t),a=i.shape[0],s=i.shape[1],u=m.zeros([a,n],&quot;int32&quot;),l=u.dataSync(),c=i.dataSync(),f=0;f&lt;a;++f){var p=f*s,h=new Float32Array(s-1);h[0]=c[p];for(var d=1;d&lt;h.length;++d)h[d]=h[d-1]+c[p+d];for(var g=o.alea(r.toString()),v=f*n,y=0;y&lt;n;++y){var b=g();l[v+y]=h.length;for(var _=0;_&lt;h.length;_++)if(b&lt;h[_]){l[v+y]=_;break}}}return u},t.prototype.oneHot=function(t,e,n,r){this.assertNotComplex(t,&quot;oneHot&quot;);var i=new Float32Array(t.size*e);i.fill(r);for(var o=t.dataSync(),a=0;a&lt;t.size;++a)o[a]&gt;=0&amp;&amp;o[a]&lt;e&amp;&amp;(i[a*e+o[a]]=n);return m.tensor2d(i,[t.size,e],&quot;int32&quot;)},t.prototype.nonMaxSuppression=function(t,e,n,r,i){this.assertNotComplex(t,&quot;nonMaxSuppression&quot;);var o=t.dataSync(),a=e.dataSync();return S.nonMaxSuppressionImpl(o,a,n,r,i)},t.prototype.fft=function(t){return this.fftBatch(t,!1)},t.prototype.ifft=function(t){return this.fftBatch(t,!0)},t.prototype.fftBatch=function(t,e){for(var n=t.shape[0],r=t.shape[1],i=m.buffer(t.shape,&quot;float32&quot;),o=m.buffer(t.shape,&quot;float32&quot;),a=m.real(t).as2D(n,r),s=m.imag(t).as2D(n,r),u=0;u&lt;n;u++)for(var l=a.slice([u,0],[1,r]),c=s.slice([u,0],[1,r]),f=m.complex(l,c),p=this.fftImpl(f,e).dataSync(),h=0;h&lt;r;h++){var d=N.getComplexWithIndex(p,h);i.values[u*r+h]=d.real,o.values[u*r+h]=d.imag}return m.complex(i.toTensor(),o.toTensor()).as2D(n,r)},t.prototype.fftImpl=function(t,e){var n=t.as1D(),r=n.size;if(this.isExponentOf2(r)){var i=this.fftRadix2(n,r,e).as2D(t.shape[0],t.shape[1]);return e&amp;&amp;(i=m.complex(m.real(i).div(g.scalar(r)),m.imag(i).div(g.scalar(r)))),i}var o=t.dataSync(),a=this.fourierTransformByMatmul(o,r,e),s=N.splitRealAndImagArrays(a);return m.complex(s.real,s.imag).as2D(t.shape[0],t.shape[1])},t.prototype.isExponentOf2=function(t){return 0==(t&amp;t-1)},t.prototype.fftRadix2=function(t,e,n){if(1===e)return t;var r=t.dataSync(),i=e/2,o=N.complexWithEvenIndex(r),a=m.complex(o.real,o.imag).as1D(),s=N.complexWithOddIndex(r),u=m.complex(s.real,s.imag).as1D();a=this.fftRadix2(a,i,n),u=this.fftRadix2(u,i,n);var l=N.exponents(e,n),c=m.complex(l.real,l.imag).mul(u),f=a.add(c),p=a.sub(c),h=m.real(f).concat(m.real(p)),d=m.imag(f).concat(m.imag(p));return m.complex(h,d).as1D()},t.prototype.fourierTransformByMatmul=function(t,e,n){for(var r=new Float32Array(2*e),i=0;i&lt;e;i++){for(var o=0,a=0,s=0;s&lt;e;s++){var u=N.exponent(i*s,e,n),l=N.getComplexWithIndex(t,s);o+=l.real*u.real-l.imag*u.imag,a+=l.real*u.imag+l.imag*u.real}n&amp;&amp;(o/=e,a/=e),N.assignToTypedArray(r,o,a,i)}return r},t.prototype.depthToSpace=function(t,e,n){x.assert(&quot;NHWC&quot;===n,function(){return&quot;Only NHWC dataFormat supported on CPU for depthToSpace. Got &quot;+n}),x.assert(e&gt;1,function(){return&quot;blockSize should be &gt; 1 for depthToSpace, but was: &quot;+e});for(var r=t.shape[0],i=t.shape[1],o=t.shape[2],a=t.shape[3],s=i*e,u=o*e,l=a/(e*e),c=t.dataSync(),f=new Float32Array(r*s*u*l),p=0,h=0;h&lt;r;++h)for(var d=0;d&lt;s;++d)for(var g=Math.floor(d/e),v=d%e,y=0;y&lt;u;++y)for(var b=Math.floor(y/e),_=(v*e+y%e)*l,w=0;w&lt;l;++w){var E=w+_+a*(b+o*(g+i*h));f[p++]=c[E]}return m.tensor4d(f,[r,s,u,l])},t.prototype.broadcastedBinaryOp=function(t,e,n,r){var i=f.assertAndGetBroadcastShape(t.shape,e.shape),o=m.buffer(i,n),a=t.dataSync(),s=e.dataSync(),u=f.getBroadcastDims(t.shape,i),l=f.getBroadcastDims(e.shape,i),c=o.values;if(u.length+l.length===0)for(var p=0;p&lt;c.length;++p)c[p]=r(a[p%a.length],s[p%s.length]);else{var h=t.bufferSync(),d=e.bufferSync(),g=function(n){var i=o.indexToLoc(n),f=i.slice(-t.rank);u.forEach(function(t){return f[t]=0});var p=h.locToIndex(f),m=i.slice(-e.rank);l.forEach(function(t){return m[t]=0});var g=d.locToIndex(m);c[n]=r(a[p],s[g])};for(p=0;p&lt;c.length;++p)g(p)}return o.toTensor()},t.prototype.broadcastedBinaryComplexOp=function(t,e,n){var r=f.assertAndGetBroadcastShape(t.shape,e.shape),i=m.buffer(r,&quot;float32&quot;),o=m.buffer(r,&quot;float32&quot;),a=t.dataSync(),s=e.dataSync(),u=f.getBroadcastDims(t.shape,r),l=f.getBroadcastDims(e.shape,r),c=i.values,p=o.values;if(u.length+l.length===0)for(var h=0;h&lt;c.length;h++){var d=h%a.length,g=h%s.length,v=n(a[2*d],a[2*d+1],s[2*g],s[2*g+1]);c[h]=v.real,p[h]=v.imag}else{var y=this.data.get(t.dataId).complexTensors.real.bufferSync(),b=this.data.get(e.dataId).complexTensors.real.bufferSync(),_=function(r){var o=i.indexToLoc(r),f=o.slice(-t.rank);u.forEach(function(t){return f[t]=0});var h=y.locToIndex(f),d=o.slice(-e.rank);l.forEach(function(t){return d[t]=0});var m=b.locToIndex(d),g=n(a[2*h],a[2*h+1],s[2*m],s[2*m+1]);c[r]=g.real,p[r]=g.imag};for(h=0;h&lt;c.length;h++)_(h)}return this.complex(i.toTensor(),o.toTensor())},t.prototype.split=function(t,e,n){return C.split(t,e,n)},t.prototype.dispose=function(){},t.prototype.floatPrecision=function(){return 32},t.prototype.epsilon=function(){return k.EPSILON_FLOAT32},t.prototype.cropAndResize=function(t,e,n,r,i,o){for(var a=t.shape,s=a[0],u=a[1],l=a[2],c=a[3],f=e.shape[0],p=r[0],h=r[1],d=m.buffer([f,p,h,c],t.dtype),g=e.dataSync(),v=n.dataSync(),y=t.dataSync(),b=t.strides,_=d.strides,w=0;w&lt;f;w++){var x=4*w,E=g[x],k=g[x+1],T=g[x+2],N=g[x+3],S=v[w];if(!(S&gt;=s))for(var C=p&gt;1?(T-E)*(u-1)/(p-1):0,A=h&gt;1?(N-k)*(l-1)/(h-1):0,I=0;I&lt;p;I++){var O=p&gt;1?E*(u-1)+I*C:.5*(E+T)*(u-1);if(O&lt;0||O&gt;u-1)for(var M=0;M&lt;h;M++)for(var R=0;R&lt;c;R++){var P=R+M*_[2]+I*_[1]+w*_[0];d.values[P]=o}else if(&quot;bilinear&quot;===i){var D=Math.floor(O),z=Math.ceil(O),L=O-D;for(M=0;M&lt;h;M++){if((H=h&gt;1?k*(l-1)+M*A:.5*(k+N)*(l-1))&lt;0||H&gt;l-1)for(R=0;R&lt;c;R++){P=R+M*_[2]+I*_[1]+w*_[0];d.values[P]=o}else{var F=Math.floor(H),V=Math.ceil(H),B=H-F;for(R=0;R&lt;c;R++){var j=y[P=R+F*b[2]+D*b[1]+S*b[0]],q=y[P=R+V*b[2]+D*b[1]+S*b[0]],U=y[P=R+F*b[2]+z*b[1]+S*b[0]],G=j+(q-j)*B,W=U+(y[P=R+V*b[2]+z*b[1]+S*b[0]]-U)*B;P=R+M*_[2]+I*_[1]+w*_[0],d.values[P]=G+(W-G)*L}}}}else for(M=0;M&lt;h;++M){var H;if((H=h&gt;1?k*(l-1)+M*A:.5*(k+N)*(l-1))&lt;0||H&gt;l-1)for(R=0;R&lt;c;R++){P=R+M*_[2]+I*_[1]+w*_[0];d.values[P]=o}else{var $=Math.round(H),K=Math.round(O);for(R=0;R&lt;c;R++){var Y=R+$*b[2]+K*b[1]+S*b[0],X=R+M*_[2]+I*_[1]+w*_[0];d.values[X]=y[Y]}}}}}return d.toTensor()},t.prototype.sparseToDense=function(t,e,n,r){var i=v.calculateShapes(e,t,n),o=i.sliceRank,a=i.numUpdates,s=i.sliceSize,u=i.strides,l=i.outputSize;return this.scatter(t,e,n,l,s,a,o,u,r,!1)},t.prototype.gatherND=function(t,e){var n=e.shape,r=n[n.length-1],i=d.prepareAndValidate(t,e),o=i[0],a=i[1],s=i[2],u=i[3];if(0===a)return g.tensor([],o,t.dtype);for(var l=new _.TensorBuffer([a,s],t.dtype),c=e.dataSync(),f=t.dataSync(),p=0;p&lt;a;p++){for(var h=[],m=0,v=0;v&lt;r;v++){var y=c[p*r+v];m+=y*u[v],h.push(y)}if(m&lt;0||m&gt;=t.size/s)throw new Error(&quot;Invalid indices: &quot;+h+&quot; does not index into &quot;+t.shape);for(var b=0;b&lt;s;b++)l.values[p*s+b]=f[m*s+b]}return l.toTensor().reshape(o)},t.prototype.scatterND=function(t,e,n){var r=v.calculateShapes(e,t,n),i=r.sliceRank,o=r.numUpdates,a=r.sliceSize,s=r.strides,u=r.outputSize,l=g.scalar(0);return this.scatter(t,e,n,u,a,o,i,s,l,!0)},t.prototype.fill=function(t,e,n){n=n||E.inferDtype(e);var r=E.getArrayFromDType(n,E.sizeFromShape(t));return r.fill(e),_.Tensor.make(t,{values:r},n)},t.prototype.onesLike=function(t){if(&quot;string&quot;===t.dtype)throw new Error(&quot;onesLike is not supported for string tensors&quot;);return this.fill(t.shape,1,t.dtype)},t.prototype.zerosLike=function(t){var e=E.getArrayFromDType(t.dtype,E.sizeFromShape(t.shape));return _.Tensor.make(t.shape,{values:e},t.dtype)},t.prototype.scatter=function(t,e,n,r,i,o,a,s,u,l){var c=[r/i,i],f=t.dataSync(),p=e.dataSync();if(0===r)return g.tensor([],n,e.dtype);var h=new _.TensorBuffer(c,e.dtype);h.values.fill(u.dataSync()[0]);for(var d=0;d&lt;o;d++){for(var m=[],v=0,y=0;y&lt;a;y++){var b=f[d*a+y];m.push(b),v+=b*s[y]}if(v&lt;0||v&gt;=r/i)throw new Error(&quot;Invalid indices: &quot;+m+&quot; does not index into &quot;+n);for(var w=0;w&lt;i;w++)l?h.values[v*i+w]+=p[d*i+w]:h.values[v*i+w]=0===e.rank?p[0]:p[d*i+w]}return h.toTensor().reshape(n)},t}();n.MathBackendCPU=O,a.ENGINE.registerBackend(&quot;cpu&quot;,function(){return new O},1)},{&quot;../../engine&quot;:133,&quot;../../environment&quot;:134,&quot;../../log&quot;:151,&quot;../../ops/array_ops_util&quot;:154,&quot;../../ops/axis_util&quot;:155,&quot;../../ops/broadcast_util&quot;:158,&quot;../../ops/concat_util&quot;:163,&quot;../../ops/erf_util&quot;:167,&quot;../../ops/gather_nd_util&quot;:170,&quot;../../ops/ops&quot;:181,&quot;../../ops/scatter_nd_util&quot;:189,&quot;../../ops/selu_util&quot;:192,&quot;../../ops/slice_util&quot;:194,&quot;../../tensor&quot;:216,&quot;../../types&quot;:222,&quot;../../util&quot;:223,&quot;../backend&quot;:49,&quot;../backend_util&quot;:50,&quot;../complex_util&quot;:51,&quot;../non_max_suppression_impl&quot;:53,&quot;../split_shared&quot;:55,&quot;../topk_impl&quot;:56,&quot;../where_impl&quot;:130,seedrandom:340}],53:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../ops/tensor_ops&quot;);function i(t,e,n){var r=t.subarray(4*e,4*e+4),i=t.subarray(4*n,4*n+4),o=Math.min(r[0],r[2]),a=Math.min(r[1],r[3]),s=Math.max(r[0],r[2]),u=Math.max(r[1],r[3]),l=Math.min(i[0],i[2]),c=Math.min(i[1],i[3]),f=Math.max(i[0],i[2]),p=Math.max(i[1],i[3]),h=(s-o)*(u-a),d=(f-l)*(p-c);if(h&lt;=0||d&lt;=0)return 0;var m=Math.max(o,l),g=Math.max(a,c),v=Math.min(s,f),y=Math.min(u,p),b=Math.max(v-m,0)*Math.max(y-g,0);return b/(h+d-b)}n.nonMaxSuppressionImpl=function(t,e,n,o,a){for(var s=Array.from(e).map(function(t,e){return{score:t,boxIndex:e}}).filter(function(t){return t.score&gt;a}).sort(function(t,e){return e.score-t.score}),u=[],l=0;l&lt;s.length;l++){var c=s[l],f=c.score,p=c.boxIndex;if(f&lt;a)break;for(var h=!1,d=u.length-1;d&gt;=0;--d)if(i(t,p,u[d])&gt;=o){h=!0;break}if(!h&amp;&amp;(u.push(p),u.length&gt;=n))break}return r.tensor1d(u,&quot;int32&quot;)}},{&quot;../ops/tensor_ops&quot;:200}],54:[function(t,e,n){&quot;use strict&quot;;function r(t,e){return[&quot;x&quot;,&quot;y&quot;,&quot;z&quot;,&quot;w&quot;,&quot;u&quot;,&quot;v&quot;].slice(0,e).map(function(e){return t+&quot;.&quot;+e})}Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.getVecChannels=r,n.getChannels=function(t,e){return 1===e?[t]:r(t,e)},n.getSourceCoords=function(t,e){if(1===t)return&quot;rc&quot;;for(var n=&quot;&quot;,r=0;r&lt;t;r++)n+=e[r],r&lt;t-1&amp;&amp;(n+=&quot;,&quot;);return n}},{}],55:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.split=function(t,e,n){var r=new Array(t.rank).fill(0),i=t.shape.slice();return e.map(function(e){i[n]=e;var o=t.slice(r,i);return r[n]+=e,o})}},{}],56:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../ops/tensor_ops&quot;),i=t(&quot;../util&quot;);n.topkImpl=function(t,e,n,o,a){for(var s=e[e.length-1],u=[t.length/s,s],l=u[0],c=u[1],f=i.getTypedArrayFromDType(n,l*o),p=i.getTypedArrayFromDType(&quot;int32&quot;,l*o),h=0;h&lt;l;h++){for(var d=h*c,m=t.subarray(d,d+c),g=[],v=0;v&lt;m.length;v++)g.push({value:m[v],index:v});g.sort(function(t,e){return e.value-t.value});var y=h*o,b=f.subarray(y,y+o),_=p.subarray(y,y+o);for(v=0;v&lt;o;v++)b[v]=g[v].value,_[v]=g[v].index}var w=e.slice();return w[w.length-1]=o,[r.tensor(f,w,n),r.tensor(p,w,&quot;int32&quot;)]}},{&quot;../ops/tensor_ops&quot;:200,&quot;../util&quot;:223}],57:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e){this.outputShape=[],this.outputShape=t,this.variableNames=e.map(function(t,e){return&quot;T&quot;+e});var n=[];this.variableNames.forEach(function(t){n.push(&quot;float v&quot;+t+&quot; = get&quot;+t+&quot;AtOutCoords();&quot;)});var r=this.variableNames.map(function(t){return&quot;v&quot;+t}).join(&quot; + &quot;);this.userCode=&quot;\n      void main() {\n        &quot;+n.join(&quot;\n        &quot;)+&quot;\n\n        float result = &quot;+r+&quot;;\n        setOutput(result);\n      }\n    &quot;}}();n.AddNProgram=r},{}],58:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e){this.outputShape=[],this.usesPackedTextures=!0,this.outputShape=t,this.variableNames=e.map(function(t,e){return&quot;T&quot;+e});var n=[];this.variableNames.forEach(function(t){n.push(&quot;vec4 v&quot;+t+&quot; = get&quot;+t+&quot;AtOutCoords();&quot;)});var r=this.variableNames.map(function(t){return&quot;v&quot;+t}).join(&quot; + &quot;);this.userCode=&quot;\n      void main() {\n        &quot;+n.join(&quot;\n        &quot;)+&quot;\n\n        vec4 result = &quot;+r+&quot;;\n        setOutput(result);\n      }\n    &quot;}}();n.AddNPackedProgram=r},{}],59:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n){this.variableNames=[&quot;A&quot;];var r=t.windowSize,i=t.batchSize,o=t.inSize,a=Math.ceil(o/r);n||this.variableNames.push(&quot;bestIndicesA&quot;),this.outputShape=[i,a];var s=&quot;max&quot;===e?&quot;&gt;&quot;:&quot;&lt;&quot;,u=n?&quot;inOffset + i;&quot;:&quot;round(getBestIndicesA(batch, inOffset + i));&quot;;this.userCode=&quot;\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n        int outIdx = coords[1];\n        int inOffset = outIdx * &quot;+r+&quot;;\n\n        int bestIndex = inOffset;\n        float bestValue = getA(batch, bestIndex);\n\n        for (int i = 0; i &lt; &quot;+r+&quot;; i++) {\n          int inIdx = &quot;+u+&quot;;\n          float candidate = getA(batch, inIdx);\n          if (candidate &quot;+s+&quot; bestValue) {\n            bestValue = candidate;\n            bestIndex = inIdx;\n          }\n        }\n        setOutput(float(bestIndex));\n      }\n    &quot;}}();n.ArgMinMaxProgram=r},{}],60:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../util&quot;),i=t(&quot;../packing_util&quot;),o=t(&quot;./shader_compiler&quot;),a=function(){return function(t,e,n,a){this.variableNames=[&quot;A&quot;],this.usesPackedTextures=!0,r.assert(t.length&gt;2,function(){return&quot;Packed arg&quot;+(n.charAt(0).toUpperCase()+n.slice(1))+&quot; supports only inputs with rank above 2.&quot;});var s=t[t.length-1],u=Math.ceil(s/e);this.outputShape=t.slice(0,-1),u&gt;1&amp;&amp;this.outputShape.push(u),a||this.variableNames.push(&quot;bestIndicesA&quot;);var l,c,f=this.outputShape,p=f.length,h=o.getCoordsDataType(p),d=i.getChannels(&quot;coords&quot;,p);if(1===u){c=p+1;var m=o.getCoordsDataType(c);l=&quot;\n        &quot;+m+&quot; sourceLocR = &quot;+m+&quot;(&quot;+d.join()+&quot;, 0);\n        ++&quot;+d[p-1]+&quot;;\n        &quot;+m+&quot; sourceLocG = &quot;+m+&quot;(&quot;+d.join()+&quot;, 0);\n        ++&quot;+d[p-2]+&quot;;\n        &quot;+m+&quot; sourceLocA = &quot;+m+&quot;(&quot;+d.join()+&quot;, 0);\n        --&quot;+d[p-1]+&quot;;\n        &quot;+m+&quot; sourceLocB = &quot;+m+&quot;(&quot;+d.join()+&quot;, 0);\n        --&quot;+d[p-2]+&quot;;&quot;}else c=p,l=&quot;\n        &quot;+h+&quot; sourceLocR = coords;\n        ++&quot;+d[p-1]+&quot;;\n        &quot;+h+&quot; sourceLocG = coords;\n        ++&quot;+d[p-2]+&quot;;\n        &quot;+h+&quot; sourceLocA = coords;\n        --&quot;+d[p-1]+&quot;;\n        &quot;+h+&quot; sourceLocB = coords;\n        --&quot;+d[p-2]+&quot;;&quot;;var g=[&quot;x&quot;,&quot;y&quot;,&quot;z&quot;,&quot;w&quot;,&quot;u&quot;,&quot;v&quot;].slice(0,c),v=&quot;.&quot;+g[c-1],y=g.map(function(t){return&quot;int &quot;+t}),b=i.getChannels(&quot;sourceLocR&quot;,c-1).concat(&quot;inIdx.r&quot;),_=i.getChannels(&quot;sourceLocG&quot;,c-1).concat(&quot;inIdx.g&quot;),w=i.getChannels(&quot;sourceLocB&quot;,c-1).concat(&quot;inIdx.b&quot;),x=i.getChannels(&quot;sourceLocA&quot;,c-1).concat(&quot;inIdx.a&quot;),E=&quot;max&quot;===n?&quot;greaterThan&quot;:&quot;lessThan&quot;,k=a?&quot;&quot;:&quot;\n          inIdx = round(vec4(getBestIndicesAChannel(&quot;+b.join()+&quot;),\n                             getBestIndicesAChannel(&quot;+_.join()+&quot;),\n                             getBestIndicesAChannel(&quot;+w.join()+&quot;),\n                             getBestIndicesAChannel(&quot;+x.join()+&quot;)));&quot;,T=&quot;vec4(\n            getAChannel(&quot;+b.join()+&quot;),\n            hasNextCol ? getAChannel(&quot;+_.join()+&quot;) : 0.,\n            hasNextRow ? getAChannel(&quot;+w.join()+&quot;) : 0.,\n            hasNextRow &amp;&amp; hasNextCol ? getAChannel(&quot;+x.join()+&quot;) : 0.)&quot;,N=a?&quot;&quot;:&quot;\n      float getBestIndicesAChannel(&quot;+y.join()+&quot;) {\n        return getChannel(getBestIndicesA(&quot;+g.join()+&quot;),\n                                          vec2(&quot;+g.slice(-2).join()+&quot;));\n      }&quot;;this.userCode=&quot;\n      float getAChannel(&quot;+y.join()+&quot;) {\n        return getChannel(getA(&quot;+g.join()+&quot;),\n                               vec2(&quot;+g.slice(-2).join()+&quot;));\n      }\n      &quot;+N+&quot;\n      void main() {\n        &quot;+h+&quot; coords = getOutputCoords();\n        bool hasNextCol = &quot;+d[p-1]+&quot; &lt; &quot;+(f[p-1]-1)+&quot;;\n        bool hasNextRow = &quot;+d[p-2]+&quot; &lt; &quot;+(f[p-2]-1)+&quot;;\n        &quot;+l+&quot;\n        ivec4 srcIdx = ivec4(sourceLocR&quot;+v+&quot;, sourceLocG&quot;+v+&quot;,\n          sourceLocB&quot;+v+&quot;, sourceLocA&quot;+v+&quot;) * &quot;+e+&quot;;\n        ivec4 inIdx = srcIdx;\n        vec4 bestIndex = vec4(inIdx);\n        vec4 bestValue = &quot;+T+&quot;;\n\n        for (int i = 0; i &lt; &quot;+e+&quot;; i++) {\n          inIdx = srcIdx;\n          &quot;+k+&quot;\n          vec4 candidate = &quot;+T+&quot;;\n          bvec4 nan = isnan(candidate);\n          bvec4 replace = bvec4(\n            vec4(&quot;+E+&quot;(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));\n\n          bestValue = vec4(replace.x  ? candidate.x : bestValue.x,\n                           replace.y  ? candidate.y : bestValue.y,\n                           replace.z  ? candidate.z : bestValue.z,\n                           replace.w  ? candidate.w : bestValue.w);\n          bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));\n          srcIdx++;\n        }\n        setOutput(bestIndex);\n      }\n    &quot;}}();n.ArgMinMaxPackedProgram=a},{&quot;../../util&quot;:223,&quot;../packing_util&quot;:54,&quot;./shader_compiler&quot;:116}],61:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t){this.variableNames=[&quot;dy&quot;],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=t.dilationHeight,a=t.dilationWidth,s=t.effectiveFilterHeight,u=t.effectiveFilterWidth,l=s-1-t.padInfo.top,c=u-1-t.padInfo.left,f=1/(e*n);this.userCode=&quot;\n      const ivec2 pads = ivec2(&quot;+l+&quot;, &quot;+c+&quot;);\n      const float avgMultiplier = float(&quot;+f+&quot;);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n\n        ivec2 dyRCCorner = coords.yz - pads;\n        int dyRCorner = dyRCCorner.x;\n        int dyCCorner = dyRCCorner.y;\n\n        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR &lt; &quot;+s+&quot;;\n            wR += &quot;+o+&quot;) {\n          float dyR = float(dyRCorner + wR) / &quot;+r+&quot;.0;\n\n          if (dyR &lt; 0.0 || dyR &gt;= &quot;+t.outHeight+&quot;.0 || fract(dyR) &gt; 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          for (int wC = 0; wC &lt; &quot;+u+&quot;;\n            wC+= &quot;+a+&quot;) {\n            float dyC = float(dyCCorner + wC) / &quot;+i+&quot;.0;\n\n            if (dyC &lt; 0.0 || dyC &gt;= &quot;+t.outWidth+&quot;.0 ||\n                fract(dyC) &gt; 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            float dyValue = getDy(b, idyR, idyC, d);\n\n            dotProd += dyValue * avgMultiplier;\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.AvgPool2DBackpropProgram=r},{}],62:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),t(&quot;./flags_webgl&quot;);var o=t(&quot;../../device_util&quot;),a=t(&quot;../../engine&quot;),s=t(&quot;../../environment&quot;),u=t(&quot;../../globals&quot;),l=t(&quot;../../log&quot;),c=t(&quot;../../ops/array_ops_util&quot;),f=t(&quot;../../ops/axis_util&quot;),p=t(&quot;../../ops/concat_util&quot;),h=t(&quot;../../ops/gather_nd_util&quot;),d=t(&quot;../../ops/reduce_util&quot;),m=t(&quot;../../ops/scatter_nd_util&quot;),g=t(&quot;../../ops/segment_util&quot;),v=t(&quot;../../ops/slice_util&quot;),y=t(&quot;../../ops/softmax&quot;),b=t(&quot;../../ops/tensor_ops&quot;),_=t(&quot;../../tensor&quot;),w=t(&quot;../../types&quot;),x=t(&quot;../../util&quot;),E=t(&quot;../../util&quot;),k=t(&quot;../backend&quot;),T=t(&quot;../backend_util&quot;),N=t(&quot;../complex_util&quot;),S=t(&quot;../non_max_suppression_impl&quot;),C=t(&quot;../split_shared&quot;),A=t(&quot;../topk_impl&quot;),I=t(&quot;../where_impl&quot;),O=t(&quot;./argminmax_gpu&quot;),M=t(&quot;./argminmax_packed_gpu&quot;),R=t(&quot;./avg_pool_backprop_gpu&quot;),P=t(&quot;./batchnorm_gpu&quot;),D=t(&quot;./batchnorm_packed_gpu&quot;),z=t(&quot;./binaryop_complex_gpu&quot;),L=t(&quot;./binaryop_complex_gpu&quot;),F=t(&quot;./binaryop_gpu&quot;),V=t(&quot;./binaryop_gpu&quot;),B=t(&quot;./binaryop_packed_gpu&quot;),j=t(&quot;./binaryop_packed_gpu&quot;),q=t(&quot;./canvas_util&quot;),U=t(&quot;./clip_gpu&quot;),G=t(&quot;./clip_packed_gpu&quot;),W=t(&quot;./complex_abs_gpu&quot;),H=t(&quot;./concat_gpu&quot;),$=t(&quot;./concat_packed_gpu&quot;),K=t(&quot;./conv_backprop_gpu&quot;),Y=t(&quot;./conv_backprop_gpu_depthwise&quot;),X=t(&quot;./conv_gpu&quot;),Z=t(&quot;./conv_gpu_depthwise&quot;),Q=t(&quot;./conv_packed_gpu_depthwise&quot;),J=t(&quot;./crop_and_resize_gpu&quot;),tt=t(&quot;./cumsum_gpu&quot;),et=t(&quot;./depth_to_space_gpu&quot;),nt=t(&quot;./encode_float_gpu&quot;),rt=t(&quot;./fft_gpu&quot;),it=t(&quot;./fft_gpu&quot;),ot=t(&quot;./fill_gpu&quot;),at=t(&quot;./from_pixels_gpu&quot;),st=t(&quot;./gather_gpu&quot;),ut=t(&quot;./gather_nd_gpu&quot;),lt=t(&quot;./gpgpu_context&quot;),ct=t(&quot;./gpgpu_math&quot;),ft=t(&quot;./im2col_packed_gpu&quot;),pt=t(&quot;./lrn_gpu&quot;),ht=t(&quot;./lrn_grad_gpu&quot;),dt=t(&quot;./max_pool_backprop_gpu&quot;),mt=t(&quot;./mulmat_packed_gpu&quot;),gt=t(&quot;./multinomial_gpu&quot;),vt=t(&quot;./onehot_gpu&quot;),yt=t(&quot;./pack_gpu&quot;),bt=t(&quot;./pad_gpu&quot;),_t=t(&quot;./pad_packed_gpu&quot;),wt=t(&quot;./pool_gpu&quot;),xt=t(&quot;./reduce_gpu&quot;),Et=t(&quot;./reshape_packed_gpu&quot;),kt=t(&quot;./resize_bilinear_backprop_gpu&quot;),Tt=t(&quot;./resize_bilinear_gpu&quot;),Nt=t(&quot;./resize_bilinear_packed_gpu&quot;),St=t(&quot;./resize_nearest_neighbor_backprop_gpu&quot;),Ct=t(&quot;./resize_nearest_neighbor_gpu&quot;),At=t(&quot;./reverse_gpu&quot;),It=t(&quot;./reverse_packed_gpu&quot;),Ot=t(&quot;./scatter_gpu&quot;),Mt=t(&quot;./segment_gpu&quot;),Rt=t(&quot;./select_gpu&quot;),Pt=t(&quot;./slice_gpu&quot;),Dt=t(&quot;./slice_packed_gpu&quot;),zt=t(&quot;./strided_slice_gpu&quot;),Lt=t(&quot;./tex_util&quot;),Ft=t(&quot;./tex_util&quot;),Vt=t(&quot;./texture_manager&quot;),Bt=t(&quot;./tile_gpu&quot;),jt=t(&quot;./transpose_gpu&quot;),qt=t(&quot;./transpose_packed_gpu&quot;),Ut=t(&quot;./unaryop_gpu&quot;),Gt=t(&quot;./unaryop_gpu&quot;),Wt=t(&quot;./unaryop_packed_gpu&quot;),Ht=t(&quot;./unaryop_packed_gpu&quot;),$t=t(&quot;./unpack_gpu&quot;),Kt=t(&quot;./addn_gpu&quot;),Yt=t(&quot;./webgl_util&quot;),Xt=t(&quot;./addn_packed_gpu&quot;),Zt={};var Qt=600;n.MATMUL_SHARED_DIM_THRESHOLD=1e3;var Jt=function(){function t(t){if(this.gpgpu=t,this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.warnedAboutMemory=!1,this.disposed=!1,!s.ENV.getBool(&quot;HAS_WEBGL&quot;))throw new Error(&quot;WebGL is not supported on this device&quot;);if(null==t){var e=q.getWebGLContext(s.ENV.getNumber(&quot;WEBGL_VERSION&quot;));this.binaryCache=(n=s.ENV.getNumber(&quot;WEBGL_VERSION&quot;))in Zt?Zt[n]:(Zt[n]={},Zt[n]),this.gpgpu=new lt.GPGPUContext(e),this.canvas=e.canvas,this.gpgpuCreatedLocally=!0}else this.binaryCache={},this.gpgpuCreatedLocally=!1,this.canvas=t.gl.canvas;var n;this.textureManager=new Vt.TextureManager(this.gpgpu),this.numMBBeforeWarning=null==s.ENV.global.screen?1024:s.ENV.global.screen.height*s.ENV.global.screen.width*window.devicePixelRatio*Qt/1024/1024,this.texData=new k.DataStorage(a.ENGINE)}return t.prototype.register=function(t,e,n){if(this.texData.has(t))throw new Error(&quot;Data buffer is already registered&quot;);this.texData.set(t,{shape:e,dtype:n})},t.prototype.fromPixels=function(t,e){if(null==t)throw new Error(&quot;pixels passed to tf.browser.fromPixels() can not be null&quot;);var n=[t.height,t.width],r=[t.height,t.width,e];if(s.ENV.getBool(&quot;IS_BROWSER&quot;)){if(!(t instanceof HTMLVideoElement||t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageData))throw new Error(&quot;pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement or ImageData, but was &quot;+t.constructor.name);if(t instanceof HTMLVideoElement){if(null==this.fromPixels2DContext){if(&quot;complete&quot;!==document.readyState)throw new Error(&quot;The DOM is not ready yet. Please call tf.browser.fromPixels() once the DOM is ready. One way to do that is to add an event listener for `DOMContentLoaded` on the document object&quot;);this.fromPixels2DContext=document.createElement(&quot;canvas&quot;).getContext(&quot;2d&quot;)}this.fromPixels2DContext.canvas.width=t.width,this.fromPixels2DContext.canvas.height=t.height,this.fromPixels2DContext.drawImage(t,0,0,t.width,t.height),t=this.fromPixels2DContext.canvas}}var i=this.makeTensorHandle(n,&quot;int32&quot;);this.texData.get(i.dataId).usage=Ft.TextureUsage.PIXELS,this.gpgpu.uploadPixelDataToTexture(this.getTexture(i.dataId),t);var o=new at.FromPixelsProgram(r),a=this.compileAndRun(o,[i]);return this.disposeData(i.dataId),a},t.prototype.makeTensorHandle=function(t,e){var n={};return this.register(n,t,e),{dataId:n,shape:t,dtype:e}},t.prototype.write=function(t,e){if(null==e)throw new Error(&quot;MathBackendWebGL.write(): values can not be null&quot;);if(s.ENV.getBool(&quot;DEBUG&quot;))for(var n=0;n&lt;e.length;n++){var r=e[n];if(!Yt.canBeRepresented(r))throw Error(&quot;The value &quot;+r+&quot; cannot be represented on this device.&quot;)}var i=this.texData.get(t);if(&quot;complex64&quot;===i.dtype)throw new Error(&quot;Cannot write to a complex64 dtype. Please use tf.complex(real, imag).&quot;);this.releaseGPUData(t),i.usage=Ft.TextureUsage.UPLOAD,i.values=e},t.prototype.readSync=function(t){var e=this.texData.get(t),n=e.values,r=e.dtype,i=e.complexTensors,o=e.slice,a=e.shape;if(null!=o){var s=new Gt.UnaryOpProgram(a,Ut.CLONE),u=this.compileAndRun(s,[{dataId:t,shape:a,dtype:r}]),l=this.readSync(u.dataId);return u.dispose(),l}if(null!=n)return this.convertAndCacheOnCPU(t);if(&quot;string&quot;===r)return n;var c,f,p=null!=this.activeTimers;if(p&amp;&amp;(c=performance.now()),&quot;complex64&quot;===r){var h=i.real.dataSync(),d=i.imag.dataSync();f=N.mergeRealAndImagArrays(h,d)}else f=this.getValuesFromTexture(t);return p&amp;&amp;(this.downloadWaitMs+=performance.now()-c),this.convertAndCacheOnCPU(t,f)},t.prototype.read=function(t){return r(this,void 0,void 0,function(){var e,n,r,o,a,u,l,c,f,p,h,d,m,g,v,y,b,_,w,E,k,T,N,S;return i(this,function(i){switch(i.label){case 0:if(this.pendingRead.has(t))return r=this.pendingRead.get(t),[2,new Promise(function(t){return r.push(t)})];if(o=this.texData.get(t),a=o.texture,u=o.values,l=o.texShape,c=o.isPacked,f=o.shape,p=o.slice,h=o.dtype,null!=p)return d=new Gt.UnaryOpProgram(f,Ut.CLONE),m=this.compileAndRun(d,[{dataId:t,shape:f,dtype:h}]),g=this.read(m.dataId),m.dispose(),[2,g];if(null!=u)return[2,this.convertAndCacheOnCPU(t)];if(this.pendingRead.set(t,[]),!s.ENV.getBool(&quot;WEBGL_DOWNLOAD_FLOAT_ENABLED&quot;)&amp;&amp;2===s.ENV.getNumber(&quot;WEBGL_VERSION&quot;))throw new Error(&quot;tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.&quot;);return v=l[1],y=l[0],c&amp;&amp;(e=Lt.getPackedMatrixTextureShapeWidthHeight(l[0],l[1]),v=e[0],y=e[1]),b=this.gpgpu.maybeCreateBufferFromTexture(a,y,v),[4,this.gpgpu.createAndWaitForFence()];case 1:return i.sent(),b instanceof WebGLTexture?_=this.getValuesFromTexture(t):(w=x.sizeFromShape(f),c?(E=Yt.getBatchDim(f),k=1,T=1,f.length&amp;&amp;(n=Yt.getRowsCols(f),k=n[0],T=n[1]),_=this.gpgpu.downloadPackedMatrixFromBuffer(b,E,k,T,l[0],l[1]).subarray(0,w)):_=this.gpgpu.downloadFloat32MatrixFromBuffer(b,l[0],l[1]).subarray(0,w)),N=this.convertAndCacheOnCPU(t,_),S=this.pendingRead.get(t),this.pendingRead.delete(t),S.forEach(function(t){return t(N)}),this.pendingDisposal.has(t)&amp;&amp;(this.pendingDisposal.delete(t),this.disposeData(t)),[2,N]}})})},t.prototype.getValuesFromTexture=function(t){var e,n=this,r=this.texData.get(t),i=r.shape,o=r.dtype,a=r.texture,l=r.texShape,c=x.sizeFromShape(i);if(s.ENV.getBool(&quot;WEBGL_DOWNLOAD_FLOAT_ENABLED&quot;)){if(this.texData.get(t).isPacked){var f=Yt.getBatchDim(i),p=1,h=1;return i.length&amp;&amp;(p=(e=Yt.getRowsCols(i))[0],h=e[1]),this.gpgpu.downloadMatrixFromPackedTexture(a,f,p,h,l[0],l[1]).subarray(0,c)}return this.gpgpu.downloadFloat32MatrixFromOutputTexture(a,l[0],l[1]).subarray(0,c)}var d=this.makeTensorHandle(i,&quot;float32&quot;);d.size=E.sizeFromShape(i),this.texData.get(d.dataId).usage=Ft.TextureUsage.DOWNLOAD;var m=u.tidy(function(){var e=new nt.EncodeFloatProgram(i);return n.compileAndRun(e,[{shape:i,dtype:o,dataId:t}],d,null)}),g=this.texData.get(m.dataId),v=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(g.texture,g.texShape[0],g.texShape[1]).subarray(0,c);return this.disposeData(d.dataId),v},t.prototype.time=function(t){return r(this,void 0,void 0,function(){var e,n,r,o,a,s,u;return i(this,function(i){switch(i.label){case 0:return e=this.activeTimers,n=[],r=!1,null==this.programTimersStack?(this.programTimersStack=n,r=!0):this.activeTimers.push(n),this.activeTimers=n,t(),o=x.flatten(this.activeTimers.map(function(t){return t.query})).filter(function(t){return null!=t}),a=x.flatten(this.activeTimers.map(function(t){return t.name})).filter(function(t){return null!=t}),this.activeTimers=e,r&amp;&amp;(this.programTimersStack=null),[4,Promise.all(o)];case 1:return s=i.sent(),u={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:x.sum(s),getExtraProfileInfo:function(){return s.map(function(t,e){return{name:a[e],ms:t}}).map(function(t){return t.name+&quot;: &quot;+t.ms}).join(&quot;, &quot;)},wallMs:null},this.uploadWaitMs=0,this.downloadWaitMs=0,[2,u]}})})},t.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},t.prototype.startTimer=function(){return s.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;)&gt;0?this.gpgpu.beginQuery():{startMs:performance.now(),endMs:null}},t.prototype.endTimer=function(t){return s.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;)&gt;0?(this.gpgpu.endQuery(),t):(t.endMs=performance.now(),t)},t.prototype.getQueryTime=function(t){return r(this,void 0,void 0,function(){var e;return i(this,function(n){return s.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;)&gt;0?[2,this.gpgpu.waitForQueryAndGetTime(t)]:[2,(e=t).endMs-e.startMs]})})},t.prototype.disposeData=function(t){if(!this.pendingDisposal.has(t))if(this.pendingRead.has(t))this.pendingDisposal.add(t);else if(this.texData.has(t)){this.releaseGPUData(t);var e=this.texData.get(t).complexTensors;null!=e&amp;&amp;(e.real.dispose(),e.imag.dispose()),this.texData.delete(t)}},t.prototype.releaseGPUData=function(t){var e=this.texData.get(t),n=e.texture,r=e.dtype,i=e.texShape,o=e.usage,a=e.isPacked,s=e.slice,u=s&amp;&amp;s.origDataId||t,l=this.dataRefCount.get(u);l&gt;1?this.dataRefCount.set(u,l-1):(this.dataRefCount.delete(u),null!=n&amp;&amp;(this.numBytesInGPU-=this.computeBytes(i,r),this.textureManager.releaseTexture(n,i,o,a)));var c=this.texData.get(t);c.texture=null,c.texShape=null,c.isPacked=!1,c.slice=null},t.prototype.getTexture=function(t){return this.uploadToGPU(t),this.texData.get(t).texture},t.prototype.getCPUBackend=function(){return s.ENV.getBool(&quot;WEBGL_CPU_FORWARD&quot;)?(null==this.cpuBackend&amp;&amp;(this.cpuBackend=a.ENGINE.findBackend(&quot;cpu&quot;)),this.cpuBackend):null},t.prototype.shouldExecuteOnCPU=function(t,e){var n=this;return void 0===e&amp;&amp;(e=128),null!=this.getCPUBackend()&amp;&amp;t.every(function(t){return null==n.texData.get(t.dataId).texture&amp;&amp;t.size&lt;e})},t.prototype.getGPGPUContext=function(){return this.gpgpu},t.prototype.getCanvas=function(){return this.canvas},t.prototype.complex=function(t,e){var n=this.makeOutputArray(t.shape,&quot;complex64&quot;);return this.texData.get(n.dataId).complexTensors={real:a.ENGINE.keep(t.clone()),imag:a.ENGINE.keep(e.clone())},n},t.prototype.real=function(t){return this.texData.get(t.dataId).complexTensors.real.clone()},t.prototype.imag=function(t){return this.texData.get(t.dataId).complexTensors.imag.clone()},t.prototype.slice=function(t,e,n){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.slice(t,e,n);var r=this.texData.get(t.dataId).isPacked,i=v.isSliceContinous(t.shape,e,n);if(r||!i){var o=s.ENV.getBool(&quot;WEBGL_PACK_ARRAY_OPERATIONS&quot;)?new Dt.SlicePackedProgram(n):new Pt.SliceProgram(n),a=o.getCustomSetupFunc(e);return this.compileAndRun(o,[t],null,a)}return this.uploadToGPU(t.dataId),this.shallowSlice(t,e,n)},t.prototype.shallowSlice=function(t,e,n){var r=this.texData.get(t.dataId),i=_.Tensor.make(n,{},t.dtype,this),o=this.texData.get(i.dataId);Object.assign(o,r),o.shape=n,o.dtype=t.dtype;var a=v.computeFlatOffset(e,t.strides);r.slice&amp;&amp;(a+=r.slice.flatOffset),o.slice={flatOffset:a,origDataId:r.slice&amp;&amp;r.slice.origDataId||t.dataId};var s=this.dataRefCount.get(o.slice.origDataId)||1;return this.dataRefCount.set(o.slice.origDataId,s+1),i},t.prototype.stridedSlice=function(t,e,n,r,i,o,a,s,u){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.stridedSlice(t,e,n,r,i,o,a,s,u);var l=v.getStridedSlicedInfo(t.shape,e,n,r,i,o,a,s,u),c=l[0],f=l[1],p=l[2],h=f.filter(function(t,e){return-1===p.indexOf(e)});if(h.some(function(t){return 0===t}))return b.tensor([],h);var d=new zt.StridedSliceProgram(c,r,f,p);return this.compileAndRun(d,[t])},t.prototype.reverse=function(t,e){var n=s.ENV.getBool(&quot;WEBGL_PACK_ARRAY_OPERATIONS&quot;)?new It.ReversePackedProgram(t.shape,e):new At.ReverseProgram(t.shape,e);return this.compileAndRun(n,[t])},t.prototype.concat=function(t,e){if(this.shouldExecuteOnCPU(t))return this.cpuBackend.concat(t,e);if(1===t.length)return t[0];if(t.length&gt;s.ENV.getNumber(&quot;WEBGL_MAX_TEXTURES_IN_SHADER&quot;)){var n=Math.floor(t.length/2),r=this.concat(t.slice(0,n),e),i=this.concat(t.slice(n),e);return this.concat([r,i],e)}if(s.ENV.getBool(&quot;WEBGL_PACK_ARRAY_OPERATIONS&quot;)&amp;&amp;t[0].rank&gt;1){var o=new $.ConcatPackedProgram(t.map(function(t){return t.shape}),e);return this.compileAndRun(o,t)}var a=p.computeOutShape(t.map(function(t){return t.shape}),e),u=t.map(function(t){return t.as2D(-1,E.sizeFromShape(t.shape.slice(e)))}),l=new H.ConcatProgram(u.map(function(t){return t.shape}));return this.compileAndRun(l,u).reshape(a)},t.prototype.neg=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.NEG);return this.compileAndRun(e,[t])},t.prototype.batchMatMul=function(t,e,r,i){var o=r?t.shape[2]:t.shape[1],a=i?e.shape[1]:e.shape[2],s=r?t.shape[1]:t.shape[2],u=t.shape[0];if((1===o||1===a)&amp;&amp;s&gt;n.MATMUL_SHARED_DIM_THRESHOLD){r&amp;&amp;(t=t.transpose([0,2,1])),i&amp;&amp;(e=e.transpose([0,2,1]));var l=1===a?t:t.as3D(u,s,1),c=1===a?2:1,f=1===a?e.as3D(u,1,s):e;return this.multiply(l,f).sum(c,!0)}var p=w.upcastType(t.dtype,e.dtype),h=new mt.MatMulPackedProgram(t.shape,[u,o,a],r,i),d=this.makePackedTensor(h.outputShape,p);return this.compileAndRun(h,[t,e],d)},t.prototype.fusedBatchMatMul=function(t,e,n,r,i,o){var a=n?t.shape[2]:t.shape[1],s=r?e.shape[1]:e.shape[2],u=t.shape[0],l=w.upcastType(t.dtype,e.dtype),c=new mt.MatMulPackedProgram(t.shape,[u,a,s],n,r,!!i,o?function(t,e){if(void 0===e&amp;&amp;(e=!1),&quot;linear&quot;===t)return e?Wt.LINEAR:Ut.LINEAR;if(&quot;relu&quot;===t)return e?Wt.RELU:Ut.RELU;throw new Error(&quot;Activation &quot;+t+&quot; has not been implemented for the WebGL backend.&quot;)}(o,!0):null),f=this.makePackedTensor(c.outputShape,l),p=[t,e];return i&amp;&amp;p.push(i),this.compileAndRun(c,p,f)},t.prototype.multiply=function(t,e){if(&quot;complex64&quot;===t.dtype){var n=this.texData.get(t.dataId),r=this.texData.get(e.dataId),i=new L.BinaryOpComplexProgram(z.COMPLEX_MULTIPLY.REAL,t.shape,e.shape),o=new L.BinaryOpComplexProgram(z.COMPLEX_MULTIPLY.IMAG,t.shape,e.shape),a=[this.makeComplexComponentTensorHandle(t,n.complexTensors.real),this.makeComplexComponentTensorHandle(t,n.complexTensors.imag),this.makeComplexComponentTensorHandle(e,r.complexTensors.real),this.makeComplexComponentTensorHandle(e,r.complexTensors.imag)],u=this.compileAndRun(i,a),l=this.compileAndRun(o,a),c=this.complex(u,l);return u.dispose(),l.dispose(),c}if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.multiply(t,e);if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,F.MUL,t.dtype);var f=new V.BinaryOpProgram(F.MUL,t.shape,e.shape),p=this.makeOutputArray(f.outputShape,t.dtype);return this.compileAndRun(f,[t,e],p)},t.prototype.batchNormalization=function(t,e,n,r,i,o){var a=[t,e,n],u=null;null!=o&amp;&amp;(u=o.shape,a.push(o));var l=null;if(null!=i&amp;&amp;(l=i.shape,a.push(i)),s.ENV.getBool(&quot;WEBGL_PACK_BATCHNORMALIZATION&quot;)){var c=new D.BatchNormPackedProgram(t.shape,e.shape,n.shape,u,l,r);return this.compileAndRun(c,a)}var f=new P.BatchNormProgram(t.shape,e.shape,n.shape,u,l,r);return this.compileAndRun(f,a)},t.prototype.localResponseNormalization4D=function(t,e,n,r,i){var o=new pt.LRNProgram(t.shape,e,n,r,i);return this.compileAndRun(o,[t])},t.prototype.LRNGrad=function(t,e,n,r,i,o,a){var s=new ht.LRNGradProgram(e.shape,r,i,o,a);return this.compileAndRun(s,[e,n,t])},t.prototype.tile=function(t,e){var n=new Bt.TileProgram(t.shape,e);return this.compileAndRun(n,[t])},t.prototype.pad=function(t,e,n){var r=s.ENV.getBool(&quot;WEBGL_PACK_ARRAY_OPERATIONS&quot;)?new _t.PadPackedProgram(t.shape,e,n):new bt.PadProgram(t.shape,e,n);return this.compileAndRun(r,[t])},t.prototype.transpose=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.transpose(t,e);var n=s.ENV.getBool(&quot;WEBGL_PACK_ARRAY_OPERATIONS&quot;)?new qt.TransposePackedProgram(t.shape,e):new jt.TransposeProgram(t.shape,e);return this.compileAndRun(n,[t])},t.prototype.gather=function(t,e,n){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.gather(t,e,n);var r=new st.GatherProgram(t.shape,e.size,n);return this.compileAndRun(r,[t,e])},t.prototype.batchToSpaceND=function(t,e,n){x.assert(t.rank&lt;=4,function(){return&quot;batchToSpaceND for rank &gt; 4 with a WebGL backend not implemented yet&quot;});var r=e.reduce(function(t,e){return t*e}),i=c.getReshaped(t.shape,e,r),o=c.getPermuted(i.length,e.length),a=c.getReshapedPermuted(t.shape,e,r),s=c.getSliceBeginCoords(n,e.length),u=c.getSliceSize(a,n,e.length);return t.reshape(i).transpose(o).reshape(a).slice(s,u)},t.prototype.spaceToBatchND=function(t,e,n){x.assert(t.rank&lt;=4,function(){return&quot;spaceToBatchND for rank &gt; 4 with a WebGL backend not implemented yet&quot;});var r=e.reduce(function(t,e){return t*e}),i=[[0,0]];i.push.apply(i,n);for(var o=1+e.length;o&lt;t.shape.length;++o)i.push([0,0]);var a=t.pad(i),s=c.getReshaped(a.shape,e,r,!1),u=c.getPermuted(s.length,e.length,!1),l=c.getReshapedPermuted(a.shape,e,r,!1);return a.reshape(s).transpose(u).reshape(l)},t.prototype.reduce=function(t,e,n){var r=t.shape[0],i=t.shape[1],o={windowSize:d.computeOptimalWindowSize(i),inSize:i,batchSize:r},a=new xt.ReduceProgram(o,e),s=a.outputShape,u=s[0],l=s[1],c=this.makeOutputArray([u,l],n);return this.compileAndRun(a,[t],c),1===c.shape[1]?c:this.reduce(c,e,n)},t.prototype.argReduce=function(t,e,n){void 0===n&amp;&amp;(n=null);var r=t.shape[0],i=t.shape[1];null!=n&amp;&amp;(r=n.shape[0],i=n.shape[1]);var o={windowSize:d.computeOptimalWindowSize(i),inSize:i,batchSize:r},a=new O.ArgMinMaxProgram(o,e,null==n),s=a.outputShape,u=s[0],l=s[1],c=this.makeOutputArray([u,l],&quot;int32&quot;),f=[t];return null!=n&amp;&amp;f.push(n),this.compileAndRun(a,f,c),1===c.shape[1]?c:this.argReduce(t,e,c)},t.prototype.argReducePacked=function(t,e,n){void 0===n&amp;&amp;(n=null);var r=null!=n?n.shape:t.shape,i=r[r.length-1],o=d.computeOptimalWindowSize(i),a=new M.ArgMinMaxPackedProgram(r,o,e,null==n),s=this.makePackedTensor(a.outputShape,&quot;int32&quot;),u=null==n?[t]:[t,n];return this.compileAndRun(a,u,s),s.rank===t.rank?this.argReducePacked(t,e,s):s},t.prototype.sum=function(t,e){f.assertAxesAreInnerMostDims(&quot;sum&quot;,e,t.rank);var n=f.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=x.sizeFromShape(i),a=t.as2D(-1,o),s=w.sumOutType(t.dtype);return this.reduce(a,&quot;sum&quot;,s).reshape(r)},t.prototype.prod=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.prod(t,e);var n=f.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=x.sizeFromShape(i),a=t.as2D(-1,o),s=w.sumOutType(t.dtype);return this.reduce(a,&quot;prod&quot;,s).reshape(r)},t.prototype.unsortedSegmentSum=function(t,e,n){var r=0,i=f.getAxesPermutation([r],t.rank),o=t;null!=i&amp;&amp;(o=t.transpose(i),r=f.getInnerMostAxes(1,t.rank)[0]);var a=g.computeOutShape(o.shape,r,n),s=x.sizeFromShape([o.shape[r]]),u=o.as2D(-1,s),l=w.sumOutType(t.dtype),c=this.segOpCompute(u,&quot;unsortedSegmentSum&quot;,e,l,n).reshape(a);return null!=i&amp;&amp;(c=c.transpose(f.getUndoAxesPermutation(i))),c},t.prototype.segOpCompute=function(t,e,n,r,i){var o=t.shape[0],a=t.shape[1],s=g.segOpComputeOptimalWindowSize(a,i),u={windowSize:s,inSize:a,batchSize:o,numSegments:i},l=new Mt.SegmentOpProgram(u,e),c=l.outputShape,f=c[0],p=c[1],h=this.makeOutputArray([f,p],r);return this.compileAndRun(l,[t,n],h),h.shape[1]===i?h:(n=b.range(0,i).tile([a/s]),this.segOpCompute(h,e,n,r,i))},t.prototype.argMinMaxReduce=function(t,e,n){var r=[e];if(f.assertAxesAreInnerMostDims(&quot;arg&quot;+n.charAt(0).toUpperCase()+n.slice(1),r,t.rank),!s.ENV.getBool(&quot;WEBGL_PACK_REDUCE&quot;)||t.rank&lt;=2){var i=f.computeOutAndReduceShapes(t.shape,r),o=i[0],a=i[1],u=x.sizeFromShape(a),l=t.as2D(-1,u);return this.argReduce(l,n).reshape(o)}return this.argReducePacked(t,n)},t.prototype.argMin=function(t,e){return this.argMinMaxReduce(t,e,&quot;min&quot;)},t.prototype.argMax=function(t,e){return this.argMinMaxReduce(t,e,&quot;max&quot;)},t.prototype.cumsum=function(t,e,n,r){if(e!==t.rank-1)throw new Error(&quot;WebGL cumsum shader expects an inner-most axis=&quot;+(t.rank-1)+&quot; but got axis=&quot;+e);var i=new tt.CumSumProgram(t.shape,n,r);return this.compileAndRun(i,[t])},t.prototype.equal=function(t,e){if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,B.EQUAL,&quot;bool&quot;);var n=new V.BinaryOpProgram(F.EQUAL,t.shape,e.shape),r=this.makeOutputArray(n.outputShape,&quot;bool&quot;);return this.compileAndRun(n,[t,e],r)},t.prototype.notEqual=function(t,e){if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,B.NOT_EQUAL,&quot;bool&quot;);var n=new V.BinaryOpProgram(F.NOT_EQUAL,t.shape,e.shape),r=this.makeOutputArray(n.outputShape,&quot;bool&quot;);return this.compileAndRun(n,[t,e],r)},t.prototype.less=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.less(t,e);if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,B.LESS,&quot;bool&quot;);var n=new V.BinaryOpProgram(F.LESS,t.shape,e.shape),r=this.makeOutputArray(n.outputShape,&quot;bool&quot;);return this.compileAndRun(n,[t,e],r)},t.prototype.lessEqual=function(t,e){if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,B.LESS_EQUAL,&quot;bool&quot;);var n=new V.BinaryOpProgram(F.LESS_EQUAL,t.shape,e.shape),r=this.makeOutputArray(n.outputShape,&quot;bool&quot;);return this.compileAndRun(n,[t,e],r)},t.prototype.greater=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.greater(t,e);if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,B.GREATER,&quot;bool&quot;);var n=new V.BinaryOpProgram(F.GREATER,t.shape,e.shape),r=this.makeOutputArray(n.outputShape,&quot;bool&quot;);return this.compileAndRun(n,[t,e],r)},t.prototype.greaterEqual=function(t,e){if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,B.GREATER_EQUAL,&quot;bool&quot;);var n=new V.BinaryOpProgram(F.GREATER_EQUAL,t.shape,e.shape),r=this.makeOutputArray(n.outputShape,&quot;bool&quot;);return this.compileAndRun(n,[t,e],r)},t.prototype.logicalNot=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.LOGICAL_NOT);return this.compileAndRun(e,[t])},t.prototype.logicalAnd=function(t,e){if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,B.LOGICAL_AND,&quot;bool&quot;);var n=new V.BinaryOpProgram(F.LOGICAL_AND,t.shape,e.shape),r=this.makeOutputArray(n.outputShape,&quot;bool&quot;);return this.compileAndRun(n,[t,e],r)},t.prototype.logicalOr=function(t,e){if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,B.LOGICAL_OR,&quot;bool&quot;);var n=new V.BinaryOpProgram(F.LOGICAL_OR,t.shape,e.shape),r=this.makeOutputArray(n.outputShape,&quot;bool&quot;);return this.compileAndRun(n,[t,e],r)},t.prototype.select=function(t,e,n){var r=new Rt.SelectProgram(t.rank,e.shape,e.rank),i=this.makeOutputArray(r.outputShape,w.upcastType(e.dtype,n.dtype));return this.compileAndRun(r,[t,e,n],i)},t.prototype.where=function(t){l.warn(&quot;tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead&quot;);var e=t.dataSync();return I.whereImpl(t.shape,e)},t.prototype.topk=function(t,e,n){var r=t.dataSync();return A.topkImpl(r,t.shape,t.dtype,e,n)},t.prototype.min=function(t,e){f.assertAxesAreInnerMostDims(&quot;min&quot;,e,t.rank);var n=f.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=x.sizeFromShape(i),a=t.as2D(-1,o);return this.reduce(a,&quot;min&quot;,a.dtype).reshape(r)},t.prototype.minimum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.minimum(t,e);var n=s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;)?new j.BinaryOpPackedProgram(B.MIN,t.shape,e.shape):new V.BinaryOpProgram(F.MIN,t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.mod=function(t,e){var n=s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;)?new j.BinaryOpPackedProgram(B.MOD,t.shape,e.shape):new V.BinaryOpProgram(F.MOD,t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.max=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.max(t,e);f.assertAxesAreInnerMostDims(&quot;max&quot;,e,t.rank);var n=f.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=x.sizeFromShape(i),a=t.as2D(-1,o);return this.reduce(a,&quot;max&quot;,a.dtype).reshape(r)},t.prototype.maximum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.maximum(t,e);var n=s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;)?new j.BinaryOpPackedProgram(B.MAX,t.shape,e.shape):new V.BinaryOpProgram(F.MAX,t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.all=function(t,e){f.assertAxesAreInnerMostDims(&quot;all&quot;,e,t.rank);var n=f.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=x.sizeFromShape(i),a=t.as2D(-1,o);return this.reduce(a,&quot;all&quot;,a.dtype).reshape(r)},t.prototype.any=function(t,e){f.assertAxesAreInnerMostDims(&quot;any&quot;,e,t.rank);var n=f.computeOutAndReduceShapes(t.shape,e),r=n[0],i=n[1],o=x.sizeFromShape(i),a=t.as2D(-1,o);return this.reduce(a,&quot;any&quot;,a.dtype).reshape(r)},t.prototype.squaredDifference=function(t,e){var n=s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;)?new j.BinaryOpPackedProgram(F.SQUARED_DIFFERENCE,t.shape,e.shape):new V.BinaryOpProgram(F.SQUARED_DIFFERENCE,t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.realDivide=function(t,e){var n=F.DIV;if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;)){return this.packedBinaryOp(t,e,B.DIV,&quot;float32&quot;,!0)}var r=new V.BinaryOpProgram(n,t.shape,e.shape),i=this.makeOutputArray(r.outputShape,&quot;float32&quot;);return this.compileAndRun(r,[t,e],i)},t.prototype.floorDiv=function(t,e){var n=F.INT_DIV;if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,B.INT_DIV,&quot;int32&quot;);var r=new V.BinaryOpProgram(n,t.shape,e.shape),i=this.makeOutputArray(r.outputShape,&quot;int32&quot;);return this.compileAndRun(r,[t,e],i)},t.prototype.add=function(t,e){if(&quot;complex64&quot;===t.dtype&amp;&amp;&quot;complex64&quot;===e.dtype)return this.complexSeparableBinaryOp(t,e,F.ADD);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.add(t,e);var n=w.upcastType(t.dtype,e.dtype);if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,F.ADD,n);var r=new V.BinaryOpProgram(F.ADD,t.shape,e.shape),i=this.makeOutputArray(r.outputShape,n);return this.compileAndRun(r,[t,e],i)},t.prototype.packedBinaryOp=function(t,e,n,r,i){void 0===i&amp;&amp;(i=!1);var o=new j.BinaryOpPackedProgram(n,t.shape,e.shape,i),a=this.makePackedTensor(o.outputShape,r);return this.compileAndRun(o,[t,e],a)},t.prototype.complexSeparableBinaryOp=function(t,e,n){var r=this,i=this.texData.get(t.dataId),o=this.texData.get(e.dataId),a=[[i.complexTensors.real,o.complexTensors.real],[i.complexTensors.imag,o.complexTensors.imag]].map(function(i){var o=i[0],a=i[1],s=r.makeComplexComponentTensorHandle(t,o),u=r.makeComplexComponentTensorHandle(e,a),l=new V.BinaryOpProgram(n,t.shape,e.shape),c=r.makeOutputArray(l.outputShape,w.upcastType(o.dtype,a.dtype));return r.compileAndRun(l,[s,u],c)}),s=a[0],u=a[1],l=this.complex(s,u);return s.dispose(),u.dispose(),l},t.prototype.makeComplexComponentTensorHandle=function(t,e){return{dataId:e.dataId,dtype:e.dtype,shape:t.shape}},t.prototype.addN=function(t){if(1===t.length)return t[0];if(t.length&gt;s.ENV.get(&quot;WEBGL_MAX_TEXTURES_IN_SHADER&quot;)){var e=Math.floor(t.length/2),n=this.addN(t.slice(0,e)),r=this.addN(t.slice(e));return this.addN([n,r])}var i=t.map(function(t){return t.dtype}).reduce(function(t,e){return w.upcastType(t,e)}),o=t.map(function(t){return t.shape}),a=s.ENV.getBool(&quot;WEBGL_PACK&quot;),u=a?new Xt.AddNPackedProgram(t[0].shape,o):new Kt.AddNProgram(t[0].shape,o),l=a?this.makePackedTensor(u.outputShape,i):this.makeOutputArray(u.outputShape,i);return this.compileAndRun(u,t,l)},t.prototype.subtract=function(t,e){if(&quot;complex64&quot;===t.dtype&amp;&amp;&quot;complex64&quot;===e.dtype)return this.complexSeparableBinaryOp(t,e,F.SUB);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.subtract(t,e);var n=w.upcastType(t.dtype,e.dtype);if(s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;))return this.packedBinaryOp(t,e,F.SUB,t.dtype);var r=new V.BinaryOpProgram(F.SUB,t.shape,e.shape),i=this.makeOutputArray(r.outputShape,n);return this.compileAndRun(r,[t,e],i)},t.prototype.pow=function(t,e){var n=s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;),r=n?new j.BinaryOpPackedProgram(B.POW,t.shape,e.shape):new V.BinaryOpProgram(F.POW,t.shape,e.shape),i=w.upcastType(t.dtype,e.dtype),o=n?this.makePackedTensor(r.outputShape,i):this.makeOutputArray(r.outputShape,i);return this.compileAndRun(r,[t,e],o)},t.prototype.ceil=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.CEIL);return this.compileAndRun(e,[t])},t.prototype.floor=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.FLOOR);return this.compileAndRun(e,[t])},t.prototype.sign=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.SIGN);return this.compileAndRun(e,[t])},t.prototype.isNaN=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.IS_NAN),n=this.makeOutputArray(e.outputShape,&quot;bool&quot;);return this.compileAndRun(e,[t],n)},t.prototype.isInf=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.IS_INF),n=this.makeOutputArray(e.outputShape,&quot;bool&quot;);return this.compileAndRun(e,[t],n)},t.prototype.isFinite=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.IS_FINITE),n=this.makeOutputArray(e.outputShape,&quot;bool&quot;);return this.compileAndRun(e,[t],n)},t.prototype.round=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.ROUND);return this.compileAndRun(e,[t])},t.prototype.exp=function(t){var e;return e=s.ENV.getBool(&quot;WEBGL_PACK&quot;)?new Ht.UnaryOpPackedProgram(t.shape,Ut.EXP):new Gt.UnaryOpProgram(t.shape,Ut.EXP),this.compileAndRun(e,[t])},t.prototype.expm1=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.EXPM1);return this.compileAndRun(e,[t])},t.prototype.log=function(t){var e;return e=s.ENV.getBool(&quot;WEBGL_PACK&quot;)?new Ht.UnaryOpPackedProgram(t.shape,Wt.LOG):new Gt.UnaryOpProgram(t.shape,Ut.LOG),this.compileAndRun(e,[t])},t.prototype.log1p=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.LOG1P);return this.compileAndRun(e,[t])},t.prototype.sqrt=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.SQRT);return this.compileAndRun(e,[t])},t.prototype.rsqrt=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.rsqrt(t);var e=new Gt.UnaryOpProgram(t.shape,Ut.RSQRT);return this.compileAndRun(e,[t])},t.prototype.square=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.SQUARE);return this.compileAndRun(e,[t])},t.prototype.reciprocal=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.RECIPROCAL);return this.compileAndRun(e,[t])},t.prototype.relu=function(t){var e;return e=s.ENV.getBool(&quot;WEBGL_PACK&quot;)?new Ht.UnaryOpPackedProgram(t.shape,Wt.RELU):new Gt.UnaryOpProgram(t.shape,Ut.RELU),this.compileAndRun(e,[t])},t.prototype.prelu=function(t,e){var n=s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;)?new j.BinaryOpPackedProgram(B.PRELU,t.shape,e.shape):new V.BinaryOpProgram(F.PRELU,t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.elu=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.ELU);return this.compileAndRun(e,[t])},t.prototype.eluDer=function(t,e){var n=s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;)?new j.BinaryOpPackedProgram(B.ELU_DER,t.shape,e.shape):new V.BinaryOpProgram(F.ELU_DER,t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.selu=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.SELU);return this.compileAndRun(e,[t])},t.prototype.int=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.TO_INT),n=this.makeOutputArray(e.outputShape,&quot;int32&quot;);return this.compileAndRun(e,[t],n)},t.prototype.clip=function(t,e,n){var r,i=(r=s.ENV.getBool(&quot;WEBGL_PACK_CLIP&quot;)?new G.ClipPackedProgram(t.shape):new U.ClipProgram(t.shape)).getCustomSetupFunc(e,n);return this.compileAndRun(r,[t],null,i)},t.prototype.abs=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.ABS);return this.compileAndRun(e,[t])},t.prototype.complexAbs=function(t){var e=this.texData.get(t.dataId),n=new W.ComplexAbsProgram(t.shape),r=[this.makeComplexComponentTensorHandle(t,e.complexTensors.real),this.makeComplexComponentTensorHandle(t,e.complexTensors.imag)];return this.compileAndRun(n,r)},t.prototype.sigmoid=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.SIGMOID);return this.compileAndRun(e,[t])},t.prototype.softplus=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.SOFTPLUS);return this.compileAndRun(e,[t])},t.prototype.sin=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.SIN);return this.compileAndRun(e,[t])},t.prototype.cos=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.COS);return this.compileAndRun(e,[t])},t.prototype.tan=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.TAN);return this.compileAndRun(e,[t])},t.prototype.asin=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.ASIN);return this.compileAndRun(e,[t])},t.prototype.acos=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.ACOS);return this.compileAndRun(e,[t])},t.prototype.atan=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.ATAN);return this.compileAndRun(e,[t])},t.prototype.atan2=function(t,e){var n=s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;)?new j.BinaryOpPackedProgram(B.ATAN2,t.shape,e.shape):new V.BinaryOpProgram(F.ATAN2,t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.sinh=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.SINH);return this.compileAndRun(e,[t])},t.prototype.cosh=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.COSH);return this.compileAndRun(e,[t])},t.prototype.tanh=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.TANH);return this.compileAndRun(e,[t])},t.prototype.asinh=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.ASINH);return this.compileAndRun(e,[t])},t.prototype.acosh=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.ACOSH);return this.compileAndRun(e,[t])},t.prototype.atanh=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.ATANH);return this.compileAndRun(e,[t])},t.prototype.erf=function(t){var e=new Gt.UnaryOpProgram(t.shape,Ut.ERF);return this.compileAndRun(e,[t])},t.prototype.step=function(t,e){var n=new Gt.UnaryOpProgram(t.shape,Ut.STEP(e));return this.compileAndRun(n,[t])},t.prototype.conv2dByMatMul=function(t,e,r){var i=t.shape,o=this.texData.get(t.dataId),a=r.inChannels,u=i[0]*i[1]*i[2],l=r.outChannels,c=(1===u||1===l)&amp;&amp;a&gt;n.MATMUL_SHARED_DIM_THRESHOLD,f=i[2]%2!=0&amp;&amp;!!o.isPacked;if(c||!s.ENV.getBool(&quot;WEBGL_LAZILY_UNPACK&quot;)||!s.ENV.getBool(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;)||!f){var p=this.reshape(t,[1,i[0]*i[1]*i[2],r.inChannels]),h=this.reshape(e,[1,r.inChannels,r.outChannels]);return this.reshape(this.batchMatMul(p,h,!1,!1),r.outShape)}var d=_.Tensor.make([1,i[0]*i[1]*(i[2]+1),r.inChannels],{dataId:t.dataId},t.dtype,this),m=o.shape;o.shape=o.shape.slice(),o.shape[o.shape.length-2]++,x.assert(Yt.isReshapeFree(o.shape,d.shape),function(){return&quot;packed reshape &quot;+o.shape+&quot; to &quot;+d.shape+&quot; isn&apos;t free&quot;});var g=this.reshape(e,[1,r.inChannels,r.outChannels]),v=this.batchMatMul(d,g,!1,!1),y=this.texData.get(v.dataId);return x.assert(y.isPacked,function(){return&quot;batchMatMul result is expected to be packed&quot;}),o.shape=m,y.shape=r.outShape,_.Tensor.make(r.outShape,{dataId:v.dataId},v.dtype,this)},t.prototype.conv2dWithIm2Row=function(t,e,n){var r=n.filterWidth,i=n.filterHeight,o=n.inChannels,a=n.outWidth,s=n.outHeight,u=r*i*o,l=s*a,c=[u,l],f=t.squeeze([0]),p=e.reshape([1,u,-1]),h=new ft.Im2ColPackedProgram(c,f.shape,n),d=this.compileAndRun(h,[f]).reshape([1,c[0],c[1]]),m=new mt.MatMulPackedProgram(d.shape,[1,l,n.outChannels],!0,!1);return this.compileAndRun(m,[d,p]).reshape([1,s,a,n.outChannels])},t.prototype.conv2d=function(t,e,n){if(1===n.filterHeight&amp;&amp;1===n.filterWidth&amp;&amp;1===n.dilationHeight&amp;&amp;1===n.dilationWidth&amp;&amp;1===n.strideHeight&amp;&amp;1===n.strideWidth&amp;&amp;(&quot;SAME&quot;===n.padInfo.type||&quot;VALID&quot;===n.padInfo.type))return this.conv2dByMatMul(t,e,n);if(s.ENV.getBool(&quot;WEBGL_CONV_IM2COL&quot;)&amp;&amp;1===t.shape[0])return this.conv2dWithIm2Row(t,e,n);var r=new X.Conv2DProgram(n);return this.compileAndRun(r,[t,e])},t.prototype.conv2dDerInput=function(t,e,n){var r=new K.Conv2DDerInputProgram(n);return this.compileAndRun(r,[t,e])},t.prototype.conv2dDerFilter=function(t,e,n){var r=new K.Conv2DDerFilterProgram(n);return this.compileAndRun(r,[t,e])},t.prototype.depthwiseConv2D=function(t,e,n){var r;return s.ENV.getBool(&quot;WEBGL_PACK_DEPTHWISECONV&quot;)&amp;&amp;n.strideWidth&lt;=2&amp;&amp;n.outChannels/n.inChannels==1?(r=new Q.DepthwiseConvPacked2DProgram(n),this.compileAndRun(r,[t,e],this.makePackedTensor(n.outShape,t.dtype))):(r=new Z.DepthwiseConv2DProgram(n),this.compileAndRun(r,[t,e]))},t.prototype.depthwiseConv2DDerInput=function(t,e,n){var r=new Y.DepthwiseConv2DDerInputProgram(n);return this.compileAndRun(r,[t,e])},t.prototype.depthwiseConv2DDerFilter=function(t,e,n){var r=new Y.DepthwiseConv2DDerFilterProgram(n);return this.compileAndRun(r,[t,e])},t.prototype.conv3d=function(t,e,n){var r=new X.Conv3DProgram(n);return this.compileAndRun(r,[t,e])},t.prototype.conv3dDerInput=function(t,e,n){var r=new K.Conv3DDerInputProgram(n);return this.compileAndRun(r,[t,e])},t.prototype.conv3dDerFilter=function(t,e,n){var r=new K.Conv3DDerFilterProgram(n);return this.compileAndRun(r,[t,e])},t.prototype.maxPool=function(t,e){var n=new wt.Pool2DProgram(e,&quot;max&quot;,!1),r=this.makeOutputArray(n.outputShape,t.dtype);return this.compileAndRun(n,[t],r)},t.prototype.avgPool=function(t,e){var n=new wt.Pool2DProgram(e,&quot;avg&quot;,!1),r=this.makeOutputArray(n.outputShape,&quot;float32&quot;);return this.compileAndRun(n,[t],r)},t.prototype.maxPoolBackprop=function(t,e,n,r){var i=new wt.Pool2DProgram(r,&quot;max&quot;,!0),o=this.compileAndRun(i,[e]),a=new dt.MaxPool2DBackpropProgram(r),s=this.makeOutputArray(a.outputShape,e.dtype),u=this.compileAndRun(a,[t,o],s);return o.dispose(),u},t.prototype.avgPoolBackprop=function(t,e,n){var r=new R.AvgPool2DBackpropProgram(n),i=this.makeOutputArray(r.outputShape,e.dtype);return this.compileAndRun(r,[t],i)},t.prototype.cast=function(t,e){return T.castTensor(t,e,this)},t.prototype.unstack=function(t,e){for(var n=t.shape[e],r=new Array(t.rank-1),i=0,o=0;o&lt;t.rank;o++)o!==e&amp;&amp;(r[i++]=t.shape[o]);var a=new Array(t.rank).fill(0),s=t.shape.slice();s[e]=1;var u=new Array(n);for(o=0;o&lt;u.length;o++)a[e]=o,u[o]=this.slice(t,a,s).reshape(r);return u},t.prototype.reshape=function(t,e){var n=this.texData.get(t.dataId);return!n.isPacked||Yt.isReshapeFree(t.shape,e)||null!==n.texture&amp;&amp;Yt.isReshapeFree(n.shape,e)?T.reshapeTensor(t,e):this.packedReshape(t,e)},t.prototype.resizeBilinear=function(t,e,n,r){var i=s.ENV.getBool(&quot;WEBGL_PACK_IMAGE_OPERATIONS&quot;)?new Nt.ResizeBilinearPackedProgram(t.shape,e,n,r):new Tt.ResizeBilinearProgram(t.shape,e,n,r);return this.compileAndRun(i,[t])},t.prototype.resizeBilinearBackprop=function(t,e,n){var r=new kt.ResizeBilinearBackpropProgram(t,e,n);return this.compileAndRun(r,[t])},t.prototype.resizeNearestNeighbor=function(t,e,n,r){var i=new Ct.ResizeNearestNeighborProgram(t.shape,e,n,r);return this.compileAndRun(i,[t])},t.prototype.resizeNearestNeighborBackprop=function(t,e,n){var r=new St.ResizeNearestNeigborBackpropProgram(t,e,n);return this.compileAndRun(r,[t])},t.prototype.multinomial=function(t,e,n,r){var i=e?t:y.softmax(t),o=i.shape[0],a=i.shape[1],s=new gt.MultinomialProgram(o,a,n),u=this.makeOutputArray(s.outputShape,&quot;int32&quot;),l=s.getCustomSetupFunc(r);return this.compileAndRun(s,[i],u,l)},t.prototype.oneHot=function(t,e,n,r){var i=new vt.OneHotProgram(t.size,e,n,r);return this.compileAndRun(i,[t])},t.prototype.nonMaxSuppression=function(t,e,n,r,i){l.warn(&quot;tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead&quot;);var o=t.dataSync(),a=e.dataSync();return S.nonMaxSuppressionImpl(o,a,n,r,i)},t.prototype.cropAndResize=function(t,e,n,r,i,o){var a=new J.CropAndResizeProgram(t.shape,e.shape,r,i,o);return this.compileAndRun(a,[t,e,n])},t.prototype.depthToSpace=function(t,e,n){x.assert(e&gt;1,function(){return&quot;blockSize should be &gt; 1 for depthToSpace, but was: &quot;+e});var r=t.shape[0],i=&quot;NHWC&quot;===n?t.shape[1]:t.shape[2],o=&quot;NHWC&quot;===n?t.shape[2]:t.shape[3],a=&quot;NHWC&quot;===n?t.shape[3]:t.shape[1],s=i*e,u=o*e,l=a/(e*e),c=&quot;NHWC&quot;===n?[r,s,u,l]:[r,l,s,u],f=new et.DepthToSpaceProgram(c,e,n);return this.compileAndRun(f,[t])},t.prototype.split=function(t,e,n){return C.split(t,e,n)},t.prototype.scatterND=function(t,e,n){var r=m.calculateShapes(e,t,n),i=r.sliceRank,o=r.numUpdates,a=r.sliceSize,s=r.strides,u=r.outputSize,l=[u/a,a],c=t.reshape([o,i]),f=e.reshape([o,a]);if(0===u)return T.reshapeTensor(b.tensor([]),n);var p=b.scalar(0),h=new Ot.ScatterProgram(o,i,c.rank,f.rank,s,l);return this.compileAndRun(h,[f,c,p]).reshape(n)},t.prototype.sparseToDense=function(t,e,n,r){var i=m.calculateShapes(e,t,n),o=i.sliceRank,a=i.numUpdates,s=i.strides,u=i.outputSize,l=new Ot.ScatterProgram(a,o,t.rank,e.rank,s,[u,1],!1);return this.compileAndRun(l,[e,t,r]).reshape(n)},t.prototype.fft=function(t){return this.fftImpl(t,!1)},t.prototype.ifft=function(t){return this.fftImpl(t,!0)},t.prototype.fftImpl=function(t,e){var n=this.texData.get(t.dataId),r=new it.FFTProgram(rt.COMPLEX_FFT.REAL,t.shape,e),i=new it.FFTProgram(rt.COMPLEX_FFT.IMAG,t.shape,e),o=[this.makeComplexComponentTensorHandle(t,n.complexTensors.real),this.makeComplexComponentTensorHandle(t,n.complexTensors.imag)],a=this.compileAndRun(r,o),s=this.compileAndRun(i,o),u=this.complex(a,s).as2D(t.shape[0],t.shape[1]);return a.dispose(),s.dispose(),u},t.prototype.gatherND=function(t,e){var n=e.shape,r=n[n.length-1],i=h.prepareAndValidate(t,e),o=i[0],a=i[1],s=i[2],u=i[3],l=e.reshape([a,r]),c=t.reshape([t.size/s,s]),f=new ut.GatherNDProgram(r,u,[a,s]);return this.compileAndRun(f,[c,l]).reshape(o)},t.prototype.fill=function(t,e,n){if(&quot;string&quot;===(n=n||E.inferDtype(e))){var r=E.getArrayFromDType(n,E.sizeFromShape(t));return r.fill(e),_.Tensor.make(t,{values:r},n)}var i=new ot.FillProgram(t,e),o=i.getCustomSetupFunc(e),a=this.makeOutputArray(t,n);return this.compileAndRun(i,[],a,o)},t.prototype.onesLike=function(t){if(&quot;string&quot;===t.dtype)throw new Error(&quot;onesLike is not supported under string dtype&quot;);return this.fill(t.shape,1,t.dtype)},t.prototype.zerosLike=function(t){return this.fill(t.shape,&quot;string&quot;===t.dtype?&quot;&quot;:0,t.dtype)},t.prototype.makeOutputArray=function(t,e){return _.Tensor.make(t,{},e,this)},t.prototype.makePackedTensor=function(t,e){var n=_.Tensor.make(t,{},e,this);return this.texData.get(n.dataId).isPacked=!0,n},t.prototype.unpackTensor=function(t){var e=new $t.UnpackProgram(t.shape);return this.compileAndRun(e,[t],_.Tensor.make(e.outputShape,{},t.dtype,this))},t.prototype.packTensor=function(t){var e=new yt.PackProgram(t.shape);return this.compileAndRun(e,[t],this.makePackedTensor(t.shape,t.dtype))},t.prototype.packedReshape=function(t,e){var n=t.reshape([Yt.getBatchDim(t.shape)].concat(Yt.getRowsCols(t.shape))),r=[Yt.getBatchDim(e)].concat(Yt.getRowsCols(e)),i=new Et.ReshapePackedProgram(r,n.shape);return this.compileAndRun(i,[n]).reshape(e)},t.prototype.compileAndRun=function(t,e,n,r){var i=this;if(null==n&amp;&amp;(n=t.usesPackedTextures?this.makePackedTensor(t.outputShape,e[0].dtype):this.makeOutputArray(t.outputShape,e[0].dtype)),0===n.size)return this.texData.get(n.dataId).values=E.getTypedArrayFromDType(n.dtype,0),n;var o=e.map(function(e){if(&quot;complex64&quot;===e.dtype)throw new Error(&quot;GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.&quot;);var n=i.texData.get(e.dataId);if(null==n.texture){if(!t.usesPackedTextures&amp;&amp;x.sizeFromShape(e.shape)&lt;=s.ENV.getNumber(&quot;WEBGL_SIZE_UPLOAD_UNIFORM&quot;))return{shape:e.shape,texData:null,isUniform:!0,uniformValues:i.readSync(e.dataId)};t.usesPackedTextures&amp;&amp;(n.isPacked=!0,n.shape=e.shape)}else if(!!n.isPacked!=!!t.usesPackedTextures)e=n.isPacked?i.unpackTensor(e):i.packTensor(e),n=i.texData.get(e.dataId);else if(n.isPacked&amp;&amp;!Yt.isReshapeFree(n.shape,e.shape)){var r=e,o=e.shape;e.shape=n.shape,e=i.packedReshape(e,o),n=i.texData.get(e.dataId),r.shape=o}return i.uploadToGPU(e.dataId),{shape:e.shape,texData:n,isUniform:!1}});this.uploadToGPU(n.dataId);var a,u={shape:n.shape,texData:this.texData.get(n.dataId),isUniform:!1},l=ct.makeShaderKey(t,o,u),c=this.getAndSaveBinary(l,function(){return ct.compileProgram(i.gpgpu,t,o,u)}),f=null!=this.activeTimers;return f&amp;&amp;(a=this.startTimer()),ct.runProgram(this.gpgpu,c,o,u,r),f&amp;&amp;(a=this.endTimer(a),this.activeTimers.push({name:t.constructor.name,query:this.getQueryTime(a)})),s.ENV.getBool(&quot;WEBGL_LAZILY_UNPACK&quot;)||!this.texData.get(n.dataId).isPacked||t.isPackShader?n:this.unpackTensor(n)},t.prototype.getAndSaveBinary=function(t,e){return t in this.binaryCache||(this.binaryCache[t]=e()),this.binaryCache[t]},t.prototype.getTextureManager=function(){return this.textureManager},t.prototype.dispose=function(){this.disposed||(this.textureManager.dispose(),this.canvas.remove(),null!=this.fromPixels2DContext&amp;&amp;this.fromPixels2DContext.canvas.remove(),this.gpgpuCreatedLocally&amp;&amp;(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)},t.prototype.floatPrecision=function(){var t=this;return null==this.floatPrecisionValue&amp;&amp;(this.floatPrecisionValue=u.tidy(function(){var e=s.ENV.getBool(&quot;DEBUG&quot;);s.ENV.set(&quot;DEBUG&quot;,!1);var n=t.abs(b.scalar(1e-8)).dataSync()[0];return s.ENV.set(&quot;DEBUG&quot;,e),n&gt;0?32:16})),this.floatPrecisionValue},t.prototype.epsilon=function(){return 32===this.floatPrecision()?k.EPSILON_FLOAT32:k.EPSILON_FLOAT16},t.prototype.uploadToGPU=function(t){var e,n=this.texData.get(t),r=n.shape,i=n.dtype,o=n.values,a=n.texture,s=n.usage,u=n.isPacked;if(null==a){var l,c=null!=this.activeTimers;c&amp;&amp;(l=performance.now());var f=Yt.getTextureShapeFromLogicalShape(r,u);n.texShape=f;var p=this.acquireTexture(f,s,i,u);if(n.texture=p,null!=o){if(u){var h=Yt.getBatchDim(r),d=1,m=1;r.length&amp;&amp;(d=(e=Yt.getRowsCols(r))[0],m=e[1]),this.gpgpu.uploadMatrixToPackedTexture(p,h,d,m,f[0],f[1],te(o))}else this.gpgpu.uploadMatrixToTexture(p,f[0],f[1],te(o));n.values=null,c&amp;&amp;(this.uploadWaitMs+=performance.now()-l)}}},t.prototype.convertAndCacheOnCPU=function(t,e){var n=this.texData.get(t),r=n.dtype;return this.releaseGPUData(t),n.usage=Ft.TextureUsage.UPLOAD,null!=e&amp;&amp;(n.values=function(t,e){if(&quot;float32&quot;===e||&quot;complex64&quot;===e)return t;if(&quot;int32&quot;===e||&quot;bool&quot;===e){for(var n=&quot;int32&quot;===e?new Int32Array(t.length):new Uint8Array(t.length),r=0;r&lt;n.length;++r)n[r]=Math.round(t[r]);return n}throw new Error(&quot;Unknown dtype &quot;+e)}(e,r)),n.values},t.prototype.acquireTexture=function(t,e,n,r){if(this.numBytesInGPU+=this.computeBytes(t,n),!this.warnedAboutMemory&amp;&amp;this.numBytesInGPU&gt;1024*this.numMBBeforeWarning*1024){var i=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(&quot;High memory usage in GPU: &quot;+i+&quot; MB, most likely due to a memory leak&quot;)}return this.textureManager.acquireTexture(t,e,r)},t.prototype.computeBytes=function(t,e){return t[0]*t[1]*x.bytesPerElement(e)},t}();function te(t){return t instanceof Float32Array?t:new Float32Array(t)}n.MathBackendWebGL=Jt,o.isBrowser()&amp;&amp;a.ENGINE.registerBackend(&quot;webgl&quot;,function(){return new Jt},2)},{&quot;../../device_util&quot;:132,&quot;../../engine&quot;:133,&quot;../../environment&quot;:134,&quot;../../globals&quot;:136,&quot;../../log&quot;:151,&quot;../../ops/array_ops_util&quot;:154,&quot;../../ops/axis_util&quot;:155,&quot;../../ops/concat_util&quot;:163,&quot;../../ops/gather_nd_util&quot;:170,&quot;../../ops/reduce_util&quot;:184,&quot;../../ops/scatter_nd_util&quot;:189,&quot;../../ops/segment_util&quot;:191,&quot;../../ops/slice_util&quot;:194,&quot;../../ops/softmax&quot;:195,&quot;../../ops/tensor_ops&quot;:200,&quot;../../tensor&quot;:216,&quot;../../types&quot;:222,&quot;../../util&quot;:223,&quot;../backend&quot;:49,&quot;../backend_util&quot;:50,&quot;../complex_util&quot;:51,&quot;../non_max_suppression_impl&quot;:53,&quot;../split_shared&quot;:55,&quot;../topk_impl&quot;:56,&quot;../where_impl&quot;:130,&quot;./addn_gpu&quot;:57,&quot;./addn_packed_gpu&quot;:58,&quot;./argminmax_gpu&quot;:59,&quot;./argminmax_packed_gpu&quot;:60,&quot;./avg_pool_backprop_gpu&quot;:61,&quot;./batchnorm_gpu&quot;:63,&quot;./batchnorm_packed_gpu&quot;:64,&quot;./binaryop_complex_gpu&quot;:65,&quot;./binaryop_gpu&quot;:66,&quot;./binaryop_packed_gpu&quot;:67,&quot;./canvas_util&quot;:68,&quot;./clip_gpu&quot;:69,&quot;./clip_packed_gpu&quot;:70,&quot;./complex_abs_gpu&quot;:71,&quot;./concat_gpu&quot;:72,&quot;./concat_packed_gpu&quot;:73,&quot;./conv_backprop_gpu&quot;:74,&quot;./conv_backprop_gpu_depthwise&quot;:75,&quot;./conv_gpu&quot;:76,&quot;./conv_gpu_depthwise&quot;:77,&quot;./conv_packed_gpu_depthwise&quot;:78,&quot;./crop_and_resize_gpu&quot;:79,&quot;./cumsum_gpu&quot;:80,&quot;./depth_to_space_gpu&quot;:81,&quot;./encode_float_gpu&quot;:82,&quot;./fft_gpu&quot;:83,&quot;./fill_gpu&quot;:84,&quot;./flags_webgl&quot;:85,&quot;./from_pixels_gpu&quot;:86,&quot;./gather_gpu&quot;:87,&quot;./gather_nd_gpu&quot;:88,&quot;./gpgpu_context&quot;:90,&quot;./gpgpu_math&quot;:91,&quot;./im2col_packed_gpu&quot;:93,&quot;./lrn_gpu&quot;:94,&quot;./lrn_grad_gpu&quot;:95,&quot;./max_pool_backprop_gpu&quot;:96,&quot;./mulmat_packed_gpu&quot;:97,&quot;./multinomial_gpu&quot;:98,&quot;./onehot_gpu&quot;:99,&quot;./pack_gpu&quot;:100,&quot;./pad_gpu&quot;:101,&quot;./pad_packed_gpu&quot;:102,&quot;./pool_gpu&quot;:103,&quot;./reduce_gpu&quot;:104,&quot;./reshape_packed_gpu&quot;:105,&quot;./resize_bilinear_backprop_gpu&quot;:106,&quot;./resize_bilinear_gpu&quot;:107,&quot;./resize_bilinear_packed_gpu&quot;:108,&quot;./resize_nearest_neighbor_backprop_gpu&quot;:109,&quot;./resize_nearest_neighbor_gpu&quot;:110,&quot;./reverse_gpu&quot;:111,&quot;./reverse_packed_gpu&quot;:112,&quot;./scatter_gpu&quot;:113,&quot;./segment_gpu&quot;:114,&quot;./select_gpu&quot;:115,&quot;./slice_gpu&quot;:118,&quot;./slice_packed_gpu&quot;:119,&quot;./strided_slice_gpu&quot;:120,&quot;./tex_util&quot;:121,&quot;./texture_manager&quot;:122,&quot;./tile_gpu&quot;:123,&quot;./transpose_gpu&quot;:124,&quot;./transpose_packed_gpu&quot;:125,&quot;./unaryop_gpu&quot;:126,&quot;./unaryop_packed_gpu&quot;:127,&quot;./unpack_gpu&quot;:128,&quot;./webgl_util&quot;:129}],63:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../ops/broadcast_util&quot;),i=function(){return function(t,e,n,i,o,a){this.outputShape=[],this.variableNames=[&quot;x&quot;,&quot;mean&quot;,&quot;variance&quot;],r.assertAndGetBroadcastShape(t,e),r.assertAndGetBroadcastShape(t,n);var s=&quot;0.0&quot;;null!=i&amp;&amp;(r.assertAndGetBroadcastShape(t,i),this.variableNames.push(&quot;offset&quot;),s=&quot;getOffsetAtOutCoords()&quot;);var u=&quot;1.0&quot;;null!=o&amp;&amp;(r.assertAndGetBroadcastShape(t,o),this.variableNames.push(&quot;scale&quot;),u=&quot;getScaleAtOutCoords()&quot;),this.outputShape=t,this.userCode=&quot;\n      void main() {\n        float x = getXAtOutCoords();\n        float mean = getMeanAtOutCoords();\n        float variance = getVarianceAtOutCoords();\n        float offset = &quot;+s+&quot;;\n        float scale = &quot;+u+&quot;;\n        float inv = scale * inversesqrt(variance + float(&quot;+a+&quot;));\n        setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n      }\n    &quot;}}();n.BatchNormProgram=i},{&quot;../../ops/broadcast_util&quot;:158}],64:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../ops/broadcast_util&quot;),i=function(){return function(t,e,n,i,o,a){this.usesPackedTextures=!0,this.variableNames=[&quot;x&quot;,&quot;mean&quot;,&quot;variance&quot;],r.assertAndGetBroadcastShape(t,e),r.assertAndGetBroadcastShape(t,n);var s=&quot;vec4(0.0)&quot;;null!=i&amp;&amp;(r.assertAndGetBroadcastShape(t,i),this.variableNames.push(&quot;offset&quot;),s=&quot;getOffsetAtOutCoords()&quot;);var u=&quot;vec4(1.0)&quot;;null!=o&amp;&amp;(r.assertAndGetBroadcastShape(t,o),this.variableNames.push(&quot;scale&quot;),u=&quot;getScaleAtOutCoords()&quot;),this.outputShape=t,this.userCode=&quot;\n      void main() {\n        vec4 offset = &quot;+s+&quot;;\n        vec4 scale = &quot;+u+&quot;;\n\n        vec4 x = getXAtOutCoords();\n        vec4 mean = getMeanAtOutCoords();\n        vec4 variance = getVarianceAtOutCoords();\n\n        vec4 inv = scale * inversesqrt(variance + vec4(&quot;+a+&quot;));\n\n        setOutput((x - mean) * inv + offset);\n      }\n    &quot;}}();n.BatchNormPackedProgram=i},{&quot;../../ops/broadcast_util&quot;:158}],65:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../ops/broadcast_util&quot;);n.COMPLEX_MULTIPLY={REAL:&quot;return areal * breal - aimag * bimag;&quot;,IMAG:&quot;return areal * bimag + aimag * breal;&quot;};var i=function(){return function(t,e,n){this.variableNames=[&quot;AReal&quot;,&quot;AImag&quot;,&quot;BReal&quot;,&quot;BImag&quot;],this.outputShape=r.assertAndGetBroadcastShape(e,n),this.userCode=&quot;\n      float binaryOpComplex(\n          float areal, float aimag, float breal, float bimag) {\n        &quot;+t+&quot;\n      }\n\n      void main() {\n        float areal = getARealAtOutCoords();\n        float aimag = getAImagAtOutCoords();\n        float breal = getBRealAtOutCoords();\n        float bimag = getBImagAtOutCoords();\n        setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n      }\n    &quot;}}();n.BinaryOpComplexProgram=i},{&quot;../../ops/broadcast_util&quot;:158}],66:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../ops/broadcast_util&quot;),i=&quot;\n  if (isnan(a)) return a;\n  if (isnan(b)) return b;\n&quot;;n.ADD=&quot;return a + b;&quot;,n.SUB=&quot;return a - b;&quot;,n.MUL=&quot;return a * b;&quot;,n.DIV=&quot;\nif (b == 0.0) {\n  return NAN;\n} \nif (a == b) {\n  return 1.0;\n};\nreturn a / b;&quot;,n.INT_DIV=&quot;\n  float s = sign(a) * sign(b);\n  int ia = round(a);\n  int ib = round(b);\n  if (ib != 0) {\n    // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n    return float(idiv(ia, ib, s));\n  } else {\n    return NAN;\n  }\n&quot;,n.POW=&quot;\nif(a &lt; 0.0 &amp;&amp; floor(b) &lt; b){\n  return NAN;\n}\nreturn (round(mod(b, 2.0)) != 1) ?\n    pow(abs(a), b) : sign(a) * pow(abs(a), b);\n&quot;,n.SQUARED_DIFFERENCE=&quot;return (a - b) * (a - b);&quot;,n.EQUAL=&quot;return float(a == b);&quot;,n.NOT_EQUAL=&quot;return float(a != b);&quot;,n.LESS=&quot;return float(a &lt; b);&quot;,n.LESS_EQUAL=&quot;return float(a &lt;= b);&quot;,n.GREATER=&quot;return float(a &gt; b);&quot;,n.GREATER_EQUAL=&quot;return float(a &gt;= b);&quot;,n.LOGICAL_AND=&quot;return float(a &gt;= 1.0 &amp;&amp; b &gt;= 1.0);&quot;,n.LOGICAL_OR=&quot;return float(a &gt;= 1.0 || b &gt;= 1.0);&quot;,n.MAX=i+&quot;\n  return max(a, b);\n&quot;,n.MIN=i+&quot;\n  return min(a, b);\n&quot;,n.MOD=&quot;if (b == 0.0) return NAN;\n  return mod(a, b);&quot;,n.ATAN2=i+&quot;\n  return atan(a, b);\n&quot;,n.ELU_DER=&quot;return (b &gt;= 1.0) ? a : a * (b + 1.0);&quot;,n.PRELU=&quot;return (a &lt; 0.) ? b * a : a;&quot;;var o=function(){return function(t,e,n){this.variableNames=[&quot;A&quot;,&quot;B&quot;],this.outputShape=r.assertAndGetBroadcastShape(e,n),this.userCode=&quot;\n      float binaryOperation(float a, float b) {\n        &quot;+t+&quot;\n      }\n\n      void main() {\n        float a = getAAtOutCoords();\n        float b = getBAtOutCoords();\n        setOutput(binaryOperation(a, b));\n      }\n    &quot;}}();n.BinaryOpProgram=o},{&quot;../../ops/broadcast_util&quot;:158}],67:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../ops/broadcast_util&quot;),i=t(&quot;../../util&quot;),o=t(&quot;../packing_util&quot;),a=t(&quot;./shader_compiler&quot;),s=&quot;\n  result.r = isNaN.r &gt; 0. ? NAN : result.r;\n  result.g = isNaN.g &gt; 0. ? NAN : result.g;\n  result.b = isNaN.b &gt; 0. ? NAN : result.b;\n  result.a = isNaN.a &gt; 0. ? NAN : result.a;\n&quot;;n.DIV=&quot;\n  // vec4 one = vec4(equal(a, b));\n  // return one + (vec4(1.0) - one) * a / b;\n  vec4 result = a / b;\n  if(b.x == 0.0) {\n    result.x = NAN;\n  } else if(a.x == b.x) {\n    result.x = 1.;\n  }\n  if(b.y == 0.0) {\n    result.y = NAN;\n  } else if(a.y == b.y) {\n    result.y = 1.;\n  }\n  if(b.z == 0.0) {\n    result.z = NAN;\n  } else if(a.z == b.z) {\n    result.z = 1.;\n  }\n  if(b.w == 0.0) {\n    result.w = NAN;\n  } else if(a.w == b.w) {\n    result.w = 1.;\n  }\n  \n  return result;\n&quot;,n.INT_DIV=&quot;\n  ivec4 ia = round(a);\n  ivec4 ib = round(b);\n  bvec4 cond = notEqual(ib, ivec4(0));\n  ivec4 result = ivec4(0);\n  vec4 s = sign(a) * sign(b);\n\n  // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n  if (cond[0]) {\n    result[0] = idiv(ia[0], ib[0], s[0]);\n  }\n  if (cond[1]) {\n    result[1] = idiv(ia[1], ib[1], s[1]);\n  }\n  if (cond[2]) {\n    result[2] = idiv(ia[2], ib[2], s[2]);\n  }\n  if (cond[3]) {\n    result[3] = idiv(ia[3], ib[3], s[3]);\n  }\n  return vec4(result);\n&quot;,n.POW=&quot;\n  // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n  vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n  vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n  vec4 result = multiplier * pow(abs(a), b);\n\n  vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b));\n  &quot;+s+&quot;\n  return result;\n&quot;,n.PRELU=&quot;\n  vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n  return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n&quot;,n.ELU_DER=&quot;\n  vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n  return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n&quot;,n.ATAN2=&quot;\n  vec4 result = atan(a, b);\n  vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n  &quot;+s+&quot;\n  return result;\n&quot;,n.EQUAL=&quot;\n  return vec4(equal(a, b));\n&quot;,n.NOT_EQUAL=&quot;\n  return vec4(notEqual(a, b));\n&quot;,n.LESS=&quot;\n  return vec4(lessThan(a, b));\n&quot;,n.LESS_EQUAL=&quot;\n  return vec4(lessThanEqual(a, b));\n&quot;,n.GREATER=&quot;\n  return vec4(greaterThan(a, b));\n&quot;,n.GREATER_EQUAL=&quot;\n  return vec4(greaterThanEqual(a, b));\n&quot;,n.LOGICAL_AND=&quot;\n  return vec4(\n    vec4(greaterThanEqual(a, vec4(1.0))) *\n    vec4(greaterThanEqual(b, vec4(1.0))));\n&quot;,n.LOGICAL_OR=&quot;\n  return min(\n    vec4(greaterThanEqual(a, vec4(1.0))) +\n    vec4(greaterThanEqual(b, vec4(1.0))),\n    vec4(1.0));\n&quot;,n.MAX=&quot;\n  vec4 result = vec4(max(a, b));\n  vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n  &quot;+s+&quot;\n  return result;\n&quot;,n.MIN=&quot;\n  vec4 result = vec4(min(a, b));\n  vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n  &quot;+s+&quot;\n  return result;\n&quot;,n.MOD=&quot;\n  vec4 result = mod(a, b);\n  vec4 isNaN = vec4(equal(b, vec4(0.0)));\n  &quot;+s+&quot;\n  return result;\n&quot;;var u=function(){return function(t,e,n,s){void 0===s&amp;&amp;(s=!1),this.variableNames=[&quot;A&quot;,&quot;B&quot;],this.supportsBroadcasting=!0,this.usesPackedTextures=!0,this.outputShape=r.assertAndGetBroadcastShape(e,n);var u=this.outputShape.length,l=&quot;&quot;;if(s)if(0===u||1===i.sizeFromShape(this.outputShape))l=&quot;\n          result.y = 0.;\n          result.z = 0.;\n          result.w = 0.;\n        &quot;;else if(l=&quot;\n          &quot;+a.getCoordsDataType(u)+&quot; coords = getOutputCoords();\n        &quot;,1===u)l+=&quot;\n            result.y = (coords + 1) &gt;= &quot;+this.outputShape[0]+&quot; ? 0. : result.y;\n            result.z = 0.;\n            result.w = 0.;\n          &quot;;else{var c=o.getChannels(&quot;coords&quot;,u);l+=&quot;\n            bool nextRowOutOfBounds =\n              (&quot;+c[u-2]+&quot; + 1) &gt;= &quot;+this.outputShape[u-2]+&quot;;\n            bool nextColOutOfBounds =\n              (&quot;+c[u-1]+&quot; + 1) &gt;= &quot;+this.outputShape[u-1]+&quot;;\n            result.y = nextColOutOfBounds ? 0. : result.y;\n            result.z = nextRowOutOfBounds ? 0. : result.z;\n            result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n          &quot;}this.userCode=&quot;\n      vec4 binaryOperation(vec4 a, vec4 b) {\n        &quot;+t+&quot;\n      }\n\n      void main() {\n        vec4 a = getAAtOutCoords();\n        vec4 b = getBAtOutCoords();\n\n        vec4 result = binaryOperation(a, b);\n        &quot;+l+&quot;\n\n        setOutput(result);\n      }\n    &quot;}}();n.BinaryOpPackedProgram=u},{&quot;../../ops/broadcast_util&quot;:158,&quot;../../util&quot;:223,&quot;../packing_util&quot;:54,&quot;./shader_compiler&quot;:116}],68:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r={},i={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};n.setWebGLContext=function(t,e){r[t]=e},n.getWebGLContext=function t(e){e in r||(r[e]=function(t){if(1!==t&amp;&amp;2!==t)throw new Error(&quot;Cannot get WebGL rendering context, WebGL is disabled.&quot;);var e=document.createElement(&quot;canvas&quot;);return e.addEventListener(&quot;webglcontextlost&quot;,function(e){e.preventDefault(),delete r[t]},!1),1===t?e.getContext(&quot;webgl&quot;,i)||e.getContext(&quot;experimental-webgl&quot;,i):e.getContext(&quot;webgl2&quot;,i)}(e));var n=r[e];return n.isContextLost()?(delete r[e],t(e)):(n.disable(n.DEPTH_TEST),n.disable(n.STENCIL_TEST),n.disable(n.BLEND),n.disable(n.DITHER),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SAMPLE_COVERAGE),n.enable(n.SCISSOR_TEST),n.enable(n.CULL_FACE),n.cullFace(n.BACK),r[e])}},{}],69:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){function t(t){this.variableNames=[&quot;A&quot;],this.outputShape=t,this.userCode=&quot;\n      uniform float min;\n      uniform float max;\n\n      void main() {\n        float value = getAAtOutCoords();\n        if (isnan(value)) {\n          setOutput(value);\n          return;\n        }\n\n        setOutput(clamp(value, min, max));\n      }\n    &quot;}return t.prototype.getCustomSetupFunc=function(t,e){var n=this;return function(r,i){null==n.minLoc&amp;&amp;(n.minLoc=r.getUniformLocationNoThrow(i,&quot;min&quot;),n.maxLoc=r.getUniformLocationNoThrow(i,&quot;max&quot;)),r.gl.uniform1f(n.minLoc,t),r.gl.uniform1f(n.maxLoc,e)}},t}();n.ClipProgram=r},{}],70:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){function t(t){this.variableNames=[&quot;A&quot;],this.usesPackedTextures=!0,this.outputShape=t,this.userCode=&quot;\n      uniform float min;\n      uniform float max;\n\n      void main() {\n        vec4 value = getAAtOutCoords();\n\n        if (any(isnan(value))) {\n          setOutput(value);\n          return;\n        }\n\n        setOutput(clamp(value, vec4(min), vec4(max)));\n      }\n    &quot;}return t.prototype.getCustomSetupFunc=function(t,e){var n=this;return function(r,i){null==n.minLoc&amp;&amp;(n.minLoc=r.getUniformLocationNoThrow(i,&quot;min&quot;),n.maxLoc=r.getUniformLocationNoThrow(i,&quot;max&quot;)),r.gl.uniform1f(n.minLoc,t),r.gl.uniform1f(n.maxLoc,e)}},t}();n.ClipPackedProgram=r},{}],71:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t){this.variableNames=[&quot;real&quot;,&quot;imag&quot;],this.outputShape=t,this.userCode=&quot;\n      void main() {\n        float re = abs(getRealAtOutCoords());\n        float im = abs(getImagAtOutCoords());\n        float mx = max(re, im);\n\n        // sadly the length function in glsl is not underflow-safe\n        // (at least not on Intel GPUs). So the safe solution is\n        // to ensure underflow-safety in all cases.\n        setOutput(\n          mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n        );\n      }\n    &quot;}}();n.ComplexAbsProgram=r},{}],72:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../ops/concat_util&quot;),i=function(){return function(t){this.outputShape=[],this.outputShape=r.computeOutShape(t,1),this.variableNames=t.map(function(t,e){return&quot;T&quot;+e});var e=new Array(t.length-1);e[0]=t[0][1];for(var n=1;n&lt;e.length;n++)e[n]=e[n-1]+t[n][1];var i=[&quot;if (yC &lt; &quot;+e[0]+&quot;) setOutput(getT0(yR, yC));&quot;];for(n=1;n&lt;e.length;n++){var o=e[n-1];i.push(&quot;else if (yC &lt; &quot;+e[n]+&quot;) setOutput(getT&quot;+n+&quot;(yR, yC-&quot;+o+&quot;));&quot;)}var a=e.length,s=e[e.length-1];i.push(&quot;else setOutput(getT&quot;+a+&quot;(yR, yC-&quot;+s+&quot;));&quot;),this.userCode=&quot;\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int yR = coords.x;\n        int yC = coords.y;\n\n        &quot;+i.join(&quot;\n        &quot;)+&quot;\n      }\n    &quot;}}();n.ConcatProgram=i},{&quot;../../ops/concat_util&quot;:163}],73:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../ops/concat_util&quot;),i=t(&quot;../packing_util&quot;),o=t(&quot;./shader_compiler&quot;),a=function(){return function(t,e){this.usesPackedTextures=!0,this.outputShape=[],this.outputShape=r.computeOutShape(t,e);var n=this.outputShape,a=n.length,s=o.getCoordsDataType(a),u=i.getChannels(&quot;coords&quot;,a),l=[&quot;x&quot;,&quot;y&quot;,&quot;z&quot;,&quot;w&quot;,&quot;u&quot;,&quot;v&quot;].slice(0,a);this.variableNames=t.map(function(t,e){return&quot;T&quot;+e});var c=new Array(t.length-1);c[0]=t[0][e];for(var f=1;f&lt;c.length;f++)c[f]=c[f-1]+t[f][e];var p=l[e],h=&quot;vec2(&quot;+l.slice(-2).join()+&quot;)&quot;,d=l.join(),m=&quot;if (&quot;+p+&quot; &lt; &quot;+c[0]+&quot;)\n          return getChannel(getT0(&quot;+d+&quot;), &quot;+h+&quot;);&quot;;for(f=1;f&lt;c.length;f++){var g=c[f-1];m+=&quot;\n        else if (&quot;+p+&quot; &lt; &quot;+c[f]+&quot;) {\n          &quot;+p+&quot; -= &quot;+g+&quot;;\n          return getChannel(getT&quot;+f+&quot;(&quot;+d+&quot;), &quot;+h+&quot;);\n        }&quot;}var v=c.length;m+=&quot;\n        else {\n          &quot;+p+&quot; -= &quot;+c[c.length-1]+&quot;;\n          return getChannel(getT&quot;+v+&quot;(&quot;+d+&quot;), &quot;+h+&quot;);\n        }&quot;,this.userCode=&quot;\n      float getValue(&quot;+l.map(function(t){return&quot;int &quot;+t})+&quot;) {\n        &quot;+m+&quot;\n      }\n\n      void main() {\n        &quot;+s+&quot; coords = getOutputCoords();\n        vec4 result = vec4(getValue(&quot;+u+&quot;), 0., 0., 0.);\n        if (++&quot;+u[a-1]+&quot; &lt; &quot;+n[a-1]+&quot;) {\n          result.g = getValue(&quot;+u+&quot;);\n        }\n        if (++&quot;+u[a-2]+&quot; &lt; &quot;+n[a-2]+&quot;) {\n          result.a = getValue(&quot;+u+&quot;);\n        }\n        if (&quot;+u[a-2]+&quot; &lt; &quot;+n[a-2]+&quot; &amp;&amp;\n            --&quot;+u[a-1]+&quot; &lt; &quot;+n[a-1]+&quot;) {\n          result.b = getValue(&quot;+u+&quot;);\n        }\n        setOutput(result);\n      }\n    &quot;}}();n.ConcatPackedProgram=a},{&quot;../../ops/concat_util&quot;:163,&quot;../packing_util&quot;:54,&quot;./shader_compiler&quot;:116}],74:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t){this.variableNames=[&quot;x&quot;,&quot;dy&quot;],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,i=t.padInfo.left;this.userCode=&quot;\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int wR = coords.x;\n        int wC = coords.y;\n        int d1 = coords.z;\n        int d2 = coords.w;\n\n        // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n\n        for (int b = 0; b &lt; &quot;+t.batchSize+&quot;; b++) {\n          for (int yR = 0; yR &lt; &quot;+t.outHeight+&quot;; yR++) {\n            int xR = wR + yR * &quot;+e+&quot; - &quot;+r+&quot;;\n\n            if (xR &lt; 0 || xR &gt;= &quot;+t.inHeight+&quot;) {\n              continue;\n            }\n\n            for (int yC = 0; yC &lt; &quot;+t.outWidth+&quot;; yC++) {\n              int xC = wC + yC * &quot;+n+&quot; - &quot;+i+&quot;;\n\n              if (xC &lt; 0 || xC &gt;= &quot;+t.inWidth+&quot;) {\n                continue;\n              }\n\n              float dyValue = getDy(b, yR, yC, d2);\n              float xValue = getX(b, xR, xC, d1);\n              dotProd += (xValue * dyValue);\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.Conv2DDerFilterProgram=r;var i=function(){return function(t){this.variableNames=[&quot;dy&quot;,&quot;W&quot;],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=e-1-t.padInfo.top,a=n-1-t.padInfo.left;this.userCode=&quot;\n      const ivec2 pads = ivec2(&quot;+o+&quot;, &quot;+a+&quot;);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d1 = coords[3];\n\n        ivec2 dyCorner = coords.yz - pads;\n        int dyRCorner = dyCorner.x;\n        int dyCCorner = dyCorner.y;\n\n        // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR &lt; &quot;+e+&quot;; wR++) {\n          float dyR = float(dyRCorner + wR) / &quot;+r+&quot;.0;\n\n          if (dyR &lt; 0.0 || dyR &gt;= &quot;+t.outHeight+&quot;.0 || fract(dyR) &gt; 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          int wRPerm = &quot;+e+&quot; - 1 - wR;\n\n          for (int wC = 0; wC &lt; &quot;+n+&quot;; wC++) {\n            float dyC = float(dyCCorner + wC) / &quot;+i+&quot;.0;\n\n            if (dyC &lt; 0.0 || dyC &gt;= &quot;+t.outWidth+&quot;.0 ||\n                fract(dyC) &gt; 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            int wCPerm = &quot;+n+&quot; - 1 - wC;\n\n            for (int d2 = 0; d2 &lt; &quot;+t.outChannels+&quot;; d2++) {\n              float xValue = getDy(batch, idyR, idyC, d2);\n              float wValue = getW(wRPerm, wCPerm, d1, d2);\n              dotProd += xValue * wValue;\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.Conv2DDerInputProgram=i;var o=function(){return function(t){this.variableNames=[&quot;x&quot;,&quot;dy&quot;],this.outputShape=t.filterShape;var e=t.strideDepth,n=t.strideHeight,r=t.strideWidth,i=t.padInfo.front,o=t.padInfo.top,a=t.padInfo.left;this.userCode=&quot;\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int wF = coords.x;\n        int wR = coords.y;\n        int wC = coords.z;\n        int d1 = coords.w;\n        int d2 = coords.u;\n\n        float dotProd = 0.0;\n\n        for (int b = 0; b &lt; &quot;+t.batchSize+&quot;; b++) {\n          for (int yF = 0; yF &lt; &quot;+t.outDepth+&quot;; yF++) {\n            int xF = wF + yF * &quot;+e+&quot; - &quot;+i+&quot;;\n\n            if (xF &lt; 0 || xF &gt;= &quot;+t.inDepth+&quot;) {\n              continue;\n            }\n\n            for (int yR = 0; yR &lt; &quot;+t.outHeight+&quot;; yR++) {\n              int xR = wR + yR * &quot;+n+&quot; - &quot;+o+&quot;;\n\n              if (xR &lt; 0 || xR &gt;= &quot;+t.inHeight+&quot;) {\n                continue;\n              }\n\n              for (int yC = 0; yC &lt; &quot;+t.outWidth+&quot;; yC++) {\n                int xC = wC + yC * &quot;+r+&quot; - &quot;+a+&quot;;\n\n                if (xC &lt; 0 || xC &gt;= &quot;+t.inWidth+&quot;) {\n                  continue;\n                }\n\n                float dyValue = getDy(b, yF, yR, yC, d2);\n                float xValue = getX(b, xF, xR, xC, d1);\n                dotProd += (xValue * dyValue);\n              }\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.Conv3DDerFilterProgram=o;var a=function(){return function(t){this.variableNames=[&quot;dy&quot;,&quot;W&quot;],this.outputShape=t.inShape;var e=t.filterDepth,n=t.filterHeight,r=t.filterWidth,i=t.strideDepth,o=t.strideHeight,a=t.strideWidth,s=e-1-t.padInfo.front,u=n-1-t.padInfo.top,l=r-1-t.padInfo.left;this.userCode=&quot;\n      const ivec3 pads = ivec3(&quot;+s+&quot;, &quot;+u+&quot;, &quot;+l+&quot;);\n\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int batch = coords.x;\n        int d1 = coords.u;\n\n\n        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n        int dyFCorner = dyCorner.x;\n        int dyRCorner = dyCorner.y;\n        int dyCCorner = dyCorner.z;\n\n        float dotProd = 0.0;\n        for (int wF = 0; wF &lt; &quot;+e+&quot;; wF++) {\n          float dyF = float(dyFCorner + wF) / &quot;+i+&quot;.0;\n\n          if (dyF &lt; 0.0 || dyF &gt;= &quot;+t.outDepth+&quot;.0 || fract(dyF) &gt; 0.0) {\n            continue;\n          }\n          int idyF = int(dyF);\n\n          int wFPerm = &quot;+e+&quot; - 1 - wF;\n\n          for (int wR = 0; wR &lt; &quot;+n+&quot;; wR++) {\n            float dyR = float(dyRCorner + wR) / &quot;+o+&quot;.0;\n\n            if (dyR &lt; 0.0 || dyR &gt;= &quot;+t.outHeight+&quot;.0 ||\n              fract(dyR) &gt; 0.0) {\n              continue;\n            }\n            int idyR = int(dyR);\n\n            int wRPerm = &quot;+n+&quot; - 1 - wR;\n\n            for (int wC = 0; wC &lt; &quot;+r+&quot;; wC++) {\n              float dyC = float(dyCCorner + wC) / &quot;+a+&quot;.0;\n\n              if (dyC &lt; 0.0 || dyC &gt;= &quot;+t.outWidth+&quot;.0 ||\n                  fract(dyC) &gt; 0.0) {\n                continue;\n              }\n              int idyC = int(dyC);\n\n              int wCPerm = &quot;+r+&quot; - 1 - wC;\n\n              for (int d2 = 0; d2 &lt; &quot;+t.outChannels+&quot;; d2++) {\n                float xValue = getDy(batch, idyF, idyR, idyC, d2);\n                float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n                dotProd += xValue * wValue;\n              }\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.Conv3DDerInputProgram=a},{}],75:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t){this.variableNames=[&quot;x&quot;,&quot;dy&quot;],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,i=t.padInfo.left,o=t.outChannels/t.inChannels;this.userCode=&quot;\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int wR = coords.x;\n        int wC = coords.y;\n        int d1 = coords.z;\n        int dm = coords.w;\n        int d2 = d1 * &quot;+o+&quot; + dm;\n\n        float dotProd = 0.0;\n\n        // TODO: Vec4 over the batch size\n        for (int b = 0; b &lt; &quot;+t.batchSize+&quot;; b++) {\n          for (int yR = 0; yR &lt; &quot;+t.outHeight+&quot;; yR++) {\n            int xR = wR + yR * &quot;+e+&quot; - &quot;+r+&quot;;\n\n            if (xR &lt; 0 || xR &gt;= &quot;+t.inHeight+&quot;) {\n              continue;\n            }\n\n            for (int yC = 0; yC &lt; &quot;+t.outWidth+&quot;; yC++) {\n              int xC = wC + yC * &quot;+n+&quot; - &quot;+i+&quot;;\n\n              if (xC &lt; 0 || xC &gt;= &quot;+t.inWidth+&quot;) {\n                continue;\n              }\n\n              float dyValue = getDy(b, yR, yC, d2);\n              float xValue = getX(b, xR, xC, d1);\n              dotProd += (xValue * dyValue);\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.DepthwiseConv2DDerFilterProgram=r;var i=function(){return function(t){this.variableNames=[&quot;dy&quot;,&quot;W&quot;],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=e-1-t.padInfo.top,a=n-1-t.padInfo.left,s=t.outChannels/t.inChannels;this.userCode=&quot;\n      const ivec2 pads = ivec2(&quot;+o+&quot;, &quot;+a+&quot;);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d1 = coords[3];\n        ivec2 dyCorner = coords.yz - pads;\n        int dyRCorner = dyCorner.x;\n        int dyCCorner = dyCorner.y;\n\n        float dotProd = 0.0;\n\n        for (int wR = 0; wR &lt; &quot;+e+&quot;; wR++) {\n          float dyR = float(dyRCorner + wR) / &quot;+r+&quot;.0;\n\n          if (dyR &lt; 0.0 || dyR &gt;= &quot;+t.outHeight+&quot;.0 || fract(dyR) &gt; 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          int wRPerm = &quot;+e+&quot; - 1 - wR;\n\n          for (int wC = 0; wC &lt; &quot;+n+&quot;; wC++) {\n            float dyC = float(dyCCorner + wC) / &quot;+i+&quot;.0;\n\n            if (dyC &lt; 0.0 || dyC &gt;= &quot;+t.outWidth+&quot;.0 ||\n                fract(dyC) &gt; 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            int wCPerm = &quot;+n+&quot; - 1 - wC;\n\n            // TODO: Vec4 over the channelMul\n            for (int dm = 0; dm &lt; &quot;+s+&quot;; dm++) {\n              int d2 = d1 * &quot;+s+&quot; + dm;\n              float xValue = getDy(batch, idyR, idyC, d2);\n              float wValue = getW(wRPerm, wCPerm, d1, dm);\n              dotProd += xValue * wValue;\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.DepthwiseConv2DDerInputProgram=i},{}],76:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t){this.variableNames=[&quot;x&quot;,&quot;W&quot;],this.outputShape=t.outShape;var e=t.padInfo.top,n=t.padInfo.left,r=t.strideHeight,i=t.strideWidth,o=t.dilationHeight,a=t.dilationWidth,s=t.filterHeight,u=t.filterWidth,l=4*Math.floor(t.inChannels/4),c=t.inChannels%4;this.userCode=&quot;\n      const ivec2 strides = ivec2(&quot;+r+&quot;, &quot;+i+&quot;);\n      const ivec2 pads = ivec2(&quot;+e+&quot;, &quot;+n+&quot;);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d2 = coords[3];\n\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR &lt; &quot;+s+&quot;; wR++) {\n          int xR = xRCorner + wR * &quot;+o+&quot;;\n\n          if (xR &lt; 0 || xR &gt;= &quot;+t.inHeight+&quot;) {\n            continue;\n          }\n\n          for (int wC = 0; wC &lt; &quot;+u+&quot;; wC++) {\n            int xC = xCCorner + wC * &quot;+a+&quot;;\n\n            if (xC &lt; 0 || xC &gt;= &quot;+t.inWidth+&quot;) {\n              continue;\n            }\n\n            for (int d1 = 0; d1 &lt; &quot;+l+&quot;; d1 += 4) {\n              vec4 xValues = vec4(\n                getX(batch, xR, xC, d1),\n                getX(batch, xR, xC, d1 + 1),\n                getX(batch, xR, xC, d1 + 2),\n                getX(batch, xR, xC, d1 + 3)\n              );\n              vec4 wValues = vec4(\n                getW(wR, wC, d1, d2),\n                getW(wR, wC, d1 + 1, d2),\n                getW(wR, wC, d1 + 2, d2),\n                getW(wR, wC, d1 + 3, d2)\n              );\n\n              dotProd += dot(xValues, wValues);\n            }\n\n            if (&quot;+(1===c)+&quot;) {\n              dotProd +=\n                getX(batch, xR, xC, &quot;+l+&quot;) *\n                getW(wR, wC, &quot;+l+&quot;, d2);\n            } else if (&quot;+(2===c)+&quot;) {\n              vec2 xValues = vec2(\n                getX(batch, xR, xC, &quot;+l+&quot;),\n                getX(batch, xR, xC, &quot;+l+&quot; + 1)\n              );\n              vec2 wValues = vec2(\n                getW(wR, wC, &quot;+l+&quot;, d2),\n                getW(wR, wC, &quot;+l+&quot; + 1, d2)\n              );\n              dotProd += dot(xValues, wValues);\n            } else if (&quot;+(3===c)+&quot;) {\n              vec3 xValues = vec3(\n                getX(batch, xR, xC, &quot;+l+&quot;),\n                getX(batch, xR, xC, &quot;+l+&quot; + 1),\n                getX(batch, xR, xC, &quot;+l+&quot; + 2)\n              );\n              vec3 wValues = vec3(\n                getW(wR, wC, &quot;+l+&quot;, d2),\n                getW(wR, wC, &quot;+l+&quot; + 1, d2),\n                getW(wR, wC, &quot;+l+&quot; + 2, d2)\n              );\n              dotProd += dot(xValues, wValues);\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.Conv2DProgram=r;var i=function(){return function(t){this.variableNames=[&quot;x&quot;,&quot;W&quot;],this.outputShape=t.outShape;var e=t.padInfo.front,n=t.padInfo.top,r=t.padInfo.left,i=t.strideDepth,o=t.strideHeight,a=t.strideWidth,s=t.dilationDepth,u=t.dilationHeight,l=t.dilationWidth,c=t.filterDepth,f=t.filterHeight,p=t.filterWidth,h=4*Math.floor(t.inChannels/4),d=t.inChannels%4;this.userCode=&quot;\n      const ivec3 strides = ivec3(&quot;+i+&quot;, &quot;+o+&quot;, &quot;+a+&quot;);\n      const ivec3 pads = ivec3(&quot;+e+&quot;, &quot;+n+&quot;, &quot;+r+&quot;);\n\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int batch = coords.x;\n        int d2 = coords.u;\n\n        ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n        int xFCorner = xFRCCorner.x;\n        int xRCorner = xFRCCorner.y;\n        int xCCorner = xFRCCorner.z;\n\n        // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n        // y(yF, yR, yC, d2). ? = to be determined. : = across all\n        // values in that axis.\n        float dotProd = 0.0;\n        for (int wF = 0; wF &lt; &quot;+c+&quot;; wF++) {\n          int xF = xFCorner + wF * &quot;+s+&quot;;\n\n          if (xF &lt; 0 || xF &gt;= &quot;+t.inDepth+&quot;) {\n            continue;\n          }\n\n          for (int wR = 0; wR &lt; &quot;+f+&quot;; wR++) {\n            int xR = xRCorner + wR * &quot;+u+&quot;;\n\n            if (xR &lt; 0 || xR &gt;= &quot;+t.inHeight+&quot;) {\n              continue;\n            }\n\n            for (int wC = 0; wC &lt; &quot;+p+&quot;; wC++) {\n              int xC = xCCorner + wC * &quot;+l+&quot;;\n\n              if (xC &lt; 0 || xC &gt;= &quot;+t.inWidth+&quot;) {\n                continue;\n              }\n\n              for (int d1 = 0; d1 &lt; &quot;+h+&quot;; d1 += 4) {\n                vec4 xValues = vec4(\n                  getX(batch, xF, xR, xC, d1),\n                  getX(batch, xF, xR, xC, d1 + 1),\n                  getX(batch, xF, xR, xC, d1 + 2),\n                  getX(batch, xF, xR, xC, d1 + 3)\n                );\n                vec4 wValues = vec4(\n                  getW(wF, wR, wC, d1, d2),\n                  getW(wF, wR, wC, d1 + 1, d2),\n                  getW(wF, wR, wC, d1 + 2, d2),\n                  getW(wF, wR, wC, d1 + 3, d2)\n                );\n\n                dotProd += dot(xValues, wValues);\n              }\n\n              if (&quot;+(1===d)+&quot;) {\n                dotProd +=\n                  getX(batch, xF, xR, xC, &quot;+h+&quot;) *\n                  getW(wF, wR, wC, &quot;+h+&quot;, d2);\n              } else if (&quot;+(2===d)+&quot;) {\n                vec2 xValues = vec2(\n                  getX(batch, xF, xR, xC, &quot;+h+&quot;),\n                  getX(batch, xF, xR, xC, &quot;+h+&quot; + 1)\n                );\n                vec2 wValues = vec2(\n                  getW(wF, wR, wC, &quot;+h+&quot;, d2),\n                  getW(wF, wR, wC, &quot;+h+&quot; + 1, d2)\n                );\n                dotProd += dot(xValues, wValues);\n              } else if (&quot;+(3===d)+&quot;) {\n                vec3 xValues = vec3(\n                  getX(batch, xF, xR, xC, &quot;+h+&quot;),\n                  getX(batch, xF, xR, xC, &quot;+h+&quot; + 1),\n                  getX(batch, xF, xR, xC, &quot;+h+&quot; + 2)\n                );\n                vec3 wValues = vec3(\n                  getW(wF, wR, wC, &quot;+h+&quot;, d2),\n                  getW(wF, wR, wC, &quot;+h+&quot; + 1, d2),\n                  getW(wF, wR, wC, &quot;+h+&quot; + 2, d2)\n                );\n                dotProd += dot(xValues, wValues);\n              }\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.Conv3DProgram=i},{}],77:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t){this.variableNames=[&quot;x&quot;,&quot;W&quot;],this.outputShape=t.outShape;var e=t.inHeight,n=t.inWidth,r=t.padInfo.top,i=t.padInfo.left,o=t.strideHeight,a=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,l=t.filterHeight,c=t.filterWidth,f=t.outChannels/t.inChannels;this.userCode=&quot;\n      const ivec2 strides = ivec2(&quot;+o+&quot;, &quot;+a+&quot;);\n      const ivec2 pads = ivec2(&quot;+r+&quot;, &quot;+i+&quot;);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords.x;\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int d2 = coords.w;\n        int d1 = d2 / &quot;+f+&quot;;\n        int q = d2 - d1 * &quot;+f+&quot;;\n\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        // TODO(dsmilkov): Flatten the two for loops and vec4 the operations.\n        for (int wR = 0; wR &lt; &quot;+l+&quot;; wR++) {\n          int xR = xRCorner + wR * &quot;+s+&quot;;\n\n          if (xR &lt; 0 || xR &gt;= &quot;+e+&quot;) {\n            continue;\n          }\n\n          for (int wC = 0; wC &lt; &quot;+c+&quot;; wC++) {\n            int xC = xCCorner + wC * &quot;+u+&quot;;\n\n            if (xC &lt; 0 || xC &gt;= &quot;+n+&quot;) {\n              continue;\n            }\n\n            float xVal = getX(batch, xR, xC, d1);\n            float wVal = getW(wR, wC, d1, q);\n            dotProd += xVal * wVal;\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.DepthwiseConv2DProgram=r},{}],78:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../util&quot;),i=function(){return function(t){this.variableNames=[&quot;x&quot;,&quot;W&quot;],this.usesPackedTextures=!0,this.outputShape=t.outShape;for(var e=t.inHeight,n=t.inWidth,i=t.padInfo.top,o=t.padInfo.left,a=t.strideHeight,s=t.strideWidth,u=t.dilationHeight,l=t.dilationWidth,c=t.filterHeight,f=t.filterWidth,p=f,h=&quot;int xR; int xC; int xCOffset;&quot;,d=0;d&lt;c;d++)for(var m=0;m&lt;f;m++)h+=&quot;\n          vec4 xTexelR&quot;+d+&quot;C&quot;+2*m+&quot; = vec4(0.);\n          vec4 wR&quot;+d+&quot;C&quot;+m+&quot; = vec4(0.);\n          vec4 xR&quot;+d+&quot;C&quot;+m+&quot; = vec4(0.);&quot;;for(d=0;d&lt;c;d++)for(var g=0;g&lt;p;g++){if(h+=&quot;\n          xR = xRCorner + &quot;+d*u+&quot;;\n          xC = xCCorner + &quot;+(m=2*g)*l+&quot;;\n        &quot;,1===s){if(m&lt;f&amp;&amp;(h+=o%2==1?&quot;\n                xCOffset = xC + 1;\n                if(xR &gt;= 0 &amp;&amp; xR &lt; &quot;+e+&quot; &amp;&amp; xCOffset &gt;= 0 &amp;&amp; xCOffset &lt; &quot;+n+&quot;) {\n                  xTexelR&quot;+d+&quot;C&quot;+m+&quot; = getX(batch, xR, xCOffset, d1);\n                } else {\n                  xTexelR&quot;+d+&quot;C&quot;+m+&quot; = vec4(0.);\n                }\n\n                xCOffset = xC + 1 - 2;\n                if(xR &gt;= 0 &amp;&amp; xR &lt; &quot;+e+&quot; &amp;&amp; xCOffset &gt;= 0 &amp;&amp; xCOffset &lt; &quot;+n+&quot;) {\n                  vec4 previous = getX(batch, xR, xCOffset, d1);\n                  xR&quot;+d+&quot;C&quot;+m+&quot; = vec4(previous.zw, xTexelR&quot;+d+&quot;C&quot;+m+&quot;.xy);\n                } else {\n                  xR&quot;+d+&quot;C&quot;+m+&quot; = vec4(0, 0, xTexelR&quot;+d+&quot;C&quot;+m+&quot;.xy);\n                }\n              &quot;:&quot;\n                if(xR &gt;= 0 &amp;&amp; xR &lt; &quot;+e+&quot; &amp;&amp; xC &gt;= 0 &amp;&amp; xC &lt; &quot;+n+&quot;) {\n                  xTexelR&quot;+d+&quot;C&quot;+m+&quot; = getX(batch, xR, xC, d1);\n                } else {\n                  xTexelR&quot;+d+&quot;C&quot;+m+&quot; = vec4(0.);\n                }\n\n                xR&quot;+d+&quot;C&quot;+m+&quot; = xTexelR&quot;+d+&quot;C&quot;+m+&quot;;\n              &quot;,m+1&lt;f)){var v=o%2==0?r.nearestLargerEven(l):l;l%2==0&amp;&amp;o%2==1||l%2!=0&amp;&amp;o%2!=1?(h+=&quot;\n                  xCOffset = xC + &quot;+o%2+&quot; + &quot;+v+&quot;;\n\n                  if(xR &gt;= 0 &amp;&amp; xR &lt; &quot;+e+&quot; &amp;&amp;\n                    xCOffset &gt;= 0 &amp;&amp; xCOffset &lt; &quot;+n+&quot;) {\n                    xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot; = getX(batch, xR, xCOffset, d1);\n                  }\n                &quot;,l&gt;1&amp;&amp;(h+=&quot;\n                    xCOffset -= 2;\n                    if(xR &gt;= 0 &amp;&amp; xR &lt; &quot;+e+&quot; &amp;&amp;\n                      xCOffset &gt;= 0 &amp;&amp; xCOffset &lt; &quot;+n+&quot;) {\n                      xTexelR&quot;+d+&quot;C&quot;+m+&quot; = getX(batch, xR, xCOffset, d1);\n                    } else {\n                      xTexelR&quot;+d+&quot;C&quot;+m+&quot; = vec4(0.);\n                    }\n                  &quot;),h+=&quot;\n                  xR&quot;+d+&quot;C&quot;+(m+1)+&quot; = vec4(\n                    xTexelR&quot;+d+&quot;C&quot;+m+&quot;.zw, xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot;.xy);\n                &quot;):h+=&quot;\n                  xCOffset = xC + &quot;+v+&quot;;\n\n                  if(xR &gt;= 0 &amp;&amp; xR &lt; &quot;+e+&quot; &amp;&amp;\n                    xCOffset &gt;= 0 &amp;&amp; xCOffset &lt; &quot;+n+&quot;) {\n                    xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot; = getX(batch, xR, xCOffset, d1);\n                  }\n\n                  xR&quot;+d+&quot;C&quot;+(m+1)+&quot; = xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot;;\n                &quot;}}else m&lt;f&amp;&amp;(h+=&quot;\n              if(xR &gt;= 0 &amp;&amp; xR &lt; &quot;+e+&quot;) {\n            &quot;,o%2==1?(h+=&quot;\n                xCOffset = xC + 1 - &quot;+s+&quot;;\n                if(xCOffset &gt;= 0 &amp;&amp; xCOffset &lt; &quot;+n+&quot;) {\n                  xTexelR&quot;+d+&quot;C&quot;+m+&quot; = getX(batch, xR, xCOffset, d1);\n                } else {\n                  xTexelR&quot;+d+&quot;C&quot;+m+&quot; = vec4(0.);\n                }\n\n                if(xC + 1 &gt;= 0 &amp;&amp; xC + 1 &lt; &quot;+n+&quot;) {\n                  xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot; = getX(batch, xR, xC + 1, d1);\n                } else {\n                  xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot; = vec4(0.);\n                }\n\n                xR&quot;+d+&quot;C&quot;+m+&quot; = vec4(\n                  xTexelR&quot;+d+&quot;C&quot;+m+&quot;.zw, xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot;.zw);\n              &quot;,m+1&lt;f&amp;&amp;(h+=&quot;\n                  vec4 final = vec4(0.);\n                  xCOffset = xC + 1 + &quot;+s+&quot;;\n                  if(xCOffset &gt;= 0 &amp;&amp; xCOffset &lt; &quot;+n+&quot;) {\n                    final = getX(batch, xR, xCOffset, d1);\n                  }\n                  xR&quot;+d+&quot;C&quot;+(m+1)+&quot; = vec4(xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot;.xy, final.xy);\n                &quot;)):(h+=&quot;\n                if(xC &gt;= 0 &amp;&amp; xC &lt; &quot;+n+&quot;) {\n                  xTexelR&quot;+d+&quot;C&quot;+m+&quot; = getX(batch, xR, xC, d1);\n                } else {\n                  xTexelR&quot;+d+&quot;C&quot;+m+&quot; = vec4(0.);\n                }\n\n                xCOffset = xC + &quot;+s+&quot;;\n                if(xCOffset &gt;= 0 &amp;&amp; xCOffset &lt; &quot;+n+&quot;) {\n                  xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot; = getX(batch, xR, xCOffset, d1);\n                } else {\n                  xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot; = vec4(0.);\n                }\n\n                xR&quot;+d+&quot;C&quot;+m+&quot; = vec4(\n                  xTexelR&quot;+d+&quot;C&quot;+m+&quot;.xy, xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot;.xy);\n              &quot;,m+1&lt;f&amp;&amp;(h+=&quot;\n                  xR&quot;+d+&quot;C&quot;+(m+1)+&quot; = vec4(\n                    xTexelR&quot;+d+&quot;C&quot;+m+&quot;.zw, xTexelR&quot;+d+&quot;C&quot;+(m+2)+&quot;.zw);\n                &quot;)),h+=&quot;}&quot;);m&lt;f&amp;&amp;(h+=&quot;\n            vec4 wTexelR&quot;+d+&quot;C&quot;+m+&quot; = getW(&quot;+d+&quot;, &quot;+m+&quot;, d1, q);\n            wR&quot;+d+&quot;C&quot;+m+&quot; = vec4(wTexelR&quot;+d+&quot;C&quot;+m+&quot;.xz, wTexelR&quot;+d+&quot;C&quot;+m+&quot;.xz);\n          &quot;,m+1&lt;f&amp;&amp;(h+=&quot;\n              vec4 wTexelR&quot;+d+&quot;C&quot;+(m+1)+&quot; = getW(&quot;+d+&quot;, &quot;+(m+1)+&quot;, d1, q);\n              wR&quot;+d+&quot;C&quot;+(m+1)+&quot; =\n                vec4(wTexelR&quot;+d+&quot;C&quot;+(m+1)+&quot;.xz, wTexelR&quot;+d+&quot;C&quot;+(m+1)+&quot;.xz);&quot;))}for(d=0;d&lt;c;d++)for(m=0;m&lt;f;m++)h+=&quot;result += xR&quot;+d+&quot;C&quot;+m+&quot; * wR&quot;+d+&quot;C&quot;+m+&quot;;&quot;;this.userCode=&quot;\n      const ivec2 strides = ivec2(&quot;+a+&quot;, &quot;+s+&quot;);\n      const ivec2 pads = ivec2(&quot;+i+&quot;, &quot;+o+&quot;);\n\n      void main() {\n\n        ivec4 coords = getOutputCoords();\n        int batch = coords.x;\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int d2 = coords.w;\n        int d1 = d2;\n        int q = 0;\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        vec4 result = vec4(0.);\n\n        &quot;+h+&quot;\n\n        setOutput(result);\n      }\n    &quot;}}();n.DepthwiseConvPacked2DProgram=i},{&quot;../../util&quot;:223}],79:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n,r,i){this.variableNames=[&quot;Image&quot;,&quot;Boxes&quot;,&quot;BoxInd&quot;],this.outputShape=[];var o=t[0],a=t[1],s=t[2],u=t[3],l=e[0],c=n[0],f=n[1];this.outputShape=[l,c,f,u];var p=&quot;bilinear&quot;===r?1:0,h=[a-1+&quot;.0&quot;,s-1+&quot;.0&quot;],d=h[0],m=h[1],g=c&gt;1?[&quot;&quot;+(a-1)/(c-1),&quot;(y2-y1) * height_ratio&quot;,&quot;y1*&quot;+d+&quot; + float(y)*(height_scale)&quot;]:[&quot;0.0&quot;,&quot;0.0&quot;,&quot;0.5 * (y1+y2) * &quot;+d],v=g[0],y=g[1],b=g[2],_=f&gt;1?[&quot;&quot;+(s-1)/(f-1),&quot;(x2-x1) * width_ratio&quot;,&quot;x1*&quot;+m+&quot; + float(x)*(width_scale)&quot;]:[&quot;0.0&quot;,&quot;0.0&quot;,&quot;0.5 * (x1+x2) * &quot;+m],w=_[0],x=_[1],E=_[2];this.userCode=&quot;\n      const float height_ratio = float(&quot;+v+&quot;);\n      const float width_ratio = float(&quot;+w+&quot;);\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int y = coords[1];\n        int x = coords[2];\n        int d = coords[3];\n\n        // get box vals\n        float y1 = getBoxes(b,0);\n        float x1 = getBoxes(b,1);\n        float y2 = getBoxes(b,2);\n        float x2 = getBoxes(b,3);\n\n        // get image in batch index\n        int bInd = round(getBoxInd(b));\n        if(bInd &lt; 0 || bInd &gt;= &quot;+o+&quot;) {\n          return;\n        }\n\n        float height_scale = &quot;+y+&quot;;\n        float width_scale = &quot;+x+&quot;;\n\n        float in_y = &quot;+b+&quot;;\n        if( in_y &lt; 0.0 || in_y &gt; &quot;+d+&quot; ) {\n          setOutput(float(&quot;+i+&quot;));\n          return;\n        }\n        float in_x = &quot;+E+&quot;;\n        if( in_x &lt; 0.0 || in_x &gt; &quot;+m+&quot; ) {\n          setOutput(float(&quot;+i+&quot;));\n          return;\n        }\n\n        vec2 sourceFracIndexCR = vec2(in_x,in_y);\n        if(&quot;+p+&quot; == 1) {\n          // Compute the four integer indices.\n          ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n          ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n          float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n          float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n          float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n          float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n          vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n          float top = topLeft + (topRight - topLeft) * fracCR.x;\n          float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n          float newValue = top + (bottom - top) * fracCR.y;\n          setOutput(newValue);\n        } else {\n          // Compute the coordinators of nearest neighbor point.\n          ivec2 sourceNearestCR = ivec2(floor(\n            sourceFracIndexCR + vec2(0.5,0.5)));\n          float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n          setOutput(newValue);\n        }\n      }\n    &quot;}}();n.CropAndResizeProgram=r},{}],80:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){return function(t,e,n){this.variableNames=[&quot;x&quot;],this.outputShape=t;var i=t.length,a=t[t.length-1],s=n?&quot;&lt;&quot;:&quot;&gt;&quot;;this.userCode=&quot;\n      int getIndex(int i) {\n        &quot;+(n?&quot;return &quot;+a+&quot; -i - 1;&quot;:&quot;return i;&quot;)+&quot;\n      }\n\n      void main() {\n        &quot;+r.getCoordsDataType(i)+&quot; coords = getOutputCoords();\n        int end = &quot;+o(i,&quot;coords&quot;)+&quot;;\n        float val = 0.0;\n        for (int i = &quot;+a+&quot; - 1; i &gt;= 0; i -= 1) {\n          int idx = getIndex(i);\n          if (idx &quot;+s+&quot; end) {\n            continue;\n          }\n          if (idx == end &amp;&amp; &quot;+e+&quot;) {\n            continue;\n          }\n          &quot;+o(i,&quot;coords&quot;)+&quot; = idx;\n          val += getX(&quot;+function(t,e){if(1===t)return&quot;&quot;+e;if(2===t)return e+&quot;.x, &quot;+e+&quot;.y&quot;;if(3===t)return e+&quot;.x, &quot;+e+&quot;.y, &quot;+e+&quot;.z&quot;;if(4===t)return e+&quot;.x, &quot;+e+&quot;.y, &quot;+e+&quot;.z, &quot;+e+&quot;.w&quot;;throw Error(&quot;Cumulative sum for rank &quot;+t+&quot; is not yet supported&quot;)}(i,&quot;coords&quot;)+&quot;);\n        }\n        setOutput(val);\n      }\n    &quot;}}();function o(t,e){if(1===t)return&quot;&quot;+e;if(2===t)return e+&quot;.y&quot;;if(3===t)return e+&quot;.z&quot;;if(4===t)return e+&quot;.w&quot;;throw Error(&quot;Cumulative sum for rank &quot;+t+&quot; is not yet supported&quot;)}n.CumSumProgram=i},{&quot;./shader_compiler&quot;:116}],81:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){function t(t,e,n){this.variableNames=[&quot;x&quot;],this.outputShape=[],this.outputShape=t,this.blockSize=e,this.dataFormat=n,this.userCode=&quot;\n    void main() {\n      ivec4 coords = getOutputCoords();\n      int b = coords[0];\n      int h = &quot;+this.getHeightCoordString()+&quot;;\n      int w = &quot;+this.getWidthCoordString()+&quot;;\n      int d = &quot;+this.getDepthCoordString()+&quot;;\n\n      int in_h = h / &quot;+e+&quot;;\n      int offset_h = imod(h, &quot;+e+&quot;);\n      int in_w = w / &quot;+e+&quot;;\n      int offset_w = imod(w, &quot;+e+&quot;);\n      int offset_d = (offset_h * &quot;+e+&quot; + offset_w) *\n        &quot;+this.getOutputDepthSize()+&quot;;\n      int in_d = d + offset_d;\n\n      float result = &quot;+this.getInputSamplingString()+&quot;;\n      setOutput(result);\n    }\n  &quot;}return t.prototype.getHeightCoordString=function(){return&quot;NHWC&quot;===this.dataFormat?&quot;coords[1]&quot;:&quot;coords[2]&quot;},t.prototype.getWidthCoordString=function(){return&quot;NHWC&quot;===this.dataFormat?&quot;coords[2]&quot;:&quot;coords[3]&quot;},t.prototype.getDepthCoordString=function(){return&quot;NHWC&quot;===this.dataFormat?&quot;coords[3]&quot;:&quot;coords[1]&quot;},t.prototype.getOutputDepthSize=function(){return&quot;NHWC&quot;===this.dataFormat?this.outputShape[3]:this.outputShape[1]},t.prototype.getInputSamplingString=function(){return&quot;NHWC&quot;===this.dataFormat?&quot;getX(b, in_h, in_w, in_d)&quot;:&quot;getX(b, in_d, in_h, in_w)&quot;},t}();n.DepthToSpaceProgram=r},{}],82:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./glsl_version&quot;),i=function(){return function(t){this.variableNames=[&quot;A&quot;];var e=r.getGlslDifferences();this.outputShape=t,this.userCode=&quot;\n      const float FLOAT_MAX = 1.70141184e38;\n      const float FLOAT_MIN = 1.17549435e-38;\n\n      lowp vec4 encode_float(highp float v) {\n        if (isnan(v)) {\n          return vec4(255, 255, 255, 255);\n        }\n\n        highp float av = abs(v);\n\n        if(av &lt; FLOAT_MIN) {\n          return vec4(0.0, 0.0, 0.0, 0.0);\n        } else if(v &gt; FLOAT_MAX) {\n          return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n        } else if(v &lt; -FLOAT_MAX) {\n          return vec4(0.0, 0.0,  128.0, 255.0) / 255.0;\n        }\n\n        highp vec4 c = vec4(0,0,0,0);\n\n        highp float e = floor(log2(av));\n        highp float m = exp2(fract(log2(av))) - 1.0;\n\n        c[2] = floor(128.0 * m);\n        m -= c[2] / 128.0;\n        c[1] = floor(32768.0 * m);\n        m -= c[1] / 32768.0;\n        c[0] = floor(8388608.0 * m);\n\n        highp float ebias = e + 127.0;\n        c[3] = floor(ebias / 2.0);\n        ebias -= c[3] * 2.0;\n        c[2] += floor(ebias) * 128.0;\n\n        c[3] += 128.0 * step(0.0, -v);\n\n        return c / 255.0;\n      }\n\n      void main() {\n        float x = getAAtOutCoords();\n        &quot;+e.output+&quot; = encode_float(x);\n      }\n    &quot;}}();n.EncodeFloatProgram=i},{&quot;./glsl_version&quot;:89}],83:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.COMPLEX_FFT={REAL:&quot;return real * expR - imag * expI;&quot;,IMAG:&quot;return real * expI + imag * expR;&quot;};var r=function(){return function(t,e,n){this.variableNames=[&quot;real&quot;,&quot;imag&quot;];var r=e[1];this.outputShape=e;var i=n?&quot;2.0 * &quot;+Math.PI:&quot;-2.0 * &quot;+Math.PI,o=n?r+&quot;.0&quot;:&quot;1.0&quot;;this.userCode=&quot;\n      const float exponentMultiplier = &quot;+i+&quot;;\n\n      float unaryOpComplex(float real, float expR, float imag, float expI) {\n        &quot;+t+&quot;\n      }\n\n      float mulMatDFT(int batch, int index) {\n        float indexRatio = float(index) / float(&quot;+r+&quot;);\n        float exponentMultiplierTimesIndexRatio =\n            exponentMultiplier * indexRatio;\n\n        float result = 0.0;\n\n        for (int i = 0; i &lt; &quot;+r+&quot;; i++) {\n          // x = (-2|2 * PI / N) * index * i;\n          float x = exponentMultiplierTimesIndexRatio * float(i);\n          float expR = cos(x);\n          float expI = sin(x);\n          float real = getReal(batch, i);\n          float imag = getImag(batch, i);\n\n          result +=\n              unaryOpComplex(real, expR, imag, expI) / &quot;+o+&quot;;\n        }\n\n        return result;\n      }\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        setOutput(mulMatDFT(coords[0], coords[1]));\n      }\n    &quot;}}();n.FFTProgram=r},{}],84:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){function t(t,e){this.outputShape=[],this.variableNames=[&quot;x&quot;],this.outputShape=t,this.userCode=&quot;\n      uniform float value;\n      void main() {\n        // Input can be obtained from uniform value.\n        setOutput(value);\n      }\n    &quot;}return t.prototype.getCustomSetupFunc=function(t){var e=this;return function(n,r){null==e.valueLoc&amp;&amp;(e.valueLoc=n.getUniformLocationNoThrow(r,&quot;value&quot;)),n.gl.uniform1f(e.valueLoc,t)}},t}();n.FillProgram=r},{}],85:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../device_util&quot;),i=t(&quot;../../environment&quot;),o=t(&quot;./webgl_util&quot;);i.ENV.registerFlag(&quot;HAS_WEBGL&quot;,function(){return i.ENV.getNumber(&quot;WEBGL_VERSION&quot;)&gt;0}),i.ENV.registerFlag(&quot;WEBGL_VERSION&quot;,function(){return o.isWebGLVersionEnabled(2)?2:o.isWebGLVersionEnabled(1)?1:0}),i.ENV.registerFlag(&quot;WEBGL_CPU_FORWARD&quot;,function(){return!1}),i.ENV.registerFlag(&quot;WEBGL_PACK&quot;,function(){return i.ENV.getBool(&quot;HAS_WEBGL&quot;)}),i.ENV.registerFlag(&quot;WEBGL_PACK_BATCHNORMALIZATION&quot;,function(){return i.ENV.getBool(&quot;WEBGL_PACK&quot;)}),i.ENV.registerFlag(&quot;WEBGL_PACK_CLIP&quot;,function(){return i.ENV.getBool(&quot;WEBGL_PACK&quot;)}),i.ENV.registerFlag(&quot;WEBGL_PACK_DEPTHWISECONV&quot;,function(){return i.ENV.getBool(&quot;WEBGL_PACK&quot;)}),i.ENV.registerFlag(&quot;WEBGL_PACK_BINARY_OPERATIONS&quot;,function(){return i.ENV.getBool(&quot;WEBGL_PACK&quot;)}),i.ENV.registerFlag(&quot;WEBGL_PACK_ARRAY_OPERATIONS&quot;,function(){return i.ENV.getBool(&quot;WEBGL_PACK&quot;)}),i.ENV.registerFlag(&quot;WEBGL_PACK_IMAGE_OPERATIONS&quot;,function(){return i.ENV.getBool(&quot;WEBGL_PACK&quot;)}),i.ENV.registerFlag(&quot;WEBGL_PACK_REDUCE&quot;,function(){return i.ENV.getBool(&quot;WEBGL_PACK&quot;)}),i.ENV.registerFlag(&quot;WEBGL_LAZILY_UNPACK&quot;,function(){return i.ENV.getBool(&quot;WEBGL_PACK&quot;)}),i.ENV.registerFlag(&quot;WEBGL_CONV_IM2COL&quot;,function(){return i.ENV.getBool(&quot;WEBGL_PACK&quot;)}),i.ENV.registerFlag(&quot;WEBGL_MAX_TEXTURE_SIZE&quot;,function(){return o.getWebGLMaxTextureSize(i.ENV.getNumber(&quot;WEBGL_VERSION&quot;))}),i.ENV.registerFlag(&quot;WEBGL_MAX_TEXTURES_IN_SHADER&quot;,function(){return o.getMaxTexturesInShader(i.ENV.getNumber(&quot;WEBGL_VERSION&quot;))}),i.ENV.registerFlag(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;,function(){var t=i.ENV.getNumber(&quot;WEBGL_VERSION&quot;);return 0===t?0:o.getWebGLDisjointQueryTimerVersion(t)}),i.ENV.registerFlag(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE&quot;,function(){return i.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;)&gt;0&amp;&amp;!r.isMobile()}),i.ENV.registerFlag(&quot;WEBGL_RENDER_FLOAT32_ENABLED&quot;,function(){return o.isRenderToFloatTextureEnabled(i.ENV.getNumber(&quot;WEBGL_VERSION&quot;))}),i.ENV.registerFlag(&quot;WEBGL_DOWNLOAD_FLOAT_ENABLED&quot;,function(){return o.isDownloadFloatTextureEnabled(i.ENV.getNumber(&quot;WEBGL_VERSION&quot;))}),i.ENV.registerFlag(&quot;WEBGL_FENCE_API_ENABLED&quot;,function(){return o.isWebGLFenceEnabled(i.ENV.getNumber(&quot;WEBGL_VERSION&quot;))}),i.ENV.registerFlag(&quot;WEBGL_SIZE_UPLOAD_UNIFORM&quot;,function(){return i.ENV.getBool(&quot;WEBGL_RENDER_FLOAT32_ENABLED&quot;)?4:0})},{&quot;../../device_util&quot;:132,&quot;../../environment&quot;:134,&quot;./webgl_util&quot;:129}],86:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./glsl_version&quot;),i=function(){return function(t){this.variableNames=[&quot;A&quot;];var e=r.getGlslDifferences(),n=t[0],i=t[1];this.outputShape=t,this.userCode=&quot;\n      void main() {\n        ivec3 coords = getOutputCoords();\n        int texR = coords[0];\n        int texC = coords[1];\n        int depth = coords[2];\n        vec2 uv = (vec2(texC, texR) + halfCR) / vec2(&quot;+i+&quot;.0, &quot;+n+&quot;.0);\n\n        vec4 values = &quot;+e.texture2D+&quot;(A, uv);\n        float value;\n        if (depth == 0) {\n          value = values.r;\n        } else if (depth == 1) {\n          value = values.g;\n        } else if (depth == 2) {\n          value = values.b;\n        } else if (depth == 3) {\n          value = values.a;\n        }\n\n        setOutput(floor(value * 255.0 + 0.5));\n      }\n    &quot;}}();n.FromPixelsProgram=i},{&quot;./glsl_version&quot;:89}],87:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){return function(t,e,n){this.variableNames=[&quot;A&quot;,&quot;indices&quot;];var i=t.slice();i[n]=e,this.outputShape=i,this.rank=i.length;var o=r.getCoordsDataType(this.rank),a=function(t,e){var n=t.length;if(n&gt;4)throw Error(&quot;Gather for rank &quot;+n+&quot; is not yet supported&quot;);if(1===n)return&quot;int(getIndices(resRC))&quot;;for(var r=[&quot;resRC.x&quot;,&quot;resRC.y&quot;,&quot;resRC.z&quot;,&quot;resRC.w&quot;],i=[],o=0;o&lt;t.length;o++)o===e?i.push(&quot;int(getIndices(&quot;+r[o]+&quot;))&quot;):i.push(&quot;&quot;+r[o]);return i.join()}(t,n);this.userCode=&quot;\n      void main() {\n        &quot;+o+&quot; resRC = getOutputCoords();\n        setOutput(getA(&quot;+a+&quot;));\n      }\n    &quot;}}();n.GatherProgram=i},{&quot;./shader_compiler&quot;:116}],88:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){return function(t,e,n){this.sliceDim=t,this.strides=e,this.variableNames=[&quot;x&quot;,&quot;indices&quot;],this.outputShape=n;var i=r.getCoordsDataType(e.length),o=r.getCoordsDataType(n.length),a=this.sliceDim&gt;1?&quot;strides[j]&quot;:&quot;strides&quot;;this.userCode=&quot;\n        &quot;+i+&quot; strides = &quot;+i+&quot;(&quot;+this.strides+&quot;);\n         void main() {\n          &quot;+o+&quot; coords = getOutputCoords();\n          int flattenIndex = 0;\n          for (int j = 0; j &lt; &quot;+this.sliceDim+&quot;; j++) {\n            int index = round(getIndices(coords[0], j));\n            flattenIndex += index * &quot;+a+&quot;;\n          }\n          setOutput(getX(flattenIndex, coords[1]));\n        }\n      &quot;}}();n.GatherNDProgram=i},{&quot;./shader_compiler&quot;:116}],89:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../environment&quot;);n.getGlslDifferences=function(){var t,e,n,i,o,a,s,u,l,c;return 2===r.ENV.getNumber(&quot;WEBGL_VERSION&quot;)?(t=&quot;#version 300 es&quot;,e=&quot;in&quot;,n=&quot;out&quot;,i=&quot;in&quot;,o=&quot;texture&quot;,a=&quot;outputColor&quot;,s=&quot;out vec4 outputColor;&quot;,u=&quot;\n      bool isnan_custom(float val) {\n        return (val &gt; 0. || val &lt; 0. || val == 0.) ? false : true;\n      }\n    &quot;,l=&quot;\n      const float INFINITY = uintBitsToFloat(uint(0x7f800000));\n    &quot;,c=&quot;\n      #define round(value) newRound(value)\n      int newRound(float value) {\n        return int(floor(value + 0.5));\n      }\n\n      ivec4 newRound(vec4 value) {\n        return ivec4(floor(value + vec4(0.5)));\n      }\n    &quot;):(t=&quot;&quot;,e=&quot;attribute&quot;,n=&quot;varying&quot;,i=&quot;varying&quot;,o=&quot;texture2D&quot;,a=&quot;gl_FragColor&quot;,s=&quot;&quot;,u=&quot;\n      bool isnan_custom(float val) {\n        return (val &gt; 0. || val &lt; 1. || val == 0.) ? false : true;\n      }\n    &quot;,l=&quot;\n      uniform float INFINITY;\n\n      bool isinf(float val) {\n        return abs(val) == INFINITY;\n      }\n      bvec4 isinf(vec4 val) {\n        return equal(abs(val), vec4(INFINITY));\n      }\n    &quot;,c=&quot;\n      int round(float value) {\n        return int(floor(value + 0.5));\n      }\n\n      ivec4 round(vec4 value) {\n        return ivec4(floor(value + vec4(0.5)));\n      }\n    &quot;),{version:t,attribute:e,varyingVs:n,varyingFs:i,texture2D:o,output:a,defineOutput:s,defineSpecialNaN:u,defineSpecialInf:l,defineRound:c}}},{&quot;../../environment&quot;:134}],90:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../../environment&quot;),a=t(&quot;../../util&quot;),s=t(&quot;./canvas_util&quot;),u=t(&quot;./gpgpu_util&quot;),l=t(&quot;./tex_util&quot;),c=t(&quot;./webgl_util&quot;),f=function(){function t(t){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];var e=o.ENV.getNumber(&quot;WEBGL_VERSION&quot;);null!=t?(this.gl=t,s.setWebGLContext(e,t)):this.gl=s.getWebGLContext(e),1===o.ENV.getNumber(&quot;WEBGL_VERSION&quot;)?(this.textureFloatExtension=c.getExtensionOrThrow(this.gl,this.debug,&quot;OES_texture_float&quot;),this.colorBufferFloatExtension=this.gl.getExtension(&quot;WEBGL_color_buffer_float&quot;),o.ENV.getBool(&quot;WEBGL_RENDER_FLOAT32_ENABLED&quot;)||(this.textureHalfFloatExtension=c.getExtensionOrThrow(this.gl,this.debug,&quot;OES_texture_half_float&quot;),this.colorBufferHalfFloatExtension=this.gl.getExtension(&quot;EXT_color_buffer_half_float&quot;))):this.colorBufferFloatExtension=c.getExtensionOrThrow(this.gl,this.debug,&quot;EXT_color_buffer_float&quot;),this.vertexBuffer=u.createVertexBuffer(this.gl,this.debug),this.indexBuffer=u.createIndexBuffer(this.gl,this.debug),this.framebuffer=c.createFramebuffer(this.gl,this.debug),this.textureConfig=u.getTextureConfig(this.gl,this.textureHalfFloatExtension)}return Object.defineProperty(t.prototype,&quot;debug&quot;,{get:function(){return o.ENV.getBool(&quot;DEBUG&quot;)},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){var t=this;if(!this.disposed){null!=this.program&amp;&amp;console.warn(&quot;Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing.&quot;),null!=this.outputTexture&amp;&amp;console.warn(&quot;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.&quot;);var e=this.gl;c.callAndCheck(e,this.debug,function(){return e.finish()}),c.callAndCheck(e,this.debug,function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)}),c.callAndCheck(e,this.debug,function(){return e.deleteFramebuffer(t.framebuffer)}),c.callAndCheck(e,this.debug,function(){return e.bindBuffer(e.ARRAY_BUFFER,null)}),c.callAndCheck(e,this.debug,function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}),c.callAndCheck(e,this.debug,function(){return e.deleteBuffer(t.indexBuffer)}),this.disposed=!0}},t.prototype.createFloat32MatrixTexture=function(t,e){return this.throwIfDisposed(),u.createFloat32MatrixTexture(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createFloat16MatrixTexture=function(t,e){return this.throwIfDisposed(),u.createFloat16MatrixTexture(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createUnsignedBytesMatrixTexture=function(t,e){return this.throwIfDisposed(),u.createUnsignedBytesMatrixTexture(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.uploadPixelDataToTexture=function(t,e){this.throwIfDisposed(),u.uploadPixelDataToTexture(this.gl,this.debug,t,e)},t.prototype.createFloat16PackedMatrixTexture=function(t,e){return this.throwIfDisposed(),u.createFloat16PackedMatrixTexture(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createPackedMatrixTexture=function(t,e){return this.throwIfDisposed(),u.createPackedMatrixTexture(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.deleteMatrixTexture=function(t){var e=this;this.throwIfDisposed(),this.outputTexture===t&amp;&amp;(c.unbindColorTextureFromFramebuffer(this.gl,this.debug,this.framebuffer),this.outputTexture=null),c.callAndCheck(this.gl,this.debug,function(){return e.gl.deleteTexture(t)})},t.prototype.uploadMatrixToTexture=function(t,e,n,r){this.throwIfDisposed();var i=c.getNumChannels();return u.uploadMatrixToTexture(this.gl,this.debug,t,e,n,r,i,this.textureConfig)},t.prototype.uploadMatrixToPackedTexture=function(t,e,n,r,i,o,a){return this.throwIfDisposed(),u.uploadMatrixToPackedTexture(this.gl,this.debug,t,e,n,r,i,o,a,this.textureConfig)},t.prototype.downloadFloat32MatrixFromOutputTexture=function(t,e,n){var r=this;return this.downloadMatrixDriver(t,function(){return u.downloadFloat32MatrixFromOutputTexture(r.gl,r.debug,e,n,r.textureConfig)})},t.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(t,e,n){var r=this;return this.downloadMatrixDriver(t,function(){return u.downloadByteEncodedFloatMatrixFromOutputTexture(r.gl,r.debug,e,n,r.textureConfig)})},t.prototype.downloadPackedMatrixFromBuffer=function(t,e,n,r,i,o){return u.downloadPackedMatrixFromBuffer(this.gl,t,e,n,r,i,o,this.textureConfig)},t.prototype.downloadFloat32MatrixFromBuffer=function(t,e,n){return u.downloadFloat32MatrixFromBuffer(this.gl,t,e,n,this.textureConfig)},t.prototype.maybeCreateBufferFromTexture=function(t,e,n){this.bindTextureToFrameBuffer(t);var r=u.maybeCreateBufferFromOutputTexture(this.gl,this.debug,t,e,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r},t.prototype.createAndWaitForFence=function(){var t=this.createFence(this.gl);return this.pollFence(t)},t.prototype.createFence=function(t){var e,n,r=this;if(o.ENV.getBool(&quot;WEBGL_FENCE_API_ENABLED&quot;)){var i=t,a=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);t.flush(),n=function(){var t=i.clientWaitSync(a,0,0);return t===i.ALREADY_SIGNALED||t===i.CONDITION_SATISFIED},e=a}else o.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;)&gt;0?(e=this.beginQuery(),this.endQuery(),n=function(){return r.isQueryAvailable(e,o.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;))}):n=function(){return!0};return{query:e,isFencePassed:n}},t.prototype.downloadMatrixFromPackedTexture=function(t,e,n,r,i,o){var a=this;return this.downloadMatrixDriver(t,function(){return u.downloadMatrixFromPackedOutputTexture(a.gl,a.debug,e,n,r,i,o,a.textureConfig)})},t.prototype.createProgram=function(t){this.throwIfDisposed();var e=this.gl,n=c.createFragmentShader(e,this.debug,t),r=u.createVertexShader(e,this.debug),i=c.createProgram(e,this.debug);return c.callAndCheck(e,this.debug,function(){return e.attachShader(i,r)}),c.callAndCheck(e,this.debug,function(){return e.attachShader(i,n)}),c.linkProgram(e,this.debug,i),this.debug&amp;&amp;c.validateProgram(e,this.debug,i),this.vertexAttrsAreBound||(this.setProgram(i),this.vertexAttrsAreBound=u.bindVertexProgramAttributeStreams(e,this.debug,this.program,this.vertexBuffer)),i},t.prototype.deleteProgram=function(t){var e=this;this.throwIfDisposed(),t===this.program&amp;&amp;(this.program=null),null!=t&amp;&amp;c.callAndCheck(this.gl,this.debug,function(){return e.gl.deleteProgram(t)})},t.prototype.setProgram=function(t){var e=this;this.throwIfDisposed(),this.program=t,null!=this.program&amp;&amp;this.debug&amp;&amp;c.validateProgram(this.gl,this.debug,this.program),c.callAndCheck(this.gl,this.debug,function(){return e.gl.useProgram(t)})},t.prototype.getUniformLocation=function(t,e,n){return void 0===n&amp;&amp;(n=!0),this.throwIfDisposed(),n?c.getProgramUniformLocationOrThrow(this.gl,this.debug,t,e):c.getProgramUniformLocation(this.gl,t,e)},t.prototype.getAttributeLocation=function(t,e){var n=this;return this.throwIfDisposed(),c.callAndCheck(this.gl,this.debug,function(){return n.gl.getAttribLocation(t,e)})},t.prototype.getUniformLocationNoThrow=function(t,e){return this.throwIfDisposed(),this.gl.getUniformLocation(t,e)},t.prototype.setInputMatrixTexture=function(t,e,n){this.throwIfDisposed(),this.throwIfNoProgram(),c.bindTextureToProgramUniformSampler(this.gl,this.debug,this.program,t,e,n)},t.prototype.setOutputMatrixTexture=function(t,e,n){this.setOutputMatrixTextureDriver(t,n,e)},t.prototype.setOutputPackedMatrixTexture=function(t,e,n){this.throwIfDisposed();var r=l.getPackedMatrixTextureShapeWidthHeight(e,n),i=r[0],o=r[1];this.setOutputMatrixTextureDriver(t,i,o)},t.prototype.setOutputMatrixWriteRegion=function(t,e,n,r){this.setOutputMatrixWriteRegionDriver(n,t,r,e)},t.prototype.setOutputPackedMatrixWriteRegion=function(t,e,n,r){throw new Error(&quot;setOutputPackedMatrixWriteRegion not implemented.&quot;)},t.prototype.debugValidate=function(){null!=this.program&amp;&amp;c.validateProgram(this.gl,this.debug,this.program),c.validateFramebuffer(this.gl)},t.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var t=this.gl;this.debug&amp;&amp;this.debugValidate(),c.callAndCheck(t,this.debug,function(){return t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0)})},t.prototype.blockUntilAllProgramsCompleted=function(){var t=this;this.throwIfDisposed(),c.callAndCheck(this.gl,this.debug,function(){return t.gl.finish()})},t.prototype.getQueryTimerExtension=function(){return null==this.disjointQueryTimerExtension&amp;&amp;(this.disjointQueryTimerExtension=c.getExtensionOrThrow(this.gl,this.debug,2===o.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;)?&quot;EXT_disjoint_timer_query_webgl2&quot;:&quot;EXT_disjoint_timer_query&quot;)),this.disjointQueryTimerExtension},t.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},t.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},t.prototype.beginQuery=function(){if(2===o.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;)){var t=this.gl,e=this.getQueryTimerExtensionWebGL2(),n=t.createQuery();return t.beginQuery(e.TIME_ELAPSED_EXT,n),n}var r=this.getQueryTimerExtensionWebGL1(),i=r.createQueryEXT();return r.beginQueryEXT(r.TIME_ELAPSED_EXT,i),i},t.prototype.endQuery=function(){if(2!==o.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;)){var t=this.getQueryTimerExtensionWebGL1();t.endQueryEXT(t.TIME_ELAPSED_EXT)}else{var e=this.gl,n=this.getQueryTimerExtensionWebGL2();e.endQuery(n.TIME_ELAPSED_EXT)}},t.prototype.waitForQueryAndGetTime=function(t){return r(this,void 0,void 0,function(){var e=this;return i(this,function(n){switch(n.label){case 0:return[4,a.repeatedTry(function(){return e.disposed||e.isQueryAvailable(t,o.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;))})];case 1:return n.sent(),[2,this.getQueryTime(t,o.ENV.getNumber(&quot;WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION&quot;))]}})})},t.prototype.getQueryTime=function(t,e){if(0===e)return null;if(2===e){var n=this.gl;return n.getQueryParameter(t,n.QUERY_RESULT)/1e6}var r=this.getQueryTimerExtensionWebGL1();return r.getQueryObjectEXT(t,r.QUERY_RESULT_EXT)/1e6},t.prototype.isQueryAvailable=function(t,e){if(0===e)return!0;if(2===e){var n=this.gl,r=this.getQueryTimerExtensionWebGL2(),i=n.getQueryParameter(t,n.QUERY_RESULT_AVAILABLE);return null==this.disjoint&amp;&amp;(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),i&amp;&amp;!this.disjoint}i=(r=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(t,r.QUERY_RESULT_AVAILABLE_EXT);return null==this.disjoint&amp;&amp;(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),i&amp;&amp;!this.disjoint},t.prototype.pollFence=function(t){var e=this;return new Promise(function(n){e.addItemToPoll(function(){return t.isFencePassed()},function(){return n()})})},t.prototype.pollItems=function(){for(var t=p(this.itemsToPoll.map(function(t){return t.isDoneFn})),e=0;e&lt;=t;++e){(0,this.itemsToPoll[e].resolveFn)()}this.itemsToPoll=this.itemsToPoll.slice(t+1)},t.prototype.addItemToPoll=function(t,e){var n=this;this.itemsToPoll.push({isDoneFn:t,resolveFn:e}),this.itemsToPoll.length&gt;1||a.repeatedTry(function(){return n.pollItems(),0===n.itemsToPoll.length})},t.prototype.bindTextureToFrameBuffer=function(t){this.throwIfDisposed(),c.bindColorTextureToFramebuffer(this.gl,this.debug,t,this.framebuffer),this.debug&amp;&amp;c.validateFramebuffer(this.gl)},t.prototype.unbindTextureToFrameBuffer=function(){null!=this.outputTexture?(c.bindColorTextureToFramebuffer(this.gl,this.debug,this.outputTexture,this.framebuffer),this.debug&amp;&amp;c.validateFramebuffer(this.gl)):c.unbindColorTextureFromFramebuffer(this.gl,this.debug,this.framebuffer)},t.prototype.downloadMatrixDriver=function(t,e){this.bindTextureToFrameBuffer(t);var n=e();return this.unbindTextureToFrameBuffer(),n},t.prototype.setOutputMatrixTextureDriver=function(t,e,n){this.throwIfDisposed();var r=this.gl;c.bindColorTextureToFramebuffer(r,this.debug,t,this.framebuffer),this.debug&amp;&amp;c.validateFramebuffer(r),this.outputTexture=t,c.callAndCheck(r,this.debug,function(){return r.viewport(0,0,e,n)}),c.callAndCheck(r,this.debug,function(){return r.scissor(0,0,e,n)})},t.prototype.setOutputMatrixWriteRegionDriver=function(t,e,n,r){var i=this;this.throwIfDisposed(),c.callAndCheck(this.gl,this.debug,function(){return i.gl.scissor(t,e,n,r)})},t.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error(&quot;Attempted to use disposed GPGPUContext.&quot;)},t.prototype.throwIfNoProgram=function(){if(null==this.program)throw new Error(&quot;No GPU program is currently set.&quot;)},t}();function p(t){for(var e=0;e&lt;t.length;++e){if(!t[e]())break}return e-1}n.GPGPUContext=f,n.linearSearchLastTrue=p},{&quot;../../environment&quot;:134,&quot;../../util&quot;:223,&quot;./canvas_util&quot;:68,&quot;./gpgpu_util&quot;:92,&quot;./tex_util&quot;:121,&quot;./webgl_util&quot;:129}],91:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../environment&quot;),i=t(&quot;../../util&quot;),o=t(&quot;./shader_compiler&quot;);function a(t,e){if(t.length!==e.length)throw Error(&quot;Binary was compiled with &quot;+t.length+&quot; inputs, but was executed with &quot;+e.length+&quot; inputs&quot;);t.forEach(function(t,n){var r=t.logicalShape,o=e[n],a=o.shape;if(!i.arraysEqual(r,a))throw Error(&quot;Binary was compiled with different shapes than the current args. Shapes &quot;+r+&quot; and &quot;+a+&quot; must match&quot;);if(!t.isUniform||!o.isUniform){var s=t.texShape,u=o.isUniform?null:o.texData.texShape;if(!i.arraysEqual(s,u))throw Error(&quot;Binary was compiled with different texture shapes than the current args. Shape &quot;+s+&quot; and &quot;+u+&quot; must match&quot;)}})}n.compileProgram=function(t,e,n,i){var a=e.userCode,s=n.map(function(t,n){var r={logicalShape:t.shape,texShape:t.isUniform?null:t.texData.texShape,isUniform:t.isUniform,isPacked:!t.isUniform&amp;&amp;t.texData.isPacked,flatOffset:null};return null!=t.texData&amp;&amp;null!=t.texData.slice&amp;&amp;t.texData.slice.flatOffset&gt;0&amp;&amp;(r.flatOffset=t.texData.slice.flatOffset),{name:e.variableNames[n],shapeInfo:r}}),u=s.map(function(t){return t.shapeInfo}),l={logicalShape:i.shape,texShape:i.texData.texShape,isUniform:!1,isPacked:i.texData.isPacked,flatOffset:null},c=o.makeShader(s,l,a,e.usesPackedTextures),f=t.createProgram(c),p=null,h=t.getUniformLocation(f,&quot;NAN&quot;,!1);1===r.ENV.getNumber(&quot;WEBGL_VERSION&quot;)&amp;&amp;(p=t.getUniformLocation(f,&quot;INFINITY&quot;,!1));for(var d={},m=0;m&lt;e.variableNames.length;m++){var g=e.variableNames[m];d[g]=t.getUniformLocation(f,g,!1),d[&quot;offset&quot;+g]=t.getUniformLocation(f,&quot;offset&quot;+g,!1)}return{program:e,source:c,webGLProgram:f,uniformLocations:d,inShapeInfos:u,outShapeInfo:l,infLoc:p,nanLoc:h}},n.runProgram=function(t,e,n,o,s){a(e.inShapeInfos,n),a([e.outShapeInfo],[o]);var u=o.texData.texture,l=o.texData.texShape;o.texData.isPacked?t.setOutputPackedMatrixTexture(u,l[0],l[1]):t.setOutputMatrixTexture(u,l[0],l[1]),t.setProgram(e.webGLProgram),1===r.ENV.getNumber(&quot;WEBGL_VERSION&quot;)&amp;&amp;null!==e.infLoc&amp;&amp;t.gl.uniform1f(e.infLoc,1/0),null!==e.nanLoc&amp;&amp;t.gl.uniform1f(e.nanLoc,NaN),n.forEach(function(n,r){var o=e.program.variableNames[r],a=e.uniformLocations[o],s=e.uniformLocations[&quot;offset&quot;+o];if(null!=a)if(n.isUniform)if(i.sizeFromShape(n.shape)&lt;2)t.gl.uniform1f(a,n.uniformValues[0]);else{var u=n.uniformValues;u instanceof Float32Array||(u=new Float32Array(u)),t.gl.uniform1fv(a,u)}else null!=n.texData.slice&amp;&amp;null!=s&amp;&amp;t.gl.uniform1i(s,n.texData.slice.flatOffset),t.setInputMatrixTexture(n.texData.texture,a,r)}),null!=s&amp;&amp;s(t,e.webGLProgram),t.executeProgram()},n.makeShaderKey=function(t,e,n){var r=&quot;&quot;;e.concat(n).forEach(function(t){var e=null!=t.texData&amp;&amp;null!=t.texData.slice&amp;&amp;t.texData.slice.flatOffset&gt;0,n=t.isUniform?&quot;uniform&quot;:t.texData.texShape;r+=t.shape+&quot;_&quot;+n+&quot;_&quot;+e});var i=t.userCode,o=t.constructor.name;return o+=&quot;_&quot;+r+&quot;_&quot;+i}},{&quot;../../environment&quot;:134,&quot;../../util&quot;:223,&quot;./shader_compiler&quot;:116}],92:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../environment&quot;),i=t(&quot;../../util&quot;),o=t(&quot;./glsl_version&quot;),a=t(&quot;./tex_util&quot;),s=t(&quot;./webgl_util&quot;);function u(t,e,n,r,i,o,a){s.validateTextureSize(n,r);var u=s.createTexture(t,e),l=t.TEXTURE_2D;return s.callAndCheck(t,e,function(){return t.bindTexture(l,u)}),s.callAndCheck(t,e,function(){return t.texParameteri(l,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE)}),s.callAndCheck(t,e,function(){return t.texParameteri(l,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}),s.callAndCheck(t,e,function(){return t.texParameteri(l,t.TEXTURE_MIN_FILTER,t.NEAREST)}),s.callAndCheck(t,e,function(){return t.texParameteri(l,t.TEXTURE_MAG_FILTER,t.NEAREST)}),s.callAndCheck(t,e,function(){return t.texImage2D(l,0,i,n,r,0,o,a,null)}),s.callAndCheck(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)}),u}function l(t,e,n,r,i,o,a){s.validateTextureSize(r,i),s.callAndCheck(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)}),s.callAndCheck(t,e,function(){return t.texSubImage2D(t.TEXTURE_2D,0,0,0,r,i,a,t.FLOAT,o)}),s.callAndCheck(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})}n.createVertexShader=function(t,e){var n=o.getGlslDifferences(),r=n.version+&quot;\n    precision highp float;\n    &quot;+n.attribute+&quot; vec3 clipSpacePos;\n    &quot;+n.attribute+&quot; vec2 uv;\n    &quot;+n.varyingVs+&quot; vec2 resultUV;\n\n    void main() {\n      gl_Position = vec4(clipSpacePos, 1);\n      resultUV = uv;\n    }&quot;;return s.createVertexShader(t,e,r)},n.createVertexBuffer=function(t,e){var n=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return s.createStaticVertexBuffer(t,e,n)},n.createIndexBuffer=function(t,e){var n=new Uint16Array([0,1,2,2,1,3]);return s.createStaticIndexBuffer(t,e,n)},n.getTextureConfig=function(t,e){var n,i,o,a,s,u,l,c,f=t;return 2===r.ENV.getNumber(&quot;WEBGL_VERSION&quot;)?(n=f.R32F,i=f.R16F,o=f.RGBA16F,a=f.RGBA32F,s=f.RED,u=4,l=1,c=f.HALF_FLOAT):(n=t.RGBA,i=t.RGBA,o=t.RGBA,a=f.RGBA,s=t.RGBA,u=4,l=4,c=null!=e?e.HALF_FLOAT_OES:null),{internalFormatFloat:n,internalFormatHalfFloat:i,internalFormatPackedHalfFloat:o,internalFormatPackedFloat:a,textureFormatFloat:s,downloadTextureFormat:t.RGBA,downloadUnpackNumChannels:u,defaultNumChannels:l,textureTypeHalfFloat:c}},n.createFloat32MatrixTexture=function(t,e,n,r,i){var o=a.getUnpackedMatrixTextureShapeWidthHeight(n,r);return u(t,e,o[0],o[1],i.internalFormatFloat,i.textureFormatFloat,t.FLOAT)},n.createFloat16MatrixTexture=function(t,e,n,r,i){var o=a.getUnpackedMatrixTextureShapeWidthHeight(n,r);return u(t,e,o[0],o[1],i.internalFormatHalfFloat,i.textureFormatFloat,i.textureTypeHalfFloat)},n.createUnsignedBytesMatrixTexture=function(t,e,n,r,i){var o=a.getUnpackedMatrixTextureShapeWidthHeight(n,r);return u(t,e,o[0],o[1],t.RGBA,t.RGBA,t.UNSIGNED_BYTE)},n.createPackedMatrixTexture=function(t,e,n,r,i){var o=a.getPackedMatrixTextureShapeWidthHeight(n,r);return u(t,e,o[0],o[1],i.internalFormatPackedFloat,t.RGBA,t.FLOAT)},n.createFloat16PackedMatrixTexture=function(t,e,n,r,i){var o=a.getPackedMatrixTextureShapeWidthHeight(n,r);return u(t,e,o[0],o[1],i.internalFormatPackedHalfFloat,t.RGBA,i.textureTypeHalfFloat)},n.bindVertexProgramAttributeStreams=function(t,e,n,r){return s.callAndCheck(t,e,function(){return t.bindBuffer(t.ARRAY_BUFFER,r)}),s.bindVertexBufferToProgramAttribute(t,e,n,&quot;clipSpacePos&quot;,r,3,20,0)&amp;&amp;s.bindVertexBufferToProgramAttribute(t,e,n,&quot;uv&quot;,r,2,20,12)},n.uploadPixelDataToTexture=function(t,e,n,r){s.callAndCheck(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)}),s.callAndCheck(t,e,function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r)}),s.callAndCheck(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})},n.uploadMatrixToTexture=function(t,e,n,r,i,o,s,u){var c,f=a.getUnpackedMatrixTextureShapeWidthHeight(r,i),p=f[0],h=f[1],d=r*i;1===u.defaultNumChannels&amp;&amp;d===o.length?c=o:(c=new Float32Array(d*s),a.encodeMatrixToUnpackedArray(o,c,s)),l(t,e,n,p,h,c,u.textureFormatFloat)},n.uploadMatrixToPackedTexture=function(t,e,n,r,i,o,s,u,c,f){var p=a.getPackedMatrixTextureShapeWidthHeight(s,u),h=p[0],d=p[1],m=new Float32Array(a.getPackedRGBAArraySizeFromMatrixShape(s,u));a.encodeMatrixToPackedRGBA(c,r,i,o,m),l(t,e,n,h,d,m,t.RGBA)},n.maybeCreateBufferFromOutputTexture=function(t,e,n,i,o,u){var l=n;if(2===r.ENV.getNumber(&quot;WEBGL_VERSION&quot;)){var c=t,f=c.createBuffer();s.callAndCheck(t,e,function(){return t.bindBuffer(c.PIXEL_PACK_BUFFER,f)});var p=4*a.getUnpackedArraySizeFromMatrixSize(i*o,u.downloadUnpackNumChannels);s.callAndCheck(t,e,function(){return t.bufferData(c.PIXEL_PACK_BUFFER,p,c.STREAM_READ)}),s.callAndCheck(t,e,function(){return c.readPixels(0,0,o,i,t.RGBA,t.FLOAT,0)}),s.callAndCheck(t,e,function(){return t.bindBuffer(c.PIXEL_PACK_BUFFER,null)}),l=f}return l},n.downloadFloat32MatrixFromBuffer=function(t,e,n,r,i){var o=t,s=new Float32Array(a.getUnpackedArraySizeFromMatrixSize(n*r,i.downloadUnpackNumChannels));o.bindBuffer(o.PIXEL_PACK_BUFFER,e),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,s),o.bindBuffer(o.PIXEL_PACK_BUFFER,null);var u=new Float32Array(n*r);return a.decodeMatrixFromUnpackedArray(s,u,i.downloadUnpackNumChannels),u},n.downloadFloat32MatrixFromOutputTexture=function(t,e,n,r,i){var o=a.getUnpackedMatrixTextureShapeWidthHeight(n,r),u=o[0],l=o[1],c=new Float32Array(a.getUnpackedArraySizeFromMatrixSize(n*r,i.downloadUnpackNumChannels));s.callAndCheck(t,e,function(){return t.readPixels(0,0,u,l,i.downloadTextureFormat,t.FLOAT,c)});var f=new Float32Array(n*r);return a.decodeMatrixFromUnpackedArray(c,f,i.downloadUnpackNumChannels),f},n.downloadByteEncodedFloatMatrixFromOutputTexture=function(t,e,n,r,i){var o=a.getUnpackedMatrixTextureShapeWidthHeight(n,r),u=o[0],l=o[1],c=new Uint8Array(a.getUnpackedArraySizeFromMatrixSize(n*r,4));return s.callAndCheck(t,e,function(){return t.readPixels(0,0,u,l,i.downloadTextureFormat,t.UNSIGNED_BYTE,c)}),new Float32Array(c.buffer)},n.downloadPackedMatrixFromBuffer=function(t,e,n,r,o,s,u,l){var c=t,f=new Float32Array(a.getPackedRGBAArraySizeFromMatrixShape(s,u));c.bindBuffer(c.PIXEL_PACK_BUFFER,e),c.getBufferSubData(c.PIXEL_PACK_BUFFER,0,f),c.bindBuffer(c.PIXEL_PACK_BUFFER,null);var p=new Float32Array(i.sizeFromShape([n,r,o]));return a.decodeMatrixFromPackedRGBA(f,n,r,o,p),p},n.downloadMatrixFromPackedOutputTexture=function(t,e,n,r,o,u,l,c){var f=a.getPackedMatrixTextureShapeWidthHeight(u,l),p=f[0],h=f[1],d=new Float32Array(a.getPackedRGBAArraySizeFromMatrixShape(u,l));s.callAndCheck(t,e,function(){return t.readPixels(0,0,p,h,t.RGBA,t.FLOAT,d)});var m=new Float32Array(i.sizeFromShape([n,r,o]));return a.decodeMatrixFromPackedRGBA(d,n,r,o,m)}},{&quot;../../environment&quot;:134,&quot;../../util&quot;:223,&quot;./glsl_version&quot;:89,&quot;./tex_util&quot;:121,&quot;./webgl_util&quot;:129}],93:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./glsl_version&quot;),i=function(){return function(t,e,n){this.variableNames=[&quot;A&quot;],this.usesPackedTextures=!0,this.outputShape=t;var i=n.filterWidth,o=n.inChannels,a=n.strideWidth,s=n.strideHeight,u=n.padInfo,l=n.outWidth,c=n.dilationWidth,f=n.dilationHeight,p=u.left,h=u.top,d=o*i,m=r.getGlslDifferences();this.userCode=&quot;\n      void main() {\n        ivec2 rc = getOutputCoords();\n\n        vec4 result = vec4(0);\n\n        for(int row=0; row&lt;=1; row++) {\n          for(int col=0; col&lt;=1; col++) {\n            int blockIndex = rc.y + col;\n            int pos = rc.x + row;\n\n            if(blockIndex &gt;= &quot;+t[1]+&quot; || pos &gt;= &quot;+t[0]+&quot;) continue;\n\n            int offsetY = int(blockIndex / (&quot;+l+&quot;)) * &quot;+s+&quot; - &quot;+h+&quot;;\n            int d0 = offsetY + &quot;+f+&quot; * (pos / &quot;+d+&quot;);\n\n            if(d0 &gt;= &quot;+e[0]+&quot; || d0 &lt; 0) continue;\n\n            int offsetX = int(mod(float(blockIndex), &quot;+l+&quot;.) * &quot;+a+&quot;. - &quot;+p+&quot;.);\n            int d1 = offsetX + &quot;+c+&quot; * (int(mod(float(pos), &quot;+d+&quot;.) / &quot;+o+&quot;.));\n\n            if(d1 &gt;= &quot;+e[1]+&quot; || d1 &lt; 0) continue;\n\n            vec2 innerDims = vec2(d1, int(mod(float(pos), &quot;+o+&quot;.)));\n            result[row * 2 + col] = getChannel(getA(d0, int(innerDims.x),\n                                              int(innerDims.y)), innerDims);\n          }\n        }\n\n        &quot;+m.output+&quot; = result;\n      }\n    &quot;}}();n.Im2ColPackedProgram=i},{&quot;./glsl_version&quot;:89}],94:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n,r,i){this.variableNames=[&quot;x&quot;],this.outputShape=[];var o,a=e,s=t[3]-1;this.outputShape=t;var u=&quot;float(&quot;+n+&quot;) + float(&quot;+r+&quot;) * sum&quot;;o=.5===i?&quot;inversesqrt(&quot;+u+&quot;)&quot;:1===i?&quot;1.0/(&quot;+u+&quot;)&quot;:&quot;exp(log(&quot;+u+&quot;) * float(-&quot;+i+&quot;));&quot;,this.userCode=&quot;\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int r = coords[1];\n        int c = coords[2];\n        int d = coords[3];\n        float x = getX(b, r, c, d);\n        float sum = 0.0;\n        for (int j = -&quot;+a+&quot;; j &lt;= &quot;+a+&quot;; j++) {\n          int idx = d + j;\n          if (idx &gt;= 0 &amp;&amp; idx &lt;=  &quot;+s+&quot;) {\n            float z = getX(b, r, c, idx);\n            sum += z * z;\n          }\n        }\n        float val = x * &quot;+o+&quot;;\n        setOutput(val);\n      }\n    &quot;}}();n.LRNProgram=r},{}],95:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n,r,i){this.variableNames=[&quot;inputImage&quot;,&quot;outputImage&quot;,&quot;dy&quot;],this.outputShape=[],this.outputShape=t,this.depth=t[3],this.depthRadius=e,this.bias=n,this.alpha=r,this.beta=i,this.userCode=&quot;\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int r = coords[1];\n        int c = coords[2];\n\n        float result = 0.0;\n        for (int d = 0; d &lt; &quot;+this.depth+&quot;; ++d) {\n          int depthBegin = int(max(0.0, float(d - &quot;+e+&quot;)));\n          int depthEnd = int(min(float(&quot;+this.depth+&quot;),\n              float(d + &quot;+e+&quot; + 1)));\n\n          const int MIN_DEPTH_BEGIN = 0;\n          const int MAX_DEPTH_END = &quot;+this.depth+&quot;;\n\n          float norm = 0.0;\n          for (int k = MIN_DEPTH_BEGIN; k &lt; MAX_DEPTH_END; ++k) {\n            if (k &lt; depthBegin){\n              continue;\n            }\n            else if (k &gt;= depthBegin &amp;&amp; k &lt; depthEnd) {\n              norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n            }\n            else {\n              break;\n            }\n          }\n\n          norm = float(&quot;+r+&quot;) * norm + float(&quot;+n+&quot;);\n\n          for(int k = MIN_DEPTH_BEGIN; k &lt; MAX_DEPTH_END; ++k){\n            if (k &lt; depthBegin){\n              continue;\n            }\n            else if (k &gt;= depthBegin &amp;&amp; k &lt; depthEnd){\n              float dyi = -2.0 * float(&quot;+r+&quot;)\n                * float(&quot;+i+&quot;)\n                * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n                / norm;\n              if (k == d) {\n                dyi += pow(norm, -1.0 * &quot;+i+&quot;);\n              }\n              if (k == coords[3]) {\n                dyi *= getDy(b, r, c, d);\n                result += dyi;\n              }\n            }\n            else {\n              break;\n            }\n          }\n      }\n      setOutput(result);\n      }\n    &quot;}}();n.LRNGradProgram=r},{}],96:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t){this.variableNames=[&quot;dy&quot;,&quot;maxPos&quot;],this.outputShape=t.inShape;var e=t.strideHeight,n=t.strideWidth,r=t.dilationHeight,i=t.effectiveFilterHeight,o=t.effectiveFilterWidth,a=i-1-t.padInfo.top,s=o-1-t.padInfo.left,u=i*o-1;this.userCode=&quot;\n      const ivec2 pads = ivec2(&quot;+a+&quot;, &quot;+s+&quot;);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n\n        ivec2 dyRCCorner = coords.yz - pads;\n        int dyRCorner = dyRCCorner.x;\n        int dyCCorner = dyRCCorner.y;\n\n        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR &lt; &quot;+i+&quot;;\n          wR += &quot;+r+&quot;) {\n          float dyR = float(dyRCorner + wR) / &quot;+e+&quot;.0;\n\n          if (dyR &lt; 0.0 || dyR &gt;= &quot;+t.outHeight+&quot;.0 || fract(dyR) &gt; 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          for (int wC = 0; wC &lt; &quot;+o+&quot;; wC++) {\n            float dyC = float(dyCCorner + wC) / &quot;+n+&quot;.0;\n\n            if (dyC &lt; 0.0 || dyC &gt;= &quot;+t.outWidth+&quot;.0 ||\n                fract(dyC) &gt; 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            float dyValue = getDy(b, idyR, idyC, d);\n            int maxPosValue = &quot;+u+&quot; - int(getMaxPos(b, idyR, idyC, d));\n\n            // Get the current value, check it against the value from the\n            // position matrix.\n            int curPosValue = wR * &quot;+o+&quot; + wC;\n            float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n            dotProd += dyValue * mask;\n          }\n        }\n        setOutput(dotProd);\n      }\n    &quot;}}();n.MaxPool2DBackpropProgram=r},{}],97:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n,r,i,o){void 0===n&amp;&amp;(n=!1),void 0===r&amp;&amp;(r=!1),void 0===i&amp;&amp;(i=!1),void 0===o&amp;&amp;(o=null),this.variableNames=[&quot;matrixA&quot;,&quot;matrixB&quot;],this.usesPackedTextures=!0,this.outputShape=e;var a=n?t[1]:t[2],s=Math.ceil(a/2),u=n?&quot;i * 2, rc.y&quot;:&quot;rc.y, i * 2&quot;,l=r?&quot;rc.z, i * 2&quot;:&quot;i * 2, rc.z&quot;,c=n?[&quot;a.xxyy&quot;,&quot;a.zzww&quot;]:[&quot;a.xxzz&quot;,&quot;a.yyww&quot;],f=r?[&quot;b.xzxz&quot;,&quot;b.ywyw&quot;]:[&quot;b.xyxy&quot;,&quot;b.zwzw&quot;],p=&quot;&quot;,h=&quot;&quot;;o&amp;&amp;(p=&quot;vec4 activation(vec4 x) {\n        &quot;+o+&quot;\n      }&quot;,h=&quot;result = activation(result);&quot;);var d=i?&quot;result += getBiasAtOutCoords();&quot;:&quot;&quot;;i&amp;&amp;this.variableNames.push(&quot;bias&quot;),this.userCode=&quot;\n      &quot;+p+&quot;\n\n      const float sharedDimension = &quot;+s+&quot;.0;\n\n      vec4 dot2x2ARowBCol(ivec3 rc) {\n        vec4 result = vec4(0);\n        for (int i = 0; i &lt; &quot;+s+&quot;; i++) {\n          vec4 a = getMatrixA(rc.x, &quot;+u+&quot;);\n          vec4 b = getMatrixB(rc.x, &quot;+l+&quot;);\n\n          result += (&quot;+c[0]+&quot; * &quot;+f[0]+&quot;) + (&quot;+c[1]+&quot; * &quot;+f[1]+&quot;);\n        }\n        return result;\n      }\n\n      void main() {\n        ivec3 rc = getOutputCoords();\n        vec4 result = dot2x2ARowBCol(rc);\n\n        &quot;+d+&quot;\n\n        &quot;+h+&quot;\n\n        setOutput(result);\n      }\n    &quot;}}();n.MatMulPackedProgram=r},{}],98:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){function t(t,e,n){this.variableNames=[&quot;probs&quot;],this.outputShape=[t,n],this.userCode=&quot;\n      uniform float seed;\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n\n        float r = random(seed);\n        float cdf = 0.0;\n\n        for (int i = 0; i &lt; &quot;+(e-1)+&quot;; i++) {\n          cdf += getProbs(batch, i);\n\n          if (r &lt; cdf) {\n            setOutput(float(i));\n            return;\n          }\n        }\n\n        // If no other event happened, last event happened.\n        setOutput(float(&quot;+(e-1)+&quot;));\n      }\n    &quot;}return t.prototype.getCustomSetupFunc=function(t){var e=this;return function(n,r){null==e.seedLoc&amp;&amp;(e.seedLoc=n.getUniformLocation(r,&quot;seed&quot;)),n.gl.uniform1f(e.seedLoc,t)}},t}();n.MultinomialProgram=r},{}],99:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n,r){this.variableNames=[&quot;indices&quot;],this.outputShape=[t,e],this.userCode=&quot;\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int index = round(getIndices(coords.x));\n        setOutput(mix(float(&quot;+r+&quot;), float(&quot;+n+&quot;),\n                      float(index == coords.y)));\n      }\n    &quot;}}();n.OneHotProgram=r},{}],100:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../packing_util&quot;),i=t(&quot;./shader_compiler&quot;),o=function(){return function(t){this.variableNames=[&quot;A&quot;],this.isPackShader=!0,this.outputShape=t;var e=t.length;if(0===e)this.userCode=&quot;\n        void main() {\n          setOutput(vec4(getA(), 0., 0., 0.));\n        }\n      &quot;;else{var n=r.getChannels(&quot;rc&quot;,e),o=i.getCoordsDataType(e),a=function(t,e,n){if(1===t)return&quot;rc &gt; &quot;+e[0];for(var r=&quot;&quot;,i=t-2;i&lt;t;i++)r+=n[i]+&quot; &gt;= &quot;+e[i],i&lt;t-1&amp;&amp;(r+=&quot;||&quot;);return r}(e,t,n),s=function(t,e,n,r){if(1===t)return&quot;&quot;;var i=r.slice(-2);return&quot;\n    int r = &quot;+i[0]+&quot;;\n    int c = &quot;+i[1]+&quot;;\n    int rp1 = r + 1;\n    int cp1 = c + 1;\n\n    bool cEdge = cp1 &gt;= &quot;+e+&quot;;\n    bool rEdge = rp1 &gt;= &quot;+n+&quot;;\n  &quot;}(e,t[t.length-1],t[t.length-2],n),u=function(t,e){var n=t.length,r=function(t,e){for(var n=[],r=0;r&lt;=1;r++)for(var i=0;i&lt;=1;i++){for(var o=(0===r?&quot;r&quot;:&quot;rp1&quot;)+&quot;, &quot;+(0===i?&quot;c&quot;:&quot;cp1&quot;),a=2;a&lt;t;a++)o=e[e.length-1-a]+&quot;,&quot;+o;n.push(o)}return n}(n,e);return 1===n?&quot;getA(rc),\n            rc + 1 &gt;= &quot;+t[0]+&quot; ? 0. : getA(rc + 1),\n            0, 0&quot;:&quot;getA(&quot;+r[0]+&quot;),\n          cEdge ? 0. : getA(&quot;+r[1]+&quot;),\n          rEdge ? 0. : getA(&quot;+r[2]+&quot;),\n          rEdge || cEdge ? 0. : getA(&quot;+r[3]+&quot;)&quot;}(t,n);this.userCode=&quot;\n        void main() {\n          &quot;+o+&quot; rc = getOutputCoords();\n\n          if(&quot;+a+&quot;) {\n            setOutput(vec4(0));\n          } else {\n            &quot;+s+&quot;\n\n            setOutput(vec4(&quot;+u+&quot;));\n          }\n        }\n      &quot;}}}();n.PackProgram=o},{&quot;../packing_util&quot;:54,&quot;./shader_compiler&quot;:116}],101:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){return function(t,e,n){this.variableNames=[&quot;x&quot;],this.outputShape=e.map(function(e,n){return e[0]+t[n]+e[1]});var i=t.length,o=r.getCoordsDataType(i),a=e.map(function(t){return t[0]}).join(&quot;,&quot;),s=e.map(function(e,n){return e[0]+t[n]}).join(&quot;,&quot;),u=[&quot;coords[0]&quot;,&quot;coords[1]&quot;,&quot;coords[2]&quot;,&quot;coords[3]&quot;].slice(0,i);this.userCode=1!==i?&quot;\n      &quot;+o+&quot; start = &quot;+o+&quot;(&quot;+a+&quot;);\n      &quot;+o+&quot; end = &quot;+o+&quot;(&quot;+s+&quot;);\n\n      void main() {\n        &quot;+o+&quot; outC = getOutputCoords();\n        if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n          setOutput(float(&quot;+n+&quot;));\n        } else {\n          &quot;+o+&quot; coords = outC - start;\n          setOutput(getX(&quot;+u+&quot;));\n        }\n      }\n    &quot;:&quot;\n        int start = &quot;+a+&quot;;\n        int end = &quot;+s+&quot;;\n\n        void main() {\n          int outC = getOutputCoords();\n          if (outC &lt; start || outC &gt;= end) {\n            setOutput(float(&quot;+n+&quot;));\n          } else {\n            setOutput(getX(outC - start));\n          }\n        }\n      &quot;}}();n.PadProgram=i},{&quot;./shader_compiler&quot;:116}],102:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=t(&quot;../packing_util&quot;),o=function(){return function(t,e,n){this.variableNames=[&quot;x&quot;],this.usesPackedTextures=!0,this.outputShape=e.map(function(e,n){return e[0]+t[n]+e[1]});for(var o=t.length,a=r.getCoordsDataType(o),s=e.map(function(t){return t[0]}).join(&quot;,&quot;),u=e.map(function(e,n){return e[0]+t[n]}).join(&quot;,&quot;),l=i.getChannels(&quot;rc&quot;,o),c=i.getChannels(&quot;source&quot;,o),f=l[o-1]+&quot; &lt; &quot;+this.outputShape[o-1],p=1===o?&quot;source&quot;:&quot;vec2(&quot;+c.slice(-2).join()+&quot;)&quot;,h=[a+&quot; rc = outputLoc;&quot;,l[o-1]+&quot; += 1;\n       if(&quot;+f+&quot;) {\n      &quot;,1===o?&quot;&quot;:&quot;}\n       rc = outputLoc;\n       &quot;+l[o-2]+&quot; += 1;\n       if(&quot;+l[o-2]+&quot; &lt; &quot;+this.outputShape[o-2]+&quot;) {&quot;,1===o?&quot;&quot;:&quot;  &quot;+l[o-1]+&quot; += 1;\n         if(&quot;+f+&quot;) {&quot;],d=1===o?&quot;rc &lt; start || rc &gt;= end&quot;:&quot;any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))&quot;,m=&quot;&quot;,g=0,v=1===o?2:4;g&lt;v;g++)m+=&quot;\n        &quot;+h[g]+&quot;\n        if (&quot;+d+&quot;) {\n          result[&quot;+g+&quot;] = float(&quot;+n+&quot;);\n        } else {\n          &quot;+a+&quot; source = rc - start;\n          result[&quot;+g+&quot;] = getChannel(getX(&quot;+c.join()+&quot;), &quot;+p+&quot;);\n        }\n      &quot;;m+=1===o?&quot;} &quot;:&quot;}}&quot;,this.userCode=&quot;\n      const &quot;+a+&quot; start = &quot;+a+&quot;(&quot;+s+&quot;);\n      const &quot;+a+&quot; end = &quot;+a+&quot;(&quot;+u+&quot;);\n\n      void main() {\n        &quot;+a+&quot; outputLoc = getOutputCoords();\n        vec4 result = vec4(0.);\n        &quot;+m+&quot;\n        setOutput(result);\n      }\n    &quot;}}();n.PadPackedProgram=o},{&quot;../packing_util&quot;:54,&quot;./shader_compiler&quot;:116}],103:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n){if(this.variableNames=[&quot;x&quot;],&quot;avg&quot;===e&amp;&amp;n)throw new Error(&quot;Cannot compute positions for average pool.&quot;);var r=t.filterWidth,i=t.strideHeight,o=t.strideWidth,a=t.dilationHeight,s=t.dilationWidth,u=t.effectiveFilterHeight,l=t.effectiveFilterWidth,c=t.padInfo.top,f=t.padInfo.left;this.outputShape=t.outShape;var p=&quot;avg&quot;===e,h=&quot;0.0&quot;;if(p||(h=&quot;-1.0 / 1e-20&quot;),n)this.userCode=&quot;\n        const ivec2 strides = ivec2(&quot;+i+&quot;, &quot;+o+&quot;);\n        const ivec2 pads = ivec2(&quot;+c+&quot;, &quot;+f+&quot;);\n\n        void main() {\n          ivec4 coords = getOutputCoords();\n          int batch = coords[0];\n          int d = coords[3];\n\n          ivec2 xRCCorner = coords.yz * strides - pads;\n          int xRCorner = xRCCorner.x;\n          int xCCorner = xRCCorner.y;\n\n          // max/min x(?, ?, d) to get y(yR, yC, d).\n          // ? = to be determined\n          float minMaxValue = 0.0;\n          float minMaxValueFound = 0.0;\n          int minMaxPosition = 0;\n          float avgValue = 0.0;\n\n          for (int wR = 0; wR &lt; &quot;+u+&quot;;\n              wR += &quot;+a+&quot;) {\n            int xR = xRCorner + wR;\n\n            if (xR &lt; 0 || xR &gt;= &quot;+t.inHeight+&quot;) {\n              continue;\n            }\n\n            for (int wC = 0; wC &lt; &quot;+l+&quot;;\n                wC += &quot;+s+&quot;) {\n              int xC = xCCorner + wC;\n\n              if (xC &lt; 0 || xC &gt;= &quot;+t.inWidth+&quot;) {\n                continue;\n              }\n\n              float value = getX(batch, xR, xC, d);\n\n              // If a min / max value has already been found, use it. If not,\n              // use the current value.\n              float currMinMaxValue = mix(\n                  value, minMaxValue, minMaxValueFound);\n              if (value &gt;= currMinMaxValue) {\n                minMaxValue = value;\n                minMaxValueFound = 1.0;\n                minMaxPosition = wR * &quot;+l+&quot; + wC;\n              }\n            }\n          }\n          setOutput(float(minMaxPosition));\n        }\n      &quot;;else{var d=e+&quot;(&quot;+e+&quot;(&quot;+e+&quot;(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])&quot;;&quot;avg&quot;===e&amp;&amp;(d=&quot;avgValue / count&quot;);var m=4*Math.floor(r/4),g=r%4,v=&quot;\n      if (&quot;+p+&quot;) {\n        avgValue += dot(values, ones);\n      } else {\n        minMaxValue = max(values, minMaxValue);\n      }\n    &quot;;this.userCode=&quot;\n      const ivec2 strides = ivec2(&quot;+i+&quot;, &quot;+o+&quot;);\n      const ivec2 pads = ivec2(&quot;+c+&quot;, &quot;+f+&quot;);\n      const float initializationValue = &quot;+h+&quot;;\n      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n      float count = 0.0;\n\n      float getValue(int batch, int xR, int xC, int d) {\n        if (xC &lt; 0 || xC &gt;= &quot;+t.inWidth+&quot;) {\n          return initializationValue;\n        }\n        count += 1.0;\n        return getX(batch, xR, xC, d);\n      }\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d = coords[3];\n\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        // max/min x(?, ?, d) to get y(yR, yC, d).\n        // ? = to be determined\n        vec4 minMaxValue = vec4(&quot;+h+&quot;);\n        float avgValue = 0.0;\n        count = 0.0;\n\n        for (int wR = 0; wR &lt; &quot;+u+&quot;;\n            wR += &quot;+a+&quot;) {\n          int xR = xRCorner + wR;\n\n          if (xR &lt; 0 || xR &gt;= &quot;+t.inHeight+&quot;) {\n            continue;\n          }\n\n          for (int wC = 0; wC &lt; &quot;+m+&quot;; wC += 4) {\n            int xC = xCCorner + wC * &quot;+s+&quot;;\n\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + &quot;+s+&quot;, d),\n              getValue(batch, xR, xC + 2 * &quot;+s+&quot;, d),\n              getValue(batch, xR, xC + 3 * &quot;+s+&quot;, d)\n            );\n\n            &quot;+v+&quot;\n          }\n\n          int xC = xCCorner + &quot;+m+&quot;;\n          if (&quot;+(1===g)+&quot;) {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              initializationValue,\n              initializationValue,\n              initializationValue\n            );\n\n            &quot;+v+&quot;\n          } else if (&quot;+(2===g)+&quot;) {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + &quot;+s+&quot;, d),\n              initializationValue,\n              initializationValue\n            );\n\n            &quot;+v+&quot;\n          } else if (&quot;+(3===g)+&quot;) {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + &quot;+s+&quot;, d),\n              getValue(batch, xR, xC + 2 * &quot;+s+&quot;, d),\n              initializationValue\n            );\n\n            &quot;+v+&quot;\n          }\n        }\n        setOutput(&quot;+d+&quot;);\n      }\n    &quot;}}}();n.Pool2DProgram=r},{}],104:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e){this.variableNames=[&quot;x&quot;];var n=t.windowSize,r=t.batchSize,i=t.inSize,o=Math.ceil(i/n);this.outputShape=[r,o];var a=&quot;0.0&quot;,s=&quot;&quot;;&quot;prod&quot;===e?a=&quot;1.0&quot;:&quot;min&quot;===e?(a=&quot;1.0 / 1e-20&quot;,s=&quot;min&quot;):&quot;max&quot;===e&amp;&amp;(a=&quot;-1.0 / 1e-20&quot;,s=&quot;max&quot;);var u=e+&quot;(&quot;+e+&quot;(&quot;+e+&quot;(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])&quot;;&quot;sum&quot;===e?u=&quot;sumValue&quot;:&quot;prod&quot;===e?u=&quot;prodValue&quot;:&quot;all&quot;===e?u=&quot;allValue&quot;:&quot;any&quot;===e&amp;&amp;(u=&quot;anyValue&quot;);var l=4*Math.floor(n/4),c=n%4,f=&quot;\n      if (&quot;+(&quot;sum&quot;===e)+&quot;) {\n        sumValue += dot(values, ones);\n      } else if (&quot;+(&quot;prod&quot;===e)+&quot;) {\n        vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n        prodValue *= tmp[0] * tmp[1];\n      } else {\n        minMaxValue = &quot;+s+&quot;(values, minMaxValue);\n      }\n    &quot;,p=&quot;vec4&quot;;&quot;all&quot;===e?(a=&quot;1.0&quot;,f=&quot;\n        bool reducedAllValue = all(values);\n        float floatedReducedAllValue = float(reducedAllValue);\n        allValue = float(allValue &gt;= 1.0 &amp;&amp; floatedReducedAllValue &gt;= 1.0);\n      &quot;,p=&quot;bvec4&quot;):&quot;any&quot;===e&amp;&amp;(a=&quot;0.0&quot;,f=&quot;\n        bool reducedAnyValue = any(values);\n        float floatedReducedAnyValue = float(reducedAnyValue);\n        anyValue = float(anyValue &gt;= 1.0 || floatedReducedAnyValue &gt;= 1.0);\n      &quot;,p=&quot;bvec4&quot;);var h=&quot;&quot;;i%n&gt;0&amp;&amp;(h=&quot;\n        if (inIdx &lt; 0 || inIdx &gt;= &quot;+i+&quot;) {\n          return initializationValue;\n        }\n      &quot;),this.userCode=&quot;\n      const float initializationValue = &quot;+a+&quot;;\n      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n      float getValue(int batch, int inIdx) {\n        &quot;+h+&quot;\n        return getX(batch, inIdx);\n      }\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n        int outIdx = coords[1];\n        int inOffset = outIdx * &quot;+n+&quot;;\n\n        vec4 minMaxValue = vec4(&quot;+a+&quot;);\n        float prodValue = 1.0;\n        float sumValue = 0.0;\n        float allValue = 1.0;\n        float anyValue = 0.0;\n\n        for (int i = 0; i &lt; &quot;+l+&quot;; i += 4) {\n          int inIdx = inOffset + i;\n          &quot;+p+&quot; values = &quot;+p+&quot;(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            getValue(batch, inIdx + 3)\n          );\n\n          &quot;+f+&quot;\n        }\n\n        int inIdx = inOffset + &quot;+l+&quot;;\n        if (&quot;+(1===c)+&quot;) {\n          &quot;+p+&quot; values = &quot;+p+&quot;(\n            getValue(batch, inIdx),\n            initializationValue,\n            initializationValue,\n            initializationValue\n          );\n\n          &quot;+f+&quot;\n        } else if (&quot;+(2===c)+&quot;) {\n          &quot;+p+&quot; values = &quot;+p+&quot;(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            initializationValue,\n            initializationValue\n          );\n\n          &quot;+f+&quot;\n        } else if (&quot;+(3===c)+&quot;) {\n          &quot;+p+&quot; values = &quot;+p+&quot;(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            initializationValue\n          );\n\n          &quot;+f+&quot;\n        }\n        setOutput(&quot;+u+&quot;);\n      }\n    &quot;}}();n.ReduceProgram=r},{}],105:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../util&quot;),i=t(&quot;./shader_compiler_util&quot;),o=function(){return function(t,e){this.variableNames=[&quot;A&quot;],this.usesPackedTextures=!0,this.outputShape=t;for(var n,o=&quot;&quot;,a=0;a&lt;4;a++){var s=&quot;thisRC = rc;&quot;;a%2==1&amp;&amp;(s+=&quot;thisRC.z += 1;&quot;),a&gt;1&amp;&amp;(s+=&quot;thisRC.y += 1;&quot;),o+=&quot;\n        &quot;+s+&quot;\n        &quot;+(a&gt;0?&quot;if(thisRC.y &lt; rows &amp;&amp; thisRC.z &lt; cols){&quot;:&quot;&quot;)+&quot;\n          int flatIndex = getFlatIndex(thisRC);\n\n          ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n          vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n          result[&quot;+a+&quot;] =\n            getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n        &quot;+(a&gt;0?&quot;}&quot;:&quot;&quot;)+&quot;\n      &quot;}this.userCode=&quot;\n      &quot;+(n=e,&quot;\n    ivec3 inputCoordsFromReshapedOutCoords(int index) {\n      &quot;+i.getLogicalCoordinatesFromFlatIndex([&quot;r&quot;,&quot;c&quot;,&quot;d&quot;],n)+&quot;\n      return ivec3(r, c, d);\n    }\n  &quot;)+&quot;\n      &quot;+function(t){return&quot;\n    int getFlatIndex(ivec3 coords) {\n      return round(&quot;+i.dotify([&quot;coords.x&quot;,&quot;coords.y&quot;,&quot;coords.z&quot;],r.computeStrides(t).map(function(t){return t.toString()}).concat([&quot;1.&quot;]))+&quot;);\n    }\n  &quot;}(t)+&quot;\n\n      void main() {\n        ivec3 rc = getOutputCoords();\n\n        vec4 result = vec4(0.);\n\n        ivec3 thisRC;\n        int rows = &quot;+t[1]+&quot;;\n        int cols = &quot;+t[2]+&quot;;\n\n        &quot;+o+&quot;\n\n        setOutput(result);\n      }\n    &quot;}}();n.ReshapePackedProgram=o},{&quot;../../util&quot;:223,&quot;./shader_compiler_util&quot;:117}],106:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n){this.variableNames=[&quot;dy&quot;],this.outputShape=[],this.outputShape=e.shape;var r=e.shape,i=r[1],o=r[2],a=t.shape,s=a[1],u=a[2],l=[n&amp;&amp;s&gt;1?i-1:i,n&amp;&amp;u&gt;1?o-1:o],c=[n&amp;&amp;s&gt;1?s-1:s,n&amp;&amp;u&gt;1?u-1:u],f=l[0]/c[0],p=l[1]/c[1],h=1/f,d=1/p,m=2*Math.ceil(h)+2,g=2*Math.ceil(d)+2;this.userCode=&quot;\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        int r = coords[1];\n        int c = coords[2];\n\n        float accumulator = 0.0;\n\n        const float heightScale = float(&quot;+f+&quot;);\n        const float widthScale = float(&quot;+p+&quot;);\n\n        const float invHeightScale = float(&quot;+h+&quot;);\n        const float invWidthScale = float(&quot;+d+&quot;);\n\n        const int winHeight = int(&quot;+m+&quot;);\n        const int winWidth = int(&quot;+g+&quot;);\n\n        // Compute bounds for where in dy we will look\n        float startRLerp = floor(float(r) * invHeightScale);\n        int startDyR = int(startRLerp - float(winHeight / 2));\n\n        float startCLerp = floor(float(c) * invWidthScale);\n        int startDyC = int(startCLerp - float(winWidth / 2));\n\n        // Loop over dy\n        for (int dyROffset = 0; dyROffset &lt; winHeight; dyROffset++) {\n          int dyR = dyROffset + startDyR;\n\n          // Guard against the window exceeding the bounds of dy\n          if (dyR &lt; 0 || dyR &gt;= &quot;+s+&quot;) {\n            continue;\n          }\n\n          for (int dyCOffset = 0; dyCOffset &lt; winWidth; dyCOffset++) {\n            int dyC = dyCOffset + startDyC;\n\n            // Guard against the window exceeding the bounds of dy\n            if (dyC &lt; 0 || dyC &gt;= &quot;+u+&quot;) {\n              continue;\n            }\n\n            float dxR = float(dyR) * heightScale;\n            int topDxRIndex = int(floor(dxR));\n            int bottomDxRIndex = int(min(ceil(dxR), &quot;+(i-1)+&quot;.0));\n            float dxRLerp = dxR - float(topDxRIndex);\n            float inverseDxRLerp = 1.0 - dxRLerp;\n\n            float dxC = float(dyC) * widthScale;\n            int leftDxCIndex = int(floor(dxC));\n            int rightDxCIndex = int(min(ceil(dxC), &quot;+(o-1)+&quot;.0));\n            float dxCLerp = dxC - float(leftDxCIndex);\n            float inverseDxCLerp = 1.0 - dxCLerp;\n\n            if (r == topDxRIndex &amp;&amp; c == leftDxCIndex) {\n              // topLeft\n              accumulator +=\n                getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n            }\n\n            if (r == topDxRIndex &amp;&amp; c == rightDxCIndex) {\n              // topRight\n              accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n            }\n\n            if (r == bottomDxRIndex &amp;&amp; c == leftDxCIndex) {\n              // bottomLeft\n              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n            }\n\n            if (r == bottomDxRIndex &amp;&amp; c == rightDxCIndex) {\n              // bottomRight\n              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n            }\n          }\n        }\n        // End loop over dy\n\n        setOutput(accumulator);\n      }\n    &quot;}}();n.ResizeBilinearBackpropProgram=r},{}],107:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n,r){this.variableNames=[&quot;A&quot;],this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&amp;&amp;e&gt;1?o-1:o,r&amp;&amp;n&gt;1?a-1:a],l=[r&amp;&amp;e&gt;1?e-1:e,r&amp;&amp;n&gt;1?n-1:n];this.userCode=&quot;\n      const vec2 effectiveInputOverOutputRatioRC = vec2(\n          &quot;+u[0]/l[0]+&quot;,\n          &quot;+u[1]/l[1]+&quot;);\n      const vec2 inputShapeRC = vec2(&quot;+o+&quot;.0, &quot;+a+&quot;.0);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        ivec2 yRC = coords.yz;\n\n        // Fractional source index.\n        vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n        // Compute the four integer indices.\n        ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);\n        ivec2 sourceCeilRC = ivec2(\n          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n        float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n        float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n        float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n        float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n        vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n        float top = topLeft + (topRight - topLeft) * fracRC.y;\n        float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n        float newValue = top + (bottom - top) * fracRC.x;\n\n        setOutput(newValue);\n      }\n    &quot;}}();n.ResizeBilinearProgram=r},{}],108:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n,r){this.variableNames=[&quot;A&quot;],this.usesPackedTextures=!0,this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&amp;&amp;e&gt;1?o-1:o,r&amp;&amp;n&gt;1?a-1:a],l=[r&amp;&amp;e&gt;1?e-1:e,r&amp;&amp;n&gt;1?n-1:n];this.userCode=&quot;\n      const vec3 effectiveInputOverOutputRatioRC = vec3(\n          &quot;+u[0]/l[0]+&quot;,\n          &quot;+u[1]/l[1]+&quot;,\n          &quot;+u[1]/l[1]+&quot;);\n      const vec3 inputShapeRC = vec3(&quot;+o+&quot;.0, &quot;+a+&quot;.0,\n                                     &quot;+a+&quot;.0);\n\n      float getAValue(int b, int r, int c, int d) {\n        return getChannel(getA(b, r, c, d), vec2(c, d));\n      }\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        // Calculate values for next column in yRC.z.\n        ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n        // Fractional source index.\n        vec3 sourceFracIndexRC = vec3(yRC) * effectiveInputOverOutputRatioRC;\n\n        // Compute the four integer indices.\n        ivec3 sourceFloorRC = ivec3(sourceFracIndexRC);\n        ivec3 sourceCeilRC = ivec3(\n          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n        \n        // Should we calculate next column and row elements in 2x2 packed cell.\n        bool hasNextCol = d &lt; &quot;+(s-1)+&quot;; \n        bool hasNextRow = coords.z &lt; &quot;+(n-1)+&quot;;\n\n        // In parallel, construct four corners for all four components in\n        // packed 2x2 cell.\n        vec4 topLeft = vec4(\n          getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),\n          hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)\n                     : 0.0,\n          hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)\n                     : 0.0,\n          (hasNextRow &amp;&amp; hasNextCol) ?\n            getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n        vec4 bottomLeft = vec4(\n          getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),\n          hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)\n                     : 0.0,\n          hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)\n                     : 0.0,\n          (hasNextRow &amp;&amp; hasNextCol) ?\n            getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n        vec4 topRight = vec4(\n          getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),\n          hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)\n                     : 0.0,\n          hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)\n                     : 0.0,\n          (hasNextRow &amp;&amp; hasNextCol) ?\n            getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n        vec4 bottomRight = vec4(\n          getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),\n          hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)\n                     : 0.0,\n          hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)\n                     : 0.0,\n          (hasNextRow &amp;&amp; hasNextCol) ?\n            getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n        vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);\n\n        vec4 top = mix(topLeft, topRight, fracRC.yyzz);\n        vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);\n        vec4 newValue = mix(top, bottom, fracRC.x);\n\n        setOutput(newValue);\n      }\n    &quot;}}();n.ResizeBilinearPackedProgram=r},{}],109:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n){this.variableNames=[&quot;dy&quot;],this.outputShape=[],this.outputShape=e.shape;var r=e.shape,i=r[1],o=r[2],a=t.shape,s=a[1],u=a[2],l=[n&amp;&amp;s&gt;1?i-1:i,n&amp;&amp;u&gt;1?o-1:o],c=[n&amp;&amp;s&gt;1?s-1:s,n&amp;&amp;u&gt;1?u-1:u],f=l[0]/c[0],p=l[1]/c[1],h=1/f,d=1/p,m=2*Math.ceil(h)+2,g=2*Math.ceil(d)+2;this.userCode=&quot;\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        int r = coords[1];\n        int c = coords[2];\n\n        float accumulator = 0.0;\n\n        const float heightScale = float(&quot;+f+&quot;);\n        const float widthScale = float(&quot;+p+&quot;);\n\n        const float invHeightScale = float(&quot;+h+&quot;);\n        const float invWidthScale = float(&quot;+d+&quot;);\n\n        const int winHeight = int(&quot;+m+&quot;);\n        const int winWidth = int(&quot;+g+&quot;);\n\n        // Compute bounds for where in dy we will look\n        float startRLerp = floor(float(r) * invHeightScale);\n        int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n        float startCLerp = floor(float(c) * invWidthScale);\n        int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n        // Loop over dy\n        for (int dyROffset = 0; dyROffset &lt; winHeight; dyROffset++) {\n          int dyR = dyROffset + startDyR;\n\n          // Guard against the window exceeding the bounds of dy\n          if (dyR &lt; 0 || dyR &gt;= &quot;+s+&quot;) {\n            continue;\n          }\n\n          for (int dyCOffset = 0; dyCOffset &lt; winWidth; dyCOffset++) {\n            int dyC = dyCOffset + startDyC;\n\n            // Guard against the window exceeding the bounds of dy\n            if (dyC &lt; 0 || dyC &gt;= &quot;+u+&quot;) {\n              continue;\n            }\n\n            float sourceFracRow =\n              float(&quot;+l[0]+&quot;) *\n                (float(dyR) / float(&quot;+c[0]+&quot;));\n\n            float sourceFracCol =\n                float(&quot;+l[1]+&quot;) *\n                  (float(dyC) / float(&quot;+c[1]+&quot;));\n\n            int sourceNearestRow = int(min(\n                float(int(&quot;+i+&quot;) - 1),\n                &quot;+n+&quot; ? float(round(sourceFracRow)) :\n                                  float(floor(sourceFracRow))));\n\n            int sourceNearestCol = int(min(\n                float(int(&quot;+o+&quot;) - 1),\n                &quot;+n+&quot; ? float(round(sourceFracCol)) :\n                                  float(floor(sourceFracCol))));\n\n            if (r == sourceNearestRow &amp;&amp; c == sourceNearestCol) {\n              accumulator += getDy(b, dyR, dyC, d);\n            }\n          }\n        }\n        // End loop over dy\n\n        setOutput(accumulator);\n      }\n    &quot;}}();n.ResizeNearestNeigborBackpropProgram=r},{}],110:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e,n,r){this.variableNames=[&quot;A&quot;],this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&amp;&amp;e&gt;1?o-1:o,r&amp;&amp;n&gt;1?a-1:a],l=[r&amp;&amp;e&gt;1?e-1:e,r&amp;&amp;n&gt;1?n-1:n],c=r?&quot;0.5&quot;:&quot;0.0&quot;;this.userCode=&quot;\n      const vec2 effectiveInputOverOutputRatioRC = vec2(\n          &quot;+u[0]/l[0]+&quot;,\n          &quot;+u[1]/l[1]+&quot;);\n      const vec2 inputShapeRC = vec2(&quot;+o+&quot;.0, &quot;+a+&quot;.0);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        ivec2 yRC = coords.yz;\n\n        // Fractional source index.\n        vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n        // Compute the coordinators of nearest neighbor point.\n        ivec2 sourceNearestRC = ivec2(\n          min(inputShapeRC - 1.0, floor(sourceFracIndexRC + &quot;+c+&quot;)));\n\n        float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n        setOutput(newValue);\n      }\n    &quot;}}();n.ResizeNearestNeighborProgram=r},{}],111:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){return function(t,e){this.variableNames=[&quot;x&quot;];var n=t.length;if(n&gt;4)throw new Error(&quot;WebGL backend: Reverse of rank-&quot;+n+&quot; tensor is not yet supported&quot;);if(this.outputShape=t,1!==n){var i=t.map(function(n,r){return function(n){return-1!==e.indexOf(n)&amp;&amp;1!==t[n]?t[n]+&quot; - coords[&quot;+n+&quot;] - 1&quot;:&quot;coords[&quot;+n+&quot;]&quot;}(r)}).join(&quot;,&quot;),o=r.getCoordsDataType(n);this.userCode=&quot;\n      void main() {\n        &quot;+o+&quot; coords = getOutputCoords();\n        setOutput(getX(&quot;+i+&quot;));\n      }\n    &quot;}else this.userCode=&quot;\n        void main() {\n          int coord = getOutputCoords();\n          setOutput(getX(&quot;+t[0]+&quot; - coord - 1));\n        }\n      &quot;}}();n.ReverseProgram=i},{&quot;./shader_compiler&quot;:116}],112:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../packing_util&quot;),i=t(&quot;./shader_compiler&quot;),o=function(){return function(t,e){this.variableNames=[&quot;x&quot;],this.usesPackedTextures=!0;var n=t.length;if(n&gt;4)throw new Error(&quot;WebGL backend: Reverse of rank-&quot;+n+&quot; tensor is not yet supported&quot;);this.outputShape=t;var o=r.getChannels(&quot;rc&quot;,n),a=o[n-1]+&quot; + 1 &lt; &quot;+this.outputShape[n-1],s=o[n-2]+&quot; + 1 &lt; &quot;+this.outputShape[n-2],u=i.getCoordsDataType(n);function l(n){var r=t.map(function(r,i){return function(n,r){return-1!==e.indexOf(n)&amp;&amp;1!==t[n]?t[n]+&quot; - &quot;+r[n]+&quot; - 1&quot;:&quot;&quot;+r[n]}(i,n)});return&quot;getChannel(getX(&quot;+r.join(&quot;,&quot;)+&quot;), vec2(&quot;+r.slice(-2).join(&quot;,&quot;)+&quot;))&quot;}this.userCode=1===n?&quot;\n        void main(){\n          int rc = getOutputCoords();\n          vec4 result = vec4(0.);\n          result.r = getChannel(getX(&quot;+t[0]+&quot; - rc - 1), rc);\n          if(&quot;+a+&quot;){\n              result.g = getChannel(getX(&quot;+t[0]+&quot; - (rc  + 1) - 1), rc + 1);\n          }\n          setOutput(result);\n        }\n      &quot;:&quot;\n        void main() {\n          &quot;+u+&quot; rc = getOutputCoords();\n          vec4 result = vec4(0.);\n          result.r = &quot;+function(t){return l(t)}(o.slice())+&quot;;\n          if(&quot;+a+&quot;){\n            result.g = &quot;+function(t){return t[n-1]=&quot;(&quot;+t[n-1]+&quot; + 1)&quot;,l(t)}(o.slice())+&quot;;\n          }\n          if(&quot;+s+&quot;) {\n            result.b = &quot;+function(t){return t[n-2]=&quot;(&quot;+t[n-2]+&quot; + 1)&quot;,l(t)}(o.slice())+&quot;;\n            if(&quot;+a+&quot;) {\n              result.a = &quot;+function(t){return t[n-1]=&quot;(&quot;+t[n-1]+&quot; + 1)&quot;,t[n-2]=&quot;(&quot;+t[n-2]+&quot; + 1)&quot;,l(t)}(o.slice())+&quot;;\n            }\n          }\n          setOutput(result);\n        }\n    &quot;}}();n.ReversePackedProgram=o},{&quot;../packing_util&quot;:54,&quot;./shader_compiler&quot;:116}],113:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){return function(t,e,n,i,o,a,s){void 0===s&amp;&amp;(s=!0),this.variableNames=[&quot;updates&quot;,&quot;indices&quot;,&quot;defaultValue&quot;],this.outputShape=a;var u=r.getCoordsDataType(o.length),l=r.getCoordsDataType(a.length),c=&quot;&quot;;1===n?c=&quot;i&quot;:2===n&amp;&amp;(c=&quot;i, j&quot;);var f=&quot;getIndices(&quot;+c+&quot;)&quot;,p=&quot;&quot;;1===i?p=&quot;i&quot;:2===i&amp;&amp;(p=&quot;i, coords[1]&quot;);var h=&quot;getUpdates(&quot;+p+&quot;)&quot;,d=e&gt;1?&quot;strides[j]&quot;:&quot;strides&quot;;this.userCode=&quot;\n        &quot;+u+&quot; strides = &quot;+u+&quot;(&quot;+o+&quot;);\n\n        void main() {\n          &quot;+l+&quot; coords = getOutputCoords();\n          float sum = 0.0;\n          bool found = false;\n          for (int i = 0; i &lt; &quot;+t+&quot;; i++) {\n            int flattenedIndex = 0;\n            for (int j = 0; j &lt; &quot;+e+&quot;; j++) {\n              int index = round(&quot;+f+&quot;);\n              flattenedIndex += index * &quot;+d+&quot;;\n            }\n            if (flattenedIndex == coords[0]) {\n              sum += &quot;+h+&quot;;\n              found = true;\n            }\n          }\n          setOutput(mix(getDefaultValue(), sum, float(found)));\n        }\n      &quot;}}();n.ScatterProgram=i},{&quot;./shader_compiler&quot;:116}],114:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(t,e){this.variableNames=[&quot;x&quot;,&quot;segmentIds&quot;];var n=t.windowSize,r=t.batchSize,i=t.inSize,o=t.numSegments,a=o*Math.ceil(i/n);this.outputShape=[r,a];var s=4*Math.floor(n/4),u=n%4,l=&quot;\n        sumValue += dot(values, segFilter);\n    &quot;,c=&quot;&quot;;i%n&gt;0&amp;&amp;(c=&quot;\n        if (inIdx &lt; 0 || inIdx &gt;= &quot;+i+&quot;) {\n          return initializationValue;\n        }\n      &quot;);var f=&quot;&quot;;i%n&gt;0&amp;&amp;(f=&quot;\n        if (inIdx &lt; 0 || inIdx &gt;= &quot;+i+&quot;) {\n          return -1.0;\n        }\n      &quot;),this.userCode=&quot;\n      const float initializationValue = 0.0;\n\n      float getValue(int batch, int inIdx) {\n        &quot;+c+&quot;\n        return getX(batch, inIdx);\n      }\n\n      float getSegmentIdAtIndex(int inIdx) {\n        &quot;+f+&quot;\n        return getSegmentIds(inIdx);\n      }\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n        int outIdx = coords[1];\n        int inOffset = int(floor(float(outIdx) / float(\n          &quot;+o+&quot;)) * float(&quot;+n+&quot;));\n        int currentSeg = int(mod(float(outIdx), float(&quot;+o+&quot;)));\n\n        float sumValue = 0.0;\n\n        for (int i = 0; i &lt; &quot;+s+&quot;; i += 4) {\n          int inIdx = inOffset + i;\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            getValue(batch, inIdx + 3)\n          );\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n          );\n\n          &quot;+l+&quot;\n        }\n\n        int inIdx = inOffset + &quot;+s+&quot;;\n        if (&quot;+(1===u)+&quot;) {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            initializationValue,\n            initializationValue,\n            initializationValue\n          );\n\n          int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            0,\n            0,\n            0\n          );\n\n          &quot;+l+&quot;\n        } else if (&quot;+(2===u)+&quot;) {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            initializationValue,\n            initializationValue\n          );\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n              0,\n              0\n          );\n\n          &quot;+l+&quot;\n        } else if (&quot;+(3===u)+&quot;) {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            initializationValue\n          );\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n            0\n          );\n\n          &quot;+l+&quot;\n        }\n        setOutput(sumValue);\n      }\n    &quot;}}();n.SegmentOpProgram=r},{}],115:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){return function(t,e,n){var i,o;if(this.variableNames=[&quot;c&quot;,&quot;a&quot;,&quot;b&quot;],this.outputShape=e,n&gt;4)throw Error(&quot;Where for rank &quot;+n+&quot; is not yet supported&quot;);if(1===n)o=&quot;resRC&quot;,i=&quot;resRC&quot;;else{for(var a=[&quot;resRC.x&quot;,&quot;resRC.y&quot;,&quot;resRC.z&quot;,&quot;resRC.w&quot;],s=[],u=[],l=0;l&lt;e.length;l++)u.push(&quot;&quot;+a[l]),l&lt;t&amp;&amp;s.push(&quot;&quot;+a[l]);i=s.join(),o=u.join()}var c=r.getCoordsDataType(n);this.userCode=&quot;\n      void main() {\n        &quot;+c+&quot; resRC = getOutputCoords();\n        float cVal = getC(&quot;+i+&quot;);\n        if (cVal &gt;= 1.0) {\n          setOutput(getA(&quot;+o+&quot;));\n        } else {\n          setOutput(getB(&quot;+o+&quot;));\n        }\n      }\n    &quot;}}();n.SelectProgram=i},{&quot;./shader_compiler&quot;:116}],116:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../ops/broadcast_util&quot;),i=t(&quot;../../util&quot;),o=t(&quot;./glsl_version&quot;),a=t(&quot;./shader_compiler_util&quot;);function s(t){var e=t.shapeInfo.logicalShape;switch(e.length){case 0:return function(t){var e=t.name,n=&quot;get&quot;+e.charAt(0).toUpperCase()+e.slice(1);if(t.shapeInfo.isUniform)return&quot;float &quot;+n+&quot;() {return &quot;+e+&quot;;}&quot;;var r=t.shapeInfo.texShape,i=r[0],o=r[1];if(1===i&amp;&amp;1===o)return&quot;\n      float &quot;+n+&quot;() {\n        return sampleTexture(&quot;+e+&quot;, halfCR);\n      }\n    &quot;;var a=t.shapeInfo.texShape,s=a[0],u=a[1],l=h(e);return&quot;\n    float &quot;+n+&quot;() {\n      vec2 uv = uvFromFlat(&quot;+s+&quot;, &quot;+u+&quot;, &quot;+l+&quot;);\n      return sampleTexture(&quot;+e+&quot;, uv);\n    }\n  &quot;}(t);case 1:return function(t){var e=t.name,n=&quot;get&quot;+e.charAt(0).toUpperCase()+e.slice(1);if(t.shapeInfo.isUniform)return&quot;\n      float &quot;+n+&quot;(int index) {\n        &quot;+d(t)+&quot;\n      }\n    &quot;;var r=t.shapeInfo.texShape,i=r[0],o=r[1];if(1===o&amp;&amp;1===i)return&quot;\n      float &quot;+n+&quot;(int index) {\n        return sampleTexture(&quot;+e+&quot;, halfCR);\n      }\n    &quot;;var a=h(e);if(1===o)return&quot;\n      float &quot;+n+&quot;(int index) {\n        vec2 uv = vec2(0.5, (float(index + &quot;+a+&quot;) + 0.5) / &quot;+i+&quot;.0);\n        return sampleTexture(&quot;+e+&quot;, uv);\n      }\n    &quot;;if(1===i)return&quot;\n      float &quot;+n+&quot;(int index) {\n        vec2 uv = vec2((float(index + &quot;+a+&quot;) + 0.5) / &quot;+o+&quot;.0, 0.5);\n        return sampleTexture(&quot;+e+&quot;, uv);\n      }\n    &quot;;return&quot;\n    float &quot;+n+&quot;(int index) {\n      vec2 uv = uvFromFlat(&quot;+i+&quot;, &quot;+o+&quot;, index + &quot;+a+&quot;);\n      return sampleTexture(&quot;+e+&quot;, uv);\n    }\n  &quot;}(t);case 2:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r=&quot;get&quot;+n.charAt(0).toUpperCase()+n.slice(1),o=t.shapeInfo.texShape;if(null!=o&amp;&amp;i.arraysEqual(e,o)){var a=o[0],u=o[1];return&quot;\n    float &quot;+r+&quot;(int row, int col) {\n      vec2 uv = (vec2(col, row) + halfCR) / vec2(&quot;+u+&quot;.0, &quot;+a+&quot;.0);\n      return sampleTexture(&quot;+n+&quot;, uv);\n    }\n  &quot;}var l=i.squeezeShape(e),c=l.newShape,f=l.keptDims,p=c;if(p.length&lt;e.length){var m=g(t,p);return&quot;\n      &quot;+s(m)+&quot;\n      float &quot;+r+&quot;(int row, int col) {\n        return &quot;+r+&quot;(&quot;+v([&quot;row&quot;,&quot;col&quot;],f)+&quot;);\n      }\n    &quot;}if(t.shapeInfo.isUniform)return&quot;\n      float &quot;+r+&quot;(int row, int col) {\n        int index = round(dot(vec2(row, col), vec2(&quot;+e[1]+&quot;, 1)));\n        &quot;+d(t)+&quot;\n      }\n    &quot;;var y=o[0],b=o[1],_=h(n);if(1===b)return&quot;\n    float &quot;+r+&quot;(int row, int col) {\n      float index = dot(vec3(row, col, &quot;+_+&quot;), vec3(&quot;+e[1]+&quot;, 1, 1));\n      vec2 uv = vec2(0.5, (index + 0.5) / &quot;+y+&quot;.0);\n      return sampleTexture(&quot;+n+&quot;, uv);\n    }\n  &quot;;if(1===y)return&quot;\n    float &quot;+r+&quot;(int row, int col) {\n      float index = dot(vec3(row, col, &quot;+_+&quot;), vec3(&quot;+e[1]+&quot;, 1, 1));\n      vec2 uv = vec2((index + 0.5) / &quot;+b+&quot;.0, 0.5);\n      return sampleTexture(&quot;+n+&quot;, uv);\n    }\n  &quot;;return&quot;\n  float &quot;+r+&quot;(int row, int col) {\n    // Explicitly use integer operations as dot() only works on floats.\n    int index = row * &quot;+e[1]+&quot; + col + &quot;+_+&quot;;\n    vec2 uv = uvFromFlat(&quot;+y+&quot;, &quot;+b+&quot;, index);\n    return sampleTexture(&quot;+n+&quot;, uv);\n  }\n&quot;}(t);case 3:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r=&quot;get&quot;+n.charAt(0).toUpperCase()+n.slice(1),o=e[1]*e[2],a=e[2],u=i.squeezeShape(e),l=u.newShape,c=u.keptDims,f=l;if(f.length&lt;e.length){var p=g(t,f);return&quot;\n        &quot;+s(p)+&quot;\n        float &quot;+r+&quot;(int row, int col, int depth) {\n          return &quot;+r+&quot;(&quot;+v([&quot;row&quot;,&quot;col&quot;,&quot;depth&quot;],c)+&quot;);\n        }\n      &quot;}if(t.shapeInfo.isUniform)return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth) {\n        int index = round(dot(vec3(row, col, depth),\n                          vec3(&quot;+o+&quot;, &quot;+a+&quot;, 1)));\n        &quot;+d(t)+&quot;\n      }\n    &quot;;var m=t.shapeInfo.texShape,y=m[0],b=m[1],_=t.shapeInfo.flatOffset;if(b===o&amp;&amp;null==_)return&quot;\n        float &quot;+r+&quot;(int row, int col, int depth) {\n          float texR = float(row);\n          float texC = dot(vec2(col, depth), vec2(&quot;+a+&quot;, 1));\n          vec2 uv = (vec2(texC, texR) + halfCR) /\n                     vec2(&quot;+b+&quot;.0, &quot;+y+&quot;.0);\n          return sampleTexture(&quot;+n+&quot;, uv);\n        }\n      &quot;;if(b===a&amp;&amp;null==_)return&quot;\n    float &quot;+r+&quot;(int row, int col, int depth) {\n      float texR = dot(vec2(row, col), vec2(&quot;+e[1]+&quot;, 1));\n      float texC = float(depth);\n      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(&quot;+b+&quot;.0, &quot;+y+&quot;.0);\n      return sampleTexture(&quot;+n+&quot;, uv);\n    }\n  &quot;;var w=h(n);return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth) {\n        // Explicitly use integer operations as dot() only works on floats.\n        int index = row * &quot;+o+&quot; + col * &quot;+a+&quot; + depth + &quot;+w+&quot;;\n        vec2 uv = uvFromFlat(&quot;+y+&quot;, &quot;+b+&quot;, index);\n        return sampleTexture(&quot;+n+&quot;, uv);\n      }\n  &quot;}(t);case 4:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r=&quot;get&quot;+n.charAt(0).toUpperCase()+n.slice(1),o=e[3],a=e[2]*o,u=e[1]*a,l=i.squeezeShape(e),c=l.newShape,f=l.keptDims;if(c.length&lt;e.length){var p=g(t,c);return&quot;\n      &quot;+s(p)+&quot;\n      float &quot;+r+&quot;(int row, int col, int depth, int depth2) {\n        return &quot;+r+&quot;(&quot;+v([&quot;row&quot;,&quot;col&quot;,&quot;depth&quot;,&quot;depth2&quot;],f)+&quot;);\n      }\n    &quot;}if(t.shapeInfo.isUniform)return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth, int depth2) {\n        int index = round(dot(vec4(row, col, depth, depth2),\n                          vec4(&quot;+u+&quot;, &quot;+a+&quot;, &quot;+o+&quot;, 1)));\n        &quot;+d(t)+&quot;\n      }\n    &quot;;var m=t.shapeInfo.flatOffset,y=t.shapeInfo.texShape,b=y[0],_=y[1];if(_===u&amp;&amp;null==m)return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth, int depth2) {\n        float texR = float(row);\n        float texC =\n            dot(vec3(col, depth, depth2),\n                vec3(&quot;+a+&quot;, &quot;+o+&quot;, 1));\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2(&quot;+_+&quot;.0, &quot;+b+&quot;.0);\n        return sampleTexture(&quot;+n+&quot;, uv);\n      }\n    &quot;;if(_===o&amp;&amp;null==m)return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth, int depth2) {\n        float texR = dot(vec3(row, col, depth),\n                         vec3(&quot;+e[1]*e[2]+&quot;, &quot;+e[2]+&quot;, 1));\n        float texC = float(depth2);\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2(&quot;+_+&quot;.0, &quot;+b+&quot;.0);\n        return sampleTexture(&quot;+n+&quot;, uv);\n      }\n    &quot;;var w=h(n);return&quot;\n    float &quot;+r+&quot;(int row, int col, int depth, int depth2) {\n      // Explicitly use integer operations as dot() only works on floats.\n      int index = row * &quot;+u+&quot; + col * &quot;+a+&quot; +\n          depth * &quot;+o+&quot; + depth2;\n      vec2 uv = uvFromFlat(&quot;+b+&quot;, &quot;+_+&quot;, index + &quot;+w+&quot;);\n      return sampleTexture(&quot;+n+&quot;, uv);\n    }\n  &quot;}(t);case 5:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r=&quot;get&quot;+n.charAt(0).toUpperCase()+n.slice(1),o=e[4],a=e[3]*o,u=e[2]*a,l=e[1]*u,c=i.squeezeShape(e),f=c.newShape,p=c.keptDims;if(f.length&lt;e.length){var m=g(t,f);return&quot;\n      &quot;+s(m)+&quot;\n      float &quot;+r+&quot;(int row, int col, int depth, int depth2, int depth3) {\n        return &quot;+r+&quot;(&quot;+v([&quot;row&quot;,&quot;col&quot;,&quot;depth&quot;,&quot;depth2&quot;,&quot;depth3&quot;],p)+&quot;);\n      }\n    &quot;}if(t.shapeInfo.isUniform)return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth, int depth2, int depth3) {\n        float index = dot(\n          vec4(row, col, depth, depth2),\n          vec4(&quot;+l+&quot;, &quot;+u+&quot;, &quot;+a+&quot;, &quot;+o+&quot;)) +\n          depth3;\n        &quot;+d(t)+&quot;\n      }\n    &quot;;var y=t.shapeInfo.flatOffset,b=t.shapeInfo.texShape,_=b[0],w=b[1];if(w===l&amp;&amp;null==y)return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth, int depth2, int depth3) {\n        int texR = row;\n        float texC = dot(vec4(col, depth, depth2, depth3),\n                         vec4(&quot;+u+&quot;, &quot;+a+&quot;, &quot;+o+&quot;, 1));\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2(&quot;+w+&quot;.0, &quot;+_+&quot;.0);\n        return sampleTexture(&quot;+n+&quot;, uv);\n      }\n    &quot;;if(w===o&amp;&amp;null==y)return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth, int depth2, int depth3) {\n        float texR = dot(\n          vec4(row, col, depth, depth2),\n          vec4(&quot;+e[1]*e[2]*e[3]+&quot;,\n               &quot;+e[2]*e[3]+&quot;, &quot;+e[3]+&quot;, 1));\n        int texC = depth3;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2(&quot;+w+&quot;.0, &quot;+_+&quot;.0);\n        return sampleTexture(&quot;+n+&quot;, uv);\n      }\n    &quot;;var x=h(n);return&quot;\n    float &quot;+r+&quot;(int row, int col, int depth, int depth2, int depth3) {\n      // Explicitly use integer operations as dot() only works on floats.\n      int index = row * &quot;+l+&quot; + col * &quot;+u+&quot; + depth * &quot;+a+&quot; +\n          depth2 * &quot;+o+&quot; + depth3 + &quot;+x+&quot;;\n      vec2 uv = uvFromFlat(&quot;+_+&quot;, &quot;+w+&quot;, index);\n      return sampleTexture(&quot;+n+&quot;, uv);\n    }\n  &quot;}(t);case 6:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r=&quot;get&quot;+n.charAt(0).toUpperCase()+n.slice(1),o=i.squeezeShape(e),a=o.newShape,u=o.keptDims;if(a.length&lt;e.length){var l=g(t,a);return&quot;\n      &quot;+s(l)+&quot;\n      float &quot;+r+&quot;(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        return &quot;+r+&quot;(&quot;+v([&quot;row&quot;,&quot;col&quot;,&quot;depth&quot;,&quot;depth2&quot;,&quot;depth3&quot;,&quot;depth4&quot;],u)+&quot;);\n      }\n    &quot;}var c=e[5],f=e[4]*c,p=e[3]*f,m=e[2]*p,y=e[1]*m;if(t.shapeInfo.isUniform)return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth,\n                  int depth2, int depth3, int depth4) {\n        int index = round(dot(\n          vec4(row, col, depth, depth2),\n          vec4(&quot;+y+&quot;, &quot;+m+&quot;, &quot;+p+&quot;, &quot;+f+&quot;)) +\n          dot(\n            vec2(depth3, depth4),\n            vec2(&quot;+c+&quot;, 1)));\n        &quot;+d(t)+&quot;\n      }\n    &quot;;var b=t.shapeInfo.flatOffset,_=t.shapeInfo.texShape,w=_[0],x=_[1];if(x===y&amp;&amp;null==b)return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        int texR = row;\n        float texC = dot(vec4(col, depth, depth2, depth3),\n          vec4(&quot;+m+&quot;, &quot;+p+&quot;, &quot;+f+&quot;, &quot;+c+&quot;)) +\n               float(depth4);\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2(&quot;+x+&quot;.0, &quot;+w+&quot;.0);\n        return sampleTexture(&quot;+n+&quot;, uv);\n      }\n    &quot;;if(x===c&amp;&amp;null==b)return&quot;\n      float &quot;+r+&quot;(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        float texR = dot(vec4(row, col, depth, depth2),\n          vec4(&quot;+e[1]*e[2]*e[3]*e[4]+&quot;,\n               &quot;+e[2]*e[3]*e[4]+&quot;,\n               &quot;+e[3]*e[4]+&quot;,\n               &quot;+e[4]+&quot;)) + float(depth3);\n        int texC = depth4;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2(&quot;+x+&quot;.0, &quot;+w+&quot;.0);\n        return sampleTexture(&quot;+n+&quot;, uv);\n      }\n    &quot;;var E=h(n);return&quot;\n    float &quot;+r+&quot;(int row, int col, int depth,\n                  int depth2, int depth3, int depth4) {\n      // Explicitly use integer operations as dot() only works on floats.\n      int index = row * &quot;+y+&quot; + col * &quot;+m+&quot; + depth * &quot;+p+&quot; +\n          depth2 * &quot;+f+&quot; + depth3 * &quot;+c+&quot; + depth4 + &quot;+E+&quot;;\n      vec2 uv = uvFromFlat(&quot;+w+&quot;, &quot;+x+&quot;, index);\n      return sampleTexture(&quot;+n+&quot;, uv);\n    }\n  &quot;}(t);default:throw new Error(e.length+&quot;-D input sampling is not yet supported&quot;)}}function u(t){var e,n,r;switch(t.shapeInfo.logicalShape.length){case 0:return e=t.name,n=&quot;get&quot;+e.charAt(0).toUpperCase()+e.slice(1),r=o.getGlslDifferences(),&quot;\n    vec4 &quot;+n+&quot;() {\n      return &quot;+r.texture2D+&quot;(&quot;+e+&quot;, halfCR);\n    }\n  &quot;;case 1:return function(t){var e=t.name,n=&quot;get&quot;+e.charAt(0).toUpperCase()+e.slice(1),r=t.shapeInfo.texShape,i=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],a=o.getGlslDifferences();return&quot;\n    vec4 &quot;+n+&quot;(int index) {\n      vec2 uv = packedUVfrom1D(\n        &quot;+i[0]+&quot;, &quot;+i[1]+&quot;, index);\n      return &quot;+a.texture2D+&quot;(&quot;+e+&quot;, uv);\n    }\n  &quot;}(t);case 2:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r=&quot;get&quot;+n.charAt(0).toUpperCase()+n.slice(1),a=t.shapeInfo.texShape,s=a[0],u=a[1],l=o.getGlslDifferences();if(null!=a&amp;&amp;i.arraysEqual(e,a))return&quot;\n      vec4 &quot;+r+&quot;(int row, int col) {\n        vec2 uv = (vec2(col, row) + halfCR) / vec2(&quot;+u+&quot;.0, &quot;+s+&quot;.0);\n\n        return &quot;+l.texture2D+&quot;(&quot;+n+&quot;, uv);\n      }\n    &quot;;var c=[Math.ceil(a[0]/2),Math.ceil(a[1]/2)],f=Math.ceil(e[1]/2);return&quot;\n    vec4 &quot;+r+&quot;(int row, int col) {\n      vec2 uv = packedUVfrom2D(&quot;+f+&quot;, &quot;+c[0]+&quot;, &quot;+c[1]+&quot;, row, col);\n      return &quot;+l.texture2D+&quot;(&quot;+n+&quot;, uv);\n    }\n  &quot;}(t);case 3:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r=&quot;get&quot;+n.charAt(0).toUpperCase()+n.slice(1),i=t.shapeInfo.texShape,a=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)];if(1===e[0]){var s=e.slice(1),l=g(t,s);return&quot;\n        &quot;+u(l)+&quot;\n        vec4 &quot;+r+&quot;(int b, int row, int col) {\n          return &quot;+r+&quot;(&quot;+v([&quot;b&quot;,&quot;row&quot;,&quot;col&quot;],[1,2])+&quot;);\n        }\n      &quot;}var c=a[0],f=a[1],p=Math.ceil(e[2]/2),h=p*Math.ceil(e[1]/2),d=o.getGlslDifferences();return&quot;\n    vec4 &quot;+r+&quot;(int b, int row, int col) {\n      vec2 uv = packedUVfrom3D(\n        &quot;+c+&quot;, &quot;+f+&quot;, &quot;+h+&quot;, &quot;+p+&quot;, b, row, col);\n      return &quot;+d.texture2D+&quot;(&quot;+n+&quot;, uv);\n    }\n  &quot;}(t);default:return function(t){for(var e=t.shapeInfo.logicalShape,n=e.length,r=t.name,i=&quot;get&quot;+r.charAt(0).toUpperCase()+r.slice(1),a=t.shapeInfo.texShape,s=[Math.ceil(a[0]/2),Math.ceil(a[1]/2)],u=s[0],l=s[1],c=Math.ceil(e[n-1]/2),f=c*Math.ceil(e[n-2]/2),p=&quot;int b, int row, int col&quot;,h=&quot;b * &quot;+f+&quot; + (row / 2) * &quot;+c+&quot; + (col / 2)&quot;,d=2;d&lt;n-1;d++)p=&quot;int b&quot;+d+&quot;, &quot;+p,f*=e[n-d-1],h=&quot;b&quot;+d+&quot; * &quot;+f+&quot; + &quot;+h;var m=o.getGlslDifferences();return&quot;\n    vec4 &quot;+i+&quot;(&quot;+p+&quot;) {\n      int index = &quot;+h+&quot;;\n      int texR = index / &quot;+l+&quot;;\n      int texC = index - texR * &quot;+l+&quot;;\n      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(&quot;+l+&quot;, &quot;+u+&quot;);\n      return &quot;+m.texture2D+&quot;(&quot;+r+&quot;, uv);\n    }\n  &quot;}(t)}}n.makeShader=function(t,e,n,h){var d=[];t.forEach(function(t){var e=i.sizeFromShape(t.shapeInfo.logicalShape);t.shapeInfo.isUniform?d.push(&quot;uniform float &quot;+t.name+(e&gt;1?&quot;[&quot;+e+&quot;]&quot;:&quot;&quot;)+&quot;;&quot;):(d.push(&quot;uniform sampler2D &quot;+t.name+&quot;;&quot;),d.push(&quot;uniform int offset&quot;+t.name+&quot;;&quot;))});var g,v,y=d.join(&quot;\n&quot;),b=t.map(function(t){return function(t,e,n){void 0===n&amp;&amp;(n=!1);var o=&quot;&quot;;o+=n?u(t):s(t);var a=t.shapeInfo.logicalShape,l=e.logicalShape;return a.length&lt;=l.length&amp;&amp;(o+=n?function(t,e){var n,i=t.name,o=i.charAt(0).toUpperCase()+i.slice(1),a=&quot;get&quot;+o+&quot;AtOutCoords&quot;,s=t.shapeInfo.logicalShape.length,u=e.logicalShape.length,l=r.getBroadcastDims(t.shapeInfo.logicalShape,e.logicalShape),c=m(u),f=u-s,p=[&quot;x&quot;,&quot;y&quot;,&quot;z&quot;,&quot;w&quot;,&quot;u&quot;,&quot;v&quot;];n=0===s?&quot;&quot;:u&lt;2&amp;&amp;l.length&gt;=1?&quot;coords = 0;&quot;:l.map(function(t){return&quot;coords.&quot;+p[t+f]+&quot; = 0;&quot;}).join(&quot;\n&quot;);var h=&quot;&quot;;h=u&lt;2&amp;&amp;s&gt;0?&quot;coords&quot;:t.shapeInfo.logicalShape.map(function(t,e){return&quot;coords.&quot;+p[e+f]}).join(&quot;, &quot;);var d=&quot;return outputValue;&quot;;if(1===s&amp;&amp;u&gt;1)d=&quot;\n      return vec4(outputValue.xy, outputValue.xy);\n    &quot;;else if(0===s&amp;&amp;u&gt;0)d=1===u?&quot;\n        return vec4(outputValue.x, outputValue.x, 0., 0.);\n      &quot;:&quot;\n        return vec4(outputValue.x);\n      &quot;;else if(l.length){var g=s-2,v=s-1;l.indexOf(g)&gt;-1&amp;&amp;l.indexOf(v)&gt;-1?d=&quot;return vec4(outputValue.x);&quot;:l.indexOf(g)&gt;-1?d=&quot;return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);&quot;:l.indexOf(v)&gt;-1&amp;&amp;(d=&quot;return vec4(outputValue.xx, outputValue.zz);&quot;)}return&quot;\n    vec4 &quot;+a+&quot;() {\n      &quot;+c+&quot; coords = getOutputCoords();\n      &quot;+n+&quot;\n      vec4 outputValue = get&quot;+o+&quot;(&quot;+h+&quot;);\n      &quot;+d+&quot;\n    }\n  &quot;}(t,e):function(t,e){var n=t.name,o=n.charAt(0).toUpperCase()+n.slice(1),a=&quot;get&quot;+o+&quot;AtOutCoords&quot;,s=e.texShape,u=t.shapeInfo.texShape,l=t.shapeInfo.logicalShape.length,c=e.logicalShape.length;if(!t.shapeInfo.isUniform&amp;&amp;l===c&amp;&amp;null==t.shapeInfo.flatOffset&amp;&amp;i.arraysEqual(u,s))return&quot;\n      float &quot;+a+&quot;() {\n        return sampleTexture(&quot;+n+&quot;, resultUV);\n      }\n    &quot;;var f,p=m(c),h=r.getBroadcastDims(t.shapeInfo.logicalShape,e.logicalShape),d=c-l,g=[&quot;x&quot;,&quot;y&quot;,&quot;z&quot;,&quot;w&quot;,&quot;u&quot;,&quot;v&quot;];f=0===l?&quot;&quot;:c&lt;2&amp;&amp;h.length&gt;=1?&quot;coords = 0;&quot;:h.map(function(t){return&quot;coords.&quot;+g[t+d]+&quot; = 0;&quot;}).join(&quot;\n&quot;);var v=&quot;&quot;;return v=c&lt;2&amp;&amp;l&gt;0?&quot;coords&quot;:t.shapeInfo.logicalShape.map(function(t,e){return&quot;coords.&quot;+g[e+d]}).join(&quot;, &quot;),&quot;\n    float &quot;+a+&quot;() {\n      &quot;+p+&quot; coords = getOutputCoords();\n      &quot;+f+&quot;\n      return get&quot;+o+&quot;(&quot;+v+&quot;);\n    }\n  &quot;}(t,e)),o}(t,e,h)}).join(&quot;\n&quot;),_=e.texShape,w=o.getGlslDifferences(),x=function(t){return&quot;\n    float sampleTexture(sampler2D textureSampler, vec2 uv) {\n      return &quot;+t.texture2D+&quot;(textureSampler, uv).r;\n    }\n  &quot;}(w),E=function(t){return t.version+&quot;\n    precision highp float;\n    precision highp int;\n    precision highp sampler2D;\n    &quot;+t.varyingFs+&quot; vec2 resultUV;\n    &quot;+t.defineOutput+&quot;\n    const vec2 halfCR = vec2(0.5, 0.5);\n\n    struct ivec5\n    {\n      int x;\n      int y;\n      int z;\n      int w;\n      int u;\n    };\n\n    struct ivec6\n    {\n      int x;\n      int y;\n      int z;\n      int w;\n      int u;\n      int v;\n    };\n\n    uniform float NAN;\n    #define isnan(value) isnan_custom(value)\n    &quot;+t.defineSpecialNaN+&quot;\n    bvec4 isnan_custom(vec4 val) {\n      return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n    }\n\n    &quot;+t.defineSpecialInf+&quot;\n    &quot;+t.defineRound+&quot;\n\n    int imod(int x, int y) {\n      return x - y * (x / y);\n    }\n\n    int idiv(int a, int b, float sign) {\n      int res = a / b;\n      int mod = imod(a, b);\n      if (sign &lt; 0. &amp;&amp; mod != 0) {\n        res -= 1;\n      }\n      return res;\n    }\n\n    //Based on the work of Dave Hoskins\n    //https://www.shadertoy.com/view/4djSRW\n    #define HASHSCALE1 443.8975\n    float random(float seed){\n      vec2 p = resultUV * seed;\n      vec3 p3  = fract(vec3(p.xyx) * HASHSCALE1);\n      p3 += dot(p3, p3.yzx + 19.19);\n      return fract((p3.x + p3.y) * p3.z);\n    }\n\n    &quot;+l+&quot;\n    &quot;+c+&quot;\n    &quot;+f+&quot;\n  &quot;}(w);return e.isPacked?(g=function(t,e){switch(t.length){case 0:return&quot;\n    int getOutputCoords() {\n      return 0;\n    }\n  &quot;;case 1:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];return 1===n[0]?&quot;\n      int getOutputCoords() {\n        return 2 * int(resultUV.x * &quot;+n[1]+&quot;.0);\n      }\n    &quot;:1===n[1]?&quot;\n      int getOutputCoords() {\n        return 2 * int(resultUV.y * &quot;+n[0]+&quot;.0);\n      }\n    &quot;:&quot;\n    int getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(&quot;+n[0]+&quot;, &quot;+n[1]+&quot;));\n      return resTexRC.x * &quot;+n[1]+&quot; + resTexRC.y;\n    }\n  &quot;}(0,e);case 2:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];if(i.arraysEqual(t,e))return&quot;\n      ivec2 getOutputCoords() {\n        return 2 * ivec2(resultUV.yx * vec2(&quot;+n[0]+&quot;, &quot;+n[1]+&quot;));\n      }\n    &quot;;var r=Math.ceil(t[1]/2);return&quot;\n    ivec2 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(&quot;+n[0]+&quot;, &quot;+n[1]+&quot;));\n\n      int index = resTexRC.x * &quot;+n[1]+&quot; + resTexRC.y;\n      int r = 2 * (index / &quot;+r+&quot;);\n      int c = imod(index, &quot;+r+&quot;) * 2;\n\n      return ivec2(r, c);\n    }\n  &quot;}(t,e);case 3:return n=t,r=e,o=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],a=Math.ceil(n[2]/2),s=a*Math.ceil(n[1]/2),&quot;\n    ivec3 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(&quot;+o[0]+&quot;, &quot;+o[1]+&quot;));\n      int index = resTexRC.x * &quot;+o[1]+&quot; + resTexRC.y;\n\n      int b = index / &quot;+s+&quot;;\n      index -= b * &quot;+s+&quot;;\n\n      int r = 2 * (index / &quot;+a+&quot;);\n      int c = imod(index, &quot;+a+&quot;) * 2;\n\n      return ivec3(b, r, c);\n    }\n  &quot;;default:return function(t,e){for(var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)],r=Math.ceil(t[t.length-1]/2),i=r*Math.ceil(t[t.length-2]/2),o=i,a=&quot;&quot;,s=&quot;b, r, c&quot;,u=2;u&lt;t.length-1;u++)o*=t[t.length-u-1],a=&quot;\n      int b&quot;+u+&quot; = index / &quot;+o+&quot;;\n      index -= b&quot;+u+&quot; * &quot;+o+&quot;;\n    &quot;+a,s=&quot;b&quot;+u+&quot;, &quot;+s;return&quot;\n    ivec&quot;+t.length+&quot; getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(&quot;+n[0]+&quot;, &quot;+n[1]+&quot;));\n      int index = resTexRC.x * &quot;+n[1]+&quot; + resTexRC.y;\n\n      &quot;+a+&quot;\n\n      int b = index / &quot;+i+&quot;;\n      index -= b * &quot;+i+&quot;;\n\n      int r = 2 * (index / &quot;+r+&quot;);\n      int c = imod(index, &quot;+r+&quot;) * 2;\n\n      return ivec&quot;+t.length+&quot;(&quot;+s+&quot;);\n    }\n  &quot;}(t,e)}var n,r,o,a,s}(e.logicalShape,_),v=function(t){return&quot;\n    void setOutput(vec4 val) {\n      &quot;+t.output+&quot; = val;\n    }\n  &quot;}(w)):(g=function(t,e){switch(t.length){case 0:return&quot;\n    int getOutputCoords() {\n      return 0;\n    }\n  &quot;;case 1:return function(t,e){return 1===e[0]?&quot;\n      int getOutputCoords() {\n        return int(resultUV.x * &quot;+e[1]+&quot;.0);\n      }\n    &quot;:1===e[1]?&quot;\n      int getOutputCoords() {\n        return int(resultUV.y * &quot;+e[0]+&quot;.0);\n      }\n    &quot;:&quot;\n    int getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(&quot;+e[0]+&quot;, &quot;+e[1]+&quot;));\n      return resTexRC.x * &quot;+e[1]+&quot; + resTexRC.y;\n    }\n  &quot;}(0,e);case 2:return function(t,e){return i.arraysEqual(t,e)?&quot;\n      ivec2 getOutputCoords() {\n        return ivec2(resultUV.yx * vec2(&quot;+e[0]+&quot;, &quot;+e[1]+&quot;));\n      }\n    &quot;:1===t[1]?&quot;\n      ivec2 getOutputCoords() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                               vec2(&quot;+e[0]+&quot;, &quot;+e[1]+&quot;));\n        int index = resTexRC.x * &quot;+e[1]+&quot; + resTexRC.y;\n        return ivec2(index, 0);\n      }\n    &quot;:1===t[0]?&quot;\n      ivec2 getOutputCoords() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                               vec2(&quot;+e[0]+&quot;, &quot;+e[1]+&quot;));\n        int index = resTexRC.x * &quot;+e[1]+&quot; + resTexRC.y;\n        return ivec2(0, index);\n      }\n    &quot;:&quot;\n    ivec2 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(&quot;+e[0]+&quot;, &quot;+e[1]+&quot;));\n      int index = resTexRC.x * &quot;+e[1]+&quot; + resTexRC.y;\n      int r = index / &quot;+t[1]+&quot;;\n      int c = index - r * &quot;+t[1]+&quot;;\n      return ivec2(r, c);\n    }\n  &quot;}(t,e);case 3:return n=t,r=e,o=a.getLogicalCoordinatesFromFlatIndex([&quot;r&quot;,&quot;c&quot;,&quot;d&quot;],n),&quot;\n    ivec3 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(&quot;+r[0]+&quot;, &quot;+r[1]+&quot;));\n      int index = resTexRC.x * &quot;+r[1]+&quot; + resTexRC.y;\n      &quot;+o+&quot;\n      return ivec3(r, c, d);\n    }\n  &quot;;case 4:return function(t,e){var n=a.getLogicalCoordinatesFromFlatIndex([&quot;r&quot;,&quot;c&quot;,&quot;d&quot;,&quot;d2&quot;],t);return&quot;\n    ivec4 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n        vec2(&quot;+e[0]+&quot;, &quot;+e[1]+&quot;));\n      int index = resTexRC.x * &quot;+e[1]+&quot; + resTexRC.y;\n      &quot;+n+&quot;\n      return ivec4(r, c, d, d2);\n    }\n  &quot;}(t,e);case 5:return function(t,e){var n=a.getLogicalCoordinatesFromFlatIndex([&quot;r&quot;,&quot;c&quot;,&quot;d&quot;,&quot;d2&quot;,&quot;d3&quot;],t);return&quot;\n    ivec5 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx * vec2(&quot;+e[0]+&quot;,\n                             &quot;+e[1]+&quot;));\n\n      int index = resTexRC.x * &quot;+e[1]+&quot; + resTexRC.y;\n\n      &quot;+n+&quot;\n\n      ivec5 outShape = ivec5(r, c, d, d2, d3);\n      return outShape;\n    }\n  &quot;}(t,e);case 6:return function(t,e){var n=a.getLogicalCoordinatesFromFlatIndex([&quot;r&quot;,&quot;c&quot;,&quot;d&quot;,&quot;d2&quot;,&quot;d3&quot;,&quot;d4&quot;],t);return&quot;\n    ivec6 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n        vec2(&quot;+e[0]+&quot;, &quot;+e[1]+&quot;));\n      int index = resTexRC.x * &quot;+e[1]+&quot; + resTexRC.y;\n\n      &quot;+n+&quot;\n\n      ivec6 result = ivec6(r, c, d, d2, d3, d4);\n      return result;\n    }\n  &quot;}(t,e);default:throw new Error(t.length+&quot;-D output sampling is not yet supported&quot;)}var n,r,o}(e.logicalShape,_),v=function(t){return&quot;\n    void setOutput(float val) {\n      &quot;+t.output+&quot; = vec4(val, 0, 0, 0);\n    }\n  &quot;}(w)),h&amp;&amp;(E+=p),[E,x,v,y,g,b,n].join(&quot;\n&quot;)};var l=&quot;\nvec2 uvFromFlat(int texNumR, int texNumC, int index) {\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n  int texelIndex = index / 2;\n  int texR = texelIndex / texNumC;\n  int texC = texelIndex - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n&quot;,c=&quot;\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n  int texNumC, int row, int col) {\n  int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n  int texR = texelIndex / texNumC;\n  int texC = texelIndex - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n&quot;,f=&quot;\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n    int texelsInBatch, int texelsInLogicalRow, int b,\n    int row, int col) {\n  int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n&quot;,p=&quot;\n  float getChannel(vec4 frag, vec2 innerDims) {\n    vec2 modCoord = mod(innerDims, 2.);\n    return modCoord.x == 0. ?\n      (modCoord.y == 0. ? frag.r : frag.g) :\n      (modCoord.y == 0. ? frag.b : frag.a);\n  }\n  float getChannel(vec4 frag, int dim) {\n    float modCoord = mod(float(dim), 2.);\n    return modCoord == 0. ? frag.r : frag.g;\n  }\n&quot;;function h(t){return&quot;offset&quot;+t}function d(t){var e=t.name,n=i.sizeFromShape(t.shapeInfo.logicalShape);return n&lt;2?&quot;return &quot;+e+&quot;;&quot;:&quot;\n    for (int i = 0; i &lt; &quot;+n+&quot;; i++) {\n      if (i == index) {\n        return &quot;+e+&quot;[i];\n      }\n    }\n  &quot;}function m(t){if(t&lt;=1)return&quot;int&quot;;if(2===t)return&quot;ivec2&quot;;if(3===t)return&quot;ivec3&quot;;if(4===t)return&quot;ivec4&quot;;if(5===t)return&quot;ivec5&quot;;if(6===t)return&quot;ivec6&quot;;throw Error(&quot;GPU for rank &quot;+t+&quot; is not yet supported&quot;)}function g(t,e){var n=JSON.parse(JSON.stringify(t));return n.shapeInfo.logicalShape=e,n}function v(t,e){return e.map(function(e){return t[e]}).join(&quot;, &quot;)}n.getCoordsDataType=m},{&quot;../../ops/broadcast_util&quot;:158,&quot;../../util&quot;:223,&quot;./glsl_version&quot;:89,&quot;./shader_compiler_util&quot;:117}],117:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../util&quot;);function i(t){return 1===t.length?&quot;&quot;+t[0]:&quot;vec&quot;+t.length+&quot;(&quot;+t.join(&quot;,&quot;)+&quot;)&quot;}n.getLogicalCoordinatesFromFlatIndex=function(t,e,n){void 0===n&amp;&amp;(n=&quot;index&quot;);var i=r.computeStrides(e);return i.map(function(e,r){return&quot;int &quot;+t[r]+&quot; = &quot;+n+&quot; / &quot;+e+&quot;; &quot;+(r===i.length-1?&quot;int &quot;+t[r+1]+&quot; = &quot;+n+&quot; - &quot;+t[r]+&quot; * &quot;+e:&quot;index -= &quot;+t[r]+&quot; * &quot;+e)+&quot;;&quot;}).join(&quot;&quot;)},n.dotify=function(t,e){if(t.length!==e.length)throw new Error(&quot;Vectors to be dotted must be of the same length -got &quot;+t.length+&quot; and &quot;+e.length);for(var n=[],r=Math.floor(t.length/4),o=t.length%4,a=0;a&lt;r;a++){var s=t.slice(4*a,4*a+4),u=e.slice(4*a,4*a+4);n.push(i(s)+&quot;, &quot;+i(u))}0!==o&amp;&amp;(s=t.slice(4*r),u=e.slice(4*r),1===s.length&amp;&amp;(s=s.map(function(t){return&quot;float(&quot;+t+&quot;)&quot;}),u=u.map(function(t){return&quot;float(&quot;+t+&quot;)&quot;})),n.push(i(s)+&quot;, &quot;+i(u)));return n.map(function(t,e){return&quot;dot(&quot;+t+&quot;)&quot;}).join(&quot;+&quot;)}},{&quot;../../util&quot;:223}],118:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){function t(t){this.variableNames=[&quot;source&quot;],this.outputShape=t,this.rank=t.length;var e,n=r.getCoordsDataType(this.rank),i=&quot;uniform int start[&quot;+this.rank+&quot;];&quot;,a=function(t){if(1===t)return&quot;sourceLoc&quot;;if(t&lt;=6)return o.slice(0,t).map(function(t){return&quot;sourceLoc.&quot;+t}).join(&quot;,&quot;);throw Error(&quot;Slicing for rank &quot;+t+&quot; is not yet supported&quot;)}(this.rank);e=&quot;\n        &quot;+n+&quot; sourceLoc;\n        &quot;+n+&quot; coords = getOutputCoords();\n        &quot;+t.map(function(t,e){return&quot;sourceLoc.&quot;+o[e]+&quot; = start[&quot;+e+&quot;] + coords.&quot;+o[e]+&quot;;&quot;}).join(&quot;\n&quot;)+&quot;\n      &quot;,this.userCode=&quot;\n      &quot;+i+&quot;\n      void main() {\n        &quot;+e+&quot;\n        setOutput(getSource(&quot;+a+&quot;));\n      }\n    &quot;}return t.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error(&quot;The rank (&quot;+this.rank+&quot;) of the program must match the length of start (&quot;+t.length+&quot;)&quot;);return function(n,r){null==e.startLoc&amp;&amp;(e.startLoc=n.getUniformLocationNoThrow(r,&quot;start&quot;),null==e.startLoc)||n.gl.uniform1iv(e.startLoc,t)}},t}();n.SliceProgram=i;var o=[&quot;x&quot;,&quot;y&quot;,&quot;z&quot;,&quot;w&quot;,&quot;u&quot;,&quot;v&quot;]},{&quot;./shader_compiler&quot;:116}],119:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=t(&quot;../packing_util&quot;),o=function(){function t(t){this.variableNames=[&quot;source&quot;],this.usesPackedTextures=!0,this.outputShape=t,this.rank=t.length;var e=r.getCoordsDataType(this.rank),n=i.getChannels(&quot;coords&quot;,this.rank),o=i.getChannels(&quot;sourceLoc&quot;,this.rank),a=1===this.rank?&quot;sourceLoc&quot;:&quot;vec2(&quot;+o.slice(-2).join()+&quot;)&quot;,s=&quot;getChannel(getSource(&quot;+o.join()+&quot;), &quot;+a+&quot;)&quot;,u=&quot;\n      result.x = &quot;+s+&quot;;\n      if (++&quot;+n[this.rank-1]+&quot; &lt; &quot;+t[this.rank-1]+&quot;) {\n        ++&quot;+o[this.rank-1]+&quot;;\n        result.y = &quot;+s+&quot;;\n        --&quot;+o[this.rank-1]+&quot;;\n      }\n    &quot;,l=1===this.rank?&quot;&quot;:&quot;\n      --&quot;+n[this.rank-1]+&quot;;\n      if (++&quot;+n[this.rank-2]+&quot; &lt; &quot;+t[this.rank-2]+&quot;) {\n        ++&quot;+o[this.rank-2]+&quot;;\n        result.z = &quot;+s+&quot;;\n        if (++&quot;+n[this.rank-1]+&quot; &lt; &quot;+t[this.rank-1]+&quot;) {\n          ++&quot;+o[this.rank-1]+&quot;;\n          result.w = &quot;+s+&quot;;\n        }\n      }\n    &quot;,c=this.rank&lt;=4?&quot;sourceLoc = coords +\n            &quot;+e+&quot;(&quot;+t.map(function(t,e){return&quot;start[&quot;+e+&quot;]&quot;}).join()+&quot;);&quot;:t.map(function(t,e){return o[e]+&quot; = &quot;+n[e]+&quot; + start[&quot;+e+&quot;];&quot;}).join(&quot;\n&quot;);this.userCode=&quot;\n      uniform int start[&quot;+this.rank+&quot;];\n      void main() {\n        &quot;+e+&quot; coords = getOutputCoords();\n        &quot;+e+&quot; sourceLoc;\n        &quot;+c+&quot; \n        vec4 result = vec4(0.);\n        &quot;+u+&quot;\n        &quot;+l+&quot;\n        setOutput(result);\n      }\n    &quot;}return t.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error(&quot;The rank (&quot;+this.rank+&quot;) of the program must match the length of start (&quot;+t.length+&quot;)&quot;);return function(n,r){null==e.startLoc&amp;&amp;(e.startLoc=n.getUniformLocationNoThrow(r,&quot;start&quot;),null==e.startLoc)||n.gl.uniform1iv(e.startLoc,t)}},t}();n.SlicePackedProgram=o},{&quot;../packing_util&quot;:54,&quot;./shader_compiler&quot;:116}],120:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){return function(t,e,n,i){this.variableNames=[&quot;x&quot;];var o=n.filter(function(t,e){return-1===i.indexOf(e)});this.outputShape=o;var a=n.length,s=r.getCoordsDataType(n.length),u=r.getCoordsDataType(o.length),l=&quot;&quot;;if(1===a)l=&quot;coords * strides + begin&quot;;else{var c=0;l=n.map(function(t,e){return-1===i.indexOf(e)?(c++,1===o.length?&quot;coords * strides[&quot;+e+&quot;] + begin[&quot;+e+&quot;]&quot;:&quot;coords[&quot;+(c-1)+&quot;] * strides[&quot;+e+&quot;] + begin[&quot;+e+&quot;]&quot;):&quot;begin[&quot;+e+&quot;]&quot;}).join(&quot;,&quot;)}this.userCode=&quot;\n      &quot;+s+&quot; begin = &quot;+s+&quot;(&quot;+t+&quot;);\n      &quot;+s+&quot; strides = &quot;+s+&quot;(&quot;+e+&quot;);\n\n      void main() {\n        &quot;+u+&quot; coords = getOutputCoords();\n        setOutput(getX(&quot;+l+&quot;));\n      }\n    &quot;}}();n.StridedSliceProgram=i},{&quot;./shader_compiler&quot;:116}],121:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../util&quot;);function i(t,e){return t*e}function o(t,e){if(t%e!=0)throw new Error(&quot;unpackedSize (&quot;+t+&quot;) must be a multiple of &quot;+e);return t/e}function a(t,e){return[Math.max(1,Math.ceil(e/2)),Math.max(1,Math.ceil(t/2))]}!function(t){t[t.RENDER=0]=&quot;RENDER&quot;,t[t.UPLOAD=1]=&quot;UPLOAD&quot;,t[t.PIXELS=2]=&quot;PIXELS&quot;,t[t.DOWNLOAD=3]=&quot;DOWNLOAD&quot;}(n.TextureUsage||(n.TextureUsage={})),function(t){t[t.UNPACKED_FLOAT16=0]=&quot;UNPACKED_FLOAT16&quot;,t[t.UNPACKED_FLOAT32=1]=&quot;UNPACKED_FLOAT32&quot;,t[t.PACKED_4X1_UNSIGNED_BYTE=2]=&quot;PACKED_4X1_UNSIGNED_BYTE&quot;,t[t.PACKED_2X2_FLOAT32=3]=&quot;PACKED_2X2_FLOAT32&quot;,t[t.PACKED_2X2_FLOAT16=4]=&quot;PACKED_2X2_FLOAT16&quot;}(n.PhysicalTextureType||(n.PhysicalTextureType={})),n.getUnpackedMatrixTextureShapeWidthHeight=function(t,e){return[e,t]},n.getUnpackedArraySizeFromMatrixSize=i,n.getColorMatrixTextureShapeWidthHeight=function(t,e){return[4*e,t]},n.getMatrixSizeFromUnpackedArraySize=o,n.encodeMatrixToUnpackedArray=function(t,e,n){var r=i(t.length,n);if(e.length&lt;r)throw new Error(&quot;unpackedArray length (&quot;+e.length+&quot;) must be &gt;= &quot;+r);for(var o=0,a=0;a&lt;t.length;++a)e[o]=t[a],o+=n},n.decodeMatrixFromUnpackedArray=function(t,e,n){var r=o(t.length,n);if(e.length&lt;r)throw new Error(&quot;matrix length (&quot;+e.length+&quot;) must be &gt;= &quot;+r);for(var i=0,a=0;a&lt;t.length;a+=n)e[i++]=t[a]},n.decodeMatrixFromUnpackedColorRGBAArray=function(t,e,n){var r=t.length*n/4;if(e.length&lt;r)throw new Error(&quot;matrix length (&quot;+e.length+&quot;) must be &gt;= &quot;+r);for(var i=0,o=0;o&lt;t.length;o+=4)for(var a=0;a&lt;n;a++)e[i++]=t[o+a]},n.getPackedMatrixTextureShapeWidthHeight=a,n.getPackedRGBAArraySizeFromMatrixShape=function(t,e){var n=a(t,e);return n[0]*n[1]*4},n.encodeMatrixToPackedRGBA=function(t,e,n,i,o){for(var a=i%2==1,s=n%2==1,u=Math.floor(i/2),l=Math.floor(n/2),c=Math.ceil(i/2),f=c*Math.ceil(n/2),p=r.nearestLargerEven(n)*r.nearestLargerEven(i),h=0;h&lt;e;h++){for(var d=h*n*i,m=h*p,g=a?4:0,v=i,y=m,b=0;b&lt;l;++b){for(var _=2*b*i,w=0;w&lt;u;++w){var x=d+_+2*w;o[y]=t[x],o[y+1]=t[x+1],o[y+2]=t[x+v],o[y+3]=t[x+v+1],y+=4}y+=g}if(a){x=d+i-1,y=m+4*(c-1);var E=2*i;for(g=4*c,b=0;b&lt;l;++b)o[y]=t[x],o[y+2]=t[x+i],x+=E,y+=g}if(s){for(x=d+(n-1)*i,y=m+4*(f-c),w=0;w&lt;u;++w)o[y++]=t[x++],o[y++]=t[x++],y+=2;a&amp;&amp;s&amp;&amp;(o[m+p-4]=t[x])}}return o},n.decodeMatrixFromPackedRGBA=function(t,e,n,i,o){var a=n*i;if(o.length&lt;a)throw new Error(&quot;matrix length (&quot;+o.length+&quot;) must be &gt;= &quot;+a);for(var s=i%2==1,u=n%2==1,l=Math.floor(i/2),c=Math.floor(n/2),f=Math.ceil(i/2),p=f*Math.ceil(n/2),h=r.nearestLargerEven(n)*r.nearestLargerEven(i),d=0;d&lt;e;d++){for(var m=d*n*i,g=d*h,v=s?4:0,y=i+(s?1:0),b=g,_=m,w=m+i,x=0;x&lt;c;++x){for(var E=0;E&lt;l;++E)o[_++]=t[b++],o[_++]=t[b++],o[w++]=t[b++],o[w++]=t[b++];b+=v,_+=y,w+=y}if(s){b=g+4*(f-1);var k=m+i-1;for(v=4*f,y=2*i,x=0;x&lt;c;++x)o[k]=t[b],o[k+i]=t[b+2],b+=v,k+=y}if(u){for(b=g+4*(p-f),k=m+(n-1)*i,E=0;E&lt;l;++E)o[k++]=t[b++],o[k++]=t[b++],b+=2;s&amp;&amp;(o[m+n*i-1]=t[b])}}return o}},{&quot;../../util&quot;:223}],122:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../environment&quot;),i=t(&quot;./tex_util&quot;),o=function(){function t(t){this.gpgpu=t,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return t.prototype.acquireTexture=function(t,e,n){var r,o=a(e,n),u=s(t,o,n);if(u in this.freeTextures||(this.freeTextures[u]=[]),u in this.usedTextures||(this.usedTextures[u]=[]),this.freeTextures[u].length&gt;0){this.numFreeTextures--,this.numUsedTextures++,this.log();var l=this.freeTextures[u].shift();return this.usedTextures[u].push(l),l}return this.numUsedTextures++,this.log(),o===i.PhysicalTextureType.PACKED_2X2_FLOAT32?r=this.gpgpu.createPackedMatrixTexture(t[0],t[1]):o===i.PhysicalTextureType.PACKED_2X2_FLOAT16?r=this.gpgpu.createFloat16PackedMatrixTexture(t[0],t[1]):o===i.PhysicalTextureType.UNPACKED_FLOAT32?r=this.gpgpu.createFloat32MatrixTexture(t[0],t[1]):o===i.PhysicalTextureType.UNPACKED_FLOAT16?r=this.gpgpu.createFloat16MatrixTexture(t[0],t[1]):o===i.PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE&amp;&amp;(r=this.gpgpu.createUnsignedBytesMatrixTexture(t[0],t[1])),this.usedTextures[u].push(r),r},t.prototype.releaseTexture=function(t,e,n,r){if(null!=this.freeTextures){var i=s(e,a(n,r),r);i in this.freeTextures||(this.freeTextures[i]=[]),this.freeTextures[i].push(t),this.numFreeTextures++,this.numUsedTextures--;var o=this.usedTextures[i],u=o.indexOf(t);if(u&lt;0)throw new Error(&quot;Cannot release a texture that was never provided by this texture manager&quot;);o.splice(u,1),this.log()}},t.prototype.log=function(){if(this.logEnabled){var t=this.numFreeTextures+this.numUsedTextures;console.log(&quot;Free/Used&quot;,this.numFreeTextures+&quot; / &quot;+this.numUsedTextures,&quot;(&quot;+t+&quot;)&quot;)}},t.prototype.getNumUsedTextures=function(){return this.numUsedTextures},t.prototype.getNumFreeTextures=function(){return this.numFreeTextures},t.prototype.dispose=function(){var t=this;if(null!=this.freeTextures){for(var e in this.freeTextures)this.freeTextures[e].forEach(function(e){t.gpgpu.deleteMatrixTexture(e)});for(var e in this.usedTextures)this.usedTextures[e].forEach(function(e){t.gpgpu.deleteMatrixTexture(e)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},t}();function a(t,e){if(t===i.TextureUsage.UPLOAD)return e?i.PhysicalTextureType.PACKED_2X2_FLOAT32:i.PhysicalTextureType.UNPACKED_FLOAT32;if(t===i.TextureUsage.RENDER||null==t)return e?r.ENV.getBool(&quot;WEBGL_RENDER_FLOAT32_ENABLED&quot;)?i.PhysicalTextureType.PACKED_2X2_FLOAT32:i.PhysicalTextureType.PACKED_2X2_FLOAT16:r.ENV.getBool(&quot;WEBGL_RENDER_FLOAT32_ENABLED&quot;)?i.PhysicalTextureType.UNPACKED_FLOAT32:i.PhysicalTextureType.UNPACKED_FLOAT16;if(t===i.TextureUsage.DOWNLOAD||t===i.TextureUsage.PIXELS)return i.PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE;throw new Error(&quot;Unknown logical texture type &quot;+t)}function s(t,e,n){return t[0]+&quot;_&quot;+t[1]+&quot;_&quot;+e+&quot;_&quot;+n}n.TextureManager=o},{&quot;../../environment&quot;:134,&quot;./tex_util&quot;:121}],123:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){return function(t,e){this.variableNames=[&quot;A&quot;];for(var n=new Array(t.length),i=0;i&lt;n.length;i++)n[i]=t[i]*e[i];this.outputShape=n,this.rank=n.length;var o=r.getCoordsDataType(this.rank),a=function(t){var e=t.length;if(e&gt;5)throw Error(&quot;Tile for rank &quot;+e+&quot; is not yet supported&quot;);if(1===e)return&quot;imod(resRC, &quot;+t[0]+&quot;)&quot;;for(var n=[&quot;resRC.x&quot;,&quot;resRC.y&quot;,&quot;resRC.z&quot;,&quot;resRC.w&quot;,&quot;resRC.u&quot;],r=[],i=0;i&lt;t.length;i++)r.push(&quot;imod(&quot;+n[i]+&quot;, &quot;+t[i]+&quot;)&quot;);return r.join()}(t);this.userCode=&quot;\n      void main() {\n        &quot;+o+&quot; resRC = getOutputCoords();\n        setOutput(getA(&quot;+a+&quot;));\n      }\n    &quot;}}();n.TileProgram=i},{&quot;./shader_compiler&quot;:116}],124:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=function(){return function(t,e){this.variableNames=[&quot;A&quot;];for(var n=new Array(t.length),i=0;i&lt;n.length;i++)n[i]=t[e[i]];this.outputShape=n,this.rank=n.length;var o=r.getCoordsDataType(this.rank),a=function(t){var e=t.length;if(e&gt;6)throw Error(&quot;Transpose for rank &quot;+e+&quot; is not yet supported&quot;);for(var n=[&quot;resRC.x&quot;,&quot;resRC.y&quot;,&quot;resRC.z&quot;,&quot;resRC.w&quot;,&quot;resRC.u&quot;,&quot;resRC.v&quot;],r=new Array(e),i=0;i&lt;t.length;i++)r[t[i]]=n[i];return r.join()}(e);this.userCode=&quot;\n    void main() {\n      &quot;+o+&quot; resRC = getOutputCoords();\n      setOutput(getA(&quot;+a+&quot;));\n    }\n    &quot;}}();n.TransposeProgram=i},{&quot;./shader_compiler&quot;:116}],125:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./shader_compiler&quot;),i=t(&quot;../packing_util&quot;),o=function(){return function(t,e){this.variableNames=[&quot;A&quot;],this.usesPackedTextures=!0;for(var n=new Array(t.length),o=0;o&lt;n.length;o++)n[o]=t[e[o]];if(this.outputShape=n,this.rank=n.length,this.rank&gt;6)throw Error(&quot;Packed transpose for rank &quot;+this.rank+&quot; is not yet supported.&quot;);var a=r.getCoordsDataType(this.rank),s=i.getVecChannels(&quot;rc&quot;,this.rank),u=new Array(this.rank);for(o=0;o&lt;e.length;o++)u[e[o]]=s[o];var l=&quot;vec2(&quot;+u.slice(-2).join()+&quot;)&quot;,c=&quot;++&quot;+s[this.rank-1]+&quot; &lt; &quot;+n[this.rank-1],f=&quot;getChannel(getA(&quot;+u.join()+&quot;), &quot;+l+&quot;)&quot;;this.userCode=&quot;\n    void main() {\n      &quot;+a+&quot; rc = getOutputCoords();\n      vec4 result = vec4(0.);\n      result[0] = &quot;+f+&quot;;\n      if(&quot;+c+&quot;) {\n        result[1] = &quot;+f+&quot;;\n      }\n      --&quot;+s[this.rank-1]+&quot;;\n      if(++&quot;+s[this.rank-2]+&quot; &lt; &quot;+n[this.rank-2]+&quot;) {\n        result[2] = &quot;+f+&quot;;\n        if(&quot;+c+&quot;) {\n          result[3] = &quot;+f+&quot;;\n        }\n      }  \n      setOutput(result);\n    }\n    &quot;}}();n.TransposePackedProgram=o},{&quot;../packing_util&quot;:54,&quot;./shader_compiler&quot;:116}],126:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../ops/erf_util&quot;),i=t(&quot;../../ops/selu_util&quot;),o=function(){return function(t,e){this.variableNames=[&quot;A&quot;],this.outputShape=t,this.userCode=&quot;\n      float unaryOperation(float x) {\n        &quot;+e+&quot;\n      }\n\n      void main() {\n        float x = getAAtOutCoords();\n        float y = unaryOperation(x);\n\n        setOutput(y);\n      }\n    &quot;}}();n.UnaryOpProgram=o;var a=&quot;if (isnan(x)) return x;&quot;;n.LINEAR=&quot;return x;&quot;,n.ABS=&quot;return abs(x);&quot;,n.RELU=a+&quot;\n  return (x &lt; 0.0) ? 0.0 : x;\n&quot;,n.ELU=&quot;return (x &gt;= 0.0) ? x : (exp(x) - 1.0);&quot;,n.SELU=&quot;\n  // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n  // see: https://arxiv.org/abs/1706.02515\n  float scaleAlpha = &quot;+i.SELU_SCALEALPHA+&quot;;\n  float scale = &quot;+i.SELU_SCALE+&quot;;\n  return (x &gt;= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n&quot;,n.STEP=function(t){return void 0===t&amp;&amp;(t=0),a+&quot;\n    return x &gt; 0.0 ? 1.0 : float(&quot;+t+&quot;);\n  &quot;},n.NEG=&quot;return -x;&quot;,n.CEIL=&quot;return ceil(x);&quot;,n.FLOOR=&quot;return floor(x);&quot;,n.SIGN=&quot;\n  if (isnan(x)) { return 0.0; }\n  return sign(x);\n&quot;,n.IS_NAN=&quot;return float(isnan(x));&quot;,n.IS_INF=&quot;return float(isinf(x));&quot;,n.IS_FINITE=&quot;return float(!isnan(x) &amp;&amp; !isinf(x));&quot;,n.ROUND=&quot;\n  // OpenGL ES does not support round function.\n  // The algorithm is based on banker&apos;s rounding.\n  float base = floor(x);\n  if ((x - base) &lt; 0.5) {\n    return floor(x);\n  } else if ((x - base) &gt; 0.5) {\n    return ceil(x);\n  } else {\n    if (mod(base, 2.0) == 0.0) {\n      return base;\n    } else {\n      return base + 1.0;\n    }\n  }\n&quot;,n.EXP=&quot;return exp(x);&quot;,n.EXPM1=&quot;return exp(x) - 1.0;&quot;,n.LOG=&quot;if (x &lt; 0.0) return NAN;\n  return log(x);&quot;,n.LOG1P=&quot;return log(1.0 + x);&quot;,n.SQRT=&quot;return sqrt(x);&quot;,n.RSQRT=&quot;return inversesqrt(x);&quot;,n.SIGMOID=&quot;return 1.0 / (1.0 + exp(-1.0 * x));&quot;,n.SOFTPLUS=&quot;\n  float epsilon = 1.1920928955078125e-7;\n  float threshold = log(epsilon) + 2.0;\n\n  bool too_large = x &gt; -threshold;\n  bool too_small = x &lt; threshold;\n\n  float result;\n  float exp_x = exp(x);\n\n  if (too_large){\n    result = x;\n  }\n  else if (too_small){\n    result = exp_x;\n  }\n  else{\n    result = log(exp_x + 1.0);\n  }\n  return result;\n&quot;,n.SIN=a+&quot;\n  return sin(x);\n&quot;,n.COS=a+&quot;\n  return cos(x);\n&quot;,n.TAN=&quot;return tan(x);&quot;,n.ASIN=&quot;return asin(x);&quot;,n.ACOS=&quot;return acos(x);&quot;,n.ATAN=a+&quot;\n  return atan(x);\n&quot;,n.SINH=&quot;\n  float e2x = exp(x);\n  return (e2x - 1.0 / e2x) / 2.0;\n&quot;,n.COSH=&quot;\n  float e2x = exp(-x);\n  return (e2x + 1.0 / e2x) / 2.0;\n&quot;,n.TANH=&quot;\n  float e2x = exp(-2.0 * abs(x));\n  return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n&quot;,n.ASINH=&quot;return log(x + sqrt(x * x + 1.0));&quot;,n.ACOSH=a+&quot;\n  if (x &lt; 1.0) return NAN;\n  return log(x + sqrt(x * x - 1.0));&quot;,n.ATANH=a+&quot;\n  if ((x &lt; -1.0) || (x &gt; 1.0)) return NAN;\n  return (log(1.0 + x) - log(1.0 - x)) / 2.0;&quot;,n.ERF=&apos;\n  // Error function is calculated approximately with elementary function.\n  // See &quot;Handbook of Mathematical Functions with Formulas,\n  // Graphs, and Mathematical Tables&quot;, Abramowitz and Stegun.\n  float p = &apos;+r.ERF_P+&quot;;\n  float a1 = &quot;+r.ERF_A1+&quot;;\n  float a2 = &quot;+r.ERF_A2+&quot;;\n  float a3 = &quot;+r.ERF_A3+&quot;;\n  float a4 = &quot;+r.ERF_A4+&quot;;\n  float a5 = &quot;+r.ERF_A5+&quot;;\n\n  float t = 1.0 / (1.0 + p * x);\n  return 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);\n&quot;,n.SQUARE=&quot;return x * x;&quot;,n.RECIPROCAL=&quot;return 1.0 / x;&quot;,n.LOGICAL_NOT=&quot;return float(!(x &gt;= 1.0));&quot;,n.TO_INT=&quot;return float(int(x));&quot;,n.CLONE=&quot;return x;&quot;},{&quot;../../ops/erf_util&quot;:167,&quot;../../ops/selu_util&quot;:192}],127:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.LINEAR=&quot;return x;&quot;,n.LOG=&quot;\n  vec4 result = log(x);\n  vec4 isNaN = vec4(lessThan(x, vec4(0.0)));\n  result.r = isNaN.r == 1.0 ? NAN : result.r;\n  result.g = isNaN.g == 1.0 ? NAN : result.g;\n  result.b = isNaN.b == 1.0 ? NAN : result.b;\n  result.a = isNaN.a == 1.0 ? NAN : result.a;\n\n  return result;\n&quot;,n.RELU=&quot;\n  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n  bvec4 isNaN = isnan(x);\n\n  result.r = isNaN.r ? x.r : result.r;\n  result.g = isNaN.g ? x.g : result.g;\n  result.b = isNaN.b ? x.b : result.b;\n  result.a = isNaN.a ? x.a : result.a;\n\n  return result;\n&quot;;var r=function(){return function(t,e){this.variableNames=[&quot;A&quot;],this.usesPackedTextures=!0,this.outputShape=t,this.userCode=&quot;\n      vec4 unaryOperation(vec4 x) {\n        &quot;+e+&quot;\n      }\n\n      void main() {\n        vec4 x = getAAtOutCoords();\n        vec4 y = unaryOperation(x);\n\n        setOutput(y);\n      }\n    &quot;}}();n.UnaryOpPackedProgram=r},{}],128:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../packing_util&quot;),i=t(&quot;./shader_compiler&quot;),o=function(){return function(t){this.variableNames=[&quot;A&quot;],this.usesPackedTextures=!0,this.outputShape=t;var e=t.length,n=r.getChannels(&quot;rc&quot;,e),o=i.getCoordsDataType(e),a=r.getSourceCoords(e,n),s=n.slice(-2),u=e&lt;=1?&quot;rc&quot;:&quot;vec2(&quot;+s.join(&quot;,&quot;)+&quot;)&quot;;this.userCode=&quot;\n      void main() {\n        &quot;+o+&quot; rc = getOutputCoords();\n        vec4 packedInput = getA(&quot;+a+&quot;);\n\n        setOutput(getChannel(packedInput, &quot;+u+&quot;));\n      }\n    &quot;}}();n.UnpackProgram=o},{&quot;../packing_util&quot;:54,&quot;./shader_compiler&quot;:116}],129:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../../environment&quot;),i=t(&quot;../../util&quot;),o=t(&quot;./canvas_util&quot;);function a(t,e,n){var r=n();return e&amp;&amp;function(t){var e=t.getError();if(e!==t.NO_ERROR)throw new Error(&quot;WebGL Error: &quot;+l(t,e))}(t),r}n.callAndCheck=a;var s=5.96e-8,u=65504;function l(t,e){switch(e){case t.NO_ERROR:return&quot;NO_ERROR&quot;;case t.INVALID_ENUM:return&quot;INVALID_ENUM&quot;;case t.INVALID_VALUE:return&quot;INVALID_VALUE&quot;;case t.INVALID_OPERATION:return&quot;INVALID_OPERATION&quot;;case t.INVALID_FRAMEBUFFER_OPERATION:return&quot;INVALID_FRAMEBUFFER_OPERATION&quot;;case t.OUT_OF_MEMORY:return&quot;OUT_OF_MEMORY&quot;;case t.CONTEXT_LOST_WEBGL:return&quot;CONTEXT_LOST_WEBGL&quot;;default:return&quot;Unknown error code &quot;+e}}n.canBeRepresented=function(t){return!!(r.ENV.getBool(&quot;WEBGL_RENDER_FLOAT32_ENABLED&quot;)||0===t||s&lt;Math.abs(t)&amp;&amp;Math.abs(t)&lt;u)},n.getWebGLErrorMessage=l,n.getExtensionOrThrow=function(t,e,n){return h(t,e,function(){return t.getExtension(n)},&apos;Extension &quot;&apos;+n+&apos;&quot; not supported on this browser.&apos;)},n.createVertexShader=function(t,e,n){var r=h(t,e,function(){return t.createShader(t.VERTEX_SHADER)},&quot;Unable to create vertex WebGLShader.&quot;);if(a(t,e,function(){return t.shaderSource(r,n)}),a(t,e,function(){return t.compileShader(r)}),!1===t.getShaderParameter(r,t.COMPILE_STATUS))throw console.log(t.getShaderInfoLog(r)),new Error(&quot;Failed to compile vertex shader.&quot;);return r},n.createFragmentShader=function(t,e,n){var r=h(t,e,function(){return t.createShader(t.FRAGMENT_SHADER)},&quot;Unable to create fragment WebGLShader.&quot;);if(a(t,e,function(){return t.shaderSource(r,n)}),a(t,e,function(){return t.compileShader(r)}),!1===t.getShaderParameter(r,t.COMPILE_STATUS))throw function(t,e){var n=c.exec(e);if(null==n)return console.log(&quot;Couldn&apos;t parse line number in error: &quot;+e),void console.log(t);for(var r=+n[1],o=t.split(&quot;\n&quot;),a=o.length.toString().length+2,s=o.map(function(t,e){return i.rightPad((e+1).toString(),a)+t}),u=0,l=0;l&lt;s.length;l++)u=Math.max(s[l].length,u);var f=s.slice(0,r-1),p=s.slice(r-1,r),h=s.slice(r);console.log(f.join(&quot;\n&quot;)),console.log(e.split(&quot;\n&quot;)[0]),console.log(&quot;%c &quot;+i.rightPad(p[0],u),&quot;border:1px solid red; background-color:#e3d2d2; color:#a61717&quot;),console.log(h.join(&quot;\n&quot;))}(n,t.getShaderInfoLog(r)),new Error(&quot;Failed to compile fragment shader.&quot;);return r};var c=/ERROR: [0-9]+:([0-9]+):/g;function f(t,e,n,r){d(t,r),a(t,e,function(){return t.activeTexture(t.TEXTURE0+r)}),a(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)})}function p(t,e){switch(e){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return&quot;FRAMEBUFFER_INCOMPLETE_ATTACHMENT&quot;;case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return&quot;FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT&quot;;case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return&quot;FRAMEBUFFER_INCOMPLETE_DIMENSIONS&quot;;case t.FRAMEBUFFER_UNSUPPORTED:return&quot;FRAMEBUFFER_UNSUPPORTED&quot;;default:return&quot;unknown error &quot;+e}}function h(t,e,n,r){var i=a(t,e,function(){return n()});if(null==i)throw new Error(r);return i}function d(t,e){var n=t.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=e+t.TEXTURE0;if(r&lt;t.TEXTURE0||r&gt;n)throw new Error(&quot;textureUnit must be in &quot;+(&quot;[gl.TEXTURE0, gl.TEXTURE&quot;+n+&quot;]&quot;)+&quot;.&quot;)}function m(t,e){return void 0===e&amp;&amp;(e=2),i.sizeFromShape(t.slice(0,t.length-e))}function g(t){if(0===t.length)throw Error(&quot;Cannot get rows and columns of an empty shape array.&quot;);return[t.length&gt;1?t[t.length-2]:1,t[t.length-1]]}function v(t){return t%2==0}function y(t,e){return null!=t.getExtension(e)}function b(t,e){var n=t.createFramebuffer(),r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);var i=2===e?t.RGBA32F:t.RGBA;t.texImage2D(t.TEXTURE_2D,0,i,1,1,0,t.RGBA,t.FLOAT,null),t.bindFramebuffer(t.FRAMEBUFFER,n),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(r),t.deleteFramebuffer(n),o}n.createProgram=function(t,e){return h(t,e,function(){return t.createProgram()},&quot;Unable to create WebGLProgram.&quot;)},n.linkProgram=function(t,e,n){if(a(t,e,function(){return t.linkProgram(n)}),!1===t.getProgramParameter(n,t.LINK_STATUS))throw console.log(t.getProgramInfoLog(n)),new Error(&quot;Failed to link vertex and fragment shaders.&quot;)},n.validateProgram=function(t,e,n){if(a(t,e,function(){return t.validateProgram(n)}),!1===t.getProgramParameter(n,t.VALIDATE_STATUS))throw console.log(t.getProgramInfoLog(n)),new Error(&quot;Shader program validation failed.&quot;)},n.createStaticVertexBuffer=function(t,e,n){var r=h(t,e,function(){return t.createBuffer()},&quot;Unable to create WebGLBuffer&quot;);return a(t,e,function(){return t.bindBuffer(t.ARRAY_BUFFER,r)}),a(t,e,function(){return t.bufferData(t.ARRAY_BUFFER,n,t.STATIC_DRAW)}),r},n.createStaticIndexBuffer=function(t,e,n){var r=h(t,e,function(){return t.createBuffer()},&quot;Unable to create WebGLBuffer&quot;);return a(t,e,function(){return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,r)}),a(t,e,function(){return t.bufferData(t.ELEMENT_ARRAY_BUFFER,n,t.STATIC_DRAW)}),r},n.getNumChannels=function(){return 2===r.ENV.getNumber(&quot;WEBGL_VERSION&quot;)?1:4},n.createTexture=function(t,e){return h(t,e,function(){return t.createTexture()},&quot;Unable to create WebGLTexture.&quot;)},n.validateTextureSize=function(t,e){var n=r.ENV.getNumber(&quot;WEBGL_MAX_TEXTURE_SIZE&quot;);if(t&lt;=0||e&lt;=0){var i=&quot;[&quot;+t+&quot;x&quot;+e+&quot;]&quot;;throw new Error(&quot;Requested texture size &quot;+i+&quot; is invalid.&quot;)}if(t&gt;n||e&gt;n)throw i=&quot;[&quot;+t+&quot;x&quot;+e+&quot;]&quot;,new Error(&quot;Requested texture size &quot;+i+&quot; greater than WebGL maximum on this browser / GPU [&quot;+n+&quot;x&quot;+n+&quot;].&quot;)},n.createFramebuffer=function(t,e){return h(t,e,function(){return t.createFramebuffer()},&quot;Unable to create WebGLFramebuffer.&quot;)},n.bindVertexBufferToProgramAttribute=function(t,e,n,r,i,o,s,u){var l=t.getAttribLocation(n,r);return-1!==l&amp;&amp;(a(t,e,function(){return t.bindBuffer(t.ARRAY_BUFFER,i)}),a(t,e,function(){return t.vertexAttribPointer(l,o,t.FLOAT,!1,s,u)}),a(t,e,function(){return t.enableVertexAttribArray(l)}),!0)},n.bindTextureUnit=f,n.unbindTextureUnit=function(t,e,n){d(t,n),a(t,e,function(){return t.activeTexture(t.TEXTURE0+n)}),a(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})},n.getProgramUniformLocationOrThrow=function(t,e,n,r){return h(t,e,function(){return t.getUniformLocation(n,r)},&apos;uniform &quot;&apos;+r+&apos;&quot; not present in program.&apos;)},n.getProgramUniformLocation=function(t,e,n){return t.getUniformLocation(e,n)},n.bindTextureToProgramUniformSampler=function(t,e,n,r,i,o){a(t,e,function(){return f(t,e,r,o)}),a(t,e,function(){return t.uniform1i(i,o)})},n.bindCanvasToFramebuffer=function(t,e){a(t,e,function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)}),a(t,e,function(){return t.viewport(0,0,t.canvas.width,t.canvas.height)}),a(t,e,function(){return t.scissor(0,0,t.canvas.width,t.canvas.height)})},n.bindColorTextureToFramebuffer=function(t,e,n,r){a(t,e,function(){return t.bindFramebuffer(t.FRAMEBUFFER,r)}),a(t,e,function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)})},n.unbindColorTextureFromFramebuffer=function(t,e,n){a(t,e,function(){return t.bindFramebuffer(t.FRAMEBUFFER,n)}),a(t,e,function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,null,0)})},n.validateFramebuffer=function(t){var e=t.checkFramebufferStatus(t.FRAMEBUFFER);if(e!==t.FRAMEBUFFER_COMPLETE)throw new Error(&quot;Error binding framebuffer: &quot;+p(t,e))},n.getFramebufferErrorMessage=p,n.getBatchDim=m,n.getRowsCols=g,n.getTextureShapeFromLogicalShape=function(t,e){var n;void 0===e&amp;&amp;(e=!1);var o=r.ENV.getNumber(&quot;WEBGL_MAX_TEXTURE_SIZE&quot;);if(e&amp;&amp;(o*=2,1===(t=t.map(function(e,n){return n&gt;=t.length-2?i.nearestLargerEven(t[n]):t[n]})).length&amp;&amp;(t=[2,t[0]])),2!==t.length){var a=i.squeezeShape(t);t=a.newShape}var s=i.sizeFromShape(t);if(t.length&lt;=1&amp;&amp;s&lt;=o)return[1,s];if(2===t.length&amp;&amp;t[0]&lt;=o&amp;&amp;t[1]&lt;=o)return t;if(3===t.length&amp;&amp;t[0]*t[1]&lt;=o&amp;&amp;t[2]&lt;=o)return[t[0]*t[1],t[2]];if(3===t.length&amp;&amp;t[0]&lt;=o&amp;&amp;t[1]*t[2]&lt;=o)return[t[0],t[1]*t[2]];if(4===t.length&amp;&amp;t[0]*t[1]*t[2]&lt;=o&amp;&amp;t[3]&lt;=o)return[t[0]*t[1]*t[2],t[3]];if(4===t.length&amp;&amp;t[0]&lt;=o&amp;&amp;t[1]*t[2]*t[3]&lt;=o)return[t[0],t[1]*t[2]*t[3]];if(e){var u=m(t),l=2,c=2;return t.length&amp;&amp;(l=(n=g(t))[0],c=n[1]),s=u*(l/2)*(c/2),i.sizeToSquarishShape(s).map(function(t){return 2*t})}return i.sizeToSquarishShape(s)},n.isReshapeFree=function(t,e){if(t=t.slice(-2),e=e.slice(-2),i.arraysEqual(t,e))return!0;if(!t.length||!e.length)return!0;if(0===t[0]||0===t[1]||0===e[0]||0===e[1])return!0;if(t.length!==e.length){var n=t.slice(-1)[0],r=e.slice(-1)[0];if(n===r)return!0;if(v(n)&amp;&amp;v(r)&amp;&amp;(1===t[0]||1===e[0]))return!0}return t[1]===e[1]&amp;&amp;v(t[0])&amp;&amp;v(e[0])},n.getWebGLMaxTextureSize=function(t){if(null==n.MAX_TEXTURE_SIZE){var e=o.getWebGLContext(t);n.MAX_TEXTURE_SIZE=e.getParameter(e.MAX_TEXTURE_SIZE)}return n.MAX_TEXTURE_SIZE},n.getMaxTexturesInShader=function(t){if(null==n.MAX_TEXTURES_IN_SHADER){var e=o.getWebGLContext(t);n.MAX_TEXTURES_IN_SHADER=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,n.MAX_TEXTURES_IN_SHADER)},n.getWebGLDisjointQueryTimerVersion=function(t){if(0===t)return 0;var e=o.getWebGLContext(t);return y(e,&quot;EXT_disjoint_timer_query_webgl2&quot;)&amp;&amp;2===t?2:y(e,&quot;EXT_disjoint_timer_query&quot;)?1:0},n.isWebGLVersionEnabled=function(t){try{if(null!=o.getWebGLContext(t))return!0}catch(t){return!1}return!1},n.isRenderToFloatTextureEnabled=function(t){if(0===t)return!1;var e=o.getWebGLContext(t);if(1===t){if(!y(e,&quot;OES_texture_float&quot;))return!1}else if(!y(e,&quot;EXT_color_buffer_float&quot;))return!1;return b(e,t)},n.isDownloadFloatTextureEnabled=function(t){if(0===t)return!1;var e=o.getWebGLContext(t);if(1===t){if(!y(e,&quot;OES_texture_float&quot;))return!1;if(!y(e,&quot;WEBGL_color_buffer_float&quot;))return!1}else if(!y(e,&quot;EXT_color_buffer_float&quot;))return!1;return b(e,t)},n.isWebGLFenceEnabled=function(t){return 2===t&amp;&amp;null!=o.getWebGLContext(t).fenceSync}},{&quot;../../environment&quot;:134,&quot;../../util&quot;:223,&quot;./canvas_util&quot;:68}],130:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../ops/array_ops&quot;);n.whereImpl=function(t,e){for(var n=[],i=0;i&lt;e.length;i++)e[i]&amp;&amp;n.push(i);var o=r.buffer(t,&quot;int32&quot;),a=r.buffer([n.length,t.length],&quot;int32&quot;);for(i=0;i&lt;n.length;i++){var s=o.indexToLoc(n[i]),u=i*t.length;a.values.set(s,u)}return a.toTensor()}},{&quot;../ops/array_ops&quot;:153}],131:[function(t,e,n){(function(t){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var e=&quot;undefined&quot;!=typeof requestAnimationFrame?requestAnimationFrame:void 0!==t?t:function(t){return t()};n.nextFrame=function(){return new Promise(function(t){return e(function(){return t()})})}}).call(this,t(&quot;timers&quot;).setImmediate)},{timers:348}],132:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.isMobile=function(){var t=navigator.userAgent||navigator.vendor||window.opera;return/(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(t)||/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 )|sy(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(t.substr(0,4))},n.isBrowser=function(){return&quot;undefined&quot;!=typeof window}},{}],133:[function(t,e,n){(function(e,r){&quot;use strict&quot;;var i=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},o=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var a,s=t(&quot;./environment&quot;),u=t(&quot;./profiler&quot;),l=t(&quot;./tape&quot;),c=t(&quot;./tensor&quot;),f=t(&quot;./tensor_util&quot;),p=t(&quot;./util&quot;),h=t(&quot;./util&quot;),d=function(){function t(){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.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null}}return t.prototype.dispose=function(){for(var t in this.registeredVariables)this.registeredVariables[t].dispose()},t}(),m=function(){function t(t){this.ENV=t,this.registry={},this.registryFactory={},this.state=new d}return Object.defineProperty(t.prototype,&quot;backend&quot;,{get:function(){if(null==this.backendInstance){var t=this.initializeBackendsAndReturnBest();this.setBackend(t)}return this.backendInstance},enumerable:!0,configurable:!0}),t.prototype.backendNames=function(){return Object.keys(this.registryFactory)},t.prototype.findBackend=function(t){if(!(t in this.registry)){if(!(t in this.registryFactory))return null;this.initializeBackend(t)}return this.registry[t]},t.prototype.findBackendFactory=function(t){return t in this.registryFactory?this.registryFactory[t].factory:null},t.prototype.registerBackend=function(t,e,n){return void 0===n&amp;&amp;(n=1),t in this.registryFactory?(console.warn(t+&quot; backend was already registered. Reusing existing backend factory.&quot;),!1):(this.registryFactory[t]={factory:e,priority:n},!0)},t.prototype.setBackend=function(t){if(null==this.registryFactory[t])throw new Error(&quot;Backend name &apos;&quot;+t+&quot;&apos; not found in registry&quot;);if(null==this.registry[t]&amp;&amp;!this.initializeBackend(t))return!1;return this.backendName=t,this.backendInstance=this.registry[t],this.profiler=new u.Profiler(this.backendInstance),!0},t.prototype.initializeBackend=function(t){var e=n.ENGINE.registryFactory[t];if(null==e)throw new Error(&quot;Cannot initialize backend &quot;+t+&quot;, no registration found.&quot;);try{var r=e.factory();return this.registry[t]=r,!0}catch(e){return console.warn(&quot;Initialization of backend &quot;+t+&quot; failed&quot;),console.warn(e.stack||e.message),!1}},t.prototype.removeBackend=function(t){if(!(t in this.registryFactory))throw new Error(t+&quot; backend not found in registry&quot;);t in this.registry&amp;&amp;(this.registry[t].dispose(),delete this.registry[t]),delete this.registryFactory[t]},t.prototype.initializeBackendsAndReturnBest=function(){var t=this;if(0===Object.keys(this.registryFactory).length)throw new Error(&quot;No backend found in registry.&quot;);for(var e=Object.keys(this.registryFactory).sort(function(e,n){return t.registryFactory[n].priority-t.registryFactory[e].priority}),n=0;n&lt;e.length;n++){var r=e[n];if(this.initializeBackend(r))return r}throw new Error(&quot;Could not initialize any backends, all backend initializations failed.&quot;)},t.prototype.moveData=function(t){this.write(t,this.readSync(t))},t.prototype.tidy=function(t,e){var n,r=this,i=null;if(null==e){if(&quot;function&quot;!=typeof t)throw new Error(&quot;Please provide a function to tidy()&quot;);e=t}else{if(&quot;string&quot;!=typeof t&amp;&amp;!(t instanceof String))throw new Error(&quot;When calling with two arguments, the first argument to tidy() must be a string&quot;);if(&quot;function&quot;!=typeof e)throw new Error(&quot;When calling with two arguments, the 2nd argument to tidy() must be a function&quot;);i=t}return this.scopedRun(function(){return r.startScope(i)},function(){return r.endScope(n)},function(){return(n=e())instanceof Promise&amp;&amp;console.error(&quot;Cannot return a Promise inside of tidy.&quot;),n})},t.prototype.scopedRun=function(t,e,n){t();try{var r=n();return e(),r}catch(t){throw e(),t}},t.prototype.nextTensorId=function(){return t.nextTensorId++},t.prototype.nextVariableId=function(){return t.nextVariableId++},t.prototype.clone=function(t){var e=c.Tensor.make(t.shape,{dataId:t.dataId},t.dtype);return this.addTapeNode([t],e,function(t){return[t.toFloat()]}),e},t.prototype.runKernel=function(t,e,n){var r,i=this,o=[],a=this.isTapeOn(),s=null!=this.state.activeScope?this.state.activeScope.name:&quot;&quot;,u=function(t){a&amp;&amp;(o=t.map(function(t){return i.keep(i.clone(t))}))},l=this.state.numBytes,c=this.state.numTensors;if(this.scopedRun(function(){return i.state.kernelDepth++},function(){return i.state.kernelDepth--},function(){r=i.ENV.getBool(&quot;DEBUG&quot;)?i.profiler.profileKernel(s,function(){return t(i.backend,u)}):t(i.backend,u)}),a){var f={id:this.state.nextTapeNodeId++,name:s,inputs:e,outputs:Array.isArray(r)?r:[r],saved:o};null!=n&amp;&amp;(f.gradient=function(t){return n(t,o)}),this.state.activeTape.push(f)}return this.state.profiling&amp;&amp;this.state.activeProfile.kernels.push({name:s,bytesAdded:this.state.numBytes-l,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-c,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(e).map(function(t){return e[t].shape}),outputShape:Array.isArray(r)?r.map(function(t){return t.shape}):r.shape}),r},t.prototype.registerTensor=function(t,e){var n=this.state.tensorInfo.has(t.dataId)?this.state.tensorInfo.get(t.dataId).refCount:0;if(this.state.numTensors++,&quot;string&quot;===t.dtype&amp;&amp;this.state.numStringTensors++,0===n){this.state.numDataBuffers++;var r=0;&quot;complex64&quot;!==t.dtype&amp;&amp;&quot;string&quot;!==t.dtype&amp;&amp;(r=t.size*p.bytesPerElement(t.dtype)),this.state.tensorInfo.set(t.dataId,{backend:null!=e?e:this.backend,dtype:t.dtype,shape:t.shape,bytes:r,refCount:0}),this.state.numBytes+=r,null!=e?e.register(t.dataId,t.shape,t.dtype):this.backend.register(t.dataId,t.shape,t.dtype)}this.state.tensorInfo.get(t.dataId).refCount++,t instanceof c.Variable||this.track(t)},t.prototype.registerVariable=function(t){if(null!=this.state.registeredVariables[t.name])throw new Error(&quot;Variable with name &quot;+t.name+&quot; was already registered&quot;);this.state.registeredVariables[t.name]=t},t.prototype.disposeTensor=function(t){if(this.state.tensorInfo.has(t.dataId)){this.state.numTensors--,&quot;string&quot;===t.dtype&amp;&amp;this.state.numStringTensors--;var e=this.state.tensorInfo.get(t.dataId);e.refCount&lt;=1?(&quot;complex64&quot;!==t.dtype&amp;&amp;(this.state.numBytes-=e.bytes),this.state.numDataBuffers--,e.backend.disposeData(t.dataId),this.state.tensorInfo.delete(t.dataId)):this.state.tensorInfo.get(t.dataId).refCount--}},t.prototype.disposeVariables=function(){for(var t in this.state.registeredVariables){var e=this.state.registeredVariables[t];this.disposeTensor(e),delete this.state.registeredVariables[t]}},t.prototype.memory=function(){var t=this.backend.memory();return t.numTensors=this.state.numTensors,t.numDataBuffers=this.state.numDataBuffers,t.numBytes=this.state.numBytes,this.state.numStringTensors&gt;0&amp;&amp;(t.unreliable=!0,null==t.reasons&amp;&amp;(t.reasons=[]),t.reasons.push(&quot;Memory usage by string tensors is approximate (2 bytes per character)&quot;)),t},t.prototype.profile=function(t){return i(this,void 0,void 0,function(){var e,n;return o(this,function(r){return this.state.profiling=!0,e=this.state.numBytes,n=this.state.numTensors,this.state.activeProfile.kernels=[],this.state.activeProfile.result=t(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,this.state.activeProfile.kernels.map(function(t){return t.totalBytesSnapshot})),this.state.activeProfile.newBytes=this.state.numBytes-e,this.state.activeProfile.newTensors=this.state.numTensors-n,[2,this.state.activeProfile]})})},t.prototype.isTapeOn=function(){return this.state.gradientDepth&gt;0&amp;&amp;0===this.state.kernelDepth},t.prototype.addTapeNode=function(t,e,n){var r={};t.forEach(function(t,e){r[e]=t});var i={id:this.state.nextTapeNodeId++,name:this.state.activeScope.name,inputs:r,outputs:[e],gradient:function(t){var e={};return n(t).forEach(function(t,n){e[n]=function(){return t}}),e}};this.state.activeTape.push(i)},t.prototype.keep=function(t){return t.kept=!0,t},t.prototype.startTape=function(){0===this.state.gradientDepth&amp;&amp;(this.state.activeTape=[]),this.state.gradientDepth++},t.prototype.endTape=function(){this.state.gradientDepth--},t.prototype.startScope=function(t){var e={track:[],name:&quot;unnamed scope&quot;,id:this.state.nextScopeId++};t&amp;&amp;(e.name=t),this.state.scopeStack.push(e),this.state.activeScope=e},t.prototype.endScope=function(t){for(var e=this,n=f.getTensorsInContainer(t),r=new Set(n.map(function(t){return t.id})),i=0;i&lt;this.state.activeScope.track.length;i++){var o=this.state.activeScope.track[i];o.kept||r.has(o.id)||o.dispose()}var a=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],n.forEach(function(t){t.kept||t.scopeId!==a.id||e.track(t)})},t.prototype.gradients=function(t,e,n,r){var i=this;if(void 0===r&amp;&amp;(r=!1),p.assert(e.length&gt;0,function(){return&quot;gradients() received an empty list of xs.&quot;}),null!=n&amp;&amp;&quot;float32&quot;!==n.dtype)throw new Error(&quot;dy must have &apos;float32&apos; dtype, but has &apos;&quot;+n.dtype+&quot;&apos;&quot;);var o=this.scopedRun(function(){return i.startTape()},function(){return i.endTape()},function(){return i.tidy(&quot;forward&quot;,t)});p.assert(o instanceof c.Tensor,function(){return&quot;The result y returned by f() must be a tensor.&quot;});var a=l.getFilteredNodesXToY(this.state.activeTape,e,o);if(!r&amp;&amp;0===a.length&amp;&amp;e.length&gt;0)throw new Error(&quot;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.&quot;);return this.tidy(&quot;backward&quot;,function(){var t,r,s={};s[o.id]=null==n?(t=o.shape,r=h.makeOnesTypedArray(h.sizeFromShape(t),&quot;float32&quot;),c.Tensor.make(t,{values:r})):n,l.backpropagateGradients(s,a,function(t){return i.tidy(t)});var u=e.map(function(t){return s[t.id]});return 0===i.state.gradientDepth&amp;&amp;(i.state.activeTape.forEach(function(t){for(var e in t.saved)t.saved[e].dispose()}),i.state.activeTape=null),{value:o,grads:u}})},t.prototype.customGrad=function(t){var e=this;return p.assert(p.isFunction(t),function(){return&quot;The f passed in customGrad(f) must be a function.&quot;}),function(){for(var n,r=[],i=0;i&lt;arguments.length;i++)r[i]=arguments[i];p.assert(r.every(function(t){return t instanceof c.Tensor}),function(){return&quot;The args passed in customGrad(f)(x1, x2,...) must all be tensors&quot;});var o={};return r.forEach(function(t,e){o[e]=t}),e.runKernel(function(e,i){return n=t.apply(void 0,r.concat([i])),p.assert(n.value instanceof c.Tensor,function(){return&quot;The function f passed in customGrad(f) must return an object where `obj.value` is a tensor&quot;}),p.assert(p.isFunction(n.gradFunc),function(){return&quot;The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function.&quot;}),n.value},o,function(t,e){var i=n.gradFunc(t,e),o=Array.isArray(i)?i:[i];p.assert(o.length===r.length,function(){return&quot;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(...).&quot;}),p.assert(o.every(function(t){return t instanceof c.Tensor}),function(){return&quot;The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.&quot;});var a={};return o.forEach(function(t,e){a[e]=function(){return t}}),a})}},t.prototype.write=function(t,e){var n=this.state.tensorInfo.get(t);if(&quot;string&quot;===n.dtype){var r=h.bytesFromStringArray(e);this.state.numBytes+=r-n.bytes,n.bytes=r}this.backend!==n.backend&amp;&amp;(n.backend.disposeData(t),n.backend=this.backend,this.backend.register(t,n.shape,n.dtype)),this.backend.write(t,e)},t.prototype.readSync=function(t){return this.state.tensorInfo.get(t).backend.readSync(t)},t.prototype.read=function(t){return this.state.tensorInfo.get(t).backend.read(t)},t.prototype.fromPixels=function(t,e){return this.backend.fromPixels(t,e)},t.prototype.time=function(t){return i(this,void 0,void 0,function(){var e,n;return o(this,function(r){switch(r.label){case 0:return e=h.now(),[4,this.backend.time(t)];case 1:return(n=r.sent()).wallMs=h.now()-e,[2,n]}})})},t.prototype.track=function(t){return null!=this.state.activeScope&amp;&amp;(t.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(t)),t},Object.defineProperty(t.prototype,&quot;registeredVariables&quot;,{get:function(){return this.state.registeredVariables},enumerable:!0,configurable:!0}),t.prototype.reset=function(){for(var t in this.state.dispose(),this.ENV.reset(),this.state=new d,this.registry)this.registry[t].dispose(),delete this.registry[t];this.backendName=null,this.backendInstance=null},t.nextTensorId=0,t.nextVariableId=0,t}();n.Engine=m,n.ENGINE=function(){var t=function(){if(null==a){var t=void 0;if(&quot;undefined&quot;!=typeof window)t=window;else if(void 0!==r)t=r;else{if(void 0===e)throw new Error(&quot;Could not find a global object&quot;);t=e}a=t}return a}();if(null==t._tfengine){var n=new s.Environment(t);t._tfengine=new m(n),s.setEnvironmentGlobal(n)}return c.setTensorTracker(function(){return t._tfengine}),t._tfengine}()}).call(this,t(&quot;_process&quot;),&quot;undefined&quot;!=typeof global?global:&quot;undefined&quot;!=typeof self?self:&quot;undefined&quot;!=typeof window?window:{})},{&quot;./environment&quot;:134,&quot;./profiler&quot;:213,&quot;./tape&quot;:215,&quot;./tensor&quot;:216,&quot;./tensor_util&quot;:218,&quot;./util&quot;:223,_process:338}],134:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){function t(t){this.global=t,this.flags={},this.flagRegistry={},this.urlFlags={},this.populateURLFlags()}return t.prototype.registerFlag=function(t,e,n){if(this.flagRegistry[t]={evaluationFn:e,setHook:n},null!=this.urlFlags[t]){var r=this.urlFlags[t];console.warn(&quot;Setting feature override from URL &quot;+t+&quot;: &quot;+r+&quot;.&quot;),this.set(t,r)}},t.prototype.get=function(t){return t in this.flags?this.flags[t]:(this.flags[t]=this.evaluateFlag(t),this.flags[t])},t.prototype.getNumber=function(t){return this.get(t)},t.prototype.getBool=function(t){return this.get(t)},t.prototype.getFlags=function(){return this.flags},Object.defineProperty(t.prototype,&quot;features&quot;,{get:function(){return this.flags},enumerable:!0,configurable:!0}),t.prototype.set=function(t,e){if(null==this.flagRegistry[t])throw new Error(&quot;Cannot set flag &quot;+t+&quot; as it has not been registered.&quot;);this.flags[t]=e,null!=this.flagRegistry[t].setHook&amp;&amp;this.flagRegistry[t].setHook(e)},t.prototype.evaluateFlag=function(t){if(null==this.flagRegistry[t])throw new Error(&quot;Cannot evaluate flag &apos;&quot;+t+&quot;&apos;: no evaluation function found.&quot;);return this.flagRegistry[t].evaluationFn()},t.prototype.setFlags=function(t){this.flags=Object.assign({},t)},t.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},t.prototype.populateURLFlags=function(){var t=this;if(void 0!==this.global&amp;&amp;void 0!==this.global.location&amp;&amp;void 0!==this.global.location.search){var e=i(this.global.location.search);if(&quot;tfjsflags&quot;in e)e.tfjsflags.split(&quot;,&quot;).forEach(function(e){var n=e.split(&quot;:&quot;),r=n[0],i=n[1];t.urlFlags[r]=function(t,e){if(&quot;true&quot;===(e=e.toLowerCase())||&quot;false&quot;===e)return!0===Boolean(e);if(&quot;&quot;+ +e===e)return+e;throw new Error(&quot;Could not parse value flag value &quot;+e+&quot; for flag &quot;+t+&quot;.&quot;)}(r,i)})}},t}();function i(t){var e={};return t.replace(/[?&amp;]([^=?&amp;]+)(?:=([^&amp;]*))?/g,function(t){for(var n=[],r=1;r&lt;arguments.length;r++)n[r-1]=arguments[r];return function(t,e,n){t[decodeURIComponent(e)]=decodeURIComponent(n||&quot;&quot;)}(e,n[0],n[1]),n.join(&quot;=&quot;)}),e}n.Environment=r,n.getQueryParams=i,n.setEnvironmentGlobal=function(t){n.ENV=t}},{}],135:[function(t,e,n){(function(e){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./device_util&quot;),i=t(&quot;./environment&quot;);i.ENV.registerFlag(&quot;DEBUG&quot;,function(){return!1},function(t){t&amp;&amp;console.warn(&quot;Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.&quot;)}),i.ENV.registerFlag(&quot;IS_BROWSER&quot;,function(){return r.isBrowser()}),i.ENV.registerFlag(&quot;IS_NODE&quot;,function(){return void 0!==e&amp;&amp;void 0!==e.versions&amp;&amp;void 0!==e.versions.node}),i.ENV.registerFlag(&quot;IS_CHROME&quot;,function(){return&quot;undefined&quot;!=typeof navigator&amp;&amp;null!=navigator&amp;&amp;null!=navigator.userAgent&amp;&amp;/Chrome/.test(navigator.userAgent)&amp;&amp;/Google Inc/.test(navigator.vendor)}),i.ENV.registerFlag(&quot;PROD&quot;,function(){return!1}),i.ENV.registerFlag(&quot;TENSORLIKE_CHECK_SHAPE_CONSISTENCY&quot;,function(){return!i.ENV.getBool(&quot;PROD&quot;)}),i.ENV.registerFlag(&quot;DEPRECATION_WARNINGS_ENABLED&quot;,function(){return!0}),i.ENV.registerFlag(&quot;IS_TEST&quot;,function(){return!1})}).call(this,t(&quot;_process&quot;))},{&quot;./device_util&quot;:132,&quot;./environment&quot;:134,_process:338}],136:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./engine&quot;),i=t(&quot;./environment&quot;),o=t(&quot;./tensor&quot;),a=t(&quot;./tensor_util&quot;);function s(t){i.ENV.getBool(&quot;DEPRECATION_WARNINGS_ENABLED&quot;)&amp;&amp;console.warn(t+&quot; You can disable deprecation warnings with tf.disableDeprecationWarnings().&quot;)}n.enableProdMode=function(){i.ENV.set(&quot;PROD&quot;,!0)},n.enableDebugMode=function(){i.ENV.set(&quot;DEBUG&quot;,!0)},n.disableDeprecationWarnings=function(){i.ENV.set(&quot;DEPRECATION_WARNINGS_ENABLED&quot;,!1),console.warn(&quot;TensorFlow.js deprecation warnings have been disabled.&quot;)},n.deprecationWarn=s,o.setDeprecationWarningFn(s),n.disposeVariables=function(){r.ENGINE.disposeVariables()},n.memory=function(){return r.ENGINE.memory()},n.profile=function(t){return r.ENGINE.profile(t)},n.tidy=function(t,e){return r.ENGINE.tidy(t,e)},n.dispose=function(t){a.getTensorsInContainer(t).forEach(function(t){return t.dispose()})},n.keep=function(t){return r.ENGINE.keep(t)},n.time=function(t){return r.ENGINE.time(t)},n.setBackend=function(t){return r.ENGINE.setBackend(t)},n.getBackend=function(){return r.ENGINE.backendName},n.removeBackend=function(t){r.ENGINE.removeBackend(t)},n.findBackend=function(t){return r.ENGINE.findBackend(t)},n.findBackendFactory=function(t){return r.ENGINE.findBackendFactory(t)},n.registerBackend=function(t,e,n){return void 0===n&amp;&amp;(n=1),r.ENGINE.registerBackend(t,e,n)},n.backend=function(){return r.ENGINE.backend}},{&quot;./engine&quot;:133,&quot;./environment&quot;:134,&quot;./tensor&quot;:216,&quot;./tensor_util&quot;:218}],137:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./engine&quot;),i=t(&quot;./tensor&quot;),o=t(&quot;./tensor_util_env&quot;),a=t(&quot;./util&quot;);function s(t){if(t.filter(function(t){return null==t}).length&gt;0)throw new Error(&quot;Cannot compute gradient of y=f(x) with respect to x. Make sure that\n    the f you passed encloses all operations that lead from x to y.&quot;)}n.grad=function(t){return a.assert(a.isFunction(t),function(){return&quot;The f passed in grad(f) must be a function&quot;}),function(e,n){var i=o.convertToTensor(e,&quot;x&quot;,&quot;tf.grad&quot;,null),u=null!=n?o.convertToTensor(n,&quot;dy&quot;,&quot;tf.grad&quot;):null;return r.ENGINE.tidy(function(){var e=r.ENGINE.gradients(function(){return t(i)},[i],u),n=e.value,o=e.grads;return null!=u&amp;&amp;a.assertShapesMatch(n.shape,u.shape,&quot;The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)&quot;),s(o),o[0]})}},n.grads=function(t){return a.assert(a.isFunction(t),function(){return&quot;The f passed in grads(f) must be a function&quot;}),function(e,n){a.assert(Array.isArray(e),function(){return&quot;The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s&quot;});var i=o.convertToTensorArray(e,&quot;args&quot;,&quot;tf.grads&quot;,null),u=null!=n?o.convertToTensor(n,&quot;dy&quot;,&quot;tf.grads&quot;):null;return r.ENGINE.tidy(function(){var e=r.ENGINE.gradients(function(){return t.apply(void 0,i)},i,u),n=e.value,o=e.grads;return null!=u&amp;&amp;a.assertShapesMatch(n.shape,u.shape,&quot;The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])&quot;),s(o),o})}},n.valueAndGrad=function(t){return a.assert(a.isFunction(t),function(){return&quot;The f passed in valueAndGrad(f) must be a function&quot;}),function(e,n){a.assert(e instanceof i.Tensor,function(){return&quot;The x passed in valueAndGrad(f)(x) must be a tensor&quot;}),a.assert(null==n||n instanceof i.Tensor,function(){return&quot;The dy passed in valueAndGrad(f)(x, dy) must be a tensor&quot;});var o=r.ENGINE.gradients(function(){return t(e)},[e],n),u=o.grads,l=o.value;return s(u),{grad:u[0],value:l}}},n.valueAndGrads=function(t){return a.assert(a.isFunction(t),function(){return&quot;The f passed in valueAndGrads(f) must be a function&quot;}),function(e,n){a.assert(Array.isArray(e)&amp;&amp;e.every(function(t){return t instanceof i.Tensor}),function(){return&quot;The args passed in valueAndGrads(f)(args) must be array of tensors&quot;}),a.assert(null==n||n instanceof i.Tensor,function(){return&quot;The dy passed in valueAndGrads(f)(args, dy) must be a tensor&quot;});var o=r.ENGINE.gradients(function(){return t.apply(void 0,e)},e,n);return null!=n&amp;&amp;a.assertShapesMatch(o.value.shape,n.shape,&quot;The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])&quot;),s(o.grads),o}},n.variableGrads=function(t,e){if(a.assert(a.isFunction(t),function(){return&quot;The f passed in variableGrads(f) must be a function&quot;}),a.assert(null==e||Array.isArray(e)&amp;&amp;e.every(function(t){return t instanceof i.Variable}),function(){return&quot;The varList passed in variableGrads(f, varList) must be an array of variables&quot;}),null==e)for(var n in e=[],r.ENGINE.registeredVariables)e.push(r.ENGINE.registeredVariables[n]);var o=e.length;e=e.filter(function(t){return t.trainable}),a.assert(e.length&gt;0,function(){return&quot;variableGrads() expects at least one of the input variables to be trainable, but none of the &quot;+o+&quot; variables is trainable.&quot;});var s=r.ENGINE.gradients(t,e,null,!0),u=s.value,l=s.grads;a.assert(l.some(function(t){return null!=t}),function(){return&quot;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().&quot;}),a.assert(0===u.rank,function(){return&quot;The f passed in variableGrads(f) must return a scalar, but it returned a rank-&quot;+u.rank+&quot; tensor&quot;});var c={};return e.forEach(function(t,e){null!=l[e]&amp;&amp;(c[t.name]=l[e])}),{value:u,grads:c}},n.customGrad=function(t){return r.ENGINE.customGrad(t)}},{&quot;./engine&quot;:133,&quot;./tensor&quot;:216,&quot;./tensor_util_env&quot;:219,&quot;./util&quot;:223}],138:[function(t,e,n){&quot;use strict&quot;;function r(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),t(&quot;./engine&quot;),t(&quot;./flags&quot;),t(&quot;./backends/webgl/backend_webgl&quot;),t(&quot;./backends/cpu/backend_cpu&quot;);var i=t(&quot;./environment&quot;);n.environment=i;var o=t(&quot;./io/io&quot;);n.io=o;var a=t(&quot;./math&quot;);n.math=a;var s=t(&quot;./ops/browser&quot;);n.browser=s;var u=t(&quot;./serialization&quot;);n.serialization=u;var l=t(&quot;./tensor&quot;),c=t(&quot;./tensor_util&quot;);n.tensor_util=c;var f=t(&quot;./test_util&quot;);n.test_util=f;var p=t(&quot;./util&quot;);n.util=p;var h=t(&quot;./version&quot;);n.version_core=h.version;var d=t(&quot;./webgl&quot;);n.webgl=d;var m=t(&quot;./optimizers/adadelta_optimizer&quot;);n.AdadeltaOptimizer=m.AdadeltaOptimizer;var g=t(&quot;./optimizers/adagrad_optimizer&quot;);n.AdagradOptimizer=g.AdagradOptimizer;var v=t(&quot;./optimizers/adam_optimizer&quot;);n.AdamOptimizer=v.AdamOptimizer;var y=t(&quot;./optimizers/adamax_optimizer&quot;);n.AdamaxOptimizer=y.AdamaxOptimizer;var b=t(&quot;./optimizers/momentum_optimizer&quot;);n.MomentumOptimizer=b.MomentumOptimizer;var _=t(&quot;./optimizers/optimizer&quot;);n.Optimizer=_.Optimizer;var w=t(&quot;./optimizers/rmsprop_optimizer&quot;);n.RMSPropOptimizer=w.RMSPropOptimizer;var x=t(&quot;./optimizers/sgd_optimizer&quot;);n.SGDOptimizer=x.SGDOptimizer;var E=t(&quot;./tensor&quot;);n.Tensor=E.Tensor,n.TensorBuffer=E.TensorBuffer,n.variable=E.variable,n.Variable=E.Variable;var k=t(&quot;./types&quot;);n.Rank=k.Rank,r(t(&quot;./ops/ops&quot;));var T=t(&quot;./ops/loss_ops&quot;);n.Reduction=T.Reduction,r(t(&quot;./train&quot;)),r(t(&quot;./globals&quot;));var N=t(&quot;./gradients&quot;);n.customGrad=N.customGrad,n.grad=N.grad,n.grads=N.grads,n.valueAndGrad=N.valueAndGrad,n.valueAndGrads=N.valueAndGrads,n.variableGrads=N.variableGrads;var S=t(&quot;./environment&quot;);n.ENV=S.ENV,n.Environment=S.Environment;var C=t(&quot;./browser_util&quot;);n.nextFrame=C.nextFrame;var A=t(&quot;./backends/backend&quot;);n.KernelBackend=A.KernelBackend,n.DataStorage=A.DataStorage;var I=t(&quot;./ops/ops&quot;);l.setOpHandler(I)},{&quot;./backends/backend&quot;:49,&quot;./backends/cpu/backend_cpu&quot;:52,&quot;./backends/webgl/backend_webgl&quot;:62,&quot;./browser_util&quot;:131,&quot;./engine&quot;:133,&quot;./environment&quot;:134,&quot;./flags&quot;:135,&quot;./globals&quot;:136,&quot;./gradients&quot;:137,&quot;./io/io&quot;:142,&quot;./math&quot;:152,&quot;./ops/browser&quot;:159,&quot;./ops/loss_ops&quot;:174,&quot;./ops/ops&quot;:181,&quot;./optimizers/adadelta_optimizer&quot;:204,&quot;./optimizers/adagrad_optimizer&quot;:205,&quot;./optimizers/adam_optimizer&quot;:206,&quot;./optimizers/adamax_optimizer&quot;:207,&quot;./optimizers/momentum_optimizer&quot;:208,&quot;./optimizers/optimizer&quot;:209,&quot;./optimizers/rmsprop_optimizer&quot;:211,&quot;./optimizers/sgd_optimizer&quot;:212,&quot;./serialization&quot;:214,&quot;./tensor&quot;:216,&quot;./tensor_util&quot;:218,&quot;./test_util&quot;:220,&quot;./train&quot;:221,&quot;./types&quot;:222,&quot;./util&quot;:223,&quot;./version&quot;:224,&quot;./webgl&quot;:225}],139:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../environment&quot;),a=t(&quot;./io_utils&quot;),s=t(&quot;./router_registry&quot;),u=&quot;model&quot;,l=&quot;.json&quot;,c=&quot;.weights.bin&quot;,f=function(){function t(e){if(!o.ENV.getBool(&quot;IS_BROWSER&quot;))throw new Error(&quot;browserDownloads() cannot proceed because the current environment is not a browser.&quot;);e.startsWith(t.URL_SCHEME)&amp;&amp;(e=e.slice(t.URL_SCHEME.length)),null!=e&amp;&amp;0!==e.length||(e=u),this.modelTopologyFileName=e+l,this.weightDataFileName=e+c}return t.prototype.save=function(t){return r(this,void 0,void 0,function(){var e,n,r,o,s,u;return i(this,function(i){if(e=window.URL.createObjectURL(new Blob([t.weightData],{type:&quot;application/octet-stream&quot;})),t.modelTopology instanceof ArrayBuffer)throw new Error(&quot;BrowserDownloads.save() does not support saving model topology in binary formats yet.&quot;);return n=[{paths:[&quot;./&quot;+this.weightDataFileName],weights:t.weightSpecs}],r={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,weightsManifest:n},o=window.URL.createObjectURL(new Blob([JSON.stringify(r)],{type:&quot;application/json&quot;})),(s=null==this.jsonAnchor?document.createElement(&quot;a&quot;):this.jsonAnchor).download=this.modelTopologyFileName,s.href=o,s.click(),null!=t.weightData&amp;&amp;((u=null==this.weightDataAnchor?document.createElement(&quot;a&quot;):this.weightDataAnchor).download=this.weightDataFileName,u.href=e,u.click()),[2,{modelArtifactsInfo:a.getModelArtifactsInfoForJSON(t)}]})})},t.URL_SCHEME=&quot;downloads://&quot;,t}();n.BrowserDownloads=f;var p=function(){function t(t){if(null==t||t.length&lt;1)throw new Error(&quot;When calling browserFiles, at least 1 file is required, but received &quot;+t);this.files=t}return t.prototype.load=function(){return r(this,void 0,void 0,function(){var t,e,n=this;return i(this,function(r){return t=this.files[0],e=this.files.slice(1),[2,new Promise(function(r,i){var o=new FileReader;o.onload=function(o){var s=JSON.parse(o.target.result),u=s.modelTopology;if(null!=u){0===e.length&amp;&amp;r({modelTopology:u});var l=s.weightsManifest;if(null!=l){var c;try{c=n.checkManifestAndWeightFiles(l,e)}catch(t){return void i(t)}var f=[],p=[],h=[];l.forEach(function(t){t.paths.forEach(function(t){p.push(t),h.push(null)}),f.push.apply(f,t.weights)}),l.forEach(function(t){t.paths.forEach(function(t){var e=new FileReader;e.onload=function(e){var n=e.target.result,i=p.indexOf(t);h[i]=n,-1===h.indexOf(null)&amp;&amp;r({modelTopology:u,weightSpecs:f,weightData:a.concatenateArrayBuffers(h)})},e.onerror=function(e){return i(&quot;Failed to weights data from file of path &apos;&quot;+t+&quot;&apos;.&quot;)},e.readAsArrayBuffer(c[t])})})}else i(new Error(&quot;weightManifest field is missing from file &quot;+t.name))}else i(new Error(&quot;modelTopology field is missing from file &quot;+t.name))},o.onerror=function(e){return i(&quot;Failed to read model topology and weights manifest JSON from file &apos;&quot;+t.name+&quot;&apos;. BrowserFiles supports loading Keras-style tf.Model artifacts only.&quot;)},o.readAsText(t)})]})})},t.prototype.checkManifestAndWeightFiles=function(t,e){for(var n=[],r=e.map(function(t){return a.basename(t.name)}),i={},o=0,s=t;o&lt;s.length;o++){s[o].paths.forEach(function(t){var o=a.basename(t);if(-1!==n.indexOf(o))throw new Error(&quot;Duplicate file basename found in weights manifest: &apos;&quot;+o+&quot;&apos;&quot;);if(n.push(o),-1===r.indexOf(o))throw new Error(&quot;Weight file with basename &apos;&quot;+o+&quot;&apos; is not provided.&quot;);i[t]=e[r.indexOf(o)]})}if(n.length!==e.length)throw new Error(&quot;Mismatch in the number of files in weights manifest (&quot;+n.length+&quot;) and the number of weight files provided (&quot;+e.length+&quot;).&quot;);return i},t}();function h(t){return void 0===t&amp;&amp;(t=&quot;model&quot;),new f(t)}n.browserDownloadsRouter=function(t){return o.ENV.getBool(&quot;IS_BROWSER&quot;)&amp;&amp;!Array.isArray(t)&amp;&amp;t.startsWith(f.URL_SCHEME)?h(t.slice(f.URL_SCHEME.length)):null},s.IORouterRegistry.registerSaveRouter(n.browserDownloadsRouter),n.browserDownloads=h,n.browserFiles=function(t){return new p(t)}},{&quot;../environment&quot;:134,&quot;./io_utils&quot;:143,&quot;./router_registry&quot;:148}],140:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../util&quot;),a=t(&quot;./io_utils&quot;),s=t(&quot;./router_registry&quot;),u=t(&quot;./weights_loader&quot;),l=function(){function t(t,e){if(this.DEFAULT_METHOD=&quot;POST&quot;,null==e&amp;&amp;(e={}),this.weightPathPrefix=e.weightPathPrefix,this.onProgress=e.onProgress,null!=e.fetchFunc?(o.assert(&quot;function&quot;==typeof e.fetchFunc,function(){return&quot;Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)&quot;}),this.fetch=e.fetchFunc):this.fetch=o.fetch,o.assert(null!=t&amp;&amp;t.length&gt;0,function(){return&quot;URL path for browserHTTPRequest must not be null, undefined or empty.&quot;}),Array.isArray(t)&amp;&amp;o.assert(2===t.length,function(){return&quot;URL paths for browserHTTPRequest must have a length of 2, (actual length is &quot;+t.length+&quot;).&quot;}),this.path=t,null!=e.requestInit&amp;&amp;null!=e.requestInit.body)throw new Error(&quot;requestInit is expected to have no pre-existing body, but has one.&quot;);this.requestInit=e.requestInit||{}}return t.prototype.save=function(t){return r(this,void 0,void 0,function(){var e,n,r,o;return i(this,function(i){switch(i.label){case 0:if(t.modelTopology instanceof ArrayBuffer)throw new Error(&quot;BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.&quot;);return(e=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,n=[{paths:[&quot;./model.weights.bin&quot;],weights:t.weightSpecs}],r={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,weightsManifest:n},e.body.append(&quot;model.json&quot;,new Blob([JSON.stringify(r)],{type:&quot;application/json&quot;}),&quot;model.json&quot;),null!=t.weightData&amp;&amp;e.body.append(&quot;model.weights.bin&quot;,new Blob([t.weightData],{type:&quot;application/octet-stream&quot;}),&quot;model.weights.bin&quot;),[4,this.fetch(this.path,e)];case 1:if((o=i.sent()).ok)return[2,{modelArtifactsInfo:a.getModelArtifactsInfoForJSON(t),responses:[o]}];throw new Error(&quot;BrowserHTTPRequest.save() failed due to HTTP response status &quot;+o.status+&quot;.&quot;)}})})},t.prototype.load=function(){return r(this,void 0,void 0,function(){var t,e,n,r,o,a,s,u;return i(this,function(i){switch(i.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(t=i.sent()).ok)throw new Error(&quot;Request to &quot;+this.path+&quot; failed with status code &quot;+t.status+&quot;. Please verify this URL points to the model JSON of the model to load.&quot;);i.label=2;case 2:return i.trys.push([2,4,,5]),[4,t.json()];case 3:return e=i.sent(),[3,5];case 4:throw i.sent(),n=&quot;Failed to parse model JSON of response from &quot;+this.path+&quot;.&quot;,this.path.endsWith(&quot;.pb&quot;)?n+=&quot; 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 &apos;pb2json&apos;NPM script in the tensorflow/tfjs-converter repository.&quot;:n+=&quot; Please make sure the server is serving valid JSON for this request.&quot;,new Error(n);case 5:if(r=e.modelTopology,o=e.weightsManifest,null==r&amp;&amp;null==o)throw new Error(&quot;The JSON from HTTP path &quot;+this.path+&quot; contains neither model topology or manifest for weights.&quot;);return null==o?[3,7]:[4,this.loadWeights(o)];case 6:u=i.sent(),a=u[0],s=u[1],i.label=7;case 7:return[2,{modelTopology:r,weightSpecs:a,weightData:s}]}})})},t.prototype.loadWeights=function(t){return r(this,void 0,void 0,function(){var e,n,r,o,s,l,f,p,h,d,m;return i(this,function(i){switch(i.label){case 0:for(e=Array.isArray(this.path)?this.path[1]:this.path,n=c(e),r=n[0],o=n[1],s=this.weightPathPrefix||r,l=[],f=0,p=t;f&lt;p.length;f++)h=p[f],l.push.apply(l,h.weights);return d=[],t.forEach(function(t){t.paths.forEach(function(t){d.push(s+t+o)})}),[4,u.loadWeightsAsArrayBuffer(d,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress})];case 1:return m=i.sent(),[2,[l,a.concatenateArrayBuffers(m)]]}})})},t.URL_SCHEME_REGEX=/^https?:\/\//,t}();function c(t){var e=t.lastIndexOf(&quot;/&quot;),n=t.lastIndexOf(&quot;?&quot;);return[t.substring(0,e)+&quot;/&quot;,n&gt;e?t.substring(n):&quot;&quot;]}function f(t){return null!=t.match(l.URL_SCHEME_REGEX)}function p(t,e){return new l(t,e)}n.BrowserHTTPRequest=l,n.parseUrl=c,n.isHTTPScheme=f,n.httpRequestRouter=function(t,e){if(void 0===o.fetch)return null;return(Array.isArray(t)?t.every(function(t){return f(t)}):f(t))?p(t,{onProgress:e}):null},s.IORouterRegistry.registerSaveRouter(n.httpRequestRouter),s.IORouterRegistry.registerLoadRouter(n.httpRequestRouter),n.browserHTTPRequest=p},{&quot;../util&quot;:223,&quot;./io_utils&quot;:143,&quot;./router_registry&quot;:148,&quot;./weights_loader&quot;:150}],141:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../environment&quot;),a=t(&quot;./io_utils&quot;),s=t(&quot;./model_management&quot;),u=t(&quot;./router_registry&quot;),l=&quot;tensorflowjs&quot;,c=&quot;models_store&quot;,f=&quot;model_info_store&quot;;function p(){if(!o.ENV.getBool(&quot;IS_BROWSER&quot;))throw new Error(&quot;Failed to obtain IndexedDB factory because the current environmentis not a web browser.&quot;);var t=window,e=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB||t.shimIndexedDB;if(null==e)throw new Error(&quot;The current browser does not appear to support IndexedDB.&quot;);return e}function h(t){var e=t.result;e.createObjectStore(c,{keyPath:&quot;modelPath&quot;}),e.createObjectStore(f,{keyPath:&quot;modelPath&quot;})}n.deleteDatabase=function(){return r(this,void 0,void 0,function(){var t;return i(this,function(e){return t=p(),[2,new Promise(function(e,n){var r=t.deleteDatabase(l);r.onsuccess=function(){return e()},r.onerror=function(t){return n(t)}})]})})};var d=function(){function t(t){if(this.indexedDB=p(),null==t||!t)throw new Error(&quot;For IndexedDB, modelPath must not be null, undefined or empty.&quot;);this.modelPath=t}return t.prototype.save=function(t){return r(this,void 0,void 0,function(){return i(this,function(e){if(t.modelTopology instanceof ArrayBuffer)throw new Error(&quot;BrowserLocalStorage.save() does not support saving model topology in binary formats yet.&quot;);return[2,this.databaseAction(this.modelPath,t)]})})},t.prototype.load=function(){return r(this,void 0,void 0,function(){return i(this,function(t){return[2,this.databaseAction(this.modelPath)]})})},t.prototype.databaseAction=function(t,e){var n=this;return new Promise(function(t,r){var i=n.indexedDB.open(l,1);i.onupgradeneeded=function(){return h(i)},i.onsuccess=function(){var o=i.result;if(null==e){var s=o.transaction(c,&quot;readonly&quot;),u=s.objectStore(c).get(n.modelPath);u.onsuccess=function(){if(null==u.result)return o.close(),r(new Error(&quot;Cannot find model with path &apos;&quot;+n.modelPath+&quot;&apos; in IndexedDB.&quot;));t(u.result.modelArtifacts)},u.onerror=function(t){return o.close(),r(u.error)},s.oncomplete=function(){return o.close()}}else{var l,p=a.getModelArtifactsInfoForJSON(e),h=o.transaction(f,&quot;readwrite&quot;),d=h.objectStore(f),m=d.put({modelPath:n.modelPath,modelArtifactsInfo:p});m.onsuccess=function(){var i=(l=o.transaction(c,&quot;readwrite&quot;)).objectStore(c).put({modelPath:n.modelPath,modelArtifacts:e,modelArtifactsInfo:p});i.onsuccess=function(){return t({modelArtifactsInfo:p})},i.onerror=function(t){var e=(d=h.objectStore(f)).delete(n.modelPath);e.onsuccess=function(){return o.close(),r(i.error)},e.onerror=function(t){return o.close(),r(i.error)}}},m.onerror=function(t){return o.close(),r(m.error)},h.oncomplete=function(){null==l?o.close():l.oncomplete=function(){return o.close()}}}},i.onerror=function(t){return r(i.error)}})},t.URL_SCHEME=&quot;indexeddb://&quot;,t}();function m(t){return new d(t)}n.BrowserIndexedDB=d,n.indexedDBRouter=function(t){return o.ENV.getBool(&quot;IS_BROWSER&quot;)&amp;&amp;!Array.isArray(t)&amp;&amp;t.startsWith(d.URL_SCHEME)?m(t.slice(d.URL_SCHEME.length)):null},u.IORouterRegistry.registerSaveRouter(n.indexedDBRouter),u.IORouterRegistry.registerLoadRouter(n.indexedDBRouter),n.browserIndexedDB=m;var g=function(){function t(){this.indexedDB=p()}return t.prototype.listModels=function(){return r(this,void 0,void 0,function(){var t=this;return i(this,function(e){return[2,new Promise(function(e,n){var r=t.indexedDB.open(l,1);r.onupgradeneeded=function(){return h(r)},r.onsuccess=function(){var t=r.result,i=t.transaction(f,&quot;readonly&quot;),o=i.objectStore(f).getAll();o.onsuccess=function(){for(var t={},n=0,r=o.result;n&lt;r.length;n++){var i=r[n];t[i.modelPath]=i.modelArtifactsInfo}e(t)},o.onerror=function(e){return t.close(),n(o.error)},i.oncomplete=function(){return t.close()}},r.onerror=function(t){return n(r.error)}})]})})},t.prototype.removeModel=function(t){return r(this,void 0,void 0,function(){var e=this;return i(this,function(n){var r;return t=(r=t).startsWith(d.URL_SCHEME)?r.slice(d.URL_SCHEME.length):r,[2,new Promise(function(n,r){var i=e.indexedDB.open(l,1);i.onupgradeneeded=function(){return h(i)},i.onsuccess=function(){var e,o=i.result,a=o.transaction(f,&quot;readwrite&quot;),s=a.objectStore(f),u=s.get(t);u.onsuccess=function(){if(null==u.result)return o.close(),r(new Error(&quot;Cannot find model with path &apos;&quot;+t+&quot;&apos; in IndexedDB.&quot;));var i=s.delete(t),a=function(){var i=(e=o.transaction(c,&quot;readwrite&quot;)).objectStore(c).delete(t);i.onsuccess=function(){return n(u.result.modelArtifactsInfo)},i.onerror=function(t){return r(u.error)}};i.onsuccess=a,i.onerror=function(t){return a(),o.close(),r(u.error)}},u.onerror=function(t){return o.close(),r(u.error)},a.oncomplete=function(){null==e?o.close():e.oncomplete=function(){return o.close()}}},i.onerror=function(t){return r(i.error)}})]})})},t}();if(n.BrowserIndexedDBManager=g,o.ENV.getBool(&quot;IS_BROWSER&quot;))try{s.ModelStoreManagerRegistry.registerManager(d.URL_SCHEME,new g)}catch(t){}},{&quot;../environment&quot;:134,&quot;./io_utils&quot;:143,&quot;./model_management&quot;:145,&quot;./router_registry&quot;:148}],142:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),t(&quot;./indexed_db&quot;),t(&quot;./local_storage&quot;);var r=t(&quot;./browser_files&quot;);n.browserFiles=r.browserFiles;var i=t(&quot;./browser_http&quot;);n.browserHTTPRequest=i.browserHTTPRequest,n.isHTTPScheme=i.isHTTPScheme;var o=t(&quot;./io_utils&quot;);n.concatenateArrayBuffers=o.concatenateArrayBuffers,n.decodeWeights=o.decodeWeights,n.encodeWeights=o.encodeWeights,n.getModelArtifactsInfoForJSON=o.getModelArtifactsInfoForJSON;var a=t(&quot;./passthrough&quot;);n.fromMemory=a.fromMemory,n.withSaveHandler=a.withSaveHandler;var s=t(&quot;./router_registry&quot;);n.getLoadHandlers=s.getLoadHandlers,n.getSaveHandlers=s.getSaveHandlers,n.registerLoadRouter=s.registerLoadRouter,n.registerSaveRouter=s.registerSaveRouter;var u=t(&quot;./weights_loader&quot;);n.loadWeights=u.loadWeights,n.weightsLoaderFactory=u.weightsLoaderFactory;var l=t(&quot;./model_management&quot;);n.copyModel=l.copyModel,n.listModels=l.listModels,n.moveModel=l.moveModel,n.removeModel=l.removeModel},{&quot;./browser_files&quot;:139,&quot;./browser_http&quot;:140,&quot;./indexed_db&quot;:141,&quot;./io_utils&quot;:143,&quot;./local_storage&quot;:144,&quot;./model_management&quot;:145,&quot;./passthrough&quot;:146,&quot;./router_registry&quot;:148,&quot;./weights_loader&quot;:150}],143:[function(t,e,n){(function(e){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../ops/tensor_ops&quot;),a=t(&quot;../util&quot;),s=t(&quot;./types&quot;);function u(t){if(null===t)throw new Error(&quot;Invalid input value: &quot;+JSON.stringify(t));var e=0,n=[];t.forEach(function(t){if(e+=t.byteLength,n.push(t.byteLength===t.buffer.byteLength?t:new t.constructor(t)),!(t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array))throw new Error(&quot;Unsupported TypedArray subtype: &quot;+t.constructor.name)});var r=new Uint8Array(e),i=0;return n.forEach(function(t){r.set(new Uint8Array(t.buffer),i),i+=t.byteLength}),r.buffer}n.encodeWeights=function(t){return r(this,void 0,void 0,function(){var e,n,r,o;return i(this,function(i){switch(i.label){case 0:for(r in e=[],n=[],t){if(&quot;float32&quot;!==(o=t[r]).dtype&amp;&amp;&quot;int32&quot;!==o.dtype&amp;&amp;&quot;bool&quot;!==o.dtype)throw new Error(&quot;Unsupported dtype in weight &apos;&quot;+r+&quot;&apos;: &quot;+o.dtype);e.push({name:r,shape:o.shape,dtype:o.dtype}),n.push(o.data())}return[4,Promise.all(n)];case 1:return[2,{data:u(i.sent()),specs:e}]}})})},n.decodeWeights=function(t,e){for(var n={},r=0,i=function(e){var i=e.name,u=e.dtype,l=e.shape,c=a.sizeFromShape(l),f=void 0;if(&quot;quantization&quot;in e){var p=e.quantization;if(&quot;uint8&quot;!==p.dtype&amp;&amp;&quot;uint16&quot;!==p.dtype)throw new Error(&quot;Weight &quot;+e.name+&quot; has unknown quantization dtype &quot;+p.dtype+&quot;. Supported quantization dtypes are: &apos;uint8&apos; and &apos;uint16&apos;.&quot;);var h=s.DTYPE_VALUE_SIZE_MAP[p.dtype],d=t.slice(r,r+c*h),m=&quot;uint8&quot;===p.dtype?new Uint8Array(d):new Uint16Array(d);if(&quot;float32&quot;===u)f=Float32Array.from(m,function(t){return t*p.scale+p.min});else{if(&quot;int32&quot;!==u)throw new Error(&quot;Unsupported dtype in weight &apos;&quot;+i+&quot;&apos;: &quot;+u);f=Int32Array.from(m,function(t){return Math.round(t*p.scale+p.min)})}r+=c*h}else{var g=s.DTYPE_VALUE_SIZE_MAP[u];if(d=t.slice(r,r+c*g),&quot;float32&quot;===u)f=new Float32Array(d);else if(&quot;int32&quot;===u)f=new Int32Array(d);else{if(&quot;bool&quot;!==u)throw new Error(&quot;Unsupported dtype in weight &apos;&quot;+i+&quot;&apos;: &quot;+u);f=new Uint8Array(d)}r+=c*g}var v=void 0;if(&quot;float32&quot;===u)v=o.tensor(f,l,&quot;float32&quot;);else if(&quot;int32&quot;===u)v=o.tensor(f,l,&quot;int32&quot;);else{if(&quot;bool&quot;!==u)throw new Error(&quot;Unsupported dtype in weight &apos;&quot;+i+&quot;&apos;: &quot;+u);v=o.tensor(f,l,&quot;bool&quot;)}n[i]=v},u=0,l=e;u&lt;l.length;u++)i(l[u]);return n},n.concatenateTypedArrays=u;var l=void 0!==e&amp;&amp;(&quot;undefined&quot;==typeof Blob||&quot;undefined&quot;==typeof atob||&quot;undefined&quot;==typeof btoa);function c(t){return l?e.byteLength(t):new Blob([t]).size}n.stringByteLength=c,n.arrayBufferToBase64String=function(t){return l?e.from(t).toString(&quot;base64&quot;):btoa(String.fromCharCode.apply(null,new Uint8Array(t)))},n.base64StringToArrayBuffer=function(t){if(l){var n=e.from(t,&quot;base64&quot;);return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}for(var r=atob(t),i=new Uint8Array(r.length),o=0;o&lt;r.length;++o)i.set([r.charCodeAt(o)],o);return i.buffer},n.concatenateArrayBuffers=function(t){var e=0;t.forEach(function(t){e+=t.byteLength});var n=new Uint8Array(e),r=0;return t.forEach(function(t){n.set(new Uint8Array(t),r),r+=t.byteLength}),n.buffer},n.basename=function(t){for(t=t.trim();t.endsWith(&quot;/&quot;);)t=t.slice(0,t.length-1);var e=t.split(&quot;/&quot;);return e[e.length-1]},n.getModelArtifactsInfoForJSON=function(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error(&quot;Expected JSON model topology, received ArrayBuffer.&quot;);return{dateSaved:new Date,modelTopologyType:&quot;JSON&quot;,modelTopologyBytes:null==t.modelTopology?0:c(JSON.stringify(t.modelTopology)),weightSpecsBytes:null==t.weightSpecs?0:c(JSON.stringify(t.weightSpecs)),weightDataBytes:null==t.weightData?0:t.weightData.byteLength}}}).call(this,t(&quot;buffer&quot;).Buffer)},{&quot;../ops/tensor_ops&quot;:200,&quot;../util&quot;:223,&quot;./types&quot;:149,buffer:303}],144:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../environment&quot;),a=t(&quot;../util&quot;),s=t(&quot;./io_utils&quot;),u=t(&quot;./model_management&quot;),l=t(&quot;./router_registry&quot;),c=&quot;/&quot;,f=&quot;tensorflowjs_models&quot;,p=&quot;info&quot;,h=&quot;model_topology&quot;,d=&quot;weight_specs&quot;,m=&quot;weight_data&quot;,g=&quot;model_metadata&quot;;function v(t){return{info:[f,t,p].join(c),topology:[f,t,h].join(c),weightSpecs:[f,t,d].join(c),weightData:[f,t,m].join(c),modelMetadata:[f,t,g].join(c)}}function y(t){var e=t.split(c);if(e.length&lt;3)throw new Error(&quot;Invalid key format: &quot;+t);return e.slice(1,e.length-1).join(c)}n.purgeLocalStorageArtifacts=function(){if(!o.ENV.getBool(&quot;IS_BROWSER&quot;)||void 0===window.localStorage)throw new Error(&quot;purgeLocalStorageModels() cannot proceed because local storage is unavailable in the current environment.&quot;);for(var t=window.localStorage,e=[],n=0;n&lt;t.length;++n){var r=t.key(n),i=f+c;if(r.startsWith(i)&amp;&amp;r.length&gt;i.length){t.removeItem(r);var a=y(r);-1===e.indexOf(a)&amp;&amp;e.push(a)}}return e};var b=function(){function t(t){if(!o.ENV.getBool(&quot;IS_BROWSER&quot;)||void 0===window.localStorage)throw new Error(&quot;The current environment does not support local storage.&quot;);if(this.LS=window.localStorage,null==t||!t)throw new Error(&quot;For local storage, modelPath must not be null, undefined or empty.&quot;);this.modelPath=t,this.keys=v(this.modelPath)}return t.prototype.save=function(t){return r(this,void 0,void 0,function(){var e,n,r;return i(this,function(i){if(t.modelTopology instanceof ArrayBuffer)throw new Error(&quot;BrowserLocalStorage.save() does not support saving model topology in binary formats yet.&quot;);e=JSON.stringify(t.modelTopology),n=JSON.stringify(t.weightSpecs),r=s.getModelArtifactsInfoForJSON(t);try{return this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,e),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,s.arrayBufferToBase64String(t.weightData)),this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy})),[2,{modelArtifactsInfo:r}]}catch(t){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(&quot;Failed to save model &apos;&quot;+this.modelPath+&quot;&apos; to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=&quot;+r.modelTopologyBytes+&quot;, weightSpecsBytes=&quot;+r.weightSpecsBytes+&quot;, weightDataBytes=&quot;+r.weightDataBytes+&quot;.&quot;)}return[2]})})},t.prototype.load=function(){return r(this,void 0,void 0,function(){var t,e,n,r,o,a,u;return i(this,function(i){if(null==(t=JSON.parse(this.LS.getItem(this.keys.info))))throw new Error(&quot;In local storage, there is no model with name &apos;&quot;+this.modelPath+&quot;&apos;&quot;);if(&quot;JSON&quot;!==t.modelTopologyType)throw new Error(&quot;BrowserLocalStorage does not support loading non-JSON model topology yet.&quot;);if(e={},null==(n=JSON.parse(this.LS.getItem(this.keys.topology))))throw new Error(&quot;In local storage, the topology of model &apos;&quot;+this.modelPath+&quot;&apos; is missing.&quot;);if(e.modelTopology=n,null==(r=JSON.parse(this.LS.getItem(this.keys.weightSpecs))))throw new Error(&quot;In local storage, the weight specs of model &apos;&quot;+this.modelPath+&quot;&apos; are missing.&quot;);if(e.weightSpecs=r,null!=(o=this.LS.getItem(this.keys.modelMetadata))&amp;&amp;(a=JSON.parse(o),e.format=a.format,e.generatedBy=a.generatedBy,e.convertedBy=a.convertedBy),null==(u=this.LS.getItem(this.keys.weightData)))throw new Error(&quot;In local storage, the binary weight values of model &apos;&quot;+this.modelPath+&quot;&apos; are missing.&quot;);return e.weightData=s.base64StringToArrayBuffer(u),[2,e]})})},t.URL_SCHEME=&quot;localstorage://&quot;,t}();function _(t){return new b(t)}n.BrowserLocalStorage=b,n.localStorageRouter=function(t){return o.ENV.getBool(&quot;IS_BROWSER&quot;)&amp;&amp;!Array.isArray(t)&amp;&amp;t.startsWith(b.URL_SCHEME)?_(t.slice(b.URL_SCHEME.length)):null},l.IORouterRegistry.registerSaveRouter(n.localStorageRouter),l.IORouterRegistry.registerLoadRouter(n.localStorageRouter),n.browserLocalStorage=_;var w=function(){function t(){a.assert(o.ENV.getBool(&quot;IS_BROWSER&quot;),function(){return&quot;Current environment is not a web browser&quot;}),a.assert(void 0!==window.localStorage,function(){return&quot;Current browser does not appear to support localStorage&quot;}),this.LS=window.localStorage}return t.prototype.listModels=function(){return r(this,void 0,void 0,function(){var t,e,n,r,o,a;return i(this,function(i){for(t={},e=f+c,n=c+p,r=0;r&lt;this.LS.length;++r)(o=this.LS.key(r)).startsWith(e)&amp;&amp;o.endsWith(n)&amp;&amp;(a=y(o),t[a]=JSON.parse(this.LS.getItem(o)));return[2,t]})})},t.prototype.removeModel=function(t){return r(this,void 0,void 0,function(){var e,n;return i(this,function(r){var i;if(t=(i=t).startsWith(b.URL_SCHEME)?i.slice(b.URL_SCHEME.length):i,e=v(t),null==this.LS.getItem(e.info))throw new Error(&quot;Cannot find model at path &apos;&quot;+t+&quot;&apos;&quot;);return n=JSON.parse(this.LS.getItem(e.info)),this.LS.removeItem(e.info),this.LS.removeItem(e.topology),this.LS.removeItem(e.weightSpecs),this.LS.removeItem(e.weightData),[2,n]})})},t}();if(n.BrowserLocalStorageManager=w,o.ENV.getBool(&quot;IS_BROWSER&quot;))try{u.ModelStoreManagerRegistry.registerManager(b.URL_SCHEME,new w)}catch(t){}},{&quot;../environment&quot;:134,&quot;../util&quot;:223,&quot;./io_utils&quot;:143,&quot;./model_management&quot;:145,&quot;./router_registry&quot;:148}],145:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../util&quot;),a=t(&quot;./router_registry&quot;),s=&quot;://&quot;,u=function(){function t(){this.managers={}}return t.getInstance=function(){return null==t.instance&amp;&amp;(t.instance=new t),t.instance},t.registerManager=function(e,n){o.assert(null!=e,function(){return&quot;scheme must not be undefined or null.&quot;}),e.endsWith(s)&amp;&amp;(e=e.slice(0,e.indexOf(s))),o.assert(e.length&gt;0,function(){return&quot;scheme must not be an empty string.&quot;});var r=t.getInstance();o.assert(null==r.managers[e],function(){return&quot;A model store manager is already registered for scheme &apos;&quot;+e+&quot;&apos;.&quot;}),r.managers[e]=n},t.getManager=function(t){var e=this.getInstance().managers[t];if(null==e)throw new Error(&quot;Cannot find model manager for scheme &apos;&quot;+t+&quot;&apos;&quot;);return e},t.getSchemes=function(){return Object.keys(this.getInstance().managers)},t}();function l(t){if(-1===t.indexOf(s))throw new Error(&quot;The url string provided does not contain a scheme. Supported schemes are: &quot;+u.getSchemes().join(&quot;,&quot;));return{scheme:t.split(s)[0],path:t.split(s)[1]}}function c(t,e,n){return void 0===n&amp;&amp;(n=!1),r(this,void 0,void 0,function(){var r,s,c,f,p,h,d,m,g;return i(this,function(i){switch(i.label){case 0:return o.assert(t!==e,function(){return&quot;Old path and new path are the same: &apos;&quot;+t+&quot;&apos;&quot;}),r=a.IORouterRegistry.getLoadHandlers(t),o.assert(r.length&gt;0,function(){return&quot;Copying failed because no load handler is found for source URL &quot;+t+&quot;.&quot;}),o.assert(r.length&lt;2,function(){return&quot;Copying failed because more than one (&quot;+r.length+&quot;) load handlers for source URL &quot;+t+&quot;.&quot;}),s=r[0],c=a.IORouterRegistry.getSaveHandlers(e),o.assert(c.length&gt;0,function(){return&quot;Copying failed because no save handler is found for destination URL &quot;+e+&quot;.&quot;}),o.assert(c.length&lt;2,function(){return&quot;Copying failed because more than one (&quot;+r.length+&quot;) save handlers for destination URL &quot;+e+&quot;.&quot;}),f=c[0],p=l(t).scheme,h=l(t).path,d=p===l(t).scheme,[4,s.load()];case 1:return m=i.sent(),n&amp;&amp;d?[4,u.getManager(p).removeModel(h)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[4,f.save(m)];case 4:return g=i.sent(),!n||d?[3,6]:[4,u.getManager(p).removeModel(h)];case 5:i.sent(),i.label=6;case 6:return[2,g.modelArtifactsInfo]}})})}n.ModelStoreManagerRegistry=u,n.listModels=function(){return r(this,void 0,void 0,function(){var t,e,n,r,o,a,l;return i(this,function(i){switch(i.label){case 0:t=u.getSchemes(),e={},n=0,r=t,i.label=1;case 1:return n&lt;r.length?(o=r[n],[4,u.getManager(o).listModels()]):[3,4];case 2:for(l in a=i.sent())e[o+s+l]=a[l];i.label=3;case 3:return n++,[3,1];case 4:return[2,e]}})})},n.removeModel=function(t){return r(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return e=l(t),[4,u.getManager(e.scheme).removeModel(e.path)];case 1:return[2,n.sent()]}})})},n.copyModel=function(t,e){return r(this,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return[4,c(t,e,!1)];case 1:return[2,n.sent()]}})})},n.moveModel=function(t,e){return r(this,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return[4,c(t,e,!0)];case 1:return[2,n.sent()]}})})}},{&quot;../util&quot;:223,&quot;./router_registry&quot;:148}],146:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n&lt;r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&amp;&amp;(t[i]=e[i]);return t}).apply(this,arguments)},i=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},o=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var a=function(){function t(t,e,n){this.modelTopology=t,this.weightSpecs=e,this.weightData=n}return t.prototype.load=function(){return i(this,void 0,void 0,function(){var t;return o(this,function(e){return t={},null!=this.modelTopology&amp;&amp;(t=r({modelTopology:this.modelTopology},t)),null!=this.weightSpecs&amp;&amp;this.weightSpecs.length&gt;0&amp;&amp;(t=r({weightSpecs:this.weightSpecs},t)),null!=this.weightData&amp;&amp;this.weightData.byteLength&gt;0&amp;&amp;(t=r({weightData:this.weightData},t)),[2,t]})})},t}(),s=function(){function t(t){this.saveHandler=t}return t.prototype.save=function(t){return i(this,void 0,void 0,function(){return o(this,function(e){return[2,this.saveHandler(t)]})})},t}();n.fromMemory=function(t,e,n){return new a(t,e,n)},n.withSaveHandler=function(t){return new s(t)}},{}],147:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../util&quot;);n.monitorPromisesProgress=function(t,e,n,i){!function(t){r.assert(null!=t&amp;&amp;Array.isArray(t)&amp;&amp;t.length&gt;0,function(){return&quot;promises must be a none empty array&quot;})}(t),function(t,e){r.assert(t&gt;=0&amp;&amp;t&lt;=1,function(){return&quot;Progress fraction must be in range [0, 1], but got startFraction &quot;+t}),r.assert(e&gt;=0&amp;&amp;e&lt;=1,function(){return&quot;Progress fraction must be in range [0, 1], but got endFraction &quot;+e}),r.assert(e&gt;=t,function(){return&quot;startFraction must be no more than endFraction, but got startFraction &quot;+t+&quot; and endFraction &quot;+e})}(n=null==n?0:n,i=null==i?1:i);var o=0;return Promise.all(t.map(function(r){return r.then(function(r){var a=n+ ++o/t.length*(i-n);return e(a),r}),r}))}},{&quot;../util&quot;:223}],148:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){function t(){this.saveRouters=[],this.loadRouters=[]}return t.getInstance=function(){return null==t.instance&amp;&amp;(t.instance=new t),t.instance},t.registerSaveRouter=function(e){t.getInstance().saveRouters.push(e)},t.registerLoadRouter=function(e){t.getInstance().loadRouters.push(e)},t.getSaveHandlers=function(e){return t.getHandlers(e,&quot;save&quot;)},t.getLoadHandlers=function(e,n){return t.getHandlers(e,&quot;load&quot;,n)},t.getHandlers=function(e,n,r){var i=[];return(&quot;load&quot;===n?t.getInstance().loadRouters:t.getInstance().saveRouters).forEach(function(t){var n=t(e,r);null!==n&amp;&amp;i.push(n)}),i},t}();n.IORouterRegistry=r,n.registerSaveRouter=function(t){return r.registerSaveRouter(t)},n.registerLoadRouter=function(t){return r.registerLoadRouter(t)},n.getSaveHandlers=function(t){return r.getSaveHandlers(t)},n.getLoadHandlers=function(t,e){return r.getLoadHandlers(t)}},{}],149:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.DTYPE_VALUE_SIZE_MAP={float32:4,int32:4,uint16:2,uint8:1,bool:1}},{}],150:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../util&quot;),a=t(&quot;./io_utils&quot;),s=t(&quot;./progress&quot;),u=t(&quot;./types&quot;);function l(t,e){return r(this,void 0,void 0,function(){var n,r,a,u,l,c,f,p,h;return i(this,function(i){switch(i.label){case 0:return null==e&amp;&amp;(e={}),n=null==e.fetchFunc?o.fetch:e.fetchFunc,r=t.map(function(t){return n(t,e.requestInit)}),a=0,u=.5,null!=e.onProgress?[3,2]:[4,Promise.all(r)];case 1:return l=i.sent(),[3,4];case 2:return[4,s.monitorPromisesProgress(r,e.onProgress,a,u)];case 3:l=i.sent(),i.label=4;case 4:return c=l.map(function(t){return t.arrayBuffer()}),f=.5,p=1,null!=e.onProgress?[3,6]:[4,Promise.all(c)];case 5:return h=i.sent(),[3,8];case 6:return[4,s.monitorPromisesProgress(c,e.onProgress,f,p)];case 7:h=i.sent(),i.label=8;case 8:return[2,h]}})})}function c(t){var e=this;return function(n,s,l){return void 0===s&amp;&amp;(s=&quot;&quot;),r(e,void 0,void 0,function(){var e,r,c,f,p,h,d,m,g,v;return i(this,function(i){switch(i.label){case 0:if(e=n.map(function(){return!1}),r={},c=null!=l?l.map(function(){return!1}):[],f=[],n.forEach(function(t,n){var i=0;t.weights.forEach(function(t){var a=&quot;quantization&quot;in t?t.quantization.dtype:t.dtype,s=u.DTYPE_VALUE_SIZE_MAP[a]*o.sizeFromShape(t.shape),p=function(){e[n]=!0,null==r[n]&amp;&amp;(r[n]=[]),r[n].push({manifestEntry:t,groupOffset:i,sizeBytes:s})};null!=l?l.forEach(function(e,n){e===t.name&amp;&amp;(p(),c[n]=!0)}):p(),f.push(t.name),i+=s})}),!c.every(function(t){return t}))throw p=l.filter(function(t,e){return!c[e]}),new Error(&quot;Could not find weights in manifest with names: &quot;+p.join(&quot;, &quot;)+&quot;. \nManifest JSON has weights with names: &quot;+f.join(&quot;, &quot;)+&quot;.&quot;);return h=e.reduce(function(t,e,n){return e&amp;&amp;t.push(n),t},[]),d=[],h.forEach(function(t){n[t].paths.forEach(function(t){var e=s+(s.endsWith(&quot;/&quot;)?&quot;&quot;:&quot;/&quot;)+t;d.push(e)})}),[4,t(d)];case 1:return m=i.sent(),g={},v=0,h.forEach(function(t){for(var e=n[t].paths.length,i=0,o=0;o&lt;e;o++)i+=m[v+o].byteLength;for(var s=new ArrayBuffer(i),u=new Uint8Array(s),l=0,c=0;c&lt;e;c++){var f=new Uint8Array(m[v+c]);u.set(f,l),l+=f.byteLength}r[t].forEach(function(t){var e=s.slice(t.groupOffset,t.groupOffset+t.sizeBytes),n=a.decodeWeights(e,[t.manifestEntry]);for(var r in n)g[r]=n[r]}),v+=e}),[2,g]}})})}}n.loadWeightsAsArrayBuffer=l,n.loadWeights=function(t,e,n,o){return void 0===e&amp;&amp;(e=&quot;&quot;),r(this,void 0,void 0,function(){return i(this,function(r){return[2,c(function(t){return l(t,{requestInit:o})})(t,e,n)]})})},n.weightsLoaderFactory=c},{&quot;../util&quot;:223,&quot;./io_utils&quot;:143,&quot;./progress&quot;:147,&quot;./types&quot;:149}],151:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./environment&quot;);n.warn=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];r.ENV.getBool(&quot;IS_TEST&quot;)||console.warn.apply(console,t)},n.log=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];r.ENV.getBool(&quot;IS_TEST&quot;)||console.log.apply(console,t)}},{&quot;./environment&quot;:134}],152:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./ops/confusion_matrix&quot;);n.confusionMatrix=r.confusionMatrix},{&quot;./ops/confusion_matrix&quot;:164}],153:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../engine&quot;),a=t(&quot;../tensor&quot;),s=t(&quot;../tensor_util_env&quot;),u=t(&quot;../util&quot;),l=t(&quot;./axis_util&quot;),c=t(&quot;./concat_split&quot;),f=t(&quot;./operation&quot;),p=t(&quot;./rand&quot;),h=t(&quot;./tensor_ops&quot;);function d(t,e,n){return void 0===e&amp;&amp;(e=&quot;float32&quot;),e=e||&quot;float32&quot;,u.assertNonNegativeIntegerDimensions(t),new a.TensorBuffer(t,e,n)}n.buffer=d,n.print=function(t,e){void 0===e&amp;&amp;(e=!1),console.log(t.toString(e))},n.batchToSpaceND=f.op({batchToSpaceND_:function(t,e,n){var r=s.convertToTensor(t,&quot;x&quot;,&quot;batchToSpaceND&quot;),i=e.reduce(function(t,e){return t*e});return u.assert(r.rank&gt;=1+e.length,function(){return&quot;input rank is &quot;+r.rank+&quot; but should be &gt; than blockShape.length &quot;+e.length}),u.assert(n.length===e.length,function(){return&quot;crops.length is &quot;+n.length+&quot; but should be equal to blockShape.length  &quot;+e.length}),u.assert(r.shape[0]%i==0,function(){return&quot;input tensor batch is &quot;+r.shape[0]+&quot; but is not divisible by the product of the elements of blockShape &quot;+e.join(&quot; * &quot;)+&quot; === &quot;+i}),o.ENGINE.runKernel(function(t){return t.batchToSpaceND(r,e,n)},{$x:r},function(t){return{$x:function(){return t.spaceToBatchND(e,n)}}})}}),n.cast=f.op({cast_:function(t,e){var n=s.convertToTensor(t,&quot;x&quot;,&quot;cast&quot;);return o.ENGINE.runKernel(function(t){return t.cast(n,e)},{$x:n},function(t){return{$x:function(){return t.clone()}}})}}),n.clone=f.op({clone_:function(t){var e=s.convertToTensor(t,&quot;x&quot;,&quot;clone&quot;,null);return o.ENGINE.runKernel(function(t){return a.Tensor.make(e.shape,{dataId:e.dataId},e.dtype)},{$x:e},function(t){return{$x:function(){return t.toFloat()}}})}}),n.cumsum=f.op({cumsum_:function(t,e,n,r){void 0===e&amp;&amp;(e=0),void 0===n&amp;&amp;(n=!1),void 0===r&amp;&amp;(r=!1);var i=s.convertToTensor(t,&quot;x&quot;,&quot;cumsum&quot;);e|=0;var a=l.getAxesPermutation([e],i.rank),u=i;null!=a&amp;&amp;(u=i.transpose(a));var c=l.getInnerMostAxes(1,i.rank)[0],f=o.ENGINE.runKernel(function(t){return t.cumsum(u,c,n,r)},{permutedX:u},function(t){return{permutedX:function(){return t.cumsum(e,n,!r)}}});return null!=a&amp;&amp;(f=f.transpose(a)),f}}),n.depthToSpace=f.op({depthToSpace_:function(t,e,n){void 0===n&amp;&amp;(n=&quot;NHWC&quot;);var r=s.convertToTensor(t,&quot;x&quot;,&quot;depthToSpace&quot;),i=&quot;NHWC&quot;===n?r.shape[1]:r.shape[2],a=&quot;NHWC&quot;===n?r.shape[2]:r.shape[3],l=&quot;NHWC&quot;===n?r.shape[3]:r.shape[1];return u.assert(i*e&gt;=0,function(){return&quot;Negative dimension size caused by overflow when multiplying\n      &quot;+i+&quot; and &quot;+e+&quot;  for depthToSpace with input shape\n      &quot;+r.shape}),u.assert(a*e&gt;=0,function(){return&quot;Negative dimension size caused by overflow when multiplying\n      &quot;+a+&quot; and &quot;+e+&quot; for depthToSpace with input shape\n          &quot;+r.shape}),u.assert(l%(e*e)==0,function(){return&quot;Dimension size must be evenly divisible by &quot;+e*e+&quot; but is &quot;+l+&quot; for depthToSpace with input shape &quot;+r.shape}),o.ENGINE.runKernel(function(t){return t.depthToSpace(r,e,n)},{$x:r})}}),n.expandDims=f.op({expandDims_:function(t,e){void 0===e&amp;&amp;(e=0);var r=s.convertToTensor(t,&quot;x&quot;,&quot;expandDims&quot;);u.assert(e&lt;=r.rank,function(){return&quot;Axis must be &lt;= rank of the tensor&quot;});var i=r.shape.slice();return e&lt;0&amp;&amp;(u.assert(-(r.rank+1)&lt;=e,function(){return&quot;Axis must be in the interval [&quot;+-(r.rank+1)+&quot;, &quot;+r.rank+&quot;]&quot;}),e=r.rank+e+1),i.splice(e,0,1),n.reshape(r,i)}}),n.eye=f.op({eye_:function(t,e,r,i){void 0===i&amp;&amp;(i=&quot;float32&quot;),null==e&amp;&amp;(e=t);for(var o=d([t,e],i),a=t&lt;=e?t:e,s=0;s&lt;a;++s)o.set(1,s,s);var u=o.toTensor().as2D(t,e);if(null==r)return u;if(1===r.length)return n.tile(n.expandDims(u,0),[r[0],1,1]);if(2===r.length)return n.tile(n.expandDims(n.expandDims(u,0),0),[r[0],r[1],1,1]);if(3===r.length)return n.tile(n.expandDims(n.expandDims(n.expandDims(u,0),0),0),[r[0],r[1],r[2],1,1]);throw new Error(&quot;eye() currently supports only 1D and 2D batchShapes, but received &quot;+r.length+&quot;D.&quot;)}}),n.multinomial=f.op({multinomial_:function(t,e,n,r){void 0===r&amp;&amp;(r=!1);var i=s.convertToTensor(t,&quot;logits&quot;,&quot;multinomial&quot;),a=i.size,u=i.rank;if(a&lt;2)throw new Error(&quot;Error in multinomial: you need at least 2 outcomes, but got &quot;+a+&quot;.&quot;);if(u&gt;2)throw new Error(&quot;Rank of probabilities must be 1 or 2, but is &quot;+u);n=n||Math.random();var l=1===u?i.as2D(1,-1):i,c=o.ENGINE.runKernel(function(t){return t.multinomial(l,r,e,n)},{logits2D:l});return 1===u?c.as1D():c}}),n.oneHot=f.op({oneHot_:function(t,e,n,r){if(void 0===n&amp;&amp;(n=1),void 0===r&amp;&amp;(r=0),e&lt;2)throw new Error(&quot;Error in oneHot: depth must be &gt;=2, but it is &quot;+e);var i=s.convertToTensor(t,&quot;indices&quot;,&quot;oneHot&quot;,&quot;int32&quot;),a=i.shape.concat([e]);return i=i.flatten(),o.ENGINE.runKernel(function(t){return t.oneHot(i,e,n,r)},{$indices:i},function(t){return{$indices:function(){return h.zeros(i.shape,&quot;float32&quot;)}}}).reshape(a)}}),n.pad=f.op({pad_:function(t,e,n){void 0===n&amp;&amp;(n=0);var r=s.convertToTensor(t,&quot;x&quot;,&quot;pad&quot;);if(0===r.rank)throw new Error(&quot;pad(scalar) is not defined. Pass non-scalar to pad&quot;);var i=e.map(function(t){return t[0]});return o.ENGINE.runKernel(function(t){return t.pad(r,e,n)},{$x:r},function(t){return{$x:function(){return t.slice(i,r.shape)}}})}}),n.pad1d=f.op({pad1d_:function(t,e,r){return void 0===r&amp;&amp;(r=0),u.assert(2===e.length,function(){return&quot;Invalid number of paddings. Must be length of 2.&quot;}),n.pad(t,[e],r)}}),n.pad2d=f.op({pad2d_:function(t,e,r){return void 0===r&amp;&amp;(r=0),u.assert(2===e.length&amp;&amp;2===e[0].length&amp;&amp;2===e[1].length,function(){return&quot;Invalid number of paddings. Must be length of 2 each.&quot;}),n.pad(t,e,r)}}),n.pad3d=f.op({pad3d_:function(t,e,r){return void 0===r&amp;&amp;(r=0),u.assert(3===e.length&amp;&amp;2===e[0].length&amp;&amp;2===e[1].length&amp;&amp;2===e[2].length,function(){return&quot;Invalid number of paddings. Must be length of 2 each.&quot;}),n.pad(t,e,r)}}),n.pad4d=f.op({pad4d_:function(t,e,r){return void 0===r&amp;&amp;(r=0),u.assert(4===e.length&amp;&amp;2===e[0].length&amp;&amp;2===e[1].length&amp;&amp;2===e[2].length&amp;&amp;2===e[3].length,function(){return&quot;Invalid number of paddings. Must be length of 2 each.&quot;}),n.pad(t,e,r)}}),n.rand=f.op({rand_:function(t,e,n){var r=u.sizeFromShape(t),i=null;if(null==n||&quot;float32&quot;===n)i=new Float32Array(r);else if(&quot;int32&quot;===n)i=new Int32Array(r);else{if(&quot;bool&quot;!==n)throw new Error(&quot;Unknown data type &quot;+n);i=new Uint8Array(r)}for(var o=0;o&lt;r;o++)i[o]=e();return a.Tensor.make(t,{values:i},n)}}),n.randomNormal=f.op({randomNormal_:function(t,e,n,r,i){if(void 0===e&amp;&amp;(e=0),void 0===n&amp;&amp;(n=1),null!=r&amp;&amp;&quot;bool&quot;===r)throw new Error(&quot;Unsupported data type &quot;+r);for(var o=new p.MPRandGauss(e,n,r,!1,i),a=d(t,r),s=0;s&lt;a.values.length;s++)a.values[s]=o.nextValue();return a.toTensor()}}),n.randomUniform=f.op({randomUniform_:function(t,e,n,r){void 0===e&amp;&amp;(e=0),void 0===n&amp;&amp;(n=1),void 0===r&amp;&amp;(r=&quot;float32&quot;);for(var i=d(t,r),o=0;o&lt;i.values.length;o++)i.values[o]=u.randUniform(e,n);return i.toTensor()}}),n.reshape=f.op({reshape_:function(t,e){var n=s.convertToTensor(t,&quot;x&quot;,&quot;reshape&quot;,null);return e=u.inferFromImplicitShape(e,n.size),u.assert(n.size===u.sizeFromShape(e),function(){return&quot;new shape and old shape must have the same number of elements.&quot;}),o.ENGINE.runKernel(function(t){return t.reshape(n,e)},{$x:n},function(t){return{$x:function(){return t.reshape(n.shape)}}})}}),n.spaceToBatchND=f.op({spaceToBatchND_:function(t,e,n){var r=s.convertToTensor(t,&quot;x&quot;,&quot;spaceToBatchND&quot;);return u.assert(r.rank&gt;=1+e.length,function(){return&quot;input rank &quot;+r.rank+&quot; should be &gt; than [blockShape] &quot;+e.length}),u.assert(n.length===e.length,function(){return&quot;paddings.shape[0] &quot;+n.length+&quot; must be equal to [blockShape] &quot;+e.length}),u.assert(r.shape.reduce(function(t,r,i){return i&gt;0&amp;&amp;i&lt;=e.length?t&amp;&amp;(r+n[i-1][0]+n[i-1][1])%e[i-1]==0:t},!0),function(){return&quot;input spatial dimensions &quot;+r.shape.slice(1)+&quot; with paddings &quot;+n.toString()+&quot; must be divisible by blockShapes &quot;+e.toString()}),o.ENGINE.runKernel(function(t){return t.spaceToBatchND(r,e,n)},{$x:r},function(t){return{$x:function(){return t.batchToSpaceND(e,n)}}})}}),n.squeeze=f.op({squeeze_:function(t,e){var r=s.convertToTensor(t,&quot;x&quot;,&quot;squeeze&quot;);return n.reshape(r,u.squeezeShape(r.shape,e).newShape)}}),n.stack=f.op({stack_:function(t,e){void 0===e&amp;&amp;(e=0);var n=s.convertToTensorArray(t,&quot;tensors&quot;,&quot;stack&quot;);if(u.assert(n.length&gt;=1,function(){return&quot;Pass at least one tensor to tf.stack&quot;}),1===n.length)return n[0].expandDims(e);var r=n[0].rank,i=n[0].shape,o=n[0].dtype;u.assert(e&lt;=r,function(){return&quot;Axis must be &lt;= rank of the tensor&quot;}),n.forEach(function(t){u.assertShapesMatch(i,t.shape,&quot;All tensors passed to stack must have matching shapes&quot;)}),n.forEach(function(t){u.assert(o===t.dtype,function(){return&quot;All tensors passed to stack must have matching dtypes&quot;})});var a=n.map(function(t){return t.expandDims(e)});return c.concat(a,e)}}),n.tile=f.op({tile_:function(t,e){var n=s.convertToTensor(t,&quot;x&quot;,&quot;tile&quot;);return u.assert(n.rank===e.length,function(){return&quot;Error in transpose: rank of input &quot;+n.rank+&quot; must match length of reps &quot;+e+&quot;.&quot;}),o.ENGINE.runKernel(function(t,r){var i=t.tile(n,e);return r([n]),i},{$x:n},function(t,n){var r=n[0];return{$x:function(){var n=h.zerosLike(r);if(1===r.rank)for(var i=0;i&lt;e[0];++i)n=n.add(t.slice([i*r.shape[0]],[r.shape[0]]));else if(2===r.rank)for(i=0;i&lt;e[0];++i)for(var o=0;o&lt;e[1];++o)n=n.add(t.slice([i*r.shape[0],o*r.shape[1]],[r.shape[0],r.shape[1]]));else if(3===r.rank)for(i=0;i&lt;e[0];++i)for(o=0;o&lt;e[1];++o)for(var a=0;a&lt;e[2];++a)n=n.add(t.slice([i*r.shape[0],o*r.shape[1],a*r.shape[2]],[r.shape[0],r.shape[1],r.shape[2]]));else{if(4!==r.rank)throw new Error(&quot;Gradient for tile operation is not implemented for rank-&quot;+r.rank+&quot; tensors yet.&quot;);for(i=0;i&lt;e[0];++i)for(o=0;o&lt;e[1];++o)for(a=0;a&lt;e[2];++a)for(var s=0;s&lt;e[3];++s)n=n.add(t.slice([i*r.shape[0],o*r.shape[1],a*r.shape[2],s*r.shape[3]],[r.shape[0],r.shape[1],r.shape[2],r.shape[3]]))}return n}}})}}),n.truncatedNormal=f.op({truncatedNormal_:function(t,e,n,r,i){if(void 0===e&amp;&amp;(e=0),void 0===n&amp;&amp;(n=1),null!=r&amp;&amp;&quot;bool&quot;===r)throw new Error(&quot;Unsupported data type &quot;+r);for(var o=new p.MPRandGauss(e,n,r,!0,i),a=d(t,r),s=0;s&lt;a.values.length;s++)a.values[s]=o.nextValue();return a.toTensor()}}),n.unstack=f.op({unstack_:function(t,e){void 0===e&amp;&amp;(e=0),e=e||0;var r=s.convertToTensor(t,&quot;x&quot;,&quot;unstack&quot;);return u.assert(e&gt;=-r.shape.length&amp;&amp;e&lt;r.shape.length,function(){return&quot;Axis = &quot;+e+&quot; is not in [-&quot;+r.shape.length+&quot;, &quot;+r.shape.length+&quot;)&quot;}),e&lt;0&amp;&amp;(e+=r.shape.length),o.ENGINE.runKernel(function(t){return t.unstack(r,e)},{$x:r},function(t){return{$x:function(){return n.stack(t,e)}}})}}),n.setdiff1dAsync=function(t,e){return r(this,void 0,void 0,function(){var n,r,o,l,c,f,p,h,d,m;return i(this,function(i){switch(i.label){case 0:return n=s.convertToTensor(t,&quot;x&quot;,&quot;setdiff1d&quot;),r=s.convertToTensor(e,&quot;y&quot;,&quot;setdiff1d&quot;),u.assert(n.dtype===r.dtype,function(){return&quot;x and y should have the same dtype, but got x (&quot;+n.dtype+&quot;) and y (&quot;+r.dtype+&quot;).&quot;}),u.assert(1===n.rank,function(){return&quot;x should be 1D tensor, but got x (&quot;+n.shape+&quot;).&quot;}),u.assert(1===r.rank,function(){return&quot;y should be 1D tensor, but got y (&quot;+r.shape+&quot;).&quot;}),[4,n.data()];case 1:return o=i.sent(),[4,r.data()];case 2:for(l=i.sent(),c=new Set(l),f=0,d=0;d&lt;o.length;d++)c.has(o[d])||f++;for(p=new a.TensorBuffer([f],n.dtype),h=new a.TensorBuffer([f],&quot;int32&quot;),d=0,m=0;d&lt;o.length;d++)c.has(o[d])||(p.values[m]=o[d],h.values[m]=d,m++);return[2,[p.toTensor(),h.toTensor()]]}})})}},{&quot;../engine&quot;:133,&quot;../tensor&quot;:216,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./axis_util&quot;:155,&quot;./concat_split&quot;:162,&quot;./operation&quot;:180,&quot;./rand&quot;:183,&quot;./tensor_ops&quot;:200}],154:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.getReshaped=function(t,e,n,r){void 0===r&amp;&amp;(r=!0);var i=[];if(r)(i=i.concat(e.slice(0))).push(t[0]/n),i=i.concat(t.slice(1));else{i=i.concat(t[0]);for(var o=e.length,a=0;a&lt;o;++a)i=i.concat([t[a+1]/e[a],e[a]]);i=i.concat(t.slice(o+1))}return i},n.getPermuted=function(t,e,n){void 0===n&amp;&amp;(n=!0);var r=[];if(n){r.push(e);for(var i=e+1;i&lt;t;++i)i&lt;=2*e?(r.push(i),r.push(i-(e+1))):r.push(i)}else{var o=[],a=[];for(i=1;i&lt;t;++i)i&gt;=2*e+1||i%2==1?a.push(i):o.push(i);r.push.apply(r,o),r.push(0),r.push.apply(r,a)}return r},n.getReshapedPermuted=function(t,e,n,r){void 0===r&amp;&amp;(r=!0);var i=[];r?i.push(t[0]/n):i.push(t[0]*n);for(var o=1;o&lt;t.length;++o)o&lt;=e.length?r?i.push(e[o-1]*t[o]):i.push(t[o]/e[o-1]):i.push(t[o]);return i},n.getSliceBeginCoords=function(t,e){for(var n=[0],r=0;r&lt;e;++r)n.push(t[r][0]);return n},n.getSliceSize=function(t,e,n){for(var r=t.slice(0,1),i=0;i&lt;n;++i)r.push(t[i+1]-e[i][0]-e[i][1]);return r}},{}],155:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../util&quot;);function i(t,e){for(var n=0;n&lt;t.length;++n)if(t[t.length-n-1]!==e-1-n)return!1;return!0}function o(t,e,n){for(var r=t.length+e.length,i=[],o=0,a=0,s=0;s&lt;r;s++)-1===n.indexOf(s)?i.push(t[o++]):i.push(e[a++]);return i}n.axesAreInnerMostDims=i,n.combineLocations=o,n.computeOutAndReduceShapes=function(t,e){for(var n=[],r=t.length,i=0;i&lt;r;i++)-1===e.indexOf(i)&amp;&amp;n.push(t[i]);return[n,e.map(function(e){return t[e]})]},n.expandShapeToKeepDim=function(t,e){return o(t,e.map(function(t){return 1}),e)},n.assertAxesAreInnerMostDims=function(t,e,n){r.assert(i(e,n),function(){return t+&quot; supports only inner-most axes for now. Got axes &quot;+e+&quot; and rank-&quot;+n+&quot; input.&quot;})},n.getAxesPermutation=function(t,e){if(i(t,e))return null;for(var n=[],r=0;r&lt;e;++r)-1===t.indexOf(r)&amp;&amp;n.push(r);return t.forEach(function(t){return n.push(t)}),n},n.getUndoAxesPermutation=function(t){return t.map(function(t,e){return[e,t]}).sort(function(t,e){return t[1]-e[1]}).map(function(t){return t[0]})},n.getInnerMostAxes=function(t,e){for(var n=[],r=e-t;r&lt;e;++r)n.push(r);return n}},{&quot;../util&quot;:223}],156:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../globals&quot;),o=t(&quot;../tensor_util_env&quot;),a=t(&quot;../util&quot;),s=t(&quot;./array_ops&quot;),u=t(&quot;./broadcast_util&quot;),l=t(&quot;./operation&quot;),c=t(&quot;./tensor_ops&quot;),f=t(&quot;./unary_ops&quot;);function p(t,e,n,r,i,s){var u,l,c=o.convertToTensor(t,&quot;x&quot;,&quot;batchNorm&quot;),f=o.convertToTensor(e,&quot;mean&quot;,&quot;batchNorm&quot;),p=o.convertToTensor(n,&quot;variance&quot;,&quot;batchNorm&quot;);return null!=i&amp;&amp;(u=o.convertToTensor(i,&quot;scale&quot;,&quot;batchNorm&quot;)),null!=r&amp;&amp;(l=o.convertToTensor(r,&quot;offset&quot;,&quot;batchNorm&quot;)),a.assert(2===c.rank,function(){return&quot;Error in batchNorm3D: x must be rank 3 but got rank &quot;+c.rank+&quot;.&quot;}),a.assert(2===f.rank||1===f.rank,function(){return&quot;Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank &quot;+f.rank+&quot;.&quot;}),a.assert(2===p.rank||1===p.rank,function(){return&quot;Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank &quot;+p.rank+&quot;.&quot;}),null!=u&amp;&amp;a.assert(2===u.rank||1===u.rank,function(){return&quot;Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank &quot;+u.rank+&quot;.&quot;}),null!=l&amp;&amp;a.assert(2===l.rank||1===l.rank,function(){return&quot;Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank &quot;+l.rank+&quot;.&quot;}),m(c,f,p,l,u,s)}function h(t,e,n,r,i,s){var u,l,c=o.convertToTensor(t,&quot;x&quot;,&quot;batchNorm&quot;),f=o.convertToTensor(e,&quot;mean&quot;,&quot;batchNorm&quot;),p=o.convertToTensor(n,&quot;variance&quot;,&quot;batchNorm&quot;);return null!=i&amp;&amp;(u=o.convertToTensor(i,&quot;scale&quot;,&quot;batchNorm&quot;)),null!=r&amp;&amp;(l=o.convertToTensor(r,&quot;offset&quot;,&quot;batchNorm&quot;)),a.assert(3===c.rank,function(){return&quot;Error in batchNorm3D: x must be rank 3 but got rank &quot;+c.rank+&quot;.&quot;}),a.assert(3===f.rank||1===f.rank,function(){return&quot;Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank &quot;+f.rank+&quot;.&quot;}),a.assert(3===p.rank||1===p.rank,function(){return&quot;Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank &quot;+p.rank+&quot;.&quot;}),null!=u&amp;&amp;a.assert(3===u.rank||1===u.rank,function(){return&quot;Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank &quot;+u.rank+&quot;.&quot;}),null!=l&amp;&amp;a.assert(3===l.rank||1===l.rank,function(){return&quot;Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank &quot;+l.rank+&quot;.&quot;}),m(c,f,p,l,u,s)}function d(t,e,n,r,i,s){var u,l,c=o.convertToTensor(t,&quot;x&quot;,&quot;batchNorm&quot;),f=o.convertToTensor(e,&quot;mean&quot;,&quot;batchNorm&quot;),p=o.convertToTensor(n,&quot;variance&quot;,&quot;batchNorm&quot;);return null!=i&amp;&amp;(u=o.convertToTensor(i,&quot;scale&quot;,&quot;batchNorm&quot;)),null!=r&amp;&amp;(l=o.convertToTensor(r,&quot;offset&quot;,&quot;batchNorm&quot;)),a.assert(4===c.rank,function(){return&quot;Error in batchNorm4D: x must be rank 4 but got rank &quot;+c.rank+&quot;.&quot;}),a.assert(4===f.rank||1===f.rank,function(){return&quot;Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank &quot;+f.rank+&quot;.&quot;}),a.assert(4===p.rank||1===p.rank,function(){return&quot;Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank &quot;+p.rank+&quot;.&quot;}),null!=u&amp;&amp;a.assert(4===u.rank||1===u.rank,function(){return&quot;Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank &quot;+u.rank+&quot;.&quot;}),null!=l&amp;&amp;a.assert(4===l.rank||1===l.rank,function(){return&quot;Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank &quot;+l.rank+&quot;.&quot;}),m(c,f,p,l,u,s)}function m(t,e,n,i,l,p){null==p&amp;&amp;(p=.001);var h,d,m,v=o.convertToTensor(t,&quot;x&quot;,&quot;batchNorm&quot;),y=o.convertToTensor(e,&quot;mean&quot;,&quot;batchNorm&quot;),b=o.convertToTensor(n,&quot;variance&quot;,&quot;batchNorm&quot;);null!=l&amp;&amp;(h=o.convertToTensor(l,&quot;scale&quot;,&quot;batchNorm&quot;)),null!=i&amp;&amp;(d=o.convertToTensor(i,&quot;offset&quot;,&quot;batchNorm&quot;)),a.assert(y.rank===b.rank,function(){return&quot;Batch normalization gradient requires mean and variance to have equal ranks.&quot;}),a.assert(null==d||y.rank===d.rank,function(){return&quot;Batch normalization gradient requires mean and offset to have equal ranks.&quot;}),a.assert(null==h||y.rank===h.rank,function(){return&quot;Batch normalization gradient requires mean and scale to have equal ranks.&quot;}),m=0===v.rank||1===v.rank?v.as4D(1,1,1,v.size):2===v.rank?v.as4D(1,1,v.shape[0],v.shape[1]):3===v.rank?v.as4D(1,v.shape[0],v.shape[1],v.shape[2]):v;return r.ENGINE.runKernel(function(t,e){var n=t.batchNormalization(m,g(y),g(b),p,g(h),g(d));return e([v,y,b,h]),n},{$x:v,$mean:y,$variance:b,$scale:h,$offset:d},function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=null==o?c.scalar(1):o,l=u.getReductionAxes(r.shape,m.shape),h=[];if(1===r.rank){for(var d=0;d&lt;m.shape.length-1;++d)h.push(m.shape[d]);h.push(1)}var g=n.sub(r),v=t.mul(a),y=f.rsqrt(i.add(c.scalar(p))),b=y.mul(y).mul(y).mul(c.scalar(-.5));return{$x:function(){return 1===r.rank?t.mul(s.tile(y.as4D(1,1,1,r.shape[0]),h)).mul(a).reshape(n.shape):t.mul(y).mul(a).reshape(n.shape)},$mean:function(){var t=y.mul(c.scalar(-1)).mul(v);return 1===r.rank&amp;&amp;(t=t.sum(l)),t.reshape(r.shape)},$variance:function(){var t=b.mul(g).mul(v);return 1===r.rank&amp;&amp;(t=t.sum(l)),t.reshape(r.shape)},$scale:function(){var e=g.mul(y),n=t.mul(e);return 1===r.rank&amp;&amp;(n=n.sum(l)),n.reshape(r.shape)},$offset:function(){var e=t;return 1===r.rank&amp;&amp;(e=e.sum(l)),e.reshape(r.shape)}}}).reshape(v.shape)}function g(t){return null==t?null:0===t.rank?t.as1D():1===t.rank?t:2===t.rank?t.as4D(1,1,t.shape[0],t.shape[1]):3===t.rank?t.as4D(1,t.shape[0],t.shape[1],t.shape[2]):t}function v(){i.deprecationWarn(&quot;tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon&quot;)}n.batchNormalization2d=l.op({batchNormalization2d_:function(t,e,n,r,i,o){return void 0===r&amp;&amp;(r=.001),v(),p(t,e,n,o,i,r)}}),n.batchNormalization3d=l.op({batchNormalization3d_:function(t,e,n,r,i,o){return void 0===r&amp;&amp;(r=.001),v(),h(t,e,n,o,i,r)}}),n.batchNormalization4d=l.op({batchNormalization4d_:function(t,e,n,r,i,o){return void 0===r&amp;&amp;(r=.001),v(),d(t,e,n,o,i,r)}}),n.batchNormalization=l.op({batchNormalization_:function(t,e,n,r,i,o){return void 0===r&amp;&amp;(r=.001),v(),m(t,e,n,o,i,r)}}),n.batchNorm=l.op({batchNorm_:m}),n.batchNorm2d=l.op({batchNorm2d_:p}),n.batchNorm3d=l.op({batchNorm3d_:h}),n.batchNorm4d=l.op({batchNorm4d_:d})},{&quot;../engine&quot;:133,&quot;../globals&quot;:136,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./array_ops&quot;:153,&quot;./broadcast_util&quot;:158,&quot;./operation&quot;:180,&quot;./tensor_ops&quot;:200,&quot;./unary_ops&quot;:203}],157:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util&quot;),o=t(&quot;../tensor_util_env&quot;),a=t(&quot;../types&quot;),s=t(&quot;../util&quot;),u=t(&quot;./broadcast_util&quot;),l=t(&quot;./operation&quot;),c=t(&quot;./tensor_ops&quot;),f=t(&quot;./unary_ops&quot;);n.add=l.op({add_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;add&quot;),s=o.convertToTensor(e,&quot;b&quot;,&quot;add&quot;);n=i.makeTypesMatch(a,s),a=n[0],s=n[1];var l=u.assertAndGetBroadcastShape(a.shape,s.shape);return r.ENGINE.runKernel(function(t){return t.add(a,s)},{$a:a,$b:s},function(t){return{$a:function(){var e=t,n=u.getReductionAxes(a.shape,l);return n.length&gt;0&amp;&amp;(e=e.sum(n)),e.reshape(a.shape)},$b:function(){var e=t,n=u.getReductionAxes(s.shape,l);return n.length&gt;0&amp;&amp;(e=e.sum(n)),e.reshape(s.shape)}}})}}),n.addN=l.op({addN_:function(t){s.assert(Array.isArray(t),function(){return&quot;The argument passed to tf.addN() must be a list of tensors&quot;}),s.assert(t.length&gt;=1,function(){return&quot;Must pass at least one tensor to tf.addN(), but got &quot;+t.length});var e=t.map(function(t,e){return o.convertToTensor(t,&quot;tensors&quot;+e,&quot;addN&quot;)}),n=e[0];e.forEach(function(t){if(t.dtype!==n.dtype)throw new Error(&quot;All tensors passed to tf.addN() must have the same dtype&quot;)}),e.forEach(function(t){if(!s.arraysEqual(t.shape,n.shape))throw new Error(&quot;All tensors passed to tf.addN() must have the same shape&quot;)});var i=e;return r.ENGINE.runKernel(function(t){return t.addN(e)},i,function(t){var n={};return e.forEach(function(e,r){n[r]=function(){return t.clone()}}),n})}}),n.addStrict=l.op({addStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;addStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;addStrict&quot;);return s.assertShapesMatch(n.shape,r.shape,&quot;Error in addStrict: &quot;),n.add(r)}}),n.atan2=l.op({atan2_:function(t,e){var a,s=o.convertToTensor(t,&quot;a&quot;,&quot;atan2&quot;),l=o.convertToTensor(e,&quot;b&quot;,&quot;atan2&quot;);a=i.makeTypesMatch(s,l),s=a[0],l=a[1];var c=u.assertAndGetBroadcastShape(s.shape,l.shape);return r.ENGINE.runKernel(function(t,e){var n=t.atan2(s,l);return e([s,l]),n},{$a:s,$b:l},function(t,e){var r=e[0],i=e[1];return{$a:function(){var e=n.add(r.square(),i.square()),o=t.mul(i.div(e)),a=u.getReductionAxes(r.shape,c);return a.length&gt;0&amp;&amp;(o=o.sum(a)),o.reshape(r.shape)},$b:function(){var e=n.add(r.square(),i.square()),o=f.neg(t.mul(r.div(e))),a=u.getReductionAxes(i.shape,c);return a.length&gt;0&amp;&amp;(o=o.sum(a)),o.reshape(i.shape)}}})}}),n.div=l.op({div_:function(t,e){var a,s=o.convertToTensor(t,&quot;a&quot;,&quot;div&quot;),l=o.convertToTensor(e,&quot;b&quot;,&quot;div&quot;);if(a=i.makeTypesMatch(s,l),s=a[0],l=a[1],&quot;int32&quot;===s.dtype&amp;&amp;&quot;int32&quot;===l.dtype)return n.floorDiv(s,l);var c=u.assertAndGetBroadcastShape(s.shape,l.shape);return r.ENGINE.runKernel(function(t,e){var n=t.realDivide(s,l);return e([s,l]),n},{$a:s,$b:l},function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=t.div(r.toFloat()),i=u.getReductionAxes(n.shape,c);return i.length&gt;0?e.sum(i).reshape(n.shape):e},$b:function(){var e=t.mul(n.toFloat()),i=u.getReductionAxes(r.shape,c);i.length&gt;0&amp;&amp;(e=e.sum(i).reshape(r.shape));var o=r.square();return e.div(o.toFloat()).neg()}}})}}),n.divStrict=l.op({divStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;div&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;div&quot;);return s.assertShapesMatch(n.shape,r.shape,&quot;Error in divideStrict: &quot;),n.div(r)}}),n.floorDiv=l.op({floorDiv_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;floorDiv&quot;),s=o.convertToTensor(e,&quot;b&quot;,&quot;floorDiv&quot;);n=i.makeTypesMatch(a,s),a=n[0],s=n[1];var l=u.assertAndGetBroadcastShape(a.shape,s.shape);return r.ENGINE.runKernel(function(t,e){var n=t.floorDiv(a,s);return e([a,s]),n},{$a:a,$b:s},function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=t.div(r.toFloat()),i=u.getReductionAxes(n.shape,l);return i.length&gt;0?e.sum(i).reshape(n.shape):e},$b:function(){var e=t.mul(n.toFloat()),i=u.getReductionAxes(r.shape,l);i.length&gt;0&amp;&amp;(e=e.sum(i).reshape(r.shape));var o=r.square();return e.div(o.toFloat()).neg()}}})}}),n.maximum=l.op({maximum_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;maximum&quot;),s=o.convertToTensor(e,&quot;b&quot;,&quot;maximum&quot;);return n=i.makeTypesMatch(a,s),a=n[0],s=n[1],&quot;bool&quot;===a.dtype&amp;&amp;(a=a.toInt(),s=s.toInt()),u.assertAndGetBroadcastShape(a.shape,s.shape),r.ENGINE.runKernel(function(t,e){var n=t.maximum(a,s);return e([a,s]),n},{$a:a,$b:s},function(t,e){var n=e[0],r=e[1];return{$a:function(){return t.mul(n.greaterEqual(r).toFloat())},$b:function(){return t.mul(n.less(r).toFloat())}}})}}),n.maximumStrict=l.op({maximumStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;maximumStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;maximumStrict&quot;);return s.assertShapesMatch(n.shape,r.shape,&quot;Error in maximumStrict: &quot;),n.maximum(r)}}),n.minimum=l.op({minimum_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;minimum&quot;),s=o.convertToTensor(e,&quot;b&quot;,&quot;minimum&quot;);return n=i.makeTypesMatch(a,s),a=n[0],s=n[1],&quot;bool&quot;===a.dtype&amp;&amp;(a=a.toInt(),s=s.toInt()),u.assertAndGetBroadcastShape(a.shape,s.shape),r.ENGINE.runKernel(function(t,e){var n=t.minimum(a,s);return e([a,s]),n},{$a:a,$b:s},function(t,e){var n=e[0],r=e[1];return{$a:function(){return t.mul(n.lessEqual(r).toFloat())},$b:function(){return t.mul(n.greater(r).toFloat())}}})}}),n.minimumStrict=l.op({minimumStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;minimumStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;minimumStrict&quot;);return s.assertShapesMatch(n.shape,r.shape,&quot;Error in minimumStrict: &quot;),n.minimum(r)}}),n.mod=l.op({mod_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;mod&quot;),s=o.convertToTensor(e,&quot;b&quot;,&quot;mod&quot;);n=i.makeTypesMatch(a,s),a=n[0],s=n[1];var l=u.assertAndGetBroadcastShape(a.shape,s.shape);return r.ENGINE.runKernel(function(t,e){var n=t.mod(a,s);return e([a,s]),n},{$a:a,$b:s},function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=u.getReductionAxes(n.shape,l);return e.length&gt;0?t.sum(e).reshape(n.shape):t},$b:function(){var e=t.mul(n.div(r).floor().neg()),i=u.getReductionAxes(r.shape,l);return i.length&gt;0?e.sum(i).reshape(r.shape):e}}})}}),n.modStrict=l.op({modStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;modStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;modStrict&quot;);return s.assertShapesMatch(n.shape,r.shape,&quot;Error in modStrict: &quot;),n.mod(r)}}),n.mul=l.op({mul_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;mul&quot;),s=o.convertToTensor(e,&quot;b&quot;,&quot;mul&quot;);n=i.makeTypesMatch(a,s),a=n[0],s=n[1];var l=u.assertAndGetBroadcastShape(a.shape,s.shape);return r.ENGINE.runKernel(function(t,e){var n=t.multiply(a,s);return e([a,s]),n},{$a:a,$b:s},function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=t.mul(r.toFloat()),i=u.getReductionAxes(n.shape,l);return i.length&gt;0?e.sum(i).reshape(n.shape):e},$b:function(){var e=t.mul(n.toFloat()),i=u.getReductionAxes(r.shape,l);return i.length&gt;0?e.sum(i).reshape(r.shape):e}}})}}),n.mulStrict=l.op({mulStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;mul&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;mul&quot;);return s.assertShapesMatch(n.shape,r.shape,&quot;Error in multiplyStrict: &quot;),n.mul(r)}}),n.pow=l.op({pow_:function(t,e){var n=o.convertToTensor(t,&quot;base&quot;,&quot;pow&quot;),i=o.convertToTensor(e,&quot;exp&quot;,&quot;pow&quot;),s=u.assertAndGetBroadcastShape(n.shape,i.shape);return t=n.cast(a.upcastType(n.dtype,i.dtype)),e=i.cast(a.upcastType(n.dtype,i.dtype)),r.ENGINE.runKernel(function(t,e){var r=t.pow(n,i);return e([n,i,r]),r},{$base:n,$exp:i},function(t,e){var n=e[0],r=e[1],i=e[2];return{$base:function(){var e=r.toFloat(),i=t.mul(e.mul(n.pow(e.sub(c.scalar(1))))),o=u.getReductionAxes(n.shape,s);return o.length&gt;0&amp;&amp;(i=i.sum(o)),i.reshape(n.shape)},$exp:function(){var e=n.greater(0),o=n.log().where(e,c.zerosLike(n)),a=t.mul(i.mul(o)),l=u.getReductionAxes(r.shape,s);return l.length&gt;0&amp;&amp;(a=a.sum(l)),a.reshape(r.shape)}}})}}),n.powStrict=l.op({powStrict_:function(t,e){return s.assertShapesMatch(t.shape,e.shape,&quot;Error in powStrict: &quot;),t.pow(e)}}),n.squaredDifference=l.op({squaredDifference_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;squaredDifference&quot;),s=o.convertToTensor(e,&quot;b&quot;,&quot;squaredDifference&quot;);return n=i.makeTypesMatch(a,s),a=n[0],s=n[1],u.assertAndGetBroadcastShape(a.shape,s.shape),r.ENGINE.runKernel(function(t,e){var n=t.squaredDifference(a,s);return e([a,s]),n},{$a:a,$b:s},function(t,e){var n=e[0],r=e[1],i=c.scalar(2);return{$a:function(){return t.mul(n.sub(r).mul(i))},$b:function(){return t.mul(r.sub(n).mul(i))}}})}}),n.squaredDifferenceStrict=l.op({squaredDifferenceStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;squaredDifferenceStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;squaredDifferenceStrict&quot;);return s.assertShapesMatch(n.shape,r.shape,&quot;Error in squaredDifferenceStrict: &quot;),n.squaredDifference(r)}}),n.sub=l.op({sub_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;sub&quot;),s=o.convertToTensor(e,&quot;b&quot;,&quot;sub&quot;);n=i.makeTypesMatch(a,s),a=n[0],s=n[1];var l=u.assertAndGetBroadcastShape(a.shape,s.shape);return r.ENGINE.runKernel(function(t){return t.subtract(a,s)},{$a:a,$b:s},function(t){return{$a:function(){var e=t,n=u.getReductionAxes(a.shape,l);return n.length&gt;0&amp;&amp;(e=e.sum(n)),e.reshape(a.shape)},$b:function(){var e=t,n=u.getReductionAxes(s.shape,l);return n.length&gt;0&amp;&amp;(e=e.sum(n)),e.neg().reshape(s.shape)}}})}}),n.subStrict=l.op({subStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;subStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;subStrict&quot;);return s.assertShapesMatch(n.shape,r.shape,&quot;Error in subStrict: &quot;),n.sub(r)}})},{&quot;../engine&quot;:133,&quot;../tensor_util&quot;:218,&quot;../tensor_util_env&quot;:219,&quot;../types&quot;:222,&quot;../util&quot;:223,&quot;./broadcast_util&quot;:158,&quot;./operation&quot;:180,&quot;./tensor_ops&quot;:200,&quot;./unary_ops&quot;:203}],158:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.getBroadcastDims=function(t,e){for(var n=t.length,r=[],i=0;i&lt;n;i++){var o=n-1-i,a=t[o]||1;(e[e.length-1-i]||1)&gt;1&amp;&amp;1===a&amp;&amp;r.unshift(o)}return r},n.getReductionAxes=function(t,e){for(var n=[],r=0;r&lt;e.length;r++){var i=t[t.length-r-1],o=e.length-r-1,a=e[o];(null==i||1===i&amp;&amp;a&gt;1)&amp;&amp;n.unshift(o)}return n},n.assertAndGetBroadcastShape=function(t,e){for(var n=[],r=Math.max(t.length,e.length),i=0;i&lt;r;i++){var o=t[t.length-i-1];null==o&amp;&amp;(o=1);var a=e[e.length-i-1];if(null==a&amp;&amp;(a=1),1===o)n.unshift(a);else if(1===a)n.unshift(o);else{if(o!==a)throw Error(&quot;Operands could not be broadcast together with shapes &quot;+t+&quot; and &quot;+e+&quot;.&quot;);n.unshift(o)}}return n}},{}],159:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../engine&quot;),a=t(&quot;../tensor&quot;),s=t(&quot;../tensor_util_env&quot;),u=t(&quot;./operation&quot;);n.toPixels=function(t,e){return r(this,void 0,void 0,function(){var n,r,o,u,l,c,f,p,h,d,m,g,v,y,b,_,w,x,E,k,T,N,S;return i(this,function(i){switch(i.label){case 0:if(n=s.convertToTensor(t,&quot;img&quot;,&quot;toPixels&quot;),t instanceof a.Tensor||(n=n.toInt()),2!==n.rank&amp;&amp;3!==n.rank)throw new Error(&quot;toPixels only supports rank 2 or 3 tensors, got rank &quot;+n.rank+&quot;.&quot;);if(r=n.shape.slice(0,2),o=r[0],u=r[1],(l=2===n.rank?1:n.shape[2])&gt;4||2===l)throw new Error(&quot;toPixels only supports depth of size 1, 3 or 4 but got &quot;+l);return[4,n.data()];case 1:return c=i.sent(),f=n.min(),p=n.max(),[4,Promise.all([f.data(),p.data()])];case 2:if(h=i.sent(),d=h[0],m=h[1],g=d[0],v=m[0],f.dispose(),p.dispose(),&quot;float32&quot;===n.dtype){if(g&lt;0||v&gt;1)throw new Error(&quot;Tensor values for a float32 Tensor must be in the range [0 - 1] but got range [&quot;+g+&quot; - &quot;+v+&quot;].&quot;)}else{if(&quot;int32&quot;!==n.dtype)throw new Error(&quot;Unsupported type for toPixels: &quot;+n.dtype+&quot;. Please use float32 or int32 tensors.&quot;);if(g&lt;0||v&gt;255)throw new Error(&quot;Tensor values for a int32 Tensor must be in the range [0 - 255] but got range [&quot;+g+&quot; - &quot;+v+&quot;].&quot;)}for(y=&quot;float32&quot;===n.dtype?255:1,b=new Uint8ClampedArray(u*o*4),_=0;_&lt;o*u;++_)w=void 0,x=void 0,E=void 0,k=void 0,1===l?(w=c[_]*y,x=c[_]*y,E=c[_]*y,k=255):3===l?(w=c[3*_]*y,x=c[3*_+1]*y,E=c[3*_+2]*y,k=255):4===l&amp;&amp;(w=c[4*_]*y,x=c[4*_+1]*y,E=c[4*_+2]*y,k=c[4*_+3]*y),b[0+(T=4*_)]=Math.round(w),b[T+1]=Math.round(x),b[T+2]=Math.round(E),b[T+3]=Math.round(k);return null!=e&amp;&amp;(e.width=u,e.height=o,N=e.getContext(&quot;2d&quot;),S=new ImageData(b,u,o),N.putImageData(S,0,0)),n!==t&amp;&amp;n.dispose(),[2,b]}})})},n.fromPixels=u.op({fromPixels_:function(t,e){if(void 0===e&amp;&amp;(e=3),e&gt;4)throw new Error(&quot;Cannot construct Tensor with more than 4 channels from pixels.&quot;);return o.ENGINE.fromPixels(t,e)}})},{&quot;../engine&quot;:133,&quot;../tensor&quot;:216,&quot;../tensor_util_env&quot;:219,&quot;./operation&quot;:180}],160:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util&quot;),o=t(&quot;../tensor_util_env&quot;),a=t(&quot;../util&quot;),s=t(&quot;./broadcast_util&quot;),u=t(&quot;./operation&quot;),l=t(&quot;./tensor_ops&quot;);n.equal=u.op({equal_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;equal&quot;),u=o.convertToTensor(e,&quot;b&quot;,&quot;equal&quot;);return n=i.makeTypesMatch(a,u),a=n[0],u=n[1],s.assertAndGetBroadcastShape(a.shape,u.shape),r.ENGINE.runKernel(function(t){return t.equal(a,u)},{$a:a,$b:u})}}),n.equalStrict=u.op({equalStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;equalStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;equalStrict&quot;);return a.assertShapesMatch(n.shape,r.shape,&quot;Error in equalStrict: &quot;),n.equal(r)}}),n.greater=u.op({greater_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;greater&quot;),u=o.convertToTensor(e,&quot;b&quot;,&quot;greater&quot;);return n=i.makeTypesMatch(a,u),a=n[0],u=n[1],s.assertAndGetBroadcastShape(a.shape,u.shape),r.ENGINE.runKernel(function(t){return t.greater(a,u)},{$a:a,$b:u})}}),n.greaterEqual=u.op({greaterEqual_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;greaterEqual&quot;),u=o.convertToTensor(e,&quot;b&quot;,&quot;greaterEqual&quot;);return n=i.makeTypesMatch(a,u),a=n[0],u=n[1],s.assertAndGetBroadcastShape(a.shape,u.shape),r.ENGINE.runKernel(function(t,e){var n=t.greaterEqual(a,u);return e([a,u]),n},{$a:a,$b:u},function(t,e){var n=e[0],r=e[1];return{$a:function(){return l.zerosLike(n)},$b:function(){return l.zerosLike(r)}}})}}),n.greaterEqualStrict=u.op({greaterEqualStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;greaterEqualStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;greaterEqualStrict&quot;);return a.assertShapesMatch(n.shape,r.shape,&quot;Error in greaterEqualStrict: &quot;),n.greaterEqual(r)}}),n.greaterStrict=u.op({greaterStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;greaterStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;greaterStrict&quot;);return a.assertShapesMatch(n.shape,r.shape,&quot;Error in greaterStrict: &quot;),n.greater(r)}}),n.less=u.op({less_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;less&quot;),u=o.convertToTensor(e,&quot;b&quot;,&quot;less&quot;);return n=i.makeTypesMatch(a,u),a=n[0],u=n[1],s.assertAndGetBroadcastShape(a.shape,u.shape),r.ENGINE.runKernel(function(t){return t.less(a,u)},{$a:a,$b:u})}}),n.lessEqual=u.op({lessEqual_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;lessEqual&quot;),u=o.convertToTensor(e,&quot;b&quot;,&quot;lessEqual&quot;);return n=i.makeTypesMatch(a,u),a=n[0],u=n[1],s.assertAndGetBroadcastShape(a.shape,u.shape),r.ENGINE.runKernel(function(t){return t.lessEqual(a,u)},{$a:a,$b:u})}}),n.lessEqualStrict=u.op({lessEqualStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;lessEqualStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;lessEqualStrict&quot;);return a.assertShapesMatch(n.shape,r.shape,&quot;Error in lessEqualStrict: &quot;),n.lessEqual(r)}}),n.lessStrict=u.op({lessStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;lessStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;lessStrict&quot;);return a.assertShapesMatch(n.shape,r.shape,&quot;Error in lessStrict: &quot;),n.less(r)}}),n.notEqual=u.op({notEqual_:function(t,e){var n,a=o.convertToTensor(t,&quot;a&quot;,&quot;notEqual&quot;),u=o.convertToTensor(e,&quot;b&quot;,&quot;notEqual&quot;);return n=i.makeTypesMatch(a,u),a=n[0],u=n[1],s.assertAndGetBroadcastShape(a.shape,u.shape),r.ENGINE.runKernel(function(t){return t.notEqual(a,u)},{$a:a,$b:u})}}),n.notEqualStrict=u.op({notEqualStrict_:function(t,e){var n=o.convertToTensor(t,&quot;a&quot;,&quot;notEqualStrict&quot;),r=o.convertToTensor(e,&quot;b&quot;,&quot;notEqualStrict&quot;);return a.assertShapesMatch(n.shape,r.shape,&quot;Error in notEqualStrict: &quot;),n.notEqual(r)}})},{&quot;../engine&quot;:133,&quot;../tensor_util&quot;:218,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./broadcast_util&quot;:158,&quot;./operation&quot;:180,&quot;./tensor_ops&quot;:200}],161:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;./operation&quot;);n.complex=a.op({complex_:function(t,e){var n=i.convertToTensor(t,&quot;real&quot;,&quot;complex&quot;),a=i.convertToTensor(e,&quot;imag&quot;,&quot;complex&quot;);return o.assertShapesMatch(n.shape,a.shape,&quot;real and imag shapes, &quot;+n.shape+&quot; and &quot;+a.shape+&quot;, must match in call to tf.complex().&quot;),r.ENGINE.runKernel(function(t){return t.complex(n,a)},{$real:n,$imag:a})}}),n.real=a.op({real_:function(t){var e=i.convertToTensor(t,&quot;input&quot;,&quot;real&quot;);return r.ENGINE.runKernel(function(t){return t.real(e)},{$input:e})}}),n.imag=a.op({imag_:function(t){var e=i.convertToTensor(t,&quot;input&quot;,&quot;imag&quot;);return r.ENGINE.runKernel(function(t){return t.imag(e)},{$input:e})}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./operation&quot;:180}],162:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;../util&quot;),s=t(&quot;./concat_util&quot;),u=t(&quot;./operation&quot;),l=t(&quot;./tensor_ops&quot;);n.concat=u.op({concat_:function(t,e){void 0===e&amp;&amp;(e=0),o.assert(t.length&gt;=1,function(){return&quot;Pass at least one tensor to concat&quot;});var u=i.convertToTensorArray(t,&quot;tensors&quot;,&quot;concat&quot;);e=a.parseAxisParam(e,u[0].shape)[0];var c=s.computeOutShape(u.map(function(t){return t.shape}),e);if(0===o.sizeFromShape(c))return l.tensor([],c);if(1===(u=u.filter(function(t){return t.size&gt;0})).length)return u[0];var f=u.map(function(t){return t.shape});s.assertParamsConsistent(f,e);var p=u;return r.ENGINE.runKernel(function(t){return t.concat(u,e)},p,function(t){var r=f.map(function(t){return t[e]});return n.split(t,r,e).map(function(t){return function(){return t}})})}}),n.concat1d=u.op({concat1d_:function(t){return n.concat(t,0)}}),n.concat2d=u.op({concat2d_:function(t,e){return n.concat(t,e)}}),n.concat3d=u.op({concat3d_:function(t,e){return n.concat(t,e)}}),n.concat4d=u.op({concat4d_:function(t,e){return n.concat(t,e)}}),n.split=u.op({split_:function(t,e,s){void 0===s&amp;&amp;(s=0);var u,l=i.convertToTensor(t,&quot;x&quot;,&quot;split&quot;);return s=a.parseAxisParam(s,l.shape)[0],&quot;number&quot;==typeof e?(o.assert(l.shape[s]%e==0,function(){return&quot;Number of splits must evenly divide the axis.&quot;}),u=new Array(e).fill(l.shape[s]/e)):(o.assert(l.shape[s]===e.reduce(function(t,e){return t+e}),function(){return&quot;The sum of sizes must match the size of the axis dimension.&quot;}),u=e),r.ENGINE.runKernel(function(t){return t.split(l,u,s)},{$x:l},function(t){return{$x:function(){return n.concat(t,s)}}})}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./concat_util&quot;:163,&quot;./operation&quot;:180,&quot;./tensor_ops&quot;:200}],163:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../util&quot;);n.assertParamsConsistent=function(t,e){var n=t[0].length;t.forEach(function(t,e){r.assert(t.length===n,function(){return&quot;Error in concat&quot;+n+&quot;D: rank of tensors[&quot;+e+&quot;] must be the same as the rank of the rest (&quot;+n+&quot;)&quot;})}),r.assert(e&gt;=0&amp;&amp;e&lt;n,function(){return&quot;Error in concat&quot;+n+&quot;D: axis must be between 0 and &quot;+(n-1)+&quot;.&quot;});var i=t[0];t.forEach(function(t,o){for(var a=0;a&lt;n;a++)r.assert(a===e||t[a]===i[a],function(){return&quot;Error in concat&quot;+n+&quot;D: Shape of tensors[&quot;+o+&quot;] (&quot;+t+&quot;) does not match the shape of the rest (&quot;+i+&quot;) along the non-concatenated axis &quot;+o+&quot;.&quot;})})},n.computeOutShape=function(t,e){for(var n=t[0].slice(),r=1;r&lt;t.length;r++)n[e]+=t[r][e];return n}},{&quot;../util&quot;:223}],164:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../tensor_util_env&quot;),i=t(&quot;../util&quot;),o=t(&quot;./array_ops&quot;),a=t(&quot;./operation&quot;);function s(t,e,n){var a=r.convertToTensor(t,&quot;labels&quot;,&quot;confusionMatrix&quot;),s=r.convertToTensor(e,&quot;predictions&quot;,&quot;confusionMatrix&quot;);i.assert(null==n||n&gt;0&amp;&amp;Number.isInteger(n),function(){return&quot;If provided, numClasses must be a positive integer, but got &quot;+n}),i.assert(1===a.rank,function(){return&quot;Expected the rank of labels to be 1, but got &quot;+a.rank}),i.assert(1===s.rank,function(){return&quot;Expected the rank of predictions to be 1, but got &quot;+s.rank}),i.assert(a.shape[0]===s.shape[0],function(){return&quot;Mismatch in the number of examples: &quot;+a.shape[0]+&quot; vs. &quot;+s.shape[0]+&quot;. Labels and predictions should have the same number of elements.&quot;}),i.assert(n&gt;0&amp;&amp;Number.isInteger(n),function(){return&quot;numClasses is required to be a positive integer, but got &quot;+n});var u=o.oneHot(a.asType(&quot;int32&quot;),n),l=o.oneHot(s.asType(&quot;int32&quot;),n);return u.transpose().matMul(l).asType(&quot;int32&quot;)}n.confusionMatrix_=s,n.confusionMatrix=a.op({confusionMatrix_:s})},{&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./array_ops&quot;:153,&quot;./operation&quot;:180}],165:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;./conv_util&quot;),s=t(&quot;./operation&quot;);function u(t,e,i,s,u,l){o.assert(t.length===e.rank,function(){return&quot;Length of inShape (&quot;+t.length+&quot;) and rank of dy (&quot;+e.rank+&quot;) must match&quot;});var c=t,f=e,p=!1;3===e.rank&amp;&amp;(p=!0,f=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]),c=[1,t[0],t[1],t[2]]);var h=c[3],d=f.shape[3];o.assert(4===c.length,function(){return&quot;Error in conv2dDerInput: inShape must be length 4, but got length &quot;+c.length+&quot;.&quot;}),o.assert(4===f.rank,function(){return&quot;Error in conv2dDerInput: dy must be rank 4, but got rank &quot;+f.rank}),o.assert(4===i.rank,function(){return&quot;Error in conv2dDerInput: filter must be rank 4, but got rank &quot;+i.rank}),o.assert(h===i.shape[2],function(){return&quot;Error in conv2dDerInput: depth of input (&quot;+h+&quot;) must match input depth for filter &quot;+i.shape[2]+&quot;.&quot;}),o.assert(d===i.shape[3],function(){return&quot;Error in conv2dDerInput: depth of output (&quot;+d+&quot;) must match output depth for filter &quot;+i.shape[3]+&quot;.&quot;}),null!=l&amp;&amp;o.assert(o.isInt(u),function(){return&quot;Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode &quot;+l+&quot; but got pad &quot;+u+&quot;.&quot;});var m=a.computeConv2DInfo(c,i.shape,s,1,u,l),g=r.ENGINE.runKernel(function(t,e){var n=t.conv2dDerInput(f,i,m);return e([i,f]),n},{dy4D:f,filter:i},function(t,e){var r=e[0],i=e[1];return{dy4D:function(){return n.conv2d(t,r,s,u,&quot;NHWC&quot;,1,l)},filter:function(){return n.conv2dDerFilter(t,i,r.shape,s,u,l)}}});return p?g.as3D(g.shape[1],g.shape[2],g.shape[3]):g}function l(t,e,n,i,s,u){var l=t;3===t.rank&amp;&amp;(l=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var c=e;3===c.rank&amp;&amp;(c=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),o.assert(4===l.rank,function(){return&quot;Error in conv2dDerFilter: input must be rank 4, but got shape &quot;+l.shape+&quot;.&quot;}),o.assert(4===c.rank,function(){return&quot;Error in conv2dDerFilter: dy must be rank 4, but got shape &quot;+c.shape+&quot;.&quot;}),o.assert(4===n.length,function(){return&quot;Error in conv2dDerFilter: filterShape must be length 4, but got &quot;+n+&quot;.&quot;}),o.assert(l.shape[3]===n[2],function(){return&quot;Error in conv2dDerFilter: depth of input &quot;+l.shape[3]+&quot;) must match input depth in filter (&quot;+n[2]+&quot;.&quot;}),o.assert(c.shape[3]===n[3],function(){return&quot;Error in conv2dDerFilter: depth of dy (&quot;+c.shape[3]+&quot;) must match output depth for filter (&quot;+n[3]+&quot;).&quot;}),null!=u&amp;&amp;o.assert(o.isInt(s),function(){return&quot;Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode &quot;+u+&quot; but got pad &quot;+s+&quot;.&quot;});var f=a.computeConv2DInfo(l.shape,n,i,1,s,u);return r.ENGINE.runKernel(function(t){return t.conv2dDerFilter(l,c,f)},{x4D:l,dy4D:c})}function c(t){var e=function(t){return&quot;number&quot;==typeof t?[t,t,t]:2===t.length?[t[0],t[1],1]:t}(t),n=e[0],r=e[1],i=e[2];return 1===n&amp;&amp;1===r&amp;&amp;1===i}n.conv1d=s.op({conv1d_:function(t,e,r,s,u,l,c){void 0===u&amp;&amp;(u=&quot;NWC&quot;),void 0===l&amp;&amp;(l=1);var f=i.convertToTensor(t,&quot;x&quot;,&quot;conv1d&quot;),p=i.convertToTensor(e,&quot;filter&quot;,&quot;conv1d&quot;),h=f,d=!1;2===f.rank&amp;&amp;(d=!0,h=f.as3D(1,f.shape[0],f.shape[1])),o.assert(3===h.rank,function(){return&quot;Error in conv1d: input must be rank 3, but got rank &quot;+h.rank+&quot;.&quot;}),o.assert(3===p.rank,function(){return&quot;Error in conv1d: filter must be rank 3, but got rank &quot;+p.rank+&quot;.&quot;}),null!=c&amp;&amp;o.assert(o.isInt(s),function(){return&quot;Error in conv1d: pad must be an integer when using, dimRoundingMode &quot;+c+&quot; but got pad &quot;+s+&quot;.&quot;}),o.assert(h.shape[2]===p.shape[1],function(){return&quot;Error in conv1d: depth of input (&quot;+h.shape[2]+&quot;) must match input depth for filter &quot;+p.shape[1]+&quot;.&quot;}),o.assert(a.eitherStridesOrDilationsAreOne(r,l),function(){return&quot;Error in conv1D: Either stride or dilation must be 1. Got stride &quot;+r+&quot; and dilation &apos;&quot;+l+&quot;&apos;&quot;}),o.assert(&quot;NWC&quot;===u,function(){return&quot;Error in conv1d: got dataFormat of &quot;+u+&quot; but only NWC is currently supported.&quot;});var m=p.as4D(1,p.shape[0],p.shape[1],p.shape[2]),g=h.as4D(h.shape[0],1,h.shape[1],h.shape[2]),v=[1,r],y=[1,l],b=n.conv2d(g,m,v,s,&quot;NHWC&quot;,y,c);return d?b.as2D(b.shape[2],b.shape[3]):b.as3D(b.shape[0],b.shape[2],b.shape[3])}}),n.conv2d=s.op({conv2d_:function(t,e,n,s,c,f,p){void 0===c&amp;&amp;(c=&quot;NHWC&quot;),void 0===f&amp;&amp;(f=[1,1]);var h=i.convertToTensor(t,&quot;x&quot;,&quot;conv2d&quot;),d=i.convertToTensor(e,&quot;filter&quot;,&quot;conv2d&quot;),m=h,g=!1;3===h.rank&amp;&amp;(g=!0,m=h.as4D(1,h.shape[0],h.shape[1],h.shape[2])),o.assert(4===m.rank,function(){return&quot;Error in conv2d: input must be rank 4, but got rank &quot;+m.rank+&quot;.&quot;}),o.assert(4===d.rank,function(){return&quot;Error in conv2d: filter must be rank 4, but got rank &quot;+d.rank+&quot;.&quot;}),null!=p&amp;&amp;o.assert(o.isInt(s),function(){return&quot;Error in conv2d: pad must be an integer when using, dimRoundingMode &quot;+p+&quot; but got pad &quot;+s+&quot;.&quot;}),o.assert(m.shape[3]===d.shape[2],function(){return&quot;Error in conv2d: depth of input (&quot;+m.shape[3]+&quot;) must match input depth for filter &quot;+d.shape[2]+&quot;.&quot;}),o.assert(a.eitherStridesOrDilationsAreOne(n,f),function(){return&quot;Error in conv2D: Either strides or dilations must be 1. Got strides &quot;+n+&quot; and dilations &apos;&quot;+f+&quot;&apos;&quot;}),o.assert(&quot;NHWC&quot;===c,function(){return&quot;Error in conv2d: got dataFormat of &quot;+c+&quot; but only NHWC is currently supported.&quot;});var v=a.computeConv2DInfo(m.shape,d.shape,n,f,s,p),y=r.ENGINE.runKernel(function(t,e){var n=t.conv2d(m,d,v);return e([d,m]),n},{x:m,$filter:d},function(t,e){var r=e,i=r[0],c=r[1];return o.assert(a.tupleValuesAreOne(f),function(){return&quot;Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations &apos;&quot;+f+&quot;&apos;&quot;}),{x:function(){return u(c.shape,t,i,n,s)},$filter:function(){return l(c,t,i.shape,n,s)}}});return g?y.as3D(y.shape[1],y.shape[2],y.shape[3]):y}}),n.conv3d=s.op({conv3d_:function(t,e,n,s,u,l){void 0===u&amp;&amp;(u=&quot;NHWC&quot;),void 0===l&amp;&amp;(l=[1,1,1]);var f=i.convertToTensor(t,&quot;x&quot;,&quot;conv3d&quot;),p=i.convertToTensor(e,&quot;filter&quot;,&quot;conv3d&quot;),h=f,d=!1;4===f.rank&amp;&amp;(d=!0,h=f.as5D(1,f.shape[0],f.shape[1],f.shape[2],f.shape[3])),o.assert(5===h.rank,function(){return&quot;Error in conv3d: input must be rank 5, but got rank &quot;+h.rank+&quot;.&quot;}),o.assert(5===p.rank,function(){return&quot;Error in conv3d: filter must be rank 5, but got rank &quot;+p.rank+&quot;.&quot;}),o.assert(h.shape[4]===p.shape[3],function(){return&quot;Error in conv3d: depth of input (&quot;+h.shape[4]+&quot;) must match input depth for filter &quot;+p.shape[3]+&quot;.&quot;}),o.assert(function(t,e){return c(t)||c(e)}(n,l),function(){return&quot;Error in conv3D: Either strides or dilations must be 1. Got strides &quot;+n+&quot; and dilations &apos;&quot;+l+&quot;&apos;&quot;}),o.assert(&quot;NHWC&quot;===u,function(){return&quot;Error in conv3d: got dataFormat of &quot;+u+&quot; but only NHWC is currently supported.&quot;});var m=a.computeConv3DInfo(h.shape,p.shape,n,l,s),g=r.ENGINE.runKernel(function(t,e){var n=t.conv3d(h,p,m);return e([h,p]),n},{x:h,$filter:p},function(t,e){o.assert(c(l),function(){return&quot;Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations &apos;&quot;+l+&quot;&apos;&quot;});var i=e[0],u=e[1];return{x:function(){return function(t,e,n,i,s){o.assert(t.length===e.rank,function(){return&quot;Length of inShape (&quot;+t.length+&quot;) and rank of dy (&quot;+e.rank+&quot;) must match&quot;});var u=t,l=e,c=!1;4===e.rank&amp;&amp;(c=!0,l=e.as5D(1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]),u=[1,t[0],t[1],t[2],t[3]]);var f=u[4],p=l.shape[4];o.assert(5===u.length,function(){return&quot;Error in conv3dDerInput: inShape must be length 5, but got length &quot;+u.length+&quot;.&quot;}),o.assert(5===l.rank,function(){return&quot;Error in conv3dDerInput: dy must be rank 5, but got rank &quot;+l.rank}),o.assert(5===n.rank,function(){return&quot;Error in conv3dDerInput: filter must be rank 5, but got rank &quot;+n.rank}),o.assert(f===n.shape[3],function(){return&quot;Error in conv3dDerInput: depth of input (&quot;+f+&quot;) must match input depth for filter &quot;+n.shape[3]+&quot;.&quot;}),o.assert(p===n.shape[4],function(){return&quot;Error in conv3dDerInput: depth of output (&quot;+p+&quot;) must match output depth for filter &quot;+n.shape[4]+&quot;.&quot;});var h=a.computeConv3DInfo(u,n.shape,i,1,s),d=r.ENGINE.runKernel(function(t){return t.conv3dDerInput(l,n,h)},{dy5D:l});return c?d.as4D(d.shape[1],d.shape[2],d.shape[3],d.shape[4]):d}(i.shape,t,u,n,s)},$filter:function(){return function(t,e,n,i,s){var u=t;4===t.rank&amp;&amp;(u=t.as5D(1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]));var l=e;4===l.rank&amp;&amp;(l=e.as5D(1,e.shape[0],e.shape[1],e.shape[2],e.shape[3])),o.assert(5===u.rank,function(){return&quot;Error in conv3dDerFilter: input must be rank 5, but got shape &quot;+u.shape+&quot;.&quot;}),o.assert(5===l.rank,function(){return&quot;Error in conv3dDerFilter: dy must be rank 5, but got shape &quot;+l.shape+&quot;.&quot;}),o.assert(5===n.length,function(){return&quot;Error in conv3dDerFilter: filterShape must be length 5, but got &quot;+n+&quot;.&quot;}),o.assert(u.shape[4]===n[3],function(){return&quot;Error in conv3dDerFilter: depth of input &quot;+u.shape[4]+&quot;) must match input depth in filter (&quot;+n[3]+&quot;.&quot;}),o.assert(l.shape[4]===n[4],function(){return&quot;Error in conv3dDerFilter: depth of dy (&quot;+l.shape[4]+&quot;) must match output depth for filter (&quot;+n[4]+&quot;).&quot;});var c=a.computeConv3DInfo(u.shape,n,i,1,s);return r.ENGINE.runKernel(function(t){return t.conv3dDerFilter(u,l,c)},{x5D:u,dy5D:l})}(i,t,u.shape,n,s)}}});return d?g.as4D(g.shape[1],g.shape[2],g.shape[3],g.shape[4]):g}}),n.conv2dDerFilter=s.op({conv2dDerFilter_:l}),n.depthwiseConv2d=s.op({depthwiseConv2d_:function(t,e,n,s,u,l,c){void 0===u&amp;&amp;(u=&quot;NHWC&quot;),void 0===l&amp;&amp;(l=[1,1]);var f=i.convertToTensor(t,&quot;x&quot;,&quot;depthwiseConv2d&quot;),p=i.convertToTensor(e,&quot;filter&quot;,&quot;depthwiseConv2d&quot;),h=f,d=!1;3===f.rank&amp;&amp;(d=!0,h=f.as4D(1,f.shape[0],f.shape[1],f.shape[2])),o.assert(4===h.rank,function(){return&quot;Error in depthwiseConv2d: input must be rank 4, but got rank &quot;+h.rank+&quot;.&quot;}),o.assert(4===p.rank,function(){return&quot;Error in depthwiseConv2d: filter must be rank 4, but got rank &quot;+p.rank+&quot;.&quot;}),o.assert(h.shape[3]===p.shape[2],function(){return&quot;Error in depthwiseConv2d: number of input channels (&quot;+h.shape[3]+&quot;) must match the inChannels dimension in filter &quot;+p.shape[2]+&quot;.&quot;}),null==l&amp;&amp;(l=[1,1]),o.assert(a.eitherStridesOrDilationsAreOne(n,l),function(){return&quot;Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides &quot;+n+&quot; and dilations &apos;&quot;+l+&quot;&apos;&quot;}),null!=c&amp;&amp;o.assert(o.isInt(s),function(){return&quot;Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode &quot;+c+&quot; but got pad &quot;+s+&quot;.&quot;});var m=a.computeConv2DInfo(h.shape,p.shape,n,l,s,c,!0),g=r.ENGINE.runKernel(function(t,e){var n=t.depthwiseConv2D(h,p,m);return e([h,p]),n},{x:h,$filter:p},function(t,e){o.assert(a.tupleValuesAreOne(l),function(){return&quot;Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations &apos;&quot;+l+&quot;&apos;&quot;});var n=e[0],i=e[1];return{x:function(){return function(t,e,n,i){var o=e,a=!1;3===e.rank&amp;&amp;(a=!0,o=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var s=r.ENGINE.runKernel(function(t){return t.depthwiseConv2DDerInput(o,n,i)},{dy4D:o});return a?s.as3D(s.shape[1],s.shape[2],s.shape[3]):s}(n.shape,t,i,m)},$filter:function(){return function(t,e,n,i){var o=t;3===t.rank&amp;&amp;(o=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var a=e;return 3===a.rank&amp;&amp;(a=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),r.ENGINE.runKernel(function(t){return t.depthwiseConv2DDerFilter(o,a,i)},{x4D:o,dy4D:a})}(n,t,i.shape,m)}}});return d?g.as3D(g.shape[1],g.shape[2],g.shape[3]):g}}),n.separableConv2d=s.op({separableConv2d_:function(t,e,r,a,s,u,l){void 0===u&amp;&amp;(u=[1,1]),void 0===l&amp;&amp;(l=&quot;NHWC&quot;);var c=i.convertToTensor(t,&quot;x&quot;,&quot;separableConv2d&quot;),f=i.convertToTensor(e,&quot;depthwiseFilter&quot;,&quot;separableConv2d&quot;),p=i.convertToTensor(r,&quot;pointwiseFilter&quot;,&quot;separableConv2d&quot;),h=c,d=!1;if(3===c.rank&amp;&amp;(d=!0,h=c.as4D(1,c.shape[0],c.shape[1],c.shape[2])),&quot;NCHW&quot;===l)throw new Error(&quot;separableConv2d currently does not support dataFormat NCHW; only NHWC is supported&quot;);o.assert(4===h.rank,function(){return&quot;Error in separableConv2d: input must be rank 4, but got rank &quot;+h.rank+&quot;.&quot;}),o.assert(4===f.rank,function(){return&quot;Error in separableConv2d: depthwise filter must be rank 4, but got rank &quot;+f.rank+&quot;.&quot;}),o.assert(4===p.rank,function(){return&quot;Error in separableConv2d: pointwise filter must be rank 4, but got rank &quot;+f.rank+&quot;.&quot;}),o.assert(1===p.shape[0],function(){return&quot;Error in separableConv2d: the first dimension of pointwise filter  must be 1, but got &quot;+p.shape[0]+&quot;.&quot;}),o.assert(1===p.shape[1],function(){return&quot;Error in separableConv2d: the second dimension of pointwise filter must be 1, but got &quot;+p.shape[1]+&quot;.&quot;});var m=f.shape[2],g=f.shape[3];o.assert(p.shape[2]===m*g,function(){return&quot;Error in separableConv2d: the third dimension of pointwise filter must be &quot;+m*g+&quot;, but got &quot;+p.shape[2]+&quot;.&quot;});var v=n.depthwiseConv2d(h,f,a,s,l,u),y=n.conv2d(v,p,1,&quot;valid&quot;,l);return d?y.as3D(y.shape[1],y.shape[2],y.shape[3]):y}}),n.conv2dTranspose=s.op({conv2dTranspose_:function(t,e,n,r,o,a){return u(n,i.convertToTensor(t,&quot;x&quot;,&quot;conv2dTranspose&quot;),i.convertToTensor(e,&quot;filter&quot;,&quot;conv2dTranspose&quot;),r,o,a)}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./conv_util&quot;:166,&quot;./operation&quot;:180}],166:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../util&quot;);function i(t,e,n,i,s,c,f,p){void 0===f&amp;&amp;(f=!1),void 0===p&amp;&amp;(p=&quot;channelsLast&quot;);var h=[-1,-1,-1,-1],d=h[0],m=h[1],g=h[2],v=h[3];if(&quot;channelsLast&quot;===p)d=t[0],m=t[1],g=t[2],v=t[3];else{if(&quot;channelsFirst&quot;!==p)throw new Error(&quot;Unknown dataFormat &quot;+p);d=t[0],v=t[1],m=t[2],g=t[3]}var y,b=e[0],_=e[1],w=e[3],x=a(n),E=x[0],k=x[1],T=a(i),N=T[0],S=T[1],C=u(b,N),A=u(_,S),I=function(t,e,n,i,a,s,u,c){var f,p,h;if(&quot;number&quot;==typeof t){var d=0===t?&quot;VALID&quot;:&quot;NUMBER&quot;;f={top:t,bottom:t,left:t,right:t,type:d};var m=function(t,e,n,i,a,s){null==a&amp;&amp;(a=o(t,e,i));var u=t[0],c=t[1],f=l((u-e+2*a)/i+1,s);r.assert(r.isInt(f),function(){return&quot;The output # of rows (&quot;+f+&quot;) must be an integer. Change the stride and/or zero pad parameters&quot;});var p=l((c-e+2*a)/i+1,s);return r.assert(r.isInt(p),function(){return&quot;The output # of columns (&quot;+p+&quot;) must be an integer. Change the stride and/or zero pad parameters&quot;}),[f,p,n]}([e,n,1],s,1,i,t,c);p=m[0],h=m[1]}else if(&quot;same&quot;===t){p=Math.ceil(e/i),h=Math.ceil(n/a);var g=Math.max(0,(p-1)*i+s-e),v=Math.max(0,(h-1)*a+u-n),y=Math.floor(g/2),b=g-y,_=Math.floor(v/2),w=v-_;f={top:y,bottom:b,left:_,right:w,type:&quot;SAME&quot;}}else{if(&quot;valid&quot;!==t)throw Error(&quot;Unknown padding parameter: &quot;+t);f={top:0,bottom:0,left:0,right:0,type:&quot;VALID&quot;},p=Math.ceil((e-s+1)/i),h=Math.ceil((n-u+1)/a)}return{padInfo:f,outHeight:p,outWidth:h}}(s,m,g,E,k,C,A,c),O=I.padInfo,M=I.outHeight,R=I.outWidth,P=f?w*v:w;return&quot;channelsFirst&quot;===p?y=[d,P,M,R]:&quot;channelsLast&quot;===p&amp;&amp;(y=[d,M,R,P]),{batchSize:d,dataFormat:p,inHeight:m,inWidth:g,inChannels:v,outHeight:M,outWidth:R,outChannels:P,padInfo:O,strideHeight:E,strideWidth:k,filterHeight:b,filterWidth:_,effectiveFilterHeight:C,effectiveFilterWidth:A,dilationHeight:N,dilationWidth:S,inShape:t,outShape:y,filterShape:e}}function o(t,e,n,r){void 0===r&amp;&amp;(r=1);var i=u(e,r);return Math.floor((t[0]*(n-1)-n+i)/2)}function a(t){return&quot;number&quot;==typeof t?[t,t]:t}function s(t){return&quot;number&quot;==typeof t?[t,t,t]:t}function u(t,e){return e&lt;=1?t:t+(t-1)*(e-1)}function l(t,e){if(!e)return t;switch(e){case&quot;round&quot;:return Math.round(t);case&quot;ceil&quot;:return Math.ceil(t);case&quot;floor&quot;:return Math.floor(t);default:throw new Error(&quot;Unknown roundingMode &quot;+e)}}function c(t){var e=a(t),n=e[0],r=e[1];return 1===n&amp;&amp;1===r}n.computePool2DInfo=function(t,e,n,r,o,s,u){void 0===u&amp;&amp;(u=&quot;channelsLast&quot;);var l,c=a(e),f=c[0],p=c[1];if(&quot;channelsLast&quot;===u)l=[f,p,t[3],t[3]];else{if(&quot;channelsFirst&quot;!==u)throw new Error(&quot;Unknown dataFormat &quot;+u);l=[f,p,t[1],t[1]]}return i(t,l,n,r,o,s,!1,u)},n.computeConv2DInfo=i,n.computeConv3DInfo=function(t,e,n,r,i,o,a){void 0===o&amp;&amp;(o=!1),void 0===a&amp;&amp;(a=&quot;channelsLast&quot;);var l=[-1,-1,-1,-1,-1],c=l[0],f=l[1],p=l[2],h=l[3],d=l[4];if(&quot;channelsLast&quot;===a)c=t[0],f=t[1],p=t[2],h=t[3],d=t[4];else{if(&quot;channelsFirst&quot;!==a)throw new Error(&quot;Unknown dataFormat &quot;+a);c=t[0],d=t[1],f=t[2],p=t[3],h=t[4]}var m,g=e[0],v=e[1],y=e[2],b=e[4],_=s(n),w=_[0],x=_[1],E=_[2],k=s(r),T=k[0],N=k[1],S=k[2],C=function(t,e,n,r,i,o,a,s,u,l){var c,f,p,h;if(&quot;same&quot;===t){f=Math.ceil(e/i),p=Math.ceil(n/o),h=Math.ceil(r/a);var d=(f-1)*i+s-e,m=(p-1)*o+u-n,g=(h-1)*a+l-r,v=Math.floor(d/2),y=d-v,b=Math.floor(m/2),_=m-b,w=Math.floor(g/2),x=g-w;c={top:b,bottom:_,left:w,right:x,front:v,back:y,type:&quot;SAME&quot;}}else{if(&quot;valid&quot;!==t)throw Error(&quot;Unknown padding parameter: &quot;+t);c={top:0,bottom:0,left:0,right:0,front:0,back:0,type:&quot;VALID&quot;},f=Math.ceil((e-s+1)/i),p=Math.ceil((n-u+1)/o),h=Math.ceil((r-l+1)/a)}return{padInfo:c,outDepth:f,outHeight:p,outWidth:h}}(i,f,p,h,w,x,E,u(g,T),u(v,N),u(y,S)),A=C.padInfo,I=C.outDepth,O=C.outHeight,M=C.outWidth,R=o?b*d:b;return&quot;channelsFirst&quot;===a?m=[c,R,I,O,M]:&quot;channelsLast&quot;===a&amp;&amp;(m=[c,I,O,M,R]),{batchSize:c,dataFormat:a,inDepth:f,inHeight:p,inWidth:h,inChannels:d,outDepth:I,outHeight:O,outWidth:M,outChannels:R,padInfo:A,strideDepth:w,strideHeight:x,strideWidth:E,filterDepth:g,filterHeight:v,filterWidth:y,dilationDepth:T,dilationHeight:N,dilationWidth:S,inShape:t,outShape:m,filterShape:e}},n.computeDefaultPad=o,n.tupleValuesAreOne=c,n.eitherStridesOrDilationsAreOne=function(t,e){return c(t)||c(e)}},{&quot;../util&quot;:223}],167:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.ERF_P=.3275911,n.ERF_A1=.254829592,n.ERF_A2=-.284496736,n.ERF_A3=1.421413741,n.ERF_A4=-1.453152027,n.ERF_A5=1.061405429},{}],168:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../ops/operation&quot;),o=t(&quot;../tensor_util&quot;),a=t(&quot;../tensor_util_env&quot;),s=t(&quot;../util&quot;),u=t(&quot;./broadcast_util&quot;);n.matMul=i.op({matMul_:function(t,e,n,i,l,c){var f;void 0===n&amp;&amp;(n=!1),void 0===i&amp;&amp;(i=!1),void 0===c&amp;&amp;(c=&quot;linear&quot;);var p=a.convertToTensor(t,&quot;a&quot;,&quot;fused matMul&quot;),h=a.convertToTensor(e,&quot;b&quot;,&quot;fused matMul&quot;);f=o.makeTypesMatch(p,h),p=f[0],h=f[1];var d=n?p.shape[p.rank-2]:p.shape[p.rank-1],m=i?h.shape[h.rank-1]:h.shape[h.rank-2],g=n?p.shape[p.rank-1]:p.shape[p.rank-2],v=i?h.shape[h.rank-2]:h.shape[h.rank-1],y=p.shape.slice(0,-2),b=h.shape.slice(0,-2),_=s.sizeFromShape(y),w=s.sizeFromShape(b);s.assert(p.rank&gt;=2&amp;&amp;h.rank&gt;=2&amp;&amp;p.rank===h.rank,function(){return&quot;Error in fused matMul: inputs must have the same rank of at least 2, got ranks &quot;+p.rank+&quot; and &quot;+h.rank+&quot;.&quot;}),s.assert(s.arraysEqual(y,b),function(){return&quot;Error in fused matMul: outer dimensions (&quot;+y+&quot;) and (&quot;+b+&quot;) of Tensors with shapes &quot;+p.shape+&quot; and &quot;+h.shape+&quot; must match.&quot;}),s.assert(d===m,function(){return&quot;Error in fused matMul: inner shapes (&quot;+d+&quot;) and (&quot;+m+&quot;) of Tensors with shapes &quot;+p.shape+&quot; and &quot;+h.shape+&quot; and transposeA=&quot;+n+&quot; and transposeB=&quot;+i+&quot; must match.&quot;});var x,E=p.shape.slice(0,-2).concat([g,v]),k=n?p.as3D(_,d,g):p.as3D(_,g,d),T=i?h.as3D(w,v,m):h.as3D(w,m,v);null!=l&amp;&amp;(x=a.convertToTensor(l,&quot;bias&quot;,&quot;fused matMul&quot;),x=o.makeTypesMatch(x,p)[0],u.assertAndGetBroadcastShape(E,x.shape));var N={$a:k,$b:T};return null!=l&amp;&amp;(N.$bias=x),r.ENGINE.runKernel(function(t,e){var r=t.fusedBatchMatMul(k,T,n,i,x,c);return e([k,T,r]),r},N,function(t,e){var r,o=e[0],a=e[1],s=e[2];if(null==c||&quot;linear&quot;===c)r=t;else{if(&quot;relu&quot;!==c)throw new Error(&quot;Gradient for activation &quot;+c+&quot; has not been implemented yet.&quot;);r=t.mul(s.step())}var f={};return null!=l&amp;&amp;(f={$bias:function(){var t=r,e=u.getReductionAxes(x.shape,r.shape);return e.length&gt;0&amp;&amp;(t=t.sum(e)),t.reshape(x.shape)}}),n||i?!n&amp;&amp;i?Object.assign({$a:function(){return r.matMul(a,!1,!1)},$b:function(){return r.matMul(o,!0,!1)}},f):n&amp;&amp;!i?Object.assign({$a:function(){return a.matMul(r,!1,!0)},$b:function(){return o.matMul(r,!1,!1)}},f):Object.assign({$a:function(){return a.matMul(r,!0,!0)},$b:function(){return r.matMul(o,!0,!0)}},f):Object.assign({$a:function(){return r.matMul(a,!1,!0)},$b:function(){return o.matMul(r,!0,!1)}},f)}).reshape(E)}})},{&quot;../engine&quot;:133,&quot;../ops/operation&quot;:180,&quot;../tensor_util&quot;:218,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./broadcast_util&quot;:158}],169:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;./operation&quot;);n.gatherND=o.op({gatherND_:function(t,e){var n=i.convertToTensor(e,&quot;indices&quot;,&quot;gatherND&quot;,&quot;int32&quot;),o=i.convertToTensor(t,&quot;x&quot;,&quot;gatherND&quot;);return r.ENGINE.runKernel(function(t){return t.gatherND(o,n)},{$x:o,$indices:n})}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;./operation&quot;:180}],170:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../util&quot;);n.prepareAndValidate=function(t,e){if(t.rank&lt;1)throw new Error(&quot;tf.gatherND() expects the input to be rank 1 or higher, but the rank was &quot;+t.rank+&quot;.&quot;);if(e.rank&lt;1)throw new Error(&quot;tf.gatherND() expects the indices to be rank 1 or higher, but the rank was &quot;+e.rank+&quot;.&quot;);if(&quot;int32&quot;!==e.dtype)throw new Error(&quot;tf.gatherND() expects the indices to be int32 type, but the dtype was &quot;+e.dtype+&quot;.&quot;);if(e.shape[e.rank-1]&gt;t.rank)throw new Error(&quot;index innermost dimension length must be &lt;= tensor rank; saw: &quot;+e.shape[e.rank-1]+&quot; vs. &quot;+t.rank);if(0===t.size)throw new Error(&quot;Requested more than 0 entries, but input is empty. Input shape: &quot;+t.shape+&quot;.&quot;);for(var n=e.shape,i=n[n.length-1],o=1,a=0;a&lt;n.length-1;++a)o*=n[a];var s=t.shape,u=n.slice();u.pop();var l=1;for(a=i;a&lt;t.rank;++a)l*=s[a],u.push(s[a]);var c=r.computeStrides(t.shape).map(function(t){return t/l}).concat([1]).slice(0,i);return[u,o,l,c]}},{&quot;../util&quot;:223}],171:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../backends/non_max_suppression_impl&quot;),a=t(&quot;../engine&quot;),s=t(&quot;../tensor_util_env&quot;),u=t(&quot;../util&quot;),l=t(&quot;./operation&quot;);function c(t,e,n,r,i){null==r&amp;&amp;(r=.5),null==i&amp;&amp;(i=Number.NEGATIVE_INFINITY);var o=t.shape[0];return n=Math.min(n,o),u.assert(0&lt;=r&amp;&amp;r&lt;=1,function(){return&quot;iouThreshold must be in [0, 1], but was &apos;&quot;+r+&quot;&apos;&quot;}),u.assert(2===t.rank,function(){return&quot;boxes must be a 2D tensor, but was of rank &apos;&quot;+t.rank+&quot;&apos;&quot;}),u.assert(4===t.shape[1],function(){return&quot;boxes must have 4 columns, but 2nd dimension was &quot;+t.shape[1]}),u.assert(1===e.rank,function(){return&quot;scores must be a 1D tensor&quot;}),u.assert(e.shape[0]===o,function(){return&quot;scores has incompatible shape with boxes. Expected &quot;+o+&quot;, but was &quot;+e.shape[0]}),{maxOutputSize:n,iouThreshold:r,scoreThreshold:i}}n.resizeBilinear=l.op({resizeBilinear_:function(t,e,n){void 0===n&amp;&amp;(n=!1);var r=s.convertToTensor(t,&quot;images&quot;,&quot;resizeBilinear&quot;);u.assert(3===r.rank||4===r.rank,function(){return&quot;Error in resizeBilinear: x must be rank 3 or 4, but got rank &quot;+r.rank+&quot;.&quot;}),u.assert(2===e.length,function(){return&quot;Error in resizeBilinear: new shape must 2D, but got shape &quot;+e+&quot;.&quot;});var i=r,o=!1;3===r.rank&amp;&amp;(o=!0,i=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var l=e[0],c=e[1],f=a.ENGINE.runKernel(function(t,e){return e([i]),t.resizeBilinear(i,l,c,n)},{batchImages:i},function(t,e){return{batchImages:function(){return a.ENGINE.runKernel(function(r){return r.resizeBilinearBackprop(t,e[0],n)},{})}}});return o?f.as3D(f.shape[1],f.shape[2],f.shape[3]):f}}),n.resizeNearestNeighbor=l.op({resizeNearestNeighbor_:function(t,e,n){void 0===n&amp;&amp;(n=!1);var r=s.convertToTensor(t,&quot;images&quot;,&quot;resizeNearestNeighbor&quot;);u.assert(3===r.rank||4===r.rank,function(){return&quot;Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank &quot;+r.rank+&quot;.&quot;}),u.assert(2===e.length,function(){return&quot;Error in resizeNearestNeighbor: new shape must 2D, but got shape &quot;+e+&quot;.&quot;}),u.assert(&quot;float32&quot;===r.dtype||&quot;int32&quot;===r.dtype,function(){return&quot;`images` must have `int32` or `float32` as dtype&quot;});var i=r,o=!1;3===r.rank&amp;&amp;(o=!0,i=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var l=e[0],c=e[1],f=a.ENGINE.runKernel(function(t,e){return e([i]),t.resizeNearestNeighbor(i,l,c,n)},{batchImages:i},function(t,e){return{batchImages:function(){return a.ENGINE.runKernel(function(r){return r.resizeNearestNeighborBackprop(t,e[0],n)},{})}}});return o?f.as3D(f.shape[1],f.shape[2],f.shape[3]):f}}),n.nonMaxSuppression=l.op({nonMaxSuppression_:function(t,e,n,r,i){void 0===r&amp;&amp;(r=.5),void 0===i&amp;&amp;(i=Number.NEGATIVE_INFINITY);var o=s.convertToTensor(t,&quot;boxes&quot;,&quot;nonMaxSuppression&quot;),u=s.convertToTensor(e,&quot;scores&quot;,&quot;nonMaxSuppression&quot;),l=c(o,u,n,r,i);return n=l.maxOutputSize,r=l.iouThreshold,i=l.scoreThreshold,a.ENGINE.runKernel(function(t){return t.nonMaxSuppression(o,u,n,r,i)},{$boxes:o})}}),n.nonMaxSuppressionAsync=function(t,e,n,a,u){return void 0===a&amp;&amp;(a=.5),void 0===u&amp;&amp;(u=Number.NEGATIVE_INFINITY),r(this,void 0,void 0,function(){var r,l,f,p,h,d;return i(this,function(i){switch(i.label){case 0:return r=s.convertToTensor(t,&quot;boxes&quot;,&quot;nonMaxSuppressionAsync&quot;),l=s.convertToTensor(e,&quot;scores&quot;,&quot;nonMaxSuppressionAsync&quot;),f=c(r,l,n,a,u),n=f.maxOutputSize,a=f.iouThreshold,u=f.scoreThreshold,[4,r.data()];case 1:return p=i.sent(),[4,l.data()];case 2:return h=i.sent(),d=o.nonMaxSuppressionImpl(p,h,n,a,u),r!==t&amp;&amp;r.dispose(),l!==e&amp;&amp;l.dispose(),[2,d]}})})},n.cropAndResize=l.op({cropAndResize_:function(t,e,n,r,i,o){var l=s.convertToTensor(t,&quot;image&quot;,&quot;cropAndResize&quot;,&quot;float32&quot;),c=s.convertToTensor(e,&quot;boxes&quot;,&quot;cropAndResize&quot;,&quot;float32&quot;),f=s.convertToTensor(n,&quot;boxInd&quot;,&quot;cropAndResize&quot;,&quot;int32&quot;);i=i||&quot;bilinear&quot;,o=o||0;var p=c.shape[0];return u.assert(4===l.rank,function(){return&quot;Error in cropAndResize: image must be rank 4,but got rank &quot;+l.rank+&quot;.&quot;}),u.assert(2===c.rank&amp;&amp;4===c.shape[1],function(){return&quot;Error in cropAndResize: boxes must be have size [&quot;+p+&quot;,4] but had shape &quot;+c.shape+&quot;.&quot;}),u.assert(1===f.rank&amp;&amp;f.shape[0]===p,function(){return&quot;Error in cropAndResize: boxInd must be have size [&quot;+p+&quot;] but had shape &quot;+c.shape+&quot;.&quot;}),u.assert(2===r.length,function(){return&quot;Error in cropAndResize: cropSize must be of length 2, but got length &quot;+r.length+&quot;.&quot;}),u.assert(r[0]&gt;=1&amp;&amp;r[1]&gt;=1,function(){return&quot;cropSize must be atleast [1,1], but was &quot;+r}),u.assert(&quot;bilinear&quot;===i||&quot;nearest&quot;===i,function(){return&quot;method must be bilinear or nearest, but was &quot;+i}),a.ENGINE.runKernel(function(t,e){return t.cropAndResize(l,c,f,r,i,o)},{$image:l,$boxes:c})}})},{&quot;../backends/non_max_suppression_impl&quot;:53,&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./operation&quot;:180}],172:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../globals&quot;),o=t(&quot;../util&quot;),a=t(&quot;./array_ops&quot;),s=t(&quot;./concat_split&quot;),u=t(&quot;./norm&quot;),l=t(&quot;./operation&quot;),c=t(&quot;./reduction_ops&quot;),f=t(&quot;./tensor_ops&quot;);function p(t,e){return void 0===e&amp;&amp;(e=!1),r.ENGINE.tidy(function(){if(2!==t.shape.length)throw new Error(&quot;qr2d() requires a 2D Tensor, but got a &quot;+t.shape.length+&quot;D Tensor.&quot;);for(var n=t.shape[0],o=t.shape[1],s=a.eye(n),u=t.clone(),l=f.tensor2d([[1]],[1,1]),c=l.clone(),p=n&gt;=o?o:n,h=function(t){var e,a=u,f=c,p=s;e=r.ENGINE.tidy(function(){var e=u.slice([t,t],[n-t,1]),r=e.norm(),i=u.slice([t,t],[1,1]),a=i.sign().neg(),f=i.sub(a.mul(r)),p=e.div(f);c=1===p.shape[0]?l.clone():l.concat(p.slice([1,0],[p.shape[0]-1,p.shape[1]]),0);var h=a.matMul(f).div(r).neg(),d=u.slice([t,0],[n-t,o]),m=h.mul(c);u=0===t?d.sub(m.matMul(c.transpose().matMul(d))):u.slice([0,0],[t,o]).concat(d.sub(m.matMul(c.transpose().matMul(d))),0);var g=s.slice([0,t],[n,s.shape[1]-t]);return s=0===t?g.sub(g.matMul(c).matMul(m.transpose())):s.slice([0,0],[n,t]).concat(g.sub(g.matMul(c).matMul(m.transpose())),1),[c,u,s]}),c=e[0],u=e[1],s=e[2],i.dispose([a,f,p])},d=0;d&lt;p;++d)h(d);return!e&amp;&amp;n&gt;o&amp;&amp;(s=s.slice([0,0],[n,o]),u=u.slice([0,0],[o,o])),[s,u]})}n.gramSchmidt=l.op({gramSchmidt_:function(t){var e;if(Array.isArray(t)){e=!1,o.assert(null!=t&amp;&amp;t.length&gt;0,function(){return&quot;Gram-Schmidt process: input must not be null, undefined, or empty&quot;});for(var n=t[0].shape[0],i=function(e){o.assert(t[e].shape[0]===n,function(){return&quot;Gram-Schmidt: Non-unique lengths found in the input vectors: (&quot;+t[e].shape[0]+&quot; vs. &quot;+n+&quot;)&quot;})},l=1;l&lt;t.length;++l)i(l)}else e=!0,t=s.split(t,t.shape[0],0).map(function(t){return a.squeeze(t,[0])});o.assert(t.length&lt;=t[0].shape[0],function(){return&quot;Gram-Schmidt: Number of vectors (&quot;+t.length+&quot;) exceeds number of dimensions (&quot;+t[0].shape[0]+&quot;).&quot;});var f=[],p=t,h=function(t){f.push(r.ENGINE.tidy(function(){var e=p[t];if(t&gt;0)for(var n=0;n&lt;t;++n){var r=c.sum(f[n].mulStrict(e)).mul(f[n]);e=e.sub(r)}return e.div(u.norm(e,&quot;euclidean&quot;))}))};for(l=0;l&lt;t.length;++l)h(l);return e?a.stack(f,0):f}}),n.qr=l.op({qr_:function(t,e){if(void 0===e&amp;&amp;(e=!1),t.rank&lt;2)throw new Error(&quot;qr() requires input tensor to have a rank &gt;= 2, but got rank &quot;+t.rank);if(2===t.rank)return p(t,e);var n=t.shape.slice(0,t.shape.length-2).reduce(function(t,e){return t*e}),r=[],i=[];return a.unstack(t.reshape([n,t.shape[t.shape.length-2],t.shape[t.shape.length-1]]),0).forEach(function(t){var n=p(t,e),o=n[0],a=n[1];r.push(o),i.push(a)}),[a.stack(r,0).reshape(t.shape),a.stack(i,0).reshape(t.shape)]}})},{&quot;../engine&quot;:133,&quot;../globals&quot;:136,&quot;../util&quot;:223,&quot;./array_ops&quot;:153,&quot;./concat_split&quot;:162,&quot;./norm&quot;:179,&quot;./operation&quot;:180,&quot;./reduction_ops&quot;:185,&quot;./tensor_ops&quot;:200}],173:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../backends/where_impl&quot;),a=t(&quot;../engine&quot;),s=t(&quot;../tensor_util_env&quot;),u=t(&quot;../util&quot;),l=t(&quot;./broadcast_util&quot;),c=t(&quot;./operation&quot;),f=t(&quot;./tensor_ops&quot;);n.logicalAnd=c.op({logicalAnd_:function(t,e){var n=s.convertToTensor(t,&quot;a&quot;,&quot;logicalAnd&quot;,&quot;bool&quot;),r=s.convertToTensor(e,&quot;b&quot;,&quot;logicalAnd&quot;,&quot;bool&quot;);return l.assertAndGetBroadcastShape(n.shape,r.shape),a.ENGINE.runKernel(function(t){return t.logicalAnd(n,r)},{$a:n,$b:r})}}),n.logicalNot=c.op({logicalNot_:function(t){var e=s.convertToTensor(t,&quot;x&quot;,&quot;logicalNot&quot;,&quot;bool&quot;);return a.ENGINE.runKernel(function(t){return t.logicalNot(e)},{$x:e})}}),n.logicalOr=c.op({logicalOr_:function(t,e){var n=s.convertToTensor(t,&quot;a&quot;,&quot;logicalOr&quot;,&quot;bool&quot;),r=s.convertToTensor(e,&quot;b&quot;,&quot;logicalOr&quot;,&quot;bool&quot;);return l.assertAndGetBroadcastShape(n.shape,r.shape),a.ENGINE.runKernel(function(t){return t.logicalOr(n,r)},{$a:n,$b:r})}}),n.logicalXor=c.op({logicalXor_:function(t,e){var r=s.convertToTensor(t,&quot;a&quot;,&quot;logicalXor&quot;,&quot;bool&quot;),i=s.convertToTensor(e,&quot;b&quot;,&quot;logicalXor&quot;,&quot;bool&quot;);return l.assertAndGetBroadcastShape(r.shape,i.shape),n.logicalOr(t,e).logicalAnd(n.logicalAnd(t,e).logicalNot())}}),n.where=c.op({where_:function(t,e,n){var r=s.convertToTensor(e,&quot;a&quot;,&quot;where&quot;),i=s.convertToTensor(n,&quot;b&quot;,&quot;where&quot;),o=s.convertToTensor(t,&quot;condition&quot;,&quot;where&quot;,&quot;bool&quot;);return u.assertShapesMatch(r.shape,i.shape,&quot;Error in where: &quot;),1===o.rank?u.assert(o.shape[0]===r.shape[0],function(){return&quot;The first dimension of `a` must match the size of `condition`.&quot;}):u.assertShapesMatch(o.shape,i.shape,&quot;Error in where: &quot;),a.ENGINE.runKernel(function(t,e){var n=t.select(o,r,i);return e([o]),n},{$condition:o,$a:r,$b:i},function(t,e){var n=e[0];return{$condition:function(){return f.zerosLike(n).toFloat()},$a:function(){return t.mul(n.cast(t.dtype))},$b:function(){return t.mul(n.logicalNot().cast(t.dtype))}}})}}),n.whereAsync=function(t){return r(this,void 0,void 0,function(){var e,n,r;return i(this,function(i){switch(i.label){case 0:return[4,(e=s.convertToTensor(t,&quot;condition&quot;,&quot;whereAsync&quot;,&quot;bool&quot;)).data()];case 1:return n=i.sent(),r=o.whereImpl(e.shape,n),t!==e&amp;&amp;e.dispose(),[2,r]}})})}},{&quot;../backends/where_impl&quot;:130,&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./broadcast_util&quot;:158,&quot;./operation&quot;:180,&quot;./tensor_ops&quot;:200}],174:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r,i=t(&quot;../gradients&quot;),o=t(&quot;../tensor_util_env&quot;),a=t(&quot;../util&quot;),s=t(&quot;./axis_util&quot;),u=t(&quot;./binary_ops&quot;),l=t(&quot;./operation&quot;),c=t(&quot;./tensor_ops&quot;);!function(t){t[t.NONE=0]=&quot;NONE&quot;,t[t.MEAN=1]=&quot;MEAN&quot;,t[t.SUM=2]=&quot;SUM&quot;,t[t.SUM_BY_NONZERO_WEIGHTS=3]=&quot;SUM_BY_NONZERO_WEIGHTS&quot;}(r=n.Reduction||(n.Reduction={})),n.absoluteDifference=l.op({absoluteDifference_:function(t,e,i,s){void 0===s&amp;&amp;(s=r.SUM_BY_NONZERO_WEIGHTS);var u=o.convertToTensor(t,&quot;labels&quot;,&quot;absoluteDifference&quot;),l=o.convertToTensor(e,&quot;predictions&quot;,&quot;absoluteDifference&quot;),c=null;null!=i&amp;&amp;(c=o.convertToTensor(i,&quot;weights&quot;,&quot;absoluteDifference&quot;)),a.assertShapesMatch(u.shape,l.shape,&quot;Error in absoluteDifference: &quot;);var f=u.sub(l).abs();return n.computeWeightedLoss(f,c,s)}}),n.computeWeightedLoss=l.op({computeWeightedLoss_:function(t,e,n){void 0===n&amp;&amp;(n=r.SUM_BY_NONZERO_WEIGHTS);var i=o.convertToTensor(t,&quot;losses&quot;,&quot;computeWeightedLoss&quot;),a=null;null!=e&amp;&amp;(a=o.convertToTensor(e,&quot;weights&quot;,&quot;computeWeightedLoss&quot;));var s=null==a?i:i.mul(a);if(n===r.NONE)return s;if(n===r.SUM)return s.sum();if(n===r.MEAN){if(null==a)return s.mean();var u=i.size/a.size,l=s.sum().div(a.sum());return u&gt;1?l.div(c.scalar(u)):l}if(n===r.SUM_BY_NONZERO_WEIGHTS){if(null==a)return s.sum().div(c.scalar(i.size));var f=a.mul(c.ones(i.shape)).notEqual(c.scalar(0)).sum().toFloat();return s.sum().div(f)}throw Error(&quot;Unknown reduction: &quot;+n)}}),n.cosineDistance=l.op({cosineDistance_:function(t,e,i,s,u){void 0===u&amp;&amp;(u=r.SUM_BY_NONZERO_WEIGHTS);var l=o.convertToTensor(t,&quot;labels&quot;,&quot;cosineDistance&quot;),f=o.convertToTensor(e,&quot;predictions&quot;,&quot;cosineDistance&quot;),p=null;null!=s&amp;&amp;(p=o.convertToTensor(s,&quot;weights&quot;,&quot;cosineDistance&quot;)),a.assertShapesMatch(l.shape,f.shape,&quot;Error in cosineDistance: &quot;);var h=c.scalar(1).sub(l.mul(f).sum(i,!0));return n.computeWeightedLoss(h,p,u)}}),n.hingeLoss=l.op({hingeLoss_:function(t,e,i,s){void 0===s&amp;&amp;(s=r.SUM_BY_NONZERO_WEIGHTS);var u=o.convertToTensor(t,&quot;labels&quot;,&quot;hingeLoss&quot;),l=o.convertToTensor(e,&quot;predictions&quot;,&quot;hingeLoss&quot;),f=null;null!=i&amp;&amp;(f=o.convertToTensor(i,&quot;weights&quot;,&quot;hingeLoss&quot;)),a.assertShapesMatch(u.shape,l.shape,&quot;Error in hingeLoss: &quot;);var p=c.scalar(1);u=c.scalar(2).mul(u).sub(p);var h=p.sub(u.mul(l)).relu();return n.computeWeightedLoss(h,f,s)}}),n.huberLoss=l.op({huberLoss_:function(t,e,i,s,l){void 0===s&amp;&amp;(s=1),void 0===l&amp;&amp;(l=r.SUM_BY_NONZERO_WEIGHTS);var f=o.convertToTensor(t,&quot;labels&quot;,&quot;huberLoss&quot;),p=o.convertToTensor(e,&quot;predictions&quot;,&quot;huberLoss&quot;),h=null;null!=i&amp;&amp;(h=o.convertToTensor(i,&quot;weights&quot;,&quot;huberLoss&quot;)),a.assertShapesMatch(f.shape,p.shape,&quot;Error in huberLoss: &quot;);var d=c.scalar(s),m=p.sub(f).abs(),g=u.minimum(m,d),v=m.sub(g),y=c.scalar(.5).mul(g.square()).add(d.mul(v));return n.computeWeightedLoss(y,h,l)}}),n.logLoss=l.op({logLoss_:function(t,e,i,s,u){void 0===s&amp;&amp;(s=1e-7),void 0===u&amp;&amp;(u=r.SUM_BY_NONZERO_WEIGHTS);var l=o.convertToTensor(t,&quot;labels&quot;,&quot;logLoss&quot;),f=o.convertToTensor(e,&quot;predictions&quot;,&quot;logLoss&quot;),p=null;null!=i&amp;&amp;(p=o.convertToTensor(i,&quot;weights&quot;,&quot;logLoss&quot;)),a.assertShapesMatch(l.shape,f.shape,&quot;Error in logLoss: &quot;);var h=c.scalar(1),d=c.scalar(s),m=l.mul(f.add(d).log()).neg().sub(h.sub(l).mul(h.sub(f).add(d).log()));return n.computeWeightedLoss(m,p,u)}}),n.meanSquaredError=l.op({meanSquaredError_:function(t,e,i,s){void 0===s&amp;&amp;(s=r.SUM_BY_NONZERO_WEIGHTS);var u=o.convertToTensor(t,&quot;labels&quot;,&quot;meanSquaredError&quot;),l=o.convertToTensor(e,&quot;predictions&quot;,&quot;meanSquaredError&quot;),c=null;null!=i&amp;&amp;(c=o.convertToTensor(i,&quot;weights&quot;,&quot;meanSquaredError&quot;)),a.assertShapesMatch(u.shape,l.shape,&quot;Error in meanSquaredError: &quot;);var f=u.squaredDifference(l);return n.computeWeightedLoss(f,c,s)}}),n.sigmoidCrossEntropy=l.op({sigmoidCrossEntropy_:function(t,e,i,s,u){void 0===s&amp;&amp;(s=0),void 0===u&amp;&amp;(u=r.SUM_BY_NONZERO_WEIGHTS);var l=o.convertToTensor(t,&quot;multiClassLabels&quot;,&quot;sigmoidCrossEntropy&quot;),f=o.convertToTensor(e,&quot;logits&quot;,&quot;sigmoidCrossEntropy&quot;),p=null;if(null!=i&amp;&amp;(p=o.convertToTensor(i,&quot;weights&quot;,&quot;sigmoidCrossEntropy&quot;)),a.assertShapesMatch(l.shape,f.shape,&quot;Error in sigmoidCrossEntropy: &quot;),s&gt;0){var h=c.scalar(s),d=c.scalar(1),m=c.scalar(.5);l=l.mul(d.sub(h)).add(m.mul(h))}var g=function(t,e){var n=o.convertToTensor(t,&quot;labels&quot;,&quot;sigmoidCrossEntropyWithLogits&quot;),r=o.convertToTensor(e,&quot;logits&quot;,&quot;sigmoidCrossEntropyWithLogits&quot;);a.assertShapesMatch(n.shape,r.shape,&quot;Error in sigmoidCrossEntropyWithLogits: &quot;);var i=r.relu(),s=r.mul(n),u=r.abs().neg().exp().log1p();return i.sub(s).add(u)}(l,f);return n.computeWeightedLoss(g,p,u)}}),n.softmaxCrossEntropy=l.op({softmaxCrossEntropy_:function(t,e,u,l,f){void 0===l&amp;&amp;(l=0),void 0===f&amp;&amp;(f=r.SUM_BY_NONZERO_WEIGHTS);var p=o.convertToTensor(t,&quot;onehotLabels&quot;,&quot;softmaxCrossEntropy&quot;),h=o.convertToTensor(e,&quot;logits&quot;,&quot;softmaxCrossEntropy&quot;),d=null;if(null!=u&amp;&amp;(d=o.convertToTensor(u,&quot;weights&quot;,&quot;softmaxCrossEntropy&quot;)),a.assertShapesMatch(p.shape,h.shape,&quot;Error in softmaxCrossEntropy: &quot;),l&gt;0){var m=c.scalar(l),g=c.scalar(1),v=c.scalar(p.shape[1]);p=p.mul(g.sub(m)).add(m.div(v))}var y=function(t,e,n){if(void 0===n&amp;&amp;(n=-1),-1===n&amp;&amp;(n=e.rank-1),n!==e.rank-1)throw Error(&quot;Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank &quot;+e.rank+&quot; and dim was &quot;+n);return i.customGrad(function(t,e,r){var i=e.logSumExp([n],!0),o=e.toFloat().sub(i);return r([t,o]),{value:o.mul(t).neg().sum([n]),gradFunc:function(t,e){var r=e[0],i=e[1],o=s.expandShapeToKeepDim(t.shape,[n]);return[t.reshape(o).mul(r.toFloat().sub(i.exp())),t.reshape(o).mul(i.exp().sub(r.toFloat()))]}}})(t,e)}(p,h);return n.computeWeightedLoss(y,d,f)}})},{&quot;../gradients&quot;:137,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./axis_util&quot;:155,&quot;./binary_ops&quot;:157,&quot;./operation&quot;:180,&quot;./tensor_ops&quot;:200}],175:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;./operation&quot;);n.localResponseNormalization=a.op({localResponseNormalization_:function(t,e,n,a,s){void 0===e&amp;&amp;(e=5),void 0===n&amp;&amp;(n=1),void 0===a&amp;&amp;(a=1),void 0===s&amp;&amp;(s=.5);var u=i.convertToTensor(t,&quot;x&quot;,&quot;localResponseNormalization&quot;);o.assert(4===u.rank||3===u.rank,function(){return&quot;Error in localResponseNormalization: x must be rank 3 or 4 but got\n               rank &quot;+u.rank+&quot;.&quot;}),o.assert(o.isInt(e),function(){return&quot;Error in localResponseNormalization: depthRadius must be an integer but got depthRadius &quot;+e+&quot;.&quot;});var l=u,c=!1;3===u.rank&amp;&amp;(c=!0,l=u.as4D(1,u.shape[0],u.shape[1],u.shape[2]));var f=r.ENGINE.runKernel(function(t,r){var i=t.localResponseNormalization4D(l,e,n,a,s);return r([l,i]),i},{x4D:l},function(t,i){var o=i[0],u=i[1];return{x4D:function(){return r.ENGINE.runKernel(function(r){return r.LRNGrad(t,o,u,e,n,a,s)},{})}}});return c?f.as3D(f.shape[1],f.shape[2],f.shape[3]):f}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./operation&quot;:180}],176:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../tensor_util_env&quot;),i=t(&quot;./operation&quot;);n.basicLSTMCell=i.op({basicLSTMCell_:function(t,e,n,i,o,a){var s=r.convertToTensor(t,&quot;forgetBias&quot;,&quot;basicLSTMCell&quot;),u=r.convertToTensor(e,&quot;lstmKernel&quot;,&quot;basicLSTMCell&quot;),l=r.convertToTensor(n,&quot;lstmBias&quot;,&quot;basicLSTMCell&quot;),c=r.convertToTensor(i,&quot;data&quot;,&quot;basicLSTMCell&quot;),f=r.convertToTensor(o,&quot;c&quot;,&quot;basicLSTMCell&quot;),p=r.convertToTensor(a,&quot;h&quot;,&quot;basicLSTMCell&quot;),h=c.concat(p,1).matMul(u).add(l),d=h.shape[0],m=h.shape[1]/4,g=[d,m],v=h.slice([0,0],g),y=h.slice([0,m],g),b=h.slice([0,2*m],g),_=h.slice([0,3*m],g),w=v.sigmoid().mulStrict(y.tanh()).addStrict(f.mulStrict(s.add(b).sigmoid()));return[w,w.tanh().mulStrict(_.sigmoid())]}}),n.multiRNNCell=i.op({multiRNNCell_:function(t,e,n,i){for(var o=r.convertToTensor(e,&quot;data&quot;,&quot;multiRNNCell&quot;),a=r.convertToTensorArray(n,&quot;c&quot;,&quot;multiRNNCell&quot;),s=r.convertToTensorArray(i,&quot;h&quot;,&quot;multiRNNCell&quot;),u=o,l=[],c=0;c&lt;t.length;c++){var f=t[c](u,a[c],s[c]);l.push(f[0]),l.push(f[1]),u=f[1]}var p=[],h=[];for(c=0;c&lt;l.length;c+=2)p.push(l[c]),h.push(l[c+1]);return[p,h]}})},{&quot;../tensor_util_env&quot;:219,&quot;./operation&quot;:180}],177:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util&quot;),o=t(&quot;../tensor_util_env&quot;),a=t(&quot;../util&quot;),s=t(&quot;./operation&quot;);n.matMul=s.op({matMul_:function(t,e,n,s){var u;void 0===n&amp;&amp;(n=!1),void 0===s&amp;&amp;(s=!1);var l=o.convertToTensor(t,&quot;a&quot;,&quot;matMul&quot;),c=o.convertToTensor(e,&quot;b&quot;,&quot;matMul&quot;);u=i.makeTypesMatch(l,c),l=u[0],c=u[1];var f=n?l.shape[l.rank-2]:l.shape[l.rank-1],p=s?c.shape[c.rank-1]:c.shape[c.rank-2],h=n?l.shape[l.rank-1]:l.shape[l.rank-2],d=s?c.shape[c.rank-2]:c.shape[c.rank-1],m=l.shape.slice(0,-2),g=c.shape.slice(0,-2),v=a.sizeFromShape(m),y=a.sizeFromShape(g);a.assert(l.rank&gt;=2&amp;&amp;c.rank&gt;=2&amp;&amp;l.rank===c.rank,function(){return&quot;Error in matMul: inputs must have the same rank of at least 2, got ranks &quot;+l.rank+&quot; and &quot;+c.rank+&quot;.&quot;}),a.assert(a.arraysEqual(m,g),function(){return&quot;Error in matMul: outer dimensions (&quot;+m+&quot;) and (&quot;+g+&quot;) of Tensors with shapes &quot;+l.shape+&quot; and &quot;+c.shape+&quot; must match.&quot;}),a.assert(f===p,function(){return&quot;Error in matMul: inner shapes (&quot;+f+&quot;) and (&quot;+p+&quot;) of Tensors with shapes &quot;+l.shape+&quot; and &quot;+c.shape+&quot; and transposeA=&quot;+n+&quot; and transposeB=&quot;+s+&quot; must match.&quot;});var b=l.shape.slice(0,-2).concat([h,d]),_=n?l.as3D(v,f,h):l.as3D(v,h,f),w=s?c.as3D(y,d,p):c.as3D(y,p,d);return r.ENGINE.runKernel(function(t,e){var r=t.batchMatMul(_,w,n,s);return e([_,w]),r},{$a:_,$b:w},function(t,e){var r=e,i=r[0],o=r[1];return n||s?!n&amp;&amp;s?{$a:function(){return t.matMul(o,!1,!1)},$b:function(){return t.matMul(i,!0,!1)}}:n&amp;&amp;!s?{$a:function(){return o.matMul(t,!1,!0)},$b:function(){return i.matMul(t,!1,!1)}}:{$a:function(){return o.matMul(t,!0,!0)},$b:function(){return t.matMul(i,!0,!0)}}:{$a:function(){return t.matMul(o,!1,!0)},$b:function(){return i.matMul(t,!0,!1)}}}).reshape(b)}}),n.dot=s.op({dot_:function(t,e){var n=o.convertToTensor(t,&quot;t1&quot;,&quot;dot&quot;),r=o.convertToTensor(e,&quot;t2&quot;,&quot;dot&quot;);a.assert(!(1!==n.rank&amp;&amp;2!==n.rank||1!==r.rank&amp;&amp;2!==r.rank),function(){return&quot;Error in dot: inputs must all be rank 1 or 2, but got ranks &quot;+n.rank+&quot; and &quot;+r.rank+&quot;.&quot;});var i=1===n.rank?n.size:n.shape[1],s=1===r.rank?r.size:r.shape[0];return a.assert(i===s,function(){return&quot;Error in dot: inner dimensions of inputs must match, but got &quot;+i+&quot; and &quot;+s+&quot;.&quot;}),1===n.rank&amp;&amp;1===r.rank?n.as2D(1,-1).matMul(r.as2D(-1,1)).asScalar():1===n.rank&amp;&amp;2===r.rank?n.as2D(1,-1).matMul(r.as2D(r.shape[0],r.shape[1])).as1D():2===n.rank&amp;&amp;1===r.rank?n.matMul(r.as2D(-1,1)).as1D():n.matMul(r.as2D(r.shape[0],r.shape[1]))}}),n.outerProduct=s.op({outerProduct_:function(t,e){var n=o.convertToTensor(t,&quot;v1&quot;,&quot;outerProduct&quot;),r=o.convertToTensor(e,&quot;v2&quot;,&quot;outerProduct&quot;);return a.assert(1===n.rank&amp;&amp;1===r.rank,function(){return&quot;Error in outerProduct: inputs must be rank 1, but got ranks &quot;+n.rank+&quot; and &quot;+r.rank+&quot;.&quot;}),n.as2D(-1,1).matMul(r.as2D(1,-1))}})},{&quot;../engine&quot;:133,&quot;../tensor_util&quot;:218,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./operation&quot;:180}],178:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../tensor_util&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;./binary_ops&quot;),s=t(&quot;./operation&quot;),u=t(&quot;./tensor_ops&quot;);n.movingAverage=s.op({movingAverage_:function(t,e,n,s,l){void 0===l&amp;&amp;(l=!0);var c=i.convertToTensor(t,&quot;v&quot;,&quot;movingAverage&quot;),f=i.convertToTensor(e,&quot;x&quot;,&quot;movingAverage&quot;),p=i.convertToTensor(n,&quot;decay&quot;,&quot;movingAverage&quot;);r.assertTypesMatch(c,f),o.assert(o.arraysEqual(c.shape,f.shape),function(){return&quot;Shape mismatch in v and x&quot;});var h=u.scalar(1),d=h.sub(p),m=f.sub(c).mul(d);if(l){o.assert(null!=s,function(){return&quot;When using zeroDebias: true, step is required.&quot;});var g=i.convertToTensor(s,&quot;step&quot;,&quot;movingAverage&quot;);m=m.div(h.sub(a.pow(p,g)))}return c.add(m)}})},{&quot;../tensor_util&quot;:218,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./binary_ops&quot;:157,&quot;./operation&quot;:180,&quot;./tensor_ops&quot;:200}],179:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../tensor_util_env&quot;),i=t(&quot;./axis_util&quot;),o=t(&quot;./operation&quot;),a=t(&quot;./tensor_ops&quot;),s=t(&quot;../util&quot;);n.norm=o.op({norm_:function(t,e,n,o){void 0===e&amp;&amp;(e=&quot;euclidean&quot;),void 0===n&amp;&amp;(n=null),void 0===o&amp;&amp;(o=!1);var u=function t(e,n,r){if(void 0===r&amp;&amp;(r=null),0===e.rank)return e.abs();if(1!==e.rank&amp;&amp;null===r)return t(e.reshape([-1]),n,r);if(1===e.rank||&quot;number&quot;==typeof r||Array.isArray(r)&amp;&amp;1===r.length){if(1===n)return e.abs().sum(r);if(n===1/0)return e.abs().max(r);if(n===-1/0)return e.abs().min(r);if(&quot;euclidean&quot;===n||2===n)return e.abs().pow(a.scalar(2,&quot;int32&quot;)).sum(r).sqrt();throw new Error(&quot;Error in norm: invalid ord value: &quot;+n)}if(Array.isArray(r)&amp;&amp;2===r.length){if(1===n)return e.abs().sum(r[0]).max(r[1]-1);if(n===1/0)return e.abs().sum(r[1]).max(r[0]);if(n===-1/0)return e.abs().sum(r[1]).min(r[0]);if(&quot;fro&quot;===n||&quot;euclidean&quot;===n)return e.square().sum(r).sqrt();throw new Error(&quot;Error in norm: invalid ord value: &quot;+n)}throw new Error(&quot;Error in norm: invalid axis: &quot;+r)}(t=r.convertToTensor(t,&quot;x&quot;,&quot;norm&quot;),e,n),l=u.shape;if(o){var c=s.parseAxisParam(n,t.shape);l=i.expandShapeToKeepDim(u.shape,c)}return u.reshape(l)}})},{&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./axis_util&quot;:155,&quot;./operation&quot;:180,&quot;./tensor_ops&quot;:200}],180:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;);n.op=function(t){var e=Object.keys(t);if(1!==e.length)throw new Error(&quot;Please provide an object with a single key (operation name) mapping to a function. Got an object with &quot;+e.length+&quot; keys.&quot;);var n=e[0],i=t[n];n.endsWith(&quot;_&quot;)&amp;&amp;(n=n.substring(0,n.length-1));var o=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];r.ENGINE.startScope(n);try{var o=i.apply(void 0,t);return o instanceof Promise&amp;&amp;console.error(&quot;Cannot return a Promise inside of tidy.&quot;),r.ENGINE.endScope(o),o}catch(t){throw r.ENGINE.endScope(null),t}};return Object.defineProperty(o,&quot;name&quot;,{value:n,configurable:!0}),o}},{&quot;../engine&quot;:133}],181:[function(t,e,n){&quot;use strict&quot;;function r(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),r(t(&quot;./batchnorm&quot;)),r(t(&quot;./complex_ops&quot;)),r(t(&quot;./concat_split&quot;)),r(t(&quot;./conv&quot;)),r(t(&quot;./matmul&quot;)),r(t(&quot;./reverse&quot;)),r(t(&quot;./pool&quot;)),r(t(&quot;./slice&quot;)),r(t(&quot;./unary_ops&quot;)),r(t(&quot;./reduction_ops&quot;)),r(t(&quot;./compare&quot;)),r(t(&quot;./binary_ops&quot;)),r(t(&quot;./relu_ops&quot;)),r(t(&quot;./logical_ops&quot;)),r(t(&quot;./array_ops&quot;)),r(t(&quot;./tensor_ops&quot;)),r(t(&quot;./transpose&quot;)),r(t(&quot;./softmax&quot;)),r(t(&quot;./lrn&quot;)),r(t(&quot;./norm&quot;)),r(t(&quot;./segment_ops&quot;)),r(t(&quot;./lstm&quot;)),r(t(&quot;./moving_average&quot;)),r(t(&quot;./strided_slice&quot;)),r(t(&quot;./topk&quot;)),r(t(&quot;./scatter_nd&quot;)),r(t(&quot;./spectral_ops&quot;)),r(t(&quot;./sparse_to_dense&quot;)),r(t(&quot;./gather_nd&quot;));var i=t(&quot;./operation&quot;);n.op=i.op;var o=t(&quot;./loss_ops&quot;);n.losses=o;var a=t(&quot;./linalg_ops&quot;);n.linalg=a;var s=t(&quot;./image_ops&quot;);n.image=s;var u=t(&quot;./spectral_ops&quot;);n.spectral=u;var l=t(&quot;./fused_ops&quot;);n.fused=l},{&quot;./array_ops&quot;:153,&quot;./batchnorm&quot;:156,&quot;./binary_ops&quot;:157,&quot;./compare&quot;:160,&quot;./complex_ops&quot;:161,&quot;./concat_split&quot;:162,&quot;./conv&quot;:165,&quot;./fused_ops&quot;:168,&quot;./gather_nd&quot;:169,&quot;./image_ops&quot;:171,&quot;./linalg_ops&quot;:172,&quot;./logical_ops&quot;:173,&quot;./loss_ops&quot;:174,&quot;./lrn&quot;:175,&quot;./lstm&quot;:176,&quot;./matmul&quot;:177,&quot;./moving_average&quot;:178,&quot;./norm&quot;:179,&quot;./operation&quot;:180,&quot;./pool&quot;:182,&quot;./reduction_ops&quot;:185,&quot;./relu_ops&quot;:186,&quot;./reverse&quot;:187,&quot;./scatter_nd&quot;:188,&quot;./segment_ops&quot;:190,&quot;./slice&quot;:193,&quot;./softmax&quot;:195,&quot;./sparse_to_dense&quot;:196,&quot;./spectral_ops&quot;:198,&quot;./strided_slice&quot;:199,&quot;./tensor_ops&quot;:200,&quot;./topk&quot;:201,&quot;./transpose&quot;:202,&quot;./unary_ops&quot;:203}],182:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;./array_ops&quot;),s=t(&quot;./conv_util&quot;),u=t(&quot;./operation&quot;);function l(t,e,n,a,u,l){var c=i.convertToTensor(t,&quot;x&quot;,&quot;maxPool&quot;),f=c,p=!1;3===c.rank&amp;&amp;(p=!0,f=c.as4D(1,c.shape[0],c.shape[1],c.shape[2])),null==a&amp;&amp;(a=[1,1]),o.assert(4===f.rank,function(){return&quot;Error in maxPool: input must be rank 4 but got rank &quot;+f.rank+&quot;.&quot;}),o.assert(s.eitherStridesOrDilationsAreOne(n,a),function(){return&quot;Error in maxPool: Either strides or dilations must be 1. Got strides &quot;+n+&quot; and dilations &apos;&quot;+a+&quot;&apos;&quot;}),null!=l&amp;&amp;o.assert(o.isInt(u),function(){return&quot;Error in maxPool: pad must be an integer when using, dimRoundingMode &quot;+l+&quot; but got pad &quot;+u+&quot;.&quot;});var h=s.computePool2DInfo(f.shape,e,n,a,u,l),d=r.ENGINE.runKernel(function(t,e){var n=t.maxPool(f,h);return e([f,n]),n},{x:f},function(t,l){var c=l[0],f=l[1];return{x:function(){return function(t,e,n,a,u,l,c,f){var p=i.convertToTensor(t,&quot;dy&quot;,&quot;maxPoolBackprop&quot;),h=i.convertToTensor(e,&quot;input&quot;,&quot;maxPoolBackprop&quot;),d=i.convertToTensor(n,&quot;output&quot;,&quot;maxPoolBackprop&quot;);o.assert(h.rank===p.rank,function(){return&quot;Rank of input (&quot;+h.rank+&quot;) does not match rank of dy (&quot;+p.rank+&quot;)&quot;}),null==l&amp;&amp;(l=[1,1]),o.assert(s.eitherStridesOrDilationsAreOne(u,l),function(){return&quot;Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides &quot;+u+&quot; and dilations &apos;&quot;+l+&quot;&apos;&quot;}),o.assert(4===p.rank,function(){return&quot;Error in maxPoolBackprop: dy must be rank 4 but got rank &quot;+p.rank+&quot;.&quot;}),o.assert(4===h.rank,function(){return&quot;Error in maxPoolBackprop: input must be rank 4 but got rank &quot;+h.rank+&quot;.&quot;}),null!=f&amp;&amp;o.assert(o.isInt(c),function(){return&quot;Error in maxPoolBackprop: pad must be an integer when using, dimRoundingMode &quot;+f+&quot; but got pad &quot;+c+&quot;.&quot;});var m=s.computePool2DInfo(h.shape,a,u,l,c,f);return r.ENGINE.runKernel(function(t){return t.maxPoolBackprop(p,h,d,m)},{$dy:p,$input:h})}(t,c,f,e,n,a,u)}}});return p?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}function c(t,e,n,a,u,l){var c=i.convertToTensor(t,&quot;x&quot;,&quot;avgPool&quot;,&quot;float32&quot;);null==a&amp;&amp;(a=[1,1]),o.assert(s.eitherStridesOrDilationsAreOne(n,a),function(){return&quot;Error in avgPool: Either strides or dilations must be 1. Got strides &quot;+n+&quot; and dilations &apos;&quot;+a+&quot;&apos;&quot;});var f=c,p=!1;3===c.rank&amp;&amp;(p=!0,f=c.as4D(1,c.shape[0],c.shape[1],c.shape[2])),o.assert(4===f.rank,function(){return&quot;Error in avgPool: x must be rank 4 but got rank &quot;+f.rank+&quot;.&quot;}),null!=l&amp;&amp;o.assert(o.isInt(u),function(){return&quot;Error in avgPool: pad must be an integer when using, dimRoundingMode &quot;+l+&quot; but got pad &quot;+u+&quot;.&quot;});var h=s.computePool2DInfo(f.shape,e,n,a,u,l),d=r.ENGINE.runKernel(function(t){return t.avgPool(f,h)},{x:f},function(t){return{x:function(){return function(t,e,n,a,u,l){var c=i.convertToTensor(t,&quot;dy&quot;,&quot;avgPoolBackprop&quot;),f=i.convertToTensor(e,&quot;input&quot;,&quot;avgPoolBackprop&quot;);o.assert(f.rank===c.rank,function(){return&quot;Rank of input (&quot;+f.rank+&quot;) does not match rank of dy (&quot;+c.rank+&quot;)&quot;}),null==u&amp;&amp;(u=[1,1]),o.assert(s.eitherStridesOrDilationsAreOne(a,u),function(){return&quot;Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides &quot;+a+&quot; and dilations &apos;&quot;+u+&quot;&apos;&quot;});var p=f,h=c,d=!1;3===f.rank&amp;&amp;(d=!0,p=f.as4D(1,f.shape[0],f.shape[1],f.shape[2]),h=c.as4D(1,c.shape[0],c.shape[1],c.shape[2])),o.assert(4===h.rank,function(){return&quot;Error in avgPoolBackprop: dy must be rank 4 but got rank &quot;+h.rank+&quot;.&quot;}),o.assert(4===p.rank,function(){return&quot;Error in avgPoolBackprop: input must be rank 4 but got rank &quot;+p.rank+&quot;.&quot;});var m=s.computePool2DInfo(p.shape,n,a,u,l),g=r.ENGINE.runKernel(function(t){return t.avgPoolBackprop(h,p,m)},{dy4D:h,input4D:p});return d?g.as3D(g.shape[1],g.shape[2],g.shape[3]):g}(t,f,e,n,a,u)}}});return d=d.cast(c.dtype),p?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}n.maxPool=u.op({maxPool_:function(t,e,n,r,i){return l(t,e,n,1,r,i)}}),n.avgPool=u.op({avgPool_:function(t,e,n,r,i){return c(t,e,n,1,r,i)}}),n.pool=u.op({pool_:function(t,e,n,r,u,f){null==u&amp;&amp;(u=[1,1]),null==f&amp;&amp;(f=1),0===r&amp;&amp;(r=&quot;valid&quot;);var p=i.convertToTensor(t,&quot;x&quot;,&quot;maxPool&quot;),h=p,d=!1;3===p.rank&amp;&amp;(d=!0,h=p.as4D(1,p.shape[0],p.shape[1],p.shape[2])),o.assert(s.eitherStridesOrDilationsAreOne(f,u),function(){return&quot;Error in pool: Either strides or dilations must be 1. Got strides &quot;+f+&quot; and dilations &apos;&quot;+u+&quot;&apos;&quot;});var m,g=s.computePool2DInfo(h.shape,e,f,u,r),v=[g.dilationHeight,g.dilationWidth];m=&quot;same&quot;===r?function(t,e){var n=t.map(function(t,n){return t+(t-1)*(e[n]-1)}).map(function(t){return t-1}),r=n.map(function(t){return Math.floor(t/2)}),i=n.map(function(t,e){return t-r[e]});return n.map(function(t,e){return[r[e],i[e]]})}([g.filterHeight,g.filterWidth],v):[[0,0],[0,0]];var y=1===v[0]&amp;&amp;1===v[1],b=function(t,e,n){var r=n.map(function(t){return t[0]}),i=n.map(function(t){return t[1]}),o=t.concat(r,i),a=e.map(function(t,e){return(t-o[e]%t)%t}),s=i.map(function(t,e){return t+a[e]}),u=e.map(function(t,e){return[r[e],s[e]]}),l=e.map(function(t,e){return[0,a[e]]});return[u,l]}([g.inHeight,g.inWidth],v,m),_=b[0],w=b[1],x=y?r:&quot;valid&quot;,E=y?h:a.spaceToBatchND(h,v,_),k=(&quot;avg&quot;===n?function(){return c(E,e,f,1,x)}:function(){return l(E,e,f,1,x)})(),T=y?k:a.batchToSpaceND(k,v,w);return d?T.as3D(T.shape[1],T.shape[2],T.shape[3]):T}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./array_ops&quot;:153,&quot;./conv_util&quot;:166,&quot;./operation&quot;:180}],183:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;seedrandom&quot;),i=function(){function t(t,e,n,i,o){this.mean=t,this.stdDev=e,this.dtype=n,this.nextVal=NaN,this.truncated=i,this.truncated&amp;&amp;(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var a=o||Math.random();this.random=r.alea(a.toString())}return t.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var t=this.nextVal;return this.nextVal=NaN,t}for(var e,n,r=!1;!r;){var i=void 0,o=void 0,a=void 0;do{a=(i=2*this.random()-1)*i+(o=2*this.random()-1)*o}while(a&gt;=1||0===a);var s=Math.sqrt(-2*Math.log(a)/a);e=this.mean+this.stdDev*i*s,n=this.mean+this.stdDev*o*s,this.truncated&amp;&amp;!this.isValidTruncated(e)||(r=!0)}return this.truncated&amp;&amp;!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(e)},t.prototype.convertValue=function(t){return null==this.dtype||&quot;float32&quot;===this.dtype?t:Math.round(t)},t.prototype.isValidTruncated=function(t){return t&lt;=this.upper&amp;&amp;t&gt;=this.lower},t}();n.MPRandGauss=i},{seedrandom:340}],184:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../util&quot;);n.PARALLELIZE_THRESHOLD=30,n.computeOptimalWindowSize=function(t){return t&lt;=n.PARALLELIZE_THRESHOLD?t:r.nearestDivisor(t,Math.floor(Math.sqrt(t)))}},{&quot;../util&quot;:223}],185:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../gradients&quot;),o=t(&quot;../tensor_util_env&quot;),a=t(&quot;../util&quot;),s=t(&quot;./axis_util&quot;),u=t(&quot;./operation&quot;),l=t(&quot;./tensor_ops&quot;);function c(t,e,n,r,i){return e.rank&lt;n.rank&amp;&amp;(e=e.reshape(s.expandShapeToKeepDim(e.shape,r))),t.rank&lt;n.rank&amp;&amp;(t=t.reshape(s.expandShapeToKeepDim(t.shape,r))),{$x:function(){var r=t.mul(n.equal(e).cast(t.dtype));return null==i?r:r.transpose(i)}}}n.all=u.op({all_:function(t,e,n){void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=!1);var i=o.convertToTensor(t,&quot;x&quot;,&quot;all&quot;,&quot;bool&quot;),u=a.parseAxisParam(e,i.shape),l=u,c=s.getAxesPermutation(l,i.rank);null!=c&amp;&amp;(i=i.transpose(c),l=s.getInnerMostAxes(l.length,i.rank));var f=r.ENGINE.runKernel(function(t){return t.all(i,l)},{$x:i});if(n){var p=s.expandShapeToKeepDim(f.shape,u);return f.reshape(p)}return f}}),n.any=u.op({any_:function(t,e,n){void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=!1);var i=o.convertToTensor(t,&quot;x&quot;,&quot;any&quot;,&quot;bool&quot;),u=a.parseAxisParam(e,i.shape),l=u,c=s.getAxesPermutation(l,i.rank);null!=c&amp;&amp;(i=i.transpose(c),l=s.getInnerMostAxes(l.length,i.rank));var f=r.ENGINE.runKernel(function(t){return t.any(i,l)},{$x:i});if(n){var p=s.expandShapeToKeepDim(f.shape,u);return f.reshape(p)}return f}}),n.argMax=u.op({argMax_:function(t,e){void 0===e&amp;&amp;(e=0);var n=o.convertToTensor(t,&quot;x&quot;,&quot;argMax&quot;);null==e&amp;&amp;(e=0);var i=a.parseAxisParam(e,n.shape),u=s.getAxesPermutation(i,n.rank);return null!=u&amp;&amp;(n=n.transpose(u),i=s.getInnerMostAxes(i.length,n.rank)),r.ENGINE.runKernel(function(t,e){var r=t.argMax(n,i[0]);return e([n]),r},{$x:n},function(t,e){var n=e[0];return{$x:function(){return l.zerosLike(n)}}})}}),n.argMin=u.op({argMin_:function(t,e){void 0===e&amp;&amp;(e=0);var n=o.convertToTensor(t,&quot;x&quot;,&quot;argMin&quot;);null==e&amp;&amp;(e=0);var i=a.parseAxisParam(e,n.shape),u=s.getAxesPermutation(i,n.rank);return null!=u&amp;&amp;(n=n.transpose(u),i=s.getInnerMostAxes(i.length,n.rank)),r.ENGINE.runKernel(function(t,e){var r=t.argMin(n,i[0]);return e([n]),r},{$x:n},function(t,e){var n=e[0];return{$x:function(){return l.zerosLike(n)}}})}}),n.logSumExp=u.op({logSumExp_:function(t,e,n){void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=!1);var r=o.convertToTensor(t,&quot;x&quot;,&quot;logSumExp&quot;),i=a.parseAxisParam(e,r.shape),u=r.max(i,!0),l=r.sub(u).exp().sum(i).log(),c=u.reshape(l.shape).add(l);if(n){var f=s.expandShapeToKeepDim(c.shape,i);return c.reshape(f)}return c}}),n.max=u.op({max_:function(t,e,n){void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=!1);var i=o.convertToTensor(t,&quot;x&quot;,&quot;max&quot;),u=i,l=a.parseAxisParam(e,i.shape),f=l,p=s.getAxesPermutation(f,i.rank);null!=p&amp;&amp;(i=i.transpose(p),f=s.getInnerMostAxes(f.length,i.rank));var h=r.ENGINE.runKernel(function(t,e){var n=t.max(i,f);return e([u,n]),n},{$x:i},function(t,e){return c(t,e[1],e[0],l,p)});if(n){var d=s.expandShapeToKeepDim(h.shape,l);h=h.reshape(d)}return h}}),n.mean=u.op({mean_:function(t,e,n){void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=!1);var r=o.convertToTensor(t,&quot;x&quot;,&quot;mean&quot;),u=a.parseAxisParam(e,r.shape),c=s.computeOutAndReduceShapes(r.shape,u)[1],f=a.sizeFromShape(c);return i.customGrad(function(t){var r=l.scalar(f);return{value:(r.dtype===t.dtype?t:t.cast(r.dtype)).div(r).sum(e,n),gradFunc:function(e){var n=t.shape.slice();return u.forEach(function(t){n[t]=1}),e.reshape(n).mul(l.ones(t.shape,&quot;float32&quot;)).div(f)}}})(r)}}),n.min=u.op({min_:function(t,e,n){void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=!1);var i=o.convertToTensor(t,&quot;x&quot;,&quot;min&quot;),u=i,l=a.parseAxisParam(e,i.shape),f=l,p=s.getAxesPermutation(f,i.rank);null!=p&amp;&amp;(i=i.transpose(p),f=s.getInnerMostAxes(f.length,i.rank));var h=r.ENGINE.runKernel(function(t,e){var n=t.min(i,f);return e([u,n]),n},{$x:i},function(t,e){return c(t,e[1],e[0],l,p)});if(n){var d=s.expandShapeToKeepDim(h.shape,l);h=h.reshape(d)}return h}}),n.moments=u.op({moments_:function(t,e,n){void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=!1),t=o.convertToTensor(t,&quot;x&quot;,&quot;moments&quot;);var r=a.parseAxisParam(e,t.shape),i=t.mean(r,n),u=i.shape;return n||(u=s.expandShapeToKeepDim(i.shape,r)),{mean:i,variance:t.toFloat().sub(i.reshape(u)).square().mean(r,n)}}}),n.sum=u.op({sum_:function(t,e,n){void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=!1);var u=o.convertToTensor(t,&quot;x&quot;,&quot;sum&quot;);&quot;bool&quot;===u.dtype&amp;&amp;(u=u.toInt());var c=a.parseAxisParam(e,u.shape);return i.customGrad(function(t){var e=s.getAxesPermutation(c,t.rank),i=c,o=t;null!=e&amp;&amp;(o=t.transpose(e),i=s.getInnerMostAxes(i.length,t.rank));var a=r.ENGINE.runKernel(function(t){return t.sum(o,i)},{permutedX:o});if(n){var u=s.expandShapeToKeepDim(a.shape,c);a=a.reshape(u)}return{value:a,gradFunc:function(e){var n=t.shape.slice();return c.forEach(function(t){n[t]=1}),e.reshape(n).mul(l.ones(t.shape,&quot;float32&quot;))}}})(u)}}),n.prod=u.op({prod_:function(t,e,n){void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=!1);var i=o.convertToTensor(t,&quot;x&quot;,&quot;prod&quot;);&quot;bool&quot;===i.dtype&amp;&amp;(i=i.toInt());var u=a.parseAxisParam(e,i.shape),l=s.getAxesPermutation(u,i.rank),c=u,f=i;null!=l&amp;&amp;(f=i.transpose(l),c=s.getInnerMostAxes(c.length,i.rank));var p=r.ENGINE.runKernel(function(t){return t.prod(f,c)},{permutedX:f});if(n){var h=s.expandShapeToKeepDim(p.shape,u);p=p.reshape(h)}return p}})},{&quot;../engine&quot;:133,&quot;../gradients&quot;:137,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./axis_util&quot;:155,&quot;./operation&quot;:180,&quot;./tensor_ops&quot;:200}],186:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;./binary_ops&quot;),a=t(&quot;./broadcast_util&quot;),s=t(&quot;./logical_ops&quot;),u=t(&quot;./operation&quot;),l=t(&quot;./selu_util&quot;),c=t(&quot;./tensor_ops&quot;);n.elu=u.op({elu_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;elu&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.elu(e);return n([r]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return r.ENGINE.runKernel(function(e){return e.eluDer(t,n)},{dy:t,y:n})}}})}}),n.leakyRelu=u.op({leakyRelu_:function(t,e){void 0===e&amp;&amp;(e=.2);var n=i.convertToTensor(t,&quot;x&quot;,&quot;leakyRelu&quot;);return o.maximum(c.scalar(e).mul(n),n)}}),n.prelu=u.op({prelu_:function(t,e){var n=i.convertToTensor(t,&quot;x&quot;,&quot;prelu&quot;),o=i.convertToTensor(e,&quot;alpha&quot;,&quot;prelu&quot;);return r.ENGINE.runKernel(function(t,e){var r=t.prelu(n,o);return e([n,o]),r},{$x:n,$alpha:o},function(t,e){var n=e[0],r=e[1],i=n.greater(0);return{$x:function(){return s.where(i,t,t.mul(r))},$alpha:function(){var e=s.where(i,c.zerosLike(t),t.mul(n)),o=a.getReductionAxes(r.shape,t.shape);return o.length&gt;0&amp;&amp;(e=e.sum(o)),e.reshape(r.shape)}}})}}),n.relu=u.op({relu_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;relu&quot;);return&quot;bool&quot;===e.dtype?e.toInt():r.ENGINE.runKernel(function(t,n){var r=t.relu(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mulStrict(n.step().toFloat())}}})}}),n.selu=u.op({selu_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;selu&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.selu(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){var e=n.greater(c.scalar(0)),r=c.scalar(l.SELU_SCALEALPHA),i=c.scalar(l.SELU_SCALE),o=t.mul(i),a=t.mul(r).mul(n.toFloat().exp());return s.where(e,o,a)}}})}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;./binary_ops&quot;:157,&quot;./broadcast_util&quot;:158,&quot;./logical_ops&quot;:173,&quot;./operation&quot;:180,&quot;./selu_util&quot;:192,&quot;./tensor_ops&quot;:200}],187:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;./operation&quot;);n.reverse=a.op({reverse_:function(t,e){var n=i.convertToTensor(t,&quot;x&quot;,&quot;reverse&quot;);if(0===n.rank)return n.clone();var a=o.parseAxisParam(e,n.shape);return r.ENGINE.runKernel(function(t){return t.reverse(n,a)},{$x:n},function(t){return{$x:function(){return t.reverse(a)}}}).reshapeAs(n)}}),n.reverse1d=a.op({reverse1d_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;reverse&quot;);return o.assert(1===e.rank,function(){return&quot;Error in reverse1D: x must be rank 1 but got rank &quot;+e.rank+&quot;.&quot;}),n.reverse(e,0)}}),n.reverse2d=a.op({reverse2d_:function(t,e){var r=i.convertToTensor(t,&quot;x&quot;,&quot;reverse&quot;);return o.assert(2===r.rank,function(){return&quot;Error in reverse2D: x must be rank 2 but got rank &quot;+r.rank+&quot;.&quot;}),n.reverse(r,e)}}),n.reverse3d=a.op({reverse3d_:function(t,e){var r=i.convertToTensor(t,&quot;x&quot;,&quot;reverse&quot;);return o.assert(3===r.rank,function(){return&quot;Error in reverse3D: x must be rank 3 but got rank &quot;+r.rank+&quot;.&quot;}),n.reverse(r,e)}}),n.reverse4d=a.op({reverse4d_:function(t,e){var r=i.convertToTensor(t,&quot;x&quot;,&quot;reverse&quot;);return o.assert(4===r.rank,function(){return&quot;Error in reverse4D: x must be rank 4 but got rank &quot;+r.rank+&quot;.&quot;}),n.reverse(r,e)}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./operation&quot;:180}],188:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;./operation&quot;),a=t(&quot;./scatter_nd_util&quot;);n.scatterND=o.op({scatterND_:function(t,e,n){var o=i.convertToTensor(t,&quot;indices&quot;,&quot;scatterND&quot;,&quot;int32&quot;),s=i.convertToTensor(e,&quot;updates&quot;,&quot;scatterND&quot;);return a.validateInput(s,o,n),r.ENGINE.runKernel(function(t){return t.scatterND(o,s,n)},{$indices:o,$updates:s})}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;./operation&quot;:180,&quot;./scatter_nd_util&quot;:189}],189:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../util&quot;);function i(t,e,n){var r=e.rank&gt;1?e.shape[e.rank-1]:1,i=e.rank&gt;1?e.rank-1:1,o=&quot;Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: &quot;+n.shape+&quot;, indices.shape: &quot;+e.shape+&quot;, shape: &quot;+t+&quot;, sliceDim: &quot;+r+&quot;, and batchDim: &quot;+i+&quot;.&quot;;if(n.rank&lt;i)throw new Error(o+&quot; update.rank &lt; &quot;+i+&quot;. &quot;);if(t.length&lt;r+(n.rank-i))throw new Error(o+&quot; Output shape length &lt; &quot;+(r+(n.rank-i)));if(n.rank!==i+t.length-r)throw new Error(o+&quot; update.rank != &quot;+(i+t.length-r));for(var a=0;a&lt;i;++a)if(n.shape[a]!==e.shape[a])throw new Error(o+&quot; updates.shape[&quot;+a+&quot;] (&quot;+n.shape[a]+&quot;) != indices.shape[&quot;+a+&quot;] (&quot;+e.shape[a]+&quot;).&quot;);for(a=0;a&lt;n.rank-i;++a)if(n.shape[a+i]!==t[a+r])throw new Error(o+&quot; updates.shape[&quot;+(a+i)+&quot;] (&quot;+n.shape[a+i]+&quot;) != shape[&quot;+(a+i)+&quot;] (&quot;+t[a+i]+&quot;)&quot;)}n.validateUpdateShape=i,n.validateInput=function(t,e,n){if(e.rank&lt;1)throw new Error(&quot;tf.scatterND() expects the indices to be rank 1 or higher, but the rank was &quot;+e.rank+&quot;.&quot;);if(t.rank&lt;1)throw new Error(&quot;tf.scatterND() expects the updates to be rank 1 or higher, but the rank was &quot;+t.rank+&quot;.&quot;);if(&quot;int32&quot;!==e.dtype)throw new Error(&quot;The dtype of &apos;indices&apos; should be int32, but got dtype: &quot;+e.dtype);if(n.length&lt;1)throw new Error(&quot;Output rank must be greater or equal to 1, but got shape: &quot;+n);if(0===n.length){if(0===e.size)throw new Error(&quot;Indices specified for empty output. indices shape: &quot;+e.shape);if(0===t.size)throw new Error(&quot;Updates specified for empty output. updates shape: &quot;+t.shape)}i(n,e,t)},n.calculateShapes=function(t,e,n){for(var i=e.rank&gt;1?e.shape[e.rank-1]:1,o=n.length,a=1,s=i;s&lt;o;++s)a*=n[s];var u=i&lt;1?1:i;return{sliceRank:i,numUpdates:e.size/u,sliceSize:a,strides:r.computeStrides(n.slice(0,i)).concat([1]),outputSize:r.sizeFromShape(n)}}},{&quot;../util&quot;:223}],190:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;./array_ops&quot;),s=t(&quot;./axis_util&quot;),u=t(&quot;./binary_ops&quot;),l=t(&quot;./compare&quot;),c=t(&quot;./logical_ops&quot;),f=t(&quot;./operation&quot;),p=t(&quot;./segment_util&quot;),h=t(&quot;./tensor_ops&quot;);function d(t,e){for(var n=[],r=t;r&lt;e;++r)n.push(r);return n}function m(t){for(var e=[],n=0;n&lt;t.length;++n)for(var r=0;r&lt;t[n].length;++r)e.push(t[n][r]);return e}n.gather=f.op({gather_:function(t,e,a){void 0===a&amp;&amp;(a=0);var u=i.convertToTensor(t,&quot;x&quot;,&quot;gather&quot;),l=i.convertToTensor(e,&quot;indices&quot;,&quot;gather&quot;,&quot;int32&quot;);a=o.parseAxisParam(a,u.shape)[0];var c=p.collectGatherOpShapeInfo(u,l,a);return r.ENGINE.runKernel(function(t,e){var n=t.gather(u,l.flatten(),a);return e([l]),n},{$x:u},function(t,e){var r=e[0];return{$x:function(){var e=u.shape,i=r.size,o=e.slice(0,a),l=o.length,c=e.slice(a,e.length).slice(1),f=c.length,p=d(0,l),h=d(l+1,l+1+f),g=m([o,[i],c]),v=t.reshape(g),y=r.reshape([i]),b=m([[l],p,h]),_=v.transpose(b),w=n.unsortedSegmentSum(_,y,u.shape[a]),x=s.getUndoAxesPermutation(b);return w=w.transpose(x)}}}).reshape(c.outputShape)}}),n.unsortedSegmentSum=f.op({unsortedSegmentSum_:function(t,e,s){var f=i.convertToTensor(t,&quot;x&quot;,&quot;unsortedSegmentSum&quot;),p=i.convertToTensor(e,&quot;segmentIds&quot;,&quot;unsortedSegmentSum&quot;,&quot;int32&quot;);return o.assert(o.isInt(s),function(){return&quot;numSegments must be of dtype int&quot;}),r.ENGINE.runKernel(function(t,e){var n=t.unsortedSegmentSum(f,p,s);return e([p]),n},{$x:f},function(t,e){var r=e[0];return{$x:function(){return function(t,e){for(var r=u.maximum(e,h.zerosLike(e)),i=n.gather(t,r),o=l.greaterEqual(e,h.scalar(0,&quot;int32&quot;)),s=i.rank-o.rank,f=0;f&lt;s;++f)o=a.expandDims(o,f+1);o=c.logicalAnd(o,h.ones(i.shape,&quot;bool&quot;));var p=h.zerosLike(i);return c.where(o,i,p)}(t,r)}}})}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./array_ops&quot;:153,&quot;./axis_util&quot;:155,&quot;./binary_ops&quot;:157,&quot;./compare&quot;:160,&quot;./logical_ops&quot;:173,&quot;./operation&quot;:180,&quot;./segment_util&quot;:191,&quot;./tensor_ops&quot;:200}],191:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../util&quot;),i=t(&quot;./reduce_util&quot;);n.segOpComputeOptimalWindowSize=function(t,e){var n,o=!1;for(t&lt;=i.PARALLELIZE_THRESHOLD?(n=t,o=!0):n=r.nearestDivisor(t,Math.floor(Math.sqrt(t)));!o;)n&gt;e||n===t?o=!0:n=r.nearestDivisor(t,n+1);return n},n.computeOutShape=function(t,e,n){for(var r=[],i=t.length,o=0;o&lt;i;o++)o!==e?r.push(t[o]):r.push(n);return r},n.collectGatherOpShapeInfo=function(t,e,n){for(var r=t.shape[n],i=[],o=1,a=1,s=0;s&lt;n;s++)i.push(t.shape[s]),o*=t.shape[s];for(s=0;s&lt;e.rank;s++)i.push(e.shape[s]);for(s=n+1;s&lt;t.rank;s++)i.push(t.shape[s]),a*=t.shape[s];return{batchSize:o,sliceSize:a,dimSize:r,outputShape:i}}},{&quot;../util&quot;:223,&quot;./reduce_util&quot;:184}],192:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.SELU_SCALEALPHA=1.7580993408473768,n.SELU_SCALE=1.0507009873554805},{}],193:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;./operation&quot;),s=t(&quot;./slice_util&quot;);n.slice=a.op({slice_:function(t,e,n){var a,u,l=i.convertToTensor(t,&quot;x&quot;,&quot;slice&quot;);if(0===l.rank)throw new Error(&quot;Slicing scalar is not possible&quot;);a=&quot;number&quot;==typeof e?[e].concat(new Array(l.rank-1).fill(0)):e.length&lt;l.rank?e.concat(new Array(l.rank-e.length).fill(0)):e.slice(),u=(u=null==n?new Array(l.rank).fill(-1):&quot;number&quot;==typeof n?[n].concat(new Array(l.rank-1).fill(-1)):n.length&lt;l.rank?n.concat(new Array(l.rank-n.length).fill(-1)):n).map(function(t,e){return t&gt;=0?t:(o.assert(-1===t,function(){return&quot;Bad value in size&quot;}),l.shape[e]-a[e])}),s.assertParamsValid(l,a,u);var c=l.shape;return r.ENGINE.runKernel(function(t){return t.slice(l,a,u)},{$x:l},function(t){for(var e=[],n=0;n&lt;t.rank;n++)e.push([a[n],c[n]-a[n]-u[n]]);return{$x:function(){return t.pad(e)}}})}}),n.slice1d=a.op({slice1d_:function(t,e,r){var a=i.convertToTensor(t,&quot;x&quot;,&quot;slice1d&quot;);return o.assert(1===a.rank,function(){return&quot;slice1d expects a rank-1 tensor, but got a rank-&quot;+a.rank+&quot; tensor&quot;}),n.slice(a,[e],[r])}}),n.slice2d=a.op({slice2d_:function(t,e,r){var a=i.convertToTensor(t,&quot;x&quot;,&quot;slice2d&quot;);return o.assert(2===a.rank,function(){return&quot;slice2d expects a rank-2 tensor, but got a rank-&quot;+a.rank+&quot; tensor&quot;}),n.slice(a,e,r)}}),n.slice3d=a.op({slice3d_:function(t,e,r){var a=i.convertToTensor(t,&quot;x&quot;,&quot;slice3d&quot;);return o.assert(3===a.rank,function(){return&quot;slice3d expects a rank-3 tensor, but got a rank-&quot;+a.rank+&quot; tensor&quot;}),n.slice(a,e,r)}}),n.slice4d=a.op({slice4d_:function(t,e,r){var a=i.convertToTensor(t,&quot;x&quot;,&quot;slice4d&quot;);return o.assert(4===a.rank,function(){return&quot;slice4d expects a rank-4 tensor, but got a rank-&quot;+a.rank+&quot; tensor&quot;}),n.slice(a,e,r)}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./operation&quot;:180,&quot;./slice_util&quot;:194}],194:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../util&quot;);function i(t,e,n,i,o){var a=e[o],s=n[o]||1;(t&amp;1&lt;&lt;o||null==a)&amp;&amp;(a=s&gt;0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var u=i[o];return a&lt;0&amp;&amp;(a+=u),a=r.clamp(0,a,u-1)}function o(t,e,n,i,o){var a=e[o],s=n[o]||1;(t&amp;1&lt;&lt;o||null==a)&amp;&amp;(a=s&gt;0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var u=i[o];return a&lt;0&amp;&amp;(a+=u),a=s&gt;0?r.clamp(0,a,u):r.clamp(-1,a,u-1)}n.assertParamsValid=function(t,e,n){r.assert(t.rank===e.length,function(){return&quot;Error in slice&quot;+t.rank+&quot;D: Length of begin &quot;+e+&quot; must match the rank of the array (&quot;+t.rank+&quot;).&quot;}),r.assert(t.rank===n.length,function(){return&quot;Error in slice&quot;+t.rank+&quot;D: Length of size &quot;+n+&quot; must match the rank of the array (&quot;+t.rank+&quot;).&quot;});for(var i=function(i){r.assert(e[i]+n[i]&lt;=t.shape[i],function(){return&quot;Error in slice&quot;+t.rank+&quot;D: begin[&quot;+i+&quot;] + size[&quot;+i+&quot;] (&quot;+(e[i]+n[i])+&quot;) would overflow input.shape[&quot;+i+&quot;] (&quot;+t.shape[i]+&quot;)&quot;})},o=0;o&lt;t.rank;++o)i(o)},n.getStridedSlicedInfo=function(t,e,n,r,a,s,u,l,c){if(void 0===a&amp;&amp;(a=0),void 0===s&amp;&amp;(s=0),void 0===u&amp;&amp;(u=0),void 0===l&amp;&amp;(l=0),void 0===c&amp;&amp;(c=0),0!==u)throw new Error(&quot;ellipsis mask is not yet supported&quot;);if(0!==l)throw new Error(&quot;new axis mask is not yet supported&quot;);for(var f=[],p=[],h=[],d=0;d&lt;t.length;d++)f[d]=i(a,e,r,t,d),p[d]=o(s,n,r,t,d),c&amp;1&lt;&lt;d&amp;&amp;(p[d]=f[d]+1,h.push(d));var m=new Array(t.length).fill(0);return m=m.map(function(t,e){for(var n=0,i=r[e]||1,o=f[e];!(i&gt;0?o&gt;=p[e]:o&lt;=p[e]);o+=i)n+=1;return n}),[f,m,h]},n.startForAxis=i,n.stopForAxis=o,n.isSliceContinous=function(t,e,n){for(var r=n.length,i=0;i&lt;n.length;i++)if(n[i]&gt;1){r=i;break}for(i=r+1;i&lt;n.length;i++)if(e[i]&gt;0||n[i]!==t[i])return!1;return!0},n.computeFlatOffset=function(t,e){for(var n=t.length&gt;0?t[t.length-1]:1,r=0;r&lt;t.length-1;r++)n+=t[r]*e[r];return n}},{&quot;../util&quot;:223}],195:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../gradients&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;./operation&quot;);n.softmax=o.op({softmax_:function(t,e){void 0===e&amp;&amp;(e=-1);var n=i.convertToTensor(t,&quot;logits&quot;,&quot;softmax&quot;);if(-1===e&amp;&amp;(e=n.rank-1),e!==n.rank-1)throw Error(&quot;Softmax along a non-last dimension is not yet supported. Logits was rank &quot;+n.rank+&quot; and dim was &quot;+e);return r.customGrad(function(t,n){var r=t.logSumExp([e],!0),i=t.toFloat().sub(r).exp();return n([i]),{value:i,gradFunc:function(t,n){var r=n[0],i=t.mul(r);return i.sub(i.sum([e],!0).mul(r))}}})(n)}}),n.logSoftmax=o.op({logSoftmax_:function(t,e){void 0===e&amp;&amp;(e=-1);var n=i.convertToTensor(t,&quot;logits&quot;,&quot;logSoftmax&quot;);if(-1===e&amp;&amp;(e=n.rank-1),e!==n.rank-1)throw Error(&quot;Log Softmax along a non-last dimension is not yet supported. Logits was rank &quot;+n.rank+&quot; and axis was &quot;+e);return r.customGrad(function(t,n){var r=t.max(e,!0),i=t.sub(r),o=i.toFloat().sub(i.exp().sum(e,!0).log());return n([o]),{value:o,gradFunc:function(t,n){var r=n[0].exp();return t.sub(t.sum(e,!0).mul(r))}}})(n)}})},{&quot;../gradients&quot;:137,&quot;../tensor_util_env&quot;:219,&quot;./operation&quot;:180}],196:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../ops/sparse_to_dense_util&quot;),o=t(&quot;../tensor_util_env&quot;),a=t(&quot;./operation&quot;);n.sparseToDense=a.op({sparseToDense_:function(t,e,n,a){void 0===a&amp;&amp;(a=0);var s=o.convertToTensor(t,&quot;sparseIndices&quot;,&quot;sparseToDense&quot;,&quot;int32&quot;),u=o.convertToTensor(e,&quot;sparseValues&quot;,&quot;sparseToDense&quot;),l=o.convertToTensor(a,&quot;defaultValue&quot;,&quot;sparseToDense&quot;,u.dtype);return i.validateInput(s,u,n,l),r.ENGINE.runKernel(function(t){return t.sparseToDense(s,u,n,l)},{$sparseIndices:s,$sparseValues:u,$defaultValue:l})}})},{&quot;../engine&quot;:133,&quot;../ops/sparse_to_dense_util&quot;:197,&quot;../tensor_util_env&quot;:219,&quot;./operation&quot;:180}],197:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.validateInput=function(t,e,n,r){if(&quot;int32&quot;!==t.dtype)throw new Error(&quot;tf.sparseToDense() expects the indices to be int32 type, but the dtype was &quot;+t.dtype+&quot;.&quot;);if(t.rank&gt;2)throw new Error(&quot;sparseIndices should be a scalar, vector, or matrix, but got shape &quot;+t.shape+&quot;.&quot;);var i=t.rank&gt;0?t.shape[0]:1,o=t.rank&gt;1?t.shape[1]:1;if(n.length!==o)throw new Error(&quot;outputShape has incorrect number of elements:, &quot;+n.length+&quot;, should be: &quot;+o+&quot;.&quot;);var a=e.size;if(0!==e.rank&amp;&amp;(1!==e.rank||a!==i))throw new Error(&quot;sparseValues has incorrect shape &quot;+e.shape+&quot;, should be [] or [&quot;+i+&quot;]&quot;);if(e.dtype!==r.dtype)throw new Error(&quot;sparseValues.dtype must match defaultValues.dtype&quot;)}},{}],198:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../ops/complex_ops&quot;),o=t(&quot;../ops/operation&quot;),a=t(&quot;../util&quot;),s=t(&quot;./tensor_ops&quot;);n.fft=o.op({fft_:function(t){a.assert(&quot;complex64&quot;===t.dtype,function(){return&quot;The dtype for tf.spectral.fft() must be complex64 but got &quot;+t.dtype+&quot;.&quot;});var e=t.shape[t.shape.length-1],n=t.size/e,i=t.as2D(n,e);return r.ENGINE.runKernel(function(t){return t.fft(i)},{input:t}).reshape(t.shape)}}),n.ifft=o.op({ifft_:function(t){a.assert(&quot;complex64&quot;===t.dtype,function(){return&quot;The dtype for tf.spectral.ifft() must be complex64 but got &quot;+t.dtype+&quot;.&quot;});var e=t.shape[t.shape.length-1],n=t.size/e,i=t.as2D(n,e);return r.ENGINE.runKernel(function(t){return t.ifft(i)},{input:t}).reshape(t.shape)}}),n.rfft=o.op({rfft_:function(t){a.assert(&quot;float32&quot;===t.dtype,function(){return&quot;The dtype for rfft() must be real value but got &quot;+t.dtype});var e=t.shape[t.shape.length-1],r=t.size/e,o=t.zerosLike(),s=i.complex(t,o).as2D(r,e),u=n.fft(s),l=Math.floor(e/2)+1,c=i.real(u),f=i.imag(u),p=c.split([l,e-l],c.shape.length-1),h=f.split([l,e-l],f.shape.length-1),d=t.shape.slice();return d[t.shape.length-1]=l,i.complex(p[0],h[0]).reshape(d)}}),n.irfft=o.op({irfft_:function(t){var e=t.shape[t.shape.length-1],r=t.size/e;if(e&lt;=2){var o=t.as2D(r,e),a=n.ifft(o);return i.real(a)}var u=[r,2*(e-1)],l=i.real(t).as2D(r,e),c=i.imag(t).as2D(r,e),f=l.slice([0,1],[r,e-2]).reverse(1),p=c.slice([0,1],[r,e-2]).reverse(1).mul(s.scalar(-1)),h=l.concat(f,1),d=c.concat(p,1);return o=i.complex(h,d).as2D(u[0],u[1]),a=n.ifft(o),i.real(a)}})},{&quot;../engine&quot;:133,&quot;../ops/complex_ops&quot;:161,&quot;../ops/operation&quot;:180,&quot;../util&quot;:223,&quot;./tensor_ops&quot;:200}],199:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;./operation&quot;),a=t(&quot;./slice&quot;),s=t(&quot;./slice_util&quot;);n.stridedSlice=o.op({stridedSlice_:function(t,e,n,o,u,l,c,f,p){if(void 0===u&amp;&amp;(u=0),void 0===l&amp;&amp;(l=0),void 0===c&amp;&amp;(c=0),void 0===f&amp;&amp;(f=0),void 0===p&amp;&amp;(p=0),0!==c)throw new Error(&quot;ellipsis mask is not yet supported&quot;);if(0!==f)throw new Error(&quot;new axis mask is not yet supported&quot;);var h=i.convertToTensor(t,&quot;x&quot;,&quot;stridedSlice&quot;);if(o.every(function(t){return 1===t})){var d=s.getStridedSlicedInfo(h.shape,e,n,o,u,l,c,f,p),m=d[0],g=d[1],v=d[2],y=g.filter(function(t,e){return-1===v.indexOf(e)});return a.slice(h,m,g).reshape(y)}return r.ENGINE.runKernel(function(t){return t.stridedSlice(h,e,n,o,u,l,c,f,p)},{$x:h})}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;./operation&quot;:180,&quot;./slice&quot;:193,&quot;./slice_util&quot;:194}],200:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../environment&quot;),o=t(&quot;../tensor&quot;),a=t(&quot;../tensor_util_env&quot;),s=t(&quot;../util&quot;),u=t(&quot;./complex_ops&quot;),l=t(&quot;./operation&quot;);function c(t,e,n){if(null==n&amp;&amp;(n=s.inferDtype(t)),&quot;complex64&quot;===n)throw new Error(&quot;Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).&quot;);if(!s.isTypedArray(t)&amp;&amp;!Array.isArray(t)&amp;&amp;&quot;number&quot;!=typeof t&amp;&amp;&quot;boolean&quot;!=typeof t&amp;&amp;&quot;string&quot;!=typeof t)throw new Error(&quot;values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray&quot;);var r=a.inferShape(t);if(null!=e){s.assertNonNegativeIntegerDimensions(e);var u=s.sizeFromShape(e),l=s.sizeFromShape(r);s.assert(u===l,function(){return&quot;Based on the provided shape, [&quot;+e+&quot;], the tensor should have &quot;+u+&quot; values but has &quot;+l});for(var c=0;c&lt;r.length;++c){var f=r[c],p=c!==r.length-1||f!==s.sizeFromShape(e.slice(c));s.assert(r[c]===e[c]||!p,function(){return&quot;Error creating a new Tensor. Inferred shape (&quot;+r+&quot;) does not match the provided shape (&quot;+e+&quot;). &quot;})}}return s.isTypedArray(t)||Array.isArray(t)||(t=[t]),e=e||r,t=&quot;string&quot;!==n?s.toTypedArray(t,n,i.ENV.getBool(&quot;DEBUG&quot;)):s.flatten(t),o.Tensor.make(e,{values:t},n)}function f(t,e){s.assertNonNull(t);var n=a.inferShape(t);if(1!==n.length)throw new Error(&quot;tensor1d() requires values to be a flat/TypedArray&quot;);return c(t,n,e)}function p(t,e){if(void 0===e&amp;&amp;(e=&quot;float32&quot;),&quot;complex64&quot;===e){var n=p(t,&quot;float32&quot;),r=p(t,&quot;float32&quot;);return u.complex(n,r)}var i=s.makeZerosTypedArray(s.sizeFromShape(t),e);return o.Tensor.make(t,{values:i},e)}n.tensor=c,n.scalar=function(t,e){if((s.isTypedArray(t)||Array.isArray(t))&amp;&amp;&quot;complex64&quot;!==e)throw new Error(&quot;Error creating a new Scalar: value must be a primitive (number|boolean|string)&quot;);return c(t,[],e)},n.tensor1d=f,n.tensor2d=function(t,e,n){if(s.assertNonNull(t),null!=e&amp;&amp;2!==e.length)throw new Error(&quot;tensor2d() requires shape to have two numbers&quot;);var r=a.inferShape(t);if(2!==r.length&amp;&amp;1!==r.length)throw new Error(&quot;tensor2d() requires values to be number[][] or flat/TypedArray&quot;);if(1===r.length&amp;&amp;null==e)throw new Error(&quot;tensor2d() requires shape to be provided when `values` are a flat/TypedArray&quot;);return c(t,e=e||r,n)},n.tensor3d=function(t,e,n){if(s.assertNonNull(t),null!=e&amp;&amp;3!==e.length)throw new Error(&quot;tensor3d() requires shape to have three numbers&quot;);var r=a.inferShape(t);if(3!==r.length&amp;&amp;1!==r.length)throw new Error(&quot;tensor3d() requires values to be number[][][] or flat/TypedArray&quot;);if(1===r.length&amp;&amp;null==e)throw new Error(&quot;tensor3d() requires shape to be provided when `values` are a flat array&quot;);return c(t,e=e||r,n)},n.tensor4d=function(t,e,n){if(s.assertNonNull(t),null!=e&amp;&amp;4!==e.length)throw new Error(&quot;tensor4d() requires shape to have four numbers&quot;);var r=a.inferShape(t);if(4!==r.length&amp;&amp;1!==r.length)throw new Error(&quot;tensor4d() requires values to be number[][][][] or flat/TypedArray&quot;);if(1===r.length&amp;&amp;null==e)throw new Error(&quot;tensor4d() requires shape to be provided when `values` are a flat array&quot;);return c(t,e=e||r,n)},n.tensor5d=function(t,e,n){if(s.assertNonNull(t),null!=e&amp;&amp;5!==e.length)throw new Error(&quot;tensor5d() requires shape to have five numbers&quot;);var r=a.inferShape(t);if(5!==r.length&amp;&amp;1!==r.length)throw new Error(&quot;tensor5d() requires values to be number[][][][][] or flat/TypedArray&quot;);if(1===r.length&amp;&amp;null==e)throw new Error(&quot;tensor5d() requires shape to be provided when `values` are a flat array&quot;);return c(t,e=e||r,n)},n.tensor6d=function(t,e,n){if(s.assertNonNull(t),null!=e&amp;&amp;6!==e.length)throw new Error(&quot;tensor6d() requires shape to have six numbers&quot;);var r=a.inferShape(t);if(6!==r.length&amp;&amp;1!==r.length)throw new Error(&quot;tensor6d() requires values to be number[][][][][][] or flat/TypedArray&quot;);if(1===r.length&amp;&amp;null==e)throw new Error(&quot;tensor6d() requires shape to be provided when `values` are a flat array&quot;);return c(t,e=e||r,n)},n.ones=function t(e,n){if(void 0===n&amp;&amp;(n=&quot;float32&quot;),&quot;complex64&quot;===n){var r=t(e,&quot;float32&quot;),i=t(e,&quot;float32&quot;);return u.complex(r,i)}var a=s.makeOnesTypedArray(s.sizeFromShape(e),n);return o.Tensor.make(e,{values:a},n)},n.zeros=p,n.fill=function(t,e,n){return r.ENGINE.runKernel(function(r){return r.fill(t,e,n)},{})},n.linspace=function(t,e,n){if(0===n)throw new Error(&quot;Cannot request zero samples&quot;);var r=(e-t)/(n-1),i=s.makeZerosTypedArray(n,&quot;float32&quot;);i[0]=t;for(var o=1;o&lt;i.length;o++)i[o]=i[o-1]+r;return f(i,&quot;float32&quot;)},n.range=function(t,e,n,r){if(void 0===n&amp;&amp;(n=1),void 0===r&amp;&amp;(r=&quot;float32&quot;),0===n)throw new Error(&quot;Cannot have a step of zero&quot;);if(t===e||t&lt;e&amp;&amp;n&lt;0||e&lt;t&amp;&amp;n&gt;1)return p([0],r);var i=Math.abs(Math.ceil((e-t)/n)),o=s.makeZerosTypedArray(i,r);e&lt;t&amp;&amp;1===n&amp;&amp;(n=-1),o[0]=t;for(var a=1;a&lt;o.length;a++)o[a]=o[a-1]+n;return f(o,r)},n.onesLike=l.op({onesLike_:function(t){var e=a.convertToTensor(t,&quot;x&quot;,&quot;onesLike&quot;);if(&quot;complex64&quot;===e.dtype){var i=n.onesLike(u.real(e)),o=n.zerosLike(u.imag(e));return u.complex(i,o)}return r.ENGINE.runKernel(function(t){return t.onesLike(e)},{$x:e},null)}}),n.zerosLike=l.op({zerosLike_:function(t){var e=a.convertToTensor(t,&quot;x&quot;,&quot;zerosLike&quot;);return r.ENGINE.runKernel(function(t){return t.zerosLike(e)},{$x:e},null)}})},{&quot;../engine&quot;:133,&quot;../environment&quot;:134,&quot;../tensor&quot;:216,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./complex_ops&quot;:161,&quot;./operation&quot;:180}],201:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;./operation&quot;);n.topk=o.op({topk_:function(t,e,n){void 0===e&amp;&amp;(e=1),void 0===n&amp;&amp;(n=!0);var o=i.convertToTensor(t,&quot;x&quot;,&quot;topk&quot;);if(0===o.rank)throw new Error(&quot;topk() expects the input to be of rank 1 or higher&quot;);var a=o.shape[o.shape.length-1];if(e&gt;a)throw new Error(&quot;&apos;k&apos; passed to topk() must be &lt;= the last dimension (&quot;+a+&quot;) but got &quot;+e);var s=r.ENGINE.runKernel(function(t){return t.topk(o,e,n)},{$x:o});return{values:s[0],indices:s[1]}}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;./operation&quot;:180}],202:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;./axis_util&quot;),s=t(&quot;./operation&quot;);n.transpose=s.op({transpose_:function(t,e){var n=i.convertToTensor(t,&quot;x&quot;,&quot;transpose&quot;);return null==e&amp;&amp;(e=n.shape.map(function(t,e){return e}).reverse()),o.assert(n.rank===e.length,function(){return&quot;Error in transpose: rank of input &quot;+n.rank+&quot; must match length of perm &quot;+e+&quot;.&quot;}),e.forEach(function(t){o.assert(t&gt;=0&amp;&amp;t&lt;n.rank,function(){return&quot;All entries in &apos;perm&apos; must be between 0 and &quot;+(n.rank-1)+&quot; but got &quot;+e})}),n.rank&lt;=1?n.clone():r.ENGINE.runKernel(function(t){return t.transpose(n,e)},{$x:n},function(t){var n=a.getUndoAxesPermutation(e);return{$x:function(){return t.transpose(n)}}})}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./axis_util&quot;:155,&quot;./operation&quot;:180}],203:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../engine&quot;),i=t(&quot;../tensor_util_env&quot;),o=t(&quot;../util&quot;),a=t(&quot;./operation&quot;),s=t(&quot;./tensor_ops&quot;);n.abs=a.op({abs_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;abs&quot;);return&quot;complex64&quot;===e.dtype?r.ENGINE.runKernel(function(t){return t.complexAbs(e)},{$x:e}):r.ENGINE.runKernel(function(t,n){var r=t.abs(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.toFloat().step(-1))}}})}}),n.acos=a.op({acos_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;acos&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.acos(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(s.scalar(1).sub(n.toFloat().square()).sqrt()).neg()}}})}}),n.acosh=a.op({acosh_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;acosh&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.acosh(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(n.toFloat().square().sub(1).sqrt())}}})}}),n.asin=a.op({asin_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;asin&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.asin(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(s.scalar(1).sub(n.toFloat().square()).sqrt())}}})}}),n.asinh=a.op({asinh_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;asinh&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.asinh(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(s.scalar(1).add(n.toFloat().square()).sqrt())}}})}}),n.atan=a.op({atan_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;atan&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.atan(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.toFloat().square().add(1))}}})}}),n.atanh=a.op({atanh_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;atanh&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.atanh(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(s.scalar(1).sub(n.toFloat().square()))}}})}}),n.ceil=a.op({ceil_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;ceil&quot;);return r.ENGINE.runKernel(function(t){return t.ceil(e)},{$x:e},function(t){return{$x:function(){return s.zerosLike(t)}}})}}),n.clipByValue=a.op({clipByValue_:function(t,e,n){var a=i.convertToTensor(t,&quot;x&quot;,&quot;clipByValue&quot;);return o.assert(e&lt;=n,function(){return&quot;Error in clip: min (&quot;+e+&quot;) must be less than or equal to max (&quot;+n+&quot;).&quot;}),r.ENGINE.runKernel(function(t,r){var i=t.clip(a,e,n);return r([a]),i},{$x:a},function(t,r){var i=r[0];return{$x:function(){return t.where(i.greaterEqual(e).logicalAnd(i.lessEqual(n)),s.zerosLike(t))}}})}}),n.cos=a.op({cos_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;cos&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.cos(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return n.toFloat().sin().neg().mul(t)}}})}}),n.cosh=a.op({cosh_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;cosh&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.cosh(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return n.toFloat().sinh().mulStrict(t)}}})}}),n.erf=a.op({erf_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;erf&quot;);return o.assert(&quot;int32&quot;===e.dtype||&quot;float32&quot;===e.dtype,function(){return&quot;Input dtype must be `int32` or `float32`.&quot;}),&quot;int32&quot;===e.dtype&amp;&amp;(e=e.toFloat()),r.ENGINE.runKernel(function(t,n){var r=t.erf(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.square().neg().exp().mul(2/Math.sqrt(Math.PI)))}}})}}),n.exp=a.op({exp_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;exp&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.exp(e);return n([r]),r},{$x:e},function(t,e){return{$x:function(){return t.mulStrict(e[0])}}})}}),n.expm1=a.op({expm1_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;expm1&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.expm1(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.exp())}}})}}),n.floor=a.op({floor_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;floor&quot;);return r.ENGINE.runKernel(function(t){return t.floor(e)},{$x:e},function(t){return{$x:function(){return s.zerosLike(t)}}})}}),n.log=a.op({log_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;log&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.log(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.toFloat())}}})}}),n.log1p=a.op({log1p_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;log1p&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.log1p(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.add(1))}}})}}),n.logSigmoid=a.op({logSigmoid_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;logSigmoid&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.softplus(e.neg()).neg();return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.neg().sigmoid())}}})}}),n.neg=a.op({neg_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;neg&quot;);return r.ENGINE.runKernel(function(t){return t.neg(e)},{$x:e},function(t){return{$x:function(){return t.neg()}}})}}),n.reciprocal=a.op({reciprocal_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;reciprocal&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.reciprocal(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.square().neg())}}})}}),n.round=a.op({round_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;round&quot;);return r.ENGINE.runKernel(function(t){return t.round(e)},{$x:e},function(t){return{$x:function(){return s.zerosLike(t)}}})}}),n.rsqrt=a.op({rsqrt_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;rsqrt&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.rsqrt(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.pow(1.5).mul(2)).neg()}}})}}),n.sigmoid=a.op({sigmoid_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;sigmoid&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.sigmoid(e);return n([r]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.mul(s.scalar(1).sub(n)))}}})}}),n.sign=a.op({sign_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;sign&quot;);return r.ENGINE.runKernel(function(t){return t.sign(e)},{$x:e},function(t){return{$x:function(){return s.zerosLike(t)}}})}}),n.isNaN=a.op({isNaN_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;isNaN&quot;);return r.ENGINE.runKernel(function(t){return t.isNaN(e)},{$x:e},function(t){return{$x:function(){return s.zerosLike(t)}}})}}),n.isInf=a.op({isInf_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;isInf&quot;);return r.ENGINE.runKernel(function(t){return t.isInf(e)},{$x:e},function(t){return{$x:function(){return s.zerosLike(t)}}})}}),n.isFinite=a.op({isFinite_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;isFinite&quot;);return r.ENGINE.runKernel(function(t){return t.isFinite(e)},{$x:e},function(t){return{$x:function(){return s.zerosLike(t)}}})}}),n.sin=a.op({sin_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;sin&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.sin(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return n.toFloat().cos().mul(t)}}})}}),n.sinh=a.op({sinh_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;sinh&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.sinh(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return n.toFloat().cosh().mulStrict(t)}}})}}),n.softplus=a.op({softplus_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;softplus&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.softplus(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.sigmoid())}}})}}),n.sqrt=a.op({sqrt_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;sqrt&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.sqrt(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.toFloat().sqrt().mul(2))}}})}}),n.square=a.op({square_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;square&quot;);return r.ENGINE.runKernel(function(t,n){return n([e]),t.square(e)},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.toFloat().mul(2))}}})}}),n.step=a.op({step_:function(t,e){void 0===e&amp;&amp;(e=0);var n=i.convertToTensor(t,&quot;x&quot;,&quot;step&quot;);return r.ENGINE.runKernel(function(t){return t.step(n,e)},{$x:n},function(t){return{$x:function(){return s.zerosLike(t)}}})}}),n.tan=a.op({tan_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;tan&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.tan(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.cos().square())}}})}}),n.tanh=a.op({tanh_:function(t){var e=i.convertToTensor(t,&quot;x&quot;,&quot;tanh&quot;);return r.ENGINE.runKernel(function(t,n){var r=t.tanh(e);return n([r]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return s.scalar(1).sub(n.square()).mulStrict(t)}}})}})},{&quot;../engine&quot;:133,&quot;../tensor_util_env&quot;:219,&quot;../util&quot;:223,&quot;./operation&quot;:180,&quot;./tensor_ops&quot;:200}],204:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../engine&quot;),a=t(&quot;../globals&quot;),s=t(&quot;../ops/ops&quot;),u=t(&quot;../serialization&quot;),l=function(t){function e(e,n,r){void 0===r&amp;&amp;(r=null);var i=t.call(this)||this;return i.learningRate=e,i.rho=n,i.epsilon=r,i.accumulatedGrads={},i.accumulatedUpdates={},null==r&amp;&amp;(i.epsilon=o.ENGINE.backend.epsilon()),i}return i(e,t),e.prototype.applyGradients=function(t){var e=this,n=function(n){var i=o.ENGINE.registeredVariables[n];if(null==r.accumulatedGrads[n]){a.tidy(function(){e.accumulatedGrads[n]=s.zerosLike(i).variable(!1)})}if(null==r.accumulatedUpdates[n]){a.tidy(function(){e.accumulatedUpdates[n]=s.zerosLike(i).variable(!1)})}var u=t[n],l=r.accumulatedGrads[n],c=r.accumulatedUpdates[n];a.tidy(function(){var t=l.mul(e.rho).add(u.square().mul(1-e.rho)),r=c.add(e.epsilon).sqrt().div(l.add(e.epsilon).sqrt()).mul(u),o=c.mul(e.rho).add(r.square().mul(1-e.rho));e.accumulatedGrads[n].assign(t),e.accumulatedUpdates[n].assign(o);var a=r.mul(-e.learningRate).add(i);i.assign(a)})},r=this;for(var i in t)n(i)},e.prototype.dispose=function(){var t=this;null!=this.accumulatedUpdates&amp;&amp;(Object.keys(this.accumulatedUpdates).forEach(function(e){return t.accumulatedUpdates[e].dispose()}),Object.keys(this.accumulatedGrads).forEach(function(e){return t.accumulatedGrads[e].dispose()}))},e.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},e.fromConfig=function(t,e){return new t(e.learningRate,e.rho,e.epsilon)},e.className=&quot;AdadeltaOptimizer&quot;,e}(t(&quot;./optimizer&quot;).Optimizer);n.AdadeltaOptimizer=l,u.registerClass(l)},{&quot;../engine&quot;:133,&quot;../globals&quot;:136,&quot;../ops/ops&quot;:181,&quot;../serialization&quot;:214,&quot;./optimizer&quot;:209}],205:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../engine&quot;),a=t(&quot;../globals&quot;),s=t(&quot;../ops/ops&quot;),u=t(&quot;../serialization&quot;),l=function(t){function e(e,n){void 0===n&amp;&amp;(n=.1);var r=t.call(this)||this;return r.learningRate=e,r.initialAccumulatorValue=n,r.accumulatedGrads={},r}return i(e,t),e.prototype.applyGradients=function(t){var e=this,n=function(n){var i=o.ENGINE.registeredVariables[n];if(null==r.accumulatedGrads[n]){a.tidy(function(){e.accumulatedGrads[n]=s.fill(i.shape,e.initialAccumulatorValue).variable(!1)})}var u=t[n],l=r.accumulatedGrads[n];a.tidy(function(){var t=l.add(u.square());e.accumulatedGrads[n].assign(t);var r=u.div(t.add(o.ENGINE.backend.epsilon()).sqrt()).mul(-e.learningRate).add(i);i.assign(r)})},r=this;for(var i in t)n(i)},e.prototype.dispose=function(){var t=this;null!=this.accumulatedGrads&amp;&amp;Object.keys(this.accumulatedGrads).forEach(function(e){return t.accumulatedGrads[e].dispose()})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},e.fromConfig=function(t,e){return new t(e.learningRate,e.initialAccumulatorValue)},e.className=&quot;AdagradOptimizer&quot;,e}(t(&quot;./optimizer&quot;).Optimizer);n.AdagradOptimizer=l,u.registerClass(l)},{&quot;../engine&quot;:133,&quot;../globals&quot;:136,&quot;../ops/ops&quot;:181,&quot;../serialization&quot;:214,&quot;./optimizer&quot;:209}],206:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../engine&quot;),a=t(&quot;../globals&quot;),s=t(&quot;../ops/ops&quot;),u=t(&quot;../serialization&quot;),l=function(t){function e(e,n,r,i){void 0===i&amp;&amp;(i=null);var u=t.call(this)||this;return u.learningRate=e,u.beta1=n,u.beta2=r,u.epsilon=i,u.accumulatedFirstMoment={},u.accumulatedSecondMoment={},a.tidy(function(){u.accBeta1=s.scalar(n).variable(),u.accBeta2=s.scalar(r).variable()}),null==i&amp;&amp;(u.epsilon=o.ENGINE.backend.epsilon()),u}return i(e,t),e.prototype.applyGradients=function(t){var e=this;a.tidy(function(){var n=s.sub(1,e.accBeta1),r=s.sub(1,e.accBeta2);for(var i in t){var a=o.ENGINE.registeredVariables[i];if(null==e.accumulatedFirstMoment[i]){var u=!1;e.accumulatedFirstMoment[i]=s.zerosLike(a).variable(u)}if(null==e.accumulatedSecondMoment[i]){u=!1;e.accumulatedSecondMoment[i]=s.zerosLike(a).variable(u)}var l=t[i],c=e.accumulatedFirstMoment[i],f=e.accumulatedSecondMoment[i],p=c.mul(e.beta1).add(l.mul(1-e.beta1)),h=f.mul(e.beta2).add(l.square().mul(1-e.beta2)),d=p.div(n),m=h.div(r);e.accumulatedFirstMoment[i].assign(p),e.accumulatedSecondMoment[i].assign(h);var g=d.div(m.sqrt().add(e.epsilon)).mul(-e.learningRate).add(a);a.assign(g)}e.accBeta1.assign(e.accBeta1.mul(e.beta1)),e.accBeta2.assign(e.accBeta2.mul(e.beta2))})},e.prototype.dispose=function(){var t=this;this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&amp;&amp;Object.keys(this.accumulatedFirstMoment).forEach(function(e){return t.accumulatedFirstMoment[e].dispose()}),null!=this.accumulatedSecondMoment&amp;&amp;Object.keys(this.accumulatedSecondMoment).forEach(function(e){return t.accumulatedSecondMoment[e].dispose()})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},e.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon)},e.className=&quot;AdamOptimizer&quot;,e}(t(&quot;./optimizer&quot;).Optimizer);n.AdamOptimizer=l,u.registerClass(l)},{&quot;../engine&quot;:133,&quot;../globals&quot;:136,&quot;../ops/ops&quot;:181,&quot;../serialization&quot;:214,&quot;./optimizer&quot;:209}],207:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../engine&quot;),a=t(&quot;../globals&quot;),s=t(&quot;../ops/ops&quot;),u=t(&quot;../serialization&quot;),l=function(t){function e(e,n,r,i,u){void 0===i&amp;&amp;(i=null),void 0===u&amp;&amp;(u=0);var l=t.call(this)||this;return l.learningRate=e,l.beta1=n,l.beta2=r,l.epsilon=i,l.decay=u,l.accumulatedFirstMoment={},l.accumulatedWeightedInfNorm={},a.tidy(function(){l.iteration=s.scalar(0).variable(),l.accBeta1=s.scalar(n).variable()}),null==i&amp;&amp;(l.epsilon=o.ENGINE.backend.epsilon()),l}return i(e,t),e.prototype.applyGradients=function(t){var e=this;a.tidy(function(){var n=s.sub(1,e.accBeta1),r=s.div(-e.learningRate,e.iteration.mul(e.decay).add(1));for(var i in t){var a=o.ENGINE.registeredVariables[i];if(null==e.accumulatedFirstMoment[i]){var u=!1;e.accumulatedFirstMoment[i]=s.zerosLike(a).variable(u)}if(null==e.accumulatedWeightedInfNorm[i]){u=!1;e.accumulatedWeightedInfNorm[i]=s.zerosLike(a).variable(u)}var l=t[i],c=e.accumulatedFirstMoment[i],f=e.accumulatedWeightedInfNorm[i],p=c.mul(e.beta1).add(l.mul(1-e.beta1)),h=f.mul(e.beta2),d=l.abs(),m=h.maximum(d);e.accumulatedFirstMoment[i].assign(p),e.accumulatedWeightedInfNorm[i].assign(m);var g=r.div(n).mul(p.div(m.add(e.epsilon))).add(a);a.assign(g)}e.iteration.assign(e.iteration.add(1)),e.accBeta1.assign(e.accBeta1.mul(e.beta1))})},e.prototype.dispose=function(){var t=this;this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&amp;&amp;Object.keys(this.accumulatedFirstMoment).forEach(function(e){return t.accumulatedFirstMoment[e].dispose()}),null!=this.accumulatedWeightedInfNorm&amp;&amp;Object.keys(this.accumulatedWeightedInfNorm).forEach(function(e){return t.accumulatedWeightedInfNorm[e].dispose()})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},e.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon,e.decay)},e.className=&quot;AdamaxOptimizer&quot;,e}(t(&quot;./optimizer&quot;).Optimizer);n.AdamaxOptimizer=l,u.registerClass(l)},{&quot;../engine&quot;:133,&quot;../globals&quot;:136,&quot;../ops/ops&quot;:181,&quot;../serialization&quot;:214,&quot;./optimizer&quot;:209}],208:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../engine&quot;),a=t(&quot;../globals&quot;),s=t(&quot;../ops/ops&quot;),u=t(&quot;../serialization&quot;),l=function(t){function e(e,n,r){void 0===r&amp;&amp;(r=!1);var i=t.call(this,e)||this;return i.learningRate=e,i.momentum=n,i.useNesterov=r,i.m=s.scalar(i.momentum),i.accumulations={},i}return i(e,t),e.prototype.applyGradients=function(t){var e=this,n=function(n){var i=o.ENGINE.registeredVariables[n];if(null==r.accumulations[n]){a.tidy(function(){e.accumulations[n]=s.zerosLike(i).variable(!1)})}var u=r.accumulations[n],l=t[n];a.tidy(function(){var t,r=e.m.mul(u).add(l);t=e.useNesterov?e.c.mul(l.add(r.mul(e.m))).add(i):e.c.mul(r).add(i),e.accumulations[n].assign(r),i.assign(t)})},r=this;for(var i in t)n(i)},e.prototype.dispose=function(){if(t.prototype.dispose.call(this),this.m.dispose(),null!=this.accumulations)for(var e in this.accumulations)this.accumulations[e].dispose()},e.prototype.setMomentum=function(t){this.momentum=t},e.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},e.fromConfig=function(t,e){return new t(e.learningRate,e.momentum,e.useNesterov)},e.className=&quot;MomentumOptimizer&quot;,e}(t(&quot;./sgd_optimizer&quot;).SGDOptimizer);n.MomentumOptimizer=l,u.registerClass(l)},{&quot;../engine&quot;:133,&quot;../globals&quot;:136,&quot;../ops/ops&quot;:181,&quot;../serialization&quot;:214,&quot;./sgd_optimizer&quot;:212}],209:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../gradients&quot;),a=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.minimize=function(t,e,n){void 0===e&amp;&amp;(e=!1);var r=this.computeGradients(t,n),i=r.value,o=r.grads;return this.applyGradients(o),Object.keys(o).forEach(function(t){return o[t].dispose()}),e?i:(i.dispose(),null)},e.prototype.computeGradients=function(t,e){return o.variableGrads(t,e)},e.prototype.dispose=function(){},e}(t(&quot;../serialization&quot;).Serializable);n.Optimizer=a,Object.defineProperty(a,Symbol.hasInstance,{value:function(t){return null!=t.minimize&amp;&amp;null!=t.computeGradients&amp;&amp;null!=t.applyGradients}})},{&quot;../gradients&quot;:137,&quot;../serialization&quot;:214}],210:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./adadelta_optimizer&quot;),i=t(&quot;./adagrad_optimizer&quot;),o=t(&quot;./adam_optimizer&quot;),a=t(&quot;./adamax_optimizer&quot;),s=t(&quot;./momentum_optimizer&quot;),u=t(&quot;./rmsprop_optimizer&quot;),l=t(&quot;./sgd_optimizer&quot;),c=function(){function t(){}return t.sgd=function(t){return new l.SGDOptimizer(t)},t.momentum=function(t,e,n){return void 0===n&amp;&amp;(n=!1),new s.MomentumOptimizer(t,e,n)},t.rmsprop=function(t,e,n,r,i){return void 0===e&amp;&amp;(e=.9),void 0===n&amp;&amp;(n=0),void 0===r&amp;&amp;(r=null),void 0===i&amp;&amp;(i=!1),new u.RMSPropOptimizer(t,e,n,r,i)},t.adam=function(t,e,n,r){return void 0===t&amp;&amp;(t=.001),void 0===e&amp;&amp;(e=.9),void 0===n&amp;&amp;(n=.999),void 0===r&amp;&amp;(r=null),new o.AdamOptimizer(t,e,n,r)},t.adadelta=function(t,e,n){return void 0===t&amp;&amp;(t=.001),void 0===e&amp;&amp;(e=.95),void 0===n&amp;&amp;(n=null),new r.AdadeltaOptimizer(t,e,n)},t.adamax=function(t,e,n,r,i){return void 0===t&amp;&amp;(t=.002),void 0===e&amp;&amp;(e=.9),void 0===n&amp;&amp;(n=.999),void 0===r&amp;&amp;(r=null),void 0===i&amp;&amp;(i=0),new a.AdamaxOptimizer(t,e,n,r,i)},t.adagrad=function(t,e){return void 0===e&amp;&amp;(e=.1),new i.AdagradOptimizer(t,e)},t}();n.OptimizerConstructors=c},{&quot;./adadelta_optimizer&quot;:204,&quot;./adagrad_optimizer&quot;:205,&quot;./adam_optimizer&quot;:206,&quot;./adamax_optimizer&quot;:207,&quot;./momentum_optimizer&quot;:208,&quot;./rmsprop_optimizer&quot;:211,&quot;./sgd_optimizer&quot;:212}],211:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../engine&quot;),a=t(&quot;../globals&quot;),s=t(&quot;../ops/ops&quot;),u=t(&quot;../serialization&quot;),l=function(t){function e(e,n,r,i,a){void 0===n&amp;&amp;(n=.9),void 0===r&amp;&amp;(r=0),void 0===i&amp;&amp;(i=null),void 0===a&amp;&amp;(a=!1);var s=t.call(this)||this;return s.learningRate=e,s.decay=n,s.momentum=r,s.epsilon=i,s.accumulatedMeanSquares={},s.accumulatedMeanGrads={},s.accumulatedMoments={},s.centered=a,null==i&amp;&amp;(s.epsilon=o.ENGINE.backend.epsilon()),s}return i(e,t),e.prototype.applyGradients=function(t){var e=this,n=function(n){var i=o.ENGINE.registeredVariables[n];if(null==r.accumulatedMeanSquares[n]){a.tidy(function(){e.accumulatedMeanSquares[n]=s.zerosLike(i).variable(!1)})}if(null==r.accumulatedMeanGrads[n]&amp;&amp;r.centered){a.tidy(function(){e.accumulatedMeanGrads[n]=s.zerosLike(i).variable(!1)})}if(null==r.accumulatedMoments[n]){a.tidy(function(){e.accumulatedMoments[n]=s.zerosLike(i).variable(!1)})}var u=r.accumulatedMeanSquares[n],l=r.accumulatedMeanGrads[n],c=r.accumulatedMoments[n],f=t[n];a.tidy(function(){var t=u.mul(e.decay).add(f.square().mul(1-e.decay));if(e.centered){var r=l.mul(e.decay).add(f.mul(1-e.decay)),o=c.mul(e.momentum).add(f.mul(e.learningRate).div(t.sub(r.square().add(e.epsilon)).sqrt()));e.accumulatedMeanSquares[n].assign(t),e.accumulatedMeanGrads[n].assign(r),e.accumulatedMoments[n].assign(o);var a=i.sub(o);i.assign(a)}else{var s=u.mul(e.decay).add(f.square().mul(1-e.decay));o=c.mul(e.momentum).add(f.mul(e.learningRate).div(s.add(e.epsilon).sqrt()));e.accumulatedMeanSquares[n].assign(s),e.accumulatedMoments[n].assign(o);a=i.sub(o);i.assign(a)}})},r=this;for(var i in t)n(i)},e.prototype.dispose=function(){var t=this;null!=this.accumulatedMeanSquares&amp;&amp;Object.keys(this.accumulatedMeanSquares).forEach(function(e){return t.accumulatedMeanSquares[e].dispose()}),null!=this.accumulatedMeanGrads&amp;&amp;this.centered&amp;&amp;Object.keys(this.accumulatedMeanGrads).forEach(function(e){return t.accumulatedMeanGrads[e].dispose()}),null!=this.accumulatedMoments&amp;&amp;Object.keys(this.accumulatedMoments).forEach(function(e){return t.accumulatedMoments[e].dispose()})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},e.fromConfig=function(t,e){return new t(e.learningRate,e.decay,e.momentum,e.epsilon,e.centered)},e.className=&quot;RMSPropOptimizer&quot;,e}(t(&quot;./optimizer&quot;).Optimizer);n.RMSPropOptimizer=l,u.registerClass(l)},{&quot;../engine&quot;:133,&quot;../globals&quot;:136,&quot;../ops/ops&quot;:181,&quot;../serialization&quot;:214,&quot;./optimizer&quot;:209}],212:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;../engine&quot;),a=t(&quot;../globals&quot;),s=t(&quot;../ops/ops&quot;),u=t(&quot;../serialization&quot;),l=function(t){function e(e){var n=t.call(this)||this;return n.learningRate=e,n.setLearningRate(e),n}return i(e,t),e.prototype.applyGradients=function(t){var e=this;Object.keys(t).forEach(function(n){var r=t[n],i=o.ENGINE.registeredVariables[n];a.tidy(function(){var t=e.c.mul(r).add(i);i.assign(t)})})},e.prototype.setLearningRate=function(t){this.learningRate=t,null!=this.c&amp;&amp;this.c.dispose(),this.c=a.keep(s.scalar(-t))},e.prototype.dispose=function(){this.c.dispose()},e.prototype.getConfig=function(){return{learningRate:this.learningRate}},e.fromConfig=function(t,e){return new t(e.learningRate)},e.className=&quot;SGDOptimizer&quot;,e}(t(&quot;./optimizer&quot;).Optimizer);n.SGDOptimizer=l,u.registerClass(l)},{&quot;../engine&quot;:133,&quot;../globals&quot;:136,&quot;../ops/ops&quot;:181,&quot;../serialization&quot;:214,&quot;./optimizer&quot;:209}],213:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./util&quot;),i=function(){function t(t,e){this.backendTimer=t,this.logger=e,null==e&amp;&amp;(this.logger=new o)}return t.prototype.profileKernel=function(t,e){var n,i=this,o=this.backendTimer.time(function(){n=e()});return(Array.isArray(n)?n:[n]).forEach(function(e){var n=e.dataSync();r.checkComputationForErrors(n,e.dtype,t),o.then(function(r){var o=&quot;&quot;;null!=r.getExtraProfileInfo&amp;&amp;(o=r.getExtraProfileInfo()),i.logger.logKernelProfile(t,e,n,r.kernelMs,o)})}),n},t}();n.Profiler=i;var o=function(){function t(){}return t.prototype.logKernelProfile=function(t,e,n,i,o){var a=r.rightPad(i+&quot;ms&quot;,9),s=r.rightPad(t,25),u=e.rank,l=e.size,c=r.rightPad(e.shape.toString(),14);console.log(&quot;%c&quot;+s+&quot;\t%c&quot;+a+&quot;\t%c&quot;+u+&quot;D &quot;+c+&quot;\t%c&quot;+l+&quot;\t%c&quot;+o,&quot;font-weight:bold&quot;,&quot;color:red&quot;,&quot;color:blue&quot;,&quot;color: orange&quot;,&quot;color: green&quot;)},t}();n.Logger=o},{&quot;./util&quot;:223}],214:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./util&quot;),i=function(){function t(){}return t.prototype.getClassName=function(){return this.constructor.className},t.fromConfig=function(t,e){return new t(e)},t}();n.Serializable=i;var o=function(){function t(){this.classNameMap={}}return t.getMap=function(){return null==t.instance&amp;&amp;(t.instance=new t),t.instance},t.register=function(e){t.getMap().classNameMap[e.className]=[e,e.fromConfig]},t}();n.SerializationMap=o,n.registerClass=function(t){r.assert(null!=t.className,function(){return&quot;Class being registered does not have the static className property defined.&quot;}),r.assert(&quot;string&quot;==typeof t.className,function(){return&quot;className is required to be a string, but got type &quot;+typeof t.className}),r.assert(t.className.length&gt;0,function(){return&quot;Class being registered has an empty-string as its className, which is disallowed.&quot;}),o.register(t)}},{&quot;./util&quot;:223}],215:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./tensor&quot;),i=t(&quot;./util&quot;);n.getFilteredNodesXToY=function(t,e,n){for(var r={},i={},o=0;o&lt;e.length;o++)r[e[o].id]=!0;for(o=0;o&lt;t.length;o++){var a=(d=t[o]).inputs;for(var s in a){for(var u=a[s],l=!1,c=0;c&lt;e.length;c++)if(r[u.id]){d.outputs.forEach(function(t){return r[t.id]=!0}),l=!0,i[d.id]=!0;break}if(l)break}}var f={};f[n.id]=!0;var p={};for(o=t.length-1;o&gt;=0;o--)for(a=(d=t[o]).inputs,c=0;c&lt;d.outputs.length;c++)if(f[d.outputs[c].id]){for(var s in a)f[a[s].id]=!0,p[d.id]=!0;break}var h=[];for(o=0;o&lt;t.length;o++){var d;if(i[(d=t[o]).id]&amp;&amp;p[d.id]){var m={};for(var s in d.inputs){var g=d.inputs[s];r[g.id]&amp;&amp;(m[s]=g)}var v=Object.assign({},d);v.inputs=m,v.outputs=d.outputs,h.push(v)}}return h},n.backpropagateGradients=function(t,e,n){for(var o=function(o){var a=e[o],s=[];if(a.outputs.forEach(function(e){var n=t[e.id];if(null!=n)s.push(n);else{var o=r.Tensor.make(e.shape,{values:i.makeZerosTypedArray(e.size,e.dtype)},e.dtype);s.push(o)}}),null==a.gradient)throw new Error(&quot;Cannot compute gradient: gradient function not found for &quot;+a.name+&quot;.&quot;);var u=a.gradient(1===a.outputs.length?s[0]:s),l=function(e){if(!(e in u))throw new Error(&quot;Cannot backprop through input &quot;+e+&quot;. Available gradients found: &quot;+Object.keys(u)+&quot;.&quot;);var r=n(function(){return u[e]()});if(&quot;float32&quot;!==r.dtype)throw new Error(&quot;Error in gradient for op &quot;+a.name+&quot;. The gradient of input &quot;+e+&quot; must have &apos;float32&apos; dtype, but has &apos;&quot;+r.dtype+&quot;&apos;&quot;);var o=a.inputs[e];if(!i.arraysEqual(r.shape,o.shape))throw new Error(&quot;Error in gradient for op &quot;+a.name+&quot;. The gradient of input &apos;&quot;+e+&quot;&apos; has shape &apos;&quot;+r.shape+&quot;&apos;, which does not match the shape of the input &apos;&quot;+o.shape+&quot;&apos;&quot;);if(null==t[o.id])t[o.id]=r;else{var s=t[o.id];t[o.id]=s.add(r),s.dispose()}};for(var c in a.inputs)l(c)},a=e.length-1;a&gt;=0;a--)o(a)}},{&quot;./tensor&quot;:216,&quot;./util&quot;:223}],216:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;./tensor_format&quot;),u=t(&quot;./util&quot;),l=t(&quot;./util&quot;),c=function(){function t(t,e,n){var r=this;if(this.dtype=e,this.shape=t.slice(),this.size=u.sizeFromShape(t),null!=n){var i=n.length;u.assert(i===this.size,function(){return&quot;Length of values &apos;&quot;+i+&quot;&apos; does not match the size inferred by the shape &apos;&quot;+r.size+&quot;&apos;.&quot;})}if(&quot;complex64&quot;===e)throw new Error(&quot;complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).&quot;);this.values=n||u.getArrayFromDType(e,this.size),this.strides=l.computeStrides(t)}return t.prototype.set=function(t){for(var e=this,n=[],r=1;r&lt;arguments.length;r++)n[r-1]=arguments[r];0===n.length&amp;&amp;(n=[0]),u.assert(n.length===this.rank,function(){return&quot;The number of provided coordinates (&quot;+n.length+&quot;) must match the rank (&quot;+e.rank+&quot;)&quot;});var i=this.locToIndex(n);this.values[i]=t},t.prototype.get=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];0===t.length&amp;&amp;(t=[0]);for(var n=0,r=0,i=t;r&lt;i.length;r++){var o=i[r];if(o&lt;0||o&gt;=this.shape[n]){var a=&quot;Requested out of range element at &quot;+t+&quot;.   Buffer shape=&quot;+this.shape;throw new Error(a)}n++}for(var s=t[t.length-1],u=0;u&lt;t.length-1;++u)s+=this.strides[u]*t[u];return this.values[s]},t.prototype.locToIndex=function(t){if(0===this.rank)return 0;if(1===this.rank)return t[0];for(var e=t[t.length-1],n=0;n&lt;t.length-1;++n)e+=this.strides[n]*t[n];return e},t.prototype.indexToLoc=function(t){if(0===this.rank)return[];if(1===this.rank)return[t];for(var e=new Array(this.shape.length),n=0;n&lt;e.length-1;++n)e[n]=Math.floor(t/this.strides[n]),t-=e[n]*this.strides[n];return e[e.length-1]=t,e},Object.defineProperty(t.prototype,&quot;rank&quot;,{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),t.prototype.toTensor=function(){return d.make(this.shape,{values:this.values},this.dtype)},t}();n.TensorBuffer=c;var f=null,p=null,h=null;n.setTensorTracker=function(t){f=t},n.setOpHandler=function(t){p=t},n.setDeprecationWarningFn=function(t){h=t};var d=function(){function t(t,e,n,r,i){this.kept=!1,this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=e||&quot;float32&quot;,this.size=u.sizeFromShape(t),this.strides=l.computeStrides(t),this.dataId=null!=r?r:{},this.id=f().nextTensorId(),this.rankType=this.rank&lt;5?this.rank.toString():&quot;higher&quot;,f().registerTensor(this,i),null!=n&amp;&amp;f().write(this.dataId,n)}return t.make=function(e,n,r,i){return new t(e,r,n.values,n.dataId,i)},t.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},t.prototype.asScalar=function(){return this.throwIfDisposed(),u.assert(1===this.size,function(){return&quot;The array must have only 1 element.&quot;}),this.reshape([])},t.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},t.prototype.as2D=function(t,e){return this.throwIfDisposed(),this.reshape([t,e])},t.prototype.as3D=function(t,e,n){return this.throwIfDisposed(),this.reshape([t,e,n])},t.prototype.as4D=function(t,e,n,r){return this.throwIfDisposed(),this.reshape([t,e,n,r])},t.prototype.as5D=function(t,e,n,r,i){return this.throwIfDisposed(),this.reshape([t,e,n,r,i])},t.prototype.asType=function(t){return this.throwIfDisposed(),p.cast(this,t)},Object.defineProperty(t.prototype,&quot;rank&quot;,{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),t.prototype.buffer=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,p.buffer(this.shape,this.dtype,t)]}})})},t.prototype.bufferSync=function(){return p.buffer(this.shape,this.dtype,this.dataSync())},t.prototype.array=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,l.toNestedArray(this.shape,t)]}})})},t.prototype.arraySync=function(){return l.toNestedArray(this.shape,this.dataSync())},t.prototype.data=function(){return o(this,void 0,void 0,function(){return a(this,function(t){return this.throwIfDisposed(),[2,f().read(this.dataId)]})})},t.prototype.dataSync=function(){return this.throwIfDisposed(),f().readSync(this.dataId)},t.prototype.dispose=function(){this.isDisposed||(f().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(t.prototype,&quot;isDisposed&quot;,{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),t.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error(&quot;Tensor is disposed.&quot;)},t.prototype.toFloat=function(){return this.asType(&quot;float32&quot;)},t.prototype.toInt=function(){return this.asType(&quot;int32&quot;)},t.prototype.toBool=function(){return this.asType(&quot;bool&quot;)},t.prototype.print=function(t){return void 0===t&amp;&amp;(t=!1),p.print(this,t)},t.prototype.reshape=function(t){return this.throwIfDisposed(),p.reshape(this,t)},t.prototype.reshapeAs=function(t){return this.throwIfDisposed(),this.reshape(t.shape)},t.prototype.expandDims=function(t){return void 0===t&amp;&amp;(t=0),p.expandDims(this,t)},t.prototype.cumsum=function(t,e,n){return void 0===t&amp;&amp;(t=0),void 0===e&amp;&amp;(e=!1),void 0===n&amp;&amp;(n=!1),p.cumsum(this,t,e,n)},t.prototype.squeeze=function(t){return this.throwIfDisposed(),p.squeeze(this,t)},t.prototype.clone=function(){return this.throwIfDisposed(),p.clone(this)},t.prototype.oneHot=function(t,e,n){return this.throwIfDisposed(),p.oneHot(this,t,e,n)},t.prototype.toString=function(t){void 0===t&amp;&amp;(t=!1);var e=this.dataSync();return s.tensorToString(e,this.shape,this.dtype,t)},t.prototype.tile=function(t){return this.throwIfDisposed(),p.tile(this,t)},t.prototype.gather=function(t,e){return void 0===e&amp;&amp;(e=0),this.throwIfDisposed(),p.gather(this,t,e)},t.prototype.matMul=function(t,e,n){return void 0===e&amp;&amp;(e=!1),void 0===n&amp;&amp;(n=!1),this.throwIfDisposed(),p.matMul(this,t,e,n)},t.prototype.dot=function(t){return this.throwIfDisposed(),p.dot(this,t)},t.prototype.norm=function(t,e,n){return void 0===t&amp;&amp;(t=&quot;euclidean&quot;),void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=!1),this.throwIfDisposed(),p.norm(this,t,e,n)},t.prototype.slice=function(t,e){return this.throwIfDisposed(),p.slice(this,t,e)},t.prototype.reverse=function(t){return this.throwIfDisposed(),p.reverse(this,t)},t.prototype.concat=function(e,n){return void 0===n&amp;&amp;(n=0),this.throwIfDisposed(),e instanceof t&amp;&amp;(e=[e]),p.concat([this].concat(e),n)},t.prototype.split=function(t,e){return void 0===e&amp;&amp;(e=0),this.throwIfDisposed(),p.split(this,t,e)},t.prototype.stack=function(t,e){return void 0===e&amp;&amp;(e=0),p.stack([this,t],e)},t.prototype.unstack=function(t){return void 0===t&amp;&amp;(t=0),p.unstack(this,t)},t.prototype.pad=function(t,e){return void 0===e&amp;&amp;(e=0),p.pad(this,t,e)},t.prototype.batchNormalization=function(t,e,n,r,i){return void 0===n&amp;&amp;(n=.001),h(&quot;tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon&quot;),this.batchNorm(t,e,i,r,n)},t.prototype.batchNorm=function(t,e,n,r,i){return void 0===i&amp;&amp;(i=.001),this.throwIfDisposed(),p.batchNorm(this,t,e,n,r,i)},t.prototype.all=function(t,e){return void 0===t&amp;&amp;(t=null),void 0===e&amp;&amp;(e=!1),this.throwIfDisposed(),p.all(this,t,e)},t.prototype.any=function(t,e){return void 0===t&amp;&amp;(t=null),void 0===e&amp;&amp;(e=!1),this.throwIfDisposed(),p.any(this,t,e)},t.prototype.logSumExp=function(t,e){return void 0===t&amp;&amp;(t=null),void 0===e&amp;&amp;(e=!1),this.throwIfDisposed(),p.logSumExp(this,t,e)},t.prototype.sum=function(t,e){return void 0===t&amp;&amp;(t=null),void 0===e&amp;&amp;(e=!1),this.throwIfDisposed(),p.sum(this,t,e)},t.prototype.prod=function(t,e){return void 0===t&amp;&amp;(t=null),void 0===e&amp;&amp;(e=!1),this.throwIfDisposed(),p.prod(this,t,e)},t.prototype.mean=function(t,e){return void 0===t&amp;&amp;(t=null),void 0===e&amp;&amp;(e=!1),this.throwIfDisposed(),p.mean(this,t,e)},t.prototype.min=function(t,e){return void 0===t&amp;&amp;(t=null),void 0===e&amp;&amp;(e=!1),this.throwIfDisposed(),p.min(this,t,e)},t.prototype.max=function(t,e){return void 0===t&amp;&amp;(t=null),void 0===e&amp;&amp;(e=!1),this.throwIfDisposed(),p.max(this,t,e)},t.prototype.argMin=function(t){return void 0===t&amp;&amp;(t=null),this.throwIfDisposed(),p.argMin(this,t)},t.prototype.argMax=function(t){return void 0===t&amp;&amp;(t=null),this.throwIfDisposed(),p.argMax(this,t)},t.prototype.cast=function(t){return this.throwIfDisposed(),p.cast(this,t)},t.prototype.add=function(t){return this.throwIfDisposed(),p.add(this,t)},t.prototype.addStrict=function(t){return this.throwIfDisposed(),p.addStrict(this,t)},t.prototype.atan2=function(t){return this.throwIfDisposed(),p.atan2(this,t)},t.prototype.sub=function(t){return this.throwIfDisposed(),p.sub(this,t)},t.prototype.subStrict=function(t){return this.throwIfDisposed(),p.subStrict(this,t)},t.prototype.pow=function(t){return this.throwIfDisposed(),p.pow(this,t)},t.prototype.powStrict=function(t){return this.throwIfDisposed(),p.powStrict(this,t)},t.prototype.mul=function(t){return this.throwIfDisposed(),p.mul(this,t)},t.prototype.mulStrict=function(t){return this.throwIfDisposed(),p.mulStrict(this,t)},t.prototype.div=function(t){return this.throwIfDisposed(),p.div(this,t)},t.prototype.floorDiv=function(t){return this.throwIfDisposed(),p.floorDiv(this,t)},t.prototype.divStrict=function(t){return this.throwIfDisposed(),p.divStrict(this,t)},t.prototype.minimum=function(t){return this.throwIfDisposed(),p.minimum(this,t)},t.prototype.minimumStrict=function(t){return this.throwIfDisposed(),p.minimumStrict(this,t)},t.prototype.maximum=function(t){return this.throwIfDisposed(),p.maximum(this,t)},t.prototype.maximumStrict=function(t){return this.throwIfDisposed(),p.maximumStrict(this,t)},t.prototype.mod=function(t){return this.throwIfDisposed(),p.mod(this,t)},t.prototype.modStrict=function(t){return this.throwIfDisposed(),p.modStrict(this,t)},t.prototype.squaredDifference=function(t){return this.throwIfDisposed(),p.squaredDifference(this,t)},t.prototype.squaredDifferenceStrict=function(t){return this.throwIfDisposed(),p.squaredDifferenceStrict(this,t)},t.prototype.transpose=function(t){return this.throwIfDisposed(),p.transpose(this,t)},t.prototype.notEqual=function(t){return this.throwIfDisposed(),p.notEqual(this,t)},t.prototype.notEqualStrict=function(t){return this.throwIfDisposed(),p.notEqualStrict(this,t)},t.prototype.less=function(t){return this.throwIfDisposed(),p.less(this,t)},t.prototype.lessStrict=function(t){return this.throwIfDisposed(),p.lessStrict(this,t)},t.prototype.equal=function(t){return this.throwIfDisposed(),p.equal(this,t)},t.prototype.equalStrict=function(t){return this.throwIfDisposed(),p.equalStrict(this,t)},t.prototype.lessEqual=function(t){return this.throwIfDisposed(),p.lessEqual(this,t)},t.prototype.lessEqualStrict=function(t){return this.throwIfDisposed(),p.lessEqualStrict(this,t)},t.prototype.greater=function(t){return this.throwIfDisposed(),p.greater(this,t)},t.prototype.greaterStrict=function(t){return this.throwIfDisposed(),p.greaterStrict(this,t)},t.prototype.greaterEqual=function(t){return this.throwIfDisposed(),p.greaterEqual(this,t)},t.prototype.greaterEqualStrict=function(t){return this.throwIfDisposed(),p.greaterEqualStrict(this,t)},t.prototype.logicalAnd=function(t){return this.throwIfDisposed(),p.logicalAnd(this,t)},t.prototype.logicalOr=function(t){return this.throwIfDisposed(),p.logicalOr(this,t)},t.prototype.logicalNot=function(){return this.throwIfDisposed(),p.logicalNot(this)},t.prototype.logicalXor=function(t){return this.throwIfDisposed(),p.logicalXor(this,t)},t.prototype.where=function(t,e){return this.throwIfDisposed(),p.where(t,this,e)},t.prototype.neg=function(){return this.throwIfDisposed(),p.neg(this)},t.prototype.ceil=function(){return this.throwIfDisposed(),p.ceil(this)},t.prototype.floor=function(){return this.throwIfDisposed(),p.floor(this)},t.prototype.sign=function(){return this.throwIfDisposed(),p.sign(this)},t.prototype.exp=function(){return this.throwIfDisposed(),p.exp(this)},t.prototype.expm1=function(){return this.throwIfDisposed(),p.expm1(this)},t.prototype.log=function(){return this.throwIfDisposed(),p.log(this)},t.prototype.log1p=function(){return this.throwIfDisposed(),p.log1p(this)},t.prototype.sqrt=function(){return this.throwIfDisposed(),p.sqrt(this)},t.prototype.rsqrt=function(){return this.throwIfDisposed(),p.rsqrt(this)},t.prototype.square=function(){return this.throwIfDisposed(),p.square(this)},t.prototype.reciprocal=function(){return this.throwIfDisposed(),p.reciprocal(this)},t.prototype.abs=function(){return this.throwIfDisposed(),p.abs(this)},t.prototype.clipByValue=function(t,e){return this.throwIfDisposed(),p.clipByValue(this,t,e)},t.prototype.relu=function(){return this.throwIfDisposed(),p.relu(this)},t.prototype.elu=function(){return this.throwIfDisposed(),p.elu(this)},t.prototype.selu=function(){return this.throwIfDisposed(),p.selu(this)},t.prototype.leakyRelu=function(t){return void 0===t&amp;&amp;(t=.2),this.throwIfDisposed(),p.leakyRelu(this,t)},t.prototype.prelu=function(t){return this.throwIfDisposed(),p.prelu(this,t)},t.prototype.sigmoid=function(){return this.throwIfDisposed(),p.sigmoid(this)},t.prototype.logSigmoid=function(){return this.throwIfDisposed(),p.logSigmoid(this)},t.prototype.softplus=function(){return this.throwIfDisposed(),p.softplus(this)},t.prototype.zerosLike=function(){return this.throwIfDisposed(),p.zerosLike(this)},t.prototype.onesLike=function(){return this.throwIfDisposed(),p.onesLike(this)},t.prototype.sin=function(){return this.throwIfDisposed(),p.sin(this)},t.prototype.cos=function(){return this.throwIfDisposed(),p.cos(this)},t.prototype.tan=function(){return this.throwIfDisposed(),p.tan(this)},t.prototype.asin=function(){return this.throwIfDisposed(),p.asin(this)},t.prototype.acos=function(){return this.throwIfDisposed(),p.acos(this)},t.prototype.atan=function(){return this.throwIfDisposed(),p.atan(this)},t.prototype.sinh=function(){return this.throwIfDisposed(),p.sinh(this)},t.prototype.cosh=function(){return this.throwIfDisposed(),p.cosh(this)},t.prototype.tanh=function(){return this.throwIfDisposed(),p.tanh(this)},t.prototype.asinh=function(){return this.throwIfDisposed(),p.asinh(this)},t.prototype.acosh=function(){return this.throwIfDisposed(),p.acosh(this)},t.prototype.atanh=function(){return this.throwIfDisposed(),p.atanh(this)},t.prototype.erf=function(){return this.throwIfDisposed(),p.erf(this)},t.prototype.round=function(){return this.throwIfDisposed(),p.round(this)},t.prototype.step=function(t){return void 0===t&amp;&amp;(t=0),this.throwIfDisposed(),p.step(this,t)},t.prototype.softmax=function(t){return void 0===t&amp;&amp;(t=-1),this.throwIfDisposed(),p.softmax(this,t)},t.prototype.logSoftmax=function(t){return void 0===t&amp;&amp;(t=-1),this.throwIfDisposed(),p.logSoftmax(this,t)},t.prototype.resizeBilinear=function(t,e){return void 0===e&amp;&amp;(e=!1),this.throwIfDisposed(),p.image.resizeBilinear(this,t,e)},t.prototype.resizeNearestNeighbor=function(t,e){return void 0===e&amp;&amp;(e=!1),this.throwIfDisposed(),p.image.resizeNearestNeighbor(this,t,e)},t.prototype.conv1d=function(t,e,n,r,i,o){return void 0===r&amp;&amp;(r=&quot;NWC&quot;),void 0===i&amp;&amp;(i=1),this.throwIfDisposed(),p.conv1d(this,t,e,n,r,i,o)},t.prototype.conv2d=function(t,e,n,r,i,o){return void 0===r&amp;&amp;(r=&quot;NHWC&quot;),void 0===i&amp;&amp;(i=[1,1]),this.throwIfDisposed(),p.conv2d(this,t,e,n,r,i,o)},t.prototype.conv2dTranspose=function(t,e,n,r,i){return this.throwIfDisposed(),p.conv2dTranspose(this,t,e,n,r,i)},t.prototype.depthwiseConv2D=function(t,e,n,r,i,o){return void 0===r&amp;&amp;(r=&quot;NHWC&quot;),void 0===i&amp;&amp;(i=[1,1]),this.throwIfDisposed(),p.depthwiseConv2d(this,t,e,n,r,i,o)},t.prototype.separableConv2d=function(t,e,n,r,i,o){return void 0===i&amp;&amp;(i=[1,1]),void 0===o&amp;&amp;(o=&quot;NHWC&quot;),this.throwIfDisposed(),p.separableConv2d(this,t,e,n,r,i,o)},t.prototype.avgPool=function(t,e,n,r){return this.throwIfDisposed(),p.avgPool(this,t,e,n,r)},t.prototype.maxPool=function(t,e,n,r){return this.throwIfDisposed(),p.maxPool(this,t,e,n,r)},t.prototype.localResponseNormalization=function(t,e,n,r){return void 0===t&amp;&amp;(t=5),void 0===e&amp;&amp;(e=1),void 0===n&amp;&amp;(n=1),void 0===r&amp;&amp;(r=.5),p.localResponseNormalization(this,t,e,n,r)},t.prototype.pool=function(t,e,n,r,i){return this.throwIfDisposed(),p.pool(this,t,e,n,r,i)},t.prototype.variable=function(t,e,n){return void 0===t&amp;&amp;(t=!0),this.throwIfDisposed(),m.variable(this,t,e,n)},t.prototype.unsortedSegmentSum=function(t,e){return this.throwIfDisposed(),p.unsortedSegmentSum(this,t,e)},t.prototype.batchToSpaceND=function(t,e){return this.throwIfDisposed(),p.batchToSpaceND(this,t,e)},t.prototype.spaceToBatchND=function(t,e){return this.throwIfDisposed(),p.spaceToBatchND(this,t,e)},t.prototype.topk=function(t,e){return void 0===t&amp;&amp;(t=1),void 0===e&amp;&amp;(e=!0),this.throwIfDisposed(),p.topk(this,t,e)},t.prototype.stridedSlice=function(t,e,n,r,i,o,a,s){return void 0===r&amp;&amp;(r=0),void 0===i&amp;&amp;(i=0),void 0===o&amp;&amp;(o=0),void 0===a&amp;&amp;(a=0),void 0===s&amp;&amp;(s=0),this.throwIfDisposed(),p.stridedSlice(this,t,e,n,r,i,o,a,s)},t.prototype.depthToSpace=function(t,e){return this.throwIfDisposed(),p.depthToSpace(this,t,e)},t.prototype.fft=function(){return this.throwIfDisposed(),p.spectral.fft(this)},t.prototype.ifft=function(){return this.throwIfDisposed(),p.spectral.ifft(this)},t.prototype.rfft=function(){return this.throwIfDisposed(),p.spectral.rfft(this)},t.prototype.irfft=function(){return this.throwIfDisposed(),p.spectral.irfft(this)},t}();n.Tensor=d,Object.defineProperty(d,Symbol.hasInstance,{value:function(t){return!!t&amp;&amp;null!=t.dataId&amp;&amp;null!=t.shape&amp;&amp;null!=t.dtype}});var m=function(t){function e(e,n,r){void 0===n&amp;&amp;(n=!0);var i=t.call(this,e.shape,e.dtype,null,e.dataId)||this;i.trainable=n,i.name=r,null==i.name&amp;&amp;(i.name=f().nextVariableId().toString());try{f().registerVariable(i)}catch(t){throw f().disposeTensor(i),t}return i}return i(e,t),e.variable=function(t,n,r,i){return void 0===n&amp;&amp;(n=!0),null!=i&amp;&amp;i!==t.dtype&amp;&amp;(t=t.asType(i)),new e(t,n,r)},e.prototype.assign=function(t){if(t.dtype!==this.dtype)throw new Error(&quot;dtype of the new value (&quot;+t.dtype+&quot;) and previous value (&quot;+this.dtype+&quot;) must match&quot;);if(!u.arraysEqual(t.shape,this.shape))throw new Error(&quot;shape of the new value (&quot;+t.shape+&quot;) and previous value (&quot;+this.shape+&quot;) must match&quot;);f().disposeTensor(this),this.dataId=t.dataId,f().registerTensor(this)},e}(d);n.Variable=m,Object.defineProperty(m,Symbol.hasInstance,{value:function(t){return t instanceof d&amp;&amp;null!=t.assign&amp;&amp;t.assign instanceof Function}});var g=m.variable;n.variable=g},{&quot;./tensor_format&quot;:217,&quot;./util&quot;:223}],217:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./util&quot;),i=20,o=3,a=7;function s(t,e,n){var i;return i=Array.isArray(t)?parseFloat(t[0].toFixed(a))+&quot; + &quot;+parseFloat(t[1].toFixed(a))+&quot;j&quot;:r.isString(t)?&quot;&apos;&quot;+t+&quot;&apos;&quot;:&quot;bool&quot;===n?u(t):parseFloat(t.toFixed(a)).toString(),r.rightPad(i,e)}function u(t){return 0===t?&quot;false&quot;:&quot;true&quot;}function l(t){for(var e=[],n=0;n&lt;t.length;n+=2)e.push([t[n],t[n+1]]);return e}n.tensorToString=function(t,e,n,a){var c=r.computeStrides(e),f=function(t,e,n,i){var o=r.sizeFromShape(e),a=i[i.length-1],u=new Array(a).fill(0),c=e.length,f=&quot;complex64&quot;===n?l(t):t;if(c&gt;1)for(var p=0;p&lt;o/a;p++)for(var h=p*a,d=0;d&lt;a;d++)u[d]=Math.max(u[d],s(f[h+d],0,n).length);return u}(t,e,n,c),p=e.length,h=function t(e,n,r,a,c,f){void 0===f&amp;&amp;(f=!0);var p=&quot;complex64&quot;===r?2:1,h=n[0],d=n.length;if(0===d){if(&quot;complex64&quot;===r){var m=l(e);return[s(m[0],0,r)]}return&quot;bool&quot;===r?[u(e[0])]:[e[0].toString()]}if(1===d){if(h&gt;i){var g=o*p,v=Array.from(e.slice(0,g)),y=Array.from(e.slice(h-o*p,h));return&quot;complex64&quot;===r&amp;&amp;(v=l(v),y=l(y)),[&quot;[&quot;+v.map(function(t,e){return s(t,c[e],r)}).join(&quot;, &quot;)+&quot;, ..., &quot;+y.map(function(t,e){return s(t,c[h-o+e],r)}).join(&quot;, &quot;)+&quot;]&quot;]}var b=&quot;complex64&quot;===r?l(e):Array.from(e);return[&quot;[&quot;+b.map(function(t,e){return s(t,c[e],r)}).join(&quot;, &quot;)+&quot;]&quot;]}var _=n.slice(1),w=a.slice(1),x=a[0]*p,E=[];if(h&gt;i){for(var k=0;k&lt;o;k++){var T=k*x,N=T+x;E.push.apply(E,t(e.slice(T,N),_,r,w,c,!1))}E.push(&quot;...&quot;);for(var k=h-o;k&lt;h;k++){var T=k*x,N=T+x;E.push.apply(E,t(e.slice(T,N),_,r,w,c,k===h-1))}}else for(var k=0;k&lt;h;k++){var T=k*x,N=T+x;E.push.apply(E,t(e.slice(T,N),_,r,w,c,k===h-1))}var S=2===d?&quot;,&quot;:&quot;&quot;;E[0]=&quot;[&quot;+E[0]+S;for(var k=1;k&lt;E.length-1;k++)E[k]=&quot; &quot;+E[k]+S;for(var C=&quot;,\n&quot;,k=2;k&lt;d;k++)C+=&quot;\n&quot;;return E[E.length-1]=&quot; &quot;+E[E.length-1]+&quot;]&quot;+(f?&quot;&quot;:C),E}(t,e,n,c,f),d=[&quot;Tensor&quot;];return a&amp;&amp;(d.push(&quot;  dtype: &quot;+n),d.push(&quot;  rank: &quot;+p),d.push(&quot;  shape: [&quot;+e+&quot;]&quot;),d.push(&quot;  values:&quot;)),d.push(h.map(function(t){return&quot;    &quot;+t}).join(&quot;\n&quot;)),d.join(&quot;\n&quot;)}},{&quot;./util&quot;:223}],218:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./tensor&quot;),i=t(&quot;./types&quot;),o=t(&quot;./util&quot;);n.makeTypesMatch=function(t,e){if(t.dtype===e.dtype)return[t,e];var n=i.upcastType(t.dtype,e.dtype);return[t.cast(n),e.cast(n)]},n.assertTypesMatch=function(t,e){o.assert(t.dtype===e.dtype,function(){return&quot;The dtypes of the first(&quot;+t.dtype+&quot;) and second(&quot;+e.dtype+&quot;) input must match&quot;})},n.isTensorInList=function(t,e){for(var n=0;n&lt;e.length;n++)if(e[n].id===t.id)return!0;return!1},n.getTensorsInContainer=function(t){var e=[];return function t(e,n,i){if(null!=e)if(e instanceof r.Tensor)n.push(e);else if(o=e,Array.isArray(o)||&quot;object&quot;==typeof o){var o,a=e;for(var s in a){var u=a[s];i.has(u)||(i.add(u),t(u,n,i))}}}(t,e,new Set),e}},{&quot;./tensor&quot;:216,&quot;./types&quot;:222,&quot;./util&quot;:223}],219:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./environment&quot;),i=t(&quot;./tensor&quot;),o=t(&quot;./util&quot;);function a(t){var e=t;if(o.isTypedArray(t))return[t.length];if(!Array.isArray(t))return[];for(var n=[];Array.isArray(e)||o.isTypedArray(e);)n.push(e.length),e=e[0];return Array.isArray(t)&amp;&amp;r.ENV.getBool(&quot;TENSORLIKE_CHECK_SHAPE_CONSISTENCY&quot;)&amp;&amp;function t(e,n,r){r=r||[];if(!Array.isArray(e)&amp;&amp;!o.isTypedArray(e))return void o.assert(0===n.length,function(){return&quot;Element arr[&quot;+r.join(&quot;][&quot;)+&quot;] is a primitive, but should be an array/TypedArray of &quot;+n[0]+&quot; elements&quot;});o.assert(n.length&gt;0,function(){return&quot;Element arr[&quot;+r.join(&quot;][&quot;)+&quot;] should be a primitive, but is an array of &quot;+e.length+&quot; elements&quot;});o.assert(e.length===n[0],function(){return&quot;Element arr[&quot;+r.join(&quot;][&quot;)+&quot;] should have &quot;+n[0]+&quot; elements, but has &quot;+e.length+&quot; elements&quot;});var i=n.slice(1);for(var a=0;a&lt;e.length;++a)t(e[a],i,r.concat(a))}(t,n,[]),n}function s(t,e,n,r){if(null!=t&amp;&amp;(&quot;numeric&quot;!==t&amp;&amp;t!==e||&quot;numeric&quot;===t&amp;&amp;&quot;string&quot;===e))throw new Error(&quot;Argument &apos;&quot;+n+&quot;&apos; passed to &apos;&quot;+r+&quot;&apos; must be &quot;+t+&quot; tensor, but got &quot;+e+&quot; tensor&quot;)}function u(t,e,n,u){if(void 0===u&amp;&amp;(u=&quot;numeric&quot;),t instanceof i.Tensor)return s(u,t.dtype,e,n),t;var l=o.inferDtype(t);if(&quot;string&quot;!==l&amp;&amp;[&quot;bool&quot;,&quot;int32&quot;,&quot;float32&quot;].indexOf(u)&gt;=0&amp;&amp;(l=u),s(u,l,e,n),null==t||!o.isTypedArray(t)&amp;&amp;!Array.isArray(t)&amp;&amp;&quot;number&quot;!=typeof t&amp;&amp;&quot;boolean&quot;!=typeof t&amp;&amp;&quot;string&quot;!=typeof t){var c=null==t?&quot;null&quot;:t.constructor.name;throw new Error(&quot;Argument &apos;&quot;+e+&quot;&apos; passed to &apos;&quot;+n+&quot;&apos; must be a Tensor or TensorLike, but got &apos;&quot;+c+&quot;&apos;&quot;)}var f=a(t);o.isTypedArray(t)||Array.isArray(t)||(t=[t]);var p=&quot;string&quot;!==l?o.toTypedArray(t,l,r.ENV.getBool(&quot;DEBUG&quot;)):o.flatten(t);return i.Tensor.make(f,{values:p},l)}n.inferShape=a,n.convertToTensor=u,n.convertToTensorArray=function(t,e,n,r){if(void 0===r&amp;&amp;(r=&quot;numeric&quot;),!Array.isArray(t))throw new Error(&quot;Argument &quot;+e+&quot; passed to &quot;+n+&quot; must be a `Tensor[]` or `TensorLike[]`&quot;);return t.map(function(t,r){return u(t,e+&quot;[&quot;+r+&quot;]&quot;,n)},r)}},{&quot;./environment&quot;:134,&quot;./tensor&quot;:216,&quot;./util&quot;:223}],220:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./engine&quot;),i=t(&quot;./tensor&quot;),o=t(&quot;./util&quot;),a=t(&quot;./util&quot;),s=.001;function u(t,e,n){return null==n&amp;&amp;(n=l()),c(t,&quot;number&quot;==typeof e||&quot;boolean&quot;==typeof e?[e]:e,function(t,e){return f(t,Number(e),n)})}function l(){return 32===r.ENGINE.backend.floatPrecision()?s:n.TEST_EPSILON_FLOAT16}function c(t,e,n){if(t instanceof i.Tensor||e instanceof i.Tensor){if(t instanceof i.Tensor&amp;&amp;e instanceof i.Tensor){if(t.dtype!==e.dtype)throw new Error(&quot;Arrays are of different type actual: &quot;+t.dtype+&quot; vs expected: &quot;+e.dtype+&quot;.&quot;);if(!o.arraysEqual(t.shape,e.shape))throw new Error(&quot;Arrays are of different shape actual: &quot;+t.shape+&quot; vs expected: &quot;+e.shape+&quot;.&quot;)}}else{var r=t.constructor.name,a=e.constructor.name;if(r!==a)throw new Error(&quot;Arrays are of different type actual: &quot;+r+&quot; vs expected: &quot;+a)}var s,u;if(s=t instanceof i.Tensor?t.dataSync():t,u=e instanceof i.Tensor?e.dataSync():e,s.length!==u.length)throw new Error(&quot;Arrays have different lengths actual: &quot;+s.length+&quot; vs expected: &quot;+u.length+&quot;.\nActual:   &quot;+s+&quot;.\nExpected: &quot;+u+&quot;.&quot;);for(var l=0;l&lt;u.length;++l){var c=s[l],f=u[l];if(!n(c,f))throw new Error(&quot;Arrays differ: actual[&quot;+l+&quot;] = &quot;+c+&quot;, expected[&quot;+l+&quot;] = &quot;+f+&quot;.\nActual:   &quot;+s+&quot;.\nExpected: &quot;+u+&quot;.&quot;)}}function f(t,e,n){return!isFinite(t)&amp;&amp;!isFinite(e)||!(isNaN(t)||isNaN(e)||Math.abs(t-e)&gt;n)}n.TEST_EPSILON_FLOAT16=.1,n.expectArraysClose=u,n.testEpsilon=l,n.expectPromiseToFail=function(t,e){t().then(function(){return e.fail()},function(){return e()})},n.expectArraysEqual=function(t,e){var n=&quot;string&quot;==typeof e||&quot;number&quot;==typeof e||&quot;boolean&quot;==typeof e?[e]:e;return t instanceof i.Tensor&amp;&amp;&quot;string&quot;===t.dtype||e instanceof i.Tensor&amp;&amp;&quot;string&quot;===e.dtype||Array.isArray(t)&amp;&amp;a.isString(t[0])||Array.isArray(e)&amp;&amp;a.isString(e[0])?c(t,n,function(t,e){return t==e}):u(t,e,0)},n.expectNumbersClose=function(t,e,n){if(null==n&amp;&amp;(n=l()),!f(t,e,n))throw new Error(&quot;Numbers differ: actual === &quot;+t+&quot;, expected === &quot;+e)},n.expectValuesInRange=function(t,e,n){var r;r=t instanceof i.Tensor?t.dataSync():t;for(var o=0;o&lt;r.length;o++)if(r[o]&lt;e||r[o]&gt;n)throw new Error(&quot;Value out of range:&quot;+r[o]+&quot; low: &quot;+e+&quot;, high: &quot;+n)},n.expectArrayBuffersEqual=function(t,e){expect(new Float32Array(t)).toEqual(new Float32Array(e))}},{&quot;./engine&quot;:133,&quot;./tensor&quot;:216,&quot;./util&quot;:223}],221:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./optimizers/adadelta_optimizer&quot;),i=t(&quot;./optimizers/adagrad_optimizer&quot;),o=t(&quot;./optimizers/adam_optimizer&quot;),a=t(&quot;./optimizers/adamax_optimizer&quot;),s=t(&quot;./optimizers/momentum_optimizer&quot;),u=t(&quot;./optimizers/optimizer_constructors&quot;),l=t(&quot;./optimizers/rmsprop_optimizer&quot;),c=t(&quot;./optimizers/sgd_optimizer&quot;);s.MomentumOptimizer,c.SGDOptimizer,r.AdadeltaOptimizer,i.AdagradOptimizer,l.RMSPropOptimizer,a.AdamaxOptimizer,o.AdamOptimizer,n.train={sgd:u.OptimizerConstructors.sgd,momentum:u.OptimizerConstructors.momentum,adadelta:u.OptimizerConstructors.adadelta,adagrad:u.OptimizerConstructors.adagrad,rmsprop:u.OptimizerConstructors.rmsprop,adamax:u.OptimizerConstructors.adamax,adam:u.OptimizerConstructors.adam}},{&quot;./optimizers/adadelta_optimizer&quot;:204,&quot;./optimizers/adagrad_optimizer&quot;:205,&quot;./optimizers/adam_optimizer&quot;:206,&quot;./optimizers/adamax_optimizer&quot;:207,&quot;./optimizers/momentum_optimizer&quot;:208,&quot;./optimizers/optimizer_constructors&quot;:210,&quot;./optimizers/rmsprop_optimizer&quot;:211,&quot;./optimizers/sgd_optimizer&quot;:212}],222:[function(t,e,n){&quot;use strict&quot;;var r,i,o,a;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),function(t){t.R0=&quot;R0&quot;,t.R1=&quot;R1&quot;,t.R2=&quot;R2&quot;,t.R3=&quot;R3&quot;,t.R4=&quot;R4&quot;,t.R5=&quot;R5&quot;,t.R6=&quot;R6&quot;}(n.Rank||(n.Rank={})),function(t){t.float32=&quot;float32&quot;,t.int32=&quot;int32&quot;,t.bool=&quot;int32&quot;,t.complex64=&quot;complex64&quot;}(r||(r={})),function(t){t.float32=&quot;float32&quot;,t.int32=&quot;int32&quot;,t.bool=&quot;bool&quot;,t.complex64=&quot;complex64&quot;}(i||(i={})),function(t){t.float32=&quot;float32&quot;,t.int32=&quot;float32&quot;,t.bool=&quot;float32&quot;,t.complex64=&quot;complex64&quot;}(o||(o={})),function(t){t.float32=&quot;complex64&quot;,t.int32=&quot;complex64&quot;,t.bool=&quot;complex64&quot;,t.complex64=&quot;complex64&quot;}(a||(a={}));var s={float32:o,int32:r,bool:i,complex64:a};function u(t,e){if(&quot;string&quot;===t||&quot;string&quot;===e){if(&quot;string&quot;===t&amp;&amp;&quot;string&quot;===e)return&quot;string&quot;;throw new Error(&quot;Can not upcast &quot;+t+&quot; with &quot;+e)}return s[t][e]}n.upcastType=u,n.sumOutType=function(t){return u(t,&quot;int32&quot;)}},{}],223:[function(t,e,n){(function(e){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./environment&quot;);function i(t){for(var e=t.length,n=0,r=0;e&gt;0;)r=Math.random()*e|0,n=t[--e],t[e]=t[r],t[r]=n}function o(t,e){if(!t)throw new Error(&quot;string&quot;==typeof e?e:e())}function a(t,e){if(void 0===e&amp;&amp;(e=[]),null==e&amp;&amp;(e=[]),Array.isArray(t)||f(t))for(var n=0;n&lt;t.length;++n)a(t[n],e);else e.push(t);return e}function s(t,e){if(t===e)return!0;if(null==t||null==e)return!1;if(t.length!==e.length)return!1;for(var n=0;n&lt;t.length;n++)if(t[n]!==e[n])return!1;return!0}function u(t){return t%1==0}function l(t,e){var n=e.length;return o((t=null==t?e.map(function(t,e){return e}):[].concat(t)).every(function(t){return t&gt;=-n&amp;&amp;t&lt;n}),function(){return&quot;All values in axis param must be in range [-&quot;+n+&quot;, &quot;+n+&quot;) but got axis &quot;+t}),o(t.every(function(t){return u(t)}),function(){return&quot;All values in axis param must be integers but got axis &quot;+t}),t.map(function(t){return t&lt;0?n+t:t})}function c(t,e){for(var n=0;n&lt;t.length;n++){var r=t[n];if(isNaN(r)||!isFinite(r))throw Error(&quot;A tensor of type &quot;+e+&quot; being uploaded contains &quot;+r+&quot;.&quot;)}}function f(t){return t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array}function p(t){return&quot;string&quot;==typeof t||t instanceof String}function h(t){return&quot;boolean&quot;==typeof t}function d(t){return&quot;number&quot;==typeof t}function m(t,e){if(null==e||&quot;float32&quot;===e||&quot;complex64&quot;===e)return new Float32Array(t);if(&quot;int32&quot;===e)return new Int32Array(t);if(&quot;bool&quot;===e)return new Uint8Array(t);throw new Error(&quot;Unknown data type &quot;+e)}n.shuffle=i,n.clamp=function(t,e,n){return Math.max(t,Math.min(e,n))},n.nearestLargerEven=function(t){return t%2==0?t:t+1},n.sum=function(t){for(var e=0,n=0;n&lt;t.length;n++)e+=t[n];return e},n.randUniform=function(t,e){var n=Math.random();return e*n+(1-n)*t},n.distSquared=function(t,e){for(var n=0,r=0;r&lt;t.length;r++){var i=Number(t[r])-Number(e[r]);n+=i*i}return n},n.assert=o,n.assertShapesMatch=function(t,e,n){void 0===n&amp;&amp;(n=&quot;&quot;),o(s(t,e),function(){return n+&quot; Shapes &quot;+t+&quot; and &quot;+e+&quot; must match&quot;})},n.assertNonNull=function(t){o(null!=t,function(){return&quot;The input to the tensor constructor must be a non-null value.&quot;})},n.flatten=a,n.sizeFromShape=function(t){if(0===t.length)return 1;for(var e=t[0],n=1;n&lt;t.length;n++)e*=t[n];return e},n.isScalarShape=function(t){return 0===t.length},n.arraysEqual=s,n.isInt=u,n.tanh=function(t){if(null!=Math.tanh)return Math.tanh(t);if(t===1/0)return 1;if(t===-1/0)return-1;var e=Math.exp(2*t);return(e-1)/(e+1)},n.sizeToSquarishShape=function(t){var e=Math.ceil(Math.sqrt(t));return[e,Math.ceil(t/e)]},n.createShuffledIndices=function(t){for(var e=new Uint32Array(t),n=0;n&lt;t;++n)e[n]=n;return i(e),e},n.rightPad=function(t,e){return e&lt;=t.length?t:t+&quot; &quot;.repeat(e-t.length)},n.repeatedTry=function(t,e,n){return void 0===e&amp;&amp;(e=function(t){return 0}),new Promise(function(r,i){var o=0,a=function(){if(t())r();else{var s=e(++o);null!=n&amp;&amp;o&gt;=n?i():setTimeout(a,s)}};a()})},n.inferFromImplicitShape=function(t,e){for(var n=1,r=-1,i=0;i&lt;t.length;++i)if(t[i]&gt;=0)n*=t[i];else if(-1===t[i]){if(-1!==r)throw Error(&quot;Shapes can only have 1 implicit size. Found -1 at dim &quot;+r+&quot; and dim &quot;+i);r=i}else if(t[i]&lt;0)throw Error(&quot;Shapes can not be &lt; 0. Found &quot;+t[i]+&quot; at dim &quot;+i);if(-1===r){if(e&gt;0&amp;&amp;e!==n)throw Error(&quot;Size(&quot;+e+&quot;) must match the product of shape &quot;+t);return t}if(0===n)throw Error(&quot;Cannot infer the missing size in [&quot;+t+&quot;] when there are 0 elements&quot;);if(e%n!=0)throw Error(&quot;The implicit shape can&apos;t be a fractional number. Got &quot;+e+&quot; / &quot;+n);var o=t.slice();return o[r]=e/n,o},n.parseAxisParam=l,n.squeezeShape=function(t,e){for(var n=[],r=[],i=null==e?null:l(e,t).sort(),o=0,a=0;a&lt;t.length;++a){if(null!=i){if(i[o]===a&amp;&amp;1!==t[a])throw new Error(&quot;Can&apos;t squeeze axis &quot;+a+&quot; since its dim &apos;&quot;+t[a]+&quot;&apos; is not 1&quot;);(null==i[o]||i[o]&gt;a)&amp;&amp;1===t[a]&amp;&amp;(n.push(t[a]),r.push(a)),i[o]&lt;=a&amp;&amp;o++}1!==t[a]&amp;&amp;(n.push(t[a]),r.push(a))}return{newShape:n,keptDims:r}},n.getTypedArrayFromDType=function(t,e){var n=null;if(null==t||&quot;float32&quot;===t)n=new Float32Array(e);else if(&quot;int32&quot;===t)n=new Int32Array(e);else{if(&quot;bool&quot;!==t)throw new Error(&quot;Unknown data type &quot;+t);n=new Uint8Array(e)}return n},n.getArrayFromDType=function(t,e){var n=null;if(null==t||&quot;float32&quot;===t)n=new Float32Array(e);else if(&quot;int32&quot;===t)n=new Int32Array(e);else if(&quot;bool&quot;===t)n=new Uint8Array(e);else{if(&quot;string&quot;!==t)throw new Error(&quot;Unknown data type &quot;+t);n=new Array(e)}return n},n.checkComputationForErrors=function(t,e,n){if(&quot;float32&quot;===e)for(var r=0;r&lt;t.length;r++){var i=t[r];if(isNaN(i)||!isFinite(i))throw Error(&quot;The result of the &apos;&quot;+n+&quot;&apos; is &quot;+i+&quot;.&quot;)}},n.checkConversionForErrors=c,n.hasEncodingLoss=function(t,e){return!(&quot;complex64&quot;===e||&quot;float32&quot;===e&amp;&amp;&quot;complex64&quot;!==t||&quot;int32&quot;===e&amp;&amp;&quot;float32&quot;!==t&amp;&amp;&quot;complex64&quot;!==t||&quot;bool&quot;===e&amp;&amp;&quot;bool&quot;===t)},n.isTypedArray=f,n.bytesPerElement=function(t){if(&quot;float32&quot;===t||&quot;int32&quot;===t)return 4;if(&quot;complex64&quot;===t)return 8;if(&quot;bool&quot;===t)return 1;throw new Error(&quot;Unknown dtype &quot;+t)},n.bytesFromStringArray=function(t){if(null==t)return 0;var e=0;return t.forEach(function(t){return e+=2*t.length}),e},n.isString=p,n.isBoolean=h,n.isNumber=d,n.inferDtype=function t(e){return Array.isArray(e)?t(e[0]):e instanceof Float32Array?&quot;float32&quot;:e instanceof Int32Array||e instanceof Uint8Array?&quot;int32&quot;:d(e)?&quot;float32&quot;:p(e)?&quot;string&quot;:h(e)?&quot;bool&quot;:&quot;float32&quot;},n.isFunction=function(t){return!!(t&amp;&amp;t.constructor&amp;&amp;t.call&amp;&amp;t.apply)},n.nearestDivisor=function(t,e){for(var n=e;n&lt;t;++n)if(t%n==0)return n;return t},n.computeStrides=function(t){var e=t.length;if(e&lt;2)return[];var n=new Array(e-1);n[e-2]=t[e-1];for(var r=e-3;r&gt;=0;--r)n[r]=n[r+1]*t[r+1];return n},n.toTypedArray=function(t,e,n){if(&quot;string&quot;===e)throw new Error(&quot;Cannot convert a string[] to a TypedArray&quot;);if(Array.isArray(t)&amp;&amp;(t=a(t)),n&amp;&amp;c(t,e),function(t,e){return t instanceof Float32Array&amp;&amp;&quot;float32&quot;===e||t instanceof Int32Array&amp;&amp;&quot;int32&quot;===e||t instanceof Uint8Array&amp;&amp;&quot;bool&quot;===e}(t,e))return t;if(null==e||&quot;float32&quot;===e||&quot;complex64&quot;===e)return new Float32Array(t);if(&quot;int32&quot;===e)return new Int32Array(t);if(&quot;bool&quot;===e){for(var r=new Uint8Array(t.length),i=0;i&lt;r.length;++i)0!==Math.round(t[i])&amp;&amp;(r[i]=1);return r}throw new Error(&quot;Unknown data type &quot;+e)},n.toNestedArray=function(t,e){if(0===t.length)return e[0];var n=t.reduce(function(t,e){return t*e});if(0===n)return[];if(n!==e.length)throw new Error(&quot;[&quot;+t+&quot;] does not match the input size.&quot;);return function t(e,n,r){var i=new Array;if(1===n.length)for(var o=n[0],a=0;a&lt;o;a++)i[a]=r[e+a];else{o=n[0];var s=n.slice(1),u=s.reduce(function(t,e){return t*e});for(a=0;a&lt;o;a++)i[a]=t(e+a*u,s,r)}return i}(0,t,e)},n.makeOnesTypedArray=function(t,e){for(var n=m(t,e),r=0;r&lt;n.length;r++)n[r]=1;return n},n.makeZerosTypedArray=m,n.now=function(){if(&quot;undefined&quot;!=typeof performance)return performance.now();if(void 0!==e){var t=e.hrtime();return 1e3*t[0]+t[1]/1e6}throw new Error(&quot;Cannot measure time in this environment. You should run tf.js in the browser or in Node.js&quot;)},n.assertNonNegativeIntegerDimensions=function(t){t.forEach(function(e){o(Number.isInteger(e)&amp;&amp;e&gt;=0,function(){return&quot;Tensor must have a shape comprised of positive integers but got shape [&quot;+t+&quot;].&quot;})})};var g=function(){if(null!=r.ENV.global.fetch)return r.ENV.global.fetch;if(r.ENV.get(&quot;IS_NODE&quot;))return n.getNodeFetch.fetchImport();throw new Error(&quot;Unable to find the fetch() method. Please add your own fetch() function to the global namespace.&quot;)};n.getNodeFetch={fetchImport:function(){return t(&quot;node-fetch&quot;)}},n.fetch=function(t,e){return null==n.systemFetch&amp;&amp;(n.systemFetch=g()),n.systemFetch(t,e)}}).call(this,t(&quot;_process&quot;))},{&quot;./environment&quot;:134,_process:338,&quot;node-fetch&quot;:302}],224:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48}],225:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./backends/webgl/gpgpu_util&quot;);n.gpgpu_util=r;var i=t(&quot;./backends/webgl/webgl_util&quot;);n.webgl_util=i;var o=t(&quot;./backends/webgl/backend_webgl&quot;);n.MathBackendWebGL=o.MathBackendWebGL;var a=t(&quot;./backends/webgl/gpgpu_context&quot;);n.GPGPUContext=a.GPGPUContext},{&quot;./backends/webgl/backend_webgl&quot;:62,&quot;./backends/webgl/gpgpu_context&quot;:90,&quot;./backends/webgl/gpgpu_util&quot;:92,&quot;./backends/webgl/webgl_util&quot;:129}],226:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;@tensorflow/tfjs-core&quot;),u=t(&quot;seedrandom&quot;),l=t(&quot;./iterators/lazy_iterator&quot;),c=t(&quot;./util/deep_map&quot;),f=function(){function t(){this.size=null}return t.prototype.batch=function(t,e){var n=this;void 0===e&amp;&amp;(e=!0);var r=this;return s.util.assert(t&gt;0,function(){return&quot;batchSize needs to be positive, but it is\n      &quot;+t}),p(function(){return o(n,void 0,void 0,function(){return a(this,function(n){switch(n.label){case 0:return[4,r.iterator()];case 1:return[2,n.sent().columnMajorBatch(t,e,h)]}})})},this.size===1/0||null==this.size?this.size:e?Math.ceil(this.size/t):Math.floor(this.size/t))},t.prototype.concatenate=function(t){var e=this,n=this;return p(function(){return o(e,void 0,void 0,function(){var e,r;return a(this,function(i){switch(i.label){case 0:return[4,n.iterator()];case 1:return r=(e=i.sent()).concatenate,[4,t.iterator()];case 2:return[2,r.apply(e,[i.sent()])]}})})},this.size===1/0||t.size===1/0?1/0:null!=this.size&amp;&amp;null!=t.size?this.size+t.size:null)},t.prototype.filter=function(t){var e=this,n=this;return p(function(){return o(e,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().filter(function(e){return s.tidy(function(){return t(e)})})]}})})},this.size===1/0?1/0:null)},t.prototype.forEachAsync=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,this.iterator()];case 1:return[2,e.sent().forEachAsync(t)]}})})},t.prototype.forEach=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return s.deprecationWarn(&quot;dataset.forEach() is deprecated and will be removed. Please use dataset.forEachAsync() instead&quot;),[2,this.forEachAsync(t)]})})},t.prototype.map=function(t){var e=this,n=this;return p(function(){return o(e,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().map(function(e){return s.tidy(function(){return t(e)})})]}})})},this.size)},t.prototype.mapAsync=function(t){var e=this,n=this;return p(function(){return o(e,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().mapAsync(t)]}})})},this.size)},t.prototype.prefetch=function(t){var e=this;if(null==t)throw new RangeError(&quot;`Dataset.prefetch()` requires bufferSize to be specified.&quot;);var n=this;return p(function(){return o(e,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().prefetch(t)]}})})},this.size)},t.prototype.repeat=function(t){var e=this,n=this;return p(function(){return o(e,void 0,void 0,function(){var e,r=this;return a(this,function(i){return e=l.iteratorFromFunction(function(){return o(r,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return t={},[4,n.iterator()];case 1:return[2,(t.value=e.sent(),t.done=!1,t)]}})})}),[2,l.iteratorFromConcatenated(e.take(t))]})})},null!=this.size&amp;&amp;t&gt;0?this.size*t:0===t?0:null!=this.size&amp;&amp;(void 0===t||t&lt;0)?1/0:null)},t.prototype.skip=function(t){var e=this,n=this;return p(function(){return o(e,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().skip(t)]}})})},null!=this.size&amp;&amp;t&gt;=0&amp;&amp;this.size&gt;=t?this.size-t:null!=this.size&amp;&amp;(this.size&lt;t||void 0===t||t&lt;0)?0:null)},t.prototype.shuffle=function(t,e,n){var r=this;if(void 0===n&amp;&amp;(n=!0),null==t||t&lt;0)throw null==this.size?new RangeError(&quot;`Dataset.shuffle()` requires bufferSize to be specified.&quot;):new RangeError(&quot;`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 (&quot;+this.size+&quot; elements)&quot;);var i=this,l=u.alea(e||s.util.now().toString());return p(function(){return o(r,void 0,void 0,function(){var e;return a(this,function(r){switch(r.label){case 0:return e=l.int32(),n&amp;&amp;(e+=l.int32()),[4,i.iterator()];case 1:return[2,r.sent().shuffle(t,e.toString())]}})})},this.size)},t.prototype.take=function(t){var e=this,n=this;return p(function(){return o(e,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().take(t)]}})})},null!=this.size&amp;&amp;this.size&gt;t?t:null!=this.size&amp;&amp;this.size&lt;=t?this.size:null)},t.prototype.toArray=function(){return o(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:if(this.size===1/0)throw new Error(&quot;Can not convert infinite data stream to array.&quot;);return[4,this.iterator()];case 1:return[2,t.sent().toArray()]}})})},t.prototype.toArrayForTest=function(){return o(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:if(this.size===1/0)throw new Error(&quot;Can not convert infinite data stream to array.&quot;);return[4,this.iterator()];case 1:return[2,t.sent().toArrayForTest()]}})})},t.MAX_BUFFER_SIZE=1e4,t}();function p(t,e){return void 0===e&amp;&amp;(e=null),new(function(n){function r(){var t=null!==n&amp;&amp;n.apply(this,arguments)||this;return t.size=e,t}return i(r,n),r.prototype.iterator=function(){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,t()]})})},r}(f))}function h(t){if(null===t)return null;var e=t[0];return c.canTensorify(e)?{value:function(t){if(0===t.length)throw new Error(&quot;Can&apos;t make a batch of zero elements.&quot;);return t[0]instanceof s.Tensor?s.stack(t):s.tensor(t)}(t),recurse:!1}:{value:null,recurse:!0}}n.Dataset=f,n.datasetFromIteratorFn=p,n.array=function(t){var e=this;return p(function(){return o(e,void 0,void 0,function(){return a(this,function(e){return[2,l.iteratorFromItems(t)]})})},t.length)},n.zip=function(t){var e,n=this;if(!c.isIterable(t))throw new Error(&quot;The argument to zip() must be an object or array.&quot;);if(Array.isArray(t))for(var r=0;r&lt;t.length;r++)e=null==e?t[r].size:Math.min(e,t[r].size);else if(t instanceof Object)for(var i in t)e=null==e?t[i].size:Math.min(e,t[i].size);return p(function(){return o(n,void 0,void 0,function(){var e;return a(this,function(n){switch(n.label){case 0:return[4,c.deepMapAndAwaitAll(t,function(t){if(t instanceof f)return{value:t.iterator(),recurse:!1};if(c.isIterable(t))return{value:null,recurse:!0};throw new Error(&quot;Leaves of the structure passed to zip() must be Datasets, not primitives.&quot;)})];case 1:return e=n.sent(),[2,l.iteratorFromZipped(e,l.ZipMismatchMode.SHORTEST)]}})})},e)}},{&quot;./iterators/lazy_iterator&quot;:233,&quot;./util/deep_map&quot;:239,&quot;@tensorflow/tfjs-core&quot;:138,seedrandom:340}],227:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;@tensorflow/tfjs-core&quot;),u=t(&quot;../dataset&quot;),l=t(&quot;./text_line_dataset&quot;),c=Symbol(&quot;out&quot;),f=Symbol(&quot;field&quot;),p=Symbol(&quot;quote&quot;),h=Symbol(&quot;quoteafterquote&quot;),d=Symbol(&quot;quoteinquote&quot;),m=function(t){function e(e,n){var r=t.call(this)||this;return r.input=e,r.hasHeader=!0,r.fullColumnNames=null,r.columnNamesValidated=!1,r.columnConfigs=null,r.configuredColumnsOnly=!1,r.delimiter=&quot;,&quot;,r.base=new l.TextLineDataset(e),n||(n={}),r.hasHeader=!1!==n.hasHeader,r.fullColumnNames=n.columnNames,r.columnConfigs=n.columnConfigs,r.configuredColumnsOnly=n.configuredColumnsOnly,r.delimiter=n.delimiter?n.delimiter:&quot;,&quot;,r}return i(e,t),e.prototype.columnNames=function(){return o(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return this.columnNamesValidated?[3,2]:[4,this.setColumnNames()];case 1:t.sent(),t.label=2;case 2:return[2,this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames]}})})},e.prototype.setColumnNames=function(){return o(this,void 0,void 0,function(){var t,e,n,r,i,o,u=this;return a(this,function(a){switch(a.label){case 0:return[4,this.maybeReadHeaderLine()];case 1:if(t=a.sent(),!this.fullColumnNames&amp;&amp;!t)throw new Error(&quot;Column names must be provided if there is no header line.&quot;);if(this.fullColumnNames&amp;&amp;t&amp;&amp;s.util.assert(t.length===this.fullColumnNames.length,function(){return&quot;The length of provided columnNames (&quot;+u.fullColumnNames.length.toString()+&quot;) does not match the length of the header line read from file (&quot;+t.length.toString()+&quot;).&quot;}),this.fullColumnNames||(this.fullColumnNames=t),e=this.fullColumnNames.reduce(function(t,e){return t[e]=t[e]+1||1,t},{}),n=Object.keys(e).filter(function(t){return e[t]&gt;1}),s.util.assert(0===n.length,function(){return&quot;Duplicate column names found: &quot;+n.toString()}),this.columnConfigs)for(r=0,i=Object.keys(this.columnConfigs);r&lt;i.length;r++)if(o=i[r],-1===this.fullColumnNames.indexOf(o))throw new Error(&apos;The key &quot;&apos;+o+&apos;&quot; provided in columnConfigs does not match any of the column names (&apos;+this.fullColumnNames.toString()+&quot;).&quot;);return this.columnNamesValidated=!0,[2]}})})},e.prototype.maybeReadHeaderLine=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return this.hasHeader?[4,this.base.iterator()]:[3,3];case 1:return[4,e.sent().next()];case 2:if((t=e.sent()).done)throw new Error(&quot;No data was found for CSV parsing.&quot;);return[2,t.value.split(this.delimiter)];case 3:return[2,null]}})})},e.prototype.iterator=function(){return o(this,void 0,void 0,function(){var t,e=this;return a(this,function(n){switch(n.label){case 0:return this.columnNamesValidated?[3,2]:[4,this.setColumnNames()];case 1:n.sent(),n.label=2;case 2:return[4,this.base.iterator()];case 3:return t=n.sent(),this.hasHeader&amp;&amp;(t=t.skip(1)),[2,t.map(function(t){return e.makeDataElement(t)})]}})})},e.prototype.makeDataElement=function(t){for(var e=this.parseRow(t),n={},r={},i=0;i&lt;this.fullColumnNames.length;i++){var o=this.fullColumnNames[i],a=this.columnConfigs?this.columnConfigs[o]:null;if(!this.configuredColumnsOnly||a){var s=e[i],u=null;if(&quot;&quot;===s)if(a&amp;&amp;void 0!==a.default)u=a.default;else{if(a&amp;&amp;(a.required||a.isLabel))throw new Error(&quot;Required column &quot;+o+&quot; is empty in this line: &quot;+t);u=void 0}else{var l=Number(s);if(isNaN(l))u=a&amp;&amp;&quot;bool&quot;===a.dtype?this.getBoolean(s):s;else if(a&amp;&amp;a.dtype)switch(a.dtype){case&quot;float32&quot;:u=l;break;case&quot;int32&quot;:u=Math.floor(l);break;case&quot;bool&quot;:u=this.getBoolean(s);break;default:u=l}else u=l}a&amp;&amp;a.isLabel?r[o]=u:n[o]=u}}return 0===Object.keys(r).length?n:{xs:n,ys:r}},e.prototype.getBoolean=function(t){return&quot;1&quot;===t||&quot;true&quot;===t.toLowerCase()?1:0},e.prototype.parseRow=function(t){for(var e=[],n=0,r=t.length,i=f,o=0;o&lt;r;o++)switch(i){case c:switch(t.charAt(o)){case&apos;&quot;&apos;:n=o+1,i=p;break;case this.delimiter:e.push(&quot;&quot;),i=c,n=o+1;break;default:i=f,n=o}break;case f:switch(t.charAt(o)){case this.delimiter:e.push(t.substring(n,o)),i=c,n=o+1}break;case p:switch(t.charAt(o)){case&apos;&quot;&apos;:i=h}break;case h:switch(t.charAt(o)){case this.delimiter:e.push(t.substring(n,o-1)),i=c,n=o+1;break;case&apos;&quot;&apos;:i=p;break;default:i=d}break;case d:switch(t.charAt(o)){case&apos;&quot;&apos;:i=p}}return i===h?e.push(t.substring(n,r-1)):e.push(t.substring(n)),e},e}(u.Dataset);n.CSVDataset=m},{&quot;../dataset&quot;:226,&quot;./text_line_dataset&quot;:228,&quot;@tensorflow/tfjs-core&quot;:138}],228:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=function(t){function e(e){var n=t.call(this)||this;return n.input=e,n}return i(e,t),e.prototype.iterator=function(){return o(this,void 0,void 0,function(){var t,e;return a(this,function(n){switch(n.label){case 0:return[4,this.input.iterator()];case 1:return t=n.sent(),e=t.decodeUTF8(),[2,e.split(&quot;\n&quot;)]}})})},e}(t(&quot;../dataset&quot;).Dataset);n.TextLineDataset=s},{&quot;../dataset&quot;:226}],229:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){return function(){}}();n.DataSource=r},{}],230:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./dataset&quot;);n.array=r.array,n.Dataset=r.Dataset,n.zip=r.zip;var i=t(&quot;./datasets/csv_dataset&quot;);n.CSVDataset=i.CSVDataset;var o=t(&quot;./datasets/text_line_dataset&quot;);n.TextLineDataset=o.TextLineDataset;var a=t(&quot;./readers&quot;);n.csv=a.csv,n.func=a.func,n.generator=a.generator;var s=t(&quot;./sources/file_data_source&quot;);n.FileDataSource=s.FileDataSource;var u=t(&quot;./sources/url_data_source&quot;);n.URLDataSource=u.URLDataSource;var l=t(&quot;./version&quot;);n.version_data=l.version},{&quot;./dataset&quot;:226,&quot;./datasets/csv_dataset&quot;:227,&quot;./datasets/text_line_dataset&quot;:228,&quot;./readers&quot;:236,&quot;./sources/file_data_source&quot;:237,&quot;./sources/url_data_source&quot;:238,&quot;./version&quot;:243}],231:[function(t,e,n){(function(e){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;@tensorflow/tfjs-core&quot;),u=t(&quot;./lazy_iterator&quot;),l=t(&quot;./string_iterator&quot;),c=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.decodeUTF8=function(){return new f(this)},e}(u.LazyIterator);n.ByteChunkIterator=c;var f=function(t){function e(e){var n=t.call(this)||this;return n.upstream=e,n.impl=new p(e),n}return i(e,t),e.prototype.summary=function(){return this.impl.summary()},e.prototype.next=function(){return o(this,void 0,void 0,function(){return a(this,function(t){return[2,this.impl.next()]})})},e}(l.StringIterator),p=function(n){function r(e){var r=n.call(this)||this;if(r.upstream=e,s.ENV.get(&quot;IS_BROWSER&quot;))r.decoder=new TextDecoder(&quot;utf-8&quot;);else{var i=t(&quot;string_decoder&quot;).StringDecoder;r.decoder=new i(&quot;utf8&quot;)}return r}return i(r,n),r.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; Utf8&quot;},r.prototype.pump=function(){return o(this,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return[4,this.upstream.next()];case 1:return(t=i.sent()).done?[2,!1]:(n=t.value,r=s.ENV.get(&quot;IS_BROWSER&quot;)?this.decoder.decode(n,{stream:!0}):this.decoder.write(e.from(n.buffer)),this.outputQueue.push(r),[2,!0])}})})},r}(u.OneToManyIterator)}).call(this,t(&quot;buffer&quot;).Buffer)},{&quot;./lazy_iterator&quot;:233,&quot;./string_iterator&quot;:234,&quot;@tensorflow/tfjs-core&quot;:138,buffer:303,string_decoder:302}],232:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;@tensorflow/tfjs-core&quot;),u=function(t){function e(e,n){void 0===n&amp;&amp;(n={});var r=t.call(this)||this;return r.file=e,r.options=n,s.util.assert(e instanceof Uint8Array||!!s.ENV.get(&quot;IS_BROWSER&quot;)&amp;&amp;(e instanceof File||e instanceof Blob),function(){return&quot;FileChunkIterator only supports File, Blob and Uint8Array right now.&quot;}),r.offset=n.offset||0,r.chunkSize=n.chunkSize||1048576,r}return i(e,t),e.prototype.summary=function(){return&quot;FileChunks &quot;+this.file},e.prototype.next=function(){return o(this,void 0,void 0,function(){var t,e,n=this;return a(this,function(r){switch(r.label){case 0:return this.offset&gt;=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size)?[2,{value:null,done:!0}]:(t=new Promise(function(t,e){var r=n.offset+n.chunkSize;if(n.file instanceof Uint8Array)t(new Uint8Array(n.file.slice(n.offset,r)));else{var i=new FileReader;i.onload=function(n){var r=i.result;if(r instanceof ArrayBuffer&amp;&amp;(r=new Uint8Array(r)),!(r instanceof Uint8Array))return e(new TypeError(&quot;FileReader returned unknown type.&quot;));t(r)},i.onabort=function(t){return e(new Error(&quot;Aborted&quot;))},i.onerror=function(t){return e(new Error(t.type))};var o=n.file.slice(n.offset,r);i.readAsArrayBuffer(o)}n.offset=r}),e={},[4,t]);case 1:return[2,(e.value=r.sent(),e.done=!1,e)]}})})},e}(t(&quot;./byte_chunk_iterator&quot;).ByteChunkIterator);n.FileChunkIterator=u},{&quot;./byte_chunk_iterator&quot;:231,&quot;@tensorflow/tfjs-core&quot;:138}],233:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;@tensorflow/tfjs-core&quot;),u=t(&quot;seedrandom&quot;),l=t(&quot;../util/deep_map&quot;),c=t(&quot;../util/growing_ring_buffer&quot;),f=t(&quot;../util/ring_buffer&quot;);function p(t){return new g(t)}function h(t){return new v(t)}function d(t,e){return new A(t,e)}n.iteratorFromItems=p,n.iteratorFromIncrementing=function(t){var e=t;return h(function(){return{value:e++,done:!1}})},n.iteratorFromFunction=h,n.iteratorFromConcatenated=d,n.iteratorFromConcatenatedFunction=function(t,e,n){return d(h(t).take(e),n)},n.iteratorFromZipped=function(t,e){return void 0===e&amp;&amp;(e=S.FAIL),new I(t,e)};var m=function(){function t(){}return t.prototype.toArray=function(){return o(this,void 0,void 0,function(){var t,e;return a(this,function(n){switch(n.label){case 0:return t=[],[4,this.next()];case 1:e=n.sent(),n.label=2;case 2:return e.done?[3,4]:(t.push(e.value),[4,this.next()]);case 3:return e=n.sent(),[3,2];case 4:return[2,t]}})})},t.prototype.toArrayForTest=function(){return o(this,void 0,void 0,function(){var t,e,n;return a(this,function(r){switch(r.label){case 0:return t=this.prefetch(100),e=[],[4,t.next()];case 1:n=r.sent(),r.label=2;case 2:return n.done?[3,4]:(e.push(n.value),[4,t.next()]);case 3:return n=r.sent(),[3,2];case 4:return[2,e]}})})},t.prototype.resolveFully=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return[4,this.next()];case 1:t=e.sent(),e.label=2;case 2:return t.done?[3,4]:[4,this.next()];case 3:return t=e.sent(),[3,2];case 4:return[2]}})})},t.prototype.resolveWhile=function(t){return o(this,void 0,void 0,function(){var e,n;return a(this,function(r){switch(r.label){case 0:return[4,this.next()];case 1:e=r.sent(),n=t(e.value),r.label=2;case 2:return e.done||!n?[3,4]:[4,this.next()];case 3:return e=r.sent(),n=t(e.value),[3,2];case 4:return[2]}})})},t.prototype.handleErrors=function(t){return new k(this,t)},t.prototype.filter=function(t){return new x(this,t)},t.prototype.map=function(t){return new E(this,t)},t.prototype.mapAsync=function(t){return new T(this,t)},t.prototype.serialMapAsync=function(t){return new T(this,t).serial()},t.prototype.flatmap=function(t){return new C(this,t)},t.prototype.forEachAsync=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,this.map(t).resolveFully()]})})},t.prototype.serialForEach=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,this.serialMapAsync(t).resolveWhile(function(t){return!0===t})]})})},t.prototype.rowMajorBatch=function(t,e){return void 0===e&amp;&amp;(e=!0),new w(this,t,e)},t.prototype.columnMajorBatch=function(t,e,n){return void 0===e&amp;&amp;(e=!0),void 0===n&amp;&amp;(n=l.zipToList),this.rowMajorBatch(t,e).map(function(t){return l.deepZip(t,n)})},t.prototype.concatenate=function(t,e){return new A(p([this,t]),e)},t.prototype.take=function(t){return t&lt;0||null==t?this:new _(this,t)},t.prototype.skip=function(t){return t&lt;0||null==t?this:new b(this,t)},t.prototype.prefetch=function(t){return new O(this,t)},t.prototype.shuffle=function(t,e){return new M(this,t,e)},t.prototype.serial=function(){return new y(this)},t}();n.LazyIterator=m;var g=function(t){function e(e){var n=t.call(this)||this;return n.items=e,n.trav=0,n}return i(e,t),e.prototype.summary=function(){return&quot;Array of &quot;+this.items.length+&quot; items&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){var t,e;return a(this,function(n){return this.trav&gt;=this.items.length?[2,{value:null,done:!0}]:(t=this.items[this.trav],e=t instanceof s.Tensor?s.clone(t):t,this.trav++,[2,{value:e,done:!1}])})})},e}(m),v=function(t){function e(e){var n=t.call(this)||this;return n.nextFn=e,n}return i(e,t),e.prototype.summary=function(){return&quot;Function call&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){return a(this,function(t){try{return[2,this.nextFn()]}catch(t){throw t.message=&quot;Error thrown while iterating through a dataset: &quot;+t.message,t}return[2]})})},e}(m),y=function(t){function e(e){var n=t.call(this)||this;return n.upstream=e,n.lastRead=Promise.resolve({value:null,done:!1}),n}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; Serial&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){var t=this;return a(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return o(this,void 0,void 0,function(){return a(this,function(t){return[2,this.upstream.next()]})})},e}(m),b=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.maxCount=n,r.count=0,r.lastRead=Promise.resolve({value:null,done:!1}),r}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; Skip&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){var t=this;return a(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return this.count++&lt;this.maxCount?[4,this.upstream.next()]:[3,2];case 1:return(t=e.sent()).done?[2,t]:(s.dispose(t.value),[3,0]);case 2:return[2,this.upstream.next()]}})})},e}(m),_=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.maxCount=n,r.count=0,r}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; Take&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){return a(this,function(t){return this.count++&gt;=this.maxCount?[2,{value:null,done:!0}]:[2,this.upstream.next()]})})},e}(m),w=function(t){function e(e,n,r){void 0===r&amp;&amp;(r=!0);var i=t.call(this)||this;return i.upstream=e,i.batchSize=n,i.enableSmallLastBatch=r,i.lastRead=Promise.resolve({value:null,done:!1}),i}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; RowMajorBatch&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){var t=this;return a(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return o(this,void 0,void 0,function(){var t,e;return a(this,function(n){switch(n.label){case 0:t=[],n.label=1;case 1:return t.length&lt;this.batchSize?[4,this.upstream.next()]:[3,3];case 2:return(e=n.sent()).done?this.enableSmallLastBatch&amp;&amp;t.length&gt;0?[2,{value:t,done:!1}]:[2,{value:null,done:!0}]:(t.push(e.value),[3,1]);case 3:return[2,{value:t,done:!1}]}})})},e}(m),x=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.predicate=n,r.lastRead=Promise.resolve({value:null,done:!1}),r}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; Filter&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){var t=this;return a(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return[4,this.upstream.next()];case 1:return(t=e.sent()).done||this.predicate(t.value)?[2,t]:(s.dispose(t.value),[3,0]);case 2:return[2]}})})},e}(m),E=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.transform=n,r}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; Map&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){var t,e,n,r,i,o,u;return a(this,function(a){switch(a.label){case 0:return[4,this.upstream.next()];case 1:if((t=a.sent()).done)return[2,{value:null,done:!0}];for(e=s.tensor_util.getTensorsInContainer(t.value),n=this.transform(t.value),r=s.tensor_util.getTensorsInContainer(n),i=0,o=e;i&lt;o.length;i++)u=o[i],s.tensor_util.isTensorInList(u,r)||u.dispose();return[2,{value:n,done:!1}]}})})},e}(m),k=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.handler=n,r.count=0,r.lastRead=Promise.resolve({value:null,done:!1}),r}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; handleErrors&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){var t=this;return a(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:0,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.upstream.next()];case 2:return[2,e.sent()];case 3:return t=e.sent(),this.handler(t)?[3,4]:[2,{value:null,done:!0}];case 4:return[3,0];case 5:return[2]}})})},e}(m),T=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.transform=n,r}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; AsyncMap&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){var t,e,n,r,i,o,u;return a(this,function(a){switch(a.label){case 0:return[4,this.upstream.next()];case 1:return(t=a.sent()).done?[2,{value:null,done:!0}]:(e=s.tensor_util.getTensorsInContainer(t.value),[4,this.transform(t.value)]);case 2:for(n=a.sent(),r=s.tensor_util.getTensorsInContainer(n),i=0,o=e;i&lt;o.length;i++)u=o[i],s.tensor_util.isTensorInList(u,r)||u.dispose();return[2,{value:n,done:!1}]}})})},e}(m),N=function(t){function e(){var e=t.call(this)||this;return e.outputQueue=new c.GrowingRingBuffer,e.lastRead=Promise.resolve({value:null,done:!1}),e}return i(e,t),e.prototype.next=function(){return o(this,void 0,void 0,function(){var t=this;return a(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return o(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return 0!==this.outputQueue.length()?[3,2]:[4,this.pump()];case 1:return t.sent()?[3,0]:[2,{value:null,done:!0}];case 2:return[2,{value:this.outputQueue.shift(),done:!1}]}})})},e}(m);n.OneToManyIterator=N;var S,C=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.transform=n,r}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; Flatmap&quot;},e.prototype.pump=function(){return o(this,void 0,void 0,function(){var t,e,n,r,i,o,u;return a(this,function(a){switch(a.label){case 0:return[4,this.upstream.next()];case 1:if((t=a.sent()).done)return[2,!1];for(e=s.tensor_util.getTensorsInContainer(t.value),n=this.transform(t.value),r=s.tensor_util.getTensorsInContainer(n),this.outputQueue.pushAll(n),i=0,o=e;i&lt;o.length;i++)u=o[i],s.tensor_util.isTensorInList(u,r)||u.dispose();return[2,!0]}})})},e}(N),A=function(t){function e(e,n){var r=t.call(this)||this;return r.baseErrorHandler=n,r.lastRead=null,r.iterator=null,r.moreIterators=e,r}return i(e,t),e.prototype.summary=function(){return&quot;TODO: fill in upstream of chained summaries -&gt; Chained&quot;},e.prototype.next=function(){return o(this,void 0,void 0,function(){return a(this,function(t){return this.lastRead=this.readFromChain(this.lastRead),[2,this.lastRead]})})},e.prototype.readFromChain=function(t){return o(this,void 0,void 0,function(){var e,n;return a(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),null!=this.iterator?[3,3]:[4,this.moreIterators.next()];case 2:if((e=r.sent()).done)return[2,{value:null,done:!0}];this.iterator=e.value,null!=this.baseErrorHandler&amp;&amp;(this.iterator=this.iterator.handleErrors(this.baseErrorHandler)),r.label=3;case 3:return[4,this.iterator.next()];case 4:return(n=r.sent()).done?(this.iterator=null,[2,this.readFromChain(t)]):[2,n]}})})},e}(m);n.ChainedIterator=A,function(t){t[t.FAIL=0]=&quot;FAIL&quot;,t[t.SHORTEST=1]=&quot;SHORTEST&quot;,t[t.LONGEST=2]=&quot;LONGEST&quot;}(S=n.ZipMismatchMode||(n.ZipMismatchMode={}));var I=function(t){function e(e,n){void 0===n&amp;&amp;(n=S.FAIL);var r=t.call(this)||this;return r.iterators=e,r.mismatchMode=n,r.count=0,r.currentPromise=null,r}return i(e,t),e.prototype.summary=function(){return&quot;{TODO: fill in upstream of zip summaries} -&gt; Zip&quot;},e.prototype.nextState=function(t){return o(this,void 0,void 0,function(){function e(t){return t instanceof m?{value:t.next().then(function(t){return n++,t.done&amp;&amp;r++,t.value}),recurse:!1}:{value:null,recurse:!0}}var n,r,i;return a(this,function(o){switch(o.label){case 0:return[4,t];case 1:return o.sent(),n=0,r=0,[4,l.deepMapAndAwaitAll(this.iterators,e)];case 2:if(i=o.sent(),n===r)return[2,{value:null,done:!0}];if(r&gt;0)switch(this.mismatchMode){case S.FAIL:throw new Error(&quot;Zipped streams should have the same length. Mismatched at element &quot;+this.count+&quot;.&quot;);case S.SHORTEST:return[2,{value:null,done:!0}];case S.LONGEST:}return this.count++,[2,{value:i,done:!1}]}})})},e.prototype.next=function(){return o(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return this.currentPromise=this.nextState(this.currentPromise),[4,this.currentPromise];case 1:return[2,t.sent()]}})})},e}(m),O=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.bufferSize=n,r.buffer=new f.RingBuffer(n),r}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; Prefetch&quot;},e.prototype.refill=function(){for(;!this.buffer.isFull();){var t=this.upstream.next();this.buffer.push(t)}},e.prototype.next=function(){return this.refill(),this.buffer.shift()},e}(m);n.PrefetchIterator=O;var M=function(t){function e(e,n,r){var i=t.call(this,e,n)||this;return i.upstream=e,i.windowSize=n,i.upstreamExhausted=!1,i.random=u.alea(r||s.util.now().toString()),i.lastRead=Promise.resolve({value:null,done:!1}),i}return i(e,t),e.prototype.next=function(){return o(this,void 0,void 0,function(){var t=this;return a(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.randomInt=function(t){return Math.floor(this.random()*t)},e.prototype.chooseIndex=function(){return this.randomInt(this.buffer.length())},e.prototype.serialNext=function(){return o(this,void 0,void 0,function(){var t,e;return a(this,function(n){switch(n.label){case 0:this.upstreamExhausted||this.refill(),n.label=1;case 1:return this.buffer.isEmpty()?[3,3]:(t=this.chooseIndex(),[4,this.buffer.shuffleExcise(t)]);case 2:return(e=n.sent()).done?(this.upstreamExhausted=!0,[3,1]):(this.refill(),[2,e]);case 3:return[2,{value:null,done:!0}]}})})},e}(O);n.ShuffleIterator=M},{&quot;../util/deep_map&quot;:239,&quot;../util/growing_ring_buffer&quot;:240,&quot;../util/ring_buffer&quot;:241,&quot;@tensorflow/tfjs-core&quot;:138,seedrandom:340}],234:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;./lazy_iterator&quot;),u=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.split=function(t){return new l(this,t)},e}(s.LazyIterator);n.StringIterator=u;var l=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.impl=new c(e,n),r}return i(e,t),e.prototype.summary=function(){return this.impl.summary()},e.prototype.next=function(){return o(this,void 0,void 0,function(){return a(this,function(t){return[2,this.impl.next()]})})},e}(u),c=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.separator=n,r.carryover=&quot;&quot;,r}return i(e,t),e.prototype.summary=function(){return this.upstream.summary()+&quot; -&gt; Split(&apos;&quot;+this.separator+&quot;&apos;)&quot;},e.prototype.pump=function(){return o(this,void 0,void 0,function(){var t,e,n,r,i;return a(this,function(o){switch(o.label){case 0:return[4,this.upstream.next()];case 1:if((t=o.sent()).done)return&quot;&quot;===this.carryover?[2,!1]:(this.outputQueue.push(this.carryover),this.carryover=&quot;&quot;,[2,!0]);for((e=t.value.split(this.separator))[0]=this.carryover+e[0],n=0,r=e.slice(0,-1);n&lt;r.length;n++)i=r[n],this.outputQueue.push(i);return this.carryover=e[e.length-1],[2,!0]}})})},e}(s.OneToManyIterator)},{&quot;./lazy_iterator&quot;:233}],235:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;./file_chunk_iterator&quot;);n.urlChunkIterator=function(e,n){return void 0===n&amp;&amp;(n={}),r(this,void 0,void 0,function(){var r,s,u,l;return i(this,function(i){switch(i.label){case 0:return o.ENV.get(&quot;IS_BROWSER&quot;)?[4,fetch(e)]:[3,5];case 1:return(r=i.sent()).ok?[4,r.blob()]:[3,3];case 2:return s=i.sent(),[2,new a.FileChunkIterator(s,n)];case 3:throw new Error(r.statusText);case 4:return[3,9];case 5:if(u=t(&quot;node-fetch&quot;),&quot;string&quot;!=typeof e)throw new Error(&quot;URL must be a string. Request objects are not supported in the node.js environment yet.&quot;);return[4,u(e)];case 6:return(r=i.sent()).ok?[4,r.buffer()]:[3,8];case 7:return l=i.sent(),[2,new a.FileChunkIterator(l,n)];case 8:throw new Error(r.statusText);case 9:return[2]}})})}},{&quot;./file_chunk_iterator&quot;:232,&quot;@tensorflow/tfjs-core&quot;:138,&quot;node-fetch&quot;:302}],236:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;./dataset&quot;),a=t(&quot;./datasets/csv_dataset&quot;),s=t(&quot;./iterators/lazy_iterator&quot;),u=t(&quot;./sources/url_data_source&quot;);n.csv=function(t,e){return void 0===e&amp;&amp;(e={}),new a.CSVDataset(new u.URLDataSource(t),e)},n.func=function(t){var e=this,n=s.iteratorFromFunction(t);return o.datasetFromIteratorFn(function(){return r(e,void 0,void 0,function(){return i(this,function(t){return[2,n]})})})},n.generator=function(t){var e=this;return o.datasetFromIteratorFn(function(){return r(e,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return[4,t()];case 1:return e=n.sent(),[2,s.iteratorFromFunction(function(){return e.next()})]}})})})}},{&quot;./dataset&quot;:226,&quot;./datasets/csv_dataset&quot;:227,&quot;./iterators/lazy_iterator&quot;:233,&quot;./sources/url_data_source&quot;:238}],237:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;@tensorflow/tfjs-core&quot;),u=t(&quot;../datasource&quot;),l=t(&quot;../iterators/file_chunk_iterator&quot;),c=t(&quot;../util/source_util&quot;),f=function(e){function n(t,n){void 0===n&amp;&amp;(n={});var r=e.call(this)||this;return r.input=t,r.options=n,r}return i(n,e),n.prototype.iterator=function(){return o(this,void 0,void 0,function(){var e;return a(this,function(n){return c.isLocalPath(this.input)&amp;&amp;s.ENV.get(&quot;IS_NODE&quot;)&amp;&amp;(e=t(&quot;fs&quot;),this.input=e.readFileSync(this.input.substr(7))),[2,new l.FileChunkIterator(this.input,this.options)]})})},n}(u.DataSource);n.FileDataSource=f},{&quot;../datasource&quot;:229,&quot;../iterators/file_chunk_iterator&quot;:232,&quot;../util/source_util&quot;:242,&quot;@tensorflow/tfjs-core&quot;:138,fs:302}],238:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;../datasource&quot;),u=t(&quot;../iterators/url_chunk_iterator&quot;),l=t(&quot;../util/source_util&quot;),c=t(&quot;./file_data_source&quot;),f=function(t){function e(e,n){void 0===n&amp;&amp;(n={});var r=t.call(this)||this;return r.url=e,r.fileOptions=n,r}return i(e,t),e.prototype.iterator=function(){return o(this,void 0,void 0,function(){return a(this,function(t){return l.isLocalPath(this.url)?[2,new c.FileDataSource(this.url,this.fileOptions).iterator()]:[2,u.urlChunkIterator(this.url,this.fileOptions)]})})},e}(s.DataSource);n.URLDataSource=f},{&quot;../datasource&quot;:229,&quot;../iterators/url_chunk_iterator&quot;:235,&quot;../util/source_util&quot;:242,&quot;./file_data_source&quot;:237}],239:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;);function a(t,e,n,r){if(void 0===n&amp;&amp;(n=new Map),void 0===r&amp;&amp;(r=new Set),null==t)return null;if(r.has(t))throw new Error(&quot;Circular references are not supported.&quot;);if(n.has(t))return n.get(t);var i=e(t);if(i.recurse&amp;&amp;null!==i.value)throw new Error(&quot;A deep map function may not return both a value and recurse=true.&quot;);if(i.recurse){if(u(t)){var o=Array.isArray(t)?[]:{};for(var s in r.add(t),t){var l=a(t[s],e,n,r);o[s]=l}return r.delete(t),o}throw new Error(&quot;Can&apos;t recurse into non-iterable type: &quot;+t)}return n.set(t,i.value),i.value}function s(t){return null===t?null:u(t[0])?{value:null,recurse:!0}:{value:t,recurse:!1}}function u(t){return null!=t&amp;&amp;(Array.isArray(t)||&quot;object&quot;==typeof t&amp;&amp;!(t instanceof o.Tensor))}n.deepMap=function(t,e){return a(t,e)},n.deepZip=function(t,e){return void 0===e&amp;&amp;(e=s),function t(e,n,r){void 0===r&amp;&amp;(r=new Set);var i=e[0];if(r.has(i))throw new Error(&quot;Circular references are not supported.&quot;);var o=n(e);if(o.recurse&amp;&amp;null!==o.value)throw new Error(&quot;A deep zip function may not return both a value and recurse=true.&quot;);if(o.recurse){if(u(i)){var a=Array.isArray(i)?[]:{};r.add(i);var s=function(i){var o=e.map(function(t){return t[i]}),s=t(o,n,r);a[i]=s};for(var l in i)s(l);return r.delete(i),a}throw new Error(&quot;Can&apos;t recurse into non-iterable type: &quot;+i)}return o.value}(t,e)},n.zipToList=s,n.deepMapAndAwaitAll=function(t,e){return r(this,void 0,void 0,function(){var n,r,o,s,u,l;return i(this,function(i){switch(i.label){case 0:n=new Map,a(t,e,n),r=0,o=Array.from(n.keys()),i.label=1;case 1:return r&lt;o.length?(s=o[r],(u=n.get(s))instanceof Promise?[4,u]:[3,3]):[3,4];case 2:l=i.sent(),n.set(s,l),i.label=3;case 3:return r++,[3,1];case 4:return[2,a(t,e,n)]}})})},n.isIterable=u,n.canTensorify=function(t){return null==t||null===(e=t)||&quot;object&quot;!=typeof e&amp;&amp;&quot;function&quot;!=typeof e||Array.isArray(t)||&quot;object&quot;==typeof t&amp;&amp;t instanceof o.Tensor||o.util.isTypedArray(t);var e}},{&quot;@tensorflow/tfjs-core&quot;:138}],240:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=function(t){function e(){return t.call(this,e.INITIAL_CAPACITY)||this}return i(e,t),e.prototype.isFull=function(){return!1},e.prototype.push=function(e){t.prototype.isFull.call(this)&amp;&amp;this.expand(),t.prototype.push.call(this,e)},e.prototype.unshift=function(e){t.prototype.isFull.call(this)&amp;&amp;this.expand(),t.prototype.unshift.call(this,e)},e.prototype.expand=function(){for(var t=2*this.capacity,e=new Array(t),n=this.length(),r=0;r&lt;n;r++)e[r]=this.get(this.wrap(this.begin+r));this.data=e,this.capacity=t,this.doubledCapacity=2*this.capacity,this.begin=0,this.end=n},e.INITIAL_CAPACITY=32,e}(t(&quot;./ring_buffer&quot;).RingBuffer);n.GrowingRingBuffer=o},{&quot;./ring_buffer&quot;:241}],241:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=function(){function t(t){if(this.capacity=t,this.begin=0,this.end=0,null==t)throw new RangeError(&quot;Can&apos;t create a ring buffer of unknown capacity.&quot;);if(t&lt;1)throw new RangeError(&quot;Can&apos;t create ring buffer of capacity &lt; 1.&quot;);this.data=new Array(t),this.doubledCapacity=2*t}return t.prototype.wrap=function(t){for(;t&lt;0;)t+=this.doubledCapacity;return t%this.doubledCapacity},t.prototype.get=function(t){if(t&lt;0)throw new RangeError(&quot;Can&apos;t get item at a negative index.&quot;);return this.data[t%this.capacity]},t.prototype.set=function(t,e){if(t&lt;0)throw new RangeError(&quot;Can&apos;t set item at a negative index.&quot;);this.data[t%this.capacity]=e},t.prototype.length=function(){var t=this.end-this.begin;return t&lt;0&amp;&amp;(t=this.doubledCapacity+t),t},t.prototype.isFull=function(){return this.length()===this.capacity},t.prototype.isEmpty=function(){return 0===this.length()},t.prototype.push=function(t){if(this.isFull())throw new RangeError(&quot;Ring buffer is full.&quot;);this.set(this.end,t),this.end=this.wrap(this.end+1)},t.prototype.pushAll=function(t){for(var e=0,n=t;e&lt;n.length;e++){var r=n[e];this.push(r)}},t.prototype.pop=function(){if(this.isEmpty())throw new RangeError(&quot;Ring buffer is empty.&quot;);this.end=this.wrap(this.end-1);var t=this.get(this.end);return this.set(this.end,void 0),t},t.prototype.unshift=function(t){if(this.isFull())throw new RangeError(&quot;Ring buffer is full.&quot;);this.begin=this.wrap(this.begin-1),this.set(this.begin,t)},t.prototype.shift=function(){if(this.isEmpty())throw new RangeError(&quot;Ring buffer is empty.&quot;);var t=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),t},t.prototype.shuffleExcise=function(t){if(this.isEmpty())throw new RangeError(&quot;Ring buffer is empty.&quot;);var e=this.wrap(this.begin+t),n=this.get(e);return this.set(e,this.pop()),n},t}();n.RingBuffer=r},{}],242:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.isLocalPath=function(t){return&quot;string&quot;==typeof t&amp;&amp;&quot;file://&quot;===t.substr(0,7)}},{}],243:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});n.version=&quot;1.1.0&quot;},{}],244:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;./backend/tfjs_backend&quot;),u=t(&quot;./utils/generic_utils&quot;),l=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.getConfig=function(){return{}},e}(a.serialization.Serializable);n.Activation=l;var c=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t,e){return void 0===e&amp;&amp;(e=1),s.elu(t,e)},e.className=&quot;elu&quot;,e}(l);n.Elu=c,a.serialization.registerClass(c);var f=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t){return o.selu(t)},e.className=&quot;selu&quot;,e}(l);n.Selu=f,a.serialization.registerClass(f);var p=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t){return o.relu(t)},e.className=&quot;relu&quot;,e}(l);n.Relu=p,a.serialization.registerClass(p);var h=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t){return a.tidy(function(){return o.minimum(6,o.relu(t))})},e.className=&quot;relu6&quot;,e}(l);n.Relu6=h,a.serialization.registerClass(h);var d=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t){return t},e.className=&quot;linear&quot;,e}(l);n.Linear=d,a.serialization.registerClass(d);var m=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t){return o.sigmoid(t)},e.className=&quot;sigmoid&quot;,e}(l);n.Sigmoid=m,a.serialization.registerClass(m);var g=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t){return s.hardSigmoid(t)},e.className=&quot;hardSigmoid&quot;,e}(l);n.HardSigmoid=g,a.serialization.registerClass(g);var v=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t){return o.softplus(t)},e.className=&quot;softplus&quot;,e}(l);n.Softplus=v,a.serialization.registerClass(v);var y=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t){return s.softsign(t)},e.className=&quot;softsign&quot;,e}(l);n.Softsign=y,a.serialization.registerClass(y);var b=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t){return o.tanh(t)},e.className=&quot;tanh&quot;,e}(l);n.Tanh=b,a.serialization.registerClass(b);var _=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t,e){return void 0===e&amp;&amp;(e=-1),o.softmax(t,e)},e.className=&quot;softmax&quot;,e}(l);function w(t,e){return void 0===e&amp;&amp;(e={}),u.deserializeKerasObject(t,a.serialization.SerializationMap.getMap().classNameMap,e,&quot;activation&quot;)}n.Softmax=_,a.serialization.registerClass(_),n.serializeActivation=function(t){return t.getClassName()},n.deserializeActivation=w,n.getActivation=function(t){var e;return null==t?w(e={className:&quot;linear&quot;,config:{}}):&quot;string&quot;==typeof t?((e={}).className=t,e.config={},w(e)):t instanceof l?t:w(t)}},{&quot;./backend/tfjs_backend&quot;:247,&quot;./utils/generic_utils&quot;:291,&quot;@tensorflow/tfjs-core&quot;:138}],245:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r,i=t(&quot;@tensorflow/tfjs-core&quot;);n.epsilon=function(){return null==r&amp;&amp;(r=i.backend().epsilon()),r},n.setEpsilon=function(t){r=t},n.imageDataFormat=function(){return&quot;channelsLast&quot;}},{&quot;@tensorflow/tfjs-core&quot;:138}],246:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=0;n.getNextUniqueTensorId=function(){return r++};var i={};n.getUid=function(t){return void 0===t&amp;&amp;(t=&quot;&quot;),t in i||(i[t]=0),i[t]+=1,t+i[t].toString()}},{}],247:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;@tensorflow/tfjs-core&quot;),o=t(&quot;../common&quot;),a=t(&quot;../errors&quot;),s=t(&quot;../utils/math_utils&quot;),u=t(&quot;./common&quot;),l=&quot;webgl&quot;;function c(t,e){void 0===e&amp;&amp;(e=-1);var n=t.shape.slice();return e&lt;0&amp;&amp;(e=n.length+e+1),n.splice(e,0,1),t.reshape(n)}function f(t,e,n){return i.tidy(function(){switch(t.rank){case 1:return r.slice1d(t,e,n);case 2:return r.slice2d(t,[e,0],[n,t.shape[1]]);case 3:return r.slice3d(t,[e,0,0],[n,t.shape[1],t.shape[2]]);case 4:return r.slice4d(t,[e,0,0,0],[n,t.shape[1],t.shape[2],t.shape[3]]);default:throw new a.ValueError(&quot;sliceAlongFirstAxis() received an unsupported tensor rank: &quot;+t.rank)}})}function p(t,e,n){return i.tidy(function(){switch(t.rank){case 1:return r.slice1d(t,e,n);case 2:return r.slice2d(t,[0,e],[t.shape[0],n]);case 3:return r.slice3d(t,[0,0,e],[t.shape[0],t.shape[1],n]);case 4:return r.slice4d(t,[0,0,0,e],[t.shape[0],t.shape[1],t.shape[2],n]);default:throw new a.ValueError(&quot;sliceAlongLastAxis() received an unsupported tensor rank: &quot;+t.rank)}})}function h(t,e){if(Array.isArray(e)||(e=[e]),t.rank!==e.length)throw new a.ValueError(&quot;The length of input n (&quot;+e.length+&quot;) does not match the number of dimensions in input x (&quot;+t.rank+&quot;)&quot;);return r.tile(t,e)}function d(t,e,n){var r=e.shape;if(1!==e.rank&amp;&amp;e.rank!==t)throw new a.ValueError(&quot;Unexpected bias dimensions: &quot;+e.rank+&quot;; expected it to be 1 or &quot;+t);if(5===t){if(&quot;channelsFirst&quot;===n)return 1===r.length?e.reshape([1,r[0],1,1,1]):e.reshape([1,r[3],r[0],r[1],r[2]]);if(&quot;channelsLast&quot;===n)return 1===r.length?e.reshape([1,1,1,1,r[0]]):e.reshape([1].concat(r))}else if(4===t){if(&quot;channelsFirst&quot;===n)return 1===r.length?e.reshape([1,r[0],1,1]):e.reshape([1,r[2],r[0],r[1]]);if(&quot;channelsLast&quot;===n)return 1===r.length?e.reshape([1,1,1,r[0]]):e.reshape([1].concat(r))}else if(3===t){if(&quot;channelsFirst&quot;===n)return 1===r.length?e.reshape([1,r[0],1]):e.reshape([1,r[1],r[0]]);if(&quot;channelsLast&quot;===n)return 1===r.length?e.reshape([1,1,r[0]]):e.reshape([1].concat(r))}else if(t&lt;3)return e;throw new a.ValueError(&quot;Unsupported input rank by biasAdd: &quot;+e.rank)}n.setBackend=function(t){r.setBackend(t),l=t},n.getBackend=function(){return l},n.isBackendSymbolic=function(){return!1},n.countParams=function(t){var e=t.shape;return e.length&gt;0?e.reduce(function(t,e){return t*e}):1},n.cast=function(t,e){return t.asType(e)},n.expandDims=c,n.repeat=function(t,e){return i.tidy(function(){if(2!==t.shape.length)throw new a.ValueError(&quot;repeat() expects a rank-2 tensor, but received a rank-&quot;+t.shape.length+&quot; tensor.&quot;);return h(c(t,1),[1,e,1])})},n.flatten=function(t){var e=[s.arrayProd(t.shape)];return t.reshape(e)},n.batchFlatten=function(t){if(t.rank&lt;=1)throw new a.ValueError(&quot;batchFlatten requires a minimum rank of 2. Got rank: &quot;+t.rank+&quot;.&quot;);var e=[t.shape[0],s.arrayProd(t.shape,1)];return t.reshape(e)},n.sliceAlongFirstAxis=f,n.sliceAlongLastAxis=p,n.sliceAlongAxis=function(t,e,n,o){return i.tidy(function(){switch(t.rank){case 1:return r.slice1d(t,e,n);case 2:switch(o){case 1:return f(t,e,n);case 2:return p(t,e,n);default:throw new a.ValueError(&quot;The axis is not within the rank of the tensor &quot;+o)}case 3:switch(o){case 1:return f(t,e,n);case 2:return r.slice3d(t,[0,e,0],[t.shape[0],n,t.shape[2]]);case 3:return p(t,e,n);default:throw new a.ValueError(&quot;The axis is not within the rank of the tensor &quot;+o)}case 4:switch(o){case 1:return f(t,e,n);case 2:return r.slice4d(t,[0,e,0,0],[t.shape[0],n,t.shape[2],t.shape[3]]);case 3:return r.slice4d(t,[0,0,e,0],[t.shape[0],t.shape[1],n,t.shape[3]]);case 4:return p(t,e,n);default:throw new a.ValueError(&quot;The axis is not within the rank of the tensor &quot;+o)}default:throw new a.ValueError(&quot;sliceAlongLastAxis() received an unsupported tensor rank: &quot;+t.rank)}})},n.concatenate=function(t,e){var n;return void 0===e&amp;&amp;(e=-1),e&lt;0&amp;&amp;(e=0!==(n=t[0].rank)?n:0),e===t[0].rank&amp;&amp;(e=-1),r.concat(t,e)},n.concatAlongFirstAxis=function(t,e){switch(t.rank){case 1:return r.concat1d([t,e]);case 2:return r.concat2d([t,e],0);case 3:return r.concat3d([t,e],0);case 4:return r.concat4d([t,e],0);default:throw new a.ValueError(&quot;concatAlongFirstAxis() received an unsupported tensor rank: &quot;+t.rank)}},n.tile=h,n.randomNormal=function(t,e,n,i,o){return void 0===e&amp;&amp;(e=0),void 0===n&amp;&amp;(n=1),r.randomNormal(t,e,n,i,o)},n.dot=function(t,e,n,i){if(t.rank&lt;2||e.rank&lt;2)throw new a.NotImplementedError(&quot;dot requires both inputs to be rank &gt;= 2 but got x shape = &quot;+t.shape+&quot; and y shape = &quot;+e.shape);if(e.rank&gt;=3&amp;&amp;(c=t.shape.slice(-1)[0])!==(h=e.shape.slice(-2)[0]))throw new a.NotImplementedError(&quot;If rank y &gt;= 3, then the second last dim of y must equal the last dim of x but got x shape = &quot;+t.shape+&quot; and  y shape = &quot;+e.shape);if(2===t.rank&amp;&amp;2===e.rank){var o=!1,s=!1;return r.fused.matMul(t,e,o,s,i?d(t.rank,i,u.imageDataFormat()):null,n)}var l=t.shape.slice(),c=l.pop();t=t.reshape([-1,c]);var f=e.shape.slice(),p=f.pop(),h=f.pop(),m=f.concat([p]),g=Array.from({length:e.rank},function(t,n){return 0===n?e.rank-2:n&lt;=e.rank-2?n-1:n});e=e.transpose(g).reshape([h,-1]);var v=l.concat(m);return o=!1,s=!1,r.fused.matMul(t,e,o,s,i?d(t.rank,i,u.imageDataFormat()):null,n).reshape(v)},n.sign=function(t){return i.tidy(function(){var e=i.zerosLike(t),n=i.onesLike(t);return i.where(r.equal(t,e),e,i.where(r.greater(t,i.zerosLike(t)),n,r.mul(-1,n)))})},n.oneHot=function(t,e){return i.tidy(function(){if(1!==t.rank)throw new Error(&quot;Only 1D one-hot tensors are supported in the deeplearn backend, at present.&quot;);return t=t.toInt(),r.oneHot(t,e).toFloat()})},n.gather=function(t,e,n){return i.tidy(function(){return e=Array.isArray(e)?i.tensor1d(e,&quot;int32&quot;):e.toInt(),r.gather(t,e,n)})},n.square=function(t){return r.mulStrict(t,t)},n.pow=function(t,e){return i.tidy(function(){if(&quot;number&quot;==typeof e&amp;&amp;(e=i.scalar(Math.round(e),&quot;int32&quot;)),&quot;int32&quot;!==e.dtype)throw new a.NotImplementedError(&quot;Non-int32 dtype (&quot;+e.dtype+&quot;) is not supported by pow() yet&quot;);return r.pow(t,e)})},n.biasAdd=function(t,e,n){return i.tidy(function(){return null==n&amp;&amp;(n=u.imageDataFormat()),o.checkDataFormat(n),t.add(d(t.rank,e,n))})},n.elu=function(t,e){if(void 0===e&amp;&amp;(e=1),1!==e)throw new a.NotImplementedError(&quot;Support for alpha values other than 1 (&quot;+e+&quot;) is not implemented yet.&quot;);return r.elu(t)},n.softsign=function(t){return i.tidy(function(){return r.div(t,r.abs(t).add(1))})},n.dropout=function(t,e,n,o){return i.tidy(function(){if(null!=n&amp;&amp;!i.util.arraysEqual(t.shape,n))throw new a.NotImplementedError(&quot;Non-default noise shape is not implemented yet: &quot;+JSON.stringify(n));if(null!=o)throw new a.NotImplementedError(&quot;seed is not implemented for dropout yet.&quot;);var s=r.step(r.add(-e,r.randomUniform(t.shape,0,1,&quot;float32&quot;)));return s=r.mul(1/(1-e),s),r.mul(t,s)})},n.hardSigmoid=function(t){return i.tidy(function(){var e=r.add(.5,r.mul(.2,t));return r.clipByValue(e,0,1)})},n.inTrainPhase=function(t,e,n){return void 0===n&amp;&amp;(n=!1),n?t():e()}},{&quot;../common&quot;:250,&quot;../errors&quot;:259,&quot;../utils/math_utils&quot;:293,&quot;./common&quot;:245,&quot;@tensorflow/tfjs-core&quot;:138}],248:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;@tensorflow/tfjs-core&quot;),u=t(&quot;./errors&quot;),l=t(&quot;./logs&quot;),c=t(&quot;./utils/generic_utils&quot;);!function(t){t[t.SILENT=0]=&quot;SILENT&quot;,t[t.VERBOSE=1]=&quot;VERBOSE&quot;}(n.ModelLoggingVerbosity||(n.ModelLoggingVerbosity={}));var f=function(){function t(){this.validationData=null}return t.prototype.setParams=function(t){this.params=t},t.prototype.onEpochBegin=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(t){return[2]})})},t.prototype.onEpochEnd=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(t){return[2]})})},t.prototype.onBatchBegin=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(t){return[2]})})},t.prototype.onBatchEnd=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(t){return[2]})})},t.prototype.onTrainBegin=function(t){return o(this,void 0,void 0,function(){return a(this,function(t){return[2]})})},t.prototype.onTrainEnd=function(t){return o(this,void 0,void 0,function(){return a(this,function(t){return[2]})})},t.prototype.setModel=function(t){},t}();n.BaseCallback=f;var p=function(){function t(t,e){void 0===e&amp;&amp;(e=10),null==t&amp;&amp;(t=[]),this.callbacks=t,this.queueLength=e}return t.prototype.append=function(t){this.callbacks.push(t)},t.prototype.setParams=function(t){for(var e=0,n=this.callbacks;e&lt;n.length;e++){n[e].setParams(t)}},t.prototype.setModel=function(t){for(var e=0,n=this.callbacks;e&lt;n.length;e++){n[e].setModel(t)}},t.prototype.onEpochBegin=function(t,e){return o(this,void 0,void 0,function(){var n,r;return a(this,function(i){switch(i.label){case 0:null==e&amp;&amp;(e={}),n=0,r=this.callbacks,i.label=1;case 1:return n&lt;r.length?[4,r[n].onEpochBegin(t,e)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.onEpochEnd=function(t,e){return o(this,void 0,void 0,function(){var n,r;return a(this,function(i){switch(i.label){case 0:null==e&amp;&amp;(e={}),n=0,r=this.callbacks,i.label=1;case 1:return n&lt;r.length?[4,r[n].onEpochEnd(t,e)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.onBatchBegin=function(t,e){return o(this,void 0,void 0,function(){var n,r;return a(this,function(i){switch(i.label){case 0:null==e&amp;&amp;(e={}),n=0,r=this.callbacks,i.label=1;case 1:return n&lt;r.length?[4,r[n].onBatchBegin(t,e)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.onBatchEnd=function(t,e){return o(this,void 0,void 0,function(){var n,r;return a(this,function(i){switch(i.label){case 0:null==e&amp;&amp;(e={}),n=0,r=this.callbacks,i.label=1;case 1:return n&lt;r.length?[4,r[n].onBatchEnd(t,e)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.onTrainBegin=function(t){return o(this,void 0,void 0,function(){var e,n;return a(this,function(r){switch(r.label){case 0:null==t&amp;&amp;(t={}),e=0,n=this.callbacks,r.label=1;case 1:return e&lt;n.length?[4,n[e].onTrainBegin(t)]:[3,4];case 2:r.sent(),r.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},t.prototype.onTrainEnd=function(t){return o(this,void 0,void 0,function(){var e,n;return a(this,function(r){switch(r.label){case 0:null==t&amp;&amp;(t={}),e=0,n=this.callbacks,r.label=1;case 1:return e&lt;n.length?[4,n[e].onTrainEnd(t)]:[3,4];case 2:r.sent(),r.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},t}();n.CallbackList=p;var h=function(){function t(t){this.yieldEvery=t,this.batchCount=0,this.batchDurationsMillis=[],this.autoYieldEveryBatches=null,this.batchStartMillis=s.util.now()}return t.prototype.maybeYieldOnBatch=function(e){return o(this,void 0,void 0,function(){var e,n;return a(this,function(r){switch(r.label){case 0:return&quot;auto&quot;!==this.yieldEvery?[3,5]:(this.batchCount++,null!=this.autoYieldEveryBatches?[3,2]:(e=s.util.now(),[4,s.nextFrame()]));case 1:return r.sent(),this.batchCount&gt;t.SKIP_FIRST_BATCHES&amp;&amp;(this.batchDurationsMillis.push(e-this.batchStartMillis),this.batchDurationsMillis.length&gt;=t.DECISION_BATCH_COUNT&amp;&amp;(n=this.batchDurationsMillis.reduce(function(t,e){return t+e})/this.batchDurationsMillis.length,this.autoYieldEveryBatches=Math.round(t.THRESHOLD_MILLIS/n),this.autoYieldEveryBatches&lt;1&amp;&amp;(this.autoYieldEveryBatches=1))),this.batchStartMillis=s.util.now(),this.lastYieldBatchCount=this.batchCount,[3,4];case 2:return this.batchCount-this.lastYieldBatchCount&gt;=this.autoYieldEveryBatches?[4,s.nextFrame()]:[3,4];case 3:r.sent(),this.lastYieldBatchCount=this.batchCount,r.label=4;case 4:return[3,7];case 5:return&quot;batch&quot;!==this.yieldEvery?[3,7]:[4,s.nextFrame()];case 6:r.sent(),r.label=7;case 7:return[2]}})})},t.prototype.maybeYieldOnEpoch=function(){return o(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return&quot;epoch&quot;!==this.yieldEvery?[3,2]:[4,s.nextFrame()];case 1:t.sent(),t.label=2;case 2:return[2]}})})},t.SKIP_FIRST_BATCHES=1,t.DECISION_BATCH_COUNT=2,t.THRESHOLD_MILLIS=16,t}();n.ModelTrainingYielder=h;var d=function(t){function e(e){var n=t.call(this)||this;return n.yieldEvery=e||&quot;auto&quot;,n}return i(e,t),e.prototype.onTrainBegin=function(t){return o(this,void 0,void 0,function(){return a(this,function(t){return this.autoYielder=new h(this.yieldEvery),[2]})})},e.prototype.onEpochBegin=function(t){return o(this,void 0,void 0,function(){return a(this,function(t){return this.seen=0,this.totals={},[2]})})},e.prototype.onBatchEnd=function(t,e){return o(this,void 0,void 0,function(){var t,n,r,i,o=this;return a(this,function(a){switch(a.label){case 0:return[4,this.autoYielder.maybeYieldOnBatch(e)];case 1:for(i in a.sent(),null==e&amp;&amp;(e={}),t=null==e.size?0:e.size,this.seen+=t,n=function(n){var i=e[n];if(&quot;number&quot;==typeof i)r.totals.hasOwnProperty(n)||(r.totals[n]=0),r.totals[n]=r.totals[n]+i*t;else{var a=void 0;n in r.totals?a=r.totals[n]:r.totals[n]=0,r.totals[n]=s.tidy(function(){return s.add(o.totals[n],s.mul(i,t))}),null!=a&amp;&amp;a.dispose()}},r=this,e)n(i);return[2]}})})},e.prototype.onEpochEnd=function(t,e){return o(this,void 0,void 0,function(){var t,n,r,i,o,u=this;return a(this,function(a){switch(a.label){case 0:return[4,this.autoYielder.maybeYieldOnEpoch()];case 1:if(a.sent(),null!=e)for(t=function(t){if(null==n.totals[t])return&quot;continue&quot;;&quot;number&quot;==typeof n.totals[t]?e[t]=n.totals[t]/n.seen:s.tidy(function(){e[t]=s.mul(s.div(1,u.seen),u.totals[t]),u.totals[t].dispose(),s.keep(e[t])})},n=this,r=0,i=this.params.metrics;r&lt;i.length;r++)o=i[r],t(o);return[2]}})})},e}(f);n.BaseLogger=d;var m=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.onTrainBegin=function(t){return o(this,void 0,void 0,function(){return a(this,function(t){return this.epoch=[],this.history={},[2]})})},e.prototype.onEpochEnd=function(t,e){return o(this,void 0,void 0,function(){var n;return a(this,function(r){for(n in null==e&amp;&amp;(e={}),this.epoch.push(t),e)null==this.history[n]&amp;&amp;(this.history[n]=[]),this.history[n].push(e[n]);return[2]})})},e.prototype.syncData=function(){return o(this,void 0,void 0,function(){var t,e,n,r,i,o,s,u,l;return a(this,function(a){switch(a.label){case 0:for(r in t=[],e=[],n=[],this.history)for(i=this.history[r],o=0;o&lt;i.length;++o)&quot;number&quot;!=typeof i[o]&amp;&amp;(s=i[o],t.push(s.data()),e.push(r),n.push(o));return[4,Promise.all(t)];case 1:for(u=a.sent(),l=0;l&lt;u.length;++l)this.history[e[l]][n[l]].dispose(),this.history[e[l]][n[l]]=u[l][0];return[2]}})})},e}(f);n.History=m;var g=function(t){function e(e){var n=t.call(this)||this;return n.trainBegin=e.onTrainBegin,n.trainEnd=e.onTrainEnd,n.epochBegin=e.onEpochBegin,n.epochEnd=e.onEpochEnd,n.batchBegin=e.onBatchBegin,n.batchEnd=e.onBatchEnd,n}return i(e,t),e.prototype.onEpochBegin=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(n){switch(n.label){case 0:return null==this.epochBegin?[3,3]:[4,l.resolveScalarsInLogs(e)];case 1:return n.sent(),[4,this.epochBegin(t,e)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.onEpochEnd=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(n){switch(n.label){case 0:return null==this.epochEnd?[3,3]:[4,l.resolveScalarsInLogs(e)];case 1:return n.sent(),[4,this.epochEnd(t,e)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.onBatchBegin=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(n){switch(n.label){case 0:return null==this.batchBegin?[3,3]:[4,l.resolveScalarsInLogs(e)];case 1:return n.sent(),[4,this.batchBegin(t,e)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.onBatchEnd=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(n){switch(n.label){case 0:return null==this.batchEnd?[3,3]:[4,l.resolveScalarsInLogs(e)];case 1:return n.sent(),[4,this.batchEnd(t,e)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.onTrainBegin=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return null==this.trainBegin?[3,3]:[4,l.resolveScalarsInLogs(t)];case 1:return e.sent(),[4,this.trainBegin(t)];case 2:e.sent(),e.label=3;case 3:return[2]}})})},e.prototype.onTrainEnd=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return null==this.trainEnd?[3,3]:[4,l.resolveScalarsInLogs(t)];case 1:return e.sent(),[4,this.trainEnd(t)];case 2:e.sent(),e.label=3;case 3:return[2]}})})},e}(f);n.CustomCallback=g,n.standardizeCallbacks=function(t){return null==t?null:t instanceof f?[t]:Array.isArray(t)&amp;&amp;t[0]instanceof f?t:c.toList(t).map(function(t){return new g(t)})};var v=function(){function t(){}return t.registerCallbackConstructor=function(e,n){s.util.assert(e&gt;=0&amp;&amp;Number.isInteger(e),function(){return&quot;Verbosity level is expected to be an integer &gt;= 0, but got &quot;+e}),t.checkForDuplicate(n),null==t.constructors[e]&amp;&amp;(t.constructors[e]=[]),t.constructors[e].push(n)},t.checkForDuplicate=function(e){for(var n in t.constructors){t.constructors[+n].forEach(function(t){if(t===e)throw new u.ValueError(&quot;Duplicate callback constructor.&quot;)})}},t.clear=function(){t.constructors={}},t.createCallbacks=function(e){var n=[];for(var r in t.constructors){var i=+r;e&gt;=i&amp;&amp;n.push.apply(n,t.constructors[i])}return n.map(function(t){return new t})},t.constructors={},t}();n.CallbackConstructorRegistry=v,n.configureCallbacks=function(t,e,n,r,i,o,a,s,u,l){var c=new m,f=[new d(e)].concat(v.createCallbacks(n));null!=t&amp;&amp;f.push.apply(f,t),f.push(c);var h=new p(f);return h.setParams({epochs:r,initialEpoch:i,samples:o,steps:a,batchSize:s,verbose:n,doValidation:u,metrics:l}),{callbackList:h,history:c}}},{&quot;./errors&quot;:259,&quot;./logs&quot;:284,&quot;./utils/generic_utils&quot;:291,&quot;@tensorflow/tfjs-core&quot;:138}],249:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;./base_callbacks&quot;),u=t(&quot;./engine/training&quot;),l=t(&quot;./errors&quot;),c=t(&quot;./logs&quot;),f=function(t){function e(){var e=null!==t&amp;&amp;t.apply(this,arguments)||this;return e.model=null,e}return i(e,t),e.prototype.setModel=function(t){if(!(t instanceof u.LayersModel))throw new Error(&quot;model must be a LayersModel, not some other Container&quot;);this.model=t},e}(s.BaseCallback);function p(t,e){return t&lt;e}function h(t,e){return t&gt;e}n.Callback=f;var d=function(t){function e(e){var n=t.call(this)||this;if(null==e&amp;&amp;(e={}),e.restoreBestWeights)throw new l.NotImplementedError(&quot;restoreBestWeights = True is not implemented in EarlyStopping yet.&quot;);return n.monitor=e.monitor||&quot;val_loss&quot;,n.minDelta=Math.abs(e.minDelta||0),n.patience=e.patience||0,n.verbose=e.verbose||0,n.mode=e.mode||&quot;auto&quot;,n.baseline=e.baseline,-1===[&quot;auto&quot;,&quot;min&quot;,&quot;max&quot;].indexOf(n.mode)&amp;&amp;(console.warn(&quot;EarlyStopping mode &apos;&quot;+n.mode+&quot;&apos; is invalid. Falling back to mode &apos;auto&apos;.&quot;),n.mode=&quot;auto&quot;),&quot;min&quot;===n.mode?n.monitorFunc=p:&quot;max&quot;===n.mode?n.monitorFunc=h:-1!==n.monitor.indexOf(&quot;acc&quot;)?n.monitorFunc=h:n.monitorFunc=p,n.monitorFunc===p&amp;&amp;(n.minDelta*=-1),n}return i(e,t),e.prototype.onTrainBegin=function(t){return o(this,void 0,void 0,function(){return a(this,function(t){return this.wait=0,this.stoppedEpoch=0,null!=this.baseline?this.best=this.baseline:this.best=this.monitorFunc===p?1/0:-1/0,[2]})})},e.prototype.onEpochEnd=function(t,e){return o(this,void 0,void 0,function(){var n;return a(this,function(r){switch(r.label){case 0:return[4,c.resolveScalarsInLogs(e)];case 1:return r.sent(),null==(n=this.getMonitorValue(e))?[2]:(this.monitorFunc(n-this.minDelta,this.best)?(this.best=n,this.wait=0):(this.wait++,this.wait&gt;=this.patience&amp;&amp;(this.stoppedEpoch=t,this.model.stopTraining=!0)),[2])}})})},e.prototype.onTrainEnd=function(t){return o(this,void 0,void 0,function(){return a(this,function(t){return this.stoppedEpoch&gt;0&amp;&amp;this.verbose&amp;&amp;console.log(&quot;Epoch &quot;+this.stoppedEpoch+&quot;: early stopping.&quot;),[2]})})},e.prototype.getMonitorValue=function(t){null==t&amp;&amp;(t={});var e=t[this.monitor];return null==e&amp;&amp;console.warn(&quot;Metric for EarlyStopping &quot;+this.monitor+&quot; is not available. Available metrics are: &quot;+Object.keys(t)),e},e}(f);function m(t){return new d(t)}n.EarlyStopping=d,n.earlyStopping=m,n.callbacks={earlyStopping:m}},{&quot;./base_callbacks&quot;:248,&quot;./engine/training&quot;:256,&quot;./errors&quot;:259,&quot;./logs&quot;:284}],250:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./keras_format/common&quot;),i=t(&quot;./utils/generic_utils&quot;),o=new Map;n.checkDataFormat=function(t){i.checkStringTypeUnionValue(r.VALID_DATA_FORMAT_VALUES,&quot;DataFormat&quot;,t)},n.checkPaddingMode=function(t){i.checkStringTypeUnionValue(r.VALID_PADDING_MODE_VALUES,&quot;PaddingMode&quot;,t)},n.checkPoolMode=function(t){i.checkStringTypeUnionValue(r.VALID_POOL_MODE_VALUES,&quot;PoolMode&quot;,t)};var a=[],s=&quot;/&quot;;n.nameScope=function(t,e){a.push(t);try{var n=e();return a.pop(),n}catch(t){throw a.pop(),t}},n.getScopedTensorName=function(t){if(!l(t))throw new Error(&quot;Not a valid tensor name: &apos;&quot;+t+&quot;&apos;&quot;);return(0===a.length?&quot;&quot;:a.join(s)+s)+t},n.getUniqueTensorName=function(t){if(!l(t))throw new Error(&quot;Not a valid tensor name: &apos;&quot;+t+&quot;&apos;&quot;);o.has(t)||o.set(t,0);var e=o.get(t);if(o.set(t,o.get(t)+1),e&gt;0){var n=t+&quot;_&quot;+e;return o.set(n,1),n}return t};var u=new RegExp(/^[A-Za-z][-A-Za-z0-9\._\/]*$/);function l(t){return!!t.match(u)}n.isValidTensorName=l},{&quot;./keras_format/common&quot;:269,&quot;./utils/generic_utils&quot;:291}],251:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;./backend/common&quot;),u=t(&quot;./utils/generic_utils&quot;);function l(t,e){return a.tidy(function(){return o.sqrt(o.sum(o.mulStrict(t,t),e,!0))})}var c=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.getConfig=function(){return{}},e}(a.serialization.Serializable);n.Constraint=c;var f=function(t){function e(e){var n=t.call(this)||this;return n.defaultMaxValue=2,n.defaultAxis=0,n.maxValue=null!=e.maxValue?e.maxValue:n.defaultMaxValue,n.axis=null!=e.axis?e.axis:n.defaultAxis,n}return i(e,t),e.prototype.apply=function(t){var e=this;return a.tidy(function(){var n=l(t,e.axis),r=o.clipByValue(n,0,e.maxValue);return o.mul(t,o.div(r,o.add(s.epsilon(),n)))})},e.prototype.getConfig=function(){return{maxValue:this.maxValue,axis:this.axis}},e.className=&quot;MaxNorm&quot;,e}(c);n.MaxNorm=f,a.serialization.registerClass(f);var p=function(t){function e(e){var n=t.call(this)||this;return n.defaultAxis=0,n.axis=null!=e.axis?e.axis:n.defaultAxis,n}return i(e,t),e.prototype.apply=function(t){var e=this;return a.tidy(function(){return o.div(t,o.add(s.epsilon(),l(t,e.axis)))})},e.prototype.getConfig=function(){return{axis:this.axis}},e.className=&quot;UnitNorm&quot;,e}(c);n.UnitNorm=p,a.serialization.registerClass(p);var h=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t){return o.relu(t)},e.className=&quot;NonNeg&quot;,e}(c);n.NonNeg=h,a.serialization.registerClass(h);var d=function(t){function e(e){var n=t.call(this)||this;return n.defaultMinValue=0,n.defaultMaxValue=1,n.defaultRate=1,n.defaultAxis=0,n.minValue=null!=e.minValue?e.minValue:n.defaultMinValue,n.maxValue=null!=e.maxValue?e.maxValue:n.defaultMaxValue,n.rate=null!=e.rate?e.rate:n.defaultRate,n.axis=null!=e.axis?e.axis:n.defaultAxis,n}return i(e,t),e.prototype.apply=function(t){var e=this;return a.tidy(function(){var n=l(t,e.axis),r=o.add(o.mul(e.rate,o.clipByValue(n,e.minValue,e.maxValue)),o.mul(1-e.rate,n));return o.mul(t,o.div(r,o.add(s.epsilon(),n)))})},e.prototype.getConfig=function(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}},e.className=&quot;MinMaxNorm&quot;,e}(c);function m(t,e){return void 0===e&amp;&amp;(e={}),u.deserializeKerasObject(t,a.serialization.SerializationMap.getMap().classNameMap,e,&quot;constraint&quot;)}n.MinMaxNorm=d,a.serialization.registerClass(d),n.CONSTRAINT_IDENTIFIER_REGISTRY_SYMBOL_MAP={maxNorm:&quot;MaxNorm&quot;,minMaxNorm:&quot;MinMaxNorm&quot;,nonNeg:&quot;NonNeg&quot;,unitNorm:&quot;UnitNorm&quot;},n.serializeConstraint=function(t){return u.serializeKerasObject(t)},n.deserializeConstraint=m,n.getConstraint=function(t){return null==t?null:&quot;string&quot;==typeof t?m({className:t in n.CONSTRAINT_IDENTIFIER_REGISTRY_SYMBOL_MAP?n.CONSTRAINT_IDENTIFIER_REGISTRY_SYMBOL_MAP[t]:t,config:{}}):t instanceof c?t:m(t)}},{&quot;./backend/common&quot;:245,&quot;./utils/generic_utils&quot;:291,&quot;@tensorflow/tfjs-core&quot;:138}],252:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;../backend/state&quot;),s=t(&quot;../errors&quot;),u=t(&quot;../layers/serialization&quot;),l=t(&quot;../utils/generic_utils&quot;),c=t(&quot;../utils/serialization_utils&quot;),f=t(&quot;../utils/types_utils&quot;),p=t(&quot;../variables&quot;),h=t(&quot;../version&quot;),d=t(&quot;./executor&quot;),m=t(&quot;./input_layer&quot;),g=t(&quot;./topology&quot;),v=function(t){function e(n){var r=t.call(this,{})||this;if(r.containerNodes=new Set,r.name=n.name,null==r.name){var i=r.getClassName().toLowerCase();r.name=a.getUid(i)}if(r.supportsMasking=!1,r.trainable_=!0,r.updatable=!0,Array.isArray(n.inputs)?r.inputs=n.inputs.slice():r.inputs=[n.inputs],Array.isArray(n.outputs)?r.outputs=n.outputs.slice():r.outputs=[n.outputs],l.unique(r.inputs).length!==r.inputs.length)throw new s.ValueError(&quot;The list of inputs passed to the model is redundant. All inputs should only appear once. Found: &quot;+r.inputs.map(function(t){return t.name}));l.unique(r.outputs).length!==r.outputs.length&amp;&amp;console.warn(&quot;The list of outputs passed to the model is redundant. All outputs should only appear once. Found: &quot;+r.outputs.map(function(t){return t.name})),r.inputLayers=[],r.inputLayersNodeIndices=[],r.inputLayersTensorIndices=[],r.outputLayers=[],r.outputLayersNodeIndices=[],r.outputLayersTensorIndices=[],r.layers=[];for(var o=0,u=r.outputs;o&lt;u.length;o++){var c=(O=u[o]).sourceLayer,f=O.nodeIndex,p=O.tensorIndex;r.outputLayers.push(c),r.outputLayersNodeIndices.push(f),r.outputLayersTensorIndices.push(p)}for(var h=0,d=r.inputs;h&lt;d.length;h++){c=(O=d[h]).sourceLayer,f=O.nodeIndex,p=O.tensorIndex;l.assert(0===f,&quot;input layer has &gt;1 nodes&quot;),l.assert(0===p,&quot;input layer has &gt;1 tensors&quot;),r.inputLayers.push(c),r.inputLayersNodeIndices.push(f),r.inputLayersTensorIndices.push(p)}r.inputNames=[],r.outputNames=[],r.feedInputShapes=[],r.feedInputNames=[],r.feedOutputNames=[];for(var v=0;v&lt;r.inputLayers.length;v++){if(!((c=r.inputLayers[v])instanceof m.InputLayer))throw new TypeError(&quot;Input layers to a LayersModel must be InputLayer objects. Received inputs: &quot;+n.inputs+&quot;. Input &quot;+v+&quot; (0-based) originates from layer type &quot;+c.getClassName()+&quot;.&quot;);r.inputNames.push(c.name),r.feedInputShapes.push(c.batchInputShape),r.feedInputNames.push(c.name)}for(var y=0,b=r.outputLayers;y&lt;b.length;y++){c=b[y];r.outputNames.push(c.name)}r.internalInputShapes=r.inputs.map(function(t){return t.shape}),r.internalOutputShapes=r.outputs.map(function(t){return t.shape});for(var _={},w={},x={},E={},k={},T=[],N=function(t,n,i,o,a,u){null!=o&amp;&amp;null!=a&amp;&amp;null!=u||(o=t.sourceLayer,a=t.nodeIndex,u=t.tensorIndex);var l=o.inboundNodes[a];if(-1!==i.indexOf(l))throw new s.RuntimeError(&quot;The tensor &quot;+t.name+&apos; at layer &quot;&apos;+o.name+&apos;&quot; is part of a cycle.&apos;);if(-1===n.indexOf(l)){r.containerNodes.add(e.nodeKey(o,a)),o.id in k||(k[o.id]=Object.keys(k).length),-1===i.indexOf(l)&amp;&amp;i.push(l);for(var c=l.inboundLayers.length,f=0;f&lt;c;f++){var p=l.inputTensors[f],h=l.inboundLayers[f],d=l.nodeIndices[f],m=l.tensorIndices[f];N(p,n,i,h,d,m)}for(n.push(l);i.indexOf(l)&gt;=0;)i.splice(i.indexOf(l),1);T.push(l)}},S=[],C=[],A=0,I=r.outputs;A&lt;I.length;A++){var O=I[A];N(O,S,C)}for(var M=0,R=T.slice().reverse();M&lt;R.length;M++){w[(et=R[M]).id]=et,et.id in _||(_[et.id]=0);var P=_[et.id],D=null==x[et.outboundLayer.id]?0:x[et.outboundLayer.id];P=Math.max(P,D),x[et.outboundLayer.id]=P,E[et.outboundLayer.id]=et.outboundLayer,_[et.id]=P;for(v=0;v&lt;et.inboundLayers.length;v++){var z=et.inboundLayers[v],L=(f=et.nodeIndices[v],z.inboundNodes[f]),F=null==_[L.id]?0:_[L.id];_[L.id]=Math.max(P+1,F),w[L.id]=L}}var V={};for(var B in _){(P=_[B])in V||(V[P]=[]),V[P].push(w[B])}var j={};for(var q in x){(P=x[q])in j||(j[P]=[]),j[P].push(E[q])}var U=Object.keys(j).map(function(t){return parseInt(t,10)}).sort(l.reverseNumberCompare);r.layers=[];for(var G=0,W=U;G&lt;W.length;G++){var H=j[P=W[G]];H.sort(function(t,e){var n=k[t.id],r=k[e.id];return n&lt;r?-1:n&gt;r?1:0});for(var $=0,K=H;$&lt;K.length;$++){c=K[$];r.layers.push(c)}}r.layersByDepth=j,U=Object.keys(V).map(function(t){return parseInt(t,10)}).sort(l.reverseNumberCompare);for(var Y=r.inputs.slice(),X=[],Z=0,Q=U;Z&lt;Q.length;Z++)for(var J=0,tt=V[P=Q[Z]];J&lt;tt.length;J++){var et;if(null!=(c=(et=tt[J]).outboundLayer)){for(var nt=0,rt=et.inputTensors;nt&lt;rt.length;nt++){O=rt[nt];if(-1===Y.indexOf(O))throw new s.RuntimeError(&quot;Graph disconnected: cannot obtain value for tensor &quot;+O+&apos; at layer &quot;&apos;+c.name+&apos;&quot;. The following previous layers were accessed without issue: &apos;+X)}for(var it=0,ot=et.outputTensors;it&lt;ot.length;it++){O=ot[it];Y.push(O)}X.push(c.name)}}r.nodesByDepth=V;for(var at=r.layers.map(function(t){return t.name}),st=function(t){var e=at.filter(function(e){return e===t}).length;if(1!==e)throw new s.RuntimeError(&apos;The name &quot;&apos;+t+&apos;&quot; is used &apos;+e+&quot; times in the model. All layer names should be unique. Layer names: &quot;+JSON.stringify(at))},ut=0,lt=at;ut&lt;lt.length;ut++){st(lt[ut])}return r.outboundNodes=[],r.inboundNodes=[],new g.Node({outboundLayer:r,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:r.inputs,outputTensors:r.outputs,inputMasks:r.inputs.map(function(t){return null}),outputMasks:r.outputs.map(function(t){return null}),inputShapes:r.inputs.map(function(t){return t.shape}),outputShapes:r.outputs.map(function(t){return t.shape})}),r.built=!0,r._refCount=1,r}return i(e,t),e.prototype.assertNotDisposed=function(){if(0===this._refCount)throw new Error(&quot;Container &apos;&quot;+this.name+&quot;&apos; is already disposed.&quot;)},e.prototype.dispose=function(){this.assertNotDisposed();var t={refCountAfterDispose:null,numDisposedVariables:0};if(0==--this._refCount)for(var e=0,n=this.layers;e&lt;n.length;e++){var r=n[e];t.numDisposedVariables+=r.dispose().numDisposedVariables}return t.refCountAfterDispose=this._refCount,t},Object.defineProperty(e.prototype,&quot;trainableWeights&quot;,{get:function(){if(this._trainableWeights.length&gt;0)throw new s.ValueError(&quot;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.&quot;);if(!this.trainable)return[];for(var t=[],e=0,n=this.layers;e&lt;n.length;e++){var r=n[e];t=t.concat(r.trainableWeights)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;nonTrainableWeights&quot;,{get:function(){for(var t=[],e=0,n=this.layers;e&lt;n.length;e++){var r=n[e];t.push.apply(t,r.nonTrainableWeights)}if(!this.trainable){for(var i=[],o=0,a=this.layers;o&lt;a.length;o++){r=a[o];i.push.apply(i,r.trainableWeights)}return i.concat(t)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;weights&quot;,{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),e.prototype.loadWeights=function(t,e){void 0===e&amp;&amp;(e=!0);for(var n={},r=0,i=0,o=this.layers;i&lt;o.length;i++)for(var a=0,u=o[i].weights;a&lt;u.length;a++){var l=u[a];if(null!=n[l.originalName])throw new s.ValueError(&quot;Duplicate weight name: &quot;+l.originalName);n[l.originalName]=l,r++}var c=[];for(var f in t){if(null!=n[f])c.push([n[f],t[f]]);else if(e)throw new s.ValueError(&quot;Provided weight data has no target variable: &quot;+f);delete n[f]}if(e){var h=[];for(var d in n)h.push(d);if(h.length&gt;0)throw new s.ValueError(h.length+&quot; of &quot;+r+&quot; weights are not set: &quot;+h)}p.batchSetValue(c)},e.prototype.updatedConfig=function(){var t=this.getConfig(),e={};return e.className=this.getClassName(),e.config=t,e.kerasVersion=&quot;tfjs-layers &quot;+h.version,e.backend=&quot;TensorFlow.js&quot;,e},e.prototype.toJSON=function(t,e){void 0===e&amp;&amp;(e=!0);var n=c.convertTsToPythonic(this.updatedConfig());return e?JSON.stringify(n):n},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){t=l.toList(t);for(var r=new d.FeedDict,i=0;i&lt;n.inputs.length;++i)r.add(n.inputs[i],t[i]);return d.execute(n.outputs,r,e)})},e.prototype.computeMask=function(t,e){var n=this;return o.tidy(function(){var r;return t=l.toList(t),r=null==e?l.pyListRepeat(null,t.length):l.toList(e),n.runInternalGraph(t,r)[1]})},e.prototype.computeOutputShape=function(t){var e=f.normalizeShapeList(t);if(e.length!==this.inputLayers.length)throw new s.ValueError(&quot;Invalid inputShape argument &quot;+t+&quot;: model has &quot;+this.inputLayers.length+&quot; tensor inputs.&quot;);for(var n={},r=0;r&lt;e.length;r++){var i=this.inputLayers[r],o=e[r];n[S=i.name+&quot;_0_0&quot;]=o}var a=Object.keys(this.nodesByDepth).map(function(t){return parseInt(t,10)}).sort(l.reverseNumberCompare);if(a.length&gt;1)for(var u=0,c=a;u&lt;c.length;u++)for(var p=c[u],h=0,d=this.nodesByDepth[p];h&lt;d.length;h++){var m=d[h];i=m.outboundLayer;if(-1===this.inputLayers.map(function(t){return t.id}).indexOf(i.id)){for(var g=[],v=0;v&lt;m.inboundLayers.length;v++){var y=m.inboundLayers[v],b=m.nodeIndices[v],_=m.tensorIndices[v],w=n[S=y.name+&quot;_&quot;+b+&quot;_&quot;+_];g.push(w)}var x=i.computeOutputShape(l.singletonOrArray(g)),E=f.normalizeShapeList(x),k=i.inboundNodes.indexOf(m);for(v=0;v&lt;E.length;v++){n[S=i.name+&quot;_&quot;+k+&quot;_&quot;+v]=E[v]}}}var T=[],N=[];for(r=0;r&lt;this.outputLayers.length;r++){i=this.outputLayers[r],k=this.outputLayersNodeIndices[r],_=this.outputLayersTensorIndices[r];var S=i.name+&quot;_&quot;+k+&quot;_&quot;+_;N.push(S)}for(r=0;r&lt;N.length;r++){var C=N[r];l.assert(C in n),T.push(n[C])}return l.singletonOrArray(T)},e.prototype.runInternalGraph=function(t,e){null==e&amp;&amp;(e=l.pyListRepeat(null,t.length));for(var n={},r=0;r&lt;this.inputs.length;++r){var i=this.inputs[r],o=t[r],a=e[r];n[i.id]=[o,a]}for(var u=0,c=Object.keys(this.nodesByDepth).map(function(t){return parseInt(t,10)}).sort(l.reverseNumberCompare);u&lt;c.length;u++)for(var f=c[u],p=0,h=this.nodesByDepth[f];p&lt;h.length;p++){for(var d=h[p],m=d.outboundLayer,g=d.inputTensors,v=d.outputTensors,y=new Array,b=0,_=g;b&lt;_.length;b++){(i=_[b]).id in n&amp;&amp;y.push(n[i.id])}if(y.length===g.length){var w={},x=void 0,E=void 0,k=void 0,T=void 0;if(null!=d.callArgs&amp;&amp;(w=d.callArgs),1===y.length){var N=y[0],S=N[0],C=N[1];null==w.mask&amp;&amp;(w.mask=C),k=l.toList(m.call(S,w)),T=l.toList(m.computeMask(S,C)),x=[S],E=[C]}else x=y.map(function(t){return t[0]}),E=y.map(function(t){return t[1]}),null==w.mask&amp;&amp;(w.mask=E),k=l.toList(m.call(x,w)),T=l.toList(m.computeMask(x,E));if(m.activityRegularizer)throw new s.NotImplementedError(&quot;LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.&quot;);for(r=0;r&lt;v.length;++r){i=v[r],o=k[r],a=T[r];n[i.id]=[o,a]}}}for(var A=[],I=[],O=[],M=0,R=this.outputs;M&lt;R.length;M++){i=R[M];l.assert(i.id in n,&quot;Could not compute output &quot;+i.name+&quot; : &quot;+i.id);var P=n[i.id],D=P[0];a=P[1];O.push(D.shape),A.push(D),I.push(a)}return[A,I,O]},e.prototype.buildNodeConversionMap=function(t){for(var n,r={},i=0,o=this.layers;i&lt;o.length;i++){var a=o[i];n=a instanceof e?1:0;for(var s=0;s&lt;a.inboundNodes.length;s++){var u=e.nodeKey(a,s);this.containerNodes.has(u)&amp;&amp;(r[u]=n,n+=1)}}return r},e.prototype.getLayer=function(t,e){if(null!=e){if(this.layers.length&lt;=e)throw new s.ValueError(&quot;Was asked to retrieve layer at index &quot;+e+&quot;, but model only has &quot;+this.layers.length+&quot; layer(s).&quot;);return this.layers[e]}if(null==t)throw new s.ValueError(&quot;Provide either a layer name or layer index&quot;);for(var n=0,r=this.layers;n&lt;r.length;n++){var i=r[n];if(i.name===t)return i}throw new s.ValueError(&quot;No such layer: &quot;+t)},e.prototype.calculateLosses=function(){var t=this;return o.tidy(function(){for(var n=[],r=0,i=t.layers;r&lt;i.length;r++)for(var o=i[r],a=0;a&lt;o.inboundNodes.length;++a){var s=e.nodeKey(o,a);t.containerNodes.has(s)&amp;&amp;n.push.apply(n,o.calculateLosses())}return n})},e.prototype.getConfig=function(){for(var t={name:this.name},n=this.buildNodeConversionMap(this.layers),r=[],i=0,o=this.layers;i&lt;o.length;i++){for(var a=(_=o[i]).getClassName(),s=_.getConfig(),u=[],l=0;l&lt;_.inboundNodes.length;l++){var c=_.inboundNodes[l],f=e.nodeKey(_,l),p={};if(this.containerNodes.has(f)){if(c.callArgs)try{JSON.stringify(c.callArgs),p=c.callArgs}catch(t){console.warn(&quot;Layer &quot;+_.name+&quot; was passed non-serializable keyword arguments: &quot;+c.callArgs+&quot;. They will not be included in the serialized model (and thus will be missing at deserialization time).&quot;),p={}}if(c.inboundLayers.length&gt;0){for(var h=[],d=0;d&lt;c.inboundLayers.length;d++){var m=c.inboundLayers[d],g=c.nodeIndices[d],v=c.tensorIndices[d];null==(x=n[e.nodeKey(m,g)])&amp;&amp;(x=0),h.push([m.name,x,v,p])}u.push(h)}}}var y={};y.name=_.name,y.className=a,y.config=s,y.inboundNodes=u,r.push(y)}t.layers=r;var b=[];for(d=0;d&lt;this.inputLayers.length;d++){var _=this.inputLayers[d];g=this.inputLayersNodeIndices[d],f=e.nodeKey(_,g);if(this.containerNodes.has(f)){null!==(x=n[f])&amp;&amp;void 0!==x||(x=0);v=this.inputLayersTensorIndices[d];b.push([_.name,x,v])}}t.inputLayers=b;var w=[];for(d=0;d&lt;this.outputLayers.length;d++){_=this.outputLayers[d],g=this.outputLayersNodeIndices[d],f=e.nodeKey(_,g);if(this.containerNodes.has(f)){var x;null!==(x=n[f])&amp;&amp;void 0!==x||(x=0);v=this.outputLayersTensorIndices[d];w.push([_.name,x,v])}}return t.outputLayers=w,t},e.fromConfig=function(t,e,n,r){void 0===n&amp;&amp;(n={}),void 0===r&amp;&amp;(r=!1);var i={},o={};function a(t,e){t.name in o?o[t.name].push(e):o[t.name]=[e]}function c(t,e){for(var n,r=[],o=0,s=e;o&lt;s.length;o++){var u=s[o],c=u[0],f=u[1],p=u[2];if(n=null==u[3]?{}:u[3],!(c in i))return void a(t,e);var h=i[c];if(h.inboundNodes.length&lt;=f)return void a(t,e);var d=h.inboundNodes[f];r.push(d.outputTensors[p])}r.length&gt;0&amp;&amp;t.apply(l.singletonOrArray(r),n)}function f(t){var n=t.name,o=u.deserialize(t,null!=e.customObjects?e.customObjects:{});o.setFastWeightInitDuringBuild(r),i[n]=o,t.inboundNodes.forEach(function(t){if(!(t instanceof Array))throw new s.ValueError(&quot;Corrupted configuration, expected array for nodeData: &quot;+t);a(o,t)})}for(var p=e.name,h=e.layers,d=0,m=h;d&lt;m.length;d++){f(y=m[d])}for(;!l.isObjectEmpty(o);)for(var g=0,v=h;g&lt;v.length;g++){var y=v[g];if((M=i[y.name]).name in o){var b=o[M.name];delete o[M.name];for(var _=0,w=b;_&lt;w.length;_++){c(M,w[_])}}}for(var x=[],E=[],k=0,T=e.inputLayers;k&lt;T.length;k++){var N=(y=T[k])[0],S=y[1],C=y[2];l.assert(N in i);var A=(M=i[N]).inboundNodes[S].outputTensors;x.push(A[C])}for(var I=0,O=e.outputLayers;I&lt;O.length;I++){N=(y=O[I])[0],S=y[1],C=y[2];l.assert(N in i);var M;A=(M=i[N]).inboundNodes[S].outputTensors;E.push(A[C])}return new t({inputs:x,outputs:E,name:p})},Object.defineProperty(e.prototype,&quot;stateful&quot;,{get:function(){if(this._stateful)throw new s.ValueError(&quot;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.&quot;);for(var t=0,e=this.layers;t&lt;e.length;t++){if(e[t].stateful)return!0}return!1},enumerable:!0,configurable:!0}),e.prototype.resetStates=function(){var t=this;o.tidy(function(){t.layers.forEach(function(t){t.stateful&amp;&amp;t.resetStates()})})},e}(g.Layer);n.Container=v},{&quot;../backend/state&quot;:246,&quot;../errors&quot;:259,&quot;../layers/serialization&quot;:282,&quot;../utils/generic_utils&quot;:291,&quot;../utils/serialization_utils&quot;:294,&quot;../utils/types_utils&quot;:295,&quot;../variables&quot;:297,&quot;../version&quot;:298,&quot;./executor&quot;:253,&quot;./input_layer&quot;:254,&quot;./topology&quot;:255,&quot;@tensorflow/tfjs-core&quot;:138}],253:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;../errors&quot;),o=t(&quot;../utils/generic_utils&quot;),a=t(&quot;./input_layer&quot;),s=t(&quot;./topology&quot;);var u=function(){function t(e){if(this.id2Value={},this.id2Mask={},this.name2Id={},e instanceof t)for(var n in e.id2Value)this.id2Value[n]=e.id2Value[n],n in e.id2Mask&amp;&amp;(this.id2Mask[n]=e.id2Mask[n]);else{if(null==e)return;for(var r=0,i=e;r&lt;i.length;r++){var o=i[r];this.add(o.key,o.value)}}}return t.prototype.add=function(t,e,n){if(null!=this.id2Value[t.id])throw new i.ValueError(&quot;Duplicate key: name=&quot;+t.name+&quot;, id=&quot;+t.id);return this.id2Value[t.id]=function(t,e){if(null==t.dtype||t.dtype===e.dtype)return e;try{return r.cast(e,t.dtype)}catch(n){throw new i.ValueError(&quot;The dtype of the feed (&quot;+e.dtype+&quot;) can not be cast to the dtype of the key &apos;&quot;+t.name+&quot;&apos; (&quot;+t.dtype+&quot;).&quot;)}}(t,e),this.name2Id[t.name]=t.id,null!=n&amp;&amp;(this.id2Mask[t.id]=n),this},t.prototype.addFeed=function(t){this.add(t.key,t.value)},t.prototype.hasKey=function(t){return null!=this.id2Value[t.id]},t.prototype.names=function(){return Object.keys(this.name2Id)},t.prototype.getValue=function(t){if(t instanceof s.SymbolicTensor){if(null==this.id2Value[t.id])throw new i.ValueError(&quot;Nonexistent key: &quot;+t.name);return this.id2Value[t.id]}var e=this.name2Id[t];if(null==e)throw new i.ValueError(&quot;Feed dict has no SymbolicTensor name: &quot;+t);return this.id2Value[e]},t.prototype.getMask=function(t){if(t instanceof s.SymbolicTensor){if(null==this.id2Value[t.id])throw new i.ValueError(&quot;Nonexistent key: &quot;+t.name);return this.id2Mask[t.id]}var e=this.name2Id[t];if(null==e)throw new i.ValueError(&quot;Feed dict has no SymbolicTensor name: &quot;+t);return this.id2Mask[e]},t.prototype.disposeMasks=function(){null!=this.id2Mask&amp;&amp;r.dispose(this.id2Mask)},t}();n.FeedDict=u;var l={},c={};function f(t,e){for(var n=new Set,r=[],i={},o=0,a=e.names();o&lt;a.length;o++){var s=a[o];n.add(s)}var u=[],l=[];for(u.push(t);u.length&gt;0;){var c=u[u.length-1];if(n.has(c.name))u.pop();else{var f=l[l.length-1]===u.length-1;if(0===c.inputs.length||f)u.pop(),r.push(c),n.add(c.name),f&amp;&amp;l.pop();else{l.push(u.length-1);for(var p=0,h=c.inputs;p&lt;h.length;p++){var d=h[p];null==i[d.name]&amp;&amp;(i[d.name]=new Set),i[d.name].add(c.name),n.has(d.name)||u.push(d)}}}}return{sorted:r,recipientMap:i}}function p(t){var e;if(1===t.sourceLayer.inboundNodes.length)e=t.sourceLayer.output;else{for(var n=null,r=0;r&lt;t.sourceLayer.inboundNodes.length;++r)for(var i=0,o=t.sourceLayer.inboundNodes[r].outputTensors;i&lt;o.length;i++){if(o[i].id===t.id){n=r;break}}e=t.sourceLayer.getOutputAt(n)}return e}n.execute=function(t,e,n,i){for(var s=null!=n&amp;&amp;n.training,h=Array.isArray(t),d=h?t:[t],m=d.map(function(t){return t.name}),g=[],v=e.names(),y=0,b=m;y&lt;b.length;y++){var _=b[y];-1!==v.indexOf(_)?g.push(e.getValue(_)):g.push(null)}null!=i&amp;&amp;(i.maxNumTensors=-1/0,i.minNumTensors=1/0);var w,x,E=m.join(&quot;,&quot;)+&quot;|&quot;+e.names().join(&quot;,&quot;);if(null==l[E]){var k=function(t,e){r.util.assert(null!=t&amp;&amp;t.length&gt;0,function(){return&quot;Expected at least one fetch, got none&quot;});var n=[],i={};if(1===t.length){var o=f(t[0],e);n=o.sorted,i=o.recipientMap}else for(var a=new Set,s=0,u=t;s&lt;u.length;s++){for(var l=u[s],c=f(l,e),p=c.sorted,h=c.recipientMap,d=0,m=p;d&lt;m.length;d++){var g=m[d];a.has(g.name)||(n.push(g),a.add(g.name))}var v=function(t){null==i[t]&amp;&amp;(i[t]=new Set),h[t].forEach(function(e){return i[t].add(e)})};for(var y in h)v(y)}return{sorted:n,recipientCounts:function(t){var e={};for(var n in t)e[n]=t[n].size;return e}(i)}}(d,e);w=k.sorted,x=k.recipientCounts,l[E]=w,c[E]=x}w=l[E],x={},s||Object.assign(x,c[E]);for(var T=new u(e),N=0;N&lt;w.length;++N){if(null!=i){var S=r.memory().numTensors;S&gt;i.maxNumTensors&amp;&amp;(i.maxNumTensors=S),S&lt;i.minNumTensors&amp;&amp;(i.minNumTensors=S)}var C=w[N],A=C.sourceLayer;if(!(A instanceof a.InputLayer)){for(var I=[],O=[],M=[],R=!1,P=0,D=C.inputs;P&lt;D.length;P++){var z=D[P],L=T.getValue(z),F=T.getMask(z);I.push(L),O.push(F),null!=F&amp;&amp;(R=!0),s||(x[z.name]--,0!==x[z.name]||e.hasKey(z)||-1!==m.indexOf(z.name)||L.isDisposed||!0===z.sourceLayer.stateful||M.push(L))}R&amp;&amp;((n=n||{}).mask=O[0]);var V=o.toList(A.apply(I,n)),B=null;A.supportsMasking&amp;&amp;(B=A.computeMask(I,O));for(var j=p(C),q=Array.isArray(j)?j:[j],U=0;U&lt;q.length;++U){T.hasKey(q[U])||T.add(q[U],V[U],Array.isArray(B)?B[0]:B);var G=m.indexOf(q[U].name);-1!==G&amp;&amp;(g[G]=V[U])}s||r.dispose(M)}}return T.disposeMasks(),h?g:g[0]},n.getTopologicalSortAndRecipientCountsForOneFetch=f},{&quot;../errors&quot;:259,&quot;../utils/generic_utils&quot;:291,&quot;./input_layer&quot;:254,&quot;./topology&quot;:255,&quot;@tensorflow/tfjs-core&quot;:138}],254:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;../backend/state&quot;),s=t(&quot;../errors&quot;),u=t(&quot;./topology&quot;),l=function(t){function e(e){var n=t.call(this,{dtype:e.dtype,name:null!=e.name?e.name:a.getUid(&quot;input&quot;).toString()})||this;if(null==e.batchSize&amp;&amp;(e.batchSize=null),null==e.sparse&amp;&amp;(e.sparse=!1),n.trainable=!1,n.built=!0,n.sparse=e.sparse,null!=e.inputShape&amp;&amp;null!=e.batchInputShape)throw new s.ValueError(&quot;Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.&quot;);var r=e.batchInputShape;if(null==r){if(null==e.inputShape)throw new s.ValueError(&quot;An InputLayer should be passed either a `batchInputShape` or an `inputShape`.&quot;);r=[e.batchSize].concat(e.inputShape)}else if(null!=e.batchSize)throw new s.ValueError(&quot;Cannot specify batchSize if batchInputShape is specified when creating an InputLayer.&quot;);var i=e.dtype||&quot;float32&quot;;n.batchInputShape=r,n.dtype=i,n.inputSpec=[{shape:r}];var o=new u.SymbolicTensor(n.dtype,n.batchInputShape,n,[],{},n.name);return o.nodeIndex=0,o.tensorIndex=0,new u.Node({outboundLayer:n,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[o],outputTensors:[o],inputMasks:[null],outputMasks:[null],inputShapes:[r],outputShapes:[r]}),n}return i(e,t),e.prototype.apply=function(t,e){throw new s.ValueError(&quot;Cannot pass any input to an InputLayer&apos;s apply() method. InputLayer name: &quot;+this.name)},e.prototype.dispose=function(){return{refCountAfterDispose:this._refCount,numDisposedVariables:0}},e.prototype.getConfig=function(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}},e.className=&quot;InputLayer&quot;,e}(u.Layer);n.InputLayer=l,o.serialization.registerClass(l),n.Input=function(t){if(null==t.batchShape&amp;&amp;null==t.shape)throw new Error(&quot;Please provide to Input either a `shape` or a `batchShape` argument. Note that `shape` does not include the batch dimension.&quot;);if(null!=t.batchShape&amp;&amp;null!=t.shape)throw new s.ValueError(&quot;Please provide either a `shape` or `batchShape` argument to Input, but not both.&quot;);var e=t.batchShape;null!=t.shape&amp;&amp;null==e&amp;&amp;(e=[null].concat(t.shape));var n=t.dtype;return null==n&amp;&amp;(n=&quot;float32&quot;),new l({batchInputShape:e,name:t.name,dtype:n,sparse:t.sparse}).inboundNodes[0].outputTensors[0]}},{&quot;../backend/state&quot;:246,&quot;../errors&quot;:259,&quot;./topology&quot;:255,&quot;@tensorflow/tfjs-core&quot;:138}],255:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;../backend/state&quot;),s=t(&quot;../common&quot;),u=t(&quot;../errors&quot;),l=t(&quot;../initializers&quot;),c=t(&quot;../utils/generic_utils&quot;),f=t(&quot;../utils/types_utils&quot;),p=t(&quot;../utils/variable_utils&quot;),h=t(&quot;../variables&quot;),d=function(){return function(t){this.dtype=t.dtype,this.shape=t.shape,null!=t.shape?this.ndim=t.shape.length:this.ndim=t.ndim,this.maxNDim=t.maxNDim,this.minNDim=t.minNDim,this.axes=t.axes||{}}}();n.InputSpec=d;var m=function(){return function(t,e,n,r,i,o,u){this.dtype=t,this.shape=e,this.sourceLayer=n,this.inputs=r,this.callArgs=i,this.outputTensorIndex=u,this.id=a.getNextUniqueTensorId(),null!=o&amp;&amp;(this.originalName=s.getScopedTensorName(o),this.name=s.getUniqueTensorName(this.originalName)),this.rank=e.length}}();n.SymbolicTensor=m;var g=0,v=function(){function t(t,e){this.callArgs=e,this.id=g++,this.outboundLayer=t.outboundLayer,this.inboundLayers=t.inboundLayers,this.nodeIndices=t.nodeIndices,this.tensorIndices=t.tensorIndices,this.inputTensors=t.inputTensors,this.outputTensors=t.outputTensors,this.inputMasks=t.inputMasks,this.outputMasks=t.outputMasks,this.inputShapes=t.inputShapes,this.outputShapes=t.outputShapes;for(var n=0,r=t.inboundLayers;n&lt;r.length;n++){var i=r[n];null!=i&amp;&amp;i.outboundNodes.push(this)}t.outboundLayer.inboundNodes.push(this)}return t.prototype.getConfig=function(){for(var t=[],e=0,n=this.inboundLayers;e&lt;n.length;e++){var r=n[e];null!=r?t.push(r.name):t.push(null)}return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:t,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}},t}();n.Node=v;var y=0,b=function(t){function e(e){var n=t.call(this)||this;n._callHook=null,n._addedWeightNames=[],n._stateful=!1,n.id=y++,n.activityRegularizer=null,n.inputSpec=null,n.supportsMasking=!1,n._trainableWeights=[],n._nonTrainableWeights=[],n._losses=[],n._updates=[],n._built=!1,n.inboundNodes=[],n.outboundNodes=[];var r=e.name;if(!r){var i=n.getClassName();r=c.toSnakeCase(i)+&quot;_&quot;+a.getUid(i)}if(n.name=r,n.trainable_=null==e.trainable||e.trainable,n.updatable=null==e.updatable||e.updatable,null!=e.inputShape||null!=e.batchInputShape){var o=void 0;if(null!=e.batchInputShape)o=e.batchInputShape;else if(null!=e.inputShape){var s=null;null!=e.batchSize&amp;&amp;(s=e.batchSize),o=[s].concat(e.inputShape)}n.batchInputShape=o;var u=e.dtype;null==u&amp;&amp;(u=e.inputDType),null==u&amp;&amp;(u=&quot;float32&quot;),n.dtype=u}return null!=e.weights?n.initialWeights=e.weights:n.initialWeights=null,n._refCount=null,n.fastWeightInitDuringBuild=!1,n}return i(e,t),e.nodeKey=function(t,e){return t.name+&quot;_ib-&quot;+e.toString()},e.prototype.getNodeAtIndex=function(t,e){if(0===this.inboundNodes.length)throw new u.RuntimeError(&quot;The layer has never been called and thus has no defined &quot;+e+&quot;.&quot;);if(this.inboundNodes.length&lt;=t)throw new u.ValueError(&quot;Asked to get &quot;+e+&quot; at node &quot;+t+&quot;, but the layer has only &quot;+this.inboundNodes.length+&quot; inbound nodes.&quot;);return this.inboundNodes[t]},e.prototype.getInputAt=function(t){return c.singletonOrArray(this.getNodeAtIndex(t,&quot;input&quot;).inputTensors)},e.prototype.getOutputAt=function(t){return c.singletonOrArray(this.getNodeAtIndex(t,&quot;output&quot;).outputTensors)},Object.defineProperty(e.prototype,&quot;input&quot;,{get:function(){if(this.inboundNodes.length&gt;1)throw new u.AttributeError(&quot;Layer &quot;+this.name+&apos; has multiple inbound nodes, hence the notion of &quot;layer input&quot; is ill-defined. Use `getInputAt(nodeIndex)` instead.&apos;);if(0===this.inboundNodes.length)throw new u.AttributeError(&quot;Layer &quot;+this.name+&quot; is not connected, no input to return.&quot;);return c.singletonOrArray(this.getNodeAtIndex(0,&quot;input&quot;).inputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;output&quot;,{get:function(){if(0===this.inboundNodes.length)throw new u.AttributeError(&quot;Layer &quot;+this.name+&quot; has no inbound nodes.&quot;);if(this.inboundNodes.length&gt;1)throw new u.AttributeError(&quot;Layer &quot;+this.name+&apos; has multiple inbound nodes, hence the notion of &quot;layer output&quot; is ill-defined. Use `getOutputAt(nodeIndex)` instead.&apos;);return c.singletonOrArray(this.getNodeAtIndex(0,&quot;output&quot;).outputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;losses&quot;,{get:function(){return this._losses},enumerable:!0,configurable:!0}),e.prototype.calculateLosses=function(){return this.losses.map(function(t){return t()})},Object.defineProperty(e.prototype,&quot;updates&quot;,{get:function(){return this._updates},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;built&quot;,{get:function(){return this._built},set:function(t){this._built=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;trainable&quot;,{get:function(){return this.trainable_},set:function(t){this._trainableWeights.forEach(function(e){e.trainable=t}),this.trainable_=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;trainableWeights&quot;,{get:function(){return this.trainable_?this._trainableWeights:[]},set:function(t){this._trainableWeights=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;nonTrainableWeights&quot;,{get:function(){return this.trainable_?this._nonTrainableWeights:this._trainableWeights.concat(this._nonTrainableWeights)},set:function(t){this._nonTrainableWeights=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;weights&quot;,{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;stateful&quot;,{get:function(){return this._stateful},enumerable:!0,configurable:!0}),e.prototype.resetStates=function(){if(!this.stateful)throw new Error(&quot;Cannot call the resetStates() method of a non-stateful Layer object.&quot;)},e.prototype.assertInputCompatibility=function(t){if(t=c.toList(t),null!=this.inputSpec&amp;&amp;0!==this.inputSpec.length){var e=c.toList(this.inputSpec);if(t.length!==e.length)throw new u.ValueError(&quot;Layer &quot;+this.name+&quot; expects &quot;+e.length+&quot; inputs, but it received &quot;+t.length+&quot; input tensors. Input received: &quot;+t);for(var n=0;n&lt;t.length;n++){var r=t[n],i=e[n];if(null!=i){var o=r.rank;if(null!=i.ndim&amp;&amp;o!==i.ndim)throw new u.ValueError(&quot;Input &quot;+n+&quot; is incompatible with layer &quot;+this.name+&quot;: expected ndim=&quot;+i.ndim+&quot;, found ndim=&quot;+o);if(null!=i.maxNDim&amp;&amp;o&gt;i.maxNDim)throw new u.ValueError(&quot;Input &quot;+n+&quot; is incompatible with layer &quot;+this.name+&quot;: expected max_ndim=&quot;+i.maxNDim+&quot;, found ndim=&quot;+o);if(null!=i.minNDim&amp;&amp;o&lt;i.minNDim)throw new u.ValueError(&quot;Input &quot;+n+&quot; is incompatible with layer &quot;+this.name+&quot;: expected min_ndim=&quot;+i.minNDim+&quot;, found ndim=&quot;+o+&quot;.&quot;);if(null!=i.dtype&amp;&amp;r.dtype!==i.dtype)throw new u.ValueError(&quot;Input &quot;+n+&quot; is incompatible with layer &quot;+this.name+&quot; : expected dtype=&quot;+i.dtype+&quot;, found dtype=&quot;+r.dtype+&quot;.&quot;);if(i.axes){var a=r.shape;for(var s in i.axes){var l=Number(s),f=i.axes[s],p=l&gt;=0?a[l]:a[a.length+l];if(null!=f&amp;&amp;-1===[f,null].indexOf(p))throw new u.ValueError(&quot;Input &quot;+n+&quot; is incompatible with layer &quot;+this.name+&quot;: expected axis &quot;+l+&quot; of input shape to have value &quot;+f+&quot; but got shape &quot;+a+&quot;.&quot;)}}if(null!=i.shape)for(var h=0;h&lt;i.shape.length;++h){var d=i.shape[h],m=r.shape[h];if(null!=d&amp;&amp;null!=m&amp;&amp;d!==m)throw new u.ValueError(&quot;Input &quot;+n+&quot; is incompatible with layer &quot;+this.name+&quot;: expected shape=&quot;+i.shape+&quot;, found shape=&quot;+r.shape+&quot;.&quot;)}}}}},e.prototype.call=function(t,e){return t},e.prototype.invokeCallHook=function(t,e){null!=this._callHook&amp;&amp;this._callHook(t,e)},e.prototype.setCallHook=function(t){this._callHook=t},e.prototype.clearCallHook=function(){this._callHook=null},e.prototype.apply=function(t,e){var n=this;e=e||{},this.assertNotDisposed();for(var r=c.toList(t),i=!0,o=0,a=r;o&lt;a.length;o++){if(!(a[o]instanceof m)){i=!1;break}}for(var l=!0,f=0,p=r;f&lt;p.length;f++){if(p[f]instanceof m){l=!1;break}}if(i===l)throw new u.ValueError(&quot;Arguments to apply() must be all SymbolicTensors or all Tensors&quot;);return s.nameScope(this.name,function(){if(!n.built){n.assertInputCompatibility(t);for(var i=[],o=0,a=c.toList(t);o&lt;a.length;o++){var s=a[o];i.push(s.shape)}n.build(c.singletonOrArray(i)),n.built=!0,n.initialWeights&amp;&amp;n.setWeights(n.initialWeights),null===n._refCount&amp;&amp;l&amp;&amp;(n._refCount=1)}if(n.assertInputCompatibility(t),l){for(var f=n.call(t,e),p=[],h=0,d=c.toList(f);h&lt;d.length;h++){var g=d[h];-1!==r.indexOf(g)&amp;&amp;(g=g.clone()),p.push(g)}if(f=c.singletonOrArray(p),null!=n.activityRegularizer)throw new u.NotImplementedError(&quot;Layer invocation in the presence of activity regularizer(s) is not supported yet.&quot;);return f}var v=function(t){for(var e=[],n=0,r=t=c.toList(t);n&lt;r.length;n++){var i=r[n];e.push(i.shape)}return c.singletonOrArray(e)}(t),y=n.computeOutputShape(v);f=void 0;if(n.warnOnIncompatibleInputShape(Array.isArray(t)?v[0]:v),f=null!=y&amp;&amp;y.length&gt;0&amp;&amp;Array.isArray(y[0])?y.map(function(r,i){return new m(&quot;float32&quot;,r,n,c.toList(t),e,n.name,i)}):new m(&quot;float32&quot;,y,n,c.toList(t),e,n.name),n.addInboundNode(t,f,null,null,v,y,e),n._refCount++,null!=n.activityRegularizer)throw new u.NotImplementedError(&quot;Layer invocation in the presence of activity regularizer(s) is not supported yet.&quot;);return f})},e.prototype.warnOnIncompatibleInputShape=function(t){if(null!=this.batchInputShape)if(t.length!==this.batchInputShape.length)console.warn(&quot;The rank of the input tensor provided (shape: &quot;+JSON.stringify(t)+&quot;) does not match that of the batchInputShape (&quot;+JSON.stringify(this.batchInputShape)+&quot;) of the layer &quot;+this.name);else{var e=!1;this.batchInputShape.forEach(function(n,r){null!=n&amp;&amp;null!=t[r]&amp;&amp;t[r]!==n&amp;&amp;(e=!0)}),e&amp;&amp;console.warn(&quot;The shape of the input tensor (&quot;+JSON.stringify(t)+&quot;) does not match the expectation of layer &quot;+this.name+&quot;: &quot;+JSON.stringify(this.batchInputShape))}},Object.defineProperty(e.prototype,&quot;outputShape&quot;,{get:function(){if(null==this.inboundNodes||0===this.inboundNodes.length)throw new u.AttributeError(&quot;The layer &quot;+this.name+&quot; has never been called and thus has no defined output shape.&quot;);for(var t=[],e=0,n=this.inboundNodes;e&lt;n.length;e++){var r=n[e],i=JSON.stringify(r.outputShapes);-1===t.indexOf(i)&amp;&amp;t.push(i)}if(1===t.length){var o=this.inboundNodes[0].outputShapes;return Array.isArray(o)&amp;&amp;Array.isArray(o[0])&amp;&amp;1===o.length?o[0]:o}throw new u.AttributeError(&quot;The layer &quot;+this.name+&apos; has multiple inbound nodes with different output shapes. Hence the notion of &quot;outut shape&quot; is ill-defined for the layer.&apos;)},enumerable:!0,configurable:!0}),e.prototype.countParams=function(){if(!this.built)throw new u.RuntimeError(&quot;You tried to call countParams() on &quot;+this.name+&quot;, but the layer is not built yet. Build it first by calling build(batchInputShape).&quot;);return p.countParamsInWeights(this.weights)},e.prototype.build=function(t){this.built=!0},e.prototype.getWeights=function(t){return void 0===t&amp;&amp;(t=!1),h.batchGetValue(t?this.trainableWeights:this.weights)},e.prototype.setWeights=function(t){var e=this;o.tidy(function(){var n=e.weights;if(n.length!==t.length)throw new u.ValueError(&apos;You called setWeights(weights) on layer &quot;&apos;+e.name+&apos;&quot; with a weight list of length &apos;+t.length+&quot;, but the layer was expecting &quot;+n.length+&quot; weights. Provided weights: &quot;+t+&quot;...&quot;);if(0!==n.length){for(var r=[],i=h.batchGetValue(n),a=0;a&lt;i.length;++a){var s=i[a],l=n[a],c=t[a];if(!o.util.arraysEqual(s.shape,c.shape))throw new u.ValueError(&quot;Layer weight shape &quot;+s.shape+&quot; not compatible with provided weight shape &quot;+c.shape);r.push([l,c])}h.batchSetValue(r)}})},e.prototype.addWeight=function(t,e,n,r,i,o,a){if(-1!==this._addedWeightNames.indexOf(t))throw new u.ValueError(&quot;Duplicate weight name &quot;+t+&quot; for layer &quot;+this.name);this._addedWeightNames.push(t),null==n&amp;&amp;(n=&quot;float32&quot;),this.fastWeightInitDuringBuild&amp;&amp;(r=l.getInitializer(&quot;zeros&quot;));var s=r.apply(e,n),c=new h.LayerVariable(s,n,t,o,a);return s.dispose(),null!=i&amp;&amp;this.addLoss(function(){return i.apply(c.read())}),null==o&amp;&amp;(o=!0),o?this._trainableWeights.push(c):this._nonTrainableWeights.push(c),c},e.prototype.setFastWeightInitDuringBuild=function(t){this.fastWeightInitDuringBuild=t},e.prototype.addLoss=function(t){var e;null==t||Array.isArray(t)&amp;&amp;0===t.length||(t=c.toList(t),void 0!==this._losses&amp;&amp;null!==this._losses&amp;&amp;(e=this.losses).push.apply(e,t))},e.prototype.computeOutputShape=function(t){return t},e.prototype.computeMask=function(t,e){var n=this;if(!this.supportsMasking){if(null!=e){if(!Array.isArray(e))throw new TypeError(&quot;Layer &quot;+this.name+&quot; does not support masking, but was passed an inputMask.&quot;);e.forEach(function(t){if(null!=t)throw new TypeError(&quot;Layer &quot;+n.name+&quot; does not support masking, but was passed an inputMask.&quot;)})}return null}return e},e.prototype.addInboundNode=function(t,e,n,r,i,o,a){void 0===a&amp;&amp;(a=null);var s=c.toList(t);e=c.toList(e),n=c.toList(n),r=c.toList(r),i=f.normalizeShapeList(i),o=f.normalizeShapeList(o);for(var u=[],l=[],p=[],h=0,d=s;h&lt;d.length;h++){var m=d[h];u.push(m.sourceLayer),l.push(m.nodeIndex),p.push(m.tensorIndex)}new v({outboundLayer:this,inboundLayers:u,nodeIndices:l,tensorIndices:p,inputTensors:s,outputTensors:e,inputMasks:n,outputMasks:r,inputShapes:i,outputShapes:o},a);for(var g=0;g&lt;e.length;g++)e[g].sourceLayer=this,e[g].nodeIndex=this.inboundNodes.length-1,e[g].tensorIndex=g},e.prototype.getConfig=function(){var t={name:this.name,trainable:this.trainable};return null!=this.batchInputShape&amp;&amp;(t.batchInputShape=this.batchInputShape),null!=this.dtype&amp;&amp;(t.dtype=this.dtype),t},e.prototype.disposeWeights=function(){return this.weights.forEach(function(t){return t.dispose()}),this.weights.length},e.prototype.assertNotDisposed=function(){if(0===this._refCount)throw new Error(&quot;Layer &apos;&quot;+this.name+&quot;&apos; is already disposed.&quot;)},e.prototype.dispose=function(){if(!this.built)throw new Error(&quot;Cannot dispose Layer &quot;+this.name+&quot; because it has not been built yet.&quot;);if(null===this._refCount)throw new Error(&quot;Cannot dispose Layer &quot;+this.name+&quot; because it has not been used yet.&quot;);this.assertNotDisposed();var t=0;return 0==--this._refCount&amp;&amp;(t=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:t}},e}(o.serialization.Serializable);n.Layer=b,n.getSourceInputs=function t(e,n,r){if((null==n||null!=r&amp;&amp;r&gt;0)&amp;&amp;(n=e.sourceLayer,r=e.nodeIndex),0===n.inboundNodes.length)return[e];var i=n.inboundNodes[r];if(0===i.inboundLayers.length)return i.inputTensors;for(var o=[],a=0;a&lt;i.inboundLayers.length;a++)for(var s=0,u=t(i.inputTensors[a],i.inboundLayers[a],i.nodeIndices[a]);s&lt;u.length;s++){var l=u[s];-1===o.indexOf(l)&amp;&amp;o.push(l)}return o}},{&quot;../backend/state&quot;:246,&quot;../common&quot;:250,&quot;../errors&quot;:259,&quot;../initializers&quot;:268,&quot;../utils/generic_utils&quot;:291,&quot;../utils/types_utils&quot;:295,&quot;../utils/variable_utils&quot;:296,&quot;../variables&quot;:297,&quot;@tensorflow/tfjs-core&quot;:138}],256:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;@tensorflow/tfjs-core&quot;),u=t(&quot;@tensorflow/tfjs-core&quot;),l=t(&quot;../backend/tfjs_backend&quot;),c=t(&quot;../common&quot;),f=t(&quot;../errors&quot;),p=t(&quot;../losses&quot;),h=t(&quot;../metrics&quot;),d=t(&quot;../optimizers&quot;),m=t(&quot;../utils/generic_utils&quot;),g=t(&quot;../utils/layer_utils&quot;),v=t(&quot;../utils/math_utils&quot;),y=t(&quot;../version&quot;),b=t(&quot;./container&quot;),_=t(&quot;./executor&quot;),w=t(&quot;./training_dataset&quot;),x=t(&quot;./training_tensors&quot;);function E(t){return t instanceof u.Tensor}function k(t){return Array.isArray(t)}function T(t){return!E(t)&amp;&amp;!k(t)}function N(t,e,n,r,i){if(void 0===r&amp;&amp;(r=!0),void 0===i&amp;&amp;(i=&quot;&quot;),null==e||0===e.length){if(null!=t){var o=!1;if(k(t)&amp;&amp;t.length&gt;0)o=!0;else if(T(t)){for(var a in t)if(t.hasOwnProperty(a)){o=!0;break}}else o=!0;if(o)throw new f.ValueError(&quot;Error when checking model &quot;+i+&quot; expected no data, but got &quot;+t)}return[]}if(null==t)return e.map(function(t){return null});var s;if(T(t)){t=t,s=[];for(var u=0,l=e;u&lt;l.length;u++){var c=l[u];if(null==t[c])throw new f.ValueError(&apos;No data provided for &quot;&apos;+c+&apos;&quot;. Need data for each key in: &apos;+e);s.push(t[c])}}else if(k(t)){if((t=t).length!==e.length)throw new f.ValueError(&quot;Error when checking model &quot;+i+&quot;: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see &quot;+e.length+&quot; Tensor(s), but instead got the following list of Tensor(s): &quot;+t);s=t}else{if(t=t,e.length&gt;1)throw new f.ValueError(&quot;The model &quot;+i+&quot; expects &quot;+e.length+&quot; Tensor(s), but only received one Tensor. Found: Tensor with shape &quot;+t.shape);s=[t]}if(s=x.ensureTensorsRank2OrHigher(s),null!=n)for(var p=0;p&lt;e.length;++p)if(null!=n[p]){var h=s[p];if(h.shape.length!==n[p].length)throw new f.ValueError(&quot;Error when checking &quot;+i+&quot;: expected &quot;+e[p]+&quot; to have &quot;+n[p].length+&quot; dimension(s). but got array with shape &quot;+h.shape);for(var d=0;d&lt;n[p].length;++d)if(0!==d||r){var m=h.shape[d],g=n[p][d];if(null!=g&amp;&amp;g&gt;=0&amp;&amp;m!==g)throw new f.ValueError(&quot;Error when checking &quot;+i+&quot;: expected &quot;+e[p]+&quot; to have shape [&quot;+n[p]+&quot;], but got array with shape [&quot;+h.shape+&quot;].&quot;)}}return s}function S(t,e,n){var r=m.unique(t.map(function(t){return t.shape[0]}));r.sort();var i=m.unique(e.map(function(t){return t.shape[0]}));if(i.sort(),r.length&gt;1)throw new f.ValueError(&quot;All input Tensors (x) should have the same number of samples. Got array shapes: &quot;+JSON.stringify(t.map(function(t){return t.shape})));if(i.length&gt;1)throw new f.ValueError(&quot;All target Tensors (y) should have the same number of samples. Got array shapes: &quot;+JSON.stringify(e.map(function(t){return t.shape})));if(r.length&gt;0&amp;&amp;i.length&gt;0&amp;&amp;!u.util.arraysEqual(r,i))throw new f.ValueError(&quot;Input Tensors should have the same number of samples as target Tensors. Found &quot;+r[0]+&quot; input sample(s) and &quot;+i[0]+&quot; target sample(s).&quot;)}function C(t,e,n,r,i){var o;if(void 0===r&amp;&amp;(r=!0),void 0===i&amp;&amp;(i=&quot;&quot;),Array.isArray(t)){if(t.length!==e.length)throw new f.ValueError(&quot;Error when checking model &quot;+i+&quot;: the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see &quot;+e.length+&quot; Tensor(s), but instead got &quot;+t.length+&quot; Tensors(s).&quot;);o=t}else{if(e.length&gt;1)throw new f.ValueError(&quot;The model expects &quot;+e.length+&quot; &quot;+i+&quot; Tensors, but only received one Tensor. Found: array with shape &quot;+JSON.stringify(t.shape)+&quot;.&quot;);o=[t]}if(null!=n)for(var a=0;a&lt;e.length;++a)if(null!=n[a]){var s=o[a];if(s.shape.length!==n[a].length)throw new f.ValueError(&quot;Error when checking &quot;+i+&quot;: expected &quot;+e[a]+&quot; to have &quot;+n[a].length+&quot; dimension(s), but got array with shape &quot;+JSON.stringify(s.shape));for(var u=0;u&lt;n[a].length;++u)if(0!==u||r){var l=s.shape[u],c=n[a][u];if(null!=c&amp;&amp;c!==l)throw new f.ValueError(&quot;Error when checking &quot;+i+&quot;: expected &quot;+e[a]+&quot; to have shape &quot;+JSON.stringify(n[a])+&quot; but got array with shape &quot;+JSON.stringify(s.shape)+&quot;.&quot;)}}}n.isDataTensor=E,n.isDataArray=k,n.isDataDict=T,n.standardizeInputData=N,n.checkArrayLengths=S;var A=function(t){function e(e){var n=t.call(this,e)||this;return n.isTraining=!1,n}return i(e,t),e.prototype.summary=function(t,e,n){if(void 0===n&amp;&amp;(n=console.log),!this.built)throw new f.ValueError(&quot;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).&quot;);g.printSummary(this,t,e,n)},e.prototype.compile=function(t){var e=this;if(null==t.loss&amp;&amp;(t.loss=[]),this.loss=t.loss,&quot;string&quot;==typeof t.optimizer)this.optimizer_=d.getOptimizer(t.optimizer),this.isOptimizerOwned=!0;else{if(!(t.optimizer instanceof u.Optimizer))throw new f.ValueError(&quot;User-defined optimizer must be an instance of tf.Optimizer.&quot;);this.optimizer_=t.optimizer,this.isOptimizerOwned=!1}var n=[];if(Array.isArray(t.loss)||&quot;string&quot;==typeof t.loss||&quot;function&quot;==typeof t.loss)if(Array.isArray(t.loss)){if(t.loss.length!==this.outputs.length)throw new f.ValueError(&quot;When passing an Array as loss, it should have one entry per model output. The model has &quot;+this.outputs.length+&quot; output(s), but you passed loss=&quot;+t.loss+&quot;.&quot;);var r=t.loss;n=r.map(function(t){return p.get(t)})}else{var i=p.get(t.loss);this.outputs.forEach(function(t){n.push(i)})}else{for(var o in t.loss=t.loss,t.loss)if(-1===this.outputNames.indexOf(o))throw new f.ValueError(&apos;Unknown entry in loss dictionary: &quot;&apos;+o+&apos;&quot;. Only expected the following keys: &apos;+this.outputNames);for(var a=0,s=this.outputNames;a&lt;s.length;a++){var l=s[a];null==t.loss[l]&amp;&amp;console.warn(&apos;Output &quot;&apos;+l+&apos;&quot; is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to &apos;+l+&quot; during training&quot;),n.push(p.get(t.loss[l]))}}this.lossFunctions=n,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(var m=0;m&lt;this.outputs.length;++m){var g=this.internalOutputShapes[m],v=this.outputNames[m];this.feedOutputNames.push(v),this.feedOutputShapes.push(g),this.feedLossFns.push(this.lossFunctions[m])}var y=[];this.metrics=t.metrics,this.metricsNames=[&quot;loss&quot;],this.metricsTensors=[],c.nameScope(&quot;loss&quot;,function(){for(var t=0;t&lt;e.outputs.length;++t)if(-1===y.indexOf(t)){var n=e.lossFunctions[t];e.outputs.length&gt;1&amp;&amp;(e.metricsTensors.push([n,t]),e.metricsNames.push(e.outputNames[t]+&quot;_loss&quot;))}});var b=function(t,e){if(null==t||Array.isArray(t)&amp;&amp;0===t.length)return e.map(function(t){return[]});if(Array.isArray(t))return e.map(function(e){return t});if(null!=t){for(var n=[],r=0,i=e;r&lt;i.length;r++){var o=i[r],a=t.hasOwnProperty(o)?t[o]:[];Array.isArray(a)||(a=[a]),n.push(a)}return n}throw new TypeError(&quot;Type of metrics argument not understood. Expected an Array or Object, found: &quot;+t)}(t.metrics,this.outputNames);c.nameScope(&quot;metric&quot;,function(){for(var t=function(t){if(-1!==y.indexOf(t))return&quot;continue&quot;;!function(n){for(var r,i,o,a=function(n){if(-1!==[&quot;accuracy&quot;,&quot;acc&quot;,&quot;crossentropy&quot;,&quot;ce&quot;].indexOf(n)){var a=e.internalOutputShapes[t];1===a[a.length-1]||e.lossFunctions[t]===p.binaryCrossentropy?-1!==[&quot;accuracy&quot;,&quot;acc&quot;].indexOf(n)?i=h.binaryAccuracy:-1!==[&quot;crossentropy&quot;,&quot;ce&quot;].indexOf(n)&amp;&amp;(i=h.binaryCrossentropy):e.lossFunctions[t]===p.sparseCategoricalCrossentropy?-1!==[&quot;accuracy&quot;,&quot;acc&quot;].indexOf(n)?i=h.sparseCategoricalAccuracy:-1!==[&quot;crossentropy&quot;,&quot;ce&quot;].indexOf(n)&amp;&amp;(i=h.sparseCategoricalCrossentropy):-1!==[&quot;accuracy&quot;,&quot;acc&quot;].indexOf(n)?i=h.categoricalAccuracy:-1!==[&quot;crossentropy&quot;,&quot;ce&quot;].indexOf(n)&amp;&amp;(i=h.categoricalCrossentropy);var s=void 0;-1!==[&quot;accuracy&quot;,&quot;acc&quot;].indexOf(n)?s=&quot;acc&quot;:-1!==[&quot;crossentropy&quot;,&quot;ce&quot;].indexOf(n)&amp;&amp;(s=&quot;ce&quot;),o=i,r=&quot;&quot;+s}else{var u=h.get(n);o=u,r=&quot;&quot;+n}var l;c.nameScope(r,function(){l=o}),function(t,n,r){e.outputNames.length&gt;1&amp;&amp;(n=e.outputNames[t]+&quot;_&quot;+n),e.metricsNames.push(n),e.metricsTensors.push([r,t])}(t,r,l)},s=0,u=n;s&lt;u.length;s++)a(u[s])}(b[t])},n=0;n&lt;e.outputs.length;++n)t(n)}),this.collectedTrainableWeights=this.trainableWeights},e.prototype.checkTrainableWeightsConsistency=function(){null!=this.collectedTrainableWeights&amp;&amp;this.trainableWeights.length!==this.collectedTrainableWeights.length&amp;&amp;console.warn(&quot;Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?&quot;)},e.prototype.evaluate=function(t,e,n){void 0===n&amp;&amp;(n={});var r=null==n.batchSize?32:n.batchSize;x.checkBatchSize(r);var i=this.standardizeUserData(t,e,!0,r);try{var o=i[0].concat(i[1]);this.makeTestFunction();var a=this.testFunction,s=this.testLoop(a,o,r,n.verbose,n.steps);return m.singletonOrArray(s)}finally{x.disposeNewTensors(i[0],t),x.disposeNewTensors(i[1],e)}},e.prototype.evaluateDataset=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(n){return this.makeTestFunction(),[2,w.evaluateDataset(this,t,e)]})})},e.prototype.checkNumSamples=function(t,e,n,r){var i;if(void 0===r&amp;&amp;(r=&quot;steps&quot;),null!=n){if(i=null,null!=e)throw new f.ValueError(&quot;If &quot;+r+&quot; is set, batchSize must be null or undefined.Got batchSize = &quot;+e)}else{if(null==t)throw new f.ValueError(&quot;Either the input data should have a defined shape, or &quot;+r+&quot; shoud be specified.&quot;);i=Array.isArray(t)?t[0].shape[0]:t.shape[0]}return i},e.prototype.execute=function(t,e){if(Array.isArray(e)&amp;&amp;0===e.length)throw new f.ValueError(&quot;`outputs` is an empty Array, which is not allowed.&quot;);var n=Array.isArray(e),r=n?e:[e],i=this.retrieveSymbolicTensors(r),o=new _.FeedDict;if(t instanceof u.Tensor&amp;&amp;(t=[t]),Array.isArray(t)){if(t.length!==this.inputs.length)throw new f.ValueError(&quot;The number of inputs provided (&quot;+t.length+&quot;) does not match the number of inputs of this model (&quot;+this.inputs.length+&quot;).&quot;);for(var a=0;a&lt;this.inputs.length;++a)o.add(this.inputs[a],t[a])}else for(var s=0,l=this.inputs;s&lt;l.length;s++){var c=l[s],p=t[c.name];if(null==p)throw new f.ValueError(&quot;No value is provided for the model&apos;s input &quot;+c.name);o.add(c,p)}var h=_.execute(i,o);return n?h:h[0]},e.prototype.retrieveSymbolicTensors=function(t){for(var e=m.pyListRepeat(null,t.length),n=t.length,r=0,i=this.layers;r&lt;i.length;r++){for(var o=i[r],a=Array.isArray(o.output)?o.output:[o.output],s=a.map(function(t){return t.name}),u=0;u&lt;t.length;++u){var l=s.indexOf(t[u]);if(-1!==l&amp;&amp;(e[u]=a[l],n--),0===n)break}if(0===n)break}if(n&gt;0){var c=[];throw e.forEach(function(e,n){null==e&amp;&amp;c.push(t[n])}),new f.ValueError(&quot;Cannot find SymbolicTensors for output name(s): &quot;+JSON.stringify(c))}return e},e.prototype.predictLoop=function(t,e,n){var r=this;return void 0===e&amp;&amp;(e=32),void 0===n&amp;&amp;(n=!1),s.tidy(function(){var i=r.checkNumSamples(t);if(n)throw new f.NotImplementedError(&quot;Verbose predictLoop() is not implemented yet.&quot;);for(var o=x.makeBatches(i,e),a=r.outputs.map(function(t){return[]}),u=function(e){s.tidy(function(){var n=o[e][0],i=o[e][1],a=x.sliceArrays(t,n,i),s=[];if(Array.isArray(a))for(var u=0;u&lt;a.length;++u)s.push({key:r.inputs[u],value:a[u]});else s.push({key:r.inputs[0],value:a});var l=new _.FeedDict(s);return _.execute(r.outputs,l)}).forEach(function(t,e){return a[e].push(t)})},l=0;l&lt;o.length;++l)u(l);return m.singletonOrArray(a.map(function(t){return s.concat(t,0)}))})},e.prototype.predict=function(t,e){void 0===e&amp;&amp;(e={});var n=x.ensureTensorsRank2OrHigher(t);C(n,this.inputNames,this.feedInputShapes,!1);try{var r=null==e.batchSize?32:e.batchSize;return x.checkBatchSize(r),this.predictLoop(n,r)}finally{x.disposeNewTensors(n,t)}},e.prototype.predictOnBatch=function(t){return C(t,this.inputNames,this.feedInputShapes,!0),this.predictLoop(t,t.shape[0])},e.prototype.standardizeUserData=function(t,e,n,r){if(void 0===n&amp;&amp;(n=!0),null==this.optimizer_)throw new f.RuntimeError(&quot;You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).&quot;);for(var i=[],o=0;o&lt;this.feedOutputShapes.length;++o){var a=this.feedOutputShapes[o];this.feedLossFns[o]===p.sparseCategoricalCrossentropy?i.push(a.slice(0,a.length-1).concat([1])):i.push(a)}if(S(t=N(t,this.feedInputNames,this.feedInputShapes,!1,&quot;input&quot;),e=N(e,this.feedOutputNames,i,!1,&quot;target&quot;)),function(t,e,n){for(var r=[p.meanSquaredError,p.binaryCrossentropy,p.categoricalCrossentropy],i=0;i&lt;t.length;++i){var o=t[i],a=e[i],s=n[i];if(null!=a){if(a===p.categoricalCrossentropy&amp;&amp;1===o.shape[o.shape.length-1])throw new f.ValueError(&quot;You are passing a target array of shape &quot;+o.shape+&quot; while using a loss &apos;categorical_crossentropy&apos;. &apos;categorical_crossentropy&apos;expects targets to be binary matrices (1s and 0s) of shape [samples, classes].&quot;);if(-1!==r.indexOf(a))for(var u=o.shape.slice(1),l=s.slice(1),c=0;c&lt;u.length;++c){var h=u[c],d=l[c];if(null!=d&amp;&amp;h!==d)throw new f.ValueError(&quot;A target Tensor with shape &quot;+o.shape+&quot; was passed for an output of shape &quot;+s+&quot;, while using a loss function that expects targets to have the same shape as the output.&quot;)}}}}(e,this.feedLossFns,this.feedOutputShapes),this.stateful&amp;&amp;null!=r&amp;&amp;r&gt;0&amp;&amp;t[0].shape[0]%r!=0)throw new f.ValueError(&quot;In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size &quot;+r+&quot;. Found: &quot;+t[0].shape[0]+&quot; sample(s).&quot;);return[t,e,null]},e.prototype.testLoop=function(t,e,n,r,i){var o=this;return void 0===r&amp;&amp;(r=0),s.tidy(function(){var a=o.checkNumSamples(e,n,i,&quot;steps&quot;),c=[];if(r&gt;0)throw new f.NotImplementedError(&quot;Verbose mode is not implemented yet.&quot;);if(null!=i)throw new f.NotImplementedError(&quot;steps mode in testLoop() is not implemented yet&quot;);for(var p=x.makeBatches(a,n),h=u.tensor1d(v.range(0,a)),d=0;d&lt;p.length;++d){var m=p[d][0],g=p[d][1],y=l.sliceAlongFirstAxis(h,m,g-m),b=x.sliceArraysByIndices(e,y),_=t(b);if(0===d)for(var w=0;w&lt;_.length;++w)c.push(u.scalar(0));for(w=0;w&lt;_.length;++w){var E=_[w];c[w]=s.add(c[w],s.mul(g-m,E))}}for(w=0;w&lt;c.length;++w)c[w]=s.div(c[w],a);return c})},e.prototype.getDedupedMetricsNames=function(){for(var t=this.metricsNames,e=[],n=0;n&lt;t.length;++n){var r=t[n],i=r;if(m.count(t,r)&gt;1)i+=&quot;_&quot;+m.count(t.slice(0,n),r);e.push(i)}return e},e.prototype.makeTrainFunction=function(){var t=this;return function(e){var n=[],r=[],i=e.slice(0,t.inputs.length),o=e.slice(t.inputs.length,t.inputs.length+t.outputs.length),a=[],u=t.collectedTrainableWeights.map(function(t){return t.read()});return[t.optimizer_.minimize(function(){for(var e=[],u=0;u&lt;t.inputs.length;++u)e.push({key:t.inputs[u],value:i[u]});var l,c=new _.FeedDict(e),f=_.execute(t.outputs,c,{training:!0});for(u=0;u&lt;t.lossFunctions.length;++u){var p=(0,t.lossFunctions[u])(o[u],f[u]);n.push(p);var h=s.mean(p);r.push(h),l=0===u?p:s.add(l,p)}for(u=0;u&lt;t.metricsTensors.length;++u){var d=t.metricsTensors[u][0],m=t.metricsTensors[u][1],g=s.mean(d(o[m],f[m]));s.keep(g),a.push(g)}return l=s.mean(l),t.calculateLosses().forEach(function(t){l=s.add(l,t)}),l},!0,u)].concat(a)}},e.prototype.makeTestFunction=function(){var t=this;this.testFunction=function(e){return s.tidy(function(){for(var n,r=[],i=e.slice(0,t.inputs.length),o=e.slice(t.inputs.length,t.inputs.length+t.outputs.length),a=[],u=0;u&lt;t.inputs.length;++u)a.push({key:t.inputs[u],value:i[u]});var l=new _.FeedDict(a),c=_.execute(t.outputs,l);for(u=0;u&lt;t.lossFunctions.length;++u){var f=t.lossFunctions[u],p=s.mean(f(o[u],c[u]));n=0===u?p:s.add(n,p),r.push(n)}for(u=0;u&lt;t.metricsTensors.length;++u){var h=t.metricsTensors[u][0],d=t.metricsTensors[u][1],m=s.mean(h(o[d],c[d]));r.push(m)}return r})}},e.prototype.fit=function(t,e,n){return void 0===n&amp;&amp;(n={}),o(this,void 0,void 0,function(){return a(this,function(r){return[2,x.fitTensors(this,t,e,n)]})})},e.prototype.fitDataset=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(n){return[2,w.fitDataset(this,t,e)]})})},e.prototype.trainOnBatch=function(t,e){return o(this,void 0,void 0,function(){var n,r,i,o,u,l,c,f,p;return a(this,function(a){switch(a.label){case 0:n=this.standardizeUserData(t,e),r=n[0],i=n[1],o=this.makeTrainFunction(),u=o(r.concat(i)),l=[],c=0,f=u,a.label=1;case 1:return c&lt;f.length?[4,f[c].data()]:[3,4];case 2:p=a.sent(),l.push(p[0]),a.label=3;case 3:return c++,[3,1];case 4:return s.dispose(u),[2,m.singletonOrArray(l)]}})})},e.prototype.getNamedWeights=function(t){for(var e={},n=null!=t&amp;&amp;t.trainableOnly,r=n?this.trainableWeights:this.weights,i=this.getWeights(n),o=0;o&lt;r.length;++o)n&amp;&amp;!r[o].trainable||(e[r[o].originalName]=i[o]);return e},Object.defineProperty(e.prototype,&quot;stopTraining&quot;,{get:function(){return this.stopTraining_},set:function(t){this.stopTraining_=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;optimizer&quot;,{get:function(){return this.optimizer_},set:function(t){this.optimizer_!==t&amp;&amp;(this.optimizer_=t,this.isOptimizerOwned=!1)},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){var e=t.prototype.dispose.call(this);if(0===e.refCountAfterDispose&amp;&amp;null!=this.optimizer&amp;&amp;this.isOptimizerOwned){var n=s.memory().numTensors;this.optimizer_.dispose(),e.numDisposedVariables+=n-s.memory().numTensors}return e},e.prototype.save=function(t,e){return o(this,void 0,void 0,function(){var n,r,i,o,s;return a(this,function(a){switch(a.label){case 0:if(&quot;string&quot;==typeof t){if(0===(n=u.io.getSaveHandlers(t)).length)throw new f.ValueError(&quot;Cannot find any save handlers for URL &apos;&quot;+t+&quot;&apos;&quot;);if(n.length&gt;1)throw new f.ValueError(&quot;Found more than one (&quot;+n.length+&quot;) save handlers for URL &apos;&quot;+t+&quot;&apos;&quot;);t=n[0]}if(null==t.save)throw new f.ValueError(&quot;LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.&quot;);return[4,u.io.encodeWeights(this.getNamedWeights(e))];case 1:return r=a.sent(),i=!1,o=null,s=this.toJSON(o,i),[2,t.save({modelTopology:s,weightData:r.data,weightSpecs:r.specs,format:&quot;layers-model&quot;,generatedBy:&quot;TensorFlow.js tfjs-layers v&quot;+y.version,convertedBy:null})]}})})},e.className=&quot;Model&quot;,e}(b.Container);n.LayersModel=A,u.serialization.registerClass(A)},{&quot;../backend/tfjs_backend&quot;:247,&quot;../common&quot;:250,&quot;../errors&quot;:259,&quot;../losses&quot;:285,&quot;../metrics&quot;:286,&quot;../optimizers&quot;:288,&quot;../utils/generic_utils&quot;:291,&quot;../utils/layer_utils&quot;:292,&quot;../utils/math_utils&quot;:293,&quot;../version&quot;:298,&quot;./container&quot;:252,&quot;./executor&quot;:253,&quot;./training_dataset&quot;:257,&quot;./training_tensors&quot;:258,&quot;@tensorflow/tfjs-core&quot;:138}],257:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../base_callbacks&quot;),u=t(&quot;../errors&quot;),l=t(&quot;../logs&quot;),c=t(&quot;../utils/generic_utils&quot;),f=32;function p(t,e){var n,r,i=e;n=i.xs,r=i.ys,o.util.assert(null!=n&amp;&amp;null!=r,function(){return&quot;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 &quot;+e});var a=h(&quot;input&quot;,t.inputNames,n),s=h(&quot;output&quot;,t.outputNames,r),u=a[0].shape[0];o.util.assert(a.length===t.inputs.length,function(){return&quot;LayersModel has &quot;+t.inputs.length+&quot; inputs, but the dataset provides &quot;+a.length+&quot; inputs.  (Expected input keys: &quot;+JSON.stringify(t.inputNames)+&quot;)&quot;}),o.util.assert(s.length===t.outputs.length,function(){return&quot;LayersModel has &quot;+t.outputs.length+&quot; outputs, but the dataset provides &quot;+s.length+&quot; outputs.  (Expected output keys: &quot;+JSON.stringify(t.outputNames)+&quot;)&quot;});var l=function(e){o.util.assert(a[e].shape[0]===u,function(){return&quot;Batch size mismatch: input &quot;+t.inputNames[e]+&quot; has &quot;+a[e].shape[0]+&quot;; expected  &quot;+u+&quot; based on input &quot;+t.inputNames[0]+&quot;.&quot;})};for(var c in a)l(c);var f=function(e){o.util.assert(s[e].shape[0]===u,function(){return&quot;Batch size mismatch: output &quot;+t.outputNames[e]+&quot; has &quot;+s[e].shape[0]+&quot;; expected  &quot;+u+&quot; based on input &quot;+t.inputNames[0]+&quot;.&quot;})};for(var p in s)f(p);return a.concat(s)}function h(t,e,n){if(n instanceof o.Tensor)return[n];if(Array.isArray(n))return o.util.assert(n.length===e.length,function(){return&quot;Received an array of &quot;+n.length+&quot; Tensors, but expected &quot;+e.length+&quot; to match the &quot;+t+&quot; keys &quot;+e+&quot;.&quot;}),n;for(var r=[],i=0,a=e;i&lt;a.length;i++){var s=a[i];if(null==n[s])throw new u.ValueError(&quot;The feature data generated by the dataset lacks the required &quot;+t+&quot; key &apos;&quot;+s+&quot;&apos;.&quot;);r.push(n[s])}return r}function d(t){return&quot;function&quot;==typeof t.iterator}n.fitDataset=function(t,e,n){return r(this,void 0,void 0,function(){var r,a,h,m,g,v,y,b,_,w,x,E,k,T,N,S,C,A,I,O,M,R,P,D,z,L,F;return i(this,function(i){switch(i.label){case 0:if(r=null!=n.batchesPerEpoch,o.util.assert(null!=t.optimizer,function(){return&quot;You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig).&quot;}),o.util.assert(null!=n,function(){return&quot;For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call.&quot;}),o.util.assert(null!=n.epochs&amp;&amp;n.epochs&gt;0&amp;&amp;Number.isInteger(n.epochs),function(){return&quot;For fitDataset(), config.epochs is expected to be a positive integer, but got &quot;+n.epochs}),o.util.assert(!r||n.batchesPerEpoch&gt;0&amp;&amp;Number.isInteger(n.batchesPerEpoch),function(){return&quot;For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got &quot;+n.batchesPerEpoch}),o.util.assert(null==n.validationSplit,function(){return&quot;`validationSplit` is not supported by `fitDataset()`. Use validationData instead.&quot;}),t.isTraining)throw new Error(&quot;Cannot start training because another fit() call is ongoing.&quot;);t.isTraining=!0,i.label=1;case 1:return i.trys.push([1,,22,23]),a=null!=n.validationData,h=void 0,m=void 0,a&amp;&amp;(d(n.validationData)?o.util.assert(null==n.validationBatches||n.validationBatches&gt;0&amp;&amp;Number.isInteger(n.validationBatches),function(){return&quot;For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got &quot;+n.validationBatches}):(g=function(t){if(3===t.length)throw new u.NotImplementedError(&quot;Validation with sample weights is not implemented yet.&quot;);return{xs:t[0],ys:t[1]}}(n.validationData),h=g.xs,m=g.ys)),v=t.makeTrainFunction(),y=t.getDedupedMetricsNames(),b=void 0,b=a?y.slice().concat(y.map(function(t){return&quot;val_&quot;+t})):y.slice(),_=s.standardizeCallbacks(n.callbacks),w=null==n.verbose?1:n.verbose,x=s.configureCallbacks(_,n.yieldEvery,w,n.epochs,null,null,function(t,e){var n=null;return null!=e.batchesPerEpoch?n=e.batchesPerEpoch:Number.isFinite(t.size)&amp;&amp;(n=t.size),n}(e,n),null,a,b),E=x.callbackList,k=x.history,E.setModel(t),t.history=k,[4,E.onTrainBegin()];case 2:return i.sent(),t.stopTraining_=!1,T=null==n.initialEpoch?0:n.initialEpoch,[4,e.iterator()];case 3:N=i.sent(),i.label=4;case 4:return T&lt;n.epochs?(S={},[4,E.onEpochBegin(T)]):[3,19];case 5:return i.sent(),C=0,A=0,r?[3,7]:[4,e.iterator()];case 6:N=i.sent(),i.label=7;case 7:return!r||C&lt;n.batchesPerEpoch?[4,N.next()]:[3,17];case 8:return I=i.sent(),r&amp;&amp;I.done?(console.warn(&quot;You provided `batchesPerEpoch` as &quot;+n.batchesPerEpoch+&quot;, but your dataset iterator ran out of data after &quot;+C+&quot; batches; interrupting training. Make sure that your dataset can generate at least `batchesPerEpoch * epochs` batches (in this case, &quot;+n.batchesPerEpoch*n.epochs+&quot; batches). You may need to use the repeat() function when building your dataset.&quot;),[3,17]):null==I.value?[3,11]:(O=p(t,I.value),(M={}).batch=A,M.size=O[0].shape[0],[4,E.onBatchBegin(A,M)]);case 9:for(i.sent(),R=v(O),o.dispose(O),F=0;F&lt;y.length;++F)P=y[F],D=R[F],M[P]=D,o.keep(D);return[4,E.onBatchEnd(A,M)];case 10:i.sent(),l.disposeTensorsInLogs(M),A++,C++,i.label=11;case 11:return(r?C&gt;=n.batchesPerEpoch:I.done)?a?(z=void 0,d(n.validationData)?(L=c.toList,[4,t.evaluateDataset(n.validationData,{batches:n.validationBatches})]):[3,13]):[3,15]:[3,16];case 12:return z=L.apply(void 0,[i.sent()]),[3,14];case 13:z=c.toList(t.evaluate(h,m,{batchSize:null==n.validationBatchSize?f:n.validationBatchSize,verbose:0})),i.label=14;case 14:for(F=0;F&lt;t.metricsNames.length;++F)S[&quot;val_&quot;+t.metricsNames[F]]=z[F];i.label=15;case 15:return[3,17];case 16:return t.stopTraining_?[3,17]:[3,7];case 17:return[4,E.onEpochEnd(T,S)];case 18:return i.sent(),T++,t.stopTraining_?[3,19]:[3,4];case 19:return[4,E.onTrainEnd()];case 20:return i.sent(),[4,t.history.syncData()];case 21:return i.sent(),[2,t.history];case 22:return t.isTraining=!1,[7];case 23:return[2]}})})},n.evaluateDataset=function(t,e,n){return r(this,void 0,void 0,function(){var r,s,l,f,h,d,m,g,v,y;return i(this,function(b){switch(b.label){case 0:if(r=null!=(n=n||{}).batches,s=t.testFunction,l=[],n.verbose&gt;0)throw new u.NotImplementedError(&quot;Verbose mode is not implemented yet.&quot;);return o.util.assert(!r||n.batches&gt;0&amp;&amp;Number.isInteger(n.batches),function(){return&quot;Test loop expects `batches` to be a positive integer, but received &quot;+JSON.stringify(n.batches)}),&quot;function&quot;!=typeof e.next?[3,1]:(h=e,[3,3]);case 1:return[4,e.iterator()];case 2:h=b.sent(),b.label=3;case 3:f=h,d=0,m=0,g=function(){var e;return i(this,function(i){switch(i.label){case 0:return[4,f.next()];case 1:return e=i.sent(),l=o.tidy(function(){if(e.value){var n=p(t,e.value),r=o.tidy(function(){return s(n)});if(o.dispose(n),0===m)for(var i=0;i&lt;r.length;++i)l.push(a.scalar(0));var u=n[0].shape[0],c=function(t){var e=r[t],n=l[t];l[t]=o.tidy(function(){return o.add(l[t],o.mul(u,e))}),m&gt;0&amp;&amp;o.dispose(n)};for(i=0;i&lt;r.length;++i)c(i);o.dispose(r),d+=u,++m}return l}),e.done?(r&amp;&amp;console.warn(&quot;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, &quot;+n.batches+&quot; batches). You may need to use the repeat() function when building your dataset.&quot;),[2,&quot;break&quot;]):[2]}})},b.label=4;case 4:return!r||m&lt;n.batches?[5,g()]:[3,6];case 5:return&quot;break&quot;===b.sent()?[3,6]:[3,4];case 6:for(v=0;v&lt;l.length;++v)y=l[v],l[v]=o.div(l[v],d),o.dispose(y);return[2,c.singletonOrArray(l)]}})})}},{&quot;../base_callbacks&quot;:248,&quot;../errors&quot;:259,&quot;../logs&quot;:284,&quot;../utils/generic_utils&quot;:291,&quot;@tensorflow/tfjs-core&quot;:138}],258:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../backend/tfjs_backend&quot;),u=t(&quot;../base_callbacks&quot;),l=t(&quot;../errors&quot;),c=t(&quot;../logs&quot;),f=t(&quot;../utils/math_utils&quot;);function p(t){o.util.assert(t&gt;0&amp;&amp;Number.isInteger(t),function(){return&quot;batchSize is required to be a positive integer, but got &quot;+t})}function h(t,e,n){return null==t?[null]:Array.isArray(t)?t.map(function(t){return s.sliceAlongFirstAxis(t,e,n-e)}):s.sliceAlongFirstAxis(t,e,n-e)}function d(t,e){return o.tidy(function(){return null==t?null:Array.isArray(t)?t.map(function(t){return d(t,e)}):s.gather(t,&quot;int32&quot;===e.dtype?e:e.toInt())})}function m(t,e){for(var n=[],r=0,i=null;r&lt;t;)(i=r+e)&gt;=t&amp;&amp;(i=t),n.push([r,i]),r=i;return n}function g(t,e){if(null!=t){var n=[];if(e instanceof a.Tensor)n.push(e.id);else if(Array.isArray(e))e.forEach(function(t){return n.push(t.id)});else if(null!=e)for(var r in e){var i=e[r];n.push(i.id)}var o=[];if(t instanceof a.Tensor)-1===n.indexOf(t.id)&amp;&amp;o.push(t);else if(Array.isArray(t))t.forEach(function(t){-1===n.indexOf(t.id)&amp;&amp;o.push(t)});else if(null!=t)for(var s in t){var u=t[s];-1===n.indexOf(u.id)&amp;&amp;o.push(u)}o.forEach(function(t){t.isDisposed||t.dispose()})}}n.checkBatchSize=p,n.sliceArrays=h,n.sliceArraysByIndices=d,n.makeBatches=m,n.fitTensors=function(t,e,n,v){return void 0===v&amp;&amp;(v={}),r(this,void 0,void 0,function(){var y,b,_,w,x,E,k,T,N,S,C,A,I,O,M,R,P,D,z;return i(this,function(L){switch(L.label){case 0:if(t.isTraining)throw new Error(&quot;Cannot start training because another fit() call is ongoing.&quot;);t.isTraining=!0,L.label=1;case 1:if(L.trys.push([1,,3,4]),p(k=null==v.batchSize?32:v.batchSize),T=t.standardizeUserData(e,n,!1,k),y=T[0],b=T[1],N=!1,S=void 0,null!=v.validationData&amp;&amp;v.validationData.length&gt;0){if(N=!0,2!==v.validationData.length)throw 3===v.validationData.length?new l.NotImplementedError(&quot;validationData including sample weights is not supported yet.&quot;):new l.ValueError(&quot;When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; &quot;+v.validationData+&quot; is invalid.&quot;);_=v.validationData[0],w=v.validationData[1],C=t.standardizeUserData(_,w,!0,k),x=C[0],E=C[1],S=x.concat(E)}else null!=v.validationSplit&amp;&amp;v.validationSplit&gt;0&amp;&amp;v.validationSplit&lt;1?(N=!0,A=Math.floor(y[0].shape[0]*(1-v.validationSplit)),I=y[0].shape[0],x=h(y,A,I),y=h(y,0,A),E=h(b,A,I),b=h(b,0,A),S=x.concat(E)):null!=v.validationSteps&amp;&amp;(N=!0);return O=y.concat(b),t.checkTrainableWeightsConsistency(),M=t.makeTrainFunction(),R=t.getDedupedMetricsNames(),P=void 0,D=void 0,N?(t.makeTestFunction(),P=t.testFunction,D=R.slice().concat(R.map(function(t){return&quot;val_&quot;+t}))):(P=null,S=[],D=R.slice()),z=u.standardizeCallbacks(v.callbacks),[4,function(t,e,n,p,h,g,v,y,b,_,w,x,E,k,T,N){return r(this,void 0,void 0,function(){var r,S,C,A,I,O,M,R;return i(this,function(P){switch(P.label){case 0:if(null==h&amp;&amp;(h=32),null==g&amp;&amp;(g=1),null==w&amp;&amp;(w=!0),null==E&amp;&amp;(E=0),r=!1,null!=b&amp;&amp;null!=_&amp;&amp;(r=!0),null!=T&amp;&amp;(r=!0,null==k))throw new l.ValueError(&quot;Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.&quot;);return null!=(S=t.checkNumSamples(n,h,k,&quot;steps_per_epoch&quot;))&amp;&amp;(C=f.range(0,S)),null==v&amp;&amp;(v=1),A=u.configureCallbacks(y,N,v,g,E,S,k,h,r,x),I=A.callbackList,O=A.history,I.setModel(t),t.history=O,[4,I.onTrainBegin()];case 1:P.sent(),t.stopTraining_=!1,M=function(u){var f,g,v,y,x;return i(this,function(E){switch(E.label){case 0:return[4,I.onEpochBegin(u)];case 1:if(E.sent(),f={},null==k)return[3,2];throw new l.NotImplementedError(&quot;stepsPerEpoch mode is not implemented yet.&quot;);case 2:if(&quot;batch&quot;===w)throw new l.NotImplementedError(&quot;batch shuffling is not implemneted yet&quot;);w&amp;&amp;a.util.shuffle(C),g=a.tensor1d(C),v=m(S,h),y=function(a){var u;return i(this,function(i){switch(i.label){case 0:return u={},[4,I.onBatchBegin(a,u)];case 1:return i.sent(),o.tidy(function(){var i=v[a][0],l=v[a][1],c=s.sliceAlongFirstAxis(g,i,l-i);u.batch=a,u.size=l-i;for(var m=d(n,c),y=e(m),w=0;w&lt;p.length;++w){var x=p[w],E=y[w];u[x]=E,o.keep(E)}if(a===v.length-1&amp;&amp;r){var k=t.testLoop(b,_,h);for(w=0;w&lt;p.length;++w)x=p[w],E=k[w],o.keep(E),f[&quot;val_&quot;+x]=E}}),[4,I.onBatchEnd(a,u)];case 2:return i.sent(),c.disposeTensorsInLogs(u),t.stopTraining_?[2,&quot;break&quot;]:[2]}})},x=0,E.label=3;case 3:return x&lt;v.length?[5,y(x)]:[3,6];case 4:if(&quot;break&quot;===E.sent())return[3,6];E.label=5;case 5:return++x,[3,3];case 6:g.dispose(),E.label=7;case 7:return[4,I.onEpochEnd(u,f)];case 8:return E.sent(),t.stopTraining_?[2,&quot;break&quot;]:[2]}})},R=E,P.label=2;case 2:return R&lt;g?[5,M(R)]:[3,5];case 3:if(&quot;break&quot;===P.sent())return[3,5];P.label=4;case 4:return++R,[3,2];case 5:return[4,I.onTrainEnd()];case 6:return P.sent(),[4,t.history.syncData()];case 7:return P.sent(),[2,t.history]}})})}(t,M,O,R,k,v.epochs,v.verbose,z,P,S,v.shuffle,D,v.initialEpoch,null,null,v.yieldEvery)];case 2:return[2,L.sent()];case 3:return t.isTraining=!1,g(y,e),g(b,n),g(x,_),g(E,w),[7];case 4:return[2]}})})},n.ensureTensorsRank2OrHigher=function(t){var e=[];t instanceof a.Tensor&amp;&amp;(t=[t]);for(var n=0;n&lt;t.length;++n){var r=t[n];if(1===r.rank)e.push(s.expandDims(r,1));else{if(0===r.rank)throw new Error(&quot;Expected tensor to be at least 1D, but received a 0D tensor (scalar).&quot;);e.push(r)}}return e},n.disposeNewTensors=g},{&quot;../backend/tfjs_backend&quot;:247,&quot;../base_callbacks&quot;:248,&quot;../errors&quot;:259,&quot;../logs&quot;:284,&quot;../utils/math_utils&quot;:293,&quot;@tensorflow/tfjs-core&quot;:138}],259:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return i(e,t),e}(Error);n.AttributeError=o;var a=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return i(e,t),e}(Error);n.RuntimeError=a;var s=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return i(e,t),e}(Error);n.ValueError=s;var u=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return i(e,t),e}(Error);n.NotImplementedError=u;var l=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return i(e,t),e}(Error);n.AssertionError=l;var c=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return i(e,t),e}(Error);n.IndexError=c},{}],260:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./base_callbacks&quot;),i=t(&quot;./engine/input_layer&quot;),o=t(&quot;./engine/training&quot;),a=t(&quot;./models&quot;);n.model=function(t){return new o.LayersModel(t)},n.sequential=function(t){return new a.Sequential(t)},n.loadLayersModel=function(t,e){return null==e&amp;&amp;(e={}),a.loadLayersModelInternal(t,e)},n.input=function(t){return i.Input(t)},n.registerCallbackConstructor=function(t,e){r.CallbackConstructorRegistry.registerCallbackConstructor(t,e)}},{&quot;./base_callbacks&quot;:248,&quot;./engine/input_layer&quot;:254,&quot;./engine/training&quot;:256,&quot;./models&quot;:287}],261:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./constraints&quot;);n.maxNorm=function(t){return new r.MaxNorm(t)},n.unitNorm=function(t){return new r.UnitNorm(t)},n.nonNeg=function(){return new r.NonNeg},n.minMaxNorm=function(t){return new r.MinMaxNorm(t)}},{&quot;./constraints&quot;:251}],262:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./initializers&quot;);n.zeros=function(){return new r.Zeros},n.ones=function(){return new r.Ones},n.constant=function(t){return new r.Constant(t)},n.randomUniform=function(t){return new r.RandomUniform(t)},n.randomNormal=function(t){return new r.RandomNormal(t)},n.truncatedNormal=function(t){return new r.TruncatedNormal(t)},n.identity=function(t){return new r.Identity(t)},n.varianceScaling=function(t){return new r.VarianceScaling(t)},n.glorotUniform=function(t){return new r.GlorotUniform(t)},n.glorotNormal=function(t){return new r.GlorotNormal(t)},n.heNormal=function(t){return new r.HeNormal(t)},n.heUniform=function(t){return new r.HeUniform(t)},n.leCunNormal=function(t){return new r.LeCunNormal(t)},n.leCunUniform=function(t){return new r.LeCunUniform(t)},n.orthogonal=function(t){return new r.Orthogonal(t)}},{&quot;./initializers&quot;:268}],263:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./engine/input_layer&quot;),i=t(&quot;./engine/topology&quot;);n.Layer=i.Layer;var o=t(&quot;./exports&quot;);n.input=o.input;var a=t(&quot;./layers/advanced_activations&quot;),s=t(&quot;./layers/convolutional&quot;),u=t(&quot;./layers/convolutional_depthwise&quot;),l=t(&quot;./layers/core&quot;),c=t(&quot;./layers/embeddings&quot;),f=t(&quot;./layers/merge&quot;),p=t(&quot;./layers/normalization&quot;),h=t(&quot;./layers/padding&quot;),d=t(&quot;./layers/pooling&quot;),m=t(&quot;./layers/recurrent&quot;);n.RNN=m.RNN,n.RNNCell=m.RNNCell;var g=t(&quot;./layers/wrappers&quot;),v=t(&quot;./layers/noise&quot;);function y(t){return new d.AveragePooling1D(t)}function b(t){return new d.AveragePooling2D(t)}function _(t){return new d.GlobalMaxPooling1D(t)}function w(t){return new d.GlobalMaxPooling2D(t)}function x(t){return new d.MaxPooling1D(t)}function E(t){return new d.MaxPooling2D(t)}n.inputLayer=function(t){return new r.InputLayer(t)},n.elu=function(t){return new a.ELU(t)},n.reLU=function(t){return new a.ReLU(t)},n.leakyReLU=function(t){return new a.LeakyReLU(t)},n.prelu=function(t){return new a.PReLU(t)},n.softmax=function(t){return new a.Softmax(t)},n.thresholdedReLU=function(t){return new a.ThresholdedReLU(t)},n.conv1d=function(t){return new s.Conv1D(t)},n.conv2d=function(t){return new s.Conv2D(t)},n.conv2dTranspose=function(t){return new s.Conv2DTranspose(t)},n.conv3d=function(t){return new s.Conv3D(t)},n.separableConv2d=function(t){return new s.SeparableConv2D(t)},n.cropping2D=function(t){return new s.Cropping2D(t)},n.upSampling2d=function(t){return new s.UpSampling2D(t)},n.depthwiseConv2d=function(t){return new u.DepthwiseConv2D(t)},n.activation=function(t){return new l.Activation(t)},n.dense=function(t){return new l.Dense(t)},n.dropout=function(t){return new l.Dropout(t)},n.flatten=function(t){return new l.Flatten(t)},n.repeatVector=function(t){return new l.RepeatVector(t)},n.reshape=function(t){return new l.Reshape(t)},n.permute=function(t){return new l.Permute(t)},n.embedding=function(t){return new c.Embedding(t)},n.add=function(t){return new f.Add(t)},n.average=function(t){return new f.Average(t)},n.concatenate=function(t){return new f.Concatenate(t)},n.maximum=function(t){return new f.Maximum(t)},n.minimum=function(t){return new f.Minimum(t)},n.multiply=function(t){return new f.Multiply(t)},n.dot=function(t){return new f.Dot(t)},n.batchNormalization=function(t){return new p.BatchNormalization(t)},n.zeroPadding2d=function(t){return new h.ZeroPadding2D(t)},n.averagePooling1d=y,n.avgPool1d=function(t){return y(t)},n.avgPooling1d=function(t){return y(t)},n.averagePooling2d=b,n.avgPool2d=function(t){return b(t)},n.avgPooling2d=function(t){return b(t)},n.globalAveragePooling1d=function(t){return new d.GlobalAveragePooling1D(t)},n.globalAveragePooling2d=function(t){return new d.GlobalAveragePooling2D(t)},n.globalMaxPooling1d=_,n.globalMaxPooling2d=w,n.maxPooling1d=x,n.maxPooling2d=E,n.gru=function(t){return new m.GRU(t)},n.gruCell=function(t){return new m.GRUCell(t)},n.lstm=function(t){return new m.LSTM(t)},n.lstmCell=function(t){return new m.LSTMCell(t)},n.simpleRNN=function(t){return new m.SimpleRNN(t)},n.simpleRNNCell=function(t){return new m.SimpleRNNCell(t)},n.rnn=function(t){return new m.RNN(t)},n.stackedRNNCells=function(t){return new m.StackedRNNCells(t)},n.bidirectional=function(t){return new g.Bidirectional(t)},n.timeDistributed=function(t){return new g.TimeDistributed(t)},n.globalMaxPool1d=_,n.globalMaxPool2d=w,n.maxPool1d=x,n.maxPool2d=E,n.gaussianNoise=function(t){return new v.GaussianNoise(t)},n.gaussianDropout=function(t){return new v.GaussianDropout(t)},n.alphaDropout=function(t){return new v.AlphaDropout(t)},n.masking=function(t){return new l.Masking(t)}},{&quot;./engine/input_layer&quot;:254,&quot;./engine/topology&quot;:255,&quot;./exports&quot;:260,&quot;./layers/advanced_activations&quot;:271,&quot;./layers/convolutional&quot;:272,&quot;./layers/convolutional_depthwise&quot;:273,&quot;./layers/core&quot;:274,&quot;./layers/embeddings&quot;:275,&quot;./layers/merge&quot;:276,&quot;./layers/noise&quot;:277,&quot;./layers/normalization&quot;:278,&quot;./layers/padding&quot;:279,&quot;./layers/pooling&quot;:280,&quot;./layers/recurrent&quot;:281,&quot;./layers/wrappers&quot;:283}],264:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./losses&quot;),i=t(&quot;./metrics&quot;);n.binaryAccuracy=function(t,e){return i.binaryAccuracy(t,e)},n.binaryCrossentropy=function(t,e){return i.binaryCrossentropy(t,e)},n.sparseCategoricalAccuracy=function(t,e){return i.sparseCategoricalAccuracy(t,e)},n.categoricalAccuracy=function(t,e){return i.categoricalAccuracy(t,e)},n.categoricalCrossentropy=function(t,e){return i.categoricalCrossentropy(t,e)},n.precision=function(t,e){return i.precision(t,e)},n.recall=function(t,e){return i.recall(t,e)},n.cosineProximity=function(t,e){return r.cosineProximity(t,e)},n.meanAbsoluteError=function(t,e){return r.meanAbsoluteError(t,e)},n.meanAbsolutePercentageError=function(t,e){return r.meanAbsolutePercentageError(t,e)},n.MAPE=function(t,e){return r.meanAbsolutePercentageError(t,e)},n.mape=function(t,e){return r.meanAbsolutePercentageError(t,e)},n.meanSquaredError=function(t,e){return r.meanSquaredError(t,e)},n.MSE=function(t,e){return r.meanSquaredError(t,e)},n.mse=function(t,e){return r.meanSquaredError(t,e)}},{&quot;./losses&quot;:285,&quot;./metrics&quot;:286}],265:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./models&quot;);n.modelFromJSON=r.modelFromJSON},{&quot;./models&quot;:287}],266:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./regularizers&quot;),i=t(&quot;./regularizers&quot;);n.l1l2=function(t){return new i.L1L2(t)},n.l1=function(t){return r.l1(t)},n.l2=function(t){return r.l2(t)}},{&quot;./regularizers&quot;:289}],267:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./exports_constraints&quot;);n.constraints=r;var i=t(&quot;./exports_initializers&quot;);n.initializers=i;var o=t(&quot;./exports_layers&quot;);n.layers=o;var a=t(&quot;./exports_metrics&quot;);n.metrics=a;var s=t(&quot;./exports_models&quot;);n.models=s;var u=t(&quot;./exports_regularizers&quot;);n.regularizers=u;var l=t(&quot;./base_callbacks&quot;);n.CallbackList=l.CallbackList,n.CustomCallback=l.CustomCallback,n.History=l.History;var c=t(&quot;./callbacks&quot;);n.Callback=c.Callback,n.callbacks=c.callbacks,n.EarlyStopping=c.EarlyStopping;var f=t(&quot;./engine/topology&quot;);n.InputSpec=f.InputSpec,n.SymbolicTensor=f.SymbolicTensor;var p=t(&quot;./engine/training&quot;);n.LayersModel=p.LayersModel;var h=t(&quot;./exports&quot;);n.input=h.input,n.loadLayersModel=h.loadLayersModel,n.model=h.model,n.registerCallbackConstructor=h.registerCallbackConstructor,n.sequential=h.sequential;var d=t(&quot;./layers/recurrent&quot;);n.RNN=d.RNN;var m=t(&quot;./models&quot;);n.Sequential=m.Sequential;var g=t(&quot;./variables&quot;);n.LayerVariable=g.LayerVariable;var v=t(&quot;./version&quot;);n.version_layers=v.version},{&quot;./base_callbacks&quot;:248,&quot;./callbacks&quot;:249,&quot;./engine/topology&quot;:255,&quot;./engine/training&quot;:256,&quot;./exports&quot;:260,&quot;./exports_constraints&quot;:261,&quot;./exports_initializers&quot;:262,&quot;./exports_layers&quot;:263,&quot;./exports_metrics&quot;:264,&quot;./exports_models&quot;:265,&quot;./exports_regularizers&quot;:266,&quot;./layers/recurrent&quot;:281,&quot;./models&quot;:287,&quot;./variables&quot;:297,&quot;./version&quot;:298}],268:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;./backend/tfjs_backend&quot;),s=t(&quot;./common&quot;),u=t(&quot;./errors&quot;),l=t(&quot;./keras_format/initializer_config&quot;),c=t(&quot;./utils/generic_utils&quot;),f=t(&quot;./utils/math_utils&quot;);function p(t){c.checkStringTypeUnionValue(l.VALID_FAN_MODE_VALUES,&quot;FanMode&quot;,t)}function h(t){c.checkStringTypeUnionValue(l.VALID_DISTRIBUTION_VALUES,&quot;Distribution&quot;,t)}n.checkFanMode=p,n.checkDistribution=h;var d=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.fromConfigUsesCustomObjects=function(){return!1},e.prototype.getConfig=function(){return{}},e}(o.serialization.Serializable);n.Initializer=d;var m=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t,e){return o.zeros(t,e)},e.className=&quot;Zeros&quot;,e}(d);n.Zeros=m,o.serialization.registerClass(m);var g=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t,e){return o.ones(t,e)},e.className=&quot;Ones&quot;,e}(d);n.Ones=g,o.serialization.registerClass(g);var v=function(t){function e(e){var n=t.call(this)||this;if(&quot;object&quot;!=typeof e)throw new u.ValueError(&quot;Expected argument of type ConstantConfig but got &quot;+e);if(void 0===e.value)throw new u.ValueError(&quot;config must have value set but got &quot;+e);return n.value=e.value,n}return i(e,t),e.prototype.apply=function(t,e){var n=this;return o.tidy(function(){return o.mul(o.scalar(n.value),o.ones(t,e))})},e.prototype.getConfig=function(){return{value:this.value}},e.className=&quot;Constant&quot;,e}(d);n.Constant=v,o.serialization.registerClass(v);var y=function(t){function e(e){var n=t.call(this)||this;return n.DEFAULT_MINVAL=-.05,n.DEFAULT_MAXVAL=.05,n.minval=e.minval||n.DEFAULT_MINVAL,n.maxval=e.maxval||n.DEFAULT_MAXVAL,n.seed=e.seed,n}return i(e,t),e.prototype.apply=function(t,e){return o.randomUniform(t,this.minval,this.maxval,e)},e.prototype.getConfig=function(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}},e.className=&quot;RandomUniform&quot;,e}(d);n.RandomUniform=y,o.serialization.registerClass(y);var b=function(t){function e(e){var n=t.call(this)||this;return n.DEFAULT_MEAN=0,n.DEFAULT_STDDEV=.05,n.mean=e.mean||n.DEFAULT_MEAN,n.stddev=e.stddev||n.DEFAULT_STDDEV,n.seed=e.seed,n}return i(e,t),e.prototype.apply=function(t,e){if(&quot;float32&quot;!==(e=e||&quot;float32&quot;)&amp;&amp;&quot;int32&quot;!==e)throw new u.NotImplementedError(&quot;randomNormal does not support dType &quot;+e+&quot;.&quot;);return a.randomNormal(t,this.mean,this.stddev,e,this.seed)},e.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},e.className=&quot;RandomNormal&quot;,e}(d);n.RandomNormal=b,o.serialization.registerClass(b);var _=function(t){function e(e){var n=t.call(this)||this;return n.DEFAULT_MEAN=0,n.DEFAULT_STDDEV=.05,n.mean=e.mean||n.DEFAULT_MEAN,n.stddev=e.stddev||n.DEFAULT_STDDEV,n.seed=e.seed,n}return i(e,t),e.prototype.apply=function(t,e){if(&quot;float32&quot;!==(e=e||&quot;float32&quot;)&amp;&amp;&quot;int32&quot;!==e)throw new u.NotImplementedError(&quot;truncatedNormal does not support dType &quot;+e+&quot;.&quot;);return o.truncatedNormal(t,this.mean,this.stddev,e,this.seed)},e.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},e.className=&quot;TruncatedNormal&quot;,e}(d);n.TruncatedNormal=_,o.serialization.registerClass(_);var w=function(t){function e(e){var n=t.call(this)||this;return n.gain=null!=e.gain?e.gain:1,n}return i(e,t),e.prototype.apply=function(t,e){var n=this;return o.tidy(function(){if(2!==t.length||t[0]!==t[1])throw new u.ValueError(&quot;Identity matrix initializer can only be used for 2D square matrices.&quot;);return o.mul(n.gain,o.eye(t[0]))})},e.prototype.getConfig=function(){return{gain:this.gain}},e.className=&quot;Identity&quot;,e}(d);n.Identity=w,o.serialization.registerClass(w);var x=function(t){function e(e){var n=t.call(this)||this;if(e.scale&lt;0)throw new u.ValueError(&quot;scale must be a positive float. Got: &quot;+e.scale);return n.scale=null==e.scale?1:e.scale,n.mode=null==e.mode?&quot;fanIn&quot;:e.mode,p(n.mode),n.distribution=null==e.distribution?&quot;normal&quot;:e.distribution,h(n.distribution),n.seed=e.seed,n}return i(e,t),e.prototype.apply=function(t,e){var n=function(t,e){var n,r;if(void 0===e&amp;&amp;(e=&quot;channelsLast&quot;),s.checkDataFormat(e),2===t.length)n=t[0],r=t[1];else if(-1!==[3,4,5].indexOf(t.length))if(&quot;channelsFirst&quot;===e){var i=f.arrayProd(t,2);n=t[1]*i,r=t[0]*i}else&quot;channelsLast&quot;===e&amp;&amp;(i=f.arrayProd(t,0,t.length-2),n=t[t.length-2]*i,r=t[t.length-1]*i);else{var o=f.arrayProd(t);n=Math.sqrt(o),r=Math.sqrt(o)}return[n,r]}(t),r=n[0],i=n[1],a=this.scale;if(&quot;fanIn&quot;===this.mode?a/=Math.max(1,r):&quot;fanOut&quot;===this.mode?a/=Math.max(1,i):a/=Math.max(1,(r+i)/2),&quot;normal&quot;===this.distribution){var l=Math.sqrt(a);if(&quot;float32&quot;!==(e=e||&quot;float32&quot;)&amp;&amp;&quot;int32&quot;!==e)throw new u.NotImplementedError(this.getClassName()+&quot; does not support dType &quot;+e+&quot;.&quot;);return o.truncatedNormal(t,0,l,e,this.seed)}var c=Math.sqrt(3*a);return o.randomUniform(t,-c,c,e)},e.prototype.getConfig=function(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}},e.className=&quot;VarianceScaling&quot;,e}(d);n.VarianceScaling=x,o.serialization.registerClass(x);var E=function(t){function e(e){return t.call(this,{scale:1,mode:&quot;fanAvg&quot;,distribution:&quot;uniform&quot;,seed:null==e?null:e.seed})||this}return i(e,t),e.prototype.getClassName=function(){return x.className},e.className=&quot;GlorotUniform&quot;,e}(x);n.GlorotUniform=E,o.serialization.registerClass(E);var k=function(t){function e(e){return t.call(this,{scale:1,mode:&quot;fanAvg&quot;,distribution:&quot;normal&quot;,seed:null==e?null:e.seed})||this}return i(e,t),e.prototype.getClassName=function(){return x.className},e.className=&quot;GlorotNormal&quot;,e}(x);n.GlorotNormal=k,o.serialization.registerClass(k);var T=function(t){function e(e){return t.call(this,{scale:2,mode:&quot;fanIn&quot;,distribution:&quot;normal&quot;,seed:null==e?null:e.seed})||this}return i(e,t),e.prototype.getClassName=function(){return x.className},e.className=&quot;HeNormal&quot;,e}(x);n.HeNormal=T,o.serialization.registerClass(T);var N=function(t){function e(e){return t.call(this,{scale:2,mode:&quot;fanIn&quot;,distribution:&quot;uniform&quot;,seed:null==e?null:e.seed})||this}return i(e,t),e.prototype.getClassName=function(){return x.className},e.className=&quot;HeUniform&quot;,e}(x);n.HeUniform=N,o.serialization.registerClass(N);var S=function(t){function e(e){return t.call(this,{scale:1,mode:&quot;fanIn&quot;,distribution:&quot;normal&quot;,seed:null==e?null:e.seed})||this}return i(e,t),e.prototype.getClassName=function(){return x.className},e.className=&quot;LeCunNormal&quot;,e}(x);n.LeCunNormal=S,o.serialization.registerClass(S);var C=function(t){function e(e){return t.call(this,{scale:1,mode:&quot;fanIn&quot;,distribution:&quot;uniform&quot;,seed:null==e?null:e.seed})||this}return i(e,t),e.prototype.getClassName=function(){return x.className},e.className=&quot;LeCunNormal&quot;,e}(x);n.LeCunUniform=C,o.serialization.registerClass(C);var A=function(t){function e(e){var n=t.call(this)||this;if(n.DEFAULT_GAIN=1,n.gain=null==e.gain?n.DEFAULT_GAIN:e.gain,n.seed=e.seed,null!=n.seed)throw new u.NotImplementedError(&quot;Random seed is not implemented for Orthogonal Initializer yet.&quot;);return n}return i(e,t),e.prototype.apply=function(t,e){var n=this;return o.tidy(function(){if(2!==t.length)throw new u.NotImplementedError(&quot;The Orthogonal Initializer does not support non-2D shapes yet.&quot;);t[0]*t[1]&gt;2e3&amp;&amp;console.warn(&quot;Orthogonal initializer is being called on a matrix with more than 2000 (&quot;+t[0]*t[1]+&quot;) elements: Slowness may result.&quot;);var e=t[0]&gt;t[1]?[t[1],t[0]]:t,r=a.randomNormal(e,0,1,&quot;float32&quot;),i=o.linalg.gramSchmidt(r);return t[0]&gt;t[1]&amp;&amp;(i=i.transpose()),o.mul(n.gain,i)})},e.prototype.getConfig=function(){return{gain:this.gain,seed:this.seed}},e.className=&quot;Orthogonal&quot;,e}(d);function I(t,e){return void 0===e&amp;&amp;(e={}),c.deserializeKerasObject(t,o.serialization.SerializationMap.getMap().classNameMap,e,&quot;initializer&quot;)}n.Orthogonal=A,o.serialization.registerClass(A),n.INITIALIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP={constant:&quot;Constant&quot;,glorotNormal:&quot;GlorotNormal&quot;,glorotUniform:&quot;GlorotUniform&quot;,heNormal:&quot;HeNormal&quot;,heUniform:&quot;HeUniform&quot;,identity:&quot;Identity&quot;,leCunNormal:&quot;LeCunNormal&quot;,leCunUniform:&quot;LeCunUniform&quot;,ones:&quot;Ones&quot;,orthogonal:&quot;Orthogonal&quot;,randomNormal:&quot;RandomNormal&quot;,randomUniform:&quot;RandomUniform&quot;,truncatedNormal:&quot;TruncatedNormal&quot;,varianceScaling:&quot;VarianceScaling&quot;,zeros:&quot;Zeros&quot;},n.serializeInitializer=function(t){return c.serializeKerasObject(t)},n.getInitializer=function(t){if(&quot;string&quot;==typeof t){var e=t in n.INITIALIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP?n.INITIALIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP[t]:t;if(&quot;GlorotNormal&quot;===e)return new k;if(&quot;GlorotUniform&quot;===e)return new E;if(&quot;HeNormal&quot;===e)return new T;if(&quot;HeUniform&quot;===e)return new N;if(&quot;LeCunNormal&quot;===e)return new S;if(&quot;LeCunUniform&quot;===e)return new C;var r={};return r.className=e,r.config={},I(r)}return t instanceof d?t:I(t)}},{&quot;./backend/tfjs_backend&quot;:247,&quot;./common&quot;:250,&quot;./errors&quot;:259,&quot;./keras_format/initializer_config&quot;:270,&quot;./utils/generic_utils&quot;:291,&quot;./utils/math_utils&quot;:293,&quot;@tensorflow/tfjs-core&quot;:138}],269:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.VALID_DATA_FORMAT_VALUES=[&quot;channelsFirst&quot;,&quot;channelsLast&quot;],n.VALID_PADDING_MODE_VALUES=[&quot;valid&quot;,&quot;same&quot;,&quot;causal&quot;],n.VALID_POOL_MODE_VALUES=[&quot;max&quot;,&quot;avg&quot;],n.VALID_BIDIRECTIONAL_MERGE_MODES=[&quot;sum&quot;,&quot;mul&quot;,&quot;concat&quot;,&quot;ave&quot;],n.VALID_SAMPLE_WEIGHT_MODES=[&quot;temporal&quot;]},{}],270:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.VALID_FAN_MODE_VALUES=[&quot;fanIn&quot;,&quot;fanOut&quot;,&quot;fanAvg&quot;],n.VALID_DISTRIBUTION_VALUES=[&quot;normal&quot;,&quot;uniform&quot;,&quot;truncatedNormal&quot;],n.initializerClassNames=[&quot;Zeros&quot;,&quot;Ones&quot;,&quot;Constant&quot;,&quot;RandomNormal&quot;,&quot;RandomUniform&quot;,&quot;TruncatedNormal&quot;,&quot;VarianceScaling&quot;,&quot;Orthogonal&quot;,&quot;Identity&quot;]},{}],271:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;../activations&quot;),s=t(&quot;../backend/tfjs_backend&quot;),u=t(&quot;../constraints&quot;),l=t(&quot;../engine/topology&quot;),c=t(&quot;../errors&quot;),f=t(&quot;../initializers&quot;),p=t(&quot;../regularizers&quot;),h=t(&quot;../utils/types_utils&quot;),d=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;return n.supportsMasking=!0,null!=e&amp;&amp;(n.maxValue=e.maxValue),n}return i(e,t),e.prototype.call=function(t,e){t=h.getExactlyOneTensor(t);var n=o.relu(t);return null!=this.maxValue&amp;&amp;(n=o.clipByValue(n,0,this.maxValue)),n},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e={maxValue:this.maxValue},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;ReLU&quot;,e}(l.Layer);n.ReLU=d,o.serialization.registerClass(d);var m=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;return n.DEFAULT_ALPHA=.3,null==e&amp;&amp;(e={}),n.alpha=null==e.alpha?n.DEFAULT_ALPHA:e.alpha,n}return i(e,t),e.prototype.call=function(t,e){var n=h.getExactlyOneTensor(t);return o.leakyRelu(n,this.alpha)},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e={alpha:this.alpha},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;LeakyReLU&quot;,e}(l.Layer);n.LeakyReLU=m,o.serialization.registerClass(m);var g=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;if(n.DEFAULT_ALPHA_INITIALIZER=&quot;zeros&quot;,null==e&amp;&amp;(e={}),n.supportsMasking=!0,n.alphaInitializer=f.getInitializer(e.alphaInitializer||n.DEFAULT_ALPHA_INITIALIZER),n.alphaRegularizer=p.getRegularizer(e.alphaRegularizer),n.alphaConstraint=u.getConstraint(e.alphaConstraint),null==e.sharedAxes)n.sharedAxes=null;else if(Array.isArray(e.sharedAxes))n.sharedAxes=e.sharedAxes;else{if(&quot;number&quot;!=typeof e.sharedAxes)throw new c.ValueError(&quot;Expected sharedAxes to be a number or an array of numbers, but got &quot;+e.sharedAxes);n.sharedAxes=[e.sharedAxes]}return n}return i(e,t),e.prototype.build=function(t){var e=(t=h.getExactlyOneShape(t)).slice(1);if(null!=this.sharedAxes)for(var n=0,r=this.sharedAxes;n&lt;r.length;n++){e[(o=r[n])-1]=1}this.alpha=this.addWeight(&quot;alpha&quot;,e,&quot;float32&quot;,this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);var i={};if(null!=this.sharedAxes)for(var o=1;o&lt;t.length;++o)i[o]=t[o];this.inputSpec=[new l.InputSpec({ndim:t.length,axes:i})],this.built=!0},e.prototype.call=function(t,e){return t=h.getExactlyOneTensor(t),o.prelu(t,this.alpha.read())},e.prototype.getConfig=function(){var e={alphaInitializer:f.serializeInitializer(this.alphaInitializer),alphaRegularizer:p.serializeRegularizer(this.alphaRegularizer),alphaConstraint:u.serializeConstraint(this.alphaConstraint),sharedAxes:this.sharedAxes},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;PReLU&quot;,e}(l.Layer);n.PReLU=g,o.serialization.registerClass(g);var v=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;if(n.DEFAULT_ALPHA=1,null==e&amp;&amp;(e={}),null!=e.alpha&amp;&amp;e.alpha!==n.DEFAULT_ALPHA)throw new c.NotImplementedError(&quot;Non-default alpha value (&quot;+e.alpha+&quot;) is not supported by the ELU layer yet.&quot;);return n.alpha=null==e.alpha?n.DEFAULT_ALPHA:e.alpha,n}return i(e,t),e.prototype.call=function(t,e){var n=h.getExactlyOneTensor(t);return o.elu(n)},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e={alpha:this.alpha},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;ELU&quot;,e}(l.Layer);n.ELU=v,o.serialization.registerClass(v);var y=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;return n.DEFAULT_THETA=1,null==e&amp;&amp;(e={}),n.theta=null==e.theta?n.DEFAULT_THETA:e.theta,n}return i(e,t),e.prototype.call=function(t,e){var n=h.getExactlyOneTensor(t);return n.mul(s.cast(n.greater(this.theta),&quot;float32&quot;))},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e={theta:this.theta},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;ThresholdedReLU&quot;,e}(l.Layer);n.ThresholdedReLU=y,o.serialization.registerClass(y);var b=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;return n.DEFAULT_AXIS=1,null==e&amp;&amp;(e={}),n.softmax=(new a.Softmax).apply,n.axis=null==e.axis?n.DEFAULT_AXIS:e.axis,n}return i(e,t),e.prototype.call=function(t,e){var n=h.getExactlyOneTensor(t);return this.softmax(n,this.axis)},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e={axis:this.axis},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;Softmax&quot;,e}(l.Layer);n.Softmax=b,o.serialization.registerClass(b)},{&quot;../activations&quot;:244,&quot;../backend/tfjs_backend&quot;:247,&quot;../constraints&quot;:251,&quot;../engine/topology&quot;:255,&quot;../errors&quot;:259,&quot;../initializers&quot;:268,&quot;../regularizers&quot;:289,&quot;../utils/types_utils&quot;:295,&quot;@tensorflow/tfjs-core&quot;:138}],272:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../activations&quot;),u=t(&quot;../backend/common&quot;),l=t(&quot;../backend/tfjs_backend&quot;),c=t(&quot;../common&quot;),f=t(&quot;../constraints&quot;),p=t(&quot;../engine/topology&quot;),h=t(&quot;../errors&quot;),d=t(&quot;../initializers&quot;),m=t(&quot;../regularizers&quot;),g=t(&quot;../utils/conv_utils&quot;),v=t(&quot;../utils/generic_utils&quot;),y=t(&quot;../utils/types_utils&quot;);function b(t,e){return a.tidy(function(){return c.checkDataFormat(e),&quot;channelsFirst&quot;===e?o.transpose(t,[0,2,3,1]):t})}function _(t,e){return a.tidy(function(){return c.checkDataFormat(e),&quot;channelsFirst&quot;===e?o.transpose(t,[0,2,3,4,1]):t})}function w(t,e,n,r,i,s,f){return void 0===r&amp;&amp;(r=1),void 0===i&amp;&amp;(i=&quot;valid&quot;),void 0===f&amp;&amp;(f=1),a.tidy(function(){if(null==s&amp;&amp;(s=u.imageDataFormat()),c.checkDataFormat(s),3!==t.shape.length)throw new h.ValueError(&quot;The input of a conv1dWithBias operation should be 3, but is &quot;+t.shape.length+&quot; instead.&quot;);if(3!==e.shape.length)throw new h.ValueError(&quot;The kernel for a conv1dWithBias operation should be 3, but is &quot;+e.shape.length+&quot; instead&quot;);if(null!=n&amp;&amp;1!==n.shape.length)throw new h.ValueError(&quot;The bias for a conv1dWithBias operation should be 1, but is &quot;+e.shape.length+&quot; instead&quot;);if(&quot;channelsFirst&quot;===s&amp;&amp;(t=o.transpose(t,[0,2,1])),&quot;causal&quot;===i)throw new h.NotImplementedError(&quot;The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.&quot;);var a=o.conv1d(t,e,r,&quot;same&quot;===i?&quot;same&quot;:&quot;valid&quot;,&quot;NWC&quot;,f);return null!=n&amp;&amp;(a=l.biasAdd(a,n)),a})}function x(t,e,n,r,i,s,f){return void 0===r&amp;&amp;(r=[1,1]),void 0===i&amp;&amp;(i=&quot;valid&quot;),a.tidy(function(){if(null==s&amp;&amp;(s=u.imageDataFormat()),c.checkDataFormat(s),3!==t.rank&amp;&amp;4!==t.rank)throw new h.ValueError(&quot;conv2dWithBias expects input to be of rank 3 or 4, but received &quot;+t.rank+&quot;.&quot;);if(3!==e.rank&amp;&amp;4!==e.rank)throw new h.ValueError(&quot;conv2dWithBias expects kernel to be of rank 3 or 4, but received &quot;+t.rank+&quot;.&quot;);var a=b(t,s);if(&quot;causal&quot;===i)throw new h.NotImplementedError(&quot;The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.&quot;);return a=o.conv2d(a,e,r,&quot;same&quot;===i?&quot;same&quot;:&quot;valid&quot;,&quot;NHWC&quot;,f),null!=n&amp;&amp;(a=l.biasAdd(a,n)),&quot;channelsFirst&quot;===s&amp;&amp;(a=o.transpose(a,[0,3,1,2])),a})}function E(t,e,n,r,i,s,f){return void 0===r&amp;&amp;(r=[1,1,1]),void 0===i&amp;&amp;(i=&quot;valid&quot;),a.tidy(function(){if(null==s&amp;&amp;(s=u.imageDataFormat()),c.checkDataFormat(s),4!==t.rank&amp;&amp;5!==t.rank)throw new h.ValueError(&quot;conv3dWithBias expects input to be of rank 4 or 5, but received &quot;+t.rank+&quot;.&quot;);if(4!==e.rank&amp;&amp;5!==e.rank)throw new h.ValueError(&quot;conv3dWithBias expects kernel to be of rank 4 or 5, but received &quot;+t.rank+&quot;.&quot;);var a=_(t,s);if(&quot;causal&quot;===i)throw new h.NotImplementedError(&quot;The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.&quot;);return a=o.conv3d(a,e,r,&quot;same&quot;===i?&quot;same&quot;:&quot;valid&quot;,&quot;NHWC&quot;,f),null!=n&amp;&amp;(a=l.biasAdd(a,n)),&quot;channelsFirst&quot;===s&amp;&amp;(a=o.transpose(a,[0,4,1,2,3])),a})}n.preprocessConv2DInput=b,n.preprocessConv3DInput=_,n.conv1dWithBias=w,n.conv1d=function(t,e,n,r,i,o){return void 0===n&amp;&amp;(n=1),void 0===r&amp;&amp;(r=&quot;valid&quot;),void 0===o&amp;&amp;(o=1),a.tidy(function(){return c.checkDataFormat(i),w(t,e,null,n,r,i,o)})},n.conv2d=function(t,e,n,r,i,o){return void 0===n&amp;&amp;(n=[1,1]),void 0===r&amp;&amp;(r=&quot;valid&quot;),a.tidy(function(){return c.checkDataFormat(i),x(t,e,null,n,r,i,o)})},n.conv2dWithBias=x,n.conv3d=function(t,e,n,r,i,o){return void 0===n&amp;&amp;(n=[1,1,1]),void 0===r&amp;&amp;(r=&quot;valid&quot;),a.tidy(function(){return c.checkDataFormat(i),E(t,e,null,n,r,i,o)})},n.conv3dWithBias=E;var k=function(t){function e(n,r){var i=t.call(this,r)||this;if(i.bias=null,i.DEFAULT_KERNEL_INITIALIZER=&quot;glorotNormal&quot;,i.DEFAULT_BIAS_INITIALIZER=&quot;zeros&quot;,e.verifyArgs(r),i.rank=n,v.assertPositiveInteger(i.rank,&quot;rank&quot;),1!==i.rank&amp;&amp;2!==i.rank&amp;&amp;3!==i.rank)throw new h.NotImplementedError(&quot;Convolution layer for rank other than 1, 2, or 3 (&quot;+i.rank+&quot;) is not implemented yet.&quot;);if(i.kernelSize=g.normalizeArray(r.kernelSize,n,&quot;kernelSize&quot;),i.strides=g.normalizeArray(null==r.strides?1:r.strides,n,&quot;strides&quot;),i.padding=null==r.padding?&quot;valid&quot;:r.padding,c.checkPaddingMode(i.padding),i.dataFormat=null==r.dataFormat?&quot;channelsLast&quot;:r.dataFormat,c.checkDataFormat(i.dataFormat),i.activation=s.getActivation(r.activation),i.useBias=null==r.useBias||r.useBias,i.biasInitializer=d.getInitializer(r.biasInitializer||i.DEFAULT_BIAS_INITIALIZER),i.biasConstraint=f.getConstraint(r.biasConstraint),i.biasRegularizer=m.getRegularizer(r.biasRegularizer),i.activityRegularizer=m.getRegularizer(r.activityRegularizer),i.dilationRate=g.normalizeArray(null==r.dilationRate?1:r.dilationRate,n,&quot;dilationRate&quot;),1===i.rank&amp;&amp;Array.isArray(i.dilationRate)&amp;&amp;1!==i.dilationRate.length)throw new h.ValueError(&quot;dilationRate must be a number or an array of a single number for 1D convolution, but received &quot;+JSON.stringify(i.dilationRate));if(2===i.rank){if(&quot;number&quot;==typeof i.dilationRate)i.dilationRate=[i.dilationRate,i.dilationRate];else if(2!==i.dilationRate.length)throw new h.ValueError(&quot;dilationRate must be a number or array of two numbers for 2D convolution, but received &quot;+JSON.stringify(i.dilationRate))}else if(3===i.rank)if(&quot;number&quot;==typeof i.dilationRate)i.dilationRate=[i.dilationRate,i.dilationRate,i.dilationRate];else if(3!==i.dilationRate.length)throw new h.ValueError(&quot;dilationRate must be a number or array of three numbers for 3D convolution, but received &quot;+JSON.stringify(i.dilationRate));return i}return i(e,t),e.verifyArgs=function(t){if(v.assert(&quot;kernelSize&quot;in t,&quot;required key &apos;kernelSize&apos; not in config&quot;),&quot;number&quot;!=typeof t.kernelSize&amp;&amp;!v.checkArrayTypeAndLength(t.kernelSize,&quot;number&quot;,1,3))throw new h.ValueError(&quot;BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received &quot;+JSON.stringify(t.kernelSize)+&quot;.&quot;)},e.prototype.getConfig=function(){var e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:s.serializeActivation(this.activation),useBias:this.useBias,biasInitializer:d.serializeInitializer(this.biasInitializer),biasRegularizer:m.serializeRegularizer(this.biasRegularizer),activityRegularizer:m.serializeRegularizer(this.activityRegularizer),biasConstraint:f.serializeConstraint(this.biasConstraint)},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e}(p.Layer);n.BaseConv=k;var T=function(t){function e(n,r){var i=t.call(this,n,r)||this;return i.kernel=null,e.verifyArgs(r),i.filters=r.filters,v.assertPositiveInteger(i.filters,&quot;filters&quot;),i.kernelInitializer=d.getInitializer(r.kernelInitializer||i.DEFAULT_KERNEL_INITIALIZER),i.kernelConstraint=f.getConstraint(r.kernelConstraint),i.kernelRegularizer=m.getRegularizer(r.kernelRegularizer),i}return i(e,t),e.prototype.build=function(t){var e;t=y.getExactlyOneShape(t);var n=&quot;channelsFirst&quot;===this.dataFormat?1:t.length-1;if(null==t[n])throw new h.ValueError(&quot;The channel dimension of the input should be defined. Found &quot;+t[n]);var r=t[n],i=this.kernelSize.concat([r,this.filters]);this.kernel=this.addWeight(&quot;kernel&quot;,i,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&amp;&amp;(this.bias=this.addWeight(&quot;bias&quot;,[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:(e={},e[n]=r,e)}],this.built=!0},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){var e;t=y.getExactlyOneTensor(t);var r=null==n.bias?null:n.bias.read();if(1===n.rank)e=w(t,n.kernel.read(),r,n.strides[0],n.padding,n.dataFormat,n.dilationRate[0]);else if(2===n.rank)e=x(t,n.kernel.read(),r,n.strides,n.padding,n.dataFormat,n.dilationRate);else{if(3!==n.rank)throw new h.NotImplementedError(&quot;convolutions greater than 3D are not implemented yet.&quot;);e=E(t,n.kernel.read(),r,n.strides,n.padding,n.dataFormat,n.dilationRate)}return null!=n.activation&amp;&amp;(e=n.activation.apply(e)),e})},e.prototype.computeOutputShape=function(t){t=y.getExactlyOneShape(t);for(var e=[],n=&quot;channelsLast&quot;===this.dataFormat?t.slice(1,t.length-1):t.slice(2),r=0;r&lt;n.length;++r){var i=g.convOutputLength(n[r],this.kernelSize[r],this.padding,this.strides[r],&quot;number&quot;==typeof this.dilationRate?this.dilationRate:this.dilationRate[r]);e.push(i)}var o=[t[0]];return&quot;channelsLast&quot;===this.dataFormat?(o=o.concat(e)).push(this.filters):(o.push(this.filters),o=o.concat(e)),o},e.prototype.getConfig=function(){var e={filters:this.filters,kernelInitializer:d.serializeInitializer(this.kernelInitializer),kernelRegularizer:m.serializeRegularizer(this.kernelRegularizer),kernelConstraint:f.serializeConstraint(this.kernelConstraint)},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.verifyArgs=function(t){if(!(&quot;filters&quot;in t)||&quot;number&quot;!=typeof t.filters||t.filters&lt;1)throw new h.ValueError(&quot;Convolution layer expected config.filters to be a &apos;number&apos; &gt; 0 but got &quot;+JSON.stringify(t.filters))},e}(k);n.Conv=T;var N=function(t){function e(n){var r=t.call(this,2,n)||this;return e.verifyArgs(n),r}return i(e,t),e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return delete e.rank,e},e.verifyArgs=function(t){if(&quot;number&quot;!=typeof t.kernelSize&amp;&amp;!v.checkArrayTypeAndLength(t.kernelSize,&quot;number&quot;,1,2))throw new h.ValueError(&quot;Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received &quot;+JSON.stringify(t.kernelSize)+&quot;.&quot;)},e.className=&quot;Conv2D&quot;,e}(T);n.Conv2D=N,a.serialization.registerClass(N);var S=function(t){function e(n){var r=t.call(this,3,n)||this;return e.verifyArgs(n),r}return i(e,t),e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return delete e.rank,e},e.verifyArgs=function(t){if(&quot;number&quot;!=typeof t.kernelSize&amp;&amp;(!Array.isArray(t.kernelSize)||1!==t.kernelSize.length&amp;&amp;3!==t.kernelSize.length))throw new h.ValueError(&quot;Conv3D expects config.kernelSize to be number or [number, number, number], but received &quot;+JSON.stringify(t.kernelSize)+&quot;.&quot;)},e.className=&quot;Conv3D&quot;,e}(T);n.Conv3D=S,a.serialization.registerClass(S);var C=function(t){function e(e){var n=t.call(this,e)||this;if(n.inputSpec=[new p.InputSpec({ndim:4})],&quot;same&quot;!==n.padding&amp;&amp;&quot;valid&quot;!==n.padding)throw new h.ValueError(&quot;Conv2DTranspose currently supports only padding modes &apos;same&apos; and &apos;valid&apos;, but received padding mode &quot;+n.padding);return n}return i(e,t),e.prototype.build=function(t){var e;if(4!==(t=y.getExactlyOneShape(t)).length)throw new h.ValueError(&quot;Input should have rank 4; Received input shape: &quot;+JSON.stringify(t));var n=&quot;channelsFirst&quot;===this.dataFormat?1:t.length-1;if(null==t[n])throw new h.ValueError(&quot;The channel dimension of the inputs should be defined. Found `None`.&quot;);var r=t[n],i=this.kernelSize.concat([this.filters,r]);this.kernel=this.addWeight(&quot;kernel&quot;,i,&quot;float32&quot;,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&amp;&amp;(this.bias=this.addWeight(&quot;bias&quot;,[this.filters],&quot;float32&quot;,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new p.InputSpec({ndim:4,axes:(e={},e[n]=r,e)})],this.built=!0},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){var e=y.getExactlyOneTensor(t);if(4!==e.shape.length)throw new h.ValueError(&quot;Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-&quot;+e.shape.length);var r,i,a=e.shape,s=a[0];&quot;channelsFirst&quot;===n.dataFormat?(r=2,i=3):(r=1,i=2);var u=a[r],c=a[i],f=n.kernelSize[0],p=n.kernelSize[1],d=n.strides[0],m=n.strides[1],v=[s,g.deconvLength(u,d,f,n.padding),g.deconvLength(c,m,p,n.padding),n.filters];&quot;channelsLast&quot;!==n.dataFormat&amp;&amp;(e=o.transpose(e,[0,2,3,1]));var b=o.conv2dTranspose(e,n.kernel.read(),v,n.strides,n.padding);return&quot;channelsLast&quot;!==n.dataFormat&amp;&amp;(b=o.transpose(b,[0,3,1,2])),null!=n.bias&amp;&amp;(b=l.biasAdd(b,n.bias.read(),n.dataFormat)),null!=n.activation&amp;&amp;(b=n.activation.apply(b)),b})},e.prototype.computeOutputShape=function(t){var e,n,r,i=(t=y.getExactlyOneShape(t)).slice();&quot;channelsFirst&quot;===this.dataFormat?(e=1,n=2,r=3):(e=3,n=1,r=2);var o=this.kernelSize[0],a=this.kernelSize[1],s=this.strides[0],u=this.strides[1];return i[e]=this.filters,i[n]=g.deconvLength(i[n],s,o,this.padding),i[r]=g.deconvLength(i[r],u,a,this.padding),i},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return delete e.dilationRate,e},e.className=&quot;Conv2DTranspose&quot;,e}(N);n.Conv2DTranspose=C,a.serialization.registerClass(C);var A=function(t){function e(e,n){var r=t.call(this,e,n)||this;if(r.DEFAULT_DEPTHWISE_INITIALIZER=&quot;glorotUniform&quot;,r.DEFAULT_POINTWISE_INITIALIZER=&quot;glorotUniform&quot;,r.depthwiseKernel=null,r.pointwiseKernel=null,null==n.filters)throw new h.ValueError(&quot;The `filters` configuration field is required by SeparableConv, but is unspecified.&quot;);if(null!=n.kernelInitializer||null!=n.kernelRegularizer||null!=n.kernelConstraint)throw new h.ValueError(&quot;Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.&quot;);if(null!=n.padding&amp;&amp;&quot;same&quot;!==n.padding&amp;&amp;&quot;valid&quot;!==n.padding)throw new h.ValueError(&quot;SeparableConv&quot;+r.rank+&quot;D supports only padding modes: &apos;same&apos; and &apos;valid&apos;, but received &quot;+JSON.stringify(n.padding));return r.depthMultiplier=null==n.depthMultiplier?1:n.depthMultiplier,r.depthwiseInitializer=d.getInitializer(n.depthwiseInitializer||r.DEFAULT_DEPTHWISE_INITIALIZER),r.depthwiseRegularizer=m.getRegularizer(n.depthwiseRegularizer),r.depthwiseConstraint=f.getConstraint(n.depthwiseConstraint),r.pointwiseInitializer=d.getInitializer(n.depthwiseInitializer||r.DEFAULT_POINTWISE_INITIALIZER),r.pointwiseRegularizer=m.getRegularizer(n.pointwiseRegularizer),r.pointwiseConstraint=f.getConstraint(n.pointwiseConstraint),r}return i(e,t),e.prototype.build=function(t){var e;if((t=y.getExactlyOneShape(t)).length&lt;this.rank+2)throw new h.ValueError(&quot;Inputs to SeparableConv&quot;+this.rank+&quot;D should have rank &quot;+(this.rank+2)+&quot;, but received input shape: &quot;+JSON.stringify(t));var n=&quot;channelsFirst&quot;===this.dataFormat?1:t.length-1;if(null==t[n]||t[n]&lt;0)throw new h.ValueError(&quot;The channel dimension of the inputs should be defined, but found &quot;+JSON.stringify(t[n]));for(var r=t[n],i=this.kernelSize.concat([r,this.depthMultiplier]),o=[],a=0;a&lt;this.rank;++a)o.push(1);o.push(r*this.depthMultiplier,this.filters);this.depthwiseKernel=this.addWeight(&quot;depthwise_kernel&quot;,i,&quot;float32&quot;,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.pointwiseKernel=this.addWeight(&quot;pointwise_kernel&quot;,o,&quot;float32&quot;,this.pointwiseInitializer,this.pointwiseRegularizer,!0,this.pointwiseConstraint),this.useBias?this.bias=this.addWeight(&quot;bias&quot;,[this.filters],&quot;float32&quot;,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.inputSpec=[new p.InputSpec({ndim:this.rank+2,axes:(e={},e[n]=r,e)})],this.built=!0},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){var e;if(t=y.getExactlyOneTensor(t),1===n.rank)throw new h.NotImplementedError(&quot;1D separable convolution is not implemented yet.&quot;);return 2===n.rank&amp;&amp;(&quot;channelsFirst&quot;===n.dataFormat&amp;&amp;(t=o.transpose(t,[0,2,3,1])),e=o.separableConv2d(t,n.depthwiseKernel.read(),n.pointwiseKernel.read(),n.strides,n.padding,n.dilationRate,&quot;NHWC&quot;)),n.useBias&amp;&amp;(e=l.biasAdd(e,n.bias.read(),n.dataFormat)),null!=n.activation&amp;&amp;(e=n.activation.apply(e)),&quot;channelsFirst&quot;===n.dataFormat&amp;&amp;(e=o.transpose(e,[0,3,1,2])),e})},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=d.serializeInitializer(this.depthwiseInitializer),e.pointwiseInitializer=d.serializeInitializer(this.pointwiseInitializer),e.depthwiseRegularizer=m.serializeRegularizer(this.depthwiseRegularizer),e.pointwiseRegularizer=m.serializeRegularizer(this.pointwiseRegularizer),e.depthwiseConstraint=f.serializeConstraint(this.depthwiseConstraint),e.pointwiseConstraint=f.serializeConstraint(this.pointwiseConstraint),e},e.className=&quot;SeparableConv&quot;,e}(T);n.SeparableConv=A;var I=function(t){function e(e){return t.call(this,2,e)||this}return i(e,t),e.className=&quot;SeparableConv2D&quot;,e}(A);n.SeparableConv2D=I,a.serialization.registerClass(I);var O=function(t){function e(n){var r=t.call(this,1,n)||this;return e.verifyArgs(n),r.inputSpec=[{ndim:3}],r}return i(e,t),e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return delete e.rank,delete e.dataFormat,e},e.verifyArgs=function(t){if(&quot;number&quot;!=typeof t.kernelSize&amp;&amp;!v.checkArrayTypeAndLength(t.kernelSize,&quot;number&quot;,1,1))throw new h.ValueError(&quot;Conv1D expects config.kernelSize to be number or number[] with length 1, but received &quot;+JSON.stringify(t.kernelSize)+&quot;.&quot;)},e.className=&quot;Conv1D&quot;,e}(T);n.Conv1D=O,a.serialization.registerClass(O);var M=function(t){function e(e){var n=t.call(this,e)||this;return&quot;number&quot;==typeof e.cropping?n.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:&quot;number&quot;==typeof e.cropping[0]?n.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:n.cropping=e.cropping,n.dataFormat=void 0===e.dataFormat?&quot;channelsLast&quot;:e.dataFormat,n.inputSpec=[{ndim:4}],n}return i(e,t),e.prototype.computeOutputShape=function(t){return&quot;channelsFirst&quot;===this.dataFormat?[t[0],t[1],t[2]-this.cropping[0][0]-this.cropping[0][1],t[3]-this.cropping[1][0]-this.cropping[1][1]]:[t[0],t[1]-this.cropping[0][0]-this.cropping[0][1],t[2]-this.cropping[1][0]-this.cropping[1][1],t[3]]},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){if(t=y.getExactlyOneTensor(t),&quot;channelsLast&quot;===n.dataFormat){var e=l.sliceAlongAxis(t,n.cropping[0][0],t.shape[1]-n.cropping[0][0]-n.cropping[0][1],2);return l.sliceAlongAxis(e,n.cropping[1][0],t.shape[2]-n.cropping[1][1]-n.cropping[1][0],3)}e=l.sliceAlongAxis(t,n.cropping[0][0],t.shape[2]-n.cropping[0][0]-n.cropping[0][1],3);return l.sliceAlongAxis(e,n.cropping[1][0],t.shape[3]-n.cropping[1][1]-n.cropping[1][0],4)})},e.prototype.getConfig=function(){var e={cropping:this.cropping,dataFormat:this.dataFormat},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;Cropping2D&quot;,e}(p.Layer);n.Cropping2D=M,a.serialization.registerClass(M);var R=function(t){function e(e){var n=t.call(this,e)||this;return n.DEFAULT_SIZE=[2,2],n.inputSpec=[{ndim:4}],n.size=null==e.size?n.DEFAULT_SIZE:e.size,n.dataFormat=null==e.dataFormat?&quot;channelsLast&quot;:e.dataFormat,n}return i(e,t),e.prototype.computeOutputShape=function(t){if(&quot;channelsFirst&quot;===this.dataFormat){var e=null==t[2]?null:this.size[0]*t[2],n=null==t[3]?null:this.size[1]*t[3];return[t[0],t[1],e,n]}e=null==t[1]?null:this.size[0]*t[1],n=null==t[2]?null:this.size[1]*t[2];return[t[0],e,n,t[3]]},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){var e=y.getExactlyOneTensor(t),r=e.shape;if(&quot;channelsFirst&quot;===n.dataFormat){e=o.transpose(e,[0,2,3,1]);var i=n.size[0]*r[2],a=n.size[1]*r[3],s=e.resizeNearestNeighbor([i,a]);return o.transpose(s,[0,3,1,2])}i=n.size[0]*r[1],a=n.size[1]*r[2];return e.resizeNearestNeighbor([i,a])})},e.prototype.getConfig=function(){var e={size:this.size,dataFormat:this.dataFormat},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;UpSampling2D&quot;,e}(p.Layer);n.UpSampling2D=R,a.serialization.registerClass(R)},{&quot;../activations&quot;:244,&quot;../backend/common&quot;:245,&quot;../backend/tfjs_backend&quot;:247,&quot;../common&quot;:250,&quot;../constraints&quot;:251,&quot;../engine/topology&quot;:255,&quot;../errors&quot;:259,&quot;../initializers&quot;:268,&quot;../regularizers&quot;:289,&quot;../utils/conv_utils&quot;:290,&quot;../utils/generic_utils&quot;:291,&quot;../utils/types_utils&quot;:295,&quot;@tensorflow/tfjs-core&quot;:138}],273:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../backend/common&quot;),u=t(&quot;../backend/tfjs_backend&quot;),l=t(&quot;../common&quot;),c=t(&quot;../constraints&quot;),f=t(&quot;../errors&quot;),p=t(&quot;../initializers&quot;),h=t(&quot;../regularizers&quot;),d=t(&quot;../utils/conv_utils&quot;),m=t(&quot;../utils/types_utils&quot;),g=t(&quot;./convolutional&quot;);function v(t,e,n,r,i,u){return void 0===n&amp;&amp;(n=[1,1]),void 0===r&amp;&amp;(r=&quot;valid&quot;),a.tidy(function(){null==i&amp;&amp;(i=s.imageDataFormat()),l.checkDataFormat(i);var a=g.preprocessConv2DInput(t,i);if(4!==t.rank)throw new f.ValueError(&quot;Input for depthwiseConv2d is required to be 4-D, but is instead &quot;+t.rank+&quot;-D&quot;);if(4!==e.rank)throw new f.ValueError(&quot;depthwiseKernel is required to be 4-D, but is instead &quot;+e.rank+&quot;-D&quot;);return a=o.depthwiseConv2d(a,e,n,&quot;same&quot;===r?&quot;same&quot;:&quot;valid&quot;,&quot;NHWC&quot;,u),&quot;channelsFirst&quot;===i&amp;&amp;(a=o.transpose(a,[0,3,1,2])),a})}n.depthwiseConv2d=v;var y=function(t){function e(e){var n=t.call(this,2,e)||this;return n.depthwiseKernel=null,n.depthMultiplier=null==e.depthMultiplier?1:e.depthMultiplier,n.depthwiseInitializer=p.getInitializer(e.depthwiseInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.depthwiseConstraint=c.getConstraint(e.depthwiseConstraint),n.depthwiseRegularizer=h.getRegularizer(e.depthwiseRegularizer),n}return i(e,t),e.prototype.build=function(t){if((t=m.getExactlyOneShape(t)).length&lt;4)throw new f.ValueError(&quot;Inputs to DepthwiseConv2D should have rank 4. Received input shape: &quot;+JSON.stringify(t)+&quot;.&quot;);var e=&quot;channelsFirst&quot;===this.dataFormat?1:3;if(null==t[e]||t[e]&lt;0)throw new f.ValueError(&quot;The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not (&quot;+t[e]+&quot;).&quot;);var n=t[e],r=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight(&quot;depthwise_kernel&quot;,r,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight(&quot;bias&quot;,[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){var e=v(t=m.getExactlyOneTensor(t),n.depthwiseKernel.read(),n.strides,n.padding,n.dataFormat,null);return n.useBias&amp;&amp;(e=u.biasAdd(e,n.bias.read(),n.dataFormat)),null!=n.activation&amp;&amp;(e=n.activation.apply(e)),e})},e.prototype.computeOutputShape=function(t){t=m.getExactlyOneShape(t);var e=&quot;channelsFirst&quot;===this.dataFormat?t[2]:t[1],n=&quot;channelsFirst&quot;===this.dataFormat?t[3]:t[2],r=&quot;channelsFirst&quot;===this.dataFormat?t[1]*this.depthMultiplier:t[3]*this.depthMultiplier,i=d.convOutputLength(e,this.kernelSize[0],this.padding,this.strides[0]),o=d.convOutputLength(n,this.kernelSize[1],this.padding,this.strides[1]);return&quot;channelsFirst&quot;===this.dataFormat?[t[0],r,i,o]:[t[0],i,o,r]},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=p.serializeInitializer(this.depthwiseInitializer),e.depthwiseRegularizer=h.serializeRegularizer(this.depthwiseRegularizer),e.depthwiseConstraint=c.serializeConstraint(this.depthwiseRegularizer),e},e.className=&quot;DepthwiseConv2D&quot;,e}(g.BaseConv);n.DepthwiseConv2D=y,a.serialization.registerClass(y)},{&quot;../backend/common&quot;:245,&quot;../backend/tfjs_backend&quot;:247,&quot;../common&quot;:250,&quot;../constraints&quot;:251,&quot;../errors&quot;:259,&quot;../initializers&quot;:268,&quot;../regularizers&quot;:289,&quot;../utils/conv_utils&quot;:290,&quot;../utils/types_utils&quot;:295,&quot;./convolutional&quot;:272,&quot;@tensorflow/tfjs-core&quot;:138}],274:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;../activations&quot;),s=t(&quot;../backend/tfjs_backend&quot;),u=t(&quot;../constraints&quot;),l=t(&quot;../engine/topology&quot;),c=t(&quot;../errors&quot;),f=t(&quot;../initializers&quot;),p=t(&quot;../regularizers&quot;),h=t(&quot;../utils/generic_utils&quot;),d=t(&quot;../utils/math_utils&quot;),m=t(&quot;../utils/types_utils&quot;);var g=function(t){function e(e){var n=t.call(this,e)||this;if(n.rate=Math.max(Math.min(e.rate,1),0),n.noiseShape=e.noiseShape,n.seed=e.seed,null!=n.seed)throw new c.NotImplementedError(&quot;Non-default seed is not implemented in Dropout layer yet: &quot;+n.seed);return n.supportsMasking=!0,n}return i(e,t),e.prototype.getNoiseShape=function(t){if(null==this.noiseShape)return this.noiseShape;for(var e=t.shape,n=[],r=0;r&lt;this.noiseShape.length;++r)n.push(null==this.noiseShape[r]?e[r]:this.noiseShape[r]);return n},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){n.invokeCallHook(t,e);var r=m.getExactlyOneTensor(t);if(null!=n.noiseShape&amp;&amp;!o.util.arraysEqual(r.shape,n.noiseShape))throw new c.NotImplementedError(&quot;Non-default noise shape is not implemented in Dropout layer yet: &quot;+JSON.stringify(n.noiseShape));if(0&lt;n.rate&amp;&amp;n.rate&lt;1){var i=null!=e.training&amp;&amp;e.training,a=n.getNoiseShape(r);return s.inTrainPhase(function(){return s.dropout(r,n.rate,a,n.seed)},function(){return r},i)}return t})},e.prototype.getConfig=function(){var e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.prototype.dispose=function(){return t.prototype.dispose.call(this)},e.className=&quot;Dropout&quot;,e}(l.Layer);n.Dropout=g,o.serialization.registerClass(g);var v=function(t){function e(e){var n=t.call(this,e)||this;if(n.activation=null,n.useBias=!0,n.kernel=null,n.bias=null,n.DEFAULT_KERNEL_INITIALIZER=&quot;glorotNormal&quot;,n.DEFAULT_BIAS_INITIALIZER=&quot;zeros&quot;,null==e.batchInputShape&amp;&amp;null==e.inputShape&amp;&amp;null!=e.inputDim){var r=null;null!=e.batchSize&amp;&amp;(r=e.batchSize),n.batchInputShape=[r,e.inputDim]}return n.units=e.units,h.assertPositiveInteger(n.units,&quot;units&quot;),n.activation=a.getActivation(e.activation),null!=e.useBias&amp;&amp;(n.useBias=e.useBias),n.kernelInitializer=f.getInitializer(e.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.biasInitializer=f.getInitializer(e.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelConstraint=u.getConstraint(e.kernelConstraint),n.biasConstraint=u.getConstraint(e.biasConstraint),n.kernelRegularizer=p.getRegularizer(e.kernelRegularizer),n.biasRegularizer=p.getRegularizer(e.biasRegularizer),n.activityRegularizer=p.getRegularizer(e.activityRegularizer),n.supportsMasking=!0,n.inputSpec=[{minNDim:2}],n}return i(e,t),e.prototype.build=function(t){var e,n=(t=m.getExactlyOneShape(t))[t.length-1];null==this.kernel&amp;&amp;(this.kernel=this.addWeight(&quot;kernel&quot;,[n,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&amp;&amp;(this.bias=this.addWeight(&quot;bias&quot;,[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:(e={},e[-1]=n,e)}],this.built=!0},e.prototype.computeOutputShape=function(t){var e=(t=m.getExactlyOneShape(t)).slice();return e[e.length-1]=this.units,e},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){n.invokeCallHook(t,e);var r,i,o=m.getExactlyOneTensor(t),a=&quot;relu&quot;===(r=n.activation.getClassName())?&quot;relu&quot;:&quot;linear&quot;===r?&quot;linear&quot;:null;return null!=a?i=s.dot(o,n.kernel.read(),a,n.bias?n.bias.read():null):(i=s.dot(o,n.kernel.read()),null!=n.bias&amp;&amp;(i=s.biasAdd(i,n.bias.read())),null!=n.activation&amp;&amp;(i=n.activation.apply(i))),i})},e.prototype.getConfig=function(){var e={units:this.units,activation:a.serializeActivation(this.activation),useBias:this.useBias,kernelInitializer:f.serializeInitializer(this.kernelInitializer),biasInitializer:f.serializeInitializer(this.biasInitializer),kernelRegularizer:p.serializeRegularizer(this.kernelRegularizer),biasRegularizer:p.serializeRegularizer(this.biasRegularizer),activityRegularizer:p.serializeRegularizer(this.activityRegularizer),kernelConstraint:u.serializeConstraint(this.kernelConstraint),biasConstraint:u.serializeConstraint(this.biasConstraint)},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;Dense&quot;,e}(l.Layer);n.Dense=v,o.serialization.registerClass(v);var y=function(t){function e(e){var n=t.call(this,e||{})||this;return n.inputSpec=[{minNDim:3}],n}return i(e,t),e.prototype.computeOutputShape=function(t){for(var e=0,n=(t=m.getExactlyOneShape(t)).slice(1);e&lt;n.length;e++){if(null==n[e])throw new c.ValueError(&apos;The shape of the input to &quot;Flatten&quot; is not fully defined (got &apos;+t.slice(1)+&apos;). Make sure to pass a complete &quot;input_shape&quot; or &quot;batch_input_shape&quot; argument to the first layer in your model.&apos;)}return[t[0],d.arrayProd(t,1)]},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){return n.invokeCallHook(t,e),s.batchFlatten(m.getExactlyOneTensor(t))})},e.className=&quot;Flatten&quot;,e}(l.Layer);n.Flatten=y,o.serialization.registerClass(y);var b=function(t){function e(e){var n=t.call(this,e)||this;return n.supportsMasking=!0,n.activation=a.getActivation(e.activation),n}return i(e,t),e.prototype.call=function(t,e){var n=this;return o.tidy(function(){n.invokeCallHook(t,e);var r=m.getExactlyOneTensor(t);return n.activation.apply(r)})},e.prototype.getConfig=function(){var e={activation:a.serializeActivation(this.activation)},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;Activation&quot;,e}(l.Layer);n.Activation=b,o.serialization.registerClass(b);var _=function(t){function e(e){var n=t.call(this,e)||this;return n.n=e.n,n.inputSpec=[{ndim:2}],n}return i(e,t),e.prototype.computeOutputShape=function(t){return[t[0],this.n,t[1]]},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){return t=m.getExactlyOneTensor(t),s.repeat(t,n.n)})},e.prototype.getConfig=function(){var e={n:this.n},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;RepeatVector&quot;,e}(l.Layer);n.RepeatVector=_,o.serialization.registerClass(_);var w=function(t){function e(e){var n=t.call(this,e)||this;n.targetShape=e.targetShape;for(var r=0;r&lt;n.targetShape.length;++r)n.isUnknown(n.targetShape[r])&amp;&amp;(n.targetShape[r]=null);return n}return i(e,t),e.prototype.isUnknown=function(t){return t&lt;0||null==t},e.prototype.fixUnknownDimension=function(t,e){for(var n=&quot;Total size of new array must be unchanged.&quot;,r=e.slice(),i=1,o=null,a=0;a&lt;r.length;++a){var s=r[a];if(this.isUnknown(s)){if(null!==o)throw new c.ValueError(&quot;Can only specifiy one unknown dimension.&quot;);o=a}else i*=s}var u=d.arrayProd(t);if(null!==o){if(0===i||u%i!=0)throw new c.ValueError(n);r[o]=u/i}else if(u!==i)throw new c.ValueError(n);return r},e.prototype.computeOutputShape=function(t){for(var e=!1,n=0;n&lt;t.length;++n)if(this.isUnknown(t[n])){e=!0;break}return e?t.slice(0,1).concat(this.targetShape):t.slice(0,1).concat(this.fixUnknownDimension(t.slice(1),this.targetShape))},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){n.invokeCallHook(t,e);var r=m.getExactlyOneTensor(t),i=r.shape,o=i.slice(0,1).concat(n.fixUnknownDimension(i.slice(1),n.targetShape));return r.reshape(o)})},e.prototype.getConfig=function(){var e={targetShape:this.targetShape},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;Reshape&quot;,e}(l.Layer);n.Reshape=w,o.serialization.registerClass(w);var x=function(t){function e(e){var n=t.call(this,e)||this;if(null==e.dims)throw new Error(&quot;Required configuration field `dims` is missing during Permute constructor call.&quot;);if(!Array.isArray(e.dims))throw new Error(&quot;Permute constructor requires `dims` to be an Array, but received &quot;+e.dims+&quot; instead.&quot;);var r=d.range(1,e.dims.length+1);if(!o.util.arraysEqual(e.dims.slice().sort(),r))throw new Error(&quot;Invalid permutation `dims`: &quot;+JSON.stringify(e.dims)+&quot; `dims` must contain consecutive integers starting from 1.&quot;);return n.dims=e.dims,n.dimsIncludingBatch=[0].concat(n.dims),n.inputSpec=[new l.InputSpec({ndim:n.dims.length+1})],n}return i(e,t),e.prototype.computeOutputShape=function(t){var e=(t=m.getExactlyOneShape(t)).slice();return this.dims.forEach(function(n,r){e[r+1]=t[n]}),e},e.prototype.call=function(t,e){return o.transpose(m.getExactlyOneTensor(t),this.dimsIncludingBatch)},e.prototype.getConfig=function(){var e={dims:this.dims},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;Permute&quot;,e}(l.Layer);n.Permute=x,o.serialization.registerClass(x);var E=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;return n.supportsMasking=!0,n.maskValue=null!=e?null==e.maskValue?0:e.maskValue:0,n}return i(e,t),e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this),n={maskValue:this.maskValue};return Object.assign(n,e),n},e.prototype.computeMask=function(t,e){var n=m.getExactlyOneTensor(t);return o.any(o.notEqual(n,this.maskValue),-1)},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){n.invokeCallHook(t,e);var r=m.getExactlyOneTensor(t),i=o.any(o.notEqual(r,n.maskValue),-1,!0);return r.mul(i.asType(r.dtype))})},e.className=&quot;Masking&quot;,e}(l.Layer);n.Masking=E,o.serialization.registerClass(E)},{&quot;../activations&quot;:244,&quot;../backend/tfjs_backend&quot;:247,&quot;../constraints&quot;:251,&quot;../engine/topology&quot;:255,&quot;../errors&quot;:259,&quot;../initializers&quot;:268,&quot;../regularizers&quot;:289,&quot;../utils/generic_utils&quot;:291,&quot;../utils/math_utils&quot;:293,&quot;../utils/types_utils&quot;:295,&quot;@tensorflow/tfjs-core&quot;:138}],275:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;../backend/tfjs_backend&quot;),s=t(&quot;../constraints&quot;),u=t(&quot;../engine/topology&quot;),l=t(&quot;../errors&quot;),c=t(&quot;../initializers&quot;),f=t(&quot;../regularizers&quot;),p=t(&quot;../utils/generic_utils&quot;),h=t(&quot;../utils/types_utils&quot;),d=function(t){function e(e){var n=t.call(this,e)||this;if(n.embeddings=null,n.DEFAULT_EMBEDDINGS_INITIALIZER=&quot;randomUniform&quot;,null==e.batchInputShape&amp;&amp;null==e.inputShape){var r=null;null!=e.batchSize&amp;&amp;(r=e.batchSize),null==e.inputLength?n.batchInputShape=[r,null]:n.batchInputShape=[r].concat(p.toList(e.inputLength))}return n.inputDim=e.inputDim,p.assertPositiveInteger(n.inputDim,&quot;inputDim&quot;),n.outputDim=e.outputDim,p.assertPositiveInteger(n.outputDim,&quot;outputDim&quot;),n.embeddingsInitializer=c.getInitializer(e.embeddingsInitializer||n.DEFAULT_EMBEDDINGS_INITIALIZER),n.embeddingsRegularizer=f.getRegularizer(e.embeddingsRegularizer),n.activityRegularizer=f.getRegularizer(e.activityRegularizer),n.embeddingsConstraint=s.getConstraint(e.embeddingsConstraint),n.maskZero=e.maskZero,n.supportsMasking=e.maskZero,n.inputLength=e.inputLength,n}return i(e,t),e.prototype.build=function(t){this.embeddings=this.addWeight(&quot;embeddings&quot;,[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0},e.prototype.warnOnIncompatibleInputShape=function(t){},e.prototype.computeMask=function(t,e){var n=this;return o.tidy(function(){return n.maskZero?(t=h.getExactlyOneTensor(t),o.notEqual(t,o.zerosLike(t))):null})},e.prototype.computeOutputShape=function(t){if(t=h.getExactlyOneShape(t),null==this.inputLength)return t.concat([this.outputDim]);var e=p.toList(this.inputLength);if(e.length!==t.length-1)throw new l.ValueError(&apos;&quot;inputLength&quot; is &apos;+this.inputLength+&quot;, but received input shape has shape &quot;+t);for(var n=0,r=0;r&lt;e.length;++r){var i=e[r],o=t[r+1];if(null!=i&amp;&amp;null!=o&amp;&amp;i!==o)throw new l.ValueError(&apos;&quot;inputLength&quot; is &apos;+this.inputLength+&quot;, but received input shape has shape &quot;+t);null==i&amp;&amp;(e[n]=o),n++}return[t[0]].concat(e,[this.outputDim])},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){n.invokeCallHook(t,e);var r=h.getExactlyOneTensor(t);return&quot;int32&quot;!==r.dtype&amp;&amp;(r=a.cast(r,&quot;int32&quot;)),a.gather(n.embeddings.read(),r.as1D()).reshape(h.getExactlyOneShape(n.computeOutputShape(r.shape)))})},e.prototype.getConfig=function(){var e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:c.serializeInitializer(this.embeddingsInitializer),embeddingsRegularizer:f.serializeRegularizer(this.embeddingsRegularizer),activityRegularizer:f.serializeRegularizer(this.activityRegularizer),embeddingsConstraint:s.serializeConstraint(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;Embedding&quot;,e}(u.Layer);n.Embedding=d,o.serialization.registerClass(d)},{&quot;../backend/tfjs_backend&quot;:247,&quot;../constraints&quot;:251,&quot;../engine/topology&quot;:255,&quot;../errors&quot;:259,&quot;../initializers&quot;:268,&quot;../regularizers&quot;:289,&quot;../utils/generic_utils&quot;:291,&quot;../utils/types_utils&quot;:295,&quot;@tensorflow/tfjs-core&quot;:138}],276:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../backend/tfjs_backend&quot;),u=t(&quot;../engine/topology&quot;),l=t(&quot;../errors&quot;),c=t(&quot;../losses&quot;),f=t(&quot;../utils/generic_utils&quot;),p=t(&quot;../utils/math_utils&quot;),h=t(&quot;../utils/types_utils&quot;),d=function(t){function e(e){var n=t.call(this,e||{})||this;return n.supportsMasking=!0,n}return i(e,t),e.prototype.mergeFunction=function(t){throw new l.NotImplementedError},e.prototype.computeElementwiseOpOutputShape=function(t,e){if(null==t||null==e)return null;if(t.length&lt;e.length)return this.computeElementwiseOpOutputShape(e,t);if(0===e.length)return t;for(var n=t.slice(0,t.length-e.length),r=0;r&lt;e.length;++r){var i=t[t.length-e.length+r],o=e[r];if(null==i||null==o||i&lt;0||o&lt;0)n.push(null);else if(1===i)n.push(o);else if(1===o)n.push(i);else{if(i!==o)throw new l.ValueError(&quot;Operands could not be broadcast together with shapes &quot;+JSON.stringify(t)+&quot; &quot;+JSON.stringify(e));n.push(i)}}return n},e.prototype.build=function(t){if(Array.isArray(t)&amp;&amp;!Array.isArray(t[0])&amp;&amp;(t=[h.getExactlyOneShape(t)]),(t=t).length&lt;2)throw new l.ValueError(&quot;A merge layer should be called on an Array of at least 2 inputs. Got &quot;+t.length+&quot; input(s).&quot;);for(var e=[],n=0,r=t;n&lt;r.length;n++){null!=(a=r[n])&amp;&amp;null!==a[0]&amp;&amp;e.push(a[0])}if((e=f.unique(e)).length&gt;1)throw new l.ValueError(&quot;Can not merge tensors with different batch sizes. Got tensors with shapes: &quot;+JSON.stringify(t)+&quot;.&quot;);for(var i=null==t[0]?null:t[0].slice(1),o=1;o&lt;t.length;++o){var a=null==t[o]?null:t[o].slice(1);i=this.computeElementwiseOpOutputShape(i,a)}var s=t.map(function(t){return t.length});-1===t.indexOf(null)&amp;&amp;1===f.unique(s).length?this.reshapeRequired=!1:this.reshapeRequired=!0},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){if(t=t,n.reshapeRequired){var e=[],r=t.map(function(t){return t.rank});if(-1===r.indexOf(null)){for(var i=p.max(r),a=0,u=t;a&lt;u.length;a++){for(var l=(m=u[a]).rank,c=0;c&lt;i-l;++c)m=s.expandDims(m,1);e.push(m)}return n.mergeFunction(e)}for(var f=!1,h=0,d=t;h&lt;d.length;h++){var m;if(null==(l=(m=d[h]).rank)){var g=m.shape,v=g[0],y=g.slice(1).concat([v]),b=m.reshape([v].concat(p.arrayProd(g.slice(1))));b=(b=o.transpose(b,[1,0])).reshape(y),e.push(b),f=!0}else if(l&gt;1){var _=p.range(1,l).concat([0]);e.push(o.transpose(m,_)),f=!0}else e.push(m)}var w=n.mergeFunction(e),x=w.rank;if(f)if(null==x){var E=w.shape;y=[v=E[E.length-1]].concat(E.slice(0,E.length-1));w=o.transpose(w.reshape([-1,v]),[1,0]).reshape(y)}else if(x&gt;1){_=[x-1].concat(p.range(0,x-1));w=o.transpose(w,_)}return w}return n.mergeFunction(t)})},e.prototype.computeOutputShape=function(t){var e;e=null==(t=t)[0]?null:t[0].slice(1);for(var n=1;n&lt;t.length;++n){var r=null==t[n]?null:t[n].slice(1);e=this.computeElementwiseOpOutputShape(e,r)}for(var i=[],o=0,a=t;o&lt;a.length;o++){null!=(r=a[o])&amp;&amp;null!==r[0]&amp;&amp;i.push(r[0])}return e=1===(i=f.unique(i)).length?i.concat(e):[null].concat(e)},e.prototype.computeMask=function(t,e){return o.tidy(function(){if(null==e)return null;if(!Array.isArray(e))throw new l.ValueError(&quot;`mask` should be an Array&quot;);if(!Array.isArray(t))throw new l.ValueError(&quot;`inputs` should be an Array&quot;);if(e.length!==t.length)throw new l.ValueError(&quot;The Array &apos;inputs&apos; and &apos;mask&apos; are expected to have the same length, but have different lengths (&quot;+t.length+&quot; vs &quot;+e.length+&quot;)&quot;);if(e.every(function(t){return null==t}))return null;for(var n=(e=e.map(function(t){return null==t?t:o.expandDims(t,0)}))[0],r=1;r&lt;e.length-1;++r)n=o.logicalAnd(n,e[r]);return n})},e}(u.Layer);n.Merge=d;var m=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.mergeFunction=function(t){return a.tidy(function(){for(var e=t[0].clone(),n=1;n&lt;t.length;++n)e=o.add(e,t[n]);return e})},e.className=&quot;Add&quot;,e}(d);n.Add=m,a.serialization.registerClass(m),n.add=function(t){return Array.isArray(t)?new m({}).apply(t):new m(t)};var g=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.mergeFunction=function(t){return a.tidy(function(){for(var e=t[0].clone(),n=1;n&lt;t.length;++n)e=o.mul(e,t[n]);return e})},e.className=&quot;Multiply&quot;,e}(d);n.Multiply=g,a.serialization.registerClass(g),n.multiply=function(t){return Array.isArray(t)?new g({}).apply(t):new g(t)};var v=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.mergeFunction=function(t){return a.tidy(function(){for(var e=t[0].clone(),n=1;n&lt;t.length;++n)e=o.add(e,t[n]);return o.mul(1/t.length,e)})},e.className=&quot;Average&quot;,e}(d);n.Average=v,a.serialization.registerClass(v),n.average=function(t){return Array.isArray(t)?new v({}).apply(t):new v(t)};var y=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.mergeFunction=function(t){return a.tidy(function(){for(var e=t[0],n=1;n&lt;t.length;++n)e=o.maximum(e,t[n]);return e})},e.className=&quot;Maximum&quot;,e}(d);n.Maximum=y,a.serialization.registerClass(y),n.maximum=function(t){return Array.isArray(t)?new y({}).apply(t):new y(t)};var b=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.mergeFunction=function(t){return a.tidy(function(){for(var e=t[0],n=1;n&lt;t.length;++n)e=o.minimum(e,t[n]);return e})},e.className=&quot;Minimum&quot;,e}(d);n.Minimum=b,a.serialization.registerClass(b),n.minimum=function(t){return Array.isArray(t)?new b({}).apply(t):new b(t)};var _=function(t){function e(e){var n=t.call(this,e)||this;return n.DEFAULT_AXIS=-1,null==e&amp;&amp;(e={}),n.axis=null==e.axis?n.DEFAULT_AXIS:e.axis,n.supportsMasking=!0,n.reshapeRequired=!1,n}return i(e,t),e.prototype.build=function(t){if(!Array.isArray(t)||!Array.isArray(t[0])||1===t.length)throw new l.ValueError(&quot;A `Concatenate` layer should be called on a list of at least 2 inputs&quot;);for(var e=!0,n=0,r=t=t;n&lt;r.length;n++){if(null!=(p=r[n])){e=!1;break}}if(!e){for(var i=[],o=0;o&lt;t.length;++o){var s=t[o].slice();s.splice(this.axis,1);for(var u=!1,c=0,f=i;c&lt;f.length;c++){var p=f[c];if(a.util.arraysEqual(p,s)){u=!0;break}}u||i.push(s)}if(i.length&gt;1)throw new l.ValueError(&quot;A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: &quot;+JSON.stringify(t))}},e.prototype.mergeFunction=function(t){var e=this;return a.tidy(function(){return s.concatenate(t,e.axis)})},e.prototype.computeOutputShape=function(t){if(!Array.isArray(t)||!Array.isArray(t[0]))throw new l.ValueError(&quot;A `Concatenate` layer should be called on a list of inputs.&quot;);for(var e=t,n=e[0].slice(),r=this.axis&lt;0?n.length+this.axis:this.axis,i=0,o=e.slice(1);i&lt;o.length;i++){var a=o[i];if(null==n[r]||null==a[r]){n[r]=null;break}n[r]+=a[r]}return n},e.prototype.computeMask=function(t,e){var n=this;if(null==e)return null;if(!Array.isArray(e))throw new l.ValueError(&quot;`mask` should be an array for Concatenate&quot;);if(!Array.isArray(t))throw new l.ValueError(&quot;`inputs` should be an array for Concatenate&quot;);if(e.length!==t.length)throw new l.ValueError(&quot;Mismatch in the length of mask (&quot;+e.length+&quot;) and the legnth of inputs (&quot;+t.length+&quot;)&quot;);return o.tidy(function(){var r=!0;if(e.forEach(function(t){null==t||(r=!1)}),r)return null;for(var i=[],a=0;a&lt;t.length;++a)null==e[a]?i.push(o.onesLike(t[a]).asType(&quot;bool&quot;)):e[a].rank&lt;t[a].rank?i.push(o.expandDims(e[a],-1)):i.push(e[a]);var s=o.concat(i,n.axis);return o.all(s,-1,!1)})},e.prototype.getConfig=function(){var e={axis:this.axis},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;Concatenate&quot;,e}(d);function w(t,e){for(;t&lt;0;)t+=e;return t}n.Concatenate=_,a.serialization.registerClass(_),n.concatenate=function(t){return Array.isArray(t)?new _({}).apply(t):new _(t)};var x=function(t){function e(e){var n=t.call(this,e)||this;return n.axes=e.axes,n.normalize=null!=e.normalize&amp;&amp;e.normalize,n.supportsMasking=!0,n.reshapeRequired=!1,n}return i(e,t),e.prototype.build=function(t){o.util.assert(Array.isArray(t)&amp;&amp;2===t.length&amp;&amp;Array.isArray(t[0])&amp;&amp;Array.isArray(t[1]),function(){return&quot;A `Dot` layer should be called on a list of exactly 2 inputs.&quot;});var e=t[0],n=t[1];if(e.length&gt;3||n.length&gt;3)throw new l.NotImplementedError(&quot;Dot layer does not support tensors of 4D or higher rank yet.&quot;);var r=this.interpretAxes(e,n);if(e[r[0]]!==n[r[1]])throw new l.ValueError(&quot;Dimension incompatibility: &quot;+e[r[0]]+&quot; !== &quot;+n[r[1]])},e.prototype.mergeFunction=function(t){if(2!==t.length)throw new l.ValueError(&quot;A `Dot` layer must be called on exactly 2 inputs, but received &quot;+t.length+&quot; input(s).&quot;);var e,n=t[0],r=t[1];return e=Array.isArray(this.axes)?this.axes.map(function(e,n){return w(e,t[n].shape.length)}):[w(this.axes,n.shape.length),w(this.axes,r.shape.length)],this.normalize&amp;&amp;(n=c.l2Normalize(n,e[0]),r=c.l2Normalize(r,e[1])),function(t,e,n){if(t.shape.length&gt;3||e.shape.length&gt;3)throw new l.NotImplementedError(&quot;batchDot is not implemented for tensors of 4D or higher rank yet&quot;);if(o.util.assert(t.shape.length&gt;=2,function(){return&quot;batchDot requires the rank of x to be &gt;= 2, but got &quot;+t.shape.length}),o.util.assert(t.shape.length&gt;=2,function(){return&quot;batchDot requires the rank of y to be &gt;= 2, but got &quot;+e.shape.length}),&quot;number&quot;==typeof n&amp;&amp;(n=[n,n]),&quot;complex64&quot;===t.dtype||&quot;complex64&quot;===e.dtype)throw new l.NotImplementedError(&quot;batchDot is not implemented for complex64-type Tensors yet.&quot;);var r=t.shape.length,i=e.shape.length;null==n&amp;&amp;(n=[r-1,i-2]);var a=n;return o.tidy(function(){var n,o;if(r&gt;i){n=r-i;for(var s=[],u=0;u&lt;n;++u)s.push(1);e=e.reshape(e.shape.concat(s))}else if(i&gt;r){for(n=i-r,s=[],u=0;u&lt;n;++u)s.push(1);t=t.reshape(t.shape.concat(s))}else n=0;if(2===t.shape.length&amp;&amp;2===e.shape.length)o=a[0]===a[1]?t.mulStrict(e).sum(a[0]):t.transpose([1,0]).mulStrict(e).sum(a[1]);else{var l=a[0]!==t.shape.length-1,c=a[1]===e.shape.length-1;o=t.matMul(e,l,c)}if(n&gt;0){var f=void 0,p=[];for(u=f=r&gt;i?r+i-3:r-1;u&lt;f+n;++u)p.push(u);o=o.squeeze(p)}return 1===o.shape.length&amp;&amp;(o=o.expandDims(1)),o})}(n,r,e)},e.prototype.interpretAxes=function(t,e){return Array.isArray(this.axes)?this.axes:[w(this.axes,t.length),w(this.axes,e.length)]},e.prototype.computeOutputShape=function(t){o.util.assert(Array.isArray(t)&amp;&amp;2===t.length&amp;&amp;Array.isArray(t[0])&amp;&amp;Array.isArray(t[1]),function(){return&quot;A `Dot` layer should be called on a list of exactly 2 inputs.&quot;});var e=t[0].slice(),n=t[1].slice();if(e.length&gt;3||n.length&gt;3)throw new l.NotImplementedError(&quot;Dot layer does not support tensors of 4D or higher rank yet.&quot;);var r=this.interpretAxes(e,n);e.splice(r[0],1),n.splice(r[1],1),n.splice(0,1);var i=e.concat(n);return 1===i.length&amp;&amp;i.push(1),i},e.prototype.computeMask=function(t,e){return null},e.prototype.getConfig=function(){var e={axes:this.axes,normalize:this.normalize},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;Dot&quot;,e}(d);n.Dot=x,a.serialization.registerClass(x)},{&quot;../backend/tfjs_backend&quot;:247,&quot;../engine/topology&quot;:255,&quot;../errors&quot;:259,&quot;../losses&quot;:285,&quot;../utils/generic_utils&quot;:291,&quot;../utils/math_utils&quot;:293,&quot;../utils/types_utils&quot;:295,&quot;@tensorflow/tfjs-core&quot;:138}],277:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;../backend/tfjs_backend&quot;),s=t(&quot;../engine/topology&quot;),u=t(&quot;../utils/types_utils&quot;),l=function(t){function e(e){var n=t.call(this,e)||this;return n.supportsMasking=!0,n.stddev=e.stddev,n}return i(e,t),e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this),n={stddev:this.stddev};return Object.assign(n,e),n},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){n.invokeCallHook(t,e);var r=u.getExactlyOneTensor(t);return a.inTrainPhase(function(){return a.randomNormal(r.shape,0,n.stddev).add(r)},function(){return r},e.training||!1)})},e.className=&quot;GaussianNoise&quot;,e}(s.Layer);n.GaussianNoise=l,o.serialization.registerClass(l);var c=function(t){function e(e){var n=t.call(this,e)||this;return n.supportsMasking=!0,n.rate=e.rate,n}return i(e,t),e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this),n={rate:this.rate};return Object.assign(n,e),n},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){n.invokeCallHook(t,e);var r=u.getExactlyOneTensor(t);if(n.rate&gt;0&amp;&amp;n.rate&lt;1){return a.inTrainPhase(function(){var t=Math.sqrt(n.rate/(1-n.rate));return a.dot(r,a.randomNormal(r.shape,1,t))},function(){return r},e.training||!1)}return r})},e.className=&quot;GaussianDropout&quot;,e}(s.Layer);n.GaussianDropout=c,o.serialization.registerClass(c);var f=function(t){function e(e){var n=t.call(this,e)||this;return n.supportsMasking=!0,n.rate=e.rate,n.noiseShape=e.noiseShape,n}return i(e,t),e.prototype._getNoiseShape=function(t){return this.noiseShape||u.getExactlyOneTensor(t).shape},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this),n={rate:this.rate};return Object.assign(n,e),n},e.prototype.call=function(t,e){var n=this;return o.tidy(function(){if(n.rate&lt;1&amp;&amp;n.rate&gt;0){var r=n._getNoiseShape(t);return a.inTrainPhase(function(){var e=u.getExactlyOneTensor(t),i=-1.7580993408473766,s=o.greaterEqual(o.randomUniform(r),n.rate);s=a.cast(s,&quot;float32&quot;);var l=Math.pow((1-n.rate)*(1+n.rate*Math.pow(i,2)),-.5),c=-l*i*n.rate;return a.dot(e,s).add(s.add(-1).mul(i)).mul(l).add(c)},function(){return u.getExactlyOneTensor(t)},e.training||!1)}return t})},e.className=&quot;AlphaDropout&quot;,e}(s.Layer);n.AlphaDropout=f,o.serialization.registerClass(f)},{&quot;../backend/tfjs_backend&quot;:247,&quot;../engine/topology&quot;:255,&quot;../utils/types_utils&quot;:295,&quot;@tensorflow/tfjs-core&quot;:138}],278:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../constraints&quot;),u=t(&quot;../engine/topology&quot;),l=t(&quot;../errors&quot;),c=t(&quot;../initializers&quot;),f=t(&quot;../regularizers&quot;),p=t(&quot;../utils/generic_utils&quot;),h=t(&quot;../utils/math_utils&quot;),d=t(&quot;../utils/types_utils&quot;);function m(t,e,n,r,i,a){var s;if(void 0===a&amp;&amp;(a=.001),2===t.rank)s=o.batchNorm2d(t,e,n,r,i,a);else if(3===t.rank)s=o.batchNorm3d(t,e,n,r,i,a);else{if(4!==t.rank)throw new l.NotImplementedError(&quot;batchNormalization is not implemented for array of rank &quot;+t.rank+&quot; yet&quot;);s=o.batchNorm4d(t,e,n,r,i,a)}return s}function g(t,e,n,r,i){return void 0===i&amp;&amp;(i=.001),a.util.arraysEqual(r.slice().sort(),h.range(0,t.rank-1))?function(t,e,n,r,i){return void 0===i&amp;&amp;(i=.001),a.tidy(function(){var a=o.moments(t,r),s=a.mean,u=a.variance;return[m(t,s,u,n,e,i),s,u]})}(t,e,n,r,i):function(t,e,n,r,i){return void 0===i&amp;&amp;(i=.001),a.tidy(function(){for(var a=o.moments(t,r),s=a.mean,u=a.variance,l=[],c=0,f=h.range(0,t.rank);c&lt;f.length;c++){var p=f[c];-1!==r.indexOf(p)?l.push(1):l.push(t.shape[p])}var d=s.reshape(l),g=u.reshape(l),v=null==e?null:e.reshape(l),y=null==n?null:n.reshape(l);return[m(t,d,g,y,v,i),s,u]})}(t,e,n,r,i)}n.batchNormalization=m,n.normalizeBatchInTraining=g;var v=function(t){function e(e){var n=this;return null==e&amp;&amp;(e={}),(n=t.call(this,e)||this).supportsMasking=!0,n.axis=null==e.axis?-1:e.axis,n.momentum=null==e.momentum?.99:e.momentum,n.epsilon=null==e.epsilon?.001:e.epsilon,n.center=null==e.center||e.center,n.scale=null==e.scale||e.scale,n.betaInitializer=c.getInitializer(e.betaInitializer||&quot;zeros&quot;),n.gammaInitializer=c.getInitializer(e.gammaInitializer||&quot;ones&quot;),n.movingMeanInitializer=c.getInitializer(e.movingMeanInitializer||&quot;zeros&quot;),n.movingVarianceInitializer=c.getInitializer(e.movingVarianceInitializer||&quot;ones&quot;),n.betaConstraint=s.getConstraint(e.betaConstraint),n.gammaConstraint=s.getConstraint(e.gammaConstraint),n.betaRegularizer=f.getRegularizer(e.betaRegularizer),n.gammaRegularizer=f.getRegularizer(e.gammaRegularizer),n}return i(e,t),e.prototype.build=function(t){var e;t=d.getExactlyOneShape(t);var n=this.axis&gt;=0?this.axis:this.axis+t.length,r=t[n];if(null==r)throw new l.ValueError(&quot;Axis &quot;+n+&quot; of input tensor should have a defined dimension but the layer received an input with shape &quot;+JSON.stringify(t)+&quot;.&quot;);this.inputSpec=[new u.InputSpec({ndim:t.length,axes:(e={},e[n]=r,e)})];var i=[r];this.scale&amp;&amp;(this.gamma=this.addWeight(&quot;gamma&quot;,i,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&amp;&amp;(this.beta=this.addWeight(&quot;beta&quot;,i,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight(&quot;moving_mean&quot;,i,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight(&quot;moving_variance&quot;,i,null,this.movingVarianceInitializer,null,!1),this.built=!0},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){var r=null!=e.training&amp;&amp;e.training,i=d.getExactlyOneTensor(t),s=i.shape,u=s.length,l=h.range(0,u),c=n.axis&gt;=0?n.axis:n.axis+u;l.splice(c,1);var f=p.pyListRepeat(1,u);f[c]=s[c];var v=l.slice();v.sort();var y=!a.util.arraysEqual(v,h.range(0,u).slice(0,u-1));if(!r)return function(){if(y){var t=n.movingMean.read().reshape(f),e=n.movingVariance.read().reshape(f),r=n.center?n.beta.read().reshape(f):null,o=n.scale?n.gamma.read().reshape(f):null;return m(i,t,e,r,o,n.epsilon)}return m(i,n.movingMean.read(),n.movingVariance.read(),null==n.beta?null:n.beta.read(),null==n.gamma?null:n.gamma.read(),n.epsilon)}();var b=g(i,n.gamma.read(),n.beta.read(),l,n.epsilon),_=b[0],w=b[1],x=b[2],E=function(t,e,n){o.tidy(function(){var r=1-n,i=t.read(),o=i.sub(e).mul(r);t.write(i.sub(o))})};return E(n.movingMean,w,n.momentum),E(n.movingVariance,x,n.momentum),_})},e.prototype.getConfig=function(){var e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:c.serializeInitializer(this.betaInitializer),gammaInitializer:c.serializeInitializer(this.gammaInitializer),movingMeanInitializer:c.serializeInitializer(this.movingMeanInitializer),movingVarianceInitializer:c.serializeInitializer(this.movingVarianceInitializer),betaRegularizer:f.serializeRegularizer(this.betaRegularizer),gammaRegularizer:f.serializeRegularizer(this.gammaRegularizer),betaConstraint:s.serializeConstraint(this.betaConstraint),gammaConstraint:s.serializeConstraint(this.gammaConstraint)},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;BatchNormalization&quot;,e}(u.Layer);n.BatchNormalization=v,a.serialization.registerClass(v)},{&quot;../constraints&quot;:251,&quot;../engine/topology&quot;:255,&quot;../errors&quot;:259,&quot;../initializers&quot;:268,&quot;../regularizers&quot;:289,&quot;../utils/generic_utils&quot;:291,&quot;../utils/math_utils&quot;:293,&quot;../utils/types_utils&quot;:295,&quot;@tensorflow/tfjs-core&quot;:138}],279:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../backend/common&quot;),u=t(&quot;../engine/topology&quot;),l=t(&quot;../errors&quot;),c=t(&quot;../utils/types_utils&quot;);function f(t,e,n){return a.tidy(function(){if(4!==t.rank)throw new l.ValueError(&quot;temporalPadding expects input tensor to be 4-D, but received a &quot;+t.rank+&quot;-D tensor.&quot;);if(null==e&amp;&amp;(e=[[1,1],[1,1]]),2!==e.length||2!==e[0].length||2!==e[1].length)throw new l.ValueError(&quot;spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.&quot;);if(null==n&amp;&amp;(n=s.imageDataFormat()),&quot;channelsLast&quot;!==n&amp;&amp;&quot;channelsFirst&quot;!==n)throw new l.ValueError(&quot;Unknown data format: &quot;+n+&quot;. Supported data formats are &apos;channelsLast&apos; and &apos;channelsFirst.&quot;);var r;return r=&quot;channelsFirst&quot;===n?[[0,0],[0,0],e[0],e[1]]:[[0,0],e[0],e[1],[0,0]],o.pad(t,r)})}n.temporalPadding=function(t,e){return a.tidy(function(){if(3!==t.rank)throw new l.ValueError(&quot;temporalPadding expects input tensor to be 3-D, but received a &quot;+t.rank+&quot;-D tensor.&quot;);if(null==e&amp;&amp;(e=[1,1]),2!==e.length)throw new l.ValueError(&quot;temporalPadding expects input padding pattern to be a length-2 array, but received a length-&quot;+e.length+&quot; array.&quot;);var n=[[0,0],e,[0,0]];return o.pad(t,n)})},n.spatial2dPadding=f;var p=function(t){function e(e){var n=this;if(null==e&amp;&amp;(e={}),(n=t.call(this,e)||this).dataFormat=null==e.dataFormat?s.imageDataFormat():e.dataFormat,null==e.padding)n.padding=[[1,1],[1,1]];else if(&quot;number&quot;==typeof e.padding)n.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,2!==e.padding.length)throw new l.ValueError(&quot;ZeroPadding2D expects padding to be a length-2 array, but received a length-&quot;+e.padding.length+&quot; array.&quot;);var r=void 0,i=void 0;if(&quot;number&quot;==typeof e.padding[0])r=[e.padding[0],e.padding[0]],i=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,2!==e.padding[0].length)throw new l.ValueError(&quot;ZeroPadding2D expects height padding to be a length-2 array, but received a length-&quot;+e.padding[0].length+&quot; array.&quot;);if(r=e.padding[0],2!==e.padding[1].length)throw new l.ValueError(&quot;ZeroPadding2D expects width padding to be a length-2 array, but received a length-&quot;+e.padding[1].length+&quot; array.&quot;);i=e.padding[1]}n.padding=[r,i]}return n.inputSpec=[new u.InputSpec({ndim:4})],n}return i(e,t),e.prototype.computeOutputShape=function(t){var e,n;return t=c.getExactlyOneShape(t),&quot;channelsFirst&quot;===this.dataFormat?(e=null!=t[2]&amp;&amp;t[2]&gt;=0?t[2]+this.padding[0][0]+this.padding[0][1]:null,n=null!=t[3]&amp;&amp;t[3]&gt;=0?t[3]+this.padding[1][0]+this.padding[1][1]:null,[t[0],t[1],e,n]):(e=null!=t[1]&amp;&amp;t[1]&gt;=0?t[1]+this.padding[0][0]+this.padding[0][1]:null,n=null!=t[2]&amp;&amp;t[2]&gt;=0?t[2]+this.padding[1][0]+this.padding[1][1]:null,[t[0],e,n,t[3]])},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){return f(c.getExactlyOneTensor(t),n.padding,n.dataFormat)})},e.prototype.getConfig=function(){var e={padding:this.padding,dataFormat:this.dataFormat},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;ZeroPadding2D&quot;,e}(u.Layer);n.ZeroPadding2D=p,a.serialization.registerClass(p)},{&quot;../backend/common&quot;:245,&quot;../engine/topology&quot;:255,&quot;../errors&quot;:259,&quot;../utils/types_utils&quot;:295,&quot;@tensorflow/tfjs-core&quot;:138}],280:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../backend/common&quot;),u=t(&quot;../backend/tfjs_backend&quot;),l=t(&quot;../common&quot;),c=t(&quot;../engine/topology&quot;),f=t(&quot;../engine/topology&quot;),p=t(&quot;../errors&quot;),h=t(&quot;../utils/conv_utils&quot;),d=t(&quot;../utils/generic_utils&quot;),m=t(&quot;../utils/types_utils&quot;),g=t(&quot;./convolutional&quot;);function v(t,e,n,r,i,u){return a.tidy(function(){var a;l.checkDataFormat(i),l.checkPoolMode(u),l.checkPaddingMode(r),null==n&amp;&amp;(n=[1,1]),null==r&amp;&amp;(r=&quot;valid&quot;),null==i&amp;&amp;(i=s.imageDataFormat()),null==u&amp;&amp;(u=&quot;max&quot;),t=g.preprocessConv2DInput(t,i);var c=&quot;same&quot;===r?&quot;same&quot;:&quot;valid&quot;;return a=&quot;max&quot;===u?o.maxPool(t,e,n,c):o.avgPool(t,e,n,c),&quot;channelsFirst&quot;===i&amp;&amp;(a=o.transpose(a,[0,3,1,2])),a})}n.pool2d=v;var y=function(t){function e(e){var n=this;if(null==e.poolSize&amp;&amp;(e.poolSize=2),n=t.call(this,e)||this,&quot;number&quot;==typeof e.poolSize)n.poolSize=[e.poolSize];else{if(!Array.isArray(e.poolSize)||1!==e.poolSize.length||&quot;number&quot;!=typeof e.poolSize[0])throw new p.ValueError(&quot;poolSize for 1D convolutional layer must be a number or an Array of a single number, but received &quot;+JSON.stringify(e.poolSize));n.poolSize=e.poolSize}if(d.assertPositiveInteger(n.poolSize,&quot;poolSize&quot;),null==e.strides)n.strides=n.poolSize;else if(&quot;number&quot;==typeof e.strides)n.strides=[e.strides];else{if(!Array.isArray(e.strides)||1!==e.strides.length||&quot;number&quot;!=typeof e.strides[0])throw new p.ValueError(&quot;strides for 1D convolutional layer must be a number or an Array of a single number, but received &quot;+JSON.stringify(e.strides));n.strides=e.strides}return d.assertPositiveInteger(n.strides,&quot;strides&quot;),n.padding=null==e.padding?&quot;valid&quot;:e.padding,l.checkPaddingMode(n.padding),n.inputSpec=[new c.InputSpec({ndim:3})],n}return i(e,t),e.prototype.computeOutputShape=function(t){t=m.getExactlyOneShape(t);var e=h.convOutputLength(t[1],this.poolSize[0],this.padding,this.strides[0]);return[t[0],e,t[2]]},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){n.invokeCallHook(t,e),t=u.expandDims(m.getExactlyOneTensor(t),2);var r=n.poolingFunction(m.getExactlyOneTensor(t),[n.poolSize[0],1],[n.strides[0],1],n.padding,&quot;channelsLast&quot;);return o.squeeze(r,[2])})},e.prototype.getConfig=function(){var e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e}(f.Layer);n.Pooling1D=y;var b=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.poolingFunction=function(t,e,n,r,i){return l.checkDataFormat(i),l.checkPaddingMode(r),v(t,e,n,r,i,&quot;max&quot;)},e.className=&quot;MaxPooling1D&quot;,e}(y);n.MaxPooling1D=b,a.serialization.registerClass(b);var _=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.poolingFunction=function(t,e,n,r,i){return l.checkDataFormat(i),l.checkPaddingMode(r),v(t,e,n,r,i,&quot;avg&quot;)},e.className=&quot;AveragePooling1D&quot;,e}(y);n.AveragePooling1D=_,a.serialization.registerClass(_);var w=function(t){function e(e){var n=this;if(null==e.poolSize&amp;&amp;(e.poolSize=[2,2]),(n=t.call(this,e)||this).poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],null==e.strides)n.strides=n.poolSize;else if(Array.isArray(e.strides)){if(2!==e.strides.length)throw new p.ValueError(&quot;If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length &quot;+e.strides.length+&quot;.&quot;);n.strides=e.strides}else n.strides=[e.strides,e.strides];return d.assertPositiveInteger(n.poolSize,&quot;poolSize&quot;),d.assertPositiveInteger(n.strides,&quot;strides&quot;),n.padding=null==e.padding?&quot;valid&quot;:e.padding,n.dataFormat=null==e.dataFormat?&quot;channelsLast&quot;:e.dataFormat,l.checkDataFormat(n.dataFormat),l.checkPaddingMode(n.padding),n.inputSpec=[new c.InputSpec({ndim:4})],n}return i(e,t),e.prototype.computeOutputShape=function(t){t=m.getExactlyOneShape(t);var e=&quot;channelsFirst&quot;===this.dataFormat?t[2]:t[1],n=&quot;channelsFirst&quot;===this.dataFormat?t[3]:t[2];return e=h.convOutputLength(e,this.poolSize[0],this.padding,this.strides[0]),n=h.convOutputLength(n,this.poolSize[1],this.padding,this.strides[1]),&quot;channelsFirst&quot;===this.dataFormat?[t[0],t[1],e,n]:[t[0],e,n,t[3]]},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){return n.invokeCallHook(t,e),n.poolingFunction(m.getExactlyOneTensor(t),n.poolSize,n.strides,n.padding,n.dataFormat)})},e.prototype.getConfig=function(){var e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e}(f.Layer);n.Pooling2D=w;var x=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.poolingFunction=function(t,e,n,r,i){return l.checkDataFormat(i),l.checkPaddingMode(r),v(t,e,n,r,i,&quot;max&quot;)},e.className=&quot;MaxPooling2D&quot;,e}(w);n.MaxPooling2D=x,a.serialization.registerClass(x);var E=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.poolingFunction=function(t,e,n,r,i){return l.checkDataFormat(i),l.checkPaddingMode(r),v(t,e,n,r,i,&quot;avg&quot;)},e.className=&quot;AveragePooling2D&quot;,e}(w);n.AveragePooling2D=E,a.serialization.registerClass(E);var k=function(t){function e(e){var n=t.call(this,e)||this;return n.inputSpec=[new c.InputSpec({ndim:3})],n}return i(e,t),e.prototype.computeOutputShape=function(t){return[t[0],t[2]]},e.prototype.call=function(t,e){throw new p.NotImplementedError},e}(f.Layer);n.GlobalPooling1D=k;var T=function(t){function e(e){return t.call(this,e||{})||this}return i(e,t),e.prototype.call=function(t,e){return a.tidy(function(){var e=m.getExactlyOneTensor(t);return o.mean(e,1)})},e.className=&quot;GlobalAveragePooling1D&quot;,e}(k);n.GlobalAveragePooling1D=T,a.serialization.registerClass(T);var N=function(t){function e(e){return t.call(this,e||{})||this}return i(e,t),e.prototype.call=function(t,e){return a.tidy(function(){var e=m.getExactlyOneTensor(t);return o.max(e,1)})},e.className=&quot;GlobalMaxPooling1D&quot;,e}(k);n.GlobalMaxPooling1D=N,a.serialization.registerClass(N);var S=function(t){function e(e){var n=t.call(this,e)||this;return n.dataFormat=null==e.dataFormat?&quot;channelsLast&quot;:e.dataFormat,l.checkDataFormat(n.dataFormat),n.inputSpec=[new c.InputSpec({ndim:4})],n}return i(e,t),e.prototype.computeOutputShape=function(t){return t=t,&quot;channelsLast&quot;===this.dataFormat?[t[0],t[3]]:[t[0],t[1]]},e.prototype.call=function(t,e){throw new p.NotImplementedError},e.prototype.getConfig=function(){var e={dataFormat:this.dataFormat},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e}(f.Layer);n.GlobalPooling2D=S;var C=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.call=function(t,e){var n=this;return a.tidy(function(){var e=m.getExactlyOneTensor(t);return&quot;channelsLast&quot;===n.dataFormat?o.mean(e,[1,2]):o.mean(e,[2,3])})},e.className=&quot;GlobalAveragePooling2D&quot;,e}(S);n.GlobalAveragePooling2D=C,a.serialization.registerClass(C);var A=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.call=function(t,e){var n=this;return a.tidy(function(){var e=m.getExactlyOneTensor(t);return&quot;channelsLast&quot;===n.dataFormat?o.max(e,[1,2]):o.max(e,[2,3])})},e.className=&quot;GlobalMaxPooling2D&quot;,e}(S);n.GlobalMaxPooling2D=A,a.serialization.registerClass(A)},{&quot;../backend/common&quot;:245,&quot;../backend/tfjs_backend&quot;:247,&quot;../common&quot;:250,&quot;../engine/topology&quot;:255,&quot;../errors&quot;:259,&quot;../utils/conv_utils&quot;:290,&quot;../utils/generic_utils&quot;:291,&quot;../utils/types_utils&quot;:295,&quot;./convolutional&quot;:272,&quot;@tensorflow/tfjs-core&quot;:138}],281:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../activations&quot;),u=t(&quot;../backend/tfjs_backend&quot;),l=t(&quot;../constraints&quot;),c=t(&quot;../engine/topology&quot;),f=t(&quot;../engine/topology&quot;),p=t(&quot;../errors&quot;),h=t(&quot;../initializers&quot;),d=t(&quot;../regularizers&quot;),m=t(&quot;../utils/generic_utils&quot;),g=t(&quot;../utils/math_utils&quot;),v=t(&quot;../utils/types_utils&quot;),y=t(&quot;../variables&quot;),b=t(&quot;./serialization&quot;);function _(t,e,n,r){if(Array.isArray(t)){if(null!=e||null!=n)throw new p.ValueError(&quot;When inputs is an array, neither initialState or constants should be provided&quot;);null!=r&amp;&amp;(n=t.slice(t.length-r,t.length),t=t.slice(0,t.length-r)),t.length&gt;1&amp;&amp;(e=t.slice(1,t.length)),t=t[0]}function i(t){return null==t||Array.isArray(t)?t:[t]}return{inputs:t,initialState:e=i(e),constants:n=i(n)}}function w(t,e,n,r,i,a,s,u){return void 0===r&amp;&amp;(r=!1),void 0===s&amp;&amp;(s=!1),void 0===u&amp;&amp;(u=!1),o.tidy(function(){var l=e.shape.length;if(l&lt;3)throw new p.ValueError(&quot;Input should be at least 3D, but is &quot;+l+&quot;D.&quot;);var c=[1,0].concat(g.range(2,l));if(e=o.transpose(e,c),null!=a)throw new p.NotImplementedError(&quot;The rnn() functoin of the deeplearn.js backend does not support constants yet.&quot;);s&amp;&amp;console.warn(&quot;Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend.&quot;),null!=i&amp;&amp;((i=i.asType(&quot;bool&quot;).asType(&quot;float32&quot;)).rank===l-1&amp;&amp;(i=o.expandDims(i,-1)),i=o.transpose(i,c)),r&amp;&amp;(e=o.reverse(e,0),null!=i&amp;&amp;(i=o.reverse(i,0)));var f,h,d=[],m=n,v=e.shape[0],y=o.unstack(e);null!=i&amp;&amp;(h=o.unstack(i));for(var b,_=function(e){var n=y[e],r=o.tidy(function(){return t(n,m)});if(null==i)f=r[0],m=r[1];else{var a=o.tidy(function(){var t=h[e],n=o.onesLike(t).sub(t);return{output:r[0].mul(t).addStrict(m[0].mul(n)),newStates:m.map(function(e,i){return r[1][i].mul(t).addStrict(e.mul(n))})}});f=a.output,m=a.newStates}u&amp;&amp;d.push(f)},w=0;w&lt;v;++w)_(w);if(u){b=o.stack(d,1)}return[f,b,m]})}n.standardizeArgs=_,n.rnn=w;var x=function(t){function e(e){var n,r=t.call(this,e)||this;if(null==e.cell)throw new p.ValueError(&quot;cell property is missing for the constructor of RNN.&quot;);if(null==(n=Array.isArray(e.cell)?new I({cells:e.cell}):e.cell).stateSize)throw new p.ValueError(&quot;The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).&quot;);return r.cell=n,r.returnSequences=null!=e.returnSequences&amp;&amp;e.returnSequences,r.returnState=null!=e.returnState&amp;&amp;e.returnState,r.goBackwards=null!=e.goBackwards&amp;&amp;e.goBackwards,r._stateful=null!=e.stateful&amp;&amp;e.stateful,r.unroll=null!=e.unroll&amp;&amp;e.unroll,r.supportsMasking=!0,r.inputSpec=[new c.InputSpec({ndim:3})],r.stateSpec=null,r.states_=null,r.numConstants=null,r.keptStates=[],r}return i(e,t),e.prototype.getStates=function(){if(null==this.states_){var t=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return g.range(0,t).map(function(t){return null})}return this.states_},e.prototype.setStates=function(t){this.states_=t},e.prototype.computeOutputShape=function(t){v.isArrayOfShapes(t)&amp;&amp;(t=t[0]),t=t;var e=this.cell.stateSize;Array.isArray(e)||(e=[e]);var n,r=e[0];if(n=this.returnSequences?[t[0],t[1],r]:[t[0],r],this.returnState){for(var i=[],o=0,a=e;o&lt;a.length;o++){var s=a[o];i.push([t[0],s])}return[n].concat(i)}return n},e.prototype.computeMask=function(t,e){var n=this;return o.tidy(function(){Array.isArray(e)&amp;&amp;(e=e[0]);var t=n.returnSequences?e:null;if(n.returnState){var r=n.states.map(function(t){return null});return[t].concat(r)}return t})},Object.defineProperty(e.prototype,&quot;states&quot;,{get:function(){if(null==this.states_){for(var t=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,e=[],n=0;n&lt;t;++n)e.push(null);return e}return this.states_},set:function(t){this.states_=t},enumerable:!0,configurable:!0}),e.prototype.build=function(t){if(null!=this.numConstants)throw new p.NotImplementedError(&quot;Constants support is not implemented in RNN yet.&quot;);v.isArrayOfShapes(t)&amp;&amp;(t=t[0]),t=t;var e=this.stateful?t[0]:null,n=t[t.length-1];this.inputSpec[0]=new c.InputSpec({shape:[e,null,n]});var r,i=[t[0]].concat(t.slice(2));if(this.cell.build(i),r=Array.isArray(this.cell.stateSize)?this.cell.stateSize:[this.cell.stateSize],null!=this.stateSpec){if(!a.util.arraysEqual(this.stateSpec.map(function(t){return t.shape[t.shape.length-1]}),r))throw new p.ValueError(&quot;An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=&quot;+this.stateSpec+&quot;; However cell.stateSize is &quot;+this.cell.stateSize)}else this.stateSpec=r.map(function(t){return new c.InputSpec({shape:[null,t]})});this.stateful&amp;&amp;this.resetStates()},e.prototype.resetStates=function(t,e){var n=this;void 0===e&amp;&amp;(e=!1),a.tidy(function(){if(!n.stateful)throw new p.AttributeError(&quot;Cannot call resetStates() on an RNN Layer that is not stateful.&quot;);var r=n.inputSpec[0].shape[0];if(null==r)throw new p.ValueError(&quot;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.&quot;);if(null==n.states_)Array.isArray(n.cell.stateSize)?n.states_=n.cell.stateSize.map(function(t){return o.zeros([r,t])}):n.states_=[o.zeros([r,n.cell.stateSize])];else if(null==t)o.dispose(n.states_),null!=n.keptStates&amp;&amp;(o.dispose(n.keptStates),n.keptStates=[]),Array.isArray(n.cell.stateSize)?n.states_=n.cell.stateSize.map(function(t){return o.zeros([r,t])}):n.states_[0]=o.zeros([r,n.cell.stateSize]);else{if(Array.isArray(t)||(t=[t]),t.length!==n.states_.length)throw new p.ValueError(&quot;Layer &quot;+n.name+&quot; expects &quot;+n.states_.length+&quot; state(s), but it received &quot;+t.length+&quot; state value(s). Input received: &quot;+t);!0===e?n.keptStates.push(n.states_.slice()):o.dispose(n.states_);for(var i=0;i&lt;n.states_.length;++i){var s=t[i],u=Array.isArray(n.cell.stateSize)?n.cell.stateSize[i]:n.cell.stateSize,l=[r,u];if(!a.util.arraysEqual(s.shape,l))throw new p.ValueError(&quot;State &quot;+i+&quot; is incompatible with layer &quot;+n.name+&quot;: expected shape=&quot;+l+&quot;, received shape=&quot;+s.shape);n.states_[i]=s}}n.states_.forEach(function(t){return o.keep(t)})})},e.prototype.apply=function(e,n){var r=null==n?null:n.initialState,i=null==n?null:n.constants;null==n&amp;&amp;(n={});var o=_(e,r,i,this.numConstants);e=o.inputs,r=o.initialState,i=o.constants;var a=[],s=[];if(null!=r){n.initialState=r,a=a.concat(r),this.stateSpec=[];for(var u=0,l=r;u&lt;l.length;u++){var f=l[u];this.stateSpec.push(new c.InputSpec({shape:f.shape}))}s=s.concat(this.stateSpec)}if(null!=i&amp;&amp;(n.constants=i,a=a.concat(i),this.numConstants=i.length),a[0]instanceof c.SymbolicTensor){var p=[e].concat(a),h=this.inputSpec.concat(s),d=this.inputSpec;this.inputSpec=h;var m=t.prototype.apply.call(this,p,n);return this.inputSpec=d,m}return t.prototype.apply.call(this,e,n)},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){var r=null==e?null:e.mask,i=null==e?null:e.training,o=null==e?null:e.initialState;t=v.getExactlyOneTensor(t),null==o&amp;&amp;(o=n.stateful?n.states_:n.getInitialState(t));var a=Array.isArray(n.cell.stateSize)?n.cell.stateSize.length:1;if(o.length!==a)throw new p.ValueError(&quot;RNN Layer has &quot;+a+&quot; state(s) but was passed &quot;+o.length+&quot; initial state(s).&quot;);n.unroll&amp;&amp;console.warn(&quot;Ignoring unroll = true for RNN layer, due to imperative backend.&quot;);var s={training:i},u=w(function(t,e){var r=n.cell.call([t].concat(e),s);return[r[0],r.slice(1)]},t,o,n.goBackwards,r,null,n.unroll,n.returnSequences),l=u[0],c=u[1],f=u[2];n.stateful&amp;&amp;n.resetStates(f,i);var h=n.returnSequences?c:l;return n.returnState?[h].concat(f):h})},e.prototype.getInitialState=function(t){var e=this;return a.tidy(function(){var n=o.zeros(t.shape);return n=o.sum(n,[1,2]),n=u.expandDims(n),Array.isArray(e.cell.stateSize)?e.cell.stateSize.map(function(t){return t&gt;1?u.tile(n,[1,t]):n}):e.cell.stateSize&gt;1?[u.tile(n,[1,e.cell.stateSize])]:[n]})},Object.defineProperty(e.prototype,&quot;trainableWeights&quot;,{get:function(){return this.trainable?this.cell.trainableWeights:[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;nonTrainableWeights&quot;,{get:function(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights},enumerable:!0,configurable:!0}),e.prototype.setFastWeightInitDuringBuild=function(e){t.prototype.setFastWeightInitDuringBuild.call(this,e),null!=this.cell&amp;&amp;this.cell.setFastWeightInitDuringBuild(e)},e.prototype.getConfig=function(){var e={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};null!=this.numConstants&amp;&amp;(e.numConstants=this.numConstants);var n=this.cell.getConfig();e.cell={className:this.cell.getClassName(),config:n};var r=t.prototype.getConfig.call(this);return Object.assign(e,r),e},e.className=&quot;RNN&quot;,e}(f.Layer);n.RNN=x,a.serialization.registerClass(x);var E=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e}(f.Layer);n.RNNCell=E;var k=function(t){function e(e){var n=t.call(this,e)||this;return n.DEFAULT_ACTIVATION=&quot;tanh&quot;,n.DEFAULT_KERNEL_INITIALIZER=&quot;glorotNormal&quot;,n.DEFAULT_RECURRENT_INITIALIZER=&quot;orthogonal&quot;,n.DEFAULT_BIAS_INITIALIZER=&quot;zeros&quot;,n.units=e.units,m.assertPositiveInteger(n.units,&quot;units&quot;),n.activation=s.getActivation(null==e.activation?n.DEFAULT_ACTIVATION:e.activation),n.useBias=null==e.useBias||e.useBias,n.kernelInitializer=h.getInitializer(e.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=h.getInitializer(e.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=h.getInitializer(e.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelRegularizer=d.getRegularizer(e.kernelRegularizer),n.recurrentRegularizer=d.getRegularizer(e.recurrentRegularizer),n.biasRegularizer=d.getRegularizer(e.biasRegularizer),n.kernelConstraint=l.getConstraint(e.kernelConstraint),n.recurrentConstraint=l.getConstraint(e.recurrentConstraint),n.biasConstraint=l.getConstraint(e.biasConstraint),n.dropout=g.min([1,g.max([0,null==e.dropout?0:e.dropout])]),n.recurrentDropout=g.min([1,g.max([0,null==e.recurrentDropout?0:e.recurrentDropout])]),n.stateSize=n.units,n.dropoutMask=null,n.recurrentDropoutMask=null,n}return i(e,t),e.prototype.build=function(t){t=v.getExactlyOneShape(t),this.kernel=this.addWeight(&quot;kernel&quot;,[t[t.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight(&quot;recurrent_kernel&quot;,[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight(&quot;bias&quot;,[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){if(2!==(t=t).length)throw new p.ValueError(&quot;SimpleRNNCell expects 2 input Tensors, got &quot;+t.length+&quot;.&quot;);var r=t[1];t=t[0];var i,a=null!=e.training&amp;&amp;e.training;0&lt;n.dropout&amp;&amp;n.dropout&lt;1&amp;&amp;null==n.dropoutMask&amp;&amp;(n.dropoutMask=O(function(){return o.onesLike(t)},n.dropout,a)),0&lt;n.recurrentDropout&amp;&amp;n.recurrentDropout&lt;1&amp;&amp;null==n.recurrentDropoutMask&amp;&amp;(n.recurrentDropoutMask=O(function(){return o.onesLike(r)},n.recurrentDropout,a));var s=n.dropoutMask,l=n.recurrentDropoutMask;i=null!=s?u.dot(o.mul(t,s),n.kernel.read()):u.dot(t,n.kernel.read()),null!=n.bias&amp;&amp;(i=u.biasAdd(i,n.bias.read())),null!=l&amp;&amp;(r=o.mul(r,l));var c=o.add(i,u.dot(r,n.recurrentKernel.read()));return null!=n.activation&amp;&amp;(c=n.activation.apply(c)),[c,c]})},e.prototype.getConfig=function(){var e={units:this.units,activation:s.serializeActivation(this.activation),useBias:this.useBias,kernelInitializer:h.serializeInitializer(this.kernelInitializer),recurrentInitializer:h.serializeInitializer(this.recurrentInitializer),biasInitializer:h.serializeInitializer(this.biasInitializer),kernelRegularizer:d.serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:d.serializeRegularizer(this.recurrentRegularizer),biasRegularizer:d.serializeRegularizer(this.biasRegularizer),activityRegularizer:d.serializeRegularizer(this.activityRegularizer),kernelConstraint:l.serializeConstraint(this.kernelConstraint),recurrentConstraint:l.serializeConstraint(this.recurrentConstraint),biasConstraint:l.serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;SimpleRNNCell&quot;,e}(E);n.SimpleRNNCell=k,a.serialization.registerClass(k);var T=function(t){function e(e){return e.cell=new k(e),t.call(this,e)||this}return i(e,t),e.prototype.call=function(e,n){var r=this;return a.tidy(function(){null!=r.cell.dropoutMask&amp;&amp;(o.dispose(r.cell.dropoutMask),r.cell.dropoutMask=null),null!=r.cell.recurrentDropoutMask&amp;&amp;(o.dispose(r.cell.recurrentDropoutMask),r.cell.recurrentDropoutMask=null);var i=null==n?null:n.mask,a=null==n?null:n.training,s=null==n?null:n.initialState;return t.prototype.call.call(r,e,{mask:i,training:a,initialState:s})})},Object.defineProperty(e.prototype,&quot;units&quot;,{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;activation&quot;,{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;useBias&quot;,{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;kernelInitializer&quot;,{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentInitializer&quot;,{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;biasInitializer&quot;,{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;kernelRegularizer&quot;,{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentRegularizer&quot;,{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;biasRegularizer&quot;,{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;kernelConstraint&quot;,{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentConstraint&quot;,{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;biasConstraint&quot;,{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;dropout&quot;,{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentDropout&quot;,{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),e.prototype.getConfig=function(){var e={units:this.units,activation:s.serializeActivation(this.activation),useBias:this.useBias,kernelInitializer:h.serializeInitializer(this.kernelInitializer),recurrentInitializer:h.serializeInitializer(this.recurrentInitializer),biasInitializer:h.serializeInitializer(this.biasInitializer),kernelRegularizer:d.serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:d.serializeRegularizer(this.recurrentRegularizer),biasRegularizer:d.serializeRegularizer(this.biasRegularizer),activityRegularizer:d.serializeRegularizer(this.activityRegularizer),kernelConstraint:l.serializeConstraint(this.kernelConstraint),recurrentConstraint:l.serializeConstraint(this.recurrentConstraint),biasConstraint:l.serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},n=t.prototype.getConfig.call(this);return delete n.cell,Object.assign(e,n),e},e.className=&quot;SimpleRNN&quot;,e}(x);n.SimpleRNN=T,a.serialization.registerClass(T);var N=function(t){function e(e){var n=t.call(this,e)||this;return n.DEFAULT_ACTIVATION=&quot;tanh&quot;,n.DEFAULT_RECURRENT_ACTIVATION=&quot;hardSigmoid&quot;,n.DEFAULT_KERNEL_INITIALIZER=&quot;glorotNormal&quot;,n.DEFAULT_RECURRENT_INITIALIZER=&quot;orthogonal&quot;,n.DEFAULT_BIAS_INITIALIZER=&quot;zeros&quot;,n.units=e.units,m.assertPositiveInteger(n.units,&quot;units&quot;),n.activation=s.getActivation(void 0===e.activation?n.DEFAULT_ACTIVATION:e.activation),n.recurrentActivation=s.getActivation(void 0===e.recurrentActivation?n.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),n.useBias=null==e.useBias||e.useBias,n.kernelInitializer=h.getInitializer(e.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=h.getInitializer(e.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=h.getInitializer(e.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelRegularizer=d.getRegularizer(e.kernelRegularizer),n.recurrentRegularizer=d.getRegularizer(e.recurrentRegularizer),n.biasRegularizer=d.getRegularizer(e.biasRegularizer),n.kernelConstraint=l.getConstraint(e.kernelConstraint),n.recurrentConstraint=l.getConstraint(e.recurrentConstraint),n.biasConstraint=l.getConstraint(e.biasConstraint),n.dropout=g.min([1,g.max([0,null==e.dropout?0:e.dropout])]),n.recurrentDropout=g.min([1,g.max([0,null==e.recurrentDropout?0:e.recurrentDropout])]),n.implementation=e.implementation,n.stateSize=n.units,n.dropoutMask=null,n.recurrentDropoutMask=null,n}return i(e,t),e.prototype.build=function(t){var e=(t=v.getExactlyOneShape(t))[t.length-1];this.kernel=this.addWeight(&quot;kernel&quot;,[e,3*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight(&quot;recurrent_kernel&quot;,[this.units,3*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight(&quot;bias&quot;,[3*this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){if(2!==(t=t).length)throw new p.ValueError(&quot;GRUCell expects 2 input Tensors (inputs, h, c), got &quot;+t.length+&quot;.&quot;);var r=null!=e.training&amp;&amp;e.training,i=t[1];t=t[0],0&lt;n.dropout&amp;&amp;n.dropout&lt;1&amp;&amp;null==n.dropoutMask&amp;&amp;(n.dropoutMask=O(function(){return o.onesLike(t)},n.dropout,r,3)),0&lt;n.recurrentDropout&amp;&amp;n.recurrentDropout&lt;1&amp;&amp;null==n.recurrentDropoutMask&amp;&amp;(n.recurrentDropoutMask=O(function(){return o.onesLike(i)},n.recurrentDropout,r,3));var a,s,l,c=n.dropoutMask,f=n.recurrentDropoutMask;0&lt;n.dropout&amp;&amp;n.dropout&lt;1&amp;&amp;(t=o.mul(t,c[0]));var h=u.dot(t,n.kernel.read());n.useBias&amp;&amp;(h=u.biasAdd(h,n.bias.read())),0&lt;n.recurrentDropout&amp;&amp;n.recurrentDropout&lt;1&amp;&amp;(i=o.mul(i,f[0]));var d=n.recurrentKernel.read(),m=o.split(d,[2*n.units,n.units],d.rank-1),g=m[0],v=m[1],y=u.dot(i,g),b=o.split(h,3,h.rank-1),_=b[0],w=b[1],x=b[2],E=o.split(y,2,y.rank-1),k=E[0],T=E[1];a=n.recurrentActivation.apply(o.add(_,k)),s=n.recurrentActivation.apply(o.add(w,T));var N=u.dot(o.mul(s,i),v);l=n.activation.apply(o.add(x,N));var S=o.add(o.mul(a,i),o.mul(o.add(1,o.neg(a)),l));return[S,S]})},e.prototype.getConfig=function(){var e={units:this.units,activation:s.serializeActivation(this.activation),recurrentActivation:s.serializeActivation(this.recurrentActivation),useBias:this.useBias,kernelInitializer:h.serializeInitializer(this.kernelInitializer),recurrentInitializer:h.serializeInitializer(this.recurrentInitializer),biasInitializer:h.serializeInitializer(this.biasInitializer),kernelRegularizer:d.serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:d.serializeRegularizer(this.recurrentRegularizer),biasRegularizer:d.serializeRegularizer(this.biasRegularizer),activityRegularizer:d.serializeRegularizer(this.activityRegularizer),kernelConstraint:l.serializeConstraint(this.kernelConstraint),recurrentConstraint:l.serializeConstraint(this.recurrentConstraint),biasConstraint:l.serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;GRUCell&quot;,e}(E);n.GRUCell=N,a.serialization.registerClass(N);var S=function(t){function e(e){return 0===e.implementation&amp;&amp;console.warn(&quot;`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call.&quot;),e.cell=new N(e),t.call(this,e)||this}return i(e,t),e.prototype.call=function(e,n){var r=this;return a.tidy(function(){null!=r.cell.dropoutMask&amp;&amp;(o.dispose(r.cell.dropoutMask),r.cell.dropoutMask=null),null!=r.cell.recurrentDropoutMask&amp;&amp;(o.dispose(r.cell.recurrentDropoutMask),r.cell.recurrentDropoutMask=null);var i=null==n?null:n.mask,a=null==n?null:n.training,s=null==n?null:n.initialState;return t.prototype.call.call(r,e,{mask:i,training:a,initialState:s})})},Object.defineProperty(e.prototype,&quot;units&quot;,{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;activation&quot;,{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentActivation&quot;,{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;useBias&quot;,{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;kernelInitializer&quot;,{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentInitializer&quot;,{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;biasInitializer&quot;,{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;kernelRegularizer&quot;,{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentRegularizer&quot;,{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;biasRegularizer&quot;,{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;kernelConstraint&quot;,{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentConstraint&quot;,{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;biasConstraint&quot;,{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;dropout&quot;,{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentDropout&quot;,{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;implementation&quot;,{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),e.prototype.getConfig=function(){var e={units:this.units,activation:s.serializeActivation(this.activation),recurrentActivation:s.serializeActivation(this.recurrentActivation),useBias:this.useBias,kernelInitializer:h.serializeInitializer(this.kernelInitializer),recurrentInitializer:h.serializeInitializer(this.recurrentInitializer),biasInitializer:h.serializeInitializer(this.biasInitializer),kernelRegularizer:d.serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:d.serializeRegularizer(this.recurrentRegularizer),biasRegularizer:d.serializeRegularizer(this.biasRegularizer),activityRegularizer:d.serializeRegularizer(this.activityRegularizer),kernelConstraint:l.serializeConstraint(this.kernelConstraint),recurrentConstraint:l.serializeConstraint(this.recurrentConstraint),biasConstraint:l.serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=t.prototype.getConfig.call(this);return delete n.cell,Object.assign(e,n),e},e.fromConfig=function(t,e){return 0===e.implmentation&amp;&amp;(e.implementation=1),new t(e)},e.className=&quot;GRU&quot;,e}(x);n.GRU=S,a.serialization.registerClass(S);var C=function(t){function e(e){var n=t.call(this,e)||this;return n.DEFAULT_ACTIVATION=&quot;tanh&quot;,n.DEFAULT_RECURRENT_ACTIVATION=&quot;hardSigmoid&quot;,n.DEFAULT_KERNEL_INITIALIZER=&quot;glorotNormal&quot;,n.DEFAULT_RECURRENT_INITIALIZER=&quot;orthogonal&quot;,n.DEFAULT_BIAS_INITIALIZER=&quot;zeros&quot;,n.units=e.units,m.assertPositiveInteger(n.units,&quot;units&quot;),n.activation=s.getActivation(void 0===e.activation?n.DEFAULT_ACTIVATION:e.activation),n.recurrentActivation=s.getActivation(void 0===e.recurrentActivation?n.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),n.useBias=null==e.useBias||e.useBias,n.kernelInitializer=h.getInitializer(e.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=h.getInitializer(e.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=h.getInitializer(e.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.unitForgetBias=e.unitForgetBias,n.kernelRegularizer=d.getRegularizer(e.kernelRegularizer),n.recurrentRegularizer=d.getRegularizer(e.recurrentRegularizer),n.biasRegularizer=d.getRegularizer(e.biasRegularizer),n.kernelConstraint=l.getConstraint(e.kernelConstraint),n.recurrentConstraint=l.getConstraint(e.recurrentConstraint),n.biasConstraint=l.getConstraint(e.biasConstraint),n.dropout=g.min([1,g.max([0,null==e.dropout?0:e.dropout])]),n.recurrentDropout=g.min([1,g.max([0,null==e.recurrentDropout?0:e.recurrentDropout])]),n.implementation=e.implementation,n.stateSize=[n.units,n.units],n.dropoutMask=null,n.recurrentDropoutMask=null,n}return i(e,t),e.prototype.build=function(t){var e,n,r=(t=v.getExactlyOneShape(t))[t.length-1];if(this.kernel=this.addWeight(&quot;kernel&quot;,[r,4*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight(&quot;recurrent_kernel&quot;,[this.units,4*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){if(this.unitForgetBias){var o=this.biasInitializer,a=this.units;n=new((e=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e.prototype.apply=function(t,e){var n=o.apply([a]),r=(new h.Ones).apply([a]),i=o.apply([2*a]);return u.concatAlongFirstAxis(u.concatAlongFirstAxis(n,r),i)},e}(h.Initializer)).className=&quot;CustomInit&quot;,e)}else n=this.biasInitializer;this.bias=this.addWeight(&quot;bias&quot;,[4*this.units],null,n,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){var r=null!=e.training&amp;&amp;e.training;if(3!==(t=t).length)throw new p.ValueError(&quot;LSTMCell expects 3 input Tensors (inputs, h, c), got &quot;+t.length+&quot;.&quot;);var i=t[1],a=t[2];t=t[0],0&lt;n.dropout&amp;&amp;n.dropout&lt;1&amp;&amp;null==n.dropoutMask&amp;&amp;(n.dropoutMask=O(function(){return o.onesLike(t)},n.dropout,r,4)),0&lt;n.recurrentDropout&amp;&amp;n.recurrentDropout&lt;1&amp;&amp;null==n.recurrentDropoutMask&amp;&amp;(n.recurrentDropoutMask=O(function(){return o.onesLike(i)},n.recurrentDropout,r,4));var s,l,c,f,h=n.dropoutMask,d=n.recurrentDropoutMask;0&lt;n.dropout&amp;&amp;n.dropout&lt;1&amp;&amp;(t=o.mul(t,h[0]));var m=u.dot(t,n.kernel.read());0&lt;n.recurrentDropout&amp;&amp;n.recurrentDropout&lt;1&amp;&amp;(i=o.mul(i,d[0])),m=o.add(m,u.dot(i,n.recurrentKernel.read())),n.useBias&amp;&amp;(m=u.biasAdd(m,n.bias.read()));var g=o.split(m,4,m.rank-1),v=g[0],y=g[1],b=g[2],_=g[3];s=n.recurrentActivation.apply(v),l=n.recurrentActivation.apply(y),c=o.add(o.mul(l,a),o.mul(s,n.activation.apply(b))),f=n.recurrentActivation.apply(_);var w=o.mul(f,n.activation.apply(c));return[w,w,c]})},e.prototype.getConfig=function(){var e={units:this.units,activation:s.serializeActivation(this.activation),recurrentActivation:s.serializeActivation(this.recurrentActivation),useBias:this.useBias,kernelInitializer:h.serializeInitializer(this.kernelInitializer),recurrentInitializer:h.serializeInitializer(this.recurrentInitializer),biasInitializer:h.serializeInitializer(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:d.serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:d.serializeRegularizer(this.recurrentRegularizer),biasRegularizer:d.serializeRegularizer(this.biasRegularizer),activityRegularizer:d.serializeRegularizer(this.activityRegularizer),kernelConstraint:l.serializeConstraint(this.kernelConstraint),recurrentConstraint:l.serializeConstraint(this.recurrentConstraint),biasConstraint:l.serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className=&quot;LSTMCell&quot;,e}(E);n.LSTMCell=C,a.serialization.registerClass(C);var A=function(t){function e(e){return 0===e.implementation&amp;&amp;console.warn(&quot;`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call.&quot;),e.cell=new C(e),t.call(this,e)||this}return i(e,t),e.prototype.call=function(e,n){var r=this;return a.tidy(function(){null!=r.cell.dropoutMask&amp;&amp;(o.dispose(r.cell.dropoutMask),r.cell.dropoutMask=null),null!=r.cell.recurrentDropoutMask&amp;&amp;(o.dispose(r.cell.recurrentDropoutMask),r.cell.recurrentDropoutMask=null);var i=null==n?null:n.mask,a=null==n?null:n.training,s=null==n?null:n.initialState;return t.prototype.call.call(r,e,{mask:i,training:a,initialState:s})})},Object.defineProperty(e.prototype,&quot;units&quot;,{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;activation&quot;,{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentActivation&quot;,{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;useBias&quot;,{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;kernelInitializer&quot;,{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentInitializer&quot;,{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;biasInitializer&quot;,{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;unitForgetBias&quot;,{get:function(){return this.cell.unitForgetBias},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;kernelRegularizer&quot;,{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentRegularizer&quot;,{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;biasRegularizer&quot;,{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;kernelConstraint&quot;,{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentConstraint&quot;,{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;biasConstraint&quot;,{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;dropout&quot;,{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;recurrentDropout&quot;,{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;implementation&quot;,{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),e.prototype.getConfig=function(){var e={units:this.units,activation:s.serializeActivation(this.activation),recurrentActivation:s.serializeActivation(this.recurrentActivation),useBias:this.useBias,kernelInitializer:h.serializeInitializer(this.kernelInitializer),recurrentInitializer:h.serializeInitializer(this.recurrentInitializer),biasInitializer:h.serializeInitializer(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:d.serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:d.serializeRegularizer(this.recurrentRegularizer),biasRegularizer:d.serializeRegularizer(this.biasRegularizer),activityRegularizer:d.serializeRegularizer(this.activityRegularizer),kernelConstraint:l.serializeConstraint(this.kernelConstraint),recurrentConstraint:l.serializeConstraint(this.recurrentConstraint),biasConstraint:l.serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=t.prototype.getConfig.call(this);return delete n.cell,Object.assign(e,n),e},e.fromConfig=function(t,e){return 0===e.implmentation&amp;&amp;(e.implementation=1),new t(e)},e.className=&quot;LSTM&quot;,e}(x);n.LSTM=A,a.serialization.registerClass(A);var I=function(t){function e(e){var n=t.call(this,e)||this;return n.cells=e.cells,n}return i(e,t),Object.defineProperty(e.prototype,&quot;stateSize&quot;,{get:function(){for(var t=[],e=0,n=this.cells.slice().reverse();e&lt;n.length;e++){var r=n[e];Array.isArray(r.stateSize)?t.push.apply(t,r.stateSize):t.push(r.stateSize)}return t},enumerable:!0,configurable:!0}),e.prototype.call=function(t,e){var n=this;return a.tidy(function(){for(var r=(t=t).slice(1),i=[],o=0,a=n.cells.slice().reverse();o&lt;a.length;o++){var s=a[o];Array.isArray(s.stateSize)?i.push(r.splice(0,s.stateSize.length)):i.push(r.splice(0,1))}i.reverse();for(var u,l=[],c=0;c&lt;n.cells.length;++c){s=n.cells[c];r=i[c],u=0===c?[t[0]].concat(r):[u[0]].concat(r),u=s.call(u,e),l.push(u.slice(1))}r=[];for(var f=0,p=l.slice().reverse();f&lt;p.length;f++){var h=p[f];r.push.apply(r,h)}return[u[0]].concat(r)})},e.prototype.build=function(t){var e;v.isArrayOfShapes(t)&amp;&amp;(t=t[0]),t=t;for(var n=0,r=this.cells;n&lt;r.length;n++){var i=r[n];i.build(t),e=Array.isArray(i.stateSize)?i.stateSize[0]:i.stateSize,t=[t[0],e]}this.built=!0},e.prototype.getConfig=function(){for(var e=[],n=0,r=this.cells;n&lt;r.length;n++){var i=r[n];e.push({className:this.getClassName(),config:i.getConfig()})}var o={cells:e},a=t.prototype.getConfig.call(this);return Object.assign(o,a),o},e.fromConfig=function(t,e,n){void 0===n&amp;&amp;(n={});for(var r=[],i=0,o=e.cells;i&lt;o.length;i++){var a=o[i];r.push(b.deserialize(a,n))}return new t({cells:r})},Object.defineProperty(e.prototype,&quot;trainableWeights&quot;,{get:function(){if(!this.trainable)return[];for(var t=[],e=0,n=this.cells;e&lt;n.length;e++){var r=n[e];t.push.apply(t,r.trainableWeights)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;nonTrainableWeights&quot;,{get:function(){for(var t=[],e=0,n=this.cells;e&lt;n.length;e++){var r=n[e];t.push.apply(t,r.nonTrainableWeights)}if(!this.trainable){for(var i=[],o=0,a=this.cells;o&lt;a.length;o++){r=a[o];i.push.apply(i,r.trainableWeights)}return i.concat(t)}return t},enumerable:!0,configurable:!0}),e.prototype.getWeights=function(){for(var t=[],e=0,n=this.cells;e&lt;n.length;e++){var r=n[e];t.push.apply(t,r.weights)}return y.batchGetValue(t)},e.prototype.setWeights=function(t){for(var e=[],n=0,r=this.cells;n&lt;r.length;n++)for(var i=r[n],o=i.weights.length,a=t.splice(o),s=0;s&lt;i.weights.length;++s)e.push([i.weights[s],a[s]]);y.batchSetValue(e)},e.className=&quot;StackedRNNCells&quot;,e}(E);function O(t,e,n,r){function i(){return u.dropout(t(),e)}if(void 0===n&amp;&amp;(n=null),void 0===r&amp;&amp;(r=1),r&gt;1){for(var a=[],s=0;s&lt;r;s++)a.push(u.inTrainPhase(i,t,n));return a.forEach(function(t){return o.keep(t)}),a}return o.keep(u.inTrainPhase(i,t,n))}n.StackedRNNCells=I,a.serialization.registerClass(I)},{&quot;../activations&quot;:244,&quot;../backend/tfjs_backend&quot;:247,&quot;../constraints&quot;:251,&quot;../engine/topology&quot;:255,&quot;../errors&quot;:259,&quot;../initializers&quot;:268,&quot;../regularizers&quot;:289,&quot;../utils/generic_utils&quot;:291,&quot;../utils/math_utils&quot;:293,&quot;../utils/types_utils&quot;:295,&quot;../variables&quot;:297,&quot;./serialization&quot;:282,&quot;@tensorflow/tfjs-core&quot;:138}],282:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;../utils/generic_utils&quot;);n.deserialize=function(t,e,n){return void 0===e&amp;&amp;(e={}),void 0===n&amp;&amp;(n=!1),i.deserializeKerasObject(t,r.serialization.SerializationMap.getMap().classNameMap,e,&quot;layer&quot;,n)}},{&quot;../utils/generic_utils&quot;:291,&quot;@tensorflow/tfjs-core&quot;:138}],283:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;../backend/tfjs_backend&quot;),u=t(&quot;../common&quot;),l=t(&quot;../engine/topology&quot;),c=t(&quot;../errors&quot;),f=t(&quot;../keras_format/common&quot;),p=t(&quot;../utils/generic_utils&quot;),h=t(&quot;../utils/types_utils&quot;),d=t(&quot;./recurrent&quot;),m=t(&quot;./serialization&quot;),g=function(t){function e(e){var n=t.call(this,e)||this;return n.layer=e.layer,n}return i(e,t),e.prototype.build=function(t){this.built=!0},Object.defineProperty(e.prototype,&quot;trainable&quot;,{get:function(){return null!=this.layer&amp;&amp;this.layer.trainable},set:function(t){null!=this.layer&amp;&amp;(this.layer.trainable=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;trainableWeights&quot;,{get:function(){return this.layer.trainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;nonTrainableWeights&quot;,{get:function(){return this.layer.nonTrainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;updates&quot;,{get:function(){return this.layer._updates},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;losses&quot;,{get:function(){return this.layer.losses},enumerable:!0,configurable:!0}),e.prototype.getWeights=function(){return this.layer.getWeights()},e.prototype.setWeights=function(t){this.layer.setWeights(t)},e.prototype.getConfig=function(){var e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.prototype.setFastWeightInitDuringBuild=function(e){t.prototype.setFastWeightInitDuringBuild.call(this,e),null!=this.layer&amp;&amp;this.layer.setFastWeightInitDuringBuild(e)},e.fromConfig=function(t,e,n){void 0===n&amp;&amp;(n={});var r=e.layer,i=m.deserialize(r,n);delete e.layer;var o={layer:i};return Object.assign(o,e),new t(o)},e}(l.Layer);n.Wrapper=g;var v=function(t){function e(e){var n=t.call(this,e)||this;return n.supportsMasking=!0,n}return i(e,t),e.prototype.build=function(e){if((e=h.getExactlyOneShape(e)).length&lt;3)throw new c.ValueError(&quot;TimeDistributed layer expects an input shape &gt;= 3D, but received input shape &quot;+JSON.stringify(e));this.inputSpec=[{shape:e}];var n=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(n),this.layer.built=!0),t.prototype.build.call(this,e)},e.prototype.computeOutputShape=function(t){var e=[(t=h.getExactlyOneShape(t))[0]].concat(t.slice(2)),n=this.layer.computeOutputShape(e),r=t[1];return[n[0],r].concat(n.slice(1))},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){t=h.getExactlyOneTensor(t);return d.rnn(function(t,r){return[h.getExactlyOneTensor(n.layer.call(t,e)),[]]},t,[],!1,null,null,!1,!0)[1]})},e.className=&quot;TimeDistributed&quot;,e}(g);function y(t){p.checkStringTypeUnionValue(f.VALID_BIDIRECTIONAL_MERGE_MODES,&quot;BidirectionalMergeMode&quot;,t)}n.TimeDistributed=v,a.serialization.registerClass(v),n.checkBidirectionalMergeMode=y;var b=&quot;concat&quot;,_=function(t){function e(e){var n=t.call(this,e)||this,r=e.layer.getConfig(),i={};i.className=e.layer.getClassName(),i.config=r,n.forwardLayer=m.deserialize(i),r.goBackwards=!0!==r.goBackwards;var o={};if(o.className=e.layer.getClassName(),o.config=r,n.backwardLayer=m.deserialize(o),n.forwardLayer.name=&quot;forward_&quot;+n.forwardLayer.name,n.backwardLayer.name=&quot;backward_&quot;+n.backwardLayer.name,n.mergeMode=void 0===e.mergeMode?b:e.mergeMode,y(n.mergeMode),e.weights)throw new c.NotImplementedError(&quot;weights support is not implemented for Bidirectional layer yet.&quot;);return n._stateful=e.layer.stateful,n.returnSequences=e.layer.returnSequences,n.returnState=e.layer.returnState,n.supportsMasking=!0,n._trainable=!0,n.inputSpec=e.layer.inputSpec,n.numConstants=null,n}return i(e,t),Object.defineProperty(e.prototype,&quot;trainable&quot;,{get:function(){return this._trainable},set:function(t){this._trainable=t,null!=this.forwardLayer&amp;&amp;(this.forwardLayer.trainable=t),null!=this.backwardLayer&amp;&amp;(this.backwardLayer.trainable=t)},enumerable:!0,configurable:!0}),e.prototype.getWeights=function(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())},e.prototype.setWeights=function(t){var e=t.length,n=Math.floor(e/2);this.forwardLayer.setWeights(t.slice(0,n)),this.backwardLayer.setWeights(t.slice(n))},e.prototype.computeOutputShape=function(t){var e,n,r,i=this.forwardLayer.computeOutputShape(t);return Array.isArray(i)&amp;&amp;Array.isArray(i[0])||(i=[i]),i=i,this.returnState?(r=i.slice(1),e=i[0]):e=i[0],e=e,&quot;concat&quot;===this.mergeMode?(e[e.length-1]*=2,n=[e]):n=null==this.mergeMode?[e,e.slice()]:[e],this.returnState?null==this.mergeMode?n.concat(r).concat(r.slice()):[e].concat(r).concat(r.slice()):p.singletonOrArray(n)},e.prototype.apply=function(e,n){var r=null==n?null:n.initialState,i=null==n?null:n.constants;null==n&amp;&amp;(n={});var o=d.standardizeArgs(e,r,i,this.numConstants);if(e=o.inputs,r=o.initialState,i=o.constants,Array.isArray(e)&amp;&amp;(r=e.slice(1),e=e[0]),(null==r||0===r.length)&amp;&amp;null==i)return t.prototype.apply.call(this,e,n);var a=[],s=[];if(null!=r){var u=r.length;if(u%2&gt;0)throw new c.ValueError(&quot;When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.&quot;);n.initialState=r,a.push.apply(a,r);var f=r.map(function(t){return new l.InputSpec({shape:t.shape})});this.forwardLayer.stateSpec=f.slice(0,u/2),this.backwardLayer.stateSpec=f.slice(u/2),s.push.apply(s,f)}if(null!=i)throw new c.NotImplementedError(&quot;Support for constants in Bidirectional layers is not implemented yet.&quot;);for(var p=a[0]instanceof l.SymbolicTensor,h=0,m=a;h&lt;m.length;h++){if(m[h]instanceof l.SymbolicTensor!==p)throw new c.ValueError(&quot;The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors&quot;)}if(p){var g=[e].concat(a),v=this.inputSpec.concat(s),y=this.inputSpec;this.inputSpec=v;var b=t.prototype.apply.call(this,g,n);return this.inputSpec=y,b}return t.prototype.apply.call(this,e,n)},e.prototype.call=function(t,e){var n=this;return a.tidy(function(){if(null!=e.mask)throw new c.NotImplementedError(&quot;The support for masking is not implemented for Bidirectional layers yet.&quot;);var r,i,a,u,l=e.initialState;if(null==l)r=n.forwardLayer.call(t,e),i=n.backwardLayer.call(t,e);else{var f=l.slice(0,l.length/2),p=l.slice(l.length/2);r=n.forwardLayer.call(t,Object.assign(e,{initialState:f})),i=n.backwardLayer.call(t,Object.assign(e,{initialState:p}))}return n.returnState&amp;&amp;(Array.isArray(r)&amp;&amp;(a=r.slice(1).concat(i.slice(1))),r=r[0],i=i[0]),n.returnSequences&amp;&amp;(i=o.reverse(i,1)),&quot;concat&quot;===n.mergeMode?u=s.concatenate([r,i]):&quot;sum&quot;===n.mergeMode?u=o.add(r,i):&quot;ave&quot;===n.mergeMode?u=o.mul(.5,o.add(r,i)):&quot;mul&quot;===n.mergeMode?u=o.mul(r,i):null==n.mergeMode&amp;&amp;(u=[r,i]),n.returnState?null==n.mergeMode?u.concat(a):[u].concat(a):u})},e.prototype.resetStates=function(t){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()},e.prototype.build=function(t){var e=this;u.nameScope(this.forwardLayer.name,function(){e.forwardLayer.build(t)}),u.nameScope(this.backwardLayer.name,function(){e.backwardLayer.build(t)}),this.built=!0},Object.defineProperty(e.prototype,&quot;trainableWeights&quot;,{get:function(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,&quot;nonTrainableWeights&quot;,{get:function(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)},enumerable:!0,configurable:!0}),e.prototype.setFastWeightInitDuringBuild=function(e){t.prototype.setFastWeightInitDuringBuild.call(this,e),null!=this.forwardLayer&amp;&amp;this.forwardLayer.setFastWeightInitDuringBuild(e),null!=this.backwardLayer&amp;&amp;this.backwardLayer.setFastWeightInitDuringBuild(e)},e.prototype.getConfig=function(){var e={mergeMode:this.mergeMode},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.fromConfig=function(t,e){var n=m.deserialize(e.layer);if(delete e.layer,null!=e.numConstants)throw new c.NotImplementedError(&quot;Deserialization of a Bidirectional layer with numConstants present is not supported yet.&quot;);var r=e;return r.layer=n,new t(r)},e.className=&quot;Bidirectional&quot;,e}(g);n.Bidirectional=_,a.serialization.registerClass(_)},{&quot;../backend/tfjs_backend&quot;:247,&quot;../common&quot;:250,&quot;../engine/topology&quot;:255,&quot;../errors&quot;:259,&quot;../keras_format/common&quot;:269,&quot;../utils/generic_utils&quot;:291,&quot;../utils/types_utils&quot;:295,&quot;./recurrent&quot;:281,&quot;./serialization&quot;:282,&quot;@tensorflow/tfjs-core&quot;:138}],284:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;);n.resolveScalarsInLogs=function(t){return r(this,void 0,void 0,function(){var e,n,r,a,s,u,l,c;return i(this,function(i){switch(i.label){case 0:if(null==t)return[2];for(a in e=[],n=[],r=[],t)&quot;number&quot;!=typeof(s=t[a])&amp;&amp;(u=s,e.push(u.data()),n.push(a),r.push(u));return[4,Promise.all(e)];case 1:for(l=i.sent(),c=0;c&lt;l.length;++c)t[n[c]]=l[c][0];return o.dispose(r),[2]}})})},n.disposeTensorsInLogs=function(t){if(null!=t)for(var e in t){var n=t[e];&quot;number&quot;!=typeof n&amp;&amp;n.dispose()}}},{&quot;@tensorflow/tfjs-core&quot;:138}],285:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;@tensorflow/tfjs-core&quot;),o=t(&quot;./backend/common&quot;),a=t(&quot;./backend/tfjs_backend&quot;),s=t(&quot;./errors&quot;);function u(t,e){return i.tidy(function(){var n=r.sum(a.square(t),e,!0),i=r.fill(n.shape,o.epsilon()),s=r.sqrt(r.maximum(n,i));return r.div(t,s)})}function l(t,e){return i.tidy(function(){return r.mean(a.square(r.sub(e,t)),-1)})}function c(t,e){return i.tidy(function(){return r.mean(r.abs(r.sub(e,t)),-1)})}function f(t,e){return i.tidy(function(){var n=r.sub(t,e),i=r.clipByValue(r.abs(t),o.epsilon(),Number.MAX_VALUE),a=r.abs(r.div(n,i));return r.mul(100,r.mean(a,-1))})}function p(t,e){return i.tidy(function(){var n=r.clipByValue(e,o.epsilon(),Number.MAX_VALUE),i=r.log(r.add(1,n)),s=r.clipByValue(t,o.epsilon(),Number.MAX_VALUE),u=r.log(r.add(1,s));return r.mean(a.square(r.sub(i,u)),-1)})}function h(t,e){return i.tidy(function(){var n=r.maximum(0,r.sub(1,r.mul(t,e)));return r.mean(a.square(n),-1)})}function d(t,e){return i.tidy(function(){var n=r.maximum(0,r.sub(1,r.mul(t,e)));return r.mean(n,-1)})}function m(t,e){return i.tidy(function(){var n=r.sum(r.mul(t,e),-1),i=r.max(r.mul(r.sub(1,t),e),-1);return r.maximum(0,r.add(1,r.sub(i,n)))})}function g(t,e){return i.tidy(function(){var n=Math.log(2),i=r.sub(e,t),o=r.sub(r.add(i,r.softplus(r.mul(-2,i))),n);return r.mean(o,-1)})}function v(t,e,n){return void 0===n&amp;&amp;(n=!1),i.tidy(function(){if(n)e=r.softmax(e);else{var i=r.sum(e,e.shape.length-1,!0);e=r.div(e,i)}return e=r.clipByValue(e,o.epsilon(),1-o.epsilon()),r.neg(r.sum(r.mul(t.toFloat(),r.log(e)),e.shape.length-1))})}function y(t,e){return i.tidy(function(){var n=r.floor(a.flatten(t)).toInt(),i=(e=r.clipByValue(e,o.epsilon(),1-o.epsilon())).shape;return v(r.oneHot(n,i[i.length-1]).reshape(i),e,!1)})}function b(t,e){if(!i.util.arraysEqual(t.shape,e.shape))throw new s.ValueError(&quot;logits and labels must have the same shape, but got shapes &quot;+JSON.stringify(t.shape)+&quot; and &quot;+JSON.stringify(e.shape));return i.tidy(function(){var n=e.relu(),r=e.abs().neg();return n.sub(e.mul(t)).add(r.exp().log1p())})}function _(t,e){return i.tidy(function(){var n;return n=r.clipByValue(e,o.epsilon(),1-o.epsilon()),n=r.log(r.div(n,r.sub(1,n))),r.mean(b(t,n),-1)})}function w(t,e){return i.tidy(function(){var n=r.clipByValue(t,o.epsilon(),1),i=r.clipByValue(e,o.epsilon(),1);return r.sum(r.mul(t,r.log(r.div(n,i))),-1)})}function x(t,e){return i.tidy(function(){var n=r.log(r.add(o.epsilon(),e));return r.mean(r.sub(e,r.mul(t,n)),-1)})}function E(t,e){return i.tidy(function(){var n=u(t,-1),i=u(e,-1),o=r.mul(n,i);return r.neg(r.sum(o,-1))})}n.l2Normalize=u,n.meanSquaredError=l,n.meanAbsoluteError=c,n.meanAbsolutePercentageError=f,n.meanSquaredLogarithmicError=p,n.squaredHinge=h,n.hinge=d,n.categoricalHinge=m,n.logcosh=g,n.categoricalCrossentropy=v,n.sparseCategoricalCrossentropy=y,n.sigmoidCrossEntropyWithLogits=b,n.binaryCrossentropy=_,n.kullbackLeiblerDivergence=w,n.poisson=x,n.cosineProximity=E,n.mse=l,n.MSE=l,n.mae=c,n.MAE=c,n.mape=f,n.MAPE=f,n.msle=p,n.MSLE=p,n.kld=w,n.KLD=w,n.cosine=E,n.get=function(t){var e={meanSquaredError:l,meanAbsoluteError:c,meanAbsolutePercentageError:f,meanSquaredLogarithmicError:p,squaredHinge:h,hinge:d,categoricalHinge:m,logcosh:g,categoricalCrossentropy:v,sparseCategoricalCrossentropy:y,binaryCrossentropy:_,kullbackLeiblerDivergence:w,poisson:x,cosineProximity:E};if(&quot;string&quot;==typeof t){if(t in e)return e[t];var n=&quot;Unknown loss &quot;+t;throw t.toLowerCase().includes(&quot;softmaxcrossentropy&quot;)&amp;&amp;(n=&quot;Unknown loss &quot;+t+&apos;. Use &quot;categoricalCrossentropy&quot; as the string name for tf.losses.softmaxCrossEntropy&apos;),new s.ValueError(n)}return t}},{&quot;./backend/common&quot;:245,&quot;./backend/tfjs_backend&quot;:247,&quot;./errors&quot;:259,&quot;@tensorflow/tfjs-core&quot;:138}],286:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;@tensorflow/tfjs-core&quot;),o=t(&quot;./backend/tfjs_backend&quot;),a=t(&quot;./errors&quot;),s=t(&quot;./losses&quot;),u=t(&quot;./losses&quot;);function l(t,e){return i.tidy(function(){var n=r.mul(.5,r.onesLike(e)),i=o.cast(r.greater(e,n),t.dtype);return r.mean(r.equal(t,i),-1)})}function c(t,e){return i.tidy(function(){return o.cast(r.equal(r.argMax(t,-1),r.argMax(e,-1)),&quot;float32&quot;)})}function f(t,e){return i.tidy(function(){return r.logicalAnd(t.equal(1),e.equal(1)).sum().cast(&quot;float32&quot;)})}function p(t,e){return i.tidy(function(){var n=f(t,e),o=function(t,e){return i.tidy(function(){return r.logicalAnd(t.equal(0),e.equal(1)).sum().cast(&quot;float32&quot;)})}(t,e),a=n.add(o);return r.where(r.greater(a,0),n.div(a),0).cast(&quot;float32&quot;)})}n.binaryAccuracy=l,n.categoricalAccuracy=c,n.precision=p,n.recall=function(t,e){return i.tidy(function(){var n=f(t,e),o=function(t,e){return i.tidy(function(){return r.logicalAnd(t.equal(1),e.equal(0)).sum().cast(&quot;float32&quot;)})}(t,e),a=n.add(o);return r.where(r.greater(a,0),n.div(a),0).cast(&quot;float32&quot;)})},n.binaryCrossentropy=function(t,e){return u.binaryCrossentropy(t,e)},n.sparseCategoricalAccuracy=function(t,e){return t.rank===e.rank&amp;&amp;(t=t.squeeze([t.rank-1])),(e=e.argMax(-1)).dtype!==t.dtype&amp;&amp;(e=e.asType(t.dtype)),r.equal(t,e).asType(&quot;float32&quot;)},n.topKCategoricalAccuracy=function(t,e){throw new a.NotImplementedError},n.sparseTopKCategoricalAccuracy=function(t,e){throw new a.NotImplementedError},n.mse=s.meanSquaredError,n.MSE=s.meanSquaredError,n.mae=s.meanAbsoluteError,n.MAE=s.meanAbsoluteError,n.mape=s.meanAbsolutePercentageError,n.MAPE=s.meanAbsolutePercentageError,n.categoricalCrossentropy=s.categoricalCrossentropy,n.cosine=s.cosineProximity,n.sparseCategoricalCrossentropy=s.sparseCategoricalCrossentropy,n.get=function(t){var e={binaryAccuracy:l,categoricalAccuracy:c,precision:p,categoricalCrossentropy:n.categoricalCrossentropy,sparseCategoricalCrossentropy:n.sparseCategoricalCrossentropy,mse:n.mse,MSE:n.MSE,mae:n.mae,MAE:n.MAE,mape:n.mape,MAPE:n.MAPE,cosine:n.cosine};if(&quot;string&quot;==typeof t&amp;&amp;t in e)return e[t];if(&quot;string&quot;!=typeof t&amp;&amp;null!=t)return t;throw new a.ValueError(&quot;Unknown metric &quot;+t)}},{&quot;./backend/tfjs_backend&quot;:247,&quot;./errors&quot;:259,&quot;./losses&quot;:285,&quot;@tensorflow/tfjs-core&quot;:138}],287:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&amp;&amp;this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},a=this&amp;&amp;this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&amp;i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},&quot;function&quot;==typeof Symbol&amp;&amp;(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError(&quot;Generator is already executing.&quot;);for(;a;)try{if(n=1,r&amp;&amp;(i=2&amp;o[0]?r.return:o[0]?r.throw||((i=r.return)&amp;&amp;i.call(r),0):r.next)&amp;&amp;!(i=i.call(r,o[1])).done)return i;switch(r=0,i&amp;&amp;(o=[2&amp;o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length&gt;0&amp;&amp;i[i.length-1])&amp;&amp;(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&amp;&amp;(!i||o[1]&gt;i[0]&amp;&amp;o[1]&lt;i[3])){a.label=o[1];break}if(6===o[0]&amp;&amp;a.label&lt;i[1]){a.label=i[1],i=o;break}if(i&amp;&amp;a.label&lt;i[2]){a.label=i[2],a.ops.push(o);break}i[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&amp;o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var s=t(&quot;@tensorflow/tfjs-core&quot;),u=t(&quot;./backend/state&quot;),l=t(&quot;./engine/input_layer&quot;),c=t(&quot;./engine/topology&quot;),f=t(&quot;./engine/training&quot;),p=t(&quot;./errors&quot;),h=t(&quot;./layers/serialization&quot;),d=t(&quot;./utils/generic_utils&quot;),m=t(&quot;./utils/serialization_utils&quot;),g=t(&quot;./utils/types_utils&quot;);function v(t,e,n){return o(this,void 0,void 0,function(){var r,i,o,u,l,c;return a(this,function(a){switch(a.label){case 0:if(null==n&amp;&amp;(n={}),null==t.load)throw new p.ValueError(&quot;Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.&quot;);return[4,t.load()];case 1:if(r=a.sent(),null!=(i=r.modelTopology).model_config&amp;&amp;(i=i.model_config),o=null==n.strict||n.strict,u=null!=r.weightData&amp;&amp;null!=r.weightSpecs&amp;&amp;o,l=h.deserialize(m.convertPythonicToTs(i),e,u),null!=r.weightData){if(null==r.weightSpecs)throw new p.ValueError(&quot;LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.&quot;);c=s.io.decodeWeights(r.weightData,r.weightSpecs),l.loadWeights(c,o),s.dispose(c)}return[2,l]}})})}n.modelFromJSON=function(t,e){return o(this,void 0,void 0,function(){var n,r,i,o,u,l,c,f;return a(this,function(a){switch(a.label){case 0:return&quot;modelTopology&quot;in t||(t={modelTopology:t}),null!=(n=(t=t).modelTopology).model_config&amp;&amp;(n=n.model_config),r=m.convertPythonicToTs(n),i=h.deserialize(r,e),null==t.weightsManifest?[3,2]:[4,s.io.loadWeights(t.weightsManifest,t.pathPrefix,i.weights.map(function(t){return t.originalName}))];case 1:for(o=a.sent(),u={},l=0,c=i.weights;l&lt;c.length;l++)f=c[l],u[f.originalName]=o[f.originalName];i.loadWeights(u),s.dispose(o),a.label=2;case 2:return[2,i]}})})},n.loadLayersModelInternal=function(t,e){return o(this,void 0,void 0,function(){var n;return a(this,function(r){if(null==e&amp;&amp;(e={}),&quot;string&quot;==typeof t){if(0===(n=s.io.getLoadHandlers(t)).length)n.push(s.io.browserHTTPRequest(t,e));else if(n.length&gt;1)throw new p.ValueError(&quot;Found more than one (&quot;+n.length+&quot;) load handlers for URL &apos;&quot;+t+&quot;&apos;&quot;);t=n[0]}return[2,v(t,void 0,e)]})})},n.loadLayersModelFromIOHandler=v;var y=function(t){function e(e){var n=t.call(this,{inputs:[],outputs:[]})||this;if(e=e||{},n.trainable=!0,n._updatable=!0,n.built=!1,n.name=null!=e.name?e.name:u.getUid(&quot;sequential_&quot;),null!=e.layers)for(var r=0,i=e.layers;r&lt;i.length;r++){var o=i[r];n.add(o)}return n}return i(e,t),e.prototype.checkShape=function(t){if(t.inboundNodes[0].outputTensors[0].shape.some(function(t){return t&lt;0}))throw new p.ValueError(&quot;Negative dimension size caused by adding layer &quot;+t.name+&quot; with input shape [&quot;+t.inboundNodes[0].inputTensors[0].shape+&quot;]&quot;)},e.prototype.add=function(t){var n,r=t instanceof e||t instanceof f.LayersModel;if(r){if(1!==(n=t).outputs.length)throw new p.ValueError(&quot;All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.&quot;);if(1!==n.inputs.length)throw new p.ValueError(&quot;All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.&quot;)}if(0===this.outputs.length){if(0===t.inboundNodes.length){if(null==t.batchInputShape)throw new p.ValueError(&quot;The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.&quot;);var i=l.Input({batchShape:t.batchInputShape,dtype:t.dtype,name:t.name+&quot;_input&quot;});t.apply(i)}if(r)this.outputs=n.outputs,this.inputs=n.inputs;else{if(1!==t.inboundNodes.length)throw new p.ValueError(&quot;A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer &quot;+t.name+&quot; which has &quot;+t.inboundNodes.length+&quot; pre-existing inbound connections.&quot;);if(1!==t.inboundNodes[0].outputTensors.length)throw new p.ValueError(&quot;All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.&quot;);this.checkShape(t),this.outputs=[t.inboundNodes[0].outputTensors[0]],this.inputs=c.getSourceInputs(this.outputs[0])}this.inboundNodes=[],new c.Node({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:d.pyListRepeat(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(function(t){return t.shape}),outputShapes:this.outputs[0].shape})}else{var o=t.apply(this.outputs[0]);if(Array.isArray(o))throw new TypeError(&quot;All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.&quot;);this.checkShape(t),this.outputs=[o],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(t),this.built=!1},e.prototype.pop=function(){if(0===this.layers.length)throw new TypeError(&quot;There are no layers in the model.&quot;);if(this.layers.pop(),0===this.layers.length)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{var t=this.layers.length-1;this.layers[t].outboundNodes=[],this.outputs=[this.layers[t].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}},e.prototype.call=function(t,e){return null==this.model&amp;&amp;this.build(),this.model.call(t,e)},e.prototype.build=function(t){if(g.getExactlyOneShape(t),0===this.inputs.length||0===this.outputs.length)throw new TypeError(&quot;Sequential model cannot be built: model is empty. Add some layers first.&quot;);this.model=new f.LayersModel({inputs:this.inputs,outputs:this.outputs[0],name:this.name+&quot;_model&quot;}),this.model.trainable=this.trainable,this.model.updatable=this.updatable,this.supportsMasking=this.model.supportsMasking,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},e.prototype.countParams=function(){return this.built||this.build(),t.prototype.countParams.call(this)},e.prototype.summary=function(e,n,r){void 0===r&amp;&amp;(r=console.log),this.built||this.build(),t.prototype.summary.call(this,e,n,r)},e.prototype.setWeights=function(t){null==this.model&amp;&amp;this.build(),this.model.setWeights(t)},Object.defineProperty(e.prototype,&quot;updatable&quot;,{get:function(){return this._updatable},set:function(t){this.built&amp;&amp;(this.model.updatable=t),this._updatable=t},enumerable:!0,configurable:!0}),e.prototype.evaluate=function(t,e,n){if(void 0===n&amp;&amp;(n={}),!this.built)throw new p.RuntimeError(&quot;The model needs to be compiled before being used.&quot;);return this.model.evaluate(t,e,n)},e.prototype.evaluateDataset=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(n){if(!this.built)throw new p.RuntimeError(&quot;The model needs to be compiled before being used.&quot;);return[2,this.model.evaluateDataset(t,e)]})})},e.prototype.predict=function(t,e){return void 0===e&amp;&amp;(e={}),null==this.model&amp;&amp;this.build(),this.model.predict(t,e)},e.prototype.predictOnBatch=function(t){return null==this.model&amp;&amp;this.build(),this.model.predictOnBatch(t)},e.prototype.compile=function(t){this.build(),this.model.compile(t),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(e.prototype,&quot;optimizer&quot;,{get:function(){return this.model.optimizer},set:function(t){this.model.optimizer=t},enumerable:!0,configurable:!0}),e.prototype.fit=function(t,e,n){return void 0===n&amp;&amp;(n={}),o(this,void 0,void 0,function(){return a(this,function(r){if(!this.built)throw new p.RuntimeError(&quot;The model needs to be compiled before being used.&quot;);return[2,this.model.fit(t,e,n)]})})},e.prototype.fitDataset=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(n){if(!this.built)throw new p.RuntimeError(&quot;The model needs to be compiled before being used.&quot;);return[2,this.model.fitDataset(t,e)]})})},e.prototype.trainOnBatch=function(t,e){return o(this,void 0,void 0,function(){return a(this,function(n){return[2,this.model.trainOnBatch(t,e)]})})},e.fromConfig=function(t,n,r,i){var o;void 0===r&amp;&amp;(r={}),void 0===i&amp;&amp;(i=!1);var a={};if(n instanceof Array){if(null==n[0].className||&quot;Merge&quot;===n[0].className)throw new p.ValueError(&quot;Legacy serialization format not supported yet.&quot;);o=n}else s.util.assert(null!=n.layers,function(){return&quot;When the config data for a Sequential model is not an Array, it must be an Object that contains the &apos;layers&apos; field.&quot;}),o=n.layers,delete n.layers,a=n;var u=new t(a);if(!(u instanceof e))throw new p.NotImplementedError(&quot;Sequential.fromConfig called on non-Sequential input: &quot;+u);for(var l=0,c=o;l&lt;c.length;l++){var f=c[l],d=h.deserialize(f,void 0,i);i&amp;&amp;d.setFastWeightInitDuringBuild(!0),u.add(d)}return u},Object.defineProperty(e.prototype,&quot;stopTraining&quot;,{get:function(){if(null==this.model)throw new p.ValueError(&quot;Cannot get the stopTraining property of a sequential model before it is compiled.&quot;);return this.model.stopTraining},set:function(t){if(null==this.model)throw new p.ValueError(&quot;Cannot set the stopTraining property of a sequential model before it is compiled.&quot;);this.model.stopTraining=t},enumerable:!0,configurable:!0}),e.prototype.getConfig=function(){for(var t=[],e=0,n=this.layers;e&lt;n.length;e++){var r=n[e],i={};i.className=r.getClassName(),i.config=r.getConfig(),t.push(i)}return t},e.className=&quot;Sequential&quot;,e}(f.LayersModel);n.Sequential=y,s.serialization.registerClass(y)},{&quot;./backend/state&quot;:246,&quot;./engine/input_layer&quot;:254,&quot;./engine/topology&quot;:255,&quot;./engine/training&quot;:256,&quot;./errors&quot;:259,&quot;./layers/serialization&quot;:282,&quot;./utils/generic_utils&quot;:291,&quot;./utils/serialization_utils&quot;:294,&quot;./utils/types_utils&quot;:295,&quot;@tensorflow/tfjs-core&quot;:138}],288:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;./backend/common&quot;),o=t(&quot;./errors&quot;);n.getOptimizer=function(t){var e={Adagrad:function(){return r.train.adagrad(.01)},Adadelta:function(){return r.train.adadelta(1,.95,i.epsilon())},Adam:function(){return r.train.adam(.001,.9,.999,i.epsilon())},Adamax:function(){return r.train.adamax(.002,.9,.999,i.epsilon(),0)},RMSProp:function(){return r.train.rmsprop(.001,.9,0,i.epsilon())},SGD:function(){return r.train.sgd(.01)}};if(e.adagrad=e.Adagrad,e.adadelta=e.Adadelta,e.adam=e.Adam,e.adamax=e.Adamax,e.rmsprop=e.RMSProp,e.sgd=e.SGD,t in e)return e[t]();throw new o.ValueError(&quot;Unknown Optimizer &quot;+t)}},{&quot;./backend/common&quot;:245,&quot;./errors&quot;:259,&quot;@tensorflow/tfjs-core&quot;:138}],289:[function(t,e,n){&quot;use strict&quot;;var r,i=this&amp;&amp;this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-core&quot;),s=t(&quot;./backend/tfjs_backend&quot;),u=t(&quot;./utils/generic_utils&quot;),l=function(t){function e(){return null!==t&amp;&amp;t.apply(this,arguments)||this}return i(e,t),e}(a.serialization.Serializable);n.Regularizer=l;var c=function(t){function e(e){var n=t.call(this)||this;return n.l1=null==e||null==e.l1?.01:e.l1,n.l2=null==e||null==e.l2?.01:e.l2,n.hasL1=0!==n.l1,n.hasL2=0!==n.l2,n}return i(e,t),e.prototype.apply=function(t){var e=this;return a.tidy(function(){var n=a.zeros([1]);return e.hasL1&amp;&amp;(n=a.add(n,a.sum(o.mul(e.l1,a.abs(t))))),e.hasL2&amp;&amp;(n=a.add(n,a.sum(o.mul(e.l2,s.square(t))))),n.asScalar()})},e.prototype.getConfig=function(){return{l1:this.l1,l2:this.l2}},e.fromConfig=function(t,e){return new t({l1:e.l1,l2:e.l2})},e.className=&quot;L1L2&quot;,e}(l);function f(t,e){return void 0===e&amp;&amp;(e={}),u.deserializeKerasObject(t,a.serialization.SerializationMap.getMap().classNameMap,e,&quot;regularizer&quot;)}n.L1L2=c,a.serialization.registerClass(c),n.l1=function(t){return new c({l1:null!=t?t.l1:null,l2:0})},n.l2=function(t){return new c({l2:null!=t?t.l2:null,l1:0})},n.REGULARIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP={l1l2:&quot;L1L2&quot;},n.serializeRegularizer=function(t){return u.serializeKerasObject(t)},n.deserializeRegularizer=f,n.getRegularizer=function(t){return null==t?null:&quot;string&quot;==typeof t?f({className:t in n.REGULARIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP?n.REGULARIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP[t]:t,config:{}}):t instanceof l?t:f(t)}},{&quot;./backend/tfjs_backend&quot;:247,&quot;./utils/generic_utils&quot;:291,&quot;@tensorflow/tfjs-core&quot;:138}],290:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../errors&quot;),i=t(&quot;./generic_utils&quot;),o=t(&quot;./math_utils&quot;);n.normalizeArray=function(t,e,n){if(&quot;number&quot;==typeof t)return i.pyListRepeat(t,e);if(t.length!==e)throw new r.ValueError(&quot;The &quot;+n+&quot; argument must be an integer or tuple of &quot;+e+&quot; integers. Received: &quot;+t.length+&quot; elements.&quot;);for(var a=0;a&lt;e;++a){var s=t[a];if(!o.isInteger(s))throw new r.ValueError(&quot;The &quot;+n+&quot; argument must be an integer or tuple of &quot;+e+&quot; integers. Received: &quot;+JSON.stringify(t)+&quot; including a non-integer number &quot;+s)}return t},n.convOutputLength=function(t,e,n,r,i){return void 0===i&amp;&amp;(i=1),null==t?t:(o=&quot;same&quot;===n?t:t-(e+(e-1)*(i-1))+1,Math.floor((o+r-1)/r));var o},n.deconvLength=function(t,e,n,i){if(null==t)return null;if(&quot;valid&quot;===i)t=t*e+o.max([n-e,0]);else{if(&quot;same&quot;!==i)throw new r.ValueError(&quot;Unsupport padding mode: &quot;+i+&quot;.&quot;);t*=e}return t}},{&quot;../errors&quot;:259,&quot;./generic_utils&quot;:291,&quot;./math_utils&quot;:293}],291:[function(t,e,n){&quot;use strict&quot;;var r=this&amp;&amp;this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n&lt;r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&amp;&amp;(t[i]=e[i]);return t}).apply(this,arguments)};Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var i=t(&quot;@tensorflow/tfjs-core&quot;),o=t(&quot;../errors&quot;);function a(t,e){if(!t)throw new o.AssertionError(e)}function s(t){return Array.isArray(t)?t:[t]}n.pyListRepeat=function(t,e){if(Array.isArray(t)){for(var n=[],r=0;r&lt;e;r++)n=n.concat(t);return n}return(n=new Array(e)).fill(t),n},n.assert=a,n.count=function(t,e){for(var n=0,r=0,i=t;r&lt;i.length;r++)i[r]===e&amp;&amp;n++;return n},n.singletonOrArray=function(t){return 1===t.length?t[0]:t},n.toList=s,n.objectListUid=function(t){for(var e=&quot;&quot;,n=0,r=s(t);n&lt;r.length;n++){var i=r[n];if(null==i.id)throw new o.ValueError(&quot;Object &quot;+i+&quot; passed to objectListUid without an id&quot;);&quot;&quot;!==e&amp;&amp;(e+=&quot;, &quot;),e+=Math.abs(i.id)}return e},n.toSnakeCase=function(t){var e=t.replace(/(.)([A-Z][a-z0-9]+)/g,&quot;$1_$2&quot;).replace(/([a-z])([A-Z])/g,&quot;$1_$2&quot;).toLowerCase();return&quot;_&quot;!==e[0]?e:&quot;private&quot;+e},n.toCamelCase=function(t){return t.length&lt;=1?t:-1===t.indexOf(&quot;_&quot;)?t:t.replace(/[_]+(\w|$)/g,function(t,e){return e.toUpperCase()})};var u={};function l(t,e){return t&lt;e?-1:t&gt;e?1:0}function c(t){return null===t?&quot;null&quot;:Array.isArray(t)?&quot;[&quot;+t.map(function(t){return c(t)}).join(&quot;,&quot;)+&quot;]&quot;:&quot;string&quot;==typeof t?&apos;&quot;&apos;+t+&apos;&quot;&apos;:&quot;&quot;+t}n.serializeKerasObject=function(t){if(null===t||void 0===t)return null;var e={};return e.className=t.getClassName(),e.config=t.getConfig(),e},n.deserializeKerasObject=function(t,e,n,i,a){var s,l,c;if(void 0===e&amp;&amp;(e={}),void 0===n&amp;&amp;(n={}),void 0===i&amp;&amp;(i=&quot;object&quot;),void 0===a&amp;&amp;(a=!1),&quot;string&quot;==typeof t){var f=t,p=void 0;if(f in n)p=n[f];else if(f in u)p=u[f];else if(null==(p=e[f]))throw new o.ValueError(&quot;Unknown &quot;+i+&quot;: &quot;+t+&quot;. This may be due to one of the following reasons:\n1. The &quot;+i+&quot; is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom &quot;+i+&quot; is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().&quot;);return p}var h=t;if(null==h.className||null==h.config)throw new o.ValueError(i+&quot;: Improper config format: &quot;+JSON.stringify(h)+&quot;.\n&apos;className&apos; and &apos;config&apos; must set.&quot;);var d=h.className,m=void 0,g=void 0;if(d in n?(m=(s=n[d])[0],g=s[1]):d in u?(m=(l=u.className)[0],g=l[1]):d in e&amp;&amp;(m=(c=e[d])[0],g=c[1]),null==m)throw new o.ValueError(&quot;Unknown &quot;+i+&quot;: &quot;+d+&quot;. This may be due to one of the following reasons:\n1. The &quot;+i+&quot; is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom &quot;+i+&quot; is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().&quot;);if(null!=g){for(var v={},y=0,b=Object.keys(u);y&lt;b.length;y++)v[T=b[y]]=u[T];for(var _=0,w=Object.keys(n);_&lt;w.length;_++)v[T=w[_]]=n[T];h.config.customObjects=v;for(var x=r({},u),E=0,k=Object.keys(n);E&lt;k.length;E++){var T=k[E];u[T]=n[T]}!function t(e){if(null!=e&amp;&amp;&quot;object&quot;==typeof e)if(Array.isArray(e))e.forEach(function(e){return t(e)});else for(var n=0,r=Object.keys(e);n&lt;r.length;n++){var i=r[n],o=e[i];null!=o&amp;&amp;&quot;object&quot;==typeof o&amp;&amp;(Array.isArray(o)||&quot;ndarray&quot;!==o.type||&quot;number&quot;!=typeof o.value?t(o):e[i]=o.value)}}(h.config);var N=g(m,h.config,n,a);return u=r({},x),N}x=r({},u);for(var S=0,C=Object.keys(n);S&lt;C.length;S++)T=C[S],u[T]=n[T];return N=new m(h.config),u=r({},x),N},n.numberCompare=l,n.reverseNumberCompare=function(t,e){return-1*l(t,e)},n.stringToDType=function(t){switch(t){case&quot;float32&quot;:return&quot;float32&quot;;default:throw new o.ValueError(&quot;Invalid dtype: &quot;+t)}},n.stringsEqual=function(t,e){if(null==t||null==e)return t===e;if(t.length!==e.length)return!1;for(var n=0;n&lt;t.length;++n)if(t[n]!==e[n])return!1;return!0},n.unique=function(t){if(null==t)return t;for(var e=[],n=0,r=t;n&lt;r.length;n++){var i=r[n];-1===e.indexOf(i)&amp;&amp;e.push(i)}return e},n.isObjectEmpty=function(t){if(null==t)throw new o.ValueError(&quot;Invalid value in obj: &quot;+JSON.stringify(t));for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},n.checkStringTypeUnionValue=function(t,e,n){if(null!=n&amp;&amp;t.indexOf(n)&lt;0)throw new o.ValueError(n+&quot; is not a valid &quot;+e+&quot;.  Valid values are &quot;+t+&quot; or null/undefined.&quot;)},n.checkArrayTypeAndLength=function(t,e,n,r){return void 0===n&amp;&amp;(n=0),void 0===r&amp;&amp;(r=1/0),a(n&gt;=0),a(r&gt;=n),Array.isArray(t)&amp;&amp;t.length&gt;=n&amp;&amp;t.length&lt;=r&amp;&amp;t.every(function(t){return typeof t===e})},n.assertPositiveInteger=function t(e,n){Array.isArray(e)?(i.util.assert(e.length&gt;0,function(){return n+&quot; is unexpectedly an empty array.&quot;}),e.forEach(function(e,r){return t(e,&quot;element &quot;+(r+1)+&quot; of &quot;+n)})):i.util.assert(Number.isInteger(e)&amp;&amp;e&gt;0,function(){return&quot;Expected &quot;+n+&quot; to be a positive integer, but got &quot;+c(e)+&quot;.&quot;})},n.formatAsFriendlyString=c},{&quot;../errors&quot;:259,&quot;@tensorflow/tfjs-core&quot;:138}],292:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;./variable_utils&quot;);function i(t,e,n){void 0===n&amp;&amp;(n=console.log);for(var r=&quot;&quot;,i=0;i&lt;t.length;++i)i&gt;0&amp;&amp;(r=r.slice(0,r.length-1)+&quot; &quot;),r=(r+=t[i]).slice(0,e[i]),r+=&quot; &quot;.repeat(e[i]-r.length);n(r)}function o(t,e,n){var r;try{r=JSON.stringify(t.outputShape)}catch(t){r=&quot;multiple&quot;}i([t.name+&quot; (&quot;+t.getClassName()+&quot;)&quot;,r,t.countParams().toString()],e,n)}function a(t,e,n,r){var o;try{o=JSON.stringify(t.outputShape)}catch(t){o=&quot;multiple&quot;}for(var a=[],s=0,u=t.inboundNodes;s&lt;u.length;s++){var l=u[s];if(!(null!=n&amp;&amp;n.length&gt;0&amp;&amp;-1===n.indexOf(l)))for(var c=0;c&lt;l.inboundLayers.length;++c){var f=l.inboundLayers[c].name,p=l.nodeIndices[c],h=l.tensorIndices[c];a.push(f+&quot;[&quot;+p+&quot;][&quot;+h+&quot;]&quot;)}}var d=t.name,m=t.getClassName(),g=0===a.length?&quot;&quot;:a[0];i([d+&quot; (&quot;+m+&quot;)&quot;,o,t.countParams().toString(),g],e,r);for(c=1;c&lt;a.length;++c)i([&quot;&quot;,&quot;&quot;,&quot;&quot;,a[c]],e,r)}n.printSummary=function(t,e,n,s){void 0===s&amp;&amp;(s=console.log);var u,l=function(t){var e=!0,n=[],r=[];for(var i in t.nodesByDepth)n.push(t.nodesByDepth[i]);for(var o=0,a=n;o&lt;a.length;o++){var s=a[o];if(s.length&gt;1||1===s.length&amp;&amp;s[0].inboundLayers.length&gt;1){e=!1;break}r.push.apply(r,s)}if(e)for(var u=0,l=t.layers;u&lt;l.length;u++){for(var c=l[u],f=!1,p=0,h=c.inboundNodes;p&lt;h.length;p++){var d=h[p];if(-1!==r.indexOf(d)){if(f){e=!1;break}f=!0}}if(!e)break}return e}(t),c=[&quot;Layer (type)&quot;,&quot;Output shape&quot;,&quot;Param #&quot;];if(l?(e=e||65,n=n||[.45,.85,1]):(e=e||98,n=n||[.33,.55,.67,1]),n[n.length-1]&lt;=1&amp;&amp;(n=n.map(function(t){return Math.floor(e*t)})),!l)for(var f in c.push(&quot;Receives inputs&quot;),u=[],t.nodesByDepth)u.push.apply(u,t.nodesByDepth[f]);s(&quot;_&quot;.repeat(e)),i(c,n,s),s(&quot;=&quot;.repeat(e));for(var p=t.layers,h=0;h&lt;p.length;++h)l?o(p[h],n,s):a(p[h],n,u,s),s((h===p.length-1?&quot;=&quot;:&quot;_&quot;).repeat(e));t.checkTrainableWeightsConsistency();var d=function(t){return null!=t.collectedTrainableWeights?r.countParamsInWeights(t.collectedTrainableWeights):r.countParamsInWeights(t.trainableWeights)}(t),m=r.countParamsInWeights(t.nonTrainableWeights);s(&quot;Total params: &quot;+(d+m)),s(&quot;Trainable params: &quot;+d),s(&quot;Non-trainable params: &quot;+m),s(&quot;_&quot;.repeat(e))}},{&quot;./variable_utils&quot;:296}],293:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;@tensorflow/tfjs-core&quot;),o=t(&quot;../errors&quot;);function a(t){return t=Array.isArray(t)?new Float32Array(t):t,i.tensor1d(t)}function s(t){return r.sum(a(t)).dataSync()[0]}function u(t){return s(t)/t.length}n.isInteger=function(t){return t===parseInt(t.toString(),10)},n.arrayProd=function(t,e,n){null==e&amp;&amp;(e=0),null==n&amp;&amp;(n=t.length);for(var r=1,i=e;i&lt;n;++i)r*=t[i];return r},n.min=function(t){return r.min(a(t)).dataSync()[0]},n.max=function(t){return r.max(a(t)).dataSync()[0]},n.sum=s,n.mean=u,n.variance=function(t){var e=r.sub(a(t),i.scalar(u(t)));return r.sum(r.mulStrict(e,e)).dataSync()[0]/t.length},n.median=function(t){var e=t.slice().sort(function(t,e){return t-e}),n=Math.floor((e.length-1)/2),r=Math.ceil((e.length-1)/2);return n===r?e[n]:(e[n]+e[r])/2},n.range=function(t,e){if(e&lt;t)throw new o.ValueError(&quot;end (&quot;+e+&quot;) &lt; begin (&quot;+t+&quot;) is forbidden.&quot;);for(var n=[],r=t;r&lt;e;++r)n.push(r);return n}},{&quot;../errors&quot;:259,&quot;@tensorflow/tfjs-core&quot;:138}],294:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../utils/generic_utils&quot;);function i(t,e,n){return(&quot;inboundNodes&quot;===t||&quot;outputLayers&quot;===t||&quot;inputLayers&quot;===t)&amp;&amp;0===e&amp;&amp;&quot;string&quot;==typeof n}n.convertPythonicToTs=function t(e,n){if(null===e)return null;if(&quot;string&quot;==typeof e)return r.toCamelCase(e);if(&quot;number&quot;==typeof e||&quot;boolean&quot;==typeof e)return e;if(e instanceof Array){for(var o=[],a=e.length,s=0;s&lt;a;++s){var u=e[s];i(n,s,u)?o.push(u):o.push(t(u,n))}return o}for(var l={},c=0,f=Object.keys(e);c&lt;f.length;c++){var p=f[c],h=e[p];if(&quot;name&quot;===p&amp;&amp;&quot;string&quot;==typeof h)l[p]=h;else{var d=r.toCamelCase(p);l[d]=t(h,d)}}return l},n.convertTsToPythonic=function t(e,n){if(null===e||void 0===e)return null;if(&quot;string&quot;==typeof e)return r.toSnakeCase(e);if(&quot;number&quot;==typeof e||&quot;boolean&quot;==typeof e)return e;if(e instanceof Array){for(var o=[],a=e.length,s=0;s&lt;a;++s){var u=e[s];i(n,s,u)?o.push(u):o.push(t(u,n))}return o}for(var l={},c=0,f=Object.keys(e);c&lt;f.length;c++){var p=f[c],h=e[p],d=r.toSnakeCase(p);l[d]=&quot;name&quot;!==p&amp;&amp;&quot;className&quot;!==p||&quot;string&quot;!=typeof h?t(h,p):h}return l}},{&quot;../utils/generic_utils&quot;:291}],295:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;../errors&quot;);n.isArrayOfShapes=function(t){return Array.isArray(t)&amp;&amp;Array.isArray(t[0])},n.normalizeShapeList=function(t){return 0===t.length?[]:Array.isArray(t[0])?t:[t]},n.getExactlyOneTensor=function(t){var e;if(Array.isArray(t)){if(1!==t.length)throw new r.ValueError(&quot;Expected Tensor length to be 1; got &quot;+t.length);e=t[0]}else e=t;return e},n.getExactlyOneShape=function(t){if(Array.isArray(t)&amp;&amp;Array.isArray(t[0])){if(1===t.length)return(t=t)[0];throw new r.ValueError(&quot;Expected exactly 1 Shape; got &quot;+t.length)}return t}},{&quot;../errors&quot;:259}],296:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),n.countParamsInWeights=function(t){for(var e=0,n=0,r=t;n&lt;r.length;n++){var i=r[n];0===i.shape.length?e+=1:e+=i.shape.reduce(function(t,e){return t*e})}return e}},{}],297:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;@tensorflow/tfjs-core&quot;),i=t(&quot;@tensorflow/tfjs-core&quot;),o=t(&quot;./backend/state&quot;),a=t(&quot;./common&quot;),s=t(&quot;./errors&quot;),u=&quot;Variable&quot;,l=function(){function t(t,e,n,i,s){void 0===e&amp;&amp;(e=&quot;float32&quot;),void 0===n&amp;&amp;(n=u),void 0===i&amp;&amp;(i=!0),void 0===s&amp;&amp;(s=null),this.dtype=null==e?&quot;float32&quot;:e,this.shape=t.shape,this.id=o.getNextUniqueTensorId(),n=null==n?u:n,this.originalName=a.getScopedTensorName(n),this.name=a.getUniqueTensorName(this.originalName),this.trainable_=i,this.constraint=s,this.val=r.variable(t,this.trainable_,this.name,this.dtype)}return t.prototype.read=function(){return this.assertNotDisposed(),this.val},t.prototype.write=function(t){return this.assertNotDisposed(),function(t,e){if(t.shape.toString()!==e.shape.toString())throw new Error(&quot;Shape mismatch: &quot;+JSON.stringify(t.shape)+&quot; vs. &quot;+JSON.stringify(e.shape))}(this.val,t),this.val.id!==t.id&amp;&amp;(this.val.assign(t),null!=this.constraint&amp;&amp;this.val.assign(this.constraint.apply(this.val))),this},t.prototype.dispose=function(){this.assertNotDisposed(),this.val.dispose()},t.prototype.assertNotDisposed=function(){if(this.val.isDisposed)throw new Error(&quot;LayersVariable &quot;+this.name+&quot; is already disposed.&quot;)},Object.defineProperty(t.prototype,&quot;trainable&quot;,{get:function(){return this.trainable_},set:function(t){this.trainable_=t,this.val.trainable=t},enumerable:!0,configurable:!0}),t}();n.LayerVariable=l,n.variable=function(t,e,n,r){return new l(t,e,n,!0,r)},n.zerosVariable=function(t,e,n){return new l(r.zeros(t),e,n)},n.zerosLike=function(t,e,n){return new l(r.zerosLike(t),e,n)},n.onesVariable=function(t,e,n){var i=r.ones(t);return new l(i,e,n)},n.onesLike=function(t,e,n){var i=r.onesLike(t);return new l(i,e,n)},n.eyeVariable=function(t,e,n){return new l(r.eye(t),e,n)},n.randomUniformVariable=function(t,e,n,i,o,a){return void 0===a&amp;&amp;(a=&quot;randomUniform&quot;),new l(r.randomUniform(t,e,n,i),i,a)},n.truncatedNormalVariable=function(t,e,n,i,o,a){if(void 0===e&amp;&amp;(e=0),void 0===n&amp;&amp;(n=1),void 0===a&amp;&amp;(a=&quot;truncatedNormal&quot;),&quot;float32&quot;!==(i=i||&quot;float32&quot;)&amp;&amp;&quot;int32&quot;!==i)throw new s.NotImplementedError(&quot;randomNormal does not support dType &quot;+i+&quot;.&quot;);return new l(r.truncatedNormal(t,e,n,i,o),i,a)},n.randomNormalVariable=function(t,e,n,i,o,a){if(void 0===e&amp;&amp;(e=0),void 0===n&amp;&amp;(n=1),void 0===a&amp;&amp;(a=&quot;randomNormal&quot;),&quot;float32&quot;!==(i=i||&quot;float32&quot;)&amp;&amp;&quot;int32&quot;!==i)throw new s.NotImplementedError(&quot;randomNormalVariable does not support dType &quot;+i+&quot;.&quot;);return new l(r.randomNormal(t,e,n,i,o),i,a)},n.update=function(t,e){return t.write(e)},n.updateAdd=function(t,e){return t.write(r.add(t.read(),e))},n.updateSub=function(t,e){return t.write(r.sub(t.read(),e))},n.batchGetValue=function(t){return t.map(function(t){return t.read()})},n.batchSetValue=function(t){t.forEach(function(t){t[0].write(t[1])})},n.gradients=function(t,e){var n=e.map(function(t){return t.read()}),r=i.variableGrads(t,n);return e.map(function(t){return r.grads[t.name]})}},{&quot;./backend/state&quot;:246,&quot;./common&quot;:250,&quot;./errors&quot;:259,&quot;@tensorflow/tfjs-core&quot;:138}],298:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});n.version=&quot;1.1.0&quot;},{}],299:[function(t,e,n){&quot;use strict&quot;;function r(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}Object.defineProperty(n,&quot;__esModule&quot;,{value:!0}),r(t(&quot;@tensorflow/tfjs-core&quot;)),r(t(&quot;@tensorflow/tfjs-layers&quot;)),r(t(&quot;@tensorflow/tfjs-converter&quot;));var i=t(&quot;@tensorflow/tfjs-data&quot;);n.data=i;var o=t(&quot;@tensorflow/tfjs-core&quot;),a=t(&quot;@tensorflow/tfjs-data&quot;),s=t(&quot;@tensorflow/tfjs-layers&quot;),u=t(&quot;@tensorflow/tfjs-converter&quot;),l=t(&quot;./version&quot;);n.version={&quot;tfjs-core&quot;:o.version_core,&quot;tfjs-data&quot;:a.version_data,&quot;tfjs-layers&quot;:s.version_layers,&quot;tfjs-converter&quot;:u.version_converter,tfjs:l.version}},{&quot;./version&quot;:300,&quot;@tensorflow/tfjs-converter&quot;:12,&quot;@tensorflow/tfjs-core&quot;:138,&quot;@tensorflow/tfjs-data&quot;:230,&quot;@tensorflow/tfjs-layers&quot;:267}],300:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48}],301:[function(t,e,n){&quot;use strict&quot;;n.byteLength=function(t){var e=l(t),n=e[0],r=e[1];return 3*(n+r)/4-r},n.toByteArray=function(t){for(var e,n=l(t),r=n[0],a=n[1],s=new o(function(t,e,n){return 3*(e+n)/4-n}(0,r,a)),u=0,c=a&gt;0?r-4:r,f=0;f&lt;c;f+=4)e=i[t.charCodeAt(f)]&lt;&lt;18|i[t.charCodeAt(f+1)]&lt;&lt;12|i[t.charCodeAt(f+2)]&lt;&lt;6|i[t.charCodeAt(f+3)],s[u++]=e&gt;&gt;16&amp;255,s[u++]=e&gt;&gt;8&amp;255,s[u++]=255&amp;e;2===a&amp;&amp;(e=i[t.charCodeAt(f)]&lt;&lt;2|i[t.charCodeAt(f+1)]&gt;&gt;4,s[u++]=255&amp;e);1===a&amp;&amp;(e=i[t.charCodeAt(f)]&lt;&lt;10|i[t.charCodeAt(f+1)]&lt;&lt;4|i[t.charCodeAt(f+2)]&gt;&gt;2,s[u++]=e&gt;&gt;8&amp;255,s[u++]=255&amp;e);return s},n.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=0,s=n-i;a&lt;s;a+=16383)o.push(c(t,a,a+16383&gt;s?s:a+16383));1===i?(e=t[n-1],o.push(r[e&gt;&gt;2]+r[e&lt;&lt;4&amp;63]+&quot;==&quot;)):2===i&amp;&amp;(e=(t[n-2]&lt;&lt;8)+t[n-1],o.push(r[e&gt;&gt;10]+r[e&gt;&gt;4&amp;63]+r[e&lt;&lt;2&amp;63]+&quot;=&quot;));return o.join(&quot;&quot;)};for(var r=[],i=[],o=&quot;undefined&quot;!=typeof Uint8Array?Uint8Array:Array,a=&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/&quot;,s=0,u=a.length;s&lt;u;++s)r[s]=a[s],i[a.charCodeAt(s)]=s;function l(t){var e=t.length;if(e%4&gt;0)throw new Error(&quot;Invalid string. Length must be a multiple of 4&quot;);var n=t.indexOf(&quot;=&quot;);return-1===n&amp;&amp;(n=e),[n,n===e?0:4-n%4]}function c(t,e,n){for(var i,o,a=[],s=e;s&lt;n;s+=3)i=(t[s]&lt;&lt;16&amp;16711680)+(t[s+1]&lt;&lt;8&amp;65280)+(255&amp;t[s+2]),a.push(r[(o=i)&gt;&gt;18&amp;63]+r[o&gt;&gt;12&amp;63]+r[o&gt;&gt;6&amp;63]+r[63&amp;o]);return a.join(&quot;&quot;)}i[&quot;-&quot;.charCodeAt(0)]=62,i[&quot;_&quot;.charCodeAt(0)]=63},{}],302:[function(t,e,n){},{}],303:[function(t,e,n){&quot;use strict&quot;;var r=t(&quot;base64-js&quot;),i=t(&quot;ieee754&quot;);n.Buffer=s,n.SlowBuffer=function(t){+t!=t&amp;&amp;(t=0);return s.alloc(+t)},n.INSPECT_MAX_BYTES=50;var o=2147483647;function a(t){if(t&gt;o)throw new RangeError(&apos;The value &quot;&apos;+t+&apos;&quot; is invalid for option &quot;size&quot;&apos;);var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,n){if(&quot;number&quot;==typeof t){if(&quot;string&quot;==typeof e)throw new TypeError(&apos;The &quot;string&quot; argument must be of type string. Received type number&apos;);return c(t)}return u(t,e,n)}function u(t,e,n){if(&quot;string&quot;==typeof t)return function(t,e){&quot;string&quot;==typeof e&amp;&amp;&quot;&quot;!==e||(e=&quot;utf8&quot;);if(!s.isEncoding(e))throw new TypeError(&quot;Unknown encoding: &quot;+e);var n=0|h(t,e),r=a(n),i=r.write(t,e);i!==n&amp;&amp;(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return f(t);if(null==t)throw TypeError(&quot;The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type &quot;+typeof t);if(B(t,ArrayBuffer)||t&amp;&amp;B(t.buffer,ArrayBuffer))return function(t,e,n){if(e&lt;0||t.byteLength&lt;e)throw new RangeError(&apos;&quot;offset&quot; is outside of buffer bounds&apos;);if(t.byteLength&lt;e+(n||0))throw new RangeError(&apos;&quot;length&quot; is outside of buffer bounds&apos;);var r;r=void 0===e&amp;&amp;void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n);return r.__proto__=s.prototype,r}(t,e,n);if(&quot;number&quot;==typeof t)throw new TypeError(&apos;The &quot;value&quot; argument must not be of type number. Received type number&apos;);var r=t.valueOf&amp;&amp;t.valueOf();if(null!=r&amp;&amp;r!==t)return s.from(r,e,n);var i=function(t){if(s.isBuffer(t)){var e=0|p(t.length),n=a(e);return 0===n.length?n:(t.copy(n,0,0,e),n)}if(void 0!==t.length)return&quot;number&quot;!=typeof t.length||j(t.length)?a(0):f(t);if(&quot;Buffer&quot;===t.type&amp;&amp;Array.isArray(t.data))return f(t.data)}(t);if(i)return i;if(&quot;undefined&quot;!=typeof Symbol&amp;&amp;null!=Symbol.toPrimitive&amp;&amp;&quot;function&quot;==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive](&quot;string&quot;),e,n);throw new TypeError(&quot;The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type &quot;+typeof t)}function l(t){if(&quot;number&quot;!=typeof t)throw new TypeError(&apos;&quot;size&quot; argument must be of type number&apos;);if(t&lt;0)throw new RangeError(&apos;The value &quot;&apos;+t+&apos;&quot; is invalid for option &quot;size&quot;&apos;)}function c(t){return l(t),a(t&lt;0?0:0|p(t))}function f(t){for(var e=t.length&lt;0?0:0|p(t.length),n=a(e),r=0;r&lt;e;r+=1)n[r]=255&amp;t[r];return n}function p(t){if(t&gt;=o)throw new RangeError(&quot;Attempt to allocate Buffer larger than maximum size: 0x&quot;+o.toString(16)+&quot; bytes&quot;);return 0|t}function h(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t,ArrayBuffer))return t.byteLength;if(&quot;string&quot;!=typeof t)throw new TypeError(&apos;The &quot;string&quot; argument must be one of type string, Buffer, or ArrayBuffer. Received type &apos;+typeof t);var n=t.length,r=arguments.length&gt;2&amp;&amp;!0===arguments[2];if(!r&amp;&amp;0===n)return 0;for(var i=!1;;)switch(e){case&quot;ascii&quot;:case&quot;latin1&quot;:case&quot;binary&quot;:return n;case&quot;utf8&quot;:case&quot;utf-8&quot;:return L(t).length;case&quot;ucs2&quot;:case&quot;ucs-2&quot;:case&quot;utf16le&quot;:case&quot;utf-16le&quot;:return 2*n;case&quot;hex&quot;:return n&gt;&gt;&gt;1;case&quot;base64&quot;:return F(t).length;default:if(i)return r?-1:L(t).length;e=(&quot;&quot;+e).toLowerCase(),i=!0}}function d(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if(&quot;string&quot;==typeof n?(r=n,n=0):n&gt;2147483647?n=2147483647:n&lt;-2147483648&amp;&amp;(n=-2147483648),j(n=+n)&amp;&amp;(n=i?0:t.length-1),n&lt;0&amp;&amp;(n=t.length+n),n&gt;=t.length){if(i)return-1;n=t.length-1}else if(n&lt;0){if(!i)return-1;n=0}if(&quot;string&quot;==typeof e&amp;&amp;(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:g(t,e,n,r,i);if(&quot;number&quot;==typeof e)return e&amp;=255,&quot;function&quot;==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):g(t,[e],n,r,i);throw new TypeError(&quot;val must be string, number or Buffer&quot;)}function g(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&amp;&amp;(&quot;ucs2&quot;===(r=String(r).toLowerCase())||&quot;ucs-2&quot;===r||&quot;utf16le&quot;===r||&quot;utf-16le&quot;===r)){if(t.length&lt;2||e.length&lt;2)return-1;a=2,s/=2,u/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=n;o&lt;s;o++)if(l(t,o)===l(e,-1===c?0:o-c)){if(-1===c&amp;&amp;(c=o),o-c+1===u)return c*a}else-1!==c&amp;&amp;(o-=o-c),c=-1}else for(n+u&gt;s&amp;&amp;(n=s-u),o=n;o&gt;=0;o--){for(var f=!0,p=0;p&lt;u;p++)if(l(t,o+p)!==l(e,p)){f=!1;break}if(f)return o}return-1}function v(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))&gt;i&amp;&amp;(r=i):r=i;var o=e.length;r&gt;o/2&amp;&amp;(r=o/2);for(var a=0;a&lt;r;++a){var s=parseInt(e.substr(2*a,2),16);if(j(s))return a;t[n+a]=s}return a}function y(t,e,n,r){return V(L(e,t.length-n),t,n,r)}function b(t,e,n,r){return V(function(t){for(var e=[],n=0;n&lt;t.length;++n)e.push(255&amp;t.charCodeAt(n));return e}(e),t,n,r)}function _(t,e,n,r){return b(t,e,n,r)}function w(t,e,n,r){return V(F(e),t,n,r)}function x(t,e,n,r){return V(function(t,e){for(var n,r,i,o=[],a=0;a&lt;t.length&amp;&amp;!((e-=2)&lt;0);++a)n=t.charCodeAt(a),r=n&gt;&gt;8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function E(t,e,n){return 0===e&amp;&amp;n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function k(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i&lt;n;){var o,a,s,u,l=t[i],c=null,f=l&gt;239?4:l&gt;223?3:l&gt;191?2:1;if(i+f&lt;=n)switch(f){case 1:l&lt;128&amp;&amp;(c=l);break;case 2:128==(192&amp;(o=t[i+1]))&amp;&amp;(u=(31&amp;l)&lt;&lt;6|63&amp;o)&gt;127&amp;&amp;(c=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&amp;o)&amp;&amp;128==(192&amp;a)&amp;&amp;(u=(15&amp;l)&lt;&lt;12|(63&amp;o)&lt;&lt;6|63&amp;a)&gt;2047&amp;&amp;(u&lt;55296||u&gt;57343)&amp;&amp;(c=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&amp;o)&amp;&amp;128==(192&amp;a)&amp;&amp;128==(192&amp;s)&amp;&amp;(u=(15&amp;l)&lt;&lt;18|(63&amp;o)&lt;&lt;12|(63&amp;a)&lt;&lt;6|63&amp;s)&gt;65535&amp;&amp;u&lt;1114112&amp;&amp;(c=u)}null===c?(c=65533,f=1):c&gt;65535&amp;&amp;(c-=65536,r.push(c&gt;&gt;&gt;10&amp;1023|55296),c=56320|1023&amp;c),r.push(c),i+=f}return function(t){var e=t.length;if(e&lt;=T)return String.fromCharCode.apply(String,t);var n=&quot;&quot;,r=0;for(;r&lt;e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=T));return n}(r)}n.kMaxLength=o,s.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),s.TYPED_ARRAY_SUPPORT||&quot;undefined&quot;==typeof console||&quot;function&quot;!=typeof console.error||console.error(&quot;This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.&quot;),Object.defineProperty(s.prototype,&quot;parent&quot;,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,&quot;offset&quot;,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),&quot;undefined&quot;!=typeof Symbol&amp;&amp;null!=Symbol.species&amp;&amp;s[Symbol.species]===s&amp;&amp;Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(t,e,n){return u(t,e,n)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(t,e,n){return function(t,e,n){return l(t),t&lt;=0?a(t):void 0!==e?&quot;string&quot;==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},s.allocUnsafe=function(t){return c(t)},s.allocUnsafeSlow=function(t){return c(t)},s.isBuffer=function(t){return null!=t&amp;&amp;!0===t._isBuffer&amp;&amp;t!==s.prototype},s.compare=function(t,e){if(B(t,Uint8Array)&amp;&amp;(t=s.from(t,t.offset,t.byteLength)),B(e,Uint8Array)&amp;&amp;(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError(&apos;The &quot;buf1&quot;, &quot;buf2&quot; arguments must be one of type Buffer or Uint8Array&apos;);if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i&lt;o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n&lt;r?-1:r&lt;n?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case&quot;hex&quot;:case&quot;utf8&quot;:case&quot;utf-8&quot;:case&quot;ascii&quot;:case&quot;latin1&quot;:case&quot;binary&quot;:case&quot;base64&quot;:case&quot;ucs2&quot;:case&quot;ucs-2&quot;:case&quot;utf16le&quot;:case&quot;utf-16le&quot;:return!0;default:return!1}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError(&apos;&quot;list&quot; argument must be an Array of Buffers&apos;);if(0===t.length)return s.alloc(0);var n;if(void 0===e)for(e=0,n=0;n&lt;t.length;++n)e+=t[n].length;var r=s.allocUnsafe(e),i=0;for(n=0;n&lt;t.length;++n){var o=t[n];if(B(o,Uint8Array)&amp;&amp;(o=s.from(o)),!s.isBuffer(o))throw new TypeError(&apos;&quot;list&quot; argument must be an Array of Buffers&apos;);o.copy(r,i),i+=o.length}return r},s.byteLength=h,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError(&quot;Buffer size must be a multiple of 16-bits&quot;);for(var e=0;e&lt;t;e+=2)d(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError(&quot;Buffer size must be a multiple of 32-bits&quot;);for(var e=0;e&lt;t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError(&quot;Buffer size must be a multiple of 64-bits&quot;);for(var e=0;e&lt;t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},s.prototype.toString=function(){var t=this.length;return 0===t?&quot;&quot;:0===arguments.length?k(this,0,t):function(t,e,n){var r=!1;if((void 0===e||e&lt;0)&amp;&amp;(e=0),e&gt;this.length)return&quot;&quot;;if((void 0===n||n&gt;this.length)&amp;&amp;(n=this.length),n&lt;=0)return&quot;&quot;;if((n&gt;&gt;&gt;=0)&lt;=(e&gt;&gt;&gt;=0))return&quot;&quot;;for(t||(t=&quot;utf8&quot;);;)switch(t){case&quot;hex&quot;:return C(this,e,n);case&quot;utf8&quot;:case&quot;utf-8&quot;:return k(this,e,n);case&quot;ascii&quot;:return N(this,e,n);case&quot;latin1&quot;:case&quot;binary&quot;:return S(this,e,n);case&quot;base64&quot;:return E(this,e,n);case&quot;ucs2&quot;:case&quot;ucs-2&quot;:case&quot;utf16le&quot;:case&quot;utf-16le&quot;:return A(this,e,n);default:if(r)throw new TypeError(&quot;Unknown encoding: &quot;+t);t=(t+&quot;&quot;).toLowerCase(),r=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError(&quot;Argument must be a Buffer&quot;);return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t=&quot;&quot;,e=n.INSPECT_MAX_BYTES;return t=this.toString(&quot;hex&quot;,0,e).replace(/(.{2})/g,&quot;$1 &quot;).trim(),this.length&gt;e&amp;&amp;(t+=&quot; ... &quot;),&quot;&lt;Buffer &quot;+t+&quot;&gt;&quot;},s.prototype.compare=function(t,e,n,r,i){if(B(t,Uint8Array)&amp;&amp;(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError(&apos;The &quot;target&quot; argument must be one of type Buffer or Uint8Array. Received type &apos;+typeof t);if(void 0===e&amp;&amp;(e=0),void 0===n&amp;&amp;(n=t?t.length:0),void 0===r&amp;&amp;(r=0),void 0===i&amp;&amp;(i=this.length),e&lt;0||n&gt;t.length||r&lt;0||i&gt;this.length)throw new RangeError(&quot;out of range index&quot;);if(r&gt;=i&amp;&amp;e&gt;=n)return 0;if(r&gt;=i)return-1;if(e&gt;=n)return 1;if(e&gt;&gt;&gt;=0,n&gt;&gt;&gt;=0,r&gt;&gt;&gt;=0,i&gt;&gt;&gt;=0,this===t)return 0;for(var o=i-r,a=n-e,u=Math.min(o,a),l=this.slice(r,i),c=t.slice(e,n),f=0;f&lt;u;++f)if(l[f]!==c[f]){o=l[f],a=c[f];break}return o&lt;a?-1:a&lt;o?1:0},s.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},s.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},s.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},s.prototype.write=function(t,e,n,r){if(void 0===e)r=&quot;utf8&quot;,n=this.length,e=0;else if(void 0===n&amp;&amp;&quot;string&quot;==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error(&quot;Buffer.write(string, encoding, offset[, length]) is no longer supported&quot;);e&gt;&gt;&gt;=0,isFinite(n)?(n&gt;&gt;&gt;=0,void 0===r&amp;&amp;(r=&quot;utf8&quot;)):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n&gt;i)&amp;&amp;(n=i),t.length&gt;0&amp;&amp;(n&lt;0||e&lt;0)||e&gt;this.length)throw new RangeError(&quot;Attempt to write outside buffer bounds&quot;);r||(r=&quot;utf8&quot;);for(var o=!1;;)switch(r){case&quot;hex&quot;:return v(this,t,e,n);case&quot;utf8&quot;:case&quot;utf-8&quot;:return y(this,t,e,n);case&quot;ascii&quot;:return b(this,t,e,n);case&quot;latin1&quot;:case&quot;binary&quot;:return _(this,t,e,n);case&quot;base64&quot;:return w(this,t,e,n);case&quot;ucs2&quot;:case&quot;ucs-2&quot;:case&quot;utf16le&quot;:case&quot;utf-16le&quot;:return x(this,t,e,n);default:if(o)throw new TypeError(&quot;Unknown encoding: &quot;+r);r=(&quot;&quot;+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:&quot;Buffer&quot;,data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function N(t,e,n){var r=&quot;&quot;;n=Math.min(t.length,n);for(var i=e;i&lt;n;++i)r+=String.fromCharCode(127&amp;t[i]);return r}function S(t,e,n){var r=&quot;&quot;;n=Math.min(t.length,n);for(var i=e;i&lt;n;++i)r+=String.fromCharCode(t[i]);return r}function C(t,e,n){var r=t.length;(!e||e&lt;0)&amp;&amp;(e=0),(!n||n&lt;0||n&gt;r)&amp;&amp;(n=r);for(var i=&quot;&quot;,o=e;o&lt;n;++o)i+=z(t[o]);return i}function A(t,e,n){for(var r=t.slice(e,n),i=&quot;&quot;,o=0;o&lt;r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function I(t,e,n){if(t%1!=0||t&lt;0)throw new RangeError(&quot;offset is not uint&quot;);if(t+e&gt;n)throw new RangeError(&quot;Trying to access beyond buffer length&quot;)}function O(t,e,n,r,i,o){if(!s.isBuffer(t))throw new TypeError(&apos;&quot;buffer&quot; argument must be a Buffer instance&apos;);if(e&gt;i||e&lt;o)throw new RangeError(&apos;&quot;value&quot; argument is out of bounds&apos;);if(n+r&gt;t.length)throw new RangeError(&quot;Index out of range&quot;)}function M(t,e,n,r,i,o){if(n+r&gt;t.length)throw new RangeError(&quot;Index out of range&quot;);if(n&lt;0)throw new RangeError(&quot;Index out of range&quot;)}function R(t,e,n,r,o){return e=+e,n&gt;&gt;&gt;=0,o||M(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function P(t,e,n,r,o){return e=+e,n&gt;&gt;&gt;=0,o||M(t,0,n,8),i.write(t,e,n,r,52,8),n+8}s.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t&lt;0?(t+=n)&lt;0&amp;&amp;(t=0):t&gt;n&amp;&amp;(t=n),e&lt;0?(e+=n)&lt;0&amp;&amp;(e=0):e&gt;n&amp;&amp;(e=n),e&lt;t&amp;&amp;(e=t);var r=this.subarray(t,e);return r.__proto__=s.prototype,r},s.prototype.readUIntLE=function(t,e,n){t&gt;&gt;&gt;=0,e&gt;&gt;&gt;=0,n||I(t,e,this.length);for(var r=this[t],i=1,o=0;++o&lt;e&amp;&amp;(i*=256);)r+=this[t+o]*i;return r},s.prototype.readUIntBE=function(t,e,n){t&gt;&gt;&gt;=0,e&gt;&gt;&gt;=0,n||I(t,e,this.length);for(var r=this[t+--e],i=1;e&gt;0&amp;&amp;(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUInt8=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,2,this.length),this[t]|this[t+1]&lt;&lt;8},s.prototype.readUInt16BE=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,2,this.length),this[t]&lt;&lt;8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,4,this.length),(this[t]|this[t+1]&lt;&lt;8|this[t+2]&lt;&lt;16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]&lt;&lt;16|this[t+2]&lt;&lt;8|this[t+3])},s.prototype.readIntLE=function(t,e,n){t&gt;&gt;&gt;=0,e&gt;&gt;&gt;=0,n||I(t,e,this.length);for(var r=this[t],i=1,o=0;++o&lt;e&amp;&amp;(i*=256);)r+=this[t+o]*i;return r&gt;=(i*=128)&amp;&amp;(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t&gt;&gt;&gt;=0,e&gt;&gt;&gt;=0,n||I(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r&gt;0&amp;&amp;(i*=256);)o+=this[t+--r]*i;return o&gt;=(i*=128)&amp;&amp;(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,1,this.length),128&amp;this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t&gt;&gt;&gt;=0,e||I(t,2,this.length);var n=this[t]|this[t+1]&lt;&lt;8;return 32768&amp;n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t&gt;&gt;&gt;=0,e||I(t,2,this.length);var n=this[t+1]|this[t]&lt;&lt;8;return 32768&amp;n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,4,this.length),this[t]|this[t+1]&lt;&lt;8|this[t+2]&lt;&lt;16|this[t+3]&lt;&lt;24},s.prototype.readInt32BE=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,4,this.length),this[t]&lt;&lt;24|this[t+1]&lt;&lt;16|this[t+2]&lt;&lt;8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t&gt;&gt;&gt;=0,e||I(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e&gt;&gt;&gt;=0,n&gt;&gt;&gt;=0,r)||O(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&amp;t;++o&lt;n&amp;&amp;(i*=256);)this[e+o]=t/i&amp;255;return e+n},s.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e&gt;&gt;&gt;=0,n&gt;&gt;&gt;=0,r)||O(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&amp;t;--i&gt;=0&amp;&amp;(o*=256);)this[e+i]=t/o&amp;255;return e+n},s.prototype.writeUInt8=function(t,e,n){return t=+t,e&gt;&gt;&gt;=0,n||O(this,t,e,1,255,0),this[e]=255&amp;t,e+1},s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e&gt;&gt;&gt;=0,n||O(this,t,e,2,65535,0),this[e]=255&amp;t,this[e+1]=t&gt;&gt;&gt;8,e+2},s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e&gt;&gt;&gt;=0,n||O(this,t,e,2,65535,0),this[e]=t&gt;&gt;&gt;8,this[e+1]=255&amp;t,e+2},s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e&gt;&gt;&gt;=0,n||O(this,t,e,4,4294967295,0),this[e+3]=t&gt;&gt;&gt;24,this[e+2]=t&gt;&gt;&gt;16,this[e+1]=t&gt;&gt;&gt;8,this[e]=255&amp;t,e+4},s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e&gt;&gt;&gt;=0,n||O(this,t,e,4,4294967295,0),this[e]=t&gt;&gt;&gt;24,this[e+1]=t&gt;&gt;&gt;16,this[e+2]=t&gt;&gt;&gt;8,this[e+3]=255&amp;t,e+4},s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e&gt;&gt;&gt;=0,!r){var i=Math.pow(2,8*n-1);O(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&amp;t;++o&lt;n&amp;&amp;(a*=256);)t&lt;0&amp;&amp;0===s&amp;&amp;0!==this[e+o-1]&amp;&amp;(s=1),this[e+o]=(t/a&gt;&gt;0)-s&amp;255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e&gt;&gt;&gt;=0,!r){var i=Math.pow(2,8*n-1);O(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&amp;t;--o&gt;=0&amp;&amp;(a*=256);)t&lt;0&amp;&amp;0===s&amp;&amp;0!==this[e+o+1]&amp;&amp;(s=1),this[e+o]=(t/a&gt;&gt;0)-s&amp;255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e&gt;&gt;&gt;=0,n||O(this,t,e,1,127,-128),t&lt;0&amp;&amp;(t=255+t+1),this[e]=255&amp;t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e&gt;&gt;&gt;=0,n||O(this,t,e,2,32767,-32768),this[e]=255&amp;t,this[e+1]=t&gt;&gt;&gt;8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e&gt;&gt;&gt;=0,n||O(this,t,e,2,32767,-32768),this[e]=t&gt;&gt;&gt;8,this[e+1]=255&amp;t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e&gt;&gt;&gt;=0,n||O(this,t,e,4,2147483647,-2147483648),this[e]=255&amp;t,this[e+1]=t&gt;&gt;&gt;8,this[e+2]=t&gt;&gt;&gt;16,this[e+3]=t&gt;&gt;&gt;24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e&gt;&gt;&gt;=0,n||O(this,t,e,4,2147483647,-2147483648),t&lt;0&amp;&amp;(t=4294967295+t+1),this[e]=t&gt;&gt;&gt;24,this[e+1]=t&gt;&gt;&gt;16,this[e+2]=t&gt;&gt;&gt;8,this[e+3]=255&amp;t,e+4},s.prototype.writeFloatLE=function(t,e,n){return R(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return R(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return P(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return P(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError(&quot;argument should be a Buffer&quot;);if(n||(n=0),r||0===r||(r=this.length),e&gt;=t.length&amp;&amp;(e=t.length),e||(e=0),r&gt;0&amp;&amp;r&lt;n&amp;&amp;(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e&lt;0)throw new RangeError(&quot;targetStart out of bounds&quot;);if(n&lt;0||n&gt;=this.length)throw new RangeError(&quot;Index out of range&quot;);if(r&lt;0)throw new RangeError(&quot;sourceEnd out of bounds&quot;);r&gt;this.length&amp;&amp;(r=this.length),t.length-e&lt;r-n&amp;&amp;(r=t.length-e+n);var i=r-n;if(this===t&amp;&amp;&quot;function&quot;==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,n,r);else if(this===t&amp;&amp;n&lt;e&amp;&amp;e&lt;r)for(var o=i-1;o&gt;=0;--o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,r),e);return i},s.prototype.fill=function(t,e,n,r){if(&quot;string&quot;==typeof t){if(&quot;string&quot;==typeof e?(r=e,e=0,n=this.length):&quot;string&quot;==typeof n&amp;&amp;(r=n,n=this.length),void 0!==r&amp;&amp;&quot;string&quot;!=typeof r)throw new TypeError(&quot;encoding must be a string&quot;);if(&quot;string&quot;==typeof r&amp;&amp;!s.isEncoding(r))throw new TypeError(&quot;Unknown encoding: &quot;+r);if(1===t.length){var i=t.charCodeAt(0);(&quot;utf8&quot;===r&amp;&amp;i&lt;128||&quot;latin1&quot;===r)&amp;&amp;(t=i)}}else&quot;number&quot;==typeof t&amp;&amp;(t&amp;=255);if(e&lt;0||this.length&lt;e||this.length&lt;n)throw new RangeError(&quot;Out of range index&quot;);if(n&lt;=e)return this;var o;if(e&gt;&gt;&gt;=0,n=void 0===n?this.length:n&gt;&gt;&gt;0,t||(t=0),&quot;number&quot;==typeof t)for(o=e;o&lt;n;++o)this[o]=t;else{var a=s.isBuffer(t)?t:s.from(t,r),u=a.length;if(0===u)throw new TypeError(&apos;The value &quot;&apos;+t+&apos;&quot; is invalid for argument &quot;value&quot;&apos;);for(o=0;o&lt;n-e;++o)this[o+e]=a[o%u]}return this};var D=/[^+/0-9A-Za-z-_]/g;function z(t){return t&lt;16?&quot;0&quot;+t.toString(16):t.toString(16)}function L(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a&lt;r;++a){if((n=t.charCodeAt(a))&gt;55295&amp;&amp;n&lt;57344){if(!i){if(n&gt;56319){(e-=3)&gt;-1&amp;&amp;o.push(239,191,189);continue}if(a+1===r){(e-=3)&gt;-1&amp;&amp;o.push(239,191,189);continue}i=n;continue}if(n&lt;56320){(e-=3)&gt;-1&amp;&amp;o.push(239,191,189),i=n;continue}n=65536+(i-55296&lt;&lt;10|n-56320)}else i&amp;&amp;(e-=3)&gt;-1&amp;&amp;o.push(239,191,189);if(i=null,n&lt;128){if((e-=1)&lt;0)break;o.push(n)}else if(n&lt;2048){if((e-=2)&lt;0)break;o.push(n&gt;&gt;6|192,63&amp;n|128)}else if(n&lt;65536){if((e-=3)&lt;0)break;o.push(n&gt;&gt;12|224,n&gt;&gt;6&amp;63|128,63&amp;n|128)}else{if(!(n&lt;1114112))throw new Error(&quot;Invalid code point&quot;);if((e-=4)&lt;0)break;o.push(n&gt;&gt;18|240,n&gt;&gt;12&amp;63|128,n&gt;&gt;6&amp;63|128,63&amp;n|128)}}return o}function F(t){return r.toByteArray(function(t){if((t=(t=t.split(&quot;=&quot;)[0]).trim().replace(D,&quot;&quot;)).length&lt;2)return&quot;&quot;;for(;t.length%4!=0;)t+=&quot;=&quot;;return t}(t))}function V(t,e,n,r){for(var i=0;i&lt;r&amp;&amp;!(i+n&gt;=e.length||i&gt;=t.length);++i)e[i+n]=t[i];return i}function B(t,e){return t instanceof e||null!=t&amp;&amp;null!=t.constructor&amp;&amp;null!=t.constructor.name&amp;&amp;t.constructor.name===e.name}function j(t){return t!=t}},{&quot;base64-js&quot;:301,ieee754:336}],304:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;function e(t,e){return t&lt;e?-1:t&gt;e?1:t&gt;=e?0:NaN}function n(t){var n;return 1===t.length&amp;&amp;(n=t,t=function(t,r){return e(n(t),r)}),{left:function(e,n,r,i){for(null==r&amp;&amp;(r=0),null==i&amp;&amp;(i=e.length);r&lt;i;){var o=r+i&gt;&gt;&gt;1;t(e[o],n)&lt;0?r=o+1:i=o}return r},right:function(e,n,r,i){for(null==r&amp;&amp;(r=0),null==i&amp;&amp;(i=e.length);r&lt;i;){var o=r+i&gt;&gt;&gt;1;t(e[o],n)&gt;0?i=o:r=o+1}return r}}}var r=n(e),i=r.right,o=r.left;function a(t,e){return[t,e]}function s(t){return null===t?NaN:+t}function u(t,e){var n,r,i=t.length,o=0,a=-1,u=0,l=0;if(null==e)for(;++a&lt;i;)isNaN(n=s(t[a]))||(l+=(r=n-u)*(n-(u+=r/++o)));else for(;++a&lt;i;)isNaN(n=s(e(t[a],a,t)))||(l+=(r=n-u)*(n-(u+=r/++o)));if(o&gt;1)return l/(o-1)}function l(t,e){var n=u(t,e);return n?Math.sqrt(n):n}function c(t,e){var n,r,i,o=t.length,a=-1;if(null==e){for(;++a&lt;o;)if(null!=(n=t[a])&amp;&amp;n&gt;=n)for(r=i=n;++a&lt;o;)null!=(n=t[a])&amp;&amp;(r&gt;n&amp;&amp;(r=n),i&lt;n&amp;&amp;(i=n))}else for(;++a&lt;o;)if(null!=(n=e(t[a],a,t))&amp;&amp;n&gt;=n)for(r=i=n;++a&lt;o;)null!=(n=e(t[a],a,t))&amp;&amp;(r&gt;n&amp;&amp;(r=n),i&lt;n&amp;&amp;(i=n));return[r,i]}var f=Array.prototype,p=f.slice,h=f.map;function d(t){return function(){return t}}function m(t){return t}function g(t,e,n){t=+t,e=+e,n=(i=arguments.length)&lt;2?(e=t,t=0,1):i&lt;3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r&lt;i;)o[r]=t+r*n;return o}var v=Math.sqrt(50),y=Math.sqrt(10),b=Math.sqrt(2);function _(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i&gt;=0?(o&gt;=v?10:o&gt;=y?5:o&gt;=b?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o&gt;=v?10:o&gt;=y?5:o&gt;=b?2:1)}function w(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o&gt;=v?i*=10:o&gt;=y?i*=5:o&gt;=b&amp;&amp;(i*=2),e&lt;t?-i:i}function x(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1}function E(t,e,n){if(null==n&amp;&amp;(n=s),r=t.length){if((e=+e)&lt;=0||r&lt;2)return+n(t[0],0,t);if(e&gt;=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(i-o)}}function k(t,e){var n,r,i=t.length,o=-1;if(null==e){for(;++o&lt;i;)if(null!=(n=t[o])&amp;&amp;n&gt;=n)for(r=n;++o&lt;i;)null!=(n=t[o])&amp;&amp;r&gt;n&amp;&amp;(r=n)}else for(;++o&lt;i;)if(null!=(n=e(t[o],o,t))&amp;&amp;n&gt;=n)for(r=n;++o&lt;i;)null!=(n=e(t[o],o,t))&amp;&amp;r&gt;n&amp;&amp;(r=n);return r}function T(t){if(!(i=t.length))return[];for(var e=-1,n=k(t,N),r=new Array(n);++e&lt;n;)for(var i,o=-1,a=r[e]=new Array(i);++o&lt;i;)a[o]=t[o][e];return r}function N(t){return t.length}t.bisect=i,t.bisectRight=i,t.bisectLeft=o,t.ascending=e,t.bisector=n,t.cross=function(t,e,n){var r,i,o,s,u=t.length,l=e.length,c=new Array(u*l);for(null==n&amp;&amp;(n=a),r=o=0;r&lt;u;++r)for(s=t[r],i=0;i&lt;l;++i,++o)c[o]=n(s,e[i]);return c},t.descending=function(t,e){return e&lt;t?-1:e&gt;t?1:e&gt;=t?0:NaN},t.deviation=l,t.extent=c,t.histogram=function(){var t=m,e=c,n=x;function r(r){var o,a,s=r.length,u=new Array(s);for(o=0;o&lt;s;++o)u[o]=t(r[o],o,r);var l=e(u),c=l[0],f=l[1],p=n(u,c,f);Array.isArray(p)||(p=w(c,f,p),p=g(Math.ceil(c/p)*p,f,p));for(var h=p.length;p[0]&lt;=c;)p.shift(),--h;for(;p[h-1]&gt;f;)p.pop(),--h;var d,m=new Array(h+1);for(o=0;o&lt;=h;++o)(d=m[o]=[]).x0=o&gt;0?p[o-1]:c,d.x1=o&lt;h?p[o]:f;for(o=0;o&lt;s;++o)c&lt;=(a=u[o])&amp;&amp;a&lt;=f&amp;&amp;m[i(p,a,0,h)].push(r[o]);return m}return r.value=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:d(e),r):t},r.domain=function(t){return arguments.length?(e=&quot;function&quot;==typeof t?t:d([t[0],t[1]]),r):e},r.thresholds=function(t){return arguments.length?(n=&quot;function&quot;==typeof t?t:Array.isArray(t)?d(p.call(t)):d(t),r):n},r},t.thresholdFreedmanDiaconis=function(t,n,r){return t=h.call(t,s).sort(e),Math.ceil((r-n)/(2*(E(t,.75)-E(t,.25))*Math.pow(t.length,-1/3)))},t.thresholdScott=function(t,e,n){return Math.ceil((n-e)/(3.5*l(t)*Math.pow(t.length,-1/3)))},t.thresholdSturges=x,t.max=function(t,e){var n,r,i=t.length,o=-1;if(null==e){for(;++o&lt;i;)if(null!=(n=t[o])&amp;&amp;n&gt;=n)for(r=n;++o&lt;i;)null!=(n=t[o])&amp;&amp;n&gt;r&amp;&amp;(r=n)}else for(;++o&lt;i;)if(null!=(n=e(t[o],o,t))&amp;&amp;n&gt;=n)for(r=n;++o&lt;i;)null!=(n=e(t[o],o,t))&amp;&amp;n&gt;r&amp;&amp;(r=n);return r},t.mean=function(t,e){var n,r=t.length,i=r,o=-1,a=0;if(null==e)for(;++o&lt;r;)isNaN(n=s(t[o]))?--i:a+=n;else for(;++o&lt;r;)isNaN(n=s(e(t[o],o,t)))?--i:a+=n;if(i)return a/i},t.median=function(t,n){var r,i=t.length,o=-1,a=[];if(null==n)for(;++o&lt;i;)isNaN(r=s(t[o]))||a.push(r);else for(;++o&lt;i;)isNaN(r=s(n(t[o],o,t)))||a.push(r);return E(a.sort(e),.5)},t.merge=function(t){for(var e,n,r,i=t.length,o=-1,a=0;++o&lt;i;)a+=t[o].length;for(n=new Array(a);--i&gt;=0;)for(e=(r=t[i]).length;--e&gt;=0;)n[--a]=r[e];return n},t.min=k,t.pairs=function(t,e){null==e&amp;&amp;(e=a);for(var n=0,r=t.length-1,i=t[0],o=new Array(r&lt;0?0:r);n&lt;r;)o[n]=e(i,i=t[++n]);return o},t.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},t.quantile=E,t.range=g,t.scan=function(t,n){if(r=t.length){var r,i,o=0,a=0,s=t[a];for(null==n&amp;&amp;(n=e);++o&lt;r;)(n(i=t[o],s)&lt;0||0!==n(s,s))&amp;&amp;(s=i,a=o);return 0===n(s,s)?a:void 0}},t.shuffle=function(t,e,n){for(var r,i,o=(null==n?t.length:n)-(e=null==e?0:+e);o;)i=Math.random()*o--|0,r=t[o+e],t[o+e]=t[i+e],t[i+e]=r;return t},t.sum=function(t,e){var n,r=t.length,i=-1,o=0;if(null==e)for(;++i&lt;r;)(n=+t[i])&amp;&amp;(o+=n);else for(;++i&lt;r;)(n=+e(t[i],i,t))&amp;&amp;(o+=n);return o},t.ticks=function(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)==(e=+e)&amp;&amp;n&gt;0)return[t];if((r=e&lt;t)&amp;&amp;(i=t,t=e,e=i),0===(a=_(t,e,n))||!isFinite(a))return[];if(a&gt;0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++s&lt;i;)o[s]=(t+s)*a;else for(t=Math.floor(t*a),e=Math.ceil(e*a),o=new Array(i=Math.ceil(t-e+1));++s&lt;i;)o[s]=(t-s)/a;return r&amp;&amp;o.reverse(),o},t.tickIncrement=_,t.tickStep=w,t.transpose=T,t.variance=u,t.zip=function(){return T(arguments)},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],305:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;var e=Array.prototype.slice;function n(t){return t}var r=1,i=2,o=3,a=4,s=1e-6;function u(t){return&quot;translate(&quot;+(t+.5)+&quot;,0)&quot;}function l(t){return&quot;translate(0,&quot;+(t+.5)+&quot;)&quot;}function c(){return!this.__axis}function f(t,f){var p=[],h=null,d=null,m=6,g=6,v=3,y=t===r||t===a?-1:1,b=t===a||t===i?&quot;x&quot;:&quot;y&quot;,_=t===r||t===o?u:l;function w(e){var u=null==h?f.ticks?f.ticks.apply(f,p):f.domain():h,l=null==d?f.tickFormat?f.tickFormat.apply(f,p):n:d,w=Math.max(m,0)+v,x=f.range(),E=+x[0]+.5,k=+x[x.length-1]+.5,T=(f.bandwidth?function(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&amp;&amp;(e=Math.round(e)),function(n){return+t(n)+e}}:function(t){return function(e){return+t(e)}})(f.copy()),N=e.selection?e.selection():e,S=N.selectAll(&quot;.domain&quot;).data([null]),C=N.selectAll(&quot;.tick&quot;).data(u,f).order(),A=C.exit(),I=C.enter().append(&quot;g&quot;).attr(&quot;class&quot;,&quot;tick&quot;),O=C.select(&quot;line&quot;),M=C.select(&quot;text&quot;);S=S.merge(S.enter().insert(&quot;path&quot;,&quot;.tick&quot;).attr(&quot;class&quot;,&quot;domain&quot;).attr(&quot;stroke&quot;,&quot;currentColor&quot;)),C=C.merge(I),O=O.merge(I.append(&quot;line&quot;).attr(&quot;stroke&quot;,&quot;currentColor&quot;).attr(b+&quot;2&quot;,y*m)),M=M.merge(I.append(&quot;text&quot;).attr(&quot;fill&quot;,&quot;currentColor&quot;).attr(b,y*w).attr(&quot;dy&quot;,t===r?&quot;0em&quot;:t===o?&quot;0.71em&quot;:&quot;0.32em&quot;)),e!==N&amp;&amp;(S=S.transition(e),C=C.transition(e),O=O.transition(e),M=M.transition(e),A=A.transition(e).attr(&quot;opacity&quot;,s).attr(&quot;transform&quot;,function(t){return isFinite(t=T(t))?_(t):this.getAttribute(&quot;transform&quot;)}),I.attr(&quot;opacity&quot;,s).attr(&quot;transform&quot;,function(t){var e=this.parentNode.__axis;return _(e&amp;&amp;isFinite(e=e(t))?e:T(t))})),A.remove(),S.attr(&quot;d&quot;,t===a||t==i?g?&quot;M&quot;+y*g+&quot;,&quot;+E+&quot;H0.5V&quot;+k+&quot;H&quot;+y*g:&quot;M0.5,&quot;+E+&quot;V&quot;+k:g?&quot;M&quot;+E+&quot;,&quot;+y*g+&quot;V0.5H&quot;+k+&quot;V&quot;+y*g:&quot;M&quot;+E+&quot;,0.5H&quot;+k),C.attr(&quot;opacity&quot;,1).attr(&quot;transform&quot;,function(t){return _(T(t))}),O.attr(b+&quot;2&quot;,y*m),M.attr(b,y*w).text(l),N.filter(c).attr(&quot;fill&quot;,&quot;none&quot;).attr(&quot;font-size&quot;,10).attr(&quot;font-family&quot;,&quot;sans-serif&quot;).attr(&quot;text-anchor&quot;,t===i?&quot;start&quot;:t===a?&quot;end&quot;:&quot;middle&quot;),N.each(function(){this.__axis=T})}return w.scale=function(t){return arguments.length?(f=t,w):f},w.ticks=function(){return p=e.call(arguments),w},w.tickArguments=function(t){return arguments.length?(p=null==t?[]:e.call(t),w):p.slice()},w.tickValues=function(t){return arguments.length?(h=null==t?null:e.call(t),w):h&amp;&amp;h.slice()},w.tickFormat=function(t){return arguments.length?(d=t,w):d},w.tickSize=function(t){return arguments.length?(m=g=+t,w):m},w.tickSizeInner=function(t){return arguments.length?(m=+t,w):m},w.tickSizeOuter=function(t){return arguments.length?(g=+t,w):g},w.tickPadding=function(t){return arguments.length?(v=+t,w):v},w}t.axisTop=function(t){return f(r,t)},t.axisRight=function(t){return f(i,t)},t.axisBottom=function(t){return f(o,t)},t.axisLeft=function(t){return f(a,t)},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],306:[function(t,e,n){var r,i;r=this,i=function(t,e,n,r,i,o){&quot;use strict&quot;;function a(t){return function(){return t}}function s(){e.event.stopImmediatePropagation()}function u(){e.event.preventDefault(),e.event.stopImmediatePropagation()}var l={name:&quot;drag&quot;},c={name:&quot;space&quot;},f={name:&quot;handle&quot;},p={name:&quot;center&quot;},h={name:&quot;x&quot;,handles:[&quot;e&quot;,&quot;w&quot;].map(w),input:function(t,e){return t&amp;&amp;[[t[0],e[0][1]],[t[1],e[1][1]]]},output:function(t){return t&amp;&amp;[t[0][0],t[1][0]]}},d={name:&quot;y&quot;,handles:[&quot;n&quot;,&quot;s&quot;].map(w),input:function(t,e){return t&amp;&amp;[[e[0][0],t[0]],[e[1][0],t[1]]]},output:function(t){return t&amp;&amp;[t[0][1],t[1][1]]}},m={name:&quot;xy&quot;,handles:[&quot;n&quot;,&quot;e&quot;,&quot;s&quot;,&quot;w&quot;,&quot;nw&quot;,&quot;ne&quot;,&quot;se&quot;,&quot;sw&quot;].map(w),input:function(t){return t},output:function(t){return t}},g={overlay:&quot;crosshair&quot;,selection:&quot;move&quot;,n:&quot;ns-resize&quot;,e:&quot;ew-resize&quot;,s:&quot;ns-resize&quot;,w:&quot;ew-resize&quot;,nw:&quot;nwse-resize&quot;,ne:&quot;nesw-resize&quot;,se:&quot;nwse-resize&quot;,sw:&quot;nesw-resize&quot;},v={e:&quot;w&quot;,w:&quot;e&quot;,nw:&quot;ne&quot;,ne:&quot;nw&quot;,se:&quot;sw&quot;,sw:&quot;se&quot;},y={n:&quot;s&quot;,s:&quot;n&quot;,nw:&quot;sw&quot;,ne:&quot;se&quot;,se:&quot;ne&quot;,sw:&quot;nw&quot;},b={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},_={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function w(t){return{type:t}}function x(){return!e.event.button}function E(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function k(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function T(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function N(t){var m,N=E,S=x,C=n.dispatch(I,&quot;start&quot;,&quot;brush&quot;,&quot;end&quot;),A=6;function I(n){var r=n.property(&quot;__brush&quot;,D).selectAll(&quot;.overlay&quot;).data([w(&quot;overlay&quot;)]);r.enter().append(&quot;rect&quot;).attr(&quot;class&quot;,&quot;overlay&quot;).attr(&quot;pointer-events&quot;,&quot;all&quot;).attr(&quot;cursor&quot;,g.overlay).merge(r).each(function(){var t=k(this).extent;e.select(this).attr(&quot;x&quot;,t[0][0]).attr(&quot;y&quot;,t[0][1]).attr(&quot;width&quot;,t[1][0]-t[0][0]).attr(&quot;height&quot;,t[1][1]-t[0][1])}),n.selectAll(&quot;.selection&quot;).data([w(&quot;selection&quot;)]).enter().append(&quot;rect&quot;).attr(&quot;class&quot;,&quot;selection&quot;).attr(&quot;cursor&quot;,g.selection).attr(&quot;fill&quot;,&quot;#777&quot;).attr(&quot;fill-opacity&quot;,.3).attr(&quot;stroke&quot;,&quot;#fff&quot;).attr(&quot;shape-rendering&quot;,&quot;crispEdges&quot;);var i=n.selectAll(&quot;.handle&quot;).data(t.handles,function(t){return t.type});i.exit().remove(),i.enter().append(&quot;rect&quot;).attr(&quot;class&quot;,function(t){return&quot;handle handle--&quot;+t.type}).attr(&quot;cursor&quot;,function(t){return g[t.type]}),n.each(O).attr(&quot;fill&quot;,&quot;none&quot;).attr(&quot;pointer-events&quot;,&quot;all&quot;).style(&quot;-webkit-tap-highlight-color&quot;,&quot;rgba(0,0,0,0)&quot;).on(&quot;mousedown.brush touchstart.brush&quot;,P)}function O(){var t=e.select(this),n=k(this).selection;n?(t.selectAll(&quot;.selection&quot;).style(&quot;display&quot;,null).attr(&quot;x&quot;,n[0][0]).attr(&quot;y&quot;,n[0][1]).attr(&quot;width&quot;,n[1][0]-n[0][0]).attr(&quot;height&quot;,n[1][1]-n[0][1]),t.selectAll(&quot;.handle&quot;).style(&quot;display&quot;,null).attr(&quot;x&quot;,function(t){return&quot;e&quot;===t.type[t.type.length-1]?n[1][0]-A/2:n[0][0]-A/2}).attr(&quot;y&quot;,function(t){return&quot;s&quot;===t.type[0]?n[1][1]-A/2:n[0][1]-A/2}).attr(&quot;width&quot;,function(t){return&quot;n&quot;===t.type||&quot;s&quot;===t.type?n[1][0]-n[0][0]+A:A}).attr(&quot;height&quot;,function(t){return&quot;e&quot;===t.type||&quot;w&quot;===t.type?n[1][1]-n[0][1]+A:A})):t.selectAll(&quot;.selection,.handle&quot;).style(&quot;display&quot;,&quot;none&quot;).attr(&quot;x&quot;,null).attr(&quot;y&quot;,null).attr(&quot;width&quot;,null).attr(&quot;height&quot;,null)}function M(t,e){return t.__brush.emitter||new R(t,e)}function R(t,e){this.that=t,this.args=e,this.state=t.__brush,this.active=0}function P(){if(e.event.touches){if(e.event.changedTouches.length&lt;e.event.touches.length)return u()}else if(m)return;if(S.apply(this,arguments)){var n,i,a,w,x,E,N,C,A,I,R,P,D,z=this,L=e.event.target.__data__.type,F=&quot;selection&quot;===(e.event.metaKey?L=&quot;overlay&quot;:L)?l:e.event.altKey?p:f,V=t===d?null:b[L],B=t===h?null:_[L],j=k(z),q=j.extent,U=j.selection,G=q[0][0],W=q[0][1],H=q[1][0],$=q[1][1],K=V&amp;&amp;B&amp;&amp;e.event.shiftKey,Y=e.mouse(z),X=Y,Z=M(z,arguments).beforestart();&quot;overlay&quot;===L?j.selection=U=[[n=t===d?G:Y[0],a=t===h?W:Y[1]],[x=t===d?H:n,N=t===h?$:a]]:(n=U[0][0],a=U[0][1],x=U[1][0],N=U[1][1]),i=n,w=a,E=x,C=N;var Q=e.select(z).attr(&quot;pointer-events&quot;,&quot;none&quot;),J=Q.selectAll(&quot;.overlay&quot;).attr(&quot;cursor&quot;,g[L]);if(e.event.touches)Q.on(&quot;touchmove.brush&quot;,et,!0).on(&quot;touchend.brush touchcancel.brush&quot;,rt,!0);else{var tt=e.select(e.event.view).on(&quot;keydown.brush&quot;,function(){switch(e.event.keyCode){case 16:K=V&amp;&amp;B;break;case 18:F===f&amp;&amp;(V&amp;&amp;(x=E-A*V,n=i+A*V),B&amp;&amp;(N=C-I*B,a=w+I*B),F=p,nt());break;case 32:F!==f&amp;&amp;F!==p||(V&lt;0?x=E-A:V&gt;0&amp;&amp;(n=i-A),B&lt;0?N=C-I:B&gt;0&amp;&amp;(a=w-I),F=c,J.attr(&quot;cursor&quot;,g.selection),nt());break;default:return}u()},!0).on(&quot;keyup.brush&quot;,function(){switch(e.event.keyCode){case 16:K&amp;&amp;(P=D=K=!1,nt());break;case 18:F===p&amp;&amp;(V&lt;0?x=E:V&gt;0&amp;&amp;(n=i),B&lt;0?N=C:B&gt;0&amp;&amp;(a=w),F=f,nt());break;case 32:F===c&amp;&amp;(e.event.altKey?(V&amp;&amp;(x=E-A*V,n=i+A*V),B&amp;&amp;(N=C-I*B,a=w+I*B),F=p):(V&lt;0?x=E:V&gt;0&amp;&amp;(n=i),B&lt;0?N=C:B&gt;0&amp;&amp;(a=w),F=f),J.attr(&quot;cursor&quot;,g[L]),nt());break;default:return}u()},!0).on(&quot;mousemove.brush&quot;,et,!0).on(&quot;mouseup.brush&quot;,rt,!0);r.dragDisable(e.event.view)}s(),o.interrupt(z),O.call(z),Z.start()}function et(){var t=e.mouse(z);!K||P||D||(Math.abs(t[0]-X[0])&gt;Math.abs(t[1]-X[1])?D=!0:P=!0),X=t,R=!0,u(),nt()}function nt(){var t;switch(A=X[0]-Y[0],I=X[1]-Y[1],F){case c:case l:V&amp;&amp;(A=Math.max(G-n,Math.min(H-x,A)),i=n+A,E=x+A),B&amp;&amp;(I=Math.max(W-a,Math.min($-N,I)),w=a+I,C=N+I);break;case f:V&lt;0?(A=Math.max(G-n,Math.min(H-n,A)),i=n+A,E=x):V&gt;0&amp;&amp;(A=Math.max(G-x,Math.min(H-x,A)),i=n,E=x+A),B&lt;0?(I=Math.max(W-a,Math.min($-a,I)),w=a+I,C=N):B&gt;0&amp;&amp;(I=Math.max(W-N,Math.min($-N,I)),w=a,C=N+I);break;case p:V&amp;&amp;(i=Math.max(G,Math.min(H,n-A*V)),E=Math.max(G,Math.min(H,x+A*V))),B&amp;&amp;(w=Math.max(W,Math.min($,a-I*B)),C=Math.max(W,Math.min($,N+I*B)))}E&lt;i&amp;&amp;(V*=-1,t=n,n=x,x=t,t=i,i=E,E=t,L in v&amp;&amp;J.attr(&quot;cursor&quot;,g[L=v[L]])),C&lt;w&amp;&amp;(B*=-1,t=a,a=N,N=t,t=w,w=C,C=t,L in y&amp;&amp;J.attr(&quot;cursor&quot;,g[L=y[L]])),j.selection&amp;&amp;(U=j.selection),P&amp;&amp;(i=U[0][0],E=U[1][0]),D&amp;&amp;(w=U[0][1],C=U[1][1]),U[0][0]===i&amp;&amp;U[0][1]===w&amp;&amp;U[1][0]===E&amp;&amp;U[1][1]===C||(j.selection=[[i,w],[E,C]],O.call(z),Z.brush())}function rt(){if(s(),e.event.touches){if(e.event.touches.length)return;m&amp;&amp;clearTimeout(m),m=setTimeout(function(){m=null},500),Q.on(&quot;touchmove.brush touchend.brush touchcancel.brush&quot;,null)}else r.dragEnable(e.event.view,R),tt.on(&quot;keydown.brush keyup.brush mousemove.brush mouseup.brush&quot;,null);Q.attr(&quot;pointer-events&quot;,&quot;all&quot;),J.attr(&quot;cursor&quot;,g.overlay),j.selection&amp;&amp;(U=j.selection),T(U)&amp;&amp;(j.selection=null,O.call(z)),Z.end()}}function D(){var e=this.__brush||{selection:null};return e.extent=N.apply(this,arguments),e.dim=t,e}return I.move=function(e,n){e.selection?e.on(&quot;start.brush&quot;,function(){M(this,arguments).beforestart().start()}).on(&quot;interrupt.brush end.brush&quot;,function(){M(this,arguments).end()}).tween(&quot;brush&quot;,function(){var e=this,r=e.__brush,o=M(e,arguments),a=r.selection,s=t.input(&quot;function&quot;==typeof n?n.apply(this,arguments):n,r.extent),u=i.interpolate(a,s);function l(t){r.selection=1===t&amp;&amp;T(s)?null:u(t),O.call(e),o.brush()}return a&amp;&amp;s?l:l(1)}):e.each(function(){var e=arguments,r=this.__brush,i=t.input(&quot;function&quot;==typeof n?n.apply(this,e):n,r.extent),a=M(this,e).beforestart();o.interrupt(this),r.selection=null==i||T(i)?null:i,O.call(this),a.start().brush().end()})},R.prototype={beforestart:function(){return 1==++this.active&amp;&amp;(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting&amp;&amp;(this.starting=!1,this.emit(&quot;start&quot;)),this},brush:function(){return this.emit(&quot;brush&quot;),this},end:function(){return 0==--this.active&amp;&amp;(delete this.state.emitter,this.emit(&quot;end&quot;)),this},emit:function(n){e.customEvent(new function(t,e,n){this.target=t,this.type=e,this.selection=n}(I,n,t.output(this.state.selection)),C.apply,C,[n,this.that,this.args])}},I.extent=function(t){return arguments.length?(N=&quot;function&quot;==typeof t?t:a([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),I):N},I.filter=function(t){return arguments.length?(S=&quot;function&quot;==typeof t?t:a(!!t),I):S},I.handleSize=function(t){return arguments.length?(A=+t,I):A},I.on=function(){var t=C.on.apply(C,arguments);return t===C?I:t},I}t.brush=function(){return N(m)},t.brushX=function(){return N(h)},t.brushY=function(){return N(d)},t.brushSelection=function(t){var e=t.__brush;return e?e.dim.output(e.selection):null},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-selection&quot;),t(&quot;d3-dispatch&quot;),t(&quot;d3-drag&quot;),t(&quot;d3-interpolate&quot;),t(&quot;d3-transition&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-selection&quot;,&quot;d3-dispatch&quot;,&quot;d3-drag&quot;,&quot;d3-interpolate&quot;,&quot;d3-transition&quot;],i):i(r.d3=r.d3||{},r.d3,r.d3,r.d3,r.d3,r.d3)},{&quot;d3-dispatch&quot;:311,&quot;d3-drag&quot;:312,&quot;d3-interpolate&quot;:320,&quot;d3-selection&quot;:327,&quot;d3-transition&quot;:332}],307:[function(t,e,n){var r,i;r=this,i=function(t,e,n){&quot;use strict&quot;;var r=Math.cos,i=Math.sin,o=Math.PI,a=o/2,s=2*o,u=Math.max;var l=Array.prototype.slice;function c(t){return function(){return t}}function f(t){return t.source}function p(t){return t.target}function h(t){return t.radius}function d(t){return t.startAngle}function m(t){return t.endAngle}t.chord=function(){var t=0,n=null,r=null,i=null;function o(o){var a,l,c,f,p,h,d=o.length,m=[],g=e.range(d),v=[],y=[],b=y.groups=new Array(d),_=new Array(d*d);for(a=0,p=-1;++p&lt;d;){for(l=0,h=-1;++h&lt;d;)l+=o[p][h];m.push(l),v.push(e.range(d)),a+=l}for(n&amp;&amp;g.sort(function(t,e){return n(m[t],m[e])}),r&amp;&amp;v.forEach(function(t,e){t.sort(function(t,n){return r(o[e][t],o[e][n])})}),f=(a=u(0,s-t*d)/a)?t:s/d,l=0,p=-1;++p&lt;d;){for(c=l,h=-1;++h&lt;d;){var w=g[p],x=v[w][h],E=o[w][x],k=l,T=l+=E*a;_[x*d+w]={index:w,subindex:x,startAngle:k,endAngle:T,value:E}}b[w]={index:w,startAngle:c,endAngle:l,value:m[w]},l+=f}for(p=-1;++p&lt;d;)for(h=p-1;++h&lt;d;){var N=_[h*d+p],S=_[p*d+h];(N.value||S.value)&amp;&amp;y.push(N.value&lt;S.value?{source:S,target:N}:{source:N,target:S})}return i?y.sort(i):y}return o.padAngle=function(e){return arguments.length?(t=u(0,e),o):t},o.sortGroups=function(t){return arguments.length?(n=t,o):n},o.sortSubgroups=function(t){return arguments.length?(r=t,o):r},o.sortChords=function(t){return arguments.length?(null==t?i=null:(e=t,i=function(t,n){return e(t.source.value+t.target.value,n.source.value+n.target.value)})._=t,o):i&amp;&amp;i._;var e},o},t.ribbon=function(){var t=f,e=p,o=h,s=d,u=m,g=null;function v(){var c,f=l.call(arguments),p=t.apply(this,f),h=e.apply(this,f),d=+o.apply(this,(f[0]=p,f)),m=s.apply(this,f)-a,v=u.apply(this,f)-a,y=d*r(m),b=d*i(m),_=+o.apply(this,(f[0]=h,f)),w=s.apply(this,f)-a,x=u.apply(this,f)-a;if(g||(g=c=n.path()),g.moveTo(y,b),g.arc(0,0,d,m,v),m===w&amp;&amp;v===x||(g.quadraticCurveTo(0,0,_*r(w),_*i(w)),g.arc(0,0,_,w,x)),g.quadraticCurveTo(0,0,y,b),g.closePath(),c)return g=null,c+&quot;&quot;||null}return v.radius=function(t){return arguments.length?(o=&quot;function&quot;==typeof t?t:c(+t),v):o},v.startAngle=function(t){return arguments.length?(s=&quot;function&quot;==typeof t?t:c(+t),v):s},v.endAngle=function(t){return arguments.length?(u=&quot;function&quot;==typeof t?t:c(+t),v):u},v.source=function(e){return arguments.length?(t=e,v):t},v.target=function(t){return arguments.length?(e=t,v):e},v.context=function(t){return arguments.length?(g=null==t?null:t,v):g},v},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-array&quot;),t(&quot;d3-path&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-array&quot;,&quot;d3-path&quot;],i):i(r.d3=r.d3||{},r.d3,r.d3)},{&quot;d3-array&quot;:304,&quot;d3-path&quot;:321}],308:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;function e(){}function n(t,n){var r=new e;if(t instanceof e)t.each(function(t,e){r.set(e,t)});else if(Array.isArray(t)){var i,o=-1,a=t.length;if(null==n)for(;++o&lt;a;)r.set(o,t[o]);else for(;++o&lt;a;)r.set(n(i=t[o],o,t),i)}else if(t)for(var s in t)r.set(s,t[s]);return r}function r(){return{}}function i(t,e,n){t[e]=n}function o(){return n()}function a(t,e,n){t.set(e,n)}function s(){}e.prototype=n.prototype={constructor:e,has:function(t){return&quot;$&quot;+t in this},get:function(t){return this[&quot;$&quot;+t]},set:function(t,e){return this[&quot;$&quot;+t]=e,this},remove:function(t){var e=&quot;$&quot;+t;return e in this&amp;&amp;delete this[e]},clear:function(){for(var t in this)&quot;$&quot;===t[0]&amp;&amp;delete this[t]},keys:function(){var t=[];for(var e in this)&quot;$&quot;===e[0]&amp;&amp;t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)&quot;$&quot;===e[0]&amp;&amp;t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)&quot;$&quot;===e[0]&amp;&amp;t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)&quot;$&quot;===e[0]&amp;&amp;++t;return t},empty:function(){for(var t in this)if(&quot;$&quot;===t[0])return!1;return!0},each:function(t){for(var e in this)&quot;$&quot;===e[0]&amp;&amp;t(this[e],e.slice(1),this)}};var u=n.prototype;function l(t,e){var n=new s;if(t instanceof s)t.each(function(t){n.add(t)});else if(t){var r=-1,i=t.length;if(null==e)for(;++r&lt;i;)n.add(t[r]);else for(;++r&lt;i;)n.add(e(t[r],r,t))}return n}s.prototype=l.prototype={constructor:s,has:u.has,add:function(t){return this[&quot;$&quot;+(t+=&quot;&quot;)]=t,this},remove:u.remove,clear:u.clear,values:u.keys,size:u.size,empty:u.empty,each:u.each},t.nest=function(){var t,e,s,u=[],l=[];function c(r,i,o,a){if(i&gt;=u.length)return null!=t&amp;&amp;r.sort(t),null!=e?e(r):r;for(var s,l,f,p=-1,h=r.length,d=u[i++],m=n(),g=o();++p&lt;h;)(f=m.get(s=d(l=r[p])+&quot;&quot;))?f.push(l):m.set(s,[l]);return m.each(function(t,e){a(g,e,c(t,i,o,a))}),g}return s={object:function(t){return c(t,0,r,i)},map:function(t){return c(t,0,o,a)},entries:function(t){return function t(n,r){if(++r&gt;u.length)return n;var i,o=l[r-1];return null!=e&amp;&amp;r&gt;=u.length?i=n.entries():(i=[],n.each(function(e,n){i.push({key:n,values:t(e,r)})})),null!=o?i.sort(function(t,e){return o(t.key,e.key)}):i}(c(t,0,o,a),0)},key:function(t){return u.push(t),s},sortKeys:function(t){return l[u.length-1]=t,s},sortValues:function(e){return t=e,s},rollup:function(t){return e=t,s}}},t.set=l,t.map=n,t.keys=function(t){var e=[];for(var n in t)e.push(n);return e},t.values=function(t){var e=[];for(var n in t)e.push(t[n]);return e},t.entries=function(t){var e=[];for(var n in t)e.push({key:n,value:t[n]});return e},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],309:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;function e(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function n(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function r(){}var i=&quot;\\s*([+-]?\\d+)\\s*&quot;,o=&quot;\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*&quot;,a=&quot;\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*&quot;,s=/^#([0-9a-f]{3})$/,u=/^#([0-9a-f]{6})$/,l=new RegExp(&quot;^rgb\\(&quot;+[i,i,i]+&quot;\\)$&quot;),c=new RegExp(&quot;^rgb\\(&quot;+[a,a,a]+&quot;\\)$&quot;),f=new RegExp(&quot;^rgba\\(&quot;+[i,i,i,o]+&quot;\\)$&quot;),p=new RegExp(&quot;^rgba\\(&quot;+[a,a,a,o]+&quot;\\)$&quot;),h=new RegExp(&quot;^hsl\\(&quot;+[o,a,a]+&quot;\\)$&quot;),d=new RegExp(&quot;^hsla\\(&quot;+[o,a,a,o]+&quot;\\)$&quot;),m={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 g(t){var e;return t=(t+&quot;&quot;).trim().toLowerCase(),(e=s.exec(t))?new w((e=parseInt(e[1],16))&gt;&gt;8&amp;15|e&gt;&gt;4&amp;240,e&gt;&gt;4&amp;15|240&amp;e,(15&amp;e)&lt;&lt;4|15&amp;e,1):(e=u.exec(t))?v(parseInt(e[1],16)):(e=l.exec(t))?new w(e[1],e[2],e[3],1):(e=c.exec(t))?new w(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=f.exec(t))?y(e[1],e[2],e[3],e[4]):(e=p.exec(t))?y(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=h.exec(t))?E(e[1],e[2]/100,e[3]/100,1):(e=d.exec(t))?E(e[1],e[2]/100,e[3]/100,e[4]):m.hasOwnProperty(t)?v(m[t]):&quot;transparent&quot;===t?new w(NaN,NaN,NaN,0):null}function v(t){return new w(t&gt;&gt;16&amp;255,t&gt;&gt;8&amp;255,255&amp;t,1)}function y(t,e,n,r){return r&lt;=0&amp;&amp;(t=e=n=NaN),new w(t,e,n,r)}function b(t){return t instanceof r||(t=g(t)),t?new w((t=t.rgb()).r,t.g,t.b,t.opacity):new w}function _(t,e,n,r){return 1===arguments.length?b(t):new w(t,e,n,null==r?1:r)}function w(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function x(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))&lt;16?&quot;0&quot;:&quot;&quot;)+t.toString(16)}function E(t,e,n,r){return r&lt;=0?t=e=n=NaN:n&lt;=0||n&gt;=1?t=e=NaN:e&lt;=0&amp;&amp;(t=NaN),new T(t,e,n,r)}function k(t,e,n,i){return 1===arguments.length?function(t){if(t instanceof T)return new T(t.h,t.s,t.l,t.opacity);if(t instanceof r||(t=g(t)),!t)return new T;if(t instanceof T)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,o=Math.min(e,n,i),a=Math.max(e,n,i),s=NaN,u=a-o,l=(a+o)/2;return u?(s=e===a?(n-i)/u+6*(n&lt;i):n===a?(i-e)/u+2:(e-n)/u+4,u/=l&lt;.5?a+o:2-a-o,s*=60):u=l&gt;0&amp;&amp;l&lt;1?0:s,new T(s,u,l,t.opacity)}(t):new T(t,e,n,null==i?1:i)}function T(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function N(t,e,n){return 255*(t&lt;60?e+(n-e)*t/60:t&lt;180?n:t&lt;240?e+(n-e)*(240-t)/60:e)}e(r,g,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+&quot;&quot;}}),e(w,_,n(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0&lt;=this.r&amp;&amp;this.r&lt;=255&amp;&amp;0&lt;=this.g&amp;&amp;this.g&lt;=255&amp;&amp;0&lt;=this.b&amp;&amp;this.b&lt;=255&amp;&amp;0&lt;=this.opacity&amp;&amp;this.opacity&lt;=1},hex:function(){return&quot;#&quot;+x(this.r)+x(this.g)+x(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?&quot;rgb(&quot;:&quot;rgba(&quot;)+Math.max(0,Math.min(255,Math.round(this.r)||0))+&quot;, &quot;+Math.max(0,Math.min(255,Math.round(this.g)||0))+&quot;, &quot;+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?&quot;)&quot;:&quot;, &quot;+t+&quot;)&quot;)}})),e(T,k,n(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new T(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new T(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h&lt;0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n&lt;.5?n:1-n)*e,i=2*n-r;return new w(N(t&gt;=240?t-240:t+120,i,r),N(t,i,r),N(t&lt;120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0&lt;=this.s&amp;&amp;this.s&lt;=1||isNaN(this.s))&amp;&amp;0&lt;=this.l&amp;&amp;this.l&lt;=1&amp;&amp;0&lt;=this.opacity&amp;&amp;this.opacity&lt;=1}}));var S=Math.PI/180,C=180/Math.PI,A=.96422,I=1,O=.82521,M=4/29,R=6/29,P=3*R*R,D=R*R*R;function z(t){if(t instanceof F)return new F(t.l,t.a,t.b,t.opacity);if(t instanceof W){if(isNaN(t.h))return new F(t.l,0,0,t.opacity);var e=t.h*S;return new F(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof w||(t=b(t));var n,r,i=q(t.r),o=q(t.g),a=q(t.b),s=V((.2225045*i+.7168786*o+.0606169*a)/I);return i===o&amp;&amp;o===a?n=r=s:(n=V((.4360747*i+.3850649*o+.1430804*a)/A),r=V((.0139322*i+.0971045*o+.7141733*a)/O)),new F(116*s-16,500*(n-s),200*(s-r),t.opacity)}function L(t,e,n,r){return 1===arguments.length?z(t):new F(t,e,n,null==r?1:r)}function F(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function V(t){return t&gt;D?Math.pow(t,1/3):t/P+M}function B(t){return t&gt;R?t*t*t:P*(t-M)}function j(t){return 255*(t&lt;=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function q(t){return(t/=255)&lt;=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function U(t){if(t instanceof W)return new W(t.h,t.c,t.l,t.opacity);if(t instanceof F||(t=z(t)),0===t.a&amp;&amp;0===t.b)return new W(NaN,0,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*C;return new W(e&lt;0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function G(t,e,n,r){return 1===arguments.length?U(t):new W(t,e,n,null==r?1:r)}function W(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}e(F,L,n(r,{brighter:function(t){return new F(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new F(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new w(j(3.1338561*(e=A*B(e))-1.6168667*(t=I*B(t))-.4906146*(n=O*B(n))),j(-.9787684*e+1.9161415*t+.033454*n),j(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),e(W,G,n(r,{brighter:function(t){return new W(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new W(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return z(this).rgb()}}));var H=-.14861,$=1.78277,K=-.29227,Y=-.90649,X=1.97294,Z=X*Y,Q=X*$,J=$*K-Y*H;function tt(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof et)return new et(t.h,t.s,t.l,t.opacity);t instanceof w||(t=b(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(J*r+Z*e-Q*n)/(J+Z-Q),o=r-i,a=(X*(n-i)-K*o)/Y,s=Math.sqrt(a*a+o*o)/(X*i*(1-i)),u=s?Math.atan2(a,o)*C-120:NaN;return new et(u&lt;0?u+360:u,s,i,t.opacity)}(t):new et(t,e,n,null==r?1:r)}function et(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}e(et,tt,n(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new et(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new et(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*S,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new w(255*(e+n*(H*r+$*i)),255*(e+n*(K*r+Y*i)),255*(e+n*(X*r)),this.opacity)}})),t.color=g,t.rgb=_,t.hsl=k,t.lab=L,t.hcl=G,t.lch=function(t,e,n,r){return 1===arguments.length?U(t):new W(n,e,t,null==r?1:r)},t.gray=function(t,e){return new F(t,0,0,null==e?1:e)},t.cubehelix=tt,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],310:[function(t,e,n){var r,i;r=this,i=function(t,e){&quot;use strict&quot;;var n=Array.prototype.slice;function r(t,e){return t-e}function i(t){return function(){return t}}function o(t,e){for(var n,r=-1,i=e.length;++r&lt;i;)if(n=a(t,e[r]))return n;return 0}function a(t,e){for(var n=e[0],r=e[1],i=-1,o=0,a=t.length,u=a-1;o&lt;a;u=o++){var l=t[o],c=l[0],f=l[1],p=t[u],h=p[0],d=p[1];if(s(l,p,e))return 0;f&gt;r!=d&gt;r&amp;&amp;n&lt;(h-c)*(r-f)/(d-f)+c&amp;&amp;(i=-i)}return i}function s(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&amp;&amp;(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i&lt;=o&amp;&amp;o&lt;=a||a&lt;=o&amp;&amp;o&lt;=i)}function u(){}var l=[[],[[[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 c(){var t=1,a=1,s=e.thresholdSturges,c=d;function f(t){var n=s(t);if(Array.isArray(n))n=n.slice().sort(r);else{var i=e.extent(t),o=i[0],a=i[1];n=e.tickStep(o,a,n),n=e.range(Math.floor(o/n)*n,Math.floor(a/n)*n,n)}return n.map(function(e){return p(t,e)})}function p(e,n){var r=[],i=[];return function(e,n,r){var i,o,s,u,c,f,p=new Array,d=new Array;i=o=-1,u=e[0]&gt;=n,l[u&lt;&lt;1].forEach(m);for(;++i&lt;t-1;)s=u,u=e[i+1]&gt;=n,l[s|u&lt;&lt;1].forEach(m);l[u&lt;&lt;0].forEach(m);for(;++o&lt;a-1;){for(i=-1,u=e[o*t+t]&gt;=n,c=e[o*t]&gt;=n,l[u&lt;&lt;1|c&lt;&lt;2].forEach(m);++i&lt;t-1;)s=u,u=e[o*t+t+i+1]&gt;=n,f=c,c=e[o*t+i+1]&gt;=n,l[s|u&lt;&lt;1|c&lt;&lt;2|f&lt;&lt;3].forEach(m);l[u|c&lt;&lt;3].forEach(m)}i=-1,c=e[o*t]&gt;=n,l[c&lt;&lt;2].forEach(m);for(;++i&lt;t-1;)f=c,c=e[o*t+i+1]&gt;=n,l[c&lt;&lt;2|f&lt;&lt;3].forEach(m);function m(t){var e,n,a=[t[0][0]+i,t[0][1]+o],s=[t[1][0]+i,t[1][1]+o],u=h(a),l=h(s);(e=d[u])?(n=p[l])?(delete d[e.end],delete p[n.start],e===n?(e.ring.push(s),r(e.ring)):p[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(s),d[e.end=l]=e):(e=p[l])?(n=d[u])?(delete p[e.start],delete d[n.end],e===n?(e.ring.push(s),r(e.ring)):p[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete p[e.start],e.ring.unshift(a),p[e.start=u]=e):p[u]=d[l]={start:u,end:l,ring:[a,s]}}l[c&lt;&lt;3].forEach(m)}(e,n,function(t){c(t,e,n),function(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e&lt;n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}(t)&gt;0?r.push([t]):i.push(t)}),i.forEach(function(t){for(var e,n=0,i=r.length;n&lt;i;++n)if(-1!==o((e=r[n])[0],t))return void e.push(t)}),{type:&quot;MultiPolygon&quot;,value:n,coordinates:r}}function h(e){return 2*e[0]+e[1]*(t+1)*4}function d(e,n,r){e.forEach(function(e){var i,o=e[0],s=e[1],u=0|o,l=0|s,c=n[l*t+u];o&gt;0&amp;&amp;o&lt;t&amp;&amp;u===o&amp;&amp;(i=n[l*t+u-1],e[0]=o+(r-i)/(c-i)-.5),s&gt;0&amp;&amp;s&lt;a&amp;&amp;l===s&amp;&amp;(i=n[(l-1)*t+u],e[1]=s+(r-i)/(c-i)-.5)})}return f.contour=p,f.size=function(e){if(!arguments.length)return[t,a];var n=Math.ceil(e[0]),r=Math.ceil(e[1]);if(!(n&gt;0&amp;&amp;r&gt;0))throw new Error(&quot;invalid size&quot;);return t=n,a=r,f},f.thresholds=function(t){return arguments.length?(s=&quot;function&quot;==typeof t?t:Array.isArray(t)?i(n.call(t)):i(t),f):s},f.smooth=function(t){return arguments.length?(c=t?d:u,f):c===d},f}function f(t,e,n){for(var r=t.width,i=t.height,o=1+(n&lt;&lt;1),a=0;a&lt;i;++a)for(var s=0,u=0;s&lt;r+n;++s)s&lt;r&amp;&amp;(u+=t.data[s+a*r]),s&gt;=n&amp;&amp;(s&gt;=o&amp;&amp;(u-=t.data[s-o+a*r]),e.data[s-n+a*r]=u/Math.min(s+1,r-1+o-s,o))}function p(t,e,n){for(var r=t.width,i=t.height,o=1+(n&lt;&lt;1),a=0;a&lt;r;++a)for(var s=0,u=0;s&lt;i+n;++s)s&lt;i&amp;&amp;(u+=t.data[a+s*r]),s&gt;=n&amp;&amp;(s&gt;=o&amp;&amp;(u-=t.data[a+(s-o)*r]),e.data[a+(s-n)*r]=u/Math.min(s+1,i-1+o-s,o))}function h(t){return t[0]}function d(t){return t[1]}function m(){return 1}t.contours=c,t.contourDensity=function(){var t=h,r=d,o=m,a=960,s=500,u=20,l=2,g=3*u,v=a+2*g&gt;&gt;l,y=s+2*g&gt;&gt;l,b=i(20);function _(n){var i=new Float32Array(v*y),a=new Float32Array(v*y);n.forEach(function(e,n,a){var s=+t(e,n,a)+g&gt;&gt;l,u=+r(e,n,a)+g&gt;&gt;l,c=+o(e,n,a);s&gt;=0&amp;&amp;s&lt;v&amp;&amp;u&gt;=0&amp;&amp;u&lt;y&amp;&amp;(i[s+u*v]+=c)}),f({width:v,height:y,data:i},{width:v,height:y,data:a},u&gt;&gt;l),p({width:v,height:y,data:a},{width:v,height:y,data:i},u&gt;&gt;l),f({width:v,height:y,data:i},{width:v,height:y,data:a},u&gt;&gt;l),p({width:v,height:y,data:a},{width:v,height:y,data:i},u&gt;&gt;l),f({width:v,height:y,data:i},{width:v,height:y,data:a},u&gt;&gt;l),p({width:v,height:y,data:a},{width:v,height:y,data:i},u&gt;&gt;l);var s=b(i);if(!Array.isArray(s)){var h=e.max(i);s=e.tickStep(0,h,s),(s=e.range(0,Math.floor(h/s)*s,s)).shift()}return c().thresholds(s).size([v,y])(i).map(w)}function w(t){return t.value*=Math.pow(2,-2*l),t.coordinates.forEach(x),t}function x(t){t.forEach(E)}function E(t){t.forEach(k)}function k(t){t[0]=t[0]*Math.pow(2,l)-g,t[1]=t[1]*Math.pow(2,l)-g}function T(){return v=a+2*(g=3*u)&gt;&gt;l,y=s+2*g&gt;&gt;l,_}return _.x=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:i(+e),_):t},_.y=function(t){return arguments.length?(r=&quot;function&quot;==typeof t?t:i(+t),_):r},_.weight=function(t){return arguments.length?(o=&quot;function&quot;==typeof t?t:i(+t),_):o},_.size=function(t){if(!arguments.length)return[a,s];var e=Math.ceil(t[0]),n=Math.ceil(t[1]);if(!(e&gt;=0||e&gt;=0))throw new Error(&quot;invalid size&quot;);return a=e,s=n,T()},_.cellSize=function(t){if(!arguments.length)return 1&lt;&lt;l;if(!((t=+t)&gt;=1))throw new Error(&quot;invalid cell size&quot;);return l=Math.floor(Math.log(t)/Math.LN2),T()},_.thresholds=function(t){return arguments.length?(b=&quot;function&quot;==typeof t?t:Array.isArray(t)?i(n.call(t)):i(t),_):b},_.bandwidth=function(t){if(!arguments.length)return Math.sqrt(u*(u+1));if(!((t=+t)&gt;=0))throw new Error(&quot;invalid bandwidth&quot;);return u=Math.round((Math.sqrt(4*t*t+1)-1)/2),T()},_},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-array&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-array&quot;],i):i(r.d3=r.d3||{},r.d3)},{&quot;d3-array&quot;:304}],311:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;var e={value:function(){}};function n(){for(var t,e=0,n=arguments.length,i={};e&lt;n;++e){if(!(t=arguments[e]+&quot;&quot;)||t in i)throw new Error(&quot;illegal type: &quot;+t);i[t]=[]}return new r(i)}function r(t){this._=t}function i(t,e){for(var n,r=0,i=t.length;r&lt;i;++r)if((n=t[r]).name===e)return n.value}function o(t,n,r){for(var i=0,o=t.length;i&lt;o;++i)if(t[i].name===n){t[i]=e,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=r&amp;&amp;t.push({name:n,value:r}),t}r.prototype=n.prototype={constructor:r,on:function(t,e){var n,r,a=this._,s=(r=a,(t+&quot;&quot;).trim().split(/^|\s+/).map(function(t){var e=&quot;&quot;,n=t.indexOf(&quot;.&quot;);if(n&gt;=0&amp;&amp;(e=t.slice(n+1),t=t.slice(0,n)),t&amp;&amp;!r.hasOwnProperty(t))throw new Error(&quot;unknown type: &quot;+t);return{type:t,name:e}})),u=-1,l=s.length;if(!(arguments.length&lt;2)){if(null!=e&amp;&amp;&quot;function&quot;!=typeof e)throw new Error(&quot;invalid callback: &quot;+e);for(;++u&lt;l;)if(n=(t=s[u]).type)a[n]=o(a[n],t.name,e);else if(null==e)for(n in a)a[n]=o(a[n],t.name,null);return this}for(;++u&lt;l;)if((n=(t=s[u]).type)&amp;&amp;(n=i(a[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new r(t)},call:function(t,e){if((n=arguments.length-2)&gt;0)for(var n,r,i=new Array(n),o=0;o&lt;n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error(&quot;unknown type: &quot;+t);for(o=0,n=(r=this._[t]).length;o&lt;n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error(&quot;unknown type: &quot;+t);for(var r=this._[t],i=0,o=r.length;i&lt;o;++i)r[i].value.apply(e,n)}},t.dispatch=n,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],312:[function(t,e,n){var r,i;r=this,i=function(t,e,n){&quot;use strict&quot;;function r(){e.event.stopImmediatePropagation()}function i(){e.event.preventDefault(),e.event.stopImmediatePropagation()}function o(t){var n=t.document.documentElement,r=e.select(t).on(&quot;dragstart.drag&quot;,i,!0);&quot;onselectstart&quot;in n?r.on(&quot;selectstart.drag&quot;,i,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect=&quot;none&quot;)}function a(t,n){var r=t.document.documentElement,o=e.select(t).on(&quot;dragstart.drag&quot;,null);n&amp;&amp;(o.on(&quot;click.drag&quot;,i,!0),setTimeout(function(){o.on(&quot;click.drag&quot;,null)},0)),&quot;onselectstart&quot;in r?o.on(&quot;selectstart.drag&quot;,null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}function s(t){return function(){return t}}function u(t,e,n,r,i,o,a,s,u,l){this.target=t,this.type=e,this.subject=n,this.identifier=r,this.active=i,this.x=o,this.y=a,this.dx=s,this.dy=u,this._=l}function l(){return!e.event.button}function c(){return this.parentNode}function f(t){return null==t?{x:e.event.x,y:e.event.y}:t}function p(){return&quot;ontouchstart&quot;in this}u.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t},t.drag=function(){var t,h,d,m,g=l,v=c,y=f,b=p,_={},w=n.dispatch(&quot;start&quot;,&quot;drag&quot;,&quot;end&quot;),x=0,E=0;function k(t){t.on(&quot;mousedown.drag&quot;,T).filter(b).on(&quot;touchstart.drag&quot;,C).on(&quot;touchmove.drag&quot;,A).on(&quot;touchend.drag touchcancel.drag&quot;,I).style(&quot;touch-action&quot;,&quot;none&quot;).style(&quot;-webkit-tap-highlight-color&quot;,&quot;rgba(0,0,0,0)&quot;)}function T(){if(!m&amp;&amp;g.apply(this,arguments)){var n=O(&quot;mouse&quot;,v.apply(this,arguments),e.mouse,this,arguments);n&amp;&amp;(e.select(e.event.view).on(&quot;mousemove.drag&quot;,N,!0).on(&quot;mouseup.drag&quot;,S,!0),o(e.event.view),r(),d=!1,t=e.event.clientX,h=e.event.clientY,n(&quot;start&quot;))}}function N(){if(i(),!d){var n=e.event.clientX-t,r=e.event.clientY-h;d=n*n+r*r&gt;E}_.mouse(&quot;drag&quot;)}function S(){e.select(e.event.view).on(&quot;mousemove.drag mouseup.drag&quot;,null),a(e.event.view,d),i(),_.mouse(&quot;end&quot;)}function C(){if(g.apply(this,arguments)){var t,n,i=e.event.changedTouches,o=v.apply(this,arguments),a=i.length;for(t=0;t&lt;a;++t)(n=O(i[t].identifier,o,e.touch,this,arguments))&amp;&amp;(r(),n(&quot;start&quot;))}}function A(){var t,n,r=e.event.changedTouches,o=r.length;for(t=0;t&lt;o;++t)(n=_[r[t].identifier])&amp;&amp;(i(),n(&quot;drag&quot;))}function I(){var t,n,i=e.event.changedTouches,o=i.length;for(m&amp;&amp;clearTimeout(m),m=setTimeout(function(){m=null},500),t=0;t&lt;o;++t)(n=_[i[t].identifier])&amp;&amp;(r(),n(&quot;end&quot;))}function O(t,n,r,i,o){var a,s,l,c=r(n,t),f=w.copy();if(e.customEvent(new u(k,&quot;beforestart&quot;,a,t,x,c[0],c[1],0,0,f),function(){return null!=(e.event.subject=a=y.apply(i,o))&amp;&amp;(s=a.x-c[0]||0,l=a.y-c[1]||0,!0)}))return function p(h){var d,m=c;switch(h){case&quot;start&quot;:_[t]=p,d=x++;break;case&quot;end&quot;:delete _[t],--x;case&quot;drag&quot;:c=r(n,t),d=x}e.customEvent(new u(k,h,a,t,d,c[0]+s,c[1]+l,c[0]-m[0],c[1]-m[1],f),f.apply,f,[h,i,o])}}return k.filter=function(t){return arguments.length?(g=&quot;function&quot;==typeof t?t:s(!!t),k):g},k.container=function(t){return arguments.length?(v=&quot;function&quot;==typeof t?t:s(t),k):v},k.subject=function(t){return arguments.length?(y=&quot;function&quot;==typeof t?t:s(t),k):y},k.touchable=function(t){return arguments.length?(b=&quot;function&quot;==typeof t?t:s(!!t),k):b},k.on=function(){var t=w.on.apply(w,arguments);return t===w?k:t},k.clickDistance=function(t){return arguments.length?(E=(t=+t)*t,k):Math.sqrt(E)},k},t.dragDisable=o,t.dragEnable=a,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-selection&quot;),t(&quot;d3-dispatch&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-selection&quot;,&quot;d3-dispatch&quot;],i):i(r.d3=r.d3||{},r.d3,r.d3)},{&quot;d3-dispatch&quot;:311,&quot;d3-selection&quot;:327}],313:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;var e={},n={},r=34,i=10,o=13;function a(t){return new Function(&quot;d&quot;,&quot;return {&quot;+t.map(function(t,e){return JSON.stringify(t)+&quot;: d[&quot;+e+&quot;]&quot;}).join(&quot;,&quot;)+&quot;}&quot;)}function s(t){var e=Object.create(null),n=[];return t.forEach(function(t){for(var r in t)r in e||n.push(e[r]=r)}),n}function u(t,e){var n=t+&quot;&quot;,r=n.length;return r&lt;e?new Array(e-r+1).join(0)+n:n}function l(t){var e,n=t.getUTCHours(),r=t.getUTCMinutes(),i=t.getUTCSeconds(),o=t.getUTCMilliseconds();return isNaN(t)?&quot;Invalid Date&quot;:((e=t.getUTCFullYear())&lt;0?&quot;-&quot;+u(-e,6):e&gt;9999?&quot;+&quot;+u(e,6):u(e,4))+&quot;-&quot;+u(t.getUTCMonth()+1,2)+&quot;-&quot;+u(t.getUTCDate(),2)+(o?&quot;T&quot;+u(n,2)+&quot;:&quot;+u(r,2)+&quot;:&quot;+u(i,2)+&quot;.&quot;+u(o,3)+&quot;Z&quot;:i?&quot;T&quot;+u(n,2)+&quot;:&quot;+u(r,2)+&quot;:&quot;+u(i,2)+&quot;Z&quot;:r||n?&quot;T&quot;+u(n,2)+&quot;:&quot;+u(r,2)+&quot;Z&quot;:&quot;&quot;)}function c(t){var u=new RegExp(&apos;[&quot;&apos;+t+&quot;\n\r]&quot;),c=t.charCodeAt(0);function f(t,a){var s,u=[],l=t.length,f=0,p=0,h=l&lt;=0,d=!1;function m(){if(h)return n;if(d)return d=!1,e;var a,s,u=f;if(t.charCodeAt(u)===r){for(;f++&lt;l&amp;&amp;t.charCodeAt(f)!==r||t.charCodeAt(++f)===r;);return(a=f)&gt;=l?h=!0:(s=t.charCodeAt(f++))===i?d=!0:s===o&amp;&amp;(d=!0,t.charCodeAt(f)===i&amp;&amp;++f),t.slice(u+1,a-1).replace(/&quot;&quot;/g,&apos;&quot;&apos;)}for(;f&lt;l;){if((s=t.charCodeAt(a=f++))===i)d=!0;else if(s===o)d=!0,t.charCodeAt(f)===i&amp;&amp;++f;else if(s!==c)continue;return t.slice(u,a)}return h=!0,t.slice(u,l)}for(t.charCodeAt(l-1)===i&amp;&amp;--l,t.charCodeAt(l-1)===o&amp;&amp;--l;(s=m())!==n;){for(var g=[];s!==e&amp;&amp;s!==n;)g.push(s),s=m();a&amp;&amp;null==(g=a(g,p++))||u.push(g)}return u}function p(e,n){return e.map(function(e){return n.map(function(t){return d(e[t])}).join(t)})}function h(e){return e.map(d).join(t)}function d(t){return null==t?&quot;&quot;:t instanceof Date?l(t):u.test(t+=&quot;&quot;)?&apos;&quot;&apos;+t.replace(/&quot;/g,&apos;&quot;&quot;&apos;)+&apos;&quot;&apos;:t}return{parse:function(t,e){var n,r,i=f(t,function(t,i){if(n)return n(t,i-1);r=t,n=e?function(t,e){var n=a(t);return function(r,i){return e(n(r),i,t)}}(t,e):a(t)});return i.columns=r||[],i},parseRows:f,format:function(e,n){return null==n&amp;&amp;(n=s(e)),[n.map(d).join(t)].concat(p(e,n)).join(&quot;\n&quot;)},formatBody:function(t,e){return null==e&amp;&amp;(e=s(t)),p(t,e).join(&quot;\n&quot;)},formatRows:function(t){return t.map(h).join(&quot;\n&quot;)}}}var f=c(&quot;,&quot;),p=f.parse,h=f.parseRows,d=f.format,m=f.formatBody,g=f.formatRows,v=c(&quot;\t&quot;),y=v.parse,b=v.parseRows,_=v.format,w=v.formatBody,x=v.formatRows;t.dsvFormat=c,t.csvParse=p,t.csvParseRows=h,t.csvFormat=d,t.csvFormatBody=m,t.csvFormatRows=g,t.tsvParse=y,t.tsvParseRows=b,t.tsvFormat=_,t.tsvFormatBody=w,t.tsvFormatRows=x,t.autoType=function(t){for(var e in t){var n,r=t[e].trim();if(r)if(&quot;true&quot;===r)r=!0;else if(&quot;false&quot;===r)r=!1;else if(&quot;NaN&quot;===r)r=NaN;else if(isNaN(n=+r)){if(!/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/.test(r))continue;r=new Date(r)}else r=n;else r=null;t[e]=r}return t},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],314:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;function e(t){return((t*=2)&lt;=1?t*t:--t*(2-t)+1)/2}function n(t){return((t*=2)&lt;=1?t*t*t:(t-=2)*t*t+2)/2}var r=function t(e){function n(t){return Math.pow(t,e)}return e=+e,n.exponent=t,n}(3),i=function t(e){function n(t){return 1-Math.pow(1-t,e)}return e=+e,n.exponent=t,n}(3),o=function t(e){function n(t){return((t*=2)&lt;=1?Math.pow(t,e):2-Math.pow(2-t,e))/2}return e=+e,n.exponent=t,n}(3),a=Math.PI,s=a/2;function u(t){return(1-Math.cos(a*t))/2}function l(t){return((t*=2)&lt;=1?Math.pow(2,10*t-10):2-Math.pow(2,10-10*t))/2}function c(t){return((t*=2)&lt;=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var f=4/11,p=6/11,h=8/11,d=.75,m=9/11,g=10/11,v=.9375,y=21/22,b=63/64,_=1/f/f;function w(t){return(t=+t)&lt;f?_*t*t:t&lt;h?_*(t-=p)*t+d:t&lt;g?_*(t-=m)*t+v:_*(t-=y)*t+b}var x=function t(e){function n(t){return t*t*((e+1)*t-e)}return e=+e,n.overshoot=t,n}(1.70158),E=function t(e){function n(t){return--t*t*((e+1)*t+e)+1}return e=+e,n.overshoot=t,n}(1.70158),k=function t(e){function n(t){return((t*=2)&lt;1?t*t*((e+1)*t-e):(t-=2)*t*((e+1)*t+e)+2)/2}return e=+e,n.overshoot=t,n}(1.70158),T=2*Math.PI,N=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=T);function i(t){return e*Math.pow(2,10*--t)*Math.sin((r-t)/n)}return i.amplitude=function(e){return t(e,n*T)},i.period=function(n){return t(e,n)},i}(1,.3),S=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=T);function i(t){return 1-e*Math.pow(2,-10*(t=+t))*Math.sin((t+r)/n)}return i.amplitude=function(e){return t(e,n*T)},i.period=function(n){return t(e,n)},i}(1,.3),C=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=T);function i(t){return((t=2*t-1)&lt;0?e*Math.pow(2,10*t)*Math.sin((r-t)/n):2-e*Math.pow(2,-10*t)*Math.sin((r+t)/n))/2}return i.amplitude=function(e){return t(e,n*T)},i.period=function(n){return t(e,n)},i}(1,.3);t.easeLinear=function(t){return+t},t.easeQuad=e,t.easeQuadIn=function(t){return t*t},t.easeQuadOut=function(t){return t*(2-t)},t.easeQuadInOut=e,t.easeCubic=n,t.easeCubicIn=function(t){return t*t*t},t.easeCubicOut=function(t){return--t*t*t+1},t.easeCubicInOut=n,t.easePoly=o,t.easePolyIn=r,t.easePolyOut=i,t.easePolyInOut=o,t.easeSin=u,t.easeSinIn=function(t){return 1-Math.cos(t*s)},t.easeSinOut=function(t){return Math.sin(t*s)},t.easeSinInOut=u,t.easeExp=l,t.easeExpIn=function(t){return Math.pow(2,10*t-10)},t.easeExpOut=function(t){return 1-Math.pow(2,-10*t)},t.easeExpInOut=l,t.easeCircle=c,t.easeCircleIn=function(t){return 1-Math.sqrt(1-t*t)},t.easeCircleOut=function(t){return Math.sqrt(1- --t*t)},t.easeCircleInOut=c,t.easeBounce=w,t.easeBounceIn=function(t){return 1-w(1-t)},t.easeBounceOut=w,t.easeBounceInOut=function(t){return((t*=2)&lt;=1?1-w(1-t):w(t-1)+1)/2},t.easeBack=k,t.easeBackIn=x,t.easeBackOut=E,t.easeBackInOut=k,t.easeElastic=S,t.easeElasticIn=N,t.easeElasticOut=S,t.easeElasticInOut=C,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],315:[function(t,e,n){var r,i;r=this,i=function(t,e){&quot;use strict&quot;;function n(t){if(!t.ok)throw new Error(t.status+&quot; &quot;+t.statusText);return t.blob()}function r(t){if(!t.ok)throw new Error(t.status+&quot; &quot;+t.statusText);return t.arrayBuffer()}function i(t){if(!t.ok)throw new Error(t.status+&quot; &quot;+t.statusText);return t.text()}function o(t,e){return fetch(t,e).then(i)}function a(t){return function(e,n,r){return 2===arguments.length&amp;&amp;&quot;function&quot;==typeof n&amp;&amp;(r=n,n=void 0),o(e,n).then(function(e){return t(e,r)})}}var s=a(e.csvParse),u=a(e.tsvParse);function l(t){if(!t.ok)throw new Error(t.status+&quot; &quot;+t.statusText);return t.json()}function c(t){return function(e,n){return o(e,n).then(function(e){return(new DOMParser).parseFromString(e,t)})}}var f=c(&quot;application/xml&quot;),p=c(&quot;text/html&quot;),h=c(&quot;image/svg+xml&quot;);t.blob=function(t,e){return fetch(t,e).then(n)},t.buffer=function(t,e){return fetch(t,e).then(r)},t.dsv=function(t,n,r,i){3===arguments.length&amp;&amp;&quot;function&quot;==typeof r&amp;&amp;(i=r,r=void 0);var a=e.dsvFormat(t);return o(n,r).then(function(t){return a.parse(t,i)})},t.csv=s,t.tsv=u,t.image=function(t,e){return new Promise(function(n,r){var i=new Image;for(var o in e)i[o]=e[o];i.onerror=r,i.onload=function(){n(i)},i.src=t})},t.json=function(t,e){return fetch(t,e).then(l)},t.text=o,t.xml=f,t.html=p,t.svg=h,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-dsv&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-dsv&quot;],i):i(r.d3=r.d3||{},r.d3)},{&quot;d3-dsv&quot;:313}],316:[function(t,e,n){var r,i;r=this,i=function(t,e,n,r,i){&quot;use strict&quot;;function o(t){return function(){return t}}function a(){return 1e-6*(Math.random()-.5)}function s(t){return t.x+t.vx}function u(t){return t.y+t.vy}function l(t){return t.index}function c(t,e){var n=t.get(e);if(!n)throw new Error(&quot;missing: &quot;+e);return n}function f(t){return t.x}function p(t){return t.y}var h=10,d=Math.PI*(3-Math.sqrt(5));t.forceCenter=function(t,e){var n;function r(){var r,i,o=n.length,a=0,s=0;for(r=0;r&lt;o;++r)a+=(i=n[r]).x,s+=i.y;for(a=a/o-t,s=s/o-e,r=0;r&lt;o;++r)(i=n[r]).x-=a,i.y-=s}return null==t&amp;&amp;(t=0),null==e&amp;&amp;(e=0),r.initialize=function(t){n=t},r.x=function(e){return arguments.length?(t=+e,r):t},r.y=function(t){return arguments.length?(e=+t,r):e},r},t.forceCollide=function(t){var n,r,i=1,l=1;function c(){for(var t,o,c,p,h,d,m,g=n.length,v=0;v&lt;l;++v)for(o=e.quadtree(n,s,u).visitAfter(f),t=0;t&lt;g;++t)c=n[t],d=r[c.index],m=d*d,p=c.x+c.vx,h=c.y+c.vy,o.visit(y);function y(t,e,n,r,o){var s=t.data,u=t.r,l=d+u;if(!s)return e&gt;p+l||r&lt;p-l||n&gt;h+l||o&lt;h-l;if(s.index&gt;c.index){var f=p-s.x-s.vx,g=h-s.y-s.vy,v=f*f+g*g;v&lt;l*l&amp;&amp;(0===f&amp;&amp;(v+=(f=a())*f),0===g&amp;&amp;(v+=(g=a())*g),v=(l-(v=Math.sqrt(v)))/v*i,c.vx+=(f*=v)*(l=(u*=u)/(m+u)),c.vy+=(g*=v)*l,s.vx-=f*(l=1-l),s.vy-=g*l)}}}function f(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e&lt;4;++e)t[e]&amp;&amp;t[e].r&gt;t.r&amp;&amp;(t.r=t[e].r)}function p(){if(n){var e,i,o=n.length;for(r=new Array(o),e=0;e&lt;o;++e)i=n[e],r[i.index]=+t(i,e,n)}}return&quot;function&quot;!=typeof t&amp;&amp;(t=o(null==t?1:+t)),c.initialize=function(t){n=t,p()},c.iterations=function(t){return arguments.length?(l=+t,c):l},c.strength=function(t){return arguments.length?(i=+t,c):i},c.radius=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:o(+e),p(),c):t},c},t.forceLink=function(t){var e,r,i,s,u,f=l,p=function(t){return 1/Math.min(s[t.source.index],s[t.target.index])},h=o(30),d=1;function m(n){for(var i=0,o=t.length;i&lt;d;++i)for(var s,l,c,f,p,h,m,g=0;g&lt;o;++g)l=(s=t[g]).source,f=(c=s.target).x+c.vx-l.x-l.vx||a(),p=c.y+c.vy-l.y-l.vy||a(),f*=h=((h=Math.sqrt(f*f+p*p))-r[g])/h*n*e[g],p*=h,c.vx-=f*(m=u[g]),c.vy-=p*m,l.vx+=f*(m=1-m),l.vy+=p*m}function g(){if(i){var o,a,l=i.length,p=t.length,h=n.map(i,f);for(o=0,s=new Array(l);o&lt;p;++o)(a=t[o]).index=o,&quot;object&quot;!=typeof a.source&amp;&amp;(a.source=c(h,a.source)),&quot;object&quot;!=typeof a.target&amp;&amp;(a.target=c(h,a.target)),s[a.source.index]=(s[a.source.index]||0)+1,s[a.target.index]=(s[a.target.index]||0)+1;for(o=0,u=new Array(p);o&lt;p;++o)a=t[o],u[o]=s[a.source.index]/(s[a.source.index]+s[a.target.index]);e=new Array(p),v(),r=new Array(p),y()}}function v(){if(i)for(var n=0,r=t.length;n&lt;r;++n)e[n]=+p(t[n],n,t)}function y(){if(i)for(var e=0,n=t.length;e&lt;n;++e)r[e]=+h(t[e],e,t)}return null==t&amp;&amp;(t=[]),m.initialize=function(t){i=t,g()},m.links=function(e){return arguments.length?(t=e,g(),m):t},m.id=function(t){return arguments.length?(f=t,m):f},m.iterations=function(t){return arguments.length?(d=+t,m):d},m.strength=function(t){return arguments.length?(p=&quot;function&quot;==typeof t?t:o(+t),v(),m):p},m.distance=function(t){return arguments.length?(h=&quot;function&quot;==typeof t?t:o(+t),y(),m):h},m},t.forceManyBody=function(){var t,n,r,i,s=o(-30),u=1,l=1/0,c=.81;function h(i){var o,a=t.length,s=e.quadtree(t,f,p).visitAfter(m);for(r=i,o=0;o&lt;a;++o)n=t[o],s.visit(g)}function d(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e&lt;r;++e)n=t[e],i[n.index]=+s(n,e,t)}}function m(t){var e,n,r,o,a,s=0,u=0;if(t.length){for(r=o=a=0;a&lt;4;++a)(e=t[a])&amp;&amp;(n=Math.abs(e.value))&amp;&amp;(s+=e.value,u+=n,r+=n*e.x,o+=n*e.y);t.x=r/u,t.y=o/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=i[e.data.index]}while(e=e.next)}t.value=s}function g(t,e,o,s){if(!t.value)return!0;var f=t.x-n.x,p=t.y-n.y,h=s-e,d=f*f+p*p;if(h*h/c&lt;d)return d&lt;l&amp;&amp;(0===f&amp;&amp;(d+=(f=a())*f),0===p&amp;&amp;(d+=(p=a())*p),d&lt;u&amp;&amp;(d=Math.sqrt(u*d)),n.vx+=f*t.value*r/d,n.vy+=p*t.value*r/d),!0;if(!(t.length||d&gt;=l)){(t.data!==n||t.next)&amp;&amp;(0===f&amp;&amp;(d+=(f=a())*f),0===p&amp;&amp;(d+=(p=a())*p),d&lt;u&amp;&amp;(d=Math.sqrt(u*d)));do{t.data!==n&amp;&amp;(h=i[t.data.index]*r/d,n.vx+=f*h,n.vy+=p*h)}while(t=t.next)}}return h.initialize=function(e){t=e,d()},h.strength=function(t){return arguments.length?(s=&quot;function&quot;==typeof t?t:o(+t),d(),h):s},h.distanceMin=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h.distanceMax=function(t){return arguments.length?(l=t*t,h):Math.sqrt(l)},h.theta=function(t){return arguments.length?(c=t*t,h):Math.sqrt(c)},h},t.forceRadial=function(t,e,n){var r,i,a,s=o(.1);function u(t){for(var o=0,s=r.length;o&lt;s;++o){var u=r[o],l=u.x-e||1e-6,c=u.y-n||1e-6,f=Math.sqrt(l*l+c*c),p=(a[o]-f)*i[o]*t/f;u.vx+=l*p,u.vy+=c*p}}function l(){if(r){var e,n=r.length;for(i=new Array(n),a=new Array(n),e=0;e&lt;n;++e)a[e]=+t(r[e],e,r),i[e]=isNaN(a[e])?0:+s(r[e],e,r)}}return&quot;function&quot;!=typeof t&amp;&amp;(t=o(+t)),null==e&amp;&amp;(e=0),null==n&amp;&amp;(n=0),u.initialize=function(t){r=t,l()},u.strength=function(t){return arguments.length?(s=&quot;function&quot;==typeof t?t:o(+t),l(),u):s},u.radius=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:o(+e),l(),u):t},u.x=function(t){return arguments.length?(e=+t,u):e},u.y=function(t){return arguments.length?(n=+t,u):n},u},t.forceSimulation=function(t){var e,o=1,a=.001,s=1-Math.pow(a,1/300),u=0,l=.6,c=n.map(),f=i.timer(m),p=r.dispatch(&quot;tick&quot;,&quot;end&quot;);function m(){g(),p.call(&quot;tick&quot;,e),o&lt;a&amp;&amp;(f.stop(),p.call(&quot;end&quot;,e))}function g(n){var r,i,a=t.length;void 0===n&amp;&amp;(n=1);for(var f=0;f&lt;n;++f)for(o+=(u-o)*s,c.each(function(t){t(o)}),r=0;r&lt;a;++r)null==(i=t[r]).fx?i.x+=i.vx*=l:(i.x=i.fx,i.vx=0),null==i.fy?i.y+=i.vy*=l:(i.y=i.fy,i.vy=0);return e}function v(){for(var e,n=0,r=t.length;n&lt;r;++n){if((e=t[n]).index=n,null!=e.fx&amp;&amp;(e.x=e.fx),null!=e.fy&amp;&amp;(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=h*Math.sqrt(n),o=n*d;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&amp;&amp;(e.vx=e.vy=0)}}function y(e){return e.initialize&amp;&amp;e.initialize(t),e}return null==t&amp;&amp;(t=[]),v(),e={tick:g,restart:function(){return f.restart(m),e},stop:function(){return f.stop(),e},nodes:function(n){return arguments.length?(t=n,v(),c.each(y),e):t},alpha:function(t){return arguments.length?(o=+t,e):o},alphaMin:function(t){return arguments.length?(a=+t,e):a},alphaDecay:function(t){return arguments.length?(s=+t,e):+s},alphaTarget:function(t){return arguments.length?(u=+t,e):u},velocityDecay:function(t){return arguments.length?(l=1-t,e):1-l},force:function(t,n){return arguments.length&gt;1?(null==n?c.remove(t):c.set(t,y(n)),e):c.get(t)},find:function(e,n,r){var i,o,a,s,u,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l&lt;c;++l)(a=(i=e-(s=t[l]).x)*i+(o=n-s.y)*o)&lt;r&amp;&amp;(u=s,r=a);return u},on:function(t,n){return arguments.length&gt;1?(p.on(t,n),e):p.on(t)}}},t.forceX=function(t){var e,n,r,i=o(.1);function a(t){for(var i,o=0,a=e.length;o&lt;a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function s(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o&lt;a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return&quot;function&quot;!=typeof t&amp;&amp;(t=o(null==t?0:+t)),a.initialize=function(t){e=t,s()},a.strength=function(t){return arguments.length?(i=&quot;function&quot;==typeof t?t:o(+t),s(),a):i},a.x=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:o(+e),s(),a):t},a},t.forceY=function(t){var e,n,r,i=o(.1);function a(t){for(var i,o=0,a=e.length;o&lt;a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function s(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o&lt;a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return&quot;function&quot;!=typeof t&amp;&amp;(t=o(null==t?0:+t)),a.initialize=function(t){e=t,s()},a.strength=function(t){return arguments.length?(i=&quot;function&quot;==typeof t?t:o(+t),s(),a):i},a.y=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:o(+e),s(),a):t},a},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-quadtree&quot;),t(&quot;d3-collection&quot;),t(&quot;d3-dispatch&quot;),t(&quot;d3-timer&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-quadtree&quot;,&quot;d3-collection&quot;,&quot;d3-dispatch&quot;,&quot;d3-timer&quot;],i):i(r.d3=r.d3||{},r.d3,r.d3,r.d3,r.d3)},{&quot;d3-collection&quot;:308,&quot;d3-dispatch&quot;:311,&quot;d3-quadtree&quot;:323,&quot;d3-timer&quot;:331}],317:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;function e(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf(&quot;e&quot;))&lt;0)return null;var n,r=t.slice(0,n);return[r.length&gt;1?r[0]+r.slice(2):r,+t.slice(n+1)]}function n(t){return(t=e(Math.abs(t)))?t[1]:NaN}var r,i=/^(?:(.)?([&lt;&gt;=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function o(t){return new a(t)}function a(t){if(!(e=i.exec(t)))throw new Error(&quot;invalid format: &quot;+t);var e;this.fill=e[1]||&quot; &quot;,this.align=e[2]||&quot;&gt;&quot;,this.sign=e[3]||&quot;-&quot;,this.symbol=e[4]||&quot;&quot;,this.zero=!!e[5],this.width=e[6]&amp;&amp;+e[6],this.comma=!!e[7],this.precision=e[8]&amp;&amp;+e[8].slice(1),this.trim=!!e[9],this.type=e[10]||&quot;&quot;}function s(t,n){var r=e(t,n);if(!r)return t+&quot;&quot;;var i=r[0],o=r[1];return o&lt;0?&quot;0.&quot;+new Array(-o).join(&quot;0&quot;)+i:i.length&gt;o+1?i.slice(0,o+1)+&quot;.&quot;+i.slice(o+1):i+new Array(o-i.length+2).join(&quot;0&quot;)}o.prototype=a.prototype,a.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?&quot;0&quot;:&quot;&quot;)+(null==this.width?&quot;&quot;:Math.max(1,0|this.width))+(this.comma?&quot;,&quot;:&quot;&quot;)+(null==this.precision?&quot;&quot;:&quot;.&quot;+Math.max(0,0|this.precision))+(this.trim?&quot;~&quot;:&quot;&quot;)+this.type};var u={&quot;%&quot;:function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+&quot;&quot;},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return s(100*t,e)},r:s,s:function(t,n){var i=e(t,n);if(!i)return t+&quot;&quot;;var o=i[0],a=i[1],s=a-(r=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,u=o.length;return s===u?o:s&gt;u?o+new Array(s-u+1).join(&quot;0&quot;):s&gt;0?o.slice(0,s)+&quot;.&quot;+o.slice(s):&quot;0.&quot;+new Array(1-s).join(&quot;0&quot;)+e(t,Math.max(0,n+s-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function l(t){return t}var c,f=[&quot;y&quot;,&quot;z&quot;,&quot;a&quot;,&quot;f&quot;,&quot;p&quot;,&quot;n&quot;,&quot;µ&quot;,&quot;m&quot;,&quot;&quot;,&quot;k&quot;,&quot;M&quot;,&quot;G&quot;,&quot;T&quot;,&quot;P&quot;,&quot;E&quot;,&quot;Z&quot;,&quot;Y&quot;];function p(t){var e,i,a=t.grouping&amp;&amp;t.thousands?(e=t.grouping,i=t.thousands,function(t,n){for(var r=t.length,o=[],a=0,s=e[0],u=0;r&gt;0&amp;&amp;s&gt;0&amp;&amp;(u+s+1&gt;n&amp;&amp;(s=Math.max(1,n-u)),o.push(t.substring(r-=s,r+s)),!((u+=s+1)&gt;n));)s=e[a=(a+1)%e.length];return o.reverse().join(i)}):l,s=t.currency,c=t.decimal,p=t.numerals?function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(t.numerals):l,h=t.percent||&quot;%&quot;;function d(t){var e=(t=o(t)).fill,n=t.align,i=t.sign,l=t.symbol,d=t.zero,m=t.width,g=t.comma,v=t.precision,y=t.trim,b=t.type;&quot;n&quot;===b?(g=!0,b=&quot;g&quot;):u[b]||(null==v&amp;&amp;(v=12),y=!0,b=&quot;g&quot;),(d||&quot;0&quot;===e&amp;&amp;&quot;=&quot;===n)&amp;&amp;(d=!0,e=&quot;0&quot;,n=&quot;=&quot;);var _=&quot;$&quot;===l?s[0]:&quot;#&quot;===l&amp;&amp;/[boxX]/.test(b)?&quot;0&quot;+b.toLowerCase():&quot;&quot;,w=&quot;$&quot;===l?s[1]:/[%p]/.test(b)?h:&quot;&quot;,x=u[b],E=/[defgprs%]/.test(b);function k(t){var o,s,u,l=_,h=w;if(&quot;c&quot;===b)h=x(t)+h,t=&quot;&quot;;else{var k=(t=+t)&lt;0;if(t=x(Math.abs(t),v),y&amp;&amp;(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r&lt;n;++r)switch(t[r]){case&quot;.&quot;:i=e=r;break;case&quot;0&quot;:0===i&amp;&amp;(i=r),e=r;break;default:if(i&gt;0){if(!+t[r])break t;i=0}}return i&gt;0?t.slice(0,i)+t.slice(e+1):t}(t)),k&amp;&amp;0==+t&amp;&amp;(k=!1),l=(k?&quot;(&quot;===i?i:&quot;-&quot;:&quot;-&quot;===i||&quot;(&quot;===i?&quot;&quot;:i)+l,h=(&quot;s&quot;===b?f[8+r/3]:&quot;&quot;)+h+(k&amp;&amp;&quot;(&quot;===i?&quot;)&quot;:&quot;&quot;),E)for(o=-1,s=t.length;++o&lt;s;)if(48&gt;(u=t.charCodeAt(o))||u&gt;57){h=(46===u?c+t.slice(o+1):t.slice(o))+h,t=t.slice(0,o);break}}g&amp;&amp;!d&amp;&amp;(t=a(t,1/0));var T=l.length+t.length+h.length,N=T&lt;m?new Array(m-T+1).join(e):&quot;&quot;;switch(g&amp;&amp;d&amp;&amp;(t=a(N+t,N.length?m-h.length:1/0),N=&quot;&quot;),n){case&quot;&lt;&quot;:t=l+t+h+N;break;case&quot;=&quot;:t=l+N+t+h;break;case&quot;^&quot;:t=N.slice(0,T=N.length&gt;&gt;1)+l+t+h+N.slice(T);break;default:t=N+l+t+h}return p(t)}return v=null==v?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),k.toString=function(){return t+&quot;&quot;},k}return{format:d,formatPrefix:function(t,e){var r=d(((t=o(t)).type=&quot;f&quot;,t)),i=3*Math.max(-8,Math.min(8,Math.floor(n(e)/3))),a=Math.pow(10,-i),s=f[8+i/3];return function(t){return r(a*t)+s}}}}function h(e){return c=p(e),t.format=c.format,t.formatPrefix=c.formatPrefix,c}h({decimal:&quot;.&quot;,thousands:&quot;,&quot;,grouping:[3],currency:[&quot;$&quot;,&quot;&quot;]}),t.formatDefaultLocale=h,t.formatLocale=p,t.formatSpecifier=o,t.precisionFixed=function(t){return Math.max(0,-n(Math.abs(t)))},t.precisionPrefix=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(n(e)/3)))-n(Math.abs(t)))},t.precisionRound=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,n(e)-n(t))+1},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],318:[function(t,e,n){var r,i;r=this,i=function(t,e){&quot;use strict&quot;;function n(){return new r}function r(){this.reset()}r.prototype={constructor:r,reset:function(){this.s=this.t=0},add:function(t){o(i,t,this.t),o(this,i.s,this.s),this.s?this.t+=i.t:this.s=i.t},valueOf:function(){return this.s}};var i=new r;function o(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var a=1e-6,s=1e-12,u=Math.PI,l=u/2,c=u/4,f=2*u,p=180/u,h=u/180,d=Math.abs,m=Math.atan,g=Math.atan2,v=Math.cos,y=Math.ceil,b=Math.exp,_=Math.log,w=Math.pow,x=Math.sin,E=Math.sign||function(t){return t&gt;0?1:t&lt;0?-1:0},k=Math.sqrt,T=Math.tan;function N(t){return t&gt;1?0:t&lt;-1?u:Math.acos(t)}function S(t){return t&gt;1?l:t&lt;-1?-l:Math.asin(t)}function C(t){return(t=x(t/2))*t}function A(){}function I(t,e){t&amp;&amp;M.hasOwnProperty(t.type)&amp;&amp;M[t.type](t,e)}var O={Feature:function(t,e){I(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r&lt;i;)I(n[r].geometry,e)}},M={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r&lt;i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){R(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r&lt;i;)R(n[r],e,0)},Polygon:function(t,e){P(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r&lt;i;)P(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r&lt;i;)I(n[r],e)}};function R(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i&lt;o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function P(t,e){var n=-1,r=t.length;for(e.polygonStart();++n&lt;r;)R(t[n],e,1);e.polygonEnd()}function D(t,e){t&amp;&amp;O.hasOwnProperty(t.type)?O[t.type](t,e):I(t,e)}var z,L,F,V,B,j=n(),q=n(),U={point:A,lineStart:A,lineEnd:A,polygonStart:function(){j.reset(),U.lineStart=G,U.lineEnd=W},polygonEnd:function(){var t=+j;q.add(t&lt;0?f+t:t),this.lineStart=this.lineEnd=this.point=A},sphere:function(){q.add(f)}};function G(){U.point=H}function W(){$(z,L)}function H(t,e){U.point=$,z=t,L=e,F=t*=h,V=v(e=(e*=h)/2+c),B=x(e)}function $(t,e){e=(e*=h)/2+c;var n=(t*=h)-F,r=n&gt;=0?1:-1,i=r*n,o=v(e),a=x(e),s=B*a,u=V*o+s*v(i),l=s*r*x(i);j.add(g(l,u)),F=t,V=o,B=a}function K(t){return[g(t[1],t[0]),S(t[2])]}function Y(t){var e=t[0],n=t[1],r=v(n);return[r*v(e),r*x(e),x(n)]}function X(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Z(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Q(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function J(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function tt(t){var e=k(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var et,nt,rt,it,ot,at,st,ut,lt,ct,ft,pt,ht,dt,mt,gt,vt,yt,bt,_t,wt,xt,Et,kt,Tt,Nt,St=n(),Ct={point:At,lineStart:Ot,lineEnd:Mt,polygonStart:function(){Ct.point=Rt,Ct.lineStart=Pt,Ct.lineEnd=Dt,St.reset(),U.polygonStart()},polygonEnd:function(){U.polygonEnd(),Ct.point=At,Ct.lineStart=Ot,Ct.lineEnd=Mt,j&lt;0?(et=-(rt=180),nt=-(it=90)):St&gt;a?it=90:St&lt;-a&amp;&amp;(nt=-90),ct[0]=et,ct[1]=rt}};function At(t,e){lt.push(ct=[et=t,rt=t]),e&lt;nt&amp;&amp;(nt=e),e&gt;it&amp;&amp;(it=e)}function It(t,e){var n=Y([t*h,e*h]);if(ut){var r=Z(ut,n),i=Z([r[1],-r[0],0],r);tt(i),i=K(i);var o,a=t-ot,s=a&gt;0?1:-1,u=i[0]*p*s,l=d(a)&gt;180;l^(s*ot&lt;u&amp;&amp;u&lt;s*t)?(o=i[1]*p)&gt;it&amp;&amp;(it=o):l^(s*ot&lt;(u=(u+360)%360-180)&amp;&amp;u&lt;s*t)?(o=-i[1]*p)&lt;nt&amp;&amp;(nt=o):(e&lt;nt&amp;&amp;(nt=e),e&gt;it&amp;&amp;(it=e)),l?t&lt;ot?zt(et,t)&gt;zt(et,rt)&amp;&amp;(rt=t):zt(t,rt)&gt;zt(et,rt)&amp;&amp;(et=t):rt&gt;=et?(t&lt;et&amp;&amp;(et=t),t&gt;rt&amp;&amp;(rt=t)):t&gt;ot?zt(et,t)&gt;zt(et,rt)&amp;&amp;(rt=t):zt(t,rt)&gt;zt(et,rt)&amp;&amp;(et=t)}else lt.push(ct=[et=t,rt=t]);e&lt;nt&amp;&amp;(nt=e),e&gt;it&amp;&amp;(it=e),ut=n,ot=t}function Ot(){Ct.point=It}function Mt(){ct[0]=et,ct[1]=rt,Ct.point=At,ut=null}function Rt(t,e){if(ut){var n=t-ot;St.add(d(n)&gt;180?n+(n&gt;0?360:-360):n)}else at=t,st=e;U.point(t,e),It(t,e)}function Pt(){U.lineStart()}function Dt(){Rt(at,st),U.lineEnd(),d(St)&gt;a&amp;&amp;(et=-(rt=180)),ct[0]=et,ct[1]=rt,ut=null}function zt(t,e){return(e-=t)&lt;0?e+360:e}function Lt(t,e){return t[0]-e[0]}function Ft(t,e){return t[0]&lt;=t[1]?t[0]&lt;=e&amp;&amp;e&lt;=t[1]:e&lt;t[0]||t[1]&lt;e}var Vt={sphere:A,point:Bt,lineStart:qt,lineEnd:Wt,polygonStart:function(){Vt.lineStart=Ht,Vt.lineEnd=$t},polygonEnd:function(){Vt.lineStart=qt,Vt.lineEnd=Wt}};function Bt(t,e){t*=h;var n=v(e*=h);jt(n*v(t),n*x(t),x(e))}function jt(t,e,n){ht+=(t-ht)/++ft,dt+=(e-dt)/ft,mt+=(n-mt)/ft}function qt(){Vt.point=Ut}function Ut(t,e){t*=h;var n=v(e*=h);kt=n*v(t),Tt=n*x(t),Nt=x(e),Vt.point=Gt,jt(kt,Tt,Nt)}function Gt(t,e){t*=h;var n=v(e*=h),r=n*v(t),i=n*x(t),o=x(e),a=g(k((a=Tt*o-Nt*i)*a+(a=Nt*r-kt*o)*a+(a=kt*i-Tt*r)*a),kt*r+Tt*i+Nt*o);pt+=a,gt+=a*(kt+(kt=r)),vt+=a*(Tt+(Tt=i)),yt+=a*(Nt+(Nt=o)),jt(kt,Tt,Nt)}function Wt(){Vt.point=Bt}function Ht(){Vt.point=Kt}function $t(){Yt(xt,Et),Vt.point=Bt}function Kt(t,e){xt=t,Et=e,t*=h,e*=h,Vt.point=Yt;var n=v(e);kt=n*v(t),Tt=n*x(t),Nt=x(e),jt(kt,Tt,Nt)}function Yt(t,e){t*=h;var n=v(e*=h),r=n*v(t),i=n*x(t),o=x(e),a=Tt*o-Nt*i,s=Nt*r-kt*o,u=kt*i-Tt*r,l=k(a*a+s*s+u*u),c=S(l),f=l&amp;&amp;-c/l;bt+=f*a,_t+=f*s,wt+=f*u,pt+=c,gt+=c*(kt+(kt=r)),vt+=c*(Tt+(Tt=i)),yt+=c*(Nt+(Nt=o)),jt(kt,Tt,Nt)}function Xt(t){return function(){return t}}function Zt(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&amp;&amp;e.invert&amp;&amp;(n.invert=function(n,r){return(n=e.invert(n,r))&amp;&amp;t.invert(n[0],n[1])}),n}function Qt(t,e){return[d(t)&gt;u?t+Math.round(-t/f)*f:t,e]}function Jt(t,e,n){return(t%=f)?e||n?Zt(ee(t),ne(e,n)):ee(t):e||n?ne(e,n):Qt}function te(t){return function(e,n){return[(e+=t)&gt;u?e-f:e&lt;-u?e+f:e,n]}}function ee(t){var e=te(t);return e.invert=te(-t),e}function ne(t,e){var n=v(t),r=x(t),i=v(e),o=x(e);function a(t,e){var a=v(e),s=v(t)*a,u=x(t)*a,l=x(e),c=l*n+s*r;return[g(u*i-c*o,s*n-l*r),S(c*i+u*o)]}return a.invert=function(t,e){var a=v(e),s=v(t)*a,u=x(t)*a,l=x(e),c=l*i-u*o;return[g(u*i+l*o,s*n+c*r),S(c*n-s*r)]},a}function re(t){function e(e){return(e=t(e[0]*h,e[1]*h))[0]*=p,e[1]*=p,e}return t=Jt(t[0]*h,t[1]*h,t.length&gt;2?t[2]*h:0),e.invert=function(e){return(e=t.invert(e[0]*h,e[1]*h))[0]*=p,e[1]*=p,e},e}function ie(t,e,n,r,i,o){if(n){var a=v(e),s=x(e),u=r*n;null==i?(i=e+r*f,o=e-u/2):(i=oe(a,i),o=oe(a,o),(r&gt;0?i&lt;o:i&gt;o)&amp;&amp;(i+=r*f));for(var l,c=i;r&gt;0?c&gt;o:c&lt;o;c-=u)l=K([a,-s*v(c),-s*x(c)]),t.point(l[0],l[1])}}function oe(t,e){(e=Y(e))[0]-=t,tt(e);var n=N(-e[1]);return((-e[2]&lt;0?-n:n)+f-a)%f}function ae(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:A,rejoin:function(){e.length&gt;1&amp;&amp;e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function se(t,e){return d(t[0]-e[0])&lt;a&amp;&amp;d(t[1]-e[1])&lt;a}function ue(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function le(t,e,n,r,i){var o,a,s=[],u=[];if(t.forEach(function(t){if(!((e=t.length-1)&lt;=0)){var e,n,r=t[0],a=t[e];if(se(r,a)){for(i.lineStart(),o=0;o&lt;e;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else s.push(n=new ue(r,t,null,!0)),u.push(n.o=new ue(r,null,n,!1)),s.push(n=new ue(a,t,null,!1)),u.push(n.o=new ue(a,null,n,!0))}}),s.length){for(u.sort(e),ce(s),ce(u),o=0,a=u.length;o&lt;a;++o)u[o].e=n=!n;for(var l,c,f=s[0];;){for(var p=f,h=!0;p.v;)if((p=p.n)===f)return;l=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(h)for(o=0,a=l.length;o&lt;a;++o)i.point((c=l[o])[0],c[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(h)for(l=p.p.z,o=l.length-1;o&gt;=0;--o)i.point((c=l[o])[0],c[1]);else r(p.x,p.p.x,-1,i);p=p.p}l=(p=p.o).z,h=!h}while(!p.v);i.lineEnd()}}}function ce(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r&lt;e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}Qt.invert=Qt;var fe=n();function pe(t,e){var n=e[0],r=e[1],i=x(r),o=[x(n),-v(n),0],s=0,p=0;fe.reset(),1===i?r=l+a:-1===i&amp;&amp;(r=-l-a);for(var h=0,d=t.length;h&lt;d;++h)if(y=(m=t[h]).length)for(var m,y,b=m[y-1],_=b[0],w=b[1]/2+c,E=x(w),k=v(w),T=0;T&lt;y;++T,_=C,E=I,k=O,b=N){var N=m[T],C=N[0],A=N[1]/2+c,I=x(A),O=v(A),M=C-_,R=M&gt;=0?1:-1,P=R*M,D=P&gt;u,z=E*I;if(fe.add(g(z*R*x(P),k*O+z*v(P))),s+=D?M+R*f:M,D^_&gt;=n^C&gt;=n){var L=Z(Y(b),Y(N));tt(L);var F=Z(o,L);tt(F);var V=(D^M&gt;=0?-1:1)*S(F[2]);(r&gt;V||r===V&amp;&amp;(L[0]||L[1]))&amp;&amp;(p+=D^M&gt;=0?1:-1)}}return(s&lt;-a||s&lt;a&amp;&amp;fe&lt;-a)^1&amp;p}function he(t,n,r,i){return function(o){var a,s,u,l=n(o),c=ae(),f=n(c),p=!1,h={point:d,lineStart:g,lineEnd:v,polygonStart:function(){h.point=y,h.lineStart=b,h.lineEnd=_,s=[],a=[]},polygonEnd:function(){h.point=d,h.lineStart=g,h.lineEnd=v,s=e.merge(s);var t=pe(a,i);s.length?(p||(o.polygonStart(),p=!0),le(s,me,t,r,o)):t&amp;&amp;(p||(o.polygonStart(),p=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),p&amp;&amp;(o.polygonEnd(),p=!1),s=a=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(e,n){t(e,n)&amp;&amp;o.point(e,n)}function m(t,e){l.point(t,e)}function g(){h.point=m,l.lineStart()}function v(){h.point=d,l.lineEnd()}function y(t,e){u.push([t,e]),f.point(t,e)}function b(){f.lineStart(),u=[]}function _(){y(u[0][0],u[0][1]),f.lineEnd();var t,e,n,r,i=f.clean(),l=c.result(),h=l.length;if(u.pop(),a.push(u),u=null,h)if(1&amp;i){if((e=(n=l[0]).length-1)&gt;0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t&lt;e;++t)o.point((r=n[t])[0],r[1]);o.lineEnd()}}else h&gt;1&amp;&amp;2&amp;i&amp;&amp;l.push(l.pop().concat(l.shift())),s.push(l.filter(de))}return h}}function de(t){return t.length&gt;1}function me(t,e){return((t=t.x)[0]&lt;0?t[1]-l-a:l-t[1])-((e=e.x)[0]&lt;0?e[1]-l-a:l-e[1])}var ge=he(function(){return!0},function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var c=o&gt;0?u:-u,f=d(o-n);d(f-u)&lt;a?(t.point(n,r=(r+s)/2&gt;0?l:-l),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(c,r),t.point(o,r),e=0):i!==c&amp;&amp;f&gt;=u&amp;&amp;(d(n-i)&lt;a&amp;&amp;(n-=i*a),d(o-c)&lt;a&amp;&amp;(o-=c*a),r=function(t,e,n,r){var i,o,s=x(t-n);return d(s)&gt;a?m((x(e)*(o=v(r))*x(n)-x(r)*(i=v(e))*x(t))/(i*o*s)):(e+r)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(c,r),e=0),t.point(n=o,r=s),i=c},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}},function(t,e,n,r){var i;if(null==t)i=n*l,r.point(-u,i),r.point(0,i),r.point(u,i),r.point(u,0),r.point(u,-i),r.point(0,-i),r.point(-u,-i),r.point(-u,0),r.point(-u,i);else if(d(t[0]-e[0])&gt;a){var o=t[0]&lt;e[0]?u:-u;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])},[-u,-l]);function ve(t){var e=v(t),n=6*h,r=e&gt;0,i=d(e)&gt;a;function o(t,n){return v(t)*v(n)&gt;e}function s(t,n,r){var i=[1,0,0],o=Z(Y(t),Y(n)),s=X(o,o),l=o[0],c=s-l*l;if(!c)return!r&amp;&amp;t;var f=e*s/c,p=-e*l/c,h=Z(i,o),m=J(i,f);Q(m,J(o,p));var g=h,v=X(m,g),y=X(g,g),b=v*v-y*(X(m,m)-1);if(!(b&lt;0)){var _=k(b),w=J(g,(-v-_)/y);if(Q(w,m),w=K(w),!r)return w;var x,E=t[0],T=n[0],N=t[1],S=n[1];T&lt;E&amp;&amp;(x=E,E=T,T=x);var C=T-E,A=d(C-u)&lt;a;if(!A&amp;&amp;S&lt;N&amp;&amp;(x=N,N=S,S=x),A||C&lt;a?A?N+S&gt;0^w[1]&lt;(d(w[0]-E)&lt;a?N:S):N&lt;=w[1]&amp;&amp;w[1]&lt;=S:C&gt;u^(E&lt;=w[0]&amp;&amp;w[0]&lt;=T)){var I=J(g,(-v+_)/y);return Q(I,m),[w,K(I)]}}}function l(e,n){var i=r?t:u-t,o=0;return e&lt;-i?o|=1:e&gt;i&amp;&amp;(o|=2),n&lt;-i?o|=4:n&gt;i&amp;&amp;(o|=8),o}return he(o,function(t){var e,n,c,f,p;return{lineStart:function(){f=c=!1,p=1},point:function(h,d){var m,g=[h,d],v=o(h,d),y=r?v?0:l(h,d):v?l(h+(h&lt;0?u:-u),d):0;if(!e&amp;&amp;(f=c=v)&amp;&amp;t.lineStart(),v!==c&amp;&amp;(!(m=s(e,g))||se(e,m)||se(g,m))&amp;&amp;(g[0]+=a,g[1]+=a,v=o(g[0],g[1])),v!==c)p=0,v?(t.lineStart(),m=s(g,e),t.point(m[0],m[1])):(m=s(e,g),t.point(m[0],m[1]),t.lineEnd()),e=m;else if(i&amp;&amp;e&amp;&amp;r^v){var b;y&amp;n||!(b=s(g,e,!0))||(p=0,r?(t.lineStart(),t.point(b[0][0],b[0][1]),t.point(b[1][0],b[1][1]),t.lineEnd()):(t.point(b[1][0],b[1][1]),t.lineEnd(),t.lineStart(),t.point(b[0][0],b[0][1])))}!v||e&amp;&amp;se(e,g)||t.point(g[0],g[1]),e=g,c=v,n=y},lineEnd:function(){c&amp;&amp;t.lineEnd(),e=null},clean:function(){return p|(f&amp;&amp;c)&lt;&lt;1}}},function(e,r,i,o){ie(o,t,n,i,e,r)},r?[0,-t]:[-u,t-u])}var ye=1e9,be=-ye;function _e(t,n,r,i){function o(e,o){return t&lt;=e&amp;&amp;e&lt;=r&amp;&amp;n&lt;=o&amp;&amp;o&lt;=i}function s(e,o,a,s){var l=0,f=0;if(null==e||(l=u(e,a))!==(f=u(o,a))||c(e,o)&lt;0^a&gt;0)do{s.point(0===l||3===l?t:r,l&gt;1?i:n)}while((l=(l+a+4)%4)!==f);else s.point(o[0],o[1])}function u(e,i){return d(e[0]-t)&lt;a?i&gt;0?0:3:d(e[0]-r)&lt;a?i&gt;0?2:1:d(e[1]-n)&lt;a?i&gt;0?1:0:i&gt;0?3:2}function l(t,e){return c(t.x,e.x)}function c(t,e){var n=u(t,1),r=u(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var u,c,f,p,h,d,m,g,v,y,b,_=a,w=ae(),x={point:E,lineStart:function(){x.point=k,c&amp;&amp;c.push(f=[]);y=!0,v=!1,m=g=NaN},lineEnd:function(){u&amp;&amp;(k(p,h),d&amp;&amp;v&amp;&amp;w.rejoin(),u.push(w.result()));x.point=E,v&amp;&amp;_.lineEnd()},polygonStart:function(){_=w,u=[],c=[],b=!0},polygonEnd:function(){var n=function(){for(var e=0,n=0,r=c.length;n&lt;r;++n)for(var o,a,s=c[n],u=1,l=s.length,f=s[0],p=f[0],h=f[1];u&lt;l;++u)o=p,a=h,f=s[u],p=f[0],h=f[1],a&lt;=i?h&gt;i&amp;&amp;(p-o)*(i-a)&gt;(h-a)*(t-o)&amp;&amp;++e:h&lt;=i&amp;&amp;(p-o)*(i-a)&lt;(h-a)*(t-o)&amp;&amp;--e;return e}(),r=b&amp;&amp;n,o=(u=e.merge(u)).length;(r||o)&amp;&amp;(a.polygonStart(),r&amp;&amp;(a.lineStart(),s(null,null,1,a),a.lineEnd()),o&amp;&amp;le(u,l,n,s,a),a.polygonEnd());_=a,u=c=f=null}};function E(t,e){o(t,e)&amp;&amp;_.point(t,e)}function k(e,a){var s=o(e,a);if(c&amp;&amp;f.push([e,a]),y)p=e,h=a,d=s,y=!1,s&amp;&amp;(_.lineStart(),_.point(e,a));else if(s&amp;&amp;v)_.point(e,a);else{var u=[m=Math.max(be,Math.min(ye,m)),g=Math.max(be,Math.min(ye,g))],l=[e=Math.max(be,Math.min(ye,e)),a=Math.max(be,Math.min(ye,a))];!function(t,e,n,r,i,o){var a,s=t[0],u=t[1],l=0,c=1,f=e[0]-s,p=e[1]-u;if(a=n-s,f||!(a&gt;0)){if(a/=f,f&lt;0){if(a&lt;l)return;a&lt;c&amp;&amp;(c=a)}else if(f&gt;0){if(a&gt;c)return;a&gt;l&amp;&amp;(l=a)}if(a=i-s,f||!(a&lt;0)){if(a/=f,f&lt;0){if(a&gt;c)return;a&gt;l&amp;&amp;(l=a)}else if(f&gt;0){if(a&lt;l)return;a&lt;c&amp;&amp;(c=a)}if(a=r-u,p||!(a&gt;0)){if(a/=p,p&lt;0){if(a&lt;l)return;a&lt;c&amp;&amp;(c=a)}else if(p&gt;0){if(a&gt;c)return;a&gt;l&amp;&amp;(l=a)}if(a=o-u,p||!(a&lt;0)){if(a/=p,p&lt;0){if(a&gt;c)return;a&gt;l&amp;&amp;(l=a)}else if(p&gt;0){if(a&lt;l)return;a&lt;c&amp;&amp;(c=a)}return l&gt;0&amp;&amp;(t[0]=s+l*f,t[1]=u+l*p),c&lt;1&amp;&amp;(e[0]=s+c*f,e[1]=u+c*p),!0}}}}}(u,l,t,n,r,i)?s&amp;&amp;(_.lineStart(),_.point(e,a),b=!1):(v||(_.lineStart(),_.point(u[0],u[1])),_.point(l[0],l[1]),s||_.lineEnd(),b=!1)}m=e,g=a,v=s}return x}}var we,xe,Ee,ke=n(),Te={sphere:A,point:A,lineStart:function(){Te.point=Se,Te.lineEnd=Ne},lineEnd:A,polygonStart:A,polygonEnd:A};function Ne(){Te.point=Te.lineEnd=A}function Se(t,e){we=t*=h,xe=x(e*=h),Ee=v(e),Te.point=Ce}function Ce(t,e){t*=h;var n=x(e*=h),r=v(e),i=d(t-we),o=v(i),a=r*x(i),s=Ee*n-xe*r*o,u=xe*n+Ee*r*o;ke.add(g(k(a*a+s*s),u)),we=t,xe=n,Ee=r}function Ae(t){return ke.reset(),D(t,Te),+ke}var Ie=[null,null],Oe={type:&quot;LineString&quot;,coordinates:Ie};function Me(t,e){return Ie[0]=t,Ie[1]=e,Ae(Oe)}var Re={Feature:function(t,e){return De(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r&lt;i;)if(De(n[r].geometry,e))return!0;return!1}},Pe={Sphere:function(){return!0},Point:function(t,e){return ze(t.coordinates,e)},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r&lt;i;)if(ze(n[r],e))return!0;return!1},LineString:function(t,e){return Le(t.coordinates,e)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r&lt;i;)if(Le(n[r],e))return!0;return!1},Polygon:function(t,e){return Fe(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r&lt;i;)if(Fe(n[r],e))return!0;return!1},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r&lt;i;)if(De(n[r],e))return!0;return!1}};function De(t,e){return!(!t||!Pe.hasOwnProperty(t.type))&amp;&amp;Pe[t.type](t,e)}function ze(t,e){return 0===Me(t,e)}function Le(t,e){var n=Me(t[0],t[1]);return Me(t[0],e)+Me(e,t[1])&lt;=n+a}function Fe(t,e){return!!pe(t.map(Ve),Be(e))}function Ve(t){return(t=t.map(Be)).pop(),t}function Be(t){return[t[0]*h,t[1]*h]}function je(t,n,r){var i=e.range(t,n-a,r).concat(n);return function(t){return i.map(function(e){return[t,e]})}}function qe(t,n,r){var i=e.range(t,n-a,r).concat(n);return function(t){return i.map(function(e){return[e,t]})}}function Ue(){var t,n,r,i,o,s,u,l,c,f,p,h,m=10,g=m,v=90,b=360,_=2.5;function w(){return{type:&quot;MultiLineString&quot;,coordinates:x()}}function x(){return e.range(y(i/v)*v,r,v).map(p).concat(e.range(y(l/b)*b,u,b).map(h)).concat(e.range(y(n/m)*m,t,m).filter(function(t){return d(t%v)&gt;a}).map(c)).concat(e.range(y(s/g)*g,o,g).filter(function(t){return d(t%b)&gt;a}).map(f))}return w.lines=function(){return x().map(function(t){return{type:&quot;LineString&quot;,coordinates:t}})},w.outline=function(){return{type:&quot;Polygon&quot;,coordinates:[p(i).concat(h(u).slice(1),p(r).reverse().slice(1),h(l).reverse().slice(1))]}},w.extent=function(t){return arguments.length?w.extentMajor(t).extentMinor(t):w.extentMinor()},w.extentMajor=function(t){return arguments.length?(i=+t[0][0],r=+t[1][0],l=+t[0][1],u=+t[1][1],i&gt;r&amp;&amp;(t=i,i=r,r=t),l&gt;u&amp;&amp;(t=l,l=u,u=t),w.precision(_)):[[i,l],[r,u]]},w.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],s=+e[0][1],o=+e[1][1],n&gt;t&amp;&amp;(e=n,n=t,t=e),s&gt;o&amp;&amp;(e=s,s=o,o=e),w.precision(_)):[[n,s],[t,o]]},w.step=function(t){return arguments.length?w.stepMajor(t).stepMinor(t):w.stepMinor()},w.stepMajor=function(t){return arguments.length?(v=+t[0],b=+t[1],w):[v,b]},w.stepMinor=function(t){return arguments.length?(m=+t[0],g=+t[1],w):[m,g]},w.precision=function(e){return arguments.length?(_=+e,c=je(s,o,90),f=qe(n,t,_),p=je(l,u,90),h=qe(i,r,_),w):_},w.extentMajor([[-180,-90+a],[180,90-a]]).extentMinor([[-180,-80-a],[180,80+a]])}function Ge(t){return t}var We,He,$e,Ke,Ye=n(),Xe=n(),Ze={point:A,lineStart:A,lineEnd:A,polygonStart:function(){Ze.lineStart=Qe,Ze.lineEnd=en},polygonEnd:function(){Ze.lineStart=Ze.lineEnd=Ze.point=A,Ye.add(d(Xe)),Xe.reset()},result:function(){var t=Ye/2;return Ye.reset(),t}};function Qe(){Ze.point=Je}function Je(t,e){Ze.point=tn,We=$e=t,He=Ke=e}function tn(t,e){Xe.add(Ke*t-$e*e),$e=t,Ke=e}function en(){tn(We,He)}var nn=1/0,rn=nn,on=-nn,an=on,sn={point:function(t,e){t&lt;nn&amp;&amp;(nn=t);t&gt;on&amp;&amp;(on=t);e&lt;rn&amp;&amp;(rn=e);e&gt;an&amp;&amp;(an=e)},lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A,result:function(){var t=[[nn,rn],[on,an]];return on=an=-(rn=nn=1/0),t}};var un,ln,cn,fn,pn=0,hn=0,dn=0,mn=0,gn=0,vn=0,yn=0,bn=0,_n=0,wn={point:xn,lineStart:En,lineEnd:Nn,polygonStart:function(){wn.lineStart=Sn,wn.lineEnd=Cn},polygonEnd:function(){wn.point=xn,wn.lineStart=En,wn.lineEnd=Nn},result:function(){var t=_n?[yn/_n,bn/_n]:vn?[mn/vn,gn/vn]:dn?[pn/dn,hn/dn]:[NaN,NaN];return pn=hn=dn=mn=gn=vn=yn=bn=_n=0,t}};function xn(t,e){pn+=t,hn+=e,++dn}function En(){wn.point=kn}function kn(t,e){wn.point=Tn,xn(cn=t,fn=e)}function Tn(t,e){var n=t-cn,r=e-fn,i=k(n*n+r*r);mn+=i*(cn+t)/2,gn+=i*(fn+e)/2,vn+=i,xn(cn=t,fn=e)}function Nn(){wn.point=xn}function Sn(){wn.point=An}function Cn(){In(un,ln)}function An(t,e){wn.point=In,xn(un=cn=t,ln=fn=e)}function In(t,e){var n=t-cn,r=e-fn,i=k(n*n+r*r);mn+=i*(cn+t)/2,gn+=i*(fn+e)/2,vn+=i,yn+=(i=fn*t-cn*e)*(cn+t),bn+=i*(fn+e),_n+=3*i,xn(cn=t,fn=e)}function On(t){this._context=t}On.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&amp;&amp;this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,f)}},result:A};var Mn,Rn,Pn,Dn,zn,Ln=n(),Fn={point:A,lineStart:function(){Fn.point=Vn},lineEnd:function(){Mn&amp;&amp;Bn(Rn,Pn),Fn.point=A},polygonStart:function(){Mn=!0},polygonEnd:function(){Mn=null},result:function(){var t=+Ln;return Ln.reset(),t}};function Vn(t,e){Fn.point=Bn,Rn=Dn=t,Pn=zn=e}function Bn(t,e){Dn-=t,zn-=e,Ln.add(k(Dn*Dn+zn*zn)),Dn=t,zn=e}function jn(){this._string=[]}function qn(t){return&quot;m0,&quot;+t+&quot;a&quot;+t+&quot;,&quot;+t+&quot; 0 1,1 0,&quot;+-2*t+&quot;a&quot;+t+&quot;,&quot;+t+&quot; 0 1,1 0,&quot;+2*t+&quot;z&quot;}function Un(t){return function(e){var n=new Gn;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Gn(){}function Wn(t,e,n){var r=t.clipExtent&amp;&amp;t.clipExtent();return t.scale(150).translate([0,0]),null!=r&amp;&amp;t.clipExtent(null),D(n,t.stream(sn)),e(sn.result()),null!=r&amp;&amp;t.clipExtent(r),t}function Hn(t,e,n){return Wn(t,function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])},n)}function $n(t,e,n){return Hn(t,[[0,0],e],n)}function Kn(t,e,n){return Wn(t,function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])},n)}function Yn(t,e,n){return Wn(t,function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])},n)}jn.prototype={_radius:4.5,_circle:qn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&amp;&amp;(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&amp;&amp;this._string.push(&quot;Z&quot;),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push(&quot;M&quot;,t,&quot;,&quot;,e),this._point=1;break;case 1:this._string.push(&quot;L&quot;,t,&quot;,&quot;,e);break;default:null==this._circle&amp;&amp;(this._circle=qn(this._radius)),this._string.push(&quot;M&quot;,t,&quot;,&quot;,e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join(&quot;&quot;);return this._string=[],t}return null}},Gn.prototype={constructor:Gn,point:function(t,e){this.stream.point(t,e)},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 Xn=16,Zn=v(30*h);function Qn(t,e){return+e?function(t,e){function n(r,i,o,s,u,l,c,f,p,h,m,v,y,b){var _=c-r,w=f-i,x=_*_+w*w;if(x&gt;4*e&amp;&amp;y--){var E=s+h,T=u+m,N=l+v,C=k(E*E+T*T+N*N),A=S(N/=C),I=d(d(N)-1)&lt;a||d(o-p)&lt;a?(o+p)/2:g(T,E),O=t(I,A),M=O[0],R=O[1],P=M-r,D=R-i,z=w*P-_*D;(z*z/x&gt;e||d((_*P+w*D)/x-.5)&gt;.3||s*h+u*m+l*v&lt;Zn)&amp;&amp;(n(r,i,o,s,u,l,M,R,I,E/=C,T/=C,N,y,b),b.point(M,R),n(M,R,I,E,T,N,c,f,p,h,m,v,y,b))}}return function(e){var r,i,o,a,s,u,l,c,f,p,h,d,m={point:g,lineStart:v,lineEnd:b,polygonStart:function(){e.polygonStart(),m.lineStart=_},polygonEnd:function(){e.polygonEnd(),m.lineStart=v}};function g(n,r){n=t(n,r),e.point(n[0],n[1])}function v(){c=NaN,m.point=y,e.lineStart()}function y(r,i){var o=Y([r,i]),a=t(r,i);n(c,f,l,p,h,d,c=a[0],f=a[1],l=r,p=o[0],h=o[1],d=o[2],Xn,e),e.point(c,f)}function b(){m.point=g,e.lineEnd()}function _(){v(),m.point=w,m.lineEnd=x}function w(t,e){y(r=t,e),i=c,o=f,a=p,s=h,u=d,m.point=y}function x(){n(c,f,l,p,h,d,i,o,r,a,s,u,Xn,e),m.lineEnd=b,b()}return m}}(t,e):function(t){return Un({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Jn=Un({point:function(t,e){this.stream.point(t*h,e*h)}});function tr(t,e,n,r){var i=v(r),o=x(r),a=i*t,s=o*t,u=i/t,l=o/t,c=(o*n-i*e)/t,f=(o*e+i*n)/t;function p(t,r){return[a*t-s*r+e,n-s*t-a*r]}return p.invert=function(t,e){return[u*t-l*e+c,f-l*t-u*e]},p}function er(t){return nr(function(){return t})()}function nr(t){var e,n,r,i,o,a,s,u,l,c,f=150,d=480,m=250,g=0,v=0,y=0,b=0,_=0,w=0,x=null,E=ge,T=null,N=Ge,S=.5;function C(t){return u(t[0]*h,t[1]*h)}function A(t){return(t=u.invert(t[0],t[1]))&amp;&amp;[t[0]*p,t[1]*p]}function I(){var t=tr(f,0,0,w).apply(null,e(g,v)),r=(w?tr:function(t,e,n){function r(r,i){return[e+t*r,n-t*i]}return r.invert=function(r,i){return[(r-e)/t,(n-i)/t]},r})(f,d-t[0],m-t[1],w);return n=Jt(y,b,_),s=Zt(e,r),u=Zt(n,s),a=Qn(s,S),O()}function O(){return l=c=null,C}return C.stream=function(t){return l&amp;&amp;c===t?l:l=Jn(function(t){return Un({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(E(a(N(c=t)))))},C.preclip=function(t){return arguments.length?(E=t,x=void 0,O()):E},C.postclip=function(t){return arguments.length?(N=t,T=r=i=o=null,O()):N},C.clipAngle=function(t){return arguments.length?(E=+t?ve(x=t*h):(x=null,ge),O()):x*p},C.clipExtent=function(t){return arguments.length?(N=null==t?(T=r=i=o=null,Ge):_e(T=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),O()):null==T?null:[[T,r],[i,o]]},C.scale=function(t){return arguments.length?(f=+t,I()):f},C.translate=function(t){return arguments.length?(d=+t[0],m=+t[1],I()):[d,m]},C.center=function(t){return arguments.length?(g=t[0]%360*h,v=t[1]%360*h,I()):[g*p,v*p]},C.rotate=function(t){return arguments.length?(y=t[0]%360*h,b=t[1]%360*h,_=t.length&gt;2?t[2]%360*h:0,I()):[y*p,b*p,_*p]},C.angle=function(t){return arguments.length?(w=t%360*h,I()):w*p},C.precision=function(t){return arguments.length?(a=Qn(s,S=t*t),O()):k(S)},C.fitExtent=function(t,e){return Hn(C,t,e)},C.fitSize=function(t,e){return $n(C,t,e)},C.fitWidth=function(t,e){return Kn(C,t,e)},C.fitHeight=function(t,e){return Yn(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&amp;&amp;A,I()}}function rr(t){var e=0,n=u/3,r=nr(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*h,n=t[1]*h):[e*p,n*p]},i}function ir(t,e){var n=x(t),r=(n+x(e))/2;if(d(r)&lt;a)return function(t){var e=v(t);function n(t,n){return[t*e,x(n)/e]}return n.invert=function(t,n){return[t/e,S(n*e)]},n}(t);var i=1+n*(2*r-n),o=k(i)/r;function s(t,e){var n=k(i-2*r*x(e))/r;return[n*x(t*=r),o-n*v(t)]}return s.invert=function(t,e){var n=o-e;return[g(t,d(n))/r*E(n),S((i-(t*t+n*n)*r*r)/(2*r))]},s}function or(){return rr(ir).scale(155.424).center([0,33.6442])}function ar(){return or().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function sr(t){return function(e,n){var r=v(e),i=v(n),o=t(r*i);return[o*i*x(e),o*x(n)]}}function ur(t){return function(e,n){var r=k(e*e+n*n),i=t(r),o=x(i),a=v(i);return[g(e*o,r*a),S(r&amp;&amp;n*o/r)]}}var lr=sr(function(t){return k(2/(1+t))});lr.invert=ur(function(t){return 2*S(t/2)});var cr=sr(function(t){return(t=N(t))&amp;&amp;t/x(t)});function fr(t,e){return[t,_(T((l+e)/2))]}function pr(t){var e,n,r,i=er(t),o=i.center,a=i.scale,s=i.translate,l=i.clipExtent,c=null;function f(){var o=u*a(),s=i(re(i.rotate()).invert([0,0]));return l(null==c?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:t===fr?[[Math.max(s[0]-o,c),e],[Math.min(s[0]+o,n),r]]:[[c,Math.max(s[1]-o,e)],[n,Math.min(s[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),f()):a()},i.translate=function(t){return arguments.length?(s(t),f()):s()},i.center=function(t){return arguments.length?(o(t),f()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=e=n=r=null:(c=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),f()):null==c?null:[[c,e],[n,r]]},f()}function hr(t){return T((l+t)/2)}function dr(t,e){var n=v(t),r=t===e?x(t):_(n/v(e))/_(hr(e)/hr(t)),i=n*w(hr(t),r)/r;if(!r)return fr;function o(t,e){i&gt;0?e&lt;-l+a&amp;&amp;(e=-l+a):e&gt;l-a&amp;&amp;(e=l-a);var n=i/w(hr(e),r);return[n*x(r*t),i-n*v(r*t)]}return o.invert=function(t,e){var n=i-e,o=E(r)*k(t*t+n*n);return[g(t,d(n))/r*E(n),2*m(w(i/o,1/r))-l]},o}function mr(t,e){return[t,e]}function gr(t,e){var n=v(t),r=t===e?x(t):(n-v(e))/(e-t),i=n/r+t;if(d(r)&lt;a)return mr;function o(t,e){var n=i-e,o=r*t;return[n*x(o),i-n*v(o)]}return o.invert=function(t,e){var n=i-e;return[g(t,d(n))/r*E(n),i-E(r)*k(t*t+n*n)]},o}cr.invert=ur(function(t){return t}),fr.invert=function(t,e){return[t,2*m(b(e))-l]},mr.invert=mr;var vr=1.340264,yr=-.081106,br=893e-6,_r=.003796,wr=k(3)/2;function xr(t,e){var n=S(wr*x(e)),r=n*n,i=r*r*r;return[t*v(n)/(wr*(vr+3*yr*r+i*(7*br+9*_r*r))),n*(vr+yr*r+i*(br+_r*r))]}function Er(t,e){var n=v(e),r=v(t)*n;return[n*x(t)/r,x(e)/r]}function kr(t,e,n,r){return 1===t&amp;&amp;1===e&amp;&amp;0===n&amp;&amp;0===r?Ge:Un({point:function(i,o){this.stream.point(i*t+n,o*e+r)}})}function Tr(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function Nr(t,e){return[v(e)*x(t),x(e)]}function Sr(t,e){var n=v(e),r=1+v(t)*n;return[n*x(t)/r,x(e)/r]}function Cr(t,e){return[_(T((l+e)/2)),-t]}xr.invert=function(t,e){for(var n,r=e,i=r*r,o=i*i*i,a=0;a&lt;12&amp;&amp;(o=(i=(r-=n=(r*(vr+yr*i+o*(br+_r*i))-e)/(vr+3*yr*i+o*(7*br+9*_r*i)))*r)*i*i,!(d(n)&lt;s));++a);return[wr*t*(vr+3*yr*i+o*(7*br+9*_r*i))/v(r),S(x(r)/wr)]},Er.invert=ur(m),Tr.invert=function(t,e){var n,r=e,i=25;do{var o=r*r,s=o*o;r-=n=(r*(1.007226+o*(.015085+s*(.028874*o-.044475-.005916*s)))-e)/(1.007226+o*(.045255+s*(.259866*o-.311325-.005916*11*s)))}while(d(n)&gt;a&amp;&amp;--i&gt;0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},Nr.invert=ur(S),Sr.invert=ur(function(t){return 2*m(t)}),Cr.invert=function(t,e){return[-e,2*m(b(t))-l]},t.geoArea=function(t){return q.reset(),D(t,U),2*q},t.geoBounds=function(t){var e,n,r,i,o,a,s;if(it=rt=-(et=nt=1/0),lt=[],D(t,Ct),n=lt.length){for(lt.sort(Lt),e=1,o=[r=lt[0]];e&lt;n;++e)Ft(r,(i=lt[e])[0])||Ft(r,i[1])?(zt(r[0],i[1])&gt;zt(r[0],r[1])&amp;&amp;(r[1]=i[1]),zt(i[0],r[1])&gt;zt(r[0],r[1])&amp;&amp;(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e&lt;=n;r=i,++e)i=o[e],(s=zt(r[1],i[0]))&gt;a&amp;&amp;(a=s,et=i[0],rt=r[1])}return lt=ct=null,et===1/0||nt===1/0?[[NaN,NaN],[NaN,NaN]]:[[et,nt],[rt,it]]},t.geoCentroid=function(t){ft=pt=ht=dt=mt=gt=vt=yt=bt=_t=wt=0,D(t,Vt);var e=bt,n=_t,r=wt,i=e*e+n*n+r*r;return i&lt;s&amp;&amp;(e=gt,n=vt,r=yt,pt&lt;a&amp;&amp;(e=ht,n=dt,r=mt),(i=e*e+n*n+r*r)&lt;s)?[NaN,NaN]:[g(n,e)*p,S(r/k(i))*p]},t.geoCircle=function(){var t,e,n=Xt([0,0]),r=Xt(90),i=Xt(6),o={point:function(n,r){t.push(n=e(n,r)),n[0]*=p,n[1]*=p}};function a(){var a=n.apply(this,arguments),s=r.apply(this,arguments)*h,u=i.apply(this,arguments)*h;return t=[],e=Jt(-a[0]*h,-a[1]*h,0).invert,ie(o,s,u,1),a={type:&quot;Polygon&quot;,coordinates:[t]},t=e=null,a}return a.center=function(t){return arguments.length?(n=&quot;function&quot;==typeof t?t:Xt([+t[0],+t[1]]),a):n},a.radius=function(t){return arguments.length?(r=&quot;function&quot;==typeof t?t:Xt(+t),a):r},a.precision=function(t){return arguments.length?(i=&quot;function&quot;==typeof t?t:Xt(+t),a):i},a},t.geoClipAntimeridian=ge,t.geoClipCircle=ve,t.geoClipExtent=function(){var t,e,n,r=0,i=0,o=960,a=500;return n={stream:function(n){return t&amp;&amp;e===n?t:t=_e(r,i,o,a)(e=n)},extent:function(s){return arguments.length?(r=+s[0][0],i=+s[0][1],o=+s[1][0],a=+s[1][1],t=e=null,n):[[r,i],[o,a]]}}},t.geoClipRectangle=_e,t.geoContains=function(t,e){return(t&amp;&amp;Re.hasOwnProperty(t.type)?Re[t.type]:De)(t,e)},t.geoDistance=Me,t.geoGraticule=Ue,t.geoGraticule10=function(){return Ue()()},t.geoInterpolate=function(t,e){var n=t[0]*h,r=t[1]*h,i=e[0]*h,o=e[1]*h,a=v(r),s=x(r),u=v(o),l=x(o),c=a*v(n),f=a*x(n),d=u*v(i),m=u*x(i),y=2*S(k(C(o-r)+a*u*C(i-n))),b=x(y),_=y?function(t){var e=x(t*=y)/b,n=x(y-t)/b,r=n*c+e*d,i=n*f+e*m,o=n*s+e*l;return[g(i,r)*p,g(o,k(r*r+i*i))*p]}:function(){return[n*p,r*p]};return _.distance=y,_},t.geoLength=Ae,t.geoPath=function(t,e){var n,r,i=4.5;function o(t){return t&amp;&amp;(&quot;function&quot;==typeof i&amp;&amp;r.pointRadius(+i.apply(this,arguments)),D(t,n(r))),r.result()}return o.area=function(t){return D(t,n(Ze)),Ze.result()},o.measure=function(t){return D(t,n(Fn)),Fn.result()},o.bounds=function(t){return D(t,n(sn)),sn.result()},o.centroid=function(t){return D(t,n(wn)),wn.result()},o.projection=function(e){return arguments.length?(n=null==e?(t=null,Ge):(t=e).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(e=null,new jn):new On(e=t),&quot;function&quot;!=typeof i&amp;&amp;r.pointRadius(i),o):e},o.pointRadius=function(t){return arguments.length?(i=&quot;function&quot;==typeof t?t:(r.pointRadius(+t),+t),o):i},o.projection(t).context(e)},t.geoAlbers=ar,t.geoAlbersUsa=function(){var t,e,n,r,i,o,s=ar(),u=or().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=or().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){o=[t,e]}};function f(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function p(){return t=e=null,f}return f.invert=function(t){var e=s.scale(),n=s.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i&gt;=.12&amp;&amp;i&lt;.234&amp;&amp;r&gt;=-.425&amp;&amp;r&lt;-.214?u:i&gt;=.166&amp;&amp;i&lt;.234&amp;&amp;r&gt;=-.214&amp;&amp;r&lt;-.115?l:s).invert(t)},f.stream=function(n){return t&amp;&amp;e===n?t:(r=[s.stream(e=n),u.stream(n),l.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n&lt;i;)r[n].point(t,e)},sphere:function(){for(var t=-1;++t&lt;i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t&lt;i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t&lt;i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t&lt;i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t&lt;i;)r[t].polygonEnd()}});var r,i},f.precision=function(t){return arguments.length?(s.precision(t),u.precision(t),l.precision(t),p()):s.precision()},f.scale=function(t){return arguments.length?(s.scale(t),u.scale(.35*t),l.scale(t),f.translate(s.translate())):s.scale()},f.translate=function(t){if(!arguments.length)return s.translate();var e=s.scale(),o=+t[0],f=+t[1];return n=s.translate(t).clipExtent([[o-.455*e,f-.238*e],[o+.455*e,f+.238*e]]).stream(c),r=u.translate([o-.307*e,f+.201*e]).clipExtent([[o-.425*e+a,f+.12*e+a],[o-.214*e-a,f+.234*e-a]]).stream(c),i=l.translate([o-.205*e,f+.212*e]).clipExtent([[o-.214*e+a,f+.166*e+a],[o-.115*e-a,f+.234*e-a]]).stream(c),p()},f.fitExtent=function(t,e){return Hn(f,t,e)},f.fitSize=function(t,e){return $n(f,t,e)},f.fitWidth=function(t,e){return Kn(f,t,e)},f.fitHeight=function(t,e){return Yn(f,t,e)},f.scale(1070)},t.geoAzimuthalEqualArea=function(){return er(lr).scale(124.75).clipAngle(179.999)},t.geoAzimuthalEqualAreaRaw=lr,t.geoAzimuthalEquidistant=function(){return er(cr).scale(79.4188).clipAngle(179.999)},t.geoAzimuthalEquidistantRaw=cr,t.geoConicConformal=function(){return rr(dr).scale(109.5).parallels([30,30])},t.geoConicConformalRaw=dr,t.geoConicEqualArea=or,t.geoConicEqualAreaRaw=ir,t.geoConicEquidistant=function(){return rr(gr).scale(131.154).center([0,13.9389])},t.geoConicEquidistantRaw=gr,t.geoEqualEarth=function(){return er(xr).scale(177.158)},t.geoEqualEarthRaw=xr,t.geoEquirectangular=function(){return er(mr).scale(152.63)},t.geoEquirectangularRaw=mr,t.geoGnomonic=function(){return er(Er).scale(144.049).clipAngle(60)},t.geoGnomonicRaw=Er,t.geoIdentity=function(){var t,e,n,r,i,o,a=1,s=0,u=0,l=1,c=1,f=Ge,p=null,h=Ge;function d(){return r=i=null,o}return o={stream:function(t){return r&amp;&amp;i===t?r:r=f(h(i=t))},postclip:function(r){return arguments.length?(h=r,p=t=e=n=null,d()):h},clipExtent:function(r){return arguments.length?(h=null==r?(p=t=e=n=null,Ge):_e(p=+r[0][0],t=+r[0][1],e=+r[1][0],n=+r[1][1]),d()):null==p?null:[[p,t],[e,n]]},scale:function(t){return arguments.length?(f=kr((a=+t)*l,a*c,s,u),d()):a},translate:function(t){return arguments.length?(f=kr(a*l,a*c,s=+t[0],u=+t[1]),d()):[s,u]},reflectX:function(t){return arguments.length?(f=kr(a*(l=t?-1:1),a*c,s,u),d()):l&lt;0},reflectY:function(t){return arguments.length?(f=kr(a*l,a*(c=t?-1:1),s,u),d()):c&lt;0},fitExtent:function(t,e){return Hn(o,t,e)},fitSize:function(t,e){return $n(o,t,e)},fitWidth:function(t,e){return Kn(o,t,e)},fitHeight:function(t,e){return Yn(o,t,e)}}},t.geoProjection=er,t.geoProjectionMutator=nr,t.geoMercator=function(){return pr(fr).scale(961/f)},t.geoMercatorRaw=fr,t.geoNaturalEarth1=function(){return er(Tr).scale(175.295)},t.geoNaturalEarth1Raw=Tr,t.geoOrthographic=function(){return er(Nr).scale(249.5).clipAngle(90+a)},t.geoOrthographicRaw=Nr,t.geoStereographic=function(){return er(Sr).scale(250).clipAngle(142)},t.geoStereographicRaw=Sr,t.geoTransverseMercator=function(){var t=pr(Cr),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length&gt;2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=Cr,t.geoRotation=re,t.geoStream=D,t.geoTransform=function(t){return{stream:Un(t)}},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-array&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-array&quot;],i):i(r.d3=r.d3||{},r.d3)},{&quot;d3-array&quot;:304}],319:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;function e(t,e){return t.parent===e.parent?1:2}function n(t,e){return t+e.x}function r(t,e){return Math.max(t,e.y)}function i(t){var e=0,n=t.children,r=n&amp;&amp;n.length;if(r)for(;--r&gt;=0;)e+=n[r].value;else e=1;t.value=e}function o(t,e){var n,r,i,o,s,c=new l(t),f=+t.value&amp;&amp;(c.value=t.value),p=[c];for(null==e&amp;&amp;(e=a);n=p.pop();)if(f&amp;&amp;(n.value=+n.data.value),(i=e(n.data))&amp;&amp;(s=i.length))for(n.children=new Array(s),o=s-1;o&gt;=0;--o)p.push(r=n.children[o]=new l(i[o])),r.parent=n,r.depth=n.depth+1;return c.eachBefore(u)}function a(t){return t.children}function s(t){t.data=t.data.data}function u(t){var e=0;do{t.height=e}while((t=t.parent)&amp;&amp;t.height&lt;++e)}function l(t){this.data=t,this.depth=this.height=0,this.parent=null}l.prototype=o.prototype={constructor:l,count:function(){return this.eachAfter(i)},each:function(t){var e,n,r,i,o=this,a=[o];do{for(e=a.reverse(),a=[];o=e.pop();)if(t(o),n=o.children)for(r=0,i=n.length;r&lt;i;++r)a.push(n[r])}while(a.length);return this},eachAfter:function(t){for(var e,n,r,i=this,o=[i],a=[];i=o.pop();)if(a.push(i),e=i.children)for(n=0,r=e.length;n&lt;r;++n)o.push(e[n]);for(;i=a.pop();)t(i);return this},eachBefore:function(t){for(var e,n,r=this,i=[r];r=i.pop();)if(t(r),e=r.children)for(n=e.length-1;n&gt;=0;--n)i.push(e[n]);return this},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&amp;&amp;r.length;--i&gt;=0;)n+=r[i].value;e.value=n})},sort:function(t){return this.eachBefore(function(e){e.children&amp;&amp;e.children.sort(t)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&amp;&amp;e.push({source:n.parent,target:n})}),e},copy:function(){return o(this).eachBefore(s)}};var c=Array.prototype.slice;function f(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}(c.call(t))).length,o=[];r&lt;i;)e=t[r],n&amp;&amp;d(n,e)?++r:(n=g(o=p(o,e)),r=0);return n}function p(t,e){var n,r;if(m(e,t))return[e];for(n=0;n&lt;t.length;++n)if(h(e,t[n])&amp;&amp;m(v(t[n],e),t))return[t[n],e];for(n=0;n&lt;t.length-1;++n)for(r=n+1;r&lt;t.length;++r)if(h(v(t[n],t[r]),e)&amp;&amp;h(v(t[n],e),t[r])&amp;&amp;h(v(t[r],e),t[n])&amp;&amp;m(y(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function h(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n&lt;0||n*n&lt;r*r+i*i}function d(t,e){var n=t.r-e.r+1e-6,r=e.x-t.x,i=e.y-t.y;return n&gt;0&amp;&amp;n*n&gt;r*r+i*i}function m(t,e){for(var n=0;n&lt;e.length;++n)if(!d(t,e[n]))return!1;return!0}function g(t){switch(t.length){case 1:return{x:(e=t[0]).x,y:e.y,r:e.r};case 2:return v(t[0],t[1]);case 3:return y(t[0],t[1],t[2])}var e}function v(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,s=e.r,u=o-n,l=a-r,c=s-i,f=Math.sqrt(u*u+l*l);return{x:(n+o+u/f*c)/2,y:(r+a+l/f*c)/2,r:(f+i+s)/2}}function y(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,s=e.y,u=e.r,l=n.x,c=n.y,f=n.r,p=r-a,h=r-l,d=i-s,m=i-c,g=u-o,v=f-o,y=r*r+i*i-o*o,b=y-a*a-s*s+u*u,_=y-l*l-c*c+f*f,w=h*d-p*m,x=(d*_-m*b)/(2*w)-r,E=(m*g-d*v)/w,k=(h*b-p*_)/(2*w)-i,T=(p*v-h*g)/w,N=E*E+T*T-1,S=2*(o+x*E+k*T),C=x*x+k*k-o*o,A=-(N?(S+Math.sqrt(S*S-4*N*C))/(2*N):C/S);return{x:r+x+E*A,y:i+k+T*A,r:A}}function b(t,e,n){var r,i,o,a,s=t.x-e.x,u=t.y-e.y,l=s*s+u*u;l?(i=e.r+n.r,i*=i,a=t.r+n.r,i&gt;(a*=a)?(r=(l+a-i)/(2*l),o=Math.sqrt(Math.max(0,a/l-r*r)),n.x=t.x-r*s-o*u,n.y=t.y-r*u+o*s):(r=(l+i-a)/(2*l),o=Math.sqrt(Math.max(0,i/l-r*r)),n.x=e.x+r*s-o*u,n.y=e.y+r*u+o*s)):(n.x=e.x+n.r,n.y=e.y)}function _(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n&gt;0&amp;&amp;n*n&gt;r*r+i*i}function w(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function x(t){this._=t,this.next=null,this.previous=null}function E(t){if(!(i=t.length))return 0;var e,n,r,i,o,a,s,u,l,c,p;if((e=t[0]).x=0,e.y=0,!(i&gt;1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i&gt;2))return e.r+n.r;b(n,e,r=t[2]),e=new x(e),n=new x(n),r=new x(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(s=3;s&lt;i;++s){b(e._,n._,r=t[s]),r=new x(r),u=n.next,l=e.previous,c=n._.r,p=e._.r;do{if(c&lt;=p){if(_(u._,r._)){n=u,e.next=n,n.previous=e,--s;continue t}c+=u._.r,u=u.next}else{if(_(l._,r._)){(e=l).next=n,n.previous=e,--s;continue t}p+=l._.r,l=l.previous}}while(u!==l.next);for(r.previous=e,r.next=n,e.next=n.previous=n=r,o=w(e);(r=r.next)!==n;)(a=w(r))&lt;o&amp;&amp;(e=r,o=a);n=e.next}for(e=[n._],r=n;(r=r.next)!==n;)e.push(r._);for(r=f(e),s=0;s&lt;i;++s)(e=t[s]).x-=r.x,e.y-=r.y;return r.r}function k(t){if(&quot;function&quot;!=typeof t)throw new Error;return t}function T(){return 0}function N(t){return function(){return t}}function S(t){return Math.sqrt(t.value)}function C(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function A(t,e){return function(n){if(r=n.children){var r,i,o,a=r.length,s=t(n)*e||0;if(s)for(i=0;i&lt;a;++i)r[i].r+=s;if(o=E(r),s)for(i=0;i&lt;a;++i)r[i].r-=s;n.r=o+s}}}function I(t){return function(e){var n=e.parent;e.r*=t,n&amp;&amp;(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}function O(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function M(t,e,n,r,i){for(var o,a=t.children,s=-1,u=a.length,l=t.value&amp;&amp;(r-e)/t.value;++s&lt;u;)(o=a[s]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*l}var R=&quot;$&quot;,P={depth:-1},D={};function z(t){return t.id}function L(t){return t.parentId}function F(t,e){return t.parent===e.parent?1:2}function V(t){var e=t.children;return e?e[0]:t.t}function B(t){var e=t.children;return e?e[e.length-1]:t.t}function j(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function q(t,e,n){return t.a.parent===e.parent?t.a:n}function U(t,e){this._=t,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=e}function G(t,e,n,r,i){for(var o,a=t.children,s=-1,u=a.length,l=t.value&amp;&amp;(i-n)/t.value;++s&lt;u;)(o=a[s]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*l}U.prototype=Object.create(l.prototype);var W=(1+Math.sqrt(5))/2;function H(t,e,n,r,i,o){for(var a,s,u,l,c,f,p,h,d,m,g,v=[],y=e.children,b=0,_=0,w=y.length,x=e.value;b&lt;w;){u=i-n,l=o-r;do{c=y[_++].value}while(!c&amp;&amp;_&lt;w);for(f=p=c,g=c*c*(m=Math.max(l/u,u/l)/(x*t)),d=Math.max(p/g,g/f);_&lt;w;++_){if(c+=s=y[_].value,s&lt;f&amp;&amp;(f=s),s&gt;p&amp;&amp;(p=s),g=c*c*m,(h=Math.max(p/g,g/f))&gt;d){c-=s;break}d=h}v.push(a={value:c,dice:u&lt;l,children:y.slice(b,_)}),a.dice?M(a,n,r,i,x?r+=l*c/x:o):G(a,n,r,x?n+=u*c/x:i,o),x-=c,b=_}return v}var $=function t(e){function n(t,n,r,i,o){H(e,t,n,r,i,o)}return n.ratio=function(e){return t((e=+e)&gt;1?e:1)},n}(W);var K=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&amp;&amp;a.ratio===e)for(var a,s,u,l,c,f=-1,p=a.length,h=t.value;++f&lt;p;){for(u=(s=a[f]).children,l=s.value=0,c=u.length;l&lt;c;++l)s.value+=u[l].value;s.dice?M(s,n,r,i,r+=(o-r)*s.value/h):G(s,n,r,n+=(i-n)*s.value/h,o),h-=s.value}else t._squarify=a=H(e,t,n,r,i,o),a.ratio=e}return n.ratio=function(e){return t((e=+e)&gt;1?e:1)},n}(W);t.cluster=function(){var t=e,i=1,o=1,a=!1;function s(e){var s,u=0;e.eachAfter(function(e){var i=e.children;i?(e.x=function(t){return t.reduce(n,0)/t.length}(i),e.y=function(t){return 1+t.reduce(r,0)}(i)):(e.x=s?u+=t(e,s):0,e.y=0,s=e)});var l=function(t){for(var e;e=t.children;)t=e[0];return t}(e),c=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(e),f=l.x-t(l,c)/2,p=c.x+t(c,l)/2;return e.eachAfter(a?function(t){t.x=(t.x-e.x)*i,t.y=(e.y-t.y)*o}:function(t){t.x=(t.x-f)/(p-f)*i,t.y=(1-(e.y?t.y/e.y:1))*o})}return s.separation=function(e){return arguments.length?(t=e,s):t},s.size=function(t){return arguments.length?(a=!1,i=+t[0],o=+t[1],s):a?null:[i,o]},s.nodeSize=function(t){return arguments.length?(a=!0,i=+t[0],o=+t[1],s):a?[i,o]:null},s},t.hierarchy=o,t.pack=function(){var t=null,e=1,n=1,r=T;function i(i){return i.x=e/2,i.y=n/2,t?i.eachBefore(C(t)).eachAfter(A(r,.5)).eachBefore(I(1)):i.eachBefore(C(S)).eachAfter(A(T,1)).eachAfter(A(r,i.r/Math.min(e,n))).eachBefore(I(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=null==(n=e)?null:k(n),i):t;var n},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r=&quot;function&quot;==typeof t?t:N(+t),i):r},i},t.packSiblings=function(t){return E(t),t},t.packEnclose=f,t.partition=function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&amp;&amp;M(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,s=r.y1-n;a&lt;i&amp;&amp;(i=a=(i+a)/2),s&lt;o&amp;&amp;(o=s=(o+s)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=s}}(e,o)),r&amp;&amp;i.eachBefore(O),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i},t.stratify=function(){var t=z,e=L;function n(n){var r,i,o,a,s,c,f,p=n.length,h=new Array(p),d={};for(i=0;i&lt;p;++i)r=n[i],s=h[i]=new l(r),null!=(c=t(r,i,n))&amp;&amp;(c+=&quot;&quot;)&amp;&amp;(d[f=R+(s.id=c)]=f in d?D:s);for(i=0;i&lt;p;++i)if(s=h[i],null!=(c=e(n[i],i,n))&amp;&amp;(c+=&quot;&quot;)){if(!(a=d[R+c]))throw new Error(&quot;missing: &quot;+c);if(a===D)throw new Error(&quot;ambiguous: &quot;+c);a.children?a.children.push(s):a.children=[s],s.parent=a}else{if(o)throw new Error(&quot;multiple roots&quot;);o=s}if(!o)throw new Error(&quot;no root&quot;);if(o.parent=P,o.eachBefore(function(t){t.depth=t.parent.depth+1,--p}).eachBefore(u),o.parent=null,p&gt;0)throw new Error(&quot;cycle&quot;);return o}return n.id=function(e){return arguments.length?(t=k(e),n):t},n.parentId=function(t){return arguments.length?(e=k(t),n):e},n},t.tree=function(){var t=F,e=1,n=1,r=null;function i(i){var u=function(t){for(var e,n,r,i,o,a=new U(t,0),s=[a];e=s.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i&gt;=0;--i)s.push(n=e.children[i]=new U(r[i],i)),n.parent=e;return(a.parent=new U(null,0)).children=[a],a}(i);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(a),r)i.eachBefore(s);else{var l=i,c=i,f=i;i.eachBefore(function(t){t.x&lt;l.x&amp;&amp;(l=t),t.x&gt;c.x&amp;&amp;(c=t),t.depth&gt;f.depth&amp;&amp;(f=t)});var p=l===c?1:t(l,c)/2,h=p-l.x,d=e/(c.x+p+h),m=n/(f.depth||1);i.eachBefore(function(t){t.x=(t.x+h)*d,t.y=t.depth*m})}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o&gt;=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&amp;&amp;(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,u=o.parent.children[0],l=o.m,c=a.m,f=s.m,p=u.m;s=B(s),o=V(o),s&amp;&amp;o;)u=V(u),(a=B(a)).a=e,(i=s.z+f-o.z-l+t(s._,o._))&gt;0&amp;&amp;(j(q(s,e,r),e,i),l+=i,c+=i),f+=s.m,l+=o.m,p+=u.m,c+=a.m;s&amp;&amp;!B(a)&amp;&amp;(a.t=s,a.m+=f-c),o&amp;&amp;!V(u)&amp;&amp;(u.t=o,u.m+=l-p,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},t.treemap=function(){var t=$,e=!1,n=1,r=1,i=[0],o=T,a=T,s=T,u=T,l=T;function c(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&amp;&amp;t.eachBefore(O),t}function f(e){var n=i[e.depth],r=e.x0+n,c=e.y0+n,f=e.x1-n,p=e.y1-n;f&lt;r&amp;&amp;(r=f=(r+f)/2),p&lt;c&amp;&amp;(c=p=(c+p)/2),e.x0=r,e.y0=c,e.x1=f,e.y1=p,e.children&amp;&amp;(n=i[e.depth+1]=o(e)/2,r+=l(e)-n,c+=a(e)-n,f-=s(e)-n,p-=u(e)-n,f&lt;r&amp;&amp;(r=f=(r+f)/2),p&lt;c&amp;&amp;(c=p=(c+p)/2),t(e,r,c,f,p))}return c.round=function(t){return arguments.length?(e=!!t,c):e},c.size=function(t){return arguments.length?(n=+t[0],r=+t[1],c):[n,r]},c.tile=function(e){return arguments.length?(t=k(e),c):t},c.padding=function(t){return arguments.length?c.paddingInner(t).paddingOuter(t):c.paddingInner()},c.paddingInner=function(t){return arguments.length?(o=&quot;function&quot;==typeof t?t:N(+t),c):o},c.paddingOuter=function(t){return arguments.length?c.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):c.paddingTop()},c.paddingTop=function(t){return arguments.length?(a=&quot;function&quot;==typeof t?t:N(+t),c):a},c.paddingRight=function(t){return arguments.length?(s=&quot;function&quot;==typeof t?t:N(+t),c):s},c.paddingBottom=function(t){return arguments.length?(u=&quot;function&quot;==typeof t?t:N(+t),c):u},c.paddingLeft=function(t){return arguments.length?(l=&quot;function&quot;==typeof t?t:N(+t),c):l},c},t.treemapBinary=function(t,e,n,r,i){var o,a,s=t.children,u=s.length,l=new Array(u+1);for(l[0]=a=o=0;o&lt;u;++o)l[o+1]=a+=s[o].value;!function t(e,n,r,i,o,a,u){if(e&gt;=n-1){var c=s[e];return c.x0=i,c.y0=o,c.x1=a,void(c.y1=u)}for(var f=l[e],p=r/2+f,h=e+1,d=n-1;h&lt;d;){var m=h+d&gt;&gt;&gt;1;l[m]&lt;p?h=m+1:d=m}p-l[h-1]&lt;l[h]-p&amp;&amp;e+1&lt;h&amp;&amp;--h;var g=l[h]-f,v=r-g;if(a-i&gt;u-o){var y=(i*v+a*g)/r;t(e,h,g,i,o,y,u),t(h,n,v,y,o,a,u)}else{var b=(o*v+u*g)/r;t(e,h,g,i,o,a,b),t(h,n,v,i,b,a,u)}}(0,u,t.value,e,n,r,i)},t.treemapDice=M,t.treemapSlice=G,t.treemapSliceDice=function(t,e,n,r,i){(1&amp;t.depth?G:M)(t,e,n,r,i)},t.treemapSquarify=$,t.treemapResquarify=K,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],320:[function(t,e,n){var r,i;r=this,i=function(t,e){&quot;use strict&quot;;function n(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}function r(t){var e=t.length-1;return function(r){var i=r&lt;=0?r=0:r&gt;=1?(r=1,e-1):Math.floor(r*e),o=t[i],a=t[i+1],s=i&gt;0?t[i-1]:2*o-a,u=i&lt;e-1?t[i+2]:2*a-o;return n((r-i/e)*e,s,o,a,u)}}function i(t){var e=t.length;return function(r){var i=Math.floor(((r%=1)&lt;0?++r:r)*e),o=t[(i+e-1)%e],a=t[i%e],s=t[(i+1)%e],u=t[(i+2)%e];return n((r-i/e)*e,o,a,s,u)}}function o(t){return function(){return t}}function a(t,e){return function(n){return t+n*e}}function s(t,e){var n=e-t;return n?a(t,n&gt;180||n&lt;-180?n-360*Math.round(n/360):n):o(isNaN(t)?e:t)}function u(t){return 1==(t=+t)?l:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):o(isNaN(e)?n:e)}}function l(t,e){var n=e-t;return n?a(t,n):o(isNaN(t)?e:t)}var c=function t(n){var r=u(n);function i(t,n){var i=r((t=e.rgb(t)).r,(n=e.rgb(n)).r),o=r(t.g,n.g),a=r(t.b,n.b),s=l(t.opacity,n.opacity);return function(e){return t.r=i(e),t.g=o(e),t.b=a(e),t.opacity=s(e),t+&quot;&quot;}}return i.gamma=t,i}(1);function f(t){return function(n){var r,i,o=n.length,a=new Array(o),s=new Array(o),u=new Array(o);for(r=0;r&lt;o;++r)i=e.rgb(n[r]),a[r]=i.r||0,s[r]=i.g||0,u[r]=i.b||0;return a=t(a),s=t(s),u=t(u),i.opacity=1,function(t){return i.r=a(t),i.g=s(t),i.b=u(t),i+&quot;&quot;}}}var p=f(r),h=f(i);function d(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n&lt;i;++n)o[n]=w(t[n],e[n]);for(;n&lt;r;++n)a[n]=e[n];return function(t){for(n=0;n&lt;i;++n)a[n]=o[n](t);return a}}function m(t,e){var n=new Date;return e-=t=+t,function(r){return n.setTime(t+e*r),n}}function g(t,e){return e-=t=+t,function(n){return t+e*n}}function v(t,e){var n,r={},i={};for(n in null!==t&amp;&amp;&quot;object&quot;==typeof t||(t={}),null!==e&amp;&amp;&quot;object&quot;==typeof e||(e={}),e)n in t?r[n]=w(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var y=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,b=new RegExp(y.source,&quot;g&quot;);function _(t,e){var n,r,i,o=y.lastIndex=b.lastIndex=0,a=-1,s=[],u=[];for(t+=&quot;&quot;,e+=&quot;&quot;;(n=y.exec(t))&amp;&amp;(r=b.exec(e));)(i=r.index)&gt;o&amp;&amp;(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:g(n,r)})),o=b.lastIndex;return o&lt;e.length&amp;&amp;(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length&lt;2?u[0]?function(t){return function(e){return t(e)+&quot;&quot;}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var n,r=0;r&lt;e;++r)s[(n=u[r]).i]=n.x(t);return s.join(&quot;&quot;)})}function w(t,n){var r,i=typeof n;return null==n||&quot;boolean&quot;===i?o(n):(&quot;number&quot;===i?g:&quot;string&quot;===i?(r=e.color(n))?(n=r,c):_:n instanceof e.color?c:n instanceof Date?m:Array.isArray(n)?d:&quot;function&quot;!=typeof n.valueOf&amp;&amp;&quot;function&quot;!=typeof n.toString||isNaN(n)?v:g)(t,n)}var x,E,k,T,N=180/Math.PI,S={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function C(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&amp;&amp;(t/=a,e/=a),(u=t*n+e*r)&amp;&amp;(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&amp;&amp;(n/=s,r/=s,u/=s),t*r&lt;e*n&amp;&amp;(t=-t,e=-e,u=-u,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*N,skewX:Math.atan(u)*N,scaleX:a,scaleY:s}}function A(t,e,n,r){function i(t){return t.length?t.pop()+&quot; &quot;:&quot;&quot;}return function(o,a){var s=[],u=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var u=a.push(&quot;translate(&quot;,null,e,null,n);s.push({i:u-4,x:g(t,i)},{i:u-2,x:g(r,o)})}else(i||o)&amp;&amp;a.push(&quot;translate(&quot;+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,u),function(t,e,n,o){t!==e?(t-e&gt;180?e+=360:e-t&gt;180&amp;&amp;(t+=360),o.push({i:n.push(i(n)+&quot;rotate(&quot;,null,r)-2,x:g(t,e)})):e&amp;&amp;n.push(i(n)+&quot;rotate(&quot;+e+r)}(o.rotate,a.rotate,s,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+&quot;skewX(&quot;,null,r)-2,x:g(t,e)}):e&amp;&amp;n.push(i(n)+&quot;skewX(&quot;+e+r)}(o.skewX,a.skewX,s,u),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+&quot;scale(&quot;,null,&quot;,&quot;,null,&quot;)&quot;);a.push({i:s-4,x:g(t,n)},{i:s-2,x:g(e,r)})}else 1===n&amp;&amp;1===r||o.push(i(o)+&quot;scale(&quot;+n+&quot;,&quot;+r+&quot;)&quot;)}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var e,n=-1,r=u.length;++n&lt;r;)s[(e=u[n]).i]=e.x(t);return s.join(&quot;&quot;)}}}var I=A(function(t){return&quot;none&quot;===t?S:(x||(x=document.createElement(&quot;DIV&quot;),E=document.documentElement,k=document.defaultView),x.style.transform=t,t=k.getComputedStyle(E.appendChild(x),null).getPropertyValue(&quot;transform&quot;),E.removeChild(x),C(+(t=t.slice(7,-1).split(&quot;,&quot;))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},&quot;px, &quot;,&quot;px)&quot;,&quot;deg)&quot;),O=A(function(t){return null==t?S:(T||(T=document.createElementNS(&quot;http://www.w3.org/2000/svg&quot;,&quot;g&quot;)),T.setAttribute(&quot;transform&quot;,t),(t=T.transform.baseVal.consolidate())?C((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):S)},&quot;, &quot;,&quot;)&quot;,&quot;)&quot;),M=Math.SQRT2,R=2,P=4,D=1e-12;function z(t){return((t=Math.exp(t))+1/t)/2}function L(t){return function(n,r){var i=t((n=e.hsl(n)).h,(r=e.hsl(r)).h),o=l(n.s,r.s),a=l(n.l,r.l),s=l(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(t),n.opacity=s(t),n+&quot;&quot;}}}var F=L(s),V=L(l);function B(t){return function(n,r){var i=t((n=e.hcl(n)).h,(r=e.hcl(r)).h),o=l(n.c,r.c),a=l(n.l,r.l),s=l(n.opacity,r.opacity);return function(t){return n.h=i(t),n.c=o(t),n.l=a(t),n.opacity=s(t),n+&quot;&quot;}}}var j=B(s),q=B(l);function U(t){return function n(r){function i(n,i){var o=t((n=e.cubehelix(n)).h,(i=e.cubehelix(i)).h),a=l(n.s,i.s),s=l(n.l,i.l),u=l(n.opacity,i.opacity);return function(t){return n.h=o(t),n.s=a(t),n.l=s(Math.pow(t,r)),n.opacity=u(t),n+&quot;&quot;}}return r=+r,i.gamma=n,i}(1)}var G=U(s),W=U(l);t.interpolate=w,t.interpolateArray=d,t.interpolateBasis=r,t.interpolateBasisClosed=i,t.interpolateDate=m,t.interpolateDiscrete=function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},t.interpolateHue=function(t,e){var n=s(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},t.interpolateNumber=g,t.interpolateObject=v,t.interpolateRound=function(t,e){return e-=t=+t,function(n){return Math.round(t+e*n)}},t.interpolateString=_,t.interpolateTransformCss=I,t.interpolateTransformSvg=O,t.interpolateZoom=function(t,e){var n,r,i=t[0],o=t[1],a=t[2],s=e[0],u=e[1],l=e[2],c=s-i,f=u-o,p=c*c+f*f;if(p&lt;D)r=Math.log(l/a)/M,n=function(t){return[i+t*c,o+t*f,a*Math.exp(M*t*r)]};else{var h=Math.sqrt(p),d=(l*l-a*a+P*p)/(2*a*R*h),m=(l*l-a*a-P*p)/(2*l*R*h),g=Math.log(Math.sqrt(d*d+1)-d),v=Math.log(Math.sqrt(m*m+1)-m);r=(v-g)/M,n=function(t){var e,n=t*r,s=z(g),u=a/(R*h)*(s*(e=M*n+g,((e=Math.exp(2*e))-1)/(e+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+u*c,o+u*f,a*s/z(M*n+g)]}}return n.duration=1e3*r,n},t.interpolateRgb=c,t.interpolateRgbBasis=p,t.interpolateRgbBasisClosed=h,t.interpolateHsl=F,t.interpolateHslLong=V,t.interpolateLab=function(t,n){var r=l((t=e.lab(t)).l,(n=e.lab(n)).l),i=l(t.a,n.a),o=l(t.b,n.b),a=l(t.opacity,n.opacity);return function(e){return t.l=r(e),t.a=i(e),t.b=o(e),t.opacity=a(e),t+&quot;&quot;}},t.interpolateHcl=j,t.interpolateHclLong=q,t.interpolateCubehelix=G,t.interpolateCubehelixLong=W,t.piecewise=function(t,e){for(var n=0,r=e.length-1,i=e[0],o=new Array(r&lt;0?0:r);n&lt;r;)o[n]=t(i,i=e[++n]);return function(t){var e=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[e](t-e)}},t.quantize=function(t,e){for(var n=new Array(e),r=0;r&lt;e;++r)n[r]=t(r/(e-1));return n},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-color&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-color&quot;],i):i(r.d3=r.d3||{},r.d3)},{&quot;d3-color&quot;:309}],321:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;var e=Math.PI,n=2*e,r=n-1e-6;function i(){this._x0=this._y0=this._x1=this._y1=null,this._=&quot;&quot;}function o(){return new i}i.prototype=o.prototype={constructor:i,moveTo:function(t,e){this._+=&quot;M&quot;+(this._x0=this._x1=+t)+&quot;,&quot;+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&amp;&amp;(this._x1=this._x0,this._y1=this._y0,this._+=&quot;Z&quot;)},lineTo:function(t,e){this._+=&quot;L&quot;+(this._x1=+t)+&quot;,&quot;+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+=&quot;Q&quot;+ +t+&quot;,&quot;+ +e+&quot;,&quot;+(this._x1=+n)+&quot;,&quot;+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,i,o){this._+=&quot;C&quot;+ +t+&quot;,&quot;+ +e+&quot;,&quot;+ +n+&quot;,&quot;+ +r+&quot;,&quot;+(this._x1=+i)+&quot;,&quot;+(this._y1=+o)},arcTo:function(t,n,r,i,o){t=+t,n=+n,r=+r,i=+i,o=+o;var a=this._x1,s=this._y1,u=r-t,l=i-n,c=a-t,f=s-n,p=c*c+f*f;if(o&lt;0)throw new Error(&quot;negative radius: &quot;+o);if(null===this._x1)this._+=&quot;M&quot;+(this._x1=t)+&quot;,&quot;+(this._y1=n);else if(p&gt;1e-6)if(Math.abs(f*u-l*c)&gt;1e-6&amp;&amp;o){var h=r-a,d=i-s,m=u*u+l*l,g=h*h+d*d,v=Math.sqrt(m),y=Math.sqrt(p),b=o*Math.tan((e-Math.acos((m+p-g)/(2*v*y)))/2),_=b/y,w=b/v;Math.abs(_-1)&gt;1e-6&amp;&amp;(this._+=&quot;L&quot;+(t+_*c)+&quot;,&quot;+(n+_*f)),this._+=&quot;A&quot;+o+&quot;,&quot;+o+&quot;,0,0,&quot;+ +(f*h&gt;c*d)+&quot;,&quot;+(this._x1=t+w*u)+&quot;,&quot;+(this._y1=n+w*l)}else this._+=&quot;L&quot;+(this._x1=t)+&quot;,&quot;+(this._y1=n);else;},arc:function(t,i,o,a,s,u){t=+t,i=+i;var l=(o=+o)*Math.cos(a),c=o*Math.sin(a),f=t+l,p=i+c,h=1^u,d=u?a-s:s-a;if(o&lt;0)throw new Error(&quot;negative radius: &quot;+o);null===this._x1?this._+=&quot;M&quot;+f+&quot;,&quot;+p:(Math.abs(this._x1-f)&gt;1e-6||Math.abs(this._y1-p)&gt;1e-6)&amp;&amp;(this._+=&quot;L&quot;+f+&quot;,&quot;+p),o&amp;&amp;(d&lt;0&amp;&amp;(d=d%n+n),d&gt;r?this._+=&quot;A&quot;+o+&quot;,&quot;+o+&quot;,0,1,&quot;+h+&quot;,&quot;+(t-l)+&quot;,&quot;+(i-c)+&quot;A&quot;+o+&quot;,&quot;+o+&quot;,0,1,&quot;+h+&quot;,&quot;+(this._x1=f)+&quot;,&quot;+(this._y1=p):d&gt;1e-6&amp;&amp;(this._+=&quot;A&quot;+o+&quot;,&quot;+o+&quot;,0,&quot;+ +(d&gt;=e)+&quot;,&quot;+h+&quot;,&quot;+(this._x1=t+o*Math.cos(s))+&quot;,&quot;+(this._y1=i+o*Math.sin(s))))},rect:function(t,e,n,r){this._+=&quot;M&quot;+(this._x0=this._x1=+t)+&quot;,&quot;+(this._y0=this._y1=+e)+&quot;h&quot;+ +n+&quot;v&quot;+ +r+&quot;h&quot;+-n+&quot;Z&quot;},toString:function(){return this._}},t.path=o,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],322:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;function e(t,e){return t[0]-e[0]||t[1]-e[1]}function n(t){for(var e,n,r,i=t.length,o=[0,1],a=2,s=2;s&lt;i;++s){for(;a&gt;1&amp;&amp;(e=t[o[a-2]],n=t[o[a-1]],r=t[s],(n[0]-e[0])*(r[1]-e[1])-(n[1]-e[1])*(r[0]-e[0])&lt;=0);)--a;o[a++]=s}return o.slice(0,a)}t.polygonArea=function(t){for(var e,n=-1,r=t.length,i=t[r-1],o=0;++n&lt;r;)e=i,i=t[n],o+=e[1]*i[0]-e[0]*i[1];return o/2},t.polygonCentroid=function(t){for(var e,n,r=-1,i=t.length,o=0,a=0,s=t[i-1],u=0;++r&lt;i;)e=s,s=t[r],u+=n=e[0]*s[1]-s[0]*e[1],o+=(e[0]+s[0])*n,a+=(e[1]+s[1])*n;return[o/(u*=3),a/u]},t.polygonHull=function(t){if((i=t.length)&lt;3)return null;var r,i,o=new Array(i),a=new Array(i);for(r=0;r&lt;i;++r)o[r]=[+t[r][0],+t[r][1],r];for(o.sort(e),r=0;r&lt;i;++r)a[r]=[o[r][0],-o[r][1]];var s=n(o),u=n(a),l=u[0]===s[0],c=u[u.length-1]===s[s.length-1],f=[];for(r=s.length-1;r&gt;=0;--r)f.push(t[o[s[r]][2]]);for(r=+l;r&lt;u.length-c;++r)f.push(t[o[u[r]][2]]);return f},t.polygonContains=function(t,e){for(var n,r,i=t.length,o=t[i-1],a=e[0],s=e[1],u=o[0],l=o[1],c=!1,f=0;f&lt;i;++f)n=(o=t[f])[0],(r=o[1])&gt;s!=l&gt;s&amp;&amp;a&lt;(u-n)*(s-r)/(l-r)+n&amp;&amp;(c=!c),u=n,l=r;return c},t.polygonLength=function(t){for(var e,n,r=-1,i=t.length,o=t[i-1],a=o[0],s=o[1],u=0;++r&lt;i;)e=a,n=s,e-=a=(o=t[r])[0],n-=s=o[1],u+=Math.sqrt(e*e+n*n);return u},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],323:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;function e(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,u,l,c,f,p,h=t._root,d={data:r},m=t._x0,g=t._y0,v=t._x1,y=t._y1;if(!h)return t._root=d,t;for(;h.length;)if((l=e&gt;=(o=(m+v)/2))?m=o:v=o,(c=n&gt;=(a=(g+y)/2))?g=a:y=a,i=h,!(h=h[f=c&lt;&lt;1|l]))return i[f]=d,t;if(s=+t._x.call(null,h.data),u=+t._y.call(null,h.data),e===s&amp;&amp;n===u)return d.next=h,i?i[f]=d:t._root=d,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(l=e&gt;=(o=(m+v)/2))?m=o:v=o,(c=n&gt;=(a=(g+y)/2))?g=a:y=a}while((f=c&lt;&lt;1|l)==(p=(u&gt;=a)&lt;&lt;1|s&gt;=o));return i[p]=h,i[f]=d,t}function n(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function r(t){return t[0]}function i(t){return t[1]}function o(t,e,n){var o=new a(null==e?r:e,null==n?i:n,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function a(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function s(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var u=o.prototype=a.prototype;u.copy=function(){var t,e,n=new a(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=s(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i&lt;4;++i)(e=r.source[i])&amp;&amp;(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=s(e));return n},u.add=function(t){var n=+this._x.call(null,t),r=+this._y.call(null,t);return e(this.cover(n,r),n,r,t)},u.addAll=function(t){var n,r,i,o,a=t.length,s=new Array(a),u=new Array(a),l=1/0,c=1/0,f=-1/0,p=-1/0;for(r=0;r&lt;a;++r)isNaN(i=+this._x.call(null,n=t[r]))||isNaN(o=+this._y.call(null,n))||(s[r]=i,u[r]=o,i&lt;l&amp;&amp;(l=i),i&gt;f&amp;&amp;(f=i),o&lt;c&amp;&amp;(c=o),o&gt;p&amp;&amp;(p=o));if(l&gt;f||c&gt;p)return this;for(this.cover(l,c).cover(f,p),r=0;r&lt;a;++r)e(this,s[r],u[r],t[r]);return this},u.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,u=i-n,l=this._root;n&gt;t||t&gt;=i||r&gt;e||e&gt;=o;)switch(s=(e&lt;r)&lt;&lt;1|t&lt;n,(a=new Array(4))[s]=l,l=a,u*=2,s){case 0:i=n+u,o=r+u;break;case 1:n=i-u,o=r+u;break;case 2:i=n+u,r=o-u;break;case 3:n=i-u,r=o-u}this._root&amp;&amp;this._root.length&amp;&amp;(this._root=l)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},u.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},u.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},u.find=function(t,e,r){var i,o,a,s,u,l,c,f=this._x0,p=this._y0,h=this._x1,d=this._y1,m=[],g=this._root;for(g&amp;&amp;m.push(new n(g,f,p,h,d)),null==r?r=1/0:(f=t-r,p=e-r,h=t+r,d=e+r,r*=r);l=m.pop();)if(!(!(g=l.node)||(o=l.x0)&gt;h||(a=l.y0)&gt;d||(s=l.x1)&lt;f||(u=l.y1)&lt;p))if(g.length){var v=(o+s)/2,y=(a+u)/2;m.push(new n(g[3],v,y,s,u),new n(g[2],o,y,v,u),new n(g[1],v,a,s,y),new n(g[0],o,a,v,y)),(c=(e&gt;=y)&lt;&lt;1|t&gt;=v)&amp;&amp;(l=m[m.length-1],m[m.length-1]=m[m.length-1-c],m[m.length-1-c]=l)}else{var b=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),w=b*b+_*_;if(w&lt;r){var x=Math.sqrt(r=w);f=t-x,p=e-x,h=t+x,d=e+x,i=g.data}}return i},u.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,s,u,l,c,f,p,h=this._root,d=this._x0,m=this._y0,g=this._x1,v=this._y1;if(!h)return this;if(h.length)for(;;){if((l=o&gt;=(s=(d+g)/2))?d=s:g=s,(c=a&gt;=(u=(m+v)/2))?m=u:v=u,e=h,!(h=h[f=c&lt;&lt;1|l]))return this;if(!h.length)break;(e[f+1&amp;3]||e[f+2&amp;3]||e[f+3&amp;3])&amp;&amp;(n=e,p=f)}for(;h.data!==t;)if(r=h,!(h=h.next))return this;return(i=h.next)&amp;&amp;delete h.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(h=e[0]||e[1]||e[2]||e[3])&amp;&amp;h===(e[3]||e[2]||e[1]||e[0])&amp;&amp;!h.length&amp;&amp;(n?n[p]=h:this._root=h),this):(this._root=i,this)},u.removeAll=function(t){for(var e=0,n=t.length;e&lt;n;++e)this.remove(t[e]);return this},u.root=function(){return this._root},u.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},u.visit=function(t){var e,r,i,o,a,s,u=[],l=this._root;for(l&amp;&amp;u.push(new n(l,this._x0,this._y0,this._x1,this._y1));e=u.pop();)if(!t(l=e.node,i=e.x0,o=e.y0,a=e.x1,s=e.y1)&amp;&amp;l.length){var c=(i+a)/2,f=(o+s)/2;(r=l[3])&amp;&amp;u.push(new n(r,c,f,a,s)),(r=l[2])&amp;&amp;u.push(new n(r,i,f,c,s)),(r=l[1])&amp;&amp;u.push(new n(r,c,o,a,f)),(r=l[0])&amp;&amp;u.push(new n(r,i,o,c,f))}return this},u.visitAfter=function(t){var e,r=[],i=[];for(this._root&amp;&amp;r.push(new n(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var a,s=e.x0,u=e.y0,l=e.x1,c=e.y1,f=(s+l)/2,p=(u+c)/2;(a=o[0])&amp;&amp;r.push(new n(a,s,u,f,p)),(a=o[1])&amp;&amp;r.push(new n(a,f,u,l,p)),(a=o[2])&amp;&amp;r.push(new n(a,s,p,f,c)),(a=o[3])&amp;&amp;r.push(new n(a,f,p,l,c))}i.push(e)}for(;e=i.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},u.x=function(t){return arguments.length?(this._x=t,this):this._x},u.y=function(t){return arguments.length?(this._y=t,this):this._y},t.quadtree=o,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],324:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;function e(){return Math.random()}var n=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,1===arguments.length?(n=t,t=0):n-=t,function(){return e()*n+t}}return n.source=t,n}(e),r=function t(e){function n(t,n){var r,i;return t=null==t?0:+t,n=null==n?1:+n,function(){var o;if(null!=r)o=r,r=null;else do{r=2*e()-1,o=2*e()-1,i=r*r+o*o}while(!i||i&gt;1);return t+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=t,n}(e),i=function t(e){function n(){var t=r.source(e).apply(this,arguments);return function(){return Math.exp(t())}}return n.source=t,n}(e),o=function t(e){function n(t){return function(){for(var n=0,r=0;r&lt;t;++r)n+=e();return n}}return n.source=t,n}(e),a=function t(e){function n(t){var n=o.source(e)(t);return function(){return n()/t}}return n.source=t,n}(e),s=function t(e){function n(t){return function(){return-Math.log(1-e())/t}}return n.source=t,n}(e);t.randomUniform=n,t.randomNormal=r,t.randomLogNormal=i,t.randomBates=a,t.randomIrwinHall=o,t.randomExponential=s,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],325:[function(t,e,n){var r,i;r=this,i=function(t,e,n){&quot;use strict&quot;;function r(t){for(var e=t.length/6|0,n=new Array(e),r=0;r&lt;e;)n[r]=&quot;#&quot;+t.slice(6*r,6*++r);return n}var i=r(&quot;1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf&quot;),o=r(&quot;7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666&quot;),a=r(&quot;1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666&quot;),s=r(&quot;a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928&quot;),u=r(&quot;fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2&quot;),l=r(&quot;b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc&quot;),c=r(&quot;e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999&quot;),f=r(&quot;66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3&quot;),p=r(&quot;8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f&quot;);function h(t){return e.interpolateRgbBasis(t[t.length-1])}var d=new Array(3).concat(&quot;d8b365f5f5f55ab4ac&quot;,&quot;a6611adfc27d80cdc1018571&quot;,&quot;a6611adfc27df5f5f580cdc1018571&quot;,&quot;8c510ad8b365f6e8c3c7eae55ab4ac01665e&quot;,&quot;8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e&quot;,&quot;8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e&quot;,&quot;8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e&quot;,&quot;5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30&quot;,&quot;5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30&quot;).map(r),m=h(d),g=new Array(3).concat(&quot;af8dc3f7f7f77fbf7b&quot;,&quot;7b3294c2a5cfa6dba0008837&quot;,&quot;7b3294c2a5cff7f7f7a6dba0008837&quot;,&quot;762a83af8dc3e7d4e8d9f0d37fbf7b1b7837&quot;,&quot;762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837&quot;,&quot;762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837&quot;,&quot;762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837&quot;,&quot;40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b&quot;,&quot;40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b&quot;).map(r),v=h(g),y=new Array(3).concat(&quot;e9a3c9f7f7f7a1d76a&quot;,&quot;d01c8bf1b6dab8e1864dac26&quot;,&quot;d01c8bf1b6daf7f7f7b8e1864dac26&quot;,&quot;c51b7de9a3c9fde0efe6f5d0a1d76a4d9221&quot;,&quot;c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221&quot;,&quot;c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221&quot;,&quot;c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221&quot;,&quot;8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419&quot;,&quot;8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419&quot;).map(r),b=h(y),_=new Array(3).concat(&quot;998ec3f7f7f7f1a340&quot;,&quot;5e3c99b2abd2fdb863e66101&quot;,&quot;5e3c99b2abd2f7f7f7fdb863e66101&quot;,&quot;542788998ec3d8daebfee0b6f1a340b35806&quot;,&quot;542788998ec3d8daebf7f7f7fee0b6f1a340b35806&quot;,&quot;5427888073acb2abd2d8daebfee0b6fdb863e08214b35806&quot;,&quot;5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806&quot;,&quot;2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08&quot;,&quot;2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08&quot;).map(r),w=h(_),x=new Array(3).concat(&quot;ef8a62f7f7f767a9cf&quot;,&quot;ca0020f4a58292c5de0571b0&quot;,&quot;ca0020f4a582f7f7f792c5de0571b0&quot;,&quot;b2182bef8a62fddbc7d1e5f067a9cf2166ac&quot;,&quot;b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac&quot;,&quot;b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac&quot;,&quot;b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac&quot;,&quot;67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061&quot;,&quot;67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061&quot;).map(r),E=h(x),k=new Array(3).concat(&quot;ef8a62ffffff999999&quot;,&quot;ca0020f4a582bababa404040&quot;,&quot;ca0020f4a582ffffffbababa404040&quot;,&quot;b2182bef8a62fddbc7e0e0e09999994d4d4d&quot;,&quot;b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d&quot;,&quot;b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d&quot;,&quot;b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d&quot;,&quot;67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a&quot;,&quot;67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a&quot;).map(r),T=h(k),N=new Array(3).concat(&quot;fc8d59ffffbf91bfdb&quot;,&quot;d7191cfdae61abd9e92c7bb6&quot;,&quot;d7191cfdae61ffffbfabd9e92c7bb6&quot;,&quot;d73027fc8d59fee090e0f3f891bfdb4575b4&quot;,&quot;d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4&quot;,&quot;d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4&quot;,&quot;d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4&quot;,&quot;a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695&quot;,&quot;a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695&quot;).map(r),S=h(N),C=new Array(3).concat(&quot;fc8d59ffffbf91cf60&quot;,&quot;d7191cfdae61a6d96a1a9641&quot;,&quot;d7191cfdae61ffffbfa6d96a1a9641&quot;,&quot;d73027fc8d59fee08bd9ef8b91cf601a9850&quot;,&quot;d73027fc8d59fee08bffffbfd9ef8b91cf601a9850&quot;,&quot;d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850&quot;,&quot;d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850&quot;,&quot;a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837&quot;,&quot;a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837&quot;).map(r),A=h(C),I=new Array(3).concat(&quot;fc8d59ffffbf99d594&quot;,&quot;d7191cfdae61abdda42b83ba&quot;,&quot;d7191cfdae61ffffbfabdda42b83ba&quot;,&quot;d53e4ffc8d59fee08be6f59899d5943288bd&quot;,&quot;d53e4ffc8d59fee08bffffbfe6f59899d5943288bd&quot;,&quot;d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd&quot;,&quot;d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd&quot;,&quot;9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2&quot;,&quot;9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2&quot;).map(r),O=h(I),M=new Array(3).concat(&quot;e5f5f999d8c92ca25f&quot;,&quot;edf8fbb2e2e266c2a4238b45&quot;,&quot;edf8fbb2e2e266c2a42ca25f006d2c&quot;,&quot;edf8fbccece699d8c966c2a42ca25f006d2c&quot;,&quot;edf8fbccece699d8c966c2a441ae76238b45005824&quot;,&quot;f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824&quot;,&quot;f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b&quot;).map(r),R=h(M),P=new Array(3).concat(&quot;e0ecf49ebcda8856a7&quot;,&quot;edf8fbb3cde38c96c688419d&quot;,&quot;edf8fbb3cde38c96c68856a7810f7c&quot;,&quot;edf8fbbfd3e69ebcda8c96c68856a7810f7c&quot;,&quot;edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b&quot;,&quot;f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b&quot;,&quot;f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b&quot;).map(r),D=h(P),z=new Array(3).concat(&quot;e0f3dba8ddb543a2ca&quot;,&quot;f0f9e8bae4bc7bccc42b8cbe&quot;,&quot;f0f9e8bae4bc7bccc443a2ca0868ac&quot;,&quot;f0f9e8ccebc5a8ddb57bccc443a2ca0868ac&quot;,&quot;f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e&quot;,&quot;f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e&quot;,&quot;f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081&quot;).map(r),L=h(z),F=new Array(3).concat(&quot;fee8c8fdbb84e34a33&quot;,&quot;fef0d9fdcc8afc8d59d7301f&quot;,&quot;fef0d9fdcc8afc8d59e34a33b30000&quot;,&quot;fef0d9fdd49efdbb84fc8d59e34a33b30000&quot;,&quot;fef0d9fdd49efdbb84fc8d59ef6548d7301f990000&quot;,&quot;fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000&quot;,&quot;fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000&quot;).map(r),V=h(F),B=new Array(3).concat(&quot;ece2f0a6bddb1c9099&quot;,&quot;f6eff7bdc9e167a9cf02818a&quot;,&quot;f6eff7bdc9e167a9cf1c9099016c59&quot;,&quot;f6eff7d0d1e6a6bddb67a9cf1c9099016c59&quot;,&quot;f6eff7d0d1e6a6bddb67a9cf3690c002818a016450&quot;,&quot;fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450&quot;,&quot;fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636&quot;).map(r),j=h(B),q=new Array(3).concat(&quot;ece7f2a6bddb2b8cbe&quot;,&quot;f1eef6bdc9e174a9cf0570b0&quot;,&quot;f1eef6bdc9e174a9cf2b8cbe045a8d&quot;,&quot;f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d&quot;,&quot;f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b&quot;,&quot;fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b&quot;,&quot;fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858&quot;).map(r),U=h(q),G=new Array(3).concat(&quot;e7e1efc994c7dd1c77&quot;,&quot;f1eef6d7b5d8df65b0ce1256&quot;,&quot;f1eef6d7b5d8df65b0dd1c77980043&quot;,&quot;f1eef6d4b9dac994c7df65b0dd1c77980043&quot;,&quot;f1eef6d4b9dac994c7df65b0e7298ace125691003f&quot;,&quot;f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f&quot;,&quot;f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f&quot;).map(r),W=h(G),H=new Array(3).concat(&quot;fde0ddfa9fb5c51b8a&quot;,&quot;feebe2fbb4b9f768a1ae017e&quot;,&quot;feebe2fbb4b9f768a1c51b8a7a0177&quot;,&quot;feebe2fcc5c0fa9fb5f768a1c51b8a7a0177&quot;,&quot;feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177&quot;,&quot;fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177&quot;,&quot;fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a&quot;).map(r),$=h(H),K=new Array(3).concat(&quot;edf8b17fcdbb2c7fb8&quot;,&quot;ffffcca1dab441b6c4225ea8&quot;,&quot;ffffcca1dab441b6c42c7fb8253494&quot;,&quot;ffffccc7e9b47fcdbb41b6c42c7fb8253494&quot;,&quot;ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84&quot;,&quot;ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84&quot;,&quot;ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58&quot;).map(r),Y=h(K),X=new Array(3).concat(&quot;f7fcb9addd8e31a354&quot;,&quot;ffffccc2e69978c679238443&quot;,&quot;ffffccc2e69978c67931a354006837&quot;,&quot;ffffccd9f0a3addd8e78c67931a354006837&quot;,&quot;ffffccd9f0a3addd8e78c67941ab5d238443005a32&quot;,&quot;ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32&quot;,&quot;ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529&quot;).map(r),Z=h(X),Q=new Array(3).concat(&quot;fff7bcfec44fd95f0e&quot;,&quot;ffffd4fed98efe9929cc4c02&quot;,&quot;ffffd4fed98efe9929d95f0e993404&quot;,&quot;ffffd4fee391fec44ffe9929d95f0e993404&quot;,&quot;ffffd4fee391fec44ffe9929ec7014cc4c028c2d04&quot;,&quot;ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04&quot;,&quot;ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506&quot;).map(r),J=h(Q),tt=new Array(3).concat(&quot;ffeda0feb24cf03b20&quot;,&quot;ffffb2fecc5cfd8d3ce31a1c&quot;,&quot;ffffb2fecc5cfd8d3cf03b20bd0026&quot;,&quot;ffffb2fed976feb24cfd8d3cf03b20bd0026&quot;,&quot;ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026&quot;,&quot;ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026&quot;,&quot;ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026&quot;).map(r),et=h(tt),nt=new Array(3).concat(&quot;deebf79ecae13182bd&quot;,&quot;eff3ffbdd7e76baed62171b5&quot;,&quot;eff3ffbdd7e76baed63182bd08519c&quot;,&quot;eff3ffc6dbef9ecae16baed63182bd08519c&quot;,&quot;eff3ffc6dbef9ecae16baed64292c62171b5084594&quot;,&quot;f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594&quot;,&quot;f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b&quot;).map(r),rt=h(nt),it=new Array(3).concat(&quot;e5f5e0a1d99b31a354&quot;,&quot;edf8e9bae4b374c476238b45&quot;,&quot;edf8e9bae4b374c47631a354006d2c&quot;,&quot;edf8e9c7e9c0a1d99b74c47631a354006d2c&quot;,&quot;edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32&quot;,&quot;f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32&quot;,&quot;f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b&quot;).map(r),ot=h(it),at=new Array(3).concat(&quot;f0f0f0bdbdbd636363&quot;,&quot;f7f7f7cccccc969696525252&quot;,&quot;f7f7f7cccccc969696636363252525&quot;,&quot;f7f7f7d9d9d9bdbdbd969696636363252525&quot;,&quot;f7f7f7d9d9d9bdbdbd969696737373525252252525&quot;,&quot;fffffff0f0f0d9d9d9bdbdbd969696737373525252252525&quot;,&quot;fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000&quot;).map(r),st=h(at),ut=new Array(3).concat(&quot;efedf5bcbddc756bb1&quot;,&quot;f2f0f7cbc9e29e9ac86a51a3&quot;,&quot;f2f0f7cbc9e29e9ac8756bb154278f&quot;,&quot;f2f0f7dadaebbcbddc9e9ac8756bb154278f&quot;,&quot;f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486&quot;,&quot;fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486&quot;,&quot;fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d&quot;).map(r),lt=h(ut),ct=new Array(3).concat(&quot;fee0d2fc9272de2d26&quot;,&quot;fee5d9fcae91fb6a4acb181d&quot;,&quot;fee5d9fcae91fb6a4ade2d26a50f15&quot;,&quot;fee5d9fcbba1fc9272fb6a4ade2d26a50f15&quot;,&quot;fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d&quot;,&quot;fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d&quot;,&quot;fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d&quot;).map(r),ft=h(ct),pt=new Array(3).concat(&quot;fee6cefdae6be6550d&quot;,&quot;feeddefdbe85fd8d3cd94701&quot;,&quot;feeddefdbe85fd8d3ce6550da63603&quot;,&quot;feeddefdd0a2fdae6bfd8d3ce6550da63603&quot;,&quot;feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04&quot;,&quot;fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04&quot;,&quot;fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704&quot;).map(r),ht=h(pt),dt=e.interpolateCubehelixLong(n.cubehelix(300,.5,0),n.cubehelix(-240,.5,1)),mt=e.interpolateCubehelixLong(n.cubehelix(-100,.75,.35),n.cubehelix(80,1.5,.8)),gt=e.interpolateCubehelixLong(n.cubehelix(260,.75,.35),n.cubehelix(80,1.5,.8)),vt=n.cubehelix();var yt=n.rgb(),bt=Math.PI/3,_t=2*Math.PI/3;function wt(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var xt=wt(r(&quot;44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725&quot;)),Et=wt(r(&quot;00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf&quot;)),kt=wt(r(&quot;00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4&quot;)),Tt=wt(r(&quot;0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921&quot;));t.schemeCategory10=i,t.schemeAccent=o,t.schemeDark2=a,t.schemePaired=s,t.schemePastel1=u,t.schemePastel2=l,t.schemeSet1=c,t.schemeSet2=f,t.schemeSet3=p,t.interpolateBrBG=m,t.schemeBrBG=d,t.interpolatePRGn=v,t.schemePRGn=g,t.interpolatePiYG=b,t.schemePiYG=y,t.interpolatePuOr=w,t.schemePuOr=_,t.interpolateRdBu=E,t.schemeRdBu=x,t.interpolateRdGy=T,t.schemeRdGy=k,t.interpolateRdYlBu=S,t.schemeRdYlBu=N,t.interpolateRdYlGn=A,t.schemeRdYlGn=C,t.interpolateSpectral=O,t.schemeSpectral=I,t.interpolateBuGn=R,t.schemeBuGn=M,t.interpolateBuPu=D,t.schemeBuPu=P,t.interpolateGnBu=L,t.schemeGnBu=z,t.interpolateOrRd=V,t.schemeOrRd=F,t.interpolatePuBuGn=j,t.schemePuBuGn=B,t.interpolatePuBu=U,t.schemePuBu=q,t.interpolatePuRd=W,t.schemePuRd=G,t.interpolateRdPu=$,t.schemeRdPu=H,t.interpolateYlGnBu=Y,t.schemeYlGnBu=K,t.interpolateYlGn=Z,t.schemeYlGn=X,t.interpolateYlOrBr=J,t.schemeYlOrBr=Q,t.interpolateYlOrRd=et,t.schemeYlOrRd=tt,t.interpolateBlues=rt,t.schemeBlues=nt,t.interpolateGreens=ot,t.schemeGreens=it,t.interpolateGreys=st,t.schemeGreys=at,t.interpolatePurples=lt,t.schemePurples=ut,t.interpolateReds=ft,t.schemeReds=ct,t.interpolateOranges=ht,t.schemeOranges=pt,t.interpolateCubehelixDefault=dt,t.interpolateRainbow=function(t){(t&lt;0||t&gt;1)&amp;&amp;(t-=Math.floor(t));var e=Math.abs(t-.5);return vt.h=360*t-100,vt.s=1.5-1.5*e,vt.l=.8-.9*e,vt+&quot;&quot;},t.interpolateWarm=mt,t.interpolateCool=gt,t.interpolateSinebow=function(t){var e;return t=(.5-t)*Math.PI,yt.r=255*(e=Math.sin(t))*e,yt.g=255*(e=Math.sin(t+bt))*e,yt.b=255*(e=Math.sin(t+_t))*e,yt+&quot;&quot;},t.interpolateViridis=xt,t.interpolateMagma=Et,t.interpolateInferno=kt,t.interpolatePlasma=Tt,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-interpolate&quot;),t(&quot;d3-color&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-interpolate&quot;,&quot;d3-color&quot;],i):i(r.d3=r.d3||{},r.d3,r.d3)},{&quot;d3-color&quot;:309,&quot;d3-interpolate&quot;:320}],326:[function(t,e,n){var r,i;r=this,i=function(t,e,n,r,i,o,a){&quot;use strict&quot;;function s(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function u(t,e){switch(arguments.length){case 0:break;case 1:this.interpolator(t);break;default:this.interpolator(e).domain(t)}return this}var l=Array.prototype,c=l.map,f=l.slice,p={name:&quot;implicit&quot;};function h(){var t=e.map(),n=[],r=[],i=p;function o(e){var o=e+&quot;&quot;,a=t.get(o);if(!a){if(i!==p)return i;t.set(o,a=n.push(e))}return r[(a-1)%r.length]}return o.domain=function(r){if(!arguments.length)return n.slice();n=[],t=e.map();for(var i,a,s=-1,u=r.length;++s&lt;u;)t.has(a=(i=r[s])+&quot;&quot;)||t.set(a,n.push(i));return o},o.range=function(t){return arguments.length?(r=f.call(t),o):r.slice()},o.unknown=function(t){return arguments.length?(i=t,o):i},o.copy=function(){return h(n,r).unknown(i)},s.apply(o,arguments),o}function d(){var t,e,r=h().unknown(void 0),i=r.domain,o=r.range,a=[0,1],u=!1,l=0,c=0,f=.5;function p(){var r=i().length,s=a[1]&lt;a[0],p=a[s-0],h=a[1-s];t=(h-p)/Math.max(1,r-l+2*c),u&amp;&amp;(t=Math.floor(t)),p+=(h-p-t*(r-l))*f,e=t*(1-l),u&amp;&amp;(p=Math.round(p),e=Math.round(e));var d=n.range(r).map(function(e){return p+t*e});return o(s?d.reverse():d)}return delete r.unknown,r.domain=function(t){return arguments.length?(i(t),p()):i()},r.range=function(t){return arguments.length?(a=[+t[0],+t[1]],p()):a.slice()},r.rangeRound=function(t){return a=[+t[0],+t[1]],u=!0,p()},r.bandwidth=function(){return e},r.step=function(){return t},r.round=function(t){return arguments.length?(u=!!t,p()):u},r.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),p()):l},r.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),p()):l},r.paddingOuter=function(t){return arguments.length?(c=+t,p()):c},r.align=function(t){return arguments.length?(f=Math.max(0,Math.min(1,t)),p()):f},r.copy=function(){return d(i(),a).round(u).paddingInner(l).paddingOuter(c).align(f)},s.apply(p(),arguments)}function m(t){return+t}var g=[0,1];function v(t){return t}function y(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function b(t){var e,n=t[0],r=t[t.length-1];return n&gt;r&amp;&amp;(e=n,n=r,r=e),function(t){return Math.max(n,Math.min(r,t))}}function _(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i&lt;r?(r=y(i,r),o=n(a,o)):(r=y(r,i),o=n(o,a)),function(t){return o(r(t))}}function w(t,e,r){var i=Math.min(t.length,e.length)-1,o=new Array(i),a=new Array(i),s=-1;for(t[i]&lt;t[0]&amp;&amp;(t=t.slice().reverse(),e=e.slice().reverse());++s&lt;i;)o[s]=y(t[s],t[s+1]),a[s]=r(e[s],e[s+1]);return function(e){var r=n.bisect(t,e,1,i)-1;return a[r](o[r](e))}}function x(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function E(){var t,e,n,i,o,a,s=g,u=g,l=r.interpolate,p=v;function h(){return i=Math.min(s.length,u.length)&gt;2?w:_,o=a=null,d}function d(e){return isNaN(e=+e)?n:(o||(o=i(s.map(t),u,l)))(t(p(e)))}return d.invert=function(n){return p(e((a||(a=i(u,s.map(t),r.interpolateNumber)))(n)))},d.domain=function(t){return arguments.length?(s=c.call(t,m),p===v||(p=b(s)),h()):s.slice()},d.range=function(t){return arguments.length?(u=f.call(t),h()):u.slice()},d.rangeRound=function(t){return u=f.call(t),l=r.interpolateRound,h()},d.clamp=function(t){return arguments.length?(p=t?b(s):v,d):p!==v},d.interpolate=function(t){return arguments.length?(l=t,h()):l},d.unknown=function(t){return arguments.length?(n=t,d):n},function(n,r){return t=n,e=r,h()}}function k(t,e){return E()(t,e)}function T(t,e,r,o){var a,s=n.tickStep(t,e,r);switch((o=i.formatSpecifier(null==o?&quot;,f&quot;:o)).type){case&quot;s&quot;:var u=Math.max(Math.abs(t),Math.abs(e));return null!=o.precision||isNaN(a=i.precisionPrefix(s,u))||(o.precision=a),i.formatPrefix(o,u);case&quot;&quot;:case&quot;e&quot;:case&quot;g&quot;:case&quot;p&quot;:case&quot;r&quot;:null!=o.precision||isNaN(a=i.precisionRound(s,Math.max(Math.abs(t),Math.abs(e))))||(o.precision=a-(&quot;e&quot;===o.type));break;case&quot;f&quot;:case&quot;%&quot;:null!=o.precision||isNaN(a=i.precisionFixed(s))||(o.precision=a-2*(&quot;%&quot;===o.type))}return i.format(o)}function N(t){var e=t.domain;return t.ticks=function(t){var r=e();return n.ticks(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return T(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(r){null==r&amp;&amp;(r=10);var i,o=e(),a=0,s=o.length-1,u=o[a],l=o[s];return l&lt;u&amp;&amp;(i=u,u=l,l=i,i=a,a=s,s=i),(i=n.tickIncrement(u,l,r))&gt;0?(u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i,i=n.tickIncrement(u,l,r)):i&lt;0&amp;&amp;(u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i,i=n.tickIncrement(u,l,r)),i&gt;0?(o[a]=Math.floor(u/i)*i,o[s]=Math.ceil(l/i)*i,e(o)):i&lt;0&amp;&amp;(o[a]=Math.ceil(u*i)/i,o[s]=Math.floor(l*i)/i,e(o)),t},t}function S(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a&lt;o&amp;&amp;(n=r,r=i,i=n,n=o,o=a,a=n),t[r]=e.floor(o),t[i]=e.ceil(a),t}function C(t){return Math.log(t)}function A(t){return Math.exp(t)}function I(t){return-Math.log(-t)}function O(t){return-Math.exp(-t)}function M(t){return isFinite(t)?+(&quot;1e&quot;+t):t&lt;0?0:t}function R(t){return function(e){return-t(-e)}}function P(t){var e,r,o=t(C,A),a=o.domain,s=10;function u(){return e=function(t){return t===Math.E?Math.log:10===t&amp;&amp;Math.log10||2===t&amp;&amp;Math.log2||(t=Math.log(t),function(e){return Math.log(e)/t})}(s),r=function(t){return 10===t?M:t===Math.E?Math.exp:function(e){return Math.pow(t,e)}}(s),a()[0]&lt;0?(e=R(e),r=R(r),t(I,O)):t(C,A),o}return o.base=function(t){return arguments.length?(s=+t,u()):s},o.domain=function(t){return arguments.length?(a(t),u()):a()},o.ticks=function(t){var i,o=a(),u=o[0],l=o[o.length-1];(i=l&lt;u)&amp;&amp;(h=u,u=l,l=h);var c,f,p,h=e(u),d=e(l),m=null==t?10:+t,g=[];if(!(s%1)&amp;&amp;d-h&lt;m){if(h=Math.round(h)-1,d=Math.round(d)+1,u&gt;0){for(;h&lt;d;++h)for(f=1,c=r(h);f&lt;s;++f)if(!((p=c*f)&lt;u)){if(p&gt;l)break;g.push(p)}}else for(;h&lt;d;++h)for(f=s-1,c=r(h);f&gt;=1;--f)if(!((p=c*f)&lt;u)){if(p&gt;l)break;g.push(p)}}else g=n.ticks(h,d,Math.min(d-h,m)).map(r);return i?g.reverse():g},o.tickFormat=function(t,n){if(null==n&amp;&amp;(n=10===s?&quot;.0e&quot;:&quot;,&quot;),&quot;function&quot;!=typeof n&amp;&amp;(n=i.format(n)),t===1/0)return n;null==t&amp;&amp;(t=10);var a=Math.max(1,s*t/o.ticks().length);return function(t){var i=t/r(Math.round(e(t)));return i*s&lt;s-.5&amp;&amp;(i*=s),i&lt;=a?n(t):&quot;&quot;}},o.nice=function(){return a(S(a(),{floor:function(t){return r(Math.floor(e(t)))},ceil:function(t){return r(Math.ceil(e(t)))}}))},o}function D(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function z(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function L(t){var e=1,n=t(D(e),z(e));return n.constant=function(n){return arguments.length?t(D(e=+n),z(e)):e},N(n)}function F(t){return function(e){return e&lt;0?-Math.pow(-e,t):Math.pow(e,t)}}function V(t){return t&lt;0?-Math.sqrt(-t):Math.sqrt(t)}function B(t){return t&lt;0?-t*t:t*t}function j(t){var e=t(v,v),n=1;return e.exponent=function(e){return arguments.length?1===(n=+e)?t(v,v):.5===n?t(V,B):t(F(n),F(1/n)):n},N(e)}function q(){var t=j(E());return t.copy=function(){return x(t,q()).exponent(t.exponent())},s.apply(t,arguments),t}var U=1e3,G=60*U,W=60*G,H=24*W,$=7*H,K=30*H,Y=365*H;function X(t){return new Date(t)}function Z(t){return t instanceof Date?+t:+new Date(+t)}function Q(t,e,r,i,o,a,s,u,l){var f=k(v,v),p=f.invert,h=f.domain,d=l(&quot;.%L&quot;),m=l(&quot;:%S&quot;),g=l(&quot;%I:%M&quot;),y=l(&quot;%I %p&quot;),b=l(&quot;%a %d&quot;),_=l(&quot;%b %d&quot;),w=l(&quot;%B&quot;),E=l(&quot;%Y&quot;),T=[[s,1,U],[s,5,5*U],[s,15,15*U],[s,30,30*U],[a,1,G],[a,5,5*G],[a,15,15*G],[a,30,30*G],[o,1,W],[o,3,3*W],[o,6,6*W],[o,12,12*W],[i,1,H],[i,2,2*H],[r,1,$],[e,1,K],[e,3,3*K],[t,1,Y]];function N(n){return(s(n)&lt;n?d:a(n)&lt;n?m:o(n)&lt;n?g:i(n)&lt;n?y:e(n)&lt;n?r(n)&lt;n?b:_:t(n)&lt;n?w:E)(n)}function C(e,r,i,o){if(null==e&amp;&amp;(e=10),&quot;number&quot;==typeof e){var a=Math.abs(i-r)/e,s=n.bisector(function(t){return t[2]}).right(T,a);s===T.length?(o=n.tickStep(r/Y,i/Y,e),e=t):s?(o=(s=T[a/T[s-1][2]&lt;T[s][2]/a?s-1:s])[1],e=s[0]):(o=Math.max(n.tickStep(r,i,e),1),e=u)}return null==o?e:e.every(o)}return f.invert=function(t){return new Date(p(t))},f.domain=function(t){return arguments.length?h(c.call(t,Z)):h().map(X)},f.ticks=function(t,e){var n,r=h(),i=r[0],o=r[r.length-1],a=o&lt;i;return a&amp;&amp;(n=i,i=o,o=n),n=(n=C(t,i,o,e))?n.range(i,o+1):[],a?n.reverse():n},f.tickFormat=function(t,e){return null==e?N:l(e)},f.nice=function(t,e){var n=h();return(t=C(t,n[0],n[n.length-1],e))?h(S(n,t)):f},f.copy=function(){return x(f,Q(t,e,r,i,o,a,s,u,l))},f}function J(){var t,e,n,r,i,o=0,a=1,s=v,u=!1;function l(e){return isNaN(e=+e)?i:s(0===n?.5:(e=(r(e)-t)*n,u?Math.max(0,Math.min(1,e)):e))}return l.domain=function(i){return arguments.length?(t=r(o=+i[0]),e=r(a=+i[1]),n=t===e?0:1/(e-t),l):[o,a]},l.clamp=function(t){return arguments.length?(u=!!t,l):u},l.interpolator=function(t){return arguments.length?(s=t,l):s},l.unknown=function(t){return arguments.length?(i=t,l):i},function(i){return r=i,t=i(o),e=i(a),n=t===e?0:1/(e-t),l}}function tt(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function et(){var t=j(J());return t.copy=function(){return tt(t,et()).exponent(t.exponent())},u.apply(t,arguments)}function nt(){var t,e,n,r,i,o,a,s=0,u=.5,l=1,c=v,f=!1;function p(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-e)*(t&lt;e?r:i),c(f?Math.max(0,Math.min(1,t)):t))}return p.domain=function(a){return arguments.length?(t=o(s=+a[0]),e=o(u=+a[1]),n=o(l=+a[2]),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),p):[s,u,l]},p.clamp=function(t){return arguments.length?(f=!!t,p):f},p.interpolator=function(t){return arguments.length?(c=t,p):c},p.unknown=function(t){return arguments.length?(a=t,p):a},function(a){return o=a,t=a(s),e=a(u),n=a(l),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),p}}function rt(){var t=j(nt());return t.copy=function(){return tt(t,rt()).exponent(t.exponent())},u.apply(t,arguments)}t.scaleBand=d,t.scalePoint=function(){return function t(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return t(n())},e}(d.apply(null,arguments).paddingInner(1))},t.scaleIdentity=function t(e){var n;function r(t){return isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=c.call(t,m),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?c.call(e,m):[0,1],N(r)},t.scaleLinear=function t(){var e=k(v,v);return e.copy=function(){return x(e,t())},s.apply(e,arguments),N(e)},t.scaleLog=function t(){var e=P(E()).domain([1,10]);return e.copy=function(){return x(e,t()).base(e.base())},s.apply(e,arguments),e},t.scaleSymlog=function t(){var e=L(E());return e.copy=function(){return x(e,t()).constant(e.constant())},s.apply(e,arguments)},t.scaleOrdinal=h,t.scaleImplicit=p,t.scalePow=q,t.scaleSqrt=function(){return q.apply(null,arguments).exponent(.5)},t.scaleQuantile=function t(){var e,r=[],i=[],o=[];function a(){var t=0,e=Math.max(1,i.length);for(o=new Array(e-1);++t&lt;e;)o[t-1]=n.quantile(r,t/e);return u}function u(t){return isNaN(t=+t)?e:i[n.bisect(o,t)]}return u.invertExtent=function(t){var e=i.indexOf(t);return e&lt;0?[NaN,NaN]:[e&gt;0?o[e-1]:r[0],e&lt;o.length?o[e]:r[r.length-1]]},u.domain=function(t){if(!arguments.length)return r.slice();r=[];for(var e,i=0,o=t.length;i&lt;o;++i)null==(e=t[i])||isNaN(e=+e)||r.push(e);return r.sort(n.ascending),a()},u.range=function(t){return arguments.length?(i=f.call(t),a()):i.slice()},u.unknown=function(t){return arguments.length?(e=t,u):e},u.quantiles=function(){return o.slice()},u.copy=function(){return t().domain(r).range(i).unknown(e)},s.apply(u,arguments)},t.scaleQuantize=function t(){var e,r=0,i=1,o=1,a=[.5],u=[0,1];function l(t){return t&lt;=t?u[n.bisect(a,t,0,o)]:e}function c(){var t=-1;for(a=new Array(o);++t&lt;o;)a[t]=((t+1)*i-(t-o)*r)/(o+1);return l}return l.domain=function(t){return arguments.length?(r=+t[0],i=+t[1],c()):[r,i]},l.range=function(t){return arguments.length?(o=(u=f.call(t)).length-1,c()):u.slice()},l.invertExtent=function(t){var e=u.indexOf(t);return e&lt;0?[NaN,NaN]:e&lt;1?[r,a[0]]:e&gt;=o?[a[o-1],i]:[a[e-1],a[e]]},l.unknown=function(t){return arguments.length?(e=t,l):l},l.thresholds=function(){return a.slice()},l.copy=function(){return t().domain([r,i]).range(u).unknown(e)},s.apply(N(l),arguments)},t.scaleThreshold=function t(){var e,r=[.5],i=[0,1],o=1;function a(t){return t&lt;=t?i[n.bisect(r,t,0,o)]:e}return a.domain=function(t){return arguments.length?(r=f.call(t),o=Math.min(r.length,i.length-1),a):r.slice()},a.range=function(t){return arguments.length?(i=f.call(t),o=Math.min(r.length,i.length-1),a):i.slice()},a.invertExtent=function(t){var e=i.indexOf(t);return[r[e-1],r[e]]},a.unknown=function(t){return arguments.length?(e=t,a):e},a.copy=function(){return t().domain(r).range(i).unknown(e)},s.apply(a,arguments)},t.scaleTime=function(){return s.apply(Q(o.timeYear,o.timeMonth,o.timeWeek,o.timeDay,o.timeHour,o.timeMinute,o.timeSecond,o.timeMillisecond,a.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},t.scaleUtc=function(){return s.apply(Q(o.utcYear,o.utcMonth,o.utcWeek,o.utcDay,o.utcHour,o.utcMinute,o.utcSecond,o.utcMillisecond,a.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},t.scaleSequential=function t(){var e=N(J()(v));return e.copy=function(){return tt(e,t())},u.apply(e,arguments)},t.scaleSequentialLog=function t(){var e=P(J()).domain([1,10]);return e.copy=function(){return tt(e,t()).base(e.base())},u.apply(e,arguments)},t.scaleSequentialPow=et,t.scaleSequentialSqrt=function(){return et.apply(null,arguments).exponent(.5)},t.scaleSequentialSymlog=function t(){var e=L(J());return e.copy=function(){return tt(e,t()).constant(e.constant())},u.apply(e,arguments)},t.scaleSequentialQuantile=function t(){var e=[],r=v;function i(t){if(!isNaN(t=+t))return r((n.bisect(e,t)-1)/(e.length-1))}return i.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var r,o=0,a=t.length;o&lt;a;++o)null==(r=t[o])||isNaN(r=+r)||e.push(r);return e.sort(n.ascending),i},i.interpolator=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return t(r).domain(e)},u.apply(i,arguments)},t.scaleDiverging=function t(){var e=N(nt()(v));return e.copy=function(){return tt(e,t())},u.apply(e,arguments)},t.scaleDivergingLog=function t(){var e=P(nt()).domain([.1,1,10]);return e.copy=function(){return tt(e,t()).base(e.base())},u.apply(e,arguments)},t.scaleDivergingPow=rt,t.scaleDivergingSqrt=function(){return rt.apply(null,arguments).exponent(.5)},t.scaleDivergingSymlog=function t(){var e=L(nt());return e.copy=function(){return tt(e,t()).constant(e.constant())},u.apply(e,arguments)},t.tickFormat=T,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-collection&quot;),t(&quot;d3-array&quot;),t(&quot;d3-interpolate&quot;),t(&quot;d3-format&quot;),t(&quot;d3-time&quot;),t(&quot;d3-time-format&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-collection&quot;,&quot;d3-array&quot;,&quot;d3-interpolate&quot;,&quot;d3-format&quot;,&quot;d3-time&quot;,&quot;d3-time-format&quot;],i):i(r.d3=r.d3||{},r.d3,r.d3,r.d3,r.d3,r.d3,r.d3)},{&quot;d3-array&quot;:304,&quot;d3-collection&quot;:308,&quot;d3-format&quot;:317,&quot;d3-interpolate&quot;:320,&quot;d3-time&quot;:330,&quot;d3-time-format&quot;:329}],327:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;var e=&quot;http://www.w3.org/1999/xhtml&quot;,n={svg:&quot;http://www.w3.org/2000/svg&quot;,xhtml:e,xlink:&quot;http://www.w3.org/1999/xlink&quot;,xml:&quot;http://www.w3.org/XML/1998/namespace&quot;,xmlns:&quot;http://www.w3.org/2000/xmlns/&quot;};function r(t){var e=t+=&quot;&quot;,r=e.indexOf(&quot;:&quot;);return r&gt;=0&amp;&amp;&quot;xmlns&quot;!==(e=t.slice(0,r))&amp;&amp;(t=t.slice(r+1)),n.hasOwnProperty(e)?{space:n[e],local:t}:t}function i(t){var n=r(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===e&amp;&amp;n.documentElement.namespaceURI===e?n.createElement(t):n.createElementNS(r,t)}})(n)}function o(){}function a(t){return null==t?o:function(){return this.querySelector(t)}}function s(){return[]}function u(t){return null==t?s:function(){return this.querySelectorAll(t)}}function l(t){return function(){return this.matches(t)}}function c(t){return new Array(t.length)}function f(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}f.prototype={constructor:f,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var p=&quot;$&quot;;function h(t,e,n,r,i,o){for(var a,s=0,u=e.length,l=o.length;s&lt;l;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new f(t,o[s]);for(;s&lt;u;++s)(a=e[s])&amp;&amp;(i[s]=a)}function d(t,e,n,r,i,o,a){var s,u,l,c={},h=e.length,d=o.length,m=new Array(h);for(s=0;s&lt;h;++s)(u=e[s])&amp;&amp;(m[s]=l=p+a.call(u,u.__data__,s,e),l in c?i[s]=u:c[l]=u);for(s=0;s&lt;d;++s)(u=c[l=p+a.call(t,o[s],s,o)])?(r[s]=u,u.__data__=o[s],c[l]=null):n[s]=new f(t,o[s]);for(s=0;s&lt;h;++s)(u=e[s])&amp;&amp;c[m[s]]===u&amp;&amp;(i[s]=u)}function m(t,e){return t&lt;e?-1:t&gt;e?1:t&gt;=e?0:NaN}function g(t){return t.ownerDocument&amp;&amp;t.ownerDocument.defaultView||t.document&amp;&amp;t||t.defaultView}function v(t,e){return t.style.getPropertyValue(e)||g(t).getComputedStyle(t,null).getPropertyValue(e)}function y(t){return t.trim().split(/^|\s+/)}function b(t){return t.classList||new _(t)}function _(t){this._node=t,this._names=y(t.getAttribute(&quot;class&quot;)||&quot;&quot;)}function w(t,e){for(var n=b(t),r=-1,i=e.length;++r&lt;i;)n.add(e[r])}function x(t,e){for(var n=b(t),r=-1,i=e.length;++r&lt;i;)n.remove(e[r])}function E(){this.textContent=&quot;&quot;}function k(){this.innerHTML=&quot;&quot;}function T(){this.nextSibling&amp;&amp;this.parentNode.appendChild(this)}function N(){this.previousSibling&amp;&amp;this.parentNode.insertBefore(this,this.parentNode.firstChild)}function S(){return null}function C(){var t=this.parentNode;t&amp;&amp;t.removeChild(this)}function A(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function I(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}_.prototype={add:function(t){this._names.indexOf(t)&lt;0&amp;&amp;(this._names.push(t),this._node.setAttribute(&quot;class&quot;,this._names.join(&quot; &quot;)))},remove:function(t){var e=this._names.indexOf(t);e&gt;=0&amp;&amp;(this._names.splice(e,1),this._node.setAttribute(&quot;class&quot;,this._names.join(&quot; &quot;)))},contains:function(t){return this._names.indexOf(t)&gt;=0}};var O={};(t.event=null,&quot;undefined&quot;!=typeof document)&amp;&amp;(&quot;onmouseenter&quot;in document.documentElement||(O={mouseenter:&quot;mouseover&quot;,mouseleave:&quot;mouseout&quot;}));function M(t,e,n){return t=R(t,e,n),function(e){var n=e.relatedTarget;n&amp;&amp;(n===this||8&amp;n.compareDocumentPosition(this))||t.call(this,e)}}function R(e,n,r){return function(i){var o=t.event;t.event=i;try{e.call(this,this.__data__,n,r)}finally{t.event=o}}}function P(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r&lt;o;++r)n=e[r],t.type&amp;&amp;n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.capture);++i?e.length=i:delete this.__on}}}function D(t,e,n){var r=O.hasOwnProperty(t.type)?M:R;return function(i,o,a){var s,u=this.__on,l=r(e,o,a);if(u)for(var c=0,f=u.length;c&lt;f;++c)if((s=u[c]).type===t.type&amp;&amp;s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=l,s.capture=n),void(s.value=e);this.addEventListener(t.type,l,n),s={type:t.type,name:t.name,value:e,listener:l,capture:n},u?u.push(s):this.__on=[s]}}function z(t,e,n){var r=g(t),i=r.CustomEvent;&quot;function&quot;==typeof i?i=new i(e,n):(i=r.document.createEvent(&quot;Event&quot;),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}var L=[null];function F(t,e){this._groups=t,this._parents=e}function V(){return new F([[document.documentElement]],L)}function B(t){return&quot;string&quot;==typeof t?new F([[document.querySelector(t)]],[document.documentElement]):new F([[t]],L)}F.prototype=V.prototype={constructor:F,select:function(t){&quot;function&quot;!=typeof t&amp;&amp;(t=a(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i&lt;n;++i)for(var o,s,u=e[i],l=u.length,c=r[i]=new Array(l),f=0;f&lt;l;++f)(o=u[f])&amp;&amp;(s=t.call(o,o.__data__,f,u))&amp;&amp;(&quot;__data__&quot;in o&amp;&amp;(s.__data__=o.__data__),c[f]=s);return new F(r,this._parents)},selectAll:function(t){&quot;function&quot;!=typeof t&amp;&amp;(t=u(t));for(var e=this._groups,n=e.length,r=[],i=[],o=0;o&lt;n;++o)for(var a,s=e[o],l=s.length,c=0;c&lt;l;++c)(a=s[c])&amp;&amp;(r.push(t.call(a,a.__data__,c,s)),i.push(a));return new F(r,i)},filter:function(t){&quot;function&quot;!=typeof t&amp;&amp;(t=l(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i&lt;n;++i)for(var o,a=e[i],s=a.length,u=r[i]=[],c=0;c&lt;s;++c)(o=a[c])&amp;&amp;t.call(o,o.__data__,c,a)&amp;&amp;u.push(o);return new F(r,this._parents)},data:function(t,e){if(!t)return g=new Array(this.size()),c=-1,this.each(function(t){g[++c]=t}),g;var n,r=e?d:h,i=this._parents,o=this._groups;&quot;function&quot;!=typeof t&amp;&amp;(n=t,t=function(){return n});for(var a=o.length,s=new Array(a),u=new Array(a),l=new Array(a),c=0;c&lt;a;++c){var f=i[c],p=o[c],m=p.length,g=t.call(f,f&amp;&amp;f.__data__,c,i),v=g.length,y=u[c]=new Array(v),b=s[c]=new Array(v);r(f,p,y,b,l[c]=new Array(m),g,e);for(var _,w,x=0,E=0;x&lt;v;++x)if(_=y[x]){for(x&gt;=E&amp;&amp;(E=x+1);!(w=b[E])&amp;&amp;++E&lt;v;);_._next=w||null}}return(s=new F(s,i))._enter=u,s._exit=l,s},enter:function(){return new F(this._enter||this._groups.map(c),this._parents)},exit:function(){return new F(this._exit||this._groups.map(c),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return r=&quot;function&quot;==typeof t?t(r):r.append(t+&quot;&quot;),null!=e&amp;&amp;(i=e(i)),null==n?o.remove():n(o),r&amp;&amp;i?r.merge(i).order():i},merge:function(t){for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s&lt;o;++s)for(var u,l=e[s],c=n[s],f=l.length,p=a[s]=new Array(f),h=0;h&lt;f;++h)(u=l[h]||c[h])&amp;&amp;(p[h]=u);for(;s&lt;r;++s)a[s]=e[s];return new F(a,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e&lt;n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o&gt;=0;)(r=i[o])&amp;&amp;(a&amp;&amp;4^r.compareDocumentPosition(a)&amp;&amp;a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&amp;&amp;n?t(e.__data__,n.__data__):!e-!n}t||(t=m);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o&lt;r;++o){for(var a,s=n[o],u=s.length,l=i[o]=new Array(u),c=0;c&lt;u;++c)(a=s[c])&amp;&amp;(l[c]=a);l.sort(e)}return new F(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t},node:function(){for(var t=this._groups,e=0,n=t.length;e&lt;n;++e)for(var r=t[e],i=0,o=r.length;i&lt;o;++i){var a=r[i];if(a)return a}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n&lt;r;++n)for(var i,o=e[n],a=0,s=o.length;a&lt;s;++a)(i=o[a])&amp;&amp;t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=r(t);if(arguments.length&lt;2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==e?n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:&quot;function&quot;==typeof e?n.local?function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}:function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}:n.local?function(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}:function(t,e){return function(){this.setAttribute(t,e)}})(n,e))},style:function(t,e,n){return arguments.length&gt;1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:&quot;function&quot;==typeof e?function(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?&quot;&quot;:n)):v(this.node(),t)},property:function(t,e){return arguments.length&gt;1?this.each((null==e?function(t){return function(){delete this[t]}}:&quot;function&quot;==typeof e?function(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=y(t+&quot;&quot;);if(arguments.length&lt;2){for(var r=b(this.node()),i=-1,o=n.length;++i&lt;o;)if(!r.contains(n[i]))return!1;return!0}return this.each((&quot;function&quot;==typeof e?function(t,e){return function(){(e.apply(this,arguments)?w:x)(this,t)}}:e?function(t){return function(){w(this,t)}}:function(t){return function(){x(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?E:(&quot;function&quot;==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?&quot;&quot;:e}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?k:(&quot;function&quot;==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?&quot;&quot;:e}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(T)},lower:function(){return this.each(N)},append:function(t){var e=&quot;function&quot;==typeof t?t:i(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n=&quot;function&quot;==typeof t?t:i(t),r=null==e?S:&quot;function&quot;==typeof e?e:a(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(C)},clone:function(t){return this.select(t?I:A)},datum:function(t){return arguments.length?this.property(&quot;__data__&quot;,t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var e=&quot;&quot;,n=t.indexOf(&quot;.&quot;);return n&gt;=0&amp;&amp;(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+&quot;&quot;),a=o.length;if(!(arguments.length&lt;2)){for(s=e?D:P,null==n&amp;&amp;(n=!1),r=0;r&lt;a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var u,l=0,c=s.length;l&lt;c;++l)for(r=0,u=s[l];r&lt;a;++r)if((i=o[r]).type===u.type&amp;&amp;i.name===u.name)return u.value},dispatch:function(t,e){return this.each((&quot;function&quot;==typeof e?function(t,e){return function(){return z(this,t,e.apply(this,arguments))}}:function(t,e){return function(){return z(this,t,e)}})(t,e))}};var j=0;function q(){return new U}function U(){this._=&quot;@&quot;+(++j).toString(36)}function G(){for(var e,n=t.event;e=n.sourceEvent;)n=e;return n}function W(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}U.prototype=q.prototype={constructor:U,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&amp;&amp;delete t[this._]},toString:function(){return this._}},t.create=function(t){return B(i(t).call(document.documentElement))},t.creator=i,t.local=q,t.matcher=l,t.mouse=function(t){var e=G();return e.changedTouches&amp;&amp;(e=e.changedTouches[0]),W(t,e)},t.namespace=r,t.namespaces=n,t.clientPoint=W,t.select=B,t.selectAll=function(t){return&quot;string&quot;==typeof t?new F([document.querySelectorAll(t)],[document.documentElement]):new F([null==t?[]:t],L)},t.selection=V,t.selector=a,t.selectorAll=u,t.style=v,t.touch=function(t,e,n){arguments.length&lt;3&amp;&amp;(n=e,e=G().changedTouches);for(var r,i=0,o=e?e.length:0;i&lt;o;++i)if((r=e[i]).identifier===n)return W(t,r);return null},t.touches=function(t,e){null==e&amp;&amp;(e=G().touches);for(var n=0,r=e?e.length:0,i=new Array(r);n&lt;r;++n)i[n]=W(t,e[n]);return i},t.window=g,t.customEvent=function(e,n,r,i){var o=t.event;e.sourceEvent=t.event,t.event=e;try{return n.apply(r,i)}finally{t.event=o}},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],328:[function(t,e,n){var r,i;r=this,i=function(t,e){&quot;use strict&quot;;function n(t){return function(){return t}}var r=Math.abs,i=Math.atan2,o=Math.cos,a=Math.max,s=Math.min,u=Math.sin,l=Math.sqrt,c=1e-12,f=Math.PI,p=f/2,h=2*f;function d(t){return t&gt;=1?p:t&lt;=-1?-p:Math.asin(t)}function m(t){return t.innerRadius}function g(t){return t.outerRadius}function v(t){return t.startAngle}function y(t){return t.endAngle}function b(t){return t&amp;&amp;t.padAngle}function _(t,e,n,r,i,o,s){var u=t-n,c=e-r,f=(s?o:-o)/l(u*u+c*c),p=f*c,h=-f*u,d=t+p,m=e+h,g=n+p,v=r+h,y=(d+g)/2,b=(m+v)/2,_=g-d,w=v-m,x=_*_+w*w,E=i-o,k=d*v-g*m,T=(w&lt;0?-1:1)*l(a(0,E*E*x-k*k)),N=(k*w-_*T)/x,S=(-k*_-w*T)/x,C=(k*w+_*T)/x,A=(-k*_+w*T)/x,I=N-y,O=S-b,M=C-y,R=A-b;return I*I+O*O&gt;M*M+R*R&amp;&amp;(N=C,S=A),{cx:N,cy:S,x01:-p,y01:-h,x11:N*(i/E-1),y11:S*(i/E-1)}}function w(t){this._context=t}function x(t){return new w(t)}function E(t){return t[0]}function k(t){return t[1]}function T(){var t=E,r=k,i=n(!0),o=null,a=x,s=null;function u(n){var u,l,c,f=n.length,p=!1;for(null==o&amp;&amp;(s=a(c=e.path())),u=0;u&lt;=f;++u)!(u&lt;f&amp;&amp;i(l=n[u],u,n))===p&amp;&amp;((p=!p)?s.lineStart():s.lineEnd()),p&amp;&amp;s.point(+t(l,u,n),+r(l,u,n));if(c)return s=null,c+&quot;&quot;||null}return u.x=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:n(+e),u):t},u.y=function(t){return arguments.length?(r=&quot;function&quot;==typeof t?t:n(+t),u):r},u.defined=function(t){return arguments.length?(i=&quot;function&quot;==typeof t?t:n(!!t),u):i},u.curve=function(t){return arguments.length?(a=t,null!=o&amp;&amp;(s=a(o)),u):a},u.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),u):o},u}function N(){var t=E,r=null,i=n(0),o=k,a=n(!0),s=null,u=x,l=null;function c(n){var c,f,p,h,d,m=n.length,g=!1,v=new Array(m),y=new Array(m);for(null==s&amp;&amp;(l=u(d=e.path())),c=0;c&lt;=m;++c){if(!(c&lt;m&amp;&amp;a(h=n[c],c,n))===g)if(g=!g)f=c,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),p=c-1;p&gt;=f;--p)l.point(v[p],y[p]);l.lineEnd(),l.areaEnd()}g&amp;&amp;(v[c]=+t(h,c,n),y[c]=+i(h,c,n),l.point(r?+r(h,c,n):v[c],o?+o(h,c,n):y[c]))}if(d)return l=null,d+&quot;&quot;||null}function f(){return T().defined(a).curve(u).context(s)}return c.x=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:n(+e),r=null,c):t},c.x0=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:n(+e),c):t},c.x1=function(t){return arguments.length?(r=null==t?null:&quot;function&quot;==typeof t?t:n(+t),c):r},c.y=function(t){return arguments.length?(i=&quot;function&quot;==typeof t?t:n(+t),o=null,c):i},c.y0=function(t){return arguments.length?(i=&quot;function&quot;==typeof t?t:n(+t),c):i},c.y1=function(t){return arguments.length?(o=null==t?null:&quot;function&quot;==typeof t?t:n(+t),c):o},c.lineX0=c.lineY0=function(){return f().x(t).y(i)},c.lineY1=function(){return f().x(t).y(o)},c.lineX1=function(){return f().x(r).y(i)},c.defined=function(t){return arguments.length?(a=&quot;function&quot;==typeof t?t:n(!!t),c):a},c.curve=function(t){return arguments.length?(u=t,null!=s&amp;&amp;(l=u(s)),c):u},c.context=function(t){return arguments.length?(null==t?s=l=null:l=u(s=t),c):s},c}function S(t,e){return e&lt;t?-1:e&gt;t?1:e&gt;=t?0:NaN}function C(t){return t}w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&amp;&amp;1===this._point)&amp;&amp;this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var A=O(x);function I(t){this._curve=t}function O(t){function e(e){return new I(t(e))}return e._curve=t,e}function M(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(O(t)):e()._curve},t}function R(){return M(T().curve(A))}function P(){var t=N().curve(A),e=t.curve,n=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return M(n())},delete t.lineX0,t.lineEndAngle=function(){return M(r())},delete t.lineX1,t.lineInnerRadius=function(){return M(i())},delete t.lineY0,t.lineOuterRadius=function(){return M(o())},delete t.lineY1,t.curve=function(t){return arguments.length?e(O(t)):e()._curve},t}function D(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}I.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};var z=Array.prototype.slice;function L(t){return t.source}function F(t){return t.target}function V(t){var r=L,i=F,o=E,a=k,s=null;function u(){var n,u=z.call(arguments),l=r.apply(this,u),c=i.apply(this,u);if(s||(s=n=e.path()),t(s,+o.apply(this,(u[0]=l,u)),+a.apply(this,u),+o.apply(this,(u[0]=c,u)),+a.apply(this,u)),n)return s=null,n+&quot;&quot;||null}return u.source=function(t){return arguments.length?(r=t,u):r},u.target=function(t){return arguments.length?(i=t,u):i},u.x=function(t){return arguments.length?(o=&quot;function&quot;==typeof t?t:n(+t),u):o},u.y=function(t){return arguments.length?(a=&quot;function&quot;==typeof t?t:n(+t),u):a},u.context=function(t){return arguments.length?(s=null==t?null:t,u):s},u}function B(t,e,n,r,i){t.moveTo(e,n),t.bezierCurveTo(e=(e+r)/2,n,e,i,r,i)}function j(t,e,n,r,i){t.moveTo(e,n),t.bezierCurveTo(e,n=(n+i)/2,r,n,r,i)}function q(t,e,n,r,i){var o=D(e,n),a=D(e,n=(n+i)/2),s=D(r,n),u=D(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],s[0],s[1],u[0],u[1])}var U={draw:function(t,e){var n=Math.sqrt(e/f);t.moveTo(n,0),t.arc(0,0,n,0,h)}},G={draw:function(t,e){var n=Math.sqrt(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},W=Math.sqrt(1/3),H=2*W,$={draw:function(t,e){var n=Math.sqrt(e/H),r=n*W;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},K=Math.sin(f/10)/Math.sin(7*f/10),Y=Math.sin(h/10)*K,X=-Math.cos(h/10)*K,Z={draw:function(t,e){var n=Math.sqrt(.8908130915292852*e),r=Y*n,i=X*n;t.moveTo(0,-n),t.lineTo(r,i);for(var o=1;o&lt;5;++o){var a=h*o/5,s=Math.cos(a),u=Math.sin(a);t.lineTo(u*n,-s*n),t.lineTo(s*r-u*i,u*r+s*i)}t.closePath()}},Q={draw:function(t,e){var n=Math.sqrt(e),r=-n/2;t.rect(r,r,n,n)}},J=Math.sqrt(3),tt={draw:function(t,e){var n=-Math.sqrt(e/(3*J));t.moveTo(0,2*n),t.lineTo(-J*n,-n),t.lineTo(J*n,-n),t.closePath()}},et=-.5,nt=Math.sqrt(3)/2,rt=1/Math.sqrt(12),it=3*(rt/2+1),ot={draw:function(t,e){var n=Math.sqrt(e/it),r=n/2,i=n*rt,o=r,a=n*rt+n,s=-o,u=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(s,u),t.lineTo(et*r-nt*i,nt*r+et*i),t.lineTo(et*o-nt*a,nt*o+et*a),t.lineTo(et*s-nt*u,nt*s+et*u),t.lineTo(et*r+nt*i,et*i-nt*r),t.lineTo(et*o+nt*a,et*a-nt*o),t.lineTo(et*s+nt*u,et*u-nt*s),t.closePath()}},at=[U,G,$,Q,Z,tt,ot];function st(){}function ut(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function lt(t){this._context=t}function ct(t){this._context=t}function ft(t){this._context=t}function pt(t,e){this._basis=new lt(t),this._beta=e}lt.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:ut(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&amp;&amp;1===this._point)&amp;&amp;this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);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:ut(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ct.prototype={areaStart:st,areaEnd:st,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ut(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ft.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||0!==this._line&amp;&amp;3===this._point)&amp;&amp;this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ut(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},pt.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n&gt;0)for(var r,i=t[0],o=e[0],a=t[n]-i,s=e[n]-o,u=-1;++u&lt;=n;)r=u/n,this._basis.point(this._beta*t[u]+(1-this._beta)*(i+r*a),this._beta*e[u]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var ht=function t(e){function n(t){return 1===e?new lt(t):new pt(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function dt(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function mt(t,e){this._context=t,this._k=(1-e)/6}mt.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:dt(this,this._x1,this._y1)}(this._line||0!==this._line&amp;&amp;1===this._point)&amp;&amp;this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:dt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var gt=function t(e){function n(t){return new mt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function vt(t,e){this._context=t,this._k=(1-e)/6}vt.prototype={areaStart:st,areaEnd:st,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:dt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var yt=function t(e){function n(t){return new vt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function bt(t,e){this._context=t,this._k=(1-e)/6}bt.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||0!==this._line&amp;&amp;3===this._point)&amp;&amp;this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,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:dt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var _t=function t(e){function n(t){return new bt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function wt(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a&gt;c){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,u=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/u,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/u}if(t._l23_a&gt;c){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,f=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*l+t._x1*t._l23_2a-e*t._l12_2a)/f,a=(a*l+t._y1*t._l23_2a-n*t._l12_2a)/f}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function xt(t,e){this._context=t,this._alpha=e}xt.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||0!==this._line&amp;&amp;1===this._point)&amp;&amp;this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:wt(this,t,e)}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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Et=function t(e){function n(t){return e?new xt(t,e):new mt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function kt(t,e){this._context=t,this._alpha=e}kt.prototype={areaStart:st,areaEnd:st,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(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:wt(this,t,e)}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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Tt=function t(e){function n(t){return e?new kt(t,e):new vt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Nt(t,e){this._context=t,this._alpha=e}Nt.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||0!==this._line&amp;&amp;3===this._point)&amp;&amp;this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,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:wt(this,t,e)}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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var St=function t(e){function n(t){return e?new Nt(t,e):new bt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Ct(t){this._context=t}function At(t){return t&lt;0?-1:1}function It(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i&lt;0&amp;&amp;-0),a=(n-t._y1)/(i||r&lt;0&amp;&amp;-0),s=(o*i+a*r)/(r+i);return(At(o)+At(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function Ot(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Mt(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function Rt(t){this._context=t}function Pt(t){this._context=new Dt(t)}function Dt(t){this._context=t}function zt(t){this._context=t}function Lt(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e&lt;r-1;++e)i[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],e=1;e&lt;r;++e)n=i[e]/o[e-1],o[e]-=n,a[e]-=n*a[e-1];for(i[r-1]=a[r-1]/o[r-1],e=r-2;e&gt;=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e&lt;r-1;++e)o[e]=2*t[e+1]-i[e+1];return[i,o]}function Ft(t,e){this._context=t,this._t=e}function Vt(t,e){if((i=t.length)&gt;1)for(var n,r,i,o=1,a=t[e[0]],s=a.length;o&lt;i;++o)for(r=a,a=t[e[o]],n=0;n&lt;s;++n)a[n][1]+=a[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function Bt(t){for(var e=t.length,n=new Array(e);--e&gt;=0;)n[e]=e;return n}function jt(t,e){return t[e]}function qt(t){var e=t.map(Ut);return Bt(t).sort(function(t,n){return e[t]-e[n]})}function Ut(t){for(var e,n=-1,r=0,i=t.length,o=-1/0;++n&lt;i;)(e=+t[n][1])&gt;o&amp;&amp;(o=e,r=n);return r}function Gt(t){var e=t.map(Wt);return Bt(t).sort(function(t,n){return e[t]-e[n]})}function Wt(t){for(var e,n=0,r=-1,i=t.length;++r&lt;i;)(e=+t[r][1])&amp;&amp;(n+=e);return n}Ct.prototype={areaStart:st,areaEnd:st,lineStart:function(){this._point=0},lineEnd:function(){this._point&amp;&amp;this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},Rt.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:Mt(this,this._t0,Ot(this,this._t0))}(this._line||0!==this._line&amp;&amp;1===this._point)&amp;&amp;this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Mt(this,Ot(this,n=It(this,t,e)),n);break;default:Mt(this,this._t0,n=It(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(Pt.prototype=Object.create(Rt.prototype)).point=function(t,e){Rt.prototype.point.call(this,e,t)},Dt.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}},zt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=Lt(t),i=Lt(e),o=0,a=1;a&lt;n;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],e[a]);(this._line||0!==this._line&amp;&amp;1===n)&amp;&amp;this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},Ft.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0&lt;this._t&amp;&amp;this._t&lt;1&amp;&amp;2===this._point&amp;&amp;this._context.lineTo(this._x,this._y),(this._line||0!==this._line&amp;&amp;1===this._point)&amp;&amp;this._context.closePath(),this._line&gt;=0&amp;&amp;(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t&lt;=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}},t.arc=function(){var t=m,a=g,w=n(0),x=null,E=v,k=y,T=b,N=null;function S(){var n,m,g,v=+t.apply(this,arguments),y=+a.apply(this,arguments),b=E.apply(this,arguments)-p,S=k.apply(this,arguments)-p,C=r(S-b),A=S&gt;b;if(N||(N=n=e.path()),y&lt;v&amp;&amp;(m=y,y=v,v=m),y&gt;c)if(C&gt;h-c)N.moveTo(y*o(b),y*u(b)),N.arc(0,0,y,b,S,!A),v&gt;c&amp;&amp;(N.moveTo(v*o(S),v*u(S)),N.arc(0,0,v,S,b,A));else{var I,O,M=b,R=S,P=b,D=S,z=C,L=C,F=T.apply(this,arguments)/2,V=F&gt;c&amp;&amp;(x?+x.apply(this,arguments):l(v*v+y*y)),B=s(r(y-v)/2,+w.apply(this,arguments)),j=B,q=B;if(V&gt;c){var U=d(V/v*u(F)),G=d(V/y*u(F));(z-=2*U)&gt;c?(P+=U*=A?1:-1,D-=U):(z=0,P=D=(b+S)/2),(L-=2*G)&gt;c?(M+=G*=A?1:-1,R-=G):(L=0,M=R=(b+S)/2)}var W=y*o(M),H=y*u(M),$=v*o(D),K=v*u(D);if(B&gt;c){var Y,X=y*o(R),Z=y*u(R),Q=v*o(P),J=v*u(P);if(C&lt;f&amp;&amp;(Y=function(t,e,n,r,i,o,a,s){var u=n-t,l=r-e,f=a-i,p=s-o,h=p*u-f*l;if(!(h*h&lt;c))return[t+(h=(f*(e-o)-p*(t-i))/h)*u,e+h*l]}(W,H,Q,J,X,Z,$,K))){var tt=W-Y[0],et=H-Y[1],nt=X-Y[0],rt=Z-Y[1],it=1/u(((g=(tt*nt+et*rt)/(l(tt*tt+et*et)*l(nt*nt+rt*rt)))&gt;1?0:g&lt;-1?f:Math.acos(g))/2),ot=l(Y[0]*Y[0]+Y[1]*Y[1]);j=s(B,(v-ot)/(it-1)),q=s(B,(y-ot)/(it+1))}}L&gt;c?q&gt;c?(I=_(Q,J,W,H,y,q,A),O=_(X,Z,$,K,y,q,A),N.moveTo(I.cx+I.x01,I.cy+I.y01),q&lt;B?N.arc(I.cx,I.cy,q,i(I.y01,I.x01),i(O.y01,O.x01),!A):(N.arc(I.cx,I.cy,q,i(I.y01,I.x01),i(I.y11,I.x11),!A),N.arc(0,0,y,i(I.cy+I.y11,I.cx+I.x11),i(O.cy+O.y11,O.cx+O.x11),!A),N.arc(O.cx,O.cy,q,i(O.y11,O.x11),i(O.y01,O.x01),!A))):(N.moveTo(W,H),N.arc(0,0,y,M,R,!A)):N.moveTo(W,H),v&gt;c&amp;&amp;z&gt;c?j&gt;c?(I=_($,K,X,Z,v,-j,A),O=_(W,H,Q,J,v,-j,A),N.lineTo(I.cx+I.x01,I.cy+I.y01),j&lt;B?N.arc(I.cx,I.cy,j,i(I.y01,I.x01),i(O.y01,O.x01),!A):(N.arc(I.cx,I.cy,j,i(I.y01,I.x01),i(I.y11,I.x11),!A),N.arc(0,0,v,i(I.cy+I.y11,I.cx+I.x11),i(O.cy+O.y11,O.cx+O.x11),A),N.arc(O.cx,O.cy,j,i(O.y11,O.x11),i(O.y01,O.x01),!A))):N.arc(0,0,v,D,P,A):N.lineTo($,K)}else N.moveTo(0,0);if(N.closePath(),n)return N=null,n+&quot;&quot;||null}return S.centroid=function(){var e=(+t.apply(this,arguments)+ +a.apply(this,arguments))/2,n=(+E.apply(this,arguments)+ +k.apply(this,arguments))/2-f/2;return[o(n)*e,u(n)*e]},S.innerRadius=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:n(+e),S):t},S.outerRadius=function(t){return arguments.length?(a=&quot;function&quot;==typeof t?t:n(+t),S):a},S.cornerRadius=function(t){return arguments.length?(w=&quot;function&quot;==typeof t?t:n(+t),S):w},S.padRadius=function(t){return arguments.length?(x=null==t?null:&quot;function&quot;==typeof t?t:n(+t),S):x},S.startAngle=function(t){return arguments.length?(E=&quot;function&quot;==typeof t?t:n(+t),S):E},S.endAngle=function(t){return arguments.length?(k=&quot;function&quot;==typeof t?t:n(+t),S):k},S.padAngle=function(t){return arguments.length?(T=&quot;function&quot;==typeof t?t:n(+t),S):T},S.context=function(t){return arguments.length?(N=null==t?null:t,S):N},S},t.area=N,t.line=T,t.pie=function(){var t=C,e=S,r=null,i=n(0),o=n(h),a=n(0);function s(n){var s,u,l,c,f,p=n.length,d=0,m=new Array(p),g=new Array(p),v=+i.apply(this,arguments),y=Math.min(h,Math.max(-h,o.apply(this,arguments)-v)),b=Math.min(Math.abs(y)/p,a.apply(this,arguments)),_=b*(y&lt;0?-1:1);for(s=0;s&lt;p;++s)(f=g[m[s]=s]=+t(n[s],s,n))&gt;0&amp;&amp;(d+=f);for(null!=e?m.sort(function(t,n){return e(g[t],g[n])}):null!=r&amp;&amp;m.sort(function(t,e){return r(n[t],n[e])}),s=0,l=d?(y-p*_)/d:0;s&lt;p;++s,v=c)u=m[s],c=v+((f=g[u])&gt;0?f*l:0)+_,g[u]={data:n[u],index:s,value:f,startAngle:v,endAngle:c,padAngle:b};return g}return s.value=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:n(+e),s):t},s.sortValues=function(t){return arguments.length?(e=t,r=null,s):e},s.sort=function(t){return arguments.length?(r=t,e=null,s):r},s.startAngle=function(t){return arguments.length?(i=&quot;function&quot;==typeof t?t:n(+t),s):i},s.endAngle=function(t){return arguments.length?(o=&quot;function&quot;==typeof t?t:n(+t),s):o},s.padAngle=function(t){return arguments.length?(a=&quot;function&quot;==typeof t?t:n(+t),s):a},s},t.areaRadial=P,t.radialArea=P,t.lineRadial=R,t.radialLine=R,t.pointRadial=D,t.linkHorizontal=function(){return V(B)},t.linkVertical=function(){return V(j)},t.linkRadial=function(){var t=V(q);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.symbol=function(){var t=n(U),r=n(64),i=null;function o(){var n;if(i||(i=n=e.path()),t.apply(this,arguments).draw(i,+r.apply(this,arguments)),n)return i=null,n+&quot;&quot;||null}return o.type=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:n(e),o):t},o.size=function(t){return arguments.length?(r=&quot;function&quot;==typeof t?t:n(+t),o):r},o.context=function(t){return arguments.length?(i=null==t?null:t,o):i},o},t.symbols=at,t.symbolCircle=U,t.symbolCross=G,t.symbolDiamond=$,t.symbolSquare=Q,t.symbolStar=Z,t.symbolTriangle=tt,t.symbolWye=ot,t.curveBasisClosed=function(t){return new ct(t)},t.curveBasisOpen=function(t){return new ft(t)},t.curveBasis=function(t){return new lt(t)},t.curveBundle=ht,t.curveCardinalClosed=yt,t.curveCardinalOpen=_t,t.curveCardinal=gt,t.curveCatmullRomClosed=Tt,t.curveCatmullRomOpen=St,t.curveCatmullRom=Et,t.curveLinearClosed=function(t){return new Ct(t)},t.curveLinear=x,t.curveMonotoneX=function(t){return new Rt(t)},t.curveMonotoneY=function(t){return new Pt(t)},t.curveNatural=function(t){return new zt(t)},t.curveStep=function(t){return new Ft(t,.5)},t.curveStepAfter=function(t){return new Ft(t,1)},t.curveStepBefore=function(t){return new Ft(t,0)},t.stack=function(){var t=n([]),e=Bt,r=Vt,i=jt;function o(n){var o,a,s=t.apply(this,arguments),u=n.length,l=s.length,c=new Array(l);for(o=0;o&lt;l;++o){for(var f,p=s[o],h=c[o]=new Array(u),d=0;d&lt;u;++d)h[d]=f=[0,+i(n[d],p,d,n)],f.data=n[d];h.key=p}for(o=0,a=e(c);o&lt;l;++o)c[a[o]].index=o;return r(c,a),c}return o.keys=function(e){return arguments.length?(t=&quot;function&quot;==typeof e?e:n(z.call(e)),o):t},o.value=function(t){return arguments.length?(i=&quot;function&quot;==typeof t?t:n(+t),o):i},o.order=function(t){return arguments.length?(e=null==t?Bt:&quot;function&quot;==typeof t?t:n(z.call(t)),o):e},o.offset=function(t){return arguments.length?(r=null==t?Vt:t,o):r},o},t.stackOffsetExpand=function(t,e){if((r=t.length)&gt;0){for(var n,r,i,o=0,a=t[0].length;o&lt;a;++o){for(i=n=0;n&lt;r;++n)i+=t[n][o][1]||0;if(i)for(n=0;n&lt;r;++n)t[n][o][1]/=i}Vt(t,e)}},t.stackOffsetDiverging=function(t,e){if((s=t.length)&gt;0)for(var n,r,i,o,a,s,u=0,l=t[e[0]].length;u&lt;l;++u)for(o=a=0,n=0;n&lt;s;++n)(i=(r=t[e[n]][u])[1]-r[0])&gt;=0?(r[0]=o,r[1]=o+=i):i&lt;0?(r[1]=a,r[0]=a+=i):r[0]=o},t.stackOffsetNone=Vt,t.stackOffsetSilhouette=function(t,e){if((n=t.length)&gt;0){for(var n,r=0,i=t[e[0]],o=i.length;r&lt;o;++r){for(var a=0,s=0;a&lt;n;++a)s+=t[a][r][1]||0;i[r][1]+=i[r][0]=-s/2}Vt(t,e)}},t.stackOffsetWiggle=function(t,e){if((i=t.length)&gt;0&amp;&amp;(r=(n=t[e[0]]).length)&gt;0){for(var n,r,i,o=0,a=1;a&lt;r;++a){for(var s=0,u=0,l=0;s&lt;i;++s){for(var c=t[e[s]],f=c[a][1]||0,p=(f-(c[a-1][1]||0))/2,h=0;h&lt;s;++h){var d=t[e[h]];p+=(d[a][1]||0)-(d[a-1][1]||0)}u+=f,l+=p*f}n[a-1][1]+=n[a-1][0]=o,u&amp;&amp;(o-=l/u)}n[a-1][1]+=n[a-1][0]=o,Vt(t,e)}},t.stackOrderAppearance=qt,t.stackOrderAscending=Gt,t.stackOrderDescending=function(t){return Gt(t).reverse()},t.stackOrderInsideOut=function(t){var e,n,r=t.length,i=t.map(Wt),o=qt(t),a=0,s=0,u=[],l=[];for(e=0;e&lt;r;++e)n=o[e],a&lt;s?(a+=i[n],u.push(n)):(s+=i[n],l.push(n));return l.reverse().concat(u)},t.stackOrderNone=Bt,t.stackOrderReverse=function(t){return Bt(t).reverse()},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-path&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-path&quot;],i):i(r.d3=r.d3||{},r.d3)},{&quot;d3-path&quot;:321}],329:[function(t,e,n){var r,i;r=this,i=function(t,e){&quot;use strict&quot;;function n(t){if(0&lt;=t.y&amp;&amp;t.y&lt;100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function r(t){if(0&lt;=t.y&amp;&amp;t.y&lt;100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function i(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function o(t){var o=t.dateTime,a=t.date,u=t.time,l=t.periods,c=t.days,f=t.shortDays,p=t.months,vt=t.shortMonths,yt=h(l),bt=d(l),_t=h(c),wt=d(c),xt=h(f),Et=d(f),kt=h(p),Tt=d(p),Nt=h(vt),St=d(vt),Ct={a:function(t){return f[t.getDay()]},A:function(t){return c[t.getDay()]},b:function(t){return vt[t.getMonth()]},B:function(t){return p[t.getMonth()]},c:null,d:P,e:P,f:V,H:D,I:z,j:L,L:F,m:B,M:j,p:function(t){return l[+(t.getHours()&gt;=12)]},Q:mt,s:gt,S:q,u:U,U:G,V:W,w:H,W:$,x:null,X:null,y:K,Y:Y,Z:X,&quot;%&quot;:dt},At={a:function(t){return f[t.getUTCDay()]},A:function(t){return c[t.getUTCDay()]},b:function(t){return vt[t.getUTCMonth()]},B:function(t){return p[t.getUTCMonth()]},c:null,d:Z,e:Z,f:nt,H:Q,I:J,j:tt,L:et,m:rt,M:it,p:function(t){return l[+(t.getUTCHours()&gt;=12)]},Q:mt,s:gt,S:ot,u:at,U:st,V:ut,w:lt,W:ct,x:null,X:null,y:ft,Y:pt,Z:ht,&quot;%&quot;:dt},It={a:function(t,e,n){var r=xt.exec(e.slice(n));return r?(t.w=Et[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=_t.exec(e.slice(n));return r?(t.w=wt[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=Nt.exec(e.slice(n));return r?(t.m=St[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=kt.exec(e.slice(n));return r?(t.m=Tt[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,e,n){return Rt(t,o,e,n)},d:k,e:k,f:I,H:N,I:N,j:T,L:A,m:E,M:S,p:function(t,e,n){var r=yt.exec(e.slice(n));return r?(t.p=bt[r[0].toLowerCase()],n+r[0].length):-1},Q:M,s:R,S:C,u:g,U:v,V:y,w:m,W:b,x:function(t,e,n){return Rt(t,a,e,n)},X:function(t,e,n){return Rt(t,u,e,n)},y:w,Y:_,Z:x,&quot;%&quot;:O};function Ot(t,e){return function(n){var r,i,o,a=[],u=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++u&lt;c;)37===t.charCodeAt(u)&amp;&amp;(a.push(t.slice(l,u)),null!=(i=s[r=t.charAt(++u)])?r=t.charAt(++u):i=&quot;e&quot;===r?&quot; &quot;:&quot;0&quot;,(o=e[r])&amp;&amp;(r=o(n,i)),a.push(r),l=u+1);return a.push(t.slice(l,u)),a.join(&quot;&quot;)}}function Mt(t,n){return function(o){var a,s,u=i(1900);if(Rt(u,t,o+=&quot;&quot;,0)!=o.length)return null;if(&quot;Q&quot;in u)return new Date(u.Q);if(&quot;p&quot;in u&amp;&amp;(u.H=u.H%12+12*u.p),&quot;V&quot;in u){if(u.V&lt;1||u.V&gt;53)return null;&quot;w&quot;in u||(u.w=1),&quot;Z&quot;in u?(a=(s=(a=r(i(u.y))).getUTCDay())&gt;4||0===s?e.utcMonday.ceil(a):e.utcMonday(a),a=e.utcDay.offset(a,7*(u.V-1)),u.y=a.getUTCFullYear(),u.m=a.getUTCMonth(),u.d=a.getUTCDate()+(u.w+6)%7):(a=(s=(a=n(i(u.y))).getDay())&gt;4||0===s?e.timeMonday.ceil(a):e.timeMonday(a),a=e.timeDay.offset(a,7*(u.V-1)),u.y=a.getFullYear(),u.m=a.getMonth(),u.d=a.getDate()+(u.w+6)%7)}else(&quot;W&quot;in u||&quot;U&quot;in u)&amp;&amp;(&quot;w&quot;in u||(u.w=&quot;u&quot;in u?u.u%7:&quot;W&quot;in u?1:0),s=&quot;Z&quot;in u?r(i(u.y)).getUTCDay():n(i(u.y)).getDay(),u.m=0,u.d=&quot;W&quot;in u?(u.w+6)%7+7*u.W-(s+5)%7:u.w+7*u.U-(s+6)%7);return&quot;Z&quot;in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,r(u)):n(u)}}function Rt(t,e,n,r){for(var i,o,a=0,u=e.length,l=n.length;a&lt;u;){if(r&gt;=l)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=It[i in s?e.charAt(a++):i])||(r=o(t,n,r))&lt;0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return Ct.x=Ot(a,Ct),Ct.X=Ot(u,Ct),Ct.c=Ot(o,Ct),At.x=Ot(a,At),At.X=Ot(u,At),At.c=Ot(o,At),{format:function(t){var e=Ot(t+=&quot;&quot;,Ct);return e.toString=function(){return t},e},parse:function(t){var e=Mt(t+=&quot;&quot;,n);return e.toString=function(){return t},e},utcFormat:function(t){var e=Ot(t+=&quot;&quot;,At);return e.toString=function(){return t},e},utcParse:function(t){var e=Mt(t,r);return e.toString=function(){return t},e}}}var a,s={&quot;-&quot;:&quot;&quot;,_:&quot; &quot;,0:&quot;0&quot;},u=/^\s*\d+/,l=/^%/,c=/[\\^$*+?|[\]().{}]/g;function f(t,e,n){var r=t&lt;0?&quot;-&quot;:&quot;&quot;,i=(r?-t:t)+&quot;&quot;,o=i.length;return r+(o&lt;n?new Array(n-o+1).join(e)+i:i)}function p(t){return t.replace(c,&quot;\\$&amp;&quot;)}function h(t){return new RegExp(&quot;^(?:&quot;+t.map(p).join(&quot;|&quot;)+&quot;)&quot;,&quot;i&quot;)}function d(t){for(var e={},n=-1,r=t.length;++n&lt;r;)e[t[n].toLowerCase()]=n;return e}function m(t,e,n){var r=u.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function g(t,e,n){var r=u.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function v(t,e,n){var r=u.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function y(t,e,n){var r=u.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function b(t,e,n){var r=u.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function _(t,e,n){var r=u.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function w(t,e,n){var r=u.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]&gt;68?1900:2e3),n+r[0].length):-1}function x(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||&quot;00&quot;)),n+r[0].length):-1}function E(t,e,n){var r=u.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function k(t,e,n){var r=u.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function T(t,e,n){var r=u.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function N(t,e,n){var r=u.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function S(t,e,n){var r=u.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function C(t,e,n){var r=u.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function A(t,e,n){var r=u.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function I(t,e,n){var r=u.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function O(t,e,n){var r=l.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function M(t,e,n){var r=u.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function R(t,e,n){var r=u.exec(e.slice(n));return r?(t.Q=1e3*+r[0],n+r[0].length):-1}function P(t,e){return f(t.getDate(),e,2)}function D(t,e){return f(t.getHours(),e,2)}function z(t,e){return f(t.getHours()%12||12,e,2)}function L(t,n){return f(1+e.timeDay.count(e.timeYear(t),t),n,3)}function F(t,e){return f(t.getMilliseconds(),e,3)}function V(t,e){return F(t,e)+&quot;000&quot;}function B(t,e){return f(t.getMonth()+1,e,2)}function j(t,e){return f(t.getMinutes(),e,2)}function q(t,e){return f(t.getSeconds(),e,2)}function U(t){var e=t.getDay();return 0===e?7:e}function G(t,n){return f(e.timeSunday.count(e.timeYear(t),t),n,2)}function W(t,n){var r=t.getDay();return t=r&gt;=4||0===r?e.timeThursday(t):e.timeThursday.ceil(t),f(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),n,2)}function H(t){return t.getDay()}function $(t,n){return f(e.timeMonday.count(e.timeYear(t),t),n,2)}function K(t,e){return f(t.getFullYear()%100,e,2)}function Y(t,e){return f(t.getFullYear()%1e4,e,4)}function X(t){var e=t.getTimezoneOffset();return(e&gt;0?&quot;-&quot;:(e*=-1,&quot;+&quot;))+f(e/60|0,&quot;0&quot;,2)+f(e%60,&quot;0&quot;,2)}function Z(t,e){return f(t.getUTCDate(),e,2)}function Q(t,e){return f(t.getUTCHours(),e,2)}function J(t,e){return f(t.getUTCHours()%12||12,e,2)}function tt(t,n){return f(1+e.utcDay.count(e.utcYear(t),t),n,3)}function et(t,e){return f(t.getUTCMilliseconds(),e,3)}function nt(t,e){return et(t,e)+&quot;000&quot;}function rt(t,e){return f(t.getUTCMonth()+1,e,2)}function it(t,e){return f(t.getUTCMinutes(),e,2)}function ot(t,e){return f(t.getUTCSeconds(),e,2)}function at(t){var e=t.getUTCDay();return 0===e?7:e}function st(t,n){return f(e.utcSunday.count(e.utcYear(t),t),n,2)}function ut(t,n){var r=t.getUTCDay();return t=r&gt;=4||0===r?e.utcThursday(t):e.utcThursday.ceil(t),f(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),n,2)}function lt(t){return t.getUTCDay()}function ct(t,n){return f(e.utcMonday.count(e.utcYear(t),t),n,2)}function ft(t,e){return f(t.getUTCFullYear()%100,e,2)}function pt(t,e){return f(t.getUTCFullYear()%1e4,e,4)}function ht(){return&quot;+0000&quot;}function dt(){return&quot;%&quot;}function mt(t){return+t}function gt(t){return Math.floor(+t/1e3)}function vt(e){return a=o(e),t.timeFormat=a.format,t.timeParse=a.parse,t.utcFormat=a.utcFormat,t.utcParse=a.utcParse,a}vt({dateTime:&quot;%x, %X&quot;,date:&quot;%-m/%-d/%Y&quot;,time:&quot;%-I:%M:%S %p&quot;,periods:[&quot;AM&quot;,&quot;PM&quot;],days:[&quot;Sunday&quot;,&quot;Monday&quot;,&quot;Tuesday&quot;,&quot;Wednesday&quot;,&quot;Thursday&quot;,&quot;Friday&quot;,&quot;Saturday&quot;],shortDays:[&quot;Sun&quot;,&quot;Mon&quot;,&quot;Tue&quot;,&quot;Wed&quot;,&quot;Thu&quot;,&quot;Fri&quot;,&quot;Sat&quot;],months:[&quot;January&quot;,&quot;February&quot;,&quot;March&quot;,&quot;April&quot;,&quot;May&quot;,&quot;June&quot;,&quot;July&quot;,&quot;August&quot;,&quot;September&quot;,&quot;October&quot;,&quot;November&quot;,&quot;December&quot;],shortMonths:[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;,&quot;Jul&quot;,&quot;Aug&quot;,&quot;Sep&quot;,&quot;Oct&quot;,&quot;Nov&quot;,&quot;Dec&quot;]});var yt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat(&quot;%Y-%m-%dT%H:%M:%S.%LZ&quot;);var bt=+new Date(&quot;2000-01-01T00:00:00.000Z&quot;)?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse(&quot;%Y-%m-%dT%H:%M:%S.%LZ&quot;);t.timeFormatDefaultLocale=vt,t.timeFormatLocale=o,t.isoFormat=yt,t.isoParse=bt,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-time&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-time&quot;],i):i(r.d3=r.d3||{},r.d3)},{&quot;d3-time&quot;:330}],330:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;var e=new Date,n=new Date;function r(t,i,o,a){function s(e){return t(e=new Date(+e)),e}return s.floor=s,s.ceil=function(e){return t(e=new Date(e-1)),i(e,1),t(e),e},s.round=function(t){var e=s(t),n=s.ceil(t);return t-e&lt;n-t?e:n},s.offset=function(t,e){return i(t=new Date(+t),null==e?1:Math.floor(e)),t},s.range=function(e,n,r){var o,a=[];if(e=s.ceil(e),r=null==r?1:Math.floor(r),!(e&lt;n&amp;&amp;r&gt;0))return a;do{a.push(o=new Date(+e)),i(e,r),t(e)}while(o&lt;e&amp;&amp;e&lt;n);return a},s.filter=function(e){return r(function(n){if(n&gt;=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,n){if(t&gt;=t)if(n&lt;0)for(;++n&lt;=0;)for(;i(t,-1),!e(t););else for(;--n&gt;=0;)for(;i(t,1),!e(t););})},o&amp;&amp;(s.count=function(r,i){return e.setTime(+r),n.setTime(+i),t(e),t(n),Math.floor(o(e,n))},s.every=function(t){return t=Math.floor(t),isFinite(t)&amp;&amp;t&gt;0?t&gt;1?s.filter(a?function(e){return a(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var i=r(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});i.every=function(t){return t=Math.floor(t),isFinite(t)&amp;&amp;t&gt;0?t&gt;1?r(function(e){e.setTime(Math.floor(e/t)*t)},function(e,n){e.setTime(+e+n*t)},function(e,n){return(n-e)/t}):i:null};var o=i.range,a=6e4,s=6048e5,u=r(function(t){t.setTime(t-t.getMilliseconds())},function(t,e){t.setTime(+t+1e3*e)},function(t,e){return(e-t)/1e3},function(t){return t.getUTCSeconds()}),l=u.range,c=r(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},function(t,e){t.setTime(+t+e*a)},function(t,e){return(e-t)/a},function(t){return t.getMinutes()}),f=c.range,p=r(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-t.getMinutes()*a)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getHours()}),h=p.range,d=r(function(t){t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*a)/864e5},function(t){return t.getDate()-1}),m=d.range;function g(t){return r(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*a)/s})}var v=g(0),y=g(1),b=g(2),_=g(3),w=g(4),x=g(5),E=g(6),k=v.range,T=y.range,N=b.range,S=_.range,C=w.range,A=x.range,I=E.range,O=r(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),M=O.range,R=r(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});R.every=function(t){return isFinite(t=Math.floor(t))&amp;&amp;t&gt;0?r(function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,n){e.setFullYear(e.getFullYear()+n*t)}):null};var P=R.range,D=r(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*a)},function(t,e){return(e-t)/a},function(t){return t.getUTCMinutes()}),z=D.range,L=r(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getUTCHours()}),F=L.range,V=r(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5},function(t){return t.getUTCDate()-1}),B=V.range;function j(t){return r(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/s})}var q=j(0),U=j(1),G=j(2),W=j(3),H=j(4),$=j(5),K=j(6),Y=q.range,X=U.range,Z=G.range,Q=W.range,J=H.range,tt=$.range,et=K.range,nt=r(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),rt=nt.range,it=r(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});it.every=function(t){return isFinite(t=Math.floor(t))&amp;&amp;t&gt;0?r(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)}):null};var ot=it.range;t.timeInterval=r,t.timeMillisecond=i,t.timeMilliseconds=o,t.utcMillisecond=i,t.utcMilliseconds=o,t.timeSecond=u,t.timeSeconds=l,t.utcSecond=u,t.utcSeconds=l,t.timeMinute=c,t.timeMinutes=f,t.timeHour=p,t.timeHours=h,t.timeDay=d,t.timeDays=m,t.timeWeek=v,t.timeWeeks=k,t.timeSunday=v,t.timeSundays=k,t.timeMonday=y,t.timeMondays=T,t.timeTuesday=b,t.timeTuesdays=N,t.timeWednesday=_,t.timeWednesdays=S,t.timeThursday=w,t.timeThursdays=C,t.timeFriday=x,t.timeFridays=A,t.timeSaturday=E,t.timeSaturdays=I,t.timeMonth=O,t.timeMonths=M,t.timeYear=R,t.timeYears=P,t.utcMinute=D,t.utcMinutes=z,t.utcHour=L,t.utcHours=F,t.utcDay=V,t.utcDays=B,t.utcWeek=q,t.utcWeeks=Y,t.utcSunday=q,t.utcSundays=Y,t.utcMonday=U,t.utcMondays=X,t.utcTuesday=G,t.utcTuesdays=Z,t.utcWednesday=W,t.utcWednesdays=Q,t.utcThursday=H,t.utcThursdays=J,t.utcFriday=$,t.utcFridays=tt,t.utcSaturday=K,t.utcSaturdays=et,t.utcMonth=nt,t.utcMonths=rt,t.utcYear=it,t.utcYears=ot,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],331:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;var e,n,r=0,i=0,o=0,a=1e3,s=0,u=0,l=0,c=&quot;object&quot;==typeof performance&amp;&amp;performance.now?performance:Date,f=&quot;object&quot;==typeof window&amp;&amp;window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function p(){return u||(f(h),u=c.now()+l)}function h(){u=0}function d(){this._call=this._time=this._next=null}function m(t,e,n){var r=new d;return r.restart(t,e,n),r}function g(){p(),++r;for(var t,n=e;n;)(t=u-n._time)&gt;=0&amp;&amp;n._call.call(null,t),n=n._next;--r}function v(){u=(s=c.now())+l,r=i=0;try{g()}finally{r=0,function(){var t,r,i=e,o=1/0;for(;i;)i._call?(o&gt;i._time&amp;&amp;(o=i._time),t=i,i=i._next):(r=i._next,i._next=null,i=t?t._next=r:e=r);n=t,b(o)}(),u=0}}function y(){var t=c.now(),e=t-s;e&gt;a&amp;&amp;(l-=e,s=t)}function b(t){r||(i&amp;&amp;(i=clearTimeout(i)),t-u&gt;24?(t&lt;1/0&amp;&amp;(i=setTimeout(v,t-c.now()-l)),o&amp;&amp;(o=clearInterval(o))):(o||(s=c.now(),o=setInterval(y,a)),r=1,f(v)))}d.prototype=m.prototype={constructor:d,restart:function(t,r,i){if(&quot;function&quot;!=typeof t)throw new TypeError(&quot;callback is not a function&quot;);i=(null==i?p():+i)+(null==r?0:+r),this._next||n===this||(n?n._next=this:e=this,n=this),this._call=t,this._time=i,b()},stop:function(){this._call&amp;&amp;(this._call=null,this._time=1/0,b())}},t.now=p,t.timer=m,t.timerFlush=g,t.timeout=function(t,e,n){var r=new d;return e=null==e?0:+e,r.restart(function(n){r.stop(),t(n+e)},e,n),r},t.interval=function(t,e,n){var r=new d,i=e;return null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?p():+n,r.restart(function o(a){a+=i,r.restart(o,i+=e,n),t(a)},e,n),r)},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],332:[function(t,e,n){var r,i;r=this,i=function(t,e,n,r,i,o,a){&quot;use strict&quot;;var s=e.dispatch(&quot;start&quot;,&quot;end&quot;,&quot;cancel&quot;,&quot;interrupt&quot;),u=[],l=0,c=1,f=2,p=3,h=4,d=5,m=6;function g(t,e,r,i,o,a){var g=t.__transition;if(g){if(r in g)return}else t.__transition={};!function(t,e,r){var i,o=t.__transition;function a(l){var d,g,v,y;if(r.state!==c)return u();for(d in o)if((y=o[d]).name===r.name){if(y.state===p)return n.timeout(a);y.state===h?(y.state=m,y.timer.stop(),y.on.call(&quot;interrupt&quot;,t,t.__data__,y.index,y.group),delete o[d]):+d&lt;e&amp;&amp;(y.state=m,y.timer.stop(),y.on.call(&quot;cancel&quot;,t,t.__data__,y.index,y.group),delete o[d])}if(n.timeout(function(){r.state===p&amp;&amp;(r.state=h,r.timer.restart(s,r.delay,r.time),s(l))}),r.state=f,r.on.call(&quot;start&quot;,t,t.__data__,r.index,r.group),r.state===f){for(r.state=p,i=new Array(v=r.tween.length),d=0,g=-1;d&lt;v;++d)(y=r.tween[d].value.call(t,t.__data__,r.index,r.group))&amp;&amp;(i[++g]=y);i.length=g+1}}function s(e){for(var n=e&lt;r.duration?r.ease.call(null,e/r.duration):(r.timer.restart(u),r.state=d,1),o=-1,a=i.length;++o&lt;a;)i[o].call(t,n);r.state===d&amp;&amp;(r.on.call(&quot;end&quot;,t,t.__data__,r.index,r.group),u())}function u(){for(var n in r.state=m,r.timer.stop(),delete o[e],o)return;delete t.__transition}o[e]=r,r.timer=n.timer(function(t){r.state=c,r.timer.restart(a,r.delay,r.time),r.delay&lt;=t&amp;&amp;a(t-r.delay)},0,r.time)}(t,r,{name:e,index:i,group:o,on:s,tween:u,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:l})}function v(t,e){var n=b(t,e);if(n.state&gt;l)throw new Error(&quot;too late; already scheduled&quot;);return n}function y(t,e){var n=b(t,e);if(n.state&gt;p)throw new Error(&quot;too late; already running&quot;);return n}function b(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error(&quot;transition not found&quot;);return n}function _(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+&quot;&quot;,o)(n=o[i]).name===e?(r=n.state&gt;f&amp;&amp;n.state&lt;d,n.state=m,n.timer.stop(),n.on.call(r?&quot;interrupt&quot;:&quot;cancel&quot;,t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&amp;&amp;delete t.__transition}}function w(t,e,n){var r=t._id;return t.each(function(){var t=y(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return b(t,r).value[e]}}function x(t,e){var n;return(&quot;number&quot;==typeof e?i.interpolateNumber:e instanceof r.color?i.interpolateRgb:(n=r.color(e))?(e=n,i.interpolateRgb):i.interpolateString)(t,e)}var E=o.selection.prototype.constructor;function k(t){return function(){this.style.removeProperty(t)}}var T=0;function N(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function S(t){return o.selection().transition(t)}function C(){return++T}var A=o.selection.prototype;N.prototype=S.prototype={constructor:N,select:function(t){var e=this._name,n=this._id;&quot;function&quot;!=typeof t&amp;&amp;(t=o.selector(t));for(var r=this._groups,i=r.length,a=new Array(i),s=0;s&lt;i;++s)for(var u,l,c=r[s],f=c.length,p=a[s]=new Array(f),h=0;h&lt;f;++h)(u=c[h])&amp;&amp;(l=t.call(u,u.__data__,h,c))&amp;&amp;(&quot;__data__&quot;in u&amp;&amp;(l.__data__=u.__data__),p[h]=l,g(p[h],e,n,h,p,b(u,n)));return new N(a,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;&quot;function&quot;!=typeof t&amp;&amp;(t=o.selectorAll(t));for(var r=this._groups,i=r.length,a=[],s=[],u=0;u&lt;i;++u)for(var l,c=r[u],f=c.length,p=0;p&lt;f;++p)if(l=c[p]){for(var h,d=t.call(l,l.__data__,p,c),m=b(l,n),v=0,y=d.length;v&lt;y;++v)(h=d[v])&amp;&amp;g(h,e,n,v,d,m);a.push(d),s.push(l)}return new N(a,s,e,n)},filter:function(t){&quot;function&quot;!=typeof t&amp;&amp;(t=o.matcher(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i&lt;n;++i)for(var a,s=e[i],u=s.length,l=r[i]=[],c=0;c&lt;u;++c)(a=s[c])&amp;&amp;t.call(a,a.__data__,c,s)&amp;&amp;l.push(a);return new N(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s&lt;o;++s)for(var u,l=e[s],c=n[s],f=l.length,p=a[s]=new Array(f),h=0;h&lt;f;++h)(u=l[h]||c[h])&amp;&amp;(p[h]=u);for(;s&lt;r;++s)a[s]=e[s];return new N(a,this._parents,this._name,this._id)},selection:function(){return new E(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=C(),r=this._groups,i=r.length,o=0;o&lt;i;++o)for(var a,s=r[o],u=s.length,l=0;l&lt;u;++l)if(a=s[l]){var c=b(a,e);g(a,t,n,l,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new N(r,this._parents,t,n)},call:A.call,nodes:A.nodes,node:A.node,size:A.size,empty:A.empty,each:A.each,on:function(t,e){var n=this._id;return arguments.length&lt;2?b(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,o=function(t){return(t+&quot;&quot;).trim().split(/^|\s+/).every(function(t){var e=t.indexOf(&quot;.&quot;);return e&gt;=0&amp;&amp;(t=t.slice(0,e)),!t||&quot;start&quot;===t})}(e)?v:y;return function(){var a=o(this,t),s=a.on;s!==r&amp;&amp;(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=o.namespace(t),r=&quot;transform&quot;===n?i.interpolateTransformSvg:x;return this.attrTween(t,&quot;function&quot;==typeof e?(n.local?function(t,e,n){var r,i,o;return function(){var a,s,u=n(this);if(null!=u)return(a=this.getAttributeNS(t.space,t.local))===(s=u+&quot;&quot;)?null:a===r&amp;&amp;s===i?o:(i=s,o=e(r=a,u));this.removeAttributeNS(t.space,t.local)}}:function(t,e,n){var r,i,o;return function(){var a,s,u=n(this);if(null!=u)return(a=this.getAttribute(t))===(s=u+&quot;&quot;)?null:a===r&amp;&amp;s===i?o:(i=s,o=e(r=a,u));this.removeAttribute(t)}})(n,r,w(this,&quot;attr.&quot;+t,e)):null==e?(n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(n):(n.local?function(t,e,n){var r,i,o=n+&quot;&quot;;return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}:function(t,e,n){var r,i,o=n+&quot;&quot;;return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}})(n,r,e))},attrTween:function(t,e){var n=&quot;attr.&quot;+t;if(arguments.length&lt;2)return(n=this.tween(n))&amp;&amp;n._value;if(null==e)return this.tween(n,null);if(&quot;function&quot;!=typeof e)throw new Error;var r=o.namespace(t);return this.tween(n,(r.local?function(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&amp;&amp;(n=(r=i)&amp;&amp;function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e(n))}}(t,i)),n}return i._value=e,i}:function(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&amp;&amp;(n=(r=i)&amp;&amp;function(t,e){return function(n){this.setAttribute(t,e(n))}}(t,i)),n}return i._value=e,i})(r,e))},style:function(t,e,n){var r=&quot;transform&quot;==(t+=&quot;&quot;)?i.interpolateTransformCss:x;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var a=o.style(this,t),s=(this.style.removeProperty(t),o.style(this,t));return a===s?null:a===n&amp;&amp;s===r?i:i=e(n=a,r=s)}}(t,r)).on(&quot;end.style.&quot;+t,k(t)):&quot;function&quot;==typeof e?this.styleTween(t,function(t,e,n){var r,i,a;return function(){var s=o.style(this,t),u=n(this),l=u+&quot;&quot;;return null==u&amp;&amp;(this.style.removeProperty(t),l=u=o.style(this,t)),s===l?null:s===r&amp;&amp;l===i?a:(i=l,a=e(r=s,u))}}(t,r,w(this,&quot;style.&quot;+t,e))).each(function(t,e){var n,r,i,o,a=&quot;style.&quot;+e,s=&quot;end.&quot;+a;return function(){var u=y(this,t),l=u.on,c=null==u.value[a]?o||(o=k(e)):void 0;l===n&amp;&amp;i===c||(r=(n=l).copy()).on(s,i=c),u.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,a=n+&quot;&quot;;return function(){var s=o.style(this,t);return s===a?null:s===r?i:i=e(r=s,n)}}(t,r,e),n).on(&quot;end.style.&quot;+t,null)},styleTween:function(t,e,n){var r=&quot;style.&quot;+(t+=&quot;&quot;);if(arguments.length&lt;2)return(r=this.tween(r))&amp;&amp;r._value;if(null==e)return this.tween(r,null);if(&quot;function&quot;!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&amp;&amp;(r=(i=o)&amp;&amp;function(t,e,n){return function(r){this.style.setProperty(t,e(r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?&quot;&quot;:n))},text:function(t){return this.tween(&quot;text&quot;,&quot;function&quot;==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?&quot;&quot;:e}}(w(this,&quot;text&quot;,t)):function(t){return function(){this.textContent=t}}(null==t?&quot;&quot;:t+&quot;&quot;))},remove:function(){return this.on(&quot;end.remove&quot;,(t=this._id,function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&amp;&amp;e.removeChild(this)}));var t},tween:function(t,e){var n=this._id;if(t+=&quot;&quot;,arguments.length&lt;2){for(var r,i=b(this.node(),n).tween,o=0,a=i.length;o&lt;a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?function(t,e){var n,r;return function(){var i=y(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a&lt;s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}:function(t,e,n){var r,i;if(&quot;function&quot;!=typeof n)throw new Error;return function(){var o=y(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},u=0,l=i.length;u&lt;l;++u)if(i[u].name===e){i[u]=s;break}u===l&amp;&amp;i.push(s)}o.tween=i}})(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each((&quot;function&quot;==typeof t?function(t,e){return function(){v(this,t).delay=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){v(this,t).delay=e}})(e,t)):b(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each((&quot;function&quot;==typeof t?function(t,e){return function(){y(this,t).duration=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){y(this,t).duration=e}})(e,t)):b(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if(&quot;function&quot;!=typeof e)throw new Error;return function(){y(this,t).ease=e}}(e,t)):b(this.node(),e).ease},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},u={value:function(){0==--i&amp;&amp;o()}};n.each(function(){var n=y(this,r),i=n.on;i!==t&amp;&amp;((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(u)),n.on=e})})}};var I={time:null,delay:0,duration:250,ease:a.easeCubicInOut};function O(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))return I.time=n.now(),I;return r}o.selection.prototype.interrupt=function(t){return this.each(function(){_(this,t)})},o.selection.prototype.transition=function(t){var e,r;t instanceof N?(e=t._id,t=t._name):(e=C(),(r=I).time=n.now(),t=null==t?null:t+&quot;&quot;);for(var i=this._groups,o=i.length,a=0;a&lt;o;++a)for(var s,u=i[a],l=u.length,c=0;c&lt;l;++c)(s=u[c])&amp;&amp;g(s,t,e,c,u,r||O(s,e));return new N(i,this._parents,t,e)};var M=[null];t.transition=S,t.active=function(t,e){var n,r,i=t.__transition;if(i)for(r in e=null==e?null:e+&quot;&quot;,i)if((n=i[r]).state&gt;c&amp;&amp;n.name===e)return new N([[t]],M,e,+r);return null},t.interrupt=_,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-dispatch&quot;),t(&quot;d3-timer&quot;),t(&quot;d3-color&quot;),t(&quot;d3-interpolate&quot;),t(&quot;d3-selection&quot;),t(&quot;d3-ease&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-dispatch&quot;,&quot;d3-timer&quot;,&quot;d3-color&quot;,&quot;d3-interpolate&quot;,&quot;d3-selection&quot;,&quot;d3-ease&quot;],i):i(r.d3=r.d3||{},r.d3,r.d3,r.d3,r.d3,r.d3,r.d3)},{&quot;d3-color&quot;:309,&quot;d3-dispatch&quot;:311,&quot;d3-ease&quot;:314,&quot;d3-interpolate&quot;:320,&quot;d3-selection&quot;:327,&quot;d3-timer&quot;:331}],333:[function(t,e,n){var r,i;r=this,i=function(t){&quot;use strict&quot;;function e(t){return function(){return t}}function n(t){return t[0]}function r(t){return t[1]}function i(){this._=null}function o(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function a(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.R=r.L,n.R&amp;&amp;(n.R.U=n),r.L=n}function s(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.L=r.R,n.L&amp;&amp;(n.L.U=n),r.R=n}function u(t){for(;t.L;)t=t.L;return t}function l(t,e,n,r){var i=[null,null],o=O.push(i)-1;return i.left=t,i.right=e,n&amp;&amp;f(i,t,e,n),r&amp;&amp;f(i,e,t,r),A[t.index].halfedges.push(o),A[e.index].halfedges.push(o),i}function c(t,e,n){var r=[e,n];return r.left=t,r}function f(t,e,n,r){t[0]||t[1]?t.left===n?t[1]=r:t[0]=r:(t[0]=r,t.left=e,t.right=n)}function p(t,e,n,r,i){var o,a=t[0],s=t[1],u=a[0],l=a[1],c=0,f=1,p=s[0]-u,h=s[1]-l;if(o=e-u,p||!(o&gt;0)){if(o/=p,p&lt;0){if(o&lt;c)return;o&lt;f&amp;&amp;(f=o)}else if(p&gt;0){if(o&gt;f)return;o&gt;c&amp;&amp;(c=o)}if(o=r-u,p||!(o&lt;0)){if(o/=p,p&lt;0){if(o&gt;f)return;o&gt;c&amp;&amp;(c=o)}else if(p&gt;0){if(o&lt;c)return;o&lt;f&amp;&amp;(f=o)}if(o=n-l,h||!(o&gt;0)){if(o/=h,h&lt;0){if(o&lt;c)return;o&lt;f&amp;&amp;(f=o)}else if(h&gt;0){if(o&gt;f)return;o&gt;c&amp;&amp;(c=o)}if(o=i-l,h||!(o&lt;0)){if(o/=h,h&lt;0){if(o&gt;f)return;o&gt;c&amp;&amp;(c=o)}else if(h&gt;0){if(o&lt;c)return;o&lt;f&amp;&amp;(f=o)}return!(c&gt;0||f&lt;1)||(c&gt;0&amp;&amp;(t[0]=[u+c*p,l+c*h]),f&lt;1&amp;&amp;(t[1]=[u+f*p,l+f*h]),!0)}}}}}function h(t,e,n,r,i){var o=t[1];if(o)return!0;var a,s,u=t[0],l=t.left,c=t.right,f=l[0],p=l[1],h=c[0],d=c[1],m=(f+h)/2,g=(p+d)/2;if(d===p){if(m&lt;e||m&gt;=r)return;if(f&gt;h){if(u){if(u[1]&gt;=i)return}else u=[m,n];o=[m,i]}else{if(u){if(u[1]&lt;n)return}else u=[m,i];o=[m,n]}}else if(s=g-(a=(f-h)/(d-p))*m,a&lt;-1||a&gt;1)if(f&gt;h){if(u){if(u[1]&gt;=i)return}else u=[(n-s)/a,n];o=[(i-s)/a,i]}else{if(u){if(u[1]&lt;n)return}else u=[(i-s)/a,i];o=[(n-s)/a,n]}else if(p&lt;d){if(u){if(u[0]&gt;=r)return}else u=[e,a*e+s];o=[r,a*r+s]}else{if(u){if(u[0]&lt;e)return}else u=[r,a*r+s];o=[e,a*e+s]}return t[0]=u,t[1]=o,!0}function d(t,e){var n=t.site,r=e.left,i=e.right;return n===i&amp;&amp;(i=r,r=n),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(n===r?(r=e[1],i=e[0]):(r=e[0],i=e[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function m(t,e){return e[+(e.left!==t.site)]}function g(t,e){return e[+(e.left===t.site)]}i.prototype={constructor:i,insert:function(t,e){var n,r,i;if(t){if(e.P=t,e.N=t.N,t.N&amp;&amp;(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else this._?(t=u(this._),e.P=null,e.N=t,t.P=t.L=e,n=t):(e.P=e.N=null,this._=e,n=null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&amp;&amp;n.C;)n===(r=n.U).L?(i=r.R)&amp;&amp;i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.R&amp;&amp;(a(this,n),n=(t=n).U),n.C=!1,r.C=!0,s(this,r)):(i=r.L)&amp;&amp;i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&amp;&amp;(s(this,n),n=(t=n).U),n.C=!1,r.C=!0,a(this,r)),n=t.U;this._.C=!1},remove:function(t){t.N&amp;&amp;(t.N.P=t.P),t.P&amp;&amp;(t.P.N=t.N),t.N=t.P=null;var e,n,r,i=t.U,o=t.L,l=t.R;if(n=o?l?u(l):o:l,i?i.L===t?i.L=n:i.R=n:this._=n,o&amp;&amp;l?(r=n.C,n.C=t.C,n.L=o,o.U=n,n!==l?(i=n.U,n.U=t.U,t=n.R,i.L=t,n.R=l,l.U=n):(n.U=i,i=n,t=n.R)):(r=t.C,t=n),t&amp;&amp;(t.U=i),!r)if(t&amp;&amp;t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&amp;&amp;(e.C=!1,i.C=!0,a(this,i),e=i.R),e.L&amp;&amp;e.L.C||e.R&amp;&amp;e.R.C){e.R&amp;&amp;e.R.C||(e.L.C=!1,e.C=!0,s(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,a(this,i),t=this._;break}}else if((e=i.L).C&amp;&amp;(e.C=!1,i.C=!0,s(this,i),e=i.L),e.L&amp;&amp;e.L.C||e.R&amp;&amp;e.R.C){e.L&amp;&amp;e.L.C||(e.R.C=!1,e.C=!0,a(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,s(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&amp;&amp;(t.C=!1)}}};var v,y=[];function b(t){var e=t.P,n=t.N;if(e&amp;&amp;n){var r=e.site,i=t.site,a=n.site;if(r!==a){var s=i[0],u=i[1],l=r[0]-s,c=r[1]-u,f=a[0]-s,p=a[1]-u,h=2*(l*p-c*f);if(!(h&gt;=-R)){var d=l*l+c*c,m=f*f+p*p,g=(p*d-c*m)/h,b=(l*m-f*d)/h,_=y.pop()||new function(){o(this),this.x=this.y=this.arc=this.site=this.cy=null};_.arc=t,_.site=i,_.x=g+s,_.y=(_.cy=b+u)+Math.sqrt(g*g+b*b),t.circle=_;for(var w=null,x=I._;x;)if(_.y&lt;x.y||_.y===x.y&amp;&amp;_.x&lt;=x.x){if(!x.L){w=x.P;break}x=x.L}else{if(!x.R){w=x;break}x=x.R}I.insert(w,_),w||(v=_)}}}}function _(t){var e=t.circle;e&amp;&amp;(e.P||(v=e.N),I.remove(e),y.push(e),o(e),t.circle=null)}var w=[];function x(t){var e=w.pop()||new function(){o(this),this.edge=this.site=this.circle=null};return e.site=t,e}function E(t){_(t),C.remove(t),w.push(t),o(t)}function k(t){var e=t.circle,n=e.x,r=e.cy,i=[n,r],o=t.P,a=t.N,s=[t];E(t);for(var u=o;u.circle&amp;&amp;Math.abs(n-u.circle.x)&lt;M&amp;&amp;Math.abs(r-u.circle.cy)&lt;M;)o=u.P,s.unshift(u),E(u),u=o;s.unshift(u),_(u);for(var c=a;c.circle&amp;&amp;Math.abs(n-c.circle.x)&lt;M&amp;&amp;Math.abs(r-c.circle.cy)&lt;M;)a=c.N,s.push(c),E(c),c=a;s.push(c),_(c);var p,h=s.length;for(p=1;p&lt;h;++p)c=s[p],u=s[p-1],f(c.edge,u.site,c.site,i);u=s[0],(c=s[h-1]).edge=l(u.site,c.site,null,i),b(u),b(c)}function T(t){for(var e,n,r,i,o=t[0],a=t[1],s=C._;s;)if((r=N(s,a)-o)&gt;M)s=s.L;else{if(!((i=o-S(s,a))&gt;M)){r&gt;-M?(e=s.P,n=s):i&gt;-M?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}!function(t){A[t.index]={site:t,halfedges:[]}}(t);var u=x(t);if(C.insert(e,u),e||n){if(e===n)return _(e),n=x(e.site),C.insert(u,n),u.edge=n.edge=l(e.site,u.site),b(e),void b(n);if(n){_(e),_(n);var c=e.site,p=c[0],h=c[1],d=t[0]-p,m=t[1]-h,g=n.site,v=g[0]-p,y=g[1]-h,w=2*(d*y-m*v),E=d*d+m*m,k=v*v+y*y,T=[(y*E-m*k)/w+p,(d*k-v*E)/w+h];f(n.edge,c,g,T),u.edge=l(c,t,null,T),n.edge=l(t,g,null,T),b(e),b(n)}else u.edge=l(e.site,u.site)}}function N(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var a=t.P;if(!a)return-1/0;var s=(n=a.site)[0],u=n[1],l=u-e;if(!l)return s;var c=s-r,f=1/o-1/l,p=c/l;return f?(-p+Math.sqrt(p*p-2*f*(c*c/(-2*l)-u+l/2+i-o/2)))/f+r:(r+s)/2}function S(t,e){var n=t.N;if(n)return N(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var C,A,I,O,M=1e-6,R=1e-12;function P(t,e){return e[1]-t[1]||e[0]-t[0]}function D(t,e){var n,r,o,a=t.sort(P).pop();for(O=[],A=new Array(t.length),C=new i,I=new i;;)if(o=v,a&amp;&amp;(!o||a[1]&lt;o.y||a[1]===o.y&amp;&amp;a[0]&lt;o.x))a[0]===n&amp;&amp;a[1]===r||(T(a),n=a[0],r=a[1]),a=t.pop();else{if(!o)break;k(o.arc)}if(function(){for(var t,e,n,r,i=0,o=A.length;i&lt;o;++i)if((t=A[i])&amp;&amp;(r=(e=t.halfedges).length)){var a=new Array(r),s=new Array(r);for(n=0;n&lt;r;++n)a[n]=n,s[n]=d(t,O[e[n]]);for(a.sort(function(t,e){return s[e]-s[t]}),n=0;n&lt;r;++n)s[n]=e[a[n]];for(n=0;n&lt;r;++n)e[n]=s[n]}}(),e){var s=+e[0][0],u=+e[0][1],l=+e[1][0],f=+e[1][1];!function(t,e,n,r){for(var i,o=O.length;o--;)h(i=O[o],t,e,n,r)&amp;&amp;p(i,t,e,n,r)&amp;&amp;(Math.abs(i[0][0]-i[1][0])&gt;M||Math.abs(i[0][1]-i[1][1])&gt;M)||delete O[o]}(s,u,l,f),function(t,e,n,r){var i,o,a,s,u,l,f,p,h,d,v,y,b=A.length,_=!0;for(i=0;i&lt;b;++i)if(o=A[i]){for(a=o.site,s=(u=o.halfedges).length;s--;)O[u[s]]||u.splice(s,1);for(s=0,l=u.length;s&lt;l;)v=(d=g(o,O[u[s]]))[0],y=d[1],p=(f=m(o,O[u[++s%l]]))[0],h=f[1],(Math.abs(v-p)&gt;M||Math.abs(y-h)&gt;M)&amp;&amp;(u.splice(s,0,O.push(c(a,d,Math.abs(v-t)&lt;M&amp;&amp;r-y&gt;M?[t,Math.abs(p-t)&lt;M?h:r]:Math.abs(y-r)&lt;M&amp;&amp;n-v&gt;M?[Math.abs(h-r)&lt;M?p:n,r]:Math.abs(v-n)&lt;M&amp;&amp;y-e&gt;M?[n,Math.abs(p-n)&lt;M?h:e]:Math.abs(y-e)&lt;M&amp;&amp;v-t&gt;M?[Math.abs(h-e)&lt;M?p:t,e]:null))-1),++l);l&amp;&amp;(_=!1)}if(_){var w,x,E,k=1/0;for(i=0,_=null;i&lt;b;++i)(o=A[i])&amp;&amp;(E=(w=(a=o.site)[0]-t)*w+(x=a[1]-e)*x)&lt;k&amp;&amp;(k=E,_=o);if(_){var T=[t,e],N=[t,r],S=[n,r],C=[n,e];_.halfedges.push(O.push(c(a=_.site,T,N))-1,O.push(c(a,N,S))-1,O.push(c(a,S,C))-1,O.push(c(a,C,T))-1)}}for(i=0;i&lt;b;++i)(o=A[i])&amp;&amp;(o.halfedges.length||delete A[i])}(s,u,l,f)}this.edges=O,this.cells=A,C=I=O=A=null}D.prototype={constructor:D,polygons:function(){var t=this.edges;return this.cells.map(function(e){var n=e.halfedges.map(function(n){return m(e,t[n])});return n.data=e.site.data,n})},triangles:function(){var t=[],e=this.edges;return this.cells.forEach(function(n,r){if(o=(i=n.halfedges).length)for(var i,o,a,s,u,l,c=n.site,f=-1,p=e[i[o-1]],h=p.left===c?p.right:p.left;++f&lt;o;)a=h,h=(p=e[i[f]]).left===c?p.right:p.left,a&amp;&amp;h&amp;&amp;r&lt;a.index&amp;&amp;r&lt;h.index&amp;&amp;(u=a,l=h,((s=c)[0]-l[0])*(u[1]-s[1])-(s[0]-u[0])*(l[1]-s[1])&lt;0)&amp;&amp;t.push([c.data,a.data,h.data])}),t},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(t,e,n){for(var r,i,o=this,a=o._found||0,s=o.cells.length;!(i=o.cells[a]);)if(++a&gt;=s)return null;var u=t-i.site[0],l=e-i.site[1],c=u*u+l*l;do{i=o.cells[r=a],a=null,i.halfedges.forEach(function(n){var r=o.edges[n],s=r.left;if(s!==i.site&amp;&amp;s||(s=r.right)){var u=t-s[0],l=e-s[1],f=u*u+l*l;f&lt;c&amp;&amp;(c=f,a=s.index)}})}while(null!==a);return o._found=r,null==n||c&lt;=n*n?i.site:null}},t.voronoi=function(){var t=n,i=r,o=null;function a(e){return new D(e.map(function(n,r){var o=[Math.round(t(n,r,e)/M)*M,Math.round(i(n,r,e)/M)*M];return o.index=r,o.data=n,o}),o)}return a.polygons=function(t){return a(t).polygons()},a.links=function(t){return a(t).links()},a.triangles=function(t){return a(t).triangles()},a.x=function(n){return arguments.length?(t=&quot;function&quot;==typeof n?n:e(+n),a):t},a.y=function(t){return arguments.length?(i=&quot;function&quot;==typeof t?t:e(+t),a):i},a.extent=function(t){return arguments.length?(o=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],a):o&amp;&amp;[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},a.size=function(t){return arguments.length?(o=null==t?null:[[0,0],[+t[0],+t[1]]],a):o&amp;&amp;[o[1][0]-o[0][0],o[1][1]-o[0][1]]},a},Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;],i):i(r.d3=r.d3||{})},{}],334:[function(t,e,n){var r,i;r=this,i=function(t,e,n,r,i,o){&quot;use strict&quot;;function a(t){return function(){return t}}function s(t,e,n){this.k=t,this.x=e,this.y=n}s.prototype={constructor:s,scale:function(t){return 1===t?this:new s(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&amp;0===e?this:new s(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return&quot;translate(&quot;+this.x+&quot;,&quot;+this.y+&quot;) scale(&quot;+this.k+&quot;)&quot;}};var u=new s(1,0,0);function l(t){return t.__zoom||u}function c(){e.event.stopImmediatePropagation()}function f(){e.event.preventDefault(),e.event.stopImmediatePropagation()}function p(){return!e.event.button}function h(){var t,e,n=this;return n instanceof SVGElement?(t=(n=n.ownerSVGElement||n).width.baseVal.value,e=n.height.baseVal.value):(t=n.clientWidth,e=n.clientHeight),[[0,0],[t,e]]}function d(){return this.__zoom||u}function m(){return-e.event.deltaY*(e.event.deltaMode?120:1)/500}function g(){return&quot;ontouchstart&quot;in this}function v(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i&gt;r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a&gt;o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}l.prototype=s.prototype,t.zoom=function(){var t,l,y=p,b=h,_=v,w=m,x=g,E=[0,1/0],k=[[-1/0,-1/0],[1/0,1/0]],T=250,N=i.interpolateZoom,S=[],C=n.dispatch(&quot;start&quot;,&quot;zoom&quot;,&quot;end&quot;),A=500,I=150,O=0;function M(t){t.property(&quot;__zoom&quot;,d).on(&quot;wheel.zoom&quot;,V).on(&quot;mousedown.zoom&quot;,B).on(&quot;dblclick.zoom&quot;,j).filter(x).on(&quot;touchstart.zoom&quot;,q).on(&quot;touchmove.zoom&quot;,U).on(&quot;touchend.zoom touchcancel.zoom&quot;,G).style(&quot;touch-action&quot;,&quot;none&quot;).style(&quot;-webkit-tap-highlight-color&quot;,&quot;rgba(0,0,0,0)&quot;)}function R(t,e){return(e=Math.max(E[0],Math.min(E[1],e)))===t.k?t:new s(e,t.x,t.y)}function P(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&amp;&amp;i===t.y?t:new s(t.k,r,i)}function D(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function z(t,e,n){t.on(&quot;start.zoom&quot;,function(){L(this,arguments).start()}).on(&quot;interrupt.zoom end.zoom&quot;,function(){L(this,arguments).end()}).tween(&quot;zoom&quot;,function(){var t=arguments,r=L(this,t),i=b.apply(this,t),o=n||D(i),a=Math.max(i[1][0]-i[0][0],i[1][1]-i[0][1]),u=this.__zoom,l=&quot;function&quot;==typeof e?e.apply(this,t):e,c=N(u.invert(o).concat(a/u.k),l.invert(o).concat(a/l.k));return function(t){if(1===t)t=l;else{var e=c(t),n=a/e[2];t=new s(n,o[0]-e[0]*n,o[1]-e[1]*n)}r.zoom(null,t)}})}function L(t,e){for(var n,r=0,i=S.length;r&lt;i;++r)if((n=S[r]).that===t)return n;return new F(t,e)}function F(t,e){this.that=t,this.args=e,this.index=-1,this.active=0,this.extent=b.apply(t,e)}function V(){if(y.apply(this,arguments)){var t=L(this,arguments),n=this.__zoom,r=Math.max(E[0],Math.min(E[1],n.k*Math.pow(2,w.apply(this,arguments)))),i=e.mouse(this);if(t.wheel)t.mouse[0][0]===i[0]&amp;&amp;t.mouse[0][1]===i[1]||(t.mouse[1]=n.invert(t.mouse[0]=i)),clearTimeout(t.wheel);else{if(n.k===r)return;t.mouse=[i,n.invert(i)],o.interrupt(this),t.start()}f(),t.wheel=setTimeout(function(){t.wheel=null,t.end()},I),t.zoom(&quot;mouse&quot;,_(P(R(n,r),t.mouse[0],t.mouse[1]),t.extent,k))}}function B(){if(!l&amp;&amp;y.apply(this,arguments)){var t=L(this,arguments),n=e.select(e.event.view).on(&quot;mousemove.zoom&quot;,function(){if(f(),!t.moved){var n=e.event.clientX-a,r=e.event.clientY-s;t.moved=n*n+r*r&gt;O}t.zoom(&quot;mouse&quot;,_(P(t.that.__zoom,t.mouse[0]=e.mouse(t.that),t.mouse[1]),t.extent,k))},!0).on(&quot;mouseup.zoom&quot;,function(){n.on(&quot;mousemove.zoom mouseup.zoom&quot;,null),r.dragEnable(e.event.view,t.moved),f(),t.end()},!0),i=e.mouse(this),a=e.event.clientX,s=e.event.clientY;r.dragDisable(e.event.view),c(),t.mouse=[i,this.__zoom.invert(i)],o.interrupt(this),t.start()}}function j(){if(y.apply(this,arguments)){var t=this.__zoom,n=e.mouse(this),r=t.invert(n),i=t.k*(e.event.shiftKey?.5:2),o=_(P(R(t,i),n,r),b.apply(this,arguments),k);f(),T&gt;0?e.select(this).transition().duration(T).call(z,o,n):e.select(this).call(M.transform,o)}}function q(){if(y.apply(this,arguments)){var n,r,i,a,s=L(this,arguments),u=e.event.changedTouches,l=u.length;for(c(),r=0;r&lt;l;++r)i=u[r],a=[a=e.touch(this,u,i.identifier),this.__zoom.invert(a),i.identifier],s.touch0?s.touch1||(s.touch1=a):(s.touch0=a,n=!0);if(t&amp;&amp;(t=clearTimeout(t),!s.touch1))return s.end(),void((a=e.select(this).on(&quot;dblclick.zoom&quot;))&amp;&amp;a.apply(this,arguments));n&amp;&amp;(t=setTimeout(function(){t=null},A),o.interrupt(this),s.start())}}function U(){var n,r,i,o,a=L(this,arguments),s=e.event.changedTouches,u=s.length;for(f(),t&amp;&amp;(t=clearTimeout(t)),n=0;n&lt;u;++n)r=s[n],i=e.touch(this,s,r.identifier),a.touch0&amp;&amp;a.touch0[2]===r.identifier?a.touch0[0]=i:a.touch1&amp;&amp;a.touch1[2]===r.identifier&amp;&amp;(a.touch1[0]=i);if(r=a.that.__zoom,a.touch1){var l=a.touch0[0],c=a.touch0[1],p=a.touch1[0],h=a.touch1[1],d=(d=p[0]-l[0])*d+(d=p[1]-l[1])*d,m=(m=h[0]-c[0])*m+(m=h[1]-c[1])*m;r=R(r,Math.sqrt(d/m)),i=[(l[0]+p[0])/2,(l[1]+p[1])/2],o=[(c[0]+h[0])/2,(c[1]+h[1])/2]}else{if(!a.touch0)return;i=a.touch0[0],o=a.touch0[1]}a.zoom(&quot;touch&quot;,_(P(r,i,o),a.extent,k))}function G(){var t,n,r=L(this,arguments),i=e.event.changedTouches,o=i.length;for(c(),l&amp;&amp;clearTimeout(l),l=setTimeout(function(){l=null},A),t=0;t&lt;o;++t)n=i[t],r.touch0&amp;&amp;r.touch0[2]===n.identifier?delete r.touch0:r.touch1&amp;&amp;r.touch1[2]===n.identifier&amp;&amp;delete r.touch1;r.touch1&amp;&amp;!r.touch0&amp;&amp;(r.touch0=r.touch1,delete r.touch1),r.touch0?r.touch0[1]=this.__zoom.invert(r.touch0[0]):r.end()}return M.transform=function(t,e){var n=t.selection?t.selection():t;n.property(&quot;__zoom&quot;,d),t!==n?z(t,e):n.interrupt().each(function(){L(this,arguments).start().zoom(null,&quot;function&quot;==typeof e?e.apply(this,arguments):e).end()})},M.scaleBy=function(t,e){M.scaleTo(t,function(){return this.__zoom.k*(&quot;function&quot;==typeof e?e.apply(this,arguments):e)})},M.scaleTo=function(t,e){M.transform(t,function(){var t=b.apply(this,arguments),n=this.__zoom,r=D(t),i=n.invert(r),o=&quot;function&quot;==typeof e?e.apply(this,arguments):e;return _(P(R(n,o),r,i),t,k)})},M.translateBy=function(t,e,n){M.transform(t,function(){return _(this.__zoom.translate(&quot;function&quot;==typeof e?e.apply(this,arguments):e,&quot;function&quot;==typeof n?n.apply(this,arguments):n),b.apply(this,arguments),k)})},M.translateTo=function(t,e,n){M.transform(t,function(){var t=b.apply(this,arguments),r=this.__zoom,i=D(t);return _(u.translate(i[0],i[1]).scale(r.k).translate(&quot;function&quot;==typeof e?-e.apply(this,arguments):-e,&quot;function&quot;==typeof n?-n.apply(this,arguments):-n),t,k)})},F.prototype={start:function(){return 1==++this.active&amp;&amp;(this.index=S.push(this)-1,this.emit(&quot;start&quot;)),this},zoom:function(t,e){return this.mouse&amp;&amp;&quot;mouse&quot;!==t&amp;&amp;(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&amp;&amp;&quot;touch&quot;!==t&amp;&amp;(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&amp;&amp;&quot;touch&quot;!==t&amp;&amp;(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit(&quot;zoom&quot;),this},end:function(){return 0==--this.active&amp;&amp;(S.splice(this.index,1),this.index=-1,this.emit(&quot;end&quot;)),this},emit:function(t){e.customEvent(new function(t,e,n){this.target=t,this.type=e,this.transform=n}(M,t,this.that.__zoom),C.apply,C,[t,this.that,this.args])}},M.wheelDelta=function(t){return arguments.length?(w=&quot;function&quot;==typeof t?t:a(+t),M):w},M.filter=function(t){return arguments.length?(y=&quot;function&quot;==typeof t?t:a(!!t),M):y},M.touchable=function(t){return arguments.length?(x=&quot;function&quot;==typeof t?t:a(!!t),M):x},M.extent=function(t){return arguments.length?(b=&quot;function&quot;==typeof t?t:a([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),M):b},M.scaleExtent=function(t){return arguments.length?(E[0]=+t[0],E[1]=+t[1],M):[E[0],E[1]]},M.translateExtent=function(t){return arguments.length?(k[0][0]=+t[0][0],k[1][0]=+t[1][0],k[0][1]=+t[0][1],k[1][1]=+t[1][1],M):[[k[0][0],k[0][1]],[k[1][0],k[1][1]]]},M.constrain=function(t){return arguments.length?(_=t,M):_},M.duration=function(t){return arguments.length?(T=+t,M):T},M.interpolate=function(t){return arguments.length?(N=t,M):N},M.on=function(){var t=C.on.apply(C,arguments);return t===C?M:t},M.clickDistance=function(t){return arguments.length?(O=(t=+t)*t,M):Math.sqrt(O)},M},t.zoomTransform=l,t.zoomIdentity=u,Object.defineProperty(t,&quot;__esModule&quot;,{value:!0})},&quot;object&quot;==typeof n&amp;&amp;void 0!==e?i(n,t(&quot;d3-selection&quot;),t(&quot;d3-dispatch&quot;),t(&quot;d3-drag&quot;),t(&quot;d3-interpolate&quot;),t(&quot;d3-transition&quot;)):&quot;function&quot;==typeof define&amp;&amp;define.amd?define([&quot;exports&quot;,&quot;d3-selection&quot;,&quot;d3-dispatch&quot;,&quot;d3-drag&quot;,&quot;d3-interpolate&quot;,&quot;d3-transition&quot;],i):i(r.d3=r.d3||{},r.d3,r.d3,r.d3,r.d3,r.d3)},{&quot;d3-dispatch&quot;:311,&quot;d3-drag&quot;:312,&quot;d3-interpolate&quot;:320,&quot;d3-selection&quot;:327,&quot;d3-transition&quot;:332}],335:[function(t,e,n){&quot;use strict&quot;;Object.defineProperty(n,&quot;__esModule&quot;,{value:!0});var r=t(&quot;d3-array&quot;),i=t(&quot;d3-axis&quot;),o=t(&quot;d3-brush&quot;),a=t(&quot;d3-chord&quot;),s=t(&quot;d3-collection&quot;),u=t(&quot;d3-color&quot;),l=t(&quot;d3-contour&quot;),c=t(&quot;d3-dispatch&quot;),f=t(&quot;d3-drag&quot;),p=t(&quot;d3-dsv&quot;),h=t(&quot;d3-ease&quot;),d=t(&quot;d3-fetch&quot;),m=t(&quot;d3-force&quot;),g=t(&quot;d3-format&quot;),v=t(&quot;d3-geo&quot;),y=t(&quot;d3-hierarchy&quot;),b=t(&quot;d3-interpolate&quot;),_=t(&quot;d3-path&quot;),w=t(&quot;d3-polygon&quot;),x=t(&quot;d3-quadtree&quot;),E=t(&quot;d3-random&quot;),k=t(&quot;d3-scale&quot;),T=t(&quot;d3-scale-chromatic&quot;),N=t(&quot;d3-selection&quot;),S=t(&quot;d3-shape&quot;),C=t(&quot;d3-time&quot;),A=t(&quot;d3-time-format&quot;),I=t(&quot;d3-timer&quot;),O=t(&quot;d3-transition&quot;),M=t(&quot;d3-voronoi&quot;),R=t(&quot;d3-zoom&quot;);Object.keys(r).forEach(function(t){n[t]=r[t]}),Object.keys(i).forEach(function(t){n[t]=i[t]}),Object.keys(o).forEach(function(t){n[t]=o[t]}),Object.keys(a).forEach(function(t){n[t]=a[t]}),Object.keys(s).forEach(function(t){n[t]=s[t]}),Object.keys(u).forEach(function(t){n[t]=u[t]}),Object.keys(l).forEach(function(t){n[t]=l[t]}),Object.keys(c).forEach(function(t){n[t]=c[t]}),Object.keys(f).forEach(function(t){n[t]=f[t]}),Object.keys(p).forEach(function(t){n[t]=p[t]}),Object.keys(h).forEach(function(t){n[t]=h[t]}),Object.keys(d).forEach(function(t){n[t]=d[t]}),Object.keys(m).forEach(function(t){n[t]=m[t]}),Object.keys(g).forEach(function(t){n[t]=g[t]}),Object.keys(v).forEach(function(t){n[t]=v[t]}),Object.keys(y).forEach(function(t){n[t]=y[t]}),Object.keys(b).forEach(function(t){n[t]=b[t]}),Object.keys(_).forEach(function(t){n[t]=_[t]}),Object.keys(w).forEach(function(t){n[t]=w[t]}),Object.keys(x).forEach(function(t){n[t]=x[t]}),Object.keys(E).forEach(function(t){n[t]=E[t]}),Object.keys(k).forEach(function(t){n[t]=k[t]}),Object.keys(T).forEach(function(t){n[t]=T[t]}),Object.keys(N).forEach(function(t){n[t]=N[t]}),Object.keys(S).forEach(function(t){n[t]=S[t]}),Object.keys(C).forEach(function(t){n[t]=C[t]}),Object.keys(A).forEach(function(t){n[t]=A[t]}),Object.keys(I).forEach(function(t){n[t]=I[t]}),Object.keys(O).forEach(function(t){n[t]=O[t]}),Object.keys(M).forEach(function(t){n[t]=M[t]}),Object.keys(R).forEach(function(t){n[t]=R[t]}),n.version=&quot;5.9.2&quot;,Object.defineProperty(n,&quot;event&quot;,{get:function(){return N.event}})},{&quot;d3-array&quot;:304,&quot;d3-axis&quot;:305,&quot;d3-brush&quot;:306,&quot;d3-chord&quot;:307,&quot;d3-collection&quot;:308,&quot;d3-color&quot;:309,&quot;d3-contour&quot;:310,&quot;d3-dispatch&quot;:311,&quot;d3-drag&quot;:312,&quot;d3-dsv&quot;:313,&quot;d3-ease&quot;:314,&quot;d3-fetch&quot;:315,&quot;d3-force&quot;:316,&quot;d3-format&quot;:317,&quot;d3-geo&quot;:318,&quot;d3-hierarchy&quot;:319,&quot;d3-interpolate&quot;:320,&quot;d3-path&quot;:321,&quot;d3-polygon&quot;:322,&quot;d3-quadtree&quot;:323,&quot;d3-random&quot;:324,&quot;d3-scale&quot;:326,&quot;d3-scale-chromatic&quot;:325,&quot;d3-selection&quot;:327,&quot;d3-shape&quot;:328,&quot;d3-time&quot;:330,&quot;d3-time-format&quot;:329,&quot;d3-timer&quot;:331,&quot;d3-transition&quot;:332,&quot;d3-voronoi&quot;:333,&quot;d3-zoom&quot;:334}],336:[function(t,e,n){n.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1&lt;&lt;s)-1,l=u&gt;&gt;1,c=-7,f=n?i-1:0,p=n?-1:1,h=t[e+f];for(f+=p,o=h&amp;(1&lt;&lt;-c)-1,h&gt;&gt;=-c,c+=s;c&gt;0;o=256*o+t[e+f],f+=p,c-=8);for(a=o&amp;(1&lt;&lt;-c)-1,o&gt;&gt;=-c,c+=r;c&gt;0;a=256*a+t[e+f],f+=p,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=l}return(h?-1:1)*a*Math.pow(2,o-r)},n.write=function(t,e,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1&lt;&lt;l)-1,f=c&gt;&gt;1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,d=r?1:-1,m=e&lt;0||0===e&amp;&amp;1/e&lt;0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))&lt;1&amp;&amp;(a--,u*=2),(e+=a+f&gt;=1?p/u:p*Math.pow(2,1-f))*u&gt;=2&amp;&amp;(a++,u/=2),a+f&gt;=c?(s=0,a=c):a+f&gt;=1?(s=(e*u-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i&gt;=8;t[n+h]=255&amp;s,h+=d,s/=256,i-=8);for(a=a&lt;&lt;i|s,l+=i;l&gt;0;t[n+h]=255&amp;a,h+=d,a/=256,l-=8);t[n+h-d]|=128*m}},{}],337:[function(t,e,n){(function(t){(function(){var r,i=200,o=&quot;Unsupported core-js use. Try https://npms.io/search?q=ponyfill.&quot;,a=&quot;Expected a function&quot;,s=&quot;__lodash_hash_undefined__&quot;,u=500,l=&quot;__lodash_placeholder__&quot;,c=1,f=2,p=4,h=1,d=2,m=1,g=2,v=4,y=8,b=16,_=32,w=64,x=128,E=256,k=512,T=30,N=&quot;...&quot;,S=800,C=16,A=1,I=2,O=1/0,M=9007199254740991,R=1.7976931348623157e308,P=NaN,D=4294967295,z=D-1,L=D&gt;&gt;&gt;1,F=[[&quot;ary&quot;,x],[&quot;bind&quot;,m],[&quot;bindKey&quot;,g],[&quot;curry&quot;,y],[&quot;curryRight&quot;,b],[&quot;flip&quot;,k],[&quot;partial&quot;,_],[&quot;partialRight&quot;,w],[&quot;rearg&quot;,E]],V=&quot;[object Arguments]&quot;,B=&quot;[object Array]&quot;,j=&quot;[object AsyncFunction]&quot;,q=&quot;[object Boolean]&quot;,U=&quot;[object Date]&quot;,G=&quot;[object DOMException]&quot;,W=&quot;[object Error]&quot;,H=&quot;[object Function]&quot;,$=&quot;[object GeneratorFunction]&quot;,K=&quot;[object Map]&quot;,Y=&quot;[object Number]&quot;,X=&quot;[object Null]&quot;,Z=&quot;[object Object]&quot;,Q=&quot;[object Proxy]&quot;,J=&quot;[object RegExp]&quot;,tt=&quot;[object Set]&quot;,et=&quot;[object String]&quot;,nt=&quot;[object Symbol]&quot;,rt=&quot;[object Undefined]&quot;,it=&quot;[object WeakMap]&quot;,ot=&quot;[object WeakSet]&quot;,at=&quot;[object ArrayBuffer]&quot;,st=&quot;[object DataView]&quot;,ut=&quot;[object Float32Array]&quot;,lt=&quot;[object Float64Array]&quot;,ct=&quot;[object Int8Array]&quot;,ft=&quot;[object Int16Array]&quot;,pt=&quot;[object Int32Array]&quot;,ht=&quot;[object Uint8Array]&quot;,dt=&quot;[object Uint8ClampedArray]&quot;,mt=&quot;[object Uint16Array]&quot;,gt=&quot;[object Uint32Array]&quot;,vt=/\b__p \+= &apos;&apos;;/g,yt=/\b(__p \+=) &apos;&apos; \+/g,bt=/(__e\(.*?\)|\b__t\)) \+\n&apos;&apos;;/g,_t=/&amp;(?:amp|lt|gt|quot|#39);/g,wt=/[&amp;&lt;&gt;&quot;&apos;]/g,xt=RegExp(_t.source),Et=RegExp(wt.source),kt=/&lt;%-([\s\S]+?)%&gt;/g,Tt=/&lt;%([\s\S]+?)%&gt;/g,Nt=/&lt;%=([\s\S]+?)%&gt;/g,St=/\.|\[(?:[^[\]]*|([&quot;&apos;])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ct=/^\w*$/,At=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|([&quot;&apos;])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,It=/[\\^$.*+?()[\]{}|]/g,Ot=RegExp(It.source),Mt=/^\s+|\s+$/g,Rt=/^\s+/,Pt=/\s+$/,Dt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,zt=/\{\n\/\* \[wrapped with (.+)\] \*/,Lt=/,? &amp; /,Ft=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Vt=/\\(\\)?/g,Bt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,jt=/\w*$/,qt=/^[-+]0x[0-9a-f]+$/i,Ut=/^0b[01]+$/i,Gt=/^\[object .+?Constructor\]$/,Wt=/^0o[0-7]+$/i,Ht=/^(?:0|[1-9]\d*)$/,$t=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Yt=/[&apos;\n\r\u2028\u2029\\]/g,Xt=&quot;\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff&quot;,Zt=&quot;\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000&quot;,Qt=&quot;[\\ud800-\\udfff]&quot;,Jt=&quot;[&quot;+Zt+&quot;]&quot;,te=&quot;[&quot;+Xt+&quot;]&quot;,ee=&quot;\\d+&quot;,ne=&quot;[\\u2700-\\u27bf]&quot;,re=&quot;[a-z\\xdf-\\xf6\\xf8-\\xff]&quot;,ie=&quot;[^\\ud800-\\udfff&quot;+Zt+ee+&quot;\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]&quot;,oe=&quot;\\ud83c[\\udffb-\\udfff]&quot;,ae=&quot;[^\\ud800-\\udfff]&quot;,se=&quot;(?:\\ud83c[\\udde6-\\uddff]){2}&quot;,ue=&quot;[\\ud800-\\udbff][\\udc00-\\udfff]&quot;,le=&quot;[A-Z\\xc0-\\xd6\\xd8-\\xde]&quot;,ce=&quot;(?:&quot;+re+&quot;|&quot;+ie+&quot;)&quot;,fe=&quot;(?:&quot;+le+&quot;|&quot;+ie+&quot;)&quot;,pe=&quot;(?:&quot;+te+&quot;|&quot;+oe+&quot;)&quot;+&quot;?&quot;,he=&quot;[\\ufe0e\\ufe0f]?&quot;+pe+(&quot;(?:\\u200d(?:&quot;+[ae,se,ue].join(&quot;|&quot;)+&quot;)[\\ufe0e\\ufe0f]?&quot;+pe+&quot;)*&quot;),de=&quot;(?:&quot;+[ne,se,ue].join(&quot;|&quot;)+&quot;)&quot;+he,me=&quot;(?:&quot;+[ae+te+&quot;?&quot;,te,se,ue,Qt].join(&quot;|&quot;)+&quot;)&quot;,ge=RegExp(&quot;[&apos;’]&quot;,&quot;g&quot;),ve=RegExp(te,&quot;g&quot;),ye=RegExp(oe+&quot;(?=&quot;+oe+&quot;)|&quot;+me+he,&quot;g&quot;),be=RegExp([le+&quot;?&quot;+re+&quot;+(?:[&apos;’](?:d|ll|m|re|s|t|ve))?(?=&quot;+[Jt,le,&quot;$&quot;].join(&quot;|&quot;)+&quot;)&quot;,fe+&quot;+(?:[&apos;’](?:D|LL|M|RE|S|T|VE))?(?=&quot;+[Jt,le+ce,&quot;$&quot;].join(&quot;|&quot;)+&quot;)&quot;,le+&quot;?&quot;+ce+&quot;+(?:[&apos;’](?:d|ll|m|re|s|t|ve))?&quot;,le+&quot;+(?:[&apos;’](?:D|LL|M|RE|S|T|VE))?&quot;,&quot;\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])&quot;,&quot;\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])&quot;,ee,de].join(&quot;|&quot;),&quot;g&quot;),_e=RegExp(&quot;[\\u200d\\ud800-\\udfff&quot;+Xt+&quot;\\ufe0e\\ufe0f]&quot;),we=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xe=[&quot;Array&quot;,&quot;Buffer&quot;,&quot;DataView&quot;,&quot;Date&quot;,&quot;Error&quot;,&quot;Float32Array&quot;,&quot;Float64Array&quot;,&quot;Function&quot;,&quot;Int8Array&quot;,&quot;Int16Array&quot;,&quot;Int32Array&quot;,&quot;Map&quot;,&quot;Math&quot;,&quot;Object&quot;,&quot;Promise&quot;,&quot;RegExp&quot;,&quot;Set&quot;,&quot;String&quot;,&quot;Symbol&quot;,&quot;TypeError&quot;,&quot;Uint8Array&quot;,&quot;Uint8ClampedArray&quot;,&quot;Uint16Array&quot;,&quot;Uint32Array&quot;,&quot;WeakMap&quot;,&quot;_&quot;,&quot;clearTimeout&quot;,&quot;isFinite&quot;,&quot;parseInt&quot;,&quot;setTimeout&quot;],Ee=-1,ke={};ke[ut]=ke[lt]=ke[ct]=ke[ft]=ke[pt]=ke[ht]=ke[dt]=ke[mt]=ke[gt]=!0,ke[V]=ke[B]=ke[at]=ke[q]=ke[st]=ke[U]=ke[W]=ke[H]=ke[K]=ke[Y]=ke[Z]=ke[J]=ke[tt]=ke[et]=ke[it]=!1;var Te={};Te[V]=Te[B]=Te[at]=Te[st]=Te[q]=Te[U]=Te[ut]=Te[lt]=Te[ct]=Te[ft]=Te[pt]=Te[K]=Te[Y]=Te[Z]=Te[J]=Te[tt]=Te[et]=Te[nt]=Te[ht]=Te[dt]=Te[mt]=Te[gt]=!0,Te[W]=Te[H]=Te[it]=!1;var Ne={&quot;\\&quot;:&quot;\\&quot;,&quot;&apos;&quot;:&quot;&apos;&quot;,&quot;\n&quot;:&quot;n&quot;,&quot;\r&quot;:&quot;r&quot;,&quot;\u2028&quot;:&quot;u2028&quot;,&quot;\u2029&quot;:&quot;u2029&quot;},Se=parseFloat,Ce=parseInt,Ae=&quot;object&quot;==typeof t&amp;&amp;t&amp;&amp;t.Object===Object&amp;&amp;t,Ie=&quot;object&quot;==typeof self&amp;&amp;self&amp;&amp;self.Object===Object&amp;&amp;self,Oe=Ae||Ie||Function(&quot;return this&quot;)(),Me=&quot;object&quot;==typeof n&amp;&amp;n&amp;&amp;!n.nodeType&amp;&amp;n,Re=Me&amp;&amp;&quot;object&quot;==typeof e&amp;&amp;e&amp;&amp;!e.nodeType&amp;&amp;e,Pe=Re&amp;&amp;Re.exports===Me,De=Pe&amp;&amp;Ae.process,ze=function(){try{var t=Re&amp;&amp;Re.require&amp;&amp;Re.require(&quot;util&quot;).types;return t||De&amp;&amp;De.binding&amp;&amp;De.binding(&quot;util&quot;)}catch(t){}}(),Le=ze&amp;&amp;ze.isArrayBuffer,Fe=ze&amp;&amp;ze.isDate,Ve=ze&amp;&amp;ze.isMap,Be=ze&amp;&amp;ze.isRegExp,je=ze&amp;&amp;ze.isSet,qe=ze&amp;&amp;ze.isTypedArray;function Ue(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ge(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i&lt;o;){var a=t[i];e(r,a,n(a),t)}return r}function We(t,e){for(var n=-1,r=null==t?0:t.length;++n&lt;r&amp;&amp;!1!==e(t[n],n,t););return t}function He(t,e){for(var n=null==t?0:t.length;n--&amp;&amp;!1!==e(t[n],n,t););return t}function $e(t,e){for(var n=-1,r=null==t?0:t.length;++n&lt;r;)if(!e(t[n],n,t))return!1;return!0}function Ke(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n&lt;r;){var a=t[n];e(a,n,t)&amp;&amp;(o[i++]=a)}return o}function Ye(t,e){return!!(null==t?0:t.length)&amp;&amp;an(t,e,0)&gt;-1}function Xe(t,e,n){for(var r=-1,i=null==t?0:t.length;++r&lt;i;)if(n(e,t[r]))return!0;return!1}function Ze(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n&lt;r;)i[n]=e(t[n],n,t);return i}function Qe(t,e){for(var n=-1,r=e.length,i=t.length;++n&lt;r;)t[i+n]=e[n];return t}function Je(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&amp;&amp;o&amp;&amp;(n=t[++i]);++i&lt;o;)n=e(n,t[i],i,t);return n}function tn(t,e,n,r){var i=null==t?0:t.length;for(r&amp;&amp;i&amp;&amp;(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function en(t,e){for(var n=-1,r=null==t?0:t.length;++n&lt;r;)if(e(t[n],n,t))return!0;return!1}var nn=cn(&quot;length&quot;);function rn(t,e,n){var r;return n(t,function(t,n,i){if(e(t,n,i))return r=n,!1}),r}function on(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o&lt;i;)if(e(t[o],o,t))return o;return-1}function an(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r&lt;i;)if(t[r]===e)return r;return-1}(t,e,n):on(t,un,n)}function sn(t,e,n,r){for(var i=n-1,o=t.length;++i&lt;o;)if(r(t[i],e))return i;return-1}function un(t){return t!=t}function ln(t,e){var n=null==t?0:t.length;return n?hn(t,e)/n:P}function cn(t){return function(e){return null==e?r:e[t]}}function fn(t){return function(e){return null==t?r:t[e]}}function pn(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}function hn(t,e){for(var n,i=-1,o=t.length;++i&lt;o;){var a=e(t[i]);a!==r&amp;&amp;(n=n===r?a:n+a)}return n}function dn(t,e){for(var n=-1,r=Array(t);++n&lt;t;)r[n]=e(n);return r}function mn(t){return function(e){return t(e)}}function gn(t,e){return Ze(e,function(e){return t[e]})}function vn(t,e){return t.has(e)}function yn(t,e){for(var n=-1,r=t.length;++n&lt;r&amp;&amp;an(e,t[n],0)&gt;-1;);return n}function bn(t,e){for(var n=t.length;n--&amp;&amp;an(e,t[n],0)&gt;-1;);return n}var _n=fn({&quot;À&quot;:&quot;A&quot;,&quot;Á&quot;:&quot;A&quot;,&quot;Â&quot;:&quot;A&quot;,&quot;Ã&quot;:&quot;A&quot;,&quot;Ä&quot;:&quot;A&quot;,&quot;Å&quot;:&quot;A&quot;,&quot;à&quot;:&quot;a&quot;,&quot;á&quot;:&quot;a&quot;,&quot;â&quot;:&quot;a&quot;,&quot;ã&quot;:&quot;a&quot;,&quot;ä&quot;:&quot;a&quot;,&quot;å&quot;:&quot;a&quot;,&quot;Ç&quot;:&quot;C&quot;,&quot;ç&quot;:&quot;c&quot;,&quot;Ð&quot;:&quot;D&quot;,&quot;ð&quot;:&quot;d&quot;,&quot;È&quot;:&quot;E&quot;,&quot;É&quot;:&quot;E&quot;,&quot;Ê&quot;:&quot;E&quot;,&quot;Ë&quot;:&quot;E&quot;,&quot;è&quot;:&quot;e&quot;,&quot;é&quot;:&quot;e&quot;,&quot;ê&quot;:&quot;e&quot;,&quot;ë&quot;:&quot;e&quot;,&quot;Ì&quot;:&quot;I&quot;,&quot;Í&quot;:&quot;I&quot;,&quot;Î&quot;:&quot;I&quot;,&quot;Ï&quot;:&quot;I&quot;,&quot;ì&quot;:&quot;i&quot;,&quot;í&quot;:&quot;i&quot;,&quot;î&quot;:&quot;i&quot;,&quot;ï&quot;:&quot;i&quot;,&quot;Ñ&quot;:&quot;N&quot;,&quot;ñ&quot;:&quot;n&quot;,&quot;Ò&quot;:&quot;O&quot;,&quot;Ó&quot;:&quot;O&quot;,&quot;Ô&quot;:&quot;O&quot;,&quot;Õ&quot;:&quot;O&quot;,&quot;Ö&quot;:&quot;O&quot;,&quot;Ø&quot;:&quot;O&quot;,&quot;ò&quot;:&quot;o&quot;,&quot;ó&quot;:&quot;o&quot;,&quot;ô&quot;:&quot;o&quot;,&quot;õ&quot;:&quot;o&quot;,&quot;ö&quot;:&quot;o&quot;,&quot;ø&quot;:&quot;o&quot;,&quot;Ù&quot;:&quot;U&quot;,&quot;Ú&quot;:&quot;U&quot;,&quot;Û&quot;:&quot;U&quot;,&quot;Ü&quot;:&quot;U&quot;,&quot;ù&quot;:&quot;u&quot;,&quot;ú&quot;:&quot;u&quot;,&quot;û&quot;:&quot;u&quot;,&quot;ü&quot;:&quot;u&quot;,&quot;Ý&quot;:&quot;Y&quot;,&quot;ý&quot;:&quot;y&quot;,&quot;ÿ&quot;:&quot;y&quot;,&quot;Æ&quot;:&quot;Ae&quot;,&quot;æ&quot;:&quot;ae&quot;,&quot;Þ&quot;:&quot;Th&quot;,&quot;þ&quot;:&quot;th&quot;,&quot;ß&quot;:&quot;ss&quot;,&quot;Ā&quot;:&quot;A&quot;,&quot;Ă&quot;:&quot;A&quot;,&quot;Ą&quot;:&quot;A&quot;,&quot;ā&quot;:&quot;a&quot;,&quot;ă&quot;:&quot;a&quot;,&quot;ą&quot;:&quot;a&quot;,&quot;Ć&quot;:&quot;C&quot;,&quot;Ĉ&quot;:&quot;C&quot;,&quot;Ċ&quot;:&quot;C&quot;,&quot;Č&quot;:&quot;C&quot;,&quot;ć&quot;:&quot;c&quot;,&quot;ĉ&quot;:&quot;c&quot;,&quot;ċ&quot;:&quot;c&quot;,&quot;č&quot;:&quot;c&quot;,&quot;Ď&quot;:&quot;D&quot;,&quot;Đ&quot;:&quot;D&quot;,&quot;ď&quot;:&quot;d&quot;,&quot;đ&quot;:&quot;d&quot;,&quot;Ē&quot;:&quot;E&quot;,&quot;Ĕ&quot;:&quot;E&quot;,&quot;Ė&quot;:&quot;E&quot;,&quot;Ę&quot;:&quot;E&quot;,&quot;Ě&quot;:&quot;E&quot;,&quot;ē&quot;:&quot;e&quot;,&quot;ĕ&quot;:&quot;e&quot;,&quot;ė&quot;:&quot;e&quot;,&quot;ę&quot;:&quot;e&quot;,&quot;ě&quot;:&quot;e&quot;,&quot;Ĝ&quot;:&quot;G&quot;,&quot;Ğ&quot;:&quot;G&quot;,&quot;Ġ&quot;:&quot;G&quot;,&quot;Ģ&quot;:&quot;G&quot;,&quot;ĝ&quot;:&quot;g&quot;,&quot;ğ&quot;:&quot;g&quot;,&quot;ġ&quot;:&quot;g&quot;,&quot;ģ&quot;:&quot;g&quot;,&quot;Ĥ&quot;:&quot;H&quot;,&quot;Ħ&quot;:&quot;H&quot;,&quot;ĥ&quot;:&quot;h&quot;,&quot;ħ&quot;:&quot;h&quot;,&quot;Ĩ&quot;:&quot;I&quot;,&quot;Ī&quot;:&quot;I&quot;,&quot;Ĭ&quot;:&quot;I&quot;,&quot;Į&quot;:&quot;I&quot;,&quot;İ&quot;:&quot;I&quot;,&quot;ĩ&quot;:&quot;i&quot;,&quot;ī&quot;:&quot;i&quot;,&quot;ĭ&quot;:&quot;i&quot;,&quot;į&quot;:&quot;i&quot;,&quot;ı&quot;:&quot;i&quot;,&quot;Ĵ&quot;:&quot;J&quot;,&quot;ĵ&quot;:&quot;j&quot;,&quot;Ķ&quot;:&quot;K&quot;,&quot;ķ&quot;:&quot;k&quot;,&quot;ĸ&quot;:&quot;k&quot;,&quot;Ĺ&quot;:&quot;L&quot;,&quot;Ļ&quot;:&quot;L&quot;,&quot;Ľ&quot;:&quot;L&quot;,&quot;Ŀ&quot;:&quot;L&quot;,&quot;Ł&quot;:&quot;L&quot;,&quot;ĺ&quot;:&quot;l&quot;,&quot;ļ&quot;:&quot;l&quot;,&quot;ľ&quot;:&quot;l&quot;,&quot;ŀ&quot;:&quot;l&quot;,&quot;ł&quot;:&quot;l&quot;,&quot;Ń&quot;:&quot;N&quot;,&quot;Ņ&quot;:&quot;N&quot;,&quot;Ň&quot;:&quot;N&quot;,&quot;Ŋ&quot;:&quot;N&quot;,&quot;ń&quot;:&quot;n&quot;,&quot;ņ&quot;:&quot;n&quot;,&quot;ň&quot;:&quot;n&quot;,&quot;ŋ&quot;:&quot;n&quot;,&quot;Ō&quot;:&quot;O&quot;,&quot;Ŏ&quot;:&quot;O&quot;,&quot;Ő&quot;:&quot;O&quot;,&quot;ō&quot;:&quot;o&quot;,&quot;ŏ&quot;:&quot;o&quot;,&quot;ő&quot;:&quot;o&quot;,&quot;Ŕ&quot;:&quot;R&quot;,&quot;Ŗ&quot;:&quot;R&quot;,&quot;Ř&quot;:&quot;R&quot;,&quot;ŕ&quot;:&quot;r&quot;,&quot;ŗ&quot;:&quot;r&quot;,&quot;ř&quot;:&quot;r&quot;,&quot;Ś&quot;:&quot;S&quot;,&quot;Ŝ&quot;:&quot;S&quot;,&quot;Ş&quot;:&quot;S&quot;,&quot;Š&quot;:&quot;S&quot;,&quot;ś&quot;:&quot;s&quot;,&quot;ŝ&quot;:&quot;s&quot;,&quot;ş&quot;:&quot;s&quot;,&quot;š&quot;:&quot;s&quot;,&quot;Ţ&quot;:&quot;T&quot;,&quot;Ť&quot;:&quot;T&quot;,&quot;Ŧ&quot;:&quot;T&quot;,&quot;ţ&quot;:&quot;t&quot;,&quot;ť&quot;:&quot;t&quot;,&quot;ŧ&quot;:&quot;t&quot;,&quot;Ũ&quot;:&quot;U&quot;,&quot;Ū&quot;:&quot;U&quot;,&quot;Ŭ&quot;:&quot;U&quot;,&quot;Ů&quot;:&quot;U&quot;,&quot;Ű&quot;:&quot;U&quot;,&quot;Ų&quot;:&quot;U&quot;,&quot;ũ&quot;:&quot;u&quot;,&quot;ū&quot;:&quot;u&quot;,&quot;ŭ&quot;:&quot;u&quot;,&quot;ů&quot;:&quot;u&quot;,&quot;ű&quot;:&quot;u&quot;,&quot;ų&quot;:&quot;u&quot;,&quot;Ŵ&quot;:&quot;W&quot;,&quot;ŵ&quot;:&quot;w&quot;,&quot;Ŷ&quot;:&quot;Y&quot;,&quot;ŷ&quot;:&quot;y&quot;,&quot;Ÿ&quot;:&quot;Y&quot;,&quot;Ź&quot;:&quot;Z&quot;,&quot;Ż&quot;:&quot;Z&quot;,&quot;Ž&quot;:&quot;Z&quot;,&quot;ź&quot;:&quot;z&quot;,&quot;ż&quot;:&quot;z&quot;,&quot;ž&quot;:&quot;z&quot;,&quot;Ĳ&quot;:&quot;IJ&quot;,&quot;ĳ&quot;:&quot;ij&quot;,&quot;Œ&quot;:&quot;Oe&quot;,&quot;œ&quot;:&quot;oe&quot;,&quot;ŉ&quot;:&quot;&apos;n&quot;,&quot;ſ&quot;:&quot;s&quot;}),wn=fn({&quot;&amp;&quot;:&quot;&amp;amp;&quot;,&quot;&lt;&quot;:&quot;&amp;lt;&quot;,&quot;&gt;&quot;:&quot;&amp;gt;&quot;,&apos;&quot;&apos;:&quot;&amp;quot;&quot;,&quot;&apos;&quot;:&quot;&amp;#39;&quot;});function xn(t){return&quot;\\&quot;+Ne[t]}function En(t){return _e.test(t)}function kn(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function Tn(t,e){return function(n){return t(e(n))}}function Nn(t,e){for(var n=-1,r=t.length,i=0,o=[];++n&lt;r;){var a=t[n];a!==e&amp;&amp;a!==l||(t[n]=l,o[i++]=n)}return o}function Sn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function Cn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}function An(t){return En(t)?function(t){var e=ye.lastIndex=0;for(;ye.test(t);)++e;return e}(t):nn(t)}function In(t){return En(t)?function(t){return t.match(ye)||[]}(t):function(t){return t.split(&quot;&quot;)}(t)}var On=fn({&quot;&amp;amp;&quot;:&quot;&amp;&quot;,&quot;&amp;lt;&quot;:&quot;&lt;&quot;,&quot;&amp;gt;&quot;:&quot;&gt;&quot;,&quot;&amp;quot;&quot;:&apos;&quot;&apos;,&quot;&amp;#39;&quot;:&quot;&apos;&quot;});var Mn=function t(e){var n,Xt=(e=null==e?Oe:Mn.defaults(Oe.Object(),e,Mn.pick(Oe,xe))).Array,Zt=e.Date,Qt=e.Error,Jt=e.Function,te=e.Math,ee=e.Object,ne=e.RegExp,re=e.String,ie=e.TypeError,oe=Xt.prototype,ae=Jt.prototype,se=ee.prototype,ue=e[&quot;__core-js_shared__&quot;],le=ae.toString,ce=se.hasOwnProperty,fe=0,pe=(n=/[^.]+$/.exec(ue&amp;&amp;ue.keys&amp;&amp;ue.keys.IE_PROTO||&quot;&quot;))?&quot;Symbol(src)_1.&quot;+n:&quot;&quot;,he=se.toString,de=le.call(ee),me=Oe._,ye=ne(&quot;^&quot;+le.call(ce).replace(It,&quot;\\$&amp;&quot;).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,&quot;$1.*?&quot;)+&quot;$&quot;),_e=Pe?e.Buffer:r,Ne=e.Symbol,Ae=e.Uint8Array,Ie=_e?_e.allocUnsafe:r,Me=Tn(ee.getPrototypeOf,ee),Re=ee.create,De=se.propertyIsEnumerable,ze=oe.splice,nn=Ne?Ne.isConcatSpreadable:r,fn=Ne?Ne.iterator:r,Rn=Ne?Ne.toStringTag:r,Pn=function(){try{var t=Vo(ee,&quot;defineProperty&quot;);return t({},&quot;&quot;,{}),t}catch(t){}}(),Dn=e.clearTimeout!==Oe.clearTimeout&amp;&amp;e.clearTimeout,zn=Zt&amp;&amp;Zt.now!==Oe.Date.now&amp;&amp;Zt.now,Ln=e.setTimeout!==Oe.setTimeout&amp;&amp;e.setTimeout,Fn=te.ceil,Vn=te.floor,Bn=ee.getOwnPropertySymbols,jn=_e?_e.isBuffer:r,qn=e.isFinite,Un=oe.join,Gn=Tn(ee.keys,ee),Wn=te.max,Hn=te.min,$n=Zt.now,Kn=e.parseInt,Yn=te.random,Xn=oe.reverse,Zn=Vo(e,&quot;DataView&quot;),Qn=Vo(e,&quot;Map&quot;),Jn=Vo(e,&quot;Promise&quot;),tr=Vo(e,&quot;Set&quot;),er=Vo(e,&quot;WeakMap&quot;),nr=Vo(ee,&quot;create&quot;),rr=er&amp;&amp;new er,ir={},or=fa(Zn),ar=fa(Qn),sr=fa(Jn),ur=fa(tr),lr=fa(er),cr=Ne?Ne.prototype:r,fr=cr?cr.valueOf:r,pr=cr?cr.toString:r;function hr(t){if(Cs(t)&amp;&amp;!vs(t)&amp;&amp;!(t instanceof vr)){if(t instanceof gr)return t;if(ce.call(t,&quot;__wrapped__&quot;))return pa(t)}return new gr(t)}var dr=function(){function t(){}return function(e){if(!Ss(e))return{};if(Re)return Re(e);t.prototype=e;var n=new t;return t.prototype=r,n}}();function mr(){}function gr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=r}function vr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=D,this.__views__=[]}function yr(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e&lt;n;){var r=t[e];this.set(r[0],r[1])}}function br(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e&lt;n;){var r=t[e];this.set(r[0],r[1])}}function _r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e&lt;n;){var r=t[e];this.set(r[0],r[1])}}function wr(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new _r;++e&lt;n;)this.add(t[e])}function xr(t){var e=this.__data__=new br(t);this.size=e.size}function Er(t,e){var n=vs(t),r=!n&amp;&amp;gs(t),i=!n&amp;&amp;!r&amp;&amp;ws(t),o=!n&amp;&amp;!r&amp;&amp;!i&amp;&amp;zs(t),a=n||r||i||o,s=a?dn(t.length,re):[],u=s.length;for(var l in t)!e&amp;&amp;!ce.call(t,l)||a&amp;&amp;(&quot;length&quot;==l||i&amp;&amp;(&quot;offset&quot;==l||&quot;parent&quot;==l)||o&amp;&amp;(&quot;buffer&quot;==l||&quot;byteLength&quot;==l||&quot;byteOffset&quot;==l)||Ho(l,u))||s.push(l);return s}function kr(t){var e=t.length;return e?t[wi(0,e-1)]:r}function Tr(t,e){return ua(no(t),Pr(e,0,t.length))}function Nr(t){return ua(no(t))}function Sr(t,e,n){(n===r||hs(t[e],n))&amp;&amp;(n!==r||e in t)||Mr(t,e,n)}function Cr(t,e,n){var i=t[e];ce.call(t,e)&amp;&amp;hs(i,n)&amp;&amp;(n!==r||e in t)||Mr(t,e,n)}function Ar(t,e){for(var n=t.length;n--;)if(hs(t[n][0],e))return n;return-1}function Ir(t,e,n,r){return Vr(t,function(t,i,o){e(r,t,n(t),o)}),r}function Or(t,e){return t&amp;&amp;ro(e,iu(e),t)}function Mr(t,e,n){&quot;__proto__&quot;==e&amp;&amp;Pn?Pn(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Rr(t,e){for(var n=-1,i=e.length,o=Xt(i),a=null==t;++n&lt;i;)o[n]=a?r:Js(t,e[n]);return o}function Pr(t,e,n){return t==t&amp;&amp;(n!==r&amp;&amp;(t=t&lt;=n?t:n),e!==r&amp;&amp;(t=t&gt;=e?t:e)),t}function Dr(t,e,n,i,o,a){var s,u=e&amp;c,l=e&amp;f,h=e&amp;p;if(n&amp;&amp;(s=o?n(t,i,o,a):n(t)),s!==r)return s;if(!Ss(t))return t;var d=vs(t);if(d){if(s=function(t){var e=t.length,n=new t.constructor(e);return e&amp;&amp;&quot;string&quot;==typeof t[0]&amp;&amp;ce.call(t,&quot;index&quot;)&amp;&amp;(n.index=t.index,n.input=t.input),n}(t),!u)return no(t,s)}else{var m=qo(t),g=m==H||m==$;if(ws(t))return Xi(t,u);if(m==Z||m==V||g&amp;&amp;!o){if(s=l||g?{}:Go(t),!u)return l?function(t,e){return ro(t,jo(t),e)}(t,function(t,e){return t&amp;&amp;ro(e,ou(e),t)}(s,t)):function(t,e){return ro(t,Bo(t),e)}(t,Or(s,t))}else{if(!Te[m])return o?t:{};s=function(t,e,n){var r,i,o,a=t.constructor;switch(e){case at:return Zi(t);case q:case U:return new a(+t);case st:return function(t,e){var n=e?Zi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case ut:case lt:case ct:case ft:case pt:case ht:case dt:case mt:case gt:return Qi(t,n);case K:return new a;case Y:case et:return new a(t);case J:return(o=new(i=t).constructor(i.source,jt.exec(i))).lastIndex=i.lastIndex,o;case tt:return new a;case nt:return r=t,fr?ee(fr.call(r)):{}}}(t,m,u)}}a||(a=new xr);var v=a.get(t);if(v)return v;if(a.set(t,s),Rs(t))return t.forEach(function(r){s.add(Dr(r,e,n,r,t,a))}),s;if(As(t))return t.forEach(function(r,i){s.set(i,Dr(r,e,n,i,t,a))}),s;var y=d?r:(h?l?Mo:Oo:l?ou:iu)(t);return We(y||t,function(r,i){y&amp;&amp;(r=t[i=r]),Cr(s,i,Dr(r,e,n,i,t,a))}),s}function zr(t,e,n){var i=n.length;if(null==t)return!i;for(t=ee(t);i--;){var o=n[i],a=e[o],s=t[o];if(s===r&amp;&amp;!(o in t)||!a(s))return!1}return!0}function Lr(t,e,n){if(&quot;function&quot;!=typeof t)throw new ie(a);return ia(function(){t.apply(r,n)},e)}function Fr(t,e,n,r){var o=-1,a=Ye,s=!0,u=t.length,l=[],c=e.length;if(!u)return l;n&amp;&amp;(e=Ze(e,mn(n))),r?(a=Xe,s=!1):e.length&gt;=i&amp;&amp;(a=vn,s=!1,e=new wr(e));t:for(;++o&lt;u;){var f=t[o],p=null==n?f:n(f);if(f=r||0!==f?f:0,s&amp;&amp;p==p){for(var h=c;h--;)if(e[h]===p)continue t;l.push(f)}else a(e,p,r)||l.push(f)}return l}hr.templateSettings={escape:kt,evaluate:Tt,interpolate:Nt,variable:&quot;&quot;,imports:{_:hr}},hr.prototype=mr.prototype,hr.prototype.constructor=hr,gr.prototype=dr(mr.prototype),gr.prototype.constructor=gr,vr.prototype=dr(mr.prototype),vr.prototype.constructor=vr,yr.prototype.clear=function(){this.__data__=nr?nr(null):{},this.size=0},yr.prototype.delete=function(t){var e=this.has(t)&amp;&amp;delete this.__data__[t];return this.size-=e?1:0,e},yr.prototype.get=function(t){var e=this.__data__;if(nr){var n=e[t];return n===s?r:n}return ce.call(e,t)?e[t]:r},yr.prototype.has=function(t){var e=this.__data__;return nr?e[t]!==r:ce.call(e,t)},yr.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=nr&amp;&amp;e===r?s:e,this},br.prototype.clear=function(){this.__data__=[],this.size=0},br.prototype.delete=function(t){var e=this.__data__,n=Ar(e,t);return!(n&lt;0||(n==e.length-1?e.pop():ze.call(e,n,1),--this.size,0))},br.prototype.get=function(t){var e=this.__data__,n=Ar(e,t);return n&lt;0?r:e[n][1]},br.prototype.has=function(t){return Ar(this.__data__,t)&gt;-1},br.prototype.set=function(t,e){var n=this.__data__,r=Ar(n,t);return r&lt;0?(++this.size,n.push([t,e])):n[r][1]=e,this},_r.prototype.clear=function(){this.size=0,this.__data__={hash:new yr,map:new(Qn||br),string:new yr}},_r.prototype.delete=function(t){var e=Lo(this,t).delete(t);return this.size-=e?1:0,e},_r.prototype.get=function(t){return Lo(this,t).get(t)},_r.prototype.has=function(t){return Lo(this,t).has(t)},_r.prototype.set=function(t,e){var n=Lo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},wr.prototype.add=wr.prototype.push=function(t){return this.__data__.set(t,s),this},wr.prototype.has=function(t){return this.__data__.has(t)},xr.prototype.clear=function(){this.__data__=new br,this.size=0},xr.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},xr.prototype.get=function(t){return this.__data__.get(t)},xr.prototype.has=function(t){return this.__data__.has(t)},xr.prototype.set=function(t,e){var n=this.__data__;if(n instanceof br){var r=n.__data__;if(!Qn||r.length&lt;i-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new _r(r)}return n.set(t,e),this.size=n.size,this};var Vr=ao($r),Br=ao(Kr,!0);function jr(t,e){var n=!0;return Vr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function qr(t,e,n){for(var i=-1,o=t.length;++i&lt;o;){var a=t[i],s=e(a);if(null!=s&amp;&amp;(u===r?s==s&amp;&amp;!Ds(s):n(s,u)))var u=s,l=a}return l}function Ur(t,e){var n=[];return Vr(t,function(t,r,i){e(t,r,i)&amp;&amp;n.push(t)}),n}function Gr(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=Wo),i||(i=[]);++o&lt;a;){var s=t[o];e&gt;0&amp;&amp;n(s)?e&gt;1?Gr(s,e-1,n,r,i):Qe(i,s):r||(i[i.length]=s)}return i}var Wr=so(),Hr=so(!0);function $r(t,e){return t&amp;&amp;Wr(t,e,iu)}function Kr(t,e){return t&amp;&amp;Hr(t,e,iu)}function Yr(t,e){return Ke(e,function(e){return ks(t[e])})}function Xr(t,e){for(var n=0,i=(e=Hi(e,t)).length;null!=t&amp;&amp;n&lt;i;)t=t[ca(e[n++])];return n&amp;&amp;n==i?t:r}function Zr(t,e,n){var r=e(t);return vs(t)?r:Qe(r,n(t))}function Qr(t){return null==t?t===r?rt:X:Rn&amp;&amp;Rn in ee(t)?function(t){var e=ce.call(t,Rn),n=t[Rn];try{t[Rn]=r;var i=!0}catch(t){}var o=he.call(t);return i&amp;&amp;(e?t[Rn]=n:delete t[Rn]),o}(t):function(t){return he.call(t)}(t)}function Jr(t,e){return t&gt;e}function ti(t,e){return null!=t&amp;&amp;ce.call(t,e)}function ei(t,e){return null!=t&amp;&amp;e in ee(t)}function ni(t,e,n){for(var i=n?Xe:Ye,o=t[0].length,a=t.length,s=a,u=Xt(a),l=1/0,c=[];s--;){var f=t[s];s&amp;&amp;e&amp;&amp;(f=Ze(f,mn(e))),l=Hn(f.length,l),u[s]=!n&amp;&amp;(e||o&gt;=120&amp;&amp;f.length&gt;=120)?new wr(s&amp;&amp;f):r}f=t[0];var p=-1,h=u[0];t:for(;++p&lt;o&amp;&amp;c.length&lt;l;){var d=f[p],m=e?e(d):d;if(d=n||0!==d?d:0,!(h?vn(h,m):i(c,m,n))){for(s=a;--s;){var g=u[s];if(!(g?vn(g,m):i(t[s],m,n)))continue t}h&amp;&amp;h.push(m),c.push(d)}}return c}function ri(t,e,n){var i=null==(t=ea(t,e=Hi(e,t)))?t:t[ca(Ea(e))];return null==i?r:Ue(i,t,n)}function ii(t){return Cs(t)&amp;&amp;Qr(t)==V}function oi(t,e,n,i,o){return t===e||(null==t||null==e||!Cs(t)&amp;&amp;!Cs(e)?t!=t&amp;&amp;e!=e:function(t,e,n,i,o,a){var s=vs(t),u=vs(e),l=s?B:qo(t),c=u?B:qo(e),f=(l=l==V?Z:l)==Z,p=(c=c==V?Z:c)==Z,m=l==c;if(m&amp;&amp;ws(t)){if(!ws(e))return!1;s=!0,f=!1}if(m&amp;&amp;!f)return a||(a=new xr),s||zs(t)?Ao(t,e,n,i,o,a):function(t,e,n,r,i,o,a){switch(n){case st:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case at:return!(t.byteLength!=e.byteLength||!o(new Ae(t),new Ae(e)));case q:case U:case Y:return hs(+t,+e);case W:return t.name==e.name&amp;&amp;t.message==e.message;case J:case et:return t==e+&quot;&quot;;case K:var s=kn;case tt:var u=r&amp;h;if(s||(s=Sn),t.size!=e.size&amp;&amp;!u)return!1;var l=a.get(t);if(l)return l==e;r|=d,a.set(t,e);var c=Ao(s(t),s(e),r,i,o,a);return a.delete(t),c;case nt:if(fr)return fr.call(t)==fr.call(e)}return!1}(t,e,l,n,i,o,a);if(!(n&amp;h)){var g=f&amp;&amp;ce.call(t,&quot;__wrapped__&quot;),v=p&amp;&amp;ce.call(e,&quot;__wrapped__&quot;);if(g||v){var y=g?t.value():t,b=v?e.value():e;return a||(a=new xr),o(y,b,n,i,a)}}return!!m&amp;&amp;(a||(a=new xr),function(t,e,n,i,o,a){var s=n&amp;h,u=Oo(t),l=u.length,c=Oo(e).length;if(l!=c&amp;&amp;!s)return!1;for(var f=l;f--;){var p=u[f];if(!(s?p in e:ce.call(e,p)))return!1}var d=a.get(t);if(d&amp;&amp;a.get(e))return d==e;var m=!0;a.set(t,e),a.set(e,t);for(var g=s;++f&lt;l;){p=u[f];var v=t[p],y=e[p];if(i)var b=s?i(y,v,p,e,t,a):i(v,y,p,t,e,a);if(!(b===r?v===y||o(v,y,n,i,a):b)){m=!1;break}g||(g=&quot;constructor&quot;==p)}if(m&amp;&amp;!g){var _=t.constructor,w=e.constructor;_!=w&amp;&amp;&quot;constructor&quot;in t&amp;&amp;&quot;constructor&quot;in e&amp;&amp;!(&quot;function&quot;==typeof _&amp;&amp;_ instanceof _&amp;&amp;&quot;function&quot;==typeof w&amp;&amp;w instanceof w)&amp;&amp;(m=!1)}return a.delete(t),a.delete(e),m}(t,e,n,i,o,a))}(t,e,n,i,oi,o))}function ai(t,e,n,i){var o=n.length,a=o,s=!i;if(null==t)return!a;for(t=ee(t);o--;){var u=n[o];if(s&amp;&amp;u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o&lt;a;){var l=(u=n[o])[0],c=t[l],f=u[1];if(s&amp;&amp;u[2]){if(c===r&amp;&amp;!(l in t))return!1}else{var p=new xr;if(i)var m=i(c,f,l,t,e,p);if(!(m===r?oi(f,c,h|d,i,p):m))return!1}}return!0}function si(t){return!(!Ss(t)||pe&amp;&amp;pe in t)&amp;&amp;(ks(t)?ye:Gt).test(fa(t))}function ui(t){return&quot;function&quot;==typeof t?t:null==t?Iu:&quot;object&quot;==typeof t?vs(t)?di(t[0],t[1]):hi(t):Vu(t)}function li(t){if(!Zo(t))return Gn(t);var e=[];for(var n in ee(t))ce.call(t,n)&amp;&amp;&quot;constructor&quot;!=n&amp;&amp;e.push(n);return e}function ci(t){if(!Ss(t))return function(t){var e=[];if(null!=t)for(var n in ee(t))e.push(n);return e}(t);var e=Zo(t),n=[];for(var r in t)(&quot;constructor&quot;!=r||!e&amp;&amp;ce.call(t,r))&amp;&amp;n.push(r);return n}function fi(t,e){return t&lt;e}function pi(t,e){var n=-1,r=bs(t)?Xt(t.length):[];return Vr(t,function(t,i,o){r[++n]=e(t,i,o)}),r}function hi(t){var e=Fo(t);return 1==e.length&amp;&amp;e[0][2]?Jo(e[0][0],e[0][1]):function(n){return n===t||ai(n,t,e)}}function di(t,e){return Ko(t)&amp;&amp;Qo(e)?Jo(ca(t),e):function(n){var i=Js(n,t);return i===r&amp;&amp;i===e?tu(n,t):oi(e,i,h|d)}}function mi(t,e,n,i,o){t!==e&amp;&amp;Wr(e,function(a,s){if(Ss(a))o||(o=new xr),function(t,e,n,i,o,a,s){var u=na(t,n),l=na(e,n),c=s.get(l);if(c)Sr(t,n,c);else{var f=a?a(u,l,n+&quot;&quot;,t,e,s):r,p=f===r;if(p){var h=vs(l),d=!h&amp;&amp;ws(l),m=!h&amp;&amp;!d&amp;&amp;zs(l);f=l,h||d||m?vs(u)?f=u:_s(u)?f=no(u):d?(p=!1,f=Xi(l,!0)):m?(p=!1,f=Qi(l,!0)):f=[]:Os(l)||gs(l)?(f=u,gs(u)?f=Gs(u):Ss(u)&amp;&amp;!ks(u)||(f=Go(l))):p=!1}p&amp;&amp;(s.set(l,f),o(f,l,i,a,s),s.delete(l)),Sr(t,n,f)}}(t,e,s,n,mi,i,o);else{var u=i?i(na(t,s),a,s+&quot;&quot;,t,e,o):r;u===r&amp;&amp;(u=a),Sr(t,s,u)}},ou)}function gi(t,e){var n=t.length;if(n)return Ho(e+=e&lt;0?n:0,n)?t[e]:r}function vi(t,e,n){var r=-1;return e=Ze(e.length?e:[Iu],mn(zo())),function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(pi(t,function(t,n,i){return{criteria:Ze(e,function(e){return e(t)}),index:++r,value:t}}),function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;++r&lt;a;){var u=Ji(i[r],o[r]);if(u){if(r&gt;=s)return u;var l=n[r];return u*(&quot;desc&quot;==l?-1:1)}}return t.index-e.index}(t,e,n)})}function yi(t,e,n){for(var r=-1,i=e.length,o={};++r&lt;i;){var a=e[r],s=Xr(t,a);n(s,a)&amp;&amp;Ni(o,Hi(a,t),s)}return o}function bi(t,e,n,r){var i=r?sn:an,o=-1,a=e.length,s=t;for(t===e&amp;&amp;(e=no(e)),n&amp;&amp;(s=Ze(t,mn(n)));++o&lt;a;)for(var u=0,l=e[o],c=n?n(l):l;(u=i(s,c,u,r))&gt;-1;)s!==t&amp;&amp;ze.call(s,u,1),ze.call(t,u,1);return t}function _i(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;Ho(i)?ze.call(t,i,1):Fi(t,i)}}return t}function wi(t,e){return t+Vn(Yn()*(e-t+1))}function xi(t,e){var n=&quot;&quot;;if(!t||e&lt;1||e&gt;M)return n;do{e%2&amp;&amp;(n+=t),(e=Vn(e/2))&amp;&amp;(t+=t)}while(e);return n}function Ei(t,e){return oa(ta(t,e,Iu),t+&quot;&quot;)}function ki(t){return kr(hu(t))}function Ti(t,e){var n=hu(t);return ua(n,Pr(e,0,n.length))}function Ni(t,e,n,i){if(!Ss(t))return t;for(var o=-1,a=(e=Hi(e,t)).length,s=a-1,u=t;null!=u&amp;&amp;++o&lt;a;){var l=ca(e[o]),c=n;if(o!=s){var f=u[l];(c=i?i(f,l,u):r)===r&amp;&amp;(c=Ss(f)?f:Ho(e[o+1])?[]:{})}Cr(u,l,c),u=u[l]}return t}var Si=rr?function(t,e){return rr.set(t,e),t}:Iu,Ci=Pn?function(t,e){return Pn(t,&quot;toString&quot;,{configurable:!0,enumerable:!1,value:Su(e),writable:!0})}:Iu;function Ai(t){return ua(hu(t))}function Ii(t,e,n){var r=-1,i=t.length;e&lt;0&amp;&amp;(e=-e&gt;i?0:i+e),(n=n&gt;i?i:n)&lt;0&amp;&amp;(n+=i),i=e&gt;n?0:n-e&gt;&gt;&gt;0,e&gt;&gt;&gt;=0;for(var o=Xt(i);++r&lt;i;)o[r]=t[r+e];return o}function Oi(t,e){var n;return Vr(t,function(t,r,i){return!(n=e(t,r,i))}),!!n}function Mi(t,e,n){var r=0,i=null==t?r:t.length;if(&quot;number&quot;==typeof e&amp;&amp;e==e&amp;&amp;i&lt;=L){for(;r&lt;i;){var o=r+i&gt;&gt;&gt;1,a=t[o];null!==a&amp;&amp;!Ds(a)&amp;&amp;(n?a&lt;=e:a&lt;e)?r=o+1:i=o}return i}return Ri(t,e,Iu,n)}function Ri(t,e,n,i){e=n(e);for(var o=0,a=null==t?0:t.length,s=e!=e,u=null===e,l=Ds(e),c=e===r;o&lt;a;){var f=Vn((o+a)/2),p=n(t[f]),h=p!==r,d=null===p,m=p==p,g=Ds(p);if(s)var v=i||m;else v=c?m&amp;&amp;(i||h):u?m&amp;&amp;h&amp;&amp;(i||!d):l?m&amp;&amp;h&amp;&amp;!d&amp;&amp;(i||!g):!d&amp;&amp;!g&amp;&amp;(i?p&lt;=e:p&lt;e);v?o=f+1:a=f}return Hn(a,z)}function Pi(t,e){for(var n=-1,r=t.length,i=0,o=[];++n&lt;r;){var a=t[n],s=e?e(a):a;if(!n||!hs(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function Di(t){return&quot;number&quot;==typeof t?t:Ds(t)?P:+t}function zi(t){if(&quot;string&quot;==typeof t)return t;if(vs(t))return Ze(t,zi)+&quot;&quot;;if(Ds(t))return pr?pr.call(t):&quot;&quot;;var e=t+&quot;&quot;;return&quot;0&quot;==e&amp;&amp;1/t==-O?&quot;-0&quot;:e}function Li(t,e,n){var r=-1,o=Ye,a=t.length,s=!0,u=[],l=u;if(n)s=!1,o=Xe;else if(a&gt;=i){var c=e?null:Eo(t);if(c)return Sn(c);s=!1,o=vn,l=new wr}else l=e?[]:u;t:for(;++r&lt;a;){var f=t[r],p=e?e(f):f;if(f=n||0!==f?f:0,s&amp;&amp;p==p){for(var h=l.length;h--;)if(l[h]===p)continue t;e&amp;&amp;l.push(p),u.push(f)}else o(l,p,n)||(l!==u&amp;&amp;l.push(p),u.push(f))}return u}function Fi(t,e){return null==(t=ea(t,e=Hi(e,t)))||delete t[ca(Ea(e))]}function Vi(t,e,n,r){return Ni(t,e,n(Xr(t,e)),r)}function Bi(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o&lt;i)&amp;&amp;e(t[o],o,t););return n?Ii(t,r?0:o,r?o+1:i):Ii(t,r?o+1:0,r?i:o)}function ji(t,e){var n=t;return n instanceof vr&amp;&amp;(n=n.value()),Je(e,function(t,e){return e.func.apply(e.thisArg,Qe([t],e.args))},n)}function qi(t,e,n){var r=t.length;if(r&lt;2)return r?Li(t[0]):[];for(var i=-1,o=Xt(r);++i&lt;r;)for(var a=t[i],s=-1;++s&lt;r;)s!=i&amp;&amp;(o[i]=Fr(o[i]||a,t[s],e,n));return Li(Gr(o,1),e,n)}function Ui(t,e,n){for(var i=-1,o=t.length,a=e.length,s={};++i&lt;o;){var u=i&lt;a?e[i]:r;n(s,t[i],u)}return s}function Gi(t){return _s(t)?t:[]}function Wi(t){return&quot;function&quot;==typeof t?t:Iu}function Hi(t,e){return vs(t)?t:Ko(t,e)?[t]:la(Ws(t))}var $i=Ei;function Ki(t,e,n){var i=t.length;return n=n===r?i:n,!e&amp;&amp;n&gt;=i?t:Ii(t,e,n)}var Yi=Dn||function(t){return Oe.clearTimeout(t)};function Xi(t,e){if(e)return t.slice();var n=t.length,r=Ie?Ie(n):new t.constructor(n);return t.copy(r),r}function Zi(t){var e=new t.constructor(t.byteLength);return new Ae(e).set(new Ae(t)),e}function Qi(t,e){var n=e?Zi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ji(t,e){if(t!==e){var n=t!==r,i=null===t,o=t==t,a=Ds(t),s=e!==r,u=null===e,l=e==e,c=Ds(e);if(!u&amp;&amp;!c&amp;&amp;!a&amp;&amp;t&gt;e||a&amp;&amp;s&amp;&amp;l&amp;&amp;!u&amp;&amp;!c||i&amp;&amp;s&amp;&amp;l||!n&amp;&amp;l||!o)return 1;if(!i&amp;&amp;!a&amp;&amp;!c&amp;&amp;t&lt;e||c&amp;&amp;n&amp;&amp;o&amp;&amp;!i&amp;&amp;!a||u&amp;&amp;n&amp;&amp;o||!s&amp;&amp;o||!l)return-1}return 0}function to(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,u=e.length,l=Wn(o-a,0),c=Xt(u+l),f=!r;++s&lt;u;)c[s]=e[s];for(;++i&lt;a;)(f||i&lt;o)&amp;&amp;(c[n[i]]=t[i]);for(;l--;)c[s++]=t[i++];return c}function eo(t,e,n,r){for(var i=-1,o=t.length,a=-1,s=n.length,u=-1,l=e.length,c=Wn(o-s,0),f=Xt(c+l),p=!r;++i&lt;c;)f[i]=t[i];for(var h=i;++u&lt;l;)f[h+u]=e[u];for(;++a&lt;s;)(p||i&lt;o)&amp;&amp;(f[h+n[a]]=t[i++]);return f}function no(t,e){var n=-1,r=t.length;for(e||(e=Xt(r));++n&lt;r;)e[n]=t[n];return e}function ro(t,e,n,i){var o=!n;n||(n={});for(var a=-1,s=e.length;++a&lt;s;){var u=e[a],l=i?i(n[u],t[u],u,n,t):r;l===r&amp;&amp;(l=t[u]),o?Mr(n,u,l):Cr(n,u,l)}return n}function io(t,e){return function(n,r){var i=vs(n)?Ge:Ir,o=e?e():{};return i(n,t,zo(r,2),o)}}function oo(t){return Ei(function(e,n){var i=-1,o=n.length,a=o&gt;1?n[o-1]:r,s=o&gt;2?n[2]:r;for(a=t.length&gt;3&amp;&amp;&quot;function&quot;==typeof a?(o--,a):r,s&amp;&amp;$o(n[0],n[1],s)&amp;&amp;(a=o&lt;3?r:a,o=1),e=ee(e);++i&lt;o;){var u=n[i];u&amp;&amp;t(e,u,i,a)}return e})}function ao(t,e){return function(n,r){if(null==n)return n;if(!bs(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=ee(n);(e?o--:++o&lt;i)&amp;&amp;!1!==r(a[o],o,a););return n}}function so(t){return function(e,n,r){for(var i=-1,o=ee(e),a=r(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===n(o[u],u,o))break}return e}}function uo(t){return function(e){var n=En(e=Ws(e))?In(e):r,i=n?n[0]:e.charAt(0),o=n?Ki(n,1).join(&quot;&quot;):e.slice(1);return i[t]()+o}}function lo(t){return function(e){return Je(ku(gu(e).replace(ge,&quot;&quot;)),t,&quot;&quot;)}}function co(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=dr(t.prototype),r=t.apply(n,e);return Ss(r)?r:n}}function fo(t){return function(e,n,i){var o=ee(e);if(!bs(e)){var a=zo(n,3);e=iu(e),n=function(t){return a(o[t],t,o)}}var s=t(e,n,i);return s&gt;-1?o[a?e[s]:s]:r}}function po(t){return Io(function(e){var n=e.length,i=n,o=gr.prototype.thru;for(t&amp;&amp;e.reverse();i--;){var s=e[i];if(&quot;function&quot;!=typeof s)throw new ie(a);if(o&amp;&amp;!u&amp;&amp;&quot;wrapper&quot;==Po(s))var u=new gr([],!0)}for(i=u?i:n;++i&lt;n;){var l=Po(s=e[i]),c=&quot;wrapper&quot;==l?Ro(s):r;u=c&amp;&amp;Yo(c[0])&amp;&amp;c[1]==(x|y|_|E)&amp;&amp;!c[4].length&amp;&amp;1==c[9]?u[Po(c[0])].apply(u,c[3]):1==s.length&amp;&amp;Yo(s)?u[l]():u.thru(s)}return function(){var t=arguments,r=t[0];if(u&amp;&amp;1==t.length&amp;&amp;vs(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i&lt;n;)o=e[i].call(this,o);return o}})}function ho(t,e,n,i,o,a,s,u,l,c){var f=e&amp;x,p=e&amp;m,h=e&amp;g,d=e&amp;(y|b),v=e&amp;k,_=h?r:co(t);return function m(){for(var g=arguments.length,y=Xt(g),b=g;b--;)y[b]=arguments[b];if(d)var w=Do(m),x=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&amp;&amp;++r;return r}(y,w);if(i&amp;&amp;(y=to(y,i,o,d)),a&amp;&amp;(y=eo(y,a,s,d)),g-=x,d&amp;&amp;g&lt;c){var E=Nn(y,w);return wo(t,e,ho,m.placeholder,n,y,E,u,l,c-g)}var k=p?n:this,T=h?k[t]:t;return g=y.length,u?y=function(t,e){for(var n=t.length,i=Hn(e.length,n),o=no(t);i--;){var a=e[i];t[i]=Ho(a,n)?o[a]:r}return t}(y,u):v&amp;&amp;g&gt;1&amp;&amp;y.reverse(),f&amp;&amp;l&lt;g&amp;&amp;(y.length=l),this&amp;&amp;this!==Oe&amp;&amp;this instanceof m&amp;&amp;(T=_||co(T)),T.apply(k,y)}}function mo(t,e){return function(n,r){return function(t,e,n,r){return $r(t,function(t,i,o){e(r,n(t),i,o)}),r}(n,t,e(r),{})}}function go(t,e){return function(n,i){var o;if(n===r&amp;&amp;i===r)return e;if(n!==r&amp;&amp;(o=n),i!==r){if(o===r)return i;&quot;string&quot;==typeof n||&quot;string&quot;==typeof i?(n=zi(n),i=zi(i)):(n=Di(n),i=Di(i)),o=t(n,i)}return o}}function vo(t){return Io(function(e){return e=Ze(e,mn(zo())),Ei(function(n){var r=this;return t(e,function(t){return Ue(t,r,n)})})})}function yo(t,e){var n=(e=e===r?&quot; &quot;:zi(e)).length;if(n&lt;2)return n?xi(e,t):e;var i=xi(e,Fn(t/An(e)));return En(e)?Ki(In(i),0,t).join(&quot;&quot;):i.slice(0,t)}function bo(t){return function(e,n,i){return i&amp;&amp;&quot;number&quot;!=typeof i&amp;&amp;$o(e,n,i)&amp;&amp;(n=i=r),e=Bs(e),n===r?(n=e,e=0):n=Bs(n),function(t,e,n,r){for(var i=-1,o=Wn(Fn((e-t)/(n||1)),0),a=Xt(o);o--;)a[r?o:++i]=t,t+=n;return a}(e,n,i=i===r?e&lt;n?1:-1:Bs(i),t)}}function _o(t){return function(e,n){return&quot;string&quot;==typeof e&amp;&amp;&quot;string&quot;==typeof n||(e=Us(e),n=Us(n)),t(e,n)}}function wo(t,e,n,i,o,a,s,u,l,c){var f=e&amp;y;e|=f?_:w,(e&amp;=~(f?w:_))&amp;v||(e&amp;=~(m|g));var p=[t,e,o,f?a:r,f?s:r,f?r:a,f?r:s,u,l,c],h=n.apply(r,p);return Yo(t)&amp;&amp;ra(h,p),h.placeholder=i,aa(h,t,e)}function xo(t){var e=te[t];return function(t,n){if(t=Us(t),n=null==n?0:Hn(js(n),292)){var r=(Ws(t)+&quot;e&quot;).split(&quot;e&quot;);return+((r=(Ws(e(r[0]+&quot;e&quot;+(+r[1]+n)))+&quot;e&quot;).split(&quot;e&quot;))[0]+&quot;e&quot;+(+r[1]-n))}return e(t)}}var Eo=tr&amp;&amp;1/Sn(new tr([,-0]))[1]==O?function(t){return new tr(t)}:Du;function ko(t){return function(e){var n=qo(e);return n==K?kn(e):n==tt?Cn(e):function(t,e){return Ze(e,function(e){return[e,t[e]]})}(e,t(e))}}function To(t,e,n,i,o,s,u,c){var f=e&amp;g;if(!f&amp;&amp;&quot;function&quot;!=typeof t)throw new ie(a);var p=i?i.length:0;if(p||(e&amp;=~(_|w),i=o=r),u=u===r?u:Wn(js(u),0),c=c===r?c:js(c),p-=o?o.length:0,e&amp;w){var h=i,d=o;i=o=r}var k=f?r:Ro(t),T=[t,e,n,i,o,h,d,s,u,c];if(k&amp;&amp;function(t,e){var n=t[1],r=e[1],i=n|r,o=i&lt;(m|g|x),a=r==x&amp;&amp;n==y||r==x&amp;&amp;n==E&amp;&amp;t[7].length&lt;=e[8]||r==(x|E)&amp;&amp;e[7].length&lt;=e[8]&amp;&amp;n==y;if(!o&amp;&amp;!a)return t;r&amp;m&amp;&amp;(t[2]=e[2],i|=n&amp;m?0:v);var s=e[3];if(s){var u=t[3];t[3]=u?to(u,s,e[4]):s,t[4]=u?Nn(t[3],l):e[4]}(s=e[5])&amp;&amp;(u=t[5],t[5]=u?eo(u,s,e[6]):s,t[6]=u?Nn(t[5],l):e[6]),(s=e[7])&amp;&amp;(t[7]=s),r&amp;x&amp;&amp;(t[8]=null==t[8]?e[8]:Hn(t[8],e[8])),null==t[9]&amp;&amp;(t[9]=e[9]),t[0]=e[0],t[1]=i}(T,k),t=T[0],e=T[1],n=T[2],i=T[3],o=T[4],!(c=T[9]=T[9]===r?f?0:t.length:Wn(T[9]-p,0))&amp;&amp;e&amp;(y|b)&amp;&amp;(e&amp;=~(y|b)),e&amp;&amp;e!=m)N=e==y||e==b?function(t,e,n){var i=co(t);return function o(){for(var a=arguments.length,s=Xt(a),u=a,l=Do(o);u--;)s[u]=arguments[u];var c=a&lt;3&amp;&amp;s[0]!==l&amp;&amp;s[a-1]!==l?[]:Nn(s,l);return(a-=c.length)&lt;n?wo(t,e,ho,o.placeholder,r,s,c,r,r,n-a):Ue(this&amp;&amp;this!==Oe&amp;&amp;this instanceof o?i:t,this,s)}}(t,e,c):e!=_&amp;&amp;e!=(m|_)||o.length?ho.apply(r,T):function(t,e,n,r){var i=e&amp;m,o=co(t);return function e(){for(var a=-1,s=arguments.length,u=-1,l=r.length,c=Xt(l+s),f=this&amp;&amp;this!==Oe&amp;&amp;this instanceof e?o:t;++u&lt;l;)c[u]=r[u];for(;s--;)c[u++]=arguments[++a];return Ue(f,i?n:this,c)}}(t,e,n,i);else var N=function(t,e,n){var r=e&amp;m,i=co(t);return function e(){return(this&amp;&amp;this!==Oe&amp;&amp;this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return aa((k?Si:ra)(N,T),t,e)}function No(t,e,n,i){return t===r||hs(t,se[n])&amp;&amp;!ce.call(i,n)?e:t}function So(t,e,n,i,o,a){return Ss(t)&amp;&amp;Ss(e)&amp;&amp;(a.set(e,t),mi(t,e,r,So,a),a.delete(e)),t}function Co(t){return Os(t)?r:t}function Ao(t,e,n,i,o,a){var s=n&amp;h,u=t.length,l=e.length;if(u!=l&amp;&amp;!(s&amp;&amp;l&gt;u))return!1;var c=a.get(t);if(c&amp;&amp;a.get(e))return c==e;var f=-1,p=!0,m=n&amp;d?new wr:r;for(a.set(t,e),a.set(e,t);++f&lt;u;){var g=t[f],v=e[f];if(i)var y=s?i(v,g,f,e,t,a):i(g,v,f,t,e,a);if(y!==r){if(y)continue;p=!1;break}if(m){if(!en(e,function(t,e){if(!vn(m,e)&amp;&amp;(g===t||o(g,t,n,i,a)))return m.push(e)})){p=!1;break}}else if(g!==v&amp;&amp;!o(g,v,n,i,a)){p=!1;break}}return a.delete(t),a.delete(e),p}function Io(t){return oa(ta(t,r,ya),t+&quot;&quot;)}function Oo(t){return Zr(t,iu,Bo)}function Mo(t){return Zr(t,ou,jo)}var Ro=rr?function(t){return rr.get(t)}:Du;function Po(t){for(var e=t.name+&quot;&quot;,n=ir[e],r=ce.call(ir,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function Do(t){return(ce.call(hr,&quot;placeholder&quot;)?hr:t).placeholder}function zo(){var t=hr.iteratee||Ou;return t=t===Ou?ui:t,arguments.length?t(arguments[0],arguments[1]):t}function Lo(t,e){var n,r,i=t.__data__;return(&quot;string&quot;==(r=typeof(n=e))||&quot;number&quot;==r||&quot;symbol&quot;==r||&quot;boolean&quot;==r?&quot;__proto__&quot;!==n:null===n)?i[&quot;string&quot;==typeof e?&quot;string&quot;:&quot;hash&quot;]:i.map}function Fo(t){for(var e=iu(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Qo(i)]}return e}function Vo(t,e){var n=function(t,e){return null==t?r:t[e]}(t,e);return si(n)?n:r}var Bo=Bn?function(t){return null==t?[]:(t=ee(t),Ke(Bn(t),function(e){return De.call(t,e)}))}:qu,jo=Bn?function(t){for(var e=[];t;)Qe(e,Bo(t)),t=Me(t);return e}:qu,qo=Qr;function Uo(t,e,n){for(var r=-1,i=(e=Hi(e,t)).length,o=!1;++r&lt;i;){var a=ca(e[r]);if(!(o=null!=t&amp;&amp;n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&amp;&amp;Ns(i)&amp;&amp;Ho(a,i)&amp;&amp;(vs(t)||gs(t))}function Go(t){return&quot;function&quot;!=typeof t.constructor||Zo(t)?{}:dr(Me(t))}function Wo(t){return vs(t)||gs(t)||!!(nn&amp;&amp;t&amp;&amp;t[nn])}function Ho(t,e){var n=typeof t;return!!(e=null==e?M:e)&amp;&amp;(&quot;number&quot;==n||&quot;symbol&quot;!=n&amp;&amp;Ht.test(t))&amp;&amp;t&gt;-1&amp;&amp;t%1==0&amp;&amp;t&lt;e}function $o(t,e,n){if(!Ss(n))return!1;var r=typeof e;return!!(&quot;number&quot;==r?bs(n)&amp;&amp;Ho(e,n.length):&quot;string&quot;==r&amp;&amp;e in n)&amp;&amp;hs(n[e],t)}function Ko(t,e){if(vs(t))return!1;var n=typeof t;return!(&quot;number&quot;!=n&amp;&amp;&quot;symbol&quot;!=n&amp;&amp;&quot;boolean&quot;!=n&amp;&amp;null!=t&amp;&amp;!Ds(t))||Ct.test(t)||!St.test(t)||null!=e&amp;&amp;t in ee(e)}function Yo(t){var e=Po(t),n=hr[e];if(&quot;function&quot;!=typeof n||!(e in vr.prototype))return!1;if(t===n)return!0;var r=Ro(n);return!!r&amp;&amp;t===r[0]}(Zn&amp;&amp;qo(new Zn(new ArrayBuffer(1)))!=st||Qn&amp;&amp;qo(new Qn)!=K||Jn&amp;&amp;&quot;[object Promise]&quot;!=qo(Jn.resolve())||tr&amp;&amp;qo(new tr)!=tt||er&amp;&amp;qo(new er)!=it)&amp;&amp;(qo=function(t){var e=Qr(t),n=e==Z?t.constructor:r,i=n?fa(n):&quot;&quot;;if(i)switch(i){case or:return st;case ar:return K;case sr:return&quot;[object Promise]&quot;;case ur:return tt;case lr:return it}return e});var Xo=ue?ks:Uu;function Zo(t){var e=t&amp;&amp;t.constructor;return t===(&quot;function&quot;==typeof e&amp;&amp;e.prototype||se)}function Qo(t){return t==t&amp;&amp;!Ss(t)}function Jo(t,e){return function(n){return null!=n&amp;&amp;n[t]===e&amp;&amp;(e!==r||t in ee(n))}}function ta(t,e,n){return e=Wn(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=Wn(r.length-e,0),a=Xt(o);++i&lt;o;)a[i]=r[e+i];i=-1;for(var s=Xt(e+1);++i&lt;e;)s[i]=r[i];return s[e]=n(a),Ue(t,this,s)}}function ea(t,e){return e.length&lt;2?t:Xr(t,Ii(e,0,-1))}function na(t,e){if(&quot;__proto__&quot;!=e)return t[e]}var ra=sa(Si),ia=Ln||function(t,e){return Oe.setTimeout(t,e)},oa=sa(Ci);function aa(t,e,n){var r=e+&quot;&quot;;return oa(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n&gt;1?&quot;&amp; &quot;:&quot;&quot;)+e[r],e=e.join(n&gt;2?&quot;, &quot;:&quot; &quot;),t.replace(Dt,&quot;{\n/* [wrapped with &quot;+e+&quot;] */\n&quot;)}(r,function(t,e){return We(F,function(n){var r=&quot;_.&quot;+n[0];e&amp;n[1]&amp;&amp;!Ye(t,r)&amp;&amp;t.push(r)}),t.sort()}(function(t){var e=t.match(zt);return e?e[1].split(Lt):[]}(r),n)))}function sa(t){var e=0,n=0;return function(){var i=$n(),o=C-(i-n);if(n=i,o&gt;0){if(++e&gt;=S)return arguments[0]}else e=0;return t.apply(r,arguments)}}function ua(t,e){var n=-1,i=t.length,o=i-1;for(e=e===r?i:e;++n&lt;e;){var a=wi(n,o),s=t[a];t[a]=t[n],t[n]=s}return t.length=e,t}var la=function(t){var e=ss(t,function(t){return n.size===u&amp;&amp;n.clear(),t}),n=e.cache;return e}(function(t){var e=[];return 46===t.charCodeAt(0)&amp;&amp;e.push(&quot;&quot;),t.replace(At,function(t,n,r,i){e.push(r?i.replace(Vt,&quot;$1&quot;):n||t)}),e});function ca(t){if(&quot;string&quot;==typeof t||Ds(t))return t;var e=t+&quot;&quot;;return&quot;0&quot;==e&amp;&amp;1/t==-O?&quot;-0&quot;:e}function fa(t){if(null!=t){try{return le.call(t)}catch(t){}try{return t+&quot;&quot;}catch(t){}}return&quot;&quot;}function pa(t){if(t instanceof vr)return t.clone();var e=new gr(t.__wrapped__,t.__chain__);return e.__actions__=no(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var ha=Ei(function(t,e){return _s(t)?Fr(t,Gr(e,1,_s,!0)):[]}),da=Ei(function(t,e){var n=Ea(e);return _s(n)&amp;&amp;(n=r),_s(t)?Fr(t,Gr(e,1,_s,!0),zo(n,2)):[]}),ma=Ei(function(t,e){var n=Ea(e);return _s(n)&amp;&amp;(n=r),_s(t)?Fr(t,Gr(e,1,_s,!0),r,n):[]});function ga(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:js(n);return i&lt;0&amp;&amp;(i=Wn(r+i,0)),on(t,zo(e,3),i)}function va(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i-1;return n!==r&amp;&amp;(o=js(n),o=n&lt;0?Wn(i+o,0):Hn(o,i-1)),on(t,zo(e,3),o,!0)}function ya(t){return null!=t&amp;&amp;t.length?Gr(t,1):[]}function ba(t){return t&amp;&amp;t.length?t[0]:r}var _a=Ei(function(t){var e=Ze(t,Gi);return e.length&amp;&amp;e[0]===t[0]?ni(e):[]}),wa=Ei(function(t){var e=Ea(t),n=Ze(t,Gi);return e===Ea(n)?e=r:n.pop(),n.length&amp;&amp;n[0]===t[0]?ni(n,zo(e,2)):[]}),xa=Ei(function(t){var e=Ea(t),n=Ze(t,Gi);return(e=&quot;function&quot;==typeof e?e:r)&amp;&amp;n.pop(),n.length&amp;&amp;n[0]===t[0]?ni(n,r,e):[]});function Ea(t){var e=null==t?0:t.length;return e?t[e-1]:r}var ka=Ei(Ta);function Ta(t,e){return t&amp;&amp;t.length&amp;&amp;e&amp;&amp;e.length?bi(t,e):t}var Na=Io(function(t,e){var n=null==t?0:t.length,r=Rr(t,e);return _i(t,Ze(e,function(t){return Ho(t,n)?+t:t}).sort(Ji)),r});function Sa(t){return null==t?t:Xn.call(t)}var Ca=Ei(function(t){return Li(Gr(t,1,_s,!0))}),Aa=Ei(function(t){var e=Ea(t);return _s(e)&amp;&amp;(e=r),Li(Gr(t,1,_s,!0),zo(e,2))}),Ia=Ei(function(t){var e=Ea(t);return e=&quot;function&quot;==typeof e?e:r,Li(Gr(t,1,_s,!0),r,e)});function Oa(t){if(!t||!t.length)return[];var e=0;return t=Ke(t,function(t){if(_s(t))return e=Wn(t.length,e),!0}),dn(e,function(e){return Ze(t,cn(e))})}function Ma(t,e){if(!t||!t.length)return[];var n=Oa(t);return null==e?n:Ze(n,function(t){return Ue(e,r,t)})}var Ra=Ei(function(t,e){return _s(t)?Fr(t,e):[]}),Pa=Ei(function(t){return qi(Ke(t,_s))}),Da=Ei(function(t){var e=Ea(t);return _s(e)&amp;&amp;(e=r),qi(Ke(t,_s),zo(e,2))}),za=Ei(function(t){var e=Ea(t);return e=&quot;function&quot;==typeof e?e:r,qi(Ke(t,_s),r,e)}),La=Ei(Oa);var Fa=Ei(function(t){var e=t.length,n=e&gt;1?t[e-1]:r;return Ma(t,n=&quot;function&quot;==typeof n?(t.pop(),n):r)});function Va(t){var e=hr(t);return e.__chain__=!0,e}function Ba(t,e){return e(t)}var ja=Io(function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,o=function(e){return Rr(e,t)};return!(e&gt;1||this.__actions__.length)&amp;&amp;i instanceof vr&amp;&amp;Ho(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:Ba,args:[o],thisArg:r}),new gr(i,this.__chain__).thru(function(t){return e&amp;&amp;!t.length&amp;&amp;t.push(r),t})):this.thru(o)});var qa=io(function(t,e,n){ce.call(t,n)?++t[n]:Mr(t,n,1)});var Ua=fo(ga),Ga=fo(va);function Wa(t,e){return(vs(t)?We:Vr)(t,zo(e,3))}function Ha(t,e){return(vs(t)?He:Br)(t,zo(e,3))}var $a=io(function(t,e,n){ce.call(t,n)?t[n].push(e):Mr(t,n,[e])});var Ka=Ei(function(t,e,n){var r=-1,i=&quot;function&quot;==typeof e,o=bs(t)?Xt(t.length):[];return Vr(t,function(t){o[++r]=i?Ue(e,t,n):ri(t,e,n)}),o}),Ya=io(function(t,e,n){Mr(t,n,e)});function Xa(t,e){return(vs(t)?Ze:pi)(t,zo(e,3))}var Za=io(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});var Qa=Ei(function(t,e){if(null==t)return[];var n=e.length;return n&gt;1&amp;&amp;$o(t,e[0],e[1])?e=[]:n&gt;2&amp;&amp;$o(e[0],e[1],e[2])&amp;&amp;(e=[e[0]]),vi(t,Gr(e,1),[])}),Ja=zn||function(){return Oe.Date.now()};function ts(t,e,n){return e=n?r:e,e=t&amp;&amp;null==e?t.length:e,To(t,x,r,r,r,r,e)}function es(t,e){var n;if(&quot;function&quot;!=typeof e)throw new ie(a);return t=js(t),function(){return--t&gt;0&amp;&amp;(n=e.apply(this,arguments)),t&lt;=1&amp;&amp;(e=r),n}}var ns=Ei(function(t,e,n){var r=m;if(n.length){var i=Nn(n,Do(ns));r|=_}return To(t,r,e,n,i)}),rs=Ei(function(t,e,n){var r=m|g;if(n.length){var i=Nn(n,Do(rs));r|=_}return To(e,r,t,n,i)});function is(t,e,n){var i,o,s,u,l,c,f=0,p=!1,h=!1,d=!0;if(&quot;function&quot;!=typeof t)throw new ie(a);function m(e){var n=i,a=o;return i=o=r,f=e,u=t.apply(a,n)}function g(t){var n=t-c;return c===r||n&gt;=e||n&lt;0||h&amp;&amp;t-f&gt;=s}function v(){var t=Ja();if(g(t))return y(t);l=ia(v,function(t){var n=e-(t-c);return h?Hn(n,s-(t-f)):n}(t))}function y(t){return l=r,d&amp;&amp;i?m(t):(i=o=r,u)}function b(){var t=Ja(),n=g(t);if(i=arguments,o=this,c=t,n){if(l===r)return function(t){return f=t,l=ia(v,e),p?m(t):u}(c);if(h)return l=ia(v,e),m(c)}return l===r&amp;&amp;(l=ia(v,e)),u}return e=Us(e)||0,Ss(n)&amp;&amp;(p=!!n.leading,s=(h=&quot;maxWait&quot;in n)?Wn(Us(n.maxWait)||0,e):s,d=&quot;trailing&quot;in n?!!n.trailing:d),b.cancel=function(){l!==r&amp;&amp;Yi(l),f=0,i=c=o=l=r},b.flush=function(){return l===r?u:y(Ja())},b}var os=Ei(function(t,e){return Lr(t,1,e)}),as=Ei(function(t,e,n){return Lr(t,Us(e)||0,n)});function ss(t,e){if(&quot;function&quot;!=typeof t||null!=e&amp;&amp;&quot;function&quot;!=typeof e)throw new ie(a);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(ss.Cache||_r),n}function us(t){if(&quot;function&quot;!=typeof t)throw new ie(a);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ss.Cache=_r;var ls=$i(function(t,e){var n=(e=1==e.length&amp;&amp;vs(e[0])?Ze(e[0],mn(zo())):Ze(Gr(e,1),mn(zo()))).length;return Ei(function(r){for(var i=-1,o=Hn(r.length,n);++i&lt;o;)r[i]=e[i].call(this,r[i]);return Ue(t,this,r)})}),cs=Ei(function(t,e){var n=Nn(e,Do(cs));return To(t,_,r,e,n)}),fs=Ei(function(t,e){var n=Nn(e,Do(fs));return To(t,w,r,e,n)}),ps=Io(function(t,e){return To(t,E,r,r,r,e)});function hs(t,e){return t===e||t!=t&amp;&amp;e!=e}var ds=_o(Jr),ms=_o(function(t,e){return t&gt;=e}),gs=ii(function(){return arguments}())?ii:function(t){return Cs(t)&amp;&amp;ce.call(t,&quot;callee&quot;)&amp;&amp;!De.call(t,&quot;callee&quot;)},vs=Xt.isArray,ys=Le?mn(Le):function(t){return Cs(t)&amp;&amp;Qr(t)==at};function bs(t){return null!=t&amp;&amp;Ns(t.length)&amp;&amp;!ks(t)}function _s(t){return Cs(t)&amp;&amp;bs(t)}var ws=jn||Uu,xs=Fe?mn(Fe):function(t){return Cs(t)&amp;&amp;Qr(t)==U};function Es(t){if(!Cs(t))return!1;var e=Qr(t);return e==W||e==G||&quot;string&quot;==typeof t.message&amp;&amp;&quot;string&quot;==typeof t.name&amp;&amp;!Os(t)}function ks(t){if(!Ss(t))return!1;var e=Qr(t);return e==H||e==$||e==j||e==Q}function Ts(t){return&quot;number&quot;==typeof t&amp;&amp;t==js(t)}function Ns(t){return&quot;number&quot;==typeof t&amp;&amp;t&gt;-1&amp;&amp;t%1==0&amp;&amp;t&lt;=M}function Ss(t){var e=typeof t;return null!=t&amp;&amp;(&quot;object&quot;==e||&quot;function&quot;==e)}function Cs(t){return null!=t&amp;&amp;&quot;object&quot;==typeof t}var As=Ve?mn(Ve):function(t){return Cs(t)&amp;&amp;qo(t)==K};function Is(t){return&quot;number&quot;==typeof t||Cs(t)&amp;&amp;Qr(t)==Y}function Os(t){if(!Cs(t)||Qr(t)!=Z)return!1;var e=Me(t);if(null===e)return!0;var n=ce.call(e,&quot;constructor&quot;)&amp;&amp;e.constructor;return&quot;function&quot;==typeof n&amp;&amp;n instanceof n&amp;&amp;le.call(n)==de}var Ms=Be?mn(Be):function(t){return Cs(t)&amp;&amp;Qr(t)==J};var Rs=je?mn(je):function(t){return Cs(t)&amp;&amp;qo(t)==tt};function Ps(t){return&quot;string&quot;==typeof t||!vs(t)&amp;&amp;Cs(t)&amp;&amp;Qr(t)==et}function Ds(t){return&quot;symbol&quot;==typeof t||Cs(t)&amp;&amp;Qr(t)==nt}var zs=qe?mn(qe):function(t){return Cs(t)&amp;&amp;Ns(t.length)&amp;&amp;!!ke[Qr(t)]};var Ls=_o(fi),Fs=_o(function(t,e){return t&lt;=e});function Vs(t){if(!t)return[];if(bs(t))return Ps(t)?In(t):no(t);if(fn&amp;&amp;t[fn])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[fn]());var e=qo(t);return(e==K?kn:e==tt?Sn:hu)(t)}function Bs(t){return t?(t=Us(t))===O||t===-O?(t&lt;0?-1:1)*R:t==t?t:0:0===t?t:0}function js(t){var e=Bs(t),n=e%1;return e==e?n?e-n:e:0}function qs(t){return t?Pr(js(t),0,D):0}function Us(t){if(&quot;number&quot;==typeof t)return t;if(Ds(t))return P;if(Ss(t)){var e=&quot;function&quot;==typeof t.valueOf?t.valueOf():t;t=Ss(e)?e+&quot;&quot;:e}if(&quot;string&quot;!=typeof t)return 0===t?t:+t;t=t.replace(Mt,&quot;&quot;);var n=Ut.test(t);return n||Wt.test(t)?Ce(t.slice(2),n?2:8):qt.test(t)?P:+t}function Gs(t){return ro(t,ou(t))}function Ws(t){return null==t?&quot;&quot;:zi(t)}var Hs=oo(function(t,e){if(Zo(e)||bs(e))ro(e,iu(e),t);else for(var n in e)ce.call(e,n)&amp;&amp;Cr(t,n,e[n])}),$s=oo(function(t,e){ro(e,ou(e),t)}),Ks=oo(function(t,e,n,r){ro(e,ou(e),t,r)}),Ys=oo(function(t,e,n,r){ro(e,iu(e),t,r)}),Xs=Io(Rr);var Zs=Ei(function(t,e){t=ee(t);var n=-1,i=e.length,o=i&gt;2?e[2]:r;for(o&amp;&amp;$o(e[0],e[1],o)&amp;&amp;(i=1);++n&lt;i;)for(var a=e[n],s=ou(a),u=-1,l=s.length;++u&lt;l;){var c=s[u],f=t[c];(f===r||hs(f,se[c])&amp;&amp;!ce.call(t,c))&amp;&amp;(t[c]=a[c])}return t}),Qs=Ei(function(t){return t.push(r,So),Ue(su,r,t)});function Js(t,e,n){var i=null==t?r:Xr(t,e);return i===r?n:i}function tu(t,e){return null!=t&amp;&amp;Uo(t,e,ei)}var eu=mo(function(t,e,n){null!=e&amp;&amp;&quot;function&quot;!=typeof e.toString&amp;&amp;(e=he.call(e)),t[e]=n},Su(Iu)),nu=mo(function(t,e,n){null!=e&amp;&amp;&quot;function&quot;!=typeof e.toString&amp;&amp;(e=he.call(e)),ce.call(t,e)?t[e].push(n):t[e]=[n]},zo),ru=Ei(ri);function iu(t){return bs(t)?Er(t):li(t)}function ou(t){return bs(t)?Er(t,!0):ci(t)}var au=oo(function(t,e,n){mi(t,e,n)}),su=oo(function(t,e,n,r){mi(t,e,n,r)}),uu=Io(function(t,e){var n={};if(null==t)return n;var r=!1;e=Ze(e,function(e){return e=Hi(e,t),r||(r=e.length&gt;1),e}),ro(t,Mo(t),n),r&amp;&amp;(n=Dr(n,c|f|p,Co));for(var i=e.length;i--;)Fi(n,e[i]);return n});var lu=Io(function(t,e){return null==t?{}:function(t,e){return yi(t,e,function(e,n){return tu(t,n)})}(t,e)});function cu(t,e){if(null==t)return{};var n=Ze(Mo(t),function(t){return[t]});return e=zo(e),yi(t,n,function(t,n){return e(t,n[0])})}var fu=ko(iu),pu=ko(ou);function hu(t){return null==t?[]:gn(t,iu(t))}var du=lo(function(t,e,n){return e=e.toLowerCase(),t+(n?mu(e):e)});function mu(t){return Eu(Ws(t).toLowerCase())}function gu(t){return(t=Ws(t))&amp;&amp;t.replace($t,_n).replace(ve,&quot;&quot;)}var vu=lo(function(t,e,n){return t+(n?&quot;-&quot;:&quot;&quot;)+e.toLowerCase()}),yu=lo(function(t,e,n){return t+(n?&quot; &quot;:&quot;&quot;)+e.toLowerCase()}),bu=uo(&quot;toLowerCase&quot;);var _u=lo(function(t,e,n){return t+(n?&quot;_&quot;:&quot;&quot;)+e.toLowerCase()});var wu=lo(function(t,e,n){return t+(n?&quot; &quot;:&quot;&quot;)+Eu(e)});var xu=lo(function(t,e,n){return t+(n?&quot; &quot;:&quot;&quot;)+e.toUpperCase()}),Eu=uo(&quot;toUpperCase&quot;);function ku(t,e,n){return t=Ws(t),(e=n?r:e)===r?function(t){return we.test(t)}(t)?function(t){return t.match(be)||[]}(t):function(t){return t.match(Ft)||[]}(t):t.match(e)||[]}var Tu=Ei(function(t,e){try{return Ue(t,r,e)}catch(t){return Es(t)?t:new Qt(t)}}),Nu=Io(function(t,e){return We(e,function(e){e=ca(e),Mr(t,e,ns(t[e],t))}),t});function Su(t){return function(){return t}}var Cu=po(),Au=po(!0);function Iu(t){return t}function Ou(t){return ui(&quot;function&quot;==typeof t?t:Dr(t,c))}var Mu=Ei(function(t,e){return function(n){return ri(n,t,e)}}),Ru=Ei(function(t,e){return function(n){return ri(t,n,e)}});function Pu(t,e,n){var r=iu(e),i=Yr(e,r);null!=n||Ss(e)&amp;&amp;(i.length||!r.length)||(n=e,e=t,t=this,i=Yr(e,iu(e)));var o=!(Ss(n)&amp;&amp;&quot;chain&quot;in n&amp;&amp;!n.chain),a=ks(t);return We(i,function(n){var r=e[n];t[n]=r,a&amp;&amp;(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=no(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Qe([this.value()],arguments))})}),t}function Du(){}var zu=vo(Ze),Lu=vo($e),Fu=vo(en);function Vu(t){return Ko(t)?cn(ca(t)):function(t){return function(e){return Xr(e,t)}}(t)}var Bu=bo(),ju=bo(!0);function qu(){return[]}function Uu(){return!1}var Gu=go(function(t,e){return t+e},0),Wu=xo(&quot;ceil&quot;),Hu=go(function(t,e){return t/e},1),$u=xo(&quot;floor&quot;);var Ku,Yu=go(function(t,e){return t*e},1),Xu=xo(&quot;round&quot;),Zu=go(function(t,e){return t-e},0);return hr.after=function(t,e){if(&quot;function&quot;!=typeof e)throw new ie(a);return t=js(t),function(){if(--t&lt;1)return e.apply(this,arguments)}},hr.ary=ts,hr.assign=Hs,hr.assignIn=$s,hr.assignInWith=Ks,hr.assignWith=Ys,hr.at=Xs,hr.before=es,hr.bind=ns,hr.bindAll=Nu,hr.bindKey=rs,hr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return vs(t)?t:[t]},hr.chain=Va,hr.chunk=function(t,e,n){e=(n?$o(t,e,n):e===r)?1:Wn(js(e),0);var i=null==t?0:t.length;if(!i||e&lt;1)return[];for(var o=0,a=0,s=Xt(Fn(i/e));o&lt;i;)s[a++]=Ii(t,o,o+=e);return s},hr.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e&lt;n;){var o=t[e];o&amp;&amp;(i[r++]=o)}return i},hr.concat=function(){var t=arguments.length;if(!t)return[];for(var e=Xt(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return Qe(vs(n)?no(n):[n],Gr(e,1))},hr.cond=function(t){var e=null==t?0:t.length,n=zo();return t=e?Ze(t,function(t){if(&quot;function&quot;!=typeof t[1])throw new ie(a);return[n(t[0]),t[1]]}):[],Ei(function(n){for(var r=-1;++r&lt;e;){var i=t[r];if(Ue(i[0],this,n))return Ue(i[1],this,n)}})},hr.conforms=function(t){return function(t){var e=iu(t);return function(n){return zr(n,t,e)}}(Dr(t,c))},hr.constant=Su,hr.countBy=qa,hr.create=function(t,e){var n=dr(t);return null==e?n:Or(n,e)},hr.curry=function t(e,n,i){var o=To(e,y,r,r,r,r,r,n=i?r:n);return o.placeholder=t.placeholder,o},hr.curryRight=function t(e,n,i){var o=To(e,b,r,r,r,r,r,n=i?r:n);return o.placeholder=t.placeholder,o},hr.debounce=is,hr.defaults=Zs,hr.defaultsDeep=Qs,hr.defer=os,hr.delay=as,hr.difference=ha,hr.differenceBy=da,hr.differenceWith=ma,hr.drop=function(t,e,n){var i=null==t?0:t.length;return i?Ii(t,(e=n||e===r?1:js(e))&lt;0?0:e,i):[]},hr.dropRight=function(t,e,n){var i=null==t?0:t.length;return i?Ii(t,0,(e=i-(e=n||e===r?1:js(e)))&lt;0?0:e):[]},hr.dropRightWhile=function(t,e){return t&amp;&amp;t.length?Bi(t,zo(e,3),!0,!0):[]},hr.dropWhile=function(t,e){return t&amp;&amp;t.length?Bi(t,zo(e,3),!0):[]},hr.fill=function(t,e,n,i){var o=null==t?0:t.length;return o?(n&amp;&amp;&quot;number&quot;!=typeof n&amp;&amp;$o(t,e,n)&amp;&amp;(n=0,i=o),function(t,e,n,i){var o=t.length;for((n=js(n))&lt;0&amp;&amp;(n=-n&gt;o?0:o+n),(i=i===r||i&gt;o?o:js(i))&lt;0&amp;&amp;(i+=o),i=n&gt;i?0:qs(i);n&lt;i;)t[n++]=e;return t}(t,e,n,i)):[]},hr.filter=function(t,e){return(vs(t)?Ke:Ur)(t,zo(e,3))},hr.flatMap=function(t,e){return Gr(Xa(t,e),1)},hr.flatMapDeep=function(t,e){return Gr(Xa(t,e),O)},hr.flatMapDepth=function(t,e,n){return n=n===r?1:js(n),Gr(Xa(t,e),n)},hr.flatten=ya,hr.flattenDeep=function(t){return null!=t&amp;&amp;t.length?Gr(t,O):[]},hr.flattenDepth=function(t,e){return null!=t&amp;&amp;t.length?Gr(t,e=e===r?1:js(e)):[]},hr.flip=function(t){return To(t,k)},hr.flow=Cu,hr.flowRight=Au,hr.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e&lt;n;){var i=t[e];r[i[0]]=i[1]}return r},hr.functions=function(t){return null==t?[]:Yr(t,iu(t))},hr.functionsIn=function(t){return null==t?[]:Yr(t,ou(t))},hr.groupBy=$a,hr.initial=function(t){return null!=t&amp;&amp;t.length?Ii(t,0,-1):[]},hr.intersection=_a,hr.intersectionBy=wa,hr.intersectionWith=xa,hr.invert=eu,hr.invertBy=nu,hr.invokeMap=Ka,hr.iteratee=Ou,hr.keyBy=Ya,hr.keys=iu,hr.keysIn=ou,hr.map=Xa,hr.mapKeys=function(t,e){var n={};return e=zo(e,3),$r(t,function(t,r,i){Mr(n,e(t,r,i),t)}),n},hr.mapValues=function(t,e){var n={};return e=zo(e,3),$r(t,function(t,r,i){Mr(n,r,e(t,r,i))}),n},hr.matches=function(t){return hi(Dr(t,c))},hr.matchesProperty=function(t,e){return di(t,Dr(e,c))},hr.memoize=ss,hr.merge=au,hr.mergeWith=su,hr.method=Mu,hr.methodOf=Ru,hr.mixin=Pu,hr.negate=us,hr.nthArg=function(t){return t=js(t),Ei(function(e){return gi(e,t)})},hr.omit=uu,hr.omitBy=function(t,e){return cu(t,us(zo(e)))},hr.once=function(t){return es(2,t)},hr.orderBy=function(t,e,n,i){return null==t?[]:(vs(e)||(e=null==e?[]:[e]),vs(n=i?r:n)||(n=null==n?[]:[n]),vi(t,e,n))},hr.over=zu,hr.overArgs=ls,hr.overEvery=Lu,hr.overSome=Fu,hr.partial=cs,hr.partialRight=fs,hr.partition=Za,hr.pick=lu,hr.pickBy=cu,hr.property=Vu,hr.propertyOf=function(t){return function(e){return null==t?r:Xr(t,e)}},hr.pull=ka,hr.pullAll=Ta,hr.pullAllBy=function(t,e,n){return t&amp;&amp;t.length&amp;&amp;e&amp;&amp;e.length?bi(t,e,zo(n,2)):t},hr.pullAllWith=function(t,e,n){return t&amp;&amp;t.length&amp;&amp;e&amp;&amp;e.length?bi(t,e,r,n):t},hr.pullAt=Na,hr.range=Bu,hr.rangeRight=ju,hr.rearg=ps,hr.reject=function(t,e){return(vs(t)?Ke:Ur)(t,us(zo(e,3)))},hr.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=zo(e,3);++r&lt;o;){var a=t[r];e(a,r,t)&amp;&amp;(n.push(a),i.push(r))}return _i(t,i),n},hr.rest=function(t,e){if(&quot;function&quot;!=typeof t)throw new ie(a);return Ei(t,e=e===r?e:js(e))},hr.reverse=Sa,hr.sampleSize=function(t,e,n){return e=(n?$o(t,e,n):e===r)?1:js(e),(vs(t)?Tr:Ti)(t,e)},hr.set=function(t,e,n){return null==t?t:Ni(t,e,n)},hr.setWith=function(t,e,n,i){return i=&quot;function&quot;==typeof i?i:r,null==t?t:Ni(t,e,n,i)},hr.shuffle=function(t){return(vs(t)?Nr:Ai)(t)},hr.slice=function(t,e,n){var i=null==t?0:t.length;return i?(n&amp;&amp;&quot;number&quot;!=typeof n&amp;&amp;$o(t,e,n)?(e=0,n=i):(e=null==e?0:js(e),n=n===r?i:js(n)),Ii(t,e,n)):[]},hr.sortBy=Qa,hr.sortedUniq=function(t){return t&amp;&amp;t.length?Pi(t):[]},hr.sortedUniqBy=function(t,e){return t&amp;&amp;t.length?Pi(t,zo(e,2)):[]},hr.split=function(t,e,n){return n&amp;&amp;&quot;number&quot;!=typeof n&amp;&amp;$o(t,e,n)&amp;&amp;(e=n=r),(n=n===r?D:n&gt;&gt;&gt;0)?(t=Ws(t))&amp;&amp;(&quot;string&quot;==typeof e||null!=e&amp;&amp;!Ms(e))&amp;&amp;!(e=zi(e))&amp;&amp;En(t)?Ki(In(t),0,n):t.split(e,n):[]},hr.spread=function(t,e){if(&quot;function&quot;!=typeof t)throw new ie(a);return e=null==e?0:Wn(js(e),0),Ei(function(n){var r=n[e],i=Ki(n,0,e);return r&amp;&amp;Qe(i,r),Ue(t,this,i)})},hr.tail=function(t){var e=null==t?0:t.length;return e?Ii(t,1,e):[]},hr.take=function(t,e,n){return t&amp;&amp;t.length?Ii(t,0,(e=n||e===r?1:js(e))&lt;0?0:e):[]},hr.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?Ii(t,(e=i-(e=n||e===r?1:js(e)))&lt;0?0:e,i):[]},hr.takeRightWhile=function(t,e){return t&amp;&amp;t.length?Bi(t,zo(e,3),!1,!0):[]},hr.takeWhile=function(t,e){return t&amp;&amp;t.length?Bi(t,zo(e,3)):[]},hr.tap=function(t,e){return e(t),t},hr.throttle=function(t,e,n){var r=!0,i=!0;if(&quot;function&quot;!=typeof t)throw new ie(a);return Ss(n)&amp;&amp;(r=&quot;leading&quot;in n?!!n.leading:r,i=&quot;trailing&quot;in n?!!n.trailing:i),is(t,e,{leading:r,maxWait:e,trailing:i})},hr.thru=Ba,hr.toArray=Vs,hr.toPairs=fu,hr.toPairsIn=pu,hr.toPath=function(t){return vs(t)?Ze(t,ca):Ds(t)?[t]:no(la(Ws(t)))},hr.toPlainObject=Gs,hr.transform=function(t,e,n){var r=vs(t),i=r||ws(t)||zs(t);if(e=zo(e,4),null==n){var o=t&amp;&amp;t.constructor;n=i?r?new o:[]:Ss(t)&amp;&amp;ks(o)?dr(Me(t)):{}}return(i?We:$r)(t,function(t,r,i){return e(n,t,r,i)}),n},hr.unary=function(t){return ts(t,1)},hr.union=Ca,hr.unionBy=Aa,hr.unionWith=Ia,hr.uniq=function(t){return t&amp;&amp;t.length?Li(t):[]},hr.uniqBy=function(t,e){return t&amp;&amp;t.length?Li(t,zo(e,2)):[]},hr.uniqWith=function(t,e){return e=&quot;function&quot;==typeof e?e:r,t&amp;&amp;t.length?Li(t,r,e):[]},hr.unset=function(t,e){return null==t||Fi(t,e)},hr.unzip=Oa,hr.unzipWith=Ma,hr.update=function(t,e,n){return null==t?t:Vi(t,e,Wi(n))},hr.updateWith=function(t,e,n,i){return i=&quot;function&quot;==typeof i?i:r,null==t?t:Vi(t,e,Wi(n),i)},hr.values=hu,hr.valuesIn=function(t){return null==t?[]:gn(t,ou(t))},hr.without=Ra,hr.words=ku,hr.wrap=function(t,e){return cs(Wi(e),t)},hr.xor=Pa,hr.xorBy=Da,hr.xorWith=za,hr.zip=La,hr.zipObject=function(t,e){return Ui(t||[],e||[],Cr)},hr.zipObjectDeep=function(t,e){return Ui(t||[],e||[],Ni)},hr.zipWith=Fa,hr.entries=fu,hr.entriesIn=pu,hr.extend=$s,hr.extendWith=Ks,Pu(hr,hr),hr.add=Gu,hr.attempt=Tu,hr.camelCase=du,hr.capitalize=mu,hr.ceil=Wu,hr.clamp=function(t,e,n){return n===r&amp;&amp;(n=e,e=r),n!==r&amp;&amp;(n=(n=Us(n))==n?n:0),e!==r&amp;&amp;(e=(e=Us(e))==e?e:0),Pr(Us(t),e,n)},hr.clone=function(t){return Dr(t,p)},hr.cloneDeep=function(t){return Dr(t,c|p)},hr.cloneDeepWith=function(t,e){return Dr(t,c|p,e=&quot;function&quot;==typeof e?e:r)},hr.cloneWith=function(t,e){return Dr(t,p,e=&quot;function&quot;==typeof e?e:r)},hr.conformsTo=function(t,e){return null==e||zr(t,e,iu(e))},hr.deburr=gu,hr.defaultTo=function(t,e){return null==t||t!=t?e:t},hr.divide=Hu,hr.endsWith=function(t,e,n){t=Ws(t),e=zi(e);var i=t.length,o=n=n===r?i:Pr(js(n),0,i);return(n-=e.length)&gt;=0&amp;&amp;t.slice(n,o)==e},hr.eq=hs,hr.escape=function(t){return(t=Ws(t))&amp;&amp;Et.test(t)?t.replace(wt,wn):t},hr.escapeRegExp=function(t){return(t=Ws(t))&amp;&amp;Ot.test(t)?t.replace(It,&quot;\\$&amp;&quot;):t},hr.every=function(t,e,n){var i=vs(t)?$e:jr;return n&amp;&amp;$o(t,e,n)&amp;&amp;(e=r),i(t,zo(e,3))},hr.find=Ua,hr.findIndex=ga,hr.findKey=function(t,e){return rn(t,zo(e,3),$r)},hr.findLast=Ga,hr.findLastIndex=va,hr.findLastKey=function(t,e){return rn(t,zo(e,3),Kr)},hr.floor=$u,hr.forEach=Wa,hr.forEachRight=Ha,hr.forIn=function(t,e){return null==t?t:Wr(t,zo(e,3),ou)},hr.forInRight=function(t,e){return null==t?t:Hr(t,zo(e,3),ou)},hr.forOwn=function(t,e){return t&amp;&amp;$r(t,zo(e,3))},hr.forOwnRight=function(t,e){return t&amp;&amp;Kr(t,zo(e,3))},hr.get=Js,hr.gt=ds,hr.gte=ms,hr.has=function(t,e){return null!=t&amp;&amp;Uo(t,e,ti)},hr.hasIn=tu,hr.head=ba,hr.identity=Iu,hr.includes=function(t,e,n,r){t=bs(t)?t:hu(t),n=n&amp;&amp;!r?js(n):0;var i=t.length;return n&lt;0&amp;&amp;(n=Wn(i+n,0)),Ps(t)?n&lt;=i&amp;&amp;t.indexOf(e,n)&gt;-1:!!i&amp;&amp;an(t,e,n)&gt;-1},hr.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:js(n);return i&lt;0&amp;&amp;(i=Wn(r+i,0)),an(t,e,i)},hr.inRange=function(t,e,n){return e=Bs(e),n===r?(n=e,e=0):n=Bs(n),function(t,e,n){return t&gt;=Hn(e,n)&amp;&amp;t&lt;Wn(e,n)}(t=Us(t),e,n)},hr.invoke=ru,hr.isArguments=gs,hr.isArray=vs,hr.isArrayBuffer=ys,hr.isArrayLike=bs,hr.isArrayLikeObject=_s,hr.isBoolean=function(t){return!0===t||!1===t||Cs(t)&amp;&amp;Qr(t)==q},hr.isBuffer=ws,hr.isDate=xs,hr.isElement=function(t){return Cs(t)&amp;&amp;1===t.nodeType&amp;&amp;!Os(t)},hr.isEmpty=function(t){if(null==t)return!0;if(bs(t)&amp;&amp;(vs(t)||&quot;string&quot;==typeof t||&quot;function&quot;==typeof t.splice||ws(t)||zs(t)||gs(t)))return!t.length;var e=qo(t);if(e==K||e==tt)return!t.size;if(Zo(t))return!li(t).length;for(var n in t)if(ce.call(t,n))return!1;return!0},hr.isEqual=function(t,e){return oi(t,e)},hr.isEqualWith=function(t,e,n){var i=(n=&quot;function&quot;==typeof n?n:r)?n(t,e):r;return i===r?oi(t,e,r,n):!!i},hr.isError=Es,hr.isFinite=function(t){return&quot;number&quot;==typeof t&amp;&amp;qn(t)},hr.isFunction=ks,hr.isInteger=Ts,hr.isLength=Ns,hr.isMap=As,hr.isMatch=function(t,e){return t===e||ai(t,e,Fo(e))},hr.isMatchWith=function(t,e,n){return n=&quot;function&quot;==typeof n?n:r,ai(t,e,Fo(e),n)},hr.isNaN=function(t){return Is(t)&amp;&amp;t!=+t},hr.isNative=function(t){if(Xo(t))throw new Qt(o);return si(t)},hr.isNil=function(t){return null==t},hr.isNull=function(t){return null===t},hr.isNumber=Is,hr.isObject=Ss,hr.isObjectLike=Cs,hr.isPlainObject=Os,hr.isRegExp=Ms,hr.isSafeInteger=function(t){return Ts(t)&amp;&amp;t&gt;=-M&amp;&amp;t&lt;=M},hr.isSet=Rs,hr.isString=Ps,hr.isSymbol=Ds,hr.isTypedArray=zs,hr.isUndefined=function(t){return t===r},hr.isWeakMap=function(t){return Cs(t)&amp;&amp;qo(t)==it},hr.isWeakSet=function(t){return Cs(t)&amp;&amp;Qr(t)==ot},hr.join=function(t,e){return null==t?&quot;&quot;:Un.call(t,e)},hr.kebabCase=vu,hr.last=Ea,hr.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i;return n!==r&amp;&amp;(o=(o=js(n))&lt;0?Wn(i+o,0):Hn(o,i-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):on(t,un,o,!0)},hr.lowerCase=yu,hr.lowerFirst=bu,hr.lt=Ls,hr.lte=Fs,hr.max=function(t){return t&amp;&amp;t.length?qr(t,Iu,Jr):r},hr.maxBy=function(t,e){return t&amp;&amp;t.length?qr(t,zo(e,2),Jr):r},hr.mean=function(t){return ln(t,Iu)},hr.meanBy=function(t,e){return ln(t,zo(e,2))},hr.min=function(t){return t&amp;&amp;t.length?qr(t,Iu,fi):r},hr.minBy=function(t,e){return t&amp;&amp;t.length?qr(t,zo(e,2),fi):r},hr.stubArray=qu,hr.stubFalse=Uu,hr.stubObject=function(){return{}},hr.stubString=function(){return&quot;&quot;},hr.stubTrue=function(){return!0},hr.multiply=Yu,hr.nth=function(t,e){return t&amp;&amp;t.length?gi(t,js(e)):r},hr.noConflict=function(){return Oe._===this&amp;&amp;(Oe._=me),this},hr.noop=Du,hr.now=Ja,hr.pad=function(t,e,n){t=Ws(t);var r=(e=js(e))?An(t):0;if(!e||r&gt;=e)return t;var i=(e-r)/2;return yo(Vn(i),n)+t+yo(Fn(i),n)},hr.padEnd=function(t,e,n){t=Ws(t);var r=(e=js(e))?An(t):0;return e&amp;&amp;r&lt;e?t+yo(e-r,n):t},hr.padStart=function(t,e,n){t=Ws(t);var r=(e=js(e))?An(t):0;return e&amp;&amp;r&lt;e?yo(e-r,n)+t:t},hr.parseInt=function(t,e,n){return n||null==e?e=0:e&amp;&amp;(e=+e),Kn(Ws(t).replace(Rt,&quot;&quot;),e||0)},hr.random=function(t,e,n){if(n&amp;&amp;&quot;boolean&quot;!=typeof n&amp;&amp;$o(t,e,n)&amp;&amp;(e=n=r),n===r&amp;&amp;(&quot;boolean&quot;==typeof e?(n=e,e=r):&quot;boolean&quot;==typeof t&amp;&amp;(n=t,t=r)),t===r&amp;&amp;e===r?(t=0,e=1):(t=Bs(t),e===r?(e=t,t=0):e=Bs(e)),t&gt;e){var i=t;t=e,e=i}if(n||t%1||e%1){var o=Yn();return Hn(t+o*(e-t+Se(&quot;1e-&quot;+((o+&quot;&quot;).length-1))),e)}return wi(t,e)},hr.reduce=function(t,e,n){var r=vs(t)?Je:pn,i=arguments.length&lt;3;return r(t,zo(e,4),n,i,Vr)},hr.reduceRight=function(t,e,n){var r=vs(t)?tn:pn,i=arguments.length&lt;3;return r(t,zo(e,4),n,i,Br)},hr.repeat=function(t,e,n){return e=(n?$o(t,e,n):e===r)?1:js(e),xi(Ws(t),e)},hr.replace=function(){var t=arguments,e=Ws(t[0]);return t.length&lt;3?e:e.replace(t[1],t[2])},hr.result=function(t,e,n){var i=-1,o=(e=Hi(e,t)).length;for(o||(o=1,t=r);++i&lt;o;){var a=null==t?r:t[ca(e[i])];a===r&amp;&amp;(i=o,a=n),t=ks(a)?a.call(t):a}return t},hr.round=Xu,hr.runInContext=t,hr.sample=function(t){return(vs(t)?kr:ki)(t)},hr.size=function(t){if(null==t)return 0;if(bs(t))return Ps(t)?An(t):t.length;var e=qo(t);return e==K||e==tt?t.size:li(t).length},hr.snakeCase=_u,hr.some=function(t,e,n){var i=vs(t)?en:Oi;return n&amp;&amp;$o(t,e,n)&amp;&amp;(e=r),i(t,zo(e,3))},hr.sortedIndex=function(t,e){return Mi(t,e)},hr.sortedIndexBy=function(t,e,n){return Ri(t,e,zo(n,2))},hr.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=Mi(t,e);if(r&lt;n&amp;&amp;hs(t[r],e))return r}return-1},hr.sortedLastIndex=function(t,e){return Mi(t,e,!0)},hr.sortedLastIndexBy=function(t,e,n){return Ri(t,e,zo(n,2),!0)},hr.sortedLastIndexOf=function(t,e){if(null!=t&amp;&amp;t.length){var n=Mi(t,e,!0)-1;if(hs(t[n],e))return n}return-1},hr.startCase=wu,hr.startsWith=function(t,e,n){return t=Ws(t),n=null==n?0:Pr(js(n),0,t.length),e=zi(e),t.slice(n,n+e.length)==e},hr.subtract=Zu,hr.sum=function(t){return t&amp;&amp;t.length?hn(t,Iu):0},hr.sumBy=function(t,e){return t&amp;&amp;t.length?hn(t,zo(e,2)):0},hr.template=function(t,e,n){var i=hr.templateSettings;n&amp;&amp;$o(t,e,n)&amp;&amp;(e=r),t=Ws(t),e=Ks({},e,i,No);var o,a,s=Ks({},e.imports,i.imports,No),u=iu(s),l=gn(s,u),c=0,f=e.interpolate||Kt,p=&quot;__p += &apos;&quot;,h=ne((e.escape||Kt).source+&quot;|&quot;+f.source+&quot;|&quot;+(f===Nt?Bt:Kt).source+&quot;|&quot;+(e.evaluate||Kt).source+&quot;|$&quot;,&quot;g&quot;),d=&quot;//# sourceURL=&quot;+(&quot;sourceURL&quot;in e?e.sourceURL:&quot;lodash.templateSources[&quot;+ ++Ee+&quot;]&quot;)+&quot;\n&quot;;t.replace(h,function(e,n,r,i,s,u){return r||(r=i),p+=t.slice(c,u).replace(Yt,xn),n&amp;&amp;(o=!0,p+=&quot;&apos; +\n__e(&quot;+n+&quot;) +\n&apos;&quot;),s&amp;&amp;(a=!0,p+=&quot;&apos;;\n&quot;+s+&quot;;\n__p += &apos;&quot;),r&amp;&amp;(p+=&quot;&apos; +\n((__t = (&quot;+r+&quot;)) == null ? &apos;&apos; : __t) +\n&apos;&quot;),c=u+e.length,e}),p+=&quot;&apos;;\n&quot;;var m=e.variable;m||(p=&quot;with (obj) {\n&quot;+p+&quot;\n}\n&quot;),p=(a?p.replace(vt,&quot;&quot;):p).replace(yt,&quot;$1&quot;).replace(bt,&quot;$1;&quot;),p=&quot;function(&quot;+(m||&quot;obj&quot;)+&quot;) {\n&quot;+(m?&quot;&quot;:&quot;obj || (obj = {});\n&quot;)+&quot;var __t, __p = &apos;&apos;&quot;+(o?&quot;, __e = _.escape&quot;:&quot;&quot;)+(a?&quot;, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, &apos;&apos;) }\n&quot;:&quot;;\n&quot;)+p+&quot;return __p\n}&quot;;var g=Tu(function(){return Jt(u,d+&quot;return &quot;+p).apply(r,l)});if(g.source=p,Es(g))throw g;return g},hr.times=function(t,e){if((t=js(t))&lt;1||t&gt;M)return[];var n=D,r=Hn(t,D);e=zo(e),t-=D;for(var i=dn(r,e);++n&lt;t;)e(n);return i},hr.toFinite=Bs,hr.toInteger=js,hr.toLength=qs,hr.toLower=function(t){return Ws(t).toLowerCase()},hr.toNumber=Us,hr.toSafeInteger=function(t){return t?Pr(js(t),-M,M):0===t?t:0},hr.toString=Ws,hr.toUpper=function(t){return Ws(t).toUpperCase()},hr.trim=function(t,e,n){if((t=Ws(t))&amp;&amp;(n||e===r))return t.replace(Mt,&quot;&quot;);if(!t||!(e=zi(e)))return t;var i=In(t),o=In(e);return Ki(i,yn(i,o),bn(i,o)+1).join(&quot;&quot;)},hr.trimEnd=function(t,e,n){if((t=Ws(t))&amp;&amp;(n||e===r))return t.replace(Pt,&quot;&quot;);if(!t||!(e=zi(e)))return t;var i=In(t);return Ki(i,0,bn(i,In(e))+1).join(&quot;&quot;)},hr.trimStart=function(t,e,n){if((t=Ws(t))&amp;&amp;(n||e===r))return t.replace(Rt,&quot;&quot;);if(!t||!(e=zi(e)))return t;var i=In(t);return Ki(i,yn(i,In(e))).join(&quot;&quot;)},hr.truncate=function(t,e){var n=T,i=N;if(Ss(e)){var o=&quot;separator&quot;in e?e.separator:o;n=&quot;length&quot;in e?js(e.length):n,i=&quot;omission&quot;in e?zi(e.omission):i}var a=(t=Ws(t)).length;if(En(t)){var s=In(t);a=s.length}if(n&gt;=a)return t;var u=n-An(i);if(u&lt;1)return i;var l=s?Ki(s,0,u).join(&quot;&quot;):t.slice(0,u);if(o===r)return l+i;if(s&amp;&amp;(u+=l.length-u),Ms(o)){if(t.slice(u).search(o)){var c,f=l;for(o.global||(o=ne(o.source,Ws(jt.exec(o))+&quot;g&quot;)),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===r?u:p)}}else if(t.indexOf(zi(o),u)!=u){var h=l.lastIndexOf(o);h&gt;-1&amp;&amp;(l=l.slice(0,h))}return l+i},hr.unescape=function(t){return(t=Ws(t))&amp;&amp;xt.test(t)?t.replace(_t,On):t},hr.uniqueId=function(t){var e=++fe;return Ws(t)+e},hr.upperCase=xu,hr.upperFirst=Eu,hr.each=Wa,hr.eachRight=Ha,hr.first=ba,Pu(hr,(Ku={},$r(hr,function(t,e){ce.call(hr.prototype,e)||(Ku[e]=t)}),Ku),{chain:!1}),hr.VERSION=&quot;4.17.11&quot;,We([&quot;bind&quot;,&quot;bindKey&quot;,&quot;curry&quot;,&quot;curryRight&quot;,&quot;partial&quot;,&quot;partialRight&quot;],function(t){hr[t].placeholder=hr}),We([&quot;drop&quot;,&quot;take&quot;],function(t,e){vr.prototype[t]=function(n){n=n===r?1:Wn(js(n),0);var i=this.__filtered__&amp;&amp;!e?new vr(this):this.clone();return i.__filtered__?i.__takeCount__=Hn(n,i.__takeCount__):i.__views__.push({size:Hn(n,D),type:t+(i.__dir__&lt;0?&quot;Right&quot;:&quot;&quot;)}),i},vr.prototype[t+&quot;Right&quot;]=function(e){return this.reverse()[t](e).reverse()}}),We([&quot;filter&quot;,&quot;map&quot;,&quot;takeWhile&quot;],function(t,e){var n=e+1,r=n==A||3==n;vr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:zo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),We([&quot;head&quot;,&quot;last&quot;],function(t,e){var n=&quot;take&quot;+(e?&quot;Right&quot;:&quot;&quot;);vr.prototype[t]=function(){return this[n](1).value()[0]}}),We([&quot;initial&quot;,&quot;tail&quot;],function(t,e){var n=&quot;drop&quot;+(e?&quot;&quot;:&quot;Right&quot;);vr.prototype[t]=function(){return this.__filtered__?new vr(this):this[n](1)}}),vr.prototype.compact=function(){return this.filter(Iu)},vr.prototype.find=function(t){return this.filter(t).head()},vr.prototype.findLast=function(t){return this.reverse().find(t)},vr.prototype.invokeMap=Ei(function(t,e){return&quot;function&quot;==typeof t?new vr(this):this.map(function(n){return ri(n,t,e)})}),vr.prototype.reject=function(t){return this.filter(us(zo(t)))},vr.prototype.slice=function(t,e){t=js(t);var n=this;return n.__filtered__&amp;&amp;(t&gt;0||e&lt;0)?new vr(n):(t&lt;0?n=n.takeRight(-t):t&amp;&amp;(n=n.drop(t)),e!==r&amp;&amp;(n=(e=js(e))&lt;0?n.dropRight(-e):n.take(e-t)),n)},vr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},vr.prototype.toArray=function(){return this.take(D)},$r(vr.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=hr[i?&quot;take&quot;+(&quot;last&quot;==e?&quot;Right&quot;:&quot;&quot;):e],a=i||/^find/.test(e);o&amp;&amp;(hr.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,u=e instanceof vr,l=s[0],c=u||vs(e),f=function(t){var e=o.apply(hr,Qe([t],s));return i&amp;&amp;p?e[0]:e};c&amp;&amp;n&amp;&amp;&quot;function&quot;==typeof l&amp;&amp;1!=l.length&amp;&amp;(u=c=!1);var p=this.__chain__,h=!!this.__actions__.length,d=a&amp;&amp;!p,m=u&amp;&amp;!h;if(!a&amp;&amp;c){e=m?e:new vr(this);var g=t.apply(e,s);return g.__actions__.push({func:Ba,args:[f],thisArg:r}),new gr(g,p)}return d&amp;&amp;m?t.apply(this,s):(g=this.thru(f),d?i?g.value()[0]:g.value():g)})}),We([&quot;pop&quot;,&quot;push&quot;,&quot;shift&quot;,&quot;sort&quot;,&quot;splice&quot;,&quot;unshift&quot;],function(t){var e=oe[t],n=/^(?:push|sort|unshift)$/.test(t)?&quot;tap&quot;:&quot;thru&quot;,r=/^(?:pop|shift)$/.test(t);hr.prototype[t]=function(){var t=arguments;if(r&amp;&amp;!this.__chain__){var i=this.value();return e.apply(vs(i)?i:[],t)}return this[n](function(n){return e.apply(vs(n)?n:[],t)})}}),$r(vr.prototype,function(t,e){var n=hr[e];if(n){var r=n.name+&quot;&quot;;(ir[r]||(ir[r]=[])).push({name:e,func:n})}}),ir[ho(r,g).name]=[{name:&quot;wrapper&quot;,func:r}],vr.prototype.clone=function(){var t=new vr(this.__wrapped__);return t.__actions__=no(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=no(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=no(this.__views__),t},vr.prototype.reverse=function(){if(this.__filtered__){var t=new vr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},vr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=vs(t),r=e&lt;0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r&lt;i;){var o=n[r],a=o.size;switch(o.type){case&quot;drop&quot;:t+=a;break;case&quot;dropRight&quot;:e-=a;break;case&quot;take&quot;:e=Hn(e,t+a);break;case&quot;takeRight&quot;:t=Wn(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,l=r?s:a-1,c=this.__iteratees__,f=c.length,p=0,h=Hn(u,this.__takeCount__);if(!n||!r&amp;&amp;i==u&amp;&amp;h==u)return ji(t,this.__actions__);var d=[];t:for(;u--&amp;&amp;p&lt;h;){for(var m=-1,g=t[l+=e];++m&lt;f;){var v=c[m],y=v.iteratee,b=v.type,_=y(g);if(b==I)g=_;else if(!_){if(b==A)continue t;break t}}d[p++]=g}return d},hr.prototype.at=ja,hr.prototype.chain=function(){return Va(this)},hr.prototype.commit=function(){return new gr(this.value(),this.__chain__)},hr.prototype.next=function(){this.__values__===r&amp;&amp;(this.__values__=Vs(this.value()));var t=this.__index__&gt;=this.__values__.length;return{done:t,value:t?r:this.__values__[this.__index__++]}},hr.prototype.plant=function(t){for(var e,n=this;n instanceof mr;){var i=pa(n);i.__index__=0,i.__values__=r,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e},hr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof vr){var e=t;return this.__actions__.length&amp;&amp;(e=new vr(this)),(e=e.reverse()).__actions__.push({func:Ba,args:[Sa],thisArg:r}),new gr(e,this.__chain__)}return this.thru(Sa)},hr.prototype.toJSON=hr.prototype.valueOf=hr.prototype.value=function(){return ji(this.__wrapped__,this.__actions__)},hr.prototype.first=hr.prototype.head,fn&amp;&amp;(hr.prototype[fn]=function(){return this}),hr}();&quot;function&quot;==typeof define&amp;&amp;&quot;object&quot;==typeof define.amd&amp;&amp;define.amd?(Oe._=Mn,define(function(){return Mn})):Re?((Re.exports=Mn)._=Mn,Me._=Mn):Oe._=Mn}).call(this)}).call(this,&quot;undefined&quot;!=typeof global?global:&quot;undefined&quot;!=typeof self?self:&quot;undefined&quot;!=typeof window?window:{})},{}],338:[function(t,e,n){var r,i,o=e.exports={};function a(){throw new Error(&quot;setTimeout has not been defined&quot;)}function s(){throw new Error(&quot;clearTimeout has not been defined&quot;)}function u(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&amp;&amp;setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r=&quot;function&quot;==typeof setTimeout?setTimeout:a}catch(t){r=a}try{i=&quot;function&quot;==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var l,c=[],f=!1,p=-1;function h(){f&amp;&amp;l&amp;&amp;(f=!1,l.length?c=l.concat(c):p=-1,c.length&amp;&amp;d())}function d(){if(!f){var t=u(h);f=!0;for(var e=c.length;e;){for(l=c,c=[];++p&lt;e;)l&amp;&amp;l[p].run();p=-1,e=c.length}l=null,f=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===s||!i)&amp;&amp;clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function m(t,e){this.fun=t,this.array=e}function g(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length&gt;1)for(var n=1;n&lt;arguments.length;n++)e[n-1]=arguments[n];c.push(new m(t,e)),1!==c.length||f||u(d)},m.prototype.run=function(){this.fun.apply(null,this.array)},o.title=&quot;browser&quot;,o.browser=!0,o.env={},o.argv=[],o.version=&quot;&quot;,o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(t){return[]},o.binding=function(t){throw new Error(&quot;process.binding is not supported&quot;)},o.cwd=function(){return&quot;/&quot;},o.chdir=function(t){throw new Error(&quot;process.chdir is not supported&quot;)},o.umask=function(){return 0}},{}],339:[function(t,e,n){&quot;use strict&quot;;var r=0;function i(t,e){var n=e.data;if(Array.isArray(n)&amp;&amp;!(n.length&lt;2)){var r=n[0],i=n[1],o=n[2],a=t._callbacks[r];a&amp;&amp;(delete t._callbacks[r],a(i,o))}}function o(t){var e=this;e._worker=t,e._callbacks={},t.addEventListener(&quot;message&quot;,function(t){i(e,t)})}o.prototype.postMessage=function(t){var e=this,n=r++,o=[n,t];return new Promise(function(t,r){if(e._callbacks[n]=function(e,n){if(e)return r(new Error(e.message));t(n)},void 0!==e._worker.controller){var a=new MessageChannel;a.port1.onmessage=function(t){i(e,t)},e._worker.controller.postMessage(o,[a.port2])}else e._worker.postMessage(o)})},e.exports=o},{}],340:[function(t,e,n){var r=t(&quot;./lib/alea&quot;),i=t(&quot;./lib/xor128&quot;),o=t(&quot;./lib/xorwow&quot;),a=t(&quot;./lib/xorshift7&quot;),s=t(&quot;./lib/xor4096&quot;),u=t(&quot;./lib/tychei&quot;),l=t(&quot;./seedrandom&quot;);l.alea=r,l.xor128=i,l.xorwow=o,l.xorshift7=a,l.xor4096=s,l.tychei=u,e.exports=l},{&quot;./lib/alea&quot;:341,&quot;./lib/tychei&quot;:342,&quot;./lib/xor128&quot;:343,&quot;./lib/xor4096&quot;:344,&quot;./lib/xorshift7&quot;:345,&quot;./lib/xorwow&quot;:346,&quot;./seedrandom&quot;:347}],341:[function(t,e,n){!function(t,e,n){function r(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function i(t,e){var n=new function(t){var e,n=this,r=(e=4022871197,function(t){t=t.toString();for(var n=0;n&lt;t.length;n++){var r=.02519603282416938*(e+=t.charCodeAt(n));r-=e=r&gt;&gt;&gt;0,e=(r*=e)&gt;&gt;&gt;0,e+=4294967296*(r-=e)}return 2.3283064365386963e-10*(e&gt;&gt;&gt;0)});n.next=function(){var t=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=t-(n.c=0|t)},n.c=1,n.s0=r(&quot; &quot;),n.s1=r(&quot; &quot;),n.s2=r(&quot; &quot;),n.s0-=r(t),n.s0&lt;0&amp;&amp;(n.s0+=1),n.s1-=r(t),n.s1&lt;0&amp;&amp;(n.s1+=1),n.s2-=r(t),n.s2&lt;0&amp;&amp;(n.s2+=1),r=null}(t),i=e&amp;&amp;e.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+1.1102230246251565e-16*(2097152*o()|0)},o.quick=o,i&amp;&amp;(&quot;object&quot;==typeof i&amp;&amp;r(i,n),o.state=function(){return r(n,{})}),o}e&amp;&amp;e.exports?e.exports=i:n&amp;&amp;n.amd?n(function(){return i}):this.alea=i}(0,&quot;object&quot;==typeof e&amp;&amp;e,&quot;function&quot;==typeof define&amp;&amp;define)},{}],342:[function(t,e,n){!function(t,e,n){function r(t,e){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e}function i(t,e){var n=new function(t){var e=this,n=&quot;&quot;;e.next=function(){var t=e.b,n=e.c,r=e.d,i=e.a;return t=t&lt;&lt;25^t&gt;&gt;&gt;7^n,n=n-r|0,r=r&lt;&lt;24^r&gt;&gt;&gt;8^i,i=i-t|0,e.b=t=t&lt;&lt;20^t&gt;&gt;&gt;12^n,e.c=n=n-r|0,e.d=r&lt;&lt;16^n&gt;&gt;&gt;16^i,e.a=i-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):n+=t;for(var r=0;r&lt;n.length+20;r++)e.b^=0|n.charCodeAt(r),e.next()}(t),i=e&amp;&amp;e.state,o=function(){return(n.next()&gt;&gt;&gt;0)/4294967296};return o.double=function(){do{var t=((n.next()&gt;&gt;&gt;11)+(n.next()&gt;&gt;&gt;0)/4294967296)/(1&lt;&lt;21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&amp;&amp;(&quot;object&quot;==typeof i&amp;&amp;r(i,n),o.state=function(){return r(n,{})}),o}e&amp;&amp;e.exports?e.exports=i:n&amp;&amp;n.amd?n(function(){return i}):this.tychei=i}(0,&quot;object&quot;==typeof e&amp;&amp;e,&quot;function&quot;==typeof define&amp;&amp;define)},{}],343:[function(t,e,n){!function(t,e,n){function r(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e}function i(t,e){var n=new function(t){var e=this,n=&quot;&quot;;e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x&lt;&lt;11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w&gt;&gt;&gt;19^t^t&gt;&gt;&gt;8},t===(0|t)?e.x=t:n+=t;for(var r=0;r&lt;n.length+64;r++)e.x^=0|n.charCodeAt(r),e.next()}(t),i=e&amp;&amp;e.state,o=function(){return(n.next()&gt;&gt;&gt;0)/4294967296};return o.double=function(){do{var t=((n.next()&gt;&gt;&gt;11)+(n.next()&gt;&gt;&gt;0)/4294967296)/(1&lt;&lt;21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&amp;&amp;(&quot;object&quot;==typeof i&amp;&amp;r(i,n),o.state=function(){return r(n,{})}),o}e&amp;&amp;e.exports?e.exports=i:n&amp;&amp;n.amd?n(function(){return i}):this.xor128=i}(0,&quot;object&quot;==typeof e&amp;&amp;e,&quot;function&quot;==typeof define&amp;&amp;define)},{}],344:[function(t,e,n){!function(t,e,n){function r(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function i(t,e){null==t&amp;&amp;(t=+new Date);var n=new function(t){var e=this;e.next=function(){var t,n,r=e.w,i=e.X,o=e.i;return e.w=r=r+1640531527|0,n=i[o+34&amp;127],t=i[o=o+1&amp;127],n^=n&lt;&lt;13,t^=t&lt;&lt;17,n^=n&gt;&gt;&gt;15,t^=t&gt;&gt;&gt;12,n=i[o]=n^t,e.i=o,n+(r^r&gt;&gt;&gt;16)|0},function(t,e){var n,r,i,o,a,s=[],u=128;for(e===(0|e)?(r=e,e=null):(e+=&quot;\0&quot;,r=0,u=Math.max(u,e.length)),i=0,o=-32;o&lt;u;++o)e&amp;&amp;(r^=e.charCodeAt((o+32)%e.length)),0===o&amp;&amp;(a=r),r^=r&lt;&lt;10,r^=r&gt;&gt;&gt;15,r^=r&lt;&lt;4,r^=r&gt;&gt;&gt;13,o&gt;=0&amp;&amp;(a=a+1640531527|0,i=0==(n=s[127&amp;o]^=r+a)?i+1:0);for(i&gt;=128&amp;&amp;(s[127&amp;(e&amp;&amp;e.length||0)]=-1),i=127,o=512;o&gt;0;--o)r=s[i+34&amp;127],n=s[i=i+1&amp;127],r^=r&lt;&lt;13,n^=n&lt;&lt;17,r^=r&gt;&gt;&gt;15,n^=n&gt;&gt;&gt;12,s[i]=r^n;t.w=a,t.X=s,t.i=i}(e,t)}(t),i=e&amp;&amp;e.state,o=function(){return(n.next()&gt;&gt;&gt;0)/4294967296};return o.double=function(){do{var t=((n.next()&gt;&gt;&gt;11)+(n.next()&gt;&gt;&gt;0)/4294967296)/(1&lt;&lt;21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&amp;&amp;(i.X&amp;&amp;r(i,n),o.state=function(){return r(n,{})}),o}e&amp;&amp;e.exports?e.exports=i:n&amp;&amp;n.amd?n(function(){return i}):this.xor4096=i}(0,&quot;object&quot;==typeof e&amp;&amp;e,&quot;function&quot;==typeof define&amp;&amp;define)},{}],345:[function(t,e,n){!function(t,e,n){function r(t,e){return e.x=t.x.slice(),e.i=t.i,e}function i(t,e){null==t&amp;&amp;(t=+new Date);var n=new function(t){var e=this;e.next=function(){var t,n,r=e.x,i=e.i;return t=r[i],n=(t^=t&gt;&gt;&gt;7)^t&lt;&lt;24,n^=(t=r[i+1&amp;7])^t&gt;&gt;&gt;10,n^=(t=r[i+3&amp;7])^t&gt;&gt;&gt;3,n^=(t=r[i+4&amp;7])^t&lt;&lt;7,t=r[i+7&amp;7],n^=(t^=t&lt;&lt;13)^t&lt;&lt;9,r[i]=n,e.i=i+1&amp;7,n},function(t,e){var n,r=[];if(e===(0|e))r[0]=e;else for(e=&quot;&quot;+e,n=0;n&lt;e.length;++n)r[7&amp;n]=r[7&amp;n]&lt;&lt;15^e.charCodeAt(n)+r[n+1&amp;7]&lt;&lt;13;for(;r.length&lt;8;)r.push(0);for(n=0;n&lt;8&amp;&amp;0===r[n];++n);for(8==n?r[7]=-1:r[n],t.x=r,t.i=0,n=256;n&gt;0;--n)t.next()}(e,t)}(t),i=e&amp;&amp;e.state,o=function(){return(n.next()&gt;&gt;&gt;0)/4294967296};return o.double=function(){do{var t=((n.next()&gt;&gt;&gt;11)+(n.next()&gt;&gt;&gt;0)/4294967296)/(1&lt;&lt;21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&amp;&amp;(i.x&amp;&amp;r(i,n),o.state=function(){return r(n,{})}),o}e&amp;&amp;e.exports?e.exports=i:n&amp;&amp;n.amd?n(function(){return i}):this.xorshift7=i}(0,&quot;object&quot;==typeof e&amp;&amp;e,&quot;function&quot;==typeof define&amp;&amp;define)},{}],346:[function(t,e,n){!function(t,e,n){function r(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function i(t,e){var n=new function(t){var e=this,n=&quot;&quot;;e.next=function(){var t=e.x^e.x&gt;&gt;&gt;2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v&lt;&lt;4^t^t&lt;&lt;1)|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,t===(0|t)?e.x=t:n+=t;for(var r=0;r&lt;n.length+64;r++)e.x^=0|n.charCodeAt(r),r==n.length&amp;&amp;(e.d=e.x&lt;&lt;10^e.x&gt;&gt;&gt;4),e.next()}(t),i=e&amp;&amp;e.state,o=function(){return(n.next()&gt;&gt;&gt;0)/4294967296};return o.double=function(){do{var t=((n.next()&gt;&gt;&gt;11)+(n.next()&gt;&gt;&gt;0)/4294967296)/(1&lt;&lt;21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&amp;&amp;(&quot;object&quot;==typeof i&amp;&amp;r(i,n),o.state=function(){return r(n,{})}),o}e&amp;&amp;e.exports?e.exports=i:n&amp;&amp;n.amd?n(function(){return i}):this.xorwow=i}(0,&quot;object&quot;==typeof e&amp;&amp;e,&quot;function&quot;==typeof define&amp;&amp;define)},{}],347:[function(t,e,n){!function(n,r){var i,o=this,a=256,s=6,u=&quot;random&quot;,l=r.pow(a,s),c=r.pow(2,52),f=2*c,p=a-1;function h(t,e,h){var v=[],y=m(function t(e,n){var r,i=[],o=typeof e;if(n&amp;&amp;&quot;object&quot;==o)for(r in e)try{i.push(t(e[r],n-1))}catch(t){}return i.length?i:&quot;string&quot;==o?e:e+&quot;\0&quot;}((e=1==e?{entropy:!0}:e||{}).entropy?[t,g(n)]:null==t?function(){try{var t;return i&amp;&amp;(t=i.randomBytes)?t=t(a):(t=new Uint8Array(a),(o.crypto||o.msCrypto).getRandomValues(t)),g(t)}catch(t){var e=o.navigator,r=e&amp;&amp;e.plugins;return[+new Date,o,r,o.screen,g(n)]}}():t,3),v),b=new function(t){var e,n=t.length,r=this,i=0,o=r.i=r.j=0,s=r.S=[];n||(t=[n++]);for(;i&lt;a;)s[i]=i++;for(i=0;i&lt;a;i++)s[i]=s[o=p&amp;o+t[i%n]+(e=s[i])],s[o]=e;(r.g=function(t){for(var e,n=0,i=r.i,o=r.j,s=r.S;t--;)e=s[i=p&amp;i+1],n=n*a+s[p&amp;(s[i]=s[o=p&amp;o+e])+(s[o]=e)];return r.i=i,r.j=o,n})(a)}(v),_=function(){for(var t=b.g(s),e=l,n=0;t&lt;c;)t=(t+n)*a,e*=a,n=b.g(1);for(;t&gt;=f;)t/=2,e/=2,n&gt;&gt;&gt;=1;return(t+n)/e};return _.int32=function(){return 0|b.g(4)},_.quick=function(){return b.g(4)/4294967296},_.double=_,m(g(b.S),n),(e.pass||h||function(t,e,n,i){return i&amp;&amp;(i.S&amp;&amp;d(i,b),t.state=function(){return d(b,{})}),n?(r[u]=t,e):t})(_,y,&quot;global&quot;in e?e.global:this==r,e.state)}function d(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function m(t,e){for(var n,r=t+&quot;&quot;,i=0;i&lt;r.length;)e[p&amp;i]=p&amp;(n^=19*e[p&amp;i])+r.charCodeAt(i++);return g(e)}function g(t){return String.fromCharCode.apply(0,t)}if(r[&quot;seed&quot;+u]=h,m(r.random(),n),&quot;object&quot;==typeof e&amp;&amp;e.exports){e.exports=h;try{i=t(&quot;crypto&quot;)}catch(t){}}else&quot;function&quot;==typeof define&amp;&amp;define.amd&amp;&amp;define(function(){return h})}([],Math)},{crypto:302}],348:[function(t,e,n){(function(e,r){var i=t(&quot;process/browser.js&quot;).nextTick,o=Function.prototype.apply,a=Array.prototype.slice,s={},u=0;function l(t,e){this._id=t,this._clearFn=e}n.setTimeout=function(){return new l(o.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new l(o.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(t){t.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},n.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},n._unrefActive=n.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e&gt;=0&amp;&amp;(t._idleTimeoutId=setTimeout(function(){t._onTimeout&amp;&amp;t._onTimeout()},e))},n.setImmediate=&quot;function&quot;==typeof e?e:function(t){var e=u++,r=!(arguments.length&lt;2)&amp;&amp;a.call(arguments,1);return s[e]=!0,i(function(){s[e]&amp;&amp;(r?t.apply(null,r):t.call(null),n.clearImmediate(e))}),e},n.clearImmediate=&quot;function&quot;==typeof r?r:function(t){delete s[t]}}).call(this,t(&quot;timers&quot;).setImmediate,t(&quot;timers&quot;).clearImmediate)},{&quot;process/browser.js&quot;:338,timers:348}],349:[function(t,e,n){e.exports.outputs=[{bubble:8.695617641210555,insert:1.6031395599246026,quick:.21912267953157424,tim:.9138642591238022},{bubble:9.021837719976903,insert:2.9958246594667433,quick:2.3424516987800597,tim:.26459737956523893},{bubble:.0041362008452415465,insert:.005773500204086303,quick:4.137045561373234,tim:.006941160559654236},{bubble:.0038737991452217103,insert:.005339759588241577,quick:4.050829581916332,tim:.007267600297927857},{bubble:9.053801460564136,insert:2.939149959683418,quick:.2198181387782097,tim:.19586013972759247},{bubble:6.848497680127621,insert:1.4326007607579232,quick:.3333208605647087,tim:.15499875962734222},{bubble:8.21068628013134,insert:1.501220359802246,quick:.12753469854593277,tim:.4637176609039307},{bubble:8.985219821929931,insert:1.5204876592755319,quick:.1343491804599762,tim:.39800597935914994},{bubble:8.220296601355075,insert:1.4758977392315864,quick:.11845043897628785,tim:.16104171931743622},{bubble:7.2913191395998,insert:1.4292970204353332,quick:.11286658078432082,tim:.1527772805094719},{bubble:7.252827299535275,insert:1.5560283589363098,quick:.32478873908519745,tim:.11277126133441925},{bubble:8.619177058935165,insert:1.4900838404893875,quick:.12905369937419892,tim:.4021609401702881},{bubble:9.169500380456448,insert:3.004220499098301,quick:1.701141400039196,tim:.15803881973028183},{bubble:8.997811381220817,insert:3.004964879155159,quick:.6040228801965714,tim:.17158075869083406},{bubble:7.5102358385920525,insert:1.3583776995539665,quick:.14921543926000594,tim:.10900444090366364},{bubble:6.5399062600731845,insert:1.4702718019485475,quick:.17776010006666185,tim:.1335411411523819},{bubble:8.672187740206718,insert:1.5633626618981362,quick:.1297750198841095,tim:.40252264112234115},{bubble:.003830721080303192,insert:.007544100284576416,quick:4.163623759150505,tim:.006670159101486206},{bubble:.004720599055290222,insert:.005573440194129944,quick:4.097374439537525,tim:.006707699298858643},{bubble:8.178547359406949,insert:1.7963647601008415,quick:.24480757981538773,tim:.16246587932109832},{bubble:8.465907380878924,insert:1.522411559820175,quick:.12960127919912337,tim:.4529390409588814},{bubble:.003586179316043854,insert:.005134259760379792,quick:4.093879898786545,tim:.006642339825630188},{bubble:8.501429300308228,insert:1.5332037797570228,quick:.1253062191605568,tim:.39606931924819944},{bubble:8.45021132171154,insert:1.528492201268673,quick:.1293250796198845,tim:.38099379956722257},{bubble:8.606028141379356,insert:1.5368495997786522,quick:.13177211970090866,tim:.37954953908920286},{bubble:9.410945199429989,insert:3.0678918409347533,quick:.32144138008356093,tim:.21250205963850022},{bubble:.003861198425292969,insert:.00556399941444397,quick:4.228250620961189,tim:.008016179203987122},{bubble:10.114932418465614,insert:3.1705644798278807,quick:.41093346059322355,tim:.22852659970521927},{bubble:9.251607379615306,insert:1.5447203782200813,quick:.13654032051563264,tim:.4082729774713516},{bubble:8.146019859015942,insert:1.3871038794517516,quick:.3045665195584297,tim:.1574212172627449},{bubble:12.370258579850196,insert:2.336699762046337,quick:.219891519844532,tim:.7348395392298699},{bubble:10.477227419614792,insert:1.526483899950981,quick:.1368930408358574,tim:.38964002072811127},{bubble:8.588676798045634,insert:1.5643031194806098,quick:.1351509603857994,tim:.4658614408969879},{bubble:8.064155401587486,insert:1.3092953407764434,quick:.39204719960689544,tim:.12316099911928177},{bubble:7.391693519055844,insert:1.681481100320816,quick:.2798375603556633,tim:.1437833398580551},{bubble:8.928703581094743,insert:1.991264860033989,quick:.15945564061403275,tim:.4342397600412369},{bubble:.003633100390434265,insert:.00528687983751297,quick:5.016873499751091,tim:.008136321306228638},{bubble:.007529700696468353,insert:.008740260303020476,quick:5.631072319149971,tim:.012034619450569153},{bubble:11.895402560532093,insert:4.540679079592228,quick:.5811628201603889,tim:.18799347937107086},{bubble:11.778074198961258,insert:4.6979237994551655,quick:1.1452565386891365,tim:.26203201830387113},{bubble:12.025544179975986,insert:3.278237321078777,quick:.2670939210057259,tim:.22721487998962403},{bubble:9.849590778648853,insert:3.1290690207481386,quick:.2620827403664589,tim:.18918455988168717},{bubble:6.271630119681358,insert:1.5610168001055718,quick:.17442052006721498,tim:.1550564393401146},{bubble:11.482597178220749,insert:3.5990996792912484,quick:.413130621612072,tim:.26436463981866837},{bubble:.00424680083990097,insert:.00600766122341156,quick:4.63885182082653,tim:.006944379508495331},{bubble:8.260420159399509,insert:1.84265998005867,quick:.1921721813082695,tim:.19133371949195863},{bubble:9.468893820047379,insert:2.9717616599798204,quick:.18964892148971557,tim:.2049117788672447},{bubble:8.618308359980583,insert:1.4690410593152046,quick:.12782106012105943,tim:.39422504007816317},{bubble:9.58249467998743,insert:2.119512120783329,quick:.17230694115161896,tim:.45001911908388137},{bubble:8.605553199350833,insert:1.6088901814818382,quick:.305594220161438,tim:.1416495206952095},{bubble:9.353667080402374,insert:3.240689139962196,quick:.7925204798579216,tim:.3174498796463013},{bubble:.00600224107503891,insert:.00890067994594574,quick:5.122677060067653,tim:.011459939479827881},{bubble:11.116924380660057,insert:1.7424892008304596,quick:.38709301978349686,tim:.20053756177425386},{bubble:10.412143421173095,insert:1.7140289998054505,quick:.2237279596924782,tim:.16667216062545775},{bubble:9.858976120352745,insert:1.915432879626751,quick:.1504185003042221,tim:.4738584780693054},{bubble:9.353522279262542,insert:1.888010939657688,quick:.34279589921236037,tim:.1433293804526329},{bubble:9.829978099763393,insert:1.7453871202468871,quick:.14696617990732194,tim:.4662998795509338},{bubble:10.293470459878444,insert:1.793016158938408,quick:.15193210035562515,tim:.476584860086441},{bubble:9.77439042031765,insert:1.7577572199702263,quick:.15673643946647645,tim:.48047891944646837},{bubble:.004354241192340851,insert:.00582679957151413,quick:5.072259860932827,tim:.007721259593963623},{bubble:8.801387199759484,insert:2.8044483798742292,quick:.12392244189977646,tim:.17248507976531982},{bubble:9.942995119988918,insert:2.1096173012256623,quick:.2594605994224548,tim:.3133114987611771},{bubble:12.940870478749275,insert:1.8541115805506707,quick:.21128522008657455,tim:.3760545414686203},{bubble:12.863466501533985,insert:4.259152999818325,quick:4.625036739706993,tim:.007670939862728119},{bubble:11.479826098978519,insert:3.0205934607982634,quick:.4033852392435074,tim:.2473966199159622},{bubble:.005574959516525269,insert:.00955512136220932,quick:5.874604021608829,tim:.012447001039981842},{bubble:14.514323900640012,insert:5.213162800371647,quick:.4781837397813797,tim:.4075440403819084},{bubble:13.565170278847217,insert:2.580639179050922,quick:.1585545402765274,tim:.5305575600266457},{bubble:12.254384620785713,insert:2.1351926803588865,quick:.17690275996923446,tim:.5965858188271522},{bubble:11.10701728105545,insert:1.914937059879303,quick:.1921126002073288,tim:.6204417014122009},{bubble:11.010273359417916,insert:1.9381938415765763,quick:.12845439940690995,tim:.5171255600452423},{bubble:9.637093760073185,insert:1.7812715396285057,quick:.15597593933343887,tim:.46410907864570616},{bubble:11.38786953896284,insert:1.8796632197499274,quick:.20457470118999482,tim:.6803855806589126},{bubble:12.794733339846134,insert:3.632586499452591,quick:.9218495598435402,tim:.21960533887147904},{bubble:8.030396180152893,insert:1.4908364194631576,quick:.5445417410135269,tim:.0762890014052391},{bubble:6.990169380903244,insert:1.6507311403751372,quick:.3260230007767677,tim:.17636284112930298},{bubble:.0039851003885269165,insert:.006292579174041748,quick:4.858007981479168,tim:.012221539616584778},{bubble:13.369889458417893,insert:2.4099056002497674,quick:.15909577995538712,tim:.5088813391327858},{bubble:12.379849959611892,insert:4.3405732992291455,quick:.9556455793976784,tim:.27278888076543806},{bubble:.006862518489360809,insert:.01011450082063675,quick:5.6846762996912,tim:.009935621321201325},{bubble:.0042566779255867005,insert:.006260779500007629,quick:5.708667599260807,tim:.008316101133823394},{bubble:10.928583820462228,insert:2.073581521213055,quick:.1995733991265297,tim:.19911090046167373},{bubble:11.447219059765338,insert:2.1863379189372063,quick:.19168178111314774,tim:.717762400507927},{bubble:12.554668678641319,insert:3.7972909995913504,quick:.4162735193967819,tim:.23539590030908586},{bubble:.004253740906715393,insert:.007596119344234467,quick:5.9429964402318,tim:.00782433956861496},{bubble:9.35411700040102,insert:1.9105415791273117,quick:.15816497892141343,tim:.4737789610028267},{bubble:9.287602959573269,insert:2.95113656103611,quick:.18349118113517762,tim:.17764550060033799},{bubble:8.57325786113739,insert:1.518574961423874,quick:.13167486011981963,tim:.38904978036880494},{bubble:10.790318760573864,insert:3.7625393596291543,quick:1.1006066393852234,tim:.2993822005391121},{bubble:9.118408319652081,insert:3.1062061604857445,quick:3.2267942214012146,tim:.006252859830856323},{bubble:8.949330220520496,insert:1.583210559487343,quick:.13153012096881866,tim:.4001761388778686},{bubble:8.031611660718918,insert:1.5240450409054755,quick:.12838397979736327,tim:.3969708001613617},{bubble:9.089679880440235,insert:3.046295019686222,quick:.48386062115430833,tim:.17375395983457564},{bubble:.005026279389858246,insert:.007916779220104218,quick:4.062883480191231,tim:.006566521525382995},{bubble:8.981891119480133,insert:1.4930833601951599,quick:.12761147946119308,tim:.40049259960651395},{bubble:8.544740119278432,insert:1.5525991195440292,quick:.13891576051712037,tim:.4337306398153305},{bubble:8.378807419240475,insert:1.626107020676136,quick:.17013101994991303,tim:.40650314033031465},{bubble:9.906082480549813,insert:3.3188819789886477,quick:.8783207595348358,tim:.15265349924564361},{bubble:10.030544658899307,insert:3.01977107912302,quick:.31417839884758,tim:.18793811947107314},{bubble:9.964780600667,insert:2.9778919985890386,quick:1.3659828585386276,tim:.16910046130418777},{bubble:.003732140362262726,insert:.0057498994469642635,quick:4.65018620043993,tim:.008149499893188477},{bubble:8.82090669989586,insert:2.0335664385557175,quick:.16098253935575485,tim:.47003180027008057},{bubble:.0046805194020271305,insert:.006180320084095001,quick:4.5057524394989015,tim:.006575079560279846},{bubble:.0037661609053611755,insert:.005578539073467254,quick:4.09708742082119,tim:.009240400195121765},{bubble:9.502418299019336,insert:1.4976877215504647,quick:.1310592398047447,tim:.3911958199739456},{bubble:9.51788116067648,insert:1.9764945596456527,quick:.12952566087245942,tim:.3921729400753975},{bubble:8.996052080094815,insert:2.9500113594532014,quick:.34492568135261537,tim:.17634765833616256},{bubble:8.276623499393462,insert:1.5213848614692689,quick:.12691182047128677,tim:.39486343950033187},{bubble:6.606861339211464,insert:1.5598660191893579,quick:.5128922587633133,tim:.1263739386200905},{bubble:6.548677660822868,insert:1.550173558294773,quick:.6761783012747764,tim:.14622218042612076},{bubble:7.963497998714447,insert:2.068956378996372,quick:.21123287916183472,tim:.15298016011714935},{bubble:9.026433059275151,insert:2.981026619374752,quick:.31321333944797514,tim:.1819788011908531},{bubble:8.413228038549423,insert:1.8913895201683044,quick:.12760138124227524,tim:.14383566170930862},{bubble:9.557932478189468,insert:2.965048760175705,quick:.4617869395017624,tim:.17245326042175294},{bubble:6.884452480375767,insert:1.574309380352497,quick:.2427506399154663,tim:.11682516068220139},{bubble:9.104176840484142,insert:2.947398200929165,quick:.6688912397623062,tim:.17482322156429292},{bubble:8.869482538104057,insert:1.7307388183474541,quick:.13295509934425354,tim:.4014261397719383},{bubble:9.245137760937213,insert:3.067501420080662,quick:2.683450839817524,tim:.13960943818092347},{bubble:.0035680001974105835,insert:.005108941495418549,quick:4.179603060781956,tim:.006563639938831329},{bubble:7.176052361428738,insert:1.4895194205641746,quick:.19681743979454042,tim:.1305015617609024},{bubble:9.225883180499077,insert:3.076624200642109,quick:1.0950659799575806,tim:.1788566792011261},{bubble:8.644095718860626,insert:1.5555218386650085,quick:.13307219833135606,tim:.39801673889160155},{bubble:8.918431480824948,insert:1.5771693614125253,quick:.13230060100555419,tim:.396530020236969},{bubble:.0038355213403701784,insert:.005151639580726623,quick:4.134377500712872,tim:.006571761965751648},{bubble:9.245345880389214,insert:3.041315200924873,quick:.2803475806117058,tim:.18152808040380478},{bubble:8.188438680171966,insert:1.9994259801506997,quick:.1430147996544838,tim:.17974197894334792},{bubble:.00381229966878891,insert:.004892580509185791,quick:4.188677321076393,tim:.006569219827651978},{bubble:8.137918939292431,insert:1.3631367006897925,quick:.11747143983840942,tim:.16699801921844482},{bubble:5.889841200709343,insert:1.1912802004814147,quick:.30048954039812087,tim:.13483749836683273},{bubble:.0051951795816421505,insert:.005753540396690369,quick:4.154691299498081,tim:.006570720970630646},{bubble:7.4116823598742485,insert:1.7585882395505905,quick:.4478812590241432,tim:.14735542178153993},{bubble:9.249619518518449,insert:3.0112563395500183,quick:.47215222001075746,tim:.18453260004520416},{bubble:9.226485321223736,insert:3.0160902604460715,quick:.527529058456421,tim:.17935659915208815},{bubble:9.601538678705692,insert:3.000526501238346,quick:.7162611198425293,tim:.17043215930461883},{bubble:6.0194452798366544,insert:1.2441576784849167,quick:.1777350601553917,tim:.12939196050167084},{bubble:8.200830879807473,insert:1.8386583995819092,quick:.24799205988645553,tim:.1523768785595894},{bubble:8.525891479551792,insert:1.542292678952217,quick:.14045290052890777,tim:.3934170404076576},{bubble:9.345353680551051,insert:2.9960533186793326,quick:.17047604143619538,tim:.1838469597697258},{bubble:8.527257659137248,insert:1.551610840857029,quick:.13583262056112289,tim:.4185410004854202},{bubble:9.30523039996624,insert:2.9897185981273653,quick:.5356009820103645,tim:.18875171840190888},{bubble:.0036944007873535157,insert:.006192820072174072,quick:4.1689862614870075,tim:.006576419174671173},{bubble:.003736960291862488,insert:.005871599614620209,quick:4.189269680380821,tim:.006580520570278168},{bubble:8.268220499753951,insert:1.6784117403626442,quick:.13150934010744095,tim:.16118131816387177},{bubble:7.109641420245171,insert:1.45593779951334,quick:.22748842000961303,tim:.14060040086507797},{bubble:9.467919841706752,insert:3.049832159280777,quick:1.2411917412281037,tim:.1698463201522827},{bubble:.0036128395795822143,insert:.0055807211995124815,quick:4.176887860298157,tim:.006518100798130036},{bubble:8.38783179908991,insert:1.5223355185985565,quick:.13125177919864656,tim:.41500197917222975},{bubble:9.270628299415112,insert:3.0083688813447953,quick:.20826858133077622,tim:.20492408096790313},{bubble:.004119159281253814,insert:.005870059728622436,quick:4.136461441218853,tim:.0068755409121513365},{bubble:.0038380199670791626,insert:.0062201195955276485,quick:4.111532638967037,tim:.007740619778633118},{bubble:.0037321192026138305,insert:.0060941195487976075,quick:4.176662300229072,tim:.0068624594807624815},{bubble:9.285284839570522,insert:2.977943719923496,quick:.15238634020090103,tim:.20641279995441436},{bubble:8.688722560107708,insert:1.5623467206954955,quick:.1324526599049568,tim:.4205736020207405},{bubble:9.225116998851298,insert:2.9948485398292544,quick:.2764278191328049,tim:.19764813929796218},{bubble:7.166551361680031,insert:1.5629017812013626,quick:.2390170994400978,tim:.17228108078241347},{bubble:6.755221759974956,insert:1.4613644590973853,quick:.21124924033880232,tim:.16185821920633317},{bubble:.003807779848575592,insert:.008494641780853272,quick:4.168768559396267,tim:.00657761961221695},{bubble:8.103782339394092,insert:1.48493165910244,quick:.14891648024320603,tim:.14437539964914323},{bubble:7.713594380319119,insert:1.2927702799439431,quick:.29215759873390196,tim:.13728666067123413},{bubble:9.388760958611964,insert:3.0204954811930658,quick:.31862595975399016,tim:.18208008021116256},{bubble:8.312230779528617,insert:1.5484639611840247,quick:.13076729834079742,tim:.4001960203051567},{bubble:8.791070118844509,insert:1.520330640077591,quick:.13496084064245223,tim:.3944585222005844},{bubble:.003808680772781372,insert:.005452738404273987,quick:4.087166681885719,tim:.006570579409599304},{bubble:9.141930759847163,insert:3.034457799196243,quick:.2649510991573334,tim:.17717514008283616},{bubble:7.7395033404231075,insert:1.711364559829235,quick:.16843034088611603,tim:.16768207967281343},{bubble:9.343872898817063,insert:3.084135579764843,quick:.47097829908132555,tim:.200732259452343},{bubble:.0038082605600357057,insert:.005067660212516784,quick:4.090684901177883,tim:.0070770192146301265},{bubble:.0037374401092529295,insert:.00556011974811554,quick:4.098383818566799,tim:.008933160603046417},{bubble:8.209319438934326,insert:1.6532574415206909,quick:.11952733874320984,tim:.12631606042385102},{bubble:9.152203739881516,insert:2.9962298783659933,quick:.5146603995561599,tim:.1840956589579582},{bubble:9.18384631961584,insert:2.9878719791769983,quick:.5891507783532143,tim:.1687413588166237},{bubble:9.190381739735603,insert:3.0822941601276397,quick:.2124142399430275,tim:.19280153930187224},{bubble:.0038135191798210144,insert:.005279280245304108,quick:4.0974094200134275,tim:.0067208012938499454},{bubble:.003611098825931549,insert:.005115959346294403,quick:4.10802335947752,tim:.0065751209855079654},{bubble:8.06658333927393,insert:1.6025368002057077,quick:.21038726091384888,tim:.11632524013519287},{bubble:9.141805381476878,insert:3.067734780013561,quick:.34152543991804124,tim:.18786379992961882},{bubble:9.406342759728432,insert:1.8366537195444108,quick:.14998512029647826,tim:.45837620049715044},{bubble:9.043282260894776,insert:1.4900691190361977,quick:.133617060482502,tim:.3945181015133858},{bubble:7.642803618907928,insert:1.5126123401522635,quick:.19816242039203644,tim:.11875504076480865},{bubble:9.127826279997826,insert:2.963144720494747,quick:.20102269887924196,tim:.20902026027441026},{bubble:9.138777358829975,insert:2.991075659096241,quick:.658323059976101,tim:.16924525916576386},{bubble:6.95129635989666,insert:1.8827837207913398,quick:.3985603603720665,tim:.13673474073410033},{bubble:8.32610305994749,insert:1.523852617740631,quick:.1277811598777771,tim:.40511536091566086},{bubble:8.564023000597954,insert:1.588696961402893,quick:.12780133992433548,tim:.39719770073890687},{bubble:9.076392360031605,insert:2.9596077394485474,quick:.27970633953809737,tim:.1989765992760658},{bubble:9.437582939565182,insert:2.999885739982128,quick:1.3346384593844414,tim:.1602463200688362},{bubble:9.174095259010791,insert:3.0262638998031615,quick:.46954394012689593,tim:.2221681606769562},{bubble:.0039863216876983645,insert:.005030960440635681,quick:4.101708241403103,tim:.006874240934848785},{bubble:7.806860679388047,insert:1.1094227209687233,quick:.23355783849954606,tim:.11179667949676514},{bubble:6.4979444599151615,insert:1.4275998592376709,quick:.13389433979988097,tim:.13086945980787276},{bubble:7.982500140368939,insert:1.3981565999984742,quick:.1940801602602005,tim:.11610817998647689},{bubble:8.197426840364933,insert:1.9048978197574615,quick:.19119426012039184,tim:.15313621878623962},{bubble:8.525241980850696,insert:1.5269205805659294,quick:.13445732086896897,tim:.4222495993971825},{bubble:9.252231619358064,insert:2.944840159714222,quick:.20639074057340623,tim:.19558636099100113},{bubble:9.187743660509586,insert:2.9722053995728492,quick:.5182738783955574,tim:.2542063391208649},{bubble:7.278015418946743,insert:1.12844859957695,quick:.11975251913070678,tim:.16171853959560395},{bubble:7.577127939760685,insert:1.7040978395938873,quick:.12965521931648255,tim:.16627866059541702},{bubble:.0038140201568603515,insert:.005530501008033753,quick:4.189623299837113,tim:.006562960147857666},{bubble:6.2916952201724055,insert:1.1155814012885095,quick:.3906713992357254,tim:.16581621885299683},{bubble:8.648301218450069,insert:1.6019695797562599,quick:.1260085591673851,tim:.3958280208706856},{bubble:.0036416807770729065,insert:.006292478740215301,quick:4.271928900778294,tim:.0066858002543449405},{bubble:7.388674699664116,insert:1.360499719977379,quick:.22535786032676697,tim:.10121826082468033},{bubble:.004519241154193878,insert:.0066280001401901245,quick:4.082144598066807,tim:.007774861454963684},{bubble:.003738940954208374,insert:.005478419959545135,quick:4.193348960280418,tim:.007128640711307525},{bubble:9.01122800052166,insert:2.9011405992507933,quick:.19951065987348557,tim:.1973482182621956},{bubble:.0039331200718879696,insert:.005417139530181885,quick:4.0708297410607335,tim:.007272520065307617},{bubble:8.382971159219743,insert:1.5976209610700607,quick:.13018840044736862,tim:.39185814023017884},{bubble:9.281653100848198,insert:3.2115206611156464,quick:.21016768097877503,tim:.1949409192800522},{bubble:8.098841339051724,insert:1.5515730804204941,quick:.11802041977643966,tim:.133814540207386},{bubble:6.474738660156727,insert:1.3640043017268182,quick:.1762935596704483,tim:.14901040077209474},{bubble:.003545360267162323,insert:.0067430403828620915,quick:4.095075921416282,tim:.007001361250877381},{bubble:9.04094318062067,insert:2.9286582791805267,quick:.24104831904172896,tim:.18946860015392303},{bubble:9.054602420032024,insert:2.9752654391527176,quick:.40998284101486204,tim:.16830948024988174},{bubble:9.085202338993549,insert:2.997642559111118,quick:.8406109011173248,tim:.16381552070379257},{bubble:8.421236340403556,insert:1.537166718542576,quick:.13141685843467713,tim:.3950347402691841},{bubble:9.123697420060635,insert:2.970796719789505,quick:.2704254987835884,tim:.1926844000816345},{bubble:6.363589780926705,insert:1.512524881362915,quick:.2631626191735268,tim:.149749518930912},{bubble:9.381270100176334,insert:2.961515639424324,quick:.5484369003772736,tim:.16370200008153915},{bubble:8.407756561338902,insert:1.5015970197319986,quick:.12824185967445373,tim:.4004839798808098},{bubble:8.179603620171546,insert:1.5236413794755936,quick:.12976375997066497,tim:.3989922189712524},{bubble:7.457584499716758,insert:1.2498293399810791,quick:.2419518595933914,tim:.12346162021160126},{bubble:9.149608419835568,insert:2.9580152398347854,quick:.3471102204918861,tim:.17862343847751616},{bubble:.00357433944940567,insert:.0056218189001083375,quick:4.095719519853592,tim:.0066836407780647275},{bubble:.005056439936161041,insert:.005533859431743622,quick:4.073601220548153,tim:.008338918685913086},{bubble:9.137997538745402,insert:2.9618749389052392,quick:.4775144588947296,tim:.17374413818120957},{bubble:.004220340251922607,insert:.005113679766654968,quick:4.092967540919781,tim:.006573779582977295},{bubble:8.342533500492573,insert:1.5052150991559028,quick:.12915333986282349,tim:.39741276025772093},{bubble:9.448986238241195,insert:2.93123173981905,quick:.1863670015335083,tim:.20334693938493728},{bubble:9.568207700550555,insert:2.955141378939152,quick:.31687794148921966,tim:.1895160999894142},{bubble:9.218237839639187,insert:3.3730550795793532,quick:.4096823412179947,tim:.21774523943662644},{bubble:9.795667799711227,insert:2.9966154783964156,quick:.5018359395861626,tim:.16990783900022507},{bubble:8.52053094059229,insert:1.5097932595014572,quick:.12420749962329865,tim:.40489431977272033},{bubble:7.632333319783211,insert:1.8957546204328537,quick:.20768502116203308,tim:.11288629949092865},{bubble:8.506554199159146,insert:1.4791460594534873,quick:.12859915882349016,tim:.3989401599764824},{bubble:.0035479414463043214,insert:.005600621998310089,quick:4.068399440944194,tim:.006570620536804199},{bubble:9.17681233972311,insert:2.913662559390068,quick:.3203424602746964,tim:.19219247996807098},{bubble:8.410920740365983,insert:1.5245912989974022,quick:.13240391939878463,tim:.39919866144657135},{bubble:8.964077359735965,insert:1.522139280438423,quick:.12837573915719985,tim:.3887868210673332},{bubble:9.025465379357337,insert:3.000277018845081,quick:.8800553020834923,tim:.15558858036994935},{bubble:8.141983381807805,insert:1.4685825991630554,quick:.1301221188902855,tim:.3823785391449928},{bubble:.003736061453819275,insert:.0051972192525863645,quick:4.0615023002028465,tim:.007177000641822815},{bubble:7.6408263996243475,insert:1.7174694016575813,quick:.15723985970020293,tim:.1361092209815979},{bubble:8.464398658275604,insert:1.4878903403878212,quick:.12732674062252045,tim:.39828545838594437},{bubble:9.080076401531697,insert:2.9554480412602424,quick:.6451156803965569,tim:.18438300013542175},{bubble:7.888695881664753,insert:1.6290869614481926,quick:.14592716008424758,tim:.14738970190286638},{bubble:.003610619306564331,insert:.004962360262870788,quick:4.083415521681308,tim:.006575720906257629},{bubble:9.068374460041523,insert:2.959406199455261,quick:.7331585401296615,tim:.17658519983291626},{bubble:9.378329160511493,insert:2.936474160552025,quick:.29301890045404433,tim:.18261553913354875},{bubble:8.192429660856725,insert:1.4984532827138901,quick:.245276161134243,tim:.15485645979642867},{bubble:9.141403180360793,insert:2.927937140464783,quick:.35012693852186205,tim:.1874668601155281},{bubble:9.044589898884297,insert:3.0040720203518867,quick:.17580285787582398,tim:.18222975969314575},{bubble:8.475857680737972,insert:1.5229392197728158,quick:.1239330780506134,tim:.40504256039857867},{bubble:.0040913611650466915,insert:.0055707994103431704,quick:4.1204196408391,tim:.006716800034046173},{bubble:8.365392060279847,insert:1.5192149391770362,quick:.12412581950426102,tim:.39613417983055116},{bubble:8.181730839908123,insert:1.5373643210530281,quick:.1317129811644554,tim:.39854718059301375},{bubble:6.8334676796197895,insert:1.4115127202868463,quick:.546106159389019,tim:.12040446072816849},{bubble:8.540214559137821,insert:1.5018792194128037,quick:.12645909875631334,tim:.3978663402795792},{bubble:8.924875140190125,insert:1.496087899506092,quick:.1284162411093712,tim:.39803432166576386},{bubble:.003794720470905304,insert:.005197139382362366,quick:4.104503019750118,tim:.007950800359249116},{bubble:8.533799120783806,insert:1.5105478796362877,quick:.1290506601333618,tim:.39973106056451796},{bubble:8.392131020724774,insert:1.5685577815771103,quick:.12752513945102692,tim:.39936838060617447},{bubble:8.675549999475479,insert:1.4938355392217637,quick:.1313060986995697,tim:.4023620203137398},{bubble:9.129335878491402,insert:2.9886311995983124,quick:.27279586017131807,tim:.19682306110858916},{bubble:7.810107620358467,insert:1.5267512997984887,quick:.18267579972743989,tim:.11911210119724273},{bubble:8.537445879876614,insert:1.5305857598781585,quick:.13004637986421586,tim:.4009404608607292},{bubble:8.302604439854623,insert:1.5076056605577468,quick:.1357751190662384,tim:.39336357951164247},{bubble:8.568058060407639,insert:1.553553240299225,quick:.12582094192504883,tim:.4082104802131653},{bubble:.0036449587345123292,insert:.005046439468860626,quick:4.460985939800739,tim:.007402219772338867},{bubble:8.430422859191895,insert:1.5425776207447053,quick:.14795314013957978,tim:.39561187982559204},{bubble:8.685088839828968,insert:1.5138554802536965,quick:.13322531878948213,tim:.4029587787389755},{bubble:9.148948881030083,insert:3.0344527208805085,quick:1.054986479282379,tim:.16645461916923524},{bubble:8.5334808203578,insert:1.5439517393708229,quick:.1337013992667198,tim:.4019708186388016},{bubble:9.246686859726905,insert:3.077910561859608,quick:.28237468004226685,tim:.18288028001785278},{bubble:.004732059538364411,insert:.005147099792957306,quick:4.173345220088959,tim:.006576379537582397},{bubble:5.869907239675522,insert:1.4729089000821114,quick:.16145764023065567,tim:.15669899940490722},{bubble:.003853839933872223,insert:.005626637935638428,quick:4.137074098289013,tim:.006743720173835755},{bubble:8.50322790145874,insert:1.5688651397824287,quick:.1286860403418541,tim:.41143405973911285},{bubble:7.412296659350395,insert:1.5507188796997071,quick:.7231513392925263,tim:.1466118410229683},{bubble:8.912681441009045,insert:1.543052379488945,quick:.13521917909383774,tim:.3996597993373871},{bubble:8.671635160446167,insert:1.5482148391008377,quick:.1345939588546753,tim:.4044761583209038},{bubble:7.711245240271092,insert:1.5644357603788377,quick:.3869251987338066,tim:.13146517872810365},{bubble:.004403858780860901,insert:.005707621276378631,quick:4.137082560956478,tim:.006575520932674408},{bubble:7.17731911957264,insert:1.438828758597374,quick:.13286999881267547,tim:.12337909966707229},{bubble:.0035635387897491456,insert:.005720521211624145,quick:4.130232421457768,tim:.009172480404376984},{bubble:8.425353081822395,insert:1.5176039004325867,quick:.13478291928768157,tim:.399659281373024},{bubble:.0038111802935600282,insert:.0049820801615715025,quick:4.1886019796133045,tim:.006570559442043305},{bubble:8.53737407952547,insert:1.48506796002388,quick:.13632363945245743,tim:.4037459799647331},{bubble:7.388416219353676,insert:1.8530890595912934,quick:.15698127925395966,tim:.12861595958471297},{bubble:8.542617819607258,insert:1.5375270807743073,quick:.1299974402785301,tim:.4041296201944351},{bubble:.0036688801646232606,insert:.007591200470924378,quick:4.154129080176354,tim:.007045959532260895},{bubble:8.50095226019621,insert:1.7086258786916733,quick:.20043833822011947,tim:.1561085996031761},{bubble:7.92387797921896,insert:1.2999660590291022,quick:.17367120176553727,tim:.14840217918157578},{bubble:8.566633180081844,insert:1.5113161996006965,quick:.13200199872255325,tim:.4009434399008751},{bubble:9.28294327944517,insert:2.9852086010575296,quick:.48529678106307983,tim:.19685056030750275},{bubble:8.6321572804451,insert:1.5104958814382554,quick:.12789701908826828,tim:.40463307917118074},{bubble:.0037133011221885683,insert:.005854359865188599,quick:4.16467739880085,tim:.006579239666461944},{bubble:9.234517139196395,insert:3.016982899606228,quick:3.00514917999506,tim:.13043134063482284},{bubble:.004493418633937835,insert:.005607660710811615,quick:4.160542421042919,tim:.0065688595175743105},{bubble:8.490584680140019,insert:1.5121356013417244,quick:.12872996032238007,tim:.38647964000701907},{bubble:7.894243039488792,insert:1.8246781402826309,quick:.13711157888174058,tim:.15257229954004287},{bubble:9.705553720593452,insert:3.0230146604776382,quick:.44170300096273424,tim:.1644417405128479},{bubble:9.203961460292339,insert:3.0561203590035437,quick:.3003504812717438,tim:.18330948084592819},{bubble:8.35913629949093,insert:1.5378074800968171,quick:.13488757967948914,tim:.3990077587962151},{bubble:9.306965780854226,insert:2.988264299929142,quick:.16732629954814912,tim:.20553337961435317},{bubble:7.860814281404019,insert:1.4978111809492112,quick:.17360807955265045,tim:.11576873987913132},{bubble:.00479390025138855,insert:.004968519508838654,quick:4.152212699055672,tim:.006575659811496735},{bubble:9.318285159468651,insert:2.9895031401515006,quick:.2848581397533417,tim:.18155012160539627},{bubble:8.51293951958418,insert:1.5611168804764748,quick:.12930194050073623,tim:.43344802021980283},{bubble:8.429473040103913,insert:1.5055745020508766,quick:.13114259988069535,tim:.39159414142370225},{bubble:8.8019759196043,insert:1.5928152802586555,quick:.13839666277170182,tim:.4614757800102234},{bubble:8.486020719110966,insert:1.4968101197481156,quick:.13995455980300903,tim:.39519536048173903},{bubble:8.608390200436116,insert:1.5112410604953765,quick:.13793828040361406,tim:.39674015939235685},{bubble:.0037965017557144167,insert:.0050179392099380495,quick:4.067783859670162,tim:.006579280495643615},{bubble:9.01760017901659,insert:2.931117178797722,quick:.19172322154045104,tim:.2116688197851181},{bubble:7.25528863966465,insert:1.4491711395978928,quick:.10360448062419891,tim:.1888800412416458},{bubble:.003957978785037995,insert:.005160100162029267,quick:4.080237519443035,tim:.006871660947799682},{bubble:9.05077009946108,insert:2.952536438405514,quick:.5742989003658294,tim:.16411261826753618},{bubble:9.06537966042757,insert:2.984374660551548,quick:1.1124045610427857,tim:.16956474065780638},{bubble:8.210856700241566,insert:2.122090558707714,quick:.42369772017002105,tim:.13340121924877166},{bubble:9.084706920385361,insert:3.2404979395866396,quick:3.223033419251442,tim:.006035280525684357},{bubble:.003808099627494812,insert:.005515381097793579,quick:4.056650879979133,tim:.006587700247764588},{bubble:9.026242640912534,insert:3.01104249894619,quick:1.6655507791042328,tim:.12792659997940065},{bubble:8.574632359743118,insert:1.5335198801755905,quick:.12552706092596055,tim:.4023856997489929},{bubble:8.438637100458145,insert:1.48924958050251,quick:.12585098087787627,tim:.39722600013017656},{bubble:8.043678020834923,insert:1.5058475404977798,quick:.12901006102561952,tim:.3949879789352417},{bubble:7.99777526050806,insert:1.9464043602347374,quick:.12165594041347504,tim:.16416436076164245},{bubble:.003907041251659393,insert:.005523721277713775,quick:4.027673320472241,tim:.006571021676063537},{bubble:7.20663870036602,insert:1.3820356586575508,quick:.17690774142742158,tim:.14594329982995988},{bubble:9.022844100892543,insert:2.97736545920372,quick:1.2577490392327308,tim:.1821243005990982},{bubble:7.31016233921051,insert:1.5630650600790978,quick:.17954106092453004,tim:.14417804032564163},{bubble:8.144737980663777,insert:1.8598051810264586,quick:.41613361954689027,tim:.128752139210701},{bubble:9.021552720665932,insert:2.939813340008259,quick:.3744383805990219,tim:.1780630400776863},{bubble:7.909919779002666,insert:1.4461135596036911,quick:.11327819973230362,tim:.13811557948589326},{bubble:8.118814341425896,insert:1.4713191196322442,quick:.10830315977334976,tim:.13985557973384857},{bubble:8.482348519861699,insert:1.504939340353012,quick:.12490294069051742,tim:.38908726096153257},{bubble:8.340749300420285,insert:1.5127424186468124,quick:.12718269914388658,tim:.3887080615758896},{bubble:8.312036338746548,insert:1.4763552206754684,quick:.1277461212873459,tim:.3955260381102562},{bubble:6.856299440860749,insert:1.4924044582247733,quick:.2737492978572845,tim:.14492689967155456},{bubble:.003813418745994568,insert:.006146900057792663,quick:4.028137779831886,tim:.006717299222946167},{bubble:8.230497480630875,insert:1.4754293000698089,quick:.12741426020860672,tim:.3939777410030365},{bubble:8.271735680699349,insert:1.6743415388464928,quick:.18881786048412322,tim:.10732715874910355},{bubble:8.432672780752181,insert:1.5073834392428398,quick:.12585657894611357,tim:.41292259842157364},{bubble:.003907980024814605,insert:.005483798980712891,quick:4.290214558243751,tim:.007107599377632141},{bubble:.003693319857120514,insert:.0056364801526069645,quick:4.138414579927922,tim:.008072138130664826},{bubble:8.354798598587513,insert:1.5030364790558814,quick:.1288997197151184,tim:.3976407387852669},{bubble:.0037364792823791505,insert:.005541278123855591,quick:4.263193241655826,tim:.006574760377407074},{bubble:9.165069919526577,insert:3.0410624998807907,quick:1.3702276808023452,tim:.14609298020601272},{bubble:8.539095520079137,insert:1.5577396795153617,quick:.13305363953113555,tim:.40351449996232985},{bubble:9.152219598591328,insert:2.9319067385792734,quick:.31911865949630736,tim:.2193174183368683},{bubble:9.019361859858035,insert:2.9753782403469087,quick:.5715787610411645,tim:.16485102146863936},{bubble:6.131663180887699,insert:1.3359303608536721,quick:.16420865952968597,tim:.1079602599143982},{bubble:.003932920098304748,insert:.005640178620815277,quick:4.286488881707191,tim:.007470960021018982},{bubble:9.009920178353786,insert:2.9414465790987014,quick:.4677287399768829,tim:.17591320008039474},{bubble:7.030443257987499,insert:1.2080886617302895,quick:.32381741821765897,tim:.1310928198695183},{bubble:8.992847439944745,insert:2.9649050998687745,quick:.6817745214700699,tim:.1657840409874916},{bubble:8.54906849950552,insert:1.5218772214651108,quick:.12631959944963456,tim:.4016998800635338},{bubble:8.443087078630924,insert:1.7090180000662805,quick:.2513579797744751,tim:.11863159954547882},{bubble:.0038035804033279418,insert:.004980358779430389,quick:4.214592538475991,tim:.006574462056159973},{bubble:9.21870329886675,insert:2.982909480929375,quick:.2916839396953583,tim:.19852295994758606},{bubble:9.242971838414668,insert:3.0070692610740664,quick:.3505581602454185,tim:.18761631846427917},{bubble:8.74395749926567,insert:1.705597280561924,quick:.1389545804262161,tim:.4344193798303604},{bubble:8.784177560806274,insert:1.5317880415916443,quick:.1281450217962265,tim:.396605022251606},{bubble:9.022485821843148,insert:3.001510460674763,quick:1.2499549397826195,tim:.1643591797351837},{bubble:8.521705519855022,insert:1.498667619228363,quick:.13421050041913987,tim:.39507293939590454},{bubble:8.4758033400774,insert:1.4970279794931411,quick:.12839767932891846,tim:.3824939402937889},{bubble:6.9405267205834384,insert:1.6146534189581871,quick:.7079701203107834,tim:.10200655966997146},{bubble:7.226212899982929,insert:1.2591168987751007,quick:.19860947966575623,tim:.13911111891269684},{bubble:9.054585380256176,insert:2.9646108999848364,quick:.23450948238372804,tim:.1923382392525673},{bubble:.0048767605423927305,insert:.006321700811386108,quick:4.046850139796734,tim:.0065768399834632875},{bubble:7.4173491790890695,insert:1.339664840400219,quick:.14602763950824738,tim:.08195548146963119},{bubble:9.00345330029726,insert:3.1738229978084562,quick:.26399044126272203,tim:.19079807937145232},{bubble:9.02199786067009,insert:2.9859742799401285,quick:1.0079225409030914,tim:.16518961876630783},{bubble:.0042931997776031496,insert:.005329678952693939,quick:4.047084639966488,tim:.006567179560661316},{bubble:6.878964801132679,insert:1.4603689202666283,quick:.4811873188614845,tim:.08579008013010025},{bubble:9.0525618994236,insert:2.9721187579631807,quick:.21097398072481155,tim:.18777170151472092},{bubble:.003981359601020813,insert:.005077440142631531,quick:4.062355461716652,tim:.00874383956193924},{bubble:8.452624099850654,insert:1.5175310400128366,quick:.12383463770151139,tim:.38957136034965517},{bubble:8.993823021352291,insert:2.950925759971142,quick:3.2341773185133933,tim:.006045339107513428},{bubble:.005061938464641571,insert:.0056305196881294255,quick:4.039797340035438,tim:.0069055607914924625},{bubble:8.410386800169945,insert:1.50175626039505,quick:.12954870074987412,tim:.3814122200012207},{bubble:.0038349395990371704,insert:.0067039582133293155,quick:4.037335761487484,tim:.006709080636501313},{bubble:7.440518921613693,insert:1.9689007195830346,quick:.22096072047948837,tim:.1474395799636841},{bubble:7.280552839934826,insert:1.306219961643219,quick:.21611445963382722,tim:.13125811994075776},{bubble:7.548019240796566,insert:1.2826808407902717,quick:.12460809916257859,tim:.17073443949222564},{bubble:7.628155559897423,insert:1.1094628804922104,quick:.3266411203145981,tim:.10786364138126374},{bubble:7.581058020889759,insert:1.3739199614524842,quick:.11280602127313615,tim:.11774502068758011},{bubble:.004102820754051209,insert:.005123778581619263,quick:4.1225266796350475,tim:.006573160588741303},{bubble:9.067321158647538,insert:2.942944941520691,quick:.3464078199863434,tim:.17517004072666167},{bubble:6.559745659530162,insert:1.5245134803652762,quick:.18467406004667283,tim:.17082262098789214},{bubble:9.067329599261283,insert:2.9451899603009224,quick:.285555619597435,tim:.18726698100566863},{bubble:.004306979179382324,insert:.005559459924697876,quick:4.077987840771675,tim:.0065842211246490475},{bubble:9.134325740337372,insert:2.934096019864082,quick:.36811005920171735,tim:.17502663969993593},{bubble:8.602246920764447,insert:1.6187637600302696,quick:.1353174602985382,tim:.42615967959165574},{bubble:9.361391118764878,insert:2.928852640688419,quick:.1888168415427208,tim:.2066614392399788},{bubble:8.543498940467835,insert:1.4898677191138268,quick:.13488164007663728,tim:.3957454401254654},{bubble:8.97882347881794,insert:2.9747926005721093,quick:2.75127229899168,tim:.12712911993265152},{bubble:7.536913699805736,insert:1.4179106789827347,quick:.11120520114898681,tim:.12297535955905914},{bubble:.004739398658275604,insert:.006159639358520508,quick:4.074158819317818,tim:.0066513592004776},{bubble:7.955741159915924,insert:1.8523816004395486,quick:.27429737865924836,tim:.15368008017539977},{bubble:.003738100230693817,insert:.005125080049037933,quick:4.0641734799742695,tim:.006570561528205871}],e.exports.inputs=[{&quot;sign sum&quot;:.49675,&quot;mean run&quot;:.00024312267657992565},{&quot;sign sum&quot;:.99675,&quot;mean run&quot;:.07642307692307691},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.9702500000000001,&quot;mean run&quot;:.007903361344537816},{&quot;sign sum&quot;:.60325,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.50025,&quot;mean run&quot;:.0002453392990305742},{&quot;sign sum&quot;:.50225,&quot;mean run&quot;:.00026863950807071483},{&quot;sign sum&quot;:.62175,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.62625,&quot;mean run&quot;:.06616666666666667},{&quot;sign sum&quot;:.28225,&quot;mean run&quot;:.042978260869565216},{&quot;sign sum&quot;:.48525,&quot;mean run&quot;:.00025433962264150944},{&quot;sign sum&quot;:.99575,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.98875,&quot;mean run&quot;:.021722222222222223},{&quot;sign sum&quot;:.28375,&quot;mean run&quot;:.041166666666666664},{&quot;sign sum&quot;:.48125,&quot;mean run&quot;:.05505555555555556},{&quot;sign sum&quot;:.50075,&quot;mean run&quot;:.00024925037481259374},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.51075,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.49875,&quot;mean run&quot;:.0002560514372163389},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50625,&quot;mean run&quot;:.00023438648052902277},{&quot;sign sum&quot;:.50425,&quot;mean run&quot;:.0002606544901065449},{&quot;sign sum&quot;:.49725,&quot;mean run&quot;:.00025037537537537537},{&quot;sign sum&quot;:.9672499999999999,&quot;mean run&quot;:.007133587786259542},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.9702500000000001,&quot;mean run&quot;:.007903361344537816},{&quot;sign sum&quot;:.49325,&quot;mean run&quot;:.0002412898443291327},{&quot;sign sum&quot;:.67575,&quot;mean run&quot;:.062},{&quot;sign sum&quot;:.49375,&quot;mean run&quot;:.00024868913857677903},{&quot;sign sum&quot;:.50025,&quot;mean run&quot;:.0002589217919514047},{&quot;sign sum&quot;:.50825,&quot;mean run&quot;:.00023116313094367227},{&quot;sign sum&quot;:.38475,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.55375,&quot;mean run&quot;:.05505555555555556},{&quot;sign sum&quot;:.50375,&quot;mean run&quot;:.0002442293373045421},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.98575,&quot;mean run&quot;:.01704385964912281},{&quot;sign sum&quot;:.9902500000000001,&quot;mean run&quot;:.025141025641025643},{&quot;sign sum&quot;:.96175,&quot;mean run&quot;:.0060359477124183},{&quot;sign sum&quot;:.97875,&quot;mean run&quot;:.011264705882352942},{&quot;sign sum&quot;:.51375,&quot;mean run&quot;:.05505555555555556},{&quot;sign sum&quot;:.96175,&quot;mean run&quot;:.006122516556291391},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.67075,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.9672499999999999,&quot;mean run&quot;:.0072519379844961235},{&quot;sign sum&quot;:.50225,&quot;mean run&quot;:.00024645257654966395},{&quot;sign sum&quot;:.49025,&quot;mean run&quot;:.000257002271006813},{&quot;sign sum&quot;:.55775,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.98775,&quot;mean run&quot;:.01990816326530612},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.39325,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.45625,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.49075,&quot;mean run&quot;:.0002387287509238729},{&quot;sign sum&quot;:.39875,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.50975,&quot;mean run&quot;:.0002589217919514047},{&quot;sign sum&quot;:.49575,&quot;mean run&quot;:.00024349442379182156},{&quot;sign sum&quot;:.51275,&quot;mean run&quot;:.00023438648052902277},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.60675,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.5902499999999999,&quot;mean run&quot;:.041166666666666664},{&quot;sign sum&quot;:.70825,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.99975,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.42725,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.9652499999999999,&quot;mean run&quot;:.006907407407407407},{&quot;sign sum&quot;:.50525,&quot;mean run&quot;:.0002442293373045421},{&quot;sign sum&quot;:.50525,&quot;mean run&quot;:.0002442293373045421},{&quot;sign sum&quot;:.49225,&quot;mean run&quot;:.00024201930215293242},{&quot;sign sum&quot;:.50125,&quot;mean run&quot;:.00024906367041198504},{&quot;sign sum&quot;:.50025,&quot;mean run&quot;:.00026707597851112816},{&quot;sign sum&quot;:.50675,&quot;mean run&quot;:.00024146884272997033},{&quot;sign sum&quot;:.98475,&quot;mean run&quot;:.01589344262295082},{&quot;sign sum&quot;:.10125,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.49175,&quot;mean run&quot;:.042978260869565216},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.48775,&quot;mean run&quot;:.00024645257654966395},{&quot;sign sum&quot;:.99175,&quot;mean run&quot;:.029803030303030303},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.65825,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.48975,&quot;mean run&quot;:.0002606544901065449},{&quot;sign sum&quot;:.98875,&quot;mean run&quot;:.021722222222222223},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50025,&quot;mean run&quot;:.00024074074074074072},{&quot;sign sum&quot;:.97725,&quot;mean run&quot;:.011404761904761905},{&quot;sign sum&quot;:.49675,&quot;mean run&quot;:.00024571215510812825},{&quot;sign sum&quot;:.9802500000000001,&quot;mean run&quot;:.012158227848101265},{&quot;sign sum&quot;:.99975,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.51125,&quot;mean run&quot;:.00023709439528023598},{&quot;sign sum&quot;:.50275,&quot;mean run&quot;:.0002515037593984962},{&quot;sign sum&quot;:.98075,&quot;mean run&quot;:.012487012987012987},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50175,&quot;mean run&quot;:.0002520692249811889},{&quot;sign sum&quot;:.50575,&quot;mean run&quot;:.00025131480090157774},{&quot;sign sum&quot;:.49575,&quot;mean run&quot;:.00026123381568926124},{&quot;sign sum&quot;:.99475,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.9722500000000001,&quot;mean run&quot;:.00850900900900901},{&quot;sign sum&quot;:.98475,&quot;mean run&quot;:.01589344262295082},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50075,&quot;mean run&quot;:.0002610350076103501},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.49375,&quot;mean run&quot;:.00025414781297134235},{&quot;sign sum&quot;:.50225,&quot;mean run&quot;:.0002475691847419596},{&quot;sign sum&quot;:.98475,&quot;mean run&quot;:.01674137931034483},{&quot;sign sum&quot;:.49875,&quot;mean run&quot;:.00025263554216867467},{&quot;sign sum&quot;:.50325,&quot;mean run&quot;:.06616666666666667},{&quot;sign sum&quot;:.47175,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.6427499999999999,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.98275,&quot;mean run&quot;:.013992753623188406},{&quot;sign sum&quot;:.58575,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.98875,&quot;mean run&quot;:.021722222222222223},{&quot;sign sum&quot;:.37675000000000003,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.9862500000000001,&quot;mean run&quot;:.01836792452830189},{&quot;sign sum&quot;:.49425,&quot;mean run&quot;:.0002470104633781764},{&quot;sign sum&quot;:.99775,&quot;mean run&quot;:.11061111111111112},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.46525,&quot;mean run&quot;:.05505555555555556},{&quot;sign sum&quot;:.98175,&quot;mean run&quot;:.013198630136986302},{&quot;sign sum&quot;:.49425,&quot;mean run&quot;:.0002552870090634441},{&quot;sign sum&quot;:.49875,&quot;mean run&quot;:.0002475691847419596},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.97575,&quot;mean run&quot;:.01025268817204301},{&quot;sign sum&quot;:.69425,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.63425,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.49025,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50275,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.98075,&quot;mean run&quot;:.012487012987012987},{&quot;sign sum&quot;:.97925,&quot;mean run&quot;:.011548192771084338},{&quot;sign sum&quot;:.9862500000000001,&quot;mean run&quot;:.01836792452830189},{&quot;sign sum&quot;:.46925,&quot;mean run&quot;:.07092857142857142},{&quot;sign sum&quot;:.61075,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.49025,&quot;mean run&quot;:.0002479431563201197},{&quot;sign sum&quot;:.9702500000000001,&quot;mean run&quot;:.008042735042735043},{&quot;sign sum&quot;:.50275,&quot;mean run&quot;:.00024146884272997033},{&quot;sign sum&quot;:.97475,&quot;mean run&quot;:.0094009900990099},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.55875,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.38925,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.99075,&quot;mean run&quot;:.026527027027027028},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50175,&quot;mean run&quot;:.00024925037481259374},{&quot;sign sum&quot;:.96575,&quot;mean run&quot;:.006799270072992701},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.96475,&quot;mean run&quot;:.006799270072992701},{&quot;sign sum&quot;:.50025,&quot;mean run&quot;:.00023206442166910686},{&quot;sign sum&quot;:.9782500000000001,&quot;mean run&quot;:.011264705882352942},{&quot;sign sum&quot;:.38025,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.59125,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.52125,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.48225,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.97325,&quot;mean run&quot;:.009208737864077669},{&quot;sign sum&quot;:.51425,&quot;mean run&quot;:.0002552870090634441},{&quot;sign sum&quot;:.49975,&quot;mean run&quot;:.00024183976261127595},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.97675,&quot;mean run&quot;:.01048901098901099},{&quot;sign sum&quot;:.64775,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.98325,&quot;mean run&quot;:.01442537313432836},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.37925,&quot;mean run&quot;:.05505555555555556},{&quot;sign sum&quot;:.9842500000000001,&quot;mean run&quot;:.01589344262295082},{&quot;sign sum&quot;:.98375,&quot;mean run&quot;:.015373015873015873},{&quot;sign sum&quot;:.97275,&quot;mean run&quot;:.009023809523809524},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.36724999999999997,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.98375,&quot;mean run&quot;:.0151171875},{&quot;sign sum&quot;:.50225,&quot;mean run&quot;:.0002718146718146718},{&quot;sign sum&quot;:.49975,&quot;mean run&quot;:.00024925037481259374},{&quot;sign sum&quot;:.32325000000000004,&quot;mean run&quot;:.0395},{&quot;sign sum&quot;:.96875,&quot;mean run&quot;:.007764462809917355},{&quot;sign sum&quot;:.9862500000000001,&quot;mean run&quot;:.017681818181818184},{&quot;sign sum&quot;:.42525,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.49725,&quot;mean run&quot;:.00024367559523809522},{&quot;sign sum&quot;:.49375,&quot;mean run&quot;:.00026414373088685017},{&quot;sign sum&quot;:.9652499999999999,&quot;mean run&quot;:.006799270072992701},{&quot;sign sum&quot;:.99475,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.98275,&quot;mean run&quot;:.01442537313432836},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.32325000000000004,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.47025,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.32675,&quot;mean run&quot;:.042978260869565216},{&quot;sign sum&quot;:.55225,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.50375,&quot;mean run&quot;:.0002583459787556904},{&quot;sign sum&quot;:.96375,&quot;mean run&quot;:.006694244604316547},{&quot;sign sum&quot;:.9742500000000001,&quot;mean run&quot;:.009809278350515465},{&quot;sign sum&quot;:.67625,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.61575,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.59875,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.49575,&quot;mean run&quot;:.0002447839046199702},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.26575,&quot;mean run&quot;:.042978260869565216},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.9632499999999999,&quot;mean run&quot;:.0063027210884353735},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.48775,&quot;mean run&quot;:.00025037537537537537},{&quot;sign sum&quot;:.9802500000000001,&quot;mean run&quot;:.012826666666666667},{&quot;sign sum&quot;:.43125,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.59175,&quot;mean run&quot;:.042978260869565216},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.96675,&quot;mean run&quot;:.007018796992481203},{&quot;sign sum&quot;:.99175,&quot;mean run&quot;:.029803030303030303},{&quot;sign sum&quot;:.98775,&quot;mean run&quot;:.01990816326530612},{&quot;sign sum&quot;:.49375,&quot;mean run&quot;:.0002532027128862095},{&quot;sign sum&quot;:.97175,&quot;mean run&quot;:.008349557522123893},{&quot;sign sum&quot;:.61075,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.98875,&quot;mean run&quot;:.021722222222222223},{&quot;sign sum&quot;:.49725,&quot;mean run&quot;:.0002692307692307692},{&quot;sign sum&quot;:.50775,&quot;mean run&quot;:.00023855243722304285},{&quot;sign sum&quot;:.44325,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.97875,&quot;mean run&quot;:.011548192771084338},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.99075,&quot;mean run&quot;:.026527027027027028},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.49725,&quot;mean run&quot;:.0002589217919514047},{&quot;sign sum&quot;:.96225,&quot;mean run&quot;:.006211409395973155},{&quot;sign sum&quot;:.9762500000000001,&quot;mean run&quot;:.010026315789473685},{&quot;sign sum&quot;:.97325,&quot;mean run&quot;:.008845794392523365},{&quot;sign sum&quot;:.99275,&quot;mean run&quot;:.03398275862068966},{&quot;sign sum&quot;:.50625,&quot;mean run&quot;:.0002520692249811889},{&quot;sign sum&quot;:.38125,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.50825,&quot;mean run&quot;:.0002515037593984962},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.96875,&quot;mean run&quot;:.0075},{&quot;sign sum&quot;:.50325,&quot;mean run&quot;:.0002451564828614009},{&quot;sign sum&quot;:.50125,&quot;mean run&quot;:.00025642965204236007},{&quot;sign sum&quot;:.99375,&quot;mean run&quot;:.0395},{&quot;sign sum&quot;:.51075,&quot;mean run&quot;:.00023800738007380073},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50925,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.49125,&quot;mean run&quot;:.0002680491551459294},{&quot;sign sum&quot;:.98275,&quot;mean run&quot;:.013992753623188406},{&quot;sign sum&quot;:.56725,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.98575,&quot;mean run&quot;:.01704385964912281},{&quot;sign sum&quot;:.9762500000000001,&quot;mean run&quot;:.010026315789473685},{&quot;sign sum&quot;:.61325,&quot;mean run&quot;:.06196875},{&quot;sign sum&quot;:.97125,&quot;mean run&quot;:.008195652173913043},{&quot;sign sum&quot;:.9722500000000001,&quot;mean run&quot;:.008586363636363637},{&quot;sign sum&quot;:.50175,&quot;mean run&quot;:.00026707597851112816},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50775,&quot;mean run&quot;:.00025585789871504153},{&quot;sign sum&quot;:.51075,&quot;mean run&quot;:.000257002271006813},{&quot;sign sum&quot;:.37375,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.50075,&quot;mean run&quot;:.00026472838561591435},{&quot;sign sum&quot;:.50525,&quot;mean run&quot;:.0002583459787556904},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.49925,&quot;mean run&quot;:.00025490936555891235},{&quot;sign sum&quot;:.49775,&quot;mean run&quot;:.00022796795338674437},{&quot;sign sum&quot;:.51275,&quot;mean run&quot;:.0002680491551459294},{&quot;sign sum&quot;:.96825,&quot;mean run&quot;:.0075},{&quot;sign sum&quot;:.41875,&quot;mean run&quot;:.06616666666666667},{&quot;sign sum&quot;:.50675,&quot;mean run&quot;:.00024201930215293242},{&quot;sign sum&quot;:.50325,&quot;mean run&quot;:.0002606544901065449},{&quot;sign sum&quot;:.49125,&quot;mean run&quot;:.00025187969924812034},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50775,&quot;mean run&quot;:.0002571969696969697},{&quot;sign sum&quot;:.49175,&quot;mean run&quot;:.0002676651305683564},{&quot;sign sum&quot;:.99475,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.49525,&quot;mean run&quot;:.0002458955223880597},{&quot;sign sum&quot;:.97725,&quot;mean run&quot;:.010735955056179776},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.61675,&quot;mean run&quot;:.042978260869565216},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50825,&quot;mean run&quot;:.0002662835249042146},{&quot;sign sum&quot;:.50775,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.50525,&quot;mean run&quot;:.0002532027128862095},{&quot;sign sum&quot;:.49675,&quot;mean run&quot;:.0002479431563201197},{&quot;sign sum&quot;:.44375,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.37424999999999997,&quot;mean run&quot;:.042978260869565216},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.49375,&quot;mean run&quot;:.0002664877300613497},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50225,&quot;mean run&quot;:.00026123381568926124},{&quot;sign sum&quot;:.45425,&quot;mean run&quot;:.06616666666666667},{&quot;sign sum&quot;:.49725,&quot;mean run&quot;:.00024925037481259374},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.58325,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.52675,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.49675,&quot;mean run&quot;:.00022427536231884058},{&quot;sign sum&quot;:.97075,&quot;mean run&quot;:.008047008547008547},{&quot;sign sum&quot;:.50275,&quot;mean run&quot;:.00025757575757575756},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.99875,&quot;mean run&quot;:.1995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.49425,&quot;mean run&quot;:.0002606544901065449},{&quot;sign sum&quot;:.57625,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.99075,&quot;mean run&quot;:.026527027027027028},{&quot;sign sum&quot;:.98325,&quot;mean run&quot;:.01442537313432836},{&quot;sign sum&quot;:.50275,&quot;mean run&quot;:.0002520692249811889},{&quot;sign sum&quot;:.9702500000000001,&quot;mean run&quot;:.007903361344537816},{&quot;sign sum&quot;:.36975,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.9822500000000001,&quot;mean run&quot;:.013992753623188406},{&quot;sign sum&quot;:.49375,&quot;mean run&quot;:.0002577710386656558},{&quot;sign sum&quot;:.49425,&quot;mean run&quot;:.0002635599694423224},{&quot;sign sum&quot;:.51175,&quot;mean run&quot;:.0002639419404125287},{&quot;sign sum&quot;:.50175,&quot;mean run&quot;:.00023982235381199112},{&quot;sign sum&quot;:.50225,&quot;mean run&quot;:.0002532027128862095},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.96375,&quot;mean run&quot;:.006592198581560283},{&quot;sign sum&quot;:.86625,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.98875,&quot;mean run&quot;:.021722222222222223},{&quot;sign sum&quot;:.9902500000000001,&quot;mean run&quot;:.025141025641025643},{&quot;sign sum&quot;:.49325,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.99975,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.99875,&quot;mean run&quot;:.1995},{&quot;sign sum&quot;:.51325,&quot;mean run&quot;:.0002676651305683564},{&quot;sign sum&quot;:.49625,&quot;mean run&quot;:.0002532027128862095},{&quot;sign sum&quot;:.49225,&quot;mean run&quot;:.00024367559523809522},{&quot;sign sum&quot;:.7282500000000001,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.57025,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.98125,&quot;mean run&quot;:.013198630136986302},{&quot;sign sum&quot;:.48525,&quot;mean run&quot;:.05502777777777778},{&quot;sign sum&quot;:.45225,&quot;mean run&quot;:.05505555555555556},{&quot;sign sum&quot;:.97725,&quot;mean run&quot;:.010735955056179776},{&quot;sign sum&quot;:.47675,&quot;mean run&quot;:.06616666666666667},{&quot;sign sum&quot;:.57775,&quot;mean run&quot;:.062},{&quot;sign sum&quot;:.49725,&quot;mean run&quot;:.0002479431563201197},{&quot;sign sum&quot;:.50025,&quot;mean run&quot;:.0002616146230007616},{&quot;sign sum&quot;:.50625,&quot;mean run&quot;:.0002524454477050414},{&quot;sign sum&quot;:.53725,&quot;mean run&quot;:.05505555555555556},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50225,&quot;mean run&quot;:.00024239049740163327},{&quot;sign sum&quot;:.30925,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.51225,&quot;mean run&quot;:.00025433962264150944},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.51025,&quot;mean run&quot;:.00023763837638376384},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.99475,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.49675,&quot;mean run&quot;:.00024146884272997033},{&quot;sign sum&quot;:.9742500000000001,&quot;mean run&quot;:.0094009900990099},{&quot;sign sum&quot;:.98875,&quot;mean run&quot;:.021722222222222223},{&quot;sign sum&quot;:.23125,&quot;mean run&quot;:.03796153846153846},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.98475,&quot;mean run&quot;:.01704385964912281},{&quot;sign sum&quot;:.48475,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.99275,&quot;mean run&quot;:.03398275862068966},{&quot;sign sum&quot;:.50525,&quot;mean run&quot;:.0002676651305683564},{&quot;sign sum&quot;:.34775,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.96075,&quot;mean run&quot;:.005869426751592357},{&quot;sign sum&quot;:.9842500000000001,&quot;mean run&quot;:.01589344262295082},{&quot;sign sum&quot;:.50125,&quot;mean run&quot;:.00023313782991202345},{&quot;sign sum&quot;:.50475,&quot;mean run&quot;:.00026472838561591435},{&quot;sign sum&quot;:.98975,&quot;mean run&quot;:.023890243902439025},{&quot;sign sum&quot;:.49725,&quot;mean run&quot;:.00025872534142640366},{&quot;sign sum&quot;:.50175,&quot;mean run&quot;:.0002635599694423224},{&quot;sign sum&quot;:.23075,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.50625,&quot;mean run&quot;:.05213157894736842},{&quot;sign sum&quot;:.96775,&quot;mean run&quot;:.0072519379844961235},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.13374999999999998,&quot;mean run&quot;:.04711904761904762},{&quot;sign sum&quot;:.97975,&quot;mean run&quot;:.012158227848101265},{&quot;sign sum&quot;:.99575,&quot;mean run&quot;:.058323529411764705},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.15875,&quot;mean run&quot;:.042978260869565216},{&quot;sign sum&quot;:.96925,&quot;mean run&quot;:.007903361344537816},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.50375,&quot;mean run&quot;:.0002656967840735069},{&quot;sign sum&quot;:.99975,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.51075,&quot;mean run&quot;:.00024183976261127595},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.61375,&quot;mean run&quot;:.05505555555555556},{&quot;sign sum&quot;:.47075,&quot;mean run&quot;:.06616666666666667},{&quot;sign sum&quot;:.72475,&quot;mean run&quot;:.0495},{&quot;sign sum&quot;:.25425,&quot;mean run&quot;:.0395},{&quot;sign sum&quot;:.36724999999999997,&quot;mean run&quot;:.05505555555555556},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.98075,&quot;mean run&quot;:.012833333333333334},{&quot;sign sum&quot;:.64225,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.96675,&quot;mean run&quot;:.007630081300813008},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.9802500000000001,&quot;mean run&quot;:.012833333333333334},{&quot;sign sum&quot;:.50325,&quot;mean run&quot;:.00027241112828438953},{&quot;sign sum&quot;:.96275,&quot;mean run&quot;:.0063965517241379305},{&quot;sign sum&quot;:.50075,&quot;mean run&quot;:.0002524454477050414},{&quot;sign sum&quot;:.99875,&quot;mean run&quot;:.1995},{&quot;sign sum&quot;:.44425,&quot;mean run&quot;:.05505555555555556},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995},{&quot;sign sum&quot;:.64825,&quot;mean run&quot;:.044954545454545455},{&quot;sign sum&quot;:.00024999999999997247,&quot;mean run&quot;:.9995}]},{}],350:[function(t,e,n){const r=t(&quot;lodash&quot;);function i(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function o(t,e,n){if(e&gt;=n)return;const r=function(t,e,n){let r=t[n],o=e;for(let a=e;a&lt;n;a++)t[a]&lt;r&amp;&amp;(o!=a&amp;&amp;i(t,o,a),o++);return i(t,o,n),o}(t,e,n);o(t,e,r-1),o(t,r+1,n)}const a={bubble:function(t){let e;do{e=!1;for(let n=0;n&lt;t.length-1;n++)t[n]&gt;t[n+1]&amp;&amp;(i(t,n,n+1),e=!0)}while(e)},insert:function(t){for(let n=0;n&lt;t.length;n++){let r=t[n];for(var e=n-1;e&gt;-1&amp;&amp;t[e]&gt;r;e--)t[e+1]=t[e];t[e+1]=r}},quick:function(t){return o(t,0,t.length-1)}};e.exports.sorts=r.keys(a),e.exports.sortFuncs=a},{lodash:337}]},{},[5]);
&lt;/script&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:run&quot;&gt;
      &lt;p&gt;A run is a contiguous sorted subsequence, i.e., a cluster of data that is already sorted within the larger dataset. &lt;a href=&quot;#fnref:run&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:drl&quot;&gt;
      &lt;p&gt;With just two inputs and one output, we could’ve easily (and, if this were a real system, should’ve!) used something simpler, like a decision tree. But what fun would that be? &lt;a href=&quot;#fnref:drl&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:cmab&quot;&gt;
      &lt;p&gt;There are many overviews available. For one, see: Chapelle and Li. “An Empirical Evaluation of Thompson Sampling.” In Advances in Neural Information Processing Systems. NIPS’11. &lt;a href=&quot;#fnref:cmab&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:explore&quot;&gt;
      &lt;p&gt;Testing these catastrophic policies is a necessary part of most reinforcement learning – after all, if we do not test the policy, how will we ever learn it is catastrophic? We don’t want the performance of real world systems to suffer while our models explores no-good possibilities. Figuring out how to avoid such catastrophic detours is &lt;a href=&quot;https://arxiv.org/abs/1808.07903&quot;&gt;an active area of research&lt;/a&gt;. &lt;a href=&quot;#fnref:explore&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Thu, 06 Jun 2019 00:00:00 +0000</pubDate>
        <link>/blog/2019/06/06/ml4sys-in-your-browser.html</link>
        <guid isPermaLink="true">/blog/2019/06/06/ml4sys-in-your-browser.html</guid>
      </item>
    
      <item>
        <title>Good comment, bad comment</title>
        <description>&lt;p&gt;Having spent five years &lt;a href=&quot;https://github.com/RyanMarcus/2ndSemesterProgrammingAssignments&quot;&gt;heavily involved&lt;/a&gt; in teaching the 2nd semester programming course at Brandeis, I’ve found myself repeating the same maxim over and over again:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Code is an essay written for two audiences: the computer, and your fellow programmers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thinking about the dual-audience nature of code immediately highlights several important aspects of “good code”:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;When “read” by the computer, good code leads to a &lt;em&gt;correct&lt;/em&gt;, &lt;em&gt;effective&lt;/em&gt;, and &lt;em&gt;efficient&lt;/em&gt; behavior. The desired outcome is achieved (correct) in a reasonable amount of time (effective) without consuming an unreasonable amount of resources (efficient).&lt;/li&gt;
  &lt;li&gt;When read by your fellow programmers, good code reads like an essay that &lt;em&gt;intuitively&lt;/em&gt;, &lt;em&gt;succinctly&lt;/em&gt;, and &lt;em&gt;precisely&lt;/em&gt; describes the semantics of the problem and how it is solved. In other words, the code is not overly long and verbose (succinct), the code conveys the exact details of what is happening to the reader (precise), and the code does so in a way that makes sense to the reader quickly (intuitive).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In my experience reading thousands (really!) of different solutions to the same problem, I find that the best code follows all six of these principles. In this post, I want to go through each principle, showing both good and bad examples. Each example will be a “real” piece of code written by a student (anonymized, of course), including myself (I have to get the bad examples from somewhere).&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#computer&quot;&gt;For the computer&lt;/a&gt;
    &lt;ol&gt;
      &lt;li&gt;&lt;a href=&quot;#correct&quot;&gt;Correct&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#effective&quot;&gt;Effective&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#efficient&quot;&gt;Efficient&lt;/a&gt;&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#fellow&quot;&gt;For your fellow programmers&lt;/a&gt;
    &lt;ol&gt;
      &lt;li&gt;&lt;a href=&quot;#intuitive&quot;&gt;Intuitive&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#succinct&quot;&gt;Succinct&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#precise&quot;&gt;Precise&lt;/a&gt;&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#conclusions&quot;&gt;Conclusions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a name=&quot;computer&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;for-the-computer&quot;&gt;For the computer&lt;/h1&gt;
&lt;p&gt;All in all, contemporary computer science departments do a pretty good job of teaching students to write correct, effective, and efficient code. In fact, new programmers tend to optimize for their robotic audiences over their fellow humans – “if it works, who cares?” If a computer wasn’t part of our audience, we might not choose to write code at all.&lt;/p&gt;

&lt;p&gt;However, new programmers are often very frustrated by a computer “not doing what I meant.” Understanding how to translate our thoughts into code is a fundamental skill that looks a whole lot like the writing process. The next three sections explain what I believe to be the three properties of good code from the point of view of the computer audience.&lt;/p&gt;

&lt;p&gt;&lt;a name=&quot;correct&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;correct&quot;&gt;Correct&lt;/h2&gt;
&lt;p&gt;When thinking about the computer as the audience for our code, we want our code to cause the computer to compute the correct result. Correctness may seem like the most obvious principle we would want good code to embody – but correctness is often subtle, underspecified, or misunderstood. For example, consider the following prompt and solution:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Write a method &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;randItem(int[] arr)&lt;/code&gt; that returns an item selected uniformally at random from the  passed array.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;randItem&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)];&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;At first glance, you might think this code is just fine – &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math.random()&lt;/code&gt; returns a uniform value from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt;, multiplying that by the array length and truncating to an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int&lt;/code&gt; should give a uniformally distributed array index. You might raise a complaint that the programming didn’t use Java’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Random&lt;/code&gt; class, but that’s not a correctness issue, right?&lt;/p&gt;

&lt;p&gt;It turns out the above code is very subtly incorrect. To understand why, let’s simplify the problem a little bit. Imagine that our input array &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;arr&lt;/code&gt; is of size 5, and that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math.random()&lt;/code&gt; returned a 4-bit random number between 0 and 1. Let’s look at the possible values of our array index:&lt;/p&gt;

&lt;table&gt;
    &lt;thead&gt;&lt;tr&gt;&lt;th&gt;Binary&lt;/th&gt;&lt;th&gt;Decimal&lt;/th&gt;&lt;th&gt;Array Index&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;&lt;td&gt;0000&lt;/td&gt;&lt;td&gt;0.0000&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;0001&lt;/td&gt;&lt;td&gt;0.0625&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;0010&lt;/td&gt;&lt;td&gt;0.1250&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;0011&lt;/td&gt;&lt;td&gt;0.1875&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;0100&lt;/td&gt;&lt;td&gt;0.2500&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;0101&lt;/td&gt;&lt;td&gt;0.3125&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;0110&lt;/td&gt;&lt;td&gt;0.3750&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;0111&lt;/td&gt;&lt;td&gt;0.4375&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;1000&lt;/td&gt;&lt;td&gt;0.5000&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;1001&lt;/td&gt;&lt;td&gt;0.5625&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;1010&lt;/td&gt;&lt;td&gt;0.6250&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;1011&lt;/td&gt;&lt;td&gt;0.6875&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;1100&lt;/td&gt;&lt;td&gt;0.7500&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;1101&lt;/td&gt;&lt;td&gt;0.8125&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;1110&lt;/td&gt;&lt;td&gt;0.8750&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt; 
        &lt;tr&gt;&lt;td&gt;1111&lt;/td&gt;&lt;td&gt;0.9375&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt; 
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Spot the problem? In this case, four values of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math.random()&lt;/code&gt; map to index 0, but only three values map to all the other elements! That means this method will return the first element of the array with probabilty &lt;span id=&quot;il171&quot;&gt;&lt;/span&gt;, while the other elements will each be returned with a probability of &lt;span id=&quot;il172&quot;&gt;&lt;/span&gt;! That’s not uniform at all.&lt;/p&gt;

&lt;p&gt;Now, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math.random()&lt;/code&gt; returns a double, which has a lot more than 4 bits, and only a subset of all possible &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;double&lt;/code&gt; values are within the range (0, 1). But, saying there are exactly &lt;span id=&quot;il173&quot;&gt;&lt;/span&gt; possible return values for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math.random()&lt;/code&gt; and &lt;span id=&quot;il174&quot;&gt;&lt;/span&gt; elements in our array &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;arr&lt;/code&gt;, this method only &lt;em&gt;potentially&lt;/em&gt; works if &lt;span id=&quot;il174&quot;&gt;&lt;/span&gt; divides &lt;span id=&quot;il173&quot;&gt;&lt;/span&gt;, i.e. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n % k == 0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A more correct way to write this code would be:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Random&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;randItem&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;nextInt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)];&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Since the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nextInt&lt;/code&gt; method ensures that we are drawing from a uniform distribution,&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; this code produces a result more in-line with the prompt. The point here is that correctness can be subtle, and that a computer will happily do whatever you tell it – and sometimes the wrong thing can look a whole lot like the right thing at first glance.&lt;/p&gt;

&lt;p&gt;&lt;a name=&quot;effective&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;effective&quot;&gt;Effective&lt;/h2&gt;
&lt;p&gt;In addition to being correct, we also want our code to cause our computer audiences to compute results effectively. We all know we want code that runs fast, and we learn tools like big-O analysis to help us make good decisions along the way. But sometimes, something seemingly-mundane, or that you think should be fast, can end up taking a very long time. There’s even &lt;a href=&quot;https://accidentallyquadratic.tumblr.com/&quot;&gt;a Tumblr about this phenomenon in very real code&lt;/a&gt;. Here’s an example of this in code written by myself a long time ago, and by numerous other students ever since:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Write a method &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;combine(String[] args)&lt;/code&gt; that returns a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;String&lt;/code&gt; containing each element of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;args&lt;/code&gt; connected with spaces, in order. If &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;args&lt;/code&gt; is empty, return the empty string.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;combine&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;collector&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;el&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;collector&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;el&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// Cut off the last space.&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;collector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;substring&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;collector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Seems straight-forward enough, right? Cutting off that last space was a little tricky. New developers might not even think to analyze the runtime of this method, or if they did, they might declare it to be linear in the size of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;args&lt;/code&gt;. More seasoned (read: cynical) developers might begin to smell trouble, though.&lt;/p&gt;

&lt;p&gt;The way Java represents strings is different from many other languages. In Java, strings are &lt;em&gt;immutable&lt;/em&gt;. Once they are created, they can’t be modified. So if they can’t be modified, what happens when the program executes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;collector += el + &quot; &quot;&lt;/code&gt;? Well, unfortunately, Java will create a brand new string, copying the contents of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;collector&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;el&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot; &quot;&lt;/code&gt; into it. Java will perform this create and copy operation &lt;em&gt;at every loop iteration&lt;/em&gt;, which means that our runtime is actually &lt;em&gt;quadratic&lt;/em&gt; in the size of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;args&lt;/code&gt;!&lt;/p&gt;

&lt;p&gt;Since the good folks working on Java know that developers sometimes need to concatenate strings, Java has a handy &lt;a href=&quot;https://docs.oracle.com/javase/9/docs/api/java/lang/StringBuilder.html&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StringBuilder&lt;/code&gt;&lt;/a&gt; class for this exact situation!&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;combine&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;nc&quot;&gt;StringBuilder&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;collector&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StringBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;el&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;collector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;collector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// Cut off the last space.&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;collector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;substring&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;collector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now our code is much more effective.&lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; The point here is to show that performance bugs can often be hard to notice, and can creep into code in subtle ways that might elude someone who isn’t looking closely for them.&lt;/p&gt;

&lt;p&gt;&lt;a name=&quot;efficient&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;efficient&quot;&gt;Efficient&lt;/h2&gt;
&lt;p&gt;When I was a new programmer, I didn’t really think about the resource usage of my application. It either ran, or it didn’t. Most of the programs I was writing were “short-lived”: I started them and waited for them to finish, normally a few moments later. Even if one of my programs used a ton of memory or temporary disk space, I wouldn’t notice, because my operating system would liberate all these resources from my greedy program after my program terminated.&lt;/p&gt;

&lt;p&gt;However, as I gained more experience and started writing longer-living programs, like servers (or “services”, as the kids call ‘em nowadays), I started to feel the pain of all my inefficient code. This pain came mostly in the form of &lt;em&gt;memory leaks&lt;/em&gt;: bugs in my programs that caused more and more memory to be used up until there was none left.&lt;/p&gt;

&lt;p&gt;Many programmers who swear by languages like Java or Python believe that their language’s garbage collector – the part of the language responsible for reclaiming objects we aren’t using anymore – makes them immune to memory leaks. While it is true that these garbage collectors prevent the majority of memory leaks, I was a poor enough Java programmer to create several! Here’s an example of one written for a class (not by me, but making the same mistake I did):&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Write a class &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BoundedStack&amp;lt;T&amp;gt;&lt;/code&gt; with methods &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;push&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pop&lt;/code&gt; that behaves like a stack with a bound on the number of items it can contain. Take the bound as a parameter in the constructor.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BoundedStack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;BoundedStack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bound&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bound&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 
            &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;IllegalStateException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 
            &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;IllegalStateException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Overall, looks fine, right? But this implementation of a bounded stack actually has a memory leak. Consider the following client code:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;BoundedStack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ReallyBigType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BoundedStack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReallyBigType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReallyBigType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReallyBigType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;performTask&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Imagine that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReallyBigType&lt;/code&gt; is a class that uses a whole bunch of memory. When &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;performTask&lt;/code&gt; is called, the programmer might be expecting that all the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReallyBigType&lt;/code&gt; instances created beforehand will be freed up, so that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;performTask&lt;/code&gt; can use as much memory as it needs. However, this isn’t really the case – all three instances of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReallyBigType&lt;/code&gt; are guaranteed to still be around when &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;performTask&lt;/code&gt; is called!&lt;/p&gt;

&lt;p&gt;The reason all three instances of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReallyBigType&lt;/code&gt; are still around is that our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BoundedStack&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s&lt;/code&gt;, is still holding a reference to them. Even though we decremented the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;topIdx&lt;/code&gt; variable whenever &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pop()&lt;/code&gt; was called, the values in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;storage&lt;/code&gt; (in positions 0, 1, and 2) still point to our instances of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReallyBigType&lt;/code&gt;! That’s a memory leak. If this were a large, long-running application, small errors like that could build up, resulting in a system that needs to be frequently rebooted.&lt;/p&gt;

&lt;p&gt;Luckily, this memory leak is easy enough to fix:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BoundedStack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;BoundedStack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bound&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bound&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 
            &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;IllegalStateException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 
            &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;IllegalStateException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
            
        &lt;span class=&quot;no&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;topIdx&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--;&lt;/span&gt;
        
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;By setting the now-unused cells of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;storage&lt;/code&gt; array to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt;, we avoid holding a reference, allowing the Java garbage collector to do its work. The point here is that just writing fast, correct code isn’t enough: good code behaves well even in long running, resource-scarce environments.&lt;/p&gt;

&lt;p&gt;&lt;a name=&quot;fellow&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;for-your-fellow-programmers&quot;&gt;For your fellow programmers&lt;/h1&gt;
&lt;p&gt;Despite all the difficulties of writing to your computer audience, writing to your human audience is often much harder. After all, writing and composition&lt;sup id=&quot;fnref:3&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; have entire classes of their own! Good code shares a lot of properties with good writing. Specifically, I’ve found that most good (technical) writing and good code I’ve read follows three  principles. First, I’ll give an overview of each of these principles, and the proceeding subsections will expand on them.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Intuitive&lt;/strong&gt;: It is well-structured and easy to understand. For human readers, packages, classes, methods, and code chunks serve a similar purpose to chapters, sections, subsections, and paragraphs. Breaking down complex ideas into small, composable pieces is a fundamental skill in both programming and writing. This is how we turn complex ideas into intuitive concepts.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Succinct&lt;/strong&gt;: It is just long enough. The phrase “if I had more time, I would write a shorter letter” comes to mind here. In high school, you may have learned to “pad out” your essays with unnecessary verbiage. Unfortunately, you’ll need to unlearn that, both for writing code and papers. Nobody wants to spend three hours reading your multi-page comment. The goal should be to get the idea across in the &lt;em&gt;fewest words possible&lt;/em&gt; (so perhaps this blog post isn’t the best example).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Precise&lt;/strong&gt;: It isn’t too “hand-wavy.” The code should communicate to the human reader exactly what is going on, and not attempt to “gloss over” or cover up the details.&lt;sup id=&quot;fnref:4&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, luckily for us, we have a bit of a “cheat code” when communicating with human audiences through our code. Specifically, we have &lt;em&gt;comments&lt;/em&gt;, which are invisible to our robot audiences, and &lt;em&gt;variable names&lt;/em&gt;, which are meaningless to our robot audiences. We can take code the computer is already happy with (correct, effective, efficient), and we can use these two tools to annotate that code to make our human audience happy as well.&lt;/p&gt;

&lt;p&gt;As a warning, this part is going to be a lot more subjective than the previous part. I’ll do my best to give examples that I think most of the professional software engineers &lt;a href=&quot;https://rmarcus.info/blog/assets/RMarcusCV.pdf&quot;&gt;I’ve worked with&lt;/a&gt; would agree on. It’s important to realize that a lot of what makes code readable (and what makes writing good or bad) &lt;em&gt;depends on your audience&lt;/em&gt;. So if your audience has certain norms – like indention style, variable naming style, etc. – following them is in your best interest. Otherwise, you’ll be written off from the get-go.&lt;/p&gt;

&lt;p&gt;Take a quick look at the two papers below.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/goodbadcomment/papers.png&quot; alt=&quot;Two papers, one poorly formatted&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You don’t have to be able to see the words to know which paper “looks” better. We have established conventions for writing, and when they aren’t followed, it is immediately jarring. And while eschewing these structures can sometimes be considered &lt;a href=&quot;https://en.wikipedia.org/wiki/Infinite_Jest&quot;&gt;“art,”&lt;/a&gt; you generally want to match the expectations of your audience. Software engineers are no different – if your code doesn’t “look” right (perhaps it isn’t indented properly, or your variable names are unconventional), the actual code you wrote probably won’t matter… the engineer will just dismiss it out of hand.&lt;/p&gt;

&lt;p&gt;Part of becoming a good programmer is learning and practicing those norms. You can take advantage of them to convey information quickly and succinctly, or you can fight an uphill battle against them. Unless you’ve got a really good reason, don’t try to make your readers learn a new convention &lt;em&gt;and&lt;/em&gt; your complex idea at the same time! Instead, try to use the conventions as rails for your code.&lt;/p&gt;

&lt;p&gt;These next sections will continue with a mix of Java and Python, but I’ll do my best to include only the norms that are common among most languages. Any specific language you use likely has its own norms (for example, &lt;a href=&quot;https://en.wikipedia.org/wiki/Javadoc&quot;&gt;JavaDoc&lt;/a&gt;), and you should learn them – but we’ll keep it general here.&lt;/p&gt;

&lt;p&gt;&lt;a name=&quot;intuitive&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;intuitive&quot;&gt;Intuitive&lt;/h2&gt;
&lt;p&gt;Most (scientific / technical) writing has the goal of &lt;em&gt;conveying intuition&lt;/em&gt;. The writer has an idea in their head that they’ve thought about deeply. They’ve analyzed it, broken it down, tried a million different things, and, at long last, they have a really good understanding of it. The writer’s goal is to create a paper that, when read by other scientists, “fast-forwards” them through that potentially multi-year process, transferring the intuition in their head to paper. In this way, reading a paper can be a lot like time travel: it lets you learn what took years to discover in just a few short hours. This is what Newton meant when he said “if I have seen further it is by standing on the shoulders of Giants.” Good code works the same way.&lt;/p&gt;

&lt;p&gt;This is also an &lt;em&gt;extremely&lt;/em&gt; difficult task, and the people who are the best at it often become professors at research institutions. It’s a high bar for writing, and it’s an even higher bar for code, but the same idea applies. Developers who write code that can convey intuition to other developers drastically boost the productivity of their teams, and ensure the longevity of their projects. The people who are best at it &lt;a href=&quot;https://en.wikipedia.org/wiki/Jeff_Dean_(computer_scientist)&quot;&gt;become the director of AI for Google&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Dave_Cutler#Microsoft_(1988_to_Present)&quot;&gt;senior technical fellows at Microsoft&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Consider the following prompt and solution:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Write a method &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;isUnique&lt;/code&gt; which, when given a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Map&amp;lt;String, String&amp;gt;&lt;/code&gt;, returns &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;true&lt;/code&gt; if no two keys  map to the same value, and false otherwise. Return true if the map is empty.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isUnique&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HashSet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, this code is correct, and is reasonably efficient and effective. It is, however, still &lt;em&gt;very bad code&lt;/em&gt;. The reason why it is bad code is that the code isn’t intuitive – there’s no connection from the line as written to the prompt. Here’s a way to improve it:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isUnique&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// By placing all the map&apos;s values into a set, we &lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// collapse any duplicates. Then, if the number&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// of uniqueValues is equal to the total number &lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// of values, all values must be unique.&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Set&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;uniqueValues&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HashSet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;uniqueValues&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In my opinion, this comment and the new, named intermediate variable greatly clarify the code. Of course, it still needs a “top level” comment above the method signature to describe what it does, but that will look a lot like the prompt. Here’s another way to improve the original code:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isUnique&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Test if bijection using incl/excl.&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Set&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;AuB&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HashSet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;AuB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, is this “good code”? Maybe if you were writing a mathematics library and all of your potential readers were extremely well-acquainted with &lt;a href=&quot;https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle&quot;&gt;the inclusion-exclusion principle&lt;/a&gt;, but in most situations this might be even worse than where we started. The majority of software engineers would scoff at this, likely assuming it was pretentious.&lt;/p&gt;

&lt;p&gt;Another way to make code more intuitive is to connect each variable, method, etc. to a &lt;em&gt;semantic&lt;/em&gt; concept in the real world. Remember, most code is trying to model or represent some real-world thing or idea. For example, consider the following code:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compute_point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pi&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;return &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, what does this code do? Well, I know. Because I wrote it. Or I should say, I know today, and maybe next week, but I might not know in a year. However, by &lt;em&gt;just changing the variable names&lt;/em&gt;, we can convey a whole lot more intuition:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compute_hour_hand_position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hrs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mins&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hrs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mins&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;secs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pi&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;return &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, the resulting code isn’t perfect, but it’s &lt;em&gt;way better&lt;/em&gt;. I can now definitely tell, for example, that this has something to do with time. It probably has something to do with an analog clock. If I have some more context from the file, I might know immediately that this code is computing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(x, y)&lt;/code&gt; coordinates for an hour hand on clock. With just a few comments, we can make this obvious:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compute_hour_hand_position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hrs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mins&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hrs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mins&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;secs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pi&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# convert to radians
&lt;/span&gt;  
  &lt;span class=&quot;c1&quot;&gt;# Compute x and y coordinates from the angle.
&lt;/span&gt;  &lt;span class=&quot;nf&quot;&gt;return &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;theta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;By connecting the code to the real world, I now understand why the first line includes a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hrs % 12&lt;/code&gt; (the clock wraps around), and I understand why &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mins&lt;/code&gt; is divided by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;60&lt;/code&gt;, and why &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secs&lt;/code&gt; is divided by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;60*60&lt;/code&gt;. Vastly improved over the initial version.&lt;/p&gt;

&lt;p&gt;While none of the examples shown here are large or overly-complex, conveying the intuition behind your code only becomes more and more important as you “scale up” (i.e., get bigger and more complex). Practicing these techniques on small projects or assignments is critical to slowly developing the skills you need to write more complex code in an intuitive way.&lt;/p&gt;

&lt;p&gt;Making code intuitive is easily the hardest task facing any software engineer. It’s so extremely difficult that some developers&lt;sup id=&quot;fnref:5&quot;&gt;&lt;a href=&quot;#fn:5&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;5&lt;/a&gt;&lt;/sup&gt; have disavowed it entirely, claiming that their code “just makes sense to smarter people.” There’s a ton of this fake-flex, over-confident compensation in computer science. Try to assure yourself that they’re deluding themselves, and then try to avoid them as best you can.&lt;/p&gt;

&lt;p&gt;&lt;a name=&quot;succinct&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;succinct&quot;&gt;Succinct&lt;/h2&gt;
&lt;p&gt;One of the biggest mistakes I see new programmers make is being overly verbose with comments. Here’s a real(!) example of a simple program that prompts the user for their name and then greets them:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// the main entry method for the program, which&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// the java command line program will execute.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// prompt the user for their name using System.out, which &lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// is a PrintStream class. The PrintStream class has a&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// method called println, which will output the text&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// passed to the console (so that the user can see it) &lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// and then print a newline.&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Welcome to my program! What is your name? &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// this makes a new scanner, which can read from &lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// STDIN, located at System.in. The scanner lets us look&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// for tokens, aka stuff the user has entered.&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Scanner&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Scanner&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// this will create a new string variable called &quot;name&quot; &lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// and set the value to whatever the user types next&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;nextLine&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// finally we use println again, and string &lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// concatenation, with the + operator, to &lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// output or (sic) message!!&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hello &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; ! &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, clearly this was written by a new programmer who has paid attention in class, and was told to explain things in comments. To a new developer, all these language features (like the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;main&lt;/code&gt; method) are new, and seem worth… well, commenting on. No points against the new programmer. Part of the learning process.&lt;/p&gt;

&lt;p&gt;However, this is a great example of over-commenting. Any software engineer reading this will be quite annoyed wading through the long, verbose comments that are explaining Java language features. As a general rule, you should never use comments to describe a language feature: just assume your reader knows the language as well (perhaps an exception could be made if you use a really weird feature or something). Try to use comments to talk about the &lt;em&gt;why&lt;/em&gt;, rather than the &lt;em&gt;what&lt;/em&gt;. For example, we could rewrite this program like so:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Prompt the user for their name and greet them.&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Welcome to my program! What is your name? &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;nc&quot;&gt;Scanner&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Scanner&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;nextLine&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;

    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hello &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; ! &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We use a single comment to say “the why” of what we are doing. That is, we are describing the &lt;em&gt;semantics&lt;/em&gt; of the code as opposed to the &lt;em&gt;syntax&lt;/em&gt; of the code. Then we use some line breaks (“paragraphing”) to separate out the input and output sections. Much easier to read.&lt;/p&gt;

&lt;p&gt;Verbosity can come from more than just comments. Often, the code itself can be repetitive or overly verbose. Consider the following program:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Write a method &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;checkNames&lt;/code&gt; that takes in a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;List&amp;lt;String&amp;gt;&lt;/code&gt; of names and returns the valid names. A name is valid if it begins with a alphabetical character and has a length of at least 3.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;checkNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// creating a new arraylist&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;();&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//looping over the input&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;a&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;Z&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There’s a lot going on here, so we’ll try to break it down. The first thing almost any programmer will notice is that the code is very “crowded” – there’s no “paragraphing” or blank lines to indicate the logical chunks of the code. The second &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.length() &amp;gt; 2&lt;/code&gt; check is also completely redundant. The only two comments are also entirely useless. So let’s fix those things first:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;checkNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;();&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
      
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;a&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;Z&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Already, the code is starting to look a little bit more like code. The next thing we notice is that all of those &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;else&lt;/code&gt; blocks are useless – the loop continues without the explicit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;continue&lt;/code&gt; statement anyway. So we can remove them.&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;checkNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;();&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;a&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;Z&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Much shorter, but we can go a bit further. The index variable of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;for&lt;/code&gt; loop, and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;currentName&lt;/code&gt; variable, can be replaced with the “for each” pattern.&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;checkNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;();&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;a&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;Z&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now we’re getting somewhere. The next refactor is a bit of a matter of opinion, with older software developers generally siding “against” and younger software developers generally siding “for.” One heuristic you can use to try to tell if your code is too verbose is to count the number of levels of indentation. If you’re over three, something has probably gone wrong. We can fix it like this:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;checkNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;();&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;a&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;Z&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Every level of indentation adds another level of “context” that the developer has to remember, e.g. “ok, I’m inside this for loop, and this if statement, and this if statement…” By inverting each condition, each &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;if&lt;/code&gt; statement now reads more like “ignore names that fail this test.” Putting three of them in a row using the exact same formatting takes advantage of &lt;a href=&quot;https://owl.purdue.edu/owl/general_writing/mechanics/parallel_structure.html&quot;&gt;parallel structure&lt;/a&gt;, just like in writing. By the time you’ve read through the three &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;if&lt;/code&gt; statements, its clear you’re left with a name that meets the conditions.&lt;/p&gt;

&lt;p&gt;Finally, we can use a little Java API knowledge to make it slightly better, and add some semantic comments, to finish it off:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;checkNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;();&lt;/span&gt;
    
  &lt;span class=&quot;c1&quot;&gt;// Find the names that: (1) have three or more characters&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// and (2) start with a letter.&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(!&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Character&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isLetter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)))&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goodNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If we want to get a little advanced, we could’ve written the whole thing in an even more succinct way using Java streams:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;checkNames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// Find the names that: (1) have three or more characters&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// and (2) start with a letter.&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Character&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isLetter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)))&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;collect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Collectors&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The point of writing succinct code isn’t to show off. In fact, sometimes shorter code can be much more complex and harder to read. For example, consider swapping two variables in Java:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Every developer will recognize this as “swap code.” It’s a common pattern we see everywhere. However, an overly-clever developer might write:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;“It’s shorter by a whole four characters!”, proudly declares a young developer who is about to get a talking-to. This is known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/XOR_swap_algorithm&quot;&gt;XOR swap algorithm&lt;/a&gt;, and it is a neat trick, but its very opaque. Nobody knows what it is doing the first time they see it, and even after they know the trick, they might not be sure everything is in exactly the right order.&lt;sup id=&quot;fnref:6&quot;&gt;&lt;a href=&quot;#fn:6&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;6&lt;/a&gt;&lt;/sup&gt; This makes the code very unintuitive. Making code less succinct doesn’t conflict with making code intuitive as often as you’d think. Normally, making things shorter, while staying inside the conventions and norms of your language and community, makes things better. &lt;em&gt;Normally.&lt;/em&gt; Experience will teach you when something falls into the “XOR swap” category or not.&lt;/p&gt;

&lt;p&gt;Overall, making things short and succinct makes your code more readable. Other developer’s eyes won’t instantly glaze over as soon as they see your code. Since anything but a superhuman-level software developer can only keep so many lines of code in their head a time, making code shorter can often decrease the cognitive load required to read and understand your code. It’s tempting to measure the progress of a project by the number of lines of code you’ve written, but I promise, senior devs will respect a “small codebase that can do a lot” much more than a large codebase that only does a little.&lt;/p&gt;

&lt;p&gt;&lt;a name=&quot;precise&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;precise&quot;&gt;Precise&lt;/h2&gt;
&lt;p&gt;The last principle for our human audience is &lt;em&gt;precision&lt;/em&gt;. Writing comments that tell the user &lt;em&gt;vaguely&lt;/em&gt; what is happening is relatively easy – but writing a comment the succinctly conveys exactly what a program is doing is much, much harder. Luckily, code &lt;em&gt;has&lt;/em&gt; to be precise, so at a minimum, an unlucky developer can simply wade through every line to try and figure out what is going on. But we should have loftier goals.&lt;/p&gt;

&lt;p&gt;Consider the following prompt and solution:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Write a method that, given a height from which a ball was dropped in meters, computes the velocity of the ball when it hits the ground.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;velocity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// compute the v with the energy formula&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;sqrt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;2.0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;9.8&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s short and sweet, and it might even be good enough if your audience has a physics background. But for us non-physics folks… a little more explanation might be nice. Note that the comment “compute the v with the energy formula” &lt;em&gt;is&lt;/em&gt; entirely correct. It describes what the code does, semantically, but it is a little hand-wavy. What energy formula? There’s a few. What’s 9.8? How exactly did you reach this solution?&lt;/p&gt;

&lt;p&gt;A better version might be:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;GRAVITY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;9.8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;velocity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Compute v using the conservation of energy formula:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//     mass * gravity * height = (1/2) mass * velocity^2&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Mass cancels. Solve for velocity:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//    sqrt(2 * gravity * height) = velocity&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;sqrt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;2.0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;GRAVITY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now the code is a bit longer, but it is also a lot more precise – a reader without a ton of physics background can at least step through the algebra to convince themselves that the code is correct. Extracting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;9.8&lt;/code&gt; to a variable also makes the code more precisely match the formula. Again, if your target audience is a bunch of physicists, the commentary is probably not required. Context is king.&lt;/p&gt;

&lt;p&gt;There’s another, very easy way to add precision to code’s explanation, although it is only applicable in a few cases. Check out this chunk of code:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[][]&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;E&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[][]&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;J&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;no&quot;&gt;J&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;no&quot;&gt;J&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Double&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;POSITIVE_INFINITY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

		&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
			&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;se&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;se&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
				&lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;se&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
				&lt;span class=&quot;no&quot;&gt;J&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
			
			&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;		
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Understand what’s going? If so, I’m extremely impressed (and perhaps you need to see the last paragraph of the &lt;a href=&quot;#intuitive&quot;&gt;“Intuitive” section&lt;/a&gt;). To me, this is just about as bad as it gets. Short, one letter variable names. Absolutely no commenting. Random, complex manipulation of 2D arrays.&lt;/p&gt;

&lt;p&gt;… but what if I told you that &lt;em&gt;this one weird comment&lt;/em&gt; would transform this code from terrible to completely acceptable? Ready? Here it is…&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Algorithm for optimal piecewise approximation. &lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Transcribed exactly from:&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Mahlknecht, Dignös, and Gamper,  “A Scalable Dynamic &lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Programming Scheme for the Computation of Optimal &lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// k-Segments for Ordered Data.”&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// https://doi.org/10.1016/j.is.2016.08.002&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[][]&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;E&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[][]&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;J&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;no&quot;&gt;J&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;no&quot;&gt;J&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Double&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;POSITIVE_INFINITY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

		&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
			&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;se&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;se&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
				&lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;se&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
				&lt;span class=&quot;no&quot;&gt;J&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
			
			&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;		
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is a (in my opinion) complex dynamic programming algorithm for approximating a function of one variable with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k&lt;/code&gt; line segments. There’s absolutely no reason to re-explain an entire scientific paper in the comments of your code, unless you feel like you can do it &lt;em&gt;way&lt;/em&gt; better than the original authors. In terms of describing an algorithm, citing the paper (or textbook, with page number) from which it was transcribed is just about as precise (and succinct!) as you can get. Of course, this situation doesn’t come up too often, but when it does, it will be one of the most useful-per-character comments you’ll ever write.&lt;/p&gt;

&lt;p&gt;&lt;a name=&quot;conclusions&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;conclusions&quot;&gt;Conclusions&lt;/h1&gt;

&lt;p&gt;My experience is limited, and I’m far from the best software developer in the world, but I have worked at quite a few places, programmed for a reasonably long time, and read &lt;em&gt;a lot&lt;/em&gt; of programming assignments! So perhaps you don’t want to treat these as steadfast rules, but I do think they are good general principles. Here’s the cheat-sheet:&lt;/p&gt;

&lt;div class=&quot;emph-box&quot;&gt;
&lt;p&gt;Code is an essay written for two audiences: the computer, and your fellow programmers. It should strive to obey these principles.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Correct&lt;/strong&gt;: the code should produce the correct output.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Effective&lt;/strong&gt;: the code should run quickly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Efficient&lt;/strong&gt;: the code should minimize resource usage.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Intuitive&lt;/strong&gt;: the code should convey the intuition behind it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Succinct&lt;/strong&gt;: the code should be short.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Precise&lt;/strong&gt;: the code should allow humans to understand exactly what it is doing.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;

&lt;p&gt;Of course, it is worth noting that you don’t always have to write good code. In fact, most of the time, you won’t. If you go over to my GitHub, you’ll see most of the code I’ve written is… &lt;a href=&quot;https://github.com/RyanMarcus/dirty-json/blob/master/parser.js&quot;&gt;bad&lt;/a&gt;. &lt;a href=&quot;https://github.com/RyanMarcus/vulcan/blob/master/vulcan.js&quot;&gt;Real bad&lt;/a&gt;. Like, &lt;a href=&quot;https://github.com/RyanMarcus/basicaf/blob/master/src/ir/blockgen.rs&quot;&gt;super bad&lt;/a&gt;. These are things to strive for, and things to practice. You won’t always be able to write code that is especially pristine. But hopefully, bit by bit, year by year, we can get better and better.&lt;/p&gt;

&lt;h1 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h1&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;You might be wondering how &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nextInt&lt;/code&gt; manages to draw from a uniform distribution – one approach is to use &lt;em&gt;rejection sampling&lt;/em&gt;. First, pick the largest number &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m&lt;/code&gt; less than &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.MAX_VALUE&lt;/code&gt; that the size of your array, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt;, still divides. Then, sample a random integer from the range (0, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.MAX_VALUE&lt;/code&gt;). If the sampled integer is less than &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m&lt;/code&gt;, return &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m % n&lt;/code&gt;. Otherwise, try again. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
      &lt;p&gt;We could also use Java’s streams, and the &lt;a href=&quot;https://docs.oracle.com/javase/9/docs/api/java/util/stream/Collectors.html#joining--&quot;&gt;joining collector&lt;/a&gt;, to make the code much shorter and more obvious to a human, but we’re only discussing effectiveness here. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
      &lt;p&gt;There’s a reason it’s called “composition.” Writing code and writing papers both require careful compositions of abstractions. In computer science, these abstractions are linked lists, stacks, queues, etc. In “traditional” writing, these are paragraphs, citations, ideas, etc. Computer scientists who dismiss literature and other humanities will &lt;a href=&quot;https://aryaboudaie.com/technical/educational/humanities/2018/10/30/humanities-for-cs.html&quot;&gt;find themselves at a huge disadvantage.&lt;/a&gt; &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot;&gt;
      &lt;p&gt;This does not mean you cannot create your own abstractions, or use others. It also does not mean you have to explain how an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ArrayList&lt;/code&gt; works every time you use one. But someone looking at your code should be able to find those details somewhere (perhaps in your code, perhaps in the Java documentation), if they look for them. &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:5&quot;&gt;
      &lt;p&gt;I’ve been guilty of this in the past, and I hold no grudge against those who avoid me to this day because of it. &lt;a href=&quot;#fnref:5&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:6&quot;&gt;
      &lt;p&gt;It turns out the XOR swap is also a tad slower than the “normal” swapping code – mostly due to compiler optimizations. &lt;a href=&quot;#fnref:6&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Mon, 05 Nov 2018 00:00:00 +0000</pubDate>
        <link>/blog/2018/11/05/good-bad-comment.html</link>
        <guid isPermaLink="true">/blog/2018/11/05/good-bad-comment.html</guid>
      </item>
    
  </channel>
</rss>
