Files
mixly3/boards/default/python_pyodide/main.bundle.9b428f0d.js

18424 lines
4.4 MiB
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(()=>{var __webpack_modules__={27543:(e,t,n)=>{"use strict";n.d(t,{rw:()=>Xl,VX:()=>ql,ce:()=>r,mp:()=>y,I_:()=>l,Cr:()=>T,eS:()=>f,uW:()=>S,yH:()=>a,k4:()=>b,Hv:()=>u,VQ:()=>x,Fr:()=>s,ro:()=>_,p7:()=>d,ZD:()=>w,dv:()=>p,dD:()=>A,wG:()=>c,og:()=>E,QC:()=>o,YI:()=>v,Xp:()=>h,$Z:()=>I,rC:()=>m,lv:()=>C,M2:()=>i,AI:()=>g,ut:()=>R});var i={};n.r(i),n.d(i,{controls_type:()=>$,controls_typeLists:()=>U,lists_zip:()=>z,lists_zip_container:()=>V,lists_zip_item:()=>j,unpack_iterable_object:()=>Y,variables_change:()=>P,variables_get:()=>F,variables_global:()=>B,variables_set:()=>L});var r={};n.r(r),n.d(r,{base_setup:()=>W,controls_delay:()=>X,controls_end_program:()=>q,controls_except:()=>le,controls_finally:()=>ue,controls_flow_statements:()=>te,controls_for:()=>ne,controls_forEach:()=>Q,controls_for_range:()=>ie,controls_if:()=>K,controls_if_else:()=>oe,controls_if_elseif:()=>se,controls_if_if:()=>re,controls_lambda:()=>de,controls_main:()=>H,controls_pass:()=>he,controls_range:()=>Z,controls_repeat_ext:()=>ce,controls_thread:()=>pe,controls_try:()=>ae,controls_try_finally:()=>ee,controls_whileUntil:()=>J,datetime_fromtimestamp:()=>ve,do_while:()=>fe,garbage_collection:()=>me,gene_unique_identifier:()=>be,get_mem_alloc:()=>ge,get_mem_free:()=>ye,get_unique_identifier:()=>_e});var s={};n.r(s),n.d(s,{base_map:()=>ze,generate_cartesian_product:()=>je,math_arithmetic:()=>Ie,math_bit:()=>Se,math_constant:()=>Ee,math_constant_mp:()=>we,math_constrain:()=>De,math_dec:()=>Oe,math_degree_to_radian:()=>Ge,math_indexer_number:()=>Le,math_map:()=>Fe,math_max_min:()=>Re,math_number:()=>xe,math_number_base_conversion:()=>ke,math_radian_to_degree:()=>Ye,math_random:()=>Ne,math_random_seed:()=>Pe,math_round:()=>Be,math_selfcalcu:()=>Ae,math_to_int:()=>Me,math_trig:()=>Ce,text_to_number:()=>$e,text_to_number_skulpt:()=>Ue,turn_to_int:()=>Ve});var o={};n.r(o),n.d(o,{ascii_to_char:()=>Qe,char_to_ascii:()=>Je,number_to_text:()=>et,os_system:()=>It,text:()=>We,text_bytes:()=>qe,text_capital:()=>ut,text_center:()=>ct,text_char:()=>Ke,text_char_at:()=>it,text_char_at2:()=>nt,text_char_at3:()=>Tt,text_compareTo:()=>bt,text_compare_to:()=>lt,text_create_with_container:()=>yt,text_create_with_item:()=>_t,text_encode:()=>Et,text_equals_starts_ends:()=>at,text_eval:()=>wt,text_find:()=>dt,text_format:()=>gt,text_format_noreturn:()=>xt,text_join:()=>Ze,text_join_seq:()=>ht,text_length:()=>tt,text_random_char:()=>rt,text_replace:()=>pt,text_split:()=>ft,text_strip:()=>mt,text_substring:()=>ot,text_substring2:()=>st,text_substring3:()=>vt,text_textarea:()=>Xe});var a={};n.r(a),n.d(a,{ENUMERATE:()=>ln,content_in_lists:()=>cn,enumerate:()=>un,list_many_input:()=>Xt,list_tolist:()=>Qt,list_tolist2:()=>an,list_trig:()=>Gt,lists_2d_get_col_row_data:()=>Mt,lists_2d_get_data_with_col_row:()=>Ot,lists_append_extend:()=>Lt,lists_change_to:()=>Wt,lists_change_to_general:()=>Kt,lists_clear:()=>zt,lists_create_with:()=>Rt,lists_create_with2:()=>Jt,lists_create_with_container:()=>Nt,lists_create_with_item:()=>Dt,lists_create_with_noreturn:()=>qt,lists_create_with_text:()=>kt,lists_create_with_text2:()=>en,lists_del_general:()=>Zt,lists_find:()=>Yt,lists_getIndex3:()=>tn,lists_getSublist3:()=>nn,lists_get_index:()=>St,lists_get_random_item:()=>Pt,lists_get_random_sublist:()=>Bt,lists_get_sublist:()=>Ct,lists_insert_value:()=>$t,lists_insert_value2:()=>sn,lists_pop:()=>jt,lists_remove_at:()=>Vt,lists_remove_at2:()=>on,lists_reverse:()=>Ut,lists_setIndex3:()=>rn,lists_set_index:()=>Ft,lists_sort:()=>Ht});var l={};n.r(l),n.d(l,{dicts_add_change_del:()=>An,dicts_add_or_change:()=>_n,dicts_clear:()=>Tn,dicts_create_with:()=>hn,dicts_create_with_container:()=>pn,dicts_create_with_item:()=>fn,dicts_create_with_noreturn:()=>On,dicts_deldict:()=>In,dicts_delete:()=>vn,dicts_get:()=>gn,dicts_get_default:()=>yn,dicts_items:()=>xn,dicts_keys:()=>mn,dicts_length:()=>wn,dicts_pop:()=>Sn,dicts_setdefault:()=>Cn,dicts_to_json:()=>Rn,dicts_to_json2:()=>Dn,dicts_to_to:()=>Nn,dicts_todict:()=>Mn,dicts_update:()=>bn,dicts_values:()=>En,json_to_dicts:()=>kn});var u={};n.r(u),n.d(u,{logic_boolean:()=>Un,logic_compare:()=>Ln,logic_compare_continous:()=>Pn,logic_is:()=>Yn,logic_is_in:()=>jn,logic_negate:()=>$n,logic_null:()=>zn,logic_operation:()=>Bn,logic_tobool:()=>Gn,logic_true_or_false:()=>Vn});var c={};n.r(c),n.d(c,{sdcard_mount:()=>fi,sdcard_use_spi_init:()=>pi,storage_can_write_ornot:()=>ei,storage_change_dir:()=>di,storage_close_file:()=>ni,storage_delete_file:()=>ri,storage_file_seek:()=>ai,storage_file_tell:()=>oi,storage_file_write:()=>Kn,storage_fileopen:()=>Wn,storage_fileopen_new:()=>Xn,storage_fileopen_new_encoding:()=>qn,storage_get_a_line:()=>Jn,storage_get_contents:()=>Qn,storage_get_contents_without_para:()=>Zn,storage_get_current_dir:()=>li,storage_get_file_size:()=>si,storage_get_filename:()=>ti,storage_is_file:()=>hi,storage_list_all_files:()=>ii,storage_make_dir:()=>ui,storage_open_file_with_os:()=>Hn,storage_rename:()=>ci});var d={};n.r(d),n.d(d,{procedures_callnoreturn:()=>vi,procedures_callreturn:()=>bi,procedures_defnoreturn:()=>mi,procedures_defreturn:()=>gi,procedures_ifreturn:()=>Ti,procedures_mutatorarg:()=>_i,procedures_mutatorcontainer:()=>yi,procedures_return:()=>xi});var h={};n.r(h),n.d(h,{tuple_change_to:()=>Di,tuple_create_llm_params:()=>ji,tuple_create_with:()=>wi,tuple_create_with_container:()=>Ii,tuple_create_with_item:()=>Ai,tuple_create_with_noreturn:()=>Bi,tuple_create_with_text2:()=>Si,tuple_create_with_text_return:()=>Ci,tuple_del:()=>Ri,tuple_find:()=>Fi,tuple_getIndex:()=>Oi,tuple_getSublist:()=>Pi,tuple_get_random_item:()=>Ui,tuple_get_sublist:()=>$i,tuple_input:()=>Vi,tuple_join:()=>ki,tuple_length:()=>Mi,tuple_max:()=>Ni,tuple_totuple:()=>zi,tuple_trig:()=>Li});var p={};n.r(p),n.d(p,{set_add_discard:()=>Ji,set_clear:()=>Ki,set_create_with:()=>Gi,set_create_with_container:()=>Hi,set_create_with_item:()=>Wi,set_create_with_text_return:()=>nr,set_length:()=>Xi,set_operate:()=>Zi,set_operate_update:()=>Qi,set_pop:()=>qi,set_sub:()=>er,set_toset:()=>ir,set_update:()=>tr});var f={};n.r(f),n.d(f,{html_content:()=>lr,html_content_more:()=>ur,html_document:()=>sr,html_form:()=>dr,html_head_body:()=>ar,html_style:()=>cr,html_style_color:()=>pr,html_style_content:()=>hr,html_text:()=>fr,html_title:()=>or});var m={};n.r(m),n.d(m,{attribute_access:()=>Cr,function_call:()=>Ir,function_call_container:()=>Ar,function_call_item:()=>Sr,raw_block:()=>yr,raw_empty:()=>vr,raw_expression:()=>_r,raw_table:()=>gr,text_comment:()=>br,text_print_multiple:()=>xr,text_print_multiple_container:()=>Er,text_print_multiple_item:()=>wr,type_check:()=>Tr});var g={};n.r(g),n.d(g,{controls_type:()=>Nr,controls_typeLists:()=>Dr,lists_zip:()=>Fr,unpack_iterable_object:()=>Lr,variables_change:()=>Rr,variables_get:()=>Or,variables_global:()=>kr,variables_set:()=>Mr});var y={};n.r(y),n.d(y,{Panic_with_status_code:()=>Wr,base_setup:()=>$r,controls_delay:()=>Hr,controls_flow_statements:()=>Gr,controls_for:()=>Vr,controls_forEach:()=>Qr,controls_for_range:()=>jr,controls_if:()=>Ur,controls_interrupts:()=>Kr,controls_lambda:()=>es,controls_main:()=>Br,controls_millis:()=>Xr,controls_nointerrupts:()=>Zr,controls_pass:()=>ns,controls_range:()=>Jr,controls_repeat:()=>cs,controls_repeat_ext:()=>ss,controls_thread:()=>is,controls_try_finally:()=>zr,controls_whileUntil:()=>Yr,datetime_fromtimestamp:()=>ds,do_while:()=>rs,garbage_collection:()=>os,gene_unique_identifier:()=>hs,get_mem_alloc:()=>as,get_mem_free:()=>ls,get_unique_identifier:()=>us,reset:()=>qr,time_sleep:()=>ts});var _={};n.r(_),n.d(_,{base_map:()=>Ns,generate_cartesian_product:()=>Fs,math_arithmetic:()=>ys,math_bit:()=>gs,math_constant:()=>fs,math_constant_mp:()=>ms,math_constrain:()=>As,math_dec:()=>Ts,math_degree_to_radian:()=>Ps,math_indexer_number:()=>Os,math_map:()=>Is,math_max_min:()=>Es,math_number:()=>ps,math_number_base_conversion:()=>Ss,math_radian_to_degree:()=>Ls,math_random:()=>ws,math_random_seed:()=>Cs,math_round:()=>Ms,math_selfcalcu:()=>_s,math_single:()=>vs,math_to_int:()=>xs,math_trig:()=>bs,text_to_number:()=>Rs,text_to_number_skulpt:()=>ks,turn_to_int:()=>Ds});var v={};n.r(v),n.d(v,{ascii_to_char:()=>js,char_to_ascii:()=>Ys,number_to_text:()=>Gs,os_system:()=>mo,text:()=>Bs,text_bytes:()=>Us,text_capital:()=>eo,text_center:()=>to,text_char:()=>zs,text_char_at:()=>Xs,text_char_at2:()=>Ws,text_char_at3:()=>ho,text_compareTo:()=>co,text_compare_to:()=>Zs,text_encode:()=>po,text_equals_starts_ends:()=>Ks,text_eval:()=>fo,text_find:()=>no,text_format:()=>ao,text_format_noreturn:()=>lo,text_join:()=>Vs,text_join_seq:()=>io,text_length:()=>Hs,text_random_char:()=>qs,text_replace:()=>ro,text_split:()=>so,text_strip:()=>oo,text_substring:()=>Js,text_substring2:()=>Qs,text_substring3:()=>uo,text_textarea:()=>$s});var b={};n.r(b),n.d(b,{content_in_lists:()=>qo,enumerate:()=>Xo,list_many_input:()=>Fo,list_tolist:()=>Ho,list_tolist2:()=>Wo,list_trig:()=>ko,lists_2d_get_col_row_data:()=>_o,lists_2d_get_data_with_col_row:()=>yo,lists_append_extend:()=>Eo,lists_change_to:()=>Do,lists_change_to_general:()=>Po,lists_clear:()=>Co,lists_create_with:()=>vo,lists_create_with2:()=>$o,lists_create_with_noreturn:()=>Lo,lists_create_with_text:()=>bo,lists_create_with_text2:()=>Uo,lists_del_general:()=>Bo,lists_find:()=>Oo,lists_getIndex3:()=>zo,lists_getSublist3:()=>Vo,lists_get_index:()=>To,lists_get_random_item:()=>wo,lists_get_random_sublist:()=>Io,lists_get_sublist:()=>go,lists_insert_value:()=>Ao,lists_insert_value2:()=>Yo,lists_pop:()=>Ro,lists_remove_at:()=>Mo,lists_remove_at2:()=>Go,lists_reverse:()=>So,lists_setIndex3:()=>jo,lists_set_index:()=>xo,lists_sort:()=>No});var T={};n.r(T),n.d(T,{dicts_add_change_del:()=>la,dicts_add_or_change:()=>ea,dicts_clear:()=>ia,dicts_create_with:()=>Ko,dicts_create_with_noreturn:()=>da,dicts_deldict:()=>aa,dicts_delete:()=>ta,dicts_get:()=>Qo,dicts_get_default:()=>Jo,dicts_items:()=>ra,dicts_keys:()=>Zo,dicts_length:()=>oa,dicts_pop:()=>ua,dicts_setdefault:()=>ca,dicts_to_json:()=>pa,dicts_to_json2:()=>ga,dicts_to_to:()=>ma,dicts_todict:()=>ha,dicts_update:()=>na,dicts_values:()=>sa,json_to_dicts:()=>fa});var x={};n.r(x),n.d(x,{logic_boolean:()=>Ta,logic_compare:()=>ya,logic_compare_continous:()=>_a,logic_is:()=>Ia,logic_is_in:()=>wa,logic_negate:()=>ba,logic_null:()=>xa,logic_operation:()=>va,logic_tobool:()=>Aa,logic_true_or_false:()=>Ea});var E={};n.r(E),n.d(E,{sdcard_mount:()=>qa,sdcard_use_spi_init:()=>Xa,storage_can_write_ornot:()=>Fa,storage_change_dir:()=>ja,storage_close_file:()=>Pa,storage_delete_file:()=>$a,storage_file_seek:()=>Va,storage_file_tell:()=>za,storage_file_write:()=>Ra,storage_fileopen:()=>Ca,storage_fileopen_new:()=>Oa,storage_fileopen_new_encoding:()=>Ma,storage_get_a_line:()=>Da,storage_get_contents:()=>Na,storage_get_contents_without_para:()=>ka,storage_get_current_dir:()=>Ya,storage_get_file_size:()=>Ua,storage_get_filename:()=>La,storage_is_file:()=>Wa,storage_list_all_files:()=>Ba,storage_make_dir:()=>Ga,storage_open_file_with_os:()=>Sa,storage_rename:()=>Ha});var w={};n.r(w),n.d(w,{procedures_callnoreturn:()=>Ja,procedures_callreturn:()=>Qa,procedures_defnoreturn:()=>Za,procedures_defreturn:()=>Ka,procedures_ifreturn:()=>el,procedures_return:()=>tl});var I={};n.r(I),n.d(I,{tuple_change_to:()=>cl,tuple_create_llm_params:()=>vl,tuple_create_with:()=>nl,tuple_create_with_noreturn:()=>fl,tuple_create_with_text2:()=>il,tuple_create_with_text_return:()=>rl,tuple_del:()=>al,tuple_find:()=>dl,tuple_getIndex:()=>sl,tuple_getSublist:()=>pl,tuple_get_random_item:()=>gl,tuple_get_sublist:()=>ml,tuple_input:()=>_l,tuple_join:()=>ll,tuple_length:()=>ol,tuple_max:()=>ul,tuple_totuple:()=>yl,tuple_trig:()=>hl});var A={};n.r(A),n.d(A,{set_add_discard:()=>Al,set_clear:()=>El,set_create_with:()=>bl,set_create_with_text_return:()=>Ol,set_length:()=>Tl,set_operate:()=>wl,set_operate_update:()=>Il,set_pop:()=>xl,set_sub:()=>Sl,set_toset:()=>Ml,set_update:()=>Cl});var S={};n.r(S),n.d(S,{html_content:()=>Dl,html_content_more:()=>Fl,html_document:()=>Rl,html_form:()=>Pl,html_head_body:()=>Nl,html_style:()=>Ll,html_style_content:()=>Bl,html_text:()=>$l,html_title:()=>kl});var C={};n.r(C),n.d(C,{attribute_access:()=>Hl,function_call:()=>Gl,raw_block:()=>Ul,raw_empty:()=>Vl,raw_expression:()=>zl,raw_table:()=>jl,type_check:()=>Yl});var O=n(13383);
/**
* @license
* Visual Blocks Editor
*
* Copyright 2012 Google Inc.
* https://developers.google.com/blockly/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const M={NAME_TYPE:"VARIABLE",allVariables:function(e){var t;if(e.getDescendants)t=e.getDescendants();else{if(!e.getAllBlocks)throw"Not Block or Workspace: "+e;t=e.getAllBlocks()}for(var n=Object.create(null),i=0;i<t.length;i++)for(var r=t[i].getVars(),s=0;s<r.length;s++){var o=r[s];o&&(n[o]=o)}var a=[];for(var l in n)a.push(n[l]);return a},renameVariable:function(e,t,n){O.Events.setGroup(!0);for(var i=n.getAllBlocks(),r=0;r<i.length;r++)i[r].renameVar(e,t);O.Events.setGroup(!1)},flyoutCategory:function(e){var t=M.allVariables(e),n=[];((o=O.utils.xml.createElement("block")).setAttribute("type","variables_global"),n.push(o),O.Blocks.variables_set)&&((o=O.utils.xml.createElement("block")).setAttribute("type","variables_set"),n.push(o));O.Blocks.variables_change&&((o=O.utils.xml.createElement("block")).setAttribute("type","variables_change"),n.push(o));O.Blocks.controls_type&&((o=O.utils.xml.createElement("block")).setAttribute("type","controls_type"),n.push(o));O.Blocks.controls_typeLists&&((o=O.utils.xml.createElement("block")).setAttribute("type","controls_typeLists"),n.push(o));if(O.Blocks.lists_zip){(o=O.utils.xml.createElement("block")).setAttribute("type","lists_zip"),o.setAttribute("inline","false");var i=O.utils.xml.createElement("mutation");i.setAttribute("items",2),o.appendChild(i);for(let e=0;e<2;e++){let t=O.utils.xml.createElement("value");t.setAttribute("name",`ADD${e}`),o.appendChild(t)}n.push(o)}O.Blocks.unpack_iterable_object&&((o=O.utils.xml.createElement("block")).setAttribute("type","unpack_iterable_object"),n.push(o));for(var r=0;r<t.length;r++){if(O.Blocks.variables_set){(o=O.utils.xml.createElement("block")).setAttribute("type","variables_set"),O.Blocks.variables_get&&o.setAttribute("gap",8),(a=O.utils.xml.createElement("field",null,t[r])).setAttribute("name","VAR");var s=O.utils.xml.createTextNode(t[r]);a.appendChild(s),o.appendChild(a),n.push(o)}if(O.Blocks.variables_get){var o,a;(o=O.utils.xml.createElement("block")).setAttribute("type","variables_get"),O.Blocks.variables_set&&o.setAttribute("gap",24),(a=O.utils.xml.createElement("field",null,t[r])).setAttribute("name","VAR");s=O.utils.xml.createTextNode(t[r]);a.appendChild(s),o.appendChild(a),n.push(o)}}return n},generateUniqueName:function(e){var t=M.allVariables(e),n="";if(t.length)for(var i=1,r="ijkmnopqrstuvwxyzabcdefgh",s=0,o=r.charAt(s);!n;){for(var a=!1,l=0;l<t.length;l++)if(t[l]==o){a=!0;break}a?(25==++s&&(s=0,i++),o=r.charAt(s),i>1&&(o+=i)):n=o}else n="i";return n}},R=M;
/**
* @license
* Visual Blocks Editor
*
* Copyright 2012 Google Inc.
* https://developers.google.com/blockly/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class k{constructor(e,t){if(this.variablePrefix_=t||"",this.reservedDict_=Object.create(null),e)for(var n=e.split(","),i=0;i<n.length;i++)this.reservedDict_[n[i]]=!0;this.reset()}static equals(e,t){return e==t}reset(){this.db_=Object.create(null),this.dbReverse_=Object.create(null),this.variableMap_=null}setVariableMap(e){this.variableMap_=e}getNameForUserVariable_(e){if(!this.variableMap_)return null;var t=this.variableMap_.getVariableById(e);return t?t.name:null}getName(e,t){if(t==R.NAME_TYPE){var n=this.getNameForUserVariable_(e);n&&(e=n)}var i=e+"_"+t,r=t==R.NAME_TYPE||t==k.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"";if(i in this.db_)return r+this.db_[i];var s=this.getDistinctName(e,t);return this.db_[i]=s.substr(r.length),s}getDistinctName(e,t){for(var n=this.safeName_(e),i="";this.dbReverse_[n+i]||n+i in this.reservedDict_;)i=i?i+1:2;return n+=i,this.dbReverse_[n]=!0,(t==R.NAME_TYPE||t==k.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"")+n}safeName_(e){return e?(e=encodeURI(e.replace(/ /g,"_")).replace(/[^,\w]/g,"_"),-1!="0123456789".indexOf(e[0])&&(e="my_"+e)):e="unnamed",e}}k.DEVELOPER_VARIABLE_TYPE="DEVELOPER_VARIABLE";const N=k,D=330,F={init:function(){this.setColour(D),this.appendDummyInput().appendField(new O.FieldTextInput(""),"VAR"),this.setOutput(!0),this.setTooltip(O.Msg.VARIABLES_GET_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){N.equals(e,this.getFieldValue("VAR"))&&this.setFieldValue(t,"VAR")}},L={init:function(){this.setColour(D),this.appendValueInput("VALUE").appendField(new O.FieldTextInput(""),"VAR").appendField(O.Msg.MIXLY_VALUE2),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.VARIABLES_SET_TOOLTIP)},getVars:function(){var e=this.getFieldValue("VAR");return null==e?[]:e.split(",")},renameVar:function(e,t){N.equals(e,this.getFieldValue("VAR"))&&this.setFieldValue(t,"VAR")}},P={init:function(){this.setColour(D);var e=[[O.Msg.LANG_MATH_INT,"int"],[O.Msg.LANG_MATH_FLOAT,"float"],[O.Msg.LANG_MATH_BOOLEAN,"bool"],[O.Msg.LANG_MATH_STRING,"str"],[O.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[O.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[O.Msg.MIXLY_MICROBIT_TYPE_DICT,"dict"],[O.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"],[O.Msg.LANG_MATH_BYTE,"bytes"]];this.appendValueInput("MYVALUE").appendField(new O.FieldDropdown(e),"OP"),this.setOutput(!0)}},B={init:function(){this.setColour(D),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_PYTHON_GLOBAL).setCheck("var"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(O.Msg.TEXT_PRINT_TOOLTIP)}},$={init:function(){this.setColour(D),this.appendValueInput("DATA").appendField(O.Msg.MICROBIT_PYTHON_TYPE),this.setOutput(!0),this.setTooltip(O.Msg.MICROBIT_PYTHON_TYPE)}},U={init:function(){this.setColour(D),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_CONTORL_GET_TYPE).appendField(new O.FieldDropdown([[O.Msg.LANG_MATH_INT,"int"],[O.Msg.MIXLY_MICROBIT_TYPE_FLOAT,"float"],[O.Msg.MIXLY_MICROBIT_TYPE_STRING,"str"],[O.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[O.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[O.Msg.MIXLY_MICROBIT_TYPE_DICT,"dict"],[O.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"],[O.Msg.LANG_MATH_BYTE,"bytes"],[O.Msg.LOGIC_NULL,"type(None)"]]),"type"),this.setInputsInline(!0),this.setOutput(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("type");return O.Msg.MICROBIT_controls_TypeLists+{int:O.Msg.LANG_MATH_INT,float:O.Msg.MIXLY_MICROBIT_TYPE_FLOAT,str:O.Msg.MIXLY_MICROBIT_TYPE_STRING,list:O.Msg.MIXLY_MICROBIT_TYPE_LIST,tuple:O.Msg.MIXLY_MICROBIT_TYPE_TUPLE,dict:O.Msg.MIXLY_MICROBIT_TYPE_DICT,set:O.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,image:O.Msg.MIXLY_MICROBIT_IMAGE,bytes:O.Msg.LANG_MATH_BYTE,NoneType:O.Msg.LOGIC_NULL}[t]})}},z={init:function(){this.setColour(D),this.itemCount_=2,this.updateShape_(),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setMutator(new O.icons.MutatorIcon(["lists_zip_item"],this)),this.setTooltip(O.Msg.MIXLY_PYTHON_LISTS_ZIP_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("lists_zip_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("lists_zip_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(O.Msg.MIXLY_PYTHON_LISTS_ZIP);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(O.Msg.MIXLY_PYTHON_LISTS_ZIP)}}},V={init:function(){this.setColour(D),this.appendDummyInput().appendField(O.Msg.MIXLY_PYTHON_LISTS_ZIP),this.appendStatementInput("STACK"),this.setTooltip(O.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_CONTAINER_TOOLTIP),this.contextMenu=!1}},j={init:function(){this.setColour(D),this.appendDummyInput().appendField(O.Msg.MIXLY_PYTHON_LISTS_ZIP_ITEM),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_LISTS_ZIP_ITEM_TOOLTIP),this.contextMenu=!1}},Y={init:function(){this.setColour(D),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_VARIABLE_UNPACK).appendField(new O.FieldDropdown([[O.Msg.MIXLY_PYTHON_LISTS_ZIP_ITEM,"*"],[O.Msg.MIXLY_MICROBIT_TYPE_DICT,"**"]]),"TYPE"),this.setTooltip(""),this.setOutput(!0)}},G=120,H={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_PYTHON_NAME_MAIN),this.appendStatementInput("DO").appendField(""),this.setTooltip(O.Msg.MIXLY_TOOLTIP_CONTROL_SETUP)}},W={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_SETUP),this.appendStatementInput("DO").appendField(""),this.setTooltip(O.Msg.MIXLY_TOOLTIP_CONTROL_SETUP)}},X={init:function(){var e=[[O.Msg.MIXLY_mSecond,"delay"],[O.Msg.MIXLY_uSecond,"delayMicroseconds"]];this.setColour(G),this.appendValueInput("DELAY_TIME",Number).appendField(O.Msg.MIXLY_DELAY).appendField(new O.FieldDropdown(e),"UNIT").setCheck(Number),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXLY_TOOLTIP_CONTROL_DELAY),this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#id9"),this.wiki={"zh-hans":{page:["Arduino AVR","控制","延时"]}}}},q={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_CONTROL_END_PROGRAM),this.setPreviousStatement(!0),this.setTooltip(O.Msg.MIXLY_MIXPY_CONTROL_END_TOOLTIP)}},K={init:function(){this.setColour(G),this.appendValueInput("IF0").setCheck([Boolean,Number]).appendField(O.Msg.CONTROLS_IF_MSG_IF),this.appendStatementInput("DO0").appendField(O.Msg.CONTROLS_IF_MSG_THEN),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#if"),this.setMutator(new O.icons.MutatorIcon(["controls_if_elseif","controls_if_else"],this));var e=this;this.setTooltip(function(){return e.elseifCount_||e.elseCount_?!e.elseifCount_&&e.elseCount_?O.Msg.CONTROLS_IF_TOOLTIP_2:e.elseifCount_&&!e.elseCount_?O.Msg.CONTROLS_IF_TOOLTIP_3:e.elseifCount_&&e.elseCount_?O.Msg.CONTROLS_IF_TOOLTIP_4:"":O.Msg.CONTROLS_IF_TOOLTIP_1}),this.elseifCount_=0,this.elseCount_=0},mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var e=document.createElement("mutation");return this.elseifCount_&&e.setAttribute("elseif",this.elseifCount_),this.elseCount_&&e.setAttribute("else",1),e},domToMutation:function(e){var t=this,n=[],i=[];this.elseCount_&&this.removeInput("ELSE");for(var r=this.elseifCount_;r>0;r--)t.getInputTargetBlock("IF"+r)&&t.getInputTargetBlock("IF"+r).previousConnection?n[r]=t.getInputTargetBlock("IF"+r).previousConnection:n[r]=null,this.removeInput("IF"+r),t.getInputTargetBlock("DO"+r)&&t.getInputTargetBlock("DO"+r).previousConnection?i[r]=t.getInputTargetBlock("DO"+r).previousConnection:i[r]=null,this.removeInput("DO"+r);this.elseifCount_=parseInt(e.getAttribute("elseif"),10),this.elseCount_=parseInt(e.getAttribute("else"),10);for(r=1;r<=this.elseifCount_;r++)this.appendValueInput("IF"+r).setCheck([Boolean,Number]).appendField(O.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+r).appendField(O.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(O.Msg.CONTROLS_IF_MSG_ELSE);for(r=n.length-2;r>0;r--)n[r]&&n[r].reconnect(this,"IF"+r);for(r=i.length-2;r>0;r--)i[r]&&i[r].reconnect(this,"DO"+r)},decompose:function(e){var t=e.newBlock("controls_if_if");t.initSvg();for(var n=t.getInput("STACK").connection,i=1;i<=this.elseifCount_;i++){var r=e.newBlock("controls_if_elseif");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}if(this.elseCount_){var s=e.newBlock("controls_if_else");s.initSvg(),n.connect(s.previousConnection)}return t},compose:function(e){this.elseCount_&&this.removeInput("ELSE"),this.elseCount_=0;for(var t=this.elseifCount_;t>0;t--)this.removeInput("IF"+t),this.removeInput("DO"+t);this.elseifCount_=0;for(var n=e.getInputTargetBlock("STACK"),i=[null],r=[null],s=null;n;){switch(n.type){case"controls_if_elseif":this.elseifCount_++,i.push(n.valueConnection_),r.push(n.statementConnection_);break;case"controls_if_else":this.elseCount_++,s=n.statementConnection_;break;default:throw Error("Unknown block type: "+n.type)}n=n.nextConnection&&n.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(i,r,s)},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=1;t;){switch(t.type){case"controls_if_elseif":var i=this.getInput("IF"+n),r=this.getInput("DO"+n);t.valueConnection_=i&&i.connection.targetConnection,t.statementConnection_=r&&r.connection.targetConnection,n++;break;case"controls_if_else":r=this.getInput("ELSE");t.statementConnection_=r&&r.connection.targetConnection;break;default:throw"Unknown block type."}t=t.nextConnection&&t.nextConnection.targetBlock()}},rebuildShape_:function(){var e=[null],t=[null],n=null;this.getInput("ELSE")&&(n=this.getInput("ELSE").connection.targetConnection);for(var i=1;this.getInput("IF"+i);){var r=this.getInput("IF"+i),s=this.getInput("DO"+i);console.log(r.connection.targetConnection),e.push(r.connection.targetConnection),t.push(s.connection.targetConnection),i++}this.updateShape_(),this.reconnectChildBlocks_(e,t,n)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var e=1;this.getInput("IF"+e);)this.removeInput("IF"+e),this.removeInput("DO"+e),e++;for(e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck([Number,Boolean]).appendField(O.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+e).appendField(O.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(O.Msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(e,t,n){for(var i=1;i<=this.elseifCount_;i++)e[i]&&e[i].reconnect(this,"IF"+i),t[i]&&t[i].reconnect(this,"DO"+i);n&&n.reconnect(this,"ELSE")}},Z={init:function(){this.setColour(G),this.appendValueInput("FROM").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.PYTHON_RANGE).appendField(O.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.LANG_CONTROLS_FOR_INPUT_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.PYTHON_RANGE_STEP),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_CONTROLS_RANGE_TOOLTIP)}},Q={init:function(){this.setColour(G),this.appendValueInput("LIST").setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.CONTROLS_FOREACH_INPUT),this.appendValueInput("VAR").appendField(O.Msg.CONTROLS_FOREACH_INPUT_ITEM),this.appendStatementInput("DO").appendField(O.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(function(){return O.Msg.CONTROLS_FOR_TOOLTIP.replace("“%1”","")})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},J={init:function(){this.setColour(G),this.appendValueInput("BOOL").setCheck([Boolean,Number]).appendField(O.Msg.MIXLY_MICROBIT_JS_CURRENT).appendField(new O.FieldDropdown(this.OPERATORS),"MODE"),this.appendStatementInput("DO").appendField(O.Msg.LANG_CONTROLS_WHILEUNTIL_TITLE_REPEAT+O.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("MODE");return{WHILE:O.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE,UNTIL:O.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}[t]})}},ee={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_PYTHON_TRY),this.appendStatementInput("try"),this.appendValueInput("IF1").appendField(O.Msg.MIXLY_PYTHON_EXCEPT),this.appendStatementInput("DO1").appendField(""),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new O.icons.MutatorIcon(["controls_except","controls_finally"],this)),this.setTooltip(O.Msg.MIXLY_MIXPY_CONTROL_TRY_TOOLTIP),this.elseifCount_=1,this.elseCount_=0},mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var e=document.createElement("mutation");return this.elseifCount_&&e.setAttribute("elseif",this.elseifCount_),this.elseCount_&&e.setAttribute("else",1),e},domToMutation:function(e){var t=this,n=[],i=[];this.elseCount_&&this.removeInput("ELSE");for(var r=this.elseifCount_;r>0;r--)t.getInputTargetBlock("IF"+r)&&t.getInputTargetBlock("IF"+r).previousConnection?n[r]=t.getInputTargetBlock("IF"+r).previousConnection:n[r]=null,this.removeInput("IF"+r),t.getInputTargetBlock("DO"+r)&&t.getInputTargetBlock("DO"+r).previousConnection?i[r]=t.getInputTargetBlock("DO"+r).previousConnection:i[r]=null,this.removeInput("DO"+r);this.elseifCount_=parseInt(e.getAttribute("elseif"),10),this.elseCount_=parseInt(e.getAttribute("else"),10);for(r=1;r<=this.elseifCount_;r++)this.appendValueInput("IF"+r).setCheck([Boolean,Number]).appendField(O.Msg.MIXLY_PYTHON_EXCEPT),this.appendStatementInput("DO"+r).appendField("");this.elseCount_&&this.appendStatementInput("ELSE").appendField(O.Msg.MIXLY_PYTHON_FINALLY);for(r=n.length-2;r>0;r--)n[r]&&n[r].reconnect(this,"IF"+r);for(r=i.length-2;r>0;r--)i[r]&&i[r].reconnect(this,"DO"+r)},decompose:function(e){var t=e.newBlock("controls_try");t.initSvg();for(var n=t.getInput("STACK").connection,i=1;i<=this.elseifCount_;i++){var r=e.newBlock("controls_except");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}if(this.elseCount_){var s=e.newBlock("controls_finally");s.initSvg(),n.connect(s.previousConnection)}return t},compose:function(e){this.elseCount_&&this.removeInput("ELSE"),this.elseCount_=0;for(var t=this.elseifCount_;t>0;t--)this.removeInput("IF"+t),this.removeInput("DO"+t);this.elseifCount_=0;for(var n=e.getInputTargetBlock("STACK"),i=[null],r=[null],s=null;n;){switch(n.type){case"controls_except":this.elseifCount_++,i.push(n.valueConnection_),r.push(n.statementConnection_);break;case"controls_finally":this.elseCount_++,s=n.statementConnection_;break;default:throw Error("Unknown block type: "+n.type)}n=n.nextConnection&&n.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(i,r,s)},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=1;t;){switch(t.type){case"controls_except":var i=this.getInput("IF"+n),r=this.getInput("DO"+n);t.valueConnection_=i&&i.connection.targetConnection,t.statementConnection_=r&&r.connection.targetConnection,n++;break;case"controls_finally":r=this.getInput("ELSE");t.statementConnection_=r&&r.connection.targetConnection;break;default:throw"Unknown block type."}t=t.nextConnection&&t.nextConnection.targetBlock()}},rebuildShape_:function(){var e=[null],t=[null],n=null;this.getInput("ELSE")&&(n=this.getInput("ELSE").connection.targetConnection);for(var i=1;this.getInput("IF"+i);){var r=this.getInput("IF"+i),s=this.getInput("DO"+i);console.log(r.connection.targetConnection),e.push(r.connection.targetConnection),t.push(s.connection.targetConnection),i++}this.updateShape_(),this.reconnectChildBlocks_(e,t,n)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var e=1;this.getInput("IF"+e);)this.removeInput("IF"+e),this.removeInput("DO"+e),e++;for(e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck([Number,Boolean]).appendField(O.Msg.MIXLY_PYTHON_EXCEPT),this.appendStatementInput("DO"+e).appendField("");this.elseCount_&&this.appendStatementInput("ELSE").appendField(O.Msg.MIXLY_PYTHON_FINALLY)},reconnectChildBlocks_:function(e,t,n){for(var i=1;i<=this.elseifCount_;i++)e[i]&&e[i].reconnect(this,"IF"+i),t[i]&&t[i].reconnect(this,"DO"+i);n&&n.reconnect(this,"ELSE")}},te={init:function(){this.setColour(G);var e=new O.FieldDropdown(this.OPERATORS);this.appendDummyInput().appendField(e,"FLOW").appendField(O.Msg.LANG_CONTROLS_FLOW_STATEMENTS_INPUT_OFLOOP),this.setPreviousStatement(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_CONTROLS_FLOW_STATEMENTS_TOOLTIP);var t=this;this.setTooltip(function(){var e=t.getFieldValue("FLOW");return{BREAK:O.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK,CONTINUE:O.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}[e]})},onchange:function(){if(this.workspace){var e=!1,t=this;do{if("controls_repeat"==t.type||"controls_for"==t.type||"controls_forEach"==t.type||"controls_repeat_ext"==t.type||"controls_whileUntil"==t.type||"do_while"==t.type){e=!0;break}t=t.getSurroundParent()}while(t);e?this.setWarningText(null):this.setWarningText(O.Msg.LANG_CONTROLS_FLOW_STATEMENTS_WARNING)}}},ne={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.LANG_CONTROLS_FOR_INPUT_WITH).appendField(new O.FieldTextInput("i"),"VAR"),this.appendValueInput("FROM").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.LANG_CONTROLS_FOR_INPUT_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.MIXLY_STEP),this.appendStatementInput("DO").appendField(O.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var e=this;this.setTooltip(function(){return O.Msg.CONTROLS_FOR_TOOLTIP.replace("%1",e.getFieldValue("VAR"))})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},ie={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.LANG_CONTROLS_FOR_INPUT_WITH).appendField(new O.FieldTextInput("i"),"VAR"),this.appendValueInput("FROM").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.LANG_CONTROLS_FOR_INPUT_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.MIXLY_STEP),this.appendStatementInput("DO").appendField(O.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var e=this;this.setTooltip(function(){return O.Msg.MIXLY_PYTHON_CONTROLS_FOR_RANGE_TOOLTIP.replace("%1",e.getFieldValue("VAR"))})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}};J.OPERATORS=[[O.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE,"WHILE"],[O.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL,"UNTIL"]],te.OPERATORS=[[O.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK,"BREAK"],[O.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE,"CONTINUE"]];const re={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.CONTROLS_IF_IF_TITLE_IF),this.appendStatementInput("STACK"),this.setTooltip(O.Msg.CONTROLS_IF_IF_TOOLTIP),this.contextMenu=!1}},se={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.CONTROLS_IF_ELSEIF_TOOLTIP),this.contextMenu=!1}},oe={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.CONTROLS_IF_ELSE_TITLE_ELSE),this.setPreviousStatement(!0),this.setTooltip(O.Msg.CONTROLS_IF_ELSE_TOOLTIP),this.contextMenu=!1}},ae={init:function(){this.setColour(G),this.appendDummyInput().appendField("try"),this.appendStatementInput("STACK"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.contextMenu=!1}},le={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_PYTHON_EXCEPT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.contextMenu=!1,this.setTooltip(O.Msg.MIXLY_MIXPY_CONTROL_EXCEPT_TOOLTIP)}},ue={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_PYTHON_FINALLY),this.setPreviousStatement(!0),this.contextMenu=!1,this.setTooltip(O.Msg.MIXLY_MIXPY_CONTROL_FINALLY_TOOLTIP)}},ce={init:function(){this.jsonInit({message0:O.Msg.CONTROLS_REPEAT_TITLE,args0:[{type:"input_value",name:"TIMES"}],previousStatement:null,nextStatement:null,colour:G,tooltip:O.Msg.CONTROLS_REPEAT_TOOLTIP,helpUrl:O.Msg.CONTROLS_REPEAT_HELPURL}),this.appendStatementInput("DO")}},de={init:function(){this.setColour(G),this.appendValueInput("BOOL").appendField("lambda"),this.appendStatementInput("DO").appendField(O.Msg.MIXLY_STAT),this.setOutput(!0)}},he={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_PYTHON_PASS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_CONTROLS_PASS_TOOLTIP)}},pe={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_PYTHON_CONTROLS_THREAD_START),this.appendValueInput("callback").appendField(O.Msg.MIXLY_PYTHON_CONTROLS_THREAD_USE),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_PARAMS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_CONTROLS_THREAD_TOOLTIP)}},fe={init:function(){this.appendDummyInput().appendField(O.Msg.CONTROLS_REPEAT_TITLE_REPEAT+O.Msg.MIXLY_DO),this.appendStatementInput("input_data").setCheck(null),this.appendValueInput("select_data").setCheck(null).appendField(O.Msg.CONTROLS_OPERATOR_UNTIL).appendField(new O.FieldDropdown([[O.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE,"true"],[O.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL,"false"]]),"type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(G),this.setTooltip("do-while loop"),this.setHelpUrl("")}},me={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_OP_GARBAGE_COLLECT),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ge={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_GET_MEM_ALLOC),this.setOutput(!0)}},ye={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_GET_MEM_FREE),this.setOutput(!0)}},_e={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_GET+O.Msg.MIXLY_DEVICE+"ID"),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(O.Msg.PROCEDURES_DEFRETURN_RETURN+O.Msg.MIXLY_GET_UNIQUE_IDEN)}},ve={init:function(){this.setColour(G),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_RTC_TIMESTAMP),this.appendDummyInput().appendField(O.Msg.MIXLY_TIMESTAMP_TO_DATA),this.setInputsInline(!0),this.setOutput(!0,Number)}},be={init:function(){this.setColour(G),this.appendDummyInput().appendField(O.Msg.MIXLY_GET_UNIQUE_IDEN),this.setOutput(!0)}},Te=230;O.FieldTextInput.math_number_validator=function(e){return String(e)},O.FieldTextInput.math_number_validator_include_blank=function(e){if(""===e)return"";return/^-?(0X|0x|0O|0o|0B|0b)?[a-fA-F0-9]{1,}(\.[a-fA-F0-9]+)?$/.test(e)?String(e):null};const xe={init:function(){this.setColour(Te),this.appendDummyInput().appendField(new O.FieldTextInput("0",O.FieldTextInput.math_number_validator),"NUM"),this.setOutput(!0,Number),this.setTooltip(O.Msg.MATH_NUMBER_TOOLTIP)}},Ee={init:function(){this.setColour(Te);this.appendDummyInput("").appendField(O.Msg.MIXLY_PYTHON_MATH_CONSTANT).appendField(new O.FieldDropdown([["π","pi"],["e","e"]]),"CONSTANT"),this.setOutput(!0,Number);var e=this;this.setTooltip(function(){var t=e.getFieldValue("CONSTANT");return{pi:O.Msg.MIXLY_PYTHON_MATH_CONSTANT_PI_TOOLTIP,e:O.Msg.MIXLY_PYTHON_MATH_CONSTANT_E_TOOLTIP}[t]})}},we={init:function(){this.setColour(Te);this.appendDummyInput("").appendField(O.Msg.MIXLY_PYTHON_MATH_CONSTANT).appendField(new O.FieldDropdown([["π","pi"],["e","e"]]),"CONSTANT"),this.setOutput(!0,Number);var e=this;this.setTooltip(function(){var t=e.getFieldValue("CONSTANT");return{pi:O.Msg.MIXLY_PYTHON_MATH_CONSTANT_PI_MP_TOOLTIP,e:O.Msg.MIXLY_PYTHON_MATH_CONSTANT_E_MP_TOOLTIP}[t]})}},Ie={init:function(){this.setColour(Te),this.setOutput(!0),this.appendValueInput("A"),this.appendValueInput("B").appendField(new O.FieldDropdown([["+","ADD"],["-","MINUS"],["×","MULTIPLY"],["÷","DIVIDE"],["%","QUYU"],["//","ZHENGCHU"],["**","POWER"]]),"OP"),this.setInputsInline(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("OP");return{ADD:O.Msg.MATH_ARITHMETIC_TOOLTIP_ADD,MINUS:O.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS,MULTIPLY:O.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY,DIVIDE:O.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,QUYU:O.Msg.MATH_MODULO_TOOLTIP,ZHENGCHU:O.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,POWER:O.Msg.MATH_ARITHMETIC_TOOLTIP_POWER}[t]})}},Ae={init:function(){this.setColour(Te),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendValueInput("A"),this.appendValueInput("B").appendField(new O.FieldDropdown([["+=","ADD"],["-=","MINUS"],["×=","MULTIPLY"],["÷=","DIVIDE"],["%=","QUYU"],["//=","ZHENGCHU"],["**=","POWER"]]),"OP"),this.setInputsInline(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("OP");return{ADD:O.Msg.MATH_ARITHMETIC_TOOLTIP_ADD,MINUS:O.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS,MULTIPLY:O.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY,DIVIDE:O.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,QUYU:O.Msg.MATH_MODULO_TOOLTIP,ZHENGCHU:O.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,POWER:O.Msg.MATH_ARITHMETIC_TOOLTIP_POWER}[t]})}},Se={init:function(){this.setColour(Te),this.setOutput(!0,Number),this.appendValueInput("A").setCheck(Number),this.appendValueInput("B").setCheck(Number).appendField(new O.FieldDropdown([["&","&"],["|","|"],[">>",">>"],["<<","<<"]]),"OP"),this.setInputsInline(!0),this.setTooltip("位运算")}},Ce={init:function(){this.setColour(Te),this.setOutput(!0,Number),this.appendValueInput("NUM").setCheck(Number).appendField(new O.FieldDropdown([["sin","SIN"],["cos","COS"],["tan","TAN"],["asin","ASIN"],["acos","ACOS"],["atan","ATAN"],["-","-"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]),"OP");var e=this;this.setTooltip(function(){var t=e.getFieldValue("OP");return{SIN:O.Msg.MATH_TRIG_TOOLTIP_SIN,COS:O.Msg.MATH_TRIG_TOOLTIP_COS,TAN:O.Msg.MATH_TRIG_TOOLTIP_TAN,ASIN:O.Msg.MATH_TRIG_TOOLTIP_ASIN,ACOS:O.Msg.MATH_TRIG_TOOLTIP_ACOS,ATAN:O.Msg.MATH_TRIG_TOOLTIP_ATAN,LN:O.Msg.MATH_SINGLE_TOOLTIP_LN}[t]})}},Oe={init:function(){var e=[[O.Msg.MATH_BIN,"bin"],[O.Msg.MATH_OCT,"oct"],[O.Msg.MATH_HEX,"hex"]];this.setColour(Te),this.setOutput(!0,String),this.appendValueInput("NUM").setCheck(Number).appendField(new O.FieldDropdown(e),"OP");var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{bin:O.Msg.MATH_DEC_TOOLTIP_BIN,oct:O.Msg.MATH_DEC_TOOLTIP_OCT,hex:O.Msg.MATH_DEC_TOOLTIP_HEX}[e]})}},Me={init:function(){var e=[[O.Msg.LANG_MATH_TO_ROUND,"round"],[O.Msg.LANG_MATH_TO_CEIL,"ceil"],[O.Msg.LANG_MATH_TO_FLOOR,"floor"],[O.Msg.MATH_ABS,"fabs"],[O.Msg.MATH_SQRT,"sqrt"]];this.setColour(Te),this.appendValueInput("A").setCheck(Number).appendField(new O.FieldDropdown(e),"OP"),this.setOutput(!0,Number);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{sqrt:O.Msg.MATH_SINGLE_TOOLTIP_ROOT,fabs:O.Msg.MATH_SINGLE_TOOLTIP_ABS,sq:O.Msg.MATH_SINGLE_TOOLTIP_SQ,round:O.Msg.MATH_SINGLE_TOOLTIP_ROUND,ceil:O.Msg.MATH_SINGLE_TOOLTIP_CEIL,floor:O.Msg.MATH_SINGLE_TOOLTIP_FLOOR}[e]})}},Re={init:function(){var e=[[O.Msg.MIXLY_MAX,"max"],[O.Msg.MIXLY_MIN,"min"]];this.setColour(Te),this.appendValueInput("A").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(new O.FieldDropdown(e),"OP").appendField("("),this.appendValueInput("B").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(","),this.appendDummyInput("").setAlign(O.inputs.Align.RIGHT).appendField(")"),this.setInputsInline(!0),this.setOutput(!0,Number);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{max:O.Msg.MIXLY_TOOLTIP_MATH_MAX,min:O.Msg.MIXLY_TOOLTIP_MATH_MIN}[e]})}},ke={init:function(){var e=[[O.Msg.MATH_TWO,"two"],[O.Msg.MATH_EIGHT,"eight"],[O.Msg.MATH_TEN,"ten"],[O.Msg.MATH_SIXTEEN,"sixteen"]];this.setColour(Te),this.appendDummyInput("").appendField(O.Msg.MATH_BA),this.appendValueInput("NUM").appendField(new O.FieldDropdown(e),"OP").appendField(O.Msg.MATH_JinZhi).setCheck(Number),this.appendDummyInput("").appendField(O.Msg.MATH_ZHW).appendField(new O.FieldDropdown(e),"OP2").appendField(O.Msg.MATH_JinZhi),this.setFieldValue("ten","OP2"),this.setOutput(!0),this.setInputsInline(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP"),n={two:O.Msg.MATH_Before_two,eight:O.Msg.MATH_Before_eight,ten:O.Msg.MATH_Before_ten,sixteen:O.Msg.MATH_Before_sixteen},i=t.getFieldValue("OP2"),r={two:O.Msg.MATH_Behind_two,eight:O.Msg.MATH_Behind_eight,ten:O.Msg.MATH_Behind_ten,sixteen:O.Msg.MATH_Behind_sixteen};return n[e]+r[i]})}},Ne={init:function(){var e=[[O.Msg.LANG_MATH_INT,"int"],[O.Msg.LANG_MATH_FLOAT,"float"]];this.setColour(Te),this.setOutput(!0,Number),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_RANDOM).appendField(new O.FieldDropdown(e),"TYPE"),this.appendValueInput("FROM").setCheck(Number).appendField(O.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.LANG_MATH_RANDOM_INT_INPUT_TO),this.setInputsInline(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("TYPE"),n={int:O.Msg.LANG_MATH_INT,float:O.Msg.LANG_MATH_FLOAT_RANDOM};return O.Msg.MATH_RANDOM_INT_TOOLTIP+n[e]})}},De={init:function(){this.setColour(Te),this.setOutput(!0,Number),this.appendValueInput("VALUE").setCheck(Number).appendField(O.Msg.LANG_MATH_CONSTRAIN_INPUT_CONSTRAIN),this.appendValueInput("LOW").setCheck(Number).appendField(O.Msg.LANG_MATH_CONSTRAIN_INPUT_LOW),this.appendValueInput("HIGH").setCheck(Number).appendField(O.Msg.LANG_MATH_CONSTRAIN_INPUT_HIGH),this.setInputsInline(!0),this.setTooltip(O.Msg.MATH_CONSTRAIN_TOOLTIP)}},Fe={init:function(){this.setColour(Te),this.appendValueInput("NUM",Number).appendField(O.Msg.MIXLY_MAP).setCheck(Number),this.appendValueInput("fromLow",Number).appendField(O.Msg.MIXLY_MAP_FROM).setCheck(Number),this.appendValueInput("fromHigh",Number).appendField(",").setCheck(Number),this.appendValueInput("toLow",Number).appendField(O.Msg.MIXLY_MAP_TO).setCheck(Number),this.appendValueInput("toHigh",Number).appendField(",").setCheck(Number),this.appendDummyInput("").appendField("]"),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(O.Msg.MIXLY_TOOLTIP_MATH_MAP)}},Le={init:function(){this.setColour(Te),this.appendDummyInput().appendField(new O.FieldTextInput("0",O.FieldTextInput.math_number_validator_include_blank),"NUM"),this.setOutput(!0),this.setTooltip(O.Msg.MATH_NUMBER_TOOLTIP)}},Pe={init:function(){this.setColour(Te),this.appendValueInput("NUM").setCheck(Number).appendField(O.Msg.LANG_MATH_RANDOM_SEED),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.MIXLY_TOOLTIP_MATH_RANDOM_SEED)}},Be={init:function(){this.setColour(Te),this.setOutput(!0,Number),this.appendValueInput("VALUE").setCheck(Number),this.appendValueInput("VAR").setCheck(Number).appendField(O.Msg.MATH_ROUND).appendField(O.Msg.TEXT_KEEP),this.appendDummyInput().appendField(O.Msg.TEXT_DECIMAL),this.setInputsInline(!0),this.setTooltip(O.Msg.MATH_ROUND_NEW_TOOLTIP)}},$e={init:function(){var e=[[O.Msg.MIXLY_TO_INT,"int"],[O.Msg.MIXLY_TO_FLOAT,"float"],[O.Msg.MIXLY_TO_BITES,"b"],[O.Msg.LANG_MATH_BYTE+O.Msg.MIXLY_TO_INT,"bti"]];this.setColour(Te),this.appendValueInput("VAR").appendField(new O.FieldDropdown(e),"TOWHAT"),this.setOutput(!0,Number);var t=this;this.setTooltip(function(){var e=t.getFieldValue("TOWHAT");return{int:O.Msg.MIXLY_PYTHON_TOOLTIP_TOINT,float:O.Msg.MIXLY_PYTHON_TOOLTIP_TOFLOAT,b:O.Msg.MIXLY_TOOLTIP_TEXT_TOBYTE}[e]})}},Ue={init:function(){var e=[[O.Msg.MIXLY_TO_INT,"int"],[O.Msg.MIXLY_TO_FLOAT,"float"]];this.setColour(Te),this.appendValueInput("VAR").appendField(new O.FieldDropdown(e),"TOWHAT"),this.setOutput(!0,Number);var t=this;this.setTooltip(function(){var e=t.getFieldValue("TOWHAT");return{int:O.Msg.MIXLY_TOOLTIP_TEXT_TOINT,float:O.Msg.MIXLY_TOOLTIP_TEXT_TOFLOAT}[e]})}},ze=Fe,Ve={init:function(){this.setColour(Te),this.appendValueInput("VAR").appendField(O.Msg.LANG_MATH_BYTE+O.Msg.MIXLY_TO_HEX),this.setOutput(!0,Number),this.setTooltip(O.Msg.MIXLY_PYTHON_TOOLTIP_TOHEX)}},je={init:function(){this.setColour(Te),this.itemCount_=1,this.setMutator(new O.icons.MutatorIcon(["lists_create_with_item"],this)),this.appendDummyInput("DUMMY").appendField(O.Msg.MIXLY_PRODUCT+O.Msg.MIXLY_GENERATE_CARTESIAN_PRODUCT),this.appendValueInput("REPEAT").appendField(O.Msg.MIXLY_EVERY_PER_ELEPER_ELEMENT),this.appendDummyInput().appendField(O.Msg.CONTROLS_REPEAT_TITLE_TIMES),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0),this.setTooltip(O.Msg.LISTS_CREATE_WITH_PYTHON_TOOLTIP),this.updateShape_()},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("lists_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("lists_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput(`ADD${i}`).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput(`ADD${n}`);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else{let e=0;for(;this.getInput(`ADD${e}`);)this.removeInput(`ADD${e}`),e++}if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(O.Msg.MIXLY_EMPTY_REMINDER);else for(let e=0;e<this.itemCount_;e++)this.appendValueInput(`ADD${e}`),this.moveInputBefore(`ADD${e}`,"REPEAT")},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Ye={init:function(){this.setColour(Te),this.setOutput(!0),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_SET_RADIAN),this.appendDummyInput().appendField(O.Msg.MIXLY_TRANS_TO_ANGLE),this.setInputsInline(!0)}},Ge={init:function(){this.setColour(Te),this.setOutput(!0),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_SET_DEGREE),this.appendDummyInput().appendField(O.Msg.MIXLY_TRANS_TO_RADIAN),this.setInputsInline(!0)}},He=160,We={init:function(){this.setColour(He),this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new O.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,String),this.setTooltip(O.Msg.TEXT_TEXT_TOOLTIP)},newQuote_:function(e){if(e==this.RTL)var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==";else t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC";return new O.FieldImage(t,12,12,'"')}},Xe={init:function(){this.setColour(He),this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new O.FieldMultilineInput("Hello\nMixly"),"VALUE").appendField(this.newQuote_(!1)),this.setOutput(!0,String),this.setTooltip(O.Msg.TEXT_LINES_TOOLTIP)},newQuote_:function(e){if(e==this.RTL)var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==";else t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC";return new O.FieldImage(t,12,12,'"')}},qe={init:function(){this.setColour(He),this.appendDummyInput().appendField(O.Msg.MIXLY_TEXT_BYTES).appendField(this.newQuote_(!0)).appendField(new O.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,String),this.setTooltip(O.Msg.TEXT_TEXT_TOOLTIP)},newQuote_:function(e){if(e==this.RTL)var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==";else t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC";return new O.FieldImage(t,12,12,'"')}};O.FieldTextInput.char_validator=function(e){if(e.length>1&&"\\"===e.charAt(0)){var t=e.charAt(1);if("0"===t||"b"===t||"f"===t||"n"===t||"r"===t||"t"===t||"\\"===t||"'"===t)return String(e).substring(0,2);if("x"===t&&"0"===e.charAt(2)&&"B"===e.charAt(3))return String(e).substring(0,4)}return String(e).substring(0,1)};const Ke={init:function(){this.setColour(He),this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new O.FieldTextInput("",O.FieldTextInput.char_validator),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,Number),this.setTooltip(O.Msg.TEXT_CHAR_TOOLTIP)},newQuote_:function(e){if(1==e)var t="../../media/quote2.png";else t="../../media/quote3.png";return new O.FieldImage(t,7,12,'"')}},Ze={init:function(){this.setColour(He),this.appendValueInput("A").setCheck([String,Number]),this.appendValueInput("B").setCheck([String,Number]).appendField(O.Msg.MIXLY_TEXT_JOIN),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(O.Msg.MIXLY_TOOLTIP_TEXT_JOIN)}},Qe={init:function(){this.setColour(He),this.appendValueInput("VAR").setCheck(Number).appendField(O.Msg.MIXLY_TOCHAR),this.setOutput(!0,String),this.setTooltip(O.Msg.MIXLY_TOOLTIP_TEXT_TOCHAR)}},Je={init:function(){this.setColour(He),this.appendValueInput("VAR").setCheck(String).appendField(O.Msg.MIXLY_TOASCII),this.setOutput(!0,Number),this.setTooltip(O.Msg.MIXLY_TOOLTIP_TEXT_TOASCII)}},et={init:function(){this.setColour(He),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_TOSTRING),this.setOutput(!0,String),this.setTooltip(O.Msg.MIXLY_PYTHON_TOOLTIP_TOTEXT)}},tt={init:function(){this.setColour(He),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_LENGTH),this.setOutput(!0,Number),this.setTooltip(O.Msg.MIXLY_TOOLTIP_TEXT_LENGTH)}},nt={init:function(){this.WHERE_OPTIONS=[[O.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[O.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[O.Msg.TEXT_GET_INDEX_RANDOM+1+O.Msg.TEXT_CHARAT2,"RANDOM"]],this.setHelpUrl(O.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(He),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("AT").setCheck(Number),this.appendDummyInput().appendField(O.Msg.LISTS_GET_INDEX_GET,"MODE"),O.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(O.Msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("MODE"),n=e.getFieldValue("WHERE"),i="";switch(t+" "+n){case"GET FROM_START":case"GET FROM_END":i=O.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET RANDOM":i=O.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":i=O.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE RANDOM":i=O.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM}return"FROM_START"!=n&&"FROM_END"!=n||(i+=" "+O.Msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",O.Msg.ONE_BASED_INDEXING?"#1":"#0")),i});var t=this;this.setTooltip(function(){var e=t.getFieldValue("WHERE"),n={FROM_START:O.Msg.LISTS_GET_INDEX_FROM_START,FROM_END:O.Msg.LISTS_GET_INDEX_FROM_END,RANDOM:O.Msg.TEXT_GET_INDEX_RANDOM};return O.Msg.PROCEDURES_DEFRETURN_RETURN+O.Msg.MIXLY_MICROBIT_TYPE_STRING+n[e]+"n"+O.Msg.TEXT_CHARAT2})},mutationToDom:function(){var e=document.createElement("mutation");e.setAttribute("statement",!this.outputConnection);var t=this.getInput("AT").type==O.INPUT_VALUE;return e.setAttribute("at",t),e},domToMutation:function(e){var t="true"==e.getAttribute("statement");this.updateStatement_(t),e="false"!=e.getAttribute("at"),this.updateAt_(e)},updateStatement_:function(e){e!=!this.outputConnection&&(this.unplug(!0,!0),e?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck(Number),O.Msg.TEXT_CHARAT2&&this.appendDummyInput("ORDINAL").appendField(O.Msg.TEXT_CHARAT2)):this.appendDummyInput("AT");var t=new O.FieldDropdown(this.WHERE_OPTIONS,function(t){var n="FROM_START"==t||"FROM_END"==t;if(n!=e){var i=this.sourceBlock_;return i.updateAt_(n),i.setFieldValue(t,"WHERE"),null}});this.getInput("AT").appendField(t,"WHERE"),O.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}},it={init:function(){this.setHelpUrl(O.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(He),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("AT").setCheck(Number).appendField(O.Msg.LISTS_GET_INDEX_GET+" "+O.Msg.LISTS_GET_INDEX_FROM_START),this.appendDummyInput().appendField(O.Msg.TEXT_CHARAT2),this.setOutput(!0),this.setTooltip(O.Msg.PROCEDURES_DEFRETURN_RETURN+O.Msg.MIXLY_MICROBIT_TYPE_STRING+O.Msg.LISTS_GET_INDEX_FROM_START+"n"+O.Msg.TEXT_CHARAT2)}},rt={init:function(){this.setHelpUrl(O.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(He),this.appendValueInput("VAR").setCheck(String),this.appendDummyInput().appendField(O.Msg.TEXT_RANDOM_CHAR),this.setOutput(!0),this.setTooltip(O.Msg.TEXT_RANDOM_CHAR_TOOLTIP)}},st={init:function(){this.WHERE_OPTIONS_1=[[O.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[O.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[O.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[O.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[O.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[O.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(O.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(He),this.appendValueInput("VAR").setCheck(String),this.appendDummyInput("").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),this.setInputsInline(!0),this.setOutput(!0,"List"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(O.Msg._GET_TEXT_SUBLIST_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT1").type==O.INPUT_VALUE;e.setAttribute("at1",t);var n=this.getInput("AT2").type==O.INPUT_VALUE;return e.setAttribute("at2",n),e},domToMutation:function(e){var t="true"==e.getAttribute("at1"),n="true"==e.getAttribute("at2");this.updateAt_(1,t),this.updateAt_(2,n)},updateAt_:function(e,t){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),t?(this.appendValueInput("AT"+e).setCheck(Number),O.Msg.TEXT_CHARAT2&&this.appendDummyInput("ORDINAL"+e).appendField(O.Msg.TEXT_CHARAT2)):this.appendDummyInput("AT"+e);var n=new O.FieldDropdown(this["WHERE_OPTIONS_"+e],function(n){var i="FROM_START"==n||"FROM_END"==n;if(i!=t){var r=this.sourceBlock_;return r.updateAt_(e,i),r.setFieldValue(n,"WHERE"+e),null}});this.getInput("AT"+e).appendField(n,"WHERE"+e),1==e&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"))}},ot={init:function(){this.setHelpUrl(O.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(He),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("AT1").appendField(O.Msg.LISTS_GET_INDEX_GET+" "+O.Msg.LISTS_GET_INDEX_FROM_START),this.appendValueInput("AT2").appendField(O.Msg.LISTS_GET_SUBLIST_END_FROM_START),this.appendDummyInput().appendField(O.Msg.TEXT_CHARAT2),this.setInputsInline(!0),this.setOutput(!0,["List",String]),this.setTooltip(O.Msg._GET_TEXT_SUBLIST_TOOLTIP)}},at={init:function(){var e=[[O.Msg.MIXLY_EQUALS,"==="],[O.Msg.MIXLY_STARTSWITH,"startswith"],[O.Msg.MIXLY_ENDSWITH,"endswith"]];this.setColour(He),this.appendValueInput("STR1").setCheck(String),this.appendValueInput("STR2").appendField(new O.FieldDropdown(e),"DOWHAT").setCheck(String),this.setOutput(!0,[Boolean,Number]),this.setInputsInline(!0)}},lt={init:function(){this.setColour(He),this.appendValueInput("STR1").setCheck(String),this.appendValueInput("STR2").appendField(O.Msg.MIXLY_COMPARETO).setCheck(String),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXLY_COMPARETO_HELP)}},ut={init:function(){var e=[[O.Msg.TEXT_UPPER,"upper"],[O.Msg.TEXT_TITLE,"title"],[O.Msg.TEXT_CAPITALIZE,"capitalize"],[O.Msg.TEXT_SWAPCASE,"swapcase"],[O.Msg.TEXT_LOWER,"lower"]];this.setColour(He),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new O.FieldDropdown(e),"CAPITAL").setCheck(String),this.setOutput(!0,String);var t=this;this.setTooltip(function(){var e=t.getFieldValue("CAPITAL");return{upper:O.Msg.MIXLY_MIXPY_TEXT_UPPER_TOOLTIP,title:O.Msg.MIXLY_MIXPY_TEXT_TITLE_TOOLTIP,swapcase:O.Msg.MIXLY_MIXPY_TEXT_SWAPCASE_TOOLTIP,capitalize:O.Msg.MIXLY_MIXPY_TEXT_CAPITALIZE_TOOLTIP,lower:O.Msg.MIXLY_MIXPY_TEXT_LOWER_TOOLTIP}[e]})}},ct={init:function(){var e=[[O.Msg.TEXT_LJUST,"ljust"],[O.Msg.TEXT_CENTER,"center"],[O.Msg.TEXT_RJUST,"rjust"]];this.setColour(He),this.appendValueInput("VAR").appendField(new O.FieldDropdown(e),"CENTER").setCheck(String),this.appendValueInput("WID").appendField(O.Msg.MIXLY_WIDTH).setCheck(Number),this.appendValueInput("Symbol").appendField(O.Msg.MIXLY_RECT_Fill).setCheck(String),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(O.Msg.MIXLY_MIXPY_TEXT_CENTER_TOOLTIP)}},dt={init:function(){this.setColour(He),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).setCheck(String),this.appendValueInput("STR").appendField(O.Msg.MIXLY_MID+O.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER).setCheck(String),this.appendDummyInput().appendField(O.Msg.MIXLY_LIST_INDEX),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(O.Msg.MIXLY_MIXPY_TEXT_FIND_TOOLTIP)}},ht={init:function(){this.setColour(He),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_USE_STR).setCheck(String),this.appendValueInput("LIST").appendField(O.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_SEQ).setCheck("List","Tuple","Set","Dict"),this.appendDummyInput().appendField(O.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_GET_STR),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(O.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_TOOLTIP)}},pt={init:function(){this.setColour(He),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("STR1").appendField(O.Msg.MIXLY_MIXPY_REPLACE).setCheck(String),this.appendValueInput("STR2").appendField(O.Msg.LISTS_SET_INDEX_INPUT_TO).setCheck(String),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(O.Msg.MIXLY_MIXPY_TEXT_REPLACE_TOOLTIP)}},ft={init:function(){this.setColour(He),this.appendValueInput("VAR"),this.appendValueInput("VAL").appendField(O.Msg.LIST_SPLIT_AS),this.appendDummyInput("").appendField(O.Msg.LIST_SPLIT),this.setOutput(!0,"List"),this.setTooltip(O.Msg.MIXLY_MIXPY_TEXT_SPLIT_TOOLTIP),this.setInputsInline(!0)}},mt={init:function(){var e=[[O.Msg.TEXT_TRIM_BOTH,"strip"],[O.Msg.TEXT_TRIM_LEFT,"lstrip"],[O.Msg.TEXT_TRIM_RIGHT,"rstrip"]];this.setColour(He),this.appendValueInput("VAR"),this.appendDummyInput("").appendField(O.Msg.TEXT_STRIM),this.appendDummyInput("").appendField(new O.FieldDropdown(e),"TOWHAT"),this.appendDummyInput("").appendField(O.Msg.TEXT_BLANK),this.setOutput(!0,String),this.setInputsInline(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("TOWHAT");return{strip:O.Msg.TEXT_TRIM_BOTH_TOOLTIP,lstrip:O.Msg.TEXT_TRIM_LEFT_TOOLTIP,rstrip:O.Msg.TEXT_TRIM_RIGHT_TOOLTIP}[e]})}},gt={init:function(){this.setColour(He),this.appendDummyInput("").appendField(O.Msg.MIXLY_MICROPYTHON_FORMAT),this.appendDummyInput("").appendField(new O.FieldTextInput("str"),"VAR"),this.itemCount_=1,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setMutator(new O.icons.MutatorIcon(["text_create_with_item"],this)),this.setOutput(!0),this.setTooltip(O.Msg.MIXLY_MIXPY_TEXT_FORMAT_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("text_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("text_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField();else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(O.Msg.PROCEDURES_BEFORE_PARAMS)}},getVars:function(){if(null!=this.getFieldValue("VAR"))return-1==this.getFieldValue("VAR").indexOf("'")&&-1==this.getFieldValue("VAR").indexOf('"')?[this.getFieldValue("VAR")]:[]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},yt={init:function(){this.setColour(He),this.appendDummyInput().appendField(O.Msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.setTooltip(O.Msg.TUPLE_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},_t={init:function(){this.setColour(He),this.appendDummyInput().appendField(O.Msg.blockpy_SET_VARIABLES_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.TUPLE_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},vt=ot,bt=lt,Tt=it,xt={init:function(){this.setColour(He),this.appendDummyInput("").appendField(O.Msg.MIXLY_MICROPYTHON_FORMAT),this.appendValueInput("VAR").setCheck(String),this.itemCount_=1,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setMutator(new O.icons.MutatorIcon(["text_create_with_item"],this)),this.setOutput(!0),this.setTooltip(O.Msg.MIXLY_MIXPY_TEXT_FORMAT_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("text_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("text_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField();else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(O.Msg.PROCEDURES_BEFORE_PARAMS)}}},Et={init:function(){this.setColour(He);var e=[[O.Msg.MIXPY_TEXT_ENCODE,"encode"],[O.Msg.MIXPY_TEXT_DECODE,"decode"]];this.appendDummyInput().appendField(new O.FieldDropdown([["ASCII","ASCII"],["gb2312","gb2312"],["gbk","gbk"],["utf-8","utf-8"],["utf-16","utf-16"],["utf-32","utf-32"]]),"CODE").appendField(" "),this.appendValueInput("VAR").appendField(new O.FieldDropdown(e),"DIR").appendField(O.Msg.LANG_MATH_STRING),this.setOutput(!0,String),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXPY_TEXT_ENCODE_DECODE_TOOLTIP)}},wt={init:function(){this.setColour(He),this.appendValueInput("VAR").setCheck(String).appendField(O.Msg.MIXLY_PYTHON_TEXT_EVAL),this.appendDummyInput().appendField(O.Msg.MIXLY_PYTHON_TEXT_EVAL_RESULT),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_TEXT_EVAL_TOOLTIP)}},It={init:function(){this.setColour(He),this.appendValueInput("VAR").setCheck(String).appendField(O.Msg.MIXLY_PYTHON_OS_SYSTEM),this.setInputsInline(!0),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_OS_SYSTEM_TOOLTIP)}},At=260,St={init:function(){this.setHelpUrl(O.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(At),this.appendValueInput("LIST"),this.appendValueInput("AT").setCheck(Number).appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+O.Msg.LISTS_GET_INDEX_FROM_START),this.appendDummyInput().appendField(O.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(O.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM)}},Ct={init:function(){this.setHelpUrl(O.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(At),this.appendValueInput("LIST"),this.appendDummyInput(""),this.appendValueInput("AT1").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+O.Msg.LISTS_GET_INDEX_FROM_START),this.appendValueInput("AT2").appendField(O.Msg.TEXT_CHARAT_TAIL+" "+O.Msg.LISTS_GET_SUBLIST_END_FROM_START),this.appendDummyInput().appendField(O.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0,"List"),this.setTooltip(O.Msg.PYTHON_LISTS_GET_SUBLIST_TOOLTIP)}},Ot={init:function(){this.appendValueInput("LIST").setCheck(null),this.appendValueInput("row").setCheck(null).appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+O.Msg.DATAFRAME_RAW),this.appendValueInput("col").setCheck(null).appendField(O.Msg.DATAFRAME_COLUMN),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(At),this.setTooltip(""),this.setHelpUrl("")}},Mt={init:function(){this.appendValueInput("LIST").setCheck(null),this.appendValueInput("row_start").setCheck(null).appendField(O.Msg.MIXLY_GET+" "+O.Msg.DATAFRAME_RAW+" ["),this.appendValueInput("row_end").setCheck(null).appendField(","),this.appendValueInput("col_start").setCheck(null).appendField(") "+O.Msg.DATAFRAME_COLUMN+" ["),this.appendValueInput("col_end").setCheck(null).appendField(","),this.appendDummyInput().appendField(") "+O.Msg.DICTS_ADD_VALUE),this.setInputsInline(!0),this.setOutput(!0,"List"),this.setColour(At),this.setTooltip(""),this.setHelpUrl("")}},Rt={init:function(){this.setColour(At),this.appendDummyInput("").appendField(new O.FieldTextInput("mylist"),"VAR").appendField("[").appendField("]"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new O.icons.MutatorIcon(["lists_create_with_item"],this)),this.setTooltip(O.Msg.LISTS_CREATE_WITH_PYTHON_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("lists_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("lists_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(O.Msg.LISTS_CREATE_PYTHON_EMPTY_TITLE);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(O.Msg.blockpy_LISTS_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},kt={init:function(){this.setColour(At),this.appendDummyInput("").appendField(new O.FieldTextInput("mylist"),"VAR").appendField(" = [").appendField(new O.FieldTextInput("0,0,0"),"TEXT").appendField("]"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.MIXLY_TOOLTIP_LISTS_CREATE_WITH_TEXT2)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Nt={init:function(){this.setColour(At),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_TYPE_LIST),this.appendStatementInput("STACK"),this.setTooltip(O.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Dt={init:function(){this.setColour(At),this.appendDummyInput().appendField(O.Msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},Ft={init:function(){this.setColour(At),this.appendValueInput("LIST"),this.appendValueInput("AT").setCheck(Number).appendField(O.Msg.MIXLY_MICROBIT_LIST_ASSIGN_AT),this.appendValueInput("TO").appendField(O.Msg.MIXLY_MICROBIT_JS_LIST_VALUE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.LANG_LISTS_SET_INDEX_TOOLTIP)}},Lt={init:function(){this.setColour(At),this.TYPE=[[O.Msg.MIXLY_blockpy_set_add,"append"],[O.Msg.MIXLY_MICROBIT_LIST_EXTEND,"extend"]],this.appendValueInput("LIST").setCheck("List"),this.appendValueInput("DATA").appendField(new O.FieldDropdown(this.TYPE),"OP").appendField(O.Msg.MIXLY_MICROBIT_LIST_A_ITEM),this.appendDummyInput("").appendField(O.Msg.MIXLY_MICROBIT_JS_LIST_TO_END),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("OP");return{append:O.Msg.MIXLY_TOOLTIP_LIST_APPEND,extend:O.Msg.LISTS_EXTEND_TOOLTIP}[t]})}},Pt={init:function(){this.setColour(At),this.appendValueInput("LIST"),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+O.Msg.LISTS_GET_INDEX_RANDOM),this.setTooltip(O.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM),this.setOutput(!0)}},Bt={init:function(){this.setColour(At),this.appendValueInput("LIST"),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+O.Msg.MIXLY_MICROBIT_RANDOM),this.appendDummyInput().appendField(O.Msg.LANG_LISTS_GET_INDEX2+O.Msg.LISTS_GET_RANDOM_SUBLIST),this.setTooltip(O.Msg.LISTS_GET_RANDOM_SUBLIST_TOOLTIP),this.setOutput(!0,"List")}},$t={init:function(){this.setColour(At),this.appendValueInput("LIST"),this.appendValueInput("AT").setCheck(Number).appendField(O.Msg.MIXLY_MICROBIT_JS_LIST_INSERT_AT),this.appendValueInput("VALUE").appendField(O.Msg.MIXLY_MICROBIT_JS_LIST_VALUE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.LANG_LISTS_SET_INDEX_TOOLTIP),this.setTooltip(O.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT)}},Ut={init:function(){this.setColour(At),this.appendValueInput("VAR").setCheck("List"),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_JS_LIST_REVERSE),this.setTooltip(O.Msg.LANG_LISTS_CLEAR_TOOLTIP),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},zt={init:function(){this.setColour(At),this.appendValueInput("VAR"),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROPYTHON_CLEAR),this.setTooltip(O.Msg.LANG_LISTS_REVERSE_TOOLTIP),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Vt={init:function(){this.setColour(At),this.TYPE=[[O.Msg.SERIES_INDEX,"del"],[O.Msg.MIXLY_MICROBIT_JS_I2C_VALUE,"remove"]],this.appendValueInput("LIST").setCheck("List"),this.appendValueInput("DATA").appendField(O.Msg.MIXLY_MIXPY_LISTS_REMOVE).appendField(new O.FieldDropdown(this.TYPE),"OP"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("OP");return{del:O.Msg.LISTS_SET_INDEX_TOOLTIP_DELETE,remove:O.Msg.MIXLY_TOOLTIP_LIST_REMOVE}[t]})}},jt={init:function(){this.setColour(At),this.appendValueInput("LIST"),this.appendValueInput("VALUE").appendField(O.Msg.MIXLY_MICROBIT_LIST_POP),this.appendDummyInput().appendField(O.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(O.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM)}},Yt={init:function(){var e=[[O.Msg.MIXLY_LIST_INDEX,"INDEX"],[O.Msg.MIXLY_LIST_COUNT,"COUNT"]];this.setColour(At),this.appendValueInput("VAR").setCheck("List"),this.appendValueInput("data").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(O.Msg.HTML_VALUE),this.appendDummyInput().appendField(O.Msg.MIXLY_DE).appendField(new O.FieldDropdown(e),"OP"),this.setInputsInline(!0),this.setOutput(!0,Number);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{INDEX:O.Msg.MIXLY_TOOLTIP_LIST_FIND_INDEX,COUNT:O.Msg.MIXLY_TOOLTIP_LIST_FIND_COUNT}[e]})}},Gt={init:function(){var e=[[O.Msg.MIXLY_LIST_LEN,"LEN"],[O.Msg.MATH_ONLIST_OPERATOR_SUM,"SUM"],[O.Msg.MATH_ONLIST_OPERATOR_MAX,"MAX"],[O.Msg.MATH_ONLIST_OPERATOR_MIN,"MIN"],[O.Msg.MATH_ONLIST_OPERATOR_AVERAGE,"AVERAGE"],[O.Msg.MATH_ONLIST_OPERATOR_MEDIAN,"MEDIAN"],[O.Msg.MATH_ONLIST_OPERATOR_MODE,"MODE"],[O.Msg.MATH_ONLIST_OPERATOR_STD_DEV,"STD_DEV"]];this.setColour(At),this.setOutput(!0,Number),this.appendValueInput("data"),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new O.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{LEN:O.Msg.LISTS_LENGTH_TOOLTIP,SUM:O.Msg.MATH_ONLIST_TOOLTIP_SUM,MAX:O.Msg.MATH_ONLIST_TOOLTIP_MAX,MIN:O.Msg.MATH_ONLIST_TOOLTIP_MIN,AVERAGE:O.Msg.MATH_ONLIST_TOOLTIP_AVERAGE,MEDIAN:O.Msg.MATH_ONLIST_TOOLTIP_MEDIAN,MODE:O.Msg.MATH_ONLIST_TOOLTIP_MODE,STD_DEV:O.Msg.MATH_ONLIST_TOOLTIP_STD_DEV}[e]})}},Ht={init:function(){this.jsonInit({args0:[{type:"input_value",name:"LIST",check:"List"},{type:"field_dropdown",name:"TYPE",options:[[O.Msg.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[O.Msg.LISTS_SORT_TYPE_TEXT,"TEXT"],[O.Msg.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[O.Msg.LISTS_SORT_ORDER_ASCENDING,"1"],[O.Msg.LISTS_SORT_ORDER_DESCENDING,"-1"]]}],message0:O.Msg.LISTS_SORT_TITLE,inputsInline:!0,output:"List",colour:At,tooltip:O.Msg.LISTS_SORT_TOOLTIP,helpUrl:O.Msg.LISTS_SORT_HELPURL})}},Wt={init:function(){var e=[[O.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[O.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"],[O.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD,"array"]];this.setColour(At),this.appendValueInput("VAR").setCheck("List"),this.appendDummyInput("").appendField(O.Msg.A_TO_B).appendField(new O.FieldDropdown(e),"OP");var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{tuple:O.Msg.MIXLY_TOOLTIP_CONVERT_LIST_TO_TUPLE,set:O.Msg.MIXLY_TOOLTIP_CONVERT_LIST_TO_SET,array:O.Msg.MIXLY_TOOLTIP_CONVERT_LIST_TO_ARRAY}[e]}),this.setInputsInline(!0),this.setOutput(!0)}},Xt={init:function(){this.setColour(At),this.appendDummyInput("").appendField("[").appendField(new O.FieldTextInput("0,0,0"),"CONTENT").appendField("]"),this.setInputsInline(!0),this.setOutput(!0)}},qt={init:function(){this.setColour(At),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setMutator(new O.icons.MutatorIcon(["lists_create_with_item"],this)),this.setTooltip(O.Msg.LISTS_CREATE_WITH_PYTHON_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("lists_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("lists_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(O.Msg.LISTS_CREATE_PYTHON_EMPTY_TITLE);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(O.Msg.blockpy_LISTS_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Kt={init:function(){var e=[[O.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[O.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[O.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"]];this.setColour(At),this.appendValueInput("VAR"),this.appendDummyInput("").appendField(O.Msg.A_TO_B).appendField(new O.FieldDropdown(e),"OP"),this.setInputsInline(!0),this.setOutput(!0)}},Zt={init:function(){this.setColour(At),this.appendValueInput("TUP"),this.appendDummyInput("").appendField(O.Msg.OBJECT_DELETE),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Qt={init:function(){this.setColour(At),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_TOLIST),this.setOutput(!0,"List"),this.setTooltip(O.Msg.MIXLY_PYTHON_TOOLTIP_TOLIST)}},Jt=Rt,en=kt,tn=St,nn=Ct,rn=Ft,sn=$t,on=Vt,an=Qt,ln={init:function(){this.setColour(At),this.appendValueInput("VAR").appendField(O.Msg.blockpy_USE_LIST),this.appendDummyInput().appendField(O.Msg.MIXLY_TO_INDEX_SEQUENCE),this.setInputsInline(!0),this.setOutput(!0,Number),this.setTooltip(O.Msg.MIXLY_TOTO_INDEX_SEQUENC_TOOLTIP)}},un={init:function(){this.setColour(At),this.appendDummyInput().appendField(O.Msg.blockpy_USE_LIST),this.appendValueInput("LIST"),this.appendValueInput("VALUE").appendField(O.Msg.MIXLY_TO_INDEX_SEQUENCE).appendField(O.Msg.MIXLY_INDEX+O.Msg.MIXLY_STARTSWITH),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(O.Msg.MIXLY_TOTO_INDEX_SEQUENC_TOOLTIP)}},cn={init:function(){this.setColour(At),this.appendValueInput("CON"),this.appendDummyInput().appendField(O.Msg.MIXLY_ESP32_MIXGO_MUSIC_SHOW_IN),this.appendValueInput("LIST"),this.appendDummyInput().appendField(O.Msg.MIXLY_MID),this.setInputsInline(!0),this.setOutput(!0)}},dn=345,hn={init:function(){this.setColour(dn),this.appendDummyInput("").appendField(new O.FieldTextInput("mydict"),"VAR").appendField(new O.FieldLabel(O.Msg.DICTS_CREATE_WITH_INPUT_WITH),"TIP"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new O.icons.MutatorIcon(["dicts_create_with_item"],this)),this.setTooltip(O.Msg.DICTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("dicts_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("dicts_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){this.getInput("EMPTY")&&this.removeInput("EMPTY");for(var e=[],t=0;this.getInput("ADD"+t);t++)e.push(this.getFieldValue("KEY"+t)),this.removeInput("ADD"+t);if(0==this.itemCount_)this.getField("TIP").setValue(O.Msg.DICTS_CREATE_EMPTY_TITLE);else{this.getField("TIP").setValue(O.Msg.DICTS_CREATE_WITH_INPUT_WITH);for(t=0;t<this.itemCount_;t++)this.appendValueInput("ADD"+t).setCheck(null).setAlign(O.inputs.Align.RIGHT).appendField(new O.FieldTextInput(e.length>t?e[t]:0==t?'"key"':'"key'+(t+1)+'"'),"KEY"+t).appendField(":")}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},pn={init:function(){this.setColour(dn),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_TYPE_DICT),this.appendStatementInput("STACK"),this.setTooltip(O.Msg.DICTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},fn={init:function(){this.setColour(dn),this.appendDummyInput().appendField(O.Msg.DICTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.DICTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},mn={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(O.Msg.DICT_KEYS),this.setTooltip(O.Msg.DICTS_KEYS_TOOLTIP),this.setOutput(!0,"List")}},gn={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(O.Msg.DICTS_GET_IN),this.appendDummyInput("").appendField(O.Msg.DICTS_ADD_VALUE),this.setOutput(!0),this.setTooltip(O.Msg.DICTS_GET_TOOLTIP)}},yn={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(O.Msg.DICTS_GET_IN),this.appendDummyInput("").appendField(O.Msg.DICTS_ADD_VALUE),this.appendValueInput("VAR").appendField(O.Msg.DICTS_DEFAULT_VALUE),this.setOutput(!0),this.setTooltip(O.Msg.DICTS_GET_DEFAULT_TOOLTIP)}},_n={init:function(){this.setColour(dn),this.appendValueInput("DICT"),this.appendValueInput("KEY").appendField(O.Msg.DICTS_ADD),this.appendDummyInput(),this.appendValueInput("VAR").appendField(O.Msg.DICTS_ADD_VALUE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.DICTS_ADD_OR_CHANGE_TOOLTIP)}},vn={init:function(){this.setColour(dn),this.appendValueInput("DICT"),this.appendValueInput("KEY").appendField(O.Msg.DICTS_DELETE_IN),this.appendDummyInput("").appendField(O.Msg.DICTS_DELETE_VALUE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.DICTS_DELETE_TOOLTIP)}},bn={init:function(){this.setColour(dn),this.appendValueInput("DICT2").setCheck("Dict").appendField(O.Msg.MAKE_DICT),this.appendValueInput("DICT").setCheck("Dict").appendField(O.Msg.DICT_UPDATE),this.appendDummyInput("").appendField(O.Msg.MIXLY_MID),this.setTooltip(O.Msg.DICTS_UPDATE_TOOLTIP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Tn={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(O.Msg.DICT_CLEAR),this.setTooltip(O.Msg.DICTS_CLEAR_TOOLTIP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},xn={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(O.Msg.DICT_ITEMS),this.setTooltip(O.Msg.DICTS_ITEMS_TOOLTIP),this.setOutput(!0,"List")}},En={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(O.Msg.DICT_VALUES),this.setTooltip(O.Msg.DICTS_VALUES_TOOLTIP),this.setOutput(!0,"List")}},wn={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(O.Msg.MIXLY_LENGTH),this.setTooltip(O.Msg.DICT_LENGTH_TOOLTIP),this.setOutput(!0,Number)}},In={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(O.Msg.DICT_DELDICT),this.setTooltip(O.Msg.DICTS_DEL_TOOLTIP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},An={init:function(){this.MODE=[[O.Msg.DICTS_ADD_OR_CHANGE,"INSERT"],[O.Msg.MIXLY_MICROBIT_JS_DELETE_VAR,"DELETE"]],this.setHelpUrl(O.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("AT2"),this.appendValueInput("KEY"),this.appendDummyInput("").appendField(O.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE).appendField(O.Msg.DICTS_ADD_VALUE),this.updateAt_(!0),this.setInputsInline(!0),this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip(function(){var t="";switch(e.getFieldValue("WHERE")){case"INSERT":t=O.Msg.DICTS_ADD_TOOLTIP;break;case"DELETE":t=O.Msg.DICTS_DELETE_TOOLTIP}return t})},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT2").type==O.INPUT_VALUE;return e.setAttribute("at2",t),e},domToMutation:function(e){var t="true"==e.getAttribute("at2");this.updateAt_(t)},updateAt_:function(e){this.removeInput("AT2"),this.removeInput("ORDINAL",!0),e?this.appendValueInput("AT2").setCheck(Number):this.appendDummyInput("AT2");var t=new O.FieldDropdown(this.MODE,function(t){var n="INSERT"==t;if(n!=e){var i=this.sourceBlock_;return i.updateAt_(n),i.setFieldValue(t,"WHERE"),null}});this.getInput("AT2").appendField(t,"WHERE")}},Sn={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(O.Msg.blockpy_DICT_POP),this.appendValueInput("KEY"),this.appendDummyInput("").appendField(O.Msg.DICTS_ADD_VALUE),this.setTooltip(O.Msg.DICT_POP_TOOLTIP),this.setInputsInline(!0),this.setOutput(!0)}},Cn={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(O.Msg.DICTS_SET_DEFAULT),this.appendDummyInput("").appendField(O.Msg.DICTS_DEFAULT_VALUE),this.appendValueInput("VAR"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.DICTS_SETDEFAULT_TOOLTIP)}},On={init:function(){this.setColour(dn),this.appendDummyInput("").appendField(new O.FieldLabel(O.Msg.MIXLY_MICROBIT_TYPE_DICT),"TIP").appendField(" "),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Dict"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setMutator(new O.icons.MutatorIcon(["dicts_create_with_item"],this)),this.setTooltip(O.Msg.DICTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("dicts_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("dicts_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){this.getInput("EMPTY")&&this.removeInput("EMPTY");for(var e=[],t=0;this.getInput("ADD"+t);t++)e.push(this.getFieldValue("KEY"+t)),this.removeInput("ADD"+t);if(0==this.itemCount_)this.getField("TIP").setValue(O.Msg.LOGIC_NULL+O.Msg.MIXLY_MICROBIT_TYPE_DICT);else{this.getField("TIP").setValue(O.Msg.MIXLY_MICROBIT_TYPE_DICT);for(t=0;t<this.itemCount_;t++)this.appendValueInput("ADD"+t).setCheck(null).setAlign(O.inputs.Align.RIGHT).appendField(new O.FieldTextInput(e.length>t?e[t]:0==t?'"key"':'"key'+(t+1)+'"'),"KEY"+t).appendField(":")}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Mn={init:function(){this.setColour(dn),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_TODICT),this.setOutput(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_TOOLTIP_TODICT)}},Rn={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(O.Msg.MIXLY_TO_JSON),this.setTooltip(O.Msg.MIXLY_TO_JSON_TOOLTIP),this.setOutput(!0)}},kn={init:function(){this.setColour(dn),this.appendValueInput("VAR"),this.appendDummyInput("").appendField(O.Msg.MIXLY_CONVERT_TO_JSON),this.setTooltip(O.Msg.MIXLY_CONVERT_TO_JSON_TOOLTIP),this.setOutput(!0)}},Nn={init:function(){this.setColour(dn),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("VAR1").appendField("key1"),this.appendValueInput("VAR2").appendField("index"),this.appendValueInput("VAR3").appendField("key2"),this.appendValueInput("VAR4").appendField("key3"),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXLY_CONVERT_TO_JSON_TOOLTIP),this.setOutput(!0)}},Dn={init:function(){this.setColour(dn),this.appendValueInput("DICT"),this.appendDummyInput("").appendField(O.Msg.MIXLY_TO_JSON),this.setTooltip(O.Msg.MIXLY_TO_JSON_TOOLTIP),this.setOutput(!0)}},Fn=210,Ln={init:function(){var e=O.RTL?[["=","EQ"],["≠","NEQ"],[">","LT"],["≥","LTE"],["<","GT"],["≤","GTE"]]:[["=","EQ"],["≠","NEQ"],["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]];this.setColour(Fn),this.setOutput(!0,Boolean),this.appendValueInput("A"),this.appendValueInput("B").appendField(new O.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{EQ:O.Msg.LOGIC_COMPARE_TOOLTIP_EQ,NEQ:O.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,LT:O.Msg.LOGIC_COMPARE_TOOLTIP_LT,LTE:O.Msg.LOGIC_COMPARE_TOOLTIP_LTE,GT:O.Msg.LOGIC_COMPARE_TOOLTIP_GT,GTE:O.Msg.LOGIC_COMPARE_TOOLTIP_GTE}[e]}),this.prevBlocks_=[null,null]}},Pn={init:function(){var e=O.RTL?[[">","LT"],["≥","LTE"],["<","GT"],["≤","GTE"]]:[["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]],t=O.RTL?[[">","LT"],["≥","LTE"],["<","GT"],["≤","GTE"]]:[["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]];this.setColour(Fn),this.setOutput(!0,Boolean),this.appendValueInput("A"),this.appendValueInput("B").appendField(new O.FieldDropdown(e),"OP1"),this.appendValueInput("C").appendField(new O.FieldDropdown(t),"OP2"),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_LOGIC_COMPARE_CONTINOUS_TOOLTIP)}},Bn={init:function(){var e=[[O.Msg.LOGIC_OPERATION_AND,"AND"],[O.Msg.LOGIC_OPERATION_OR,"OR"],[O.Msg.LOGIC_OPERATION_NOR,"NOR"],[O.Msg.LOGIC_OPERATION_XOR,"XOR"]];this.setColour(Fn),this.setOutput(!0,Boolean),this.appendValueInput("A").setCheck([Boolean,Number]),this.appendValueInput("B").setCheck([Boolean,Number]).appendField(new O.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{AND:O.Msg.LOGIC_OPERATION_TOOLTIP_AND,OR:O.Msg.LOGIC_OPERATION_TOOLTIP_OR,NOR:O.Msg.LOGIC_OPERATION_TOOLTIP_NOR,XOR:O.Msg.LOGIC_OPERATION_TOOLTIP_XOR}[e]})}},$n={init:function(){this.setColour(Fn),this.setOutput(!0,Boolean),this.appendValueInput("BOOL").setCheck([Number,Boolean]).appendField(O.Msg.LOGIC_NEGATE_TITLE),this.setTooltip(O.Msg.LOGIC_NEGATE_TOOLTIP)}},Un={init:function(){var e=[[O.Msg.LOGIC_BOOLEAN_TRUE,"TRUE"],[O.Msg.LOGIC_BOOLEAN_FALSE,"FALSE"]];this.setColour(Fn),this.setOutput(!0,Boolean),this.appendDummyInput().appendField(new O.FieldDropdown(e),"BOOL"),this.setTooltip(O.Msg.LOGIC_BOOLEAN_TOOLTIP)}},zn={init:function(){this.setColour(Fn),this.setOutput(!0),this.appendDummyInput().appendField(O.Msg.LOGIC_NULL),this.setTooltip(O.Msg.LOGIC_NULL_TOOLTIP)}},Vn={init:function(){this.setColour(Fn),this.appendValueInput("A"),this.appendValueInput("B").appendField(O.Msg.LOGIC_TERNARY_IF_TRUE),this.appendValueInput("C").appendField(O.Msg.LOGIC_TERNARY_IF_FALSE),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXLY_TOOLTIP_LOGIT_TRUEORFALSE)}},jn={init:function(){var e=[[O.Msg.TEXT_APPEND_TO,"in"],[O.Msg.MIXLY_PYTHON_LOGIC_IS_NOT_IN,"not in"]];this.setColour(Fn),this.appendValueInput("A"),this.appendValueInput("B").setCheck([String,"List"]).appendField(new O.FieldDropdown(e),"BOOL"),this.appendDummyInput("").appendField(O.Msg.MICROBIT_LOGIC_IS_IN),this.setOutput(!0,Boolean),this.setInputsInline(!0),this.setTooltip(O.Msg.IN)}},Yn={init:function(){var e=[[O.Msg.MIXLY_PYTHON_LOGIC_IS,"is"],[O.Msg.MIXLY_PYTHON_LOGIC_IS_NOT,"is not"]];this.setColour(Fn),this.appendValueInput("A"),this.appendValueInput("B").appendField(new O.FieldDropdown(e),"BOOL"),this.setOutput(!0,Boolean),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_LOGIC_IS_TOOLTIP)}},Gn={init:function(){this.setColour(Fn),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_TOBOOL),this.setOutput(!0,Boolean),this.setTooltip(O.Msg.MIXLY_PYTHON_TOOLTIP_TOBOOL)}},Hn={init:function(){this.setColour(0),this.appendValueInput("fn").setCheck(String).appendField(O.Msg.MIXLY_PYTHON_STORAGE_OPEN_FILE_WITH_OS+"(For Windows)"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0)}},Wn={init:function(){this.setColour(0),this.appendValueInput("FILENAME").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE).appendField(new O.FieldDropdown([[O.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,"r"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,"w"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,"rb"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE,"wb"],[O.Msg.MIXLY_ADD,"a"],[O.Msg.MATH_BIN+O.Msg.MIXLY_ADD,"ab"],[O.Msg.MIXLY_R_W,"r+"],[O.Msg.MATH_BIN+O.Msg.MIXLY_R_W,"rb+"],[O.Msg.MIXLY_W_R,"w+"],[O.Msg.MATH_BIN+O.Msg.MIXLY_W_R,"wb+"],[O.Msg.MIXLY_A_R,"a+"],[O.Msg.MATH_BIN+O.Msg.MIXLY_A_R,"ab+"]]),"MODE"),this.appendValueInput("FILE").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_AS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("MODE"),n=O.Msg.MIXLY_USE,i=O.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE,r=O.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE,s=O.Msg.MIXLY_BELONG;return n+{r:O.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,w:O.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,rb:O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,wb:O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE}[t]+s+i+r})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Xn={init:function(){this.setColour(0),this.appendValueInput("FILENAME").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE).appendField(new O.FieldDropdown([[O.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,"r"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,"w"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,"rb"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE,"wb"]]),"MODE"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setOutput(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("MODE"),n=O.Msg.MIXLY_USE,i=O.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE,r=O.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE,s=O.Msg.MIXLY_BELONG,o=O.Msg.PY_STORAGE_FILE_OBJECT;return n+{r:O.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,w:O.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,rb:O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,wb:O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE}[t]+s+i+r+o})}},qn={init:function(){this.setColour(0),this.appendValueInput("FILENAME").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE);this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE).appendField(new O.FieldDropdown([[O.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,"r"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,"w"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,"rb"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE,"wb"]]),"MODE"),this.appendDummyInput().appendField(O.Msg.MIXPY_TEXT_ENCODE).appendField(new O.FieldDropdown([["ANSI","ANSI"],["gbk","gbk"],["utf-8","utf-8"]]),"CODE"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setOutput(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("MODE"),n=O.Msg.MIXLY_USE,i=O.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE,r=O.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE,s=O.Msg.MIXLY_BELONG,o=O.Msg.PY_STORAGE_FILE_OBJECT;return n+{r:O.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,w:O.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,rb:O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,wb:O.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE}[t]+s+i+r+o})}},Kn={init:function(){this.setColour(0),this.appendValueInput("data").setCheck(String).appendField(O.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendValueInput("FILE").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_WRITE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE+O.Msg.MIXLY_MICROBIT_TYPE_STRING+O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_WRITE)}},Zn={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck("Variable").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE),this.appendDummyInput().appendField(new O.FieldDropdown([[O.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL,"read"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE,"readline"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL_LINES,"readlines"]]),"MODE"),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String)}},Qn={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck("Variable").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE),this.appendDummyInput().appendField(new O.FieldDropdown([[O.Msg.MIXLY_MICROBIT_PY_STORAGE_NO_MORE_THAN_SIZE,"read"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE_NO_MORE_THAN_SIZE,"readline"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL_LINES_NO_MORE_THAN_SIZE,"readlines"]]),"MODE"),this.appendValueInput("SIZE").setCheck(Number),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String);var e=this;this.setTooltip(function(){var t=e.getFieldValue("MODE"),n=O.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE,i=O.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER;return n+{read:O.Msg.MIXLY_MICROBIT_PY_STORAGE_NO_MORE_THAN_SIZE,readline:O.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE_NO_MORE_THAN_SIZE,readlines:O.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL_LINES_NO_MORE_THAN_SIZE}[t]+"x"+i})}},Jn={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE),this.setNextStatement(!0),this.appendValueInput("SIZE").setCheck(Number).appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE_NO_MORE_THAN_SIZE),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String),this.setTooltip(O.Msg.MICROBIT_PYTHON_TYPE)}},ei={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(O.Msg.HTML_FILE),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_CAN_WRITE_ORNOT),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Boolean),this.setTooltip(O.Msg.MIXLY_MICROBIT_PY_STORAGE_CAN_WRITE_ORNOT1)}},ti={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILENAME),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String),this.setTooltip(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_FILENAME)}},ni={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_CLOSE_FILE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(O.Msg.MIXLY_MICROBIT_PY_STORAGE_CLOSE_FILE)}},ii={init:function(){this.setColour(0),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_LIST_ALL_FILES),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setTooltip(O.Msg.MIXLY_MICROBIT_PY_STORAGE_LIST_ALL_FILES)}};O.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_FILE;const ri={init:function(){this.setColour(0),this.appendDummyInput().appendField(new O.FieldDropdown([[O.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_FILE,"remove"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_DIRS,"removedirs"]]),"MODE"),this.appendValueInput("FILE").setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(O.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_FILE)}},si={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_FILE_SIZE),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_SIZE),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Number),this.setTooltip(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_FILE_SIZE+O.Msg.MIXLY_MICROBIT_PY_STORAGE_SIZE)}},oi={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_RETURN_FILE),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_PRESENT_LOCATION),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Number),this.setTooltip(O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_TELL)}},ai={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck("Variable").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_SET_FILE_POSITION),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_CURRENT_POSITION),this.appendDummyInput().appendField(new O.FieldDropdown([[O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_START,"start"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_CURRENT,"current"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_END,"end"]]),"MODE"),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_OFFSET),this.appendValueInput("SIZE").setCheck(Number),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("MODE"),n=O.Msg.MIXLY_MICROBIT_PY_STORAGE_SET_FILE_POSITION+O.Msg.MIXLY_MICROBIT_PY_STORAGE_CURRENT_POSITION,i=O.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER,r=O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_OFFSET;return n+" "+{start:O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_START,current:O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_CURRENT,end:O.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_END}[t]+r+"x"+i})}},li={init:function(){this.setColour(0),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_CURRENT_DIR),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setTooltip(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_CURRENT_DIR)}},ui={init:function(){this.setColour(0),this.appendValueInput("PATH").setCheck(String).appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_PATH),this.appendDummyInput().appendField(O.Msg.MIXLY_ESP32_SET),this.appendDummyInput().appendField(new O.FieldDropdown([[O.Msg.MIXLY_MICROBIT_PY_STORAGE_MKDIR,"mkdir"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_MAKEDIRS,"makedirs"]]),"MODE"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1);var e=this;this.setTooltip(function(){var t=e.getFieldValue("MODE");return O.Msg.MIXLY_MICROBIT_PY_STORAGE_PATH+"x"+O.Msg.MIXLY_ESP32_SET+{mkdir:O.Msg.MIXLY_MICROBIT_PY_STORAGE_MKDIR,makedirs:O.Msg.MIXLY_MICROPYTHON_SOCKET_MAKEDIRS}[t]})}},ci={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_RENAME),this.appendValueInput("NEWFILE").setCheck(String).appendField(O.Msg.MIXLY_AS),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(O.Msg.MIXLY_MICROBIT_PY_STORAGE_RENAME)}},di={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_CHANGE_DIR),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(O.Msg.MIXLY_MICROBIT_PY_STORAGE_CHANGE_DIR)}},hi={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_THE_PATH),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_IS_OR_NOT),this.appendDummyInput().appendField(new O.FieldDropdown([[O.Msg.HTML_FILE,"isfile"],[O.Msg.MIXLY_MICROBIT_PY_STORAGE_IS_DIR,"isdir"]]),"MODE"),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Boolean);let e=this;this.setTooltip(function(){var t=e.getFieldValue("MODE");return O.Msg.MIXLY_MICROBIT_PY_STORAGE_THE_PATH+"x"+O.Msg.MIXLY_MICROBIT_PY_STORAGE_IS_OR_NOT+{isfile:O.Msg.MIXLY_MICROBIT_PY_STORAGE_MKDIR,isdir:O.Msg.MIXLY_MICROPYTHON_SOCKET_MAKEDIRS}[t]})}},pi={init:function(){this.setColour(0),this.appendValueInput("SPISUB").appendField(O.Msg.CONTROLS_FOR_INPUT_WITH+"SPI").setCheck("var"),this.appendValueInput("PINSUB").appendField("CS"),this.appendValueInput("SUB").appendField(O.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE).setCheck("var"),this.appendDummyInput("").appendField(O.Msg.MIXLY_SETUP+O.Msg.LISTS_SET_INDEX_INPUT_TO).appendField(O.Msg.MIXLY_SD_CARD),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},fi={init:function(){this.setColour(0),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_SD_CARD),this.appendValueInput("DIR").setCheck(String).appendField(O.Msg.MIXLY_SDCARD_MOUNT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip()}},mi={init:function(){var e=O.Procedures.findLegalName("",this),t=new O.FieldTextInput(e,O.Procedures.rename);t.setSpellcheck(!1),this.appendDummyInput().appendField(t,"NAME").appendField("","PARAMS"),this.setMutator(new O.icons.MutatorIcon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&O.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(O.Msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(O.Msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(O.Msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:function(e){this.hasStatements_!==e&&(e?(this.appendStatementInput("STACK").appendField(O.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=e)},updateParams_:function(){var e="";this.arguments_.length&&(e=O.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),O.Events.disable();try{this.setFieldValue(e,"PARAMS")}finally{O.Events.enable()}},mutationToDom:function(e){var t=O.utils.xml.createElement("mutation");e&&t.setAttribute("name",this.getFieldValue("NAME"));for(var n=0;n<this.argumentVarModels_.length;n++){var i=O.utils.xml.createElement("arg"),r=this.argumentVarModels_[n];i.setAttribute("name",r.name),i.setAttribute("varid",r.getId()),e&&this.paramIds_&&i.setAttribute("paramId",this.paramIds_[n]),t.appendChild(i)}return this.hasStatements_||t.setAttribute("statements","false"),t},domToMutation:function(e){this.arguments_=[],this.argumentVarModels_=[];for(var t,n=0;t=e.childNodes[n];n++)if("arg"==t.nodeName.toLowerCase()){var i=t.getAttribute("name"),r=t.getAttribute("varid")||t.getAttribute("varId");this.arguments_.push(i);var s=O.Variables.getOrCreateVariablePackage(this.workspace,r,i,"");null!=s?this.argumentVarModels_.push(s):console.log("Failed to create a variable with name "+i+", ignoring.")}this.updateParams_(),O.Procedures.mutateCallers(this),this.setStatements_("false"!==e.getAttribute("statements"))},saveExtraState:function(){if(!this.argumentVarModels_.length&&this.hasStatements_)return null;const e=Object.create(null);if(this.argumentVarModels_.length){e.params=[];for(let t=0;t<this.argumentVarModels_.length;t++)e.params.push({name:this.argumentVarModels_[t].name,id:this.argumentVarModels_[t].getId()})}return this.hasStatements_||(e.hasStatements=!1),e},loadExtraState:function(e){if(this.arguments_=[],this.argumentVarModels_=[],e.params)for(let t=0;t<e.params.length;t++){const n=e.params[t],i=O.Variables.getOrCreateVariablePackage(this.workspace,n.id,n.name,"");this.arguments_.push(i.name),this.argumentVarModels_.push(i)}this.updateParams_(),O.Procedures.mutateCallers(this),this.setStatements_(!1!==e.hasStatements)},decompose:function(e){var t=O.utils.xml.createElement("block");t.setAttribute("type","procedures_mutatorcontainer");var n=O.utils.xml.createElement("statement");n.setAttribute("name","STACK"),t.appendChild(n);for(var i=n,r=0;r<this.arguments_.length;r++){var s=O.utils.xml.createElement("block");s.setAttribute("type","procedures_mutatorarg");var o=O.utils.xml.createElement("field");o.setAttribute("name","NAME");var a=O.utils.xml.createTextNode(this.arguments_[r]);o.appendChild(a),s.appendChild(o);var l=O.utils.xml.createElement("next");s.appendChild(l),i.appendChild(s),i=l}var u=O.Xml.domToBlock(t,e);return"procedures_defreturn"==this.type?u.setFieldValue(this.hasStatements_,"STATEMENTS"):u.removeInput("STATEMENT_INPUT"),O.Procedures.mutateCallers(this),u},compose:function(e){this.arguments_=[],this.paramIds_=[],this.argumentVarModels_=[];for(var t=e.getInputTargetBlock("STACK");t&&!t.isInsertionMarker();){var n=t.getFieldValue("NAME");this.arguments_.push(n);var i=this.workspace.getVariable(n,"");this.argumentVarModels_.push(i),this.paramIds_.push(t.id),t=t.nextConnection&&t.nextConnection.targetBlock()}this.updateParams_(),O.Procedures.mutateCallers(this);var r=e.getFieldValue("STATEMENTS");if(null!==r&&(r="TRUE"==r,this.hasStatements_!=r))if(r)this.setStatements_(!0),this.statementConnection_&&this.statementConnection_.reconnect(this,"STACK"),this.statementConnection_=null;else{var s=this.getInput("STACK").connection;if(this.statementConnection_=s.targetConnection,this.statementConnection_){var o=s.targetBlock();o.unplug(),o.bumpNeighbours()}this.setStatements_(!1)}},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},renameVarById:function(e,t){var n=this.workspace.getVariableById(e);if(""==n.type){for(var i=n.name,r=this.workspace.getVariableById(t),s=!1,o=0;o<this.argumentVarModels_.length;o++)this.argumentVarModels_[o].getId()==e&&(this.arguments_[o]=r.name,this.argumentVarModels_[o]=r,s=!0);s&&(this.displayRenamedVar_(i,r.name),O.Procedures.mutateCallers(this))}},updateVarName:function(e){for(var t=e.name,n=!1,i=0;i<this.argumentVarModels_.length;i++)if(this.argumentVarModels_[i].getId()==e.getId()){var r=this.arguments_[i];this.arguments_[i]=t,n=!0}n&&(this.displayRenamedVar_(r,t),O.Procedures.mutateCallers(this))},displayRenamedVar_:function(e,t){this.updateParams_();const n=this.getIcon(O.icons.MutatorIcon.TYPE);if(n&&n.bubbleIsVisible())for(var i,r=n.getWorkspace().getAllBlocks(!1),s=0;i=r[s];s++)"procedures_mutatorarg"==i.type&&O.Names.equals(e,i.getFieldValue("NAME"))&&i.setFieldValue(t,"NAME")},customContextMenu:function(e){if(!this.isInFlyout){var t={enabled:!0},n=this.getFieldValue("NAME");t.text=O.Msg.PROCEDURES_CREATE_DO.replace("%1",n);var i=O.utils.xml.createElement("mutation");i.setAttribute("name",n);for(var r=0;r<this.arguments_.length;r++){var s=O.utils.xml.createElement("arg");s.setAttribute("name",this.arguments_[r]),i.appendChild(s)}var o=O.utils.xml.createElement("block");if(o.setAttribute("type",this.callType_),o.appendChild(i),t.callback=O.ContextMenu.callbackFactory(this,o),e.push(t),!this.isCollapsed())for(r=0;r<this.argumentVarModels_.length;r++){var a={enabled:!0},l=this.argumentVarModels_[r];a.text=O.Msg.VARIABLES_SET_CREATE_GET.replace("%1",l.name);var u=O.Variables.generateVariableFieldDom(l),c=O.utils.xml.createElement("block");c.setAttribute("type","variables_get"),c.appendChild(u),a.callback=O.ContextMenu.callbackFactory(this,c),e.push(a)}}},callType_:"procedures_callnoreturn"},gi={init:function(){var e=O.Procedures.findLegalName("",this),t=new O.FieldTextInput(e,O.Procedures.rename);t.setSpellcheck(!1),this.appendDummyInput().appendField(t,"NAME").appendField("","PARAMS"),this.appendValueInput("RETURN").setAlign(O.inputs.Align.RIGHT).appendField(O.Msg.PROCEDURES_DEFRETURN_RETURN),this.setMutator(new O.icons.MutatorIcon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&O.Msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText(O.Msg.PROCEDURES_DEFRETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(O.Msg.PROCEDURES_DEFRETURN_TOOLTIP),this.setHelpUrl(O.Msg.PROCEDURES_DEFRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:mi.setStatements_,updateParams_:mi.updateParams_,mutationToDom:mi.mutationToDom,domToMutation:mi.domToMutation,decompose:mi.decompose,compose:mi.compose,getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},getVars:mi.getVars,getVarModels:mi.getVarModels,renameVarById:mi.renameVarById,updateVarName:mi.updateVarName,displayRenamedVar_:mi.displayRenamedVar_,customContextMenu:mi.customContextMenu,callType_:"procedures_callreturn"},yi={init:function(){this.appendDummyInput().appendField(O.Msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.appendDummyInput("STATEMENT_INPUT").appendField(O.Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new O.FieldCheckbox("TRUE"),"STATEMENTS"),this.setStyle("procedure_blocks"),this.setTooltip(O.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP),this.contextMenu=!1}},_i={init:function(){var e=new O.FieldTextInput(O.Procedures.DEFAULT_ARG,this.validator_);e.oldShowEditorFn_=e.showEditor_;e.showEditor_=function(){this.createdVariables_=[],this.oldShowEditorFn_()},this.appendDummyInput().appendField(O.Msg.PROCEDURES_BEFORE_PARAMS).appendField(e,"NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(O.Msg.PROCEDURES_MUTATORARG_TOOLTIP),this.contextMenu=!1,e.onFinishEditing_=this.deleteIntermediateVars_,e.createdVariables_=[],e.onFinishEditing_("x")},validator_:function(e){var t=this.getSourceBlock(),n=t.workspace.getRootWorkspace();if(!(e=e.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"")))return null;for(var i=(t.workspace.targetWorkspace||t.workspace).getAllBlocks(!1),r=e.toLowerCase(),s=0;s<i.length;s++)if(i[s].id!=this.getSourceBlock().id){var o=i[s].getFieldValue("NAME");if(o&&o.toLowerCase()==r)return null}if(t.isInFlyout)return e;var a=n.getVariable(e,"");return a&&a.name!=e&&n.renameVariableById(a.getId(),e),a||(a=n.createVariable(e,""))&&this.createdVariables_&&this.createdVariables_.push(a),e},deleteIntermediateVars_:function(e){var t=this.getSourceBlock().workspace.getRootWorkspace();if(t)for(var n=0;n<this.createdVariables_.length;n++){var i=this.createdVariables_[n];i.name!=e&&t.deleteVariableById(i.getId())}}},vi={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(O.Msg.PROCEDURES_CALLNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null,this.previousEnabledState_=!0},getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(e,t){if(O.Names.equals(e,this.getProcedureCall())){this.setFieldValue(t,"NAME");var n=this.outputConnection?O.Msg.PROCEDURES_CALLRETURN_TOOLTIP:O.Msg.PROCEDURES_CALLNORETURN_TOOLTIP;this.setTooltip(n.replace("%1",t))}},setProcedureParameters_:function(e,t){const n=O.Procedures.getDefinition(this.getProcedureCall(),this.workspace),i=n&&n.getIcon(O.icons.MutatorIcon.TYPE),r=i&&i.bubbleIsVisible();if(r?this.setCollapsed(!1):(this.quarkConnections_={},this.quarkIds_=null),e.join("\n")!==this.arguments_.join("\n")){if(t.length!==e.length)throw Error("paramNames and paramIds must be the same length.");this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);for(let e=0;e<this.arguments_.length;e++){const n=this.getInput("ARG"+e);if(n){const i=n?.connection?.targetConnection;this.quarkConnections_[this.quarkIds_[e]]=i,r&&i&&!t.includes(this.quarkIds_[e])&&(i.disconnect(),i.getSourceBlock().bumpNeighbours())}}this.arguments_=[].concat(e),this.argumentVarModels_=[];for(var s=0;s<this.arguments_.length;s++){var o=O.Variables.getOrCreateVariablePackage(this.workspace,null,this.arguments_[s],"");this.argumentVarModels_.push(o)}if(this.updateShape_(),this.quarkIds_=t,this.quarkIds_)for(let e=0;e<this.arguments_.length;e++){const t=this.quarkIds_[e];if(t in this.quarkConnections_){const n=this.quarkConnections_[t];n?.reconnect(this,"ARG"+e)||delete this.quarkConnections_[t]}}}else this.quarkIds_=t},updateShape_:function(){for(var e=0;e<this.arguments_.length;e++){var t=this.getField("ARGNAME"+e);if(t){O.Events.disable();try{t.setValue(this.arguments_[e])}finally{O.Events.enable()}}else{t=new O.FieldLabel(this.arguments_[e]),this.appendValueInput("ARG"+e).setAlign(O.inputs.Align.RIGHT).appendField(t,"ARGNAME"+e).init()}}for(;this.getInput("ARG"+e);)this.removeInput("ARG"+e),e++;var n=this.getInput("TOPROW");n&&(this.arguments_.length?this.getField("WITH")||(n.appendField(O.Msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"),n.init()):this.getField("WITH")&&n.removeField("WITH"))},mutationToDom:function(){var e=O.utils.xml.createElement("mutation");e.setAttribute("name",this.getProcedureCall());for(var t=0;t<this.arguments_.length;t++){var n=O.utils.xml.createElement("arg");n.setAttribute("name",this.arguments_[t]),e.appendChild(n)}return e},domToMutation:function(e){var t=e.getAttribute("name");this.renameProcedure(this.getProcedureCall(),t);for(var n,i=[],r=[],s=0;n=e.childNodes[s];s++)"arg"==n.nodeName.toLowerCase()&&(i.push(n.getAttribute("name")),r.push(n.getAttribute("paramId")));this.setProcedureParameters_(i,r)},saveExtraState:function(){const e=Object.create(null);return e.name=this.getProcedureCall(),this.arguments_.length&&(e.params=this.arguments_),e},loadExtraState:function(e){this.renameProcedure(this.getProcedureCall(),e.name);const t=e.params;if(t){const e=[];e.length=t.length,e.fill(null),this.setProcedureParameters_(t,e)}},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(e){if(this.workspace&&!this.workspace.isFlyout&&e.recordUndo)if(e.type==O.Events.BLOCK_CREATE&&-1!=e.ids.indexOf(this.id)){var t=this.getProcedureCall();if((p=O.Procedures.getDefinition(t,this.workspace))&&p.type!=this.defType_&&(p=null),p){if(JSON.stringify(p.getVars())!=JSON.stringify(this.arguments_)){let e=p.arguments_,t=[];for(var n=0;n<this.arguments_.length;n++){var i=this.getInput("ARG"+n);if(i){var r=i.connection.targetConnection;r?t.push(r.sourceBlock_.id):t.push(null)}}this.setProcedureParameters_(e,t)}}else{O.Events.setGroup(e.group);var s=O.utils.xml.createElement("xml"),o=O.utils.xml.createElement("block");o.setAttribute("type",this.defType_);var a=this.getRelativeToSurfaceXY(),l=a.x+O.SNAP_RADIUS*(this.RTL?-1:1),u=a.y+2*O.SNAP_RADIUS;o.setAttribute("x",l),o.setAttribute("y",u);var c=this.mutationToDom();o.appendChild(c);var d=O.utils.xml.createElement("field");d.setAttribute("name","NAME");var h=this.getProcedureCall();h||(h=O.Procedures.findLegalName("",this),this.renameProcedure("",h)),d.appendChild(O.utils.xml.createTextNode(h)),o.appendChild(d),s.appendChild(o),O.Xml.domToWorkspace(s,this.workspace),O.Events.setGroup(!1)}}else if(e.type==O.Events.BLOCK_DELETE){t=this.getProcedureCall();(p=O.Procedures.getDefinition(t,this.workspace))||(O.Events.setGroup(e.group),this.dispose(!0),O.Events.setGroup(!1))}else if(e.type==O.Events.CHANGE&&"disabled"==e.element){var p;t=this.getProcedureCall();if((p=O.Procedures.getDefinition(t,this.workspace))&&p.id==e.blockId){var f=O.Events.getGroup();f&&console.log("Saw an existing group while responding to a definition change"),O.Events.setGroup(e.group),e.newValue?(this.previousEnabledState_=this.isEnabled(),this.setEnabled(!1)):this.setEnabled(this.previousEnabledState_),O.Events.setGroup(f)}}},customContextMenu:function(e){if(this.workspace.isMovable()){var t={enabled:!0};t.text=O.Msg.PROCEDURES_HIGHLIGHT_DEF;var n=this.getProcedureCall(),i=this.workspace;t.callback=function(){var e=O.Procedures.getDefinition(n,i);e&&(i.centerOnBlock(e.id),e.select())},e.push(t)}},defType_:"procedures_defnoreturn"},bi={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setOutput(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(O.Msg.PROCEDURES_CALLRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null,this.previousEnabledState_=!0},getProcedureCall:vi.getProcedureCall,renameProcedure:vi.renameProcedure,setProcedureParameters_:vi.setProcedureParameters_,updateShape_:vi.updateShape_,mutationToDom:vi.mutationToDom,domToMutation:vi.domToMutation,getVars:vi.getVars,getVarModels:vi.getVarModels,onchange:vi.onchange,customContextMenu:vi.customContextMenu,defType_:"procedures_defreturn"},Ti={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(O.Msg.CONTROLS_IF_MSG_IF),this.appendValueInput("VALUE").appendField(O.Msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(O.Msg.PROCEDURES_IFRETURN_TOOLTIP),this.setHelpUrl(O.Msg.PROCEDURES_IFRETURN_HELPURL),this.hasReturnValue_=!0},mutationToDom:function(){var e=O.utils.xml.createElement("mutation");return e.setAttribute("value",Number(this.hasReturnValue_)),e},domToMutation:function(e){var t=e.getAttribute("value");this.hasReturnValue_=1==t,this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(O.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){if(this.workspace.isDragging&&!this.workspace.isDragging()){var e=!1,t=this;do{if(-1!=this.FUNCTION_TYPES.indexOf(t.type)){e=!0;break}t=t.getSurroundParent()}while(t);e?("procedures_defnoreturn"==t.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(O.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=t.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(O.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null),this.isInFlyout||this.setEnabled(!0)):(this.setWarningText(O.Msg.PROCEDURES_IFRETURN_WARNING),this.isInFlyout||this.getInheritedDisabled()||this.setEnabled(!1))}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]},xi={init:function(){this.setStyle("procedure_blocks"),this.appendValueInput("VALUE").appendField(O.Msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.PROCEDURES_IFRETURN_TOOLTIP),this.hasReturnValue_=!0},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("value",Number(this.hasReturnValue_)),e},domToMutation:function(e){var t=e.getAttribute("value");this.hasReturnValue_=1==t,this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(O.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){var e=!1,t=this;do{if(-1!=this.FUNCTION_TYPES.indexOf(t.type)){e=!0;break}t=t.getSurroundParent()}while(t);e?("procedures_defnoreturn"==t.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(O.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=t.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(O.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(O.Msg.PROCEDURES_IFRETURN_WARNING)},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn","method_procedures_defnoreturn","method_procedures_defreturn"]},Ei=195,wi={init:function(){this.setColour(Ei),this.appendDummyInput("").appendField(new O.FieldTextInput("mytup"),"VAR"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new O.icons.MutatorIcon(["tuple_create_with_item"],this)),this.setTooltip(O.Msg.TUPLE_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("tuple_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("tuple_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(O.Msg.TUPLE_CREATE_EMPTY_TITLE);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(O.Msg.TUPLE_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Ii={init:function(){this.setColour(Ei),this.appendDummyInput().appendField(O.Msg.TUPLE_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(O.Msg.TUPLE_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Ai={init:function(){this.setColour(Ei),this.appendDummyInput().appendField(O.Msg.blockpy_SET_VARIABLES_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.TUPLE_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},Si={init:function(){this.setColour(Ei),this.appendDummyInput("").appendField(new O.FieldTextInput("mytup"),"VAR").appendField(" = (").appendField(new O.FieldTextInput("0,0,0"),"TEXT").appendField(")"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.MIXPY_TOOLTIP_TUPLE_CREATE_WITH_TEXT)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Ci={init:function(){this.setColour(Ei),this.appendDummyInput("").appendField("(").appendField(new O.FieldTextInput("0,0,0"),"TEXT").appendField(")"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXPY_TOOLTIP_TUPLE_CREATE_WITH_TEXT)}},Oi={init:function(){this.setColour(Ei),this.setOutput(!0),this.appendValueInput("TUP").setCheck("Tuple"),this.appendValueInput("AT").setCheck(Number).appendField(O.Msg.LANG_LISTS_GET_INDEX1),this.appendDummyInput("").appendField(O.Msg.LANG_LISTS_GET_INDEX2),this.setInputsInline(!0),this.setTooltip(O.Msg.TUPLE_GET_INDEX_TOOLTIP)}},Mi={init:function(){this.setColour(Ei),this.appendValueInput("TUP"),this.appendDummyInput("").appendField(O.Msg.MIXLY_LENGTH),this.setTooltip(O.Msg.TUPLE_LENGTH_TOOLTIP),this.setOutput(!0,Number)}},Ri={init:function(){this.setColour(Ei),this.appendValueInput("TUP").setCheck("Tuple"),this.appendDummyInput("").appendField(O.Msg.TUPLE_DEL),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.TUPLE_DEL_TOOLTIP)}},ki={init:function(){this.setColour(Ei),this.appendValueInput("TUP1").setCheck("Tuple"),this.appendDummyInput("").appendField(O.Msg.TUPLE_JOIN),this.appendValueInput("TUP2").setCheck("Tuple"),this.setInputsInline(!0),this.setTooltip(O.Msg.TUPLE_JOIN_TOOLTIP),this.setOutput(!0,"Tuple")}},Ni={init:function(){this.appendValueInput("TUP").setCheck("Tuple");var e=[[O.Msg.blockpy_TUPLE_MAX,"max"],[O.Msg.blockpy_TUPLE_MIN,"min"],[O.Msg.MATH_ONLIST_OPERATOR_SUM,"sum"]];this.setColour(Ei),this.appendDummyInput("").appendField(O.Msg.MIXLY_MICROBIT_JS_GET).appendField(new O.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{max:O.Msg.MIXLY_TOOLTIP_TUPLE_MAX,min:O.Msg.MIXLY_TOOLTIP_TUPLE_MIN,sum:O.Msg.MIXLY_TOOLTIP_TUPLE_SUM}[e]})}},Di={init:function(){var e=[[O.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[O.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"]];this.setColour(Ei),this.appendValueInput("VAR").setCheck("Tuple"),this.appendDummyInput("").appendField(O.Msg.A_TO_B).appendField(new O.FieldDropdown(e),"OP"),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{list:O.Msg.TUPLE_TO_LISTS,set:O.Msg.TUPLE_TO_SET}[e]})}},Fi={init:function(){var e=[[O.Msg.MIXLY_LIST_INDEX,"INDEX"],[O.Msg.MIXLY_LIST_COUNT,"COUNT"]];this.setColour(Ei),this.appendValueInput("VAR").setCheck("List"),this.appendValueInput("data").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(O.Msg.HTML_VALUE),this.appendDummyInput().appendField(O.Msg.MIXLY_DE).appendField(new O.FieldDropdown(e),"OP"),this.setInputsInline(!0),this.setOutput(!0,Number);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{INDEX:O.Msg.MIXLY_TOOLTIP_TUPLE_FIND_INDEX,COUNT:O.Msg.MIXLY_TOOLTIP_TUPLE_FIND_COUNT}[e]})}},Li={init:function(){var e=[[O.Msg.MIXLY_LIST_LEN,"LEN"],[O.Msg.MATH_ONLIST_OPERATOR_SUM,"SUM"],[O.Msg.MATH_ONLIST_OPERATOR_MAX,"MAX"],[O.Msg.MATH_ONLIST_OPERATOR_MIN,"MIN"],[O.Msg.MATH_ONLIST_OPERATOR_AVERAGE,"AVERAGE"],[O.Msg.MATH_ONLIST_OPERATOR_MEDIAN,"MEDIAN"],[O.Msg.MATH_ONLIST_OPERATOR_MODE,"MODE"],[O.Msg.MATH_ONLIST_OPERATOR_STD_DEV,"STD_DEV"]];this.setColour(Ei),this.setOutput(!0,Number),this.appendValueInput("data").setCheck("List"),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new O.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{LEN:O.Msg.TUPLE_LENGTH_TOOLTIP,SUM:O.Msg.MATH_ONLIST_TOOLTIP_TUPLE_SUM,MAX:O.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MAX,MIN:O.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MIN,AVERAGE:O.Msg.MATH_ONLIST_TOOLTIP_TUPLE_AVERAGE,MEDIAN:O.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MEDIAN,MODE:O.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MODE,STD_DEV:O.Msg.MATH_ONLIST_TOOLTIP_TUPLE_STD_DEV}[e]})}},Pi={init:function(){this.WHERE_OPTIONS_1=[[O.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[O.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[O.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[O.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[O.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[O.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(O.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(Ei),this.appendValueInput("LIST").setCheck("List"),this.appendDummyInput("").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),this.setInputsInline(!0),this.setOutput(!0,"List"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(O.Msg.PYTHON_TUPLE_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT1").type==O.INPUT_VALUE;e.setAttribute("at1",t);var n=this.getInput("AT2").type==O.INPUT_VALUE;return e.setAttribute("at2",n),e},domToMutation:function(e){var t="true"==e.getAttribute("at1"),n="true"==e.getAttribute("at2");this.updateAt_(1,t),this.updateAt_(2,n)},updateAt_:function(e,t){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),t?(this.appendValueInput("AT"+e).setCheck(Number),O.Msg.TEXT_CHARAT_TAIL&&this.appendDummyInput("ORDINAL"+e).appendField(O.Msg.TEXT_CHARAT_TAIL)):this.appendDummyInput("AT"+e);var n=new O.FieldDropdown(this["WHERE_OPTIONS_"+e],function(n){var i="FROM_START"==n||"FROM_END"==n;if(i!=t){var r=this.sourceBlock_;return r.updateAt_(e,i),r.setFieldValue(n,"WHERE"+e),null}});this.getInput("AT"+e).appendField(n,"WHERE"+e),1==e&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"))}},Bi={init:function(){this.setColour(Ei),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"Tuple"),this.setMutator(new O.icons.MutatorIcon(["tuple_create_with_item"],this)),this.setTooltip(O.Msg.TUPLE_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("tuple_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("tuple_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(O.Msg.TUPLE_CREATE_EMPTY_TITLE);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(O.Msg.TUPLE_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},$i={init:function(){this.setHelpUrl(O.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(Ei),this.appendValueInput("LIST"),this.appendDummyInput(""),this.appendValueInput("AT1").appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+O.Msg.LISTS_GET_INDEX_FROM_START),this.appendValueInput("AT2").appendField(O.Msg.TEXT_CHARAT_TAIL+" "+O.Msg.LISTS_GET_SUBLIST_END_FROM_START),this.appendDummyInput().appendField(O.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Tuple"),this.setTooltip(O.Msg.PYTHON_TUPLE_GET_SUBLIST_TOOLTIP)}},Ui={init:function(){this.setColour(Ei),this.appendValueInput("TUP"),this.appendDummyInput().appendField(O.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+O.Msg.LISTS_GET_INDEX_RANDOM),this.setTooltip(O.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM),this.setOutput(!0)}},zi={init:function(){this.setColour(Ei),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_TOTUPLE),this.setOutput(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_TOOLTIP_TOTUPLE)}};const Vi={init:function(){var e;this.setColour(Ei),this.appendDummyInput("").appendField("(").appendField(new O.FieldTextInput((e=new Date,e.getFullYear()+","+(e.getMonth()+1)+","+e.getDate()+","+e.getHours()+","+e.getMinutes()+","+e.getSeconds())),"CONTENT").appendField(")"),this.setOutput(!0)}},ji={init:function(){this.setColour(Ei),this.appendValueInput("params").appendField("(").appendField(O.Msg.MIXLY_NAME_OF_PARAMS),this.appendDummyInput().appendField(",").appendField(O.Msg.MIXLY_TYPE).appendField(new O.FieldDropdown([[O.Msg.MIXLY_TYPE_BOOLEAN,"boolean"],[O.Msg.MIXLY_TYPE_STRING,"string"],[O.Msg.MIXLY_TYPE_NUMBER,"number"],[O.Msg.MIXLY_TYPE_INTEGER,"integer"],[O.Msg.MIXLY_TYPE_NULL,"null"]]),"type"),this.appendValueInput("des").appendField(",").appendField(O.Msg.MIXLY_DESCRIPTION),this.appendDummyInput().appendField(")"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXPY_TOOLTIP_TUPLE_CREATE_WITH_TEXT)}},Yi=100,Gi={init:function(){this.setColour(Yi),this.appendDummyInput("").appendField(new O.FieldTextInput("s1"),"VAR"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new O.icons.MutatorIcon(["set_create_with_item"],this)),this.setTooltip(O.Msg.blockpy_SET_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("set_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("set_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(O.Msg.blockpy_SET_CREATE_EMPTY_TITLE);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(O.Msg.blockpy_SET_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){O.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Hi={init:function(){this.setColour(Yi),this.appendDummyInput().appendField(O.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(O.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Wi={init:function(){this.setColour(Yi),this.appendDummyInput().appendField(O.Msg.blockpy_SET_VARIABLES_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.blockpy_SET_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},Xi={init:function(){this.setColour(Yi),this.appendValueInput("SET"),this.appendDummyInput("").appendField(O.Msg.MIXLY_LENGTH),this.setInputsInline(!0),this.setTooltip(O.Msg.SET_LENGTH_TOOLTIP),this.setOutput(!0,Number)}},qi={init:function(){this.setColour(Yi),this.appendValueInput("SET").setCheck("Set"),this.appendDummyInput("").appendField(O.Msg.blockpy_SET_GET_AND_REMOVE_LAST),this.setTooltip(O.Msg.SET_POP_TOOLTIP),this.setInputsInline(!0),this.setOutput(!0)}},Ki={init:function(){this.setColour(Yi),this.appendValueInput("SET").setCheck("Set"),this.appendDummyInput("").appendField(O.Msg.SET_CLEAR),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Zi={init:function(){this.appendValueInput("SET1").setCheck("Set");var e=[[O.Msg.blockpy_set_union,"union"],[O.Msg.blockpy_set_intersection,"intersection"],[O.Msg.blockpy_set_difference,"difference"]];this.setColour(Yi),this.appendDummyInput("").appendField(O.Msg.blockpy_and_set),this.appendValueInput("SET2").setCheck("Set"),this.appendDummyInput("").appendField(O.Msg.blockpy_set_get_operate).appendField(new O.FieldDropdown(e),"OPERATE"),this.setInputsInline(!0),this.setOutput(!0,"set");var t=this;this.setTooltip(function(){var e=t.getFieldValue("OPERATE");return{union:O.Msg.MIXLY_TOOLTIP_SET_UNION,intersection:O.Msg.MIXLY_TOOLTIP_SET_INTERSECTION,difference:O.Msg.MIXLY_TOOLTIP_SET_DIFFERENCE}[e]})}},Qi={init:function(){this.appendValueInput("SET1").setCheck("Set");var e=[[O.Msg.blockpy_set_union,"update"],[O.Msg.blockpy_set_intersection,"intersection_update"],[O.Msg.blockpy_set_difference,"difference_update"]];this.setColour(Yi),this.appendDummyInput("").appendField(O.Msg.blockpy_and_set),this.appendValueInput("SET2").setCheck("Set"),this.appendDummyInput("").appendField(O.Msg.blockpy_set_get_operate).appendField(new O.FieldDropdown(e),"OPERATE"),this.appendDummyInput("").appendField(O.Msg.blockpy_set_update),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OPERATE");return{update:O.Msg.MIXLY_TOOLTIP_SET_UPDATE,intersection_update:O.Msg.MIXLY_TOOLTIP_SET_INTERSECTION_UPDATE,difference_update:O.Msg.MIXLY_TOOLTIP_SET_DIFFERENCE_UPDATE}[e]})}},Ji={init:function(){this.appendValueInput("SET").setCheck("Set");var e=[[O.Msg.MIXLY_blockpy_set_add,"add"],[O.Msg.MIXLY_blockpy_set_discard,"discard"]];this.setColour(Yi),this.appendDummyInput("").appendField(new O.FieldDropdown(e),"OPERATE"),this.appendValueInput("data").appendField(O.Msg.blockpy_SET_VARIABLES_NAME),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OPERATE");return{add:O.Msg.SET_ADD_TOOLTIP,discard:O.Msg.SET_DISCARD_TOOLTIP}[e]})}},er={init:function(){this.appendValueInput("SET1").setCheck("Set");var e=[[O.Msg.blockpy_set_sub,"issubset"],[O.Msg.blockpy_set_super,"issuperset"]];this.setColour(Yi),this.appendDummyInput("").appendField(O.Msg.blockpy_is_set),this.appendValueInput("SET2").setCheck("Set"),this.appendDummyInput("").appendField(O.Msg.blockpy_set_of).appendField(new O.FieldDropdown(e),"OPERATE"),this.setInputsInline(!0),this.setOutput(!0,Boolean);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OPERATE");return{issubset:O.Msg.MIXLY_TOOLTIP_SET_SUB,issuperset:O.Msg.MIXLY_TOOLTIP_SET_SUPER}[e]})}},tr={init:function(){this.appendValueInput("SET").setCheck("Set"),this.setColour(Yi),this.appendValueInput("VAR").setCheck([String,"List"]).appendField(O.Msg.blockpy_set_add_update),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(O.Msg.SET_UPDATE_TOOLTIP)}},nr={init:function(){this.setColour(Yi),this.appendDummyInput("").appendField("{").appendField(new O.FieldTextInput("0,0,0"),"TEXT").appendField("}"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(O.Msg.MIXPY_TOOLTIP_SET_CREATE_WITH_TEXT)}},ir={init:function(){this.setColour(Yi),this.appendValueInput("VAR").appendField(O.Msg.MIXLY_TOSET),this.setOutput(!0),this.setTooltip(O.Msg.MIXLY_PYTHON_TOOLTIP_TOSET)}},rr="#1ec1e4",sr={init:function(){this.setColour(rr),this.appendDummyInput().appendField(O.Msg.HTML_DOCUMENT),this.appendStatementInput("HEAD").appendField(O.Msg.HTML_HEAD),this.appendStatementInput("BODY").appendField(O.Msg.HTML_BODY),this.setOutput(!0)}},or={init:function(){this.setColour(rr),this.appendDummyInput().appendField(O.Msg.HTML_LEVEL).appendField(new O.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"]]),"LEVEL"),this.appendStatementInput("DO").appendField(""),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ar={init:function(){this.setColour(rr),this.appendDummyInput().appendField(new O.FieldDropdown([[O.Msg.HTML_HEAD,"head"],[O.Msg.HTML_BODY,"body"]]),"LEVEL"),this.appendStatementInput("DO").appendField(""),this.setPreviousStatement(!0),this.setNextStatement(!0)}},lr={init:function(){this.setColour(rr),this.appendDummyInput().appendField(new O.FieldDropdown([[O.Msg.HTML_P,"p"],[O.Msg.HTML_SPAN,"span"],[O.Msg.HTML_FORM,"form"],[O.Msg.HTML_TABLE,"table"],[O.Msg.HTML_LINE,"tr"],[O.Msg.HTML_CELL,"td"],[O.Msg.HTML_OL,"ol"],[O.Msg.HTML_UL,"ul"],[O.Msg.HTML_LI,"li"]]),"LEVEL"),this.appendStatementInput("DO").appendField(""),this.setInputsInline(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ur={init:function(){this.setColour(rr),this.appendDummyInput().appendField("<").appendField(new O.FieldTextInput("tag"),"LEVEL").appendField(">"),this.appendValueInput("style").appendField(O.Msg.MIXLY_AIP_ATTR).setAlign(O.inputs.Align.RIGHT),this.appendStatementInput("DO").appendField(""),this.setInputsInline(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)}},cr={init:function(){this.setColour(rr),this.appendDummyInput().appendField(O.Msg.HTML_STYLE),this.appendStatementInput("STYLE"),this.setOutput(!0)}},dr={init:function(){this.setColour(rr),this.appendDummyInput().appendField(O.Msg.HTML_FORM_CONTENT).appendField(new O.FieldDropdown([[O.Msg.HTML_TEXT,"text"],[O.Msg.HTML_EMAIL,"email"],[O.Msg.HTML_NUMBER,"number"],[O.Msg.HTML_PASSWORD,"password"],[O.Msg.HTML_CHECKBOX,"checkbox"],[O.Msg.HTML_RADIOBUTTON,"radiobutton"],[O.Msg.HTML_BUTTON,"button"],[O.Msg.HTML_COLOUR,"colour"],[O.Msg.HTML_DATE,"date"],[O.Msg.HTML_LOCALTIME,"local time"],[O.Msg.HTML_FILE,"file"],[O.Msg.HTML_HIDDEN,"hidden"],[O.Msg.HTML_IMAGE,"image"],[O.Msg.HTML_MONTH,"month"],[O.Msg.HTML_RANGE,"range"],[O.Msg.HTML_RESET,"reset"],[O.Msg.HTML_SEARCH,"search"],[O.Msg.HTML_SUBMIT,"submit"],[O.Msg.HTML_TELEPHONENUMBER,"telephone number"],[O.Msg.HTML_TIME,"time"],[O.Msg.HTML_URL,"url"],[O.Msg.HTML_WEEK,"week"]]),"LEVEL"),this.appendDummyInput().appendField(O.Msg.HTML_NAME).appendField(new O.FieldTextInput("car"),"NAME"),this.appendDummyInput().appendField(O.Msg.HTML_VALUE).appendField(new O.FieldTextInput("go"),"VALUE"),this.appendValueInput("style").appendField(O.Msg.MIXLY_AIP_ATTR).setAlign(O.inputs.Align.RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},hr={init:function(){this.setColour(rr),this.appendDummyInput().appendField(new O.FieldTextInput("property"),"KEY").appendField(":").appendField(new O.FieldTextInput("value"),"VALUE"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},pr={init:function(){this.setColour(rr),this.appendDummyInput().appendField(new O.FieldTextInput("property"),"KEY").appendField(":").appendField(new O.FieldColour("#ff0000"),"RGB_LED_COLOR"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},fr={init:function(){this.setColour(rr),this.appendDummyInput().appendField(O.Msg.HTML_TEXT).appendField(new O.FieldTextInput("text"),"TEXT"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},mr=160,gr={init:function(){this.setColour(mr),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendDummyInput().appendField("Tabular Abstraction:"),this.appendDummyInput().appendField(new O.FieldTable(""),"TEXT")}},yr={init:function(){this.setColour(mr),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendDummyInput().appendField("Code Block:"),this.appendDummyInput().appendField(new O.FieldMultilineInput(""),"TEXT")}},_r={init:function(){this.setColour(mr),this.appendDummyInput().appendField("Code Expression:"),this.appendDummyInput().appendField(new O.FieldMultilineInput(""),"TEXT"),this.setOutput(!0)}},vr={init:function(){this.setColour(mr),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendValueInput("VALUE").appendField(""),this.setInputsInline(!1)}},br={init:function(){this.setColour(mr),this.appendDummyInput().appendTitle("Comment:").appendTitle(new O.FieldTextInput(""),"TEXT"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("This comment will be ignored by Python")}},Tr={init:function(){this.setColour(mr),this.appendValueInput("VALUE").appendField(O.Msg.TYPE_CHECK),this.setInputsInline(!1),this.setOutput(!0,"Type")}},xr={init:function(){this.setColour(mr),this.itemCount_=1,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new O.icons.MutatorIcon(["text_print_multiple_item"],this)),this.setTooltip(O.Msg.TEXT_PRINT_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=O.Block.obtain(e,"text_print_multiple_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("text_print_multiple_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("PRINT"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("PRINT"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("PRINT"+e);)this.removeInput("PRINT"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField("print");else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("PRINT"+e);0==e&&t.appendField("print")}}},Er={init:function(){this.setColour(mr),this.appendDummyInput().appendField("print"),this.appendStatementInput("STACK"),this.setTooltip(""),this.contextMenu=!1}},wr={init:function(){this.setColour(mr),this.appendDummyInput().appendField("item"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(""),this.contextMenu=!1}},Ir={init:function(){this.setColour(mr),this.itemCount_=1,this.hasReturn_=!1,this.appendDummyInput().appendField(new O.FieldTextInput("str"),"NAME"),this.updateShape_(),this.setMutator(new O.icons.MutatorIcon(["function_call_item"],this)),this.setTooltip("Can be used to call any function")},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e.setAttribute("hasReturn",this.hasReturn_?"TRUE":"FALSE"),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.hasReturn_="TRUE"===e.getAttribute("hasReturn"),this.updateShape_()},decompose:function(e){var t=O.Block.obtain(e,"function_call_container");t.initSvg(),t.setFieldValue(this.hasStatements_?"TRUE":"FALSE","RETURN");for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("function_call_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},setReturn:function(e){this.unplug(!0,!0),this.setOutput(e),this.setPreviousStatement(!e),this.setNextStatement(!e),this.rendered&&this.render()},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.hasReturn_="TRUE"===e.getFieldValue("RETURN"),this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ARGUMENT"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ARGUMENT"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ARGUMENT"+e);)this.removeInput("ARGUMENT"+e),e++;for(e=0;e<this.itemCount_;e++)this.appendValueInput("ARGUMENT"+e);this.setReturn(this.hasReturn_)}},Ar={init:function(){this.setColour(mr),this.appendDummyInput().appendField("Arguments"),this.appendStatementInput("STACK"),this.appendDummyInput().setAlign(O.inputs.Align.RIGHT).appendField("has return").appendField(new O.FieldCheckbox("TRUE"),"RETURN"),this.setTooltip(""),this.contextMenu=!1}},Sr={init:function(){this.setColour(mr),this.appendDummyInput().appendField("argument"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(""),this.contextMenu=!1}},Cr={init:function(){this.appendValueInput("MODULE").setCheck(null),this.appendValueInput("NAME").setCheck(null).appendField("."),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(230),this.setTooltip(""),this.setHelpUrl("")}},Or=function(e,t){return[t.variableDB_.getName(this.getFieldValue("VAR"),O.Variables.NAME_TYPE),t.ORDER_ATOMIC]},Mr=function(e,t){if(""==this.getFieldValue("VAR"))return" = None\n";var n=t.valueToCode(this,"VALUE",t.ORDER_ASSIGNMENT)||"None";return t.variableDB_.getName(this.getFieldValue("VAR"),O.Variables.NAME_TYPE)+" = "+n+"\n"},Rr=function(e,t){var n=this.getFieldValue("OP"),i=t.valueToCode(this,"MYVALUE",t.ORDER_ATOMIC)||"None";if("bytes"==n)var r=n+"("+i+',"UTF-8")';else r=n+"("+i+")";return[r,t.ORDER_ATOMIC]},kr=function(e,t){return"global "+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"None")+"\n"},Nr=function(e,t){return["type("+(t.valueToCode(this,"DATA",t.ORDER_ATOMIC)||"None")+")",t.ORDER_ATOMIC]},Dr=function(e,t){return[this.getFieldValue("type"),t.ORDER_ATOMIC]},Fr=function(e,t){for(var n=new Array(this.itemCount_),i=0;i<this.itemCount_;i++)n[i]=t.valueToCode(this,"ADD"+i,t.ORDER_NONE)||"[]";return[n="zip("+n.join(", ")+")",t.ORDER_ATOMIC]},Lr=function(e,t){const n=t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"[]";return[`${this.getFieldValue("TYPE")}(${n})`,t.ORDER_ATOMIC]};var Pr=n(64548);const Br=function(e,t){var n=t.statementToCode(e,"DO");return"if __name__ == '__main__':\n"+(n=t.addLoopTrap(n,e.id)||t.PASS)},$r=function(e,t){var n=t.statementToCode(this,"DO");return(n=n.replace(/(^\s*)|(\s*$)/g,"").replace(/\n {4}/g,"\n")).endsWith("\n")?t.setups_.setup_setup=n:t.setups_.setup_setup=n+"\n",""},Ur=function(e,t){var n=0,i="";do{i+=(0==n?"if ":"elif ")+(t.valueToCode(e,"IF"+n,t.ORDER_NONE)||"False")+":\n"+(t.statementToCode(e,"DO"+n)||t.PASS),++n}while(e.getInput("IF"+n));return e.getInput("ELSE")&&(i+="else:\n"+(t.statementToCode(e,"ELSE")||t.PASS)),i},zr=function(e,t){var n=1,i=t.valueToCode(this,"IF"+n,t.ORDER_NONE)||"null",r="try:\n"+(t.statementToCode(this,"try")||" pass\n");for(n=1;n<=this.elseifCount_;n++)""!==(i=t.valueToCode(this,"IF"+n,t.ORDER_NONE)||"")&&(i=" "+i),r+="except"+i+": \n"+(t.statementToCode(this,"DO"+n)||" pass\n");return this.elseCount_&&(r+="finally:\n"+(t.statementToCode(this,"ELSE")||" pass\n")),r},Vr=function(e,t){var n=t.variableDB_.getName(e.getFieldValue("VAR"),O.Variables.NAME_TYPE),i=t.valueToCode(e,"FROM",t.ORDER_NONE)||"0",r=t.valueToCode(e,"TO",t.ORDER_NONE)||"0",s=t.valueToCode(e,"STEP",t.ORDER_NONE)||"1",o=t.statementToCode(e,"DO"),a=(o=t.addLoopTrap(o,e.id)||t.PASS,""),l=function(e,t){return t.provideFunction_("upRange",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(start, stop, step):"," while start <= stop:"," yield start"," start += abs(step)"])},u=function(e,t){return t.provideFunction_("downRange",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(start, stop, step):"," while start >= stop:"," yield start"," start -= abs(step)"])};if(e=function(e,t,n){return"("+e+" <= "+t+") and "+l()+"("+e+", "+t+", "+n+") or "+u()+"("+e+", "+t+", "+n+")"},O.isNumber(i)&&O.isNumber(r)&&O.isNumber(s))i=parseFloat(i),r=parseFloat(r),s=Math.abs(parseFloat(s)),0==i%1&&0==r%1&&0==s%1?(i<=r?(r++,e=0==i&&1==s?r:i+", "+r,1!=s&&(e+=", "+s)):e=i+", "+--r+", -"+s,e="range("+e+")"):(e=i<r?l():u(),e+="("+i+", "+r+", "+s+")");else{var c=function(e,i){if(O.isNumber(e))e=parseFloat(e);else{var r=t.variableDB_.getDistinctName(n+i,O.Variables.NAME_TYPE);a+=r+" = "+e+"\n",e=r}return e};i=c(i,"_start"),r=c(r,"_end");c(s,"_inc"),e="number"==typeof i&&"number"==typeof r?i<r?l(0,r):u(0,r):e(i,r,s)}return a+="for "+n+" in "+e+":\n"+o},jr=function(e,t){var n=t.variableDB_.getName(e.getFieldValue("VAR"),O.Variables.NAME_TYPE),i=t.valueToCode(e,"FROM",t.ORDER_NONE)||"0",r=t.valueToCode(e,"TO",t.ORDER_NONE)||"0",s=t.valueToCode(e,"STEP",t.ORDER_NONE)||"1",o=t.statementToCode(e,"DO"),a=t.addLoopTrap(o,e.id)||t.PASS;return t.setups_.mixly_range="def mixly_range(start, stop, step):\n for i in range(start, stop + 1, step):\n yield i\n\n","for "+n+" in mixly_range("+i+", "+r+", "+s+"):\n"+a},Yr=function(e,t){var n="UNTIL"==e.getFieldValue("MODE"),i=t.valueToCode(e,"BOOL",t.ORDER_NONE)||"False",r=t.statementToCode(e,"DO");return n&&(i="not "+i),"while "+i+":\n"+(r=t.addLoopTrap(r,e.id)||t.PASS)},Gr=function(e){switch(e.getFieldValue("FLOW")){case"BREAK":return"break\n";case"CONTINUE":return"continue\n"}throw"Unknown flow statement."},Hr=function(e,t){return"sleep("+(t.valueToCode(this,"DELAY_TIME",t.ORDER_ATOMIC)||"1000")+")\n"},Wr=function(e,t){return"panic("+(t.valueToCode(this,"STATUS_CODE",t.ORDER_ATOMIC)||"1000")+")\n"},Xr=function(e,t){t.definitions_.import_time="import time";return["time.time()",t.ORDER_ATOMIC]},qr=function(e,t){return t.definitions_.import_microbit="from microbit import *","reset()\n"},Kr=function(){return"interrupts();\n"},Zr=function(){return"noInterrupts();\n"},Qr=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"''",i=t.valueToCode(e,"LIST",t.ORDER_RELATIONAL)||"[]",r=t.statementToCode(e,"DO");return"for "+n+" in "+i+":\n"+(r=t.addLoopTrap(r,e.id)||t.PASS)},Jr=function(e,t){return["range("+(t.valueToCode(this,"FROM",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"TO",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"STEP",t.ORDER_NONE)||"1")+")",t.ORDER_ATOMIC]},es=function(e,t){var n="lambda "+(t.valueToCode(e,"BOOL",t.ORDER_NONE)||"None")+": "+(t.statementToCode(e,"DO")||"pass");return[n=n.replace("\n","").replace(" ",""),t.ORDER_ATOMIC]},ts=function(e,t){return t.definitions_.import_time="import time","time.sleep("+(t.valueToCode(this,"DELAY_TIME",t.ORDER_ATOMIC)||"1000")+")\n"},ns=function(){return"pass\n"},is=function(e,t){t.definitions_.import__thread="import _thread";var n=t.valueToCode(this,"VAR",t.ORDER_NONE)||"None";return"_thread.start_new_thread("+t.variableDB_.getName(t.valueToCode(this,"callback",t.ORDER_NONE)||"None",O.Procedures.NAME_TYPE)+", "+n+")\n"},rs=function(e,t){var n=t.valueToCode(this,"select_data",t.ORDER_NONE)||"False",i=t.statementToCode(this,"input_data");return i="true"==this.getFieldValue("type")?i+" if ("+n+"):\n break\n":i+" if not ("+n+"):\n break\n","while True:\n"+(i=t.addLoopTrap(i,this.id)||t.PASS)},ss=function(e,t){var n=t.valueToCode(this,"TIMES",t.ORDER_ATOMIC),i=t.statementToCode(e,"DO");return"for _my_variable in range("+n+"):\n"+(i=t.addLoopTrap(i,e.id)||t.PASS)},os=function(e,t){t.definitions_.import_gc="import gc";return"gc.collect()\n"},as=function(e,t){t.definitions_.import_gc="import gc";return["gc.mem_alloc()",t.ORDER_ATOMIC]},ls=function(e,t){t.definitions_.import_gc="import gc";return["gc.mem_free()",t.ORDER_ATOMIC]},us=function(e,t){t.definitions_.import_machine="import machine";return["machine.unique_id()",t.ORDER_ATOMIC]},cs=ss,ds=function(e,t){return t.definitions_.import_datetime="import datetime",["datetime.datetime.fromtimestamp("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},hs=function(e,t){var n=Pr.Boards.getSelectedBoardKey().split(":")[2];t.definitions_["import_"+n+"uuid"]="from "+n+" import uuid";return["uuid()",t.ORDER_ATOMIC]},ps=function(e,t){var n=this.getFieldValue("NUM");return[n,n<0?t.ORDER_UNARY_PREFIX:t.ORDER_ATOMIC]},fs=function(e,t){return t.definitions_.import_math="import math",["math."+this.getFieldValue("CONSTANT"),t.ORDER_ATOMIC]},ms=function(e,t){return t.definitions_.import_math="import math",["math."+this.getFieldValue("CONSTANT"),t.ORDER_ATOMIC]},gs=function(e,t){var n=this.getFieldValue("OP"),i=t.ORDER_ATOMIC;return["("+(t.valueToCode(this,"A",i)||"0")+n+(t.valueToCode(this,"B",i)||"0")+")",i]},ys=function(e,t){var n=(i={ADD:[" + ",t.ORDER_ADDITIVE],MINUS:[" - ",t.ORDER_ADDITIVE],MULTIPLY:[" * ",t.ORDER_MULTIPLICATIVE],DIVIDE:[" / ",t.ORDER_MULTIPLICATIVE],QUYU:[" % ",t.ORDER_MULTIPLICATIVE],ZHENGCHU:[" // ",t.ORDER_MULTIPLICATIVE],POWER:[" ** ",t.ORDER_EXPONENTIATION]}[e.getFieldValue("OP")])[0],i=i[1];return[(t.valueToCode(e,"A",i)||"0")+n+(e=t.valueToCode(e,"B",i)||"0"),i]},_s=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_RELATIONAL)||"0",i=t.valueToCode(this,"B",t.ORDER_RELATIONAL)||"0";switch(this.getFieldValue("OP")){case"ADD":var r="+=";break;case"MINUS":r="-=";break;case"MULTIPLY":r="*=";break;case"DIVIDE":r="/=";break;case"QUYU":r="%=";break;case"ZHENGCHU":r="//=";break;case"POWER":r="**="}return n+" "+r+" "+i+"\n"},vs=function(e,t){var n,i=e.getFieldValue("OP");if("NEG"==i)return["-"+(n=t.valueToCode(e,"NUM",t.ORDER_UNARY_SIGN)||"0"),t.ORDER_UNARY_SIGN];switch(t.definitions_.import_math="import math",e="SIN"==i||"COS"==i||"TAN"==i?t.valueToCode(e,"NUM",t.ORDER_MULTIPLICATIVE)||"0":t.valueToCode(e,"NUM",t.ORDER_NONE)||"0",i){case"ABS":n="math.fabs("+e+")";break;case"ROOT":n="math.sqrt("+e+")";break;case"LN":n="math.log("+e+")";break;case"LOG10":n="math.log10("+e+")";break;case"EXP":n="math.exp("+e+")";break;case"POW10":n="math.pow(10,"+e+")";break;case"ROUND":n="round("+e+")";break;case"ROUNDUP":n="math.ceil("+e+")";break;case"ROUNDDOWN":n="math.floor("+e+")";break;case"SIN":n="math.sin("+e+")";break;case"COS":n="math.cos("+e+")";break;case"TAN":n="math.tan("+e+")";break;case"++":n="++("+e+")";break;case"--":n="--("+e+")";break;case"-":n="-("+e+")"}if(n)return[n,t.ORDER_EXPONENTIATION];switch(i){case"ASIN":n="math.degrees(math.asin("+e+"))";break;case"ACOS":n="math.degrees(math.acos("+e+"))";break;case"ATAN":n="math.degrees(math.atan("+e+"))"}return[n,t.ORDER_MULTIPLICATIVE]},bs=vs,Ts=function(e,t){var n=t.valueToCode(this,"NUM",t.ORDER_NONE)||"0";return[this.getFieldValue("OP")+"("+n+")",t.ORDER_ATOMIC]},xs=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_NONE)||"0",i=this.getFieldValue("OP"),r="";return"round"===i?r=i+"("+n+")":(r="math."+i+"("+n+")",t.definitions_.import_math="import math"),[r,t.ORDER_ATOMIC]},Es=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_NONE)||"0",i=t.valueToCode(this,"B",t.ORDER_NONE)||"0";return[this.getFieldValue("OP")+"("+n+", "+i+")",t.ORDER_ATOMIC]},ws=function(e,t){t.definitions_.import_random="import random";var n=this.getFieldValue("TYPE"),i=t.valueToCode(this,"FROM",t.ORDER_NONE)||"0",r=t.valueToCode(this,"TO",t.ORDER_NONE)||"0";if("int"==n)var s="random.randint("+i+", "+r+")";else if("float"==n)s="random.uniform("+i+", "+r+")";return[s,t.ORDER_UNARY_POSTFIX]},Is=function(e,t){var n=t.valueToCode(this,"NUM",t.ORDER_NONE),i=t.valueToCode(this,"fromLow",t.ORDER_ATOMIC),r=t.valueToCode(this,"fromHigh",t.ORDER_ATOMIC),s=t.valueToCode(this,"toLow",t.ORDER_ATOMIC),o=t.valueToCode(this,"toHigh",t.ORDER_ATOMIC);return t.definitions_.import_mixpy_math_map="from mixpy import math_map",["math_map("+n+", "+i+", "+r+", "+s+", "+o+")",t.ORDER_NONE]},As=function(e,t){return["min(max("+(t.valueToCode(this,"VALUE",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"LOW",t.ORDER_NONE)||"0")+"), "+(t.valueToCode(this,"HIGH",t.ORDER_NONE)||"0")+")",t.ORDER_UNARY_POSTFIX]},Ss=function(e,t){var n=e.getFieldValue("OP"),i=t.valueToCode(this,"NUM",t.ORDER_NONE)||"0",r=e.getFieldValue("OP2");t.definitions_.import_math="import math";var s="",o="10";if("two"==n?o="2":"eight"==n?o="8":"ten"==n?o="10":"sixteen"==n&&(o="16"),"two"==r?s="bin":"eight"==r?s="oct":"ten"==r?s="":"sixteen"==r&&(s="hex"),""==s)var a="int(str("+i+"), "+o+")";else a=s+"(int(str("+i+"), "+o+"))";return[a,t.ORDER_ATOMIC]},Cs=function(e,t){return t.definitions_.import_random="import random","random.seed("+(t.valueToCode(this,"NUM",t.ORDER_NONE)||"0")+");\n"},Os=function(e,t){var n=this.getFieldValue("NUM");return[n,n<0?t.ORDER_UNARY_PREFIX:t.ORDER_ATOMIC]},Ms=function(e,t){return["round("+(t.valueToCode(this,"VALUE",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"VAR",t.ORDER_NONE)||"0")+")",t.ORDER_ATOMIC]},Rs=function(e,t){var n=this.getFieldValue("TOWHAT"),i=t.valueToCode(this,"VAR",t.ORDER_ATOMIC);return"b"==n?[i+'.encode("utf-8")',t.ORDER_ATOMIC]:"bti"==n?["int.from_bytes("+i+',"big")',t.ORDER_ATOMIC]:[n+"("+i+")",t.ORDER_ATOMIC]},ks=function(e,t){var n=this.getFieldValue("TOWHAT"),i=t.valueToCode(this,"VAR",t.ORDER_ATOMIC);return"b"==n?[i+'.encode("utf-8")',t.ORDER_ATOMIC]:[n+"("+i+")",t.ORDER_ATOMIC]},Ns=Is,Ds=function(e,t){return t.definitions_.import_hexlify="from ubinascii import hexlify",["hexlify("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+").decode()",t.ORDER_ATOMIC]},Fs=function(e,t){t.definitions_.import_itertools="import itertools";let n=t.valueToCode(this,"REPEAT",t.ORDER_ATOMIC),i=new Array(this.itemCount_);for(let e=0;e<this.itemCount_;e++)i[e]=t.valueToCode(this,`ADD${e}`,t.ORDER_NONE)||"0";let r="";return this.itemCount_&&(r=`itertools.product(${i.join(", ")}, repeat=${n})`),[r,t.ORDER_ATOMIC]},Ls=function(e,t){return t.definitions_.import_math="import math",["math.degrees("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Ps=function(e,t){return t.definitions_.import_math="import math",["math.radians("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Bs=function(e,t){return[t.quote_(this.getFieldValue("TEXT")),t.ORDER_ATOMIC]},$s=function(e,t){return['"""'+this.getFieldValue("VALUE")+'"""',t.ORDER_ATOMIC]},Us=function(e,t){return[`b'${this.getFieldValue("TEXT")}'`,t.ORDER_ATOMIC]},zs=function(e,t){return["'"+this.getFieldValue("TEXT")+"'",t.ORDER_ATOMIC]},Vs=function(e,t){return[t.valueToCode(this,"A",t.ORDER_ATOMIC)+" + "+t.valueToCode(this,"B",t.ORDER_ATOMIC),t.ORDER_ADDITIVE]},js=function(e,t){return["chr("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},Ys=function(e,t){return["ord("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"a")+")",t.ORDER_ATOMIC]},Gs=function(e,t){return["str("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},Hs=function(e,t){return["len("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+")",t.ORDER_ATOMIC]},Ws=function(e,t){var n=e.getFieldValue("WHERE")||"FROM_START",i=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""';switch(n){case"FROM_START":return[i+"["+(e=t.getAdjustedInt(e,"AT"))+"]",t.ORDER_ATOMIC];case"FROM_END":return[i+"["+(e=t.getAdjustedInt(e,"AT",1,!0))+"]",t.ORDER_ATOMIC];case"RANDOM":return t.definitions_.import_random="import random",["random.choice("+i+")",t.ORDER_FUNCTION_CALL]}throw"Unhandled combination (lists_getIndex)."},Xs=function(e,t){return[(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+"["+(t.valueToCode(this,"AT",t.ORDER_ATOMIC)||0)+"]",t.ORDER_ATOMIC]},qs=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""';return t.definitions_.import_random="import random",["random.choice("+n+")",t.ORDER_FUNCTION_CALL]},Ks=function(e,t){var n=t.valueToCode(this,"STR1",t.ORDER_ATOMIC)||'""',i=t.valueToCode(this,"STR2",t.ORDER_ATOMIC)||'""',r=this.getFieldValue("DOWHAT");return"==="===r?[n+" == "+i,t.ORDER_ATOMIC]:[n+"."+r+"("+i+")",t.ORDER_ATOMIC]},Zs=function(e,t){return["cmp("+(t.valueToCode(this,"STR1",t.ORDER_ATOMIC)||'""')+","+(t.valueToCode(this,"STR2",t.ORDER_ATOMIC)||'""')+")",t.ORDER_ATOMIC]},Qs=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""',i=e.getFieldValue("WHERE1"),r=e.getFieldValue("WHERE2");switch(i){case"FROM_START":"0"==(s=t.getAdjustedInt(e,"AT1"))&&(s="");break;case"FROM_END":var s=t.getAdjustedInt(e,"AT1",0,!0);break;case"FIRST":s="0";break;default:throw"Unhandled option (lists_getSublist)"}switch(r){case"FROM_START":var o=t.getAdjustedInt(e,"AT2");break;case"FROM_END":o=t.getAdjustedInt(e,"AT2",0,!0);O.isNumber(String(o))?"0"==o&&(o=""):(t.definitions_.import_sys="import sys",o+=" or sys.maxsize");break;case"LAST":o="-1";break;default:throw"Unhandled option (lists_getSublist)"}return[n+"["+s+" : "+o+"]",t.ORDER_ATOMIC]},Js=function(e,t){return[(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+"["+t.valueToCode(this,"AT1",t.ORDER_ATOMIC)+" : "+t.valueToCode(this,"AT2",t.ORDER_ATOMIC)+"]",t.ORDER_ATOMIC]},eo=function(e,t){var n=this.getFieldValue("CAPITAL");return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+"."+n+"()",t.ORDER_ATOMIC]},to=function(e,t){var n=this.getFieldValue("CENTER");return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+"."+n+"("+t.valueToCode(this,"WID",t.ORDER_ATOMIC)+","+t.valueToCode(this,"Symbol",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},no=function(e,t){return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+".find("+t.valueToCode(this,"STR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},io=function(e,t){return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+".join("+(t.valueToCode(this,"LIST",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},ro=function(e,t){return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+".replace("+t.valueToCode(this,"STR1",t.ORDER_ATOMIC)+","+t.valueToCode(this,"STR2",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},so=function(e,t){return[(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+".split("+(t.valueToCode(this,"VAL",t.ORDER_ATOMIC)||'""')+")",t.ORDER_ATOMIC]},oo=function(e,t){var n=this.getFieldValue("TOWHAT");return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+"."+n+"()",t.ORDER_ATOMIC]},ao=function(e,t){for(var n=this.getFieldValue("VAR"),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0";return[i=n+".format("+i.join(", ")+")",t.ORDER_ATOMIC]},lo=function(e,t){for(var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0";return[i=n+".format("+i.join(", ")+")",t.ORDER_ATOMIC]},uo=Js,co=Zs,ho=Xs,po=function(e,t){var n=this.getFieldValue("DIR"),i=this.getFieldValue("CODE");return[(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+"."+n+'("'+i+'")',t.ORDER_ATOMIC]},fo=function(e,t){return["eval("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},mo=function(e,t){return t.definitions_.import_os="import os","os.system("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},go=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+"["+t.valueToCode(this,"AT1",t.ORDER_ADDITIVE)+" : "+t.valueToCode(this,"AT2",t.ORDER_ADDITIVE)+"]",t.ORDER_ATOMIC]},yo=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ATOMIC)||"mylist")+"["+(t.valueToCode(this,"row",t.ORDER_ATOMIC)||0)+","+(t.valueToCode(this,"col",t.ORDER_ATOMIC)||0)+"]",t.ORDER_ATOMIC]},_o=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ATOMIC)||"mylist")+"["+(t.valueToCode(this,"row_start",t.ORDER_ATOMIC)||0)+" : "+(t.valueToCode(this,"row_end",t.ORDER_ATOMIC)||1)+","+(t.valueToCode(this,"col_start",t.ORDER_ATOMIC)||0)+" : "+(t.valueToCode(this,"col_end",t.ORDER_ATOMIC)||1)+"]",t.ORDER_ATOMIC]},vo=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("VAR"),O.Variables.NAME_TYPE),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0";return i=n+" = ["+i.join(", ")+"]\n"},bo=function(e,t){return t.variableDB_.getName(this.getFieldValue("VAR"),O.Variables.NAME_TYPE)+" = ["+this.getFieldValue("TEXT")+"]\n"},To=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+"["+(t.valueToCode(this,"AT",t.ORDER_ADDITIVE)||0)+"]",t.ORDER_ATOMIC]},xo=function(e,t){return(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+"["+(t.valueToCode(this,"AT",t.ORDER_ADDITIVE)||"0")+"] = "+(t.valueToCode(this,"TO",t.ORDER_ASSIGNMENT)||"0")+"\n"},Eo=function(e,t){var n=t.valueToCode(this,"LIST",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"DATA",t.ORDER_ASSIGNMENT)||"0";return n+"."+this.getFieldValue("OP")+"("+i+")\n"},wo=function(e,t){return t.definitions_.import_random="import random",["random.choice("+(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+")",t.ORDER_ATOMIC]},Io=function(e,t){return t.definitions_.import_random="import random",["random.sample("+(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+","+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},Ao=function(e,t){return(t.valueToCode(this,"LIST",t.ORDER_ASSIGNMENT)||"0")+".insert("+(t.valueToCode(this,"AT",t.ORDER_ADDITIVE)||"0")+", "+(t.valueToCode(this,"VALUE",t.ORDER_ASSIGNMENT)||"0")+")\n"},So=function(e,t){return(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+".reverse()\n"},Co=function(e,t){return(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+".clear()\n"},Oo=function(e,t){var n=this.getFieldValue("OP"),i=t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0";if("INDEX"==n)var s=i+".index("+r+")";else if("COUNT"==n)s=i+".count("+r+")";return[s,t.ORDER_ATOMIC]},Mo=function(e,t){var n=t.valueToCode(this,"LIST",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"DATA",t.ORDER_ASSIGNMENT)||"0";return"del"==this.getFieldValue("OP")?"del "+n+"["+i+"]\n":n+".remove("+i+")\n"},Ro=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+".pop("+(t.valueToCode(this,"VALUE",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},ko=function(e,t){var n,i=e.getFieldValue("OP");switch(t.definitions_.import_math="import math",e=t.valueToCode(e,"data",t.ORDER_NONE),i){case"LEN":n="len("+e+")";break;case"SUM":n="sum("+e+")";break;case"MIN":n="min("+e+")";break;case"MAX":n="max("+e+")";break;case"AVERAGE":t.definitions_.import_mixpy_math_mean="from mixpy import math_mean",n="math_mean("+e+")";break;case"MEDIAN":t.definitions_.import_mixpy_math_median="from mixpy import math_median",n="math_median("+e+")";break;case"MODE":t.definitions_.import_mixpy_math_modes="from mixpy import math_modes",n="math_modes("+e+")";break;case"STD_DEV":t.definitions_.import_mixpy_math_standard_deviation="from mixpy import math_standard_deviation",n="math_standard_deviation("+e+")";break;default:throw"Unknown operator: "+i}if(n)return[n,t.ORDER_ATOMIC]},No=function(e,t){return t.definitions_.import_mixpy_lists_sort="from mixpy import lists_sort",["lists_sort("+(t.valueToCode(e,"LIST",t.ORDER_NONE)||"[]")+', "'+e.getFieldValue("TYPE")+'", '+("1"===e.getFieldValue("DIRECTION")?"False":"True")+")",t.ORDER_ATOMIC]},Do=function(e,t){var n=this.getFieldValue("OP"),i=t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0",r="";return"array"==n?(t.definitions_.import_numpy="import numpy",r="numpy.array("+i+")"):r=n+"("+i+")",[r,t.ORDER_ATOMIC]},Fo=function(e,t){return["["+this.getFieldValue("CONTENT")+"]",t.ORDER_ATOMIC]},Lo=function(e,t){for(var n=new Array(this.itemCount_),i=0;i<this.itemCount_;i++)n[i]=t.valueToCode(this,"ADD"+i,t.ORDER_NONE)||"0";return[n="["+n.join(", ")+"]",t.ORDER_ATOMIC]},Po=Do,Bo=function(e,t){return"del "+(t.valueToCode(this,"TUP",t.ORDER_ASSIGNMENT)||"0")+"\n"},$o=vo,Uo=bo,zo=To,Vo=go,jo=xo,Yo=Ao,Go=Mo,Ho=function(e,t){return["list("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},Wo=function(e,t){return[(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+".tolist()",t.ORDER_ATOMIC]},Xo=function(e,t){return["enumerate("+(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+",start="+(t.valueToCode(this,"VALUE",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},qo=function(e,t){var n=t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist";return[(t.valueToCode(this,"CON",t.ORDER_ASSIGNMENT)||"0")+" in "+n,t.ORDER_ATOMIC]},Ko=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("VAR"),O.Variables.NAME_TYPE),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++){var s=this.getFieldValue("KEY"+r);i[r]=s+":"+(t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0")}return i=n+"= {"+i.join(", ")+"}\n"},Zo=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".keys()",t.ORDER_ATOMIC]},Qo=function(e,t){var n=Pr.Boards.getSelectedBoardKey().split(":")[2],i=t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT);if("educore"==n)var s=i+".get("+r+")";else s=i+"["+r+"]";return[s,t.ORDER_ATOMIC]},Jo=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".get("+t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT)+","+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},ea=function(e,t){return(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"mydict")+"["+t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT)+"] = "+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+"\n"},ta=function(e,t){return"del "+(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"mydict")+"["+t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT)+"]\n"},na=function(e,t){var n=t.valueToCode(this,"DICT2",t.ORDER_ASSIGNMENT)||"0";return(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".update("+n+")\n"},ia=function(e,t){return(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".clear()\n"},ra=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".items()",t.ORDER_ATOMIC]},sa=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".values()",t.ORDER_ATOMIC]},oa=function(e,t){return["len("+(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},aa=function(e,t){return"del "+(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+"\n"},la=function(e,t){var n=t.valueToCode(e,"DICT",t.ORDER_MEMBER)||"[]",i=e.getFieldValue("WHERE"),r=t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT);switch(i){case"INSERT":var s=n+"["+r+"] = "+(t.valueToCode(this,"AT2",t.ORDER_ASSIGNMENT)||"0")+"\n";break;case"DELETE":s="del "+n+"["+r+"]\n";break;default:throw"Unhandled option (lists_setIndex2)"}return s},ua=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".pop("+t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT)+")",t.ORDER_ATOMIC]},ca=function(e,t){return(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"mydict")+".setdefault("+t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT)+","+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+")\n"},da=function(e,t){for(var n=new Array(this.itemCount_),i=0;i<this.itemCount_;i++){var r=this.getFieldValue("KEY"+i);n[i]=r+": "+(t.valueToCode(this,"ADD"+i,t.ORDER_NONE)||"0")}return[n="{"+n.join(", ")+"}",t.ORDER_ATOMIC]},ha=function(e,t){return["dict("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},pa=function(e,t){return t.definitions_.import_json="import json",["json.dumps("+(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},fa=function(e,t){return t.definitions_.import_json="import json",["json.loads("+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"null")+")",t.ORDER_ATOMIC]},ma=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+"["+(t.valueToCode(this,"VAR1",t.ORDER_ASSIGNMENT)||"null")+"]["+(t.valueToCode(this,"VAR2",t.ORDER_ASSIGNMENT)||"null")+"]["+(t.valueToCode(this,"VAR3",t.ORDER_ASSIGNMENT)||"null")+"]["+(t.valueToCode(this,"VAR4",t.ORDER_ASSIGNMENT)||"null")+"]",t.ORDER_ATOMIC]},ga=function(e,t){return t.definitions_.import_json="import json",t.definitions_.import_ujson="import ujson",["ujson.loads("+(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},ya=function(e,t){var n=this.getFieldValue("OP"),i=ya.OPERATORS[n],r="=="==i||"!="==i?t.ORDER_EQUALITY:t.ORDER_RELATIONAL;return[(t.valueToCode(this,"A",r)||"0")+" "+i+" "+(t.valueToCode(this,"B",r)||"0"),r]},_a=function(e,t){var n=this.getFieldValue("OP1"),i=ya.OPERATORS[n],r=this.getFieldValue("OP2"),s=ya.OPERATORS[r];return[(t.valueToCode(this,"A",t.ORDER_RELATIONAL)||"0")+" "+i+" "+(t.valueToCode(this,"B",t.ORDER_RELATIONAL)||"0")+" "+s+" "+(t.valueToCode(this,"C",t.ORDER_RELATIONAL)||"0"),t.ORDER_RELATIONAL]};ya.OPERATORS={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="};const va=function(e,t){var n=this.getFieldValue("OP"),i="&&"==n?t.ORDER_LOGICAL_AND:t.ORDER_LOGICAL_OR,r=t.valueToCode(this,"A",i)||"False",s=t.valueToCode(this,"B",i)||"False";if("AND"==n)var o=r+" and "+s;else if("OR"==n)o=r+" or "+s;else if("NOR"==n)o="not("+r+"^"+s+")";else o=r+"^"+s;return[o,i]},ba=function(e,t){var n=t.ORDER_UNARY_PREFIX;return["not "+(t.valueToCode(this,"BOOL",n)||"False"),n]},Ta=function(e,t){return["TRUE"==this.getFieldValue("BOOL")?"True":"False",t.ORDER_ATOMIC]},xa=function(e,t){return["None",t.ORDER_ATOMIC]},Ea=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"False";return["("+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"False")+" if "+n+" else "+(t.valueToCode(this,"C",t.ORDER_ATOMIC)||"False")+")",t.ORDER_ATOMIC]},wa=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''";return[n+" "+this.getFieldValue("BOOL")+" "+i,t.ORDER_ATOMIC]},Ia=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''";return[n+" "+this.getFieldValue("BOOL")+" "+i,t.ORDER_ATOMIC]},Aa=function(e,t){return["bool("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},Sa=function(e,t){return t.definitions_.import_os="import os","os.startfile("+t.valueToCode(this,"fn",t.ORDER_ATOMIC)+")\n"},Ca=function(e,t){return t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+" = open("+t.valueToCode(this,"FILENAME",t.ORDER_ATOMIC)+", '"+this.getFieldValue("MODE")+"')\n"},Oa=function(e,t){return["open("+t.valueToCode(this,"FILENAME",t.ORDER_ATOMIC)+", '"+this.getFieldValue("MODE")+"')",t.ORDER_ATOMIC]},Ma=function(e,t){return["open("+t.valueToCode(this,"FILENAME",t.ORDER_ATOMIC)+", '"+this.getFieldValue("MODE")+"', encoding=\""+this.getFieldValue("CODE")+'")',t.ORDER_ATOMIC]},Ra=function(e,t){var n=t.valueToCode(this,"data",t.ORDER_ATOMIC);return t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".write("+n+")\n"},ka=function(e,t){var n=this.getFieldValue("MODE");return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+"."+n+"()",t.ORDER_ATOMIC]},Na=function(e,t){var n=this.getFieldValue("MODE");return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+"."+n+"("+t.valueToCode(this,"SIZE",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Da=function(e,t){return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".readline("+t.valueToCode(this,"SIZE",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Fa=function(e,t){return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".writable()",t.ORDER_ATOMIC]},La=function(e,t){return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".name()",t.ORDER_ATOMIC]},Pa=function(e,t){return t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".close()\n"},Ba=function(e,t){t.definitions_.import_os="import os";return["os.listdir()",t.ORDER_ATOMIC]},$a=function(e,t){return t.definitions_.import_os="import os","os."+this.getFieldValue("MODE")+"("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")\n"},Ua=function(e,t){return t.definitions_.import_os="import os",["os.path.getsize("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},za=function(e,t){return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".tell()",t.ORDER_ATOMIC]},Va=function(e,t){var n=this.getFieldValue("MODE"),i=0;return i="start"==n?0:"current"==n?1:2,t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".seek("+t.valueToCode(this,"SIZE",t.ORDER_ATOMIC)+","+i+")\n"},ja=function(e,t){return t.definitions_.import_os="import os","os.chdir("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")\n"},Ya=function(e,t){t.definitions_.import_os="import os";return["os.getcwd()",t.ORDER_ATOMIC]},Ga=function(e,t){return t.definitions_.import_os="import os","os."+this.getFieldValue("MODE")+"("+t.valueToCode(this,"PATH",t.ORDER_ATOMIC)+")\n"},Ha=function(e,t){return t.definitions_.import_os="import os","os.rename("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+","+t.valueToCode(this,"NEWFILE",t.ORDER_ATOMIC)+")\n"},Wa=function(e,t){t.definitions_.import_os="import os";var n=t.valueToCode(this,"FILE",t.ORDER_ATOMIC);return["os."+this.getFieldValue("MODE")+"("+n+")",t.ORDER_ATOMIC]},Xa=function(e,t){return t.definitions_.import_os="import os",t.definitions_.import_sdcard="import sdcard",t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+" = sdcard.SDCard("+t.valueToCode(this,"SPISUB",t.ORDER_ATOMIC)+","+t.valueToCode(this,"PINSUB",t.ORDER_ATOMIC)+")\n"},qa=function(e,t){return t.definitions_.import_os="import os",t.definitions_.import_sdcard="import sdcard","os.mount("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+","+t.valueToCode(this,"DIR",t.ORDER_ATOMIC)+")\n"},Ka=function(e,t){var n=t.variableDB_.getName(this.getFieldValue("NAME"),O.Procedures.NAME_TYPE),i=(this.getInput("STACK")&&t.statementToCode(this,"STACK"))??" pass\n";t.INFINITE_LOOP_TRAP&&(i=t.INFINITE_LOOP_TRAP.replace(/%1/g,"'"+this.id+"'")+i);var r=t.valueToCode(this,"RETURN",t.ORDER_NONE)||"";r&&(r=" return "+r+"\n");for(var s=[],o=0;o<this.arguments_.length;o++){var a=t.variableDB_.getName(this.arguments_[o],O.Variables.NAME_TYPE);s[o]=a}var l="def "+n+"("+s.join(", ")+"):\n"+i+r+"\n";return l=t.scrub_(this,l),t.setups_[n]=l,null},Za=function(e,t){var n=t.variableDB_.getName(this.getFieldValue("NAME"),O.Procedures.NAME_TYPE),i=(this.getInput("STACK")&&t.statementToCode(this,"STACK"))??" pass\n";t.INFINITE_LOOP_TRAP&&(i=t.INFINITE_LOOP_TRAP.replace(/%1/g,"'"+this.id+"'")+i);for(var r=[],s=0;s<this.arguments_.length;s++){var o=t.variableDB_.getName(this.arguments_[s],O.Variables.NAME_TYPE);r[s]=o}var a="def "+n+"("+r.join(", ")+"):\n"+i+"\n";return a=t.scrub_(this,a),t.setups_[n]=a,null},Qa=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("NAME"),O.Procedures.NAME_TYPE),i=[],r=0;r<this.arguments_.length;r++)i[r]=t.valueToCode(this,"ARG"+r,t.ORDER_NONE)||"null";return[n+"("+i.join(", ")+")",t.ORDER_UNARY_POSTFIX]},Ja=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("NAME"),O.Procedures.NAME_TYPE),i=[],r=0;r<this.arguments_.length;r++)i[r]=t.valueToCode(this,"ARG"+r,t.ORDER_NONE)||"null";return n+"("+i.join(", ")+")\n"},el=function(e,t){var n="if ("+(t.valueToCode(this,"CONDITION",t.ORDER_NONE)||"False")+") :\n";this.hasReturnValue_?n+=" return "+(t.valueToCode(this,"VALUE",t.ORDER_NONE)||"None"):n+=" return None";return n+="\n"},tl=function(e,t){var n="";this.hasReturnValue_?n+="return "+(t.valueToCode(this,"VALUE",t.ORDER_NONE)||"None"):n+="return None";return n+="\n"},nl=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("VAR"),O.Variables.NAME_TYPE),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0";if(1!=this.itemCount_)i=n+"= ("+i.join(", ")+")\n";else i=n+"= ("+i.join(", ")+",)\n";return i},il=function(e,t){return t.variableDB_.getName(this.getFieldValue("VAR"),O.Variables.NAME_TYPE)+"= ("+this.getFieldValue("TEXT")+")\n"},rl=function(e,t){return["("+this.getFieldValue("TEXT")+")",t.ORDER_ATOMIC]},sl=function(e,t){var n=t.valueToCode(this,"TUP",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"AT",t.ORDER_ADDITIVE)||"1";return i.match(/^\d+$/)&&(i=parseInt(i,10)),[n+"["+i+"]",t.ORDER_ATOMIC]},ol=function(e,t){return["len("+(t.valueToCode(this,"TUP",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},al=function(e,t){return"del "+(t.valueToCode(this,"TUP",t.ORDER_ASSIGNMENT)||"0")+"\n"},ll=function(e,t){return[(t.valueToCode(this,"TUP1",t.ORDER_ASSIGNMENT)||"0")+" + "+(t.valueToCode(this,"TUP2",t.ORDER_ASSIGNMENT)||"0"),t.ORDER_ATOMIC]},ul=function(e,t){var n=t.valueToCode(this,"TUP",t.ORDER_ASSIGNMENT)||"0";return[this.getFieldValue("DIR")+"("+n+")",t.ORDER_ATOMIC]},cl=function(e,t){return[this.getFieldValue("OP")+"("+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+")\n",t.ORDER_ATOMIC]},dl=function(e,t){var n=this.getFieldValue("OP"),i=t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0";if("INDEX"==n)var s=i+".index("+r+")";else if("COUNT"==n)s=i+".count("+r+")";return[s,t.ORDER_ATOMIC]},hl=function(e,t){var n,i=e.getFieldValue("OP");switch(t.definitions_.import_math="import math",e=t.valueToCode(e,"data",t.ORDER_NONE),i){case"LEN":n="len("+e+")";break;case"SUM":n="sum("+e+")";break;case"MIN":n="min("+e+")";break;case"MAX":n="max("+e+")";break;case"AVERAGE":n=t.provideFunction_("math_mean",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(myList):"," localList = [e for e in myList if type(e) == int or type(e) == float]"," if not localList: return"," return float(sum(localList)) / len(localList)"])+"("+e+")";break;case"MEDIAN":n=t.provideFunction_("math_median",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(myList):"," localList = sorted([e for e in myList if type(e) == int or type(e) == float])"," if not localList: return"," if len(localList) % 2 == 0:"," return (localList[len(localList) // 2 - 1] + localList[len(localList) // 2]) / 2.0"," else:"," return localList[(len(localList) - 1) // 2]"])+"("+e+")";break;case"MODE":n=t.provideFunction_("math_modes",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(some_list):"," modes = []"," # Using a lists of [item, count] to keep count rather than dict",' # to avoid "unhashable" errors when the counted item is itself a list or dict.'," counts = []"," maxCount = 1"," for item in some_list:"," found = False"," for count in counts:"," if count[0] == item:"," count[1] += 1"," maxCount = max(maxCount, count[1])"," found = True"," if not found:"," counts.append([item, 1])"," for counted_item, item_count in counts:"," if item_count == maxCount:"," modes.append(counted_item)"," return modes"])+"("+e+")";break;case"STD_DEV":t.definitions_.import_math="import math",n=t.provideFunction_("math_standard_deviation",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(numbers):"," n = len(numbers)"," if n == 0: return"," mean = float(sum(numbers)) / n"," variance = sum((x - mean) ** 2 for x in numbers) / n"," return math.sqrt(variance)"])+"("+e+")";break;default:throw"Unknown operator: "+i}if(n)return[n,t.ORDER_FUNCTION_CALL]},pl=function(e,t){var n=t.valueToCode(e,"LIST",t.ORDER_MEMBER)||"[]",i=e.getFieldValue("WHERE1"),r=e.getFieldValue("WHERE2");switch(i){case"FROM_START":"0"==(s=t.getAdjustedInt(e,"AT1"))&&(s="");break;case"FROM_END":var s=t.getAdjustedInt(e,"AT1",1,!0);break;case"FIRST":s="0";break;default:throw"Unhandled option (lists_getSublist)"}switch(r){case"FROM_START":var o=t.getAdjustedInt(e,"AT2",1);o-=1;break;case"FROM_END":o=t.getAdjustedInt(e,"AT2",1,!0);O.isNumber(String(o))?"0"==o&&(o=""):(t.definitions_.import_sys="import sys",o+=" or sys.maxsize");break;case"LAST":o="-1";break;default:throw"Unhandled option (lists_getSublist)"}return[n+"["+s+" : "+o+"]",t.ORDER_MEMBER]},fl=function(e,t){for(var n=new Array(this.itemCount_),i=0;i<this.itemCount_;i++)n[i]=t.valueToCode(this,"ADD"+i,t.ORDER_NONE)||"0";if(1!=this.itemCount_)n="("+n.join(", ")+")";else n="("+n.join(", ")+",)";return[n,t.ORDER_ATOMIC]},ml=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"0")+"["+(t.valueToCode(this,"AT1",t.ORDER_ADDITIVE)||"0")+" : "+(t.valueToCode(this,"AT2",t.ORDER_ADDITIVE)||"0")+"]",t.ORDER_ATOMIC]},gl=function(e,t){return t.definitions_.import_random="import random",["random.choice("+(t.valueToCode(this,"TUP",t.ORDER_ADDITIVE)||"mytup")+")",t.ORDER_ATOMIC]},yl=function(e,t){return["tuple("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},_l=function(e,t){return["("+this.getFieldValue("CONTENT")+")",t.ORDER_ATOMIC]},vl=function(e,t){var n=t.valueToCode(this,"params",t.ORDER_ATOMIC)||"0",i=t.valueToCode(this,"des",t.ORDER_ATOMIC)||"0";return["("+n+',"'+this.getFieldValue("type")+'",'+i+")",t.ORDER_ATOMIC]},bl=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("VAR"),O.Variables.NAME_TYPE),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0";return i=n+"= {"+i.join(", ")+"}\n",0==this.itemCount_&&(i=n+" = set()\n"),i},Tl=function(e,t){return["len("+(t.valueToCode(this,"SET",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},xl=function(e,t){return[(t.valueToCode(this,"SET",t.ORDER_ASSIGNMENT)||"0")+".pop()",t.ORDER_ATOMIC]},El=function(e,t){return(t.valueToCode(this,"SET",t.ORDER_ASSIGNMENT)||"0")+".clear()\n"},wl=function(e,t){var n=t.valueToCode(this,"SET1",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"SET2",t.ORDER_ASSIGNMENT)||"0";return[n+"."+this.getFieldValue("OPERATE")+"("+i+")",t.ORDER_ATOMIC]},Il=function(e,t){var n=t.valueToCode(this,"SET1",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"SET2",t.ORDER_ASSIGNMENT)||"0";return n+"."+this.getFieldValue("OPERATE")+"("+i+")\n"},Al=function(e,t){return(t.valueToCode(this,"SET",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("OPERATE")+"("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+")\n"},Sl=function(e,t){var n=t.valueToCode(this,"SET1",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"SET2",t.ORDER_ASSIGNMENT)||"0";return[n+"."+this.getFieldValue("OPERATE")+"("+i+")",t.ORDER_ATOMIC]},Cl=function(e,t){return(t.valueToCode(this,"SET",t.ORDER_ASSIGNMENT)||"0")+".update("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},Ol=function(e,t){return["{"+this.getFieldValue("TEXT")+"}",t.ORDER_ATOMIC]},Ml=function(e,t){return["set("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},Rl=function(e,t){return["'''<!DOCTYPE HTML>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n"+t.statementToCode(this,"HEAD")+"</head>\n<body>\n"+t.statementToCode(this,"BODY")+"</body>\n</html>\n'''",t.ORDER_ATOMIC]},kl=function(e,t){var n=t.statementToCode(this,"DO"),i=this.getFieldValue("LEVEL");return"<h"+i+">\n"+n+"</h"+i+">\n"},Nl=function(e,t){var n=t.statementToCode(this,"DO"),i=this.getFieldValue("LEVEL");if("head"==i)var r="<"+i+'>\n\t<meta charset="utf-8">\n'+n+"</"+i+">\n";else r="<"+i+">\n"+n+"</"+i+">\n";return r},Dl=function(e,t){var n=t.statementToCode(this,"DO"),i=this.getFieldValue("LEVEL");return"<"+i+">\n"+n+"</"+i+">\n"},Fl=function(e,t){var n=t.statementToCode(this,"DO"),i=t.valueToCode(this,"style"),r=this.getFieldValue("LEVEL");return"<"+r+" "+i+" >\n"+n+"</"+r+">\n"},Ll=function(e,t){return['style="'+t.statementToCode(this,"STYLE")+'"',t.ORDER_ATOMIC]},Pl=function(e,t){return'<input type="'+this.getFieldValue("LEVEL")+'" name="'+this.getFieldValue("NAME")+'" value="'+this.getFieldValue("VALUE")+'" '+(t.valueToCode(this,"style")||"")+" />"},Bl=function(){return this.getFieldValue("KEY")+":"+this.getFieldValue("VALUE")+";"},$l=function(){return this.getFieldValue("TEXT")+"\n"},Ul=function(e){return e.getFieldValue("TEXT")+"\n"},zl=function(e,t){return[e.getFieldValue("TEXT"),t.ORDER_ATOMIC]},Vl=function(e,t){return(t.valueToCode(e,"VALUE",t.ORDER_ATOMIC)||"")+"\n"},jl=function(){return""},Yl=function(e,t){return["type("+(t.valueToCode(e,"VALUE",t.ORDER_MEMBER)||"___")+")",t.ORDER_ATOMIC]},Gl=function(e,t){for(var n=e.getFieldValue("NAME"),i=e.hasReturn_,r=new Array(e.itemCount_),s=0;s<e.itemCount_;s++)r[s]=t.valueToCode(e,"ARGUMENT"+s,t.ORDER_NONE)||"___";var o=n+"("+r.join(", ")+")";return i?[o,t.ORDER_ATOMIC]:o+"\n"},Hl=function(e,t){var n=t.valueToCode(e,"MODULE",t.ORDER_ATOMIC),i=t.valueToCode(e,"NAME",t.ORDER_ATOMIC);return[n+"."+(i=i.substring(1,i.length-1)),t.ORDER_NONE]},Wl={};Wl.NAME_TYPE=O.PROCEDURE_CATEGORY_NAME,Wl.allProcedures=function(e){for(var t=e.getAllBlocks(!1),n=[],i=[],r=0;r<t.length;r++)if(t[r].getProcedureDef){var s=t[r].getProcedureDef();s&&(s[2]?n.push(s):i.push(s))}return i.sort(Wl.procTupleComparator_),n.sort(Wl.procTupleComparator_),[i,n]},Wl.procTupleComparator_=function(e,t){return e[0].toLowerCase().localeCompare(t[0].toLowerCase())},Wl.findLegalName=function(e,t){if(t.isInFlyout)return e;for(e=e||O.Msg.UNNAMED_KEY||"unnamed";!Wl.isLegalName_(e,t.workspace,t);){var n=e.match(/^(.*?)(\d+)$/);n?e=n[1]+(parseInt(n[2],10)+1):e+="2"}return e},Wl.isLegalName_=function(e,t,n){return!Wl.isNameUsed(e,t,n)},Wl.isNameUsed=function(e,t,n){for(var i=t.getAllBlocks(!1),r=0;r<i.length;r++)if(i[r]!=n&&i[r].getProcedureDef){var s=i[r].getProcedureDef();if(O.Names.equals(s[0],e))return!0}return!1},Wl.rename=function(e){e=e.trim();var t=Wl.findLegalName(e,this.getSourceBlock()),n=this.getValue();if(n!=e&&n!=t)for(var i=this.getSourceBlock().workspace.getAllBlocks(!1),r=0;r<i.length;r++)i[r].renameProcedure&&i[r].renameProcedure(n,t);return t},Wl.flyoutCategory=function(e){var t,n,i=[];O.Blocks.procedures_defnoreturn&&((n=O.utils.xml.createElement("block")).setAttribute("type","procedures_defnoreturn"),n.setAttribute("gap",16),(t=O.utils.xml.createElement("field")).setAttribute("name","NAME"),t.appendChild(O.utils.xml.createTextNode(O.Msg.PROCEDURES_DEFNORETURN_PROCEDURE)),n.appendChild(t),i.push(n));O.Blocks.procedures_defreturn&&((n=O.utils.xml.createElement("block")).setAttribute("type","procedures_defreturn"),n.setAttribute("gap",16),(t=O.utils.xml.createElement("field")).setAttribute("name","NAME"),t.appendChild(O.utils.xml.createTextNode(O.Msg.PROCEDURES_DEFRETURN_PROCEDURE)),n.appendChild(t),i.push(n));O.Blocks.procedures_return&&((n=O.utils.xml.createElement("block")).setAttribute("type","procedures_return"),n.setAttribute("gap",16),i.push(n));O.Blocks.procedures_ifreturn&&((n=O.utils.xml.createElement("block")).setAttribute("type","procedures_ifreturn"),n.setAttribute("gap",16),i.push(n));function r(e,t){for(var n=0;n<e.length;n++){var r=e[n][0],s=e[n][1],o=O.utils.xml.createElement("block");o.setAttribute("type",t),o.setAttribute("gap",16);var a=O.utils.xml.createElement("mutation");a.setAttribute("name",r),o.appendChild(a);for(var l=0;l<s.length;l++){var u=O.utils.xml.createElement("arg");u.setAttribute("name",s[l]),a.appendChild(u)}i.push(o)}}i.length&&i[i.length-1].setAttribute("gap",24);var s=Wl.allProcedures(e);return r(s[0],"procedures_callnoreturn"),r(s[1],"procedures_callreturn"),i},Wl.getCallers=function(e,t){for(var n=[],i=t.getAllBlocks(!1),r=0;r<i.length;r++)if(i[r].getProcedureCall){var s=i[r].getProcedureCall();s&&O.Names.equals(s,e)&&n.push(i[r])}return n},Wl.mutateCallers=function(e){const t=O.Events.getRecordUndo(),n=e.getProcedureDef()[0],i=e.mutationToDom(!0),r=O.Procedures.getCallers(n,e.workspace);for(let e,n=0;e=r[n];n++){const n=e.mutationToDom(),r=n&&O.utils.xml.domToText(n);e.domToMutation&&e.domToMutation(i);const s=e.mutationToDom(),o=s&&O.utils.xml.domToText(s);r!==o&&(O.Events.setRecordUndo(!1),O.Events.fire(new(O.Events.get(O.Events.BLOCK_CHANGE))(e,"mutation",null,r,o)),O.Events.setRecordUndo(t))}},Wl.getDefinition=function(e,t){for(var n=t.getTopBlocks(!1),i=0;i<n.length;i++)if(n[i].getProcedureDef){var r=n[i].getProcedureDef();if(r&&O.Names.equals(r[0],e))return n[i]}return null};const Xl=Wl,ql=new O.Generator("Python");ql.INDENT=" ",ql.addReservedWords("False,None,True,and,as,assert,break,class,continue,def,del,elif,else,except,exec,finally,for,from,global,if,import,in,is,lambda,nonlocal,not,or,pass,print,raise,return,try,while,with,yield,NotImplemented,Ellipsis,__debug__,quit,exit,copyright,license,credits,ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EnvironmentError,Exception,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StandardError,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,ZeroDivisionError,_,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,all,any,apply,ascii,basestring,bin,bool,buffer,bytearray,bytes,callable,chr,classmethod,cmp,coerce,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,execfile,exit,file,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,intern,isinstance,issubclass,iter,len,license,list,locals,long,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,raw_input,reduce,reload,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,unichr,unicode,vars,xrange,zip"),ql.ORDER_ATOMIC=0,ql.ORDER_COLLECTION=1,ql.ORDER_STRING_CONVERSION=1,ql.ORDER_UNARY_POSTFIX=1,ql.ORDER_UNARY_PREFIX=2,ql.ORDER_MEMBER=2.1,ql.ORDER_FUNCTION_CALL=2.2,ql.ORDER_EXPONENTIATION=3,ql.ORDER_UNARY_SIGN=4,ql.ORDER_BITWISE_NOT=4,ql.ORDER_MULTIPLICATIVE=5,ql.ORDER_ADDITIVE=6,ql.ORDER_BITWISE_SHIFT=7,ql.ORDER_BITWISE_AND=8,ql.ORDER_BITWISE_XOR=9,ql.ORDER_BITWISE_OR=10,ql.ORDER_RELATIONAL=11,ql.ORDER_EQUALITY=11,ql.ORDER_LOGICAL_NOT=12,ql.ORDER_LOGICAL_AND=13,ql.ORDER_LOGICAL_OR=14,ql.ORDER_ASSIGNMENT=14,ql.ORDER_CONDITIONAL=15,ql.ORDER_LAMBDA=16,ql.ORDER_NONE=99,ql.ORDER_OVERRIDES=[[ql.ORDER_FUNCTION_CALL,ql.ORDER_MEMBER],[ql.ORDER_FUNCTION_CALL,ql.ORDER_FUNCTION_CALL],[ql.ORDER_MEMBER,ql.ORDER_MEMBER],[ql.ORDER_MEMBER,ql.ORDER_FUNCTION_CALL]],ql.init=function(){ql.PASS=this.INDENT+"pass\n",ql.definitions_=Object.create(null),ql.functionNames_=Object.create(null),ql.setups_=Object.create(null),ql.loops_=Object.create(null),ql.codeEnd_=Object.create(null),ql.variableDB_?ql.variableDB_.reset():ql.variableDB_=new N(ql.RESERVED_WORDS_)},ql.finish=function(e){""!==e&&(e=(e=e.replace(/\n/g,"\n")).replace(/\n\s+$/,"\n"));var t=[],n=[],i=[];for(var r in this.definitions_){var s=this.definitions_[r];0===r.indexOf("import")?t.push(s):0===r.indexOf("var_declare")?n.push(s):i.push(s)}t.length&&t.push("\n\n"),n.length&&n.push("\n\n"),i.length&&i.push("\n\n");var o=[];for(var r in ql.functions_)o.push(ql.functions_[r]);o.length&&o.push("\n\n");var a=[];for(var r in ql.setups_)a.push(ql.setups_[r]);a.length&&a.push("\n\n");var l=[];for(var r in ql.loops_)l.push(ql.loops_[r]);var u=[];for(var r in ql.codeEnd_)u.push(ql.codeEnd_[r]);return 0!==u.length&&u.push("\n"),l.length>0?t.join("\n")+n.join("\n")+i.join("\n")+o.join("\n")+a.join("")+e+"while True:\n"+l.join("")+u.join("\n"):t.join("\n")+n.join("\n")+i.join("\n")+o.join("\n")+a.join("")+e+u.join("\n")},ql.scrubNakedValue=function(e){return e+"\n"},ql.quote_=function(e){var t="'";return-1!==e.indexOf("'")&&(-1===e.indexOf('"')?t='"':e=e.replace(/'/g,"\\'")),t+e+t},ql.multiline_quote_=function(e){return"'''"+(e=e.replace(/'''/g,"\\'\\'\\'"))+"'''"},ql.scrub_=function(e,t,n){var i="";if(!e.outputConnection||!e.outputConnection.targetConnection){(s=e.getCommentText())&&(s=O.utils.string.wrap(s,ql.COMMENT_WRAP-3),i+=ql.prefixLines(s+"\n","# "));for(var r=0;r<e.inputList.length;r++)if(e.inputList[r].type==O.INPUT_VALUE){var s,o=e.inputList[r].connection.targetBlock();if(o)(s=ql.allNestedComments(o))&&(i+=ql.prefixLines(s,"# "))}}var a=e.nextConnection&&e.nextConnection.targetBlock();return i+t+(n?"":ql.blockToCode(a))},ql.getAdjustedInt=function(e,t,n,i){var r=n||0;e.workspace.options.oneBasedIndex&&r--;var s=e.workspace.options.oneBasedIndex?"1":"0",o=r?ql.ORDER_ADDITIVE:ql.ORDER_NONE,a=ql.valueToCode(e,t,o)||s;return O.isNumber(a)?(a=parseInt(a,10)+r,i&&(a=-a)):(a=r>0?"int("+a+" + "+r+")":r<0?"int("+a+" - "+-r+")":"int("+a+")",i&&(a="-"+a)),a}},87202:(e,t,n)=>{"use strict";n.d(t,{Ej:()=>i,mi:()=>_,j2:()=>r,N5:()=>v,r_:()=>o,nm:()=>La,v4:()=>s,$W:()=>b,cU:()=>a,aB:()=>T,Vv:()=>l,ZF:()=>x,OQ:()=>u,yw:()=>E,Sd:()=>c,iR:()=>w,sc:()=>h,c8:()=>A,DE:()=>d,To:()=>I,ws:()=>p,AU:()=>S,Ig:()=>m,oo:()=>O,UQ:()=>f,Qk:()=>C,r4:()=>g,FR:()=>M,Ge:()=>y,SE:()=>R});var i={};n.r(i),n.d(i,{AI_ChooseAndGet:()=>D,AI_Face_match:()=>U,AI_ImageClassify:()=>B,AI_ImageClassify_Func:()=>$,AI_Nlp:()=>j,AI_Nlp_Func:()=>G,AI_Nlp_Func_sim:()=>H,AI_Nlp_Sim:()=>Y,AI_Nlp_Topic:()=>W,AI_Nlp_newsSummary:()=>X,AI_Ocr:()=>z,AI_Ocr_Func:()=>V,AI_Speech_asr:()=>P,AI_Speech_synthesis:()=>L,AI_audio:()=>q,AI_client:()=>F,AI_photo:()=>K,AI_result:()=>Z});var r={};n.r(r),n.d(r,{algorithm_add_path:()=>re,algorithm_add_school:()=>ee,algorithm_all_books:()=>be,algorithm_all_books_sequence:()=>Te,algorithm_book_scale:()=>Ne,algorithm_check_feet:()=>Ye,algorithm_chick_calculate:()=>je,algorithm_color_seclet:()=>lt,algorithm_current_school:()=>ce,algorithm_del_path:()=>se,algorithm_delete_book:()=>Oe,algorithm_delete_books:()=>Me,algorithm_delete_books2:()=>Re,algorithm_divide_books:()=>Se,algorithm_find_path:()=>te,algorithm_first_book:()=>xe,algorithm_fz_calc:()=>Xe,algorithm_fz_calc_first_min:()=>qe,algorithm_fz_compare:()=>Ke,algorithm_fz_move:()=>Qe,algorithm_fz_set_min:()=>Ze,algorithm_get_book_num:()=>Pe,algorithm_get_current_location:()=>ot,algorithm_get_half_books:()=>Ce,algorithm_hxdb_add:()=>it,algorithm_hxdb_init_soldier:()=>et,algorithm_hxdb_last_line:()=>nt,algorithm_hxdb_result:()=>rt,algorithm_hxdb_stand_in_line:()=>tt,algorithm_init_fzsf:()=>We,algorithm_init_hxdb:()=>Je,algorithm_init_jttl:()=>Ue,algorithm_move_recent:()=>fe,algorithm_new_path:()=>ne,algorithm_next_book:()=>Ie,algorithm_no_left:()=>ae,algorithm_no_path:()=>de,algorithm_no_ring2:()=>Ee,algorithm_not_home:()=>me,algorithm_not_school:()=>ge,algorithm_number_add:()=>Fe,algorithm_number_zero:()=>De,algorithm_prepare:()=>J,algorithm_prepare2:()=>ue,algorithm_prepare_2_1:()=>he,algorithm_prepare_2_2:()=>pe,algorithm_print_book2:()=>ke,algorithm_print_divide:()=>$e,algorithm_print_jttl_answer:()=>Ge,algorithm_print_number:()=>Le,algorithm_print_path:()=>le,algorithm_print_path2:()=>ye,algorithm_print_sequence:()=>Be,algorithm_rabbit_add:()=>He,algorithm_rabbit_number_in_range:()=>Ve,algorithm_rabbit_zero:()=>ze,algorithm_return_path:()=>oe,algorithm_set_path:()=>ie,algorithm_two_left:()=>Ae,algorithm_void_path:()=>at,algorithm_yes_ring2:()=>we,hanoi_init:()=>_e,hanoi_init_offline:()=>st,hanoi_move:()=>ve});var s={};n.r(s),n.d(s,{requests_attribute:()=>pt,requests_get:()=>dt,requests_get_old:()=>ct,requests_method:()=>ft,requests_post:()=>ht});var o={};n.r(o),n.d(o,{cv_destroy_all:()=>bt,cv_face_classifier:()=>Et,cv_face_detect:()=>wt,cv_face_detect_all:()=>It,cv_line_rect:()=>Tt,cv_read_image:()=>gt,cv_show_image:()=>yt,cv_text:()=>xt,cv_waitkey:()=>vt,cv_write_image:()=>_t});var a={};n.r(a),n.d(a,{array_create:()=>Vt,array_toarray:()=>nn,dataframe_aggregate_func:()=>Qn,dataframe_create:()=>Ot,dataframe_create_from_index:()=>Rt,dataframe_create_from_one_index:()=>Mt,dataframe_fillna:()=>Bn,dataframe_get:()=>Jt,dataframe_groupby:()=>Zn,dataframe_head_tail:()=>qn,dataframe_info:()=>$n,dataframe_median:()=>Pn,dataframe_select:()=>Kn,dataframe_sort_values:()=>Xn,matrix_multiplication:()=>Fn,matrix_transpose:()=>Dn,numpy_argmin_template_match:()=>An,numpy_astype:()=>En,numpy_c_:()=>kn,numpy_dot:()=>jn,numpy_linalg_det:()=>Nn,numpy_linalg_inv:()=>Ln,numpy_max:()=>zn,numpy_mean:()=>Sn,numpy_mean_digit:()=>In,numpy_min:()=>Un,numpy_ones:()=>Rn,numpy_random_random:()=>Hn,numpy_reshape:()=>xn,numpy_shape:()=>Tn,numpy_size:()=>Vn,numpy_square:()=>Yn,numpy_std:()=>Cn,numpy_sum:()=>Gn,numpy_trig:()=>Kt,pandas_drop_columns:()=>Mn,pandas_dropna:()=>On,pandas_readcsv:()=>Qt,pl_axes:()=>Bt,pl_bar:()=>Ht,pl_hist:()=>Xt,pl_label:()=>zt,pl_legend:()=>$t,pl_pie:()=>Wt,pl_plot:()=>Lt,pl_plot_bar:()=>jt,pl_plot_easy:()=>Ft,pl_plot_scatter:()=>Yt,pl_plot_xy:()=>Gt,pl_savefig:()=>en,pl_show:()=>Pt,pl_subplot:()=>Zt,pl_text:()=>tn,pl_ticks:()=>qt,pl_title:()=>Ut,plot_axes:()=>an,plot_bar:()=>fn,plot_cla:()=>Jn,plot_hist:()=>gn,plot_label:()=>cn,plot_legend:()=>ln,plot_pie:()=>mn,plot_plot:()=>sn,plot_plot_bar:()=>dn,plot_plot_easy:()=>rn,plot_plot_scatter:()=>hn,plot_plot_xy:()=>pn,plot_savefig:()=>vn,plot_show:()=>on,plot_subplot:()=>_n,plot_text:()=>bn,plot_ticks:()=>yn,plot_title:()=>un,py_sum:()=>Wn,pylab_imshow:()=>wn,series_create:()=>St,series_create_from_index:()=>Ct,series_create_from_text:()=>kt,series_get_num:()=>Dt,series_index_value:()=>Nt});var l={};n.r(l),n.d(l,{ds_add_node_by_attr:()=>li,ds_add_node_by_name:()=>ai,ds_create_linkedlist:()=>ti,ds_create_linkedlist_container:()=>ni,ds_create_linkedlist_item:()=>ii,ds_create_node:()=>ri,ds_del_node_by_attr:()=>ci,ds_del_node_by_name:()=>ui,ds_get_node_attr:()=>si,ds_reverse_linkedlist:()=>di,ds_set_node_attr:()=>oi});var u={};n.r(u),n.d(u,{factory_block:()=>xi,factory_block_return:()=>Ei,factory_block_return_with_textarea:()=>Ii,factory_block_with_textarea:()=>wi,factory_callMethod_noreturn:()=>bi,factory_callMethod_return:()=>Ti,factory_create_with_container:()=>gi,factory_create_with_item:()=>yi,factory_declare:()=>vi,factory_from_import:()=>pi,factory_function_noreturn:()=>mi,factory_function_return:()=>_i,factory_import:()=>fi});var c={};n.r(c),n.d(c,{hardware_arduino_analog_read:()=>ki,hardware_arduino_analog_write:()=>Ri,hardware_arduino_digital_read:()=>Mi,hardware_arduino_digital_write:()=>Oi,hardware_arduino_start:()=>Si,inout_highlow:()=>Ci});var d={};n.r(d),n.d(d,{inout_input:()=>Ni,inout_print:()=>Di,inout_print_container:()=>Ui,inout_print_end:()=>Li,inout_print_inline:()=>Fi,inout_print_item:()=>zi,inout_print_many:()=>$i,inout_type_input:()=>Pi,pyinout_type_input:()=>Bi});var h={};n.r(h),n.d(h,{IOT_EMQX_INIT_AND_CONNECT_BY_MIXLY_CODE:()=>hr,IOT_EMQX_INIT_AND_CONNECT_BY_SHARE_CODE:()=>dr,IOT_EMQX_PING:()=>ur,IOT_FORMATTING:()=>ar,IOT_FORMAT_STRING:()=>lr,IOT_MIXIO_NTP:()=>cr,IOT_MIXIO_PUBLISH:()=>Ji,IOT_MIXIO_SUBSCRIBE:()=>er,IOT_MIXIO_UNSUBSCRIBE:()=>tr,iot_checkonenet:()=>xr,iot_client_onboard:()=>mr,iot_create_with_item:()=>Zi,iot_http_client:()=>gr,iot_http_data:()=>yr,iot_mixio_check:()=>rr,iot_mixio_connect:()=>Qi,iot_mixio_connect_only:()=>ir,iot_mixio_disconnect:()=>nr,iot_mixio_format_msg:()=>or,iot_mixio_format_topic:()=>sr,iot_mixly_key:()=>fr,iot_mixly_key_py:()=>pr,iot_mqtt_client:()=>_r,iot_mqtt_data:()=>vr,iot_onenet_check:()=>Hi,iot_onenet_connect:()=>Yi,iot_onenet_disconnect:()=>Gi,iot_onenet_publish:()=>Xi,iot_onenet_publish_dict:()=>Wi,iot_onenetconnect:()=>br,iot_onenetdisconnect:()=>Tr,iot_publish:()=>Er,iot_publish_container:()=>qi,iot_publish_item:()=>Ki});var p={};n.r(p),n.d(p,{pins_analog_read:()=>Cr,pins_analog_write:()=>Sr,pins_digital_read:()=>Ar,pins_digital_write:()=>Ir});var f={};n.r(f),n.d(f,{serial_close:()=>kr,serial_open:()=>Or,serial_read_b:()=>Rr,serial_write:()=>Mr});var m={};n.r(m),n.d(m,{sklearn_DecisionTreeClassifier_Regressor:()=>jr,sklearn_GaussianNB:()=>Hr,sklearn_KMeans:()=>qr,sklearn_KMeans_fit:()=>Kr,sklearn_KNeighborsClassifier_Regressor:()=>Gr,sklearn_LinearRegression:()=>zr,sklearn_RandomForestClassifier_Regressor:()=>Yr,sklearn_Ridge:()=>Vr,sklearn_cluster_centers_labels_inertia:()=>is,sklearn_coef_intercept:()=>ns,sklearn_data_target:()=>Br,sklearn_fit:()=>Zr,sklearn_fit_no_target:()=>Qr,sklearn_load:()=>Pr,sklearn_make_blobs:()=>Lr,sklearn_make_classification:()=>Dr,sklearn_make_regression:()=>Fr,sklearn_pca:()=>Wr,sklearn_pca_fit_transform:()=>Xr,sklearn_predict:()=>Jr,sklearn_save_load_model:()=>rs,sklearn_score:()=>es,sklearn_score_no_target:()=>ts,sklearn_train_test_split:()=>$r,sklearn_train_test_split_no_target:()=>Ur});var g={};n.r(g),n.d(g,{Panic_with_status_code:()=>us,base_delay:()=>os,controls_millis:()=>as,controls_mstimer2:()=>ds,controls_mstimer2_start:()=>hs,controls_mstimer2_stop:()=>ps,reset:()=>cs,time_localtime:()=>ls,time_sleep:()=>fs});var y={};n.r(y),n.d(y,{turtle_bgcolor:()=>Ls,turtle_bgcolor_hex:()=>Gs,turtle_bgcolor_hex_new:()=>Us,turtle_circle:()=>Ns,turtle_circle_advanced:()=>Ds,turtle_clear:()=>Ss,turtle_clone:()=>$s,turtle_color:()=>js,turtle_color_hex:()=>Ys,turtle_color_seclet:()=>to,turtle_create:()=>gs,turtle_done:()=>ys,turtle_exitonclick:()=>_s,turtle_fill:()=>Os,turtle_fillcolor:()=>Bs,turtle_fillcolor_hex:()=>Ws,turtle_fillcolor_hex_new:()=>Vs,turtle_getscreen:()=>no,turtle_goto:()=>Es,turtle_listen:()=>oo,turtle_move:()=>vs,turtle_numinput:()=>Ks,turtle_onclick:()=>ro,turtle_onkey:()=>io,turtle_ontimer:()=>so,turtle_pencolor:()=>Ps,turtle_pencolor_hex:()=>Hs,turtle_pencolor_hex_new:()=>zs,turtle_penup:()=>Cs,turtle_pos_shape:()=>Is,turtle_rotate:()=>bs,turtle_screen_delay:()=>xs,turtle_screen_savefig:()=>ao,turtle_setheading:()=>Ts,turtle_setxy:()=>ws,turtle_shape:()=>Xs,turtle_shapesize:()=>qs,turtle_size:()=>Rs,turtle_size_speed:()=>Ms,turtle_speed:()=>ks,turtle_stamp:()=>As,turtle_textinput:()=>Zs,turtle_visible:()=>Fs,turtle_write:()=>Qs,turtle_write_format:()=>Js,turtle_write_format_skulpt:()=>eo});var _={};n.r(_),n.d(_,{AI_ChooseAndGet:()=>lo,AI_Face_match:()=>fo,AI_ImageClassify:()=>po,AI_ImageClassify_Func:()=>bo,AI_Nlp:()=>go,AI_Nlp_Func:()=>xo,AI_Nlp_Func_sim:()=>Eo,AI_Nlp_Sim:()=>yo,AI_Nlp_Topic:()=>_o,AI_Nlp_newsSummary:()=>vo,AI_Ocr:()=>mo,AI_Ocr_Func:()=>To,AI_Speech_asr:()=>ho,AI_Speech_synthesis:()=>co,AI_audio:()=>wo,AI_client:()=>uo,AI_photo:()=>Io,AI_result:()=>Ao});var v={};n.r(v),n.d(v,{algorithm_add_path:()=>ko,algorithm_add_school:()=>Co,algorithm_all_books:()=>qo,algorithm_all_books_sequence:()=>Xo,algorithm_book_scale:()=>sa,algorithm_check_feet:()=>pa,algorithm_chick_calculate:()=>ha,algorithm_color_seclet:()=>Ma,algorithm_current_school:()=>Bo,algorithm_del_path:()=>No,algorithm_delete_book:()=>ia,algorithm_divide_books:()=>ta,algorithm_find_path:()=>Oo,algorithm_first_book:()=>Ko,algorithm_fz_calc:()=>ya,algorithm_fz_compare:()=>_a,algorithm_fz_move:()=>ba,algorithm_fz_set_min:()=>va,algorithm_get_current_location:()=>Ca,algorithm_get_half_books:()=>na,algorithm_hxdb_add:()=>Ia,algorithm_hxdb_init_soldier:()=>xa,algorithm_hxdb_last_line:()=>wa,algorithm_hxdb_result:()=>Aa,algorithm_hxdb_stand_in_line:()=>Ea,algorithm_init_fzsf:()=>ga,algorithm_init_hxdb:()=>Ta,algorithm_init_jttl:()=>ua,algorithm_move_recent:()=>Vo,algorithm_new_path:()=>Mo,algorithm_next_book:()=>Jo,algorithm_no_left:()=>Fo,algorithm_no_path:()=>$o,algorithm_no_ring2:()=>Zo,algorithm_not_home:()=>jo,algorithm_not_school:()=>Yo,algorithm_number_add:()=>aa,algorithm_number_zero:()=>oa,algorithm_prepare:()=>So,algorithm_prepare2:()=>Po,algorithm_prepare_2_1:()=>Uo,algorithm_prepare_2_2:()=>zo,algorithm_print_book2:()=>ra,algorithm_print_jttl_answer:()=>fa,algorithm_print_number:()=>la,algorithm_print_path:()=>Lo,algorithm_print_path2:()=>Go,algorithm_rabbit_add:()=>ma,algorithm_rabbit_number_in_range:()=>da,algorithm_rabbit_zero:()=>ca,algorithm_return_path:()=>Do,algorithm_set_path:()=>Ro,algorithm_two_left:()=>ea,algorithm_void_path:()=>Oa,algorithm_yes_ring2:()=>Qo,hanoi_init:()=>Ho,hanoi_init_offline:()=>Sa,hanoi_move:()=>Wo});var b={};n.r(b),n.d(b,{requests_attribute:()=>Da,requests_get:()=>ka,requests_get_old:()=>Ra,requests_method:()=>Fa,requests_post:()=>Na});var T={};n.r(T),n.d(T,{array_create:()=>Qa,array_toarray:()=>hl,dataframe_aggregate_func:()=>au,dataframe_create:()=>$a,dataframe_create_from_index:()=>Ua,dataframe_create_from_one_index:()=>za,dataframe_fillna:()=>Wl,dataframe_get:()=>ul,dataframe_groupby:()=>ou,dataframe_head_tail:()=>ru,dataframe_info:()=>Xl,dataframe_median:()=>Hl,dataframe_select:()=>su,dataframe_sort_values:()=>iu,matrix_multiplication:()=>Yl,matrix_transpose:()=>jl,numpy_argmin_template_match:()=>Fl,numpy_astype:()=>kl,numpy_c_:()=>zl,numpy_dot:()=>Ql,numpy_linalg_det:()=>Vl,numpy_linalg_inv:()=>Gl,numpy_max:()=>Kl,numpy_mean:()=>Ll,numpy_mean_digit:()=>Dl,numpy_min:()=>ql,numpy_ones:()=>Ul,numpy_random_random:()=>tu,numpy_reshape:()=>Rl,numpy_shape:()=>Ml,numpy_size:()=>Zl,numpy_square:()=>Jl,numpy_std:()=>Pl,numpy_sum:()=>eu,numpy_trig:()=>ol,pandas_drop_columns:()=>$l,pandas_dropna:()=>Bl,pandas_readcsv:()=>ll,pl_axes:()=>Ha,pl_bar:()=>nl,pl_hist:()=>rl,pl_label:()=>Za,pl_legend:()=>qa,pl_pie:()=>il,pl_plot:()=>Xa,pl_plot_bar:()=>Ja,pl_plot_easy:()=>Wa,pl_plot_scatter:()=>el,pl_plot_xy:()=>tl,pl_savefig:()=>cl,pl_show:()=>Ga,pl_subplot:()=>al,pl_text:()=>dl,pl_ticks:()=>sl,pl_title:()=>Ka,plot_axes:()=>fl,plot_bar:()=>El,plot_cla:()=>lu,plot_hist:()=>Il,plot_label:()=>vl,plot_legend:()=>yl,plot_pie:()=>wl,plot_plot:()=>gl,plot_plot_bar:()=>bl,plot_plot_easy:()=>ml,plot_plot_scatter:()=>Tl,plot_plot_xy:()=>xl,plot_savefig:()=>Cl,plot_show:()=>pl,plot_subplot:()=>Sl,plot_text:()=>Ol,plot_ticks:()=>Al,plot_title:()=>_l,py_sum:()=>nu,pylab_imshow:()=>Nl,series_create:()=>Pa,series_create_from_index:()=>Ba,series_create_from_text:()=>Va,series_get_num:()=>Ya,series_index_value:()=>ja});var x={};n.r(x),n.d(x,{ds_add_node_by_attr:()=>fu,ds_add_node_by_name:()=>pu,ds_create_linkedlist:()=>uu,ds_create_node:()=>cu,ds_del_node_by_attr:()=>gu,ds_del_node_by_name:()=>mu,ds_get_node_attr:()=>du,ds_reverse_linkedlist:()=>yu,ds_set_node_attr:()=>hu});var E={};n.r(E),n.d(E,{factory_block:()=>Iu,factory_block_return:()=>Au,factory_block_return_with_textarea:()=>Cu,factory_block_with_textarea:()=>Su,factory_callMethod_noreturn:()=>Eu,factory_callMethod_return:()=>wu,factory_declare:()=>xu,factory_from_import:()=>_u,factory_function_noreturn:()=>bu,factory_function_return:()=>Tu,factory_import:()=>vu});var w={};n.r(w),n.d(w,{hardware_arduino_analog_read:()=>Nu,hardware_arduino_analog_write:()=>Du,hardware_arduino_digital_read:()=>ku,hardware_arduino_digital_write:()=>Ru,hardware_arduino_start:()=>Ou,inout_highlow:()=>Mu});var I={};n.r(I),n.d(I,{inout_input:()=>Fu,inout_print:()=>Lu,inout_print_end:()=>Bu,inout_print_inline:()=>Pu,inout_print_many:()=>zu,inout_type_input:()=>$u,pyinout_type_input:()=>Uu});var A={};n.r(A),n.d(A,{IOT_EMQX_INIT_AND_CONNECT_BY_MIXLY_CODE:()=>Ju,IOT_EMQX_INIT_AND_CONNECT_BY_SHARE_CODE:()=>nc,IOT_EMQX_PING:()=>ic,IOT_FORMATTING:()=>Zu,IOT_FORMAT_STRING:()=>Qu,IOT_MIXIO_NTP:()=>rc,IOT_MIXIO_PUBLISH:()=>ju,IOT_MIXIO_SUBSCRIBE:()=>Yu,IOT_MIXIO_UNSUBSCRIBE:()=>Gu,iot_mixio_check:()=>Xu,iot_mixio_connect:()=>Vu,iot_mixio_connect_only:()=>Wu,iot_mixio_disconnect:()=>Hu,iot_mixio_format_msg:()=>Ku,iot_mixio_format_topic:()=>qu,iot_mixly_key:()=>ec,iot_mixly_key_py:()=>tc});var S={};n.r(S),n.d(S,{pins_analog_read:()=>uc,pins_analog_write:()=>lc,pins_digital:()=>sc,pins_digital_read:()=>ac,pins_digital_write:()=>oc});var C={};n.r(C),n.d(C,{serial_close:()=>pc,serial_open:()=>cc,serial_read_b:()=>hc,serial_write:()=>dc});var O={};n.r(O),n.d(O,{sklearn_DecisionTreeClassifier_Regressor:()=>Ec,sklearn_GaussianNB:()=>Ac,sklearn_KMeans:()=>Oc,sklearn_KMeans_fit:()=>Mc,sklearn_KNeighborsClassifier_Regressor:()=>Ic,sklearn_LinearRegression:()=>Tc,sklearn_RandomForestClassifier_Regressor:()=>wc,sklearn_Ridge:()=>xc,sklearn_cluster_centers_labels_inertia:()=>Pc,sklearn_coef_intercept:()=>Lc,sklearn_data_target:()=>_c,sklearn_fit:()=>Rc,sklearn_fit_no_target:()=>kc,sklearn_load:()=>yc,sklearn_make_blobs:()=>gc,sklearn_make_classification:()=>fc,sklearn_make_regression:()=>mc,sklearn_pca:()=>Sc,sklearn_pca_fit_transform:()=>Cc,sklearn_predict:()=>Nc,sklearn_save_load_model:()=>Bc,sklearn_score:()=>Dc,sklearn_score_no_target:()=>Fc,sklearn_train_test_split:()=>vc,sklearn_train_test_split_no_target:()=>bc});var M={};n.r(M),n.d(M,{controls_end_program:()=>Uc,controls_millis:()=>$c,time_localtime:()=>zc});var R={};n.r(R),n.d(R,{turtle_bgcolor:()=>ld,turtle_bgcolor_hex:()=>hd,turtle_bgcolor_hex_new:()=>md,turtle_circle:()=>rd,turtle_circle_advanced:()=>od,turtle_clear:()=>Qc,turtle_clone:()=>dd,turtle_color:()=>vd,turtle_color_hex:()=>_d,turtle_color_seclet:()=>Sd,turtle_create:()=>Vc,turtle_done:()=>jc,turtle_exitonclick:()=>Yc,turtle_fill:()=>ed,turtle_fillcolor:()=>cd,turtle_fillcolor_hex:()=>fd,turtle_fillcolor_hex_new:()=>yd,turtle_getscreen:()=>Cd,turtle_goto:()=>qc,turtle_listen:()=>kd,turtle_move:()=>Gc,turtle_numinput:()=>Ed,turtle_onclick:()=>Md,turtle_onkey:()=>Od,turtle_ontimer:()=>Rd,turtle_pencolor:()=>ud,turtle_pencolor_hex:()=>pd,turtle_pencolor_hex_new:()=>gd,turtle_penup:()=>Jc,turtle_pos_shape:()=>Kc,turtle_rotate:()=>Hc,turtle_screen_delay:()=>Xc,turtle_screen_savefig:()=>Nd,turtle_setheading:()=>Wc,turtle_setxy:()=>sd,turtle_shape:()=>bd,turtle_shapesize:()=>Td,turtle_size:()=>nd,turtle_size_speed:()=>td,turtle_speed:()=>id,turtle_stamp:()=>Zc,turtle_textinput:()=>xd,turtle_visible:()=>ad,turtle_write:()=>wd,turtle_write_format:()=>Id,turtle_write_format_skulpt:()=>Ad});var k=n(13383);const N=205,D={init:function(){this.setColour(N),this.appendDummyInput("").appendField(k.Msg.MIXLY_CHOOSE_AND_GET).appendField(new k.FieldDropdown([[k.Msg.MIXLY_CHOOSE_AND_GET_ONE_FILE_NAME,"getOneFile"],[k.Msg.MIXLY_CHOOSE_AND_GET_MANY_FILE_NAMES,"getManyFiles"],[k.Msg.MIXLY_CHOOSE_AND_GET_DIR,"getDirectory"]]),"TYPE"),this.setInputsInline(!0),this.setOutput(!0)}},F={init:function(){this.setColour(N),this.appendDummyInput("").appendField(k.Msg.MIXLY_SETUP).appendField(new k.FieldDropdown([[k.Msg.MIXLY_AipImageClassify,"AipImageClassify"],[k.Msg.MIXLY_AipSpeech,"AipSpeech"],[k.Msg.MIXLY_AipImageCensor,"AipImageCensor"],[k.Msg.MIXLY_AipFace,"AipFace"],[k.Msg.MIXLY_AipOcr,"AipOcr"],[k.Msg.MIXLY_AipNlp,"AipNlp"]]),"CTYPE"),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_Client).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("API_KEY").appendField("API_KEY").setAlign(k.inputs.Align.RIGHT),this.appendValueInput("SECRET_KEY").appendField("SECRET_KEY").setAlign(k.inputs.Align.RIGHT),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},L={init:function(){this.setColour(N),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_AipSpeech_synthesis).appendField(k.Msg.MIXLY_Client).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("STR").appendField(k.Msg.OLED_STRING).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("ATTR").appendField(k.Msg.MIXLY_AIP_ATTR).setAlign(k.inputs.Align.RIGHT),this.setTooltip(k.Msg.MIXLY_AipSpeech_synthesis_TOOLTIP),this.setInputsInline(!1),this.setOutput(!0)}},P={init:function(){this.setColour(N),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_AipSpeech_asr).appendField(k.Msg.MIXLY_Client).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("FILE").appendField(k.Msg.MIXLY_AipSpeech_File).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("ATTR").appendField(k.Msg.MIXLY_AIP_ATTR).setAlign(k.inputs.Align.RIGHT),this.setTooltip(k.Msg.MIXLY_AipSpeech_ASR_TOOLTIP),this.setInputsInline(!1),this.setOutput(!0)}},B={init:function(){this.setColour(N),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_AipImageClassify).appendField(k.Msg.MIXLY_Client).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("FUNC").appendField(k.Msg.MIXLY_AIP_FUNC).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("ADDR").appendField(k.Msg.MIXLY_AipImageClassify_Image).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("ATTR").appendField(k.Msg.MIXLY_AIP_ATTR).setAlign(k.inputs.Align.RIGHT),this.setTooltip(k.Msg.MIXLY_AipImageClassify_advancedGeneral_TOOLTIP),this.setInputsInline(!1),this.setOutput(!0)}},$={init:function(){this.setColour(N),this.appendDummyInput("").appendField(new k.FieldDropdown([[k.Msg.MIXLY_AipImageClassify_advancedGeneral,"advancedGeneral"],[k.Msg.MIXLY_AipImageClassify_dishDetect,"dishDetect"],[k.Msg.MIXLY_AipImageClassify_carDetect,"carDetect"],[k.Msg.MIXLY_AipImageClassify_animalDetect,"animalDetect"],[k.Msg.MIXLY_AipImageClassify_plantDetect,"plantDetect"],[k.Msg.MIXLY_AipImageClassify_logoSearch,"logoSearch"]]),"TYPE"),this.setOutput(!0)}},U={init:function(){this.setColour(N),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_AipFace_match).appendField(k.Msg.MIXLY_Client).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_AipImageClassify_Image+"1"+k.Msg.MIXLY_MICROBIT_PY_STORAGE_THE_PATH).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("VAR2").appendField(k.Msg.MIXLY_AipImageClassify_Image+"2"+k.Msg.MIXLY_MICROBIT_PY_STORAGE_THE_PATH).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("ATTR").appendField(k.Msg.MIXLY_AIP_ATTR).setAlign(k.inputs.Align.RIGHT),this.setTooltip(k.Msg.MIXLY_AipFace_match_TOOLTIP),this.setInputsInline(!1),this.setOutput(!0)}},z={init:function(){this.setColour(N),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_AipOcr).appendField(k.Msg.MIXLY_Client).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("FUNC").appendField(k.Msg.MIXLY_AIP_FUNC).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("ADDR").appendField(k.Msg.MIXLY_AipImageClassify_Image).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("ATTR").appendField(k.Msg.MIXLY_AIP_ATTR).setAlign(k.inputs.Align.RIGHT),this.setTooltip(k.Msg.MIXLY_AipOcr_TOOLTIP),this.setInputsInline(!1),this.setOutput(!0)}},V={init:function(){this.setColour(N),this.appendDummyInput("").appendField(new k.FieldDropdown([[k.Msg.MIXLY_AipOcr_basicGeneral,"basicGeneral"],[k.Msg.MIXLY_AipOcr_webImage,"webImage"],[k.Msg.MIXLY_AipOcr_idcard,"idcard"],[k.Msg.MIXLY_AipOcr_bankcard,"bankcard"],[k.Msg.MIXLY_AipOcr_drivingLicense,"drivingLicense"],[k.Msg.MIXLY_AipOcr_vehicleLicense,"vehicleLicense"],[k.Msg.MIXLY_AipOcr_licensePlate,"licensePlate"],[k.Msg.MIXLY_AipOcr_businessLicense,"businessLicense"],[k.Msg.MIXLY_AipOcr_receipt,"receipt"],[k.Msg.MIXLY_AipOcr_trainTicket,"trainTicket"],[k.Msg.MIXLY_AipOcr_taxiReceipt,"taxiReceipt"],[k.Msg.MIXLY_AipOcr_form,"tableRecognition"],[k.Msg.MIXLY_AipOcr_vatInvoice,"vatInvoice"],[k.Msg.MIXLY_AipOcr_passport,"passport"],[k.Msg.MIXLY_AipOcr_handwriting,"handwriting"]]),"TYPE"),this.setOutput(!0)}},j={init:function(){this.setColour(N),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_AipNlp).appendField(k.Msg.MIXLY_Client).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("FUNC").appendField(k.Msg.MIXLY_AIP_FUNC).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("STR").appendField(k.Msg.OLED_STRING).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("ATTR").appendField(k.Msg.MIXLY_AIP_ATTR).setAlign(k.inputs.Align.RIGHT),this.setTooltip(k.Msg.MIXLY_AipNlp_TOOLTIP),this.setInputsInline(!1),this.setOutput(!0)}},Y={init:function(){this.setColour(N),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_AipNlp_Sim).appendField(k.Msg.MIXLY_Client).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("FUNC").appendField(k.Msg.MIXLY_AIP_FUNC).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("STR1").appendField(k.Msg.OLED_STRING+"1").setAlign(k.inputs.Align.RIGHT),this.appendValueInput("STR2").appendField(k.Msg.OLED_STRING+"2").setAlign(k.inputs.Align.RIGHT),this.appendValueInput("ATTR").appendField(k.Msg.MIXLY_AIP_ATTR).setAlign(k.inputs.Align.RIGHT),this.setTooltip(k.Msg.MIXLY_AipNlp_Sim_TOOLTIP),this.setInputsInline(!1),this.setOutput(!0)}},G={init:function(){this.setColour(N),this.appendDummyInput("").appendField(new k.FieldDropdown([[k.Msg.MIXLY_AipNlp_lexer,"lexer"],[k.Msg.MIXLY_AipNlp_depParser,"depParser"],[k.Msg.MIXLY_AipNlp_wordEmbedding,"wordEmbedding"],[k.Msg.MIXLY_AipNlp_dnnlm,"dnnlm"],[k.Msg.MIXLY_AipNlp_commentTag,"commentTag"],[k.Msg.MIXLY_AipNlp_sentimentClassify,"sentimentClassify"],[k.Msg.MIXLY_AipNlp_keyword,"keyword"],[k.Msg.MIXLY_AipNlp_topic,"topic"],[k.Msg.MIXLY_AipNlp_ecnet,"ecnet"],[k.Msg.MIXLY_AipNlp_emotion,"emotion"]]),"TYPE"),this.setOutput(!0)}},H={init:function(){this.setColour(N),this.appendDummyInput("").appendField(new k.FieldDropdown([[k.Msg.MIXLY_AipNlp_wordSimEmbedding,"wordSimEmbedding"],[k.Msg.MIXLY_AipNlp_simnet,"simnet"]]),"TYPE"),this.setOutput(!0)}},W={init:function(){this.setColour(N),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_AipNlp_topic).appendField(k.Msg.MIXLY_Client).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("STR1").appendField(k.Msg.MIXLY_AipNlp_Topic_Title).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("STR2").appendField(k.Msg.MIXLY_AipNlp_Topic_Content).setAlign(k.inputs.Align.RIGHT),this.setTooltip(k.Msg.MIXLY_AipNlp_Topic_TOOLTIP),this.setInputsInline(!1),this.setOutput(!0)}},X={init:function(){this.setColour(N),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_AipNlp_summary).appendField(k.Msg.MIXLY_Client).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("STR").appendField(k.Msg.MIXLY_AipNlp_Topic_Content).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("LEN").appendField(k.Msg.MIXLY_LIST_LEN).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("ATTR").appendField(k.Msg.MIXLY_AIP_ATTR).setAlign(k.inputs.Align.RIGHT),this.setTooltip(k.Msg.MIXLY_AipNlp_Summary_TOOLTIP),this.setInputsInline(!1),this.setOutput(!0)}},q={init:function(){this.setColour(N),this.appendValueInput("VAR").appendField(k.Msg.MIXPY_AI_AUDIO),this.appendValueInput("TIME").appendField(k.Msg.MIXPY_AI_AUDIO_TIME),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXPY_AI_AUDIO_TOOLTIP)}},K={init:function(){this.setColour(N),this.appendValueInput("VAR").appendField(k.Msg.MIXPY_AI_PHOTO),this.appendValueInput("BUT").appendField(k.Msg.MIXPY_AI_PHOTO_BUTTON),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXPY_AI_PHOTO_TOOLTIP)}},Z={init:function(){this.setColour(N),this.appendValueInput("AI").appendField(k.Msg.MIXPY_AI_RESULT).appendField(new k.FieldDropdown([[k.Msg.MIXLY_AipImageClassify,"Image"],[k.Msg.MIXLY_AipSpeech_asr,"Speech"],[k.Msg.MIXLY_AipFace_match,"Face"],[k.Msg.MIXLY_AipOcr,"Ocr"],[k.Msg.MIXLY_AipNlp_simnet,"OcrSimilarity"],[k.Msg.MIXLY_AipNlp_sentimentClassify,"Emotion"]]),"CTYPE"),this.setOutput(!0),this.setTooltip(k.Msg.LOGIC_NEGATE_TOOLTIP)}},Q="#526FC3",J={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_PREPARE),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},ee={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_ADD_SCHOOL),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},te={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_FIND_PATH),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},ne={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_NEW_PATH),this.setOutput(!0)}},ie={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_SET_PATH),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},re={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_ADD_PATH),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},se={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_DEL_PATH),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},oe={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_RETURN_PATH),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},ae={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_NO_LEFT),this.setOutput(!0)}},le={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_PRINT_PATH),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},ue={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_PREPARE2),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},ce={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_CURRENT_SCHOOL),this.setOutput(!0)}},de={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_NO_PATH),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},he={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_PREPARE_2_1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},pe={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_PREPARE_2_2),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},fe={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_MOVE_RECENT),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},me={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_NOT_HOME),this.setOutput(!0)}},ge={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_NOT_SCHOOL),this.setOutput(!0)}},ye={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_PRINT_PATH2),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},_e={init:function(){this.appendDummyInput().appendField("准备").appendField(new k.FieldNumber(3,0,100,1),"NUM").appendField("层汉诺塔"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},ve={init:function(){this.appendDummyInput().appendField("移动圆盘从"),this.appendValueInput("FROM_NUM").setCheck(null).appendField("柱"),this.appendDummyInput().appendField("到"),this.appendValueInput("TO_NUM").setCheck(null).appendField("柱"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},be={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_ALL_BOOKS),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Te={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_ALL_BOOKS2),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},xe={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_FIRST_BOOK),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Ee={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_NO_RING),this.setOutput(!0)}},we={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_YES_RING),this.setOutput(!0)}},Ie={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_NEXT_BOOK),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Ae={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_TWO_LEFT),this.setOutput(!0)}},Se={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_DIVIDE_BOOKS),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Ce={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_GET_HALF_BOOKS),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Oe={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_DELETE_BOOK),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Me={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_DELETE_BOOKS),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Re={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_DELETE_BOOKS2),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},ke={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_PRINT_BOOK),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Ne={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("设置待查书总数 N=").appendField(new k.FieldDropdown([["5","5"],["10","10"],["20","20"],["50","50"]]),"NUM"),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},De={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_NUMBER_ZERO),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Fe={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_NUMBER_ADD),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Le={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_PRINT_NUMBER),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Pe={init:function(){this.setColour(Q),this.appendDummyInput().appendField("n"+k.Msg.MIXLY_VALUE2).appendField(new k.FieldTextInput("50"),"NUM"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Be={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_PRINT_SEQUENCE),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},$e={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_PRINT_DIVIDE),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Ue={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("初始化鸡兔同笼问题:"),this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("有若干只鸡、兔在同一个笼子里。"),this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("从上面数鸡兔有10个头"),this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("从下面数鸡兔有32只脚。"),this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("问笼中有多少只鸡和多少只兔?"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},ze={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("假设兔子的数量为0只"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},Ve={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("兔子的数量在范围之内"),this.setOutput(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},je={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("根据(头数-兔子数)计算出鸡的数量"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},Ye={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("计算得到脚的数量正确"),this.setOutput(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},Ge={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("输出鸡、兔的数量"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},He={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("假设兔子数量要更多一只"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},We={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("加载路线图"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},Xe={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("计算").appendField(new k.FieldDropdown([["S1","1"],["S2","2"],["S3","3"],["S4","4"]]),"PATHNAME").appendField("长度"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},qe={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("设置S1为Smin"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},Ke={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField(new k.FieldDropdown([["S1","1"],["S2","2"],["S3","3"],["S4","4"]]),"PATHNAME").appendField("的长度比").appendField(new k.FieldDropdown([["S1","1"],["S2","2"],["S3","3"],["S4","4"]]),"PATHNAME2").appendField("短"),this.setOutput(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},Ze={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("设置").appendField(new k.FieldDropdown([["S1","1"],["S2","2"],["S3","3"],["S4","4"]]),"PATHNAME").appendField("为Smin"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},Qe={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("按照Smin移动"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},Je={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("初始化韩信点兵问题:"),this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("有未知数量的若干士兵。"),this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("若3人一排列队多1人"),this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("若5人一排列队多2人"),this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("若7人一排列队多2人"),this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("问士兵的数量最少是多少人?"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},et={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("初始化士兵为").appendField(new k.FieldTextInput("7"),"NUM").appendField("个"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},tt={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("使士兵").appendField(new k.FieldDropdown([["3","3"],["5","5"],["7","7"]]),"NUM").appendField("人一排列队"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},nt={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("剩余").appendField(new k.FieldTextInput("1"),"NUM").appendField("个士兵"),this.setOutput(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},it={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("增加1个士兵"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},rt={init:function(){this.appendDummyInput().setAlign(k.inputs.Align.LEFT).appendField("输出士兵数量"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setTooltip(""),this.setHelpUrl("")}},st={init:function(){this.appendDummyInput().appendField("准备").appendField(new k.FieldNumber(3,0,100,1),"NUM").appendField("层汉诺塔"),this.appendValueInput("VAR").setCheck(String).appendField(k.Msg.HTML_COLOUR),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Q),this.setInputsInline(!0),this.setTooltip(""),this.setHelpUrl("")}},ot={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_GET_CURRENT_LOCATION),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},at={init:function(){this.setColour(Q),this.appendDummyInput().appendField(k.Msg.MIXLY_MIXPY_ALGORITHM_VOID_PATH),this.setOutput(!0)}},lt={init:function(){this.setColour(Q),this.appendDummyInput("").setAlign(k.inputs.Align.RIGHT).appendField(new k.FieldColour("ff0000"),"COLOR"),this.setInputsInline(!0),this.setOutput(!0,String)}},ut="#3288dd",ct={init:function(){this.setColour(ut),this.appendValueInput("DOMAIN").appendField(k.Msg.DISPLAY_IMAGE_LET2).setCheck(String),this.appendDummyInput("").appendField(k.Msg.blockpy_REQUESTS_GET).appendField(new k.FieldTextInput("response"),"VAR"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.blockpy_REQUESTS_GET_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},dt={init:function(){this.setColour(ut),this.appendValueInput("URL").appendField(k.Msg.DISPLAY_IMAGE_LET2).setCheck(String),this.appendDummyInput("").appendField(k.Msg.blockpy_CONDUCT).appendField(new k.FieldDropdown([["get","get"],["head","head"],["delete","delete"]]),"TYPE").appendField(k.Msg.blockpy_REQUESTS).appendField(k.Msg.MIXPY_REQUESTS_GET_RESULT),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip("")}},ht={init:function(){this.setColour(ut),this.appendValueInput("URL").appendField(k.Msg.DISPLAY_IMAGE_LET2).setCheck(String),this.appendDummyInput("").appendField(k.Msg.blockpy_CONDUCT).appendField(new k.FieldDropdown([["post","post"],["put","put"],["patch","patch"]]),"TYPE").appendField(k.Msg.blockpy_REQUESTS),this.appendValueInput("data").appendField(k.Msg.blockpy_REQUESTS+k.Msg.OLED_STRING),this.appendDummyInput("").appendField(k.Msg.MIXPY_REQUESTS_GET_RESULT),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip("")}},pt={init:function(){this.appendValueInput("VAL");var e=[[k.Msg.blockpy_REQUESTS_GET_ATTR_STATUS_CODE,"status_code"],[k.Msg.blockpy_REQUESTS_GET_ATTR_TEXT,"text"],[k.Msg.blockpy_REQUESTS_GET_ATTR_COOKIES,"cookies"],[k.Msg.blockpy_REQUESTS_GET_ATTR_CONTENT,"content"],[k.Msg.MIXPY_TEXT_ENCODE,"encoding"]];this.setColour(ut),this.appendDummyInput("").appendField(k.Msg.MIXLY_MICROBIT_JS_GET).appendField(new k.FieldDropdown(e),"ATTR"),this.setInputsInline(!0),this.setOutput(!0,String)}},ft={init:function(){this.appendValueInput("VAR").appendField(k.Msg.DISPLAY_IMAGE_LET2).setCheck(String);this.setColour(ut),this.appendDummyInput("").appendField(k.Msg.blockpy_CONDUCT).appendField(new k.FieldDropdown([["post","post"],["put","put"],["delete","delete"],["head","head"],["option","option"]]),"DIR"),this.appendDummyInput("").appendField(k.Msg.blockpy_REQUESTS),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip(function(){var t=e.getFieldValue("DIR");return{forward:k.Msg.MIXLY_TOOLTIP_TURTEL_FORWARD,backward:k.Msg.MIXLY_TOOLTIP_TURTEL_BACKWARD}[t]})}},mt="f0a559",gt={init:function(){this.setColour(mt),this.appendValueInput("FILE").setCheck(String).appendField(k.Msg.MIXLY_CV_IMREAD),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)}},yt={init:function(){this.setColour(mt),this.appendValueInput("FILE").appendField(k.Msg.OLED_BITMAP),this.appendValueInput("data").setCheck(String).appendField(k.Msg.MIXLY_AipNlp_Topic_Title),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0)}},_t={init:function(){this.setColour(mt),this.appendValueInput("FILE").appendField(k.Msg.MIXLY_CV_IMWRITE),this.appendValueInput("data").setCheck(String).appendField(k.Msg.HTML_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0)}},vt={init:function(){this.setColour(mt),this.appendValueInput("data").setCheck(Number).appendField(k.Msg.MIXLY_DELAY),this.appendDummyInput().appendField(k.Msg.MIXLY_MILLIS+k.Msg.MIXLY_CV_OR_PRESS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_CV_WAITKEY_TOOLTIP)}},bt={init:function(){this.setColour(mt),this.appendDummyInput().appendField(k.Msg.MIXLY_CV_DESTROY_ALL),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0)}},Tt={init:function(){this.setColour(mt),this.appendValueInput("FILE").appendField(k.Msg.MIXLY_MICROBIT_IMAGE);var e=[[k.Msg.MIXLY_CV_RECT,"rectangle"],[k.Msg.MIXLY_CV_LINE,"line"]];this.appendValueInput("x1").setCheck(Number).appendField(k.Msg.MIXLY_DISPLAY_DRAW).appendField(new k.FieldDropdown(e),"DIR").appendField(k.Msg.MIXLY_CV_DRAWLINE_BEGIN+"(x1"),this.appendValueInput("y1").setCheck(Number).appendField(",y1"),this.appendValueInput("x2").setCheck(Number).appendField(") "+k.Msg.MIXLY_CV_DRAWLINE_END+"(x2"),this.appendValueInput("y2").setCheck(Number).appendField(",y2"),this.appendDummyInput().appendField(") "+k.Msg.MIXLY_CV_DRAWLINE_COLOR).appendField(new k.FieldColour("#ff0000"),"FIELDNAME"),this.appendValueInput("thick").setCheck(Number).appendField(k.Msg.MIXLY_CV_DRAWLINE_THICKNESS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_CV_DRAWLINE_RECT_TOOLTIP)}},xt={init:function(){this.setColour(mt),this.appendValueInput("FILE").appendField(k.Msg.MIXLY_MICROBIT_IMAGE);this.appendValueInput("data").setCheck(String).appendField(k.Msg.MIXLY_CV_DRAWTEXT),this.appendValueInput("x1").setCheck(Number).appendField(k.Msg.MIXLY_CV_DRAWLINE_BEGIN+"(x1"),this.appendValueInput("y1").setCheck(Number).appendField(",y1"),this.appendDummyInput().appendField(") "+k.Msg.MIXLY_TURTLE_WRITE_FONT_NAME).appendField(new k.FieldDropdown([["SIMPLEX","SIMPLEX"],["PLAIN","PLAIN"],["DUPLEX","DUPLEX"],["COMPLEX","COMPLEX"],["COMPLEX_SMALL","COMPLEX_SMALL"],["TRIPLEX","TRIPLEX"],["SCRIPT_SIMPLEX","SCRIPT_SIMPLEX"],["SCRIPT_COMPLEX","SCRIPT_COMPLEX"]]),"font"),this.appendValueInput("size").setCheck(Number).appendField(k.Msg.MIXLY_TURTLE_WRITE_FONT_NUM),this.appendDummyInput().appendField(") "+k.Msg.MIXLY_CV_DRAWLINE_COLOR).appendField(new k.FieldColour("#ff0000"),"FIELDNAME"),this.appendValueInput("thick").setCheck(Number).appendField(k.Msg.MIXLY_CV_DRAWLINE_THICKNESS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_CV_DRAWLINE_RECT_TOOLTIP)}},Et={init:function(){this.setColour(mt),this.appendValueInput("FILE").setCheck(String).appendField(k.Msg.MIXLY_CV_FACE_CLASSIFIER),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)}},wt={init:function(){this.setColour(mt),this.appendValueInput("FILE").appendField(k.Msg.MIXLY_MICROBIT_IMAGE),this.appendValueInput("FACE").appendField(k.Msg.MIXLY_CV_FACE_DETECT),this.appendValueInput("SCALE").setCheck(Number).appendField(k.Msg.MIXLY_CV_FACE_DETECT_SCALE),this.appendValueInput("NEIGHBOR").setCheck(Number).appendField(k.Msg.MIXLY_CV_FACE_DETECT_NEIGHBOR),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)}},It={init:function(){this.setColour(mt),this.appendValueInput("FILE").appendField(k.Msg.MIXLY_MICROBIT_IMAGE),this.appendValueInput("FACE").appendField(k.Msg.MIXLY_CV_FACE_DETECT),this.appendValueInput("SCALE").setCheck(Number).appendField(k.Msg.MIXLY_CV_FACE_DETECT_SCALE),this.appendValueInput("NEIGHBOR").setCheck(Number).appendField(k.Msg.MIXLY_CV_FACE_DETECT_NEIGHBOR),this.appendValueInput("x1").setCheck(Number).appendField(k.Msg.MIXLY_CV_FACE_DETECT_RANGE).appendField(k.Msg.blockpy_TUPLE_MIN),this.appendValueInput("y1").setCheck(Number).appendField("×"),this.appendValueInput("x2").setCheck(Number).appendField(k.Msg.blockpy_TUPLE_MAX),this.appendValueInput("y2").setCheck(Number).appendField("×"),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)}},At=170,St={init:function(){this.setColour(At),this.appendDummyInput("").appendField(k.Msg.blockpy_series_create).appendField(new k.FieldTextInput("ser1"),"VAR"),this.appendValueInput("SER").appendField(k.Msg.blockpy_series_via),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.blockpy_series_create_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Ct={init:function(){this.setColour(At),this.appendDummyInput("").appendField(k.Msg.blockpy_series_create).appendField(new k.FieldTextInput("ser1"),"VAR"),this.appendValueInput("SER").appendField(k.Msg.blockpy_series_via),this.appendValueInput("INDEX").setCheck([String,"List"]).appendField(k.Msg.blockpy_series_set_index),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.blockpy_series_create_index_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Ot={init:function(){this.setColour(At),this.appendDummyInput("").appendField(k.Msg.blockpy_dataframe_create).appendField(new k.FieldTextInput("df1"),"VAR"),this.appendValueInput("SER").appendField(k.Msg.blockpy_series_via),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.blockpy_dataframe_create_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Mt={init:function(){this.setColour(At);var e=[[k.Msg.DATAFRAME_RAW,"index"],[k.Msg.DATAFRAME_COLUMN,"columns"]];this.appendDummyInput("").appendField(k.Msg.blockpy_dataframe_create).appendField(new k.FieldTextInput("df1"),"VAR"),this.appendValueInput("SER").appendField(k.Msg.blockpy_series_via),this.appendDummyInput("").appendField(new k.FieldDropdown(e),"COLUMN_RAW"),this.appendValueInput("INDEX").setCheck([String,"List"]).appendField(k.Msg.blockpy_series_set_index),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.blockpy_dataframe_create_index_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Rt={init:function(){this.setColour(At),this.appendDummyInput("").appendField(k.Msg.blockpy_dataframe_create).appendField(new k.FieldTextInput("df1"),"VAR"),this.appendValueInput("SER").appendField(k.Msg.blockpy_series_via),this.appendValueInput("INDEX_COLUMN").setCheck([String,"List"]).appendField(k.Msg.blockpy_dataframe_set_index_column),this.appendValueInput("INDEX_RAW").setCheck([String,"List"]).appendField(k.Msg.blockpy_dataframe_set_index_raw),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.blockpy_dataframe_create_index_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},kt={init:function(){this.setColour(At),this.appendDummyInput("").appendField(new k.FieldTextInput("ser1"),"VAR").appendField(" = [").appendField(new k.FieldTextInput("1,2,3"),"TEXT").appendField("]"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_TOOLTIP_SERIES_CREATE_FROM_TEXT)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Nt={init:function(){this.setColour(At);var e=[[k.Msg.SERIES_INDEX,"index"],[k.Msg.HTML_VALUE,"value"]];this.appendValueInput("SERIES").setCheck("Series"),this.appendDummyInput("").appendField(k.Msg.SERIES_INDEX_VALUE).appendField(new k.FieldDropdown(e),"INDEX_VALUE"),this.setOutput(!0,"List");var t=this;this.setTooltip(function(){var e=t.getFieldValue("INDEX_VALUE");return{index:k.Msg.SERIES_INDEX_TOOLTIP,value:k.Msg.HTML_VALUE_TOOLTIP}[e]})}},Dt={init:function(){this.setColour(At),this.setOutput(!0),this.appendValueInput("SER").setCheck("Series"),this.appendValueInput("AT").setCheck(Number).appendField(k.Msg.LANG_LISTS_GET_INDEX1),this.appendDummyInput("").appendField(k.Msg.LANG_LISTS_GET_INDEX2),this.setInputsInline(!0),this.setTooltip(k.Msg.TUPLE_GET_INDEX_TOOLTIP)}},Ft={init:function(){this.setColour(At),this.appendValueInput("SER").setCheck("Series").appendField(k.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_PLOT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Lt={init:function(){this.setColour(At);var e=[[k.Msg.blockpy_PYLAB_PLOT_LINE_SOLID,"-"],[k.Msg.blockpy_PYLAB_PLOT_LINE_DOTTED,"--"],[k.Msg.blockpy_PYLAB_PLOT_LINE_CHAIN,"-."],[k.Msg.blockpy_PYLAB_PLOT_LINE_POINT_DOTTED,":"],[k.Msg.MIXLY_MICROBIT_JS_INOUT_PULL_NONE,""]],t=[[k.Msg.COLOUR_RGB_BLUE,"b"],[k.Msg.COLOUR_RGB_GREEN,"g"],[k.Msg.COLOUR_RGB_RED,"r"],[k.Msg.COLOUR_CYAN,"c"],[k.Msg.COLOUR_MAGENTA,"m"],[k.Msg.COLOUR_YELLOW,"y"],[k.Msg.COLOUR_BLACK,"k"],[k.Msg.COLOUR_WHITE,"w"]],n=[[k.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[k.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[k.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_DOWN,"v"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_UP,"^"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_LEFT,"<"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_RIGHT,">"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_UP,"1"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_DOWN,"2"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_LEFT,"3"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_RIGHT,"4"],[k.Msg.blockpy_PYLAB_PLOT_DOT_SQUARE,"s"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PENTAGON,"p"],[k.Msg.blockpy_PYLAB_PLOT_DOT_STAR,"*"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_VERTICAL,"h"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_HORIZONTAL,"H"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PLUS,"+"],[k.Msg.blockpy_PYLAB_PLOT_DOT_CROSS,"x"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND,"D"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND_SMALL,"d"],[k.Msg.blockpy_PYLAB_PLOT_DOT_VERTICAL,"|"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HORIZONTAL,"_"]];this.appendValueInput("SER").setCheck("Series").appendField(k.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_PLOT),this.appendDummyInput("").appendField(k.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new k.FieldDropdown(n),"DOT"),this.appendDummyInput("").appendField(k.Msg.blockpy_PYLAB_PLOT_LINE).appendField(new k.FieldDropdown(e),"LINE"),this.appendDummyInput("").appendField(k.Msg.HTML_COLOUR).appendField(new k.FieldDropdown(t),"COLOR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Pt={init:function(){this.setColour(At),this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_SHOW),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Bt={init:function(){this.setColour(At),this.appendDummyInput().appendField(k.Msg.mixpy_PL_AXES),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},$t={init:function(){this.setColour(At),this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_LEGEND),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ut={init:function(){this.setColour(At),this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_TITLE),this.appendValueInput("TITLE").setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},zt={init:function(){this.setColour(At);var e=[[k.Msg.PYLAB_LABEL_X,"x"],[k.Msg.PYLAB_LABEL_Y,"y"]];this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_SET_LABEL).appendField(new k.FieldDropdown(e),"DIR"),this.appendValueInput("LABEL").appendField(k.Msg.blockpy_PYLAB_LABEL).setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Vt={init:function(){this.setColour(At),this.appendValueInput("FROM").setCheck(Number).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MIXLY_SPLITBYDOU).appendField(k.Msg.MIXPY_DATA_ARRAY_CREATE_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MIXPY_DATA_ARRAY_CREATE_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MIXLY_STEP),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(k.Msg.MIXLY_PYTHON_CONTROLS_RANGE_TOOLTIP)}},jt={init:function(){this.setColour(At);var e=[[k.Msg.mixpy_PYLAB_PLOT_BAR_PLOT,"plot"],[k.Msg.mixpy_PYLAB_PLOT_BAR_BAR,"bar"]];this.appendDummyInput().appendField(k.Msg.MIXLY_DISPLAY_DRAW).appendField(new k.FieldDropdown(e),"DIR"),this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_PLOT_Y),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{plot:k.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP,bar:k.Msg.mixpy_PYLAB_PLOT_BAR_EASY_TOOLTIP}[e]})}},Yt={init:function(){this.setColour(At);var e=[[k.Msg.COLOUR_RGB_BLUE,"b"],[k.Msg.COLOUR_RGB_GREEN,"g"],[k.Msg.COLOUR_RGB_RED,"r"],[k.Msg.COLOUR_CYAN,"c"],[k.Msg.COLOUR_MAGENTA,"m"],[k.Msg.COLOUR_YELLOW,"y"],[k.Msg.COLOUR_BLACK,"k"],[k.Msg.COLOUR_WHITE,"w"]],t=[[k.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[k.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[k.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_DOWN,"v"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_UP,"^"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_LEFT,"<"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_RIGHT,">"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_UP,"1"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_DOWN,"2"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_LEFT,"3"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_RIGHT,"4"],[k.Msg.blockpy_PYLAB_PLOT_DOT_SQUARE,"s"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PENTAGON,"p"],[k.Msg.blockpy_PYLAB_PLOT_DOT_STAR,"*"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_VERTICAL,"h"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_HORIZONTAL,"H"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PLUS,"+"],[k.Msg.blockpy_PYLAB_PLOT_DOT_CROSS,"x"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND,"D"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND_SMALL,"d"],[k.Msg.blockpy_PYLAB_PLOT_DOT_VERTICAL,"|"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HORIZONTAL,"_"]];this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_SCATTER).appendField(k.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_PLOT_Y),this.appendValueInput("S").appendField(k.Msg.MIXLY_MICROBIT_JS_NUMBER),this.appendDummyInput("").appendField(k.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new k.FieldDropdown(t),"DOT"),this.appendDummyInput("").appendField(k.Msg.HTML_COLOUR).appendField(new k.FieldDropdown(e),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(k.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Gt={init:function(){this.setColour(At);var e=[[k.Msg.blockpy_PYLAB_PLOT_LINE_SOLID,"-"],[k.Msg.blockpy_PYLAB_PLOT_LINE_DOTTED,"--"],[k.Msg.blockpy_PYLAB_PLOT_LINE_CHAIN,"-."],[k.Msg.blockpy_PYLAB_PLOT_LINE_POINT_DOTTED,":"],[k.Msg.MIXLY_MICROBIT_JS_INOUT_PULL_NONE,""]],t=[[k.Msg.COLOUR_RGB_BLUE,"b"],[k.Msg.COLOUR_RGB_GREEN,"g"],[k.Msg.COLOUR_RGB_RED,"r"],[k.Msg.COLOUR_CYAN,"c"],[k.Msg.COLOUR_MAGENTA,"m"],[k.Msg.COLOUR_YELLOW,"y"],[k.Msg.COLOUR_BLACK,"k"],[k.Msg.COLOUR_WHITE,"w"]],n=[[k.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[k.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[k.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_DOWN,"v"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_UP,"^"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_LEFT,"<"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_RIGHT,">"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_UP,"1"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_DOWN,"2"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_LEFT,"3"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_RIGHT,"4"],[k.Msg.blockpy_PYLAB_PLOT_DOT_SQUARE,"s"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PENTAGON,"p"],[k.Msg.blockpy_PYLAB_PLOT_DOT_STAR,"*"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_VERTICAL,"h"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_HORIZONTAL,"H"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PLUS,"+"],[k.Msg.blockpy_PYLAB_PLOT_DOT_CROSS,"x"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND,"D"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND_SMALL,"d"],[k.Msg.blockpy_PYLAB_PLOT_DOT_VERTICAL,"|"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HORIZONTAL,"_"]];this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_PLOT_XY).appendField(k.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_PLOT_Y),this.appendDummyInput("").appendField(k.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new k.FieldDropdown(n),"DOT"),this.appendDummyInput("").appendField(k.Msg.blockpy_PYLAB_PLOT_LINE).appendField(new k.FieldDropdown(e),"LINE"),this.appendDummyInput("").appendField(k.Msg.HTML_COLOUR).appendField(new k.FieldDropdown(t),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(k.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},Ht={init:function(){this.setColour(At);var e=[[k.Msg.MIXLY_TURTLE_WRITE_ALIGN_CENTER,"center"],[k.Msg.AILGN_EDGE,"edge"]];this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_BAR).appendField(k.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_PLOT_Y),this.appendValueInput("WIDTH").setCheck(Number).appendField(k.Msg.MIXLY_WIDTH),this.appendDummyInput("").appendField(k.Msg.mixpy_PYLAB_BAR_ALIGN).appendField(new k.FieldDropdown(e),"ALIGN"),this.appendDummyInput().appendField(k.Msg.HTML_COLOUR).appendField(new k.FieldColour("#0000ff"),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(k.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},Wt={init:function(){this.setColour(At);var e=[[k.Msg.mixpy_PL_PIE_SHADOW_N,"False"],[k.Msg.mixpy_PL_PIE_SHADOW_Y,"True"]],t=[[k.Msg.mixpy_PL_PIE_SHADOW_N,"None"],[k.Msg.mixpy_PYLAB_PIE_AUTOPCT_Z,"%.0f%%"],[k.Msg.mixpy_PYLAB_PIE_AUTOPCT_O,"%.1f%%"],[k.Msg.mixpy_PYLAB_PIE_AUTOPCT_T,"%.2f%%"]];this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_PIE).appendField(k.Msg.COLOUR_BLEND_RATIO),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_TICKS_TAG),this.appendValueInput("EXPLODE").appendField(k.Msg.mixpy_PYLAB_PIE_EXPLODE),this.appendDummyInput("").appendField(k.Msg.mixpy_PYLAB_PIE_AUTOPCT).appendField(new k.FieldDropdown(t),"autopct"),this.appendDummyInput("").appendField(k.Msg.mixpy_PYLAB_PIE_SHADOW).appendField(new k.FieldDropdown(e),"SHADOW"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},Xt={init:function(){this.setColour(At),this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_HIST).appendField(k.Msg.MIXLY_SD_DATA),this.appendValueInput("B").appendField(k.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_INTERVAL),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},qt={init:function(){this.setColour(At);var e=[[k.Msg.PYLAB_LABEL_X,"x"],[k.Msg.PYLAB_LABEL_Y,"y"]];this.appendDummyInput().appendField(k.Msg.MIXLY_SETTING).appendField(new k.FieldDropdown(e),"DIR"),this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_TICKS).appendField(k.Msg.MIXLY_MICROBIT_JS_I2C_VALUE),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.mixpy_PYLAB_TICKS_TOOLTIP)}},Kt={init:function(){var e=[["sin","sin"],["cos","cos"],["tan","tan"],["arcsin","arcsin"],["arccos","arccos"],["arctan","arctan"],[k.Msg.LANG_MATH_TO_ROUND,"round"],[k.Msg.LANG_MATH_TO_CEIL,"ceil"],[k.Msg.LANG_MATH_TO_FLOOR,"floor"]];this.setColour(At),this.setOutput(!0),this.setInputsInline(!0),this.appendDummyInput().appendField(k.Msg.mixpy_NUMPY_TRIG),this.appendValueInput("NUM").setCheck(Number).appendField(new k.FieldDropdown(e),"OP"),this.setTooltip(k.Msg.mixpy_NUMPY_TRIG_TOOLTIP)}},Zt={init:function(){this.setColour(At),this.appendValueInput("VET").setCheck(Number).appendField(k.Msg.mixpy_SUBPLOT).appendField(k.Msg.mixpy_SUBPLOT_VERTICLE),this.appendValueInput("HOR").setCheck(Number).appendField(k.Msg.mixpy_SUBPLOT_HORIZEN),this.appendValueInput("NUM").setCheck(Number).appendField(k.Msg.mixpy_SUBPLOT_NUM),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_PYTHON_CONTROLS_RANGE_TOOLTIP)}},Qt={init:function(){this.setColour(At),this.appendValueInput("FILENAME").appendField(k.Msg.MIXPY_PANDAS_READ_CSV),this.appendDummyInput().appendField(new k.FieldDropdown([[k.Msg.mixpy_PANDAS_READCSV_HEADER_Y,"0"],[k.Msg.mixpy_PANDAS_READCSV_HEADER_N,"None"]]),"MODE"),this.appendDummyInput().appendField(k.Msg.mixpy_PANDAS_READCSV_TITLE),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.mixpy_PANDAS_READCSV_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Jt={init:function(){this.setColour(At),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(k.Msg.mixpy_DATAFRAME_GET),this.appendDummyInput("").appendField(k.Msg.mixpy_DATAFRAME_GET_INDEX).appendField(new k.FieldDropdown([[k.Msg.DATAFRAME_COLUMN,"column"],[k.Msg.DATAFRAME_RAW,"raw"]]),"MODE"),this.setOutput(!0),this.setTooltip(k.Msg.mixpy_DATAFRAME_GET_TOOLTIP)}},en={init:function(){this.setColour(At),this.appendValueInput("FILE").setCheck(String).appendField(k.Msg.mixpy_PL_SAVEFIG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(k.Msg.mixpy_PL_SAVEFIG_TOOLTIP)}},tn={init:function(){this.setColour(At);var e=[[k.Msg.TEXT_TRIM_LEFT,"right"],[k.Msg.mixpy_PL_TEXT_CENTER,"center"],[k.Msg.TEXT_TRIM_RIGHT,"left"]],t=[[k.Msg.mixpy_PL_TEXT_TOP,"bottom"],[k.Msg.mixpy_PL_TEXT_CENTER,"center"],[k.Msg.mixpy_PL_TEXT_BOTTOM,"top"]];this.appendValueInput("VET").setCheck(Number).appendField(k.Msg.MIXLY_SETTING).appendField(k.Msg.mixpy_PL_TEXT_X),this.appendValueInput("HOR").setCheck(Number).appendField(k.Msg.mixpy_PL_TEXT_Y),this.appendValueInput("NUM").setCheck(Number).appendField(k.Msg.mixpy_PL_TEXT_TAG),this.appendDummyInput("").appendField(k.Msg.mixpy_PL_TEXT_HOR).appendField(new k.FieldDropdown(e),"HALIGN"),this.appendDummyInput("").appendField(k.Msg.mixpy_PL_TEXT_VER).appendField(new k.FieldDropdown(t),"VALIGN"),this.appendValueInput("FONTNUM").setCheck(Number).appendField(k.Msg.MIXLY_TURTLE_WRITE_FONT_NUM),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.mixpy_PL_TEXT_TOOLTIP)}},nn={init:function(){this.setColour(At),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_TOARRAY),this.setOutput(!0,"List"),this.setTooltip(k.Msg.MIXLY_PYTHON_TOOLTIP_TOARRAY)}},rn={init:function(){this.setColour(At),this.appendValueInput("SER").setCheck("Series").appendField(k.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_PLOT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},sn={init:function(){this.setColour(At);var e=[[k.Msg.blockpy_PYLAB_PLOT_LINE_SOLID,"-"],[k.Msg.blockpy_PYLAB_PLOT_LINE_DOTTED,"--"],[k.Msg.blockpy_PYLAB_PLOT_LINE_CHAIN,"-."],[k.Msg.blockpy_PYLAB_PLOT_LINE_POINT_DOTTED,":"],[k.Msg.MIXLY_MICROBIT_JS_INOUT_PULL_NONE,""]],t=[[k.Msg.COLOUR_RGB_BLUE,"b"],[k.Msg.COLOUR_RGB_GREEN,"g"],[k.Msg.COLOUR_RGB_RED,"r"],[k.Msg.COLOUR_CYAN,"c"],[k.Msg.COLOUR_MAGENTA,"m"],[k.Msg.COLOUR_YELLOW,"y"],[k.Msg.COLOUR_BLACK,"k"],[k.Msg.COLOUR_WHITE,"w"]],n=[[k.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[k.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[k.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_DOWN,"v"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_UP,"^"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_LEFT,"<"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_RIGHT,">"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_UP,"1"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_DOWN,"2"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_LEFT,"3"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_RIGHT,"4"],[k.Msg.blockpy_PYLAB_PLOT_DOT_SQUARE,"s"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PENTAGON,"p"],[k.Msg.blockpy_PYLAB_PLOT_DOT_STAR,"*"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_VERTICAL,"h"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_HORIZONTAL,"H"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PLUS,"+"],[k.Msg.blockpy_PYLAB_PLOT_DOT_CROSS,"x"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND,"D"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND_SMALL,"d"],[k.Msg.blockpy_PYLAB_PLOT_DOT_VERTICAL,"|"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HORIZONTAL,"_"]];this.appendValueInput("SER").setCheck("Series").appendField(k.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_PLOT),this.appendDummyInput("").appendField(k.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new k.FieldDropdown(n),"DOT"),this.appendDummyInput("").appendField(k.Msg.blockpy_PYLAB_PLOT_LINE).appendField(new k.FieldDropdown(e),"LINE"),this.appendDummyInput("").appendField(k.Msg.HTML_COLOUR).appendField(new k.FieldDropdown(t),"COLOR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},on={init:function(){this.setColour(At),this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_SHOW),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},an={init:function(){this.setColour(At),this.appendDummyInput().appendField(k.Msg.mixpy_PL_AXES),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ln={init:function(){this.setColour(At),this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_LEGEND),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},un={init:function(){this.setColour(At),this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_TITLE),this.appendValueInput("TITLE").setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},cn={init:function(){this.setColour(At);var e=[[k.Msg.PYLAB_LABEL_X,"x"],[k.Msg.PYLAB_LABEL_Y,"y"]];this.appendDummyInput().appendField(k.Msg.blockpy_PYLAB_SET_LABEL).appendField(new k.FieldDropdown(e),"DIR"),this.appendValueInput("LABEL").appendField(k.Msg.blockpy_PYLAB_LABEL).setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},dn={init:function(){this.setColour(At);var e=[[k.Msg.mixpy_PYLAB_PLOT_BAR_PLOT,"plot"],[k.Msg.mixpy_PYLAB_PLOT_BAR_BAR,"bar"]];this.appendDummyInput().appendField(k.Msg.MIXLY_DISPLAY_DRAW).appendField(new k.FieldDropdown(e),"DIR"),this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_PLOT_Y),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{plot:k.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP,bar:k.Msg.mixpy_PYLAB_PLOT_BAR_EASY_TOOLTIP}[e]})}},hn={init:function(){this.setColour(At);var e=[[k.Msg.COLOUR_RGB_BLUE,"b"],[k.Msg.COLOUR_RGB_GREEN,"g"],[k.Msg.COLOUR_RGB_RED,"r"],[k.Msg.COLOUR_CYAN,"c"],[k.Msg.COLOUR_MAGENTA,"m"],[k.Msg.COLOUR_YELLOW,"y"],[k.Msg.COLOUR_BLACK,"k"],[k.Msg.COLOUR_WHITE,"w"]],t=[[k.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[k.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[k.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_DOWN,"v"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_UP,"^"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_LEFT,"<"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_RIGHT,">"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_UP,"1"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_DOWN,"2"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_LEFT,"3"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_RIGHT,"4"],[k.Msg.blockpy_PYLAB_PLOT_DOT_SQUARE,"s"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PENTAGON,"p"],[k.Msg.blockpy_PYLAB_PLOT_DOT_STAR,"*"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_VERTICAL,"h"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_HORIZONTAL,"H"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PLUS,"+"],[k.Msg.blockpy_PYLAB_PLOT_DOT_CROSS,"x"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND,"D"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND_SMALL,"d"],[k.Msg.blockpy_PYLAB_PLOT_DOT_VERTICAL,"|"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HORIZONTAL,"_"]];this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_SCATTER).appendField(k.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_PLOT_Y),this.appendValueInput("S").appendField(k.Msg.MIXLY_MICROBIT_JS_NUMBER),this.appendDummyInput("").appendField(k.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new k.FieldDropdown(t),"DOT"),this.appendDummyInput("").appendField(k.Msg.HTML_COLOUR).appendField(new k.FieldDropdown(e),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(k.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},pn={init:function(){this.setColour(At);var e=[[k.Msg.blockpy_PYLAB_PLOT_LINE_SOLID,"-"],[k.Msg.blockpy_PYLAB_PLOT_LINE_DOTTED,"--"],[k.Msg.blockpy_PYLAB_PLOT_LINE_CHAIN,"-."],[k.Msg.blockpy_PYLAB_PLOT_LINE_POINT_DOTTED,":"],[k.Msg.MIXLY_MICROBIT_JS_INOUT_PULL_NONE,""]],t=[[k.Msg.COLOUR_RGB_BLUE,"b"],[k.Msg.COLOUR_RGB_GREEN,"g"],[k.Msg.COLOUR_RGB_RED,"r"],[k.Msg.COLOUR_CYAN,"c"],[k.Msg.COLOUR_MAGENTA,"m"],[k.Msg.COLOUR_YELLOW,"y"],[k.Msg.COLOUR_BLACK,"k"],[k.Msg.COLOUR_WHITE,"w"]],n=[[k.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[k.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[k.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_DOWN,"v"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_UP,"^"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_LEFT,"<"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_RIGHT,">"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_UP,"1"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_DOWN,"2"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_LEFT,"3"],[k.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_RIGHT,"4"],[k.Msg.blockpy_PYLAB_PLOT_DOT_SQUARE,"s"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PENTAGON,"p"],[k.Msg.blockpy_PYLAB_PLOT_DOT_STAR,"*"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_VERTICAL,"h"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_HORIZONTAL,"H"],[k.Msg.blockpy_PYLAB_PLOT_DOT_PLUS,"+"],[k.Msg.blockpy_PYLAB_PLOT_DOT_CROSS,"x"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND,"D"],[k.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND_SMALL,"d"],[k.Msg.blockpy_PYLAB_PLOT_DOT_VERTICAL,"|"],[k.Msg.blockpy_PYLAB_PLOT_DOT_HORIZONTAL,"_"]];this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_PLOT_XY).appendField(k.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_PLOT_Y),this.appendDummyInput("").appendField(k.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new k.FieldDropdown(n),"DOT"),this.appendDummyInput("").appendField(k.Msg.blockpy_PYLAB_PLOT_LINE).appendField(new k.FieldDropdown(e),"LINE"),this.appendDummyInput("").appendField(k.Msg.HTML_COLOUR).appendField(new k.FieldDropdown(t),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(k.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},fn={init:function(){this.setColour(At);var e=[[k.Msg.MIXLY_TURTLE_WRITE_ALIGN_CENTER,"center"],[k.Msg.AILGN_EDGE,"edge"]];this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_BAR).appendField(k.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_PLOT_Y),this.appendValueInput("WIDTH").setCheck(Number).appendField(k.Msg.MIXLY_WIDTH),this.appendDummyInput("").appendField(k.Msg.mixpy_PYLAB_BAR_ALIGN).appendField(new k.FieldDropdown(e),"ALIGN"),this.appendDummyInput().appendField(k.Msg.HTML_COLOUR).appendField(new k.FieldColour("#0000ff"),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(k.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},mn={init:function(){this.setColour(At);var e=[[k.Msg.mixpy_PL_PIE_SHADOW_N,"False"],[k.Msg.mixpy_PL_PIE_SHADOW_Y,"True"]],t=[[k.Msg.mixpy_PL_PIE_SHADOW_N,"None"],[k.Msg.mixpy_PYLAB_PIE_AUTOPCT_Z,"%.0f%%"],[k.Msg.mixpy_PYLAB_PIE_AUTOPCT_O,"%.1f%%"],[k.Msg.mixpy_PYLAB_PIE_AUTOPCT_T,"%.2f%%"]];this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_PIE).appendField(k.Msg.COLOUR_BLEND_RATIO),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_TICKS_TAG),this.appendValueInput("EXPLODE").appendField(k.Msg.mixpy_PYLAB_PIE_EXPLODE),this.appendDummyInput("").appendField(k.Msg.mixpy_PYLAB_PIE_AUTOPCT).appendField(new k.FieldDropdown(t),"autopct"),this.appendDummyInput("").appendField(k.Msg.mixpy_PYLAB_PIE_SHADOW).appendField(new k.FieldDropdown(e),"SHADOW"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},gn={init:function(){this.setColour(At),this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_HIST).appendField(k.Msg.MIXLY_SD_DATA),this.appendValueInput("B").appendField(k.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_INTERVAL),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},yn={init:function(){this.setColour(At);var e=[[k.Msg.PYLAB_LABEL_X,"x"],[k.Msg.PYLAB_LABEL_Y,"y"]];this.appendDummyInput().appendField(k.Msg.MIXLY_SETTING).appendField(new k.FieldDropdown(e),"DIR"),this.appendValueInput("A").appendField(k.Msg.mixpy_PYLAB_TICKS).appendField(k.Msg.MIXLY_MICROBIT_JS_I2C_VALUE),this.appendValueInput("B").appendField(k.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.mixpy_PYLAB_TICKS_TOOLTIP)}},_n={init:function(){this.setColour(At),this.appendValueInput("VET").setCheck(Number).appendField(k.Msg.mixpy_SUBPLOT).appendField(k.Msg.mixpy_SUBPLOT_VERTICLE),this.appendValueInput("HOR").setCheck(Number).appendField(k.Msg.mixpy_SUBPLOT_HORIZEN),this.appendValueInput("NUM").setCheck(Number).appendField(k.Msg.mixpy_SUBPLOT_NUM),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_PYTHON_CONTROLS_RANGE_TOOLTIP)}},vn={init:function(){this.setColour(At),this.appendDummyInput("").appendField(k.Msg.mixpy_PL_SAVEFIG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(k.Msg.mixpy_PL_SAVEFIG_TOOLTIP)}},bn={init:function(){this.setColour(At);var e=[[k.Msg.TEXT_TRIM_LEFT,"right"],[k.Msg.mixpy_PL_TEXT_CENTER,"center"],[k.Msg.TEXT_TRIM_RIGHT,"left"]],t=[[k.Msg.mixpy_PL_TEXT_TOP,"bottom"],[k.Msg.mixpy_PL_TEXT_CENTER,"center"],[k.Msg.mixpy_PL_TEXT_BOTTOM,"top"]];this.appendValueInput("VET").setCheck(Number).appendField(k.Msg.MIXLY_SETTING).appendField(k.Msg.mixpy_PL_TEXT_X),this.appendValueInput("HOR").setCheck(Number).appendField(k.Msg.mixpy_PL_TEXT_Y),this.appendValueInput("NUM").setCheck(Number).appendField(k.Msg.mixpy_PL_TEXT_TAG),this.appendDummyInput("").appendField(k.Msg.mixpy_PL_TEXT_HOR).appendField(new k.FieldDropdown(e),"HALIGN"),this.appendDummyInput("").appendField(k.Msg.mixpy_PL_TEXT_VER).appendField(new k.FieldDropdown(t),"VALIGN"),this.appendValueInput("FONTNUM").setCheck(Number).appendField(k.Msg.MIXLY_TURTLE_WRITE_FONT_NUM),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.mixpy_PL_TEXT_TOOLTIP)}},Tn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("获取维度"),this.setOutput(!0),this.setTooltip("Returns the shape of the array.")}},xn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("变形"),this.appendValueInput("DIMENSIONS").appendField("后维度为"),this.setOutput(!0),this.setTooltip("Reshapes the array to the specified dimensions.")}},En={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("把"),this.appendDummyInput().appendField("转换为").appendField(new k.FieldDropdown([["uint8","numpy.uint8"],["int32","numpy.int32"],["float32","numpy.float32"],["float64","numpy.float64"]]),"TYPE"),this.setOutput(!0),this.setTooltip("Converts array to specified type.")}},wn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("创建二维图"),this.appendDummyInput().appendField("颜色").appendField(new k.FieldDropdown([["gray","gray"],["viridis","viridis"],["plasma","plasma"],["inferno","inferno"],["magma","magma"],["cividis","cividis"],["hot","hot"],["cool","cool"],["spring","spring"],["summer","summer"],["autumn","autumn"],["winter","winter"],["jet","jet"]]),"COLORMAP"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip("Displays an image with the specified colormap.")}},In={init:function(){this.setColour(At),this.appendValueInput("X").appendField("从数据集"),this.appendValueInput("Y").appendField("获取平均图像,标签"),this.appendValueInput("DIGIT").appendField("为"),this.setOutput(!0),this.setTooltip("Computes the mean of X where y equals the specified digit.")}},An={init:function(){this.setColour(At),this.appendValueInput("IMAGE").appendField("获取模板匹配结果,图片:"),this.appendValueInput("TEMPLATES").appendField("模板:"),this.setOutput(!0),this.setTooltip("Finds the index of the template that minimizes the sum of absolute differences with the image.")}},Sn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("获取平均值"),this.appendDummyInput().appendField("沿着axis").appendField(new k.FieldDropdown([["None","NONE"],["0","0"],["1","1"]]),"AXIS"),this.setOutput(!0),this.setTooltip("Computes the mean of the array along the specified axis.")}},Cn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("获取标准差"),this.appendDummyInput().appendField("沿着axis").appendField(new k.FieldDropdown([["None","NONE"],["0","0"],["1","1"]]),"AXIS"),this.setOutput(!0),this.setTooltip("Computes the standard deviation of the array along the specified axis.")}},On={init:function(){this.setColour(At),this.appendValueInput("DF").appendField("丢弃缺省值"),this.setOutput(!0),this.setTooltip("Drops rows with NaN values from the dataframe.")}},Mn={init:function(){this.setColour(At),this.appendValueInput("DATAFRAME").appendField("从数据集"),this.appendValueInput("COLUMNS").appendField("中删除列").setCheck(String),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip("从数据框中删除指定的列。用逗号分隔多个列名。")}},Rn={init:function(){this.setColour(At),this.appendValueInput("NUM").appendField("生成单位行向量"),this.setOutput(!0),this.setTooltip("Creates an array of ones with the specified length.")}},kn={init:function(){this.setColour(At),this.appendValueInput("ARRAY1").appendField("列拼接数组1"),this.appendValueInput("ARRAY2").appendField("数组2"),this.setOutput(!0),this.setTooltip("Concatenates two arrays along the second axis using numpy.c_.")}},Nn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("获取行列式"),this.setOutput(!0),this.setTooltip("Computes the determinant of an array using numpy.linalg.det.")}},Dn={init:function(){this.setColour(At),this.appendValueInput("MATRIX").appendField("获取转置"),this.setOutput(!0),this.setTooltip("Computes the transpose of the given matrix.")}},Fn={init:function(){this.setColour(At),this.appendValueInput("MATRIX1"),this.appendValueInput("MATRIX2").appendField("@"),this.setOutput(!0),this.setTooltip("Multiplies two matrices.")}},Ln={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("获取逆矩阵"),this.setOutput(!0),this.setTooltip("Computes the inverse of the given matrix using numpy.linalg.inv.")}},Pn={init:function(){this.setColour(At),this.appendValueInput("DATAFRAME").appendField("获取中位数"),this.setOutput(!0),this.setTooltip("Computes the median of the given dataframe.")}},Bn={init:function(){this.setColour(At),this.appendValueInput("DATAFRAME").appendField("填充缺失值"),this.appendValueInput("VALUE").appendField("填充值"),this.appendDummyInput().appendField("是否修改原数据").appendField(new k.FieldDropdown([["True","True"],["False","False"]]),"INPLACE"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip("Fills NaN values in the dataframe with the specified value.")}},$n={init:function(){this.setColour(At),this.appendValueInput("DATAFRAME").appendField("获取DataFrame信息"),this.setOutput(!0),this.setTooltip("Displays information about the DataFrame.")}},Un={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("获取最小值"),this.appendDummyInput().appendField("沿着axis").appendField(new k.FieldDropdown([["None","None"],["行","0"],["列","1"]]),"AXIS"),this.setOutput(!0),this.setTooltip("Returns the minimum value along the specified axis.")}},zn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("获取最大值"),this.appendDummyInput().appendField("沿着axis").appendField(new k.FieldDropdown([["None","None"],["行","0"],["列","1"]]),"AXIS"),this.setOutput(!0),this.setTooltip("Returns the maximum value along the specified axis.")}},Vn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("获取数组大小"),this.setOutput(!0),this.setTooltip("Returns the size of the array.")}},jn={init:function(){this.setColour(At),this.appendValueInput("ARRAY1").appendField("点乘数组1"),this.appendValueInput("ARRAY2").appendField("点乘数组2"),this.setOutput(!0),this.setTooltip("Returns the dot product of two arrays.")}},Yn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("获取平方数组"),this.setOutput(!0),this.setTooltip("Returns the element-wise square of the array.")}},Gn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("获取数组元素和"),this.setOutput(!0),this.setTooltip("Returns the sum of the array.")}},Hn={init:function(){this.setColour(At),this.appendValueInput("SIZE").appendField("生成随机数组"),this.setOutput(!0),this.setTooltip("Returns a random array of the specified size.")}},Wn={init:function(){this.setColour(At),this.appendValueInput("ARRAY").appendField("Python求和"),this.setOutput(!0),this.setTooltip("Returns the sum of the iterable.")}},Xn={init:function(){this.setColour(At),this.appendValueInput("DICT").setAlign(k.inputs.Align.RIGHT).setCheck("Dict"),this.appendDummyInput().setAlign(k.inputs.Align.RIGHT).appendField("值排序"),this.appendValueInput("KEY").setAlign(k.inputs.Align.RIGHT).appendField("标签"),this.appendDummyInput().setAlign(k.inputs.Align.RIGHT).appendField("排序方式").appendField(new k.FieldDropdown([["升序","True"],["降序","False"]]),"AS_CENDING"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip("")}},qn={init:function(){this.setColour(At),this.appendValueInput("DICT").setAlign(k.inputs.Align.RIGHT).setCheck("Dict"),this.appendDummyInput().setAlign(k.inputs.Align.RIGHT).appendField("获取").appendField(new k.FieldDropdown([["前几行","head"],["最后几行","tail"]]),"TYPE"),this.appendValueInput("LINES").setAlign(k.inputs.Align.RIGHT).appendField("行数"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip("")}},Kn={init:function(){this.setColour(At),this.appendValueInput("DICT").setAlign(k.inputs.Align.RIGHT).setCheck("Dict"),this.appendDummyInput().setAlign(k.inputs.Align.RIGHT).appendField("筛选数据"),this.appendValueInput("KEY").setAlign(k.inputs.Align.RIGHT).appendField("满足条件"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip("")}},Zn={init:function(){this.setColour(At),this.appendValueInput("DICT").setAlign(k.inputs.Align.RIGHT).setCheck("Dict"),this.appendValueInput("KEY").setAlign(k.inputs.Align.RIGHT).appendField("通过标签"),this.appendDummyInput().setAlign(k.inputs.Align.RIGHT).appendField("分组"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip("")}},Qn={init:function(){this.setColour(At),this.appendDummyInput().setAlign(k.inputs.Align.RIGHT).appendField(new k.FieldDropdown([["求最小值","min"],["求最大值","max"],["求和","sum"],["求平均值","mean"],["求中位数","median"],["求标准差","std"]]),"TYPE"),this.appendValueInput("DICT").setAlign(k.inputs.Align.RIGHT).setCheck("Dict"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip("")}},Jn={init:function(){this.setColour(At),this.appendDummyInput().appendField("清除已有图像"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ei=80,ti={init:function(){this.setColour(ei),this.appendDummyInput("").appendField(new k.FieldLabel(k.Msg.DS_CREATE_LINKEDLIST_NEW)),this.appendDummyInput("").appendField(new k.FieldLabel(k.Msg.DS_CREATE_LINKEDLIST_HEAD)).appendField(new k.FieldTextInput("head"),"VAR"),this.appendDummyInput("").appendField(new k.FieldLabel(k.Msg.DS_CREATE_LINKEDLIST_TYPE)).appendField(new k.FieldTextInput("tag"),"TYPE"),this.appendDummyInput().appendField(k.Msg.DS_CREATE_LINKEDLIST_ATTRIBUTE),this.itemCount_=1,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new k.icons.MutatorIcon(["ds_create_linkedlist_item"],this)),this.setTooltip(k.Msg.DS_CREATE_LINKEDLIST_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("ds_create_linkedlist_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("ds_create_linkedlist_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){this.getInput("EMPTY")&&this.removeInput("EMPTY");for(var e=[],t=0;this.getInput("ADD"+t);t++)e.push(this.getFieldValue("KEY"+t)),this.removeInput("ADD"+t);for(t=0;t<this.itemCount_;t++)this.appendValueInput("ADD"+t).setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(new k.FieldTextInput(e.length>t?e[t]:"name"),"KEY"+t).appendField("=")},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},ni={init:function(){this.setColour(ei),this.appendDummyInput().appendField(k.Msg.DS_CREATE_LINKEDLIST_CONTAINER_TITLE),this.appendStatementInput("STACK"),this.setTooltip(k.Msg.DS_CREATE_LINKEDLIST_CONTAINER_TOOLTIP),this.contextMenu=!1}},ii={init:function(){this.setColour(ei),this.appendDummyInput().appendField(k.Msg.DS_CREATE_LINKEDLIST_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.DS_CREATE_LINKEDLIST_ITEM_TOOLTIP),this.contextMenu=!1}},ri={init:function(){this.setColour(ei),this.appendDummyInput("").appendField(k.Msg.DS_CREATE_NODE_USE).appendField(new k.FieldTextInput("tag"),"TYPE"),this.appendDummyInput("").appendField(k.Msg.DS_CREATE_NODE_NEW),this.appendValueInput("NODE"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.DS_CREATE_NODE_TOOLTIP)}},si={init:function(){this.setColour(ei),this.appendDummyInput("").appendField(k.Msg.DS_GET_NODE_ATTR_NODE),this.appendValueInput("NODE"),this.appendDummyInput("").appendField(k.Msg.MIXLY_AIP_ATTR).appendField(new k.FieldTextInput("name"),"TYPE"),this.appendDummyInput("").appendField(k.Msg.DICTS_ADD_VALUE),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.DS_GET_NODE_ATTR_TOOLTIP)}},oi={init:function(){this.setColour(ei),this.appendDummyInput("").appendField(k.Msg.DS_SET_NODE_ATTR_NODE),this.appendValueInput("NODE"),this.appendDummyInput("").appendField(k.Msg.MIXLY_AIP_ATTR).appendField(new k.FieldTextInput("name"),"TYPE"),this.appendValueInput("VAR").appendField(k.Msg.DS_SET_NODE_ATTR_SET),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.DS_SET_NODE_ATTR_TOOLTIP)}},ai={init:function(){this.setColour(ei),this.appendValueInput("NODE").appendField(k.Msg.DS_ADD_NODE_HEAD_NODE);var e=[[k.Msg.DS_ADD_NODE_BEFORE,"before"],[k.Msg.DS_ADD_NODE_AFTER,"after"]];this.appendDummyInput("").appendField(k.Msg.DS_ADD_NODE_LINKEDLIST),this.appendValueInput("NODE2").appendField(k.Msg.DS_SET_NODE_ATTR_NODE),this.appendValueInput("NODE3").appendField(new k.FieldDropdown(e),"DIR").appendField(k.Msg.DS_ADD_NODE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.DS_ADD_NODE_TOOLTIP)}},li={init:function(){this.setColour(ei),this.appendValueInput("NODE").appendField(k.Msg.DS_ADD_NODE_HEAD_NODE);var e=[[k.Msg.DS_ADD_NODE_BEFORE,"before"],[k.Msg.DS_ADD_NODE_AFTER,"after"]];this.appendDummyInput("").appendField(k.Msg.DS_ADD_NODE_LINKEDLIST),this.appendDummyInput("").appendField(k.Msg.DS_CREATE_LINKEDLIST_ITEM_TITLE).appendField(new k.FieldTextInput("name"),"TYPE"),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_AS),this.appendDummyInput("").appendField(k.Msg.DS_ADD_NODE_ATTR),this.appendValueInput("NODE3").appendField(new k.FieldDropdown(e),"DIR").appendField(k.Msg.DS_ADD_NODE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.DS_ADD_NODE_TOOLTIP)}},ui={init:function(){this.setColour(ei),this.appendValueInput("NODE").appendField(k.Msg.DS_ADD_NODE_HEAD_NODE),this.appendDummyInput("").appendField(k.Msg.DS_ADD_NODE_LINKEDLIST),this.appendValueInput("NODE2").appendField(k.Msg.DS_DEL_NODE_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.DS_DEL_NODE_TOOLTIP)}},ci={init:function(){this.setColour(ei),this.appendValueInput("NODE").appendField(k.Msg.DS_ADD_NODE_HEAD_NODE),this.appendDummyInput("").appendField(k.Msg.DS_ADD_NODE_LINKEDLIST),this.appendDummyInput("").appendField(k.Msg.DS_DEL_NODE_ATTR).appendField(new k.FieldTextInput("name"),"TYPE"),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_AS),this.appendDummyInput("").appendField(k.Msg.DS_ADD_NODE_ATTR),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.DS_DEL_NODE_TOOLTIP)}},di={init:function(){this.setColour(ei),this.appendValueInput("NODE").appendField(k.Msg.DS_ADD_NODE_HEAD_NODE),this.appendDummyInput("").appendField(k.Msg.DS_REVERSE_LINKEDLIST),this.appendValueInput("NODE2").appendField(k.Msg.DS_REVERSE_LINKEDLIST_NEW_HEAD),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.DS_DEL_NODE_TOOLTIP)}},hi="#777777",pi={init:function(){this.setColour(hi),this.appendDummyInput("").appendField("from ").appendField(new k.FieldTextInput("ESP32"),"path").appendField(" import ").appendField(new k.FieldTextInput("*"),"module"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},fi={init:function(){this.setColour(hi),this.appendDummyInput("").appendField("import ").appendField(new k.FieldTextInput("module"),"module"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},mi={init:function(){this.setColour(hi),this.appendDummyInput("").appendField(new k.FieldTextInput("my_function"),"NAME"),this.itemCount_=1,this.arguments_=["x"],this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new k.icons.MutatorIcon(["factory_create_with_item"],this))},mutationToDom:function(){var e=document.createElement("mutation");e.setAttribute("items",this.itemCount_);for(var t=0;t<this.arguments_.length;t++){var n=document.createElement("arg");n.setAttribute("name",this.arguments_[t]),e.appendChild(n)}return e},domToMutation:function(e){this.arguments_=[];for(var t=0;e.childNodes[t];t++){let n=e.childNodes[t];"arg"==n.nodeName.toLowerCase()&&this.arguments_.push(n.getAttribute("name"))}this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("factory_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("factory_create_with_item");r.initSvg(),r.setFieldValue(this.arguments_[i],"NAME"),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){this.arguments_=[];for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)this.arguments_.push(t.getFieldValue("NAME")),n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;for(e=0;e<this.itemCount_;e++)this.appendValueInput("ADD"+e).setAlign(k.inputs.Align.RIGHT).appendField(this.arguments_[e])}},gi={init:function(){this.setColour(hi),this.appendDummyInput().appendField(k.Msg.MIXLY_PARAMS),this.appendStatementInput("STACK"),this.contextMenu=!1}},yi={init:function(){this.setColour(hi),this.appendDummyInput().appendField(k.Msg.LISTS_CREATE_WITH_ITEM_TITLE+":").appendField(new k.FieldTextInput("x"),"NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.contextMenu=!1}},_i={init:function(){this.setColour(hi),this.appendDummyInput("").appendField(new k.FieldTextInput("my_function"),"NAME"),this.itemCount_=1,this.arguments_=["x"],this.updateShape_(),this.setOutput(!0),this.setMutator(new k.icons.MutatorIcon(["factory_create_with_item"],this))},mutationToDom:mi.mutationToDom,domToMutation:mi.domToMutation,decompose:mi.decompose,compose:mi.compose,saveConnections:mi.saveConnections,updateShape_:mi.updateShape_},vi={init:function(){this.setColour(hi),this.appendDummyInput("").appendField(new k.FieldTextInput("test"),"NAME").appendField("=").appendField(new k.FieldTextInput("Test"),"TYPE").appendField("()"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},bi={init:function(){this.setColour(hi),this.appendDummyInput("").appendField(new k.FieldTextInput("test"),"NAME").appendField(".").appendField(new k.FieldTextInput("callMethod"),"METHOD"),this.itemCount_=1,this.arguments_=["x"],this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new k.icons.MutatorIcon(["factory_create_with_item"],this))},mutationToDom:mi.mutationToDom,domToMutation:mi.domToMutation,decompose:mi.decompose,compose:mi.compose,saveConnections:mi.saveConnections,updateShape_:mi.updateShape_},Ti={init:function(){this.setColour(hi),this.appendDummyInput("").appendField(new k.FieldTextInput("test"),"NAME").appendField(".").appendField(new k.FieldTextInput("callMethod"),"METHOD"),this.itemCount_=1,this.arguments_=["x"],this.updateShape_(),this.setOutput(!0),this.setMutator(new k.icons.MutatorIcon(["factory_create_with_item"],this))},mutationToDom:mi.mutationToDom,domToMutation:mi.domToMutation,decompose:mi.decompose,compose:mi.compose,saveConnections:mi.saveConnections,updateShape_:mi.updateShape_},xi={init:function(){this.setColour(hi),this.appendDummyInput("").appendField(new k.FieldTextInput('display.scroll("Hello World!")'),"VALUE"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ei={init:function(){this.setColour(hi),this.appendDummyInput("").appendField(new k.FieldTextInput("test"),"VALUE"),this.setOutput(!0)}},wi={init:function(){this.setColour(hi),this.appendDummyInput("").appendField(new k.FieldMultilineInput('display.scroll("Hello World!")\ndisplay.scroll("Hello Mixly!")'),"VALUE"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ii={init:function(){this.setColour(hi),this.appendDummyInput("").appendField(new k.FieldMultilineInput("Hello\nMixly"),"VALUE"),this.setOutput(!0)}},Ai=40,Si={init:function(){this.setColour(Ai),this.appendDummyInput("").appendField(k.Msg.MIXLY_HARDWARE),this.appendValueInput("SUB").setCheck("var"),this.appendDummyInput().appendField(k.Msg.MIXLY_HARDWARE_START),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Ci={init:function(){this.setColour(Ai),this.appendDummyInput("").appendField(new k.FieldDropdown([[k.Msg.MIXLY_HIGH,"HIGH"],[k.Msg.MIXLY_LOW,"LOW"]]),"BOOL"),this.setOutput(!0,Boolean),this.setTooltip(k.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW)}},Oi={init:function(){this.setColour(Ai),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_HARDWARE).setCheck("var"),this.appendValueInput("PIN",Number).appendField(k.Msg.MIXLY_Digital_PINMODEOUT).appendField(k.Msg.MIXLY_PIN).setCheck(Number),this.appendValueInput("STAT").appendField(k.Msg.MIXLY_STAT).setCheck([Number,Boolean]),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(k.Msg.LANG_INOUT_DIGITAL_WRITE_TOOLTIP)}},Mi={init:function(){this.setColour(Ai),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_HARDWARE).setCheck("var"),this.appendValueInput("PIN",Number).appendField(k.Msg.MIXLY_Digital_PINMODEIN).appendField(k.Msg.MIXLY_PIN).setCheck(Number),this.appendDummyInput().appendField(k.Msg.MIXLY_ESP32_MACHINE_VALUE),this.setInputsInline(!0),this.setOutput(!0,[Boolean,Number]),this.setTooltip(k.Msg.MIXLY_TOOLTIP_INOUT_DIGITAL_READ)}},Ri={init:function(){this.setColour(Ai),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_HARDWARE).setCheck("var"),this.appendValueInput("PIN",Number).appendField(k.Msg.MIXLY_Analog_PINMODEOUT).appendField(k.Msg.MIXLY_PIN).setCheck(Number),this.appendValueInput("NUM",Number).appendField(k.Msg.MIXLY_VALUE2).setCheck(Number),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_TOOLTIP_INOUT_ANALOG_WRITE)}},ki={init:function(){this.setColour(Ai),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_HARDWARE).setCheck("var"),this.appendValueInput("PIN",Number).appendField(k.Msg.MIXLY_Analog_PINMODEIN).appendField(k.Msg.MIXLY_PIN).setCheck(Number),this.appendDummyInput().appendField(k.Msg.MIXLY_ESP32_MACHINE_VALUE),this.setInputsInline(!0),this.setOutput(!0,[Boolean,Number]),this.setTooltip(k.Msg.MIXLY_TOOLTIP_INOUT_ANALOG_READ)}},Ni={init:function(){this.setColour(20),this.appendValueInput("VAR").appendField(k.Msg.blockpy_inout_raw_input).setCheck(String),this.setOutput(!0),this.setTooltip(k.Msg.INOUT_input_TOOLTIP)}},Di={init:function(){this.setColour(20),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_SERIAL_PRINTLN),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(k.Msg.BLOCKPY_PRINT_TOOLTIP)}},Fi={init:function(){this.setColour(20),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_SERIAL_PRINT),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(k.Msg.TEXT_PRINT_TOOLTIP)}},Li={init:function(){this.setColour(20),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_SERIAL_PRINT),this.appendValueInput("END").appendField(k.Msg.MIXLY_ENDSWITH),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_PYTHON_INOUT_PRINT_END_TOOLTIP)}},Pi={init:function(){var e=[[k.Msg.LANG_MATH_STRING,"str"],[k.Msg.LANG_MATH_INT,"int"],[k.Msg.LANG_MATH_FLOAT,"float"]];this.setColour(20),this.appendDummyInput("").appendField(k.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new k.FieldDropdown(e),"DIR"),this.appendValueInput("VAR").appendField(k.Msg.PROCEDURES_MUTATORCONTAINER_TITLE).setCheck(String),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{str:k.Msg.MIXLY_MIXPY_INOUT_STR_INPUT_TOOLTIP,int:k.Msg.MIXLY_MIXPY_INOUT_INT_INPUT_TOOLTIP,float:k.Msg.MIXLY_MIXPY_INOUT_FLOAT_INPUT_TOOLTIP}[e]})}},Bi={init:function(){var e=[[k.Msg.LANG_MATH_STRING,"str"],[k.Msg.LANG_MATH_INT,"int"],[k.Msg.LANG_MATH_FLOAT,"float"]];this.setColour(20),this.appendDummyInput("").appendField(k.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new k.FieldDropdown(e),"DIR"),this.appendValueInput("VAR").appendField(k.Msg.PROCEDURES_MUTATORCONTAINER_TITLE).setCheck(String),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{str:k.Msg.MIXLY_MIXPY_INOUT_STR_INPUT_TOOLTIP,int:k.Msg.MIXLY_MIXPY_INOUT_INT_INPUT_TOOLTIP,float:k.Msg.MIXLY_MIXPY_INOUT_FLOAT_INPUT_TOOLTIP}[e]})}},$i={init:function(){this.setColour(20),this.itemCount_=2,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setMutator(new k.icons.MutatorIcon(["inout_print_item"],this)),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("inout_print_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("inout_print_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(k.Msg.MIXLY_MIXPY_INOUT_PRINT_EMPTY);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(k.Msg.MIXLY_SERIAL_PRINTLN)}}},Ui={init:function(){this.setColour(20),this.appendDummyInput().appendField(k.Msg.MIXLY_SERIAL_PRINTLN),this.appendStatementInput("STACK"),this.setTooltip(k.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_CONTAINER_TOOLTIP),this.contextMenu=!1}},zi={init:function(){this.setColour(20),this.appendDummyInput().appendField(k.Msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_ITEM_TOOLTIP),this.contextMenu=!1}};var Vi=n(64548);const ji="#526FC3",Yi={init:function(){this.setColour("#78AAE0"),this.appendValueInput("VAR").setCheck("var").appendField("OneNET"+k.Msg.TUPLE_JOIN),this.appendValueInput("CLIENT").setCheck(String).appendField(k.Msg.MIXLY_ESP32_ONENET_CLIENT),this.appendValueInput("SERVER").setCheck(String).appendField(k.Msg.MIXLY_ESP32_ONENET_SERVER),this.appendValueInput("USERNAME").setCheck(String).appendField(k.Msg.MIXLY_ESP32_ONENET_USERNAME),this.appendValueInput("PASSWORD").setCheck(String).appendField(k.Msg.MIXLY_ESP32_ONENET_PASSWORD),this.appendValueInput("TOPIC").setCheck(String).appendField(k.Msg.MIXLY_ESP32_ONENET_TOPIC),this.appendValueInput("SUB").appendField(k.Msg.MIXLY_ESP32_ONENET_SUB),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_ESP32_IOT_ONENET_CONNECT_TOOLTIP)}},Gi={init:function(){this.setColour("#78AAE0"),this.appendValueInput("VAR").setCheck("var").appendField("OneNET"),this.appendDummyInput().appendField(k.Msg.MIXLY_ESP32_DISCONNECT_ONENET),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_ESP32_IOT_ONENET_DISCONNECT_TOOLTIP)}},Hi={init:function(){this.setColour("#78AAE0"),this.appendValueInput("VAR").setCheck("var").appendField("OneNET"),this.appendDummyInput().appendField(k.Msg.MIXLY_ESP32_CHECK_ONENET),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_ESP32_IOT_ONENET_CHECK_TOOLTIP)}},Wi={init:function(){this.setColour("#78AAE0"),this.appendValueInput("VAR").setCheck("var").appendField("OneNET"),this.appendValueInput("DICT").appendField(k.Msg.MIXLY_ESP32_PUBLISH_ONENET),this.appendDummyInput().appendField(k.Msg.MIXLY_ESP32_IOT_ONENET_PRINT_DATA).appendField(new k.FieldCheckbox("TRUE"),"is_print"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_ESP32_IOT_ONENET_PUBLISH_DICT_TOOLTIP)}},Xi={init:function(){this.setColour("#78AAE0"),this.appendValueInput("VAR").setCheck("var").appendField("OneNET").setAlign(k.inputs.Align.RIGHT),this.appendDummyInput().appendField(new k.FieldLabel(k.Msg.MIXLY_ESP32_PUBLISH_ONENET),"TIP").setAlign(k.inputs.Align.RIGHT),this.itemCount_=2,this.updateShape_(),this.setInputsInline(!1),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new k.Mutator(["iot_publish_item"])),this.setTooltip(k.Msg.MIXLY_ESP32_IOT_ONENET_PUBLISH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("iot_publish_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("iot_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){this.getInput("EMPTY")&&this.removeInput("EMPTY");for(var e=[],t=0;this.getInput("ADD"+t);t++)e.push(this.getFieldValue("KEY"+t)),this.removeInput("ADD"+t);if(0==this.itemCount_)this.setFieldValue(k.Msg.MIXLY_ESP32_PUBLISH_ONENET_EMPTY,"TIP");else{this.setFieldValue(k.Msg.MIXLY_ESP32_PUBLISH_ONENET,"TIP");for(t=0;t<this.itemCount_;t++)this.appendValueInput("ADD"+t).setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(new k.FieldTextInput(e.length>t?e[t]:'"key'+(t+1)+'"'),"KEY"+t).appendField(":")}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},qi={init:function(){this.setColour(ji),this.appendDummyInput().appendField(k.Msg.MIXLY_MICROBIT_TYPE_DICT),this.appendStatementInput("STACK"),this.setTooltip(k.Msg.DICTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Ki={init:function(){this.setColour(ji),this.appendDummyInput().appendField(k.Msg.DICTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.DICTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},Zi={init:function(){this.setColour(ji),this.appendDummyInput().appendField(k.Msg.DICTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.DICTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},Qi={init:function(){this.setColour(ji),this.appendDummyInput().appendField(k.Msg.MIXLY_CREATE_MQTT_CLIENT_AND_CONNECT),this.appendValueInput("SERVER").setCheck(String).appendField(k.Msg.MIXLY_EMQX_SERVER).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("USERNAME").setCheck(String).appendField(k.Msg.MIXLY_WIFI_USERNAME).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("PASSWORD").setCheck(String).appendField(k.Msg.MIXLY_IOT_PASSWORD).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("PROJECT").setCheck(String).appendField(k.Msg.MIXLY_EMQX_PROJECT).setAlign(k.inputs.Align.RIGHT),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ji={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MixIO"),this.appendValueInput("TOPIC").appendField(k.Msg.MIXLY_EMQX_PUBLISH_NEW).appendField(k.Msg.MIXLY_EMQX_PUBLISH_TOPIC),this.appendValueInput("MSG").appendField(k.Msg.HTML_BODY),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_ESP32_IOT_EMQX_PUBLISH_TOOLTIP)}},er={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MixIO"),this.appendValueInput("TOPIC").appendField(k.Msg.MIXLY_EMQX_SUBSCRIBE+k.Msg.MIXLY_MICROBIT_MSG).appendField(k.Msg.MIXLY_EMQX_PUBLISH_TOPIC),this.appendValueInput("METHOD").appendField(k.Msg.MIXLY_EMQX_SET_METHOD),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_ESP32_IOT_EMQX_SUBSCRIBE_TOOLTIP)}},tr={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MixIO"),this.appendValueInput("TOPIC").appendField(k.Msg.MSG.stop+k.Msg.MIXLY_EMQX_SUBSCRIBE).appendField(k.Msg.MIXLY_EMQX_PUBLISH_TOPIC),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_ESP32_IOT_EMQX_SUBSCRIBE_TOOLTIP)}},nr={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MixIO"),this.appendDummyInput().appendField(k.Msg.MIXLY_ESP32_DISCONNECT_ONENET),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ir={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MixIO"),this.appendDummyInput().appendField(k.Msg.MIXLY_EMQX_CONNECT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},rr={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MixIO"),this.appendDummyInput().appendField(k.Msg.MIXLY_ESP32_CHECK_ONENET),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},sr={init:function(){this.setColour(ji),this.appendDummyInput().appendField(k.Msg.MIXLY_MICROPYTHON_FORMAT).appendField(k.MQTT_Topic),this.setInputsInline(!0),this.setOutput(!0)}},or={init:function(){this.setColour(ji),this.appendDummyInput().appendField(k.Msg.MIXLY_MICROPYTHON_FORMAT).appendField(k.Msg.MIXLY_EMQX_PUBLISH_MSG),this.setInputsInline(!0),this.setOutput(!0)}},ar={init:function(){this.setColour(ji),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_ESP32_IOT_MAP_FORMATING),this.setOutput(!0)}},lr={init:function(){this.setColour(ji),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_MICROPYTHON_FORMAT+"(Json)"),this.setOutput(!0)}},ur={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MixIO"),this.appendDummyInput().appendField(k.Msg.MIXLY_EMQX_PING),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(k.Msg.MIXLY_ESP32_IOT_EMQX_PING_TOOLTIP)}},cr={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MixIO").appendField(k.Msg.MIXLY_GET_NTP),this.appendValueInput("addr").appendField(k.blynk_SERVER_ADD),this.setInputsInline(!0),this.setOutput(!0)}},dr={init:function(){this.setColour(ji),this.appendDummyInput().appendField(k.Msg.MIXLY_CREATE_MQTT_CLIENT_AND_CONNECT),this.appendValueInput("SERVER").appendField(k.Msg.MIXLY_EMQX_SERVER).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("KEY").appendField(k.Msg.CONTROLS_FOR_INPUT_WITH+k.Msg.MIXLY_MIXIO_SHARE_KEY).setAlign(k.inputs.Align.RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},hr={init:function(){this.setColour(ji),this.appendDummyInput().appendField(k.Msg.MIXLY_CREATE_MQTT_CLIENT_AND_CONNECT),this.appendValueInput("SERVER").appendField(k.Msg.MIXLY_EMQX_SERVER).setAlign(k.inputs.Align.RIGHT),this.appendValueInput("KEY").appendField(k.Msg.CONTROLS_FOR_INPUT_WITH+"Mixly Key").setAlign(k.inputs.Align.RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},pr={init:function(){this.VISITOR_ID=Vi.Config.BOARD.visitorId.str32.substring(0,8).toUpperCase(),this.setColour(ji),this.appendDummyInput("").appendField(this.newQuote_(!0)).appendField(new k.FieldTextInput(this.visitorId),"VISITOR_ID").appendField(this.newQuote_(!1)),this.setOutput(!0,null)},onchange:function(){const e=this.getFieldValue("VISITOR_ID");this.VISITOR_ID!==e&&this.setFieldValue(this.VISITOR_ID,"VISITOR_ID")},newQuote_:function(e){if(e==this.RTL)var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==";else t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC";return new k.FieldImage(t,12,12,'"')}},fr={init:function(){this.VISITOR_ID=Vi.Config.BOARD.visitorId.str32.substring(0,8).toUpperCase(),this.setColour(ji),this.appendDummyInput("").appendField(new k.FieldTextInput(this.visitorId),"VISITOR_ID"),this.setOutput(!0,null)},onchange:function(){const e=this.getFieldValue("VISITOR_ID");this.VISITOR_ID!==e&&this.setFieldValue(this.VISITOR_ID,"VISITOR_ID")}},mr={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MixIO").appendField(k.Msg.MSG.catEthernet_clinet),this.setOutput(!0),this.setInputsInline(!0)}},gr={init:function(){this.setColour(ji),this.appendDummyInput().appendField("HTTP"+k.Msg.MIXLY_Client),this.appendValueInput("addr").appendField(k.Msg.DISPLAY_IMAGE_LET2),this.appendDummyInput().appendField(k.Msg.MIXLY_REQUESTS_GET).appendField(k.Msg.MIXLY_GET_CURRENT_TIME).appendField(k.Msg.MIXLY_OPEN_DEBUG).appendField(new k.FieldDropdown([[k.Msg.MIXLY_TURTLE_WRITE_MOVE_TRUE,"True"],[k.Msg.MIXLY_TURTLE_WRITE_MOVE_FALSE,"False"]]),"key"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},yr={init:function(){this.setColour(ji),this.appendDummyInput().appendField("HTTP"+k.Msg.MIXLY_Client).appendField(k.Msg.MIXLY_GET).appendField(new k.FieldDropdown([[k.Msg.MIXLY_REQUESTS_LEN,"client_len"],[k.Msg.MIXLY_REQUESTS_GET_LEN,"server_len"],[k.Msg.MIXLY_REQUESTS_MESSAGE,"text"]]),"key"),this.setOutput(!0),this.setInputsInline(!0)}},_r={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MQTT"+k.Msg.MIXLY_Client),this.appendValueInput("addr").appendField(k.Msg.MIXLY_CONNECTTO),this.appendDummyInput().appendField(k.Msg.MIXLY_INIT_SUBSCRIBE).appendField(k.MQTT_Topic).appendField(new k.FieldDropdown([[k.Msg.MIXLY_GET_CURRENT_TIME,""]]),"key").appendField(k.Msg.MIXLY_OPEN_DEBUG).appendField(new k.FieldDropdown([[k.Msg.MIXLY_TURTLE_WRITE_MOVE_TRUE,"True"],[k.Msg.MIXLY_TURTLE_WRITE_MOVE_FALSE,"False"]]),"key2"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},vr={init:function(){this.setColour(ji),this.appendDummyInput().appendField("MQTT"+k.Msg.MIXLY_Client).appendField(k.Msg.MIXLY_GET).appendField(new k.FieldDropdown([[k.Msg.MIXLY_REQUESTS_LEN,"client_len"],[k.Msg.MIXLY_REQUESTS_GET_LEN,"server_len"],[k.Msg.MIXLY_REQUESTS_MESSAGE,"time_msg()"]]),"key"),this.setOutput(!0),this.setInputsInline(!0)}},br=Yi,Tr=Gi,xr=Hi,Er=Xi,wr=230,Ir={init:function(){this.setColour(wr),this.appendDummyInput("").appendField(new k.FieldDropdown(Vi.Profile.default.digital_write),"PIN"),this.setOutput(!0)}},Ar={init:function(){this.setColour(wr),this.appendDummyInput("").appendField(new k.FieldDropdown(Vi.Profile.default.digital_read),"PIN"),this.setOutput(!0)}},Sr={init:function(){this.setColour(wr),this.appendDummyInput("").appendField(new k.FieldDropdown(Vi.Profile.default.analog_write),"PIN"),this.setOutput(!0)}},Cr={init:function(){this.setColour(wr),this.appendDummyInput("").appendField(new k.FieldDropdown(Vi.Profile.default.analog_read),"PIN"),this.setOutput(!0)}},Or={init:function(){this.setColour(40),this.appendDummyInput("").appendField(new k.FieldLabel(k.Msg.MIXPY_SERIAL_OPEN)).appendField(new k.FieldTextInput("ser"),"SER"),this.appendDummyInput().appendField(k.Msg.MIXLY_SERIAL_BEGIN).appendField(new k.FieldDropdown([["115200","115200"],["256000","256000"],["128000","128000"],["57600","57600"],["56000","56000"],["43000","43000"],["38400","38400"],["28800","28800"],["19200","19200"],["9600","9600"],["4800","4800"],["2400","2400"],["1200","1200"],["600","600"],["300","300"],["110","110"]]),"BPS"),this.appendValueInput("VAR").appendField(k.Msg.MIXPY_SERIAL_OPEN_TIMEOUT),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(k.Msg.MIXPY_SERIAL_OPEN_TOOLTIP)}},Mr={init:function(){this.setColour(40),this.appendValueInput("SER"),this.appendValueInput("VAR").appendField(k.Msg.MIXPY_SERIAL_WRITE),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(k.Msg.MIXPY_SERIAL_WRITE_TOOLTIP)}},Rr={init:function(){this.setColour(40),this.appendValueInput("SER"),this.appendValueInput("VAR").setCheck(Number).appendField(k.Msg.MIXPY_SERIAL_READ),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(k.Msg.MIXPY_SERIAL_READ_TOOLTIP)}},kr={init:function(){this.setColour(40),this.appendValueInput("SER"),this.appendDummyInput().appendField(k.Msg.MIXPY_SERIAL_CLOSE),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(k.Msg.MIXPY_SERIAL_CLOSE_TOOLTIP)}},Nr=80,Dr={init:function(){this.appendDummyInput().appendField(k.Msg.SKLEARN_CLASSIFICATION_GENERATION),this.appendValueInput("n_samples").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_SAMPLES),this.appendValueInput("n_features").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_FEATURES),this.appendValueInput("n_informative").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_EFFECTIVE_FEATURES),this.appendValueInput("n_redundant").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_REDUNDANT_FEATURES),this.appendValueInput("n_repeated").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_REPEATED_FEATURES),this.appendValueInput("n_classes").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_CLASSES),this.appendValueInput("n_clusters_per_class").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_CLUSTERS_PER_CLASSES),this.appendValueInput("random_state").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.RANDOM_SEED),this.setInputsInline(!1),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Fr={init:function(){this.appendDummyInput().appendField(k.Msg.SKLEARN_REGRESSION_GENERATION),this.appendValueInput("n_samples").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_SAMPLES),this.appendValueInput("n_features").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_FEATURES),this.appendValueInput("n_informative").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_EFFECTIVE_FEATURES),this.appendValueInput("n_targets").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_LABELS),this.appendValueInput("bias").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.DEVIATION),this.appendValueInput("noise").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NOISE),this.appendValueInput("random_state").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.RANDOM_SEED),this.setInputsInline(!1),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Lr={init:function(){this.appendDummyInput().appendField(k.Msg.SKLEARN_CLUSTERING_GENERATION),this.appendValueInput("n_samples").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_SAMPLES),this.appendValueInput("n_features").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_FEATURES),this.appendValueInput("centers").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_CLUSTERS),this.appendValueInput("cluster_std").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.STANDARD_DEVIATION_OF_CLUSTER),this.appendValueInput("center_box").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.CLUSTER_BOUNDING_BOX),this.appendValueInput("shuffle").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SHUFFLE_SAMPLES),this.appendValueInput("random_state").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.RANDOM_SEED),this.setInputsInline(!1),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Pr={init:function(){var e=[[k.Msg.SKLEARN_LOAD_IRIS,"load_iris"],[k.Msg.SKLEARN_LOAD_BOSTON,"load_boston"],[k.Msg.SKLEARN_LOAD_DIABETES,"load_diabetes"],[k.Msg.SKLEARN_LOAD_BREAST_CANCER,"load_breast_cancer"],[k.Msg.SKLEARN_LOAD_LINNERUD,"load_linnerud"],[k.Msg.SKLEARN_LOAD_DIGITS,"load_digits"]];this.appendDummyInput().appendField("sklearn "+k.Msg.LOAD).appendField(new k.FieldDropdown(e),"type").appendField(new k.FieldTextInput("iris"),"name"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")},getVars:function(){return[this.getFieldValue("name")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("name"))&&this.setTitleValue(t,"name")}},Br={init:function(){this.appendValueInput("name").setCheck(null).appendField("sklearn "+k.Msg.DATA_SET),this.appendDummyInput().setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MIXLY_GET).appendField(new k.FieldDropdown([[k.Msg.EIGENVALUES,"data"],[k.Msg.LABEL_VALUE,"target"],[k.Msg.FEATURE,"feature_names"],[k.Msg.mixpy_PYLAB_TICKS_TAG,"target_names"]]),"type"),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},$r={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.DATA_SEGMENTATION),this.appendValueInput("train_data").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.EIGENVALUES),this.appendValueInput("train_target").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.LABEL_VALUE),this.appendValueInput("test_size").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.TEST_SET_PROPORTION),this.appendValueInput("rondom_state").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.RANDOM_SEED),this.setInputsInline(!1),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Ur={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.DATA_SEGMENTATION),this.appendValueInput("train_data").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.EIGENVALUES),this.appendValueInput("test_size").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.TEST_SET_PROPORTION),this.appendValueInput("rondom_state").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.RANDOM_SEED),this.setInputsInline(!1),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},zr={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.SKLEARN_LINEARREGRESSION_INIT),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("fit_intercept").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_CALCULATE_MODEL_INTERRUPT),this.appendValueInput("normalize").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_REGRESSION_NORMIALIZATION),this.appendValueInput("n_jobs").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_THREADS),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Vr={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.SKLEARN_RIDGE_INIT),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("alpha").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_REGULA_INTENSITY),this.appendValueInput("fit_intercept").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_CALCULATE_MODEL_INTERRUPT),this.appendValueInput("normalize").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_REGRESSION_NORMIALIZATION),this.appendValueInput("max_iter").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_MAX_ITER),this.appendValueInput("random_state").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.RANDOM_SEED),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},jr={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.SKLEARN_DECISIONTREE_INIT).appendField(new k.FieldDropdown([[k.Msg.SKLEARN_CLASSIFICATION_ALGORITHM,"DecisionTreeClassifier"],[k.Msg.SKLEARN_REGRESSION_ALGORITHM,"DecisionTreeRegressor"]]),"type"),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("max_depth").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_MAXIMUM_TREE_DEPTH),this.appendValueInput("random_state").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.RANDOM_SEED),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Yr={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.SKLEARN_RANDOMFOREST_INIT).appendField(new k.FieldDropdown([[k.Msg.SKLEARN_CLASSIFICATION_ALGORITHM,"RandomForestClassifier"],[k.Msg.SKLEARN_REGRESSION_ALGORITHM,"RandomForestRegressor"]]),"type"),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("n_estimators").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_TREES),this.appendValueInput("max_depth").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_MAXIMUM_TREE_DEPTH),this.appendValueInput("n_jobs").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_THREADS),this.appendValueInput("random_state").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.RANDOM_SEED),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Gr={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.SKLEARN_KNN_INIT).appendField(new k.FieldDropdown([[k.Msg.SKLEARN_CLASSIFICATION_ALGORITHM,"KNeighborsClassifier"],[k.Msg.SKLEARN_REGRESSION_ALGORITHM,"KNeighborsRegressor"]]),"type"),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("K").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField("K"),this.appendValueInput("n_jobs").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_THREADS),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Hr={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.SKLEARN_GAUSSINNB_INIT),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Wr={init:function(){this.appendDummyInput().appendField("sklearn 初始化 PCA 算法"),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("n_components").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_PCA_N_COMPONENTS),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Xr={init:function(){this.appendDummyInput().appendField("sklearn PCA 降维"),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("train_data").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.EIGENVALUES),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},qr={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.SKLEARN_KMEANS_INIT),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("n_clusters").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.NUMBER_OF_CLUSTERS_JUST),this.appendValueInput("max_iter").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.SKLEARN_MAX_ITER),this.appendValueInput("random_state").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.RANDOM_SEED),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Kr={init:function(){this.appendDummyInput().appendField("sklearn K-均值聚类"),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("train_data").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.EIGENVALUES),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Zr={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.TRAINING_MODEL),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("train_data").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.EIGENVALUES),this.appendValueInput("train_target").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.LABEL_VALUE),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Qr={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.TRAINING_MODEL),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("train_data").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.EIGENVALUES),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},Jr={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.MODEL_PRODICTION),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("train_data").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.EIGENVALUES),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},es={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.CALCULATE_THE_SCORE),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("train_data").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.EIGENVALUES),this.appendValueInput("train_target").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.LABEL_VALUE),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},ts={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.CALCULATE_THE_SCORE),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendValueInput("train_data").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.EIGENVALUES),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},ns={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.SKLEARN_GENERALIZED_LINEAR_REGRESSION),this.appendValueInput("model_name").setAlign(k.inputs.Align.RIGHT).setCheck(null).appendField(k.Msg.MODEL_NAME),this.appendDummyInput().setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MIXLY_GET).appendField(new k.FieldDropdown([[k.Msg.SKLEARN_COEF,"coef_"],[k.Msg.SKLEARN_INTERCEPT,"intercept_"]]),"type"),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},is={init:function(){this.appendDummyInput().appendField("sklearn "+k.Msg.SKLEARN_CLUSTERING),this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MODEL_NAME),this.appendDummyInput().appendField(k.Msg.MIXLY_GET).appendField(new k.FieldDropdown([[k.Msg.SKLEARN_CLUSTER_CENTER,"cluster_centers_"],[k.Msg.SKLEARN_LABELS_AFTER_CLUSTERING,"labels_"],[k.Msg.SKLEARN_CLUSTERING_SUM_OF_SQUARED_DISTANCES,"inertia_"]]),"type"),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},rs={init:function(){this.appendValueInput("model_name").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField("sklearn").appendField(new k.FieldDropdown([[k.Msg.SKLEARN_SAVE_MODEL,"dump"],[k.Msg.SKLEARN_LOAD_MODEL,"load"]]),"type").appendField(" "+k.Msg.MODEL_NAME),this.appendValueInput("address").setCheck(null).setAlign(k.inputs.Align.RIGHT).appendField(k.Msg.MIXLY_MICROBIT_PY_STORAGE_THE_PATH),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Nr),this.setTooltip(""),this.setHelpUrl("")}},ss=120,os={init:function(){this.setColour(ss),this.appendValueInput("DELAY_TIME",Number).appendField(k.Msg.MIXLY_DELAY+"("+k.Msg.MIXLY_MILLIS+")").setCheck(Number),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_TOOLTIP_CONTROL_DELAY)}},as={init:function(){this.setColour(ss),this.appendDummyInput().appendField(k.Msg.blockpy_time_time),this.setOutput(!0,Number),this.setTooltip(k.Msg.MIXLY_TOOLTIP_CONTROL_MILLIS)}},ls={init:function(){this.setColour(ss),this.appendDummyInput("").appendField(k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME),this.appendDummyInput().appendField(new k.FieldDropdown([[k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_ALL,"all"],[k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_YEAR,"0"],[k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_MONTH,"1"],[k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_DATE,"2"],[k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_HOUR,"3"],[k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_MINUTE,"4"],[k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_SECOND,"5"],[k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_INWEEK,"6"],[k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_INYEAR,"7"],[k.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_DST,"8"]]),"op"),this.setOutput(!0),this.setInputsInline(!0)}},us={init:function(){this.setColour(ss),this.appendValueInput("STATUS_CODE",Number).appendField(k.Msg.MIXLY_MICROBIT_Panic_with_status_code).setCheck(Number),this.setPreviousStatement(!0,null),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_TOOLTIP_CONTROL_DELAY)}},cs={init:function(){this.setColour(ss),this.appendDummyInput().appendField(k.Msg.MIXLY_MICROBIT_Reset_micro),this.setPreviousStatement(!0)}},ds={init:function(){this.setColour(ss),this.appendValueInput("TIME").setCheck(Number).setAlign(k.inputs.Align.RIGHT).appendField("MsTimer2").appendField(k.Msg.MIXLY_MSTIMER2_EVERY),this.appendDummyInput().appendField("ms"),this.appendStatementInput("DO").appendField(k.Msg.MIXLY_MSTIMER2_DO),this.setPreviousStatement(!0),this.setNextStatement(!0)}},hs={init:function(){this.setColour(ss),this.appendDummyInput().appendField("MsTimer2").appendField(k.Msg.MIXLY_MSTIMER2_START),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ps={init:function(){this.setColour(ss),this.appendDummyInput().appendField("MsTimer2").appendField(k.Msg.MIXLY_STOP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},fs={init:function(){this.setColour(ss),this.appendValueInput("DELAY_TIME",Number).appendField(k.Msg.MIXLY_DELAY).setCheck(Number),this.appendDummyInput().appendField(k.Msg.MIXLY_SECOND),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_TOOLTIP_CONTROL_DELAY)}},ms=180,gs={init:function(){this.setColour(ms),this.appendDummyInput("").appendField(k.Msg.blockpy_turtle_create).appendField(new k.FieldTextInput("tina"),"VAR"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.blockpy_turtle_create_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},ys={init:function(){this.setColour(ms),this.appendDummyInput().appendField(k.Msg.blockpy_TURTLE_DONE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},_s={init:function(){this.setColour(ms),this.appendDummyInput().appendField(k.Msg.MIXLY_PYTHON_TURTLE_EXITONCLICK),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},vs={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[k.Msg.blockpy_forward,"forward"],[k.Msg.blockpy_backward,"backward"]];this.setColour(ms),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_MICROBIT_JS_MOVE_BY).appendField(new k.FieldDropdown(e),"DIR").appendField(k.Msg.MIXLY_MICROBIT_JS_MOVE_BY_num),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{forward:k.Msg.MIXLY_TOOLTIP_TURTEL_FORWARD,backward:k.Msg.MIXLY_TOOLTIP_TURTEL_BACKWARD}[e]})}},bs={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[k.Msg.blockpy_left,"left"],[k.Msg.blockpy_right,"right"]];this.setColour(ms),this.appendValueInput("VAR").appendField(k.Msg.blockpy_turtle_rotate).appendField(new k.FieldDropdown(e),"DIR").appendField(k.Msg.MIXLY_MICROBIT_JS_BY_ANGLE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{left:k.Msg.MIXLY_TOOLTIP_TURTEL_LEFT,right:k.Msg.MIXLY_TOOLTIP_TURTEL_RIGHT}[e]})}},Ts={init:function(){this.setColour(ms),this.appendValueInput("TUR").setCheck("Turtle"),this.appendValueInput("data").setCheck(Number).appendField(k.Msg.blockpy_setheading),this.appendDummyInput().appendField(k.Msg.blockpy_setheading_degree),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},xs={init:function(){this.setColour(ms),this.appendValueInput("TUR").setCheck("Turtle"),this.appendValueInput("data").setCheck(Number).appendField(k.Msg.MIXLY_TURTLE_SCREEN_DELAY),this.appendDummyInput().appendField(k.Msg.MIXLY_MILLIS),this.setTooltip(k.Msg.MIXLY_TOOLTIP_TURTEL_SCREEN_DELAY),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Es={init:function(){this.setColour(ms),this.appendValueInput("TUR").setCheck("Turtle"),this.appendValueInput("data").setCheck(Number).appendField(k.Msg.blockpy_turtle_goto),this.appendValueInput("val").setCheck(Number).appendField(k.Msg.blockpy_turtle_goto_y),this.appendDummyInput().appendField(k.Msg.blockpy_turtle_goto_position),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ws={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[k.Msg.PYLAB_LABEL_X,"x"],[k.Msg.PYLAB_LABEL_Y,"y"]];this.setColour(ms),this.appendValueInput("VAR").appendField(new k.FieldDropdown(e),"DIR").appendField(k.Msg.MIXLY_MIXPY_TURTLE_SETXY),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_MIXPY_TURTLE_SETXY_TOOLTIP)}},Is={init:function(){this.setColour(ms);var e=[[k.Msg.TURTLE_POS,"pos"],[k.Msg.TURTLE_SHAPE,"shape"],[k.Msg.TURTLE_HEADING,"heading"],[k.Msg.MIXLY_MIXPY_TURTLE_WIDTH,"width"],[k.Msg.MIXLY_TURTEL_GET_SHAPESIZE,"shapesize"],[k.Msg.MIXLY_SPEED,"speed"]];this.appendValueInput("TUR").setCheck("Turtle"),this.appendDummyInput("").appendField(k.Msg.TURTLE_POS_SHAPE).appendField(new k.FieldDropdown(e),"DIR");var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{pos:k.Msg.MIXLY_TOOLTIP_TURTEL_POS,shape:k.Msg.MIXLY_TOOLTIP_TURTEL_SHAPE,heading:k.Msg.MIXLY_TOOLTIP_TURTEL_HEADING,width:k.Msg.MIXLY_TOOLTIP_TURTEL_WIDTH,speed:k.Msg.MIXLY_TOOLTIP_TURTEL_GET_SPEED,shapesize:k.Msg.MIXLY_TURTEL_GET_SHAPESIZE_TOOLTIP}[e]}),this.setOutput(!0),this.setInputsInline(!0)}},As={init:function(){this.setColour(ms),this.appendValueInput("TUR").setCheck("Turtle"),this.appendDummyInput().appendField(k.Msg.TURTLE_STAMP),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ss={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[k.Msg.MIXLY_LCD_STAT_CLEAR,"clear"],[k.Msg.blockpy_turtle_reset,"reset"],[k.Msg.blockpy_turtle_home,"home"]];this.setColour(ms),this.appendDummyInput("").appendField(new k.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{clear:k.Msg.MIXLY_TOOLTIP_TURTEL_CLEAR,reset:k.Msg.MIXLY_TOOLTIP_TURTEL_RESET,home:k.Msg.MIXLY_TOOLTIP_TURTEL_HOME}[e]})}},Cs={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[k.Msg.blockpy_turtle_penup,"penup"],[k.Msg.blockpy_turtle_pendown,"pendown"]];this.setColour(ms),this.appendDummyInput("").appendField(new k.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{penup:k.Msg.MIXLY_TOOLTIP_TURTEL_PENUP,pendown:k.Msg.MIXLY_TOOLTIP_TURTEL_PENDOWN}[e]})}},Os={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[k.Msg.blockpy_turtle_beginfill,"begin"],[k.Msg.blockpy_turtle_endfill,"end"]];this.setColour(ms),this.appendDummyInput("").appendField(new k.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{begin:k.Msg.MIXLY_TOOLTIP_TURTEL_BEGINFILL,end:k.Msg.MIXLY_TOOLTIP_TURTEL_ENDFILL}[e]})}},Ms={init:function(){this.appendDummyInput("").appendField(new k.FieldTextInput("tina"),"TUR");var e=[[k.Msg.blockpy_turtle_size,"pensize"],[k.Msg.MIXLY_SPEED,"speed"]];this.setColour(ms),this.appendValueInput("VAR").appendField(k.Msg.blockpy_turtle_set).appendField(new k.FieldDropdown(e),"DIR").appendField(k.Msg.blockpy_turtle_set_num),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{pensize:k.Msg.MIXLY_TOOLTIP_TURTEL_SIZE,speed:k.Msg.MIXLY_TOOLTIP_TURTEL_SPEED}[e]})}},Rs={init:function(){this.setColour(ms),this.appendValueInput("TUR").setCheck("Turtle"),this.appendValueInput("data").setCheck(Number).appendField(k.Msg.blockpy_turtle_set_size),this.setTooltip(k.Msg.MIXLY_TOOLTIP_TURTEL_SIZE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ks={init:function(){this.setColour(ms),this.appendValueInput("TUR").setCheck("Turtle"),this.appendValueInput("data").setCheck(Number).appendField(k.Msg.blockpy_turtle_set_speed),this.setTooltip(k.Msg.MIXLY_TOOLTIP_TURTEL_SPEED),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ns={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[k.Msg.blockpy_turtle_circle,"circle"],[k.Msg.blockpy_turtle_dot,"dot"]];this.setColour(ms),this.appendValueInput("VAR").appendField(k.Msg.blockpy_turtle_draw).appendField(new k.FieldDropdown(e),"DIR").appendField(k.Msg.blockpy_turtle_radius),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{circle:k.Msg.MIXLY_TOOLTIP_TURTEL_CIRCLE,dot:k.Msg.MIXLY_TOOLTIP_TURTEL_DOT}[e]})}},Ds={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_MIXPY_TURTLE_DRAW_CIRCLE).appendField(k.Msg.blockpy_turtle_radius),this.appendValueInput("data").setCheck(Number).appendField(k.Msg.blockpy_turtle_angle),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_TOOLTIP_TURTEL_CIRCLE)}},Fs={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[k.Msg.blockpy_turtle_hide,"hideturtle"],[k.Msg.blockpy_turtle_show,"showturtle"]];this.setColour(ms),this.appendDummyInput("").appendField(new k.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("DIR");return{hideturtle:k.Msg.MIXLY_TOOLTIP_TURTEL_HIDE,showturtle:k.Msg.MIXLY_TOOLTIP_TURTEL_SHOW}[e]})}},Ls={init:function(){this.setColour(ms),this.appendDummyInput().appendField(k.Msg.blockpy_turtle_bgcolor).appendField(new k.FieldColour("#ff0000"),"FIELDNAME"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ps={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendDummyInput().appendField(k.Msg.blockpy_turtle_pencolor).appendField(new k.FieldColour("#ff0000"),"FIELDNAME"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Bs={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendDummyInput().appendField(k.Msg.blockpy_turtle_fillcolor).appendField(new k.FieldColour("#ff0000"),"FIELDNAME"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},$s={init:function(){this.setColour(ms),this.appendValueInput("TUR").setCheck("Turtle"),this.appendDummyInput("").appendField(k.Msg.TURTLE_CLONE),this.setTooltip(k.Msg.TURTLE_CLONE_TOOLTIP),this.setOutput(!0)}},Us={init:function(){this.setColour(ms),this.appendValueInput("VAR").setCheck(String).appendField(k.Msg.blockpy_turtle_bgcolor),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},zs={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendValueInput("VAR").setCheck(String).appendField(k.Msg.blockpy_turtle_pencolor),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Vs={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendValueInput("VAR").setCheck(String).appendField(k.Msg.blockpy_turtle_fillcolor),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},js={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendDummyInput().appendField(k.Msg.blockpy_turtle_pencolor).appendField(new k.FieldColour("#ff0000"),"FIELDNAME"),this.appendDummyInput().appendField(k.Msg.blockpy_turtle_fillcolor).appendField(new k.FieldColour("#ff0000"),"FIELDNAME2"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ys={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendValueInput("VAR1").setCheck(String).appendField(k.Msg.blockpy_turtle_pencolor),this.appendValueInput("VAR2").setCheck(String).appendField(k.Msg.blockpy_turtle_fillcolor),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Gs={init:function(){this.setColour(ms),this.appendValueInput("VAR").setCheck(String).appendField(k.Msg.blockpy_turtle_bgcolor_hex),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Hs={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendValueInput("VAR").setCheck(String).appendField(k.Msg.blockpy_turtle_pencolor_hex),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ws={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendValueInput("VAR").setCheck(String).appendField(k.Msg.blockpy_turtle_fillcolor_hex),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Xs={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[k.Msg.blockpy_turtle_shape_arrow,"arrow"],[k.Msg.blockpy_turtle_shape_turtle,"turtle"],[k.Msg.blockpy_turtle_shape_circle,"circle"],[k.Msg.blockpy_turtle_shape_square,"square"],[k.Msg.blockpy_turtle_shape_triangle,"triangle"],[k.Msg.blockpy_turtle_shape_classic,"classic"]];this.setColour(ms),this.appendDummyInput("").appendField(k.Msg.blockpy_turtle_shape).appendField(new k.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.TURTLE_SHAPE_TOOLTIP)}},qs={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendDummyInput("").appendField(k.Msg.MIXLY_TURTEL_SHAPESIZE),this.appendValueInput("WID").setCheck(Number).appendField(k.Msg.MIXLY_TURTEL_SHAPESIZE_WID),this.appendValueInput("LEN").setCheck(Number).appendField(k.Msg.MIXLY_TURTEL_SHAPESIZE_LEN),this.appendValueInput("OUTLINE").setCheck(Number).appendField(k.Msg.MIXLY_TURTEL_SHAPESIZE_OUTLINE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_TOOLTIP_SHAPESIZE)}},Ks={init:function(){this.appendDummyInput("").appendField(k.Msg.MIXLY_MIXPY_TURTLE_NUMINPUT),this.setColour(ms),this.appendValueInput("TITLE").setCheck(String).appendField(k.Msg.MIXLY_MIXPY_TURTLE_TEXTINPUT_TITLE),this.appendValueInput("PROMPT").setCheck(String).appendField(k.Msg.MIXLY_MIXPY_TURTLE_TEXTINPUT_PROMPT),this.appendValueInput("DEFAULT").setCheck(Number).appendField(k.Msg.DICTS_DEFAULT_VALUE),this.appendValueInput("MIN").setCheck(Number).appendField(k.Msg.MATH_ONLIST_OPERATOR_MIN),this.appendValueInput("MAX").setCheck(Number).appendField(k.Msg.MATH_ONLIST_OPERATOR_MAX),this.setInputsInline(!0),this.setOutput(!0,Number),this.setTooltip(k.Msg.TURTLE_NUMINPUT_TOOLTIP)}},Zs={init:function(){this.appendDummyInput("").appendField(k.Msg.MIXLY_MIXPY_TURTLE_TEXTINPUT),this.setColour(ms),this.appendValueInput("TITLE").setCheck(String).appendField(k.Msg.MIXLY_MIXPY_TURTLE_TEXTINPUT_TITLE),this.appendValueInput("PROMPT").setCheck(String).appendField(k.Msg.MIXLY_MIXPY_TURTLE_TEXTINPUT_PROMPT),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(k.Msg.TURTLE_TEXTINPUT_TOOLTIP)}},Qs={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendValueInput("VAR").setCheck(String).appendField(k.Msg.blockpy_turtle_write),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.TURTLE_WRITE_TOOLTIP)}},Js={init:function(){var e=[[k.Msg.MIXLY_TURTLE_WRITE_MOVE_FALSE,"False"],[k.Msg.MIXLY_TURTLE_WRITE_MOVE_TRUE,"True"]],t=[[k.Msg.MIXLY_TURTLE_WRITE_ALIGN_LEFT,"left"],[k.Msg.MIXLY_TURTLE_WRITE_ALIGN_CENTER,"center"],[k.Msg.MIXLY_TURTLE_WRITE_ALIGN_RIGHT,"right"]],n=[[k.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_NORMAL,"normal"],[k.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_BOLD,"bold"],[k.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_ITALIC,"italic"],[k.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_BOLD_ITALIC,'bold","italic']];this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendValueInput("VAR").setCheck(String).appendField(k.Msg.blockpy_turtle_write),this.appendDummyInput("").appendField(k.Msg.MIXLY_TURTLE_WRITE_MOVE).appendField(new k.FieldDropdown(e),"MOVE"),this.appendDummyInput("").appendField(k.Msg.MIXLY_TURTLE_WRITE_ALIGN).appendField(new k.FieldDropdown(t),"ALIGN"),this.appendValueInput("FONTNAME").setCheck(String).appendField(k.Msg.MIXLY_TURTLE_WRITE_FONT_NAME),this.appendValueInput("FONTNUM").setCheck(Number).appendField(k.Msg.MIXLY_TURTLE_WRITE_FONT_NUM),this.appendDummyInput("").appendField(k.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE).appendField(new k.FieldDropdown(n),"FONTTYPE"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.TURTLE_WRITE_TOOLTIP)}},eo={init:function(){var e=[[k.Msg.MIXLY_TURTLE_WRITE_MOVE_FALSE,"False"],[k.Msg.MIXLY_TURTLE_WRITE_MOVE_TRUE,"True"]],t=[[k.Msg.MIXLY_TURTLE_WRITE_ALIGN_LEFT,"left"],[k.Msg.MIXLY_TURTLE_WRITE_ALIGN_CENTER,"center"],[k.Msg.MIXLY_TURTLE_WRITE_ALIGN_RIGHT,"right"]],n=[[k.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_NORMAL,"normal"],[k.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_BOLD,"bold"],[k.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_ITALIC,"italic"]];this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(ms),this.appendValueInput("VAR").setCheck(String).appendField(k.Msg.blockpy_turtle_write),this.appendDummyInput("").appendField(k.Msg.MIXLY_TURTLE_WRITE_MOVE).appendField(new k.FieldDropdown(e),"MOVE"),this.appendDummyInput("").appendField(k.Msg.MIXLY_TURTLE_WRITE_ALIGN).appendField(new k.FieldDropdown(t),"ALIGN"),this.appendValueInput("FONTNAME").setCheck(String).appendField(k.Msg.MIXLY_TURTLE_WRITE_FONT_NAME),this.appendValueInput("FONTNUM").setCheck(Number).appendField(k.Msg.MIXLY_TURTLE_WRITE_FONT_NUM),this.appendDummyInput("").appendField(k.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE).appendField(new k.FieldDropdown(n),"FONTTYPE"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.TURTLE_WRITE_TOOLTIP)}},to={init:function(){this.setColour(ms),this.appendDummyInput("").setAlign(k.inputs.Align.RIGHT).appendField(new k.FieldColour("ff0000"),"COLOR"),this.setInputsInline(!0),this.setOutput(!0,String)}},no={init:function(){this.setColour(ms),this.appendValueInput("TUR").setCheck("Turtle"),this.appendDummyInput("").appendField(k.Msg.MIXLY_TURTEL_GETSCREEN).appendField(new k.FieldTextInput("screen"),"VAR"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(k.Msg.MIXLY_TURTEL_GETSCREEN_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){k.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},io={init:function(){this.setColour(ms),this.appendValueInput("TUR"),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_TURTEL_EVENT_ONKEY),this.appendValueInput("callback").appendField(k.Msg.MIXLY_PYTHON_CONTROLS_THREAD_USE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_TURTEL_EVENT_ONKEY_TOOLTIP)}},ro={init:function(){this.setColour(ms),this.appendValueInput("TUR"),this.appendDummyInput("").appendField(k.Msg.MIXLY_TURTEL_EVENT_ONCLICK),this.appendValueInput("callback").appendField(k.Msg.MIXLY_PYTHON_CONTROLS_THREAD_USE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_TURTEL_EVENT_ONCLICK_TOOLTIP)}},so={init:function(){this.setColour(ms),this.appendValueInput("TUR"),this.appendValueInput("VAR").appendField(k.Msg.MIXLY_TURTEL_EVENT_ONTIMER),this.appendDummyInput("").appendField(k.Msg.MIXLY_mSecond),this.appendValueInput("callback").appendField(k.Msg.MIXLY_PYTHON_CONTROLS_THREAD_USE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(k.Msg.MIXLY_TURTEL_EVENT_ONTIMER_TOOLTIP)}},oo={init:function(){this.setColour(ms),this.appendValueInput("TUR"),this.appendDummyInput().appendField(k.Msg.MIXLY_TURTEL_SCREEN_LISTEN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ao={init:function(){this.setColour(ms),this.appendValueInput("TUR"),this.appendValueInput("FILE").setCheck(String).appendField(k.Msg.mixpy_PL_SAVEFIG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(k.Msg.mixpy_TURTLE_SAVEFIG_TOOLTIP)}},lo=function(e,t){var n=this.getFieldValue("TYPE");return t.definitions_.import_FileDialog="import FileDialog",["FileDialog."+n+"()",t.ORDER_ATOMIC]},uo=function(e,t){var n=this.getFieldValue("CTYPE");return t.definitions_.import_aip="import aip",t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+" = aip."+n+"("+t.valueToCode(this,"API_KEY",t.ORDER_ATOMIC)+", "+t.valueToCode(this,"SECRET_KEY",t.ORDER_ATOMIC)+")\n"},co=function(e,t){return t.definitions_.import_aip="import aip",[t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+".synthesis("+t.valueToCode(this,"STR",t.ORDER_ATOMIC)+", options="+(t.valueToCode(this,"ATTR",t.ORDER_ATOMIC)||"{}")+")",t.ORDER_ATOMIC]},ho=function(e,t){return t.definitions_.import_aip="import aip",[t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+".asr("+(t.valueToCode(this,"FILE",t.ORDER_ATOMIC)||'""')+", options="+(t.valueToCode(this,"ATTR",t.ORDER_ATOMIC)||"{}")+")",t.ORDER_ATOMIC]},po=function(e,t){t.definitions_.import_aip="import aip";var n=t.valueToCode(this,"SUB",t.ORDER_ATOMIC),i=t.valueToCode(this,"ADDR",t.ORDER_ATOMIC);return[n+"."+t.valueToCode(this,"FUNC",t.ORDER_ATOMIC)+"("+i+", options="+(t.valueToCode(this,"ATTR",t.ORDER_ATOMIC)||"{}")+")",t.ORDER_ATOMIC]},fo=function(e,t){return t.definitions_.import_aip="import aip",[t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+".match("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+","+t.valueToCode(this,"VAR2",t.ORDER_ATOMIC)+", options="+(t.valueToCode(this,"ATTR",t.ORDER_ATOMIC)||"{}")+")",t.ORDER_ATOMIC]},mo=function(e,t){t.definitions_.import_aip="import aip";var n=t.valueToCode(this,"SUB",t.ORDER_ATOMIC),i=t.valueToCode(this,"ADDR",t.ORDER_ATOMIC);return[n+"."+t.valueToCode(this,"FUNC",t.ORDER_ATOMIC)+"("+i+", options="+(t.valueToCode(this,"ATTR",t.ORDER_ATOMIC)||"{}")+")",t.ORDER_ATOMIC]},go=function(e,t){t.definitions_.import_aip="import aip";var n=t.valueToCode(this,"SUB",t.ORDER_ATOMIC),i=t.valueToCode(this,"STR",t.ORDER_ATOMIC);return[n+"."+t.valueToCode(this,"FUNC",t.ORDER_ATOMIC)+"("+i+", options="+(t.valueToCode(this,"ATTR",t.ORDER_ATOMIC)||"{}")+")",t.ORDER_ATOMIC]},yo=function(e,t){t.definitions_.import_aip="import aip";var n=t.valueToCode(this,"SUB",t.ORDER_ATOMIC),i=t.valueToCode(this,"STR1",t.ORDER_ATOMIC),r=t.valueToCode(this,"STR2",t.ORDER_ATOMIC);return[n+"."+t.valueToCode(this,"FUNC",t.ORDER_ATOMIC)+"("+i+","+r+", options="+(t.valueToCode(this,"ATTR",t.ORDER_ATOMIC)||"{}")+")",t.ORDER_ATOMIC]},_o=function(e,t){return t.definitions_.import_aip="import aip",[t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+".topic("+t.valueToCode(this,"STR1",t.ORDER_ATOMIC)+","+t.valueToCode(this,"STR2",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},vo=function(e,t){return t.definitions_.import_aip="import aip",[t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+".newsSummary("+t.valueToCode(this,"STR",t.ORDER_ATOMIC)+","+t.valueToCode(this,"LEN",t.ORDER_ATOMIC)+", options="+(t.valueToCode(this,"ATTR",t.ORDER_ATOMIC)||"{}")+")",t.ORDER_ATOMIC]},bo=function(e,t){return[this.getFieldValue("TYPE"),t.ORDER_ATOMIC]},To=function(e,t){return[this.getFieldValue("TYPE"),t.ORDER_ATOMIC]},xo=function(e,t){return[this.getFieldValue("TYPE"),t.ORDER_ATOMIC]},Eo=function(e,t){return[this.getFieldValue("TYPE"),t.ORDER_ATOMIC]},wo=function(e,t){return t.definitions_.import_audio="import audio","audio.audio_record("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+","+(t.valueToCode(this,"TIME",t.ORDER_ATOMIC)||"0")+")\n"},Io=function(e,t){return t.definitions_.import_audio="import cam","cam.photo_capture("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+","+(t.valueToCode(this,"BUT",t.ORDER_ATOMIC)||'""')+")\n"},Ao=function(e,t){var n=t.valueToCode(this,"AI",t.ORDER_ASSIGNMENT)||"0",i=this.getFieldValue("CTYPE");if("Image"==i)var r=n+'["result"][0]["keyword"]';if("Speech"==i)r=n+'["result"][0]';if("Face"==i||"OcrSimilarity"==i)r=n+'["score"]';if("Ocr"==i)r=n+'["words_result"]';return[r,t.ORDER_ATOMIC]},So=function(e,t){t.definitions_.import_sprite="import sprite";return"g = [[0,0,0,0,0,0,0,0,0,0], [0,0,0,1,0,0,0,0,0,0], [0,0,0,1,0,0,1,0,0,0], [0,1,1,0,1,1,0,0,0,0], [0,0,0,1,0,0,0,1,0,0], [0,0,0,1,0,0,1,1,0,0], [0,0,1,0,0,1,0,1,0,0], [0,0,0,0,1,1,1,0,0,0]]\nmark = [[0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0]]\nvis = [0,1,0,0,0,0,0,0,0]\nposition = [[0, 0], [200, 200], [250, 60], [320, 200], [280, 380], [470, 250], [670, 90], [650, 340]]\nsprite.clearAllSprites()\nsprite.createBackground('ditu')\nmask = sprite.Sprite('white', 96, 354)\nmask.hide()\nhouse = [\n sprite.Sprite('mark', 150, 380),\n sprite.Sprite('xtxn', 96, 170),\n sprite.Sprite('xnvijx', 270, 45),\n sprite.Sprite('xnxbjx', 310, 182),\n sprite.Sprite('xnsijx', 300, 370),\n sprite.Sprite('xnkejx', 495, 220),\n sprite.Sprite('bwbwjx', 716, 85),\n sprite.Sprite('lelejx', 686, 314)\n]\nfor i in house:\n i.filterBrighter()\n i.hide()\n"},Co=function(){return"path = [1]\nmask.show()\ncar = sprite.Sprite('xnie', position[1][0], position[1][1])\nhouse[1].show()\ncar.nowPos = 1\ndef drive(n):\n if g[car.nowPos][n]==1:\n car.slideTo(position[n][0], position[n][1], 1)\n car.nowPos = n\n else:\n print('移动失败!程序有误!')\n exit()\n"},Oo=function(e,t){t.definitions_.import_random="import random";return"f = path[(len(path) - 1)]\nflag = 0\nfor _my_variable in [6,5,4,3,2,1,0]:\n if vis[_my_variable+1] == 0 and g[f][_my_variable+1] == 1:\n if mark[f][_my_variable+1] == 0:\n flag = 1\n break\n"},Mo=function(e,t){return["flag == 1",t.ORDER_ATOMIC]},Ro=function(){return"mark[f][_my_variable+1] = 1\nvis[_my_variable+1] = 1\n"},ko=function(){return"path.append(_my_variable+1)\ndrive(path[len(path) - 1])\nhouse[_my_variable+1].show()\n"},No=function(e,t){t.definitions_.import_time="import time";return"del path[len(path) - 1]\nhouse[0].show()\ntime.sleep(0.5)\nhouse[0].hide()\n"},Do=function(){var e="for i in range(7):\n mark[f][i+1] = 0\n vis[f] = 0\n";return e="house[f].hide()\ndrive(path[len(path) - 1])\n"+e},Fo=function(e,t){return["len(path) == 7",t.ORDER_ATOMIC]},Lo=function(){return'name = ["","学校","小智家","小欣家","小思家","小科家","贝贝家","乐乐家"]\nres = ""\nfor i in path:\n res = res + name[i] + "-"\nprint(res[:-1])\n'},Po=function(e,t){t.definitions_.import_sprite="import sprite";return"g = [[0,0,0,0,0,0,0,0,0,0], [0,0,0,1,0,0,0,0,0,0], [0,0,0,1,0,0,1,0,0,0], [0,1,1,0,1,0,0,0,0,0], [0,0,0,1,0,0,0,1,0,0], [0,0,0,1,0,0,0,1,0,0], [0,0,1,0,0,0,0,1,0,0], [0,0,0,0,1,1,1,0,0,0]]\nmark = [[0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0]]\nvis = [0,1,0,0,0,0,0,0,0]\nposition = [[0, 0], [200, 200], [250, 60], [320, 200], [280, 380], [470, 250], [670, 90], [650, 340]]\nsprite.clearAllSprites()\nsprite.createBackground('ditu')\nmask = sprite.Sprite('white', 96, 354)\nmask.hide()\nhouse = [\n sprite.Sprite('mark', 150, 380),\n sprite.Sprite('xtxn', 96, 170),\n sprite.Sprite('xnvijx', 270, 45),\n sprite.Sprite('xnxbjx', 310, 182),\n sprite.Sprite('xnsijx', 300, 370),\n sprite.Sprite('xnkejx', 495, 220),\n sprite.Sprite('bwbwjx', 716, 85),\n sprite.Sprite('lelejx', 686, 314)\n]\nbarricade = sprite.Sprite('barricade', 610, 170)\nbarricade.enlargeTo(100)\nfor i in house:\n i.filterBrighter()\n i.hide()\n"},Bo=function(e,t){return["f == 1",t.ORDER_ATOMIC]},$o=function(){return"print('没有符合条件的路线')\n"},Uo=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return'g = [[10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000],[10000,10000,500,300,10000,10000,10000,10000,10000,10000,10000],[10000,500,10000,10000,100,10000,10000,10000,10000,10000,10000],[10000,300,10000,10000,400,300,10000,10000,10000,10000,10000],[10000,10000,100,400,10000,10000,200,10000,10000,10000,10000],[10000,10000,10000,300,10000,10000,100,200,10000,10000,10000],[10000,10000,10000,10000,200,100,10000,10000,100,10000,10000],[10000,10000,10000,10000,10000,200,10000,10000,100,10000,10000],[10000,10000,10000,10000,10000,10000,100,100,10000,10000,10000]]\nnow=1\nlast=1\npath=[]\npath.append(1)\nname = ["","小思家","银行","邮局","餐厅","书店","医院","超市","小科家"]\nposition = [[0, 0], [60, 320], [510, 390], [240, 200], [750, 330], [410, 90], [540, 190], [550, 30], [720, 120]]\nsprite.clearAllSprites()\nsprite.createBackground(\'map_si_ke\')\nstu = sprite.Sprite(\'girl\', 60, 320)\nstu.enlargeTo(100)\ntime.sleep(1)\n\n'},zo=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return'g =[[10000,10000,10000,10000,10000,10000,10000],[10000,10000,300,500,10000,10000,10000],[10000,300,10000,10000,300,700,10000],[10000,500,10000,10000,10000,100,10000],[10000,10000,300,10000,10000,10000,200],[10000,10000,700,100,10000,10000,100],[10000,10000,10000,10000,200,100,10000]]\nnow=1\nlast=1\npath=[]\npath.append(1)\nname = ["","小智家","邮局","银行","书店","餐厅","学校"]\nposition = [[0, 0], [70, 340], [70, 90], [550, 310], [420, 70], [730, 250], [650, 130]]\nsprite.clearAllSprites()\nsprite.createBackground(\'map_zhi_xue\')\nstu = sprite.Sprite(\'boy\', 70, 340)\nstu.enlargeTo(100)\ntime.sleep(1)\n\n'},Vo=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return'tmp=10000\nfor i in range(0, len(g), 1):\n if g[now][i]<tmp and i!=last:\n next=i\n tmp=g[now][i]\nstu.slideTo(position[next][0], position[next][1], 1)\ntime.sleep(0.5)\npath.append(next)\nlast=now\nnow=next\nif len(path)>6:\n print("路线错乱!程序有误!")\n exit()\n'},jo=function(e,t){return["name[now] != '小科家'",t.ORDER_ATOMIC]},Yo=function(e,t){return["name[now] != '学校'",t.ORDER_ATOMIC]},Go=function(){return'res = ""\nfor i in path:\n res = res + name[i] + "→"\nprint(res[:-1])\n'},Ho=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";var n=this.getFieldValue("NUM");if(n>=7)var i="print('层数过高不得高于6层')\nexit()\n";else i="sprite.clearAllSprites()\n_Hanoicolor = ['blue', 'red', 'yellow', 'green', 'purple', 'black']\n_Hanoi = [[], [], []]\nA = 0\nB = 1\nC = 2\n_n = "+n+"\n_HanoiColumn = [\n sprite.Sprite('HanoiColumn', 200, 320),\n sprite.Sprite('HanoiColumn', 400, 320),\n sprite.Sprite('HanoiColumn', 600, 320)\n]\n_HanoiColumnNumber = [\n sprite.Text('A', 190, 120),\n sprite.Text('B', 390, 120),\n sprite.Text('C', 590, 120)\n]\n_HanoiBlock = []\nfor i in range(0, _n, 1):\n _HanoiBlock.append(sprite.Sprite(_Hanoicolor[i], 200, 400-(_n-i-1)*27))\n _HanoiBlock[i].setScale(25, 30*i+30)\n _Hanoi[0].insert(0, _HanoiBlock[i])\n_steptext = sprite.Text('步数0', 30, 30)\n_steps = {'steps' : 0}\ntime.sleep(1)\n";return i},Wo=function(e,t){var n=t.valueToCode(this,"FROM_NUM",t.ORDER_ATOMIC)||"0",i=t.valueToCode(this,"TO_NUM",t.ORDER_ATOMIC)||"0";return`if len(_Hanoi[${n}])>0 :\n _HanoiBlockMoved = _Hanoi[${n}].pop()\n if len(_Hanoi[${i}]) > 0 :\n _HanoiBlockSuppressed = _Hanoi[${i}].pop()\n if _HanoiBlock.index(_HanoiBlockMoved) > _HanoiBlock.index(_HanoiBlockSuppressed):\n print('非法移动!程序有误!')\n exit()\n else:\n _Hanoi[${i}].append(_HanoiBlockSuppressed)\n _HanoiBlockMoved.slideTo(${n}*200+200, 180, 0.2)\n _HanoiBlockMoved.slideTo(${i}*200+200, 180, 0.5)\n _HanoiBlockMoved.slideTo(${i}*200+200, 400-len(_Hanoi[${i}])*27, 0.2)\n _Hanoi[${i}].append(_HanoiBlockMoved)\n _steps['steps'] += 1\n _steptext.changeText('步数:'+str(_steps['steps']))\nelse :\n print('非法移动!程序有误!')\n exit()\n`},Xo=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"if 'mode' not in globals() or mode == 0:\n sprite.clearAllSprites()\n ring=[0,0,0,0,0,0,0,0,0,0]\n mode=1\n n=5\n ring[5]=1\n name=['小王子','海底两万里','荷花镇的早市','孔子的故事','夏洛的网','草房子','月下看猫头鹰','会唱歌的咖啡磨','父与子','城南旧事']\n Books = []\n for i in range(1, 11, 1):\n Books.append(sprite.Sprite('books/book'+str(i), (130*i-650) if i>5 else 130*i, 320 if i>5 else 120))\nelse:\n mode=2\n n=len(ring)-1\nring[n]=1\ntime.sleep(1)\n"},qo=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"if 'mode' not in globals() or mode == 0:\n sprite.clearAllSprites()\n ring=[0,0,0,0,0,0,0,0,0,0]\n mode=2\n n=5\n name=['小王子','海底两万里','荷花镇的早市','孔子的故事','夏洛的网','草房子','月下看猫头鹰','会唱歌的咖啡磨','父与子','城南旧事']\n Books = []\n for i in range(1, 11, 1):\n Books.append(sprite.Sprite('books/book'+str(i), (130*i-650) if i>5 else 130*i, 320 if i>5 else 120))\nelse:\n mode=1\n n=len(ring)-1\nring[n]=n\nlist=ring\ntemp=Books\ntime.sleep(1)\n"},Ko=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"res=0\nflag=ring[res]\nBooks[res].filterBrighter()\ntime.sleep(0.1)\nBooks[res].filterOrigin()\n"},Zo=function(e,t){return["(('mode' not in globals())or(mode==1 and flag==0)or(mode==2 and not any(value > 0 for value in qian))or(mode==0))",t.ORDER_ATOMIC]},Qo=function(e,t){return["(('mode' in globals())and((mode==1 and flag!=0)or(mode==2 and any(value > 0 for value in qian))))",t.ORDER_ATOMIC]},Jo=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";var n="res+=1\nflag=ring[res]\n";return n="Books[res].filterGray()\ntime.sleep(0.3)\n"+(n+="Books[res].filterBrighter()\ntime.sleep(0.1)\nBooks[res].filterOrigin()\n")},ea=function(e,t){return["len(list)>=2",t.ORDER_ATOMIC]},ta=function(){return"mid = int(len(list)/2)\nqian = list[0:mid]\nhou = list[mid:]\nqiantemp = temp[0:mid]\nhoutemp = temp[mid:]\n"},na=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"quchu = qian\nlist = hou\nquchutemp = qiantemp\ntemp = houtemp\nfor i in qiantemp:\n i.filterBrighter()\ntime.sleep(0.5)\nfor i in qiantemp:\n i.filterGray()\ntime.sleep(0.5)\n"},ia=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"list = quchu\ntemp = quchutemp\nfor i in qiantemp:\n i.filterBrighter()\ntime.sleep(0.5)\nfor i in qiantemp:\n i.filterOrigin()\nfor i in houtemp:\n\ti.filterBrighter()\ntime.sleep(0.5)\nfor i in houtemp:\n i.filterGray()\ntime.sleep(0.5)\n"},ra=function(){return"if 'list' in globals():\n res = list[0]\nBooks[res].filterBrighter()\nprint('未消磁的书籍是第'+str(res+1)+'本《'+name[res%10]+'》。')\nif res!=n:\n print('答案错误!请检查程序!')\nmode=0\n"},sa=function(e,t){var n=this.getFieldValue("NUM");return t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite",`sprite.clearAllSprites()\nring = []\nname = ['小王子','海底两万里','荷花镇的早市','孔子的故事','夏洛的网','草房子','月下看猫头鹰','会唱歌的咖啡磨','父与子','城南旧事']\nBooks = []\nfor i in range(${n}):\n ring.append(0)\nfor i in range(1, ${n}+1, 1):\n Books.append(sprite.Sprite('books/book'+str(i%10 if i%10!=0 else 10), ${{5:"130*i, 120",10:"(130*i-650) if i>5 else 130*i, 320 if i>5 else 120",20:"(65*i-650)+30 if i>10 else 65*i+30, 320 if i>10 else 120",50:"(26*i-650)+50 if i>25 else 26*i+50, 320 if i>25 else 120"}[n]}))\ntime.sleep(1)\nmode=3\n`},oa=function(e,t){t.definitions_.import_sprite="import sprite";return"cnt=0\ncntText = sprite.Text('计数器0', 30, 200)\n"},aa=function(e,t){t.definitions_.import_sprite="import sprite";return"cnt+=1\ncntText.changeText('计数器:'+str(cnt))\n"},la=function(e,t){t.definitions_.import_sprite="import sprite";return"print('计数器大小:'+str(cnt))\n"},ua=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"sprite.clearAllSprites()\n_head = 10\n_foot = 32\n_footText = sprite.Text('脚的数量:', 20, 10)\n_sprite = []\n"},ca=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"_rabbit = 0\ntime.sleep(1)\n"},da=function(e,t){return["_rabbit < _head",t.ORDER_ATOMIC]},ha=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"_chick = _head - _rabbit\nfor i in range(0, _chick, 1):\n _sprite.append(sprite.Sprite('jttl/chick', len(_sprite)*130+130 if len(_sprite)<5 else len(_sprite)*130+130-650, 120 if len(_sprite)<5 else 320))\n\ntime.sleep(0.5)\n_footText.changeText('脚的数量:'+str(_rabbit*4 + _chick*2))\ntime.sleep(1)\n"},pa=function(e,t){return["_rabbit*4 + _chick*2 == _foot",t.ORDER_ATOMIC]},fa=function(e,t){t.definitions_.import_sprite="import sprite";return"print('鸡的数量:'+str(_chick)+'只;\\n兔的数量'+str(_rabbit)+'只。')\n"},ma=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"_rabbit += 1\nsprite.clearAllSprites()\n_sprite = []\n_footText = sprite.Text('脚的数量:', 20, 10)\nfor i in range(0, _rabbit, 1):\n _sprite.append(sprite.Sprite('jttl/rabbit', len(_sprite)*130+130 if len(_sprite)<5 else len(_sprite)*130+130-650, 120 if len(_sprite)<5 else 320))\ntime.sleep(0.5)\n"},ga=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"sprite.clearAllSprites()\nsprite.createBackground('/fzsf/map_ck_xxjsjs')\n_S1 = sprite.Sprite('/fzsf/S1',400,225,'S1')\n_S2 = sprite.Sprite('/fzsf/S2',400,225,'S2')\n_S3 = sprite.Sprite('/fzsf/S3',400,225,'S3')\n_S4 = sprite.Sprite('/fzsf/S4',400,225,'S4')\n_S1.hide()\n_S2.hide()\n_S3.hide()\n_S4.hide()\n_text_1 = sprite.Text('S1',0,0,'text')\n_text_2 = sprite.Text('S2',0,30,'text2')\n_text_3 = sprite.Text('S3',0,60,'text3')\n_text_4 = sprite.Text('S4',0,90,'text4')\n_position = [[60, 270], [240, 50], [260, 380], [440, 190], [730, 60], [700, 400]]\n_Llen = [0, 170, 230, 100, 150, 10, 30, 50]\n_Slen = [0, 0, 0, 0, 0]\n_tag = [0, [0, 1, 3], [0, 2, 3], [3, 4, 5], [3, 5]]\nbear = sprite.Sprite('mixbear',60,270,'bear')\nbear.enlargeTo(80)\n_pos = 0\ntime.sleep(1)\n"},ya=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";var n=this.getFieldValue("PATHNAME");const i=[0,[1,3],[2,4],[5,7],[6]];var r="";return r+=`_S${n}.show()\ntime.sleep(1)\n`,r+=4!=n?`_Slen[${n}] = _Llen[${i[n][0]}] + _Llen[${i[n][1]}]\n_text_${n}.changeText('S${n}'+str(_Slen[${n}])+'m')\ntime.sleep(1)\n_S${n}.hide()\ntime.sleep(1)\n`:"_Slen[4] = _Llen[6]\n_text_4.changeText('S4'+str(_Slen[4])+'m')\ntime.sleep(1)\n_S4.hide()\ntime.sleep(1)\n"},_a=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";var n="";return[n+=`_Slen[${this.getFieldValue("PATHNAME")}] < _Slen[${this.getFieldValue("PATHNAME2")}]`,t.ORDER_ATOMIC]},va=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";var n=this.getFieldValue("PATHNAME"),i="";return i+=`\n_S1.hide()\n_S2.hide()\n_S3.hide()\n_S4.hide()\n_Smin = ${n}\n_S${n}.show()\ntime.sleep(0.5)\n_S${n}.hide()\ntime.sleep(0.5)\n_S${n}.show()\ntime.sleep(1)\n`},ba=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"if(_pos == _tag[_Smin][0]):\n for i in range(1, len(_tag[_Smin]), 1):\n bear.slideTo(_position[_tag[_Smin][i]][0], _position[_tag[_Smin][i]][1], 1)\n _pos = _tag[_Smin][len(_tag[_Smin])-1]\nelse:\n print('移动错误!程序有误!')\n exit()\n_S1.hide()\n_S2.hide()\n_S3.hide()\n_S4.hide()\nif(_pos == 5):\n print('成功抵达信息科技教室!')\n"},Ta=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"sprite.clearAllSprites()\nsprite.createBackground('/hxdb/hxdbbg')\n_soldier = []\n_num = sprite.Text('目前士兵数量0',0,0,'num')\n_last = sprite.Text('剩余0',500,0,'last')\n_line = 3\n"},xa=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";var n="";return n+=`for i in range(0, ${this.getFieldValue("NUM")}, 1):\n _soldier.append(sprite.Sprite('/hxdb/soldier', 30 + (len(_soldier)%_line)*50 + (len(_soldier)//(4*_line))*(_line+1)*50 +(len(_soldier)%3-2), 80+(len(_soldier)//_line)*100-(len(_soldier)//(4*_line))*4*100+(len(_soldier)%2)))\n_num.changeText('目前士兵数量:'+str(len(_soldier)))\n`},Ea=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";var n=this.getFieldValue("NUM");return`for i in range(0, len(_soldier), 1):\n _soldier[i].slideTo(30 + (i%${n})*50 + (i//(4*${n}))*(${n}+1)*50 +(i%3-2), 80+(i//${n})*100-(i//(4*${n}))*4*100+(i%2), 0.05)\n_line = ${n}\n_last.changeText('剩余:'+str(len(_soldier)%_line))\ntime.sleep(2)\n`},wa=function(e,t){return t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite",[`len(_soldier)%_line == ${this.getFieldValue("NUM")}`,t.ORDER_ATOMIC]},Ia=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"_num.changeText('目前士兵数量:'+str(len(_soldier)+1))\n_last.changeText('剩余:')\ntime.sleep(0.5)\n_soldier.append(sprite.Sprite('/hxdb/soldier', 30 + (len(_soldier)%_line)*50 + (len(_soldier)//(4*_line))*(_line+1)*50 +(len(_soldier)%3-2), 80+(len(_soldier)//_line)*100-(len(_soldier)//(4*_line))*4*100+(len(_soldier)%2)))\ntime.sleep(1)\n"},Aa=function(e,t){t.definitions_.import_time="import time",t.definitions_.import_sprite="import sprite";return"print('符合要求的士兵数量为:'+str(len(_soldier)))\n"},Sa=function(e,t){t.definitions_.import_turtle="import turtle",t.definitions_.import_time="import time",t.definitions_.import_math="import math";var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC),i=this.getFieldValue("NUM");return t.setups_.init_Hanoi="\ndef init_Hanoi():\n pen = turtle.Turtle()\n pen.hideturtle()\n pen.speed(0)\n for i in range(0, 3, 1):\n pen.penup()\n pen.setheading(0)\n pen.goto(150 * i - 200,-100)\n pen.pendown()\n pen.pensize(5)\n pen.forward(100)\n pen.goto(150 * i - 150,-100)\n pen.setheading(90)\n pen.forward(200)",t.setups_.begin="\ndef begin(): \n s = turtle.Turtle()\n s.hideturtle()\n s.penup()\n s.speed(0)\n s.goto(0,-150)\n s.write('3')\n time.sleep(1)\n s.clear()\n s.write('2')\n time.sleep(1)\n s.clear()\n s.write('1')\n time.sleep(1)\n s.clear()\n s.write('Start!')\n time.sleep(1)\n s.clear()\n",t.setups_.move="\ndef move(x, y):\n try:\n t = tower[x].pop(-1)\n a = tower_num[x].pop(-1)\n if tower_num[y]!=[]:\n b = tower_num[y][-1]\n if a<b:\n print('非法移动,不能将大盘放置在小盘上')\n exit() \n t.goto(150 * y - 150,20 * len(tower[y]) - 90)\n tower[y].append(t)\n tower_num[y].append(a)\n except IndexError:\n print('非法移动,未找到可移动的圆盘')\n exit()\n",`num = ${i}\ntower = [[], [], []]\ntower_num = [[], [], []]\nA,B,C=0,1,2\ntotal_num=[0]\ncolor= (${n})\ninit_Hanoi()\nfor i in range(0, num, 1):\n tina = turtle.Turtle()\n tina.penup()\n tina.shape('square')\n if num == 1:\n tina.shapesize(1,7,1)\n else:\n tina.shapesize(1,7 - (6 / (num - 1)) * i,1)\n tina.color("#000000",color)\n tina.speed(3)\n tina.goto(-150,20 * i - 90)\n tower[0].append(tina)\n tower_num[0].append(i)\ncount_turtle=turtle.Turtle()\ncount_turtle.hideturtle()\ncount_turtle.penup()\ncount_turtle.goto(0,150)\ncount_turtle.write('总步数0') \nbegin()\n`},Ca=function(){return"f = path[(len(path) - 1)]\n"},Oa=function(e,t){return["len(path)==0",t.ORDER_ATOMIC]},Ma=function(e,t){return['"'+this.getFieldValue("COLOR")+'"',t.ORDER_ATOMIC]},Ra=function(e,t){return t.definitions_.import_requests="import requests",t.variableDB_.getName(this.getFieldValue("VAR"),k.Variables.NAME_TYPE)+"= requests.get("+t.valueToCode(this,"DOMAIN",t.ORDER_ATOMIC)+")\n"},ka=function(e,t){return t.definitions_.import_requests="import requests",["requests."+this.getFieldValue("TYPE")+"("+t.valueToCode(this,"URL",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Na=function(e,t){return t.definitions_.import_requests="import requests",["requests."+this.getFieldValue("TYPE")+"("+t.valueToCode(this,"URL",t.ORDER_ATOMIC)+",data="+t.valueToCode(this,"data",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Da=function(e,t){return t.definitions_.import_requests="import requests",[(t.valueToCode(this,"VAL",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("ATTR"),t.ORDER_ATOMIC]},Fa=function(e,t){return t.definitions_.import_requests="import requests","requests."+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"};var La=n(20936);const Pa=function(e,t){t.definitions_.import_pandas="import pandas";var n=t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0";return t.variableDB_.getName(this.getFieldValue("VAR"),k.Variables.NAME_TYPE)+" = pandas.Series("+n+")\n"},Ba=function(e,t){t.definitions_.import_pandas="import pandas";var n=t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"INDEX",t.ORDER_ATOMIC)||"''";return t.variableDB_.getName(this.getFieldValue("VAR"),k.Variables.NAME_TYPE)+" = pandas.Series("+n+",index="+i+")\n"},$a=function(e,t){t.definitions_.import_pandas="import pandas";var n=t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0";return t.variableDB_.getName(this.getFieldValue("VAR"),k.Variables.NAME_TYPE)+" = pandas.DataFrame("+n+")\n"},Ua=function(e,t){t.definitions_.import_pandas="import pandas";var n=t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"INDEX_COLUMN",t.ORDER_ATOMIC)||"''",r=t.valueToCode(this,"INDEX_RAW",t.ORDER_ATOMIC)||"''";return t.variableDB_.getName(this.getFieldValue("VAR"),k.Variables.NAME_TYPE)+" = pandas.DataFrame("+n+",columns="+i+",index="+r+")\n"},za=function(e,t){t.definitions_.import_pandas="import pandas";var n=this.getFieldValue("COLUMN_RAW"),i=t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"INDEX",t.ORDER_ATOMIC)||"''";return t.variableDB_.getName(this.getFieldValue("VAR"),k.Variables.NAME_TYPE)+" = pandas.DataFrame("+i+","+n+"="+r+")\n"},Va=function(e,t){return t.definitions_.import_pandas="import pandas",t.variableDB_.getName(this.getFieldValue("VAR"),k.Variables.NAME_TYPE)+" = pandas.Series(["+this.getFieldValue("TEXT")+"])\n"},ja=function(e,t){return t.definitions_.import_pandas="import pandas",[(t.valueToCode(this,"SERIES",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("INDEX_VALUE"),t.ORDER_ATOMIC]},Ya=function(e,t){return[(t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0")+"["+(t.valueToCode(this,"AT",t.ORDER_ADDITIVE)||"1")+"]",t.ORDER_ATOMIC]},Ga=function(e,t){t.definitions_.import_pylab="import pylab";return"pylab.show()\n"},Ha=function(e,t){t.definitions_.import_pylab="import pylab";return"pylab.axes(aspect=1)\n"},Wa=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.plot("+(t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0")+")\n"},Xa=function(e,t){t.definitions_.import_pylab="import pylab";var n=this.getFieldValue("LINE"),i=this.getFieldValue("COLOR"),r=this.getFieldValue("DOT");return"pylab.plot("+(t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0")+",'"+r+n+i+"')\n"},qa=function(e,t){t.definitions_.import_pylab="import pylab",t.definitions_.import_matplotlib_font_manager="import matplotlib.font_manager";return'pylab.legend(prop=matplotlib.font_manager.FontProperties("STSong"))\n'},Ka=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.title("+t.valueToCode(this,"TITLE",t.ORDER_ATOMIC)+', fontproperties = "STSong")\n'},Za=function(e,t){return t.definitions_.import_pylab="import pylab","pylab."+this.getFieldValue("DIR")+"label("+t.valueToCode(this,"LABEL",t.ORDER_ATOMIC)+', fontproperties = "STSong")\n'},Qa=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.arange("+(t.valueToCode(this,"FROM",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"TO",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"STEP",t.ORDER_NONE)||"1")+")",t.ORDER_ATOMIC]},Ja=function(e,t){return t.definitions_.import_pylab="import pylab","pylab."+this.getFieldValue("DIR")+"("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+")\n"},el=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.scatter("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+",s="+(t.valueToCode(this,"S",t.ORDER_ATOMIC)||"''")+",c='"+this.getFieldValue("COLOR")+"',marker='"+this.getFieldValue("DOT")+"',label="+(t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''")+")\n"},tl=function(e,t){t.definitions_.import_pylab="import pylab";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=this.getFieldValue("LINE"),s=this.getFieldValue("COLOR");return"pylab.plot("+n+","+i+",'"+this.getFieldValue("DOT")+r+s+"',label="+(t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''")+")\n"},nl=function(e,t){t.definitions_.import_pylab="import pylab";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''",s=t.valueToCode(this,"WIDTH",t.ORDER_RELATIONAL)||"0",o=this.getFieldValue("COLOR");return"pylab.bar("+n+","+i+',align="'+this.getFieldValue("ALIGN")+'",color="'+o+'",width='+s+",label="+r+")\n"},il=function(e,t){t.definitions_.import_pylab="import pylab";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=t.valueToCode(this,"EXPLODE",t.ORDER_ATOMIC)||"''",s=this.getFieldValue("SHADOW"),o=this.getFieldValue("autopct");return"None"!=o&&(o="'"+o+"'"),"pylab.pie("+n+",explode="+r+",labels="+i+",autopct="+o+",shadow="+s+")\n"},rl=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.hist("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+")\n"},sl=function(e,t){return t.definitions_.import_pylab="import pylab","pylab."+this.getFieldValue("DIR")+"ticks("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+",fontproperties = 'STSong')\n"},ol=function(e,t){t.definitions_.import_numpy="import numpy";var n=t.valueToCode(this,"NUM",t.ORDER_NONE)||"0";return["numpy."+this.getFieldValue("OP")+"("+n+")",t.ORDER_ATOMIC]},al=function(e,t){return t.definitions_.import_numpy="import numpy","pylab.subplot("+(t.valueToCode(this,"VET",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"HOR",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"NUM",t.ORDER_NONE)||"0")+")\n"},ll=function(e,t){return t.definitions_.import_pandas="import pandas",["pandas.read_csv("+t.valueToCode(this,"FILENAME",t.ORDER_ATOMIC)+", header="+this.getFieldValue("MODE")+")",t.ORDER_ATOMIC]},ul=function(e,t){var n=this.getFieldValue("MODE"),i=t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT);if("column"==n)var s=i+"["+r+"]";else if("raw"==n)s=i+".loc["+r+"]";return[s,t.ORDER_ATOMIC]},cl=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.savefig("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")\n"},dl=function(e,t){return t.definitions_.import_numpy="import numpy","pylab.text("+(t.valueToCode(this,"VET",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"HOR",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"NUM",t.ORDER_NONE)||"0")+", ha='"+this.getFieldValue("HALIGN")+"', va='"+this.getFieldValue("VALIGN")+"', fontsize="+(t.valueToCode(this,"FONTNUM",t.ORDER_ASSIGNMENT)||"0")+")\n"},hl=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0";return t.definitions_.import_numpy="import numpy",["numpy.array("+n+")",t.ORDER_ATOMIC]},pl=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt";return"plt.show()\n"},fl=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt";return"plt.axes(aspect=1)\n"},ml=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt","plt.plot("+(t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0")+")\n"},gl=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt";var n=this.getFieldValue("LINE"),i=this.getFieldValue("COLOR"),r=this.getFieldValue("DOT");return"plt.plot("+(t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0")+", '"+r+n+i+"')\n"},yl=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt",t.definitions_.import_matplotlib_font_manager="import matplotlib.font_manager";return'plt.legend(prop=matplotlib.font_manager.FontProperties("STSong"))\n'},_l=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt","plt.title("+t.valueToCode(this,"TITLE",t.ORDER_ATOMIC)+', fontproperties="STSong")\n'},vl=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt","plt."+this.getFieldValue("DIR")+"label("+t.valueToCode(this,"LABEL",t.ORDER_ATOMIC)+', fontproperties="STSong")\n'},bl=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt","plt."+this.getFieldValue("DIR")+"("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+", "+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+")\n"},Tl=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt","plt.scatter("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+", "+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+", s="+(t.valueToCode(this,"S",t.ORDER_ATOMIC)||"''")+", c='"+this.getFieldValue("COLOR")+"', marker='"+this.getFieldValue("DOT")+"', label="+(t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''")+")\n"},xl=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=this.getFieldValue("LINE"),s=this.getFieldValue("COLOR");return"plt.plot("+n+", "+i+", '"+this.getFieldValue("DOT")+r+s+"', label="+(t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''")+")\n"},El=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''",s=t.valueToCode(this,"WIDTH",t.ORDER_RELATIONAL)||"0",o=this.getFieldValue("COLOR");return"plt.bar("+n+", "+i+', align="'+this.getFieldValue("ALIGN")+'", color="'+o+'", width='+s+", label="+r+")\n"},wl=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=t.valueToCode(this,"EXPLODE",t.ORDER_ATOMIC)||"''",s=this.getFieldValue("SHADOW"),o=this.getFieldValue("autopct");return"None"!=o&&(o="'"+o+"'"),"plt.pie("+n+", explode="+r+", labels="+i+", autopct="+o+", shadow="+s+")\n"},Il=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt","plt.hist("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+", "+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+")\n"},Al=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt","plt."+this.getFieldValue("DIR")+"ticks("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+", "+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+", fontproperties = 'STSong')\n"},Sl=function(e,t){return t.definitions_.import_numpy="import numpy",t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt","plt.subplot("+(t.valueToCode(this,"VET",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"HOR",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"NUM",t.ORDER_NONE)||"0")+")\n"},Cl=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt";return"plt.savefig('1.png')\n"},Ol=function(e,t){return t.definitions_.import_numpy="import numpy",t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt","plt.text("+(t.valueToCode(this,"VET",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"HOR",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"NUM",t.ORDER_NONE)||"0")+", ha='"+this.getFieldValue("HALIGN")+"', va='"+this.getFieldValue("VALIGN")+"', fontsize="+(t.valueToCode(this,"FONTNUM",t.ORDER_ASSIGNMENT)||"0")+")\n"},Ml=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.shape("+(t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]")+")",t.ORDER_ATOMIC]},Rl=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.reshape("+(t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]")+", "+(t.valueToCode(e,"DIMENSIONS",t.ORDER_ATOMIC)||"(1, -1)")+")",t.ORDER_ATOMIC]},kl=function(e,t){return t.definitions_.import_numpy="import numpy",[(t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]")+".astype("+e.getFieldValue("TYPE")+")",t.ORDER_ATOMIC]},Nl=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.imshow("+(t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]")+', cmap="'+(e.getFieldValue("COLORMAP")||"gray")+'")\n'},Dl=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.mean("+(t.valueToCode(e,"X",t.ORDER_ATOMIC)||"[]")+"["+(t.valueToCode(e,"Y",t.ORDER_ATOMIC)||"[]")+" == "+(t.valueToCode(e,"DIGIT",t.ORDER_ATOMIC)||"0")+"], axis=0)",t.ORDER_ATOMIC]},Fl=function(e,t){return t.definitions_.import_numpy="import numpy",t.definitions_.import_cv2="import cv2",["numpy.argmin([numpy.sum(cv2.absdiff("+(t.valueToCode(e,"IMAGE",t.ORDER_ATOMIC)||"[]")+", template)) for template in "+(t.valueToCode(e,"TEMPLATES",t.ORDER_ATOMIC)||"[]")+"])",t.ORDER_ATOMIC]},Ll=function(e,t){t.definitions_.import_numpy="import numpy";var n=t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]",i=e.getFieldValue("AXIS");if("NONE"===i)var r="numpy.mean("+n+")";else r="numpy.mean("+n+", axis="+i+")";return[r,t.ORDER_ATOMIC]},Pl=function(e,t){t.definitions_.import_numpy="import numpy";var n=t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]",i=e.getFieldValue("AXIS");if("NONE"===i)var r="numpy.std("+n+")";else r="numpy.std("+n+", axis="+i+")";return[r,t.ORDER_ATOMIC]},Bl=function(e,t){return t.definitions_.import_pandas="import pandas",[(t.valueToCode(e,"DF",t.ORDER_ATOMIC)||"df")+".dropna()",t.ORDER_MEMBER]},$l=function(e,t){return t.definitions_.import_pandas="import pandas",[(t.valueToCode(e,"DATAFRAME",t.ORDER_ATOMIC)||"df")+".drop(columns="+(t.valueToCode(e,"COLUMNS",t.ORDER_ATOMIC)||"[]")+", axis=1)",t.ORDER_ATOMIC]},Ul=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.ones("+(t.valueToCode(e,"NUM",t.ORDER_ATOMIC)||"1")+")",t.ORDER_ATOMIC]},zl=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.c_["+(t.valueToCode(e,"ARRAY1",t.ORDER_ATOMIC)||"[]")+", "+(t.valueToCode(e,"ARRAY2",t.ORDER_ATOMIC)||"[]")+"]",t.ORDER_ATOMIC]},Vl=function(e,t){return t.definitions_.import_numpy="import numpy",t.definitions_.import_linalg="import numpy.linalg",["numpy.linalg.det("+(t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]")+")",t.ORDER_ATOMIC]},jl=function(e,t){return[(t.valueToCode(e,"MATRIX",t.ORDER_ATOMIC)||"[]")+".T",t.ORDER_ATOMIC]},Yl=function(e,t){return[(t.valueToCode(e,"MATRIX1",t.ORDER_ATOMIC)||"[]")+" @ "+(t.valueToCode(e,"MATRIX2",t.ORDER_ATOMIC)||"[]"),t.ORDER_ATOMIC]},Gl=function(e,t){return t.definitions_.import_numpy="import numpy",t.definitions_.import_linalg="import numpy.linalg",["numpy.linalg.inv("+(t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]")+")",t.ORDER_ATOMIC]},Hl=function(e,t){return[(t.valueToCode(e,"DATAFRAME",t.ORDER_ATOMIC)||"df")+".median()",t.ORDER_ATOMIC]},Wl=function(e,t){return(t.valueToCode(e,"DATAFRAME",t.ORDER_ATOMIC)||"df")+".fillna(value="+(t.valueToCode(e,"VALUE",t.ORDER_ATOMIC)||"0")+", inplace="+(e.getFieldValue("INPLACE")||"False")+")\n"},Xl=function(e,t){return[(t.valueToCode(e,"DATAFRAME",t.ORDER_ATOMIC)||"df")+".info()",t.ORDER_ATOMIC]},ql=function(e,t){t.definitions_.import_numpy="import numpy";var n=t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]",i=e.getFieldValue("AXIS");return["None"===i?"numpy.min("+n+")":"numpy.min("+n+", axis="+i+")",t.ORDER_ATOMIC]},Kl=function(e,t){t.definitions_.import_numpy="import numpy";var n=t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]",i=e.getFieldValue("AXIS");return["None"===i?"numpy.max("+n+")":"numpy.max("+n+", axis="+i+")",t.ORDER_ATOMIC]},Zl=function(e,t){return t.definitions_.import_numpy="import numpy",[(t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]")+".size",t.ORDER_ATOMIC]},Ql=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.dot("+(t.valueToCode(e,"ARRAY1",t.ORDER_ATOMIC)||"[]")+", "+(t.valueToCode(e,"ARRAY2",t.ORDER_ATOMIC)||"[]")+")",t.ORDER_ATOMIC]},Jl=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.square("+(t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]")+")",t.ORDER_ATOMIC]},eu=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.sum("+(t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]")+")",t.ORDER_ATOMIC]},tu=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.random.random("+(t.valueToCode(e,"SIZE",t.ORDER_ATOMIC)||"1")+")",t.ORDER_ATOMIC]},nu=function(e,t){return["sum("+(t.valueToCode(e,"ARRAY",t.ORDER_ATOMIC)||"[]")+")",t.ORDER_ATOMIC]},iu=function(e,t){return[`${t.valueToCode(e,"DICT",t.ORDER_ATOMIC)||"df"}.sort_values(by=${t.valueToCode(e,"KEY",t.ORDER_ATOMIC)||"'tag'"}, ascending=${e.getFieldValue("AS_CENDING")})`,t.ORDER_ATOMIC]},ru=function(e,t){const n=t.valueToCode(e,"DICT",t.ORDER_ATOMIC)||"df",i=t.valueToCode(e,"LINES",t.ORDER_ATOMIC)||"1";return[`${n}.${e.getFieldValue("TYPE")}(${i})`,t.ORDER_ATOMIC]},su=function(e,t){return[`${t.valueToCode(e,"DICT",t.ORDER_ATOMIC)||"df"}[${t.valueToCode(e,"KEY",t.ORDER_ATOMIC)||"df['tag'] > 1"}]`,t.ORDER_ATOMIC]},ou=function(e,t){return[`${t.valueToCode(e,"DICT",t.ORDER_ATOMIC)||"df"}.groupby(by=${t.valueToCode(e,"KEY",t.ORDER_ATOMIC)||"'tag'"})`,t.ORDER_ATOMIC]},au=function(e,t){return[`${t.valueToCode(e,"DICT",t.ORDER_ATOMIC)||"df"}.${e.getFieldValue("TYPE")}()`,t.ORDER_ATOMIC]},lu=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot as plt";return"plt.cla()\n"},uu=function(e,t){var n=t.variableDB_.getName(this.getFieldValue("VAR"),k.Variables.NAME_TYPE),i=t.variableDB_.getName(this.getFieldValue("TYPE"),k.Variables.NAME_TYPE),r="class "+i+":\n";r+=" def __init__(self):\n";for(var s=new Array(this.itemCount_),o=0;o<this.itemCount_;o++){var a=this.getFieldValue("KEY"+o);s[o]=" self."+a+" = "+(t.valueToCode(this,"ADD"+o,t.ORDER_NONE)||"0")}return r+=s.join("\n")+"\n",r+=" self.next = None\n",r+=n+" = "+i+"()\n"},cu=function(e,t){return(t.valueToCode(this,"NODE",t.ORDER_ASSIGNMENT)||"0")+" = "+t.variableDB_.getName(this.getFieldValue("TYPE"),k.Variables.NAME_TYPE)+"()\n"},du=function(e,t){return[(t.valueToCode(this,"NODE",t.ORDER_ASSIGNMENT)||"0")+"."+t.variableDB_.getName(this.getFieldValue("TYPE"),k.Variables.NAME_TYPE),t.ORDER_ATOMIC]},hu=function(e,t){return(t.valueToCode(this,"NODE",t.ORDER_ASSIGNMENT)||"0")+"."+t.variableDB_.getName(this.getFieldValue("TYPE"),k.Variables.NAME_TYPE)+" = "+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+"\n"},pu=function(e,t){var n=t.valueToCode(this,"NODE",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"NODE2",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"NODE3",t.ORDER_ASSIGNMENT)||"0",s=this.getFieldValue("DIR");if("after"==s){var o="now = "+n+"\n";o+="while now != "+i+" and now != None:\n",o+=" now = now.next\n",o+="if now != None:\n",o+=" "+r+".next = now.next\n",o+=" now.next = "+r+"\n",o+=' print("插入节点成功")\n',o+="else:\n",o+=' print("插入节点失败,未找到指定名称的节点")\n'}if("before"==s){o="if "+n+" == "+i+":\n";o+=" "+r+".next = "+n+"\n",o+="else:\n",o+=" now = "+n+"\n",o+=" while now.next != "+i+" and now.next != None:\n",o+=" now = now.next\n",o+=" if now != None:\n",o+=" "+r+".next = now.next\n",o+=" now.next = "+r+"\n",o+=' print("插入节点成功")\n',o+=" else:\n",o+=' print("插入节点失败,未找到指定名称的节点")\n'}return o},fu=function(e,t){var n=t.valueToCode(this,"NODE",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"NODE3",t.ORDER_ASSIGNMENT)||"0",s=t.variableDB_.getName(this.getFieldValue("TYPE"),k.Variables.NAME_TYPE),o=this.getFieldValue("DIR");if("after"==o){var a="now = "+n+"\n";a+="while now."+s+" != "+i+" and now != None:\n",a+=" now = now.next\n",a+="if now != None:\n",a+=" "+r+".next = now.next\n",a+=" now.next = "+r+"\n",a+=' print("插入节点成功")\n',a+="else:\n",a+=' print("插入节点失败,未找到指定的节点")\n'}if("before"==o){a="if "+n+"."+s+" == "+i+":\n";a+=" "+r+".next = "+n+"\n",a+="else:\n",a+=" now = "+n+"\n",a+=" while now.next."+s+" != "+i+"and now.next != None:\n",a+=" now = now.next\n",a+=" if now != None:\n",a+=" "+r+".next = now.next\n",a+=" now.next = "+r+"\n",a+=' print("插入节点成功")\n',a+=" else:\n",a+=' print("插入节点失败,未找到指定的节点")\n'}return a},mu=function(e,t){var n=t.valueToCode(this,"NODE",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"NODE2",t.ORDER_ASSIGNMENT)||"0",r="if "+n+" == "+i+":\n";return r+=" "+n+".next = None\n",r+="else:\n",r+=" now = "+n+"\n",r+=" while now.next != "+i+" and now.next != None:\n",r+=" now = now.next\n",r+=" if now != None:\n",r+=" now.next = now.next.next\n",r+=' print("删除节点成功")\n',r+=" else:\n",r+=' print("删除节点失败,未找到指定名称的节点")\n'},gu=function(e,t){var n=t.valueToCode(this,"NODE",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0",r=t.variableDB_.getName(this.getFieldValue("TYPE"),k.Variables.NAME_TYPE),s="if "+n+"."+r+" == "+i+":\n";return s+=" "+n+".next = None\n",s+="else:\n",s+=" now = "+n+"\n",s+=" while now.next."+r+" != "+i+" and now.next != None:\n",s+=" now = now.next\n",s+=" if now != None:\n",s+=" now.next = now.next.next\n",s+=' print("删除节点成功")\n',s+=" else:\n",s+=' print("删除节点失败,未找到指定的节点")\n'},yu=function(e,t){var n="ptr = "+(t.valueToCode(this,"NODE",t.ORDER_ASSIGNMENT)||"0")+"\n";return n+="before = None\n",n+="while ptr != None:\n",n+=" last = before\n",n+=" before = ptr\n",n+=" ptr = ptr.next\n",n+=" before.next = last\n",n+=(t.valueToCode(this,"NODE2",t.ORDER_ASSIGNMENT)||"0")+" = before\n"},_u=function(e,t){var n=this.getFieldValue("path"),i=this.getFieldValue("module");return t.definitions_["import_"+n+"_"+i]="from "+n+" import "+i,""},vu=function(e,t){var n=this.getFieldValue("module");return t.definitions_["import_"+n]="import "+n,""},bu=function(e,t){for(var n=this.getFieldValue("NAME"),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"";return n+"("+i.join(", ")+")\n"},Tu=function(e,t){for(var n=this.getFieldValue("NAME"),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"";return[n+"("+i.join(", ")+")",t.ORDER_ATOMIC]},xu=function(){var e=this.getFieldValue("TYPE");return this.getFieldValue("NAME")+" = "+e+"()\n"},Eu=function(e,t){for(var n=this.getFieldValue("NAME"),i=this.getFieldValue("METHOD"),r=new Array(this.itemCount_),s=0;s<this.itemCount_;s++)r[s]=t.valueToCode(this,"ADD"+s,t.ORDER_NONE)||"";return n+"."+i+"("+r.join(", ")+")\n"},wu=function(e,t){for(var n=this.getFieldValue("NAME"),i=this.getFieldValue("METHOD"),r=new Array(this.itemCount_),s=0;s<this.itemCount_;s++)r[s]=t.valueToCode(this,"ADD"+s,t.ORDER_NONE)||"";return[n+"."+i+"("+r.join(", ")+")",t.ORDER_ATOMIC]},Iu=function(){return this.getFieldValue("VALUE")+"\n"},Au=function(e,t){return[this.getFieldValue("VALUE"),t.ORDER_ATOMIC]},Su=function(){return this.getFieldValue("VALUE")+"\n"},Cu=function(e,t){return[this.getFieldValue("VALUE"),t.ORDER_ATOMIC]},Ou=function(e,t){return t.definitions_.import_s4alib="import s4alib",t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+' = s4alib.s4a_start("'+Vi.JSFuncs.getCom()+'")\n'},Mu=function(e,t){return["HIGH"==this.getFieldValue("BOOL")?"1":"0",t.ORDER_ATOMIC]},Ru=function(e,t){t.definitions_.import_s4alib="import s4alib";var n="";return n+=t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+".digital_write("+t.valueToCode(this,"PIN",t.ORDER_ATOMIC)+","+t.valueToCode(this,"STAT",t.ORDER_ATOMIC)+")\n"},ku=function(e,t){t.definitions_.import_s4alib="import s4alib";return[t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+".digital_read("+t.valueToCode(this,"PIN",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Nu=function(e,t){t.definitions_.import_s4alib="import s4alib";return[t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+".analog_read("+t.valueToCode(this,"PIN",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Du=function(e,t){t.definitions_.import_s4alib="import s4alib";var n="";return n+=t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+".analog_write("+t.valueToCode(this,"PIN",t.ORDER_ATOMIC)+","+t.valueToCode(this,"NUM",t.ORDER_ATOMIC)+")\n"},Fu=function(e,t){return["input("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+")",t.ORDER_ATOMIC]},Lu=function(e,t){return"print("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+")\n"},Pu=function(e,t){return"print("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+',end ="")\n'},Bu=function(e,t){return"print("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+",end ="+(t.valueToCode(this,"END",t.ORDER_ATOMIC)||'""')+")\n"},$u=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""',i=this.getFieldValue("DIR");if("str"==i)var r="input("+n+")";else if("int"==i)r="int(input("+n+"))";else if("float"==i)r="float(input("+n+"))";return[r,t.ORDER_ATOMIC]},Uu=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""',i=this.getFieldValue("DIR");if(t.definitions_.import_pyinput="import pyinput","str"==i)var r="pyinput.input("+n+")";else if("int"==i)r="int(pyinput.input("+n+"))";else if("float"==i)r="float(pyinput.input("+n+"))";return[r,t.ORDER_ATOMIC]},zu=function(e,t){for(var n=new Array(this.itemCount_),i=0;i<this.itemCount_;i++)n[i]=t.valueToCode(this,"ADD"+i,t.ORDER_NONE)||"0";return n="print("+n.join(", ")+")\n"},Vu=function(e,t){t.definitions_.import_mixiot="import mixiot";var n=t.valueToCode(this,"SERVER",t.ORDER_ATOMIC),i=t.valueToCode(this,"USERNAME",t.ORDER_ATOMIC),r=t.valueToCode(this,"PASSWORD",t.ORDER_ATOMIC),s=t.valueToCode(this,"PROJECT",t.ORDER_ATOMIC),o=Math.round(new Date).toString(),a="f'python-mqtt-"+i.replace("'","").replace("'","")+o.replace("'","").replace("'","")+"'";return"mqtt_client = mixiot.MixIO("+n+", 1883 ,"+i+", "+r+", "+s+", "+a+")\n"},ju=function(e,t){var n=t.valueToCode(this,"TOPIC",t.ORDER_ATOMIC),i=t.valueToCode(this,"MSG",t.ORDER_ATOMIC);return t.definitions_.import_mixiot="import mixiot","mqtt_client.publish("+n+", "+i+")\n"},Yu=function(e,t){var n=t.valueToCode(this,"TOPIC",t.ORDER_ATOMIC),i=t.valueToCode(this,"METHOD",t.ORDER_ATOMIC);return t.definitions_.import_mixiot="import mixiot","mqtt_client.subscribe_and_set_callback("+n+","+i+")\n"},Gu=function(e,t){var n=t.valueToCode(this,"TOPIC",t.ORDER_ATOMIC);return t.definitions_.import_mixiot="import mixiot","mqtt_client.unsubscribe("+n+")\n"},Hu=function(e,t){t.definitions_.import_mixiot="import mixiot";return"mqtt_client.disconnect()\n"},Wu=function(e,t){t.definitions_.import_mixiot="import mixiot";return"mqtt_client.connect()\n"},Xu=function(e,t){t.definitions_.import_mixiot="import mixiot";return"mqtt_client.check_msg()\n"},qu=function(e,t){return['mqtt_client.decode("utf-8").split("/")[-1]',t.ORDER_ATOMIC]},Ku=function(e,t){return['mqtt_client.decode("utf-8")',t.ORDER_ATOMIC]},Zu=function(e,t){return t.definitions_.import_mixpy="import mixpy",["mixpy.format_content("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+", mqtt_client.client_id)",t.ORDER_ATOMIC]},Qu=function(e,t){return t.definitions_.import_mixpy="import mixpy",["mixpy.format_str("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Ju=function(e,t){t.definitions_.import_mixiot="import mixiot";var n=t.valueToCode(this,"SERVER",t.ORDER_ATOMIC),i=t.valueToCode(this,"KEY",t.ORDER_ATOMIC),r=Math.round(new Date).toString(),s="f'python-mqtt-"+i.replace("'","").replace("'","")+r.replace("'","").replace("'","")+"'";return"mqtt_client = mixiot.MixIO.from_mixly_key("+n+", 1883 ,"+i+", "+s+")\n"},ec=function(e,t){return[this.getFieldValue("VISITOR_ID"),t.ORDER_ATOMIC]},tc=function(e,t){return["'"+this.getFieldValue("VISITOR_ID")+"'",t.ORDER_ATOMIC]},nc=function(e,t){t.definitions_.import_mixiot="import mixiot";var n=t.valueToCode(this,"SERVER",t.ORDER_ATOMIC),i=t.valueToCode(this,"KEY",t.ORDER_ATOMIC),r=Math.round(new Date).toString(),s="f'python-mqtt-"+i.replace("'","").replace("'","")+r.replace("'","").replace("'","")+"'";return"mqtt_client = mixiot.MixIO.from_share_key("+n+", 1883 ,"+i+", "+s+")\n"},ic=function(e,t){t.definitions_.import_mixiot="import mixiot";return["mqtt_client.pingSync()",t.ORDER_ATOMIC]},rc=function(e,t){return t.definitions_.import_mixiot="import mixiot",["mixiot.ntp("+t.valueToCode(this,"addr",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},sc=function(e,t){return[this.getFieldValue("PIN"),t.ORDER_ATOMIC]},oc=sc,ac=sc,lc=sc,uc=sc,cc=function(e,t){t.definitions_.import_serial="import serial";var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0",i=t.variableDB_.getName(this.getFieldValue("SER"),k.Variables.NAME_TYPE),r=this.getFieldValue("BPS");return i+' = serial.Serial("'+Vi.JSFuncs.getCom()+'", '+r+", timeout="+n+")\n"},dc=function(e,t){return t.definitions_.import_serial="import serial",(t.valueToCode(this,"SER",t.ORDER_ADDITIVE)||"ser")+".write("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+")\n"},hc=function(e,t){return t.definitions_.import_serial="import serial",[(t.valueToCode(this,"SER",t.ORDER_ADDITIVE)||"ser")+".read("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},pc=function(e,t){return t.definitions_.import_serial="import serial",(t.valueToCode(this,"SER",t.ORDER_ADDITIVE)||"ser")+".close()\n"},fc=function(e,t){var n=t.valueToCode(this,"n_samples",t.ORDER_ATOMIC)||"100",i=t.valueToCode(this,"n_features",t.ORDER_ATOMIC)||"20",r=t.valueToCode(this,"n_informative",t.ORDER_ATOMIC)||"2",s=t.valueToCode(this,"n_redundant",t.ORDER_ATOMIC)||"2",o=t.valueToCode(this,"n_repeated",t.ORDER_ATOMIC)||"0",a=t.valueToCode(this,"n_classes",t.ORDER_ATOMIC)||"2",l=t.valueToCode(this,"n_clusters_per_class",t.ORDER_ATOMIC)||"2",u=t.valueToCode(this,"random_state",t.ORDER_ATOMIC)||"None";return t.definitions_.import_sklearn_make_classification="from sklearn.datasets import make_classification",["make_classification(n_samples="+n+", n_features="+i+", n_informative="+r+", n_redundant="+s+", n_repeated="+o+", n_classes="+a+", n_clusters_per_class="+l+", random_state="+u+")",t.ORDER_ATOMIC]},mc=function(e,t){var n=t.valueToCode(this,"n_samples",t.ORDER_ATOMIC)||"100",i=t.valueToCode(this,"n_features",t.ORDER_ATOMIC)||"100",r=t.valueToCode(this,"n_informative",t.ORDER_ATOMIC)||"10",s=t.valueToCode(this,"n_targets",t.ORDER_ATOMIC)||"1",o=t.valueToCode(this,"bias",t.ORDER_ATOMIC)||"0.0",a=t.valueToCode(this,"noise",t.ORDER_ATOMIC)||"0.0",l=t.valueToCode(this,"random_state",t.ORDER_ATOMIC)||"None";return t.definitions_.import_sklearn_make_regression="from sklearn.datasets import make_regression",["make_regression(n_samples="+n+", n_features="+i+", n_informative="+r+", n_targets="+s+", bias="+o+", noise="+a+", random_state="+l+")",t.ORDER_ATOMIC]},gc=function(e,t){var n=t.valueToCode(this,"n_samples",t.ORDER_ATOMIC)||"100",i=t.valueToCode(this,"n_features",t.ORDER_ATOMIC)||"2",r=t.valueToCode(this,"centers",t.ORDER_ATOMIC)||"None",s=t.valueToCode(this,"cluster_std",t.ORDER_ATOMIC)||"1.0",o=t.valueToCode(this,"center_box",t.ORDER_ATOMIC)||"(-10.0,10.0)",a=t.valueToCode(this,"shuffle",t.ORDER_ATOMIC)||"True",l=t.valueToCode(this,"random_state",t.ORDER_ATOMIC)||"None";return t.definitions_.import_sklearn_make_blobs="from sklearn.datasets import make_blobs",["make_blobs(n_samples="+n+", n_features="+i+", centers="+r+", cluster_std="+s+", center_box="+o+", shuffle="+a+", random_state="+l+")",t.ORDER_ATOMIC]},yc=function(e,t){var n=this.getFieldValue("type"),i=this.getFieldValue("name");return t.definitions_.import_sklearn_datasets="from sklearn import datasets",i+" = datasets."+n+"()\n"},_c=function(e,t){return[(t.valueToCode(this,"name",t.ORDER_ATOMIC)||"iris")+"."+this.getFieldValue("type"),t.ORDER_ATOMIC]},vc=function(e,t){var n=t.valueToCode(this,"train_data",t.ORDER_ATOMIC)||"iris_X",i=t.valueToCode(this,"train_target",t.ORDER_ATOMIC)||"iris_y",r=t.valueToCode(this,"test_size",t.ORDER_ATOMIC)||"0.3",s=t.valueToCode(this,"rondom_state",t.ORDER_ATOMIC)||"None";if(t.definitions_.import_sklearn_train_test_split="from sklearn.model_selection import train_test_split","None"==i)var o="train_test_split("+n+", test_size="+r+", random_state="+s+")";else o="train_test_split("+n+", "+i+", test_size="+r+", random_state="+s+")";return[o,t.ORDER_ATOMIC]},bc=function(e,t){var n=t.valueToCode(this,"train_data",t.ORDER_ATOMIC)||"iris_X",i=t.valueToCode(this,"test_size",t.ORDER_ATOMIC)||"0.3",r=t.valueToCode(this,"rondom_state",t.ORDER_ATOMIC)||"None";return t.definitions_.import_sklearn_train_test_split="from sklearn.model_selection import train_test_split",["train_test_split("+n+", test_size="+i+", random_state="+r+")",t.ORDER_ATOMIC]},Tc=function(e,t){var n=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model",i=t.valueToCode(this,"fit_intercept",t.ORDER_ATOMIC)||"True",r=t.valueToCode(this,"normalize",t.ORDER_ATOMIC)||"False",s=t.valueToCode(this,"n_jobs",t.ORDER_ATOMIC)||"None";return t.definitions_.import_sklearn_linear_model="from sklearn.linear_model import LinearRegression",n+" = LinearRegression(fit_intercept="+i+", normalize="+r+", n_jobs="+s+")\n"},xc=function(e,t){var n=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model",i=t.valueToCode(this,"alpha",t.ORDER_ATOMIC)||"1.0",r=t.valueToCode(this,"fit_intercept",t.ORDER_ATOMIC)||"True",s=t.valueToCode(this,"normalize",t.ORDER_ATOMIC)||"False",o=t.valueToCode(this,"max_iter",t.ORDER_ATOMIC)||"300",a=t.valueToCode(this,"random_state",t.ORDER_ATOMIC)||"None";return t.definitions_.import_sklearn_linear_model="from sklearn.linear_model import Ridge",n+" = Ridge(alpha="+i+", fit_intercept="+r+", normalize="+s+", max_iter="+o+", random_state="+a+")\n"},Ec=function(e,t){var n=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model",i=this.getFieldValue("type"),r=t.valueToCode(this,"max_depth",t.ORDER_ATOMIC)||"None",s=t.valueToCode(this,"random_state",t.ORDER_ATOMIC)||"None";return t.definitions_["import_sklearn_"+i]="from sklearn.tree import "+i,n+" = "+i+"(max_depth="+r+", random_state="+s+")\n"},wc=function(e,t){var n=this.getFieldValue("type"),i=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"Model",r=t.valueToCode(this,"n_estimators",t.ORDER_ATOMIC)||"100",s=t.valueToCode(this,"max_depth",t.ORDER_ATOMIC)||"None",o=t.valueToCode(this,"n_jobs",t.ORDER_ATOMIC)||"None",a=t.valueToCode(this,"random_state",t.ORDER_ATOMIC)||"None";return t.definitions_["import_sklearn_"+n]="from sklearn.ensemble import "+n,i+" = "+n+"(n_estimators="+r+", max_depth="+s+", n_jobs="+o+", random_state="+a+")\n"},Ic=function(e,t){var n=this.getFieldValue("type"),i=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model",r=t.valueToCode(this,"K",t.ORDER_ATOMIC)||"5",s=t.valueToCode(this,"n_jobs",t.ORDER_ATOMIC)||"None";return t.definitions_["import_sklearn_"+n]="from sklearn.neighbors import "+n,i+" = "+n+"(n_neighbors="+r+", n_jobs="+s+")\n"},Ac=function(e,t){var n=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model";return t.definitions_.import_sklearn_GaussianNB="from sklearn.naive_bayes import GaussianNB",n+" = GaussianNB()\n"},Sc=function(e,t){var n=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"pca",i=t.valueToCode(this,"n_components",t.ORDER_ATOMIC)||"2";return t.definitions_.import_sklearn_pca="from sklearn.decomposition import PCA",n+" = PCA(n_components="+i+")\n"},Cc=function(e,t){return[t.valueToCode(e,"model_name",t.ORDER_ATOMIC)+".fit_transform("+t.valueToCode(e,"train_data",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Oc=function(e,t){var n=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model",i=t.valueToCode(this,"n_clusters",t.ORDER_ATOMIC)||"8",r=t.valueToCode(this,"max_iter",t.ORDER_ATOMIC)||"300",s=t.valueToCode(this,"random_state",t.ORDER_ATOMIC)||"None";return t.definitions_.import_sklearn_KMeans="from sklearn.cluster import KMeans",n+" = KMeans(n_clusters="+i+", max_iter="+r+", random_state="+s+")\n"},Mc=function(e,t){return t.valueToCode(e,"model_name",t.ORDER_ATOMIC)+".fit("+t.valueToCode(e,"train_data",t.ORDER_ATOMIC)+")\n"},Rc=function(e,t){var n=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model",i=t.valueToCode(this,"train_data",t.ORDER_ATOMIC)||"X_train",r=t.valueToCode(this,"train_target",t.ORDER_ATOMIC)||"y_train";if("None"==r)var s=n+".fit("+i+")\n";else s=n+".fit("+i+", "+r+")\n";return s},kc=function(e,t){return(t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model")+".fit("+(t.valueToCode(this,"train_data",t.ORDER_ATOMIC)||"X_train")+")\n"},Nc=function(e,t){return[(t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model")+".predict("+(t.valueToCode(this,"train_data",t.ORDER_ATOMIC)||"X_test")+")",t.ORDER_ATOMIC]},Dc=function(e,t){var n=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model",i=t.valueToCode(this,"train_data",t.ORDER_ATOMIC)||"X_train",r=t.valueToCode(this,"train_target",t.ORDER_ATOMIC)||"y_train";if("None"==r)var s=n+".score("+i+")";else s=n+".score("+i+", "+r+")";return[s,t.ORDER_ATOMIC]},Fc=function(e,t){return[(t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model")+".score("+(t.valueToCode(this,"train_data",t.ORDER_ATOMIC)||"X_train")+")",t.ORDER_ATOMIC]},Lc=function(e,t){return[(t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model")+"."+this.getFieldValue("type"),t.ORDER_ATOMIC]},Pc=function(e,t){return[(t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model")+"."+this.getFieldValue("type"),t.ORDER_ATOMIC]},Bc=function(e,t){var n=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model",i=this.getFieldValue("type"),r=t.valueToCode(this,"address",t.ORDER_ATOMIC)||"D:/mixly/test.pkl";t.definitions_.import_sklearn_joblib="import joblib";return"dump"==i?"joblib.dump("+n+", "+r+")\n":n+" = joblib.load("+r+")\n"},$c=function(e,t){t.definitions_.import_time="import time";return["time.time()",t.ORDER_ATOMIC]},Uc=function(){return"exit()\n"},zc=function(e,t){t.definitions_.import_time="import time";var n=this.getFieldValue("op"),i="time.localtime()["+n+"]";if("all"===n){return["time.localtime()",t.ORDER_ASSIGNMENT]}return[i,t.ORDER_ASSIGNMENT]},Vc=function(e,t){return t.definitions_.import_turtle="import turtle",t.variableDB_.getName(this.getFieldValue("VAR"),k.Variables.NAME_TYPE)+" = turtle.Turtle()\n"},jc=function(e,t){t.definitions_.import_turtle="import turtle";return"turtle.done()\n"},Yc=function(e,t){t.definitions_.import_turtle="import turtle";return"turtle.exitonclick()\n"},Gc=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},Hc=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},Wc=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".setheading("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+")\n"},Xc=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".screen.delay("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+")\n"},qc=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".goto("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+","+(t.valueToCode(this,"val",t.ORDER_ASSIGNMENT)||"0")+")\n"},Kc=function(e,t){return t.definitions_.import_turtle="import turtle",[(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"()",t.ORDER_ATOMIC]},Zc=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".stamp()\n"},Qc=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"()\n"},Jc=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"()\n"},ed=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"_fill()\n"},td=function(e,t){return t.definitions_.import_turtle="import turtle",this.getFieldValue("TUR")+"."+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},nd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".pensize("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+")\n"},id=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".speed("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+")\n"},rd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},sd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".set"+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},od=function(e,t){t.definitions_.import_turtle="import turtle";var n=t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0";return n+".circle ("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+","+i+")\n"},ad=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"()\n"},ld=function(e,t){return t.definitions_.import_turtle="import turtle",'turtle.bgcolor("'+this.getFieldValue("FIELDNAME")+'")\n'},ud=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+'.pencolor("'+this.getFieldValue("FIELDNAME")+'")\n'},cd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+'.fillcolor("'+this.getFieldValue("FIELDNAME")+'")\n'},dd=function(e,t){return t.definitions_.import_turtle="import turtle",[(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".clone()",t.ORDER_ATOMIC]},hd=function(e,t){return t.definitions_.import_turtle="import turtle","turtle.bgcolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},pd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".pencolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},fd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".fillcolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},md=function(e,t){return t.definitions_.import_turtle="import turtle","turtle.bgcolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},gd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".pencolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},yd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".fillcolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},_d=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".color("+t.valueToCode(this,"VAR1",t.ORDER_ATOMIC)+","+t.valueToCode(this,"VAR2",t.ORDER_ATOMIC)+")\n"},vd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+'.color("'+this.getFieldValue("FIELDNAME")+'","'+this.getFieldValue("FIELDNAME2")+'")\n'},bd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".shape('"+this.getFieldValue("DIR")+"')\n"},Td=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".shapesize("+(t.valueToCode(this,"WID",t.ORDER_ASSIGNMENT)||"0")+","+(t.valueToCode(this,"LEN",t.ORDER_ASSIGNMENT)||"0")+","+(t.valueToCode(this,"OUTLINE",t.ORDER_ASSIGNMENT)||"0")+")\n"},xd=function(e,t){return t.definitions_.import_turtle="import turtle",["turtle.textinput("+t.valueToCode(this,"TITLE",t.ORDER_ATOMIC)+","+t.valueToCode(this,"PROMPT",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Ed=function(e,t){return t.definitions_.import_turtle="import turtle",["turtle.numinput("+t.valueToCode(this,"TITLE",t.ORDER_ATOMIC)+","+t.valueToCode(this,"PROMPT",t.ORDER_ATOMIC)+","+t.valueToCode(this,"DEFAULT",t.ORDER_ATOMIC)+",minval = "+t.valueToCode(this,"MIN",t.ORDER_ATOMIC)+",maxval = "+t.valueToCode(this,"MAX",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},wd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".write("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},Id=function(e,t){t.definitions_.import_turtle="import turtle";var n=this.getFieldValue("MOVE"),i=this.getFieldValue("ALIGN"),r=t.valueToCode(this,"FONTNAME",t.ORDER_ATOMIC),s=t.valueToCode(this,"FONTNUM",t.ORDER_ASSIGNMENT)||"0",o=this.getFieldValue("FONTTYPE");return(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".write("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+","+n+',align="'+i+'",font=('+r+","+s+',"'+o+'"))\n'},Ad=function(e,t){t.definitions_.import_turtle="import turtle";var n=this.getFieldValue("MOVE"),i=this.getFieldValue("ALIGN"),r=t.valueToCode(this,"FONTNAME",t.ORDER_ATOMIC),s=t.valueToCode(this,"FONTNUM",t.ORDER_ASSIGNMENT)||"0",o=this.getFieldValue("FONTTYPE");return(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".write("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+","+n+',align="'+i+'",font=('+r+","+s+',"'+o+'"))\n'},Sd=function(e,t){return['"'+this.getFieldValue("COLOR")+'"',t.ORDER_ATOMIC]},Cd=function(e,t){t.definitions_.import_turtle="import turtle";var n=t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0";return t.variableDB_.getName(this.getFieldValue("VAR"),k.Variables.NAME_TYPE)+" = "+n+".getscreen()\n"},Od=function(e,t){t.definitions_.import_turtle="import turtle";var n=t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"VAR",t.ORDER_NONE)||"None";return n+".onkey("+(t.valueToCode(this,"callback",t.ORDER_NONE)||"None")+", "+i+")\n"},Md=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".onclick("+(t.valueToCode(this,"callback",t.ORDER_NONE)||"None")+")\n"},Rd=function(e,t){t.definitions_.import_turtle="import turtle";var n=t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"VAR",t.ORDER_NONE)||"None";return n+".ontimer("+(t.valueToCode(this,"callback",t.ORDER_NONE)||"None")+", "+i+")\n"},kd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".listen()\n"},Nd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".getcanvas().postscript(file="+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")\n"}},20936:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{cv_destroy_all:()=>cv_destroy_all,cv_face_classifier:()=>cv_face_classifier,cv_face_detect:()=>cv_face_detect,cv_face_detect_all:()=>cv_face_detect_all,cv_line_rect:()=>cv_line_rect,cv_read_image:()=>cv_read_image,cv_show_image:()=>cv_show_image,cv_text:()=>cv_text,cv_waitkey:()=>cv_waitkey,cv_write_image:()=>cv_write_image});const cv_read_image=function(e,t){return t.definitions_.import_cv2="import cv2",["cv2.imread("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},cv_show_image=function(e,t){return t.definitions_.import_cv2="import cv2","cv2.imshow("+t.valueToCode(this,"data",t.ORDER_ATOMIC)+","+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")\n"},cv_write_image=function(e,t){return t.definitions_.import_cv2="import cv2","cv2.imwrite("+t.valueToCode(this,"data",t.ORDER_ATOMIC)+","+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")\n"},cv_waitkey=function(e,t){return t.definitions_.import_cv2="import cv2","cv2.waitKey("+t.valueToCode(this,"data",t.ORDER_ATOMIC)+")\n"},cv_destroy_all=function(e,t){t.definitions_.import_cv2="import cv2";return"cv2.destroyAllWindows()\n"},cv_line_rect=function(_,generator){generator.definitions_.import_cv2="import cv2";var file=generator.valueToCode(this,"FILE",generator.ORDER_ATOMIC),x1=generator.valueToCode(this,"x1",generator.ORDER_ATOMIC),y1=generator.valueToCode(this,"y1",generator.ORDER_ATOMIC),x2=generator.valueToCode(this,"x2",generator.ORDER_ATOMIC),y2=generator.valueToCode(this,"y2",generator.ORDER_ATOMIC),thick=generator.valueToCode(this,"thick",generator.ORDER_ATOMIC),color=this.getFieldValue("FIELDNAME"),color1=eval("0x"+color[1]+color[2]),color2=eval("0x"+color[3]+color[4]),color3=eval("0x"+color[5]+color[6]),direction=this.getFieldValue("DIR"),code="cv2."+direction+"("+file+",("+x1+","+y1+"),("+x2+","+y2+"),("+color3+","+color2+","+color1+"),"+thick+")\n";return code},cv_text=function(_,generator){generator.definitions_.import_cv2="import cv2";var file=generator.valueToCode(this,"FILE",generator.ORDER_ATOMIC),x1=generator.valueToCode(this,"x1",generator.ORDER_ATOMIC),y1=generator.valueToCode(this,"y1",generator.ORDER_ATOMIC),data=generator.valueToCode(this,"data",generator.ORDER_ATOMIC),size=generator.valueToCode(this,"size",generator.ORDER_ATOMIC),thick=generator.valueToCode(this,"thick",generator.ORDER_ATOMIC),color=this.getFieldValue("FIELDNAME"),color1=eval("0x"+color[1]+color[2]),color2=eval("0x"+color[3]+color[4]),color3=eval("0x"+color[5]+color[6]),font=this.getFieldValue("font"),code="cv2.putText("+file+","+data+",("+x1+","+y1+"),cv2.FONT_HERSHEY_"+font+","+size+",("+color3+","+color2+","+color1+"),"+thick+")\n";return code},cv_face_classifier=function(e,t){return t.definitions_.import_cv2="import cv2",["cv2.CascadeClassifier("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},cv_face_detect=function(e,t){t.definitions_.import_cv2="import cv2";var n=t.valueToCode(this,"FILE",t.ORDER_ATOMIC);return[t.valueToCode(this,"FACE",t.ORDER_ATOMIC)+".detectMultiScale("+n+",scaleFactor="+t.valueToCode(this,"SCALE",t.ORDER_ATOMIC)+",minNeighbors="+t.valueToCode(this,"NEIGHBOR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},cv_face_detect_all=function(e,t){t.definitions_.import_cv2="import cv2";var n=t.valueToCode(this,"FILE",t.ORDER_ATOMIC);return[t.valueToCode(this,"FACE",t.ORDER_ATOMIC)+".detectMultiScale("+n+",scaleFactor="+t.valueToCode(this,"SCALE",t.ORDER_ATOMIC)+",minNeighbors="+t.valueToCode(this,"NEIGHBOR",t.ORDER_ATOMIC)+",minSize=("+t.valueToCode(this,"x1",t.ORDER_ATOMIC)+","+t.valueToCode(this,"y1",t.ORDER_ATOMIC)+"),maxSize=("+t.valueToCode(this,"x2",t.ORDER_ATOMIC)+","+t.valueToCode(this,"y2",t.ORDER_ATOMIC)+"))",t.ORDER_ATOMIC]}},58921:(e,t,n)=>{"use strict";n.d(t,{RK:()=>i,tk:()=>r,GI:()=>s,U5:()=>o});var i={};n.r(i),n.d(i,{sklearn_LinearRegression:()=>l});var r={};n.r(r),n.d(r,{sklearn_LinearRegression:()=>u});var s={};n.r(s);var o={};n.r(o),n.d(o,{tensorflow_add:()=>f,tensorflow_compile:()=>m,tensorflow_fit:()=>g,tensorflow_get_loss:()=>y,tensorflow_get_tensor_data:()=>v,tensorflow_init_tensor:()=>d,tensorflow_layers_dense:()=>p,tensorflow_predict:()=>_,tensorflow_prepare_picture:()=>x,tensorflow_save_or_export_model:()=>b,tensorflow_sequential:()=>h,tensorflow_use_load_model:()=>T});var a=n(13383);const l={init:function(){this.appendDummyInput().appendField("sklearn "+a.Msg.SKLEARN_LINEARREGRESSION_INIT),this.appendValueInput("model_name").setCheck(null).setAlign(a.inputs.Align.RIGHT).appendField(a.Msg.MODEL_NAME),this.appendValueInput("fit_intercept").setCheck(null).setAlign(a.inputs.Align.RIGHT).appendField(a.Msg.SKLEARN_CALCULATE_MODEL_INTERRUPT),this.appendValueInput("n_jobs").setCheck(null).setAlign(a.inputs.Align.RIGHT).appendField(a.Msg.SKLEARN_THREADS),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(80),this.setTooltip(""),this.setHelpUrl("")}},u=function(e,t){const n=t.valueToCode(this,"model_name",t.ORDER_ATOMIC)||"model",i=t.valueToCode(this,"fit_intercept",t.ORDER_ATOMIC)||"True",r=t.valueToCode(this,"n_jobs",t.ORDER_ATOMIC)||"None";t.definitions_.import_sklearn_linear_model="from sklearn.linear_model import LinearRegression";return n+" = LinearRegression(fit_intercept="+i+", n_jobs="+r+")\n"},c="#1216ab";a.Blocks.tensorflow_init_tensor={init:function(){this.appendValueInput("VAR").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_INIT_TENSOR),this.setOutput(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_sequential={init:function(){this.appendDummyInput().setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_SEQUENTIAL),this.setOutput(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_layers_dense={init:function(){this.appendDummyInput().setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_INIT_LAYERS_DENSE_LAYER),this.appendValueInput("VAR1").setCheck(null).setAlign(a.ALIGN_RIGHT).appendField(a.Msg.MIXLY_TENSORFLOW_OUTPUT_DIMENSION),this.appendValueInput("VAR2").setCheck(null).setAlign(a.ALIGN_RIGHT).appendField(a.Msg.MIXLY_TENSORFLOW_INPUT_SHAPE),this.setOutput(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_add={init:function(){this.appendValueInput("VAR1").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_MODEL),this.appendValueInput("VAR2").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_ADD_LAYER),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_compile={init:function(){this.appendValueInput("VAR1").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_COMPILE_MODEL),this.appendDummyInput().setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_LOSS_FUNCTION_TYPE).appendField(new a.FieldDropdown([[a.Msg.MIXLY_TENSORFLOW_MEAN_SQUARED_ERROR,"meanSquaredError"]]),"VAR2"),this.appendDummyInput().setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_OPTIMIZER).appendField(new a.FieldDropdown([[a.Msg.MIXLY_TENSORFLOW_SGD,"sgd"]]),"VAR3"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_fit={init:function(){this.appendValueInput("VAR1").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_FIT_MODEL),this.appendValueInput("VAR2").setCheck(null).setAlign(a.ALIGN_RIGHT).appendField(a.Msg.MIXLY_TENSORFLOW_FIT_INPUT_DATA),this.appendValueInput("VAR3").setCheck(null).setAlign(a.ALIGN_RIGHT).appendField(a.Msg.MIXLY_TENSORFLOW_FIT_TARGET_DATA),this.appendValueInput("VAR4").setCheck(null).setAlign(a.ALIGN_RIGHT).appendField(a.Msg.MIXLY_TENSORFLOW_FIT_EPOCHS),this.appendValueInput("VAR5").setCheck(null).setAlign(a.ALIGN_RIGHT).appendField(a.Msg.MIXLY_TENSORFLOW_FIT_VERBOSE),this.appendDummyInput().setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_FIT_RETURN_HISTORY),this.setInputsInline(!1),this.setOutput(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_get_loss={init:function(){this.appendValueInput("VAR").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_GET_LOSS_FROM_HISTORY),this.appendDummyInput().setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_GET_LOSS_FROM_HISTORY_2),this.setOutput(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_predict={init:function(){this.appendValueInput("VAR1").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_PREDICT),this.appendValueInput("VAR2").setCheck(null).setAlign(a.ALIGN_RIGHT).appendField(a.Msg.MIXLY_TENSORFLOW_PREDICT_INPUT_DATA),this.appendDummyInput().setAlign(a.ALIGN_RIGHT).appendField(a.Msg.MIXLY_TENSORFLOW_PREDICT_RETURN_RESULT),this.setInputsInline(!1),this.setOutput(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_get_tensor_data={init:function(){this.appendValueInput("VAR").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_GET_TENSOR_DATA),this.setOutput(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_save_or_export_model={init:function(){this.appendValueInput("NAME1").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_MODEL),this.appendValueInput("NAME2").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(new a.FieldDropdown([[a.Msg.MIXLY_TENSORFLOW_SAVE_MODEL,"save"],[a.Msg.MIXLY_TENSORFLOW_EXPORT_MODEL,"export"]]),"NAME").appendField(a.Msg.MIXLY_TENSORFLOW_SAVE_MODEL_NAME),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_use_load_model={init:function(){this.appendValueInput("NAME").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_LOAD_MODEL).appendField(a.Msg.MIXLY_TENSORFLOW_MODEL_NAME),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}},a.Blocks.tensorflow_prepare_picture={init:function(){this.appendValueInput("NAME").setCheck(null).setAlign(a.ALIGN_LEFT).appendField(a.Msg.MIXLY_TENSORFLOW_PREPARE_PICTURE_TO_TENSOR).appendField(a.Msg.MIXLY_TENSORFLOW_PREPARE_PICTURE_READ_PICTURE),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(c),this.setTooltip(""),this.setHelpUrl("")}};const d=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC);return t.definitions_.import_tensorflow="import tensorflow",["tensorflow.tensor("+n+")",t.ORDER_ATOMIC]},h=function(e,t){t.definitions_.import_tensorflow="import tensorflow";return["tensorflow.sequential()",t.ORDER_ATOMIC]},p=function(e,t){return t.definitions_.import_tensorflow="import tensorflow",["tensorflow.layers.dense(units = "+t.valueToCode(this,"VAR1",t.ORDER_ATOMIC)+", input_shape = "+t.valueToCode(this,"VAR2",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},f=function(e,t){return t.definitions_.import_tensorflow="import tensorflow",t.valueToCode(this,"VAR1",t.ORDER_ATOMIC)+".add("+t.valueToCode(this,"VAR2",t.ORDER_ATOMIC)+")\n"},m=function(e,t){return t.definitions_.import_tensorflow="import tensorflow",t.valueToCode(this,"VAR1",t.ORDER_ATOMIC)+'.compile(loss = "'+this.getFieldValue("VAR2")+'", optimizer = "'+this.getFieldValue("VAR3")+'")\n'},g=function(e,t){return t.definitions_.import_tensorflow="import tensorflow",["await "+t.valueToCode(this,"VAR1",t.ORDER_ATOMIC)+".fit("+t.valueToCode(this,"VAR2",t.ORDER_ATOMIC)+", "+t.valueToCode(this,"VAR3",t.ORDER_ATOMIC)+", epochs="+t.valueToCode(this,"VAR4",t.ORDER_ATOMIC)+", verbose="+t.valueToCode(this,"VAR5",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},y=function(e,t){return t.definitions_.import_tensorflow="import tensorflow",[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+".history.loss",t.ORDER_ATOMIC]},_=function(e,t){return t.definitions_.import_tensorflow="import tensorflow",[t.valueToCode(this,"VAR1",t.ORDER_ATOMIC)+".predict("+t.valueToCode(this,"VAR2",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},v=function(e,t){return t.definitions_.import_tensorflow="import tensorflow",["(await "+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+".data())",t.ORDER_ATOMIC]},b=function(e,t){t.definitions_.import_tensorflow="import tensorflow";var n=t.valueToCode(this,"NAME1",t.ORDER_ATOMIC),i=this.getFieldValue("NAME"),r=t.valueToCode(this,"NAME2",t.ORDER_ATOMIC).replace(/^'|'$/g,"");return"export"==i?`await ${n}.save("downloads://${r}")\n`:`await ${n}.save("indexeddb://${r}")\n`},T=function(e,t){return t.definitions_.import_tensorflow="import tensorflow",[`await tensorflow.load_model("${t.valueToCode(this,"NAME",t.ORDER_ATOMIC).replace(/^'|'$/g,"")}")`,t.ORDER_ATOMIC]},x=function(e,t){return t.definitions_.import_tensorflow="import tensorflow",t.definitions_.import_numpy="import numpy",t.definitions_.import_PIL="import PIL",[`(await tensorflow.prepare_qmyixtxi(tensorflow.tensor(numpy.array(PIL.Image.open(${t.valueToCode(this,"NAME",t.ORDER_ATOMIC)}).convert('RGB')))))`,t.ORDER_ATOMIC]}},35237:(e,t,n)=>{"use strict";n.a(e,async(e,t)=>{try{var i=n(13383),r=(n(82879),n(64548)),s=n(27543),o=n(87202),a=n(58921),l=n(53378),u=e([l]);l=(u.then?(await u)():u)[0],Object.assign(i.Variables,s.ut),Object.assign(i.Procedures,s.rw),i.Python=s.VX,i.generator=s.VX,r.Profile.default={},Object.assign(i.Blocks,s.M2,s.ce,s.Fr,s.QC,s.yH,s.I_,s.Hv,s.wG,s.p7,s.Xp,s.dv,s.eS,s.rC,o.Ej,o.j2,o.v4,o.r_,o.cU,o.Vv,o.OQ,o.Sd,o.DE,o.sc,o.ws,o.UQ,o.Ig,o.r4,o.Ge,a.RK,a.GI),Object.assign(i.Python.forBlock,s.AI,s.mp,s.ro,s.YI,s.k4,s.Cr,s.VQ,s.og,s.ZD,s.$Z,s.dD,s.uW,s.lv,o.mi,o.N5,o.$W,o.nm,o.aB,o.ZF,o.yw,o.iR,o.To,o.c8,o.AU,o.Qk,o.oo,o.FR,o.SE,a.tk,a.U5),t()}catch(e){t(e)}})},82879:(e,t,n)=>{"use strict";var i=n(13383);Object.assign(i.Lang.ZhHans,{PYTHON_PYODIDE_IMAGE:"图像",PYTHON_PYODIDE_TOOL:"可教机器",PYTHON_PYODIDE_GAME:"生命游戏",PYTHON_PYODIDE_GAME_EPOCH:"代数",PYTHON_PYODIDE_GAME_START:"开始",PYTHON_PYODIDE_GAME_PAUSE:"暂停",PYTHON_PYODIDE_GAME_RANDOM:"随机初始化",PYTHON_PYODIDE_GAME_RESET:"重置",PYTHON_PYODIDE_LOADING:"Python3内核载入中...",PYTHON_PYODIDE_FILE_SYSTEM:"本地文件系统",PYTHON_PYODIDE_LOAD_FILE_SYSTEM:"载入本地文件夹"}),Object.assign(i.Lang.ZhHant,{PYTHON_PYODIDE_IMAGE:"影像",PYTHON_PYODIDE_TOOL:"可教機器",PYTHON_PYODIDE_GAME:"生命遊戲",PYTHON_PYODIDE_GAME_EPOCH:"代數",PYTHON_PYODIDE_GAME_START:"開始",PYTHON_PYODIDE_GAME_PAUSE:"暫停",PYTHON_PYODIDE_GAME_RANDOM:"隨機初始化",PYTHON_PYODIDE_GAME_RESET:"重置",PYTHON_PYODIDE_LOADING:"Python3核心載入...",PYTHON_PYODIDE_FILE_SYSTEM:"本機檔案系統",PYTHON_PYODIDE_LOAD_FILE_SYSTEM:"載入本機資料夾"}),Object.assign(i.Lang.En,{PYTHON_PYODIDE_IMAGE:"Image",PYTHON_PYODIDE_TOOL:"Teachable Machine",PYTHON_PYODIDE_GAME:"Game of Life",PYTHON_PYODIDE_GAME_EPOCH:"Iterations",PYTHON_PYODIDE_GAME_START:"Start",PYTHON_PYODIDE_GAME_PAUSE:"Pause",PYTHON_PYODIDE_GAME_RANDOM:"Random Initialization",PYTHON_PYODIDE_GAME_RESET:"Reset",PYTHON_PYODIDE_LOADING:"Python3 kernel loading...",PYTHON_PYODIDE_FILE_SYSTEM:"Local File System",PYTHON_PYODIDE_LOAD_FILE_SYSTEM:"Load Local Folder"}),Object.assign(i.Lang.ZhHans.MSG,{}),Object.assign(i.Lang.ZhHant.MSG,{}),Object.assign(i.Lang.En.MSG,{})},15149:(e,t,n)=>{"use strict";n.d(t,{GJ:()=>i,uI:()=>r});class i{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class r{refCount(e){return s("refCount")}incRef(e){return s("incRef")}timerAvailable(){return!0}time(e){return s("time")}read(e){return s("read")}readSync(e){return s("readSync")}readToGPU(e,t){return s("readToGPU")}numDataIds(){return s("numDataIds")}disposeData(e,t){return s("disposeData")}write(e,t,n){return s("write")}move(e,t,n,i,r){return s("move")}createTensorFromGPUData(e,t,n){return s("createTensorFromGPUData")}memory(){return s("memory")}floatPrecision(){return s("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}dispose(){return s("dispose")}}function s(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}},8360:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function i(e,t,n){const i=function(e,t,n){return function(e,t,n){let i=0,r=e.length,s=0,o=!1;for(;i<r;){s=i+(r-i>>>1);const a=n(t,e[s]);a>0?i=s+1:(r=s,o=!a)}return o?i:-i-1}(e,t,n||r)}(e,t,n),s=i<0?-(i+1):i;e.splice(s,0,t)}function r(e,t){return e>t?1:e<t?-1:0}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function s(e,t,n,i,r){return l(e,t,n,i,r,0)}function o(e,t,n,i,r,s){return l(e,t,n,i,r,0,!1,s,!0)}function a(e,t,n,i,r,s){return l(e,t,n,i,r,s,!0)}function l(e,t,n,r,s,o,a=!1,l=!1,h=!1){const p=[];for(let e=0;e<t.length;e++)t[e]>s&&p.push({score:t[e],boxIndex:e,suppressBeginIndex:0});p.sort(d);const f=o>0?-.5/o:0,m=[],g=[];for(;m.length<n&&p.length>0;){const t=p.pop(),{score:n,boxIndex:o,suppressBeginIndex:a}=t;if(n<s)break;let l=!1;for(let n=m.length-1;n>=a;--n){const i=u(e,o,m[n]);if(i>=r){l=!0;break}if(t.score=t.score*c(r,f,i),t.score<=s)break}t.suppressBeginIndex=m.length,l||(t.score===n?(m.push(o),g.push(t.score)):t.score>s&&i(p,t,d))}const y=m.length,_=n-y;l&&_>0&&(m.push(...new Array(_).fill(0)),g.push(...new Array(_).fill(0)));const v={selectedIndices:m};return a&&(v.selectedScores=g),h&&(v.validOutputs=y),v}function u(e,t,n){const i=e.subarray(4*t,4*t+4),r=e.subarray(4*n,4*n+4),s=Math.min(i[0],i[2]),o=Math.min(i[1],i[3]),a=Math.max(i[0],i[2]),l=Math.max(i[1],i[3]),u=Math.min(r[0],r[2]),c=Math.min(r[1],r[3]),d=Math.max(r[0],r[2]),h=Math.max(r[1],r[3]),p=(a-s)*(l-o),f=(d-u)*(h-c);if(p<=0||f<=0)return 0;const m=Math.max(s,u),g=Math.max(o,c),y=Math.min(a,d),_=Math.min(l,h),v=Math.max(y-m,0)*Math.max(_-g,0);return v/(p+f-v)}function c(e,t,n){const i=Math.exp(t*n*n);return n<=e?i:0}function d(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}n.d(t,{c7:()=>s,ZS:()=>o,ut:()=>a})},54411:(e,t,n)=>{"use strict";n.d(t,{Y:()=>r});var i=n(448);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/function r(e,t){const n=[];for(let e=0;e<t.length;e++)t[e]&&n.push(e);const r=(0,i.r)(e,"int32"),s=(0,i.r)([n.length,e.length],"int32");for(let t=0;t<n.length;t++){const i=r.indexToLoc(n[t]),o=t*e.length;s.values.set(i,o)}return s.toTensor()}},41585:(e,t,n)=>{"use strict";n.d(t,{T2:()=>b,Ye:()=>v});var i=n(15149),r=n(46574),s=n(41743),o=n(15441),a=n(37074),l=n(73673),u=n(83879),c=n(45119);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class d{constructor(e,t){this.backendTimer=e,this.logger=t,null==t&&(this.logger=new p)}profileKernel(e,t,n){let i;const s=()=>{i=n()};let o;const a=u.now();if(this.backendTimer.timerAvailable())o=this.backendTimer.time(s);else{s();for(const e of i)e.dataSync();o=Promise.resolve({kernelMs:u.now()-a})}if((0,r._K)().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let t=0;t<i.length;t++){const n=i[t];n.data().then(t=>{h(t,n.dtype,e)})}return{kernelName:e,outputs:i,inputs:t,timeMs:o.then(e=>e.kernelMs),extraInfo:o.then(e=>null!=e.getExtraProfileInfo?e.getExtraProfileInfo():"")}}logKernelProfile(e){const{kernelName:t,outputs:n,timeMs:i,inputs:r,extraInfo:s}=e;n.forEach(e=>{Promise.all([e.data(),i,s]).then(n=>{this.logger.logKernelProfile(t,e,n[0],n[1],r,n[2])})})}}function h(e,t,n){if("float32"!==t)return!1;for(let t=0;t<e.length;t++){const i=e[t];if(isNaN(i)||!isFinite(i))return console.warn(`Found ${i} in the result of '${n}'`),!0}return!1}class p{logKernelProfile(e,t,n,i,r,s){const o="number"==typeof i?c.av(`${i}ms`,9):i.error,a=c.av(e,25),l=t.rank,u=t.size,d=c.av(t.shape.toString(),14);let h="";for(const e in r){const n=r[e];if(null!=n){const i=n.shape||t.shape,r=i.length;h+=`${e}: ${r}D ${r>0?i:""} `}}console.log(`%c${a}\t%c${o}\t%c${l}D ${d}\t%c${u}\t%c${h}\t%c${s}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}}var f=n(50259),m=n(30565);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function g(e){return null!=e.kernelName}class y{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(e=>e.name)))}}}dispose(){for(const e in this.registeredVariables)this.registeredVariables[e].dispose()}}class _{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new y}async ready(){if(null!=this.pendingBackendInit)return this.pendingBackendInit.then(()=>{});if(null!=this.backendInstance)return;const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t];if(await this.initializeBackend(n).success)return void await this.setBackend(n)}throw new Error("Could not initialize any backends, all backend initializations failed.")}get backend(){if(null!=this.pendingBackendInit)throw new Error(`Backend '${this.backendName}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);if(null==this.backendInstance){const{name:e,asyncInit:t}=this.initializeBackendsAndReturnBest();if(t)throw new Error(`The highest priority backend '${e}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);this.setBackend(e)}return this.backendInstance}backendNames(){return Object.keys(this.registryFactory)}findBackend(e){if(!(e in this.registry)){if(!(e in this.registryFactory))return null;{const{asyncInit:t}=this.initializeBackend(e);if(t)return null}}return this.registry[e]}findBackendFactory(e){return e in this.registryFactory?this.registryFactory[e].factory:null}registerBackend(e,t,n=1){return e in this.registryFactory?(l.i(`${e} backend was already registered. Reusing existing backend factory.`),!1):(this.registryFactory[e]={factory:t,priority:n},!0)}async setBackend(e){if(null==this.registryFactory[e])throw new Error(`Backend name '${e}' not found in registry`);if(this.backendName=e,null==this.registry[e]){this.backendInstance=null;const{success:t,asyncInit:n}=this.initializeBackend(e);if(!(n?await t:t))return!1}return this.backendInstance=this.registry[e],this.setupRegisteredKernels(),this.profiler=new d(this.backendInstance),!0}setupRegisteredKernels(){(0,a.Op)(this.backendName).forEach(e=>{null!=e.setupFunc&&e.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){(0,a.Op)(e).forEach(t=>{null!=t.disposeFunc&&t.disposeFunc(this.registry[e])})}initializeBackend(e){const t=this.registryFactory[e];if(null==t)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{const n=t.factory();if(!n||n instanceof i.uI||"function"!=typeof n.then)return this.registry[e]=n,{success:!0,asyncInit:!1};{const t=++this.pendingBackendInitId,i=n.then(n=>!(t<this.pendingBackendInitId)&&(this.registry[e]=n,this.pendingBackendInit=null,!0)).catch(n=>(t<this.pendingBackendInitId||(this.pendingBackendInit=null,l.i(`Initialization of backend ${e} failed`),l.i(n.stack||n.message)),!1));return this.pendingBackendInit=i,{success:i,asyncInit:!0}}}catch(t){return l.i(`Initialization of backend ${e} failed`),l.i(t.stack||t.message),{success:!1,asyncInit:!1}}}removeBackend(e){if(!(e in this.registryFactory))throw new Error(`${e} backend not found in registry`);this.backendName===e&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,e in this.registry&&(this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e]),delete this.registryFactory[e],this.backendName===e&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)}getSortedBackends(){if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort((e,t)=>this.registryFactory[t].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t],{success:i,asyncInit:r}=this.initializeBackend(n);if(r||i)return{name:n,asyncInit:r}}throw new Error("Could not initialize any backends, all backend initializations failed.")}moveData(e,t){const n=this.state.tensorInfo.get(t),i=n.backend,r=this.readSync(t),s=i.refCount(t);i.disposeData(t,!0),n.backend=e,e.move(t,r,n.shape,n.dtype,s),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}tidy(e,t){let n,i=null;if(null==t){if("function"!=typeof e)throw new Error("Please provide a function to tidy()");t=e}else{if("string"!=typeof e&&!(e instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof t)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");i=e}return this.scopedRun(()=>this.startScope(i),()=>this.endScope(n),()=>(n=t(),n instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n))}scopedRun(e,t,n){e();try{const e=n();return t(),e}catch(e){throw t(),e}}nextTensorId(){return _.nextTensorId++}nextVariableId(){return _.nextVariableId++}clone(e){const t=b.runKernel(o.lzr,{x:e}),n={x:e};return this.addTapeNode(this.state.activeScope.name,n,[t],e=>({x:()=>{const t={x:e},n={dtype:"float32"};return b.runKernel(o.KXH,t,n)}}),[],{}),t}runKernel(e,t,n){null==this.backendName&&this.backend;if(!(null!=(0,a._5)(e,this.backendName)))throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,n){const i=this.backend.numDataIds();let r=0;n.forEach(e=>{r+="complex64"===e.dtype?3:1});const s=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],o=i-t-r-s;if(o>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${o} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[];const i=this.isTapeOn(),r=this.state.numBytes,s=this.state.numTensors;let o,l;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0),null==this.backendName&&this.backend;const u=g(e)?e.kernelName:null!=this.state.activeScope?this.state.activeScope.name:"";if(g(e)){const{kernelName:t,inputs:r,attrs:s}=e;null==this.backendName&&this.backend;const u=(0,a._5)(t,this.backendName);c.vA(null!=u,()=>`Cannot find registered kernel '${t}' for backend '${this.backendName}'`),o=()=>{const e=this.backend.numDataIds();l=u.kernelFunc({inputs:r,attrs:s,backend:this.backend});const o=Array.isArray(l)?l:[l];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(t,e,o);const a=o.map(e=>null!=e.rank?e:this.makeTensorFromTensorInfo(e));if(i){const e=this.getTensorsForGradient(t,r,a);n=this.saveTensorsForBackwardMode(e)}return a}}else{const{forwardFunc:t}=e,r=e=>{i&&(n=e.map(e=>this.keep(this.clone(e))))};o=()=>{const e=this.backend.numDataIds();l=this.tidy(()=>t(this.backend,r));const n=Array.isArray(l)?l:[l];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(u,e,n),n}}const{inputs:d,attrs:h}=e,p=g(e)?null:e.backwardsFunc;let f;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{this.ENV.getBool("DEBUG")||this.state.profiling?(f=this.profiler.profileKernel(u,d,()=>o()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(f),t=f.outputs):t=o()}),i&&this.addTapeNode(u,d,t,p,n,h),this.state.profiling&&this.state.activeProfile.kernels.push({name:u,bytesAdded:this.state.numBytes-r,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-s,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(d).map(e=>null!=d[e]?d[e].shape:null),outputShapes:t.map(e=>e.shape),kernelTimeMs:f.timeMs,extraInfo:f.extraInfo}),Array.isArray(l)?t:t[0]}saveTensorsForBackwardMode(e){const t=e.map(e=>this.keep(this.clone(e)));return t}getTensorsForGradient(e,t,n){const i=(0,a.vQ)(e);if(null!=i){const e=i.inputsToSave||[],r=i.outputsToSave||[];let s;i.saveAllInputs?(c.vA(Array.isArray(t),()=>"saveAllInputs is true, expected inputs to be an array."),s=Object.keys(t).map(e=>t[e])):s=e.map(e=>t[e]);const o=n.filter((e,t)=>r[t]);return s.concat(o)}return[]}makeTensor(e,t,n,i){if(null==e)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",i=i||this.backend;let r=e;"string"===n&&c.Kg(e[0])&&(r=e.map(e=>u.encodeString(e)));const s=i.write(r,t,n),o=new f.qY(t,n,s,this.nextTensorId());if(this.trackTensor(o,i),"string"===n){const e=this.state.tensorInfo.get(s),t=(0,c.SL)(r);this.state.numBytes+=t-e.bytes,e.bytes=t}return o}makeTensorFromDataId(e,t,n,i){const r={dataId:e,shape:t,dtype:n=n||"float32"};return this.makeTensorFromTensorInfo(r,i)}makeTensorFromTensorInfo(e,t){const{dataId:n,shape:i,dtype:r}=e,s=new f.qY(i,r,n,this.nextTensorId());return this.trackTensor(s,t),s}makeVariable(e,t=!0,n,i){n=n||this.nextVariableId().toString(),null!=i&&i!==e.dtype&&(e=e.cast(i));const r=new f.rT(e,t,n,this.nextTensorId());if(null!=this.state.registeredVariables[r.name])throw new Error(`Variable with name ${r.name} was already registered`);return this.state.registeredVariables[r.name]=r,this.incRef(r,this.backend),r}trackTensor(e,t){this.state.numTensors++,"string"===e.dtype&&this.state.numStringTensors++;let n=0;"complex64"!==e.dtype&&"string"!==e.dtype&&(n=e.size*c.jv(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof f.rT||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;const t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,"string"===e.dtype&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),"complex64"!==e.dtype&&"string"!==e.dtype){const t=e.size*c.jv(e.dtype);this.state.numBytes-=t}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(const e in this.state.registeredVariables){const t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),null!=this.state.registeredVariables[e.name]&&delete this.state.registeredVariables[e.name]}memory(){const e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,null==e.reasons&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;const t=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(e=>e.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(const e of this.state.activeProfile.kernels)e.kernelTimeMs=await e.kernelTimeMs,e.extraInfo=await e.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&0===this.state.kernelDepth}addTapeNode(e,t,n,i,r,s){const o={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:r},l=(0,a.vQ)(e);null!=l&&(i=l.gradFunc),null!=i&&(o.gradient=e=>(e=e.map((e,t)=>{if(null==e){const e=n[t],i=c.Ty(e.size,e.dtype);return this.makeTensor(i,e.shape,e.dtype)}return e}),i(e.length>1?e:e[0],r,s))),this.state.activeTape.push(o)}keep(e){return e.kept=!0,e}startTape(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){const t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){const t=(0,m.getTensorsInContainer)(e),n=new Set(t.map(e=>e.id));for(let e=0;e<this.state.activeScope.track.length;e++){const t=this.state.activeScope.track[e];t.kept||n.has(t.id)||t.dispose()}const i=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],t.forEach(e=>{e.kept||e.scopeId!==i.id||this.track(e)})}gradients(e,t,n,i=!1){if(c.vA(t.length>0,()=>"gradients() received an empty list of xs."),null!=n&&"float32"!==n.dtype)throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);const r=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));c.vA(r instanceof f.qY,()=>"The result y returned by f() must be a tensor.");const s=
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i={},r={};for(let e=0;e<t.length;e++)i[t[e].id]=!0;for(let n=0;n<e.length;n++){const s=e[n],o=s.inputs;for(const e in o){const n=o[e];let a=!1;for(let e=0;e<t.length;e++)if(i[n.id]){s.outputs.forEach(e=>i[e.id]=!0),a=!0,r[s.id]=!0;break}if(a)break}}const s={};s[n.id]=!0;const o={};for(let t=e.length-1;t>=0;t--){const n=e[t],i=n.inputs;for(let e=0;e<n.outputs.length;e++)if(s[n.outputs[e].id]){for(const e in i)s[i[e].id]=!0,o[n.id]=!0;break}}const a=[];for(let t=0;t<e.length;t++){const n=e[t];if(r[n.id]&&o[n.id]){const e={};for(const t in n.inputs){const r=n.inputs[t];i[r.id]&&(e[t]=r)}const t=Object.assign({},n);t.inputs=e,t.outputs=n.outputs,a.push(t)}}return a}(this.state.activeTape,t,r);if(!i&&0===s.length&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{const e={};e[r.id]=null==n?function(e){const t=(0,c.FZ)((0,c.Ze)(e),"float32");return b.makeTensor(t,e,"float32")}(r.shape):n,function(e,t,n,i){for(let r=t.length-1;r>=0;r--){const s=t[r],o=[];if(s.outputs.forEach(t=>{const n=e[t.id];null!=n?o.push(n):o.push(null)}),null==s.gradient)throw new Error(`Cannot compute gradient: gradient function not found for ${s.kernelName}.`);const a=s.gradient(o);for(const t in s.inputs){if(!(t in a))throw new Error(`Cannot backprop through input ${t}. Available gradients found: ${Object.keys(a)}.`);const r=n(()=>a[t]());if("float32"!==r.dtype)throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input ${t} must have 'float32' dtype, but has '${r.dtype}'`);const o=s.inputs[t];if(!c.r1(r.shape,o.shape))throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input '${t}' has shape '${r.shape}', which does not match the shape of the input '${o.shape}'`);if(null==e[o.id])e[o.id]=r;else{const t=e[o.id];e[o.id]=i(t,r),t.dispose()}}}}(e,s,e=>this.tidy(e),T);const i=t.map(t=>e[t.id]);return 0===this.state.gradientDepth&&(this.state.activeTape.forEach(e=>{for(const t of e.saved)t.dispose()}),this.state.activeTape=null),{value:r,grads:i}})}customGrad(e){return c.vA(c.Tn(e),()=>"The f passed in customGrad(f) must be a function."),(...t)=>{let n;c.vA(t.every(e=>e instanceof f.qY),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");const i={};t.forEach((e,t)=>{i[t]=e});return this.runKernelFunc({forwardFunc:(i,r)=>(n=e(...t,r),c.vA(n.value instanceof f.qY,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),c.vA(c.Tn(n.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n.value),backwardsFunc:(e,i)=>{const r=n.gradFunc(e,i),s=Array.isArray(r)?r:[r];c.vA(s.length===t.length,()=>"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(...)."),c.vA(s.every(e=>e instanceof f.qY),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");const o={};return s.forEach((e,t)=>{o[t]=()=>e}),o},inputs:i})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,t){return this.state.tensorInfo.get(e).backend.readToGPU(e,t)}async time(e){const t=(0,u.now)(),n=await this.backend.time(e);return n.wallMs=(0,u.now)()-t,n}track(e){return null!=this.state.activeScope&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new y;for(const e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}function v(){const e=(0,s.L)();if(null==e._tfengine){const t=new r.OH(e);e._tfengine=new _(t)}return(0,r.tj)(e._tfengine.ENV),(0,f.qP)(()=>e._tfengine),e._tfengine}_.nextTensorId=0,_.nextVariableId=0;const b=v();function T(e,t){const n={a:e,b:t};return b.runKernel(o.OMN,n)}},46574:(e,t,n)=>{"use strict";n.d(t,{Km:()=>l,OH:()=>s,_K:()=>a,tj:()=>u});var i=n(45119);
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/const r="tfjsflags";class s{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=o,this.populateURLFlags()}setPlatform(e,t){null!=this.platform&&(a().getBool("IS_TEST")||a().getBool("PROD")||console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${e}.`)),this.platformName=e,this.platform=t}registerFlag(e,t,n){if(this.flagRegistry[e]={evaluationFn:t,setHook:n},null!=this.urlFlags[e]){const t=this.urlFlags[e];a().getBool("IS_TEST")||a().getBool("PROD")||console.warn(`Setting feature override from URL ${e}: ${t}.`),this.set(e,t)}}async getAsync(e){return e in this.flags||(this.flags[e]=await this.evaluateFlag(e)),this.flags[e]}get(e){if(e in this.flags)return this.flags[e];const t=this.evaluateFlag(e);if((0,i.yL)(t))throw new Error(`Flag ${e} cannot be synchronously evaluated. Please use getAsync() instead.`);return this.flags[e]=t,this.flags[e]}getNumber(e){return this.get(e)}getBool(e){return this.get(e)}getString(e){return this.get(e)}getFlags(){return this.flags}get features(){return this.flags}set(e,t){if(null==this.flagRegistry[e])throw new Error(`Cannot set flag ${e} as it has not been registered.`);this.flags[e]=t,null!=this.flagRegistry[e].setHook&&this.flagRegistry[e].setHook(t)}evaluateFlag(e){if(null==this.flagRegistry[e])throw new Error(`Cannot evaluate flag '${e}': no evaluation function found.`);return this.flagRegistry[e].evaluationFn()}setFlags(e){this.flags=Object.assign({},e)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(void 0===this.global||void 0===this.global.location||void 0===this.global.location.search)return;const e=this.getQueryParams(this.global.location.search);if(r in e){e[r].split(",").forEach(e=>{const[t,n]=e.split(":");this.urlFlags[t]=function(e,t){const n=t.toLowerCase();return"true"===n||"false"===n?"true"===n:""+ +n===n?+n:t}(0,n)})}}}function o(e){const t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(e,...n)=>(function(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}(t,n[0],n[1]),n.join("="))),t}function a(){return l}let l=null;function u(e){l=e}},41743:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
let i;function r(){if(null==i){let e;if("undefined"!=typeof window)e=window;else if(void 0!==n.g)e=n.g;else if("undefined"!=typeof process)e=process;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}i=e}return i}function s(e,t){const n=function(){const e=r();return null==e._tfGlobals&&(e._tfGlobals=new Map),e._tfGlobals}();if(n.has(e))return n.get(e);{const i=t();return n.set(e,i),n.get(e)}}n.d(t,{L:()=>r,m:()=>s})},35287:(e,t,n)=>{"use strict";n.d(t,{AS:()=>g,DZ:()=>m,Gc:()=>b,Hi:()=>h,Hs:()=>A,IS:()=>u,ME:()=>f,Ok:()=>S,Sm:()=>a,W4:()=>w,aC:()=>y,fL:()=>c,gJ:()=>I,gY:()=>l,go:()=>E,jh:()=>v,jz:()=>T,kB:()=>_,m1:()=>p,rE:()=>x,rm:()=>d});var i=n(41585),r=n(46574),s=n(50259),o=n(30565);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function a(){(0,r._K)().set("PROD",!0)}function l(){(0,r._K)().set("DEBUG",!0)}function u(){(0,r._K)().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function c(e){(0,r._K)().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function d(){i.T2.disposeVariables()}function h(){return i.T2}function p(){return i.T2.memory()}function f(e){return i.T2.profile(e)}function m(e,t){return i.T2.tidy(e,t)}function g(e){(0,o.getTensorsInContainer)(e).forEach(e=>e.dispose())}function y(e){return i.T2.keep(e)}function _(e){return i.T2.time(e)}function v(e){return i.T2.setBackend(e)}function b(){return i.T2.ready()}function T(){return i.T2.backendName}function x(e){i.T2.removeBackend(e)}function E(e){return i.T2.findBackend(e)}function w(e){return i.T2.findBackendFactory(e)}function I(e,t,n=1){return i.T2.registerBackend(e,t,n)}function A(){return i.T2.backend}function S(e,t){(0,r._K)().setPlatform(e,t)}(0,s.B4)(c)},31830:(e,t,n)=>{"use strict";n.d(t,{Dv:()=>a,_X:()=>h,jY:()=>u,mu:()=>c,ok:()=>l,y7:()=>d});var i=n(41585),r=n(50259),s=n(28189),o=n(45119);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function a(e){return o.vA(o.Tn(e),()=>"The f passed in grad(f) must be a function"),(t,n)=>{const r=(0,s.YT)(t,"x","tf.grad","string_or_numeric"),a=null!=n?(0,s.YT)(n,"dy","tf.grad"):null;return i.T2.tidy(()=>{const{value:t,grads:n}=i.T2.gradients(()=>e(r),[r],a);return null!=a&&o.O3(t.shape,a.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),p(n),n[0]})}}function l(e){return o.vA(o.Tn(e),()=>"The f passed in grads(f) must be a function"),(t,n)=>{o.vA(Array.isArray(t),()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s");const r=(0,s.j1)(t,"args","tf.grads","string_or_numeric"),a=null!=n?(0,s.YT)(n,"dy","tf.grads"):null;return i.T2.tidy(()=>{const{value:t,grads:n}=i.T2.gradients(()=>e(...r),r,a);return null!=a&&o.O3(t.shape,a.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),p(n),n})}}function u(e){return o.vA(o.Tn(e),()=>"The f passed in valueAndGrad(f) must be a function"),(t,n)=>{o.vA(t instanceof r.qY,()=>"The x passed in valueAndGrad(f)(x) must be a tensor"),o.vA(null==n||n instanceof r.qY,()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");const{grads:s,value:a}=i.T2.gradients(()=>e(t),[t],n);return p(s),{grad:s[0],value:a}}}function c(e){return o.vA(o.Tn(e),()=>"The f passed in valueAndGrads(f) must be a function"),(t,n)=>{o.vA(Array.isArray(t)&&t.every(e=>e instanceof r.qY),()=>"The args passed in valueAndGrads(f)(args) must be array of tensors"),o.vA(null==n||n instanceof r.qY,()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");const s=i.T2.gradients(()=>e(...t),t,n);return null!=n&&o.O3(s.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),p(s.grads),s}}function d(e,t){o.vA(o.Tn(e),()=>"The f passed in variableGrads(f) must be a function"),o.vA(null==t||Array.isArray(t)&&t.every(e=>e instanceof r.rT),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");const n=null!=t;if(!n){t=[];for(const e in i.T2.registeredVariables)t.push(i.T2.registeredVariables[e])}const s=n?t.filter(e=>!e.trainable):null,a=t.length;t=t.filter(e=>e.trainable),o.vA(t.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${a} variables is trainable.`);const{value:l,grads:u}=i.T2.gradients(e,t,null,!0);o.vA(u.some(e=>null!=e),()=>"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()."),o.vA(0===l.rank,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${l.rank} tensor`);const c={};return t.forEach((e,t)=>{null!=u[t]&&(c[e.name]=u[t])}),null!=s&&s.forEach(e=>c[e.name]=null),{value:l,grads:c}}function h(e){return i.T2.customGrad(e)}function p(e){if(e.filter(e=>null==e).length>0)throw new Error("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.")}},15838:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Abs:()=>yt.ljI,Acos:()=>yt.Vvy,Acosh:()=>yt.PH8,AdadeltaOptimizer:()=>Me,AdagradOptimizer:()=>ke,AdamOptimizer:()=>Fe,AdamaxOptimizer:()=>Be,Add:()=>yt.OMN,AddN:()=>yt.EkD,All:()=>yt.u8Z,Any:()=>yt.FSt,ArgMax:()=>yt.Jp_,ArgMin:()=>yt.p_m,Asin:()=>yt.QKF,Asinh:()=>yt.epO,Atan:()=>yt.TyE,Atan2:()=>yt.lxb,Atanh:()=>yt.zP9,AvgPool:()=>yt.ho8,AvgPool3D:()=>yt.cS,AvgPool3DGrad:()=>yt.wwC,AvgPoolGrad:()=>yt.VCH,BatchMatMul:()=>yt.jAQ,BatchToSpaceND:()=>yt.Ik2,Bincount:()=>yt.N4F,BitwiseAnd:()=>yt.HNs,BroadcastArgs:()=>yt.vj7,BroadcastTo:()=>yt.LB5,Cast:()=>yt.KXH,Ceil:()=>yt.QDP,ClipByValue:()=>yt.vaV,Complex:()=>yt.pr3,ComplexAbs:()=>yt.$zE,Concat:()=>yt.$dB,Conv2D:()=>yt.p2J,Conv2DBackpropFilter:()=>yt.rFm,Conv2DBackpropInput:()=>yt.jfg,Conv3D:()=>yt.A1h,Conv3DBackpropFilterV2:()=>yt.iGz,Conv3DBackpropInputV2:()=>yt.gC7,Cos:()=>yt.Mn0,Cosh:()=>yt.MnK,CropAndResize:()=>yt.MRQ,Cumprod:()=>yt.jj_,Cumsum:()=>yt.nY8,DataStorage:()=>pi.GJ,DenseBincount:()=>yt.wNW,DepthToSpace:()=>yt.TMz,DepthwiseConv2dNative:()=>yt.tGH,DepthwiseConv2dNativeBackpropFilter:()=>yt.X$8,DepthwiseConv2dNativeBackpropInput:()=>yt.nVu,Diag:()=>yt.ORI,Dilation2D:()=>yt.jxD,Dilation2DBackpropFilter:()=>yt.pk0,Dilation2DBackpropInput:()=>yt.bP9,Draw:()=>yt.XmO,ENV:()=>_.Km,Einsum:()=>yt.Qgm,Elu:()=>yt.Pah,EluGrad:()=>yt.rsH,Environment:()=>_.OH,Equal:()=>yt.BRl,Erf:()=>yt._s9,Exp:()=>yt.ox3,ExpandDims:()=>yt.ybN,Expm1:()=>yt.ybj,FFT:()=>yt.rGP,Fill:()=>yt.SQl,FlipLeftRight:()=>yt.BxF,Floor:()=>yt.ZgB,FloorDiv:()=>yt.ElG,FromPixels:()=>yt.awo,FusedBatchNorm:()=>yt.i5R,FusedConv2D:()=>yt.aAr,FusedDepthwiseConv2D:()=>yt.T7M,GatherNd:()=>yt.O4G,GatherV2:()=>yt.mxL,Greater:()=>yt.XhZ,GreaterEqual:()=>yt.lLS,IFFT:()=>yt.OAQ,Identity:()=>yt.lzr,Imag:()=>yt.dv8,IsFinite:()=>yt.gIW,IsInf:()=>yt.E3$,IsNan:()=>yt.iPs,KernelBackend:()=>pi.uI,LRN:()=>yt.jM4,LRNGrad:()=>yt.ToN,LeakyRelu:()=>yt.X0$,Less:()=>yt.mIA,LessEqual:()=>yt.CwD,LinSpace:()=>yt.mnI,Log:()=>yt.tG8,Log1p:()=>yt.Cg$,LogSoftmax:()=>yt.zfU,LogicalAnd:()=>yt.RUm,LogicalNot:()=>yt.nZd,LogicalOr:()=>yt.LXA,LogicalXor:()=>yt.RW8,LowerBound:()=>yt.yPW,MatrixBandPart:()=>yt.WRv,Max:()=>yt.VAI,MaxPool:()=>yt.t3d,MaxPool3D:()=>yt.ySp,MaxPool3DGrad:()=>yt.cHb,MaxPoolGrad:()=>yt.RXX,MaxPoolWithArgmax:()=>yt.TL8,Maximum:()=>yt.LDN,Mean:()=>yt.g5A,Min:()=>yt.lNG,Minimum:()=>yt.LG0,MirrorPad:()=>yt.x7F,Mod:()=>yt.BLA,MomentumOptimizer:()=>Ue,Multinomial:()=>yt.WT3,Multiply:()=>yt.xu7,Neg:()=>yt.l0G,NonMaxSuppressionV3:()=>yt.SDM,NonMaxSuppressionV4:()=>yt.Zl4,NonMaxSuppressionV5:()=>yt.e0f,NotEqual:()=>yt.ylV,OP_SCOPE_SUFFIX:()=>Zt.BTT,OneHot:()=>yt.urI,OnesLike:()=>yt.LWX,Optimizer:()=>Oe,OptimizerConstructors:()=>qt,Pack:()=>yt.mM$,PadV2:()=>yt.ODT,Pool:()=>yt.bCz,Pow:()=>yt.pyJ,Prelu:()=>yt.Ncv,Prod:()=>yt.kdj,RMSPropOptimizer:()=>ze,RaggedGather:()=>yt.oJ2,RaggedRange:()=>yt.CQC,RaggedTensorToTensor:()=>yt.mH5,Range:()=>yt.Q6t,Rank:()=>Kt.rg,Real:()=>yt.LRy,RealDiv:()=>yt.sDr,Reciprocal:()=>yt.huO,Reduction:()=>Qt.i,Relu:()=>yt.fUj,Relu6:()=>yt.P_L,Reshape:()=>yt.R23,ResizeBilinear:()=>yt.hgw,ResizeBilinearGrad:()=>yt.FCQ,ResizeNearestNeighbor:()=>yt.jOE,ResizeNearestNeighborGrad:()=>yt.XQy,Reverse:()=>yt.D7i,RotateWithOffset:()=>yt.BK4,Round:()=>yt.hVg,Rsqrt:()=>yt.TOR,SGDOptimizer:()=>$e,ScatterNd:()=>yt.pJc,SearchSorted:()=>yt.uWl,Select:()=>yt.l6P,Selu:()=>yt.u$b,Sigmoid:()=>yt.vI1,Sign:()=>yt.YVe,Sin:()=>yt.hql,Sinh:()=>yt.J3C,Slice:()=>yt.JiE,Softmax:()=>yt.rFG,Softplus:()=>yt.Fin,SpaceToBatchND:()=>yt.A8B,SparseFillEmptyRows:()=>yt.C8s,SparseReshape:()=>yt.BoJ,SparseSegmentMean:()=>yt.L6G,SparseSegmentSum:()=>yt.DvZ,SparseToDense:()=>yt.jgd,SplitV:()=>yt.Blb,Sqrt:()=>yt.dFH,Square:()=>yt.M6A,SquaredDifference:()=>yt.Ddj,StaticRegexReplace:()=>yt.GZp,Step:()=>yt.pnw,StridedSlice:()=>yt.UcO,StringNGrams:()=>yt.YAb,StringSplit:()=>yt.iW0,StringToHashBucketFast:()=>yt.$jE,Sub:()=>yt.PbM,Sum:()=>yt.WuN,Tan:()=>yt.oFs,Tanh:()=>yt.iuW,Tensor:()=>he.qY,TensorBuffer:()=>he.yl,TensorScatterUpdate:()=>yt.X4r,Tile:()=>yt.FAs,TopK:()=>yt.TBb,Transform:()=>yt.dLy,Transpose:()=>yt.wx0,Unique:()=>yt.EwU,Unpack:()=>yt.dXR,UnsortedSegmentSum:()=>yt.pPe,UpperBound:()=>yt.RMm,Variable:()=>he.rT,ZerosLike:()=>yt.xJ3,_FusedMatMul:()=>yt.Dr,abs:()=>Zt.tnl,acos:()=>Zt.HQu,acosh:()=>Zt.FqL,add:()=>Zt.WQq,addN:()=>Zt.QiD,all:()=>Zt.Q7R,any:()=>Zt.bzn,argMax:()=>Zt.FLi,argMin:()=>Zt.XRg,asin:()=>Zt.qRo,asinh:()=>Zt.yHs,atan:()=>Zt.rYl,atan2:()=>Zt.FPz,atanh:()=>Zt.rfv,avgPool:()=>Zt.$jT,avgPool3d:()=>Zt.sub,backend:()=>fe.Hs,backend_util:()=>d,basicLSTMCell:()=>Zt.lZX,batchNorm:()=>Zt.$v7,batchNorm2d:()=>Zt.BFc,batchNorm3d:()=>Zt.kSi,batchNorm4d:()=>Zt.T5N,batchToSpaceND:()=>Zt.GTe,bincount:()=>Zt.HbZ,bitwiseAnd:()=>Zt.vjT,booleanMaskAsync:()=>Zt.ftb,broadcastArgs:()=>Zt.ROE,broadcastTo:()=>Zt.hOW,broadcast_util:()=>gt,browser:()=>a,buffer:()=>Zt.ra8,cast:()=>Zt.wgE,ceil:()=>Zt.mkO,clipByValue:()=>Zt.zQh,clone:()=>Zt.o8B,complex:()=>Zt.faB,concat:()=>Zt.xWs,concat1d:()=>Zt.I1m,concat2d:()=>Zt.RPU,concat3d:()=>Zt.O5O,concat4d:()=>Zt.P1l,conv1d:()=>Zt.kA9,conv2d:()=>Zt.Xtf,conv2dTranspose:()=>Zt.wX9,conv3d:()=>Zt.IPL,conv3dTranspose:()=>Zt.jIJ,copyRegisteredKernels:()=>_t.Cf,cos:()=>Zt.gnS,cosh:()=>Zt.yIG,cosineWindow:()=>Zt._jP,cumprod:()=>Zt.Lp0,cumsum:()=>Zt.rCv,customGrad:()=>Te._X,denseBincount:()=>Zt.aOp,deprecationWarn:()=>fe.fL,depthToSpace:()=>Zt.Rj8,depthwiseConv2d:()=>Zt.Gl3,device_util:()=>i,diag:()=>Zt.smy,dilation2d:()=>Zt.X7t,disableDeprecationWarnings:()=>fe.IS,dispose:()=>fe.AS,disposeVariables:()=>fe.rm,div:()=>Zt.y4m,divNoNan:()=>Zt.ek5,dot:()=>Zt.Omf,dropout:()=>Zt.EZY,einsum:()=>Zt._3C,elu:()=>Zt.Pqc,enableDebugMode:()=>fe.gY,enableProdMode:()=>fe.Sm,enclosingPowerOfTwo:()=>Zt.FJY,engine:()=>fe.Hi,ensureShape:()=>Zt.QP2,env:()=>_._K,equal:()=>Zt.LCg,erf:()=>Zt.Y12,euclideanNorm:()=>Zt.p4S,exp:()=>Zt.oNF,expandDims:()=>Zt.UG6,expm1:()=>Zt.IYd,eye:()=>Zt.y5U,fft:()=>Zt.hVP,fill:()=>Zt.GSj,findBackend:()=>fe.go,findBackendFactory:()=>fe.W4,floor:()=>Zt.RIf,floorDiv:()=>Zt.wh_,fused:()=>Zt.cZk,gather:()=>Zt.kgh,gatherND:()=>Zt.SY9,gather_util:()=>l,getBackend:()=>fe.jz,getGradient:()=>_t.vQ,getKernel:()=>_t._5,getKernelsForBackend:()=>_t.Op,grad:()=>Te.Dv,grads:()=>Te.ok,greater:()=>Zt.rhj,greaterEqual:()=>Zt.DQN,ifft:()=>Zt.KGM,imag:()=>Zt.ngS,image:()=>Zt.Slp,inTopKAsync:()=>Zt.U4u,io:()=>s,irfft:()=>Zt.ggX,isFinite:()=>Zt.MIs,isInf:()=>Zt.EN4,isNaN:()=>Zt.yrW,keep:()=>fe.aC,kernel_impls:()=>h,leakyRelu:()=>Zt.H8d,less:()=>Zt.M7h,lessEqual:()=>Zt.InN,linalg:()=>Zt.mPL,linspace:()=>Zt.mT8,localResponseNormalization:()=>Zt.Kgs,log:()=>Zt.Rm2,log1p:()=>Zt.Kko,logSigmoid:()=>Zt.nqI,logSoftmax:()=>Zt.HPB,logSumExp:()=>Zt.VZ,logicalAnd:()=>Zt.n76,logicalNot:()=>Zt.NSZ,logicalOr:()=>Zt.ztW,logicalXor:()=>Zt.rxB,losses:()=>Zt.YYh,lowerBound:()=>Zt.yzS,matMul:()=>Zt.NoW,math:()=>o,max:()=>Zt.T9B,maxPool:()=>Zt.jgi,maxPool3d:()=>Zt.NYV,maxPoolWithArgmax:()=>Zt.RO,maximum:()=>Zt.PhQ,mean:()=>Zt.i2o,memory:()=>fe.m1,meshgrid:()=>Zt.OYQ,min:()=>Zt.jkA,minimum:()=>Zt.BpO,mirrorPad:()=>Zt.FFZ,mod:()=>Zt.ziu,moments:()=>Zt.Clk,movingAverage:()=>Zt.CRk,mul:()=>Zt.lKK,multiRNNCell:()=>Zt.YDF,multinomial:()=>Zt.OjQ,neg:()=>Zt.HZy,nextFrame:()=>tn,norm:()=>Zt.xbf,notEqual:()=>Zt.Ec,oneHot:()=>Zt.Mw0,ones:()=>Zt.SaS,onesLike:()=>Zt.P61,op:()=>Zt.op,outerProduct:()=>Zt.X4o,pad:()=>Zt.eVF,pad1d:()=>Zt.BZs,pad2d:()=>Zt.grY,pad3d:()=>Zt.XHu,pad4d:()=>Zt.WLX,pool:()=>Zt.dzn,pow:()=>Zt.n7C,prelu:()=>Zt.NsG,print:()=>Zt.yyV,prod:()=>Zt._eU,profile:()=>fe.ME,raggedGather:()=>Zt.whe,raggedRange:()=>Zt.iyU,raggedTensorToTensor:()=>Zt.Q0_,rand:()=>Zt._9M,randomGamma:()=>Zt.pR9,randomNormal:()=>Zt.FE$,randomStandardNormal:()=>Zt.m0H,randomUniform:()=>Zt.YeY,randomUniformInt:()=>Zt.HYA,range:()=>Zt.y17,ready:()=>fe.Gc,real:()=>Zt.xav,reciprocal:()=>Zt.VOZ,registerBackend:()=>fe.gJ,registerGradient:()=>_t.kr,registerKernel:()=>_t.tA,relu:()=>Zt.VVh,relu6:()=>Zt.j__,removeBackend:()=>fe.rE,reshape:()=>Zt.tQQ,reverse:()=>Zt.BEg,reverse1d:()=>Zt.QD2,reverse2d:()=>Zt.LMr,reverse3d:()=>Zt.I2l,reverse4d:()=>Zt.JYU,rfft:()=>Zt.z8$,round:()=>Zt.LIG,rsqrt:()=>Zt.Z$r,scalar:()=>Zt.d_2,scatterND:()=>Zt.NFr,scatter_util:()=>Mt,searchSorted:()=>Zt.sZg,selu:()=>Zt.WfX,separableConv2d:()=>Zt.wdz,serialization:()=>r,setBackend:()=>fe.jh,setPlatform:()=>fe.Ok,setdiff1dAsync:()=>Zt.F12,sigmoid:()=>Zt.ry7,sign:()=>Zt._SZ,signal:()=>Zt.vPA,sin:()=>Zt.F8e,sinh:()=>Zt.L0l,slice:()=>Zt.dik,slice1d:()=>Zt.Q$M,slice2d:()=>Zt.zAd,slice3d:()=>Zt.wck,slice4d:()=>Zt.R0O,slice_util:()=>Rt,softmax:()=>Zt.Vs9,softplus:()=>Zt.lw0,spaceToBatchND:()=>Zt.eDJ,sparse:()=>Zt.lMo,sparseToDense:()=>Zt.Zhr,spectral:()=>Zt.lOn,split:()=>Zt.lDo,sqrt:()=>Zt.RZD,square:()=>Zt.EwI,squaredDifference:()=>Zt.Pbu,squeeze:()=>Zt.r2V,stack:()=>Zt.t$z,step:()=>Zt.PMw,stridedSlice:()=>Zt.Ym9,string:()=>Zt.YjP,sub:()=>Zt.jbE,sum:()=>Zt.czq,sumOutType:()=>Kt.ch,tan:()=>Zt.Mlm,tanh:()=>Zt.ymU,tensor:()=>Zt.OEK,tensor1d:()=>Zt.tGX,tensor2d:()=>Zt.KtR,tensor3d:()=>Zt.$_$,tensor4d:()=>Zt.g9W,tensor5d:()=>Zt.Lpo,tensor6d:()=>Zt.yxw,tensorScatterUpdate:()=>Zt.NNh,tensor_util:()=>kt,test_util:()=>u,tidy:()=>fe.DZ,tile:()=>Zt.Vsq,time:()=>fe.kB,topk:()=>Zt.rfw,train:()=>Jt,transpose:()=>Zt.mgz,truncatedNormal:()=>Zt.efE,unique:()=>Zt.AmM,unregisterGradient:()=>_t.rY,unregisterKernel:()=>_t.iP,unsortedSegmentSum:()=>Zt.zAU,unstack:()=>Zt.K$i,upcastType:()=>Kt.Tu,upperBound:()=>Zt.rni,util:()=>Nt,valueAndGrad:()=>Te.jY,valueAndGrads:()=>Te.mu,variable:()=>Zt.bvq,variableGrads:()=>Te.y7,version_core:()=>Xt,where:()=>Zt._M9,whereAsync:()=>Zt.YJN,zeros:()=>Zt.Ul9,zerosLike:()=>Zt.POl});var i={};n.r(i),n.d(i,{isBrowser:()=>y,isMobile:()=>g,mockIsMobile:()=>m});var r={};n.r(r),n.d(r,{Serializable:()=>Ie,SerializationMap:()=>Ae,getRegisteredName:()=>Ce,registerClass:()=>Se});var s={};n.r(s),n.d(s,{CompositeArrayBuffer:()=>A.D,browserFiles:()=>He,browserHTTPRequest:()=>nt,concatenateArrayBuffers:()=>b.AQ,copyModel:()=>te,decodeWeights:()=>b.CY,decodeWeightsStream:()=>b.s5,encodeWeights:()=>b.aG,fromMemory:()=>ot,fromMemorySync:()=>at,getLoadHandlers:()=>I,getModelArtifactsForJSON:()=>b.Ej,getModelArtifactsForJSONSync:()=>b.Rl,getModelArtifactsInfoForJSON:()=>b.oR,getSaveHandlers:()=>w,getWeightSpecs:()=>b.Xf,http:()=>tt,isHTTPScheme:()=>Je,listModels:()=>J,loadWeights:()=>Ke,moveModel:()=>ne,registerLoadRouter:()=>E,registerSaveRouter:()=>x,removeModel:()=>ee,weightsLoaderFactory:()=>Ze,withSaveHandler:()=>lt,withSaveHandlerSync:()=>ut});var o={};n.r(o),n.d(o,{confusionMatrix:()=>mt});var a={};n.r(a),n.d(a,{draw:()=>St,fromPixels:()=>Ct,fromPixelsAsync:()=>wt,toPixels:()=>At});var l={};n.r(l),n.d(l,{prepareAndValidate:()=>Ot});var u={};n.r(u),n.d(u,{TEST_EPSILON_FLOAT16:()=>Ft,createVideoElement:()=>Ht,encodeStrings:()=>Gt,expectArrayBuffersEqual:()=>Yt,expectArraysClose:()=>Lt,expectArraysEqual:()=>Ut,expectNumbersClose:()=>zt,expectPromiseToFail:()=>$t,expectValuesInRange:()=>jt,play:()=>Wt,testEpsilon:()=>Pt});var c={};n.r(c),n.d(c,{collectGatherOpShapeInfo:()=>li,computeOutShape:()=>ai,segOpComputeOptimalWindowSize:()=>oi});var d={};n.r(d),n.d(d,{ERF_A1:()=>En,ERF_A2:()=>wn,ERF_A3:()=>In,ERF_A4:()=>An,ERF_A5:()=>Sn,ERF_P:()=>xn,PARALLELIZE_THRESHOLD:()=>pn,RowPartitionType:()=>on,SELU_SCALE:()=>Tn.X,SELU_SCALEALPHA:()=>Tn.j,applyActivation:()=>ln.f2,assertAndGetBroadcastShape:()=>gt.assertAndGetBroadcastShape,assertAxesAreInnerMostDims:()=>nn.WC,assertParamsConsistent:()=>rn,assignToTypedArray:()=>Dn,axesAreInnerMostDims:()=>nn.WH,calculateShapes:()=>Mt.calculateShapes,checkEinsumDimSizes:()=>jn,checkPadOnDimRoundingMode:()=>an.s_,combineLocations:()=>nn.aF,combineRaggedTensorToTensorShapes:()=>un,complexWithEvenIndex:()=>Rn,complexWithOddIndex:()=>kn,computeConv2DInfo:()=>an.uf,computeConv3DInfo:()=>an.p$,computeDefaultPad:()=>an.G8,computeDilation2DInfo:()=>an.YQ,computeOptimalWindowSize:()=>fn,computeOutAndReduceShapes:()=>nn.lb,computeOutShape:()=>sn,computePool2DInfo:()=>an.E6,computePool3DInfo:()=>an.l5,convertConv2DDataFormat:()=>an.$Q,decodeEinsumEquation:()=>zn,eitherStridesOrDilationsAreOne:()=>an.G0,expandShapeToKeepDim:()=>nn.SM,exponent:()=>Ln,exponents:()=>Fn,fromStringArrayToUint8:()=>ci,fromUint8ToStringArray:()=>ui,getAxesPermutation:()=>nn.Em,getBroadcastDims:()=>gt.getBroadcastDims,getComplexWithIndex:()=>Nn,getEinsumComputePath:()=>Yn,getEinsumPermutation:()=>Vn,getFusedBiasGradient:()=>ln.Do,getFusedDyActivation:()=>ln.XB,getImageCenter:()=>mn,getInnerMostAxes:()=>nn.fK,getPermuted:()=>yn,getRaggedRank:()=>dn,getReductionAxes:()=>gt.getReductionAxes,getReshaped:()=>gn,getReshapedPermuted:()=>_n,getRowPartitionTypesHelper:()=>cn,getSliceBeginCoords:()=>vn,getSliceSize:()=>bn,getSparseFillEmptyRowsIndicesDenseShapeMismatch:()=>Xn,getSparseFillEmptyRowsNegativeIndexErrorMessage:()=>qn,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:()=>Kn,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:()=>Jn,getSparseReshapeInputOutputMismatchErrorMessage:()=>ti,getSparseReshapeInputOutputMultipleErrorMessage:()=>ei,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:()=>Zn,getSparseReshapeNegativeOutputDimErrorMessage:()=>Qn,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:()=>si,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:()=>ni,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:()=>ii,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:()=>ri,getUndoAxesPermutation:()=>nn.gx,isIdentityPermutation:()=>Gn,log:()=>Cn.R,mergeRealAndImagArrays:()=>On,prepareAndValidate:()=>Ot,prepareSplitSize:()=>Wn,segment_util:()=>c,shouldFuse:()=>ln.zE,slice_util:()=>Rt,splitRealAndImagArrays:()=>Mn,stridesOrDilationsArePositive:()=>an.qk,tupleValuesAreOne:()=>an.Dh,upcastType:()=>Kt.Tu,validateDefaultValueShape:()=>hn,validateInput:()=>Mt.validateInput,validateUpdateShape:()=>Mt.validateUpdateShape,warn:()=>Cn.i});var h={};n.r(h),n.d(h,{nonMaxSuppressionV3Impl:()=>di.c7,nonMaxSuppressionV4Impl:()=>di.ZS,nonMaxSuppressionV5Impl:()=>di.ut,whereImpl:()=>hi.Y});var p=n(41585);let f;function m(e){f=e}function g(e){if(void 0!==f)return f;if(e||"undefined"!=typeof navigator&&null!=navigator){if(e||(e=navigator),"ReactNative"===e.product)return!0;const t=e.userAgent||e.vendor||("undefined"!=typeof window?window.opera:"");if(!t){const t=e;return t.userAgentData&&t.userAgentData.mobile}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))}return!1}function y(){return"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope}var _=n(46574);
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const v=(0,_._K)();v.registerFlag("DEBUG",()=>!1,e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")}),v.registerFlag("IS_BROWSER",()=>y()),v.registerFlag("IS_NODE",()=>"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node),v.registerFlag("IS_CHROME",()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)),v.registerFlag("IS_SAFARI",()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),v.registerFlag("PROD",()=>!1),v.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>v.getBool("DEBUG")),v.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0),v.registerFlag("IS_TEST",()=>!1),v.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>v.getBool("DEBUG")),v.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1),v.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",()=>!1),v.registerFlag("USE_SETTIMEOUTCUSTOM",()=>!1);var b=n(77084);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class T{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return null==T.instance&&(T.instance=new T),T.instance}static registerSaveRouter(e){T.getInstance().saveRouters.push(e)}static registerLoadRouter(e){T.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return T.getHandlers(e,"save")}static getLoadHandlers(e,t){return T.getHandlers(e,"load",t)}static getHandlers(e,t,n){const i=[];return("load"===t?T.getInstance().loadRouters:T.getInstance().saveRouters).forEach(t=>{const r=t(e,n);null!==r&&i.push(r)}),i}}const x=e=>T.registerSaveRouter(e),E=e=>T.registerLoadRouter(e),w=e=>T.getSaveHandlers(e),I=(e,t)=>T.getLoadHandlers(e,t);var A=n(56734);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const S="tensorflowjs",C="models_store",O="model_info_store";function M(){if(!(0,_._K)().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const e="undefined"==typeof window?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(null==t)throw new Error("The current browser does not appear to support IndexedDB.");return t}function R(e){const t=e.result;t.createObjectStore(C,{keyPath:"modelPath"}),t.createObjectStore(O,{keyPath:"modelPath"})}class k{constructor(e){if(this.indexedDB=M(),null==e||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise((e,n)=>{const i=this.indexedDB.open(S,1);i.onupgradeneeded=()=>R(i),i.onsuccess=()=>{const r=i.result;if(null==t){const t=r.transaction(C,"readonly"),i=t.objectStore(C).get(this.modelPath);i.onsuccess=()=>{if(null==i.result)return r.close(),n(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));e(i.result.modelArtifacts)},i.onerror=e=>(r.close(),n(i.error)),t.oncomplete=()=>r.close()}else{t.weightData=A.D.join(t.weightData);const i=(0,b.oR)(t),s=r.transaction(O,"readwrite");let o,a,l=s.objectStore(O);try{o=l.put({modelPath:this.modelPath,modelArtifactsInfo:i})}catch(e){return n(e)}o.onsuccess=()=>{a=r.transaction(C,"readwrite");const o=a.objectStore(C);let u;try{u=o.put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:i})}catch(e){return n(e)}u.onsuccess=()=>e({modelArtifactsInfo:i}),u.onerror=e=>{l=s.objectStore(O);const t=l.delete(this.modelPath);t.onsuccess=()=>(r.close(),n(u.error)),t.onerror=e=>(r.close(),n(u.error))}},o.onerror=e=>(r.close(),n(o.error)),s.oncomplete=()=>{null==a?r.close():a.oncomplete=()=>r.close()}}},i.onerror=e=>n(i.error)})}}k.URL_SCHEME="indexeddb://";const N=e=>{return(0,_._K)().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(k.URL_SCHEME)?(t=e.slice(k.URL_SCHEME.length),new k(t)):null;var t};T.registerSaveRouter(N),T.registerLoadRouter(N);class D{constructor(){this.indexedDB=M()}async listModels(){return new Promise((e,t)=>{const n=this.indexedDB.open(S,1);n.onupgradeneeded=()=>R(n),n.onsuccess=()=>{const i=n.result,r=i.transaction(O,"readonly"),s=r.objectStore(O).getAll();s.onsuccess=()=>{const t={};for(const e of s.result)t[e.modelPath]=e.modelArtifactsInfo;e(t)},s.onerror=e=>(i.close(),t(s.error)),r.oncomplete=()=>i.close()},n.onerror=e=>t(n.error)})}async removeModel(e){var t;return e=(t=e).startsWith(k.URL_SCHEME)?t.slice(k.URL_SCHEME.length):t,new Promise((t,n)=>{const i=this.indexedDB.open(S,1);i.onupgradeneeded=()=>R(i),i.onsuccess=()=>{const r=i.result,s=r.transaction(O,"readwrite"),o=s.objectStore(O),a=o.get(e);let l;a.onsuccess=()=>{if(null==a.result)return r.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{const i=o.delete(e),s=()=>{l=r.transaction(C,"readwrite");const i=l.objectStore(C).delete(e);i.onsuccess=()=>t(a.result.modelArtifactsInfo),i.onerror=e=>n(a.error)};i.onsuccess=s,i.onerror=e=>(s(),r.close(),n(a.error))}},a.onerror=e=>(r.close(),n(a.error)),s.oncomplete=()=>{null==l?r.close():l.oncomplete=()=>r.close()}},i.onerror=e=>n(i.error)})}}var F=n(45119);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const L="/",P="tensorflowjs_models",B="info",$="model_topology",U="weight_specs",z="weight_data",V="model_metadata";function j(e){return{info:[P,e,B].join(L),topology:[P,e,$].join(L),weightSpecs:[P,e,U].join(L),weightData:[P,e,z].join(L),modelMetadata:[P,e,V].join(L)}}function Y(e){for(const t of Object.values(e))window.localStorage.removeItem(t)}function G(e){const t=e.split(L);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(L)}class H{constructor(e){if(!(0,_._K)().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==e||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=j(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),i=(0,b.oR)(e),r=A.D.join(e.weightData);try{this.LS.setItem(this.keys.info,JSON.stringify(i)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,(0,b.l3)(r));const s={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:null!=e.signature?e.signature:void 0,userDefinedMetadata:null!=e.userDefinedMetadata?e.userDefinedMetadata:void 0,modelInitializer:null!=e.modelInitializer?e.modelInitializer:void 0,initializerSignature:null!=e.initializerSignature?e.initializerSignature:void 0,trainingConfig:null!=e.trainingConfig?e.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(s)),{modelArtifactsInfo:i}}catch(e){throw Y(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${i.modelTopologyBytes}, weightSpecsBytes=${i.weightSpecsBytes}, weightDataBytes=${i.weightDataBytes}.`)}}}async load(){const e=JSON.parse(this.LS.getItem(this.keys.info));if(null==e)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if("JSON"!==e.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(null==n)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;const i=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(null==i)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=i;const r=this.LS.getItem(this.keys.modelMetadata);if(null!=r){const e=JSON.parse(r);t.format=e.format,t.generatedBy=e.generatedBy,t.convertedBy=e.convertedBy,null!=e.signature&&(t.signature=e.signature),null!=e.userDefinedMetadata&&(t.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(t.modelInitializer=e.modelInitializer),null!=e.initializerSignature&&(t.initializerSignature=e.initializerSignature),null!=e.trainingConfig&&(t.trainingConfig=e.trainingConfig)}const s=this.LS.getItem(this.keys.weightData);if(null==s)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=(0,b.jf)(s),t}}H.URL_SCHEME="localstorage://";const W=e=>{return(0,_._K)().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(H.URL_SCHEME)?(t=e.slice(H.URL_SCHEME.length),new H(t)):null;var t};T.registerSaveRouter(W),T.registerLoadRouter(W);class X{constructor(){(0,F.vA)((0,_._K)().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),(0,F.vA)("undefined"==typeof window||void 0!==window.localStorage,()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){const e={},t=P+L,n=L+B;for(let i=0;i<this.LS.length;++i){const r=this.LS.key(i);if(r.startsWith(t)&&r.endsWith(n)){e[G(r)]=JSON.parse(this.LS.getItem(r))}}return e}async removeModel(e){var t;const n=j(e=(t=e).startsWith(H.URL_SCHEME)?t.slice(H.URL_SCHEME.length):t);if(null==this.LS.getItem(n.info))throw new Error(`Cannot find model at path '${e}'`);const i=JSON.parse(this.LS.getItem(n.info));return Y(n),i}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const q="://";class K{constructor(){this.managers={}}static getInstance(){return null==K.instance&&(K.instance=new K),K.instance}static registerManager(e,t){(0,F.vA)(null!=e,()=>"scheme must not be undefined or null."),e.endsWith(q)&&(e=e.slice(0,e.indexOf(q))),(0,F.vA)(e.length>0,()=>"scheme must not be an empty string.");const n=K.getInstance();(0,F.vA)(null==n.managers[e],()=>`A model store manager is already registered for scheme '${e}'.`),n.managers[e]=t}static getManager(e){const t=K.getInstance().managers[e];if(null==t)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(K.getInstance().managers)}}function Z(e){if(-1===e.indexOf(q))throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${K.getSchemes().join(",")}`);return{scheme:e.split(q)[0],path:e.split(q)[1]}}async function Q(e,t,n=!1){(0,F.vA)(e!==t,()=>`Old path and new path are the same: '${e}'`);const i=T.getLoadHandlers(e);(0,F.vA)(i.length>0,()=>`Copying failed because no load handler is found for source URL ${e}.`),(0,F.vA)(i.length<2,()=>`Copying failed because more than one (${i.length}) load handlers for source URL ${e}.`);const r=i[0],s=T.getSaveHandlers(t);(0,F.vA)(s.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),(0,F.vA)(s.length<2,()=>`Copying failed because more than one (${i.length}) save handlers for destination URL ${t}.`);const o=s[0],a=Z(e).scheme,l=Z(e).path,u=a===Z(e).scheme,c=await r.load();n&&u&&await K.getManager(a).removeModel(l);const d=await o.save(c);return n&&!u&&await K.getManager(a).removeModel(l),d.modelArtifactsInfo}async function J(){const e=K.getSchemes(),t={};for(const n of e){const e=await K.getManager(n).listModels();for(const i in e){t[n+q+i]=e[i]}}return t}async function ee(e){const t=Z(e);return K.getManager(t.scheme).removeModel(t.path)}async function te(e,t){return Q(e,t,!1)}async function ne(e,t){return Q(e,t,!0)}var ie=n(86448);
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class re{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return null==this.textEncoder&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}setTimeoutCustom(e,t){"undefined"!=typeof window&&(0,_._K)().getBool("USE_SETTIMEOUTCUSTOM")?(this.functionRefs.push(e),setTimeout(()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")},t),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",e=>{if(e.source===window&&e.data.name===this.messageName){e.stopPropagation();(0,this.functionRefs[e.data.index])(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}},!0))):setTimeout(e,t)}isTypedArray(e){return(0,ie.Y)(e)}}if((0,_._K)().get("IS_BROWSER")){(0,_._K)().setPlatform("browser",new re);try{K.registerManager(H.URL_SCHEME,new X)}catch(e){}try{K.registerManager(k.URL_SCHEME,new D)}catch(e){}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const se=()=>n(85817);let oe;class ae{constructor(){this.util=n(18590),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return null!=(0,_._K)().global.fetch?(0,_._K)().global.fetch(e,t):(null==oe&&(oe=se()),oe(e,t))}now(){const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return 0===e.length?"":new this.util.TextDecoder(t).decode(e)}isTypedArray(e){return this.util.types.isFloat32Array(e)||this.util.types.isInt32Array(e)||this.util.types.isUint8Array(e)||this.util.types.isUint8ClampedArray(e)}}(0,_._K)().get("IS_NODE")&&!(0,_._K)().get("IS_BROWSER")&&(0,_._K)().setPlatform("node",new ae);var le=n(448),ue=n(29809),ce=n(70125),de=n(75295),he=n(50259);
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,p.Ye)();const pe={buffer:le.r,cast:ue.w,clone:ce.o,print:de.y};(0,he.Q5)(pe);var fe=n(35287),me=n(37523),ge=n(89359),ye=n(9258),_e=n(79348),ve=n(45793),be=n(55537),Te=n(31830),xe=n(45702);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Ee=new Map,we=new Map;class Ie{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}}class Ae{constructor(){this.classNameMap={}}static getMap(){return null==Ae.instance&&(Ae.instance=new Ae),Ae.instance}static register(e){Ae.getMap().classNameMap[e.className]=[e,e.fromConfig]}}function Se(e,t,n){(0,F.vA)(null!=e.className,()=>"Class being registered does not have the static className property defined."),(0,F.vA)("string"==typeof e.className,()=>"className is required to be a string, but got type "+typeof e.className),(0,F.vA)(e.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),void 0===t&&(t="Custom"),void 0===n&&(n=e.className);const i=t+">"+n;return Ae.register(e),Ee.set(i,e),we.set(e,i),e}function Ce(e){return we.has(e)?we.get(e):e.className}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Oe extends Ie{minimize(e,t=!1,n){const{value:i,grads:r}=this.computeGradients(e,n);if(null!=n){const e=n.map(e=>({name:e.name,tensor:r[e.name]}));this.applyGradients(e)}else this.applyGradients(r);return(0,fe.AS)(r),t?i:(i.dispose(),null)}get iterations(){return null==this.iterations_&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return(0,Te.y7)(e,t)}dispose(){null!=this.iterations_&&(0,fe.AS)(this.iterations_)}async saveIterations(){return null==this.iterations_&&(this.iterations_=0),{name:"iter",tensor:(0,xe.d)(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}}Object.defineProperty(Oe,Symbol.hasInstance,{value:e=>null!=e.minimize&&null!=e.computeGradients&&null!=e.applyGradients});
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Me extends Oe{static get className(){return"Adadelta"}constructor(e,t,n=null){super(),this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],null==n&&(this.epsilon=p.T2.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(e=>e.name):Object.keys(e)).forEach((t,n)=>{const i=p.T2.registeredVariables[t],r=!1;null==this.accumulatedGrads[n]&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:(0,fe.DZ)(()=>(0,be.P)(i).variable(r))}),null==this.accumulatedUpdates[n]&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:(0,fe.DZ)(()=>(0,be.P)(i).variable(r))});const s=Array.isArray(e)?e[n].tensor:e[t];if(null==s)return;const o=this.accumulatedGrads[n].variable,a=this.accumulatedUpdates[n].variable;(0,fe.DZ)(()=>{const e=(0,me.W)((0,ye.l)(o,this.rho),(0,ye.l)((0,ve.E)(s),1-this.rho)),t=(0,ye.l)((0,ge.y)((0,_e.R)((0,me.W)(a,this.epsilon)),(0,_e.R)((0,me.W)(o,this.epsilon))),s),n=(0,me.W)((0,ye.l)(a,this.rho),(0,ye.l)((0,ve.E)(t),1-this.rho));o.assign(e),a.assign(n);const r=(0,me.W)((0,ye.l)(t,-this.learningRate),i);i.assign(r)})}),this.incrementIterations()}dispose(){null!=this.accumulatedUpdates&&((0,fe.AS)(this.accumulatedGrads.map(e=>e.variable)),(0,fe.AS)(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){const e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){const t=(e=await this.extractIterations(e)).length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map(e=>({originalName:e.name,variable:e.tensor.variable(n)})),this.accumulatedUpdates=e.slice(t,2*t).map(e=>({originalName:e.name,variable:e.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}}var Re=n(96111);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class ke extends Oe{static get className(){return"Adagrad"}constructor(e,t=.1){super(),this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(e=>e.name):Object.keys(e)).forEach((t,n)=>{const i=p.T2.registeredVariables[t];if(null==this.accumulatedGrads[n]){const e=!1;this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:(0,fe.DZ)(()=>(0,Re.G)(i.shape,this.initialAccumulatorValue).variable(e))}}const r=Array.isArray(e)?e[n].tensor:e[t];if(null==r)return;const s=this.accumulatedGrads[n].variable;(0,fe.DZ)(()=>{const e=(0,me.W)(s,(0,ve.E)(r));s.assign(e);const t=(0,me.W)((0,ye.l)((0,ge.y)(r,(0,_e.R)((0,me.W)(e,p.T2.backend.epsilon()))),-this.learningRate),i);i.assign(t)})}),this.incrementIterations()}dispose(){null!=this.accumulatedGrads&&(0,fe.AS)(this.accumulatedGrads.map(e=>e.variable))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);this.accumulatedGrads=e.map(e=>({originalName:e.name,variable:e.tensor.variable(false)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}}var Ne=n(98990),De=n(77126);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Fe extends Oe{static get className(){return"Adam"}constructor(e,t,n,i=null){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=i,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],(0,fe.DZ)(()=>{this.accBeta1=(0,xe.d)(t).variable(),this.accBeta2=(0,xe.d)(n).variable()}),null==i&&(this.epsilon=p.T2.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map(e=>e.name):Object.keys(e);(0,fe.DZ)(()=>{const n=(0,De.j)(1,this.accBeta1),i=(0,De.j)(1,this.accBeta2);t.forEach((t,r)=>{const s=p.T2.registeredVariables[t],o=!1;null==this.accumulatedFirstMoment[r]&&(this.accumulatedFirstMoment[r]={originalName:`${t}/m`,variable:(0,fe.DZ)(()=>(0,be.P)(s).variable(o))}),null==this.accumulatedSecondMoment[r]&&(this.accumulatedSecondMoment[r]={originalName:`${t}/v`,variable:(0,fe.DZ)(()=>(0,be.P)(s).variable(o))});const a=Array.isArray(e)?e[r].tensor:e[t];if(null==a)return;const l=this.accumulatedFirstMoment[r].variable,u=this.accumulatedSecondMoment[r].variable,c=(0,me.W)((0,ye.l)(l,this.beta1),(0,ye.l)(a,1-this.beta1)),d=(0,me.W)((0,ye.l)(u,this.beta2),(0,ye.l)((0,ve.E)(a),1-this.beta2)),h=(0,ge.y)(c,n),f=(0,ge.y)(d,i);l.assign(c),u.assign(d);const m=(0,me.W)((0,ye.l)((0,ge.y)(h,(0,me.W)((0,_e.R)(f),this.epsilon)),-this.learningRate),s);s.assign(m)}),this.accBeta1.assign((0,ye.l)(this.accBeta1,this.beta1)),this.accBeta2.assign((0,ye.l)(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&(0,fe.AS)(this.accumulatedFirstMoment.map(e=>e.variable)),null!=this.accumulatedSecondMoment&&(0,fe.AS)(this.accumulatedSecondMoment.map(e=>e.variable))}async getWeights(){const e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e),(0,fe.DZ)(()=>{this.accBeta1.assign((0,Ne.n)(this.beta1,this.iterations_+1)),this.accBeta2.assign((0,Ne.n)(this.beta2,this.iterations_+1))});const t=e.length/2,n=!1;this.accumulatedFirstMoment=e.slice(0,t).map(e=>({originalName:e.name,variable:e.tensor.variable(n)})),this.accumulatedSecondMoment=e.slice(t,2*t).map(e=>({originalName:e.name,variable:e.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}}var Le=n(4888),Pe=n(30178);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Be extends Oe{static get className(){return"Adamax"}constructor(e,t,n,i=null,r=0){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=i,this.decay=r,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],(0,fe.DZ)(()=>{this.iteration=(0,xe.d)(0).variable(),this.accBeta1=(0,xe.d)(t).variable()}),null==i&&(this.epsilon=p.T2.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map(e=>e.name):Object.keys(e);(0,fe.DZ)(()=>{const n=(0,De.j)(1,this.accBeta1),i=(0,ge.y)(-this.learningRate,(0,me.W)((0,ye.l)(this.iteration,this.decay),1));t.forEach((t,r)=>{const s=p.T2.registeredVariables[t],o=!1;null==this.accumulatedFirstMoment[r]&&(this.accumulatedFirstMoment[r]={originalName:`${t}/m`,variable:(0,be.P)(s).variable(o)}),null==this.accumulatedWeightedInfNorm[r]&&(this.accumulatedWeightedInfNorm[r]={originalName:`${t}/v`,variable:(0,be.P)(s).variable(o)});const a=Array.isArray(e)?e[r].tensor:e[t];if(null==a)return;const l=this.accumulatedFirstMoment[r].variable,u=this.accumulatedWeightedInfNorm[r].variable,c=(0,me.W)((0,ye.l)(l,this.beta1),(0,ye.l)(a,1-this.beta1)),d=(0,ye.l)(u,this.beta2),h=(0,Le.t)(a),f=(0,Pe.P)(d,h);l.assign(c),u.assign(f);const m=(0,me.W)((0,ye.l)((0,ge.y)(i,n),(0,ge.y)(c,(0,me.W)(f,this.epsilon))),s);s.assign(m)}),this.iteration.assign((0,me.W)(this.iteration,1)),this.accBeta1.assign((0,ye.l)(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&(0,fe.AS)(this.accumulatedFirstMoment.map(e=>e.variable)),null!=this.accumulatedWeightedInfNorm&&(0,fe.AS)(this.accumulatedWeightedInfNorm.map(e=>e.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class $e extends Oe{static get className(){return"SGD"}constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(e=>e.name):Object.keys(e)).forEach((t,n)=>{const i=Array.isArray(e)?e[n].tensor:e[t];if(null==i)return;const r=p.T2.registeredVariables[t];(0,fe.DZ)(()=>{const e=(0,me.W)((0,ye.l)(this.c,i),r);r.assign(e)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=(0,fe.aC)((0,xe.d)(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(0!==(e=await this.extractIterations(e)).length)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Ue extends $e{static get className(){return"Momentum"}constructor(e,t,n=!1){super(e),this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=(0,xe.d)(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(e=>e.name):Object.keys(e)).forEach((t,n)=>{const i=p.T2.registeredVariables[t];if(null==this.accumulations[n]){const e=!1;this.accumulations[n]={originalName:`${t}/momentum`,variable:(0,fe.DZ)(()=>(0,be.P)(i).variable(e))}}const r=this.accumulations[n].variable,s=Array.isArray(e)?e[n].tensor:e[t];null!=s&&(0,fe.DZ)(()=>{let e;const t=(0,me.W)((0,ye.l)(this.m,r),s);e=this.useNesterov?(0,me.W)((0,ye.l)(this.c,(0,me.W)(s,(0,ye.l)(t,this.m))),i):(0,me.W)((0,ye.l)(this.c,t),i),r.assign(t),i.assign(e)})}),this.incrementIterations()}dispose(){this.m.dispose(),null!=this.accumulations&&(0,fe.AS)(this.accumulations.map(e=>e.variable))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);this.accumulations=e.map(e=>({originalName:e.name,variable:e.tensor.variable(false)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class ze extends Oe{static get className(){return"RMSProp"}constructor(e,t=.9,n=0,i=null,r=!1){if(super(),this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=i,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=r,null==i&&(this.epsilon=p.T2.backend.epsilon()),null==e)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map(e=>e.name):Object.keys(e)).forEach((t,n)=>{const i=p.T2.registeredVariables[t],r=!1;null==this.accumulatedMeanSquares[n]&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:(0,fe.DZ)(()=>(0,be.P)(i).variable(r))}),null==this.accumulatedMoments[n]&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:(0,fe.DZ)(()=>(0,be.P)(i).variable(r))}),null==this.accumulatedMeanGrads[n]&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:(0,fe.DZ)(()=>(0,be.P)(i).variable(r))});const s=Array.isArray(e)?e[n].tensor:e[t];if(null==s)return;const o=this.accumulatedMeanSquares[n].variable,a=this.accumulatedMoments[n].variable;(0,fe.DZ)(()=>{const e=(0,me.W)((0,ye.l)(o,this.decay),(0,ye.l)((0,ve.E)(s),1-this.decay));if(this.centered){const t=this.accumulatedMeanGrads[n].variable,r=(0,me.W)((0,ye.l)(t,this.decay),(0,ye.l)(s,1-this.decay)),l=(0,ge.y)((0,ye.l)(s,this.learningRate),(0,_e.R)((0,De.j)(e,(0,me.W)((0,ve.E)(r),this.epsilon)))),u=(0,me.W)((0,ye.l)(a,this.momentum),l);o.assign(e),t.assign(r),a.assign(u);const c=(0,De.j)(i,u);i.assign(c)}else{const e=(0,me.W)((0,ye.l)(o,this.decay),(0,ye.l)((0,ve.E)(s),1-this.decay)),t=(0,me.W)((0,ye.l)(a,this.momentum),(0,ge.y)((0,ye.l)(s,this.learningRate),(0,_e.R)((0,me.W)(e,this.epsilon))));o.assign(e),a.assign(t);const n=(0,De.j)(i,t);i.assign(n)}})}),this.incrementIterations()}dispose(){null!=this.accumulatedMeanSquares&&(0,fe.AS)(this.accumulatedMeanSquares.map(e=>e.variable)),null!=this.accumulatedMeanGrads&&this.centered&&(0,fe.AS)(this.accumulatedMeanGrads.map(e=>e.variable)),null!=this.accumulatedMoments&&(0,fe.AS)(this.accumulatedMoments.map(e=>e.variable))}async getWeights(){const e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);const t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map(e=>({originalName:e.name,variable:e.tensor.variable(n)})),this.accumulatedMoments=e.slice(t,2*t).map(e=>({originalName:e.name,variable:e.tensor.variable(n)})),this.centered&&(this.accumulatedMeanGrads=e.slice(2*t,3*t).map(e=>({originalName:e.name,variable:e.tensor.variable(n)})))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}}
/**
* @license
* Copyright 2022 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Ve=[Me,ke,Fe,Be,Ue,ze,$e];function je(e){return new Promise(e=>setTimeout(e)).then(e)}class Ye{constructor(e){if(!(0,_._K)().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(Ye.URL_SCHEME)&&(e=e.slice(Ye.URL_SCHEME.length)),null!=e&&0!==e.length||(e="model"),this.modelJsonFileName=e+".json",this.weightDataFileName=e+".weights.bin"}async save(e){if("undefined"==typeof document)throw new Error("Browser downloads are not supported in this environment since `document` is not present");const t=A.D.join(e.weightData),n=window.URL.createObjectURL(new Blob([t],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{const t=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],i=(0,b.zV)(e,t),r=window.URL.createObjectURL(new Blob([JSON.stringify(i)],{type:"application/json"})),s=null==this.modelJsonAnchor?document.createElement("a"):this.modelJsonAnchor;if(s.download=this.modelJsonFileName,s.href=r,await je(()=>s.dispatchEvent(new MouseEvent("click"))),null!=e.weightData){const e=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor;e.download=this.weightDataFileName,e.href=n,await je(()=>e.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:(0,b.oR)(e)}}}}Ye.URL_SCHEME="downloads://";class Ge{constructor(e){if(null==e||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.jsonFile=e[0],this.weightsFiles=e.slice(1)}async load(){return new Promise((e,t)=>{const n=new FileReader;n.onload=n=>{const i=JSON.parse(n.target.result),r=i.modelTopology;if(null==r)return void t(new Error(`modelTopology field is missing from file ${this.jsonFile.name}`));if(null==i.weightsManifest)return void t(new Error(`weightManifest field is missing from file ${this.jsonFile.name}`));if(0===this.weightsFiles.length)return void e({modelTopology:r});const s=(0,b.Ej)(i,e=>this.loadWeights(e));e(s)},n.onerror=e=>t(`Failed to read model topology and weights manifest JSON from file '${this.jsonFile.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),n.readAsText(this.jsonFile)})}loadWeights(e){const t=[],n=[];for(const i of e)t.push(...i.weights),n.push(...i.paths);const i=this.checkManifestAndWeightFiles(e),r=n.map(e=>this.loadWeightsFile(e,i[e]));return Promise.all(r).then(e=>[t,e])}loadWeightsFile(e,t){return new Promise((n,i)=>{const r=new FileReader;r.onload=e=>{const t=e.target.result;n(t)},r.onerror=t=>i(`Failed to weights data from file of path '${e}'.`),r.readAsArrayBuffer(t)})}checkManifestAndWeightFiles(e){const t=[],n=this.weightsFiles.map(e=>(0,b.P8)(e.name)),i={};for(const r of e)r.paths.forEach(e=>{const r=(0,b.P8)(e);if(-1!==t.indexOf(r))throw new Error(`Duplicate file basename found in weights manifest: '${r}'`);if(t.push(r),-1===n.indexOf(r))throw new Error(`Weight file with basename '${r}' is not provided.`);i[e]=this.weightsFiles[n.indexOf(r)]});if(t.length!==this.weightsFiles.length)throw new Error(`Mismatch in the number of files in weights manifest (${t.length}) and the number of weight files provided (${this.weightsFiles.length}).`);return i}}function He(e){return new Ge(e)}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function We(e,t,n,i){!function(e){(0,F.vA)(null!=e&&Array.isArray(e)&&e.length>0,()=>"promises must be a none empty array")}(e),function(e,t){(0,F.vA)(e>=0&&e<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${e}`),(0,F.vA)(t>=0&&t<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${t}`),(0,F.vA)(t>=e,()=>`startFraction must be no more than endFraction, but got startFraction ${e} and endFraction ${t}`)}(n=null==n?0:n,i=null==i?1:i);let r=0;return Promise.all(e.map(s=>(s.then(s=>{const o=n+ ++r/e.length*(i-n);return t(o),s}),s)))}T.registerSaveRouter(e=>(0,_._K)().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Ye.URL_SCHEME)?function(e="model"){return new Ye(e)}(e.slice(Ye.URL_SCHEME.length)):null);var Xe=n(15685);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
async function qe(e,t){null==t&&(t={});const n=null==t.fetchFunc?(0,_._K)().platform.fetch:t.fetchFunc,i=e.map(e=>n(e,t.requestInit,{isBinary:!0})),r=(null==t.onProgress?await Promise.all(i):await We(i,t.onProgress,0,.5)).map(e=>e.arrayBuffer());return null==t.onProgress?await Promise.all(r):await We(r,t.onProgress,.5,1)}async function Ke(e,t="",n,i){return Ze(e=>qe(e,{requestInit:i}))(e,t,n)}function Ze(e){return async(t,n="",i)=>{const r=t.map(()=>!1),s={},o=null!=i?i.map(()=>!1):[],a=[];if(t.forEach((e,t)=>{let n=0;e.weights.forEach(e=>{const l="quantization"in e?e.quantization.dtype:e.dtype,u=Xe.i[l]*F.Ze(e.shape),c=()=>{r[t]=!0,null==s[t]&&(s[t]=[]),s[t].push({manifestEntry:e,groupOffset:n,sizeBytes:u})};null!=i?i.forEach((t,n)=>{t===e.name&&(c(),o[n]=!0)}):c(),a.push(e.name),n+=u})}),!o.every(e=>e)){const e=i.filter((e,t)=>!o[t]);throw new Error(`Could not find weights in manifest with names: ${e.join(", ")}. \nManifest JSON has weights with names: ${a.join(", ")}.`)}const l=r.reduce((e,t,n)=>(t&&e.push(n),e),[]),u=[];l.forEach(e=>{t[e].paths.forEach(e=>{const t=n+(n.endsWith("/")?"":"/")+e;u.push(t)})});const c=await e(u),d={};let h=0;return l.forEach(e=>{const n=t[e].paths.length,i=new A.D(c.slice(h,h+n));s[e].forEach(e=>{const t=i.slice(e.groupOffset,e.groupOffset+e.sizeBytes),n=(0,b.CY)(t,[e.manifestEntry]);for(const e in n)d[e]=n[e]}),h+=n}),d}}class Qe{constructor(e,t){if(this.DEFAULT_METHOD="POST",null==t&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.weightUrlConverter=t.weightUrlConverter,null!=t.fetchFunc?((0,F.vA)("function"==typeof t.fetchFunc,()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=t.fetchFunc):this.fetch=(0,_._K)().platform.fetch,(0,F.vA)(null!=e&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&(0,F.vA)(2===e.length,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,null!=t.requestInit&&null!=t.requestInit.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{},this.loadOptions=t}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");const t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;const n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],i=(0,b.zV)(e,n);if(t.body.append("model.json",new Blob([JSON.stringify(i)],{type:"application/json"}),"model.json"),null!=e.weightData){const n=A.D.join(e.weightData);t.body.append("model.weights.bin",new Blob([n],{type:"application/octet-stream"}),"model.weights.bin")}const r=await this.fetch(this.path,t);if(r.ok)return{modelArtifactsInfo:(0,b.oR)(e),responses:[r]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${r.status}.`)}async loadModelJSON(){const e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let t;try{t=await e.json()}catch(e){let t=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?t+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":t+=" Please make sure the server is serving valid JSON for this request.",new Error(t)}const n=t.modelTopology,i=t.weightsManifest;if(null==n&&null==i)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);return t}async load(){if(this.loadOptions.streamWeights)return this.loadStream();const e=await this.loadModelJSON();return(0,b.Ej)(e,e=>this.loadWeights(e))}async loadStream(){const e=await this.loadModelJSON(),t=await this.getWeightUrls(e.weightsManifest),n=(0,b.Xf)(e.weightsManifest);return Object.assign(Object.assign({},e),{weightSpecs:n,getWeightStream:()=>function(e,t){var n;const i=null==t.fetchFunc?(0,_._K)().platform.fetch:t.fetchFunc;let r,s=0;return null===(n=t.onProgress)||void 0===n||n.call(t,0),new ReadableStream({pull:async n=>{for(var o;s<e.length;){if(!r){const n=(await i(e[s],t.requestInit,{isBinary:!0})).body;r=n.getReader()}const{done:a,value:l}=await r.read();if(!a)return void n.enqueue(l);s++,r=void 0,null===(o=t.onProgress)||void 0===o||o.call(t,s/e.length)}n.close()}})}(t,this.loadOptions)})}async getWeightUrls(e){const t=Array.isArray(this.path)?this.path[1]:this.path,[n,i]=function(e){const t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),i=e.substring(0,t),r=n>t?e.substring(n):"";return[i+"/",r]}(t),r=this.weightPathPrefix||n,s=[],o=[];for(const t of e)for(const e of t.paths)null!=this.weightUrlConverter?o.push(this.weightUrlConverter(e)):s.push(r+e+i);return this.weightUrlConverter&&s.push(...await Promise.all(o)),s}async loadWeights(e){const t=await this.getWeightUrls(e);return[(0,b.Xf)(e),await qe(t,this.loadOptions)]}}function Je(e){return null!=e.match(Qe.URL_SCHEME_REGEX)}Qe.URL_SCHEME_REGEX=/^https?:\/\//;const et=(e,t)=>{if("undefined"==typeof fetch&&(null==t||null==t.fetchFunc))return null;{let n=!0;if(n=Array.isArray(e)?e.every(e=>Je(e)):Je(e),n)return tt(e,t)}return null};function tt(e,t){return new Qe(e,t)}function nt(e,t){return tt(e,t)}T.registerSaveRouter(et),T.registerLoadRouter(et);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class it{constructor(e){this.modelArtifacts=e}load(){return this.modelArtifacts}}class rt{constructor(e){this.saveHandler=e}save(e){return this.saveHandler(e)}}class st{constructor(e){e.load&&(this.load=()=>Promise.resolve(e.load())),e.save&&(this.save=t=>Promise.resolve(e.save(t)))}}function ot(e,t,n,i){return new st(at(...arguments))}function at(e,t,n,i){if(1===arguments.length){return null!=e.modelTopology||null!=e.weightSpecs?new it(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new it({modelTopology:e}))}return console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new it({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:i})}function lt(e){return new rt(e)}function ut(e){return new rt(e)}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
var ct=n(28189),dt=n(65703),ht=n(11760),pt=n(70929),ft=n(7703);const mt=(0,pt.op)({confusionMatrix_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,ct.YT)(e,"labels","confusionMatrix"),r=(0,ct.YT)(t,"predictions","confusionMatrix");F.vA(null==n||n>0&&Number.isInteger(n),()=>`If provided, numClasses must be a positive integer, but got ${n}`),F.vA(1===i.rank,()=>`Expected the rank of labels to be 1, but got ${i.rank}`),F.vA(1===r.rank,()=>`Expected the rank of predictions to be 1, but got ${r.rank}`),F.vA(i.shape[0]===r.shape[0],()=>`Mismatch in the number of examples: ${i.shape[0]} vs. ${r.shape[0]}. Labels and predictions should have the same number of elements.`),F.vA(n>0&&Number.isInteger(n),()=>`numClasses is required to be a positive integer, but got ${n}`);const s=(0,ht.M)((0,ue.w)(i,"int32"),n),o=(0,ht.M)((0,ue.w)(r,"int32"),n),a=(0,ft.m)(s),l=(0,dt.N)(a,o);return(0,ue.w)(l,"int32")}});
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
var gt=n(62198),yt=n(15441),_t=n(37074),vt=n(42768);
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
let bt,Tt=!1;function xt(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(null==e)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,i=!1,r=!1,s=!1,o=!1,a=!1;if(e.data instanceof Uint8Array)n=!0;else if("undefined"!=typeof ImageData&&e instanceof ImageData)i=!0;else if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)r=!0;else if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement)s=!0;else if(null!=e.getContext)o=!0;else{if(!("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap))throw new Error(`pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was ${e.constructor.name}`);a=!0}if(null!=(0,_t._5)(yt.awo,p.T2.backendName)){const n={pixels:e},i={numChannels:t};return p.T2.runKernel(yt.awo,n,i)}const[l,u]=r?[e.videoWidth,e.videoHeight]:[e.width,e.height];let c,d;if(o)c=e.getContext("2d").getImageData(0,0,l,u).data;else if(i||n)c=e.data;else if(s||r||a){if(null==bt)if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas||"undefined"==typeof OffscreenCanvasRenderingContext2D)throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");bt=new OffscreenCanvas(1,1).getContext("2d")}else bt=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});bt.canvas.width=l,bt.canvas.height=u,bt.drawImage(e,0,0,l,u),c=bt.getImageData(0,0,l,u).data}if(4===t)d=new Int32Array(c);else{const e=l*u;d=new Int32Array(e*t);for(let n=0;n<e;n++)for(let e=0;e<t;++e)d[n*t+e]=c[4*n+e]}const h=[u,l,t];return(0,vt.$)(d,h,"int32")}function Et(e){return"undefined"!=typeof window&&"undefined"!=typeof ImageBitmap&&window.hasOwnProperty("createImageBitmap")&&!(e instanceof ImageBitmap)&&function(e){return null!=e&&0!==e.width&&0!==e.height}(e)&&!function(e){return null!=e&&e.data instanceof Uint8Array}(e)}async function wt(e,t=3){let n=null;if((0,_._K)().getBool("WRAP_TO_IMAGEBITMAP")&&Et(e)){let t;try{t=await createImageBitmap(e,{premultiplyAlpha:"none"})}catch(e){t=null}n=null!=t&&t.width===e.width&&t.height===e.height?t:e}else n=e;return xt(n,t)}function It(e){if(2!==e.rank&&3!==e.rank)throw new Error(`toPixels only supports rank 2 or 3 tensors, got rank ${e.rank}.`);const t=2===e.rank?1:e.shape[2];if(t>4||2===t)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${t}`);if("float32"!==e.dtype&&"int32"!==e.dtype)throw new Error(`Unsupported type for toPixels: ${e.dtype}. Please use float32 or int32 tensors.`)}async function At(e,t){let n=(0,ct.YT)(e,"img","toPixels");if(!(e instanceof he.qY)){const e=n;n=(0,ue.w)(e,"int32"),e.dispose()}It(n);const[i,r]=n.shape.slice(0,2),s=2===n.rank?1:n.shape[2],o=await n.data(),a="float32"===n.dtype?255:1,l=new Uint8ClampedArray(r*i*4);for(let e=0;e<i*r;++e){const t=[0,0,0,255];for(let i=0;i<s;i++){const r=o[e*s+i];if("float32"===n.dtype){if(r<0||r>1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${r}.`)}else if("int32"===n.dtype&&(r<0||r>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${r}.`);1===s?(t[0]=r*a,t[1]=r*a,t[2]=r*a):t[i]=r*a}const i=4*e;l[i+0]=Math.round(t[0]),l[i+1]=Math.round(t[1]),l[i+2]=Math.round(t[2]),l[i+3]=Math.round(t[3])}if(null!=t){if(!Tt){null!=(0,_t._5)(yt.XmO,p.T2.backendName)&&(console.warn("tf.browser.toPixels is not efficient to draw tensor on canvas. Please try tf.browser.draw instead."),Tt=!0)}t.width=r,t.height=i;const e=t.getContext("2d"),n=new ImageData(l,r,i);e.putImageData(n,0,0)}return n!==e&&n.dispose(),l}function St(e,t,n){let i=(0,ct.YT)(e,"img","draw");if(!(e instanceof he.qY)){const e=i;i=(0,ue.w)(e,"int32"),e.dispose()}It(i),function(e){const t=(null==e?void 0:e.alpha)||1;if(t>1||t<0)throw new Error(`Alpha value ${t} is suppoed to be in range [0 - 1].`)}(null==n?void 0:n.imageOptions);const r={image:i},s={canvas:t,options:n};p.T2.runKernel(yt.XmO,r,s)}const Ct=(0,pt.op)({fromPixels_:xt});function Ot(e,t){const n=e.shape.length,i=t.shape.length;if(n<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${n}.`);if(i<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${i}.`);if("int32"!==t.dtype)throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[i-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[i-1]} vs. ${n}`);if(0===(0,F.Ze)(e.shape))throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);const r=t.shape,s=r[r.length-1];let o=1;for(let e=0;e<r.length-1;++e)o*=r[e];const a=e.shape,l=r.slice();l.pop();let u=1;for(let e=s;e<n;++e)u*=a[e],l.push(a[e]);const c=[...(0,F.Ur)(e.shape).map(e=>e/u),1].slice(0,s);return[l,o,u,c]}var Mt=n(26170),Rt=n(34969),kt=n(30565),Nt=n(83879);
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Dt=.001,Ft=.1;function Lt(e,t,n){return null==n&&(n=Pt()),Bt(e,t,(e,t)=>Vt(e,t,n))}function Pt(){return 32===p.T2.backend.floatPrecision()?Dt:Ft}function Bt(e,t,n){let i=!0;if(((0,Nt.isTypedArray)(e)||(0,Nt.isTypedArray)(t))&&(i=!1),(0,Nt.isTypedArray)(e)&&(0,Nt.isTypedArray)(t)&&(i=!0),i){const n=e.constructor.name,i=t.constructor.name;if(n!==i)throw new Error(`Arrays are of different type. Actual: ${n}. Expected: ${i}`)}if(Array.isArray(e)&&Array.isArray(t)){const n=(0,ct.MZ)(e),i=(0,ct.MZ)(t);if(!(0,F.r1)(n,i))throw new Error(`Arrays have different shapes. Actual: [${n}]. Expected: [${i}]`)}const r=(0,Nt.isTypedArray)(e)?e:(0,Nt.flatten)(e),s=(0,Nt.isTypedArray)(t)?t:(0,Nt.flatten)(t);if(r.length!==s.length)throw new Error(`Arrays have different lengths actual: ${r.length} vs expected: ${s.length}.\nActual: ${r}.\nExpected: ${s}.`);for(let e=0;e<s.length;++e){const t=r[e],i=s[e];if(!n(t,i))throw new Error(`Arrays differ: actual[${e}] = ${t}, expected[${e}] = ${i}.\nActual: ${r}.\nExpected: ${s}.`)}"undefined"!=typeof expect&&expect().nothing()}function $t(e,t){e().then(()=>t.fail(),()=>t()),"undefined"!=typeof expect&&expect().nothing()}function Ut(e,t){const n="string"==typeof t||"number"==typeof t||"boolean"==typeof t?[t]:t;return(0,F.Kg)(e)||(0,F.Kg)(e[0])||(0,F.Kg)(t)||(0,F.Kg)(t[0])?Bt(e,n,(e,t)=>e==t):Bt(e,t,(e,t)=>Vt(e,t,0))}function zt(e,t,n){if(null==n&&(n=Pt()),!Vt(e,t,n))throw new Error(`Numbers differ: actual === ${e}, expected === ${t}`);"undefined"!=typeof expect&&expect().nothing()}function Vt(e,t,n){return!isFinite(e)&&!isFinite(t)||!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function jt(e,t,n){for(let i=0;i<e.length;i++)if(e[i]<t||e[i]>n)throw new Error(`Value out of range:${e[i]} low: ${t}, high: ${n}`)}function Yt(e,t){const n=new Float32Array(e),i=new Float32Array(t);if(n.length!==i.length)throw new Error(`Expected ArrayBuffer to be of length ${i.length}, but it was ${n.length}`);for(let e=0;e<i.length;e++)if(n[e]!==i[e])throw new Error(`Expected ArrayBuffer value at ${e} to be ${i[e]} but got ${n[e]} instead`)}function Gt(e){for(let t=0;t<e.length;t++){const n=e[t];Array.isArray(n)?Gt(n):e[t]=(0,Nt.encodeString)(n)}return e}function Ht(e){const t=document.createElement("video");return"playsInline"in t&&(t.playsInline=!0),t.muted=!0,t.loop=!0,t.style.position="fixed",t.style.left="0px",t.style.top="0px",t.preload="auto",t.appendChild(e),new Promise(e=>{t.addEventListener("loadeddata",n=>e(t)),t.load()})}async function Wt(e){await e.play(),"requestVideoFrameCallback"in e&&await new Promise(t=>{e.requestVideoFrameCallback(t)})}
/** @license See the LICENSE file. */
const Xt="4.22.0";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class qt{static sgd(e){return new $e(e)}static momentum(e,t,n=!1){return new Ue(e,t,n)}static rmsprop(e,t=.9,n=0,i=null,r=!1){return new ze(e,t,n,i,r)}static adam(e=.001,t=.9,n=.999,i=null){return new Fe(e,t,n,i)}static adadelta(e=.001,t=.95,n=null){return new Me(e,t,n)}static adamax(e=.002,t=.9,n=.999,i=null,r=0){return new Be(e,t,n,i,r)}static adagrad(e,t=.1){return new ke(e,t)}}var Kt=n(52046),Zt=n(67270),Qt=n(27084);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Jt=qt,en="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:"undefined"!=typeof setImmediate?setImmediate:e=>e();function tn(){return new Promise(e=>en(()=>e()))}var nn=n(21078);
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function rn(e,t){const n=e[0].length;e.forEach((e,t)=>{F.vA(e.length===n,()=>`Error in concat${n}D: rank of tensors[${t}] must be the same as the rank of the rest (${n})`)}),F.vA(t>=0&&t<n,()=>`Error in concat${n}D: axis must be between 0 and ${n-1}.`);const i=e[0];e.forEach((e,r)=>{for(let s=0;s<n;s++)F.vA(s===t||e[s]===i[s],()=>`Error in concat${n}D: Shape of tensors[${r}] (${e}) does not match the shape of the rest (${i}) along the non-concatenated axis ${r}.`)})}function sn(e,t){const n=e[0].slice();for(let i=1;i<e.length;i++)n[t]+=e[i][t];return n}var on,an=n(47195),ln=n(68646);function un(e,t,n){let i=new Array;if(null==n&&null==t)return i;if(null==t)for(;i.length<e+n.length;)i.push(-1);else i=t.slice();if(null==n)return i;if(e+n.length!==i.length)throw new Error(`rt input.shape and shape=${t} are incompatible: rt input.rank = ${e+n.length}, but shape.rank = ${i.length}`);for(let r=1;r<n.length;++r){const s=n[r],o=i[i.length-n.length+r],a=i[o];if(s>=0)if(a>=0){if(a!==s)throw new Error(`rt input.shape and shape=${t} are incompatible: rt input.shape[${r+e}] = ${s} but shape[${r+e}] = ${a}`)}else i[o]=s}return i}function cn(e){const t={FIRST_DIM_SIZE:on.FIRST_DIM_SIZE,VALUE_ROWIDS:on.VALUE_ROWIDS,ROW_LENGTHS:on.ROW_LENGTHS,ROW_SPLITS:on.ROW_SPLITS,ROW_LIMITS:on.ROW_LIMITS,ROW_STARTS:on.ROW_STARTS},n=[];for(const i of e){if(!(i in t))break;n.push(t[i])}return n}function dn(e){return 0===e.length?0:e[0]===on.FIRST_DIM_SIZE?e.length-1:e.length}function hn(e,t){if(null==e||null==t)return;const n=e.length,i=t.length;if(n>=i)throw new Error(`defaultValue.shape=${e} and ragged tensor flatValues.shape=${t}, are incompatible: defaultValue.rank = ${n} must be less than ragged tensor input flatValues.rank = ${i})`);for(let r=0;r<Math.min(n,i-1);++r){const n=e[r],i=t[r+1];if(n>=0&&i>=0&&1!==n&&n!==i)throw new Error(`defaultValue.shape=${e}, and ragged tensor input flatValues.shape=${t} are incompatible: defaultValue.shape[${r-e.length}] = ${n} but ragged tensor input.flatValues.shape[${r-e.length}] = ${i}`)}}!function(e){e[e.FIRST_DIM_SIZE=0]="FIRST_DIM_SIZE",e[e.VALUE_ROWIDS=1]="VALUE_ROWIDS",e[e.ROW_LENGTHS=2]="ROW_LENGTHS",e[e.ROW_SPLITS=3]="ROW_SPLITS",e[e.ROW_LIMITS=4]="ROW_LIMITS",e[e.ROW_STARTS=5]="ROW_STARTS"}(on||(on={}));
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const pn=30;function fn(e){return e<=pn?e:(0,F.lK)(e,Math.floor(Math.sqrt(e)))}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function mn(e,t,n){return[n*("number"==typeof e?e:e[0]),t*("number"==typeof e?e:e[1])]}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function gn(e,t,n,i=!0){let r=[];if(i)r=r.concat(t.slice(0)),r.push(e[0]/n),r=r.concat(e.slice(1));else{r=r.concat(e[0]);const n=t.length;for(let i=0;i<n;++i)r=r.concat([e[i+1]/t[i],t[i]]);r=r.concat(e.slice(n+1))}return r}function yn(e,t,n=!0){const i=[];if(n){i.push(t);for(let n=t+1;n<e;++n)n<=2*t?(i.push(n),i.push(n-(t+1))):i.push(n)}else{const n=[],r=[];for(let i=1;i<e;++i)i>=2*t+1||i%2==1?r.push(i):n.push(i);i.push(...n),i.push(0),i.push(...r)}return i}function _n(e,t,n,i=!0){const r=[];i?r.push(e[0]/n):r.push(e[0]*n);for(let n=1;n<e.length;++n)n<=t.length?i?r.push(t[n-1]*e[n]):r.push(e[n]/t[n-1]):r.push(e[n]);return r}function vn(e,t){const n=[0];for(let i=0;i<t;++i)n.push(e[i][0]);return n}function bn(e,t,n){const i=e.slice(0,1);for(let r=0;r<n;++r)i.push(e[r+1]-t[r][0]-t[r][1]);return i}var Tn=n(28576);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const xn=.3275911,En=.254829592,wn=-.284496736,In=1.421413741,An=-1.453152027,Sn=1.061405429;var Cn=n(73673);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function On(e,t){if(e.length!==t.length)throw new Error(`Cannot merge real and imag arrays of different lengths. real:${e.length}, imag: ${t.length}.`);const n=new Float32Array(2*e.length);for(let i=0;i<n.length;i+=2)n[i]=e[i/2],n[i+1]=t[i/2];return n}function Mn(e){const t=new Float32Array(e.length/2),n=new Float32Array(e.length/2);for(let i=0;i<e.length;i+=2)t[i/2]=e[i],n[i/2]=e[i+1];return{real:t,imag:n}}function Rn(e){const t=Math.ceil(e.length/4),n=new Float32Array(t),i=new Float32Array(t);for(let t=0;t<e.length;t+=4)n[Math.floor(t/4)]=e[t],i[Math.floor(t/4)]=e[t+1];return{real:n,imag:i}}function kn(e){const t=Math.floor(e.length/4),n=new Float32Array(t),i=new Float32Array(t);for(let t=2;t<e.length;t+=4)n[Math.floor(t/4)]=e[t],i[Math.floor(t/4)]=e[t+1];return{real:n,imag:i}}function Nn(e,t){return{real:e[2*t],imag:e[2*t+1]}}function Dn(e,t,n,i){e[2*i]=t,e[2*i+1]=n}function Fn(e,t){const n=new Float32Array(e/2),i=new Float32Array(e/2);for(let r=0;r<Math.ceil(e/2);r++){const s=(t?2:-2)*Math.PI*(r/e);n[r]=Math.cos(s),i[r]=Math.sin(s)}return{real:n,imag:i}}function Ln(e,t,n){const i=(n?2:-2)*Math.PI*(e/t);return{real:Math.cos(i),imag:Math.sin(i)}}
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Pn="->",Bn=/->/g,$n=",",Un="...";function zn(e,t){const n=((e=e.replace(/\s/g,"")).length-e.replace(Bn,"").length)/Pn.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error(`Equation must contain exactly one arrow ("${Pn}").`);const[i,r]=e.split(Pn);(0,F.vA)(-1===i.indexOf(Un),()=>`The ellipsis notation ("${Un}") is not supported yet.`);const s=i.split($n),o=s.length;if(t!==o)throw new Error(`Expected ${o} input tensors, received ${t}`);if(o>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");const a=[];for(let e=0;e<r.length;++e){const t=r[e];if(!s.some(e=>-1!==e.indexOf(t)))throw new Error(`Output subscripts contain the label ${t} not present in the input subscripts.`);-1===a.indexOf(t)&&a.push(t)}for(let e=0;e<i.length;++e){const t=i[e];-1===a.indexOf(t)&&t!==$n&&a.push(t)}const l=new Array(s.length);for(let e=0;e<o;++e){if(new Set(s[e].split("")).size!==s[e].length)throw new Error(`Found duplicate axes in input component ${s[e]}. Support for duplicate axes in input is not implemented yet.`);l[e]=[];for(let t=0;t<s[e].length;++t)l[e].push(a.indexOf(s[e][t]))}const u=a.length,c=[];for(let e=r.length;e<u;++e)c.push(e);return{allDims:a,summedDims:c,idDims:l}}function Vn(e,t){let n=new Array(e);n.fill(-1);for(let e=0;e<t.length;++e)n[t[e]]=e;const i=[];for(let t=0;t<e;++t)-1===n[t]&&i.push(t);return n=n.filter(e=>-1!==e),{permutationIndices:n,expandDims:i}}function jn(e,t,n){const i=new Array(e);for(let e=0;e<n.length;++e){const r=n[e].shape;for(let n=0;n<t[e].length;++n)void 0===i[t[e][n]]?i[t[e][n]]=r[n]:(0,F.vA)(i[t[e][n]]===r[n],()=>`Expected dimension ${i[t[e][n]]} at axis ${n} of input shaped ${JSON.stringify(r)}, but got dimension ${r[n]}`)}}function Yn(e,t){const n=e,i=[];let r=0;0===e.length&&n.push(-1),r=e.length+1;for(let e=0;e<r;++e)i.push([]);const s=[];for(let e=0;e<n.length;++e){const r=Hn(t,n[e]);for(const t of r)-1===s.indexOf(t)&&(i[e].push(t),s.push(t))}return{path:n,steps:i}}function Gn(e){return e.every((e,t)=>e===t)}function Hn(e,t){const n=[];for(let i=0;i<e.length;++i)0!==e[i].length&&-1===e[i].indexOf(t)&&-1!==t||n.push(i);return n}function Wn(e,t,n=0){let i=[];if("number"==typeof t)(0,F.vA)(e.shape[n]%t===0,()=>"Number of splits must evenly divide the axis."),i=new Array(t).fill(e.shape[n]/t);else{const r=t.reduce((e,t)=>(-1===t&&(e+=1),e),0);(0,F.vA)(r<=1,()=>"There should be only one negative value in split array.");const s=t.indexOf(-1);if(-1!==s){const i=t.reduce((e,t)=>t>0?e+t:e);t[s]=e.shape[n]-i}(0,F.vA)(e.shape[n]===t.reduce((e,t)=>e+t),()=>"The sum of sizes must match the size of the axis dimension."),i=t}return i}
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Xn(e){return`Received SparseTensor with denseShape[0] = 0 but\n indices.shape[0] = ${e}`}function qn(e,t){return`indices(${e}, 0) is invalid: ${t} < 0`}function Kn(e,t,n){return`indices(${e}, 0) is invalid: ${t} >= ${n}`}
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Zn(e,t){return`only one output dimension may be -1, not both ${e} and ${t}`}function Qn(e,t){return`size ${e} must be non-negative, not ${t}`}function Jn(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"}function ei(e,t){return`Input to reshape is a SparseTensor with ${(0,F.Ze)(e)}\n dense values, but the requested shape requires a multiple of ${(0,F.Ze)(t)}. inputShape=${e} outputShape= ${t}`}function ti(e,t){return`Input to reshape is a tensor with ${(0,F.Ze)(e)} dense values, but the requested shape has ${(0,F.Ze)(t)}. inputShape=${e} outputShape=${t}`}
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function ni(){return"segment ids must be >= 0"}function ii(){return"segment ids are not increasing"}function ri(e,t){return`Segment id ${e} out of range [0, ${t}), possibly because segmentIds input is not sorted.`}function si(e,t,n){return`Bad: indices[${e}] == ${t} out of range [0, ${n})`}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function oi(e,t){let n,i=!1;for(e<=pn?(n=e,i=!0):n=(0,F.lK)(e,Math.floor(Math.sqrt(e)));!i;)n>t||n===e?i=!0:n=(0,F.lK)(e,n+1);return n}function ai(e,t,n){const i=[],r=e.length;for(let s=0;s<r;s++)s!==t?i.push(e[s]):i.push(n);return i}function li(e,t,n,i){const r=t.shape.length,s=e.shape.length;if(0!==i&&(i<-r||i>r))throw new Error(`Expect batchDims in the range of [-${r}, ${r}], but got ${i}`);if(i<0&&(i+=r),i>s)throw new Error(`batchDims (${i}) must be less than rank(x) (\n ${s}).`);if(n<i)throw new Error(`batchDims (${i}) must be less than or equal to axis (${n}).`);for(let n=0;n<i;++n)if(e.shape[n]!==t.shape[n])throw new Error(`x.shape[${n}]: ${e.shape[n]} should be equal to indices.shape[${n}]: ${t.shape[n]}.`);const o=e.shape[n],a=[];let l=1,u=1,c=1;for(let t=0;t<i;++t)a.push(e.shape[t]),l*=e.shape[t];for(let t=i;t<n;t++)a.push(e.shape[t]),u*=e.shape[t];for(let e=i;e<r;e++)a.push(t.shape[e]);for(let t=n+1;t<s;t++)a.push(e.shape[t]),c*=e.shape[t];return{batchSize:l,sliceSize:c,outerSize:u,dimSize:o,outputShape:a}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function ui(e){try{return e.map(e=>(0,Nt.decodeString)(e))}catch(e){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${e}`)}}function ci(e){return e.map(e=>(0,Nt.encodeString)(e))}var di=n(8360),hi=n(54411),pi=n(15149);
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
!function(){for(const e of Ve)Se(e)}()},56734:(e,t,n)=>{"use strict";n.d(t,{D:()=>r});var i=n(83879);class r{static join(e){return new r(e).slice()}constructor(e){if(this.shards=[],this.previousShardIndex=0,null==e)return;if(e instanceof Array||(e=[e]),0===(e=e.map(e=>i.isTypedArray(e)?e.buffer:e)).length)return;this.bufferUniformSize=e[0].byteLength;let t=0;for(let n=0;n<e.length;n++){const i=e[n];n!==e.length-1&&i.byteLength!==this.bufferUniformSize&&(this.bufferUniformSize=void 0);const r=t+i.byteLength;this.shards.push({buffer:i,start:t,end:r}),t=r}0===this.shards.length&&(this.byteLength=0),this.byteLength=this.shards[this.shards.length-1].end}slice(e=0,t=this.byteLength){if(0===this.shards.length)return new ArrayBuffer(0);if(e=isNaN(Number(e))?0:e,t=isNaN(Number(t))?0:t,e=Math.max(0,e),(t=Math.min(this.byteLength,t))<=e)return new ArrayBuffer(0);const n=this.findShardForByte(e);if(-1===n)throw new Error(`Could not find start shard for byte ${e}`);const i=new ArrayBuffer(t-e),r=new Uint8Array(i);let s=0;for(let i=n;i<this.shards.length;i++){const n=this.shards[i],o=e+s-n.start,a=s,l=Math.min(t,n.end)-n.start,u=new Uint8Array(n.buffer,o,l-o);if(r.set(u,a),s+=u.length,t<n.end)break}return i}findShardForByte(e){if(0===this.shards.length||e<0||e>=this.byteLength)return-1;if(null!=this.bufferUniformSize)return this.previousShardIndex=Math.floor(e/this.bufferUniformSize),this.previousShardIndex;function t(t){return e<t.start?-1:e>=t.end?1:0}if(0===t(this.shards[this.previousShardIndex]))return this.previousShardIndex;const n=function(e,t){let n=0,i=e.length;for(;n<=i;){const r=Math.floor((i-n)/2)+n,s=t(e[r]);if(0===s)return r;s<0?i=r:n=r+1}return-1}(this.shards,t);return-1===n?-1:(this.previousShardIndex=n,this.previousShardIndex)}}},77084:(e,t,n)=>{"use strict";n.d(t,{AQ:()=>E,CY:()=>h,Ej:()=>S,P8:()=>w,Rl:()=>A,Xf:()=>O,aG:()=>d,jf:()=>x,l3:()=>T,oR:()=>C,s5:()=>y,zV:()=>I});var i=n(37148),r=n(74027),s=n(45119),o=n(15685),a=n(56734),l=n(35287),u=n(46574);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const c=4;async function d(e,t){const n=[],i=[],r=Array.isArray(e)?e.map(e=>e.name):Object.keys(e);for(let s=0;s<r.length;++s){const o=r[s],a=Array.isArray(e)?e[s].tensor:e[o];if("float32"!==a.dtype&&"int32"!==a.dtype&&"bool"!==a.dtype&&"string"!==a.dtype&&"complex64"!==a.dtype)throw new Error(`Unsupported dtype in weight '${o}': ${a.dtype}`);const l={name:o,shape:a.shape,dtype:a.dtype};if("string"===a.dtype){const e=new Promise(async e=>{const t=await a.bytes(),n=t.reduce((e,t)=>e+t.length,0)+c*t.length,i=new Uint8Array(n);let r=0;for(let e=0;e<t.length;e++){const n=t[e],s=new Uint8Array(new Uint32Array([n.length]).buffer);i.set(s,r),r+=c,i.set(n,r),r+=n.length}e(i)});i.push(e)}else i.push(a.data());null!=t&&(l.group=t),n.push(l)}return{data:_(await Promise.all(i)),specs:n}}function h(e,t){const n=new a.D(e),i={};let r=0;for(const e of t){const t=p(e,(e,t)=>n.slice(r+e,r+t));i[e.name]=m(e,n.slice(r,r+t)),r+=t}return i}function p(e,t){const n=(0,s.Ze)(e.shape);let i;if("quantization"in e){const t=e.quantization;i=o.i[t.dtype]}else{if("string"===e.dtype){let e=0;for(let i=0;i<n;i++)e+=c+new Uint32Array(t(e,e+c))[0];return e}i=o.i[e.dtype]}return n*i}async function f(e,t){const n=(0,s.Ze)(e.shape);let i;if("quantization"in e){const t=e.quantization;i=o.i[t.dtype]}else{if("string"===e.dtype){let e=0;for(let i=0;i<n;i++)e+=c+new Uint32Array(await t(e,e+c))[0];return e}i=o.i[e.dtype]}return n*i}function m(e,t){const n=e.name,a=e.dtype,l=e.shape,u=(0,s.Ze)(l);let d,h=0;if("quantization"in e){const i=e.quantization;if("uint8"===i.dtype||"uint16"===i.dtype){if(!("min"in i)||!("scale"in i))throw new Error(`Weight ${e.name} with quantization ${i.dtype} doesn't have corresponding metadata min and scale.`)}else{if("float16"!==i.dtype)throw new Error(`Weight ${e.name} has unknown quantization dtype ${i.dtype}. Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.`);if("float32"!==a)throw new Error(`Weight ${e.name} is quantized with ${i.dtype} which only supports weights of type float32 not ${a}.`)}const r=o.i[i.dtype],s="uint8"===i.dtype?new Uint8Array(t):new Uint16Array(t);if("float32"===a)if("uint8"===i.dtype||"uint16"===i.dtype){d=new Float32Array(s.length);for(let e=0;e<s.length;e++){const t=s[e];d[e]=t*i.scale+i.min}}else{if("float16"!==i.dtype)throw new Error(`Unsupported quantization type ${i.dtype} for weight type float32.`);{const e=function(){const e=function(){const e=e=>{let t=e<<13,n=0;for(;!(8388608&t);)n-=8388608,t<<=1;return t&=-8388609,n+=947912704,t|n},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let e=1024;e<2048;e++)t[e]=939524096+(e-1024<<13);return t}(),t=function(){const e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}(),n=function(){const e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}();return i=>{const r=new ArrayBuffer(4*i.length),s=new Uint32Array(r);for(let r=0;r<i.length;r++){const o=i[r],a=e[n[o>>10]+(1023&o)]+t[o>>10];s[r]=a}return new Float32Array(r)}}();d=e(s)}}else{if("int32"!==a)throw new Error(`Unsupported dtype in weight '${n}': ${a}`);if("uint8"!==i.dtype&&"uint16"!==i.dtype)throw new Error(`Unsupported quantization type ${i.dtype} for weight type int32.`);d=new Int32Array(s.length);for(let e=0;e<s.length;e++){const t=s[e];d[e]=Math.round(t*i.scale+i.min)}}h+=u*r}else if("string"===a){const n=(0,s.Ze)(e.shape);d=[];for(let e=0;e<n;e++){const e=new Uint32Array(t.slice(h,h+c))[0];h+=c;const n=new Uint8Array(t.slice(h,h+e));d.push(n),h+=e}}else{const e=o.i[a];if("float32"===a)d=new Float32Array(t);else if("int32"===a)d=new Int32Array(t);else{if("bool"!==a){if("complex64"===a){d=new Float32Array(t);const e=new Float32Array(d.length/2),n=new Float32Array(d.length/2);for(let t=0;t<e.length;t++)e[t]=d[2*t],n[t]=d[2*t+1];const s=(0,r.O)(e,l,"float32"),o=(0,r.O)(n,l,"float32"),a=(0,i.f)(s,o);return s.dispose(),o.dispose(),a}throw new Error(`Unsupported dtype in weight '${n}': ${a}`)}d=new Uint8Array(t)}h+=u*e}return(0,r.O)(d,l,a)}async function g(e,t,n){let i=new Uint8Array(t);for(;i.byteLength<n;){const{done:t,value:r}=await e.read();if(t&&null==r){const e=n-i.byteLength;throw new Error(`Reader is done but ${e} bytes are still expected`)}const s=new Uint8Array(i.length+r.byteLength);s.set(i,0),s.set(new Uint8Array(r),i.length),i=s}return i.buffer}async function y(e,t){const n={},i=e.getReader();let r=new ArrayBuffer(0);for(const e of t){const t=await f(e,async(e,t)=>(r=await g(i,r,t),r.slice(e,t)));r=await g(i,r,t);const o=r.slice(0,t);r=r.slice(t);const a=m(e,o);if(n[e.name]=a,"webgpu"===(0,l.jz)()){const e=(0,l.Hs)();"uploadToGPU"in e&&(0,s.Ze)(a.shape)>=(0,u._K)().get("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD")&&e.uploadToGPU(a.dataId)}}return n}function _(e){if(null===e)throw new Error(`Invalid input value: ${JSON.stringify(e)}`);let t=0;const n=[];e.forEach(e=>{if(t+=e.byteLength,n.push(e.byteLength===e.buffer.byteLength?e:new e.constructor(e)),!(e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${e.constructor.name}`)});const i=new Uint8Array(t);let r=0;return n.forEach(e=>{i.set(new Uint8Array(e.buffer),r),r+=e.byteLength}),i.buffer}const v="undefined"!=typeof Buffer&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function b(e){return v?Buffer.byteLength(e,"utf8"):new Blob([e]).size}function T(e){if(v)return Buffer.from(e).toString("base64");const t=new Uint8Array(e);let n="";for(let e=0,i=t.length;e<i;e++)n+=String.fromCharCode(t[e]);return btoa(n)}function x(e){if(v){const t=Buffer.from(e,"base64");return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n.set([t.charCodeAt(e)],e);return n.buffer}function E(e){return a.D.join(e)}function w(e){for(e=e.trim();e.endsWith("/");)e=e.slice(0,e.length-1);const t=e.split("/");return t[t.length-1]}function I(e,t){const n={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:t};return null!=e.signature&&(n.signature=e.signature),null!=e.userDefinedMetadata&&(n.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(n.modelInitializer=e.modelInitializer),null!=e.initializerSignature&&(n.initializerSignature=e.initializerSignature),null!=e.trainingConfig&&(n.trainingConfig=e.trainingConfig),n}function A(e,t,n){const i={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};if(null!=e.trainingConfig&&(i.trainingConfig=e.trainingConfig),null!=e.weightsManifest){if(!t)throw new Error("modelJSON has weightsManifest but weightSpecs is null");if(!n)throw new Error("modelJSON has weightsManifest but weightData is null");i.weightSpecs=t,i.weightData=n}return null!=e.signature&&(i.signature=e.signature),null!=e.userDefinedMetadata&&(i.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(i.modelInitializer=e.modelInitializer),null!=e.initializerSignature&&(i.initializerSignature=e.initializerSignature),i}async function S(e,t){let n,i;return null!=e.weightsManifest&&([n,i]=await t(e.weightsManifest)),A(e,n,i)}function C(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==e.modelTopology?0:b(JSON.stringify(e.modelTopology)),weightSpecsBytes:null==e.weightSpecs?0:b(JSON.stringify(e.weightSpecs)),weightDataBytes:null==e.weightData?0:new a.D(e.weightData).byteLength}}function O(e){const t=[];for(const n of e)t.push(...n.weights);return t}},15685:(e,t,n)=>{"use strict";n.d(t,{i:()=>i});
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const i={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8}},15441:(e,t,n)=>{"use strict";n.d(t,{$dB:()=>k,$jE:()=>nn,$zE:()=>R,A1h:()=>L,A8B:()=>Vt,BK4:()=>_n,BLA:()=>Ze,BRl:()=>se,Blb:()=>jt,BoJ:()=>Ht,BxF:()=>de,C8s:()=>Gt,CQC:()=>ft,Cg$:()=>Me,CwD:()=>Se,D7i:()=>At,Ddj:()=>Kt,Dr:()=>vn,DvZ:()=>Xt,E3$:()=>Ee,EkD:()=>a,ElG:()=>pe,EwU:()=>dn,FAs:()=>an,FCQ:()=>wt,FSt:()=>u,Fin:()=>$t,GZp:()=>Qt,HNs:()=>w,Ik2:()=>x,J3C:()=>Lt,JiE:()=>Dt,Jp_:()=>c,KXH:()=>S,L6G:()=>Wt,LB5:()=>I,LDN:()=>ze,LG0:()=>qe,LRy:()=>yt,LWX:()=>st,LXA:()=>Ne,M6A:()=>Zt,MRQ:()=>j,Mn0:()=>$,MnK:()=>U,N4F:()=>E,Ncv:()=>dt,O4G:()=>ge,OAQ:()=>be,ODT:()=>lt,OMN:()=>o,ORI:()=>q,PH8:()=>s,P_L:()=>It,Pah:()=>ne,PbM:()=>rn,Q6t:()=>gt,QDP:()=>C,QKF:()=>h,Qgm:()=>te,R23:()=>bt,RMm:()=>fn,RUm:()=>Re,RW8:()=>De,RXX:()=>je,SDM:()=>nt,SQl:()=>ce,T7M:()=>Tn,TBb:()=>ln,TL8:()=>He,TMz:()=>G,TOR:()=>Ct,ToN:()=>Be,TyE:()=>f,UcO:()=>Jt,VAI:()=>Ue,VCH:()=>_,Vvy:()=>r,WRv:()=>$e,WT3:()=>Qe,WuN:()=>zt,X$8:()=>W,X0$:()=>Ie,X4r:()=>Mt,XQy:()=>xt,XhZ:()=>ye,XmO:()=>J,YAb:()=>en,YVe:()=>Pt,ZgB:()=>he,Zl4:()=>it,_s9:()=>re,aAr:()=>bn,awo:()=>yn,bCz:()=>ut,bP9:()=>Z,cHb:()=>Ge,cS:()=>v,dFH:()=>Ut,dLy:()=>un,dXR:()=>hn,dv8:()=>Te,e0f:()=>rt,epO:()=>p,fUj:()=>vt,g5A:()=>We,gC7:()=>B,gIW:()=>xe,hVg:()=>St,hgw:()=>Et,ho8:()=>y,hql:()=>Ft,huO:()=>_t,i5R:()=>fe,iGz:()=>P,iPs:()=>we,iW0:()=>tn,iuW:()=>on,jAQ:()=>T,jM4:()=>Pe,jOE:()=>Tt,jfg:()=>F,jgd:()=>qt,jj_:()=>z,jxD:()=>K,kdj:()=>ht,l0G:()=>et,l6P:()=>kt,lLS:()=>_e,lNG:()=>Xe,ljI:()=>i,lxb:()=>g,lzr:()=>ve,mH5:()=>mt,mIA:()=>Ae,mM$:()=>at,mnI:()=>Ce,mxL:()=>me,nVu:()=>X,nY8:()=>V,nZd:()=>ke,oFs:()=>sn,oJ2:()=>pt,ox3:()=>oe,p2J:()=>N,pJc:()=>Ot,pPe:()=>pn,p_m:()=>d,pk0:()=>Q,pnw:()=>gn,pr3:()=>M,pyJ:()=>ct,rFG:()=>Yt,rFm:()=>D,rGP:()=>ue,rsH:()=>ie,sDr:()=>ee,t3d:()=>Ve,tG8:()=>Oe,tGH:()=>H,u$b:()=>Nt,u8Z:()=>l,uWl:()=>Rt,urI:()=>ot,vI1:()=>Bt,vaV:()=>O,vj7:()=>A,wNW:()=>Y,wwC:()=>b,wx0:()=>cn,x7F:()=>Ke,xJ3:()=>mn,xu7:()=>Je,yPW:()=>Le,ySp:()=>Ye,ybN:()=>ae,ybj:()=>le,ylV:()=>tt,zP9:()=>m,zfU:()=>Fe});const i="Abs",r="Acos",s="Acosh",o="Add",a="AddN",l="All",u="Any",c="ArgMax",d="ArgMin",h="Asin",p="Asinh",f="Atan",m="Atanh",g="Atan2",y="AvgPool",_="AvgPoolGrad",v="AvgPool3D",b="AvgPool3DGrad",T="BatchMatMul",x="BatchToSpaceND",E="Bincount",w="BitwiseAnd",I="BroadcastTo",A="BroadcastArgs",S="Cast",C="Ceil",O="ClipByValue",M="Complex",R="ComplexAbs",k="Concat",N="Conv2D",D="Conv2DBackpropFilter",F="Conv2DBackpropInput",L="Conv3D",P="Conv3DBackpropFilterV2",B="Conv3DBackpropInputV2",$="Cos",U="Cosh",z="Cumprod",V="Cumsum",j="CropAndResize",Y="DenseBincount",G="DepthToSpace",H="DepthwiseConv2dNative",W="DepthwiseConv2dNativeBackpropFilter",X="DepthwiseConv2dNativeBackpropInput",q="Diag",K="Dilation2D",Z="Dilation2DBackpropInput",Q="Dilation2DBackpropFilter",J="Draw",ee="RealDiv",te="Einsum",ne="Elu",ie="EluGrad",re="Erf",se="Equal",oe="Exp",ae="ExpandDims",le="Expm1",ue="FFT",ce="Fill",de="FlipLeftRight",he="Floor",pe="FloorDiv",fe="FusedBatchNorm",me="GatherV2",ge="GatherNd",ye="Greater",_e="GreaterEqual",ve="Identity",be="IFFT",Te="Imag",xe="IsFinite",Ee="IsInf",we="IsNan",Ie="LeakyRelu",Ae="Less",Se="LessEqual",Ce="LinSpace",Oe="Log",Me="Log1p",Re="LogicalAnd",ke="LogicalNot",Ne="LogicalOr",De="LogicalXor",Fe="LogSoftmax",Le="LowerBound",Pe="LRN",Be="LRNGrad",$e="MatrixBandPart",Ue="Max",ze="Maximum",Ve="MaxPool",je="MaxPoolGrad",Ye="MaxPool3D",Ge="MaxPool3DGrad",He="MaxPoolWithArgmax",We="Mean",Xe="Min",qe="Minimum",Ke="MirrorPad",Ze="Mod",Qe="Multinomial",Je="Multiply",et="Neg",tt="NotEqual",nt="NonMaxSuppressionV3",it="NonMaxSuppressionV4",rt="NonMaxSuppressionV5",st="OnesLike",ot="OneHot",at="Pack",lt="PadV2",ut="Pool",ct="Pow",dt="Prelu",ht="Prod",pt="RaggedGather",ft="RaggedRange",mt="RaggedTensorToTensor",gt="Range",yt="Real",_t="Reciprocal",vt="Relu",bt="Reshape",Tt="ResizeNearestNeighbor",xt="ResizeNearestNeighborGrad",Et="ResizeBilinear",wt="ResizeBilinearGrad",It="Relu6",At="Reverse",St="Round",Ct="Rsqrt",Ot="ScatterNd",Mt="TensorScatterUpdate",Rt="SearchSorted",kt="Select",Nt="Selu",Dt="Slice",Ft="Sin",Lt="Sinh",Pt="Sign",Bt="Sigmoid",$t="Softplus",Ut="Sqrt",zt="Sum",Vt="SpaceToBatchND",jt="SplitV",Yt="Softmax",Gt="SparseFillEmptyRows",Ht="SparseReshape",Wt="SparseSegmentMean",Xt="SparseSegmentSum",qt="SparseToDense",Kt="SquaredDifference",Zt="Square",Qt="StaticRegexReplace",Jt="StridedSlice",en="StringNGrams",tn="StringSplit",nn="StringToHashBucketFast",rn="Sub",sn="Tan",on="Tanh",an="Tile",ln="TopK",un="Transform",cn="Transpose",dn="Unique",hn="Unpack",pn="UnsortedSegmentSum",fn="UpperBound",mn="ZerosLike",gn="Step",yn="FromPixels",_n="RotateWithOffset",vn="_FusedMatMul",bn="FusedConv2D",Tn="FusedDepthwiseConv2D"},37074:(e,t,n)=>{"use strict";n.d(t,{Cf:()=>m,Op:()=>c,_5:()=>l,iP:()=>p,kr:()=>h,rY:()=>f,tA:()=>d,vQ:()=>u});var i=n(46574),r=n(41743),s=n(73673);
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const o=(0,r.m)("kernelRegistry",()=>new Map),a=(0,r.m)("gradRegistry",()=>new Map);function l(e,t){const n=g(e,t);return o.get(n)}function u(e){return a.get(e)}function c(e){const t=o.entries(),n=[];for(;;){const{done:i,value:r}=t.next();if(i)break;const[s,o]=r,[a]=s.split("_");a===e&&n.push(o)}return n}function d(e){const{kernelName:t,backendName:n}=e,i=g(t,n);o.has(i)&&s.i(`The kernel '${t}' for backend '${n}' is already registered`),o.set(i,e)}function h(e){const{kernelName:t}=e;a.has(t)&&(0,i._K)().getBool("DEBUG")&&s.i(`Overriding the gradient for '${t}'`),a.set(t,e)}function p(e,t){const n=g(e,t);if(!o.has(n))throw new Error(`The kernel '${e}' for backend '${t}' is not registered`);o.delete(n)}function f(e){if(!a.has(e))throw new Error(`The gradient '${e}' for backend is not registered`);a.delete(e)}function m(e,t){c(e).forEach(e=>{d(Object.assign({},e,{backendName:t}))})}function g(e,t){return`${t}_${e}`}},73673:(e,t,n)=>{"use strict";n.d(t,{R:()=>s,i:()=>r});var i=n(46574);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/function r(...e){(0,i._K)().getBool("IS_TEST")||(0,i._K)().getBool("PROD")||console.warn(...e)}function s(...e){(0,i._K)().getBool("IS_TEST")||(0,i._K)().getBool("PROD")||console.log(...e)}},4888:(e,t,n)=>{"use strict";n.d(t,{t:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({abs_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t=(0,s.YT)(e,"x","abs");if("complex64"===t.dtype){const e={x:t};return i.T2.runKernel(r.$zE,e)}{const e={x:t};return i.T2.runKernel(r.ljI,e)}}})},12804:(e,t,n)=>{"use strict";n.d(t,{H:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({acos_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","acos")};return i.T2.runKernel(r.Vvy,t)}})},37558:(e,t,n)=>{"use strict";n.d(t,{F:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({acosh_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","acosh")};return i.T2.runKernel(r.PH8,t)}})},37523:(e,t,n)=>{"use strict";n.d(t,{W:()=>a});var i=n(41585),r=n(15441),s=n(30565),o=n(28189);const a=(0,n(70929).op)({add_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","add"),a=(0,o.YT)(t,"b","add");[n,a]=(0,s.makeTypesMatch)(n,a);const l={a:n,b:a};return i.T2.runKernel(r.OMN,l)}})},12307:(e,t,n)=>{"use strict";n.d(t,{Q:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({all_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=null,n=!1){const o={x:(0,s.YT)(e,"x","all","bool")},a={axis:t,keepDims:n};return i.T2.runKernel(r.u8Z,o,a)}})},89326:(e,t,n)=>{"use strict";n.d(t,{b:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({any_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=null,n=!1){const o={x:(0,s.YT)(e,"x","any","bool")},a={axis:t,keepDims:n};return i.T2.runKernel(r.FSt,o,a)}})},10897:(e,t,n)=>{"use strict";n.d(t,{F:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({argMax_:
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0){const n={x:(0,s.YT)(e,"x","argMax")},o={axis:t};return i.T2.runKernel(r.Jp_,n,o)}})},54339:(e,t,n)=>{"use strict";n.d(t,{X:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({argMin_:
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0){const n={x:(0,s.YT)(e,"x","argMin")},o={axis:t};return i.T2.runKernel(r.p_m,n,o)}})},66841:(e,t,n)=>{"use strict";n.d(t,{q:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({asin_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","asin")};return i.T2.runKernel(r.QKF,t)}})},50269:(e,t,n)=>{"use strict";n.d(t,{y:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({asinh_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","asinh")};return i.T2.runKernel(r.epO,t)}})},29580:(e,t,n)=>{"use strict";n.d(t,{r:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({atan_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","atan")};return i.T2.runKernel(r.TyE,t)}})},21404:(e,t,n)=>{"use strict";n.d(t,{F:()=>a});var i=n(41585),r=n(15441),s=n(30565),o=n(28189);const a=(0,n(70929).op)({atan2_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","atan2"),a=(0,o.YT)(t,"b","atan2");[n,a]=(0,s.makeTypesMatch)(n,a);const l={a:n,b:a};return i.T2.runKernel(r.lxb,l)}})},63774:(e,t,n)=>{"use strict";n.d(t,{r:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({atanh_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","atanh")};return i.T2.runKernel(r.zP9,t)}})},53909:(e,t,n)=>{"use strict";n.d(t,{$:()=>d});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(29809),l=n(47195),u=n(70929),c=n(62302);const d=(0,u.op)({avgPool_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,u,d){const h=(0,s.YT)(e,"x","avgPool","float32");o.vA(l.G0(n,1),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '1'`);let p=h,f=!1;3===h.rank&&(f=!0,p=(0,c.t)(h,[1,h.shape[0],h.shape[1],h.shape[2]])),o.vA(4===p.rank,()=>`Error in avgPool: x must be rank 4 but got rank ${p.rank}.`),l.s_("avgPool",u,d);const m={x:p},g={filterSize:t,strides:n,pad:u,dimRoundingMode:d};let y=i.T2.runKernel(r.ho8,m,g);return y=(0,a.w)(y,h.dtype),f?(0,c.t)(y,[y.shape[1],y.shape[2],y.shape[3]]):y}})},21078:(e,t,n)=>{"use strict";n.d(t,{Em:()=>u,SM:()=>a,WC:()=>l,WH:()=>r,aF:()=>s,fK:()=>d,gx:()=>c,lb:()=>o});var i=n(45119);
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/function r(e,t){for(let n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function s(e,t,n){const i=e.length+t.length,r=[];let s=0,o=0;for(let a=0;a<i;a++)-1===n.indexOf(a)?r.push(e[s++]):r.push(t[o++]);return r}function o(e,t){const n=[],i=e.length;for(let r=0;r<i;r++)-1===t.indexOf(r)&&n.push(e[r]);return[n,t.map(t=>e[t])]}function a(e,t){return s(e,t.map(e=>1),t)}function l(e,t,n){i.vA(r(t,n),()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`)}function u(e,t){if(r(e,t))return null;const n=[];for(let i=0;i<t;++i)-1===e.indexOf(i)&&n.push(i);return e.forEach(e=>n.push(e)),n}function c(e){return e.map((e,t)=>[t,e]).sort((e,t)=>e[1]-t[1]).map(e=>e[0])}function d(e,t){const n=[];for(let i=t-e;i<t;++i)n.push(i);return n}},69772:(e,t,n)=>{"use strict";n.d(t,{G:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({batchToSpaceND_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const a=(0,s.YT)(e,"x","batchToSpaceND"),l=t.reduce((e,t)=>e*t);o.vA(a.rank>=1+t.length,()=>`input rank is ${a.rank} but should be > than blockShape.length ${t.length}`),o.vA(n.length===t.length,()=>`crops.length is ${n.length} but should be equal to blockShape.length ${t.length}`),o.vA(a.shape[0]%l===0,()=>`input tensor batch is ${a.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${l}`);const u={x:a},c={blockShape:t,crops:n};return i.T2.runKernel(r.Ik2,u,c)}})},9160:(e,t,n)=>{"use strict";n.d(t,{$:()=>l});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(62302);const l=(0,n(70929).op)({batchNorm_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,l,u,c){null==c&&(c=.001);const d=(0,s.YT)(e,"x","batchNorm"),h=(0,s.YT)(t,"mean","batchNorm"),p=(0,s.YT)(n,"variance","batchNorm");let f,m;null!=u&&(f=(0,s.YT)(u,"scale","batchNorm")),null!=l&&(m=(0,s.YT)(l,"offset","batchNorm")),o.vA(h.rank===p.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),o.vA(null==m||h.rank===m.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),o.vA(null==f||h.rank===f.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");const g={x:function(e){let t;return t=0===e.rank||1===e.rank?(0,a.t)(e,[1,1,1,e.size]):2===e.rank?(0,a.t)(e,[1,1,e.shape[0],e.shape[1]]):3===e.rank?(0,a.t)(e,[1,e.shape[0],e.shape[1],e.shape[2]]):e,t}(d),scale:f,offset:m,mean:h,variance:p},y={varianceEpsilon:c},_=i.T2.runKernel(r.i5R,g,y);return(0,a.t)(_,d.shape)}})},63567:(e,t,n)=>{"use strict";n.d(t,{h:()=>c});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(70125),l=n(70929),u=n(62302);const c=(0,l.op)({broadcastTo_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,s.YT)(e,"broadcastTo","x");const l=n.shape;if((0,o.SA)(t),t.length<n.rank)throw new Error(`broadcastTo(): shape.length=${t.length} < input.rank=${n.rank}.`);if(t.length>n.rank){const e=n.shape.slice();for(;e.length<t.length;)e.unshift(1);n=(0,u.t)(n,e)}const c=n.shape,d=Array.from(t);for(let e=t.length-1;e>=0;e--)if(c[e]===t[e])d[e]=1;else if(1!==n.shape[e])throw new Error(`broadcastTo(): [${l}] cannot be broadcast to [${t}].`);if(0===d.map((e,t)=>e>1?t:-1).filter(e=>e>=0).length)return(0,a.o)(n);const h={x:n},p={reps:d};return i.T2.runKernel(r.FAs,h,p)}})},62198:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function i(e,t){const n=e.length,i=[];for(let r=0;r<n;r++){const s=n-1-r,o=e[s]||1;(t[t.length-1-r]||1)>1&&1===o&&i.unshift(s)}return i}function r(e,t){const n=[];for(let i=0;i<t.length;i++){const r=e[e.length-i-1],s=t.length-i-1,o=t[s];(null==r||1===r&&o>1)&&n.unshift(s)}return n}function s(e,t){const n=Math.max(e.length,t.length),i=new Array(n);for(let r=0;r<n;r++){let s=e[e.length-r-1];null==s&&(s=1);let o=t[t.length-r-1];if(null==o&&(o=1),1===s)i[n-r-1]=o;else if(1===o)i[n-r-1]=s;else{if(s!==o){throw Error(`Operands could not be broadcast together with shapes ${e} and ${t}.`)}i[n-r-1]=s}}return i}n.r(t),n.d(t,{assertAndGetBroadcastShape:()=>s,getBroadcastDims:()=>i,getReductionAxes:()=>r})},448:(e,t,n)=>{"use strict";n.d(t,{r:()=>s});var i=n(50259),r=n(45119);
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function s(e,t="float32",n){return t=t||"float32",r.SA(e),new i.yl(e,t,n)}},29809:(e,t,n)=>{"use strict";n.d(t,{w:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({cast_:
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,s.YT)(e,"x","cast");if(!o.xn(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if("string"===t&&"string"!==n.dtype||"string"!==t&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");const a={x:n},l={dtype:t};return i.T2.runKernel(r.KXH,a,l)}})},30855:(e,t,n)=>{"use strict";n.d(t,{m:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({ceil_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","ceil","float32")};return i.T2.runKernel(r.QDP,t)}})},96928:(e,t,n)=>{"use strict";n.d(t,{z:()=>l});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(96111);const l=(0,n(70929).op)({clipByValue_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const l=(0,s.YT)(e,"x","clipByValue");if(o.vA(t<=n,()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`),t===n)return(0,a.G)(l.shape,t,l.dtype);const u={x:l},c={clipValueMin:t,clipValueMax:n};return i.T2.runKernel(r.vaV,u,c)}})},70125:(e,t,n)=>{"use strict";n.d(t,{o:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({clone_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","clone","string_or_numeric")};return i.T2.runKernel(r.lzr,t)}})},37148:(e,t,n)=>{"use strict";n.d(t,{f:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({complex_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,s.YT)(e,"real","complex"),a=(0,s.YT)(t,"imag","complex");o.O3(n.shape,a.shape,`real and imag shapes, ${n.shape} and ${a.shape}, must match in call to tf.complex().`);const l={real:n,imag:a};return i.T2.runKernel(r.pr3,l)}})},25030:(e,t,n)=>{"use strict";n.d(t,{x:()=>l});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(70125);const l=(0,n(70929).op)({concat_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0){(0,o.vA)(e.length>=1,()=>"Pass at least one tensor to concat");const n=(0,s.j1)(e,"tensors","concat","string_or_numeric");if("complex64"===n[0].dtype&&n.forEach(e=>{if("complex64"!==e.dtype)throw new Error(`Cannot concatenate complex64 tensors with a tensor\n with dtype ${e.dtype}. `)}),1===n.length)return(0,a.o)(n[0]);const l=n,u={axis:t};return i.T2.runKernel(r.$dB,l,u)}})},3701:(e,t,n)=>{"use strict";n.d(t,{k:()=>u});var i=n(28189),r=n(45119),s=n(28794),o=n(47195),a=n(70929),l=n(62302);const u=(0,a.op)({conv1d_:function(e,t,n,a,u="NWC",c=1,d){const h=(0,i.YT)(e,"x","conv1d"),p=(0,i.YT)(t,"filter","conv1d");let f=h,m=!1;2===h.rank&&(m=!0,f=(0,l.t)(h,[1,h.shape[0],h.shape[1]])),r.vA(3===f.rank,()=>`Error in conv1d: input must be rank 3, but got rank ${f.rank}.`),r.vA(3===p.rank,()=>`Error in conv1d: filter must be rank 3, but got rank ${p.rank}.`),o.s_("conv1d",a,d),r.vA(f.shape[2]===p.shape[1],()=>`Error in conv1d: depth of input (${f.shape[2]}) must match input depth for filter ${p.shape[1]}.`),r.vA(o.G0(n,c),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${c}'`),r.vA(o.qk(c),()=>"Error in conv1D: Dilated rates should be larger than 0."),r.vA(o.qk(n),()=>"Error in conv1D: Stride should be larger than 0."),r.vA("NWC"===u,()=>`Error in conv1d: got dataFormat of ${u} but only NWC is currently supported.`);const g=(0,l.t)(p,[1,p.shape[0],p.shape[1],p.shape[2]]),y=(0,l.t)(f,[f.shape[0],1,f.shape[1],f.shape[2]]),_=[1,n],v=[1,c],b=(0,s.X)(y,g,_,a,"NHWC",v,d);return m?(0,l.t)(b,[b.shape[2],b.shape[3]]):(0,l.t)(b,[b.shape[0],b.shape[2],b.shape[3]])}})},28794:(e,t,n)=>{"use strict";n.d(t,{X:()=>c});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(47195),l=n(70929),u=n(62302);const c=(0,l.op)({conv2d_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,l,c="NHWC",d=[1,1],h){const p=(0,s.YT)(e,"x","conv2d","float32"),f=(0,s.YT)(t,"filter","conv2d","float32");let m=p,g=!1;3===p.rank&&(g=!0,m=(0,u.t)(p,[1,p.shape[0],p.shape[1],p.shape[2]])),o.vA(4===m.rank,()=>`Error in conv2d: input must be rank 4, but got rank ${m.rank}.`),o.vA(4===f.rank,()=>`Error in conv2d: filter must be rank 4, but got rank ${f.rank}.`),a.s_("conv2d",l,h);const y="NHWC"===c?m.shape[3]:m.shape[1];o.vA(y===f.shape[2],()=>`Error in conv2d: depth of input (${y}) must match input depth for filter ${f.shape[2]}.`),o.vA(a.G0(n,d),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${d}'`),o.vA(a.qk(d),()=>"Error in conv2D: Dilated rates should be larger than 0."),o.vA(a.qk(n),()=>"Error in conv2D: Strides should be larger than 0.");const _={x:m,filter:f},v={strides:n,pad:l,dataFormat:c,dilations:d,dimRoundingMode:h},b=i.T2.runKernel(r.p2J,_,v);return g?(0,u.t)(b,[b.shape[1],b.shape[2],b.shape[3]]):b}})},25248:(e,t,n)=>{"use strict";n.d(t,{H:()=>u});var i=n(41585),r=n(15441),s=n(45119),o=n(47195),a=n(70929),l=n(62302);const u=(0,a.op)({conv2DBackpropFilter_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,a,u,c="NHWC",d){let h=e;3===e.rank&&(h=(0,l.t)(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let p=t;3===p.rank&&(p=(0,l.t)(t,[1,t.shape[0],t.shape[1],t.shape[2]])),s.vA(4===h.rank,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${h.shape}.`),s.vA(4===p.rank,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${p.shape}.`),s.vA(4===n.length,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`);const f="NHWC"===c?h.shape[3]:h.shape[1],m="NHWC"===c?p.shape[3]:p.shape[1];s.vA(f===n[2],()=>`Error in conv2dDerFilter: depth of input ${f}) must match input depth in filter (${n[2]}.`),s.vA(m===n[3],()=>`Error in conv2dDerFilter: depth of dy (${m}) must match output depth for filter (${n[3]}).`),o.s_("conv2dDerFilter",u,d);const g={x:h,dy:p},y={strides:a,pad:u,dataFormat:c,dimRoundingMode:d,filterShape:n};return i.T2.runKernel(r.rFm,g,y)}})},80252:(e,t,n)=>{"use strict";n.d(t,{v:()=>u});var i=n(41585),r=n(15441),s=n(45119),o=n(47195),a=n(70929),l=n(62302);const u=(0,a.op)({conv2DBackpropInput_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,a,u,c="NHWC",d){s.vA(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let h=e,p=t,f=!1;3===t.rank&&(f=!0,p=(0,l.t)(t,[1,t.shape[0],t.shape[1],t.shape[2]]),h=[1,e[0],e[1],e[2]]),s.vA(4===h.length,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${h.length}.`),s.vA(4===p.rank,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${p.rank}`),s.vA(4===n.rank,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`);const m="NHWC"===c?h[3]:h[1],g="NHWC"===c?p.shape[3]:p.shape[1];s.vA(m===n.shape[2],()=>`Error in conv2dDerInput: depth of input (${m}) must match input depth for filter ${n.shape[2]}.`),s.vA(g===n.shape[3],()=>`Error in conv2dDerInput: depth of output (${g}) must match output depth for filter ${n.shape[3]}.`),o.s_("conv2dDerInput",u,d);const y={dy:p,filter:n},_={strides:a,pad:u,dataFormat:c,dimRoundingMode:d,inputShape:h},v=i.T2.runKernel(r.jfg,y,_);return f?(0,l.t)(v,[v.shape[1],v.shape[2],v.shape[3]]):v}})},41106:(e,t,n)=>{"use strict";n.d(t,{w:()=>s});var i=n(28189),r=n(80252);const s=(0,n(70929).op)({conv2dTranspose_:function(e,t,n,s,o,a){const l=(0,i.YT)(e,"x","conv2dTranspose"),u=(0,i.YT)(t,"filter","conv2dTranspose");return(0,r.v)(n,l,u,s,o,"NHWC",a)}})},31895:(e,t,n)=>{"use strict";n.d(t,{c:()=>l});var i=n(41585),r=n(15441),s=n(45119),o=n(70929),a=n(62302);const l=(0,o.op)({conv3DBackpropInput_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,o,l){s.vA(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let u=e,c=t,d=!1;4===t.rank&&(d=!0,c=(0,a.t)(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),u=[1,e[0],e[1],e[2],e[3]]);const h=u[4],p=c.shape[4];s.vA(5===u.length,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${u.length}.`),s.vA(5===c.rank,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${c.rank}`),s.vA(5===n.rank,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`),s.vA(h===n.shape[3],()=>`Error in conv3dDerInput: depth of input (${h}) must match input depth for filter ${n.shape[3]}.`),s.vA(p===n.shape[4],()=>`Error in conv3dDerInput: depth of output (${p}) must match output depth for filter ${n.shape[4]}.`);const f={dy:c,filter:n},m={pad:l,strides:o,inputShape:u},g=i.T2.runKernel(r.gC7,f,m);return d?(0,a.t)(g,[g.shape[1],g.shape[2],g.shape[3],g.shape[4]]):g}})},47195:(e,t,n)=>{"use strict";n.d(t,{$Q:()=>y,Dh:()=>f,E6:()=>s,G0:()=>m,G8:()=>u,YQ:()=>r,l5:()=>o,p$:()=>l,qk:()=>g,s_:()=>_,uf:()=>a});var i=n(45119);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/function r(e,t,n,i,r="NHWC",s){return a(e,[...t,e[3]],n,s,i,null,null,y(r))}function s(e,t,n,i,r,s,o="channelsLast"){const[l,u]=c(t);let d;if("channelsLast"===o)d=[l,u,e[3],e[3]];else{if("channelsFirst"!==o)throw new Error(`Unknown dataFormat ${o}`);d=[l,u,e[1],e[1]]}return a(e,d,n,i,r,s,!1,o)}function o(e,t,n,i,r,s,o="NDHWC"){const[a,u,c]=d(t);let h,p;if("NDHWC"===o)p="channelsLast",h=[a,u,c,e[4],e[4]];else{if("NCDHW"!==o)throw new Error(`Unknown dataFormat ${o}`);p="channelsFirst",h=[a,u,c,e[1],e[1]]}return l(e,h,n,i,r,!1,p,s)}function a(e,t,n,i,r,s,o=!1,a="channelsLast"){let[l,d,f,m]=[-1,-1,-1,-1];if("channelsLast"===a)[l,d,f,m]=e;else{if("channelsFirst"!==a)throw new Error(`Unknown dataFormat ${a}`);[l,m,d,f]=e}const[g,y,,_]=t,[v,b]=c(n),[T,x]=c(i),E=h(g,T),w=h(y,x),{padInfo:I,outHeight:A,outWidth:S}=function(e,t,n,i,r,s,o,a,l){let c,d,h;if("number"==typeof e){c={top:e,bottom:e,left:e,right:e,type:0===e?"VALID":"NUMBER"};const r=function(e,t,n,i,r){null==i&&(i=u(e,t,n));const s=e[0],o=e[1],a=p((s-t+2*i)/n+1,r),l=p((o-t+2*i)/n+1,r);return[a,l]}([t,n],s,i,e,a);d=r[0],h=r[1]}else if("same"===e){d=Math.ceil(t/i),h=Math.ceil(n/r);const e=Math.max(0,(d-1)*i+s-t),a=Math.max(0,(h-1)*r+o-n),l=Math.floor(e/2),u=e-l,p=Math.floor(a/2);c={top:l,bottom:u,left:p,right:a-p,type:"SAME"}}else if("valid"===e)c={top:0,bottom:0,left:0,right:0,type:"VALID"},d=Math.ceil((t-s+1)/i),h=Math.ceil((n-o+1)/r);else{if("object"!=typeof e)throw Error(`Unknown padding parameter: ${e}`);{const u="channelsLast"===l?e[1][0]:e[2][0],f="channelsLast"===l?e[1][1]:e[2][1],m="channelsLast"===l?e[2][0]:e[3][0],g="channelsLast"===l?e[2][1]:e[3][1];c={top:u,bottom:f,left:m,right:g,type:0===u&&0===f&&0===m&&0===g?"VALID":"EXPLICIT"},d=p((t-s+u+f)/i+1,a),h=p((n-o+m+g)/r+1,a)}}return{padInfo:c,outHeight:d,outWidth:h}}(r,d,f,v,b,E,w,s,a),C=o?_*m:_;let O;return"channelsFirst"===a?O=[l,C,A,S]:"channelsLast"===a&&(O=[l,A,S,C]),{batchSize:l,dataFormat:a,inHeight:d,inWidth:f,inChannels:m,outHeight:A,outWidth:S,outChannels:C,padInfo:I,strideHeight:v,strideWidth:b,filterHeight:g,filterWidth:y,effectiveFilterHeight:E,effectiveFilterWidth:w,dilationHeight:T,dilationWidth:x,inShape:e,outShape:O,filterShape:t}}function l(e,t,n,i,r,s=!1,o="channelsLast",a){let[l,c,f,m,g]=[-1,-1,-1,-1,-1];if("channelsLast"===o)[l,c,f,m,g]=e;else{if("channelsFirst"!==o)throw new Error(`Unknown dataFormat ${o}`);[l,g,c,f,m]=e}const[y,_,v,,b]=t,[T,x,E]=d(n),[w,I,A]=d(i),S=h(y,w),C=h(_,I),O=h(v,A),{padInfo:M,outDepth:R,outHeight:k,outWidth:N}=function(e,t,n,i,r,s,o,a,l,c,d){let h,f,m,g;"valid"===e&&(e=0);if("number"==typeof e){h={top:e,bottom:e,left:e,right:e,front:e,back:e,type:0===e?"VALID":"NUMBER"};const y=function(e,t,n,i,r,s){null==r&&(r=u(e,t[0],i[0]));const o=[0,0,0,n];for(let n=0;n<3;n++)e[n]+2*r>=t[n]&&(o[n]=p((e[n]-t[n]+2*r)/i[n]+1,s));return o}([t,n,i,1],[a,l,c],1,[r,s,o],e,d);f=y[0],m=y[1],g=y[2]}else{if("same"!==e)throw Error(`Unknown padding parameter: ${e}`);{f=Math.ceil(t/r),m=Math.ceil(n/s),g=Math.ceil(i/o);const e=(f-1)*r+a-t,u=(m-1)*s+l-n,d=(g-1)*o+c-i,p=Math.floor(e/2),y=e-p,_=Math.floor(u/2),v=u-_,b=Math.floor(d/2);h={top:_,bottom:v,left:b,right:d-b,front:p,back:y,type:"SAME"}}}return{padInfo:h,outDepth:f,outHeight:m,outWidth:g}}(r,c,f,m,T,x,E,S,C,O,a),D=s?b*g:b;let F;return"channelsFirst"===o?F=[l,D,R,k,N]:"channelsLast"===o&&(F=[l,R,k,N,D]),{batchSize:l,dataFormat:o,inDepth:c,inHeight:f,inWidth:m,inChannels:g,outDepth:R,outHeight:k,outWidth:N,outChannels:D,padInfo:M,strideDepth:T,strideHeight:x,strideWidth:E,filterDepth:y,filterHeight:_,filterWidth:v,effectiveFilterDepth:S,effectiveFilterHeight:C,effectiveFilterWidth:O,dilationDepth:w,dilationHeight:I,dilationWidth:A,inShape:e,outShape:F,filterShape:t}}function u(e,t,n,i=1){const r=h(t,i);return Math.floor((e[0]*(n-1)-n+r)/2)}function c(e){return"number"==typeof e?[e,e,e]:2===e.length?[e[0],e[1],1]:e}function d(e){return"number"==typeof e?[e,e,e]:e}function h(e,t){return t<=1?e:e+(e-1)*(t-1)}function p(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error(`Unknown roundingMode ${t}`)}}function f(e){const[t,n,i]=c(e);return 1===t&&1===n&&1===i}function m(e,t){return f(e)||f(t)}function g(e){return c(e).every(e=>e>0)}function y(e){if("NHWC"===e)return"channelsLast";if("NCHW"===e)return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function _(e,t,n){if(null!=n){if("string"==typeof t)throw Error(`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`);if("number"==typeof t)i.vA(i.E6(t),()=>`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`);else{if("object"!=typeof t)throw Error(`Error in ${e}: Unknown padding parameter: ${t}`);t.forEach(t=>{t.forEach(t=>{i.vA(i.E6(t),()=>`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`)})})}}}},99907:(e,t,n)=>{"use strict";n.d(t,{g:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({cos_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","cos","float32")};return i.T2.runKernel(r.Mn0,t)}})},27451:(e,t,n)=>{"use strict";n.d(t,{y:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({cosh_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","cosh","float32")};return i.T2.runKernel(r.MnK,t)}})},10302:(e,t,n)=>{"use strict";n.d(t,{L:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({cumprod_:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0,n=!1,o=!1){const a={x:(0,s.YT)(e,"x","cumprod")},l={axis:t,exclusive:n,reverse:o};return i.T2.runKernel(r.jj_,a,l)}})},76808:(e,t,n)=>{"use strict";n.d(t,{r:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({cumsum_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0,n=!1,o=!1){const a={x:(0,s.YT)(e,"x","cumsum")},l={axis:t,exclusive:n,reverse:o};return i.T2.runKernel(r.nY8,a,l)}})},31216:(e,t,n)=>{"use strict";n.d(t,{R:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({depthToSpace_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n="NHWC"){const a=(0,s.YT)(e,"x","depthToSpace","float32"),l="NHWC"===n?a.shape[1]:a.shape[2],u="NHWC"===n?a.shape[2]:a.shape[3],c="NHWC"===n?a.shape[3]:a.shape[1];o.vA(t>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${t}`),o.vA(l*t>=0,()=>`Negative dimension size caused by overflow when multiplying\n ${l} and ${t} for depthToSpace with input shape\n ${a.shape}`),o.vA(u*t>=0,()=>`Negative dimension size caused by overflow when multiplying\n ${u} and ${t} for depthToSpace with input shape\n ${a.shape}`),o.vA(c%(t*t)===0,()=>`Dimension size must be evenly divisible by ${t*t} but is ${c} for depthToSpace with input shape ${a.shape}`);const d={x:a},h={blockSize:t,dataFormat:n};return i.T2.runKernel(r.TMz,d,h)}})},10676:(e,t,n)=>{"use strict";n.d(t,{G:()=>c});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(47195),l=n(70929),u=n(62302);const c=(0,l.op)({depthwiseConv2d_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,l,c="NHWC",d=[1,1],h){const p=(0,s.YT)(e,"x","depthwiseConv2d","float32"),f=(0,s.YT)(t,"filter","depthwiseConv2d","float32");let m=p,g=!1;3===p.rank&&(g=!0,m=(0,u.t)(p,[1,p.shape[0],p.shape[1],p.shape[2]])),o.vA(4===m.rank,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${m.rank}.`),o.vA(4===f.rank,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${f.rank}.`);const y="NHWC"===c?m.shape[3]:m.shape[1];o.vA(y===f.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${y}) must match the inChannels dimension in filter ${f.shape[2]}.`),a.s_("depthwiseConv2d",l,h);const _={x:m,filter:f},v={strides:n,pad:l,dataFormat:c,dilations:d,dimRoundingMode:h},b=i.T2.runKernel(r.tGH,_,v);return g?(0,u.t)(b,[b.shape[1],b.shape[2],b.shape[3]]):b}})},41890:(e,t,n)=>{"use strict";n.d(t,{x:()=>a});var i=n(41585),r=n(15441),s=n(70929),o=n(62302);const a=(0,s.op)({depthwiseConv2dNativeBackpropFilter_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,s,a,l=[1,1],u){let c=e;3===e.rank&&(c=(0,o.t)(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let d=t;3===d.rank&&(d=(0,o.t)(t,[1,t.shape[0],t.shape[1],t.shape[2]]));const h={x:c,dy:d},p={strides:s,pad:a,dimRoundingMode:u,dilations:l,filterShape:n};return i.T2.runKernel(r.X$8,h,p)}})},83134:(e,t,n)=>{"use strict";n.d(t,{l:()=>a});var i=n(41585),r=n(15441),s=n(70929),o=n(62302);const a=(0,s.op)({depthwiseConv2dNativeBackpropInput_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,s,a,l=[1,1],u){let c=t,d=!1;3===t.rank&&(d=!0,c=(0,o.t)(t,[1,t.shape[0],t.shape[1],t.shape[2]]));const h={dy:c,filter:n},p={strides:s,pad:a,dimRoundingMode:u,dilations:l,inputShape:e},f=i.T2.runKernel(r.nVu,h,p);return d?(0,o.t)(f,[f.shape[1],f.shape[2],f.shape[3]]):f}})},93002:(e,t,n)=>{"use strict";n.d(t,{X:()=>u});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(70929),l=n(62302);const u=(0,a.op)({dilation2d_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,a,u=[1,1],c="NHWC"){const d=(0,s.YT)(e,"x","dilation2d"),h=(0,s.YT)(t,"filter","dilation2d");o.vA(3===d.rank||4===d.rank,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${d.rank}.`),o.vA(3===h.rank,()=>`Error in dilation2d: filter must be rank 3, but got rank ${h.rank}.`),o.vA("NHWC"===c,()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${c}`);let p=d,f=!1;3===d.rank&&(p=(0,l.t)(d,[1,d.shape[0],d.shape[1],d.shape[2]]),f=!0),o.vA(p.shape[3]===h.shape[2],()=>`Error in dilation2d: input and filter must have the same depth: ${p.shape[3]} vs ${h.shape[2]}`);const m={x:p,filter:h},g={strides:n,pad:a,dilations:u},y=i.T2.runKernel(r.jxD,m,g);return f?(0,l.t)(y,[y.shape[1],y.shape[2],y.shape[3]]):y}})},89359:(e,t,n)=>{"use strict";n.d(t,{y:()=>l});var i=n(41585),r=n(15441),s=n(30565),o=n(28189),a=n(88991);const l=(0,n(70929).op)({div_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","div"),l=(0,o.YT)(t,"b","div");if([n,l]=(0,s.makeTypesMatch)(n,l),"int32"===n.dtype&&"int32"===l.dtype)return(0,a.w)(n,l);const u={a:n,b:l};return i.T2.runKernel(r.sDr,u,{})}})},919:(e,t,n)=>{"use strict";n.d(t,{e:()=>c});var i=n(30565),r=n(28189),s=n(89359),o=n(13020),a=n(70929),l=n(12151),u=n(55537);const c=(0,a.op)({divNoNan_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,r.YT)(e,"a","div"),a=(0,r.YT)(t,"b","div");[n,a]=(0,i.makeTypesMatch)(n,a);const c=(0,s.y)(n,a),d=(0,u.P)(c),h=(0,o.L)(a,d);return(0,l._)(h,d,c)}})},69759:(e,t,n)=>{"use strict";n.d(t,{O:()=>l});var i=n(28189),r=n(45119),s=n(65703),o=n(70929),a=n(62302);const l=(0,o.op)({dot_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,i.YT)(e,"t1","dot"),o=(0,i.YT)(t,"t2","dot");r.vA(!(1!==n.rank&&2!==n.rank||1!==o.rank&&2!==o.rank),()=>`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${o.rank}.`);const l=1===n.rank?n.size:n.shape[1],u=1===o.rank?o.size:o.shape[0];if(r.vA(l===u,()=>`Error in dot: inner dimensions of inputs must match, but got ${l} and ${u}.`),1===n.rank&&1===o.rank){const e=(0,a.t)(n,[1,-1]),t=(0,a.t)(o,[-1,1]),i=(0,s.N)(e,t);return(0,a.t)(i,[])}if(1===n.rank&&2===o.rank){const e=(0,a.t)(n,[1,-1]),t=(0,a.t)(o,[o.shape[0],o.shape[1]]),i=(0,s.N)(e,t);return(0,a.t)(i,[i.size])}if(2===n.rank&&1===o.rank){const e=(0,a.t)(o,[-1,1]),t=(0,s.N)(n,e);return(0,a.t)(t,[t.size])}{const e=(0,a.t)(o,[o.shape[0],o.shape[1]]);return(0,s.N)(n,e)}}})},83416:(e,t,n)=>{"use strict";n.d(t,{P:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({elu_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","elu","float32")};return i.T2.runKernel(r.Pah,t)}})},13020:(e,t,n)=>{"use strict";n.d(t,{L:()=>l});var i=n(41585),r=n(15441),s=n(30565),o=n(28189),a=n(62198);const l=(0,n(70929).op)({equal_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","equal","string_or_numeric"),l=(0,o.YT)(t,"b","equal","string_or_numeric");[n,l]=(0,s.makeTypesMatch)(n,l),(0,a.assertAndGetBroadcastShape)(n.shape,l.shape);const u={a:n,b:l};return i.T2.runKernel(r.BRl,u)}})},95207:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(29809);const l=(0,n(70929).op)({erf_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){let t=(0,s.YT)(e,"x","erf");o.vA("int32"===t.dtype||"float32"===t.dtype,()=>"Input dtype must be `int32` or `float32`."),"int32"===t.dtype&&(t=(0,a.w)(t,"float32"));const n={x:t};return i.T2.runKernel(r._s9,n)}})},44881:(e,t,n)=>{"use strict";n.d(t,{p:()=>r});var i=n(92596);const r=(0,n(70929).op)({euclideanNorm_:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=null,n=!1){return(0,i.x)(e,"euclidean",t,n)}})},8631:(e,t,n)=>{"use strict";n.d(t,{o:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({exp_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","exp")};return i.T2.runKernel(r.ox3,t)}})},8710:(e,t,n)=>{"use strict";n.d(t,{U:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({expandDims_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0){const n=(0,s.YT)(e,"x","expandDims","string_or_numeric");o.vA(t<=n.rank,()=>"Axis must be <= rank of the tensor");const a={input:n},l={dim:t};return i.T2.runKernel(r.ybN,a,l)}})},40517:(e,t,n)=>{"use strict";n.d(t,{I:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({expm1_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","expm1")};return i.T2.runKernel(r.ybj,t)}})},96111:(e,t,n)=>{"use strict";n.d(t,{G:()=>o});var i=n(41585),r=n(15441),s=n(45119);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function o(e,t,n){(0,s.SA)(e);const o={shape:e,value:t,dtype:n=n||(0,s.X$)(t)};return i.T2.runKernel(r.SQl,{},o)}},15606:(e,t,n)=>{"use strict";n.d(t,{R:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({floor_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","floor","float32")};return i.T2.runKernel(r.ZgB,t)}})},88991:(e,t,n)=>{"use strict";n.d(t,{w:()=>a});var i=n(41585),r=n(15441),s=n(30565),o=n(28189);const a=(0,n(70929).op)({floorDiv_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","floorDiv"),a=(0,o.YT)(t,"b","floorDiv");[n,a]=(0,s.makeTypesMatch)(n,a);const l={a:n,b:a};return i.T2.runKernel(r.ElG,l)}})},68646:(e,t,n)=>{"use strict";n.d(t,{Do:()=>m,XB:()=>f,f2:()=>g,zE:()=>y});var i=n(62198),r=n(83416),s=n(66919),o=n(9258),a=n(64394),l=n(90112),u=n(83732),c=n(62302),d=n(28968),h=n(10700),p=n(83791);
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function f(e,t,n){if(null==n||"linear"===n)return e;if("relu"===n)return(0,o.l)(e,(0,h.P)(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function m(e,t){let n=t;const r=i.getReductionAxes(e.shape,t.shape);return r.length>0&&(n=(0,p.c)(n,r)),(0,c.t)(n,e.shape)}function g(e,t,n,i){if("linear"===t)return e;if("relu"===t)return(0,l.V)(e);if("elu"===t)return(0,r.P)(e);if("relu6"===t)return(0,u.j)(e);if("prelu"===t)return(0,a.N)(e,n);if("leakyrelu"===t)return(0,s.H)(e,i);if("sigmoid"===t)return(0,d.r)(e);throw new Error(`Unknown fused activation ${t}.`)}const y=(e,t)=>!(e>0)||"linear"===t},48229:(e,t,n)=>{"use strict";n.d(t,{k:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({gather_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=0,o=0){const a={x:(0,s.YT)(e,"x","gather"),indices:(0,s.YT)(t,"indices","gather","int32")},l={axis:n,batchDims:o};return i.T2.runKernel(r.mxL,a,l)}})},62058:(e,t,n)=>{"use strict";n.d(t,{r:()=>l});var i=n(41585),r=n(15441),s=n(30565),o=n(28189),a=n(62198);const l=(0,n(70929).op)({greater_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","greater","string_or_numeric"),l=(0,o.YT)(t,"b","greater","string_or_numeric");[n,l]=(0,s.makeTypesMatch)(n,l),(0,a.assertAndGetBroadcastShape)(n.shape,l.shape);const u={a:n,b:l};return i.T2.runKernel(r.XhZ,u)}})},13337:(e,t,n)=>{"use strict";n.d(t,{D:()=>l});var i=n(41585),r=n(15441),s=n(30565),o=n(28189),a=n(62198);const l=(0,n(70929).op)({greaterEqual_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","greaterEqual","string_or_numeric"),l=(0,o.YT)(t,"b","greaterEqual","string_or_numeric");[n,l]=(0,s.makeTypesMatch)(n,l),(0,a.assertAndGetBroadcastShape)(n.shape,l.shape);const u={a:n,b:l};return i.T2.runKernel(r.lLS,u)}})},35040:(e,t,n)=>{"use strict";n.d(t,{n:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({imag_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={input:(0,s.YT)(e,"input","imag")};return i.T2.runKernel(r.dv8,t)}})},44711:(e,t,n)=>{"use strict";n.d(t,{v:()=>u});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(70929),l=n(62302);const u=(0,a.op)({resizeBilinear_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=!1,a=!1){const u=(0,s.YT)(e,"images","resizeBilinear");o.vA(3===u.rank||4===u.rank,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${u.rank}.`),o.vA(2===t.length,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`),o.vA(!1===a||!1===n,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let c=u,d=!1;3===u.rank&&(d=!0,c=(0,l.t)(u,[1,u.shape[0],u.shape[1],u.shape[2]]));const[]=t,h={images:c},p={alignCorners:n,halfPixelCenters:a,size:t},f=i.T2.runKernel(r.hgw,h,p);return d?(0,l.t)(f,[f.shape[1],f.shape[2],f.shape[3]]):f}})},42954:(e,t,n)=>{"use strict";n.d(t,{b:()=>u});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(70929),l=n(62302);const u=(0,a.op)({resizeNearestNeighbor_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=!1,a=!1){const u=(0,s.YT)(e,"images","resizeNearestNeighbor");o.vA(3===u.rank||4===u.rank,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${u.rank}.`),o.vA(2===t.length,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`),o.vA("float32"===u.dtype||"int32"===u.dtype,()=>"`images` must have `int32` or `float32` as dtype"),o.vA(!1===a||!1===n,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let c=u,d=!1;3===u.rank&&(d=!0,c=(0,l.t)(u,[1,u.shape[0],u.shape[1],u.shape[2]]));const[]=t,h={images:c},p={alignCorners:n,halfPixelCenters:a,size:t},f=i.T2.runKernel(r.jOE,h,p);return d?(0,l.t)(f,[f.shape[1],f.shape[2],f.shape[3]]):f}})},68318:(e,t,n)=>{"use strict";n.d(t,{M:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({isFinite_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","isFinite")};return i.T2.runKernel(r.gIW,t)}})},33454:(e,t,n)=>{"use strict";n.d(t,{E:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({isInf_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","isInf")};return i.T2.runKernel(r.E3$,t)}})},6300:(e,t,n)=>{"use strict";n.d(t,{y:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({isNaN_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","isNaN")};return i.T2.runKernel(r.iPs,t)}})},66919:(e,t,n)=>{"use strict";n.d(t,{H:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({leakyRelu_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=.2){const n={x:(0,s.YT)(e,"x","leakyRelu")},o={alpha:t};return i.T2.runKernel(r.X0$,n,o)}})},61303:(e,t,n)=>{"use strict";n.d(t,{M:()=>l});var i=n(41585),r=n(15441),s=n(30565),o=n(28189),a=n(62198);const l=(0,n(70929).op)({less_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","less","string_or_numeric"),l=(0,o.YT)(t,"b","less","string_or_numeric");[n,l]=(0,s.makeTypesMatch)(n,l),(0,a.assertAndGetBroadcastShape)(n.shape,l.shape);const u={a:n,b:l};return i.T2.runKernel(r.mIA,u)}})},56508:(e,t,n)=>{"use strict";n.d(t,{I:()=>l});var i=n(41585),r=n(15441),s=n(30565),o=n(28189),a=n(62198);const l=(0,n(70929).op)({lessEqual_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","lessEqual","string_or_numeric"),l=(0,o.YT)(t,"b","lessEqual","string_or_numeric");[n,l]=(0,s.makeTypesMatch)(n,l),(0,a.assertAndGetBroadcastShape)(n.shape,l.shape);const u={a:n,b:l};return i.T2.runKernel(r.CwD,u)}})},93531:(e,t,n)=>{"use strict";n.d(t,{K:()=>u});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(70929),l=n(62302);const u=(0,a.op)({localResponseNormalization_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=5,n=1,a=1,u=.5){const c=(0,s.YT)(e,"x","localResponseNormalization");o.vA(4===c.rank||3===c.rank,()=>`Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank ${c.rank}.`),o.vA(o.E6(t),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);let d=c,h=!1;3===c.rank&&(h=!0,d=(0,l.t)(c,[1,c.shape[0],c.shape[1],c.shape[2]]));const p={x:d},f={depthRadius:t,bias:n,alpha:a,beta:u},m=i.T2.runKernel(r.jM4,p,f);return h?(0,l.t)(m,[m.shape[1],m.shape[2],m.shape[3]]):m}})},44010:(e,t,n)=>{"use strict";n.d(t,{R:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({log_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","log","float32")};return i.T2.runKernel(r.tG8,t)}})},12015:(e,t,n)=>{"use strict";n.d(t,{K:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({log1p_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","log1p")};return i.T2.runKernel(r.Cg$,t)}})},95645:(e,t,n)=>{"use strict";n.d(t,{n:()=>c});var i=n(31830),r=n(28189),s=n(9258),o=n(96522),a=n(70929),l=n(28968),u=n(66030);const c=(0,a.op)({logSigmoid_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t=(0,r.YT)(e,"x","logSigmoid");return(0,i._X)(e=>({value:(0,o.H)((0,u.l)((0,o.H)(e))),gradFunc:t=>(0,s.l)(t,(0,l.r)((0,o.H)(e)))}))(t)}})},97991:(e,t,n)=>{"use strict";n.d(t,{H:()=>p});var i=n(31830),r=n(28189),s=n(29809),o=n(8631),a=n(44010),l=n(41938),u=n(9258),c=n(70929),d=n(77126),h=n(83791);const p=(0,c.op)({logSoftmax_:
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=-1){const n=(0,r.YT)(e,"logits","logSoftmax");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and axis was ${t}`);return(0,i._X)((e,n)=>{const i=(0,l.T)(e,t,!0),r=(0,d.j)(e,i),c=(0,d.j)((0,s.w)(r,"float32"),(0,a.R)((0,h.c)((0,o.o)(r),t,!0)));n([c]);return{value:c,gradFunc:(e,n)=>{const[i]=n,r=(0,o.o)(i);return(0,d.j)(e,(0,u.l)((0,h.c)(e,t,!0),r))}}})(n)}})},13330:(e,t,n)=>{"use strict";n.d(t,{V:()=>f});var i=n(28189),r=n(45119),s=n(37523),o=n(21078),a=n(8631),l=n(44010),u=n(41938),c=n(70929),d=n(62302),h=n(77126),p=n(83791);const f=(0,c.op)({logSumExp_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=null,n=!1){const c=(0,i.YT)(e,"x","logSumExp"),f=(0,r.Y6)(t,c.shape),m=(0,u.T)(c,f,!0),g=(0,h.j)(c,m),y=(0,a.o)(g),_=(0,p.c)(y,f),v=(0,l.R)(_),b=(0,s.W)((0,d.t)(m,v.shape),v);if(n){const e=(0,o.SM)(b.shape,f);return(0,d.t)(b,e)}return b}})},13789:(e,t,n)=>{"use strict";n.d(t,{n:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(62198);const a=(0,n(70929).op)({logicalAnd_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,s.YT)(e,"a","logicalAnd","bool"),a=(0,s.YT)(t,"b","logicalAnd","bool");(0,o.assertAndGetBroadcastShape)(n.shape,a.shape);const l={a:n,b:a};return i.T2.runKernel(r.RUm,l)}})},89881:(e,t,n)=>{"use strict";n.d(t,{N:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({logicalNot_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","logicalNot","bool")};return i.T2.runKernel(r.nZd,t)}})},9879:(e,t,n)=>{"use strict";n.d(t,{z:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(62198);const a=(0,n(70929).op)({logicalOr_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,s.YT)(e,"a","logicalOr","bool"),a=(0,s.YT)(t,"b","logicalOr","bool");(0,o.assertAndGetBroadcastShape)(n.shape,a.shape);const l={a:n,b:a};return i.T2.runKernel(r.LXA,l)}})},19925:(e,t,n)=>{"use strict";n.d(t,{r:()=>l});var i=n(28189),r=n(62198),s=n(13789),o=n(89881),a=n(9879);const l=(0,n(70929).op)({logicalXor_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,i.YT)(e,"a","logicalXor","bool"),l=(0,i.YT)(t,"b","logicalXor","bool");return(0,r.assertAndGetBroadcastShape)(n.shape,l.shape),(0,s.n)((0,a.z)(e,t),(0,o.N)((0,s.n)(e,t)))}})},27084:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
var i;n.d(t,{i:()=>i}),function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"}(i||(i={}))},65703:(e,t,n)=>{"use strict";n.d(t,{N:()=>a});var i=n(41585),r=n(15441),s=n(30565),o=n(28189);const a=(0,n(70929).op)({matMul_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=!1,a=!1){let l=(0,o.YT)(e,"a","matMul"),u=(0,o.YT)(t,"b","matMul");[l,u]=(0,s.makeTypesMatch)(l,u);const c={a:l,b:u},d={transposeA:n,transposeB:a};return i.T2.runKernel(r.jAQ,c,d)}})},41938:(e,t,n)=>{"use strict";n.d(t,{T:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({max_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=null,n=!1){const o={x:(0,s.YT)(e,"x","max")},a={reductionIndices:t,keepDims:n};return i.T2.runKernel(r.VAI,o,a)}})},86999:(e,t,n)=>{"use strict";n.d(t,{j:()=>c});var i=n(41585),r=n(15441),s=n(28189),o=n(45119),a=n(47195),l=n(70929),u=n(62302);const c=(0,l.op)({maxPool_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,l,c){const d=(0,s.YT)(e,"x","maxPool");let h=d,p=!1;3===d.rank&&(p=!0,h=(0,u.t)(d,[1,d.shape[0],d.shape[1],d.shape[2]])),o.vA(4===h.rank,()=>`Error in maxPool: input must be rank 4 but got rank ${h.rank}.`),o.vA(a.G0(n,1),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '1'`),a.s_("maxPool",l,c);const f={x:h},m={filterSize:t,strides:n,pad:l,dimRoundingMode:c},g=i.T2.runKernel(r.t3d,f,m);return p?(0,u.t)(g,[g.shape[1],g.shape[2],g.shape[3]]):g}})},30178:(e,t,n)=>{"use strict";n.d(t,{P:()=>u});var i=n(41585),r=n(15441),s=n(30565),o=n(28189),a=n(62198),l=n(29809);const u=(0,n(70929).op)({maximum_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","maximum"),u=(0,o.YT)(t,"b","maximum");[n,u]=(0,s.makeTypesMatch)(n,u),"bool"===n.dtype&&(n=(0,l.w)(n,"int32"),u=(0,l.w)(u,"int32")),(0,a.assertAndGetBroadcastShape)(n.shape,u.shape);const c={a:n,b:u};return i.T2.runKernel(r.LDN,c)}})},12611:(e,t,n)=>{"use strict";n.d(t,{i:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({mean_:
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=null,n=!1){const o={x:(0,s.YT)(e,"x","mean")},a={axis:t,keepDims:n};return i.T2.runKernel(r.g5A,o,a)}})},57436:(e,t,n)=>{"use strict";n.d(t,{j:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({min_:
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=null,n=!1){const o={x:(0,s.YT)(e,"x","min")},a={axis:t,keepDims:n};return i.T2.runKernel(r.lNG,o,a)}})},12644:(e,t,n)=>{"use strict";n.d(t,{B:()=>u});var i=n(41585),r=n(15441),s=n(30565),o=n(28189),a=n(62198),l=n(29809);const u=(0,n(70929).op)({minimum_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","minimum"),u=(0,o.YT)(t,"b","minimum");[n,u]=(0,s.makeTypesMatch)(n,u),"bool"===n.dtype&&(n=(0,l.w)(n,"int32"),u=(0,l.w)(u,"int32")),(0,a.assertAndGetBroadcastShape)(n.shape,u.shape);const c={a:n,b:u};return i.T2.runKernel(r.LG0,c)}})},66567:(e,t,n)=>{"use strict";n.d(t,{F:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({mirrorPad_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){o.vA("reflect"===n||"symmetric"===n,()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);const a=(0,s.YT)(e,"x","mirrorPad");if(0===a.rank)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");o.vA(t.length===a.rank,()=>`Padding doesn't match input. Must be ${a.rank}. Got ${t.length}.`);const l="reflect"===n?1:0;for(let e=0;e<a.rank;e++)o.vA(2===t[e].length,()=>"Invalid number of paddings. Must be length of 2 each."),o.vA(t[e][0]>=0&&t[e][0]<=a.shape[e]-l&&t[e][1]>=0&&t[e][1]<=a.shape[e]-l,()=>`Padding in dimension ${e} cannot be greater than or equal to ${a.shape[e]-l} or less than 0 for input of shape ${a.shape}`);const u={paddings:t,mode:n},c={x:a};return i.T2.runKernel(r.x7F,c,u)}})},60152:(e,t,n)=>{"use strict";n.d(t,{z:()=>a});var i=n(41585),r=n(15441),s=n(30565),o=n(28189);const a=(0,n(70929).op)({mod_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","mod"),a=(0,o.YT)(t,"b","mod");[n,a]=(0,s.makeTypesMatch)(n,a);const l={a:n,b:a};return i.T2.runKernel(r.BLA,l)}})},9258:(e,t,n)=>{"use strict";n.d(t,{l:()=>a});var i=n(41585),r=n(15441),s=n(30565),o=n(28189);const a=(0,n(70929).op)({mul_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","mul"),a=(0,o.YT)(t,"b","mul");[n,a]=(0,s.makeTypesMatch)(n,a);const l={a:n,b:a};return i.T2.runKernel(r.xu7,l)}})},96522:(e,t,n)=>{"use strict";n.d(t,{H:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({neg_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","neg")};return i.T2.runKernel(r.l0G,t)}})},92596:(e,t,n)=>{"use strict";n.d(t,{x:()=>y});var i=n(28189),r=n(45119),s=n(4888),o=n(21078),a=n(41938),l=n(57436),u=n(70929),c=n(98990),d=n(62302),h=n(45702),p=n(79348),f=n(45793),m=n(83791);function g(e,t,n=null){if(0===e.rank)return(0,s.t)(e);if(1!==e.rank&&null===n)return g((0,d.t)(e,[-1]),t,n);if(1===e.rank||"number"==typeof n||Array.isArray(n)&&1===n.length){if(1===t)return(0,m.c)((0,s.t)(e),n);if(t===1/0)return(0,a.T)((0,s.t)(e),n);if(t===-1/0)return(0,l.j)((0,s.t)(e),n);if("euclidean"===t||2===t)return(0,p.R)((0,m.c)((0,c.n)((0,s.t)(e),(0,h.d)(2,"int32")),n));throw new Error(`Error in norm: invalid ord value: ${t}`)}if(Array.isArray(n)&&2===n.length){if(1===t)return(0,a.T)((0,m.c)((0,s.t)(e),n[0]),n[1]-1);if(t===1/0)return(0,a.T)((0,m.c)((0,s.t)(e),n[1]),n[0]);if(t===-1/0)return(0,l.j)((0,m.c)((0,s.t)(e),n[1]),n[0]);if("fro"===t||"euclidean"===t)return(0,p.R)((0,m.c)((0,f.E)(e),n));throw new Error(`Error in norm: invalid ord value: ${t}`)}throw new Error(`Error in norm: invalid axis: ${n}`)}const y=(0,u.op)({norm_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t="euclidean",n=null,s=!1){const a=g(e=(0,i.YT)(e,"x","norm"),t,n);let l=a.shape;if(s){const t=(0,r.Y6)(n,e.shape);l=o.SM(a.shape,t)}return(0,d.t)(a,l)}})},42118:(e,t,n)=>{"use strict";n.d(t,{E:()=>l});var i=n(41585),r=n(15441),s=n(30565),o=n(28189),a=n(62198);const l=(0,n(70929).op)({notEqual_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","notEqual","string_or_numeric"),l=(0,o.YT)(t,"b","notEqual","string_or_numeric");[n,l]=(0,s.makeTypesMatch)(n,l),(0,a.assertAndGetBroadcastShape)(n.shape,l.shape);const u={a:n,b:l};return i.T2.runKernel(r.ylV,u)}})},11760:(e,t,n)=>{"use strict";n.d(t,{M:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({oneHot_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=1,o=0,a="int32"){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);const l={indices:(0,s.YT)(e,"indices","oneHot","int32")},u={dtype:a,depth:t,onValue:n,offValue:o};return i.T2.runKernel(r.urI,l,u)}})},61411:(e,t,n)=>{"use strict";n.d(t,{S:()=>a});var i=n(41585),r=n(45119),s=n(37148),o=n(42855);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function a(e,t="float32"){if((0,r.SA)(e),"complex64"===t){const t=a(e,"float32"),n=(0,o.U)(e,"float32");return(0,s.f)(t,n)}const n=(0,r.FZ)((0,r.Ze)(e),t);return i.T2.makeTensor(n,e,t)}},69885:(e,t,n)=>{"use strict";n.d(t,{P:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({onesLike_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","onesLike")};return i.T2.runKernel(r.LWX,t)}})},70929:(e,t,n)=>{"use strict";n.d(t,{B:()=>s,op:()=>o});var i=n(41585),r=n(45119);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const s="__op";function o(e){const t=Object.keys(e);if(1!==t.length)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let n=t[0];const o=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n+=s;const a=(...e)=>{i.T2.startScope(n);try{const t=o(...e);return(0,r.yL)(t)&&console.error("Cannot return a Promise inside of tidy."),i.T2.endScope(t),t}catch(e){throw i.T2.endScope(null),e}};return Object.defineProperty(a,"name",{value:n,configurable:!0}),a}},67270:(e,t,n)=>{"use strict";n.d(t,{BTT:()=>h.B,tnl:()=>r.t,HQu:()=>s.H,FqL:()=>o.F,WQq:()=>a.W,QiD:()=>p,Q7R:()=>f.Q,bzn:()=>m.b,FLi:()=>g.F,XRg:()=>y.X,qRo:()=>_.q,yHs:()=>v.y,rYl:()=>b.r,FPz:()=>T.F,rfv:()=>x.r,$jT:()=>E.$,sub:()=>S,lZX:()=>D,$v7:()=>L.$,BFc:()=>P,kSi:()=>B,T5N:()=>$,GTe:()=>F.G,HbZ:()=>U,vjT:()=>z,ftb:()=>ni,ROE:()=>V,hOW:()=>j.h,ra8:()=>Y.r,wgE:()=>w.w,mkO:()=>G.m,zQh:()=>H.z,o8B:()=>W.o,faB:()=>X.f,xWs:()=>C.x,I1m:()=>q,RPU:()=>K,O5O:()=>Z,P1l:()=>Q,kA9:()=>J.k,Xtf:()=>ee.X,wX9:()=>te.w,IPL:()=>ne,jIJ:()=>re,gnS:()=>se.g,yIG:()=>oe.y,_jP:()=>hi,Lp0:()=>ae.L,rCv:()=>le.r,aOp:()=>ue,Rj8:()=>ce.R,Gl3:()=>de.G,smy:()=>he,X7t:()=>pe.X,y4m:()=>fe.y,ek5:()=>me.e,Omf:()=>ge.O,EZY:()=>ci,_3C:()=>ye,Pqc:()=>_e.P,FJY:()=>di,QP2:()=>ve,LCg:()=>be.L,Y12:()=>Te.Y,p4S:()=>xe.p,oNF:()=>Ee.o,UG6:()=>we.U,IYd:()=>Ie.I,y5U:()=>Se,hVP:()=>Tn.h,GSj:()=>Ce.G,RIf:()=>Oe.R,wh_:()=>Me.w,cZk:()=>i,kgh:()=>Re.k,SY9:()=>ui,rhj:()=>ke.r,DQN:()=>Ne.D,KGM:()=>xn.K,ngS:()=>De.n,Slp:()=>gr,U4u:()=>pi,ggX:()=>En.g,MIs:()=>Fe.M,EN4:()=>Le.E,yrW:()=>Pe.y,H8d:()=>Be.H,M7h:()=>$e.M,InN:()=>Ue.I,mPL:()=>yr,mT8:()=>ze,Kgs:()=>Ve.K,Rm2:()=>je.R,Kko:()=>Ye.K,nqI:()=>Ge.n,HPB:()=>He.H,VZ:()=>We.V,n76:()=>Xe.n,NSZ:()=>qe.N,ztW:()=>Ke.z,rxB:()=>Ze.r,YYh:()=>_r,yzS:()=>et,NoW:()=>O.N,T9B:()=>tt.T,jgi:()=>nt.j,NYV:()=>it,RO:()=>rt,PhQ:()=>st.P,i2o:()=>ot.i,OYQ:()=>ut,jkA:()=>ct.j,BpO:()=>dt.B,FFZ:()=>ht.F,ziu:()=>pt.z,Clk:()=>yt,CRk:()=>oi,lKK:()=>M.l,YDF:()=>_t,OjQ:()=>vt,HZy:()=>bt.H,xbf:()=>ri.x,Ec:()=>Tt.E,Mw0:()=>xt.M,SaS:()=>at.S,P61:()=>Et.P,op:()=>h.op,X4o:()=>wt,eVF:()=>It.e,BZs:()=>At,grY:()=>St,XHu:()=>Ct,WLX:()=>Ot,dzn:()=>Mt.d,n7C:()=>Rt.n,NsG:()=>kt.N,yyV:()=>Nt.y,_eU:()=>Dt._,whe:()=>Ft,iyU:()=>Lt,Q0_:()=>Pt,_9M:()=>Bt,pR9:()=>jt,FE$:()=>Yt,m0H:()=>Gt,YeY:()=>Ht,HYA:()=>Wt,y17:()=>Xt,xav:()=>qt.x,VOZ:()=>Kt.V,VVh:()=>Zt.V,j__:()=>Qt.j,tQQ:()=>A.t,BEg:()=>Jt.B,QD2:()=>en,LMr:()=>tn,I2l:()=>nn,JYU:()=>rn,z8$:()=>wn.z,LIG:()=>sn.L,Z$r:()=>on.Z,d_2:()=>an.d,NFr:()=>ai,sZg:()=>Je,WfX:()=>ln.W,wdz:()=>un.w,F12:()=>cn,ry7:()=>R.r,_SZ:()=>dn._,vPA:()=>mr,F8e:()=>hn.F,L0l:()=>pn.L,dik:()=>k.d,Q$M:()=>fn,zAd:()=>mn,wck:()=>gn,R0O:()=>yn,Vs9:()=>_n.V,lw0:()=>vn.l,eDJ:()=>bn.e,lMo:()=>vr,Zhr:()=>li,lOn:()=>fr,lDo:()=>In.l,RZD:()=>An.R,EwI:()=>mt.E,Pbu:()=>Sn.P,r2V:()=>Cn.r,t$z:()=>On.t,PMw:()=>Mn.P,Ym9:()=>Rn.Y,YjP:()=>br,jbE:()=>gt.j,czq:()=>kn.c,Mlm:()=>Nn.M,ymU:()=>N.y,OEK:()=>Dn.O,tGX:()=>Ln,KtR:()=>Pn,$_$:()=>Bn.$,g9W:()=>$n,Lpo:()=>Un,yxw:()=>zn,NNh:()=>jn,Vsq:()=>Ae.V,rfw:()=>Yn.r,mgz:()=>ii.m,efE:()=>Gn,AmM:()=>Hn.A,zAU:()=>Wn.z,K$i:()=>Xn.K,rni:()=>qn,bvq:()=>Kn,_M9:()=>Zn._,YJN:()=>Jn,Ul9:()=>ei.U,POl:()=>ti.P});var i={};n.r(i),n.d(i,{conv2d:()=>vi,depthwiseConv2d:()=>xi,matMul:()=>Ei});var r=n(4888),s=n(12804),o=n(37558),a=n(37523),l=n(41585),u=n(15441),c=n(28189),d=n(45119),h=n(70929);const p=(0,h.op)({addN_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){d.vA(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),d.vA(e.length>=1,()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`);const t=e.map((e,t)=>(0,c.YT)(e,`tensors${t}`,"addN")),n=t[0];t.forEach(e=>{if(e.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(e=>{if(!d.r1(e.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});const i=t;return l.T2.runKernel(u.EkD,i)}});var f=n(12307),m=n(89326),g=n(10897),y=n(54339),_=n(66841),v=n(50269),b=n(29580),T=n(21404),x=n(63774),E=n(53909),w=n(29809),I=n(47195),A=n(62302);const S=(0,h.op)({avgPool3d_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r,s="NDHWC"){const o=(0,c.YT)(e,"x","avgPool3d","float32");let a=o,h=!1;4===o.rank&&(h=!0,a=(0,A.t)(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),d.vA(5===a.rank,()=>`Error in avgPool3d: x must be rank 5 but got rank ${a.rank}.`),d.vA("NDHWC"===s,()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),d.vA("number"==typeof n&&n>0||Array.isArray(n)&&n[0]>0&&n[1]>0&&n[2]>0,()=>`Error in avgPool3d: Stride must be > 0, but got '${n}'`),(0,I.s_)("avgPool3d",i,r);const p={x:a},f={filterSize:t,strides:n,pad:i,dimRoundingMode:r,dataFormat:s};let m=l.T2.runKernel(u.cS,p,f);return m=(0,w.w)(m,a.dtype),h?(0,A.t)(m,[m.shape[1],m.shape[2],m.shape[3],m.shape[4]]):m}});var C=n(25030),O=n(65703),M=n(9258),R=n(28968),k=n(17986),N=n(57311);const D=(0,h.op)({basicLSTMCell_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r,s){const o=(0,c.YT)(e,"forgetBias","basicLSTMCell"),l=(0,c.YT)(t,"lstmKernel","basicLSTMCell"),u=(0,c.YT)(n,"lstmBias","basicLSTMCell"),d=(0,c.YT)(i,"data","basicLSTMCell"),h=(0,c.YT)(r,"c","basicLSTMCell"),p=(0,c.YT)(s,"h","basicLSTMCell"),f=(0,C.x)([d,p],1),m=(0,O.N)(f,l),g=(0,a.W)(m,u),y=g.shape[0],_=g.shape[1]/4,v=[y,_],b=(0,k.d)(g,[0,0],v),T=(0,k.d)(g,[0,_],v),x=(0,k.d)(g,[0,2*_],v),E=(0,k.d)(g,[0,3*_],v),w=(0,a.W)((0,M.l)((0,R.r)(b),(0,N.y)(T)),(0,M.l)(h,(0,R.r)((0,a.W)(o,x))));return[w,(0,M.l)((0,N.y)(w),(0,R.r)(E))]}});var F=n(69772),L=n(9160);const P=(0,h.op)({batchNorm2d_:function(e,t,n,i,r,s){const o=(0,c.YT)(e,"x","batchNorm"),a=(0,c.YT)(t,"mean","batchNorm"),l=(0,c.YT)(n,"variance","batchNorm");let u,h;return null!=r&&(u=(0,c.YT)(r,"scale","batchNorm")),null!=i&&(h=(0,c.YT)(i,"offset","batchNorm")),d.vA(2===o.rank,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${o.rank}.`),d.vA(2===a.rank||1===a.rank,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${a.rank}.`),d.vA(2===l.rank||1===l.rank,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`),null!=u&&d.vA(2===u.rank||1===u.rank,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${u.rank}.`),null!=h&&d.vA(2===h.rank||1===h.rank,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${h.rank}.`),(0,L.$)(o,a,l,h,u,s)}});const B=(0,h.op)({batchNorm3d_:function(e,t,n,i,r,s){const o=(0,c.YT)(e,"x","batchNorm"),a=(0,c.YT)(t,"mean","batchNorm"),l=(0,c.YT)(n,"variance","batchNorm");let u,h;return null!=r&&(u=(0,c.YT)(r,"scale","batchNorm")),null!=i&&(h=(0,c.YT)(i,"offset","batchNorm")),d.vA(3===o.rank,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${o.rank}.`),d.vA(3===a.rank||1===a.rank,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${a.rank}.`),d.vA(3===l.rank||1===l.rank,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`),null!=u&&d.vA(3===u.rank||1===u.rank,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${u.rank}.`),null!=h&&d.vA(3===h.rank||1===h.rank,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${h.rank}.`),(0,L.$)(o,a,l,h,u,s)}});const $=(0,h.op)({batchNorm4d_:function(e,t,n,i,r,s){const o=(0,c.YT)(e,"x","batchNorm"),a=(0,c.YT)(t,"mean","batchNorm"),l=(0,c.YT)(n,"variance","batchNorm");let u,h;return null!=r&&(u=(0,c.YT)(r,"scale","batchNorm")),null!=i&&(h=(0,c.YT)(i,"offset","batchNorm")),d.vA(4===o.rank,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${o.rank}.`),d.vA(4===a.rank||1===a.rank,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${a.rank}.`),d.vA(4===l.rank||1===l.rank,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`),null!=u&&d.vA(4===u.rank||1===u.rank,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${u.rank}.`),null!=h&&d.vA(4===h.rank||1===h.rank,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${h.rank}.`),(0,L.$)(o,a,l,h,u,s)}});const U=(0,h.op)({bincount_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"x","bincount"),r=(0,c.YT)(t,"weights","bincount");d.vA("int32"===i.dtype,()=>`Error in bincount: input dtype must be int32, but got ${i.dtype}`),d.vA(n>=0,()=>`size must be non-negative, but got ${n}.`),d.vA(r.size===i.size||0===r.size,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${i.shape}, weights shape: ${r.shape}.`);const s={x:i,weights:r},o={size:n};return l.T2.runKernel(u.N4F,s,o)}});const z=(0,h.op)({bitwiseAnd_:
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,c.YT)(e,"x","bitwiseAnd"),i=(0,c.YT)(t,"y","bitwiseAnd");if(!(0,d.r1)(n.shape,i.shape))throw new Error(`BitwiseAnd: Tensors must have the same shape. x: ${n.shape}, y: ${i.shape}`);if("int32"!==n.dtype||"int32"!==i.dtype)throw new Error(`BitwiseAnd: Only supports 'int32' values in tensor, found type of x: ${n.dtype} and type of y: ${i.dtype}`);const r={a:n,b:i};return l.T2.runKernel(u.HNs,r)}});const V=(0,h.op)({broadcastArgs_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,c.YT)(e,"s0","broadcastArgs","int32"),i=(0,c.YT)(t,"s1","broadcastArgs","int32");if(1!==n.rank)throw new Error(`broadcastArgs(): first input must be a vector (rank=1). Has rank ${n.rank}`);if(1!==i.rank)throw new Error(`broadcastArgs(): second input must be a vector (rank=1). Has rank ${i.rank}`);const r={s0:n,s1:i};return l.T2.runKernel(u.vj7,r)}});var j=n(63567),Y=n(448),G=n(30855),H=n(96928),W=n(70125),X=n(37148);const q=(0,h.op)({concat1d_:function(e){return(0,C.x)(e,0)}});const K=(0,h.op)({concat2d_:function(e,t){return(0,C.x)(e,t)}});const Z=(0,h.op)({concat3d_:function(e,t){return(0,C.x)(e,t)}});const Q=(0,h.op)({concat4d_:function(e,t){return(0,C.x)(e,t)}});var J=n(3701),ee=n(28794),te=n(41106);const ne=(0,h.op)({conv3d_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r="NDHWC",s=[1,1,1]){const o=(0,c.YT)(e,"x","conv3d"),a=(0,c.YT)(t,"filter","conv3d");let h=o,p=!1;4===o.rank&&(p=!0,h=(0,A.t)(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),d.vA(5===h.rank,()=>`Error in conv3d: input must be rank 5, but got rank ${h.rank}.`),d.vA(5===a.rank,()=>`Error in conv3d: filter must be rank 5, but got rank ${a.rank}.`),d.vA(h.shape[4]===a.shape[3],()=>`Error in conv3d: depth of input (${h.shape[4]}) must match input depth for filter ${a.shape[3]}.`),d.vA((0,I.G0)(n,s),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),d.vA("NDHWC"===r,()=>`Error in conv3d: got dataFormat of ${r} but only NDHWC is currently supported.`),d.vA((0,I.qk)(s),()=>"Error in conv3D: Dilated rates should be larger than 0."),d.vA((0,I.qk)(n),()=>"Error in conv3D: Strides should be larger than 0.");const f={x:h,filter:a},m={strides:n,pad:i,dataFormat:r,dilations:s},g=l.T2.runKernel(u.A1h,f,m);return p?(0,A.t)(g,[g.shape[1],g.shape[2],g.shape[3],g.shape[4]]):g}});var ie=n(31895);const re=(0,h.op)({conv3dTranspose_:function(e,t,n,i,r){const s=(0,c.YT)(e,"x","conv3dTranspose"),o=(0,c.YT)(t,"filter","conv3dTranspose");return(0,ie.c)(n,s,o,i,r)}});var se=n(99907),oe=n(27451),ae=n(10302),le=n(76808);const ue=(0,h.op)({denseBincount_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=!1){const r=(0,c.YT)(e,"x","denseBincount"),s=(0,c.YT)(t,"weights","denseBincount");d.vA("int32"===r.dtype,()=>`Error in denseBincount: input dtype must be int32, but got ${r.dtype}`),d.vA(r.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${r.rank}.`),d.vA(n>=0,()=>`size must be non-negative, but got ${n}.`),d.vA(s.size===r.size||0===s.size,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${r.shape}, weights shape: ${s.shape}.`);const o={x:r,weights:s},a={size:n,binaryOutput:i};return l.T2.runKernel(u.wNW,o,a)}});var ce=n(31216),de=n(10676);const he=(0,h.op)({diag_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,c.YT)(e,"x","diag")};return l.T2.runKernel(u.ORI,t)}});var pe=n(93002),fe=n(89359),me=n(919),ge=n(69759);const ye=(0,h.op)({einsum_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,...t){const n=t.map((e,t)=>(0,c.YT)(e,`tensors${t}`,"einsum")),i={equation:e};return l.T2.runKernel(u.Qgm,n,i)}});var _e=n(83416);const ve=(0,h.op)({ensureShape_:
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,c.YT)(e,"x","ensureShape","string_or_numeric");if(!(0,d.e_)(n.shape,t))throw new Error(`EnsureShape: Shape of tensor ${n.shape} is not compatible with expected shape ${t}`);return e}});var be=n(13020),Te=n(95207),xe=n(44881),Ee=n(8631),we=n(8710),Ie=n(40517),Ae=n(64826);const Se=(0,h.op)({eye_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i="float32"){null==t&&(t=e);const r=(0,Y.r)([e,t],i),s=e<=t?e:t;for(let e=0;e<s;++e)r.set(1,e,e);const o=(0,A.t)(r.toTensor(),[e,t]);if(null==n)return o;if(1===n.length)return(0,Ae.V)((0,we.U)(o,0),[n[0],1,1]);if(2===n.length)return(0,Ae.V)((0,we.U)((0,we.U)(o,0),0),[n[0],n[1],1,1]);if(3===n.length)return(0,Ae.V)((0,we.U)((0,we.U)((0,we.U)(o,0),0),0),[n[0],n[1],n[2],1,1]);throw new Error(`eye() currently supports only 1D and 2D batchShapes, but received ${n.length}D.`)}});var Ce=n(96111),Oe=n(15606),Me=n(88991),Re=n(48229),ke=n(62058),Ne=n(13337),De=n(35040),Fe=n(68318),Le=n(33454),Pe=n(6300),Be=n(66919),$e=n(61303),Ue=n(56508);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function ze(e,t,n){if(n<=0)throw new Error("The number of values should be positive.");const i={start:e,stop:t,num:n};return l.T2.runKernel(u.mnI,{},i)}var Ve=n(93531),je=n(44010),Ye=n(12015),Ge=n(95645),He=n(97991),We=n(13330),Xe=n(13789),qe=n(89881),Ke=n(9879),Ze=n(19925);
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Qe=2147483648;const Je=(0,h.op)({searchSorted_:function(e,t,n="left"){const i=(0,c.YT)(e,"sortedSequence","searchSorted"),r=(0,c.YT)(t,"values","searchSorted"),s=i.shape[i.shape.length-1],o=r.shape[r.shape.length-1],a=(0,A.t)(i,[-1,s]),h=(0,A.t)(r,[-1,o]);if(a.rank<2)throw new Error("Sorted input argument must be at least 2-dimensional");if(a.shape[0]!==h.shape[0])throw new Error("Leading dimension of 'sortedSequence' and 'values' must match.");if((0,d.Ze)(h.shape)>=Qe)throw new Error("values tensor size must less than 2147483648");if(a.shape[1]>=Qe)throw new Error(`trailing dim_size must less than 2147483648 for int32 output type, was ${a.shape[1]}`);const p={sortedSequence:a,values:h},f={side:n};return l.T2.runKernel(u.uWl,p,f)}});
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function et(e,t){return Je(e,t,"left")}var tt=n(41938),nt=n(86999);const it=(0,h.op)({maxPool3d_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=[1,1,1],n,i,r,s="NDHWC"){const o=(0,c.YT)(e,"x","maxPool3d");let a=o,h=!1;4===o.rank&&(h=!0,a=(0,A.t)(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),d.vA(5===a.rank,()=>`Error in maxPool3d: x must be rank 5 but got rank ${a.rank}.`),d.vA("NDHWC"===s,()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),(0,I.s_)("maxPool3d",i,r);const p={x:a},f={filterSize:t,strides:n,pad:i,dimRoundingMode:r,dataFormat:s},m=l.T2.runKernel(u.ySp,p,f);return h?(0,A.t)(m,[m.shape[1],m.shape[2],m.shape[3],m.shape[4]]):m}});const rt=(0,h.op)({maxPoolWithArgmax_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r=!1){const s={x:(0,c.YT)(e,"x","maxPoolWithArgmax")},o={filterSize:t,strides:n,pad:i,includeBatchInIndex:r},a=l.T2.runKernel(u.TL8,s,o);return{result:a[0],indexes:a[1]}}});var st=n(30178),ot=n(12611),at=n(61411),lt=n(50259);
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function ut(e,t,{indexing:n="xy"}={}){if("xy"!==n&&"ij"!==n)throw new TypeError(`${n} is not a valid third argument to meshgrid`);if(void 0===e)return[];let i=(0,c.YT)(e,"x","meshgrid",e instanceof lt.qY?e.dtype:"float32");if(void 0===t)return[i];let r=(0,c.YT)(t,"y","meshgrid",t instanceof lt.qY?t.dtype:"float32");const s=(0,d.Ze)(i.shape),o=(0,d.Ze)(r.shape);return"xy"===n?(i=(0,A.t)(i,[1,-1]),r=(0,A.t)(r,[-1,1]),[(0,O.N)((0,at.S)([o,1],i.dtype),i),(0,O.N)(r,(0,at.S)([1,s],r.dtype))]):(i=(0,A.t)(i,[-1,1]),r=(0,A.t)(r,[1,-1]),[(0,O.N)(i,(0,at.S)([1,o],i.dtype)),(0,O.N)((0,at.S)([s,1],r.dtype),r)])}var ct=n(57436),dt=n(12644),ht=n(66567),pt=n(60152),ft=n(21078),mt=n(45793),gt=n(77126);const yt=(0,h.op)({moments_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=null,n=!1){e=(0,c.YT)(e,"x","moments");const i=(0,d.Y6)(t,e.shape),r=(0,ot.i)(e,i,n);let s=r.shape;n||(s=(0,ft.SM)(r.shape,i));const o=(0,mt.E)((0,gt.j)((0,w.w)(e,"float32"),(0,A.t)(r,s)));return{mean:r,variance:(0,ot.i)(o,i,n)}}});const _t=(0,h.op)({multiRNNCell_:function(e,t,n,i){const r=(0,c.YT)(t,"data","multiRNNCell"),s=(0,c.j1)(n,"c","multiRNNCell"),o=(0,c.j1)(i,"h","multiRNNCell");let a=r;const l=[];for(let t=0;t<e.length;t++){const n=e[t](a,s[t],o[t]);l.push(n[0]),l.push(n[1]),a=n[1]}const u=[],d=[];for(let e=0;e<l.length;e+=2)u.push(l[e]),d.push(l[e+1]);return[u,d]}});const vt=(0,h.op)({multinomial_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=!1){const r=(0,c.YT)(e,"logits","multinomial"),s=r.size,o=r.rank;if(s<2)throw new Error(`Error in multinomial: you need at least 2 outcomes, but got ${s}.`);if(o>2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${o}`);n=n||Math.random();const a={logits:1===o?(0,A.t)(r,[1,-1]):r},d={numSamples:t,seed:n,normalized:i},h=l.T2.runKernel(u.WT3,a,d);return 1===o?(0,A.t)(h,[h.size]):h}});var bt=n(96522),Tt=n(42118),xt=n(11760),Et=n(69885);const wt=(0,h.op)({outerProduct_:function(e,t){const n=(0,c.YT)(e,"v1","outerProduct"),i=(0,c.YT)(t,"v2","outerProduct");d.vA(1===n.rank&&1===i.rank,()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${i.rank}.`);const r=(0,A.t)(n,[-1,1]),s=(0,A.t)(i,[1,-1]);return(0,O.N)(r,s)}});var It=n(65661);const At=(0,h.op)({pad1d_:function(e,t,n=0){return(0,d.vA)(2===t.length,()=>"Invalid number of paddings. Must be length of 2."),(0,It.e)(e,[t],n)}});const St=(0,h.op)({pad2d_:function(e,t,n=0){return(0,d.vA)(2===t.length&&2===t[0].length&&2===t[1].length,()=>"Invalid number of paddings. Must be length of 2 each."),(0,It.e)(e,t,n)}});const Ct=(0,h.op)({pad3d_:function(e,t,n=0){return(0,d.vA)(3===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length,()=>"Invalid number of paddings. Must be length of 2 each."),(0,It.e)(e,t,n)}});const Ot=(0,h.op)({pad4d_:function(e,t,n=0){return(0,d.vA)(4===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length&&2===t[3].length,()=>"Invalid number of paddings. Must be length of 2 each."),(0,It.e)(e,t,n)}});var Mt=n(17872),Rt=n(98990),kt=n(64394),Nt=n(75295),Dt=n(67771);const Ft=(0,h.op)({raggedGather_:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i){const r={paramsNestedSplits:e.map((e,t)=>(0,c.YT)(e,`tensors${t}`,"raggedGather","int32")),paramsDenseValues:(0,c.YT)(t,"paramsDenseValues","raggedGather"),indices:(0,c.YT)(n,"indices","raggedGather","int32")},s={outputRaggedRank:i},o=l.T2.runKernel(u.oJ2,r,s);return{outputNestedSplits:o.slice(0,o.length-1),outputDenseValues:o[o.length-1]}}});const Lt=(0,h.op)({raggedRange_:
/**
* @license
* Copyright 2022 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"starts","raggedRange"),r={starts:i,limits:(0,c.YT)(t,"limits","raggedRange",i.dtype),deltas:(0,c.YT)(n,"deltas","raggedRange",i.dtype)},s=l.T2.runKernel(u.CQC,r);return{rtNestedSplits:s[0],rtDenseValues:s[1]}}});const Pt=(0,h.op)({raggedTensorToTensor_:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r){const s=(0,c.YT)(e,"shape","raggedTensorToTensor","int32"),o=(0,c.YT)(t,"values","raggedTensorToTensor"),a={shape:s,values:o,defaultValue:(0,c.YT)(n,"defaultValue","raggedTensorToTensor",o.dtype),rowPartitionTensors:i.map((e,t)=>(0,c.YT)(e,`tensors${t}`,"raggedTensorToTensor","int32"))},d={rowPartitionTypes:r};return l.T2.runKernel(u.mH5,a,d)}});const Bt=(0,h.op)({rand_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){(0,d.SA)(e);const i=(0,d.Ze)(e);let r=null;if(null==n||"float32"===n)r=new Float32Array(i);else if("int32"===n)r=new Int32Array(i);else{if("bool"!==n)throw new Error(`Unknown data type ${n}`);r=new Uint8Array(i)}for(let e=0;e<i;e++)r[e]=t();return l.T2.makeTensor(r,e,n)}});var $t=n(7391);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Ut{constructor(e,t,n,i,r){this.mean=e,this.stdDev=t,this.dtype=n,this.nextVal=NaN,this.truncated=i,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);const s=r||Math.random();this.random=$t.alea(s.toString())}nextValue(){if(!isNaN(this.nextVal)){const e=this.nextVal;return this.nextVal=NaN,e}let e,t,n=!1;for(;!n;){let i,r,s;do{i=2*this.random()-1,r=2*this.random()-1,s=i*i+r*r}while(s>=1||0===s);const o=Math.sqrt(-2*Math.log(s)/s);e=this.mean+this.stdDev*i*o,t=this.mean+this.stdDev*r*o,this.truncated&&!this.isValidTruncated(e)||(n=!0)}return this.truncated&&!this.isValidTruncated(t)||(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return null==this.dtype||"float32"===this.dtype?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}}class zt{constructor(e,t,n,i){this.alpha=e,this.beta=1/t,this.dtype=n;const r=i||Math.random();this.randu=$t.alea(r.toString()),this.randn=new Ut(0,1,n,!1,this.randu()),this.d=e<1?e+2/3:e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,i,r,s;for(;;){do{i=this.randn.nextValue(),s=1+this.c*i}while(s<=0);if(s*=s*s,e=i*i,t=1-.331*e*e,n=.5*e+this.d*(1-s+Math.log(s)),r=this.randu(),r<t||Math.log(r)<n)break}return s=1/this.beta*this.d*s,this.alpha<1&&(s*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(s)}convertValue(e){return"float32"===this.dtype?e:Math.round(e)}}class Vt{constructor(e=0,t=1,n,i){if(this.canReturnFloat=()=>null==this.dtype||"float32"===this.dtype,this.min=e,this.range=t-e,this.dtype=n,null==i&&(i=Math.random()),"number"==typeof i&&(i=i.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=$t.alea(i)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}}const jt=(0,h.op)({randomGamma_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=1,i="float32",r){if((0,d.SA)(e),null==n&&(n=1),null==i&&(i="float32"),"float32"!==i&&"int32"!==i)throw new Error(`Unsupported data type ${i}`);const s=new zt(t,n,i,r),o=(0,Y.r)(e,i);for(let e=0;e<o.values.length;e++)o.values[e]=s.nextValue();return o.toTensor()}});const Yt=(0,h.op)({randomNormal_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0,n=1,i,r){if((0,d.SA)(e),null!=i&&"bool"===i)throw new Error(`Unsupported data type ${i}`);const s=new Ut(t,n,i,!1,r),o=(0,Y.r)(e,i);for(let e=0;e<o.values.length;e++)o.values[e]=s.nextValue();return o.toTensor()}});const Gt=(0,h.op)({randomStandardNormal_:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){if(null!=t&&"bool"===t)throw new Error(`Unsupported data type ${t}`);return Yt(e,0,1,t,n)}});const Ht=(0,h.op)({randomUniform_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0,n=1,i="float32",r){(0,d.SA)(e);const s=(0,Y.r)(e,i),o=new Vt(t,n,null,r);for(let e=0;e<s.values.length;e++)s.values[e]=o.nextValue();return s.toTensor()}});const Wt=(0,h.op)({randomUniformInt_:
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i){return Ht(e,t,n,"int32",i)}});
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Xt(e,t,n=1,i="float32"){if(0===n)throw new Error("Cannot have a step of zero");const r={start:e,stop:t,step:n,dtype:i};return l.T2.runKernel(u.Q6t,{},r)}var qt=n(1902),Kt=n(19870),Zt=n(90112),Qt=n(83732),Jt=n(53262);const en=(0,h.op)({reverse1d_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t=(0,c.YT)(e,"x","reverse");return d.vA(1===t.rank,()=>`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`),(0,Jt.B)(t,0)}});const tn=(0,h.op)({reverse2d_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,c.YT)(e,"x","reverse");return d.vA(2===n.rank,()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`),(0,Jt.B)(n,t)}});const nn=(0,h.op)({reverse3d_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,c.YT)(e,"x","reverse");return d.vA(3===n.rank,()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`),(0,Jt.B)(n,t)}});const rn=(0,h.op)({reverse4d_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,c.YT)(e,"x","reverse");return d.vA(4===n.rank,()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`),(0,Jt.B)(n,t)}});var sn=n(25912),on=n(17820),an=n(45702),ln=n(26325),un=n(89986);const cn=
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
async function(e,t){const n=(0,c.YT)(e,"x","setdiff1d"),i=(0,c.YT)(t,"y","setdiff1d");d.vA(n.dtype===i.dtype,()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${i.dtype}).`),d.vA(1===n.rank,()=>`x should be 1D tensor, but got x (${n.shape}).`),d.vA(1===i.rank,()=>`y should be 1D tensor, but got y (${i.shape}).`);const r=await n.data(),s=await i.data(),o=new Set(s);let a=0;for(let e=0;e<r.length;e++)o.has(r[e])||a++;const l=new lt.yl([a],n.dtype),u=new lt.yl([a],"int32");for(let e=0,t=0;e<r.length;e++)o.has(r[e])||(l.values[t]=r[e],u.values[t]=e,t++);return[l.toTensor(),u.toTensor()]};var dn=n(51115),hn=n(33726),pn=n(58276);const fn=(0,h.op)({slice1d_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"x","slice1d");return d.vA(1===i.rank,()=>`slice1d expects a rank-1 tensor, but got a rank-${i.rank} tensor`),(0,k.d)(i,[t],[n])}});const mn=(0,h.op)({slice2d_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"x","slice2d");return d.vA(2===i.rank,()=>`slice2d expects a rank-2 tensor, but got a rank-${i.rank} tensor`),(0,k.d)(i,t,n)}});const gn=(0,h.op)({slice3d_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"x","slice3d");return d.vA(3===i.rank,()=>`slice3d expects a rank-3 tensor, but got a rank-${i.rank} tensor`),(0,k.d)(i,t,n)}});const yn=(0,h.op)({slice4d_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"x","slice4d");return d.vA(4===i.rank,()=>`slice4d expects a rank-4 tensor, but got a rank-${i.rank} tensor`),(0,k.d)(i,t,n)}});var _n=n(26346),vn=n(66030),bn=n(10776),Tn=n(41361),xn=n(13108),En=n(22292),wn=n(8775),In=n(66512),An=n(79348),Sn=n(53427),Cn=n(5932),On=n(54268),Mn=n(10700),Rn=n(45894),kn=n(83791),Nn=n(77823),Dn=n(74027),Fn=n(19171);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Ln(e,t){(0,d.HO)(e);const n=(0,c.MZ)(e,t);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return(0,Fn.Q)(e,null,n,t)}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Pn(e,t,n){if((0,d.HO)(e),null!=t&&2!==t.length)throw new Error("tensor2d() requires shape to have two numbers");const i=(0,c.MZ)(e,n);if(2!==i.length&&1!==i.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===i.length&&null==t)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return(0,Fn.Q)(e,t,i,n)}var Bn=n(42768);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function $n(e,t,n){if((0,d.HO)(e),null!=t&&4!==t.length)throw new Error("tensor4d() requires shape to have four numbers");const i=(0,c.MZ)(e,n);if(4!==i.length&&1!==i.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===i.length&&null==t)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return(0,Fn.Q)(e,t,i,n)}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Un(e,t,n){if((0,d.HO)(e),null!=t&&5!==t.length)throw new Error("tensor5d() requires shape to have five numbers");const i=(0,c.MZ)(e,n);if(5!==i.length&&1!==i.length)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(1===i.length&&null==t)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return(0,Fn.Q)(e,t,i,n)}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function zn(e,t,n){if((0,d.HO)(e),null!=t&&6!==t.length)throw new Error("tensor6d() requires shape to have six numbers");const i=(0,c.MZ)(e,n);if(6!==i.length&&1!==i.length)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(1===i.length&&null==t)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return t=t||i,(0,Fn.Q)(e,t,i,n)}var Vn=n(26170);const jn=(0,h.op)({tensorScatterUpdate_:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"tensor","tensorScatterupdate"),r=(0,c.YT)(t,"indices","tensorScatterupdate","int32"),s=(0,c.YT)(n,"updates","tensorScatterupdate");if(Vn.validateInput(s,r,i.shape),i.dtype!==s.dtype)throw new Error(`tensor and updates must have the same dtype, instead they are ${i.dtype} and ${s.dtype}.`);const o={tensor:i,indices:r,updates:s};return l.T2.runKernel(u.X4r,o,{})}});var Yn=n(21190);const Gn=(0,h.op)({truncatedNormal_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0,n=1,i,r){if((0,d.SA)(e),null!=i&&"bool"===i)throw new Error("Unsupported data type $ { dtype }");const s=new Ut(t,n,i,!0,r),o=(0,Y.r)(e,i);for(let e=0;e<o.values.length;e++)o.values[e]=s.nextValue();return o.toTensor()}});var Hn=n(73937),Wn=n(97706),Xn=n(67261);
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function qn(e,t){return Je(e,t,"right")}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Kn(e,t=!0,n,i){return l.T2.makeVariable(e,t,n,i)}var Zn=n(12151),Qn=n(54411);const Jn=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
async function(e){const t=(0,c.YT)(e,"condition","whereAsync","bool"),n=await t.data(),i=(0,Qn.Y)(t.shape,n);return e!==t&&t.dispose(),i};var ei=n(42855),ti=n(55537);const ni=
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
async function(e,t,n){const i=(0,c.YT)(e,"tensor","boolMask"),r=(0,c.YT)(t,"mask","boolMask","bool"),s=null==n?0:n,o=r.rank,a=i.shape;d.vA(o>0,()=>"mask cannot be scalar"),d.O3(a.slice(s,s+o),r.shape,"mask's shape must match the first K dimensions of tensor's shape,");let l=1;for(let e=s;e<s+o;e++)l*=a[e];const u=a.slice(0,s).concat([l],a.slice(s+o)),h=(0,A.t)(i,u),p=(0,A.t)(r,[-1]),f=await Jn(p),m=(0,Cn.r)(f,[1]),g=(0,Re.k)(h,m,s);return e!==i&&i.dispose(),t!==r&&r.dispose(),m.dispose(),h.dispose(),p.dispose(),f.dispose(),g};var ii=n(7703),ri=n(92596),si=n(30565);const oi=(0,h.op)({movingAverage_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r=!0){const s=(0,c.YT)(e,"v","movingAverage"),o=(0,c.YT)(t,"x","movingAverage"),l=(0,c.YT)(n,"decay","movingAverage");(0,si.assertTypesMatch)(s,o),d.vA(d.r1(s.shape,o.shape),()=>"Shape mismatch in v and x");const u=(0,an.d)(1),h=(0,gt.j)(u,l);let p=(0,M.l)((0,gt.j)(o,s),h);if(r){d.vA(null!=i,()=>"When using zeroDebias: true, step is required.");const e=(0,c.YT)(i,"step","movingAverage");p=(0,fe.y)(p,(0,gt.j)(u,(0,Rt.n)(l,e)))}return(0,a.W)(s,p)}});const ai=(0,h.op)({scatterND_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){(0,d.SA)(n);const i=(0,c.YT)(e,"indices","scatterND","int32"),r=(0,c.YT)(t,"updates","scatterND");Vn.validateInput(r,i,n);const s={indices:i,updates:r},o={shape:n};return l.T2.runKernel(u.pJc,s,o)}});const li=(0,h.op)({sparseToDense_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=0){(0,d.SA)(n);const r=(0,c.YT)(e,"sparseIndices","sparseToDense","int32"),s=(0,c.YT)(t,"sparseValues","sparseToDense","string_or_numeric"),o=(0,c.YT)(i,"defaultValue","sparseToDense",s.dtype);!function(e,t,n,i){if("int32"!==e.dtype)throw new Error(`tf.sparseToDense() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.rank>2)throw new Error(`sparseIndices should be a scalar, vector, or matrix, but got shape ${e.shape}.`);const r=e.rank>0?e.shape[0]:1,s=e.rank>1?e.shape[1]:1;if(n.length!==s)throw new Error(`outputShape has incorrect number of elements:, ${n.length}, should be: ${s}.`);const o=t.size;if(0!==t.rank&&(1!==t.rank||o!==r))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${r}]`);if(t.dtype!==i.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(r,s,n,o);const a={sparseIndices:r,sparseValues:s,defaultValue:o},h={outputShape:n};return l.T2.runKernel(u.jgd,a,h)}});const ui=(0,h.op)({gatherND_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,c.YT)(t,"indices","gatherND","int32"),i={params:(0,c.YT)(e,"x","gatherND","string_or_numeric"),indices:n};return l.T2.runKernel(u.O4G,i)}});const ci=(0,h.op)({dropout_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i){const r=(0,c.YT)(e,"x","dropout");if(d.vA("float32"===r.dtype,()=>`x has to be a floating point tensor since it's going to be scaled, but got a ${r.dtype} tensor instead.`),d.vA(t>=0&&t<1,()=>`rate must be a float in the range [0, 1), but got ${t}.`),0===t)return e instanceof lt.qY?r.clone():r;const s=
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){if(null==t)return e.shape.slice();if(d.r1(e.shape,t))return t;if(e.shape.length===t.length){const n=[];for(let i=0;i<e.shape.length;i++)null==t[i]&&null!=e.shape[i]?n.push(e.shape[i]):n.push(t[i]);return n}return t}(r,n),o=1-t,l=(0,fe.y)((0,Oe.R)((0,a.W)(Ht(s,0,1,"float32",i),o)),o);return(0,M.l)(r,l)}});
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function di(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function hi(e,t,n){const i=1-e%2,r=new Float32Array(e);for(let s=0;s<e;++s){const o=2*Math.PI*s/(e+i-1);r[s]=t-n*Math.cos(o)}return Ln(r,"float32")}const pi=
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
async function(e,t,n=1){const i=(0,c.YT)(e,"predictions","inTopK"),r=(0,c.YT)(t,"targets","inTopK");(0,d.vA)(i.rank>1,()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${i.rank}`),(0,d.vA)(i.rank-1===r.rank,()=>`predictions rank should be 1 larger than targets rank, but got predictions rank ${i.rank} and targets rank ${r.rank}`),(0,d.O3)(i.shape.slice(0,i.shape.length-1),r.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");const s=i.shape[i.shape.length-1];(0,d.vA)(n>0&&n<=s,()=>`'k' passed to inTopK() must be > 0 && <= the predictions last dimension (${s}), but got ${n}`);const o=await i.data(),a=await r.data(),[l,u]=[o.length/s,s],h=(0,d.ce)("bool",l);for(let e=0;e<l;e++){const t=e*u,i=o.subarray(t,t+u),r=[];for(let e=0;e<i.length;e++)r.push({value:i[e],index:e});r.sort((e,t)=>t.value-e.value),h[e]=0;for(let t=0;t<n;t++)if(r[t].index===a[e]){h[e]=1;break}}return e!==i&&i.dispose(),t!==r&&r.dispose(),(0,Dn.O)(h,r.shape,"bool")};var fi=n(31830),mi=n(62198),gi=n(25248),yi=n(80252),_i=n(68646);const vi=(0,h.op)({fusedConv2d_:
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function({x:e,filter:t,strides:n,pad:i,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:o,bias:h,activation:p="linear",preluActivationWeights:f,leakyreluAlpha:m}){if(p=p||"linear",!1===(0,_i.zE)(l.T2.state.gradientDepth,p)){d.vA("NHWC"===r,()=>`Error in fused conv2d: got dataFormat of ${r} but only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.`);let l=(0,ee.X)(e,t,n,i,r,s,o);return null!=h&&(l=(0,a.W)(l,h)),(0,_i.f2)(l,p,f,m)}const g=(0,c.YT)(e,"x","conv2d","float32"),y=(0,c.YT)(t,"filter","conv2d","float32");let _=g,v=!1;3===g.rank&&(v=!0,_=(0,A.t)(g,[1,g.shape[0],g.shape[1],g.shape[2]])),d.vA(4===_.rank,()=>`Error in fused conv2d: input must be rank 4, but got rank ${_.rank}.`),d.vA(4===y.rank,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${y.rank}.`),I.s_("fused conv2d",i,o);const b="NHWC"===r?_.shape[3]:_.shape[1];d.vA(y.shape[2]===b,()=>`Error in conv2d: depth of input (${b}) must match input depth for filter ${y.shape[2]}.`),d.vA(I.G0(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`);const T=I.uf(_.shape,y.shape,n,s,i,o);let x,E;if(null!=h&&(x=(0,c.YT)(h,"bias","fused conv2d"),[x]=(0,si.makeTypesMatch)(x,g),"NHWC"===r?mi.assertAndGetBroadcastShape(T.outShape,x.shape):(d.vA(x.shape.length<=1,()=>`Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of rank-${x.shape.length}.`),d.vA(0===x.shape.length||x.shape[0]===T.outChannels||1===x.shape[0],()=>`Error in fused conv2d: bias shape (${x.shape}) is not compatible with the number of output channels (${T.outChannels})`))),null!=f){const e=f.shape;if(d.vA(e.length<=1||3===e.length,()=>`Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of rank-${e.length}.`),1===e.length)d.vA(1===e[0]||e[0]===T.outChannels,()=>`Error in fused conv2d: PReLU activation weights (${e}) is not compatible with the number of output channels (${T.outChannels}).`);else if(3===e.length)try{mi.assertAndGetBroadcastShape(e,T.outShape)}catch(t){const n=`Error in fused conv2d: PReLU activation weights (${e}) is not compatible with the output shape of the conv2d (${T.outShape}).`;throw Error(n)}E=(0,c.YT)(f,"prelu weights","fused conv2d")}const w=(e,t)=>{d.vA("NHWC"===r,()=>`Error in gradient of fused conv2D: got dataFormat of ${r} but only NHWC is currently supported.`);const[o,a,l,u]=t,c=(0,_i.XB)(e,l,p);d.vA(I.Dh(s),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`);const h=[(0,yi.v)(a.shape,c,o,n,i),(0,gi.H)(a,c,o.shape,n,i)];if(null!=u){const e=(0,_i.Do)(u,c);h.push(e)}return h},S={x:_,filter:y,bias:x,preluActivationWeights:E},C={strides:n,pad:i,dataFormat:r,dilations:s,dimRoundingMode:o,activation:p,leakyreluAlpha:m};if(null==h){const e=(0,fi._X)((e,t,n)=>{let i=l.T2.runKernel(u.aAr,S,C);return n([t,e,i]),v&&(i=(0,A.t)(i,[i.shape[1],i.shape[2],i.shape[3]])),{value:i,gradFunc:w}});return e(_,y)}{const e=(0,fi._X)((e,t,n,i)=>{let r=l.T2.runKernel(u.aAr,S,C);return i([t,e,r,n]),v&&(r=(0,A.t)(r,[r.shape[1],r.shape[2],r.shape[3]])),{value:r,gradFunc:w}});return e(_,y,x)}}});var bi=n(41890),Ti=n(83134);const xi=(0,h.op)({fusedDepthwiseConv2d_:
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function({x:e,filter:t,strides:n,pad:i,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:o,bias:h,activation:p="linear",preluActivationWeights:f,leakyreluAlpha:m}){if(!1===(0,_i.zE)(l.T2.state.gradientDepth,p)){let l=(0,de.G)(e,t,n,i,r,s,o);return null!=h&&(l=(0,a.W)(l,h)),(0,_i.f2)(l,p,f,m)}const g=(0,c.YT)(e,"x","depthwiseConv2d","float32"),y=(0,c.YT)(t,"filter","depthwiseConv2d","float32");let _=g,v=!1;3===g.rank&&(v=!0,_=(0,A.t)(g,[1,g.shape[0],g.shape[1],g.shape[2]])),d.vA(4===_.rank,()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${_.rank}.`),d.vA(4===y.rank,()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${y.rank}.`),d.vA(_.shape[3]===y.shape[2],()=>`Error in fused depthwiseConv2d: number of input channels (${_.shape[3]}) must match the inChannels dimension in filter ${y.shape[2]}.`),null==s&&(s=[1,1]),d.vA(I.G0(n,s),()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),I.s_("fused depthwiseConv2d",i,o);const b=I.uf(_.shape,y.shape,n,s,i,o,!0);let T,x;null!=h&&(T=(0,c.YT)(h,"bias","fused conv2d"),[T]=(0,si.makeTypesMatch)(T,g),mi.assertAndGetBroadcastShape(b.outShape,T.shape)),null!=f&&(x=(0,c.YT)(f,"prelu weights","fused depthwiseConv2d"));const E=(e,t)=>{d.vA(I.Dh(s),()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${s}'`);const[r,a,l,u]=t,c=(0,_i.XB)(e,l,p),h=(0,Ti.l)(a.shape,c,r,n,i,s,o),f=(0,bi.x)(a,c,r.shape,n,i,s,o);if(null!=u){return[h,f,(0,_i.Do)(T,c)]}return[h,f]},w={x:_,filter:y,bias:T,preluActivationWeights:x},S={strides:n,pad:i,dataFormat:r,dilations:s,dimRoundingMode:o,activation:p,leakyreluAlpha:m};if(null==h){const e=(0,fi._X)((e,t,n)=>{let i=l.T2.runKernel(u.T7M,w,S);return n([t,e,i]),v&&(i=(0,A.t)(i,[i.shape[1],i.shape[2],i.shape[3]])),{value:i,gradFunc:E}});return e(_,y)}{const e=(0,fi._X)((e,t,n,i)=>{let r=l.T2.runKernel(u.T7M,w,S);return i([t,e,r,n]),v&&(r=(0,A.t)(r,[r.shape[1],r.shape[2],r.shape[3]])),{value:r,gradFunc:E}});return e(_,y,T)}}});const Ei=(0,h.op)({fusedMatMul_:
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function({a:e,b:t,transposeA:n=!1,transposeB:i=!1,bias:r,activation:s="linear",preluActivationWeights:o,leakyreluAlpha:h=.2}){if(!1===(0,_i.zE)(l.T2.state.gradientDepth,s)){let l=(0,O.N)(e,t,n,i);return null!=r&&(l=(0,a.W)(l,r)),(0,_i.f2)(l,s,o,h)}let p=(0,c.YT)(e,"a","fused matMul"),f=(0,c.YT)(t,"b","fused matMul");[p,f]=(0,si.makeTypesMatch)(p,f);const m=n?p.shape[p.rank-2]:p.shape[p.rank-1],g=i?f.shape[f.rank-1]:f.shape[f.rank-2],y=n?p.shape[p.rank-1]:p.shape[p.rank-2],_=i?f.shape[f.rank-2]:f.shape[f.rank-1],v=p.shape.slice(0,-2),b=f.shape.slice(0,-2),T=d.Ze(v),x=d.Ze(b);d.vA(m===g,()=>`Error in fused matMul: inner shapes (${m}) and (${g}) of Tensors with shapes ${p.shape} and ${f.shape} and transposeA=${n} and transposeB=${i} must match.`);const E=mi.assertAndGetBroadcastShape(p.shape.slice(0,-2),f.shape.slice(0,-2)).concat([y,_]),w=n?(0,A.t)(p,[T,m,y]):(0,A.t)(p,[T,y,m]),I=i?(0,A.t)(f,[x,_,g]):(0,A.t)(f,[x,g,_]);let S,C;null!=r&&(S=(0,c.YT)(r,"bias","fused matMul"),[S]=(0,si.makeTypesMatch)(S,p),mi.assertAndGetBroadcastShape(E,S.shape)),null!=o&&(C=(0,c.YT)(o,"prelu weights","fused matMul"));const M=(e,t)=>{const[o,a,l,u]=t,c=(0,_i.XB)((0,A.t)(e,l.shape),l,s);let d,h;if(n||i?!n&&i?(d=(0,O.N)(c,a,!1,!1),h=(0,O.N)(c,o,!0,!1)):n&&!i?(d=(0,O.N)(a,c,!1,!0),h=(0,O.N)(o,c,!1,!1)):(d=(0,O.N)(a,c,!0,!0),h=(0,O.N)(c,o,!0,!0)):(d=(0,O.N)(c,a,!1,!0),h=(0,O.N)(o,c,!0,!1)),null!=r){return[d,h,(0,_i.Do)(u,c)]}return[d,h]},R={a:w,b:I,bias:S,preluActivationWeights:C},k={transposeA:n,transposeB:i,activation:s,leakyreluAlpha:h};if(null==r){const e=(0,fi._X)((e,t,n)=>{const i=l.T2.runKernel(u.Dr,R,k);return n([e,t,i]),{value:(0,A.t)(i,E),gradFunc:M}});return e(w,I)}{const e=(0,fi._X)((e,t,n,i)=>{const r=l.T2.runKernel(u.Dr,R,k);return i([e,t,r,n]),{value:(0,A.t)(r,E),gradFunc:M}});return e(w,I,S)}}});const wi=(0,h.op)({hammingWindow_:
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){return hi(e,.54,.46)}});const Ii=(0,h.op)({hannWindow_:
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){return hi(e,.5,.5)}});const Ai=(0,h.op)({frame_:
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=!1,r=0){let s=0;const o=[];for(;s+t<=e.size;)o.push((0,k.d)(e,s,t)),s+=n;if(i)for(;s<e.size;){const i=s+t-e.size,a=(0,C.x)([(0,k.d)(e,s,t-i),(0,Ce.G)([i],r)]);o.push(a),s+=n}return 0===o.length?Pn([],[0,t]):(0,A.t)((0,C.x)(o),[o.length,t])}});const Si=(0,h.op)({stft_:
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r=Ii){null==i&&(i=di(t));const s=Ai(e,t,n),o=(0,M.l)(s,r(t));return(0,wn.z)(o,i)}});const Ci=(0,h.op)({cropAndResize_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r="bilinear",s=0){const o=(0,c.YT)(e,"image","cropAndResize"),a=(0,c.YT)(t,"boxes","cropAndResize","float32"),h=(0,c.YT)(n,"boxInd","cropAndResize","int32"),p=a.shape[0];d.vA(4===o.rank,()=>`Error in cropAndResize: image must be rank 4,but got rank ${o.rank}.`),d.vA(2===a.rank&&4===a.shape[1],()=>`Error in cropAndResize: boxes must be have size [${p},4] but had shape ${a.shape}.`),d.vA(1===h.rank&&h.shape[0]===p,()=>`Error in cropAndResize: boxInd must be have size [${p}] but had shape ${a.shape}.`),d.vA(2===i.length,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${i.length}.`),d.vA(i[0]>=1&&i[1]>=1,()=>`cropSize must be atleast [1,1], but was ${i}`),d.vA("bilinear"===r||"nearest"===r,()=>`method must be bilinear or nearest, but was ${r}`);const f={image:o,boxes:a,boxInd:h},m={method:r,extrapolationValue:s,cropSize:i};return l.T2.runKernel(u.MRQ,f,m)}});const Oi=(0,h.op)({flipLeftRight_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t=(0,c.YT)(e,"image","flipLeftRight","float32");d.vA(4===t.rank,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`);const n={image:t};return l.T2.runKernel(u.BxF,n,{})}});const Mi=(0,h.op)({grayscaleToRGB_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t=(0,c.YT)(e,"image","grayscaleToRGB"),n=t.rank-1,i=t.shape[n];d.vA(t.rank>=2,()=>`Error in grayscaleToRGB: images must be at least rank 2, but got rank ${t.rank}.`),d.vA(1===i,()=>`Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${i}.`);const r=new Array(t.rank);return r.fill(1,0,n),r[n]=3,(0,Ae.V)(t,r)}});const Ri=(0,h.op)({rgbToGrayscale_:
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t=(0,c.YT)(e,"image","RGBToGrayscale"),n=t.rank-1,i=t.shape[n];d.vA(t.rank>=2,()=>`Error in RGBToGrayscale: images must be at least rank 2, but got rank ${t.rank}.`),d.vA(3===i,()=>`Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${i}.`);const r=t.dtype,s=(0,w.w)(t,"float32"),o=Ln([.2989,.587,.114]);let a;switch(t.rank){case 2:a=ye("ij,j->i",s,o);break;case 3:a=ye("ijk,k->ij",s,o);break;case 4:a=ye("ijkl,l->ijk",s,o);break;case 5:a=ye("ijklm,m->ijkl",s,o);break;case 6:a=ye("ijklmn,n->ijklm",s,o);break;default:throw new Error("Not a valid tensor rank.")}return a=(0,we.U)(a,-1),(0,w.w)(a,r)}});const ki=(0,h.op)({rotateWithOffset_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=0,i=.5){const r=(0,c.YT)(e,"image","rotateWithOffset","float32");d.vA(4===r.rank,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${r.rank}.`);const s={image:r},o={radians:t,fillValue:n,center:i};return l.T2.runKernel(u.BK4,s,o)}});
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Ni(e,t,n,i,r,s){null==i&&(i=.5),null==r&&(r=Number.NEGATIVE_INFINITY),null==s&&(s=0);const o=e.shape[0];return n=Math.min(n,o),d.vA(0<=i&&i<=1,()=>`iouThreshold must be in [0, 1], but was '${i}'`),d.vA(2===e.rank,()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`),d.vA(4===e.shape[1],()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`),d.vA(1===t.rank,()=>"scores must be a 1D tensor"),d.vA(t.shape[0]===o,()=>`scores has incompatible shape with boxes. Expected ${o}, but was ${t.shape[0]}`),d.vA(0<=s&&s<=1,()=>`softNmsSigma must be in [0, 1], but was '${s}'`),{maxOutputSize:n,iouThreshold:i,scoreThreshold:r,softNmsSigma:s}}const Di=(0,h.op)({nonMaxSuppression_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=.5,r=Number.NEGATIVE_INFINITY){const s=(0,c.YT)(e,"boxes","nonMaxSuppression","float32"),o=(0,c.YT)(t,"scores","nonMaxSuppression","float32"),a=Ni(s,o,n,i,r),d={maxOutputSize:n=a.maxOutputSize,iouThreshold:i=a.iouThreshold,scoreThreshold:r=a.scoreThreshold};return l.T2.runKernel(u.SDM,{boxes:s,scores:o},d)}});var Fi=n(8360);const Li=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
async function(e,t,n,i=.5,r=Number.NEGATIVE_INFINITY){const s=(0,c.YT)(e,"boxes","nonMaxSuppressionAsync"),o=(0,c.YT)(t,"scores","nonMaxSuppressionAsync"),a=Ni(s,o,n,i,r);n=a.maxOutputSize,i=a.iouThreshold,r=a.scoreThreshold;const l=await Promise.all([s.data(),o.data()]),u=l[0],d=l[1],{selectedIndices:h}=(0,Fi.c7)(u,d,n,i,r);return s!==e&&s.dispose(),o!==t&&o.dispose(),Ln(h,"int32")};const Pi=(0,h.op)({nonMaxSuppressionWithScore_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=.5,r=Number.NEGATIVE_INFINITY,s=0){const o=(0,c.YT)(e,"boxes","nonMaxSuppression"),a=(0,c.YT)(t,"scores","nonMaxSuppression"),d=Ni(o,a,n,i,r,s),h={boxes:o,scores:a},p={maxOutputSize:n=d.maxOutputSize,iouThreshold:i=d.iouThreshold,scoreThreshold:r=d.scoreThreshold,softNmsSigma:s=d.softNmsSigma},f=l.T2.runKernel(u.e0f,h,p);return{selectedIndices:f[0],selectedScores:f[1]}}});const Bi=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
async function(e,t,n,i=.5,r=Number.NEGATIVE_INFINITY,s=0){const o=(0,c.YT)(e,"boxes","nonMaxSuppressionAsync"),a=(0,c.YT)(t,"scores","nonMaxSuppressionAsync"),l=Ni(o,a,n,i,r,s);n=l.maxOutputSize,i=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;const u=await Promise.all([o.data(),a.data()]),d=u[0],h=u[1],{selectedIndices:p,selectedScores:f}=(0,Fi.ut)(d,h,n,i,r,s);return o!==e&&o.dispose(),a!==t&&a.dispose(),{selectedIndices:Ln(p,"int32"),selectedScores:Ln(f)}};const $i=(0,h.op)({nonMaxSuppressionPadded_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=.5,r=Number.NEGATIVE_INFINITY,s=!1){const o=(0,c.YT)(e,"boxes","nonMaxSuppression"),a=(0,c.YT)(t,"scores","nonMaxSuppression"),d=Ni(o,a,n,i,r,null),h={boxes:o,scores:a},p={maxOutputSize:d.maxOutputSize,iouThreshold:d.iouThreshold,scoreThreshold:d.scoreThreshold,padToMaxOutputSize:s},f=l.T2.runKernel(u.Zl4,h,p);return{selectedIndices:f[0],validOutputs:f[1]}}});const Ui=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
async function(e,t,n,i=.5,r=Number.NEGATIVE_INFINITY,s=!1){const o=(0,c.YT)(e,"boxes","nonMaxSuppressionAsync"),a=(0,c.YT)(t,"scores","nonMaxSuppressionAsync"),l=Ni(o,a,n,i,r,null),u=l.maxOutputSize,d=l.iouThreshold,h=l.scoreThreshold,[p,f]=await Promise.all([o.data(),a.data()]),{selectedIndices:m,validOutputs:g}=(0,Fi.ZS)(p,f,u,d,h,s);return o!==e&&o.dispose(),a!==t&&a.dispose(),{selectedIndices:Ln(m,"int32"),validOutputs:(0,an.d)(g,"int32")}};var zi=n(44711),Vi=n(42954);const ji=(0,h.op)({threshold_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t="binary",n=!1,i=.5){const r=(0,c.YT)(e,"image","threshold"),s=r.shape[0]*r.shape[1];let o,l,u,h,p=(0,M.l)(Ln([i]),255);if(d.vA(3===r.rank,()=>`Error in threshold: image must be rank 3,but got rank ${r.rank}.`),d.vA(3===r.shape[2]||1===r.shape[2],()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${r.shape[2]}.`),d.vA("int32"===r.dtype||"float32"===r.dtype,()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${r.dtype}.`),d.vA("otsu"===t||"binary"===t,()=>`Method must be binary or otsu, but was ${t}`),3===r.shape[2]){[o,l,u]=(0,In.l)(r,[1,1,1],-1);const e=(0,M.l)(o,.2989),t=(0,M.l)(l,.587),n=(0,M.l)(u,.114);h=(0,a.W)((0,a.W)(e,t),n)}else h=e;if("otsu"===t){p=function(e,t){let n,i,r,s,o,l,u=Ln([-1]),c=Ln([0]),d=Ln([0]);for(let h=0;h<e.size-1;h++){n=(0,k.d)(e,0,h+1),i=(0,k.d)(e,h+1),o=(0,fe.y)((0,kn.c)(n),t),l=(0,fe.y)((0,kn.c)(i),t);const p=(0,kn.c)((0,M.l)(n,Xt(0,n.size)));r=(0,fe.y)(p,(0,kn.c)(n));const f=(0,Ce.G)(i.shape,n.size),m=(0,a.W)(Xt(0,i.size),f),g=(0,M.l)(i,m);s=(0,fe.y)((0,kn.c)(g),(0,kn.c)(i));const y=(0,gt.j)(r,s),_=(0,gt.j)(r,s),v=(0,M.l)(o,l);d=(0,M.l)((0,M.l)(v,y),_);const b=(0,ke.r)(d,c);c=(0,Zn._)(b,d,c),u=(0,Zn._)(b,Ln([h]),u)}return u}(U((0,w.w)((0,sn.L)(h),"int32"),(0,Dn.O)([]),256),s)}const f=n?(0,Ue.I)(h,p):(0,ke.r)(h,p);return(0,w.w)((0,M.l)(f,255),"int32")}});const Yi=(0,h.op)({transform_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n="nearest",i="constant",r=0,s){const o=(0,c.YT)(e,"image","transform","float32"),a=(0,c.YT)(t,"transforms","transform","float32");d.vA(4===o.rank,()=>`Error in transform: image must be rank 4,but got rank ${o.rank}.`),d.vA(2===a.rank&&(a.shape[0]===o.shape[0]||1===a.shape[0])&&8===a.shape[1],()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),d.vA(null==s||2===s.length,()=>`Error in transform: outputShape must be [height, width] or null, but got ${s}.`);const h={image:o,transforms:a},p={interpolation:n,fillMode:i,fillValue:r,outputShape:s};return l.T2.runKernel(u.dLy,h,p)}});const Gi=(0,h.op)({bandPart_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"a","bandPart");(0,d.vA)(i.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${i.rank}.`);const r=i.shape,[s,o]=i.shape.slice(-2);let a,l;"number"==typeof t?((0,d.vA)(t%1==0,()=>`bandPart(): numLower must be an integer, got ${t}.`),(0,d.vA)(t<=s,()=>`bandPart(): numLower (${t}) must not be greater than the number of rows (${s}).`),a=(0,c.YT)(t<0?s:t,"numLower","bandPart")):((0,d.vA)("int32"===t.dtype,()=>"bandPart(): numLower's dtype must be an int32."),a=(0,Zn._)((0,$e.M)(t,0),s,(0,dt.B)(t,s))),"number"==typeof n?((0,d.vA)(n%1==0,()=>`bandPart(): numUpper must be an integer, got ${n}.`),(0,d.vA)(n<=o,()=>`bandPart(): numUpper (${n}) must not be greater than the number of columns (${o}).`),l=(0,c.YT)(n<0?o:n,"numUpper","bandPart")):((0,d.vA)("int32"===n.dtype,()=>"bandPart(): numUpper's dtype must be an int32."),l=(0,Zn._)((0,$e.M)(n,0),o,(0,dt.B)(n,o)));const u=(0,A.t)(Xt(0,s,1,"int32"),[-1,1]),h=Xt(0,o,1,"int32"),p=(0,gt.j)(u,h),f=(0,Xe.n)((0,Ue.I)(p,a),(0,Ne.D)(p,(0,bt.H)(l))),m=(0,ei.U)([s,o],i.dtype);return(0,A.t)((0,On.t)((0,Xn.K)((0,A.t)(i,[-1,s,o])).map(e=>(0,Zn._)(f,e,m))),r)}});const Hi=(0,h.op)({gramSchmidt_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){let t;if(Array.isArray(e)){t=!1,(0,d.vA)(null!=e&&e.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");const n=e[0].shape[0];for(let t=1;t<e.length;++t)(0,d.vA)(e[t].shape[0]===n,()=>`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[t].shape[0]} vs. ${n})`)}else t=!0,e=(0,In.l)(e,e.shape[0],0).map(e=>(0,Cn.r)(e,[0]));(0,d.vA)(e.length<=e[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`);const n=[],i=e;for(let t=0;t<e.length;++t)n.push(l.T2.tidy(()=>{let e=i[t];if(t>0)for(let i=0;i<t;++i){const t=(0,M.l)((0,kn.c)((0,M.l)(n[i],e)),n[i]);e=(0,gt.j)(e,t)}return(0,fe.y)(e,(0,ri.x)(e,"euclidean"))}));return t?(0,On.t)(n,0):n}});var Wi=n(35287);function Xi(e,t=!1){return l.T2.tidy(()=>{(0,d.vA)(2===e.shape.length,()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`);const n=e.shape[0],i=e.shape[1];let r=Se(n),s=(0,W.o)(e);const o=Pn([[1]],[1,1]);let a=(0,W.o)(o);const u=n>=i?i:n;for(let e=0;e<u;++e){const t=s,u=a,c=r;[a,s,r]=l.T2.tidy(()=>{const t=(0,k.d)(s,[e,e],[n-e,1]),l=(0,ri.x)(t),u=(0,k.d)(s,[e,e],[1,1]),c=(0,Zn._)((0,ke.r)(u,0),Pn([[-1]]),Pn([[1]])),d=(0,gt.j)(u,(0,M.l)(c,l)),h=(0,fe.y)(t,d);a=1===h.shape[0]?(0,W.o)(o):(0,C.x)([o,(0,k.d)(h,[1,0],[h.shape[0]-1,h.shape[1]])],0);const p=(0,bt.H)((0,fe.y)((0,O.N)(c,d),l)),f=(0,k.d)(s,[e,0],[n-e,i]),m=(0,M.l)(p,a),g=(0,ii.m)(a);if(0===e)s=(0,gt.j)(f,(0,O.N)(m,(0,O.N)(g,f)));else{const t=(0,gt.j)(f,(0,O.N)(m,(0,O.N)(g,f)));s=(0,C.x)([(0,k.d)(s,[0,0],[e,i]),t],0)}const y=(0,ii.m)(m),_=(0,k.d)(r,[0,e],[n,r.shape[1]-e]);if(0===e)r=(0,gt.j)(_,(0,O.N)((0,O.N)(_,a),y));else{const t=(0,gt.j)(_,(0,O.N)((0,O.N)(_,a),y));r=(0,C.x)([(0,k.d)(r,[0,0],[n,e]),t],1)}return[a,s,r]}),(0,Wi.AS)([t,u,c])}return!t&&n>i&&(r=(0,k.d)(r,[0,0],[n,i]),s=(0,k.d)(s,[0,0],[i,i])),[r,s]})}const qi=(0,h.op)({qr_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=!1){if((0,d.vA)(e.rank>=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`),2===e.rank)return Xi(e,t);{const n=e.shape.slice(0,e.shape.length-2).reduce((e,t)=>e*t),i=(0,Xn.K)((0,A.t)(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),r=[],s=[];i.forEach(e=>{const[n,i]=Xi(e,t);r.push(n),s.push(i)});return[(0,A.t)((0,On.t)(r,0),e.shape),(0,A.t)((0,On.t)(s,0),e.shape)]}}});var Ki=n(27084);const Zi=(0,h.op)({computeWeightedLoss_:function(e,t,n=Ki.i.SUM_BY_NONZERO_WEIGHTS){const i=(0,c.YT)(e,"losses","computeWeightedLoss");let r=null;null!=t&&(r=(0,c.YT)(t,"weights","computeWeightedLoss"));const s=null==r?i:(0,M.l)(i,r);if(n===Ki.i.NONE)return s;if(n===Ki.i.SUM)return(0,kn.c)(s);if(n===Ki.i.MEAN){if(null==r)return(0,ot.i)(s);{const e=i.size/r.size,t=(0,fe.y)((0,kn.c)(s),(0,kn.c)(r));return e>1?(0,fe.y)(t,(0,an.d)(e)):t}}if(n===Ki.i.SUM_BY_NONZERO_WEIGHTS){if(null==r)return(0,fe.y)((0,kn.c)(s),(0,an.d)(i.size));{const e=(0,M.l)(r,(0,at.S)(i.shape)),t=(0,w.w)((0,kn.c)((0,Tt.E)(e,(0,an.d)(0))),"float32");return(0,fe.y)((0,kn.c)(s),t)}}throw Error(`Unknown reduction: ${n}`)}});const Qi=(0,h.op)({absoluteDifference_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=Ki.i.SUM_BY_NONZERO_WEIGHTS){const s=(0,c.YT)(e,"labels","absoluteDifference"),o=(0,c.YT)(t,"predictions","absoluteDifference");let a=null;null!=n&&(a=(0,c.YT)(n,"weights","absoluteDifference")),(0,d.O3)(s.shape,o.shape,"Error in absoluteDifference: ");const l=(0,r.t)((0,gt.j)(s,o));return Zi(l,a,i)}});const Ji=(0,h.op)({cosineDistance_:function(e,t,n,i,r=Ki.i.SUM_BY_NONZERO_WEIGHTS){const s=(0,c.YT)(e,"labels","cosineDistance"),o=(0,c.YT)(t,"predictions","cosineDistance");let a=null;null!=i&&(a=(0,c.YT)(i,"weights","cosineDistance")),(0,d.O3)(s.shape,o.shape,"Error in cosineDistance: ");const l=(0,an.d)(1),u=(0,gt.j)(l,(0,kn.c)((0,M.l)(s,o),n,!0));return Zi(u,a,r)}});const er=(0,h.op)({hingeLoss_:function(e,t,n,i=Ki.i.SUM_BY_NONZERO_WEIGHTS){let r=(0,c.YT)(e,"labels","hingeLoss");const s=(0,c.YT)(t,"predictions","hingeLoss");let o=null;null!=n&&(o=(0,c.YT)(n,"weights","hingeLoss")),(0,d.O3)(r.shape,s.shape,"Error in hingeLoss: ");const a=(0,an.d)(1);r=(0,gt.j)((0,M.l)((0,an.d)(2),r),a);const l=(0,Zt.V)((0,gt.j)(a,(0,M.l)(r,s)));return Zi(l,o,i)}});const tr=(0,h.op)({huberLoss_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=1,s=Ki.i.SUM_BY_NONZERO_WEIGHTS){const o=(0,c.YT)(e,"labels","huberLoss"),l=(0,c.YT)(t,"predictions","huberLoss");let u=null;null!=n&&(u=(0,c.YT)(n,"weights","huberLoss")),(0,d.O3)(o.shape,l.shape,"Error in huberLoss: ");const h=(0,an.d)(i),p=(0,r.t)((0,gt.j)(l,o)),f=(0,dt.B)(p,h),m=(0,gt.j)(p,f),g=(0,a.W)((0,M.l)((0,an.d)(.5),(0,mt.E)(f)),(0,M.l)(h,m));return Zi(g,u,s)}});const nr=(0,h.op)({logLoss_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=1e-7,r=Ki.i.SUM_BY_NONZERO_WEIGHTS){const s=(0,c.YT)(e,"labels","logLoss"),o=(0,c.YT)(t,"predictions","logLoss");let l=null;null!=n&&(l=(0,c.YT)(n,"weights","logLoss")),(0,d.O3)(s.shape,o.shape,"Error in logLoss: ");const u=(0,an.d)(1),h=(0,an.d)(i),p=(0,bt.H)((0,M.l)(s,(0,je.R)((0,a.W)(o,h)))),f=(0,M.l)((0,gt.j)(u,s),(0,je.R)((0,a.W)((0,gt.j)(u,o),h))),m=(0,gt.j)(p,f);return Zi(m,l,r)}});const ir=(0,h.op)({meanSquaredError_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=Ki.i.SUM_BY_NONZERO_WEIGHTS){const r=(0,c.YT)(e,"labels","meanSquaredError"),s=(0,c.YT)(t,"predictions","meanSquaredError");let o=null;null!=n&&(o=(0,c.YT)(n,"weights","meanSquaredError")),(0,d.O3)(r.shape,s.shape,"Error in meanSquaredError: ");const a=(0,Sn.P)(r,s);return Zi(a,o,i)}});const rr=(0,h.op)({sigmoidCrossEntropy_:function(e,t,n,i=0,s=Ki.i.SUM_BY_NONZERO_WEIGHTS){let o=(0,c.YT)(e,"multiClassLabels","sigmoidCrossEntropy");const l=(0,c.YT)(t,"logits","sigmoidCrossEntropy");let u=null;if(null!=n&&(u=(0,c.YT)(n,"weights","sigmoidCrossEntropy")),(0,d.O3)(o.shape,l.shape,"Error in sigmoidCrossEntropy: "),i>0){const e=(0,an.d)(i),t=(0,an.d)(1),n=(0,an.d)(.5);o=(0,a.W)((0,M.l)(o,(0,gt.j)(t,e)),(0,M.l)(n,e))}const h=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,c.YT)(e,"labels","sigmoidCrossEntropyWithLogits"),i=(0,c.YT)(t,"logits","sigmoidCrossEntropyWithLogits");(0,d.O3)(n.shape,i.shape,"Error in sigmoidCrossEntropyWithLogits: ");const s=(0,Zt.V)(i),o=(0,M.l)(i,n),l=(0,Ye.K)((0,Ee.o)((0,bt.H)((0,r.t)(i))));return(0,a.W)((0,gt.j)(s,o),l)}(o,l);return Zi(h,u,s)}});const sr=(0,h.op)({softmaxCrossEntropy_:function(e,t,n,i=0,r=Ki.i.SUM_BY_NONZERO_WEIGHTS){let s=(0,c.YT)(e,"onehotLabels","softmaxCrossEntropy");const o=(0,c.YT)(t,"logits","softmaxCrossEntropy");let l=null;if(null!=n&&(l=(0,c.YT)(n,"weights","softmaxCrossEntropy")),(0,d.O3)(s.shape,o.shape,"Error in softmaxCrossEntropy: "),i>0){const e=(0,an.d)(i),t=(0,an.d)(1),n=(0,an.d)(s.shape[1]);s=(0,a.W)((0,M.l)(s,(0,gt.j)(t,e)),(0,fe.y)(e,n))}const u=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=-1){if(-1===n&&(n=t.rank-1),n!==t.rank-1)throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${t.rank} and dim was ${n}`);const i=(0,fi._X)((e,t,i)=>{const r=(0,We.V)(t,[n],!0),s=(0,gt.j)((0,w.w)(t,"float32"),r);i([e,s]);const o=(0,bt.H)((0,M.l)(s,e));return{value:(0,kn.c)(o,[n]),gradFunc:(e,t)=>{const[i,r]=t,s=(0,ft.SM)(e.shape,[n]);return[(0,M.l)((0,A.t)(e,s),(0,gt.j)((0,w.w)(i,"float32"),(0,Ee.o)(r))),(0,M.l)((0,A.t)(e,s),(0,gt.j)((0,Ee.o)(r),(0,w.w)(i,"float32")))]}}});return i(e,t)}(s,o);return Zi(u,l,r)}});const or=(0,h.op)({sparseFillEmptyRows_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i){const r=(0,c.YT)(e,"indices","sparseFillEmptyRows","int32"),s=(0,c.YT)(t,"values","sparseFillEmptyRows"),o=(0,c.YT)(n,"denseShape","sparseFillEmptyRows","int32"),a=(0,c.YT)(i,"defaultValue","sparseFillEmptyRows",s.dtype);if(2!==r.rank)throw new Error(`Indices should be Tensor2D but received shape\n ${r.shape}`);if(1!==s.rank)throw new Error(`Values should be Tensor1D but received shape ${s.shape}`);if(1!==o.rank)throw new Error(`Dense shape should be Tensor1D but received shape ${o.shape}`);if(0!==a.rank)throw new Error(`Default value should be a scalar but received shape ${a.shape}`);const d={indices:r,values:s,denseShape:o,defaultValue:a},h=l.T2.runKernel(u.C8s,d);return{outputIndices:h[0],outputValues:h[1],emptyRowIndicator:h[2],reverseIndexMap:h[3]}}});const ar=(0,h.op)({sparseReshape_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"inputIndices","sparseReshape","int32"),r=(0,c.YT)(t,"inputShape","sparseReshape","int32"),s=(0,c.YT)(n,"newShape","sparseReshape","int32");if(2!==i.rank)throw new Error(`Input indices should be Tensor2D but received shape\n ${i.shape}`);if(1!==r.rank)throw new Error(`Input shape should be Tensor1D but received shape ${r.shape}`);if(1!==s.rank)throw new Error(`New shape should be Tensor1D but received shape ${s.shape}`);const o={inputIndices:i,inputShape:r,newShape:s},a=l.T2.runKernel(u.BoJ,o);return{outputIndices:a[0],outputShape:a[1]}}});const lr=(0,h.op)({sparseSegmentMean_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"data","sparseSegmentMean"),r=(0,c.YT)(t,"indices","sparseSegmentMean","int32"),s=(0,c.YT)(n,"segmentIds","sparseSegmentMean","int32");if(i.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==r.rank)throw new Error(`Indices should be Tensor1D but received shape\n ${r.shape}`);if(1!==s.rank)throw new Error(`Segment ids should be Tensor1D but received shape\n ${s.shape}`);const o={data:i,indices:r,segmentIds:s};return l.T2.runKernel(u.L6G,o)}});const ur=(0,h.op)({sparseSegmentSum_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=(0,c.YT)(e,"data","sparseSegmentSum"),r=(0,c.YT)(t,"indices","sparseSegmentSum","int32"),s=(0,c.YT)(n,"segmentIds","sparseSegmentSum","int32");if(i.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==r.rank)throw new Error(`Indices should be Tensor1D but received shape\n ${r.shape}`);if(1!==s.rank)throw new Error(`Segment ids should be Tensor1D but received shape\n ${s.shape}`);const o={data:i,indices:r,segmentIds:s};return l.T2.runKernel(u.DvZ,o)}});const cr=(0,h.op)({stringNGrams_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r,s,o,a){const d=(0,c.YT)(e,"data","stringNGrams","string");if("string"!==d.dtype)throw new Error("Data must be of datatype string");if(1!==d.shape.length)throw new Error(`Data must be a vector, saw: ${d.shape}`);const h=(0,c.YT)(t,"dataSplits","stringNGrams");if("int32"!==h.dtype)throw new Error("Data splits must be of datatype int32");const p={separator:n,nGramWidths:i,leftPad:r,rightPad:s,padWidth:o,preserveShortSequences:a},f={data:d,dataSplits:h},m=l.T2.runKernel(u.YAb,f,p);return{nGrams:m[0],nGramsSplits:m[1]}}});const dr=(0,h.op)({stringSplit_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=!0){const i=(0,c.YT)(e,"input","stringSplit","string"),r=(0,c.YT)(t,"delimiter","stringSplit","string");if(1!==i.rank)throw new Error(`Input should be Tensor1D but received shape ${i.shape}`);if(0!==r.rank)throw new Error(`Delimiter should be a scalar but received shape ${r.shape}`);const s={skipEmpty:n},o={input:i,delimiter:r},a=l.T2.runKernel(u.iW0,o,s);return{indices:a[0],values:a[1],shape:a[2]}}});const hr=(0,h.op)({stringToHashBucketFast_:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,c.YT)(e,"input","stringToHashBucketFast","string"),i={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");const r={input:n};return l.T2.runKernel(u.$jE,r,i)}});const pr=(0,h.op)({staticRegexReplace_:
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=!0){const r=(0,c.YT)(e,"input","staticRegexReplace","string"),s={pattern:t,rewrite:n,replaceGlobal:i};return l.T2.runKernel(u.GZp,{x:r},s)}}),fr={fft:Tn.h,ifft:xn.K,rfft:wn.z,irfft:En.g},mr={hammingWindow:wi,hannWindow:Ii,frame:Ai,stft:Si},gr={flipLeftRight:Oi,grayscaleToRGB:Mi,resizeNearestNeighbor:Vi.b,resizeBilinear:zi.v,rgbToGrayscale:Ri,rotateWithOffset:ki,cropAndResize:Ci,nonMaxSuppression:Di,nonMaxSuppressionAsync:Li,nonMaxSuppressionWithScore:Pi,nonMaxSuppressionWithScoreAsync:Bi,nonMaxSuppressionPadded:$i,nonMaxSuppressionPaddedAsync:Ui,threshold:ji,transform:Yi},yr={bandPart:Gi,gramSchmidt:Hi,qr:qi},_r={absoluteDifference:Qi,computeWeightedLoss:Zi,cosineDistance:Ji,hingeLoss:er,huberLoss:tr,logLoss:nr,meanSquaredError:ir,sigmoidCrossEntropy:rr,softmaxCrossEntropy:sr},vr={sparseFillEmptyRows:or,sparseReshape:ar,sparseSegmentMean:lr,sparseSegmentSum:ur},br={stringNGrams:cr,stringSplit:dr,stringToHashBucketFast:hr,staticRegexReplace:pr}},65661:(e,t,n)=>{"use strict";n.d(t,{e:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({pad_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=0){const o=(0,s.YT)(e,"x","pad");if(0===o.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");const a={paddings:t,constantValue:n},l={x:o};return i.T2.runKernel(r.ODT,l,a)}})},17872:(e,t,n)=>{"use strict";n.d(t,{d:()=>h});var i=n(28189),r=n(45119),s=n(53909),o=n(69772),a=n(47195),l=n(86999),u=n(70929),c=n(62302),d=n(10776);const h=(0,u.op)({pool_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,u,h,p,f){null==h&&(h=[1,1]),null==p&&(p=1),0===u&&(u="valid");const m=(0,i.YT)(e,"x","maxPool");let g=m,y=!1;3===m.rank&&(y=!0,g=(0,c.t)(m,[1,m.shape[0],m.shape[1],m.shape[2]])),r.vA(a.G0(p,h),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${p} and dilations '${h}'`);const _=a.E6(g.shape,t,p,h,u),v=[_.dilationHeight,_.dilationWidth];let b;b="same"===u?function(e,t){const n=e.map((e,n)=>e+(e-1)*(t[n]-1)),i=n.map(e=>e-1),r=i.map(e=>Math.floor(e/2)),s=i.map((e,t)=>e-r[t]);return i.map((e,t)=>[r[t],s[t]])}([_.filterHeight,_.filterWidth],v):[[0,0],[0,0]];const T=1===v[0]&&1===v[1],[x,E]=function(e,t,n){const i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=e.concat(i,r),o=t.map((e,t)=>(e-s[t]%e)%e),a=r.map((e,t)=>e+o[t]),l=t.map((e,t)=>[i[t],a[t]]),u=t.map((e,t)=>[0,o[t]]);return[l,u]}([_.inHeight,_.inWidth],v,b),w=T?u:"valid",I=T?g:(0,d.e)(g,v,x),A=("avg"===n?()=>(0,s.$)(I,t,p,w,f):()=>(0,l.j)(I,t,p,w,f))(),S=T?A:(0,o.G)(A,v,E);return y?(0,c.t)(S,[S.shape[1],S.shape[2],S.shape[3]]):S}})},98990:(e,t,n)=>{"use strict";n.d(t,{n:()=>a});var i=n(41585),r=n(15441),s=n(30565),o=n(28189);const a=(0,n(70929).op)({pow_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"base","pow"),a=(0,o.YT)(t,"exp","pow");[n,a]=(0,s.makeTypesMatch)(n,a);const l={a:n,b:a};return i.T2.runKernel(r.pyJ,l)}})},64394:(e,t,n)=>{"use strict";n.d(t,{N:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({prelu_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n={x:(0,s.YT)(e,"x","prelu"),alpha:(0,s.YT)(t,"alpha","prelu")};return i.T2.runKernel(r.Ncv,n)}})},75295:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function i(e,t=!1){console.log(e.toString(t))}n.d(t,{y:()=>i})},67771:(e,t,n)=>{"use strict";n.d(t,{_:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(29809);const a=(0,n(70929).op)({prod_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=null,n=!1){let a=(0,s.YT)(e,"x","prod");"bool"===a.dtype&&(a=(0,o.w)(a,"int32"));const l={x:a},u={axis:t,keepDims:n};return i.T2.runKernel(r.kdj,l,u)}})},1902:(e,t,n)=>{"use strict";n.d(t,{x:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({real_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={input:(0,s.YT)(e,"input","real")};return i.T2.runKernel(r.LRy,t)}})},19870:(e,t,n)=>{"use strict";n.d(t,{V:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({reciprocal_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","reciprocal")};return i.T2.runKernel(r.huO,t)}})},90112:(e,t,n)=>{"use strict";n.d(t,{V:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({relu_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","relu")};return i.T2.runKernel(r.fUj,t)}})},83732:(e,t,n)=>{"use strict";n.d(t,{j:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({relu6_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","relu6")};return i.T2.runKernel(r.P_L,t)}})},62302:(e,t,n)=>{"use strict";n.d(t,{t:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({reshape_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n={x:(0,s.YT)(e,"x","reshape","string_or_numeric")},o={shape:t};return i.T2.runKernel(r.R23,n,o)}})},53262:(e,t,n)=>{"use strict";n.d(t,{B:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({reverse_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n={x:(0,s.YT)(e,"x","reverse")},o={dims:t};return i.T2.runKernel(r.D7i,n,o)}})},25912:(e,t,n)=>{"use strict";n.d(t,{L:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({round_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","round")};return i.T2.runKernel(r.hVg,t)}})},17820:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({rsqrt_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","rsqrt","float32")};return i.T2.runKernel(r.TOR,t)}})},45702:(e,t,n)=>{"use strict";n.d(t,{d:()=>s});var i=n(83879),r=n(19171);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function s(e,t){if(((0,i.isTypedArray)(e)&&"string"!==t||Array.isArray(e))&&"complex64"!==t)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if("string"===t&&(0,i.isTypedArray)(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return(0,r.Q)(e,[],[],t)}},26170:(e,t,n)=>{"use strict";n.r(t),n.d(t,{calculateShapes:()=>o,validateInput:()=>s,validateUpdateShape:()=>r});var i=n(45119);function r(e,t,n){const i=t.rank>1?t.shape[t.rank-1]:1,r=t.rank>1?t.rank-1:1,s=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${i}, and batchDim: ${r}.`;if(n.rank<r)throw new Error(s+` update.rank < ${r}. `);if(e.length<i+(n.rank-r))throw new Error(s+` Output shape length < ${i+(n.rank-r)}`);if(n.rank!==r+e.length-i)throw new Error(s+" update.rank != "+(r+e.length-i));for(let e=0;e<r;++e)if(n.shape[e]!==t.shape[e])throw new Error(s+` updates.shape[${e}] (${n.shape[e]}) != indices.shape[${e}] (${t.shape[e]}).`);for(let t=0;t<n.rank-r;++t)if(n.shape[t+r]!==e[t+i])throw new Error(s+` updates.shape[${t+r}] (${n.shape[t+r]}) != shape[${t+r}] (${e[t+r]})`)}function s(e,t,n){if(t.rank<1)throw new Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);if(e.rank<1)throw new Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${e.rank}.`);if("int32"!==t.dtype)throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${t.dtype}`);if(n.length<1)throw new Error(`Output rank must be greater or equal to 1, but got shape: ${n}`);if(0===n.length){if(0===t.size)throw new Error(`Indices specified for empty output. indices shape: ${t.shape}`);if(0===e.size)throw new Error(`Updates specified for empty output. updates shape: ${e.shape}`)}r(n,t,e)}function o(e,t,n){const r=t.shape.length,s=r>1?t.shape[r-1]:1,o=n.length;let a=1;for(let e=s;e<o;++e)a*=n[e];const l=s<1?1:s;return{sliceRank:s,numUpdates:(0,i.Ze)(t.shape)/l,sliceSize:a,strides:[...(0,i.Ur)(n.slice(0,s)),1],outputSize:(0,i.Ze)(n)}}},26325:(e,t,n)=>{"use strict";n.d(t,{W:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({selu_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","selu")};return i.T2.runKernel(r.u$b,t)}})},28576:(e,t,n)=>{"use strict";n.d(t,{X:()=>r,j:()=>i});
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const i=1.7580993408473768,r=1.0507009873554805},89986:(e,t,n)=>{"use strict";n.d(t,{w:()=>u});var i=n(28189),r=n(45119),s=n(28794),o=n(10676),a=n(70929),l=n(62302);const u=(0,a.op)({separableConv2d_:function(e,t,n,a,u,c=[1,1],d="NHWC"){const h=(0,i.YT)(e,"x","separableConv2d"),p=(0,i.YT)(t,"depthwiseFilter","separableConv2d"),f=(0,i.YT)(n,"pointwiseFilter","separableConv2d");let m=h,g=!1;if(3===h.rank&&(g=!0,m=(0,l.t)(h,[1,h.shape[0],h.shape[1],h.shape[2]])),"NCHW"===d)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");r.vA(4===m.rank,()=>`Error in separableConv2d: input must be rank 4, but got rank ${m.rank}.`),r.vA(4===p.rank,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${p.rank}.`),r.vA(4===f.rank,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${p.rank}.`),r.vA(1===f.shape[0],()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${f.shape[0]}.`),r.vA(1===f.shape[1],()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${f.shape[1]}.`);const y=p.shape[2],_=p.shape[3];r.vA(f.shape[2]===y*_,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${y*_}, but got ${f.shape[2]}.`);const v=(0,o.G)(m,p,a,u,d,c),b=(0,s.X)(v,f,1,"valid",d);return g?(0,l.t)(b,[b.shape[1],b.shape[2],b.shape[3]]):b}})},28968:(e,t,n)=>{"use strict";n.d(t,{r:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({sigmoid_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","sigmoid","float32")};return i.T2.runKernel(r.vI1,t)}})},51115:(e,t,n)=>{"use strict";n.d(t,{_:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({sign_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","sign")};return i.T2.runKernel(r.YVe,t)}})},33726:(e,t,n)=>{"use strict";n.d(t,{F:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({sin_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","sin","float32")};return i.T2.runKernel(r.hql,t)}})},58276:(e,t,n)=>{"use strict";n.d(t,{L:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({sinh_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","sinh")};return i.T2.runKernel(r.J3C,t)}})},17986:(e,t,n)=>{"use strict";n.d(t,{d:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({slice_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const o=(0,s.YT)(e,"x","slice","string_or_numeric");if(0===o.rank)throw new Error("Slicing scalar is not possible");const a={x:o},l={begin:t,size:n};return i.T2.runKernel(r.JiE,a,l)}})},34969:(e,t,n)=>{"use strict";n.r(t),n.d(t,{assertParamsValid:()=>o,computeFlatOffset:()=>v,computeOutShape:()=>l,getNormalizedAxes:()=>h,isSliceContinous:()=>_,maskToAxes:()=>a,parseSliceParams:()=>b,sliceInfo:()=>T,startForAxis:()=>g,startIndicesWithElidedDims:()=>p,stopForAxis:()=>y,stopIndicesWithElidedDims:()=>f,stridesForAxis:()=>m,stridesWithElidedDims:()=>u});var i=n(45119);
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/const r=-2,s=-1;function o(e,t,n){const r=e.shape.length;i.vA(r===t.length,()=>`Error in slice${r}D: Length of begin ${t} must match the rank of the array (${r}).`),i.vA(r===n.length,()=>`Error in slice${r}D: Length of size ${n} must match the rank of the array (${r}).`);for(let s=0;s<r;++s)i.vA(t[s]+n[s]<=e.shape[s],()=>`Error in slice${r}D: begin[${s}] + size[${s}] (${t[s]+n[s]}) would overflow input.shape[${s}] (${e.shape[s]})`)}function a(e){const t=[];let n=0;for(;e>0;)1&e&&t.push(n),e/=2,n++;return t}function l(e,t,n){const i=[];for(let r=0;r<e.length;r++)i[r]=Math.ceil((t[r]-e[r])/n[r]);return i}function u(e,t,n,i){const r=[...e];for(let e=r.length;e<i.length;e++)r.push(1);for(let e=0;e<n;e++)0===e?r[t]=1:(r.splice(t,0,1),r.pop());return r}function c(e,t,n){return n<=e?n:n-(t-1)}function d(e,t){const n=[];for(let i=0;i<e;i++)n.push(t+i);return n}function h(e,t,n,i,r,s,o,a,l){const c=e.length;let d=new Array(c),h=new Array(c),_=new Array(c);if(t.length&&n>0){const l=t[0],c=n+1;d=p(o,l,c,i,e),h=f(a,l,c,r,e),_=u(s,l,c,e)}else for(let t=0;t<c;t++)d[t]=g(o,i,s,e,t,l),h[t]=y(a,r,s,e,t,l),_[t]=m(s,t,l);return{begin:d,end:h,strides:_}}function p(e,t,n,i,r){const s=[...r],o=d(n,t);for(let r=0;r<s.length;r++)if(o.indexOf(r)>-1)s[r]=0;else{const o=c(t,n,r);let a=i[o];e&1<<o&&(a=0),s[r]=a}return s}function f(e,t,n,r,s){const o=[...s],a=d(n,t);for(let i=0;i<o.length;i++)if(a.indexOf(i)>-1)o[i]=Number.MAX_SAFE_INTEGER;else{const s=c(t,n,i);let a=r[s];e&1<<s&&(a=Number.MAX_SAFE_INTEGER),o[i]=a}for(let e=0;e<o.length;e++){const t=s[e];o[e]<0&&(o[e]+=t),o[e]=i.qE(0,o[e],s[e])}return o}function m(e,t,n){let i=e[t];return(n&1<<t||null==i)&&(i=1),i}function g(e,t,n,r,s,o){let a=t[s];const l=n[s]||1;(e&1<<s||o&1<<s||null==a)&&(a=l>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);const u=r[s];return a<0&&(a+=u),a=i.qE(0,a,u-1),a}function y(e,t,n,r,s,o){let a=t[s];const l=n[s]||1;(e&1<<s||o&1<<s||null==a)&&(a=l>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);const u=r[s];return a<0&&(a+=u),a=l>0?i.qE(0,a,u):i.qE(-1,a,u-1),a}function _(e,t,n){let i=n.length;for(let e=0;e<n.length;e++)if(n[e]>1){i=e;break}for(let r=i+1;r<n.length;r++)if(t[r]>0||n[r]!==e[r])return!1;return!0}function v(e,t){let n=e.length>0?e[e.length-1]:1;for(let i=0;i<e.length-1;i++)n+=e[i]*t[i];return n}function b(e,t,n){let r;const s=e.shape.length;let o;return r="number"==typeof t?[t,...new Array(s-1).fill(0)]:t.length<s?t.concat(new Array(s-t.length).fill(0)):t.slice(),r.forEach(e=>{i.vA(-1!==e,()=>"slice() does not support negative begin indexing.")}),o=null==n?new Array(s).fill(-1):"number"==typeof n?[n,...new Array(s-1).fill(-1)]:n.length<s?n.concat(new Array(s-n.length).fill(-1)):n,o=o.map((t,n)=>t>=0?t:(i.vA(-1===t,()=>`Negative size values should be exactly -1 but got ${t} for the slice() size at index ${n}.`),e.shape[n]-r[n])),[r,o]}function T(e,t,n,i,o,a,l,u,c){let d;if(null==i?(d=new Array(t.length),d.fill(1)):d=i,null!=l&&l&l-1)throw new Error("Multiple ellipses in slice is not allowed.");let h=!1;const p={dims:d.length,numAddAxisAfterEllipsis:0,begin:t.slice(),end:n.slice(),strides:d.slice(),beginMask:o,endMask:a,ellipsisMask:l,newAxisMask:u,shrinkAxisMask:c};for(let e=0;e<p.dims;e++)h&&1<<e&u&&p.numAddAxisAfterEllipsis++,1<<e&l&&(h=!0);h||(p.ellipsisMask|=1<<p.dims,p.dims++);const f={dims:e.length,beginMask:0,endMask:0,beginValid:!1,endValid:!1};!function(e,t){t.beginMask=0,t.endMask=0,t.shrinkAxisMask=0;let n=0;t.beginValid=null!=e.begin,t.endValid=null!=e.end,t.begin=new Array(t.dims),t.end=new Array(t.dims),t.strides=new Array(t.dims),t.finalShapeGatherIndices=[],t.finalShapeGatherIndicesSparse=[],t.inputShapeGatherIndicesSparse=new Array(t.dims);for(let i=0;i<e.dims;i++)if(1<<i&e.ellipsisMask){const r=Math.min(t.dims-(e.dims-i)+1+e.numAddAxisAfterEllipsis,t.dims);for(;n<r;n++)t.begin[n]=0,t.end[n]=0,t.strides[n]=1,t.beginMask|=1<<n,t.endMask|=1<<n,t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(-1),t.inputShapeGatherIndicesSparse[n]=i}else if(1<<i&e.newAxisMask)t.finalShapeGatherIndices.push(r),t.finalShapeGatherIndicesSparse.push(-1);else{if(n===t.begin.length)throw Error(`Index out of range using input dim ${n}; input has only ${t.dims} dims, ${t.begin.length}.`);null!=e.begin&&(t.begin[n]=e.begin[i]),null!=e.end&&(t.end[n]=e.end[i]),t.strides[n]=e.strides[i],e.beginMask&1<<i&&(t.beginMask|=1<<n),e.endMask&1<<i&&(t.endMask|=1<<n),e.shrinkAxisMask&1<<i?(t.finalShapeGatherIndices.push(s),t.finalShapeGatherIndicesSparse.push(-1),t.shrinkAxisMask|=1<<n):(t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(i)),t.inputShapeGatherIndicesSparse[n]=i,n++}}(p,f);let m=!0,g=!0,y=!0;const _=[],v=[];for(let t=0;t<e.length;++t){if(0===f.strides[t])throw Error(`strides[${t}] must be non-zero`);const n=!!(f.shrinkAxisMask&1<<t),i=e[t];if(-1===i){_.push(n?1:-1);continue}const r=[f.beginMask&1<<t,f.endMask&1<<t],s=[f.strides[t]>0?0:-1,f.strides[t]>0?i:i-1];if(n&&f.strides[t]<=0)throw Error("only stride 1 allowed on non-range indexing.");y=y&&1===f.strides[t];const o=!!(f.beginMask&1<<t&&f.endMask&1<<t);if(f.beginValid&&f.endValid){if(n){const e=f.begin[t]<0?i+f.begin[t]:f.begin[t];if(f.begin[t]=e,f.end[t]=f.begin[t]+1,e<0||e>=i)throw Error(`slice index ${f.begin[t]} of dimension ${t} out of bounds.`)}else f.begin[t]=x(f.begin[t],0,f.strides[t],i,r,s),f.end[t]=x(f.end[t],1,f.strides[t],i,r,s);const e=1===f.strides[t]&&0===f.begin[t]&&f.end[t]===i;m=m&&e,g=g&&(0===t&&1===f.strides[t]||e)}else m=m&&1===f.strides[t]&&o,g=g&&(0===t&&1===f.strides[t]||o);let a,l=!1;if(f.beginValid&&f.endValid?(a=f.end[t]-f.begin[t],l=!0):n?(a=1,l=!0):o&&i>=0&&(a=f.strides[t]<0?-i:i,l=!0),l){let e;e=0===a||a<0!=f.strides[t]<0?0:Math.trunc(a/f.strides[t])+(a%f.strides[t]!==0?1:0),_.push(e)}else _.push(-1)}for(let e=0;e<f.finalShapeGatherIndices.length;++e){const t=f.finalShapeGatherIndices[e];t>=0?v.push(_[t]):t===r&&v.push(1)}return{finalShapeSparse:v.filter((e,t)=>f.finalShapeGatherIndices[t]!==r),finalShape:v,isIdentity:m,sliceDim0:g,isSimpleSlice:y,begin:f.begin,end:f.end,strides:f.strides}}function x(e,t,n,i,r,s){if(r[t])return n>0?s[t]:s[t+1&1];{const t=e<0?i+e:e;return t<s[0]?s[0]:t>s[1]?s[1]:t}}},26346:(e,t,n)=>{"use strict";n.d(t,{V:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({softmax_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=-1){const n=(0,s.YT)(e,"logits","softmax","float32");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and dim was ${t}`);const o={logits:n},a={dim:t};return i.T2.runKernel(r.rFG,o,a)}})},66030:(e,t,n)=>{"use strict";n.d(t,{l:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({softplus_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","softplus")};return i.T2.runKernel(r.Fin,t)}})},10776:(e,t,n)=>{"use strict";n.d(t,{e:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({spaceToBatchND_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const a=(0,s.YT)(e,"x","spaceToBatchND");o.vA(a.rank>=1+t.length,()=>`input rank ${a.rank} should be > than [blockShape] ${t.length}`),o.vA(n.length===t.length,()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`),o.vA(a.shape.reduce((e,i,r)=>r>0&&r<=t.length?e&&(i+n[r-1][0]+n[r-1][1])%t[r-1]===0:e,!0),()=>`input spatial dimensions ${a.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`);const l={x:a},u={blockShape:t,paddings:n};return i.T2.runKernel(r.A8B,l,u)}})},41361:(e,t,n)=>{"use strict";n.d(t,{h:()=>o});var i=n(41585),r=n(15441),s=n(45119);const o=(0,n(70929).op)({fft_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){(0,s.vA)("complex64"===e.dtype,()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);const t={input:e};return i.T2.runKernel(r.rGP,t)}})},13108:(e,t,n)=>{"use strict";n.d(t,{K:()=>o});var i=n(41585),r=n(15441),s=n(45119);const o=(0,n(70929).op)({ifft_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){(0,s.vA)("complex64"===e.dtype,()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);const t={input:e};return i.T2.runKernel(r.OAQ,t)}})},22292:(e,t,n)=>{"use strict";n.d(t,{g:()=>f});var i=n(37148),r=n(25030),s=n(35040),o=n(9258),a=n(70929),l=n(1902),u=n(62302),c=n(53262),d=n(45702),h=n(17986),p=n(13108);const f=(0,a.op)({irfft_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t=e.shape[e.shape.length-1],n=e.size/t;let a;if(t<=2){const i=(0,u.t)(e,[n,t]);a=(0,p.K)(i)}else{const f=[n,2*(t-1)],m=(0,u.t)((0,l.x)(e),[n,t]),g=(0,u.t)((0,s.n)(e),[n,t]),y=(0,c.B)((0,h.d)(m,[0,1],[n,t-2]),1),_=(0,o.l)((0,c.B)((0,h.d)(g,[0,1],[n,t-2]),1),(0,d.d)(-1)),v=(0,r.x)([m,y],1),b=(0,r.x)([g,_],1),T=(0,u.t)((0,i.f)(v,b),[f[0],f[1]]);a=(0,p.K)(T)}if(a=(0,l.x)(a),3===e.rank&&0!==e.shape[0]){const t=a,n=e.shape[0];a=(0,u.t)(a,[n,a.shape[0]/n,a.shape[1]]),t.dispose()}return a}})},8775:(e,t,n)=>{"use strict";n.d(t,{z:()=>m});var i=n(45119),r=n(37148),s=n(25030),o=n(35040),a=n(70929),l=n(1902),u=n(62302),c=n(17986),d=n(66512),h=n(42855),p=n(55537),f=n(41361);const m=(0,a.op)({rfft_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){(0,i.vA)("float32"===e.dtype,()=>`The dtype for rfft() must be real value but got ${e.dtype}`);let n=e.shape[e.shape.length-1];const a=e.size/n;let m;if(null!=t&&t<n){const i=e.shape.map(e=>0),r=e.shape.map(e=>e);r[e.shape.length-1]=t,m=(0,c.d)(e,i,r),n=t}else if(null!=t&&t>n){const i=e.shape.map(e=>e);i[e.shape.length-1]=t-n,m=(0,s.x)([e,(0,h.U)(i)],e.shape.length-1),n=t}else m=e;const g=(0,p.P)(m),y=(0,u.t)((0,r.f)(m,g),[a,n]),_=(0,f.h)(y),v=Math.floor(n/2)+1,b=(0,l.x)(_),T=(0,o.n)(_),x=(0,d.l)(b,[v,n-v],b.shape.length-1),E=(0,d.l)(T,[v,n-v],T.shape.length-1),w=m.shape.slice();return w[m.shape.length-1]=v,(0,u.t)((0,r.f)(x[0],E[0]),w)}})},66512:(e,t,n)=>{"use strict";n.d(t,{l:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({split_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n=0){const o={x:(0,s.YT)(e,"x","split")},a={numOrSizeSplits:t,axis:n};return i.T2.runKernel(r.Blb,o,a)}})},79348:(e,t,n)=>{"use strict";n.d(t,{R:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({sqrt_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","sqrt","float32")};return i.T2.runKernel(r.dFH,t)}})},45793:(e,t,n)=>{"use strict";n.d(t,{E:()=>s});var i=n(41585),r=n(28189);const s=(0,n(70929).op)({square_:
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t=(0,r.YT)(e,"x","square");return i.T2.runKernel("Square",{x:t},{})}})},53427:(e,t,n)=>{"use strict";n.d(t,{P:()=>l});var i=n(41585),r=n(15441),s=n(30565),o=n(28189),a=n(62198);const l=(0,n(70929).op)({squaredDifference_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","squaredDifference"),l=(0,o.YT)(t,"b","squaredDifference");[n,l]=(0,s.makeTypesMatch)(n,l),(0,a.assertAndGetBroadcastShape)(n.shape,l.shape);const u={a:n,b:l};return i.T2.runKernel(r.Ddj,u,{})}})},5932:(e,t,n)=>{"use strict";n.d(t,{r:()=>a});var i=n(28189),r=n(45119),s=n(70929),o=n(62302);const a=(0,s.op)({squeeze_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,i.YT)(e,"x","squeeze","string_or_numeric");return(0,o.t)(n,(0,r.gx)(n.shape,t).newShape)}})},54268:(e,t,n)=>{"use strict";n.d(t,{t:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({stack_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0){const n=(0,s.j1)(e,"tensors","stack","string_or_numeric");o.vA(n.length>=1,()=>"Pass at least one tensor to tf.stack"),n.length>0&&o.vA(t<=n[0].rank,()=>"Axis must be <= rank of the tensor");const a=n,l={axis:t};return i.T2.runKernel(r.mM$,a,l)}})},10700:(e,t,n)=>{"use strict";n.d(t,{P:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({step_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0){const n={x:(0,s.YT)(e,"x","step")},o={alpha:t};return i.T2.runKernel(r.pnw,n,o)}})},45894:(e,t,n)=>{"use strict";n.d(t,{Y:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({stridedSlice_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,o,a=0,l=0,u=0,c=0,d=0){const h={x:(0,s.YT)(e,"x","stridedSlice","string_or_numeric")},p={begin:t,end:n,strides:o,beginMask:a,endMask:l,ellipsisMask:u,newAxisMask:c,shrinkAxisMask:d};return i.T2.runKernel(r.UcO,h,p)}})},77126:(e,t,n)=>{"use strict";n.d(t,{j:()=>a});var i=n(41585),r=n(15441),s=n(30565),o=n(28189);const a=(0,n(70929).op)({sub_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){let n=(0,o.YT)(e,"a","sub"),a=(0,o.YT)(t,"b","sub");[n,a]=(0,s.makeTypesMatch)(n,a);const l={a:n,b:a};return i.T2.runKernel(r.PbM,l)}})},83791:(e,t,n)=>{"use strict";n.d(t,{c:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(29809);const a=(0,n(70929).op)({sum_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=null,n=!1){let a=(0,s.YT)(e,"x","sum");"bool"===a.dtype&&(a=(0,o.w)(a,"int32"));const l={x:a},u={axis:t,keepDims:n};return i.T2.runKernel(r.WuN,l,u)}})},77823:(e,t,n)=>{"use strict";n.d(t,{M:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({tan_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","tan","float32")};return i.T2.runKernel(r.oFs,t)}})},57311:(e,t,n)=>{"use strict";n.d(t,{y:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({tanh_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","tanh","float32")};return i.T2.runKernel(r.iuW,t)}})},74027:(e,t,n)=>{"use strict";n.d(t,{O:()=>s});var i=n(28189),r=n(19171);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function s(e,t,n){const s=(0,i.MZ)(e,n);return(0,r.Q)(e,t,s,n)}},42768:(e,t,n)=>{"use strict";n.d(t,{$:()=>o});var i=n(28189),r=n(45119),s=n(19171);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function o(e,t,n){if((0,r.HO)(e),null!=t&&3!==t.length)throw new Error("tensor3d() requires shape to have three numbers");const o=(0,i.MZ)(e,n);if(3!==o.length&&1!==o.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===o.length&&null==t)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return(0,s.Q)(e,t,o,n)}},19171:(e,t,n)=>{"use strict";n.d(t,{Q:()=>a});var i=n(41585),r=n(52046),s=n(45119),o=n(83879);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function a(e,t,n,a){if(null==a)a=(0,s.X$)(e);else if("complex64"===a)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if((0,r.Nw)(e)||(0,r.Oj)(e)){if("float32"!==a&&"int32"!==a)throw new Error(`Creating tensor from GPU data only supports 'float32'|'int32' dtype, while the dtype is ${a}.`);return i.T2.backend.createTensorFromGPUData(e,t||n,a)}if(!(0,o.isTypedArray)(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=t){(0,s.SA)(t);const e=(0,s.Ze)(t),i=(0,s.Ze)(n);(0,s.vA)(e===i,()=>`Based on the provided shape, [${t}], the tensor should have ${e} values but has ${i}`);for(let e=0;e<n.length;++e){const i=n[e],r=e!==n.length-1||i!==(0,s.Ze)(t.slice(e));(0,s.vA)(n[e]===t[e]||!r,()=>`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `)}}return(0,o.isTypedArray)(e)||Array.isArray(e)||(e=[e]),t=t||n,e="string"!==a?(0,o.toTypedArray)(e,a):(0,o.flatten)(e,[],!0),i.T2.makeTensor(e,t,a)}},64826:(e,t,n)=>{"use strict";n.d(t,{V:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({tile_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t){const n=(0,s.YT)(e,"x","tile","string_or_numeric");o.vA(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`);const a={x:n},l={reps:t};return i.T2.runKernel(r.FAs,a,l)}})},21190:(e,t,n)=>{"use strict";n.d(t,{r:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({topk_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=1,n=!0){const o=(0,s.YT)(e,"x","topk");if(0===o.rank)throw new Error("topk() expects the input to be of rank 1 or higher");const a=o.shape[o.shape.length-1];if(t<0)throw new Error(`'k' passed to topk() must be >= 0 but got ${t}`);if(t>a)throw new Error(`'k' passed to topk() must be <= the last dimension (${a}) but got ${t}`);const l={x:o},u={k:t,sorted:n},[c,d]=i.T2.runKernel(r.TBb,l,u);return{values:c,indices:d}}})},7703:(e,t,n)=>{"use strict";n.d(t,{m:()=>p});var i=n(41585),r=n(35287),s=n(15441),o=n(28189),a=n(45119),l=n(37148),u=n(35040),c=n(96522),d=n(70929),h=n(1902);const p=(0,d.op)({transpose_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const d=(0,o.YT)(e,"x","transpose");if(null==t&&(t=d.shape.map((e,t)=>t).reverse()),a.vA(d.rank===t.length,()=>`Error in transpose: rank of input ${d.rank} must match length of perm ${t}.`),t.forEach(e=>{a.vA(e>=0&&e<d.rank,()=>"All entries in 'perm' must be between 0 and "+(d.rank-1)+` but got ${t}`)}),d.rank<=1)return d.clone();const p={x:d},f={perm:t};return"complex64"===d.dtype?(0,r.DZ)(()=>{let e=(0,h.x)(d),t=(0,u.n)(d);return e=i.T2.runKernel(s.wx0,{x:e},f),t=i.T2.runKernel(s.wx0,{x:t},f),n&&(t=(0,c.H)(t)),(0,l.f)(e,t)}):i.T2.runKernel(s.wx0,p,f)}})},73937:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({unique_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0){const n=(0,s.YT)(e,"x","unique","string_or_numeric");(0,o.vA)(n.rank>0,()=>"The input tensor must be at least 1D");const a={x:n},l={axis:t},[u,c]=i.T2.runKernel(r.EwU,a,l);return{values:u,indices:c}}})},97706:(e,t,n)=>{"use strict";n.d(t,{z:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({unsortedSegmentSum_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const a=(0,s.YT)(e,"x","unsortedSegmentSum"),l=(0,s.YT)(t,"segmentIds","unsortedSegmentSum","int32");(0,o.vA)((0,o.E6)(n),()=>"numSegments must be of dtype int");const u={x:a,segmentIds:l},c={numSegments:n};return i.T2.runKernel(r.pPe,u,c)}})},67261:(e,t,n)=>{"use strict";n.d(t,{K:()=>a});var i=n(41585),r=n(15441),s=n(28189),o=n(45119);const a=(0,n(70929).op)({unstack_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t=0){const n=(0,s.YT)(e,"x","unstack","string_or_numeric");o.vA(t>=-n.shape.length&&t<n.shape.length,()=>`Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);const a={value:n},l={axis:t};return i.T2.runKernel(r.dXR,a,l)}})},12151:(e,t,n)=>{"use strict";n.d(t,{_:()=>l});var i=n(41585),r=n(15441),s=n(28189),o=n(63567),a=n(62198);const l=(0,n(70929).op)({where_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const l=(0,s.YT)(t,"a","where"),u=(0,s.YT)(n,"b","where"),c=(0,s.YT)(e,"condition","where","bool"),d=(0,a.assertAndGetBroadcastShape)((0,a.assertAndGetBroadcastShape)(c.shape,l.shape),u.shape),h={condition:(0,o.h)(c,d),t:(0,o.h)(l,d),e:(0,o.h)(u,d)};return i.T2.runKernel(r.l6P,h)}})},42855:(e,t,n)=>{"use strict";n.d(t,{U:()=>o});var i=n(41585),r=n(45119),s=n(37148);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function o(e,t="float32"){if((0,r.SA)(e),"complex64"===t){const t=o(e,"float32"),n=o(e,"float32");return(0,s.f)(t,n)}const n=(0,r.Ty)((0,r.Ze)(e),t);return i.T2.makeTensor(n,e,t)}},55537:(e,t,n)=>{"use strict";n.d(t,{P:()=>o});var i=n(41585),r=n(15441),s=n(28189);const o=(0,n(70929).op)({zerosLike_:
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t={x:(0,s.YT)(e,"x","zerosLike")};return i.T2.runKernel(r.xJ3,t)}})},86448:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function i(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}n.d(t,{Y:()=>i})},20455:(e,t,n)=>{"use strict";var i=n(4888),r=n(50259);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.abs=function(){return this.throwIfDisposed(),(0,i.t)(this)};var s=n(12804);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.acos=function(){return this.throwIfDisposed(),(0,s.H)(this)};var o=n(37558);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.acosh=function(){return this.throwIfDisposed(),(0,o.F)(this)};var a=n(37523);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.add=function(e){return this.throwIfDisposed(),(0,a.W)(this,e)};var l=n(12307);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.all=function(e,t){return this.throwIfDisposed(),(0,l.Q)(this,e,t)};var u=n(89326);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.any=function(e,t){return this.throwIfDisposed(),(0,u.b)(this,e,t)};var c=n(10897);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.argMax=function(e){return this.throwIfDisposed(),(0,c.F)(this,e)};var d=n(54339);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.argMin=function(e){return this.throwIfDisposed(),(0,d.X)(this,e)};var h=n(62302),p=n(45119);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.asScalar=function(){return this.throwIfDisposed(),(0,p.vA)(1===this.size,()=>"The array must have only 1 element."),(0,h.t)(this,[])};var f=n(29809);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.asType=function(e){return this.throwIfDisposed(),(0,f.w)(this,e)},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.as1D=function(){return this.throwIfDisposed(),(0,h.t)(this,[this.size])},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.as2D=function(e,t){return this.throwIfDisposed(),(0,h.t)(this,[e,t])},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),(0,h.t)(this,[e,t,n])},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.as4D=function(e,t,n,i){return this.throwIfDisposed(),(0,h.t)(this,[e,t,n,i])},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.as5D=function(e,t,n,i,r){return this.throwIfDisposed(),(0,h.t)(this,[e,t,n,i,r])};var m=n(66841);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.asin=function(){return this.throwIfDisposed(),(0,m.q)(this)};var g=n(50269);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.asinh=function(){return this.throwIfDisposed(),(0,g.y)(this)};var y=n(29580);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.atan=function(){return this.throwIfDisposed(),(0,y.r)(this)};var _=n(21404);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.atan2=function(e){return this.throwIfDisposed(),(0,_.F)(this,e)};var v=n(63774);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.atanh=function(){return this.throwIfDisposed(),(0,v.r)(this)};var b=n(53909);(0,r.tp)().prototype.avgPool=function(e,t,n,i){return this.throwIfDisposed(),(0,b.$)(this,e,t,n,i)};var T=n(69772);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),(0,T.G)(this,e,t)};var x=n(9160);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.batchNorm=function(e,t,n,i,r){return this.throwIfDisposed(),(0,x.$)(this,e,t,n,i,r)};var E=n(63567);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.broadcastTo=function(e){return this.throwIfDisposed(),(0,E.h)(this,e)},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.cast=function(e){return this.throwIfDisposed(),(0,f.w)(this,e)};var w=n(30855);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.ceil=function(){return this.throwIfDisposed(),(0,w.m)(this)};var I=n(96928);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),(0,I.z)(this,e,t)};var A=n(25030);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof r.qY&&(e=[e]),(0,A.x)([this,...e],t)};var S=n(3701);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.conv1d=function(e,t,n,i,r,s){return this.throwIfDisposed(),(0,S.k)(this,e,t,n,i,r,s)};var C=n(41106);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.conv2dTranspose=function(e,t,n,i,r){return this.throwIfDisposed(),(0,C.w)(this,e,t,n,i,r)};var O=n(28794);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.conv2d=function(e,t,n,i,r,s){return this.throwIfDisposed(),(0,O.X)(this,e,t,n,i,r,s)};var M=n(99907);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.cos=function(){return this.throwIfDisposed(),(0,M.g)(this)};var R=n(27451);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.cosh=function(){return this.throwIfDisposed(),(0,R.y)(this)};var k=n(10302);
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.cumprod=function(e,t,n){return this.throwIfDisposed(),(0,k.L)(this,e,t,n)};var N=n(76808);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),(0,N.r)(this,e,t,n)};var D=n(31216);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),(0,D.R)(this,e,t)};var F=n(10676);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.depthwiseConv2d=function(e,t,n,i,r,s){return this.throwIfDisposed(),(0,F.G)(this,e,t,n,i,r,s)};var L=n(93002);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.dilation2d=function(e,t,n,i,r){return this.throwIfDisposed(),(0,L.X)(this,e,t,n,i,r)};var P=n(919);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.divNoNan=function(e){return this.throwIfDisposed(),(0,P.e)(this,e)};var B=n(89359);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.div=function(e){return this.throwIfDisposed(),(0,B.y)(this,e)};var $=n(69759);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.dot=function(e){return this.throwIfDisposed(),(0,$.O)(this,e)};var U=n(83416);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.elu=function(){return this.throwIfDisposed(),(0,U.P)(this)};var z=n(13020);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.equal=function(e){return this.throwIfDisposed(),(0,z.L)(this,e)};var V=n(95207);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.erf=function(){return this.throwIfDisposed(),(0,V.Y)(this)};var j=n(44881);
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.euclideanNorm=function(e,t){return this.throwIfDisposed(),(0,j.p)(this,e,t)};var Y=n(8631);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.exp=function(){return this.throwIfDisposed(),(0,Y.o)(this)};var G=n(8710);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.expandDims=function(e){return this.throwIfDisposed(),(0,G.U)(this,e)};var H=n(40517);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.expm1=function(){return this.throwIfDisposed(),(0,H.I)(this)};var W=n(41361);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.fft=function(){return this.throwIfDisposed(),(0,W.h)(this)},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.flatten=function(){return this.throwIfDisposed(),(0,h.t)(this,[this.size])};var X=n(15606);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.floor=function(){return this.throwIfDisposed(),(0,X.R)(this)};var q=n(88991);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.floorDiv=function(e){return this.throwIfDisposed(),(0,q.w)(this,e)};var K=n(48229);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.gather=function(e,t,n){return this.throwIfDisposed(),(0,K.k)(this,e,t,n)};var Z=n(13337);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.greaterEqual=function(e){return this.throwIfDisposed(),(0,Z.D)(this,e)};var Q=n(62058);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.greater=function(e){return this.throwIfDisposed(),(0,Q.r)(this,e)};var J=n(13108);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.ifft=function(){return this.throwIfDisposed(),(0,J.K)(this)};var ee=n(22292);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.irfft=function(){return this.throwIfDisposed(),(0,ee.g)(this)};var te=n(68318);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.isFinite=function(){return this.throwIfDisposed(),(0,te.M)(this)};var ne=n(33454);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.isInf=function(){return this.throwIfDisposed(),(0,ne.E)(this)};var ie=n(6300);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.isNaN=function(){return this.throwIfDisposed(),(0,ie.y)(this)};var re=n(66919);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.leakyRelu=function(e){return this.throwIfDisposed(),(0,re.H)(this,e)};var se=n(56508);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.lessEqual=function(e){return this.throwIfDisposed(),(0,se.I)(this,e)};var oe=n(61303);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.less=function(e){return this.throwIfDisposed(),(0,oe.M)(this,e)};var ae=n(93531);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.localResponseNormalization=function(e,t,n,i){return this.throwIfDisposed(),(0,ae.K)(this,e,t,n,i)};var le=n(95645);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.logSigmoid=function(){return this.throwIfDisposed(),(0,le.n)(this)};var ue=n(97991);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.logSoftmax=function(e){return this.throwIfDisposed(),(0,ue.H)(this,e)};var ce=n(13330);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),(0,ce.V)(this,e,t)};var de=n(44010);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.log=function(){return this.throwIfDisposed(),(0,de.R)(this)};var he=n(12015);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.log1p=function(){return this.throwIfDisposed(),(0,he.K)(this)};var pe=n(13789);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.logicalAnd=function(e){return this.throwIfDisposed(),(0,pe.n)(this,e)};var fe=n(89881);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.logicalNot=function(){return this.throwIfDisposed(),(0,fe.N)(this)};var me=n(9879);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.logicalOr=function(e){return this.throwIfDisposed(),(0,me.z)(this,e)};var ge=n(19925);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.logicalXor=function(e){return this.throwIfDisposed(),(0,ge.r)(this,e)};var ye=n(65703);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),(0,ye.N)(this,e,t,n)};var _e=n(86999);(0,r.tp)().prototype.maxPool=function(e,t,n,i){return this.throwIfDisposed(),(0,_e.j)(this,e,t,n,i)};var ve=n(41938);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.max=function(e,t){return this.throwIfDisposed(),(0,ve.T)(this,e,t)};var be=n(30178);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.maximum=function(e){return this.throwIfDisposed(),(0,be.P)(this,e)};var Te=n(12611);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.mean=function(e,t){return this.throwIfDisposed(),(0,Te.i)(this,e,t)};var xe=n(57436);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.min=function(e,t){return this.throwIfDisposed(),(0,xe.j)(this,e,t)};var Ee=n(12644);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.minimum=function(e){return this.throwIfDisposed(),(0,Ee.B)(this,e)};var we=n(66567);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),(0,we.F)(this,e,t)};var Ie=n(60152);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.mod=function(e){return this.throwIfDisposed(),(0,Ie.z)(this,e)};var Ae=n(9258);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.mul=function(e){return this.throwIfDisposed(),(0,Ae.l)(this,e)};var Se=n(96522);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.neg=function(){return this.throwIfDisposed(),(0,Se.H)(this)};var Ce=n(92596);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.norm=function(e,t,n){return this.throwIfDisposed(),(0,Ce.x)(this,e,t,n)};var Oe=n(42118);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.notEqual=function(e){return this.throwIfDisposed(),(0,Oe.E)(this,e)};var Me=n(11760);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.oneHot=function(e,t=1,n=0){return this.throwIfDisposed(),(0,Me.M)(this,e,t,n)};var Re=n(69885);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.onesLike=function(){return this.throwIfDisposed(),(0,Re.P)(this)};var ke=n(65661);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.pad=function(e,t){return this.throwIfDisposed(),(0,ke.e)(this,e,t)};var Ne=n(17872);(0,r.tp)().prototype.pool=function(e,t,n,i,r,s){return this.throwIfDisposed(),(0,Ne.d)(this,e,t,n,i,r,s)};var De=n(98990);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.pow=function(e){return this.throwIfDisposed(),(0,De.n)(this,e)};var Fe=n(64394);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.prelu=function(e){return this.throwIfDisposed(),(0,Fe.N)(this,e)};var Le=n(67771);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.prod=function(e,t){return this.throwIfDisposed(),(0,Le._)(this,e,t)};var Pe=n(19870);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.reciprocal=function(){return this.throwIfDisposed(),(0,Pe.V)(this)};var Be=n(90112);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.relu=function(){return this.throwIfDisposed(),(0,Be.V)(this)};var $e=n(83732);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.relu6=function(){return this.throwIfDisposed(),(0,$e.j)(this)},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.reshapeAs=function(e){return this.throwIfDisposed(),(0,h.t)(this,e.shape)},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.reshape=function(e){return this.throwIfDisposed(),(0,h.t)(this,e)};var Ue=n(44711);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),(0,Ue.v)(this,e,t,n)};var ze=n(42954);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),(0,ze.b)(this,e,t,n)};var Ve=n(53262);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.reverse=function(e){return this.throwIfDisposed(),(0,Ve.B)(this,e)};var je=n(8775);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.rfft=function(){return this.throwIfDisposed(),(0,je.z)(this)};var Ye=n(25912);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.round=function(){return this.throwIfDisposed(),(0,Ye.L)(this)};var Ge=n(17820);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.rsqrt=function(){return this.throwIfDisposed(),(0,Ge.Z)(this)};var He=n(26325);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.selu=function(){return this.throwIfDisposed(),(0,He.W)(this)};var We=n(89986);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.separableConv2d=function(e,t,n,i,r,s){return this.throwIfDisposed(),(0,We.w)(this,e,t,n,i,r,s)};var Xe=n(28968);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.sigmoid=function(){return this.throwIfDisposed(),(0,Xe.r)(this)};var qe=n(51115);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.sign=function(){return this.throwIfDisposed(),(0,qe._)(this)};var Ke=n(33726);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.sin=function(){return this.throwIfDisposed(),(0,Ke.F)(this)};var Ze=n(58276);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.sinh=function(){return this.throwIfDisposed(),(0,Ze.L)(this)};var Qe=n(17986);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.slice=function(e,t){return this.throwIfDisposed(),(0,Qe.d)(this,e,t)};var Je=n(26346);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.softmax=function(e){return this.throwIfDisposed(),(0,Je.V)(this,e)};var et=n(66030);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.softplus=function(){return this.throwIfDisposed(),(0,et.l)(this)};var tt=n(10776);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),(0,tt.e)(this,e,t)};var nt=n(66512);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.split=function(e,t){return this.throwIfDisposed(),(0,nt.l)(this,e,t)};var it=n(79348);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.sqrt=function(){return this.throwIfDisposed(),(0,it.R)(this)};var rt=n(45793);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.square=function(){return this.throwIfDisposed(),(0,rt.E)(this)};var st=n(53427);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.squaredDifference=function(e){return this.throwIfDisposed(),(0,st.P)(this,e)};var ot=n(5932);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.squeeze=function(e){return this.throwIfDisposed(),(0,ot.r)(this,e)};var at=n(54268);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.stack=function(e,t){this.throwIfDisposed();const n=e instanceof r.qY?[this,e]:[this,...e];return(0,at.t)(n,t)};var lt=n(10700);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.step=function(e){return this.throwIfDisposed(),(0,lt.P)(this,e)};var ut=n(45894);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.stridedSlice=function(e,t,n,i,r,s,o,a){return this.throwIfDisposed(),(0,ut.Y)(this,e,t,n,i,r,s,o,a)};var ct=n(77126);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.sub=function(e){return this.throwIfDisposed(),(0,ct.j)(this,e)};var dt=n(83791);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.sum=function(e,t){return this.throwIfDisposed(),(0,dt.c)(this,e,t)};var ht=n(77823);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.tan=function(){return this.throwIfDisposed(),(0,ht.M)(this)};var pt=n(57311);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.tanh=function(){return this.throwIfDisposed(),(0,pt.y)(this)};var ft=n(64826);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.tile=function(e){return this.throwIfDisposed(),(0,ft.V)(this,e)},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.toBool=function(){return this.throwIfDisposed(),(0,f.w)(this,"bool")},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.toFloat=function(){return this.throwIfDisposed(),(0,f.w)(this,"float32")},
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.toInt=function(){return this.throwIfDisposed(),(0,f.w)(this,"int32")};var mt=n(21190);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.topk=function(e,t){return this.throwIfDisposed(),(0,mt.r)(this,e,t)};var gt=n(7703);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.transpose=function(e){return this.throwIfDisposed(),(0,gt.m)(this,e)};var yt=n(73937);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.unique=function(e){return this.throwIfDisposed(),(0,yt.A)(this,e)};var _t=n(97706);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),(0,_t.z)(this,e,t)};var vt=n(67261);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.unstack=function(e){return this.throwIfDisposed(),(0,vt.K)(this,e)};var bt=n(12151);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.where=function(e,t){return this.throwIfDisposed(),(0,bt._)(e,this,t)};var Tt=n(55537);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,r.tp)().prototype.zerosLike=function(){return this.throwIfDisposed(),(0,Tt.P)(this)}},50259:(e,t,n)=>{"use strict";n.d(t,{qY:()=>_,yl:()=>d,rT:()=>b,tp:()=>v,B4:()=>y,Q5:()=>g,qP:()=>m});var i=n(41743),r=n(45119);function s(e,t,n,i){const s=(0,r.Ur)(t),a=function(e,t,n,i){const s=(0,r.Ze)(t),a=i[i.length-1],l=new Array(a).fill(0),c=t.length,d="complex64"===n?u(e):e;if(c>1)for(let e=0;e<s/a;e++){const t=e*a;for(let e=0;e<a;e++)l[e]=Math.max(l[e],o(d[t+e],0,n).length)}return l}(e,t,n,s),c=t.length,d=l(e,t,n,s,a),h=["Tensor"];return i&&(h.push(` dtype: ${n}`),h.push(` rank: ${c}`),h.push(` shape: [${t}]`),h.push(" values:")),h.push(d.map(e=>" "+e).join("\n")),h.join("\n")}function o(e,t,n){let i;return i=Array.isArray(e)?`${parseFloat(e[0].toFixed(7))} + ${parseFloat(e[1].toFixed(7))}j`:(0,r.Kg)(e)?`'${e}'`:"bool"===n?a(e):parseFloat(e.toFixed(7)).toString(),(0,r.av)(i,t)}function a(e){return 0===e?"false":"true"}function l(e,t,n,i,r,s=!0){const c="complex64"===n?2:1,d=t[0],h=t.length;if(0===h){if("complex64"===n){return[o(u(e)[0],0,n)]}return"bool"===n?[a(e[0])]:[e[0].toString()]}if(1===h){if(d>20){const t=3*c;let i=Array.from(e.slice(0,t)),s=Array.from(e.slice((d-3)*c,d*c));return"complex64"===n&&(i=u(i),s=u(s)),["["+i.map((e,t)=>o(e,r[t],n)).join(", ")+", ..., "+s.map((e,t)=>o(e,r[d-3+t],n)).join(", ")+"]"]}return["["+("complex64"===n?u(e):Array.from(e)).map((e,t)=>o(e,r[t],n)).join(", ")+"]"]}const p=t.slice(1),f=i.slice(1),m=i[0]*c,g=[];if(d>20){for(let t=0;t<3;t++){const i=t*m,s=i+m;g.push(...l(e.slice(i,s),p,n,f,r,!1))}g.push("...");for(let t=d-3;t<d;t++){const i=t*m,s=i+m;g.push(...l(e.slice(i,s),p,n,f,r,t===d-1))}}else for(let t=0;t<d;t++){const i=t*m,s=i+m;g.push(...l(e.slice(i,s),p,n,f,r,t===d-1))}const y=2===h?",":"";g[0]="["+(d>0?g[0]+y:"");for(let e=1;e<g.length-1;e++)g[e]=" "+g[e]+y;let _=",\n";for(let e=2;e<h;e++)_+="\n";return g[g.length-1]=" "+g[g.length-1]+"]"+(s?"":_),g}function u(e){const t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}var c=n(83879);
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class d{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=r.Ze(e),null!=n){const e=n.length;r.vA(e===this.size,()=>`Length of values '${e}' does not match the size inferred by the shape '${this.size}'.`)}if("complex64"===t)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||r.Ab(t,this.size),this.strides=(0,r.Ur)(e)}set(e,...t){0===t.length&&(t=[0]),r.vA(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);const n=this.locToIndex(t);this.values[n]=e}get(...e){0===e.length&&(e=[0]);let t=0;for(const n of e){if(n<0||n>=this.shape[t]){const t=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(t)}t++}let n=e[e.length-1];for(let t=0;t<e.length-1;++t)n+=this.strides[t]*e[t];return this.values[n]}locToIndex(e){if(0===this.rank)return 0;if(1===this.rank)return e[0];let t=e[e.length-1];for(let n=0;n<e.length-1;++n)t+=this.strides[n]*e[n];return t}indexToLoc(e){if(0===this.rank)return[];if(1===this.rank)return[e];const t=new Array(this.shape.length);for(let n=0;n<t.length-1;++n)t[n]=Math.floor(e/this.strides[n]),e-=t[n]*this.strides[n];return t[t.length-1]=e,t}get rank(){return this.shape.length}toTensor(){return h().makeTensor(this.values,this.shape,this.dtype)}}let h=null,p=null,f=null;function m(e){h=e}function g(e){p=e}function y(e){f=e}class _{constructor(e,t,n,i){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=r.Ze(e),this.strides=(0,r.Ur)(e),this.dataId=n,this.id=i,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const e=await this.data();return p.buffer(this.shape,this.dtype,e)}bufferSync(){return p.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return(0,r.yw)(this.shape,e,"complex64"===this.dtype)}arraySync(){return(0,r.yw)(this.shape,this.dataSync(),"complex64"===this.dtype)}async data(){this.throwIfDisposed();const e=h().read(this.dataId);if("string"===this.dtype){const t=await e;try{return t.map(e=>c.decodeString(e))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),h().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=h().readSync(this.dataId);if("string"===this.dtype)try{return e.map(e=>c.decodeString(e))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await h().read(this.dataId);return"string"===this.dtype?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(this.kerasMask&&this.kerasMask.dispose(),h().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return p.print(this,e)}clone(){return this.throwIfDisposed(),p.clone(this)}toString(e=!1){return s(this.dataSync(),this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),p.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),h().makeVariable(this,e,t,n)}}function v(){return(0,i.m)("Tensor",()=>_)}Object.defineProperty(_,Symbol.hasInstance,{value:e=>!!e&&null!=e.data&&null!=e.dataSync&&null!=e.throwIfDisposed}),v();class b extends _{constructor(e,t,n,i){super(e.shape,e.dtype,e.dataId,i),this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!r.r1(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);h().disposeTensor(this),this.dataId=e.dataId,h().incRef(this,null)}dispose(){h().disposeVariable(this),this.isDisposedInternal=!0}}Object.defineProperty(b,Symbol.hasInstance,{value:e=>e instanceof _&&null!=e.assign&&e.assign instanceof Function})},30565:(e,t,n)=>{"use strict";n.r(t),n.d(t,{assertTypesMatch:()=>a,getTensorsInContainer:()=>u,isTensorInList:()=>l,makeTypesMatch:()=>o});var i=n(50259),r=n(52046),s=n(45119);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function o(e,t){if(e.dtype===t.dtype)return[e,t];const n=(0,r.Tu)(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function a(e,t){(0,s.vA)(e.dtype===t.dtype,()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`)}function l(e,t){return t.some(t=>t.id===e.id)}function u(e){const t=[];return c(e,t,new Set),t}function c(e,t,n){if(null==e)return;if(e instanceof i.qY)return void t.push(e);if(r=e,!Array.isArray(r)&&"object"!=typeof r)return;var r;const s=e;for(const e in s){const i=s[e];n.has(i)||(n.add(i),c(i,t,n))}}},28189:(e,t,n)=>{"use strict";n.d(t,{MZ:()=>u,YT:()=>h,j1:()=>p});var i=n(41585),r=n(46574),s=n(50259),o=n(52046),a=n(83879),l=n(45119);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function u(e,t){let n=e;if((0,a.isTypedArray)(e))return"string"===t?[]:[e.length];if((0,o.Oj)(e)){const t=e.channels||"RGBA";return[e.height,e.width*t.length]}if((0,o.Nw)(e))return[e.buffer.size/(null==t?4:(0,l.jv)(t))];if(!Array.isArray(e))return[];const i=[];for(;Array.isArray(n)||(0,a.isTypedArray)(n)&&"string"!==t;)i.push(n.length),n=n[0];return Array.isArray(e)&&(0,r._K)().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&c(e,i,[]),i}function c(e,t,n){if(n=n||[],!Array.isArray(e)&&!(0,a.isTypedArray)(e))return void(0,l.vA)(0===t.length,()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);(0,l.vA)(t.length>0,()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`),(0,l.vA)(e.length===t[0],()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);const i=t.slice(1);for(let t=0;t<e.length;++t)c(e[t],i,n.concat(t))}function d(e,t,n,i){if("string_or_numeric"!==e){if(null==e)throw new Error("Expected dtype cannot be null.");if("numeric"!==e&&e!==t||"numeric"===e&&"string"===t)throw new Error(`Argument '${n}' passed to '${i}' must be ${e} tensor, but got ${t} tensor`)}}function h(e,t,n,r="numeric"){if(e instanceof(0,s.tp)())return d(r,e.dtype,t,n),e;let o=(0,l.X$)(e);if("string"!==o&&["bool","int32","float32"].indexOf(r)>=0&&(o=r),d(r,o,t,n),null==e||!(0,a.isTypedArray)(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e){const i=null==e?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${i}'`)}const c=u(e,o);(0,a.isTypedArray)(e)||Array.isArray(e)||(e=[e]);const h="string"!==o?(0,a.toTypedArray)(e,o):(0,a.flatten)(e,[],!0);return i.T2.makeTensor(h,c,o)}function p(e,t,n,i="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map((e,r)=>h(e,`${t}[${r}]`,n,i))}},52046:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
var i,r,s,o,a;n.d(t,{Nw:()=>h,Oj:()=>d,Tu:()=>u,ch:()=>c,rg:()=>i}),function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"}(i||(i={})),function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"}(r||(r={})),function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"}(s||(s={})),function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"}(o||(o={})),function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"}(a||(a={}));const l={float32:o,int32:r,bool:s,complex64:a};function u(e,t){if("string"===e||"string"===t){if("string"===e&&"string"===t)return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return l[e][t]}function c(e){return u(e,"int32")}function d(e){return null!=e&&"object"==typeof e&&"texture"in e&&e.texture instanceof WebGLTexture}function h(e){return"undefined"!=typeof GPUBuffer&&null!=e&&"object"==typeof e&&"buffer"in e&&e.buffer instanceof GPUBuffer}},83879:(e,t,n)=>{"use strict";n.r(t),n.d(t,{arraysEqual:()=>s.r1,arraysEqualWithNull:()=>s.e_,assert:()=>s.vA,assertNonNegativeIntegerDimensions:()=>s.SA,assertNonNull:()=>s.HO,assertShapesMatch:()=>s.O3,bytesFromStringArray:()=>s.SL,bytesPerElement:()=>s.jv,checkConversionForErrors:()=>s.nd,clamp:()=>s.qE,computeStrides:()=>s.Ur,convertBackendValuesAndArrayBuffer:()=>s.o2,createScalarValue:()=>b,createShuffledIndices:()=>s.P8,decodeString:()=>I,distSquared:()=>s.oO,encodeString:()=>w,fetch:()=>E,fingerPrint64:()=>v,flatten:()=>S,getArrayFromDType:()=>s.Ab,getTypedArrayFromDType:()=>s.ce,hasEncodingLoss:()=>s.BE,hexToLong:()=>l,indexToLoc:()=>s._k,inferDtype:()=>s.X$,inferFromImplicitShape:()=>s.XT,isBoolean:()=>s.Lm,isFunction:()=>s.Tn,isInt:()=>s.E6,isNumber:()=>s.Et,isPromise:()=>s.yL,isScalarShape:()=>s.Sf,isString:()=>s.Kg,isTypedArray:()=>A,isValidDtype:()=>s.xn,locToIndex:()=>s.sX,makeOnesTypedArray:()=>s.FZ,makeZerosNestedTypedArray:()=>s.c7,makeZerosTypedArray:()=>s.Ty,nearestDivisor:()=>s.lK,nearestLargerEven:()=>s.eV,now:()=>x,parseAxisParam:()=>s.Y6,randUniform:()=>s.so,repeatedTry:()=>s._q,rightPad:()=>s.av,shuffle:()=>s.k4,shuffleCombo:()=>s.a0,sizeFromShape:()=>s.Ze,sizeToSquarishShape:()=>s.gS,squeezeShape:()=>s.gx,sum:()=>s.cz,swap:()=>s.wg,tanh:()=>s.ym,toNestedArray:()=>s.yw,toTypedArray:()=>T});var i=n(46574),r=n(86448),s=n(45119),o=n(28570);
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const a=n.n(o)()||o;function l(e){return a.fromString(e,!0,16)}const u=l("c3a5c85c97cb3127"),c=l("b492b66fbe98f273"),d=l("9ae16a3b2f90404f");function h(e){return e.xor(e.shru(47))}function p(e,t,n){const i=e.slice(t,t+n);return a.fromBytes(Array.from(i),!0,!0)}function f(e,t){return p(e,t,8)}function m(e,t){return p(e,t,4)}function g(e,t){return 0===t?e:e.shru(t).or(e.shl(64-t))}function y(e,t,n=l("9ddfea08eb382d69")){let i=e.xor(t).mul(n);i=i.xor(i.shru(47));let r=t.xor(i).mul(n);return r=r.xor(r.shru(47)),r=r.mul(n),r}function _(e,t,n,i){return function(e,t,n,i,r,s){r=r.add(e),s=g(s.add(r).add(i),21);const o=r;return r=(r=r.add(t)).add(n),s=s.add(g(r,44)),[r.add(i),s.add(o)]}(f(e,t),f(e,t+8),f(e,t+16),f(e,t+24),n,i)}function v(e,t=e.length){const n=a.fromNumber(81,!0);if(t<=32)return t<=16?function(e,t=e.length){if(t>=8){const n=d.add(2*t),i=f(e,0).add(d),r=f(e,t-8);return y(g(r,37).mul(n).add(i),g(i,25).add(r).mul(n),n)}if(t>=4){const n=d.add(2*t);return y(m(e,0).shl(3).add(t),m(e,t-4),n)}if(t>0){const n=e[0]+(e[t>>1]<<8),i=t+(e[t-1]<<2);return h(d.mul(n).xor(u.mul(i))).mul(d)}return d}(e,t):function(e,t=e.length){const n=d.add(2*t),i=f(e,0).mul(c),r=f(e,8),s=f(e,t-8).mul(n),o=f(e,t-16).mul(d);return y(g(i.add(r),43).add(g(s,30)).add(o),i.add(g(r.add(d),18)).add(s),n)}(e,t);if(t<=64)return function(e,t=e.length){const n=d.add(2*t),i=f(e,0).mul(d),r=f(e,8),s=f(e,t-8).mul(n),o=f(e,t-16).mul(d),a=g(i.add(r),43).add(g(s,30)).add(o),l=y(a,i.add(g(r.add(d),18)).add(s),n),u=f(e,16).mul(n),c=f(e,24),h=a.add(f(e,t-32)).mul(n),p=l.add(f(e,t-24)).mul(n);return y(g(u.add(c),43).add(g(h,30)).add(p),u.add(g(c.add(i),18)).add(h),n)}(e,t);let i=n,r=n.mul(c).add(113),s=h(r.mul(d).add(113)).mul(d),o=[a.UZERO,a.UZERO],l=[a.UZERO,a.UZERO];i=i.mul(d).add(f(e,0));let p=0;const v=64*(t-1>>6),b=v+(t-1&63)-63;do{i=g(i.add(r).add(o[0]).add(f(e,p+8)),37).mul(c),r=g(r.add(o[1]).add(f(e,p+48)),42).mul(c),i=i.xor(l[1]),r=r.add(o[0]).add(f(e,p+40)),s=g(s.add(l[0]),33).mul(c),o=_(e,p,o[1].mul(c),i.add(l[0])),l=_(e,p+32,s.add(l[1]),r.add(f(e,p+16))),[s,i]=[i,s],p+=64}while(p!==v);const T=c.add(s.and(255).shl(1));return p=b,l[0]=l[0].add(t-1&63),o[0]=o[0].add(l[0]),l[0]=l[0].add(o[0]),i=g(i.add(r).add(o[0]).add(f(e,p+8)),37).mul(T),r=g(r.add(o[1]).add(f(e,p+48)),42).mul(T),i=i.xor(l[1].mul(9)),r=r.add(o[0].mul(9).add(f(e,p+40))),s=g(s.add(l[0]),33).mul(T),o=_(e,p,o[1].mul(T),i.add(l[0])),l=_(e,p+32,s.add(l[1]),r.add(f(e,p+16))),[s,i]=[i,s],y(y(o[0],l[0],T).add(h(r).mul(u)).add(s),y(o[1],l[1],T).add(i),T)}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function b(e,t){return"string"===t?w(e):T([e],t)}function T(e,t){if("string"===t)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=S(e)),(0,i._K)().getBool("DEBUG")&&s.nd(e,t),function(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}(e,t))return e;if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t){const t=new Uint8Array(e.length);for(let n=0;n<t.length;++n)0!==Math.round(e[n])&&(t[n]=1);return t}throw new Error(`Unknown data type ${t}`)}function x(){return(0,i._K)().platform.now()}function E(e,t){return(0,i._K)().platform.fetch(e,t)}function w(e,t="utf-8"){return t=t||"utf-8",(0,i._K)().platform.encode(e,t)}function I(e,t="utf-8"){return t=t||"utf-8",(0,i._K)().platform.decode(e,t)}function A(e){return null!=(0,i._K)().platform.isTypedArray?(0,i._K)().platform.isTypedArray(e):(0,r.Y)(e)}function S(e,t=[],n=!1){if(null==t&&(t=[]),"boolean"==typeof e||"number"==typeof e||"string"==typeof e||s.yL(e)||null==e||A(e)&&n)t.push(e);else if(Array.isArray(e)||A(e))for(let i=0;i<e.length;++i)S(e[i],t,n);else{let i=-1;for(const t of Object.keys(e))/^([1-9]+[0-9]*|0)$/.test(t)&&(i=Math.max(i,Number(t)));for(let r=0;r<=i;r++)S(e[r],t,n)}return t}},45119:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function i(e){let t=e.length,n=0;for(;t>0;)n=Math.random()*t|0,t--,a(e,t,n)}function r(e,t){if(e.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${e.length}Second array length was ${t.length}`);let n=e.length,i=0;for(;n>0;)i=Math.random()*n|0,n--,a(e,n,i),a(t,n,i)}function s(e,t,n){return Math.max(e,Math.min(t,n))}function o(e){return e%2==0?e:e+1}function a(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function l(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t}function u(e,t){const n=Math.random();return t*n+(1-n)*e}function c(e,t){let n=0;for(let i=0;i<e.length;i++){const r=Number(e[i])-Number(t[i]);n+=r*r}return n}function d(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function h(e,t,n=""){d(y(e,t),()=>n+` Shapes ${e} and ${t} must match`)}function p(e){d(null!=e,()=>"The input to the tensor constructor must be a non-null value.")}function f(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function m(e){return 0===e.length}function g(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(null!==e[n]&&null!==t[n]&&e[n]!==t[n])return!1;return!0}function y(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function _(e){return e%1==0}function v(e){if(null!=Math.tanh)return Math.tanh(e);if(e===1/0)return 1;if(e===-1/0)return-1;{const t=Math.exp(2*e);return(t-1)/(t+1)}}function b(e){const t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function T(e){const t=new Uint32Array(e);for(let n=0;n<e;++n)t[n]=n;return i(t),t}function x(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function E(e,t=e=>0,n,i){return new Promise((r,s)=>{let o=0;const a=()=>{if(e())return void r();o++;const l=t(o);null!=n&&o>=n?s():null!=i?i(a,l):setTimeout(a,l)};a()})}function w(e,t){let n=1,i=-1;for(let t=0;t<e.length;++t)if(e[t]>=0)n*=e[t];else if(-1===e[t]){if(-1!==i)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${i} and dim ${t}`);i=t}else if(e[t]<0)throw Error(`Shapes can not be < 0. Found ${e[t]} at dim ${t}`);if(-1===i){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(0===n)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!==0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);const r=e.slice();return r[i]=t/n,r}function I(e,t){const n=t.length;return d((e=null==e?t.map((e,t)=>t):[].concat(e)).every(e=>e>=-n&&e<n),()=>`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),d(e.every(e=>_(e)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(e=>e<0?n+e:e)}function A(e,t){const n=[],i=[],r=null!=t&&Array.isArray(t)&&0===t.length,s=null==t||r?null:I(t,e).sort();let o=0;for(let t=0;t<e.length;++t){if(null!=s){if(s[o]===t&&1!==e[t])throw new Error(`Can't squeeze axis ${t} since its dim '${e[t]}' is not 1`);(null==s[o]||s[o]>t)&&1===e[t]&&(n.push(e[t]),i.push(t)),s[o]<=t&&o++}1!==e[t]&&(n.push(e[t]),i.push(t))}return{newShape:n,keptDims:i}}function S(e,t){return C(e,t)}function C(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error(`Unknown data type ${e}`);n=new Array(t)}return n}function O(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(isNaN(i)||!isFinite(i))throw Error(`A tensor of type ${t} being uploaded contains ${i}.`)}}function M(e){return"bool"===e||"complex64"===e||"float32"===e||"int32"===e||"string"===e}function R(e,t){return"complex64"!==t&&(("float32"!==t||"complex64"===e)&&(("int32"!==t||"float32"===e||"complex64"===e)&&("bool"!==t||"bool"!==e)))}function k(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error(`Unknown dtype ${e}`)}function N(e){if(null==e)return 0;let t=0;return e.forEach(e=>t+=e.length),t}function D(e){return"string"==typeof e||e instanceof String}function F(e){return"boolean"==typeof e}function L(e){return"number"==typeof e}function P(e){return Array.isArray(e)?P(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":L(e)?"float32":D(e)?"string":F(e)?"bool":"float32"}function B(e){return!!(e&&e.constructor&&e.call&&e.apply)}function $(e,t){for(let n=t;n<e;++n)if(e%n===0)return n;return e}function U(e){const t=e.length;if(t<2)return[];const n=new Array(t-1);n[t-2]=e[t-1];for(let i=t-3;i>=0;--i)n[i]=n[i+1]*e[i+1];return n}function z(e,t,n,i=!1){const r=new Array;if(1===t.length){const s=t[0]*(i?2:1);for(let t=0;t<s;t++)r[t]=n[e+t]}else{const s=t[0],o=t.slice(1),a=o.reduce((e,t)=>e*t)*(i?2:1);for(let t=0;t<s;t++)r[t]=z(e+t*a,o,n,i)}return r}function V(e,t,n=!1){if(0===e.length)return t[0];const i=e.reduce((e,t)=>e*t)*(n?2:1);if(0===i)return[];if(i!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return z(0,e,t,n)}function j(e,t){if(Array.isArray(e))return e;if("float32"===t)return e instanceof Float32Array?e:new Float32Array(e);if("int32"===t)return e instanceof Int32Array?e:new Int32Array(e);if("bool"===t||"string"===t)return Uint8Array.from(new Int32Array(e));throw new Error(`Unknown dtype ${t}`)}function Y(e,t){const n=G(e,t);for(let e=0;e<n.length;e++)n[e]=1;return n}function G(e,t){if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t)return new Uint8Array(e);throw new Error(`Unknown data type ${t}`)}function H(e,t){const n=e.reduce((e,t)=>e*t,1);if(null==t||"float32"===t)return V(e,new Float32Array(n));if("int32"===t)return V(e,new Int32Array(n));if("bool"===t)return V(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function W(e){e.forEach(t=>{d(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`)})}function X(e,t,n){if(0===t)return 0;if(1===t)return e[0];let i=e[e.length-1];for(let t=0;t<e.length-1;++t)i+=n[t]*e[t];return i}function q(e,t,n){if(0===t)return[];if(1===t)return[e];const i=new Array(t);for(let t=0;t<i.length-1;++t)i[t]=Math.floor(e/n[t]),e-=i[t]*n[t];return i[i.length-1]=e,i}function K(e){return e&&e.then&&"function"==typeof e.then}n.d(t,{Ab:()=>C,BE:()=>R,E6:()=>_,Et:()=>L,FZ:()=>Y,HO:()=>p,Kg:()=>D,Lm:()=>F,O3:()=>h,P8:()=>T,SA:()=>W,SL:()=>N,Sf:()=>m,Tn:()=>B,Ty:()=>G,Ur:()=>U,X$:()=>P,XT:()=>w,Y6:()=>I,Ze:()=>f,_k:()=>q,_q:()=>E,a0:()=>r,av:()=>x,c7:()=>H,ce:()=>S,cz:()=>l,eV:()=>o,e_:()=>g,gS:()=>b,gx:()=>A,jv:()=>k,k4:()=>i,lK:()=>$,nd:()=>O,o2:()=>j,oO:()=>c,qE:()=>s,r1:()=>y,sX:()=>X,so:()=>u,vA:()=>d,wg:()=>a,xn:()=>M,yL:()=>K,ym:()=>v,yw:()=>V})},1936:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/Object.defineProperty(t,"__esModule",{value:!0});const i=n(95237),r=n(38205);class s extends i.Component{componentDidMount(){const{name:e,tab:t}=this.props;this.props.registerSurface(e,t,this)}componentDidUpdate(){return!1}render(){const{name:e,visible:t,styles:n}=this.props,o=Object.assign({},s.defaultStyles,n),{width:a,height:l}=o;let{maxHeight:u,maxWidth:c}=o;u=l===s.defaultStyles.height?u:l,c=a===s.defaultStyles.width?c:a;const d=r.css({display:t?"block":"none",backgroundColor:"white",marginTop:"10px",marginBottom:"10px",boxShadow:"0 0 6px -3px #777",padding:"10px !important",height:l,width:a,maxHeight:u,maxWidth:c,overflow:"auto"}),h=r.css({backgroundColor:"white",boxSizing:"border-box",borderBottom:"1px solid #357EDD",lineHeight:"2em",marginBottom:"20px",fontWeight:"600",textAlign:"center"}),p=r.css({boxSizing:"border-box"});return i.h("div",{className:`${d} tf-surface`,ref:e=>this.container=e,"data-visible":t},i.h("div",{className:`${h} tf-label`,ref:e=>this.label=e},e),i.h("div",{className:`${p} tf-draw-area`,ref:e=>this.drawArea=e}))}}s.defaultStyles={maxWidth:"550px",maxHeight:"580px",height:"auto",width:"auto"},t.SurfaceComponent=s},9779:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/Object.defineProperty(t,"__esModule",{value:!0});const i=n(95237),r=n(38205);class s extends i.Component{render(){const{tabNames:e,activeTab:t,handleClick:n}=this.props,s=e.length>0?e.map(e=>i.h(o,{key:e,id:e,handleClick:n,isActive:e===t},e)):null,a=r.css({overflowX:"scroll",overflowY:"hidden",whiteSpace:"nowrap",borderBottomStyle:"solid",borderBottomWidth:"1px",borderColor:"#eee",paddingBottom:"1rem",marginTop:"1rem"});return i.h("div",{className:`${a} visor-tabs`},s)}}t.Tabs=s;class o extends i.Component{render(){const{children:e,isActive:t,handleClick:n,id:s}=this.props,o=r.css({borderBottomColor:t?"#357EDD":"#AAAAAA",borderBottomWidth:"1px",borderBottomStyle:"solid",cursor:"pointer",":hover":{color:"#357EDD"},display:"inline-block",marginRight:"1rem",padding:".5rem",fontSize:"1rem",fontWeight:"bold"});return i.h("a",{className:`${o} tf-tab`,"data-isactive":t,onClick:()=>n(s)},e)}}},25976:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/Object.defineProperty(t,"__esModule",{value:!0});const i=n(95237),r=n(38205),s=n(1936),o=n(9779);class a extends i.Component{static render(e,t,n){return i.render(i.h(a,Object.assign({},n)),e,t)}constructor(e){super(e),this.surfaces=new Map;const t=null==e.startOpen||e.startOpen;this.state={isOpen:t,isFullscreen:!1,activeTab:null,tabs:new Set},this.keyHandler=this.keyHandler.bind(this)}close(){this.setState({isOpen:!1})}open(){this.setState({isOpen:!0})}toggle(){this.setState({isOpen:!this.state.isOpen})}toggleFullScreen(){this.setState({isFullscreen:!this.state.isFullscreen})}isOpen(){return this.state.isOpen}isFullscreen(){return this.state.isFullscreen}getSurface(e,t){const n=this.surfaceId(e,t);let i;if(!this.surfaces.has(n))throw Error(`Surface not found with id: ${n}`);return i=this.surfaces.get(n),{container:i.container,label:i.label,drawArea:i.drawArea}}bindKeys(){document.addEventListener("keydown",this.keyHandler,!1)}unbindKeys(){document.removeEventListener("keydown",this.keyHandler)}surfaceId(e,t){return e+t}setTabs(e){const t=e.map(e=>e.tab),n=this.state.tabs;let i;for(const e of t)n.has(e)||(n.add(e),i=e);null!=i&&this.setState({tabs:n,activeTab:i})}getTabs(){return this.state.tabs}registerSurface(e,t,n){const i=this.surfaceId(e,t);this.surfaces.set(i,n)}keyHandler(e){192===e.keyCode&&(e.shiftKey?this.toggleFullScreen():this.toggle())}setActiveTab(e){this.setState({activeTab:e})}componentDidMount(){this.bindKeys()}componentWillMount(){this.setTabs(this.props.surfaceList)}componentWillReceiveProps(e){this.setTabs(e.surfaceList)}render(){const{isOpen:e,isFullscreen:t,activeTab:n}=this.state,{surfaceList:a}=this.props,u=Array.from(this.getTabs().values()),c=t?"90vw":"550px",d=r.css({width:c,height:"100%",backgroundColor:"#fafafa",boxSizing:"border-box",padding:"10px",position:"fixed",top:"0px",transition:"right 0.5s cubic-bezier(0.645, 0.045, 0.355, 1), width 0.5s cubic-bezier(0.645, 0.045, 0.355, 1)",boxShadow:"0 2px 5px rgba(0, 0, 0, 0.12), 0 2px 5px rgba(0, 0, 0, 0.24)",overflow:"auto",fontFamily:"sans-serif",fontSize:"14px",zIndex:1e3}),h=r.css({right:"0"}),p=r.css({right:`calc(-${c} - 10px)`}),f=e?h:p,m=r.css({});return i.h("div",{className:`${d} ${f} visor`,"data-isopen":e,"data-isfullscreen":t},i.h(l,{fullScreenHandler:this.toggleFullScreen.bind(this),closeHandler:this.close.bind(this),isFullScreen:t}),i.h(o.Tabs,{tabNames:u,activeTab:n,handleClick:this.setActiveTab.bind(this)}),i.h("div",{className:`${m} visor-surfaces`},a.map(e=>i.h(s.SurfaceComponent,{key:e.name+e.tab,name:e.name,tab:e.tab,styles:e.styles,registerSurface:this.registerSurface.bind(this),visible:n===e.tab}))))}}function l(e){const{isFullScreen:t,fullScreenHandler:n,closeHandler:s}=e,o=r.css({display:"flex",backgroundColor:"white",border:"1px solid white",padding:"6px",paddingTop:"10px",marginBottom:"10px",borderRadius:"6px",marginTop:"-16px"}),a=r.css({fontSize:".875rem",borderRadius:".25rem",paddingLeft:"1rem",paddingRight:"1rem",paddingTop:".5rem",paddingBottom:".5rem",textDecoration:"none",transition:"color .15s ease-in",color:"#111"}),l=r.css({marginLeft:"auto"});return i.h("div",{className:`${o} visor-controls`},i.h("button",{className:`${a}`,onClick:n},t?"Minimize":"Maximize"),i.h("button",{className:`${a} ${l}`,onClick:s},"Hide"))}t.VisorComponent=a},99778:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
n(15838),n(20455);const i=n(42784),r=n(13739),s=n(87483),o=n(45877),a=n(44857),l=n(80898),u=n(19827),c=n(10062),d=n(63559),h=n(15727),p=n(64853),f=n(32729),m=n(10454);t.version_vis=m.version;const g={barchart:i.barchart,table:u.table,histogram:o.histogram,linechart:a.linechart,scatterplot:l.scatterplot,confusionMatrix:r.confusionMatrix,heatmap:s.heatmap};t.render=g;const y={accuracy:f.accuracy,perClassAccuracy:f.perClassAccuracy,confusionMatrix:f.confusionMatrix};t.metrics=y;const _={history:c.history,fitCallbacks:c.fitCallbacks,perClassAccuracy:h.perClassAccuracy,valuesDistribution:p.valuesDistribution,layer:d.layer,modelSummary:d.modelSummary};t.show=_;var v=n(4701);t.visor=v.visor,function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(65759))},42784:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(n(45780)),o=n(88227),a=n(56857);t.barchart=function(e,t,n={}){return i(this,void 0,void 0,function*(){const i=a.getDrawArea(e),r=t,c=Object.assign({},l,n);if(u.has(i)){const e=u.get(i);if(a.shallowEquals(c,e.lastOptions)){yield a.nextFrame();const t=e.view,n=t.changeset().remove(()=>!0).insert(r);return void(yield t.change("values",n).runAsync())}}const{xLabel:d,yLabel:h,xType:p,yType:f}=c;let m=null;null!=d&&(m={title:d});let g=null;null!=h&&(g={title:h});let y;y=null!=c.color?Array.isArray(c.color)?{field:"index",type:"nominal",scale:{range:c.color}}:{value:c.color}:{value:"#4C78A0"};const _={width:c.width||o.getDefaultWidth(i),height:c.height||o.getDefaultHeight(i),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:c.fontSize,titleFontSize:c.fontSize},text:{fontSize:c.fontSize},legend:{labelFontSize:c.fontSize,titleFontSize:c.fontSize}},data:{values:r,name:"values"},mark:{type:"bar",tooltip:!0},encoding:{x:{field:"index",type:p,axis:m},y:{field:"value",type:f,axis:g},color:y}};yield a.nextFrame();const v=yield s.default(i,_,{actions:!1,mode:"vega-lite",defaultStyle:!1});u.set(i,{view:v.view,lastOptions:c})})};const l={xLabel:"",yLabel:"",xType:"ordinal",yType:"quantitative",fontSize:11},u=new Map},13739:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(n(45780)),o=n(88227),a=n(56857);t.confusionMatrix=function(e,t,n={}){return i(this,void 0,void 0,function*(){const i=Object.assign({},l,n),r=a.getDrawArea(e),u=[],c=t.values,d=t.tickLabels||[],h=0===d.length;let p=!0;for(let e=0;e<c.length;e++){const t=h?`Class ${e}`:d[e];h&&d.push(t);for(let n=0;n<c[e].length;n++){const r=h?`Class ${n}`:d[n],s=c[e][n];e!==n||i.shadeDiagonal?(u.push({label:t,prediction:r,count:s,scaleCount:s}),0!==s&&(p=!1)):u.push({label:t,prediction:r,count:s,noFill:!0})}}if(!i.shadeDiagonal&&p)for(const e of u)!0===e.noFill&&(e.noFill=!1,e.scaleCount=e.count);const f={width:i.width||o.getDefaultWidth(r),height:i.height||o.getDefaultHeight(r),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:i.fontSize,titleFontSize:i.fontSize},text:{fontSize:i.fontSize},legend:{labelFontSize:i.fontSize,titleFontSize:i.fontSize}},data:{values:u},encoding:{x:{field:"prediction",type:"ordinal",title:i.xLabel||"prediction",scale:{domain:d}},y:{field:"label",type:"ordinal",title:i.yLabel||"label",scale:{domain:d}}},layer:[{transform:[{filter:"datum.noFill != true"}],mark:{type:"rect"},encoding:{color:{field:"scaleCount",type:"quantitative",scale:{range:i.colorMap}},tooltip:[{field:"label",type:"nominal"},{field:"prediction",type:"nominal"},{field:"count",type:"quantitative"}]}}]};!1===i.shadeDiagonal&&f.layer.push({transform:[{filter:"datum.noFill == true"}],mark:{type:"rect",fill:"white"},encoding:{tooltip:[{field:"label",type:"nominal"},{field:"prediction",type:"nominal"},{field:"count",type:"quantitative"}]}}),i.showTextOverlay&&f.layer.push({mark:{type:"text",baseline:"middle"},encoding:{text:{field:"count",type:"nominal"}}});const m="string"==typeof i.colorMap?{scheme:i.colorMap}:i.colorMap;f.layer[0].encoding.color.scale.range=m,yield s.default(r,f,{actions:!1,mode:"vega-lite",defaultStyle:!1})})};const l={xLabel:null,yLabel:null,xType:"nominal",yType:"nominal",shadeDiagonal:!0,fontSize:12,showTextOverlay:!0,height:400,colorMap:["#f7fbff","#4292c6"]}},87483:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(n(15838)),a=s(n(45780)),l=n(88227),u=n(56286),c=n(56857);function d(e,t,n){const i=e instanceof o.Tensor?e.shape:[e.length,e[0].length];0===n?u.assert(i[0]===t.length,`Length of xTickLabels (${t.length}) must match number of rows (${i[0]})`):1===n&&u.assert(i[1]===t.length,`Length of yTickLabels (${t.length}) must match number of columns (${i[1]})`)}t.heatmap=function(e,t,n={}){return i(this,void 0,void 0,function*(){const r=Object.assign({},h,n),s=c.getDrawArea(e);let p=t.values;r.rowMajor&&(p=yield function(e){return i(this,void 0,void 0,function*(){let t,n;e instanceof o.Tensor?(t=e.shape,n=e.transpose()):(t=[e.length,e[0].length],n=o.tidy(()=>o.tensor2d(e).transpose())),u.assert(2===n.rank,"Input to renderHeatmap must be a 2d array or Tensor2d");const i=yield n.array();n.dispose();const r=[i.length,i[0].length];return u.assert(t[0]===r[1]&&t[1]===r[0],`Unexpected transposed shape. Original ${t} : Transposed ${r}`),i})}(t.values));const{xTickLabels:f,yTickLabels:m}=t;if(null!=f){d(p,f,0)}if(null!=m){d(p,m,1)}const g="@tfidx@",y=[];if(p instanceof o.Tensor){u.assert(2===p.rank,"Input to renderHeatmap must be a 2d array or Tensor2d");const e=yield p.data(),[t,n]=p.shape;for(let i=0;i<t;i++){const t=f?`${f[i]}${g}${i}`:i;for(let r=0;r<n;r++){const s=m?`${m[r]}${g}${r}`:r,o=e[i*n+r];y.push({x:t,y:s,value:o})}}}else{const e=p;for(let t=0;t<e.length;t++){const n=f?`${f[t]}${g}${t}`:t;for(let i=0;i<e[t].length;i++){const r=m?`${m[i]}${g}${i}`:i,s=e[t][i];y.push({x:n,y:r,value:s})}}}const _={actions:!1,mode:"vega-lite",defaultStyle:!1},v={width:r.width||l.getDefaultWidth(s),height:r.height||l.getDefaultHeight(s),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:r.fontSize,titleFontSize:r.fontSize},text:{fontSize:r.fontSize},legend:{labelFontSize:r.fontSize,titleFontSize:r.fontSize},scale:{bandPaddingInner:0,bandPaddingOuter:0}},data:{values:y},mark:{type:"rect",tooltip:!0},encoding:{x:{field:"x",type:r.xType,title:r.xLabel,sort:!1},y:{field:"y",type:r.yType,title:r.yLabel,sort:!1},fill:{field:"value",type:"quantitative"}}},b=`${g}\\d+$`,T=new RegExp(b);let x;switch(f&&(v.encoding.x.axis={labelExpr:`replace(datum.value, regexp(/${b}/), '')`}),m&&(v.encoding.y.axis={labelExpr:`replace(datum.value, regexp(/${b}/), '')`}),(f||m)&&(_.tooltip={sanitize:e=>String(e).replace(T,"")}),r.colorMap){case"blues":x=["#f7fbff","#4292c6"];break;case"greyscale":x=["#000000","#ffffff"];break;default:x="viridis"}if("viridis"!==x){v.encoding.fill.scale={range:x}}if(r.domain){const e=v.encoding.fill;null!=e.scale?e.scale=Object.assign({},e.scale,{domain:r.domain}):e.scale={domain:r.domain}}yield a.default(s,v,_)})};const h={xLabel:null,yLabel:null,xType:"ordinal",yType:"ordinal",colorMap:"viridis",fontSize:12,domain:null,rowMajor:!1}},45877:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(34410),o=r(n(45780)),a=n(88227),l=n(32729),u=n(19827),c={maxBins:12,fontSize:11};t.histogram=function(e,t,n={}){return i(this,void 0,void 0,function*(){const i=function(e){if(null==e.length)throw new Error("input data must be an array");if(0===e.length)return[];if("object"==typeof e[0]){if(null==e[0].value)throw new Error("input data must have a value field");return e}{const t=Array(e.length);for(let n=0;n<e.length;n++)t[n]={value:e[n]};return t}}(t),r=Object.assign({},c,n),d=a.subSurface(e,"histogram");if(!1!==n.stats){const t=a.subSurface(e,"stats",{prepend:!0});let o;o=n.stats?n.stats:l.arrayStats(i.map(e=>e.value)),function(e,t,n){const i=s.format(",.4~f"),r=s.format(".4~p"),o=[],a=[];null!=e.numVals&&(o.push("Num Vals"),a.push(i(e.numVals)));null!=e.min&&(o.push("Min"),a.push(i(e.min)));null!=e.max&&(o.push("Max"),a.push(i(e.max)));if(null!=e.numZeros){o.push("# Zeros");let t="";e.numVals&&(t=e.numZeros>0?`(${r(e.numZeros/e.numVals)})`:""),a.push(`${i(e.numZeros)} ${t}`)}if(null!=e.numNans){o.push("# NaNs");let t="";e.numVals&&(t=e.numNans>0?`(${r(e.numNans/e.numVals)})`:""),a.push(`${i(e.numNans)} ${t}`)}if(null!=e.numInfs){o.push("# Infinity");let t="";e.numVals&&(t=e.numInfs>0?`(${r(e.numInfs/e.numVals)})`:""),a.push(`${i(e.numInfs)} ${t}`)}u.table(t,{headers:o,values:[a]},n)}(o,t,{fontSize:r.fontSize})}if(0===i.length)return;const h=[];for(let e=0;e<i.length;e++){const t=i[e].value;null!=t&&isFinite(t)&&h.push(i[e])}const p={width:r.width||a.getDefaultWidth(d),height:r.height||a.getDefaultHeight(d),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},data:{values:h},mark:{type:"bar",tooltip:!0},config:{axis:{labelFontSize:r.fontSize,titleFontSize:r.fontSize},text:{fontSize:r.fontSize},legend:{labelFontSize:r.fontSize,titleFontSize:r.fontSize}},encoding:{x:{bin:{maxbins:r.maxBins},field:"value",type:"quantitative"},y:{aggregate:"count",type:"quantitative"},color:{value:r.color||"#001B44"}}};return o.default(d,p,{actions:!1,mode:"vega-lite",defaultStyle:!1})})}},44857:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(n(45780)),o=n(88227),a=n(56286),l=n(56857);t.linechart=function(e,t,n={}){return i(this,void 0,void 0,function*(){const i=Array.isArray(t.values[0])?t.values:[t.values],r=i[0].length,c=t.series?t.series:i.map((e,t)=>`Series ${t+1}`);a.assert(c.length===i.length,"Must have an equal number of series labels as there are data series"),null!=n.seriesColors&&a.assert(n.seriesColors.length===i.length,"Must have an equal number of series colors as there are data series");const d=[];for(let e=0;e<r;e++){const t={x:e};c.forEach((n,r)=>{const s=i[r][e].y;t[n]=s,t[`${n}-name`]=n}),d.push(t)}const h=Object.assign({},u,n),p={x:{field:"x",type:h.xType,title:h.xLabel},tooltip:[{field:"x",type:"quantitative"},...c.map(e=>({field:e,type:"quantitative"}))]},f=c.map(e=>({data:void 0,mark:{type:"line",clip:!0},encoding:{y:{field:e,type:h.yType,title:h.yLabel,scale:h.zoomToFit?{zero:!1}:null!=h.yAxisDomain?{domain:h.yAxisDomain}:void 0},color:{field:`${e}-name`,type:"nominal",legend:{values:c,title:null},scale:{range:h.seriesColors}}}})),m=l.getDrawArea(e),g={width:h.width||o.getDefaultWidth(m),height:h.height||o.getDefaultHeight(m),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:h.fontSize,titleFontSize:h.fontSize},text:{fontSize:h.fontSize},legend:{labelFontSize:h.fontSize,titleFontSize:h.fontSize}},data:{values:d},encoding:p,layer:[...f,{mark:"rule",selection:{hover:{type:"single",on:"mouseover",nearest:!0,clear:"mouseout"}},encoding:{color:{value:"grey",condition:{selection:{not:"hover"},value:"transparent"}}}}]};return yield s.default(m,g,{actions:!1,mode:"vega-lite",defaultStyle:!1}),Promise.resolve()})};const u={xLabel:"x",yLabel:"y",xType:"quantitative",yType:"quantitative",zoomToFit:!1,fontSize:11}},56857:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(65759),s=n(4701);t.getDrawArea=function(e){if(e instanceof HTMLElement)return e;if(r.isSurface(e))return e.drawArea;if(r.isSurfaceInfo(e)){return s.visor().surface({name:e.name,tab:e.tab,styles:e.styles}).drawArea}throw new Error("Not a drawable")},t.shallowEquals=function(e,t){const n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!==i.length)return!1;for(let i=0;i<n.length;i++){const r=n[i];if(e[r]!==t[r])return!1}return!0},t.nextFrame=function(){return i(this,void 0,void 0,function*(){yield new Promise(e=>requestAnimationFrame(e))})}},80898:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(n(45780)),o=n(88227),a=n(56286),l=n(56857);t.scatterplot=function(e,t,n={}){return i(this,void 0,void 0,function*(){let i=t.values;const r=null==t.series?[]:t.series;i=Array.isArray(i[0])?i:[i];const c=[];i.forEach((e,t)=>{const n=null!=r[t]?r[t]:`Series ${t+1}`,i=e.map(e=>Object.assign({},e,{series:n}));c.push(...i)}),null!=n.seriesColors&&a.assert(n.seriesColors.length===i.length,"Must have an equal number of series colors as there are data series");const d=l.getDrawArea(e),h=Object.assign({},u,n),p={width:h.width||o.getDefaultWidth(d),height:h.height||o.getDefaultHeight(d),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:h.fontSize,titleFontSize:h.fontSize},text:{fontSize:h.fontSize},legend:{labelFontSize:h.fontSize,titleFontSize:h.fontSize}},data:{values:c},mark:{type:"point",clip:!0,tooltip:{content:"data"}},encoding:{x:{field:"x",type:h.xType,title:h.xLabel,scale:h.zoomToFit?{zero:!1}:null!=h.xAxisDomain?{domain:h.xAxisDomain}:void 0},y:{field:"y",type:h.yType,title:h.yLabel,scale:h.zoomToFit?{zero:!1}:null!=h.yAxisDomain?{domain:h.yAxisDomain}:void 0},color:{field:"series",type:"nominal",scale:{range:h.seriesColors}},shape:{field:"series",type:"nominal"}}};return yield s.default(d,p,{actions:!1,mode:"vega-lite",defaultStyle:!1}),Promise.resolve()})};const u={xLabel:"x",yLabel:"y",xType:"quantitative",yType:"quantitative",zoomToFit:!1,fontSize:11}},19827:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/Object.defineProperty(t,"__esModule",{value:!0});const i=n(34410),r=n(90716),s=n(38205),o=n(56857);t.table=function(e,t,n={}){if(t&&null==t.headers)throw new Error('Data to render must have a "headers" property');if(t&&null==t.values)throw new Error('Data to render must have a "values" property');const l=o.getDrawArea(e),u=Object.assign({},a,n);let c=r.select(l).select("table.tf-table");const d=s.css({fontSize:u.fontSize||".875rem",width:"100%",maxWidth:"64rem",marginRight:"auto",marginLeft:"auto"});if(0===c.size()&&(c=r.select(l).append("table"),c.attr("class",` ${d} tf-table`),c.append("thead").append("tr"),c.append("tbody")),1!==c.size())throw new Error("Error inserting table");const h=s.css({fontWeight:"600",borderBottomStyle:"solid",borderBottomWidth:"1px",borderColor:"rgba( 0, 0, 0, .2 )",textAlign:"left",paddingBottom:"1rem",paddingRight:"1rem",backgroundColor:"#fff"}),p=c.select("thead").select("tr").selectAll("th").data(t.headers),f=p.enter().append("th").attr("class",`${h}`);p.merge(f).html(e=>e),p.exit().remove();const m=i.format(",.4~f"),g=c.select("tbody").selectAll("tr").data(t.values),y=g.enter().append("tr"),_=s.css({padding:"0.25rem",borderBottomStyle:"solid",borderBottomWidth:"1px",borderColor:"rgba( 0, 0, 0, .2 )"}),v=g.merge(y).selectAll("td").data(e=>e),b=v.enter().append("td").attr("class",`${_}`);v.merge(b).html(e=>"number"==typeof e?m(e):e),v.exit().remove(),g.exit().remove()};const a={fontSize:14}},10062:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(44857),s=n(56857),o=n(88227);function a(e,t,n,a={}){return i(this,void 0,void 0,function*(){const i=s.getDrawArea(e),c={};for(const e of n)if(/val_/.test(e)){const i=e.replace("val_","");l(c,i);const r=u(t,e,n.indexOf(e));c[i].series.push(e),c[i].values.push(r)}else{const i=u(t,e,n.indexOf(e));l(c,e),c[e].series.push(e),c[e].values.push(i)}const d=Object.keys(c),h=Object.assign({},{xLabel:"Iteration",yLabel:"Value"},a),p=[];for(const e of d){const t=o.subSurface(i,e),n=c[e].series,s=c[e].values;n.every(e=>Boolean(e.match("acc")))&&(h.zoomToFitAccuracy?h.zoomToFit=!0:(h.yAxisDomain=[0,1],delete h.zoomToFit));const a=r.linechart(t,{values:s,series:n},h);p.push(a)}yield Promise.all(p)})}function l(e,t){null==e[t]&&(e[t]={series:[],values:[]})}function u(e,t,n){if(Array.isArray(e)){const i=Array.isArray(e[0])?e[n]:e,r=[];for(let e=0;e<i.length;e++){const n=i[e];r.push({x:e,y:n[t]})}return r}return e.history[t].map((e,t)=>({x:t,y:e}))}function c(e,t,n){return null==e[t]&&(e[t]={}),null==e[t][n]&&(e[t][n]=[]),e[t][n]}t.history=a,t.fitCallbacks=function(e,t,n={}){const r={},l=n.callbacks||["onEpochEnd","onBatchEnd"],u=s.getDrawArea(e),d=Object.assign({},n);delete d.callbacks;const h={};return l.forEach(e=>{h[e]=function(e){return(n,l)=>i(this,void 0,void 0,function*(){/batch/i.test(e)?d.xLabel="Batch":/epoch/i.test(e)&&(d.xLabel="Epoch");const n=[],i=[];for(const s of t)if(null!=l[s]){i.push(s);const t=c(r,e,s);t.push({[s]:l[s]}),n.push(t)}a(o.subSurface(u,e,{title:e}),n,i,d),yield s.nextFrame()})}(e)}),h}},63559:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(45877),s=n(56857),o=n(19827),a=n(88227),l=n(32729);function u(e){let t;if(Array.isArray(e.outputShape[0])){t=`[${e.outputShape.map(e=>c(e)).join(", ")}]`}else t=c(e.outputShape);return{name:e.name,trainable:e.trainable,parameters:e.countParams(),outputShape:t}}function c(e){const t=e.slice();return 0===t.length?"Scalar":(null===t[0]&&(t[0]="batch"),`[${t.join(",")}]`)}t.modelSummary=function(e,t){return i(this,void 0,void 0,function*(){const n=s.getDrawArea(e),i=function(e){return{layers:e.layers.map(u)}}(t),r=i.layers.map(e=>[e.name,e.outputShape,e.parameters,e.trainable]);o.table(n,{headers:["Layer Name","Output Shape","# Of Params","Trainable"],values:r})})},t.layer=function(e,t){return i(this,void 0,void 0,function*(){const n=s.getDrawArea(e),u=yield function(e){return i(this,void 0,void 0,function*(){const t=e.getWeights(),n=e.weights,i=t.map(l.tensorStats),r=yield Promise.all(i),s=t.map(e=>e.shape);return t.map((e,t)=>({name:n[t].name,stats:r[t],shape:c(s[t]),weight:e}))})}(t),d=a.subSurface(n,"layer-weights-info"),h=u.map(e=>[e.name,e.shape,e.stats.min,e.stats.max,e.weight.size,e.stats.numZeros,e.stats.numNans,e.stats.numInfs]);o.table(d,{headers:["Weight Name","Shape","Min","Max","# Params","# Zeros","# NaNs","# Infinity"],values:h});const p=a.subSurface(n,"select-layer"),f=a.subSurface(n,"param-distribution");!function(e,t,n){const i=`\n <select>\n ${e.map(e=>`<option value=${e}>${e}</option>`)}\n </select>\n `,r=`<div><button>Show Values Distribution for:</button>${i}</div>`;t.innerHTML=r;const s=t.querySelector("button"),o=t.querySelector("select");s.addEventListener("click",()=>{n(o.selectedOptions[0].label)})}(u.map(e=>e.name),p,e=>i(this,void 0,void 0,function*(){const t=u.filter(t=>t.name===e)[0],n=yield t.weight.data();r.histogram(f,n,{height:150,width:460,stats:!1})}))})}},15727:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(56857),s=n(19827);t.perClassAccuracy=function(e,t,n){return i(this,void 0,void 0,function*(){const i=r.getDrawArea(e),o=[];for(let e=0;e<t.length;e++){const i=n?n[e]:e.toString(),r=t[e];o.push([i,r.accuracy,r.count])}return s.table(i,{headers:["Class","Accuracy","# Samples"],values:o})})}},64853:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(45877),s=n(56857),o=n(32729);t.valuesDistribution=function(e,t){return i(this,void 0,void 0,function*(){const n=s.getDrawArea(e),i=yield o.tensorStats(t),a=yield t.data();r.histogram(n,a,{height:150,stats:i})})}},65759:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSurfaceInfo=function(e){return null!=e.name},t.isSurface=function(e){return e.drawArea instanceof HTMLElement}},88227:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/Object.defineProperty(t,"__esModule",{value:!0});const i=n(38205),r=n(56857),s={prepend:!1};t.subSurface=function(e,t,n={}){const o=r.getDrawArea(e),a=i.css({"& canvas":{display:"block"},marginTop:".5rem",marginBottom:".5rem"}),l=i.css({backgroundColor:"white",display:"inline-block",boxSizing:"border-box",borderBottom:"1px solid #357EDD",lineHeight:"2em",padding:"0 10px 0 10px",marginBottom:"20px",fontWeight:"600",textAlign:"left"}),u=Object.assign({},s,n);let c=o.querySelector(`div[data-name=${t}]`);if(!c){if(c=document.createElement("div"),c.setAttribute("class",`${a}`),c.dataset.name=t,u.title){const e=document.createElement("div");e.setAttribute("class",`subsurface-title ${l}`),e.innerText=u.title,c.appendChild(e)}u.prepend?o.insertBefore(c,o.firstChild):o.appendChild(c)}return c},t.getDefaultWidth=function(e){let t=0,n=e;for(;n&&0===n.clientWidth;)n=n.parentElement,t=50;return n.clientWidth-t},t.getDefaultHeight=function(e){return 0===e.clientHeight?200:e.clientHeight}},32729:function(e,t,n){"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(15838),s=n(56286);t.arrayStats=function(e){if(!Array.isArray(e))throw new Error("input must be an array");if(0===e.length)return{numVals:0,numNans:0,numZeros:0,max:void 0,min:void 0};const t=e.length;let n=-1/0,i=1/0,r=0,s=0,o=0;for(let a=0;a<t;a++){const t=e[a];t>n&&(n=t),t<i&&(i=t),0===t&&(r+=1),isNaN(t)?s+=1:isFinite(t)||(o+=1)}const a={numVals:t,numZeros:r,numNans:s,max:n,min:i,numInfs:o};return a.max===-1/0&&(a.max=NaN),a.min===1/0&&(a.min=NaN),a},t.tensorStats=function(e){return i(this,void 0,void 0,function*(){const[t,n,i]=r.tidy(()=>{const t=r.scalar(0,e.dtype);return[e.min(),e.max(),e.equal(t).sum()]});return Promise.all([e.data(),t.data(),n.data(),i.data()]).then(([e,t,n,i])=>{const r=e.length;let s=0,o=0;for(let t=0;t<r;t++){const n=e[t];isNaN(n)?s+=1:isFinite(n)||(o+=1)}let a=t[0],l=n[0];s===r&&(a=NaN,l=NaN);return{numVals:r,numZeros:i[0],numNans:s,min:a,max:l,numInfs:o}})})},t.confusionMatrix=function(e,t,n,o){return i(this,void 0,void 0,function*(){s.assert(1===e.rank,"labels must be a 1D tensor"),s.assert(1===t.rank,"predictions must be a 1D tensor"),s.assert(e.size===t.size,"labels and predictions must be the same length"),null!=o&&s.assert(o.size===t.size,"labels and predictions must be the same length");const i=e.cast("int32"),a=t.cast("int32");null==n&&(n=r.tidy(()=>r.maximum(i.max(),a.max()).cast("int32").dataSync()[0]+1));let l=Promise.resolve(null);return null!=o&&(l=o.data()),Promise.all([i.data(),a.data(),l]).then(([e,t,i])=>{const r=Array(n).fill(0);for(let e=0;e<n;e++)r[e]=Array(n).fill(0);for(let n=0;n<e.length;n++){const s=e[n],o=t[n];r[s][o]+=null!=i?i[n]:1}return r})})},t.accuracy=function(e,t){return i(this,void 0,void 0,function*(){s.assertShapesMatch(e.shape,t.shape,"Error computing accuracy.");const n=e.equal(t),i=n.mean(),o=(yield i.data())[0];return r.dispose([n,i]),o})},t.perClassAccuracy=function(e,t,n){return i(this,void 0,void 0,function*(){return s.assert(1===e.rank,"labels must be a 1D tensor"),s.assert(1===t.rank,"predictions must be a 1D tensor"),s.assert(e.size===t.size,"labels and predictions must be the same length"),null==n&&(n=r.tidy(()=>r.maximum(e.max(),t.max()).dataSync()[0]+1)),Promise.all([e.data(),t.data()]).then(([e,t])=>{const i=Array(n).fill(0),r=Array(n).fill(0);for(let n=0;n<e.length;n++){const s=e[n],o=t[n];i[s]+=1,s===o&&(r[s]+=1)}const s=[];for(let e=0;e<i.length;e++)s.push({count:i[e],accuracy:0===i[e]?0:r[e]/i[e]});return s})})}},56286:(e,t)=>{"use strict";
/*
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function n(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function i(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.assert=n,t.assertShapesMatch=function(e,t,r=""){n(i(e,t),r+` Shapes ${e} and ${t} must match`)},t.arraysEqual=i,t.DECIMAL_PLACES_TO_CHECK=4},10454:(e,t)=>{"use strict";
/** @license See the LICENSE file. */Object.defineProperty(t,"__esModule",{value:!0});t.version="1.5.1"},4701:(e,t,n)=>{"use strict";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/Object.defineProperty(t,"__esModule",{value:!0});const i=n(25976);let r;const s="tfjs-visor-container";t.visor=function(){if("undefined"==typeof document)throw new Error("No document defined. This library needs a browser/dom to work");if(document.getElementById(s)&&null!=r)return r;let e,t=document.getElementById(s);function n(t,n){let r=null;return e=i.VisorComponent.render(t,e,{ref:e=>r=e,surfaceList:Array.from(n.values())}),r}null==t&&(t=document.createElement("div"),t.id=s,document.body.appendChild(t));const a=new Map,l=n(t,a);return r=new o(l,t,a,n),r};class o{constructor(e,t,n,i){this.visorComponent=e,this.el=t,this.surfaceList=n,this.renderVisor=i}surface(e){const{name:t}=e,n=null==e.tab?"Visor":e.tab;if(null==t||!("string"==typeof t||t instanceof String))throw new Error("You must pass a config object with a 'name' property to create or retrieve a surface");const i=Object.assign({},e,{tab:n}),r=`${t}-${n}`;return this.surfaceList.has(r)||this.surfaceList.set(r,i),this.renderVisor(this.el,this.surfaceList),this.visorComponent.getSurface(t,n)}isFullscreen(){return this.visorComponent.isFullscreen()}isOpen(){return this.visorComponent.isOpen()}close(){return this.visorComponent.close()}open(){return this.visorComponent.open()}toggle(){return this.visorComponent.toggle()}toggleFullScreen(){return this.visorComponent.toggleFullScreen()}bindKeys(){return this.visorComponent.bindKeys()}unbindKeys(){return this.visorComponent.unbindKeys()}setActiveTab(e){if(!this.visorComponent.state.tabs.has(e))throw new Error(`Tab '${e}' does not exist`);this.visorComponent.setState({activeTab:e})}}t.Visor=o},41103:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Abs:()=>N.Abs,Acos:()=>N.Acos,Acosh:()=>N.Acosh,AdadeltaOptimizer:()=>N.AdadeltaOptimizer,AdagradOptimizer:()=>N.AdagradOptimizer,AdamOptimizer:()=>N.AdamOptimizer,AdamaxOptimizer:()=>N.AdamaxOptimizer,Add:()=>N.Add,AddN:()=>N.AddN,All:()=>N.All,Any:()=>N.Any,ArgMax:()=>N.ArgMax,ArgMin:()=>N.ArgMin,Asin:()=>N.Asin,Asinh:()=>N.Asinh,Atan:()=>N.Atan,Atan2:()=>N.Atan2,Atanh:()=>N.Atanh,AvgPool:()=>N.AvgPool,AvgPool3D:()=>N.AvgPool3D,AvgPool3DGrad:()=>N.AvgPool3DGrad,AvgPoolGrad:()=>N.AvgPoolGrad,BatchMatMul:()=>N.BatchMatMul,BatchToSpaceND:()=>N.BatchToSpaceND,Bincount:()=>N.Bincount,BitwiseAnd:()=>N.BitwiseAnd,BroadcastArgs:()=>N.BroadcastArgs,BroadcastTo:()=>N.BroadcastTo,Callback:()=>ld,CallbackList:()=>Bs,Cast:()=>N.Cast,Ceil:()=>N.Ceil,ClipByValue:()=>N.ClipByValue,Complex:()=>N.Complex,ComplexAbs:()=>N.ComplexAbs,Concat:()=>N.Concat,Conv2D:()=>N.Conv2D,Conv2DBackpropFilter:()=>N.Conv2DBackpropFilter,Conv2DBackpropInput:()=>N.Conv2DBackpropInput,Conv3D:()=>N.Conv3D,Conv3DBackpropFilterV2:()=>N.Conv3DBackpropFilterV2,Conv3DBackpropInputV2:()=>N.Conv3DBackpropInputV2,Cos:()=>N.Cos,Cosh:()=>N.Cosh,CropAndResize:()=>N.CropAndResize,Cumprod:()=>N.Cumprod,Cumsum:()=>N.Cumsum,CustomCallback:()=>zs,DataStorage:()=>N.DataStorage,DenseBincount:()=>N.DenseBincount,DepthToSpace:()=>N.DepthToSpace,DepthwiseConv2dNative:()=>N.DepthwiseConv2dNative,DepthwiseConv2dNativeBackpropFilter:()=>N.DepthwiseConv2dNativeBackpropFilter,DepthwiseConv2dNativeBackpropInput:()=>N.DepthwiseConv2dNativeBackpropInput,Diag:()=>N.Diag,Dilation2D:()=>N.Dilation2D,Dilation2DBackpropFilter:()=>N.Dilation2DBackpropFilter,Dilation2DBackpropInput:()=>N.Dilation2DBackpropInput,Draw:()=>N.Draw,ENV:()=>N.ENV,EarlyStopping:()=>dd,Einsum:()=>N.Einsum,Elu:()=>N.Elu,EluGrad:()=>N.EluGrad,Environment:()=>N.Environment,Equal:()=>N.Equal,Erf:()=>N.Erf,Exp:()=>N.Exp,ExpandDims:()=>N.ExpandDims,Expm1:()=>N.Expm1,FFT:()=>N.FFT,Fill:()=>N.Fill,FlipLeftRight:()=>N.FlipLeftRight,Floor:()=>N.Floor,FloorDiv:()=>N.FloorDiv,FromPixels:()=>N.FromPixels,FusedBatchNorm:()=>N.FusedBatchNorm,FusedConv2D:()=>N.FusedConv2D,FusedDepthwiseConv2D:()=>N.FusedDepthwiseConv2D,GPGPUContext:()=>Vx,GatherNd:()=>N.GatherNd,GatherV2:()=>N.GatherV2,GraphModel:()=>Fh,Greater:()=>N.Greater,GreaterEqual:()=>N.GreaterEqual,History:()=>Us,IFFT:()=>N.IFFT,Identity:()=>N.Identity,Imag:()=>N.Imag,InputSpec:()=>jr,IsFinite:()=>N.IsFinite,IsInf:()=>N.IsInf,IsNan:()=>N.IsNan,KernelBackend:()=>N.KernelBackend,LRN:()=>N.LRN,LRNGrad:()=>N.LRNGrad,LayerVariable:()=>Ur,LayersModel:()=>Wo,LeakyRelu:()=>N.LeakyRelu,Less:()=>N.Less,LessEqual:()=>N.LessEqual,LinSpace:()=>N.LinSpace,Log:()=>N.Log,Log1p:()=>N.Log1p,LogSoftmax:()=>N.LogSoftmax,LogicalAnd:()=>N.LogicalAnd,LogicalNot:()=>N.LogicalNot,LogicalOr:()=>N.LogicalOr,LogicalXor:()=>N.LogicalXor,LowerBound:()=>N.LowerBound,MathBackendCPU:()=>Qp,MathBackendWebGL:()=>iw,MatrixBandPart:()=>N.MatrixBandPart,Max:()=>N.Max,MaxPool:()=>N.MaxPool,MaxPool3D:()=>N.MaxPool3D,MaxPool3DGrad:()=>N.MaxPool3DGrad,MaxPoolGrad:()=>N.MaxPoolGrad,MaxPoolWithArgmax:()=>N.MaxPoolWithArgmax,Maximum:()=>N.Maximum,Mean:()=>N.Mean,Min:()=>N.Min,Minimum:()=>N.Minimum,MirrorPad:()=>N.MirrorPad,Mod:()=>N.Mod,MomentumOptimizer:()=>N.MomentumOptimizer,Multinomial:()=>N.Multinomial,Multiply:()=>N.Multiply,Neg:()=>N.Neg,NonMaxSuppressionV3:()=>N.NonMaxSuppressionV3,NonMaxSuppressionV4:()=>N.NonMaxSuppressionV4,NonMaxSuppressionV5:()=>N.NonMaxSuppressionV5,NotEqual:()=>N.NotEqual,OP_SCOPE_SUFFIX:()=>N.OP_SCOPE_SUFFIX,OneHot:()=>N.OneHot,OnesLike:()=>N.OnesLike,Optimizer:()=>N.Optimizer,OptimizerConstructors:()=>N.OptimizerConstructors,Pack:()=>N.Pack,PadV2:()=>N.PadV2,Pool:()=>N.Pool,Pow:()=>N.Pow,Prelu:()=>N.Prelu,Prod:()=>N.Prod,RMSPropOptimizer:()=>N.RMSPropOptimizer,RNN:()=>il,RaggedGather:()=>N.RaggedGather,RaggedRange:()=>N.RaggedRange,RaggedTensorToTensor:()=>N.RaggedTensorToTensor,Range:()=>N.Range,Rank:()=>N.Rank,Real:()=>N.Real,RealDiv:()=>N.RealDiv,Reciprocal:()=>N.Reciprocal,Reduction:()=>N.Reduction,Relu:()=>N.Relu,Relu6:()=>N.Relu6,Reshape:()=>N.Reshape,ResizeBilinear:()=>N.ResizeBilinear,ResizeBilinearGrad:()=>N.ResizeBilinearGrad,ResizeNearestNeighbor:()=>N.ResizeNearestNeighbor,ResizeNearestNeighborGrad:()=>N.ResizeNearestNeighborGrad,Reverse:()=>N.Reverse,RotateWithOffset:()=>N.RotateWithOffset,Round:()=>N.Round,Rsqrt:()=>N.Rsqrt,SGDOptimizer:()=>N.SGDOptimizer,ScatterNd:()=>N.ScatterNd,SearchSorted:()=>N.SearchSorted,Select:()=>N.Select,Selu:()=>N.Selu,Sequential:()=>Zo,Sigmoid:()=>N.Sigmoid,Sign:()=>N.Sign,Sin:()=>N.Sin,Sinh:()=>N.Sinh,Slice:()=>N.Slice,Softmax:()=>N.Softmax,Softplus:()=>N.Softplus,SpaceToBatchND:()=>N.SpaceToBatchND,SparseFillEmptyRows:()=>N.SparseFillEmptyRows,SparseReshape:()=>N.SparseReshape,SparseSegmentMean:()=>N.SparseSegmentMean,SparseSegmentSum:()=>N.SparseSegmentSum,SparseToDense:()=>N.SparseToDense,SplitV:()=>N.SplitV,Sqrt:()=>N.Sqrt,Square:()=>N.Square,SquaredDifference:()=>N.SquaredDifference,StaticRegexReplace:()=>N.StaticRegexReplace,Step:()=>N.Step,StridedSlice:()=>N.StridedSlice,StringNGrams:()=>N.StringNGrams,StringSplit:()=>N.StringSplit,StringToHashBucketFast:()=>N.StringToHashBucketFast,Sub:()=>N.Sub,Sum:()=>N.Sum,SymbolicTensor:()=>Yr,Tan:()=>N.Tan,Tanh:()=>N.Tanh,Tensor:()=>N.Tensor,TensorBuffer:()=>N.TensorBuffer,TensorScatterUpdate:()=>N.TensorScatterUpdate,Tile:()=>N.Tile,TopK:()=>N.TopK,Transform:()=>N.Transform,Transpose:()=>N.Transpose,Unique:()=>N.Unique,Unpack:()=>N.Unpack,UnsortedSegmentSum:()=>N.UnsortedSegmentSum,UpperBound:()=>N.UpperBound,Variable:()=>N.Variable,ZerosLike:()=>N.ZerosLike,_FusedMatMul:()=>N._FusedMatMul,abs:()=>N.abs,acos:()=>N.acos,acosh:()=>N.acosh,add:()=>N.add,addN:()=>N.addN,all:()=>N.all,any:()=>N.any,argMax:()=>N.argMax,argMin:()=>N.argMin,asin:()=>N.asin,asinh:()=>N.asinh,atan:()=>N.atan,atan2:()=>N.atan2,atanh:()=>N.atanh,avgPool:()=>N.avgPool,avgPool3d:()=>N.avgPool3d,backend:()=>N.backend,backend_util:()=>N.backend_util,basicLSTMCell:()=>N.basicLSTMCell,batchNorm:()=>N.batchNorm,batchNorm2d:()=>N.batchNorm2d,batchNorm3d:()=>N.batchNorm3d,batchNorm4d:()=>N.batchNorm4d,batchToSpaceND:()=>N.batchToSpaceND,bincount:()=>N.bincount,bitwiseAnd:()=>N.bitwiseAnd,booleanMaskAsync:()=>N.booleanMaskAsync,broadcastArgs:()=>N.broadcastArgs,broadcastTo:()=>N.broadcastTo,broadcast_util:()=>N.broadcast_util,browser:()=>N.browser,buffer:()=>N.buffer,callbacks:()=>hd,cast:()=>N.cast,ceil:()=>N.ceil,clipByValue:()=>N.clipByValue,clone:()=>N.clone,complex:()=>N.complex,concat:()=>N.concat,concat1d:()=>N.concat1d,concat2d:()=>N.concat2d,concat3d:()=>N.concat3d,concat4d:()=>N.concat4d,constraints:()=>i,conv1d:()=>N.conv1d,conv2d:()=>N.conv2d,conv2dTranspose:()=>N.conv2dTranspose,conv3d:()=>N.conv3d,conv3dTranspose:()=>N.conv3dTranspose,copyRegisteredKernels:()=>N.copyRegisteredKernels,cos:()=>N.cos,cosh:()=>N.cosh,cosineWindow:()=>N.cosineWindow,cumprod:()=>N.cumprod,cumsum:()=>N.cumsum,customGrad:()=>N.customGrad,data:()=>O,denseBincount:()=>N.denseBincount,deprecationWarn:()=>N.deprecationWarn,depthToSpace:()=>N.depthToSpace,depthwiseConv2d:()=>N.depthwiseConv2d,deregisterOp:()=>_d,device_util:()=>N.device_util,diag:()=>N.diag,dilation2d:()=>N.dilation2d,disableDeprecationWarnings:()=>N.disableDeprecationWarnings,dispose:()=>N.dispose,disposeVariables:()=>N.disposeVariables,div:()=>N.div,divNoNan:()=>N.divNoNan,dot:()=>N.dot,dropout:()=>N.dropout,einsum:()=>N.einsum,elu:()=>N.elu,enableDebugMode:()=>N.enableDebugMode,enableProdMode:()=>N.enableProdMode,enclosingPowerOfTwo:()=>N.enclosingPowerOfTwo,engine:()=>N.engine,ensureShape:()=>N.ensureShape,env:()=>N.env,equal:()=>N.equal,erf:()=>N.erf,euclideanNorm:()=>N.euclideanNorm,exp:()=>N.exp,expandDims:()=>N.expandDims,expm1:()=>N.expm1,eye:()=>N.eye,fft:()=>N.fft,fill:()=>N.fill,findBackend:()=>N.findBackend,findBackendFactory:()=>N.findBackendFactory,floor:()=>N.floor,floorDiv:()=>N.floorDiv,forceHalfFloat:()=>sw,fused:()=>N.fused,gather:()=>N.gather,gatherND:()=>N.gatherND,gather_util:()=>N.gather_util,getBackend:()=>N.getBackend,getGradient:()=>N.getGradient,getKernel:()=>N.getKernel,getKernelsForBackend:()=>N.getKernelsForBackend,gpgpu_util:()=>k,grad:()=>N.grad,grads:()=>N.grads,greater:()=>N.greater,greaterEqual:()=>N.greaterEqual,ifft:()=>N.ifft,imag:()=>N.imag,image:()=>N.image,inTopKAsync:()=>N.inTopKAsync,initializers:()=>r,input:()=>ea,io:()=>N.io,irfft:()=>N.irfft,isFinite:()=>N.isFinite,isInf:()=>N.isInf,isNaN:()=>N.isNaN,keep:()=>N.keep,kernel_impls:()=>N.kernel_impls,layers:()=>s,leakyRelu:()=>N.leakyRelu,less:()=>N.less,lessEqual:()=>N.lessEqual,linalg:()=>N.linalg,linspace:()=>N.linspace,loadGraphModel:()=>Lh,loadGraphModelSync:()=>Ph,loadLayersModel:()=>Ko,localResponseNormalization:()=>N.localResponseNormalization,log:()=>N.log,log1p:()=>N.log1p,logSigmoid:()=>N.logSigmoid,logSoftmax:()=>N.logSoftmax,logSumExp:()=>N.logSumExp,logicalAnd:()=>N.logicalAnd,logicalNot:()=>N.logicalNot,logicalOr:()=>N.logicalOr,logicalXor:()=>N.logicalXor,losses:()=>N.losses,lowerBound:()=>N.lowerBound,matMul:()=>N.matMul,math:()=>N.math,max:()=>N.max,maxPool:()=>N.maxPool,maxPool3d:()=>N.maxPool3d,maxPoolWithArgmax:()=>N.maxPoolWithArgmax,maximum:()=>N.maximum,mean:()=>N.mean,memory:()=>N.memory,meshgrid:()=>N.meshgrid,metrics:()=>o,min:()=>N.min,minimum:()=>N.minimum,mirrorPad:()=>N.mirrorPad,mod:()=>N.mod,model:()=>Qo,models:()=>a,moments:()=>N.moments,movingAverage:()=>N.movingAverage,mul:()=>N.mul,multiRNNCell:()=>N.multiRNNCell,multinomial:()=>N.multinomial,neg:()=>N.neg,nextFrame:()=>N.nextFrame,norm:()=>N.norm,notEqual:()=>N.notEqual,oneHot:()=>N.oneHot,ones:()=>N.ones,onesLike:()=>N.onesLike,op:()=>N.op,outerProduct:()=>N.outerProduct,pad:()=>N.pad,pad1d:()=>N.pad1d,pad2d:()=>N.pad2d,pad3d:()=>N.pad3d,pad4d:()=>N.pad4d,pool:()=>N.pool,pow:()=>N.pow,prelu:()=>N.prelu,print:()=>N.print,prod:()=>N.prod,profile:()=>N.profile,raggedGather:()=>N.raggedGather,raggedRange:()=>N.raggedRange,raggedTensorToTensor:()=>N.raggedTensorToTensor,rand:()=>N.rand,randomGamma:()=>N.randomGamma,randomNormal:()=>N.randomNormal,randomStandardNormal:()=>N.randomStandardNormal,randomUniform:()=>N.randomUniform,randomUniformInt:()=>N.randomUniformInt,range:()=>N.range,ready:()=>N.ready,real:()=>N.real,reciprocal:()=>N.reciprocal,registerBackend:()=>N.registerBackend,registerCallbackConstructor:()=>ta,registerGradient:()=>N.registerGradient,registerKernel:()=>N.registerKernel,registerOp:()=>gd,regularizers:()=>l,relu:()=>N.relu,relu6:()=>N.relu6,removeBackend:()=>N.removeBackend,reshape:()=>N.reshape,reverse:()=>N.reverse,reverse1d:()=>N.reverse1d,reverse2d:()=>N.reverse2d,reverse3d:()=>N.reverse3d,reverse4d:()=>N.reverse4d,rfft:()=>N.rfft,round:()=>N.round,rsqrt:()=>N.rsqrt,scalar:()=>N.scalar,scatterND:()=>N.scatterND,scatter_util:()=>N.scatter_util,searchSorted:()=>N.searchSorted,selu:()=>N.selu,separableConv2d:()=>N.separableConv2d,sequential:()=>Jo,serialization:()=>N.serialization,setBackend:()=>N.setBackend,setPlatform:()=>N.setPlatform,setWebGLContext:()=>Fb,setdiff1dAsync:()=>N.setdiff1dAsync,shared:()=>M,sigmoid:()=>N.sigmoid,sign:()=>N.sign,signal:()=>N.signal,sin:()=>N.sin,sinh:()=>N.sinh,slice:()=>N.slice,slice1d:()=>N.slice1d,slice2d:()=>N.slice2d,slice3d:()=>N.slice3d,slice4d:()=>N.slice4d,slice_util:()=>N.slice_util,softmax:()=>N.softmax,softplus:()=>N.softplus,spaceToBatchND:()=>N.spaceToBatchND,sparse:()=>N.sparse,sparseToDense:()=>N.sparseToDense,spectral:()=>N.spectral,split:()=>N.split,sqrt:()=>N.sqrt,square:()=>N.square,squaredDifference:()=>N.squaredDifference,squeeze:()=>N.squeeze,stack:()=>N.stack,step:()=>N.step,stridedSlice:()=>N.stridedSlice,string:()=>N.string,sub:()=>N.sub,sum:()=>N.sum,sumOutType:()=>N.sumOutType,tan:()=>N.tan,tanh:()=>N.tanh,tensor:()=>N.tensor,tensor1d:()=>N.tensor1d,tensor2d:()=>N.tensor2d,tensor3d:()=>N.tensor3d,tensor4d:()=>N.tensor4d,tensor5d:()=>N.tensor5d,tensor6d:()=>N.tensor6d,tensorScatterUpdate:()=>N.tensorScatterUpdate,tensor_util:()=>N.tensor_util,test_util:()=>N.test_util,tidy:()=>N.tidy,tile:()=>N.tile,time:()=>N.time,topk:()=>N.topk,train:()=>N.train,transpose:()=>N.transpose,truncatedNormal:()=>N.truncatedNormal,unique:()=>N.unique,unregisterGradient:()=>N.unregisterGradient,unregisterKernel:()=>N.unregisterKernel,unsortedSegmentSum:()=>N.unsortedSegmentSum,unstack:()=>N.unstack,upcastType:()=>N.upcastType,upperBound:()=>N.upperBound,util:()=>N.util,valueAndGrad:()=>N.valueAndGrad,valueAndGrads:()=>N.valueAndGrads,variable:()=>N.variable,variableGrads:()=>N.variableGrads,version:()=>JM,version_converter:()=>Bh,version_core:()=>N.version_core,version_cpu:()=>Ag,version_layers:()=>So,version_webgl:()=>rw,webgl:()=>ow,webgl_util:()=>R,where:()=>N.where,whereAsync:()=>N.whereAsync,zeros:()=>N.zeros,zerosLike:()=>N.zerosLike});var i={};n.r(i),n.d(i,{maxNorm:()=>ms,minMaxNorm:()=>_s,nonNeg:()=>ys,unitNorm:()=>gs});var r={};n.r(r),n.d(r,{constant:()=>Ts,glorotNormal:()=>Cs,glorotUniform:()=>Ss,heNormal:()=>Os,heUniform:()=>Ms,identity:()=>Is,leCunNormal:()=>Rs,leCunUniform:()=>ks,ones:()=>bs,orthogonal:()=>Ns,randomNormal:()=>Es,randomUniform:()=>xs,truncatedNormal:()=>ws,varianceScaling:()=>As,zeros:()=>vs});var s={};n.r(s),n.d(s,{Layer:()=>Xr,RNN:()=>il,RNNCell:()=>rl,activation:()=>Pu,add:()=>Hu,alphaDropout:()=>Lc,average:()=>Wu,averagePooling1d:()=>nc,averagePooling2d:()=>sc,averagePooling3d:()=>lc,avgPool1d:()=>ic,avgPool2d:()=>oc,avgPool3d:()=>uc,avgPooling1d:()=>rc,avgPooling2d:()=>ac,avgPooling3d:()=>cc,batchNormalization:()=>Ju,bidirectional:()=>Cc,categoryEncoding:()=>zc,centerCrop:()=>$c,concatenate:()=>Xu,conv1d:()=>Cu,conv2d:()=>Ou,conv2dTranspose:()=>Mu,conv3d:()=>Ru,conv3dTranspose:()=>ku,convLstm2d:()=>wc,convLstm2dCell:()=>Ic,cropping2D:()=>Du,dense:()=>Bu,depthwiseConv2d:()=>Lu,dot:()=>Qu,dropout:()=>$u,elu:()=>xu,embedding:()=>Gu,flatten:()=>zu,gaussianDropout:()=>Fc,gaussianNoise:()=>Dc,globalAveragePooling1d:()=>dc,globalAveragePooling2d:()=>hc,globalMaxPool1d:()=>Mc,globalMaxPool2d:()=>Rc,globalMaxPooling1d:()=>pc,globalMaxPooling2d:()=>fc,gru:()=>_c,gruCell:()=>vc,input:()=>ea,inputLayer:()=>Tu,layerNormalization:()=>ec,leakyReLU:()=>wu,lstm:()=>bc,lstmCell:()=>Tc,masking:()=>Pc,maxPool1d:()=>kc,maxPool2d:()=>Nc,maxPooling1d:()=>mc,maxPooling2d:()=>gc,maxPooling3d:()=>yc,maximum:()=>qu,minimum:()=>Ku,multiply:()=>Zu,permute:()=>Yu,prelu:()=>Iu,randomWidth:()=>Vc,reLU:()=>Eu,repeatVector:()=>Vu,rescaling:()=>Bc,reshape:()=>ju,resizing:()=>Uc,rnn:()=>Ac,separableConv2d:()=>Nu,simpleRNN:()=>xc,simpleRNNCell:()=>Ec,softmax:()=>Au,spatialDropout1d:()=>Uu,stackedRNNCells:()=>Sc,thresholdedReLU:()=>Su,timeDistributed:()=>Oc,upSampling2d:()=>Fu,zeroPadding2d:()=>tc});var o={};n.r(o),n.d(o,{MAPE:()=>Jc,MSE:()=>nd,binaryAccuracy:()=>jc,binaryCrossentropy:()=>Yc,categoricalAccuracy:()=>Hc,categoricalCrossentropy:()=>Wc,cosineProximity:()=>Kc,mape:()=>ed,meanAbsoluteError:()=>Zc,meanAbsolutePercentageError:()=>Qc,meanSquaredError:()=>td,mse:()=>id,precision:()=>Xc,r2Score:()=>rd,recall:()=>qc,sparseCategoricalAccuracy:()=>Gc});var a={};n.r(a),n.d(a,{modelFromJSON:()=>qo});var l={};n.r(l),n.d(l,{l1:()=>od,l1l2:()=>sd,l2:()=>ad});var u={};n.r(u),n.d(u,{json:()=>Sd});var c={};n.r(c),n.d(c,{json:()=>Cd});var d={};n.r(d),n.d(d,{json:()=>Od});var h={};n.r(h),n.d(h,{json:()=>Md});var p={};n.r(p),n.d(p,{json:()=>Rd});var f={};n.r(f),n.d(f,{json:()=>kd});var m={};n.r(m),n.d(m,{json:()=>Nd});var g={};n.r(g),n.d(g,{json:()=>Dd});var y={};n.r(y),n.d(y,{json:()=>Fd});var _={};n.r(_),n.d(_,{json:()=>Ld});var v={};n.r(v),n.d(v,{json:()=>Pd});var b={};n.r(b),n.d(b,{json:()=>Bd});var T={};n.r(T),n.d(T,{json:()=>$d});var x={};n.r(x),n.d(x,{json:()=>Ud});var E={};n.r(E),n.d(E,{json:()=>zd});var w={};n.r(w),n.d(w,{json:()=>Vd});var I={};n.r(I),n.d(I,{json:()=>jd});var A={};n.r(A),n.d(A,{json:()=>Yd});var S={};n.r(S),n.d(S,{json:()=>Gd});var C={};n.r(C),n.d(C,{OP_SCOPE_SUFFIX:()=>lh.BTT,abs:()=>lh.tnl,acos:()=>lh.HQu,acosh:()=>lh.FqL,add:()=>lh.WQq,addN:()=>lh.QiD,all:()=>lh.Q7R,any:()=>lh.bzn,argMax:()=>lh.FLi,argMin:()=>lh.XRg,asin:()=>lh.qRo,asinh:()=>lh.yHs,atan:()=>lh.rYl,atan2:()=>lh.FPz,atanh:()=>lh.rfv,avgPool:()=>lh.$jT,avgPool3d:()=>lh.sub,basicLSTMCell:()=>lh.lZX,batchNorm:()=>lh.$v7,batchNorm2d:()=>lh.BFc,batchNorm3d:()=>lh.kSi,batchNorm4d:()=>lh.T5N,batchToSpaceND:()=>lh.GTe,bincount:()=>lh.HbZ,bitwiseAnd:()=>lh.vjT,booleanMaskAsync:()=>lh.ftb,broadcastArgs:()=>lh.ROE,broadcastTo:()=>lh.hOW,buffer:()=>lh.ra8,cast:()=>lh.wgE,ceil:()=>lh.mkO,clipByValue:()=>lh.zQh,clone:()=>lh.o8B,complex:()=>lh.faB,concat:()=>lh.xWs,concat1d:()=>lh.I1m,concat2d:()=>lh.RPU,concat3d:()=>lh.O5O,concat4d:()=>lh.P1l,conv1d:()=>lh.kA9,conv2d:()=>lh.Xtf,conv2dTranspose:()=>lh.wX9,conv3d:()=>lh.IPL,conv3dTranspose:()=>lh.jIJ,cos:()=>lh.gnS,cosh:()=>lh.yIG,cosineWindow:()=>lh._jP,cumprod:()=>lh.Lp0,cumsum:()=>lh.rCv,denseBincount:()=>lh.aOp,depthToSpace:()=>lh.Rj8,depthwiseConv2d:()=>lh.Gl3,diag:()=>lh.smy,dilation2d:()=>lh.X7t,div:()=>lh.y4m,divNoNan:()=>lh.ek5,dot:()=>lh.Omf,dropout:()=>lh.EZY,einsum:()=>lh._3C,elu:()=>lh.Pqc,enclosingPowerOfTwo:()=>lh.FJY,ensureShape:()=>lh.QP2,equal:()=>lh.LCg,erf:()=>lh.Y12,euclideanNorm:()=>lh.p4S,exp:()=>lh.oNF,expandDims:()=>lh.UG6,expm1:()=>lh.IYd,eye:()=>lh.y5U,fft:()=>lh.hVP,fill:()=>lh.GSj,floor:()=>lh.RIf,floorDiv:()=>lh.wh_,fused:()=>lh.cZk,gather:()=>lh.kgh,gatherND:()=>lh.SY9,greater:()=>lh.rhj,greaterEqual:()=>lh.DQN,ifft:()=>lh.KGM,imag:()=>lh.ngS,image:()=>lh.Slp,inTopKAsync:()=>lh.U4u,irfft:()=>lh.ggX,isFinite:()=>lh.MIs,isInf:()=>lh.EN4,isNaN:()=>lh.yrW,leakyRelu:()=>lh.H8d,less:()=>lh.M7h,lessEqual:()=>lh.InN,linalg:()=>lh.mPL,linspace:()=>lh.mT8,localResponseNormalization:()=>lh.Kgs,log:()=>lh.Rm2,log1p:()=>lh.Kko,logSigmoid:()=>lh.nqI,logSoftmax:()=>lh.HPB,logSumExp:()=>lh.VZ,logicalAnd:()=>lh.n76,logicalNot:()=>lh.NSZ,logicalOr:()=>lh.ztW,logicalXor:()=>lh.rxB,losses:()=>lh.YYh,lowerBound:()=>lh.yzS,matMul:()=>lh.NoW,max:()=>lh.T9B,maxPool:()=>lh.jgi,maxPool3d:()=>lh.NYV,maxPoolWithArgmax:()=>lh.RO,maximum:()=>lh.PhQ,mean:()=>lh.i2o,meshgrid:()=>lh.OYQ,min:()=>lh.jkA,minimum:()=>lh.BpO,mirrorPad:()=>lh.FFZ,mod:()=>lh.ziu,moments:()=>lh.Clk,movingAverage:()=>lh.CRk,mul:()=>lh.lKK,multiRNNCell:()=>lh.YDF,multinomial:()=>lh.OjQ,neg:()=>lh.HZy,norm:()=>lh.xbf,notEqual:()=>lh.Ec,oneHot:()=>lh.Mw0,ones:()=>lh.SaS,onesLike:()=>lh.P61,op:()=>lh.op,outerProduct:()=>lh.X4o,pad:()=>lh.eVF,pad1d:()=>lh.BZs,pad2d:()=>lh.grY,pad3d:()=>lh.XHu,pad4d:()=>lh.WLX,pool:()=>lh.dzn,pow:()=>lh.n7C,prelu:()=>lh.NsG,print:()=>lh.yyV,prod:()=>lh._eU,raggedGather:()=>lh.whe,raggedRange:()=>lh.iyU,raggedTensorToTensor:()=>lh.Q0_,rand:()=>lh._9M,randomGamma:()=>lh.pR9,randomNormal:()=>lh.FE$,randomStandardNormal:()=>lh.m0H,randomUniform:()=>lh.YeY,randomUniformInt:()=>lh.HYA,range:()=>lh.y17,real:()=>lh.xav,reciprocal:()=>lh.VOZ,relu:()=>lh.VVh,relu6:()=>lh.j__,reshape:()=>lh.tQQ,reverse:()=>lh.BEg,reverse1d:()=>lh.QD2,reverse2d:()=>lh.LMr,reverse3d:()=>lh.I2l,reverse4d:()=>lh.JYU,rfft:()=>lh.z8$,round:()=>lh.LIG,rsqrt:()=>lh.Z$r,scalar:()=>lh.d_2,scatterND:()=>lh.NFr,searchSorted:()=>lh.sZg,selu:()=>lh.WfX,separableConv2d:()=>lh.wdz,setdiff1dAsync:()=>lh.F12,sigmoid:()=>lh.ry7,sign:()=>lh._SZ,signal:()=>lh.vPA,sin:()=>lh.F8e,sinh:()=>lh.L0l,slice:()=>lh.dik,slice1d:()=>lh.Q$M,slice2d:()=>lh.zAd,slice3d:()=>lh.wck,slice4d:()=>lh.R0O,softmax:()=>lh.Vs9,softplus:()=>lh.lw0,spaceToBatchND:()=>lh.eDJ,sparse:()=>lh.lMo,sparseToDense:()=>lh.Zhr,spectral:()=>lh.lOn,split:()=>lh.lDo,sqrt:()=>lh.RZD,square:()=>lh.EwI,squaredDifference:()=>lh.Pbu,squeeze:()=>lh.r2V,stack:()=>lh.t$z,step:()=>lh.PMw,stridedSlice:()=>lh.Ym9,string:()=>lh.YjP,sub:()=>lh.jbE,sum:()=>lh.czq,tan:()=>lh.Mlm,tanh:()=>lh.ymU,tensor:()=>lh.OEK,tensor1d:()=>lh.tGX,tensor2d:()=>lh.KtR,tensor3d:()=>lh.$_$,tensor4d:()=>lh.g9W,tensor5d:()=>lh.Lpo,tensor6d:()=>lh.yxw,tensorScatterUpdate:()=>lh.NNh,tile:()=>lh.Vsq,topk:()=>lh.rfw,transpose:()=>lh.mgz,truncatedNormal:()=>lh.efE,unique:()=>lh.AmM,unsortedSegmentSum:()=>lh.zAU,unstack:()=>lh.K$i,upperBound:()=>lh.rni,variable:()=>lh.bvq,where:()=>lh._M9,whereAsync:()=>lh.YJN,zeros:()=>lh.Ul9,zerosLike:()=>lh.POl});var O={};n.r(O),n.d(O,{CSVDataset:()=>Op,Dataset:()=>yp,FileDataSource:()=>Vp,TextLineDataset:()=>xp,URLDataSource:()=>jp,array:()=>vp,csv:()=>Yp,func:()=>Gp,generator:()=>Hp,microphone:()=>Xp,version_data:()=>qp,webcam:()=>Wp,zip:()=>bp});var M={};n.r(M),n.d(M,{addImpl:()=>mf,bincountImpl:()=>vf,bincountReduceImpl:()=>bf,bitwiseAndImpl:()=>Tf,castImpl:()=>cf,ceilImpl:()=>Sf,concatImpl:()=>Mf,equalImpl:()=>Rf,expImpl:()=>Df,expm1Impl:()=>Pf,floorDivImpl:()=>jf,floorImpl:()=>Uf,gatherNdImpl:()=>Hf,gatherV2Impl:()=>Wf,greaterEqualImpl:()=>Zf,greaterImpl:()=>Xf,lessEqualImpl:()=>im,lessImpl:()=>em,linSpaceImpl:()=>om,logImpl:()=>am,maxImpl:()=>cm,maximumImpl:()=>dm,minimumImpl:()=>fm,multiplyImpl:()=>ym,negImpl:()=>Tm,notEqualImpl:()=>Em,prodImpl:()=>Om,raggedGatherImpl:()=>Dm,raggedRangeImpl:()=>Lm,raggedTensorToTensorImpl:()=>zm,rangeImpl:()=>Vm,rsqrtImpl:()=>jm,scatterImpl:()=>Hm,sigmoidImpl:()=>Wm,simpleAbsImpl:()=>Jp,sliceImpl:()=>Km,sparseFillEmptyRowsImpl:()=>Jm,sparseReshapeImpl:()=>eg,sparseSegmentReductionImpl:()=>tg,sqrtImpl:()=>ng,squaredDifferenceImpl:()=>sg,staticRegexReplaceImpl:()=>lg,stridedSliceImpl:()=>dg,stringNGramsImpl:()=>pg,stringSplitImpl:()=>mg,stringToHashBucketFastImpl:()=>gg,subImpl:()=>yg,tileImpl:()=>Tg,topKImpl:()=>wg,transposeImpl:()=>Am,uniqueImpl:()=>Ig});var R={};n.r(R),n.d(R,{assertNotComplex:()=>zT,bindCanvasToFramebuffer:()=>mT,bindColorTextureToFramebuffer:()=>gT,bindTextureToProgramUniformSampler:()=>fT,bindTextureUnit:()=>cT,bindVertexBufferToProgramAttribute:()=>uT,callAndCheck:()=>Yb,canBeRepresented:()=>Wb,createFragmentShader:()=>Zb,createFramebuffer:()=>lT,createProgram:()=>eT,createStaticIndexBuffer:()=>rT,createStaticVertexBuffer:()=>iT,createTexture:()=>oT,createVertexShader:()=>Kb,getBatchDim:()=>xT,getExtensionOrThrow:()=>qb,getFramebufferErrorMessage:()=>vT,getMaxTexturesInShader:()=>NT,getNumChannels:()=>sT,getProgramUniformLocation:()=>pT,getProgramUniformLocationOrThrow:()=>hT,getRowsCols:()=>ET,getShapeAs3D:()=>wT,getTextureShapeFromLogicalShape:()=>IT,getWebGLDisjointQueryTimerVersion:()=>DT,getWebGLErrorMessage:()=>Xb,getWebGLMaxTextureSize:()=>MT,hasExtension:()=>FT,isCapableOfRenderingToFloatTexture:()=>PT,isDownloadFloatTextureEnabled:()=>BT,isReshapeFree:()=>ST,isWebGLFenceEnabled:()=>UT,isWebGLVersionEnabled:()=>LT,linkProgram:()=>tT,logShaderSourceAndInfoLog:()=>Jb,resetMaxTextureSize:()=>RT,resetMaxTexturesInShader:()=>kT,unbindColorTextureFromFramebuffer:()=>yT,unbindTextureUnit:()=>dT,validateFramebuffer:()=>_T,validateProgram:()=>nT,validateTextureSize:()=>aT});var k={};n.r(k),n.d(k,{bindVertexProgramAttributeStreams:()=>Dx,createBufferFromOutputTexture:()=>Px,createFloat16MatrixTexture:()=>Sx,createFloat16PackedMatrixTexture:()=>Nx,createFloat32MatrixTexture:()=>Ix,createIndexBuffer:()=>xx,createPackedMatrixTexture:()=>Rx,createUnsignedBytesMatrixTexture:()=>Ox,createVertexBuffer:()=>Tx,createVertexShader:()=>bx,downloadByteEncodedFloatMatrixFromOutputTexture:()=>$x,downloadFloat32MatrixFromBuffer:()=>Bx,downloadMatrixFromPackedOutputTexture:()=>zx,downloadPackedMatrixFromBuffer:()=>Ux,getInternalFormatForFloat16MatrixTexture:()=>Ax,getInternalFormatForFloat16PackedMatrixTexture:()=>kx,getInternalFormatForFloat32MatrixTexture:()=>wx,getInternalFormatForPackedMatrixTexture:()=>Mx,getInternalFormatForUnsignedBytesMatrixTexture:()=>Cx,uploadDenseMatrixToTexture:()=>Fx,uploadPixelDataToTexture:()=>Lx});var N=n(15838),D=n(15441),F=n(29809),L=n(9258),P=n(10700);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const B={kernelName:D.ljI,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)(e,(0,P.P)((0,F.w)(n,"float32"),-1))}}};var $=n(89359),U=n(96522),z=n(45702),V=n(79348),j=n(45793),Y=n(77126);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const G={kernelName:D.Vvy,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=(0,j.E)((0,F.w)(n,"float32")),i=(0,V.R)((0,Y.j)((0,z.d)(1),t));return(0,U.H)((0,$.y)(e,i))}}}},H={kernelName:D.PH8,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=(0,V.R)((0,Y.j)((0,j.E)((0,F.w)(n,"float32")),1));return(0,$.y)(e,t)}}}};var W=n(62198),X=n(62302),q=n(83791);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const K={kernelName:D.OMN,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t,r=W.assertAndGetBroadcastShape(n.shape,i.shape);return{a:()=>{let t=e;const i=W.getReductionAxes(n.shape,r);return i.length>0&&(t=(0,q.c)(t,i)),(0,X.t)(t,n.shape)},b:()=>{let t=e;const n=W.getReductionAxes(i.shape,r);return n.length>0&&(t=(0,q.c)(t,n)),(0,X.t)(t,i.shape)}}}},Z={kernelName:D.EkD,saveAllInputs:!0,gradFunc:(e,t)=>{const n={};return t.forEach((t,i)=>{n[i]=()=>e.clone()}),n}};var Q=n(55537);
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const J={kernelName:D.Jp_,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,Q.P)(n)}}},ee={kernelName:D.p_m,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,Q.P)(n)}}},te={kernelName:D.QKF,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,$.y)(e,(0,V.R)((0,Y.j)((0,z.d)(1),(0,j.E)((0,F.w)(n,"float32")))))}}};var ne=n(37523);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const ie={kernelName:D.epO,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=(0,V.R)((0,ne.W)((0,z.d)(1),(0,j.E)((0,F.w)(n,"float32"))));return(0,$.y)(e,t)}}}},re={kernelName:D.lxb,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t,r=(0,W.assertAndGetBroadcastShape)(n.shape,i.shape);return{a:()=>{const t=(0,ne.W)((0,j.E)(n),(0,j.E)(i));let s=(0,L.l)(e,(0,$.y)(i,t));const o=(0,W.getReductionAxes)(n.shape,r);return o.length>0&&(s=(0,q.c)(s,o)),(0,X.t)(s,n.shape)},b:()=>{const t=(0,ne.W)((0,j.E)(n),(0,j.E)(i));let s=(0,U.H)((0,L.l)(e,(0,$.y)(n,t)));const o=(0,W.getReductionAxes)(i.shape,r);return o.length>0&&(s=(0,q.c)(s,o)),(0,X.t)(s,i.shape)}}}},se={kernelName:D.TyE,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,$.y)(e,(0,ne.W)((0,j.E)((0,F.w)(n,"float32")),1))}}},oe={kernelName:D.zP9,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,$.y)(e,(0,Y.j)((0,z.d)(1),(0,j.E)((0,F.w)(n,"float32"))))}}};var ae=n(41585),le=n(28189),ue=n(45119),ce=n(47195),de=n(70929);const he=(0,de.op)({avgPool3dGrad_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r,s){const o=(0,le.YT)(e,"dy","avgPool3dGrad"),a=(0,le.YT)(t,"input","avgPool3dGrad");let l=o,u=a,c=!1;4===a.rank&&(c=!0,l=(0,X.t)(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]]),u=(0,X.t)(a,[1,a.shape[0],a.shape[1],a.shape[2],a.shape[3]])),ue.vA(5===l.rank,()=>`Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`),ue.vA(5===u.rank,()=>`Error in avgPool3dGrad: input must be rank 5 but got rank ${u.rank}.`),(0,ce.s_)("avgPool3dGrad",r,s);const d={dy:l,input:u},h={filterSize:n,strides:i,pad:r,dimRoundingMode:s},p=ae.T2.runKernel(D.wwC,d,h);return c?(0,X.t)(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}}),pe={kernelName:D.cS,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[i]=t,{filterSize:r,strides:s,pad:o,dimRoundingMode:a}=n;return{x:()=>he(e,i,r,s,o,a)}}};const fe=(0,de.op)({avgPoolGrad_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r){const s=(0,le.YT)(e,"dy","avgPoolGrad"),o=(0,le.YT)(t,"input","avgPoolGrad");ue.vA(o.rank===s.rank,()=>`Rank of input (${o.rank}) does not match rank of dy (${s.rank})`);let a=o,l=s,u=!1;3===o.rank&&(u=!0,a=(0,X.t)(o,[1,o.shape[0],o.shape[1],o.shape[2]]),l=(0,X.t)(s,[1,s.shape[0],s.shape[1],s.shape[2]])),ue.vA(4===l.rank,()=>`Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`),ue.vA(4===a.rank,()=>`Error in avgPoolGrad: input must be rank 4 but got rank ${a.rank}.`);const c={dy:l,input:a},d={filterSize:n,strides:i,pad:r},h=ae.T2.runKernel(D.VCH,c,d);return u?(0,X.t)(h,[h.shape[1],h.shape[2],h.shape[3]]):h}}),me={kernelName:D.ho8,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[i]=t,{filterSize:r,strides:s,pad:o}=n;return{x:()=>fe(e,i,r,s,o)}}};var ge=n(65703);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const ye={kernelName:D.jAQ,inputsToSave:["a","b"],gradFunc:(e,t,n)=>{const[i,r]=t,{transposeA:s,transposeB:o}=n;return s||o?!s&&o?{a:()=>(0,ge.N)(e,r,!1,!1),b:()=>(0,ge.N)(e,i,!0,!1)}:s&&!o?{a:()=>(0,ge.N)(r,e,!1,!0),b:()=>(0,ge.N)(i,e,!1,!1)}:{a:()=>(0,ge.N)(r,e,!0,!0),b:()=>(0,ge.N)(e,i,!0,!0)}:{a:()=>(0,ge.N)(e,r,!1,!0),b:()=>(0,ge.N)(i,e,!0,!1)}}};var _e=n(10776);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const ve={kernelName:D.Ik2,gradFunc:(e,t,n)=>{const{blockShape:i,crops:r}=n;return{x:()=>(0,_e.e)(e,i,r)}}},be={kernelName:D.LB5,gradFunc:(e,t,n)=>{const i=n,r=i.inputShape,s=i.shape,o=Array.from(s);for(let e=r.length-1;e>=0;e--)if(r[e]===s[e])o[e]=1;else if(1!==r[e])throw new Error(`broadcastTo(): [${r}] cannot be broadcast to [${s}].`);const a=[];for(let e=0;e<o.length;e++)o[e]>1&&a.push(e);return{x:()=>(0,q.c)(e,a,!0)}}},Te={kernelName:D.KXH,gradFunc:e=>({x:()=>e.clone()})},xe={kernelName:D.QDP,gradFunc:e=>({x:()=>(0,Q.P)(e)})};var Ee=n(13337),we=n(56508),Ie=n(13789),Ae=n(12151);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Se={kernelName:D.vaV,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[i]=t,{clipValueMin:r,clipValueMax:s}=n;return{x:()=>(0,Ae._)((0,Ie.n)((0,Ee.D)(i,r),(0,we.I)(i,s)),e,(0,Q.P)(e))}}},Ce={kernelName:D.$zE,inputsToSave:["x"],gradFunc:B.gradFunc};var Oe=n(66512);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Me={kernelName:D.$dB,saveAllInputs:!0,gradFunc:(e,t,n)=>{const i=t.map(e=>e.shape),{axis:r}=n,s=(0,ue.Y6)(r,t[0].shape)[0],o=i.map(e=>e[s]);return(0,Oe.l)(e,o,s).map(e=>()=>e)}};var Re=n(25248),ke=n(80252);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Ne={kernelName:D.p2J,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const[i,r]=t,{dilations:s,strides:o,pad:a,dataFormat:l}=n;return ue.vA(ce.Dh(s),()=>`Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`),{x:()=>(0,ke.v)(i.shape,e,r,o,a,l),filter:()=>(0,Re.H)(i,e,r.shape,o,a,l)}}};var De=n(28794);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Fe={kernelName:D.jfg,inputsToSave:["dy","filter"],gradFunc:(e,t,n)=>{const[i,r]=t,{strides:s,pad:o,dataFormat:a,dimRoundingMode:l}=n;return{dy:()=>(0,De.X)(e,r,s,o,a,1,l),filter:()=>(0,Re.H)(e,i,r.shape,s,o,a,l)}}};const Le=(0,de.op)({conv3DBackpropFilter_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r){let s=e;4===e.rank&&(s=(0,X.t)(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]));let o=t;4===o.rank&&(o=(0,X.t)(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]])),ue.vA(5===s.rank,()=>`Error in conv3dDerFilter: input must be rank 5, but got shape ${s.shape}.`),ue.vA(5===o.rank,()=>`Error in conv3dDerFilter: dy must be rank 5, but got shape ${o.shape}.`),ue.vA(5===n.length,()=>`Error in conv3dDerFilter: filterShape must be length 5, but got ${n}.`),ue.vA(s.shape[4]===n[3],()=>`Error in conv3dDerFilter: depth of input ${s.shape[4]}) must match input depth in filter (${n[3]}.`),ue.vA(o.shape[4]===n[4],()=>`Error in conv3dDerFilter: depth of dy (${o.shape[4]}) must match output depth for filter (${n[4]}).`);const a={x:s,dy:o},l={strides:i,pad:r,filterShape:n};return ae.T2.runKernel(D.iGz,a,l)}});var Pe=n(31895);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Be={kernelName:D.A1h,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const{dilations:i,strides:r,pad:s}=n;ue.vA((0,ce.Dh)(i),()=>`Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${i}'`);const[o,a]=t;return{x:()=>(0,Pe.c)(o.shape,e,a,r,s),filter:()=>Le(o,e,a.shape,r,s)}}};var $e=n(33726);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Ue={kernelName:D.Mn0,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)((0,U.H)((0,$e.F)((0,F.w)(n,"float32"))),e)}}};var ze=n(58276);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Ve={kernelName:D.MnK,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)((0,ze.L)((0,F.w)(n,"float32")),e)}}};var je=n(21078),Ye=n(76808),Ge=n(7703);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const He={kernelName:D.nY8,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[i]=t,{axis:r,exclusive:s,reverse:o}=n;return{x:()=>{const t=(0,je.Em)([r],i.rank);let n=(0,Ye.r)(e,r,s,!o);return null!=t&&(n=(0,Ge.m)(n,t)),n}}}};var We=n(41890),Xe=n(83134);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const qe={kernelName:D.tGH,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const{dilations:i,strides:r,pad:s,dimRoundingMode:o}=n,a=null==i?[1,1]:i;ue.vA(ce.Dh(a),()=>`Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${a}'`);const[l,u]=t;return ue.vA(4===l.rank,()=>`Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`),ue.vA(4===u.rank,()=>`Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${u.rank}.`),ue.vA(l.shape[3]===u.shape[2],()=>`Error in gradient of depthwiseConv2d: number of input channels (${l.shape[3]}) must match the inChannels dimension in filter ${u.shape[2]}.`),ue.vA(ce.G0(r,a),()=>`Error in gradient of depthwiseConv2d: Either strides or dilations must be 1. Got strides ${r} and dilations '${a}'.`),ce.s_("depthwiseConv2d",s,o),{x:()=>(0,Xe.l)(l.shape,e,u,r,s,a,o),filter:()=>(0,We.x)(l,e,u.shape,r,s,a,o)}}},Ke={kernelName:D.jxD,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const[i,r]=t,s={x:i,filter:r,dy:e},o={x:i,filter:r,dy:e};return{x:()=>ae.T2.runKernel(D.bP9,s,n),filter:()=>ae.T2.runKernel(D.pk0,o,n)}}},Ze={kernelName:D.Pah,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t,i={dy:e,y:n};return{x:()=>ae.T2.runKernel(D.rsH,i)}}};var Qe=n(8631);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Je={kernelName:D._s9,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t,i=(0,L.l)((0,Qe.o)((0,U.H)((0,j.E)(n))),2/Math.sqrt(Math.PI));return{x:()=>(0,L.l)(e,i)}}},et={kernelName:D.ox3,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)(e,n)}}},tt={kernelName:D.ybN,inputsToSave:["input"],gradFunc:(e,t)=>{const[n]=t;return{input:()=>(0,X.t)(e,n.shape)}}},nt={kernelName:D.ybj,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)(e,(0,Qe.o)(n))}}},it={kernelName:D.ZgB,gradFunc:e=>({x:()=>(0,Q.P)(e)})},rt={kernelName:D.ElG,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t,r=(0,W.assertAndGetBroadcastShape)(n.shape,i.shape);return{a:()=>{const t=(0,$.y)(e,(0,F.w)(i,"float32")),s=(0,W.getReductionAxes)(n.shape,r);return s.length>0?(0,X.t)((0,q.c)(t,s),n.shape):t},b:()=>{let t=(0,L.l)(e,(0,F.w)(n,"float32"));const s=(0,W.getReductionAxes)(i.shape,r);s.length>0&&(t=(0,X.t)((0,q.c)(t,s),i.shape));const o=(0,j.E)(i);return(0,U.H)((0,$.y)(t,(0,F.w)(o,"float32")))}}}};var st=n(17820),ot=n(64826);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const at={kernelName:D.i5R,inputsToSave:["x","mean","variance","scale"],gradFunc:(e,t,n)=>{const{varianceEpsilon:i}=n,[r,s,o,a]=t,l=null==a?(0,z.d)(1):a,u=(0,W.getReductionAxes)(s.shape,r.shape),c=[];if(1===s.rank){for(let e=0;e<r.shape.length-1;++e)c.push(r.shape[e]);c.push(1)}const d=(0,Y.j)(r,s),h=(0,L.l)(e,l),p=(0,st.Z)((0,ne.W)(o,(0,z.d)(i))),f=(0,L.l)((0,L.l)((0,L.l)(p,p),p),(0,z.d)(-.5));return{x:()=>1===s.rank?(0,X.t)((0,L.l)((0,L.l)(e,(0,ot.V)((0,X.t)(p,[1,1,1,s.shape[0]]),c)),l),r.shape):(0,X.t)((0,L.l)((0,L.l)(e,p),l),r.shape),mean:()=>{let e=(0,L.l)((0,L.l)(p,(0,z.d)(-1)),h);return 1===s.rank&&(e=(0,q.c)(e,u)),(0,X.t)(e,s.shape)},variance:()=>{let e=(0,L.l)((0,L.l)(f,d),h);return 1===s.rank&&(e=(0,q.c)(e,u)),(0,X.t)(e,s.shape)},scale:()=>{const t=(0,L.l)(d,p);let n=(0,L.l)(e,t);return 1===s.rank&&(n=(0,q.c)(n,u)),(0,X.t)(n,s.shape)},offset:()=>{let t=e;return 1===s.rank&&(t=(0,q.c)(t,u)),(0,X.t)(t,s.shape)}}}};var lt=n(54268),ut=n(97706);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const ct={kernelName:D.mxL,inputsToSave:["x","indices"],gradFunc:(e,t,n)=>{const[i,r]=t,{axis:s,batchDims:o}=n,a=(0,ue.Y6)(s,i.shape)[0],l=(e,t,n)=>()=>{const i=e.shape,r=t.size,o=i.slice(0,a),l=o.length,u=i.slice(s,i.length).slice(1),c=u.length,d=dt(0,l),h=dt(l+1,l+1+c),p=ht([o,[r],u]),f=(0,X.t)(n,p),m=(0,X.t)(t,[r]),g=ht([[l],d,h]),y=(0,Ge.m)(f,g);let _=(0,ut.z)(y,m,e.shape[a]);const v=(0,je.gx)(g);return _=(0,Ge.m)(_,v),_};if(1===o){const t=i.shape[0],n=i.split(t,0);return{x:()=>{const t=(0,lt.t)(n.map((t,n)=>l(t,r.slice(n,1),e.slice(n,1))()));return t.reshape(i.shape)},indices:()=>r}}return{x:l(i,r,e),indices:()=>r}}};function dt(e,t){const n=[];for(let i=e;i<t;++i)n.push(i);return n}function ht(e){const t=[];for(let n=0;n<e.length;++n)for(let i=0;i<e[n].length;++i)t.push(e[n][i]);return t}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const pt={kernelName:D.lLS,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t;return{a:()=>(0,Q.P)(n),b:()=>(0,Q.P)(i)}}},ft={kernelName:D.lzr,gradFunc:e=>({x:()=>(0,F.w)(e,"float32")})},mt={kernelName:D.gIW,gradFunc:e=>({x:()=>(0,Q.P)(e)})},gt={kernelName:D.E3$,gradFunc:e=>({x:()=>(0,Q.P)(e)})},yt={kernelName:D.iPs,gradFunc:e=>({x:()=>(0,Q.P)(e)})};var _t=n(62058);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const vt={kernelName:D.X0$,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[i]=t,{alpha:r}=n,s=(0,_t.r)(i,0);return{x:()=>(0,Ae._)(s,e,(0,L.l)(e,r))}}},bt={kernelName:D.Cg$,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,$.y)(e,(0,ne.W)(n,1))}}},Tt={kernelName:D.tG8,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,$.y)(e,(0,F.w)(n,"float32"))}}},xt={kernelName:D.zfU,inputsToSave:[],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[i]=t,{axis:r}=n;return{logits:()=>{const t=(0,Qe.o)(i);return(0,Y.j)(e,(0,L.l)((0,q.c)(e,r,!0),t))}}}};const Et=(0,de.op)({localResponseNormalizationBackprop_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i=5,r=1,s=1,o=.5){const a={x:e,y:t,dy:n},l={depthRadius:i,bias:r,alpha:s,beta:o};return ae.T2.runKernel(D.ToN,a,l)}}),wt={kernelName:D.jM4,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[i,r]=t,{depthRadius:s,bias:o,alpha:a,beta:l}=n;return{x:()=>Et(i,r,e,s,o,a,l)}}};var It=n(13020);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function At(e,t,n,i){return t.rank<n.rank&&(t=(0,X.t)(t,je.SM(t.shape,i))),e.rank<n.rank&&(e=(0,X.t)(e,je.SM(e.shape,i))),{x:()=>(0,L.l)(e,(0,F.w)((0,It.L)(n,t),e.dtype))}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const St={kernelName:D.VAI,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const i=n,{reductionIndices:r}=i,s=t[0],o=At(e,t[1],s,ue.Y6(r,s.shape));return{x:()=>o.x()}}};var Ct=n(61303);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Ot={kernelName:D.LDN,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t;return{a:()=>(0,L.l)(e,(0,F.w)((0,Ee.D)(n,i),"float32")),b:()=>(0,L.l)(e,(0,F.w)((0,Ct.M)(n,i),"float32"))}}};const Mt=(0,de.op)({maxPool3dGrad_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r,s,o){const a=(0,le.YT)(e,"dy","maxPool3dGrad"),l=(0,le.YT)(t,"input","maxPool3dGrad"),u=(0,le.YT)(n,"output","maxPool3dGrad");let c=a,d=l,h=u,p=!1;4===l.rank&&(p=!0,c=(0,X.t)(a,[1,a.shape[0],a.shape[1],a.shape[2],a.shape[3]]),d=(0,X.t)(l,[1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]]),h=(0,X.t)(u,[1,u.shape[0],u.shape[1],u.shape[2],u.shape[3]])),ue.vA(5===c.rank,()=>`Error in maxPool3dGrad: dy must be rank 5 but got rank ${c.rank}.`),ue.vA(5===d.rank,()=>`Error in maxPool3dGrad: input must be rank 5 but got rank ${d.rank}.`),ue.vA(5===h.rank,()=>`Error in maxPool3dGrad: output must be rank 5 but got rank ${h.rank}.`),(0,ce.s_)("maxPool3dGrad",s,o);const f={dy:c,input:d,output:h},m={filterSize:i,strides:r,pad:s,dimRoundingMode:o},g=ae.T2.runKernel(D.cHb,f,m);return p?(0,X.t)(g,[g.shape[1],g.shape[2],g.shape[3],g.shape[4]]):g}}),Rt={kernelName:D.ySp,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[i,r]=t,{filterSize:s,strides:o,pad:a,dimRoundingMode:l}=n;return{x:()=>Mt(e,i,r,s,o,a,l)}}};const kt=(0,de.op)({maxPoolGrad_:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r,s,o){const a=(0,le.YT)(e,"dy","maxPoolGrad"),l=(0,le.YT)(t,"input","maxPoolGrad"),u=(0,le.YT)(n,"output","maxPoolGrad");ue.vA(l.rank===a.rank,()=>`Rank of input (${l.rank}) does not match rank of dy (${a.rank})`),ue.vA(4===a.rank,()=>`Error in maxPoolGrad: dy must be rank 4 but got rank ${a.rank}.`),ue.vA(4===l.rank,()=>`Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`),ce.s_("maxPoolGrad",s,o);const c={dy:a,input:l,output:u},d={filterSize:i,strides:r,pad:s,dimRoundingMode:o};return ae.T2.runKernel(D.RXX,c,d)}}),Nt={kernelName:D.t3d,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[i,r]=t,{filterSize:s,strides:o,pad:a}=n;return{x:()=>kt(e,i,r,s,o,a)}}};var Dt=n(61411);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Ft={kernelName:D.g5A,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[i]=t,{axis:r}=n,s=ue.Y6(r,i.shape),o=(0,je.lb)(i.shape,s)[1],a=ue.Ze(o);return{x:()=>{const t=i.shape.slice();s.forEach(e=>{t[e]=1});const n=(0,X.t)(e,t);return(0,$.y)((0,L.l)(n,(0,Dt.S)(i.shape,"float32")),a)}}}},Lt={kernelName:D.lNG,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const i=n,{axis:r}=i,[s,o]=t,a=At(e,o,s,ue.Y6(r,s.shape));return{x:()=>a.x()}}},Pt={kernelName:D.LG0,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t;return{a:()=>(0,L.l)(e,(0,F.w)((0,we.I)(n,i),"float32")),b:()=>(0,L.l)(e,(0,F.w)((0,_t.r)(n,i),"float32"))}}};var Bt=n(17986);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const $t={kernelName:D.x7F,inputsToSave:["x"],gradFunc:(e,t,n)=>{const i=t[0],{paddings:r}=n,s=r.map(e=>e[0]);return{x:()=>(0,Bt.d)(e,s,i.shape)}}};var Ut=n(15606);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const zt={kernelName:D.BLA,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t,r=(0,W.assertAndGetBroadcastShape)(n.shape,i.shape);return{a:()=>{const t=(0,W.getReductionAxes)(n.shape,r);return t.length>0?(0,X.t)((0,q.c)(e,t),n.shape):e},b:()=>{const t=(0,L.l)(e,(0,U.H)((0,Ut.R)((0,$.y)(n,i)))),s=(0,W.getReductionAxes)(i.shape,r);return s.length>0?(0,X.t)((0,q.c)(t,s),i.shape):t}}}},Vt={kernelName:D.xu7,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t,r=(0,W.assertAndGetBroadcastShape)(n.shape,i.shape);return{a:()=>{const t=(0,L.l)(e,(0,F.w)(i,"float32")),s=(0,W.getReductionAxes)(n.shape,r);return s.length>0?(0,X.t)((0,q.c)(t,s),n.shape):t},b:()=>{const t=(0,L.l)(e,(0,F.w)(n,"float32")),s=(0,W.getReductionAxes)(i.shape,r);return s.length>0?(0,X.t)((0,q.c)(t,s),i.shape):t}}}},jt={kernelName:D.l0G,gradFunc:e=>({x:()=>(0,U.H)(e)})};var Yt=n(42855);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Gt={kernelName:D.urI,inputsToSave:["indices"],gradFunc:(e,t)=>{const n=t[0];return{indices:()=>(0,Yt.U)(n.shape,"float32")}}},Ht={kernelName:D.LWX,gradFunc:e=>({x:()=>(0,Q.P)(e)})};var Wt=n(67261);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Xt={kernelName:D.mM$,saveAllInputs:!0,gradFunc:(e,t,n)=>{const{axis:i}=n;return(0,Wt.K)(e,i).map(e=>()=>e)}},qt={kernelName:D.ODT,inputsToSave:["x"],gradFunc:(e,t,n)=>{const i=t[0],{paddings:r}=n,s=r.map(e=>e[0]);return{x:()=>(0,Bt.d)(e,s,i.shape)}}};var Kt=n(44010),Zt=n(98990);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Qt={kernelName:D.pyJ,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(e,t)=>{const[n,i,r]=t,s=n,o=i,a=W.assertAndGetBroadcastShape(s.shape,o.shape);return{a:()=>{const t=(0,F.w)(o,"float32");let n=(0,L.l)(e,(0,L.l)(t,(0,Zt.n)(s,(0,Y.j)(t,(0,z.d)(1)))));const i=W.getReductionAxes(s.shape,a);return i.length>0&&(n=(0,q.c)(n,i)),(0,X.t)(n,s.shape)},b:()=>{const t=(0,_t.r)(s,0),n=(0,Ae._)(t,(0,Kt.R)(s),(0,Q.P)(s));let i=(0,L.l)(e,(0,L.l)(r,n));const l=W.getReductionAxes(o.shape,a);return l.length>0&&(i=(0,q.c)(i,l)),(0,X.t)(i,o.shape)}}}},Jt={kernelName:D.Ncv,inputsToSave:["x","alpha"],gradFunc:(e,t)=>{const[n,i]=t,r=(0,_t.r)(n,0);return{x:()=>(0,Ae._)(r,e,(0,L.l)(e,i)),alpha:()=>{let t=(0,Ae._)(r,(0,Q.P)(e),(0,L.l)(e,n));const s=(0,W.getReductionAxes)(i.shape,e.shape);return s.length>0&&(t=(0,q.c)(t,s)),(0,X.t)(t,i.shape)}}}};var en=n(10302);function tn(e,t,n){const i=e.shape.length,r=i-n.length,s=je.Em(n,i);let o=e;null!=s&&(o=(0,Ge.m)(e,s));const a=o.shape.slice(),l=a.splice(i-n.length,n.length).reduce((e,t)=>e*t,1);a.push(l);let u=
/**
* @license
* Copyright 2022 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=e.shape.slice();i[n]=1;const r=(0,X.t)(t,i),s=(0,en.L)(e,n,!0,!1),o=(0,en.L)(e,n,!0,!0),a=(0,L.l)(s,o);return(0,L.l)(r,a)}(o.reshape(a),t,r);if(u=u.reshape(o.shape),null!=s){const e=je.gx(s);u=(0,Ge.m)(u,e)}return u}const nn={kernelName:D.kdj,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[i]=t,{axis:r}=n;let s=[];return s=null==r?i.shape.map((e,t)=>t):"number"==typeof r?[r]:r,{x:()=>tn(i,e,s)}}},rn={kernelName:D.sDr,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t,r=W.assertAndGetBroadcastShape(n.shape,i.shape);return{a:()=>{const t=(0,$.y)(e,(0,F.w)(i,"float32")),s=W.getReductionAxes(n.shape,r);return s.length>0?(0,X.t)((0,q.c)(t,s),n.shape):t},b:()=>{let t=(0,L.l)(e,(0,F.w)(n,"float32"));const s=W.getReductionAxes(i.shape,r);s.length>0&&(t=(0,X.t)((0,q.c)(t,s),i.shape));const o=(0,j.E)(i);return(0,U.H)((0,$.y)(t,(0,F.w)(o,"float32")))}}}},sn={kernelName:D.huO,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,$.y)(e,(0,U.H)((0,j.E)(n)))}}},on={kernelName:D.P_L,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t,i=(0,L.l)((0,we.I)(n,6),(0,P.P)(n));return{x:()=>(0,L.l)(e,(0,F.w)(i,"float32"))}}},an={kernelName:D.fUj,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)(e,(0,F.w)((0,P.P)(n),"float32"))}}},ln={kernelName:D.R23,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,X.t)(e,n.shape)}}},un={kernelName:D.hgw,inputsToSave:["images"],gradFunc:(e,t,n)=>{const[i]=t,r={dy:e,images:i};return{images:()=>ae.T2.runKernel(D.FCQ,r,n)}}},cn={kernelName:D.jOE,inputsToSave:["images"],gradFunc:(e,t,n)=>{const[i]=t,r={dy:e,images:i};return{images:()=>ae.T2.runKernel(D.XQy,r,n)}}};var dn=n(53262);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const hn={kernelName:D.D7i,gradFunc:(e,t,n)=>{const{dims:i}=n,r=(0,ue.Y6)(i,e.shape);return{x:()=>(0,dn.B)(e,r)}}},pn={kernelName:D.hVg,gradFunc:e=>({x:()=>(0,Q.P)(e)})},fn={kernelName:D.TOR,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,U.H)((0,$.y)(e,(0,L.l)((0,Zt.n)(n,1.5),2)))}}};var mn=n(89881);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const gn={kernelName:D.l6P,inputsToSave:["condition"],gradFunc:(e,t)=>{const[n]=t;return{condition:()=>(0,F.w)((0,Q.P)(n),"float32"),t:()=>(0,L.l)(e,(0,F.w)(n,e.dtype)),e:()=>(0,L.l)(e,(0,F.w)((0,mn.N)(n),e.dtype))}}};var yn=n(28576);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const _n={kernelName:D.u$b,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=(0,_t.r)(n,(0,z.d)(0)),i=(0,z.d)(yn.j),r=(0,z.d)(yn.X),s=(0,L.l)(e,r),o=(0,L.l)((0,L.l)(e,i),(0,Qe.o)((0,F.w)(n,"float32")));return(0,Ae._)(t,s,o)}}}},vn={kernelName:D.vI1,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)(e,(0,L.l)(n,(0,Y.j)((0,z.d)(1),n)))}}},bn={kernelName:D.YVe,gradFunc:e=>({x:()=>(0,Q.P)(e)})};var Tn=n(99907);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const xn={kernelName:D.hql,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)((0,Tn.g)((0,F.w)(n,"float32")),e)}}};var En=n(27451);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const wn={kernelName:D.J3C,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)((0,En.y)((0,F.w)(n,"float32")),e)}}};var In=n(65661),An=n(34969);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Sn={kernelName:D.JiE,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[i]=t,{begin:r,size:s}=n,o=i.shape,[a,l]=(0,An.parseSliceParams)(i,r,s),u=[];for(let t=0;t<e.rank;t++)u.push([a[t],o[t]-a[t]-l[t]]);return{x:()=>(0,In.e)(e,u)}}},Cn={kernelName:D.rFG,outputsToSave:[!0],gradFunc:(e,t,n)=>{const[i]=t,{dim:r}=n,s=(0,L.l)(e,i);return{logits:()=>(0,Y.j)(s,(0,L.l)((0,q.c)(s,[r],true),i))}}};var On=n(28968);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Mn={kernelName:D.Fin,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)(e,(0,On.r)(n))}}};var Rn=n(69772);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const kn={kernelName:D.A8B,gradFunc:(e,t,n)=>{const{blockShape:i,paddings:r}=n;return{x:()=>(0,Rn.G)(e,i,r)}}};var Nn=n(25030);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Dn={kernelName:D.Blb,gradFunc:(e,t,n)=>{const{axis:i}=n;return{x:()=>(0,Nn.x)(e,i)}}},Fn={kernelName:D.dFH,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,$.y)(e,(0,L.l)((0,V.R)((0,F.w)(n,"float32")),2))}}},Ln={kernelName:D.M6A,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)(e,(0,L.l)((0,F.w)(n,"float32"),2))}}},Pn={kernelName:D.Ddj,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t,r=(0,z.d)(2);return{a:()=>(0,L.l)(e,(0,L.l)(r,(0,Y.j)(n,i))),b:()=>(0,L.l)(e,(0,L.l)(r,(0,Y.j)(i,n)))}}},Bn={kernelName:D.pnw,gradFunc:e=>({x:()=>(0,Q.P)(e)})},$n={kernelName:D.PbM,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,i]=t,r=W.assertAndGetBroadcastShape(n.shape,i.shape);return{a:()=>{let t=e;const i=W.getReductionAxes(n.shape,r);return i.length>0&&(t=(0,q.c)(t,i)),(0,X.t)(t,n.shape)},b:()=>{let t=e;const n=W.getReductionAxes(i.shape,r);return n.length>0&&(t=(0,q.c)(t,n)),(0,X.t)((0,U.H)(t),i.shape)}}}},Un={kernelName:D.WuN,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[i]=t,r=i.shape.slice(),{axis:s}=n;(0,ue.Y6)(s,i.shape).forEach(e=>{r[e]=1});const o=(0,X.t)(e,r),a=(0,L.l)(o,(0,Dt.S)(i.shape,"float32"));return{x:()=>a}}},zn={kernelName:D.oFs,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,$.y)(e,(0,j.E)((0,Tn.g)(n)))}}},Vn={kernelName:D.iuW,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>(0,L.l)((0,Y.j)((0,z.d)(1),(0,j.E)(n)),e)}}},jn={kernelName:D.FAs,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[i]=t,{reps:r}=n;return{x:()=>{let t=(0,Q.P)(i);if(1===i.rank)for(let n=0;n<r[0];++n)t=(0,ne.W)(t,(0,Bt.d)(e,[n*i.shape[0]],[i.shape[0]]));else if(2===i.rank)for(let n=0;n<r[0];++n)for(let s=0;s<r[1];++s)t=(0,ne.W)(t,(0,Bt.d)(e,[n*i.shape[0],s*i.shape[1]],[i.shape[0],i.shape[1]]));else if(3===i.rank)for(let n=0;n<r[0];++n)for(let s=0;s<r[1];++s)for(let o=0;o<r[2];++o)t=(0,ne.W)(t,(0,Bt.d)(e,[n*i.shape[0],s*i.shape[1],o*i.shape[2]],[i.shape[0],i.shape[1],i.shape[2]]));else{if(4!==i.rank)throw new Error(`Gradient for tile operation is not implemented for rank-${i.rank} tensors yet.`);for(let n=0;n<r[0];++n)for(let s=0;s<r[1];++s)for(let o=0;o<r[2];++o)for(let a=0;a<r[3];++a)t=(0,ne.W)(t,(0,Bt.d)(e,[n*i.shape[0],s*i.shape[1],o*i.shape[2],a*i.shape[3]],[i.shape[0],i.shape[1],i.shape[2],i.shape[3]]))}return t}}}},Yn={kernelName:D.wx0,gradFunc:(e,t,n)=>{const i=n,{perm:r}=i,s=je.gx(r);return{x:()=>(0,Ge.m)(e,s)}}},Gn={kernelName:D.dXR,gradFunc:(e,t,n)=>{const i=n,{axis:r}=i;return{value:()=>(0,lt.t)(e,r)}}};var Hn=n(8710),Wn=n(48229),Xn=n(30178);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const qn={kernelName:D.pPe,inputsToSave:["segmentIds"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>function(e,t){const n=(0,Xn.P)(t,(0,Q.P)(t)),i=(0,Wn.k)(e,n);let r=(0,Ee.D)(t,(0,z.d)(0,"int32"));const s=i.rank-r.rank;for(let e=0;e<s;++e)r=(0,Hn.U)(r,e+1);r=(0,Ie.n)(r,(0,Dt.S)(i.shape,"bool"));const o=(0,Q.P)(i);return(0,Ae._)(r,i,o)}(e,n)}}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Kn={kernelName:D.xJ3,gradFunc:e=>({x:()=>(0,Q.P)(e)})};var Zn=n(37074);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Qn=[B,G,H,K,Z,J,ee,te,ie,re,se,oe,pe,me,ye,ve,be,Te,xe,Se,Ce,Me,Fe,Ne,Be,Ue,Ve,He,qe,Ke,rn,Ze,Je,et,tt,nt,rt,it,at,ct,pt,ft,mt,gt,yt,vt,bt,Tt,xt,wt,St,St,Ot,Rt,Nt,Ft,Lt,Pt,$t,zt,Vt,jt,Gt,Ht,Xt,qt,qt,Qt,Jt,nn,sn,on,an,ln,un,cn,hn,pn,fn,gn,_n,vn,bn,xn,wn,Sn,Cn,Mn,kn,kn,Dn,Dn,Fn,Pn,Ln,Bn,$n,Un,zn,Vn,jn,Yn,Gn,qn,Kn];for(const e of Qn)(0,Zn.kr)(e);n(20455);
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class Jn extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Jn.prototype)}}class ei extends Error{constructor(e){super(e),Object.setPrototypeOf(this,ei.prototype)}}class ti extends Error{constructor(e){super(e),Object.setPrototypeOf(this,ti.prototype)}}class ni extends Error{constructor(e){super(e),Object.setPrototypeOf(this,ni.prototype)}}class ii extends Error{constructor(e){super(e),Object.setPrototypeOf(this,ii.prototype)}}Error;
/**
* @license
* Copyright 2022 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class ri{constructor(e){this.maxEntries=e||100,this.cache=new Map}get(e){let t;return this.cache.has(e)&&(t=this.cache.get(e),this.cache.delete(e),this.cache.set(e,t)),t}put(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxEntries){const e=this.cache.keys().next().value;this.cache.delete(e)}this.cache.set(e,t)}getMaxEntries(){return this.maxEntries}setMaxEntries(e){if(e<0)throw new Error(`The maxEntries of LRU caches must be at least 0, but got ${e}.`);if(this.maxEntries>e)for(let t=0;t<this.maxEntries-e;t++){const e=this.cache.keys().next().value;this.cache.delete(e)}this.maxEntries=e}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function si(e,t){if(Array.isArray(e)){let n=[];for(let i=0;i<t;i++)n=n.concat(e);return n}{const n=new Array(t);return n.fill(e),n}}function oi(e,t){if(!e)throw new ii(t)}function ai(e,t){let n=0;for(const i of e)i===t&&n++;return n}function li(e){return 1===e.length?e[0]:e}function ui(e){return Array.isArray(e)?e:[e]}function ci(e){const t=e.replace(/(.)([A-Z][a-z0-9]+)/g,"$1_$2").replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();return"_"!==t[0]?t:"private"+t}function di(e){return e.length<=1||-1===e.indexOf("_")?e:e.replace(/[_]+(\w|$)/g,(e,t)=>t.toUpperCase())}let hi={};function pi(e){if(null==e)return null;const t={};return t.className=e.getClassName(),t.config=e.getConfig(),t}function fi(e){if(null!=e&&"object"==typeof e)if(Array.isArray(e))e.forEach(e=>fi(e));else{const t=Object.keys(e);for(const n of t){const t=e[n];null!=t&&"object"==typeof t&&(Array.isArray(t)||"ndarray"!==t.type||"number"!=typeof t.value?fi(t):e[n]=t.value)}}}function mi(e,t={},n={},i="object",r=!1){if("string"==typeof e){const r=e;let s;if(r in n)s=n[r];else if(r in hi)s=hi[r];else if(s=t[r],null==s)throw new ti(`Unknown ${i}: ${e}. This may be due to one of the following reasons:\n1. The ${i} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom ${i} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);return s}{const s=e;if(null==s.className||null==s.config)throw new ti(`${i}: Improper config format: ${JSON.stringify(s)}.\n'className' and 'config' must set.`);const o=s.className;let a,l;if(o in n?[a,l]=n[o]:o in hi?[a,l]=hi.className:o in t&&([a,l]=t[o]),null==a)throw new ti(`Unknown ${i}: ${o}. This may be due to one of the following reasons:\n1. The ${i} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom ${i} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);if(null!=l){const e={};for(const t of Object.keys(hi))e[t]=hi[t];for(const t of Object.keys(n))e[t]=n[t];s.config.customObjects=e;const t=Object.assign({},hi);for(const e of Object.keys(n))hi[e]=n[e];fi(s.config);const i=l(a,s.config,n,r);return hi=Object.assign({},t),i}{const e=Object.assign({},hi);for(const e of Object.keys(n))hi[e]=n[e];const t=new a(s.config);return hi=Object.assign({},e),t}}}function gi(e,t){return-1*function(e,t){return e<t?-1:e>t?1:0}(e,t)}function yi(e){if(null==e)return e;const t=[];for(const n of e)-1===t.indexOf(n)&&t.push(n);return t}function _i(e){if(null==e)throw new ti(`Invalid value in obj: ${JSON.stringify(e)}`);for(const t in e)if(e.hasOwnProperty(t))return!1;return!0}function vi(e,t,n){if(null!=n&&e.indexOf(n)<0)throw new ti(`${n} is not a valid ${t}. Valid values are ${e} or null/undefined.`)}function bi(e,t,n=0,i=1/0){return oi(n>=0),oi(i>=n),Array.isArray(e)&&e.length>=n&&e.length<=i&&e.every(e=>typeof e===t)}function Ti(e,t){Array.isArray(e)?(N.util.assert(e.length>0,()=>`${t} is unexpectedly an empty array.`),e.forEach((e,n)=>Ti(e,`element ${n+1} of ${t}`))):N.util.assert(Number.isInteger(e)&&e>0,()=>`Expected ${t} to be a positive integer, but got ${xi(e)}.`)}function xi(e){return null===e?"null":Array.isArray(e)?"["+e.map(e=>xi(e)).join(",")+"]":"string"==typeof e?`"${e}"`:`${e}`}function Ei(e){return"relu"===e?"relu":"linear"===e?"linear":"elu"===e?"elu":null}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
let wi=0;function Ii(){return wi++}const Ai={};function Si(e=""){return e in Ai||(Ai[e]=0),Ai[e]+=1,e+Ai[e].toString()}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
const Ci=["channelsFirst","channelsLast"],Oi=["nearest","bilinear"],Mi=["valid","same","causal"],Ri=["max","avg"],ki=["sum","mul","concat","ave"],Ni=new Map;function Di(e){vi(Ci,"DataFormat",e)}function Fi(e){vi(Mi,"PaddingMode",e)}function Li(e){vi(Ri,"PoolMode",e)}const Pi=[];function Bi(e,t){Pi.push(e);try{const e=t();return Pi.pop(),e}catch(e){throw Pi.pop(),e}}function $i(e){if(!Vi(e))throw new Error("Not a valid tensor name: '"+e+"'");return(0===Pi.length?"":Pi.join("/")+"/")+e}function Ui(e){if(!Vi(e))throw new Error("Not a valid tensor name: '"+e+"'");Ni.has(e)||Ni.set(e,0);const t=Ni.get(e);if(Ni.set(e,Ni.get(e)+1),t>0){const n=`${e}_${t}`;return Ni.set(n,1),n}return e}const zi=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function Vi(e){return!!e.match(zi)}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function ji(e){return e===parseInt(e.toString(),10)}function Yi(e,t,n){null==t&&(t=0),null==n&&(n=e.length);let i=1;for(let r=t;r<n;++r)i*=e[r];return i}function Gi(e){if(0===e.length)return Number.NaN;let t=Number.POSITIVE_INFINITY;for(let n=0;n<e.length;n++){const i=e[n];i<t&&(t=i)}return t}function Hi(e){if(0===e.length)return Number.NaN;let t=Number.NEGATIVE_INFINITY;for(let n=0;n<e.length;n++){const i=e[n];i>t&&(t=i)}return t}function Wi(e,t){if(t<e)throw new ti(`end (${t}) < begin (${e}) is forbidden.`);const n=[];for(let i=e;i<t;++i)n.push(i);return n}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
let Xi;function qi(){return null==Xi&&(Xi=(0,N.backend)().epsilon()),Xi}function Ki(e,t){return N.cast(e,t)}function Zi(e,t=-1){const n=e.shape.slice();return t<0&&(t=n.length+t+1),n.splice(t,0,1),N.reshape(e,n)}function Qi(e,t,n){return(0,N.tidy)(()=>{switch(e.rank){case 1:return N.slice1d(e,t,n);case 2:return N.slice2d(e,[t,0],[n,e.shape[1]]);case 3:return N.slice3d(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return N.slice4d(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);case 5:return N.slice(e,[t,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4]]);case 6:return N.slice(e,[t,0,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4],e.shape[5]]);default:throw new ti(`sliceAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}})}function Ji(e,t,n){return(0,N.tidy)(()=>{switch(e.rank){case 1:return N.slice1d(e,t,n);case 2:return N.slice2d(e,[0,t],[e.shape[0],n]);case 3:return N.slice3d(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return N.slice4d(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new ti(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function er(e,t,n,i){return(0,N.tidy)(()=>{switch(e.rank){case 1:return N.slice1d(e,t,n);case 2:switch(i){case 1:return Qi(e,t,n);case 2:return Ji(e,t,n);default:throw new ti(`The axis is not within the rank of the tensor ${i}`)}case 3:switch(i){case 1:return Qi(e,t,n);case 2:return N.slice3d(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return Ji(e,t,n);default:throw new ti(`The axis is not within the rank of the tensor ${i}`)}case 4:switch(i){case 1:return Qi(e,t,n);case 2:return N.slice4d(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return N.slice4d(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return Ji(e,t,n);default:throw new ti(`The axis is not within the rank of the tensor ${i}`)}default:throw new ti(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function tr(e,t=-1){let n;return t<0&&(n=e[0].rank,t=0!==n?n:0),t===e[0].rank&&(t=-1),N.concat(e,t)}function nr(e,t){switch(e.rank){case 1:return N.concat1d([e,t]);case 2:return N.concat2d([e,t],0);case 3:return N.concat3d([e,t],0);case 4:return N.concat4d([e,t],0);default:throw new ti(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}}function ir(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new ti(`The length of input n (${t.length}) does not match the number of dimensions in input x (${e.rank})`);return N.tile(e,t)}function rr(e,t=0,n=1,i,r){return N.randomNormal(e,t,n,i,r)}function sr(e,t,n,i){if(e.rank<2||t.rank<2)throw new ni(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${t.shape}`);if(t.rank>=3){if(e.shape.slice(-1)[0]!==t.shape.slice(-2)[0])throw new ni(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${e.shape} and y shape = ${t.shape}`)}if(2===e.rank&&2===t.rank){const r=!1,s=!1;return N.fused.matMul({a:e,b:t,transposeA:r,transposeB:s,bias:i?lr(e.rank,i,"channelsLast"):null,activation:n})}{const r=e.shape.slice(),s=r.pop();e=N.reshape(e,[-1,s]);const o=t.shape.slice(),a=o.pop(),l=o.pop(),u=[...o,a],c=Array.from({length:t.rank},(e,n)=>0===n?t.rank-2:n<=t.rank-2?n-1:n);t=N.reshape(N.transpose(t,c),[l,-1]);const d=[...r,...u],h=!1,p=!1;return N.reshape(N.fused.matMul({a:e,b:t,transposeA:h,transposeB:p,bias:i?lr(e.rank,i,"channelsLast"):null,activation:n}),d)}}function or(e,t,n){return(0,N.tidy)(()=>(t=Array.isArray(t)?(0,N.tensor1d)(t,"int32"):N.cast(t,"int32"),N.gather(e,t,n)))}function ar(e){return N.mul(e,e)}function lr(e,t,n){const i=t.shape;if(1!==t.rank&&t.rank!==e)throw new ti(`Unexpected bias dimensions: ${t.rank}; expected it to be 1 or ${e}`);if(5===e){if("channelsFirst"===n)return 1===i.length?N.reshape(t,[1,i[0],1,1,1]):N.reshape(t,[1,i[3],i[0],i[1],i[2]]);if("channelsLast"===n)return 1===i.length?N.reshape(t,[1,1,1,1,i[0]]):N.reshape(t,[1].concat(i))}else if(4===e){if("channelsFirst"===n)return 1===i.length?N.reshape(t,[1,i[0],1,1]):N.reshape(t,[1,i[2],i[0],i[1]]);if("channelsLast"===n)return 1===i.length?N.reshape(t,[1,1,1,i[0]]):N.reshape(t,[1].concat(i))}else if(3===e){if("channelsFirst"===n)return 1===i.length?N.reshape(t,[1,i[0],1]):N.reshape(t,[1,i[1],i[0]]);if("channelsLast"===n)return 1===i.length?N.reshape(t,[1,1,i[0]]):N.reshape(t,[1].concat(i))}else if(e<3)return t;throw new ti(`Unsupported input rank by biasAdd: ${t.rank}`)}function ur(e,t,n){return(0,N.tidy)(()=>(null==n&&(n="channelsLast"),Di(n),N.add(e,lr(e.rank,t,n))))}function cr(e,t,n,i){return(0,N.tidy)(()=>N.dropout(e,t,n,i))}function dr(e,t,n=!1){return n?e():t()}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
const hr=["fanIn","fanOut","fanAvg"],pr=["normal","uniform","truncatedNormal"];class fr extends N.serialization.Serializable{fromConfigUsesCustomObjects(){return!1}getConfig(){return{}}}class mr extends fr{apply(e,t){return(0,N.zeros)(e,t)}}mr.className="Zeros",N.serialization.registerClass(mr);class gr extends fr{apply(e,t){return(0,N.ones)(e,t)}}gr.className="Ones",N.serialization.registerClass(gr);class yr extends fr{constructor(e){if(super(),"object"!=typeof e)throw new ti(`Expected argument of type ConstantConfig but got ${e}`);if(void 0===e.value)throw new ti(`config must have value set but got ${e}`);this.value=e.value}apply(e,t){return(0,N.tidy)(()=>(0,N.mul)((0,N.scalar)(this.value),(0,N.ones)(e,t)))}getConfig(){return{value:this.value}}}yr.className="Constant",N.serialization.registerClass(yr);class _r extends fr{constructor(e){super(),this.DEFAULT_MINVAL=-.05,this.DEFAULT_MAXVAL=.05,this.minval=e.minval||this.DEFAULT_MINVAL,this.maxval=e.maxval||this.DEFAULT_MAXVAL,this.seed=e.seed}apply(e,t){return(0,N.randomUniform)(e,this.minval,this.maxval,t,this.seed)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}}_r.className="RandomUniform",N.serialization.registerClass(_r);class vr extends fr{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if("float32"!==(t=t||"float32")&&"int32"!==t)throw new ni(`randomNormal does not support dType ${t}.`);return rr(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}vr.className="RandomNormal",N.serialization.registerClass(vr);class br extends fr{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if("float32"!==(t=t||"float32")&&"int32"!==t)throw new ni(`truncatedNormal does not support dType ${t}.`);return(0,N.truncatedNormal)(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}br.className="TruncatedNormal",N.serialization.registerClass(br);class Tr extends fr{constructor(e){super(),this.gain=null!=e.gain?e.gain:1}apply(e,t){return(0,N.tidy)(()=>{if(2!==e.length||e[0]!==e[1])throw new ti("Identity matrix initializer can only be used for 2D square matrices.");return(0,N.mul)(this.gain,(0,N.eye)(e[0]))})}getConfig(){return{gain:this.gain}}}Tr.className="Identity",N.serialization.registerClass(Tr);class xr extends fr{constructor(e){if(super(),e.scale<0)throw new ti(`scale must be a positive float. Got: ${e.scale}`);
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
var t;this.scale=null==e.scale?1:e.scale,this.mode=null==e.mode?"fanIn":e.mode,t=this.mode,vi(hr,"FanMode",t),this.distribution=null==e.distribution?"normal":e.distribution,function(e){vi(pr,"Distribution",e)}(this.distribution),this.seed=e.seed}apply(e,t){const n=function(e,t="channelsLast"){let n,i;if(Di(t),2===e.length)n=e[0],i=e[1];else if(-1!==[3,4,5].indexOf(e.length)){if("channelsFirst"===t){const t=Yi(e,2);n=e[1]*t,i=e[0]*t}else if("channelsLast"===t){const t=Yi(e,0,e.length-2);n=e[e.length-2]*t,i=e[e.length-1]*t}}else{const t=Yi(e);n=Math.sqrt(t),i=Math.sqrt(t)}return[n,i]}(e),i=n[0],r=n[1];let s=this.scale;if("fanIn"===this.mode?s/=Math.max(1,i):"fanOut"===this.mode?s/=Math.max(1,r):s/=Math.max(1,(i+r)/2),"normal"===this.distribution){const n=Math.sqrt(s);if("float32"!==(t=t||"float32")&&"int32"!==t)throw new ni(`${this.getClassName()} does not support dType ${t}.`);return(0,N.truncatedNormal)(e,0,n,t,this.seed)}{const n=Math.sqrt(3*s);return(0,N.randomUniform)(e,-n,n,t,this.seed)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}}xr.className="VarianceScaling",N.serialization.registerClass(xr);class Er extends xr{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return xr.className}}Er.className="GlorotUniform",N.serialization.registerClass(Er);class wr extends xr{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return xr.className}}wr.className="GlorotNormal",N.serialization.registerClass(wr);class Ir extends xr{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return xr.className}}Ir.className="HeNormal",N.serialization.registerClass(Ir);class Ar extends xr{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return xr.className}}Ar.className="HeUniform",N.serialization.registerClass(Ar);class Sr extends xr{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return xr.className}}Sr.className="LeCunNormal",N.serialization.registerClass(Sr);class Cr extends xr{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return xr.className}}Cr.className="LeCunUniform",N.serialization.registerClass(Cr);class Or extends fr{constructor(e){super(),this.DEFAULT_GAIN=1,this.ELEMENTS_WARN_SLOW=2e3,this.gain=null==e.gain?this.DEFAULT_GAIN:e.gain,this.seed=e.seed}apply(e,t){return(0,N.tidy)(()=>{if(e.length<2)throw new ni("Shape must be at least 2D.");if("int32"!==t&&"float32"!==t&&void 0!==t)throw new TypeError(`Unsupported data type ${t}.`);const n=N.util.sizeFromShape(e.slice(0,-1)),i=e[e.length-1],r=n*i;r>this.ELEMENTS_WARN_SLOW&&console.warn(`Orthogonal initializer is being called on a matrix with more than ${this.ELEMENTS_WARN_SLOW} (${r}) elements: Slowness may result.`);const s=rr([Math.max(i,n),Math.min(i,n)],0,1,t,this.seed),o=N.linalg.qr(s,!1);let a=o[0];const l=o[1].flatten().stridedSlice([0],[Math.min(i,n)*Math.min(i,n)],[Math.min(i,n)+1]);return a=(0,N.mul)(a,l.sign()),n<i&&(a=a.transpose()),(0,N.mul)((0,N.scalar)(this.gain),a.reshape(e))})}getConfig(){return{gain:this.gain,seed:this.seed}}}Or.className="Orthogonal",N.serialization.registerClass(Or);const Mr={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function Rr(e,t={}){return mi(e,N.serialization.SerializationMap.getMap().classNameMap,t,"initializer")}function kr(e){return pi(e)}function Nr(e){if("string"==typeof e){const t=e in Mr?Mr[e]:e;if("GlorotNormal"===t)return new wr;if("GlorotUniform"===t)return new Er;if("HeNormal"===t)return new Ir;if("HeUniform"===t)return new Ar;if("LeCunNormal"===t)return new Sr;if("LeCunUniform"===t)return new Cr;{const e={};return e.className=t,e.config={},Rr(e)}}return e instanceof fr?e:Rr(e)}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Dr(e){return Array.isArray(e)&&Array.isArray(e[0])}function Fr(e){return 0===e.length?[]:Array.isArray(e[0])?e:[e]}function Lr(e){let t;if(Array.isArray(e)){if(1!==e.length)throw new ti(`Expected Tensor length to be 1; got ${e.length}`);t=e[0]}else t=e;return t}function Pr(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(1===e.length)return e[0];throw new ti(`Expected exactly 1 Shape; got ${e.length}`)}return e}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Br(e){let t=0;for(const n of e)0===n.shape.length?t+=1:t+=n.shape.reduce((e,t)=>e*t);return t}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
const $r="Variable";class Ur{constructor(e,t="float32",n=$r,i=!0,r=null){this.dtype=null==t?"float32":t,this.shape=e.shape,this.id=Ii(),n=null==n?$r:n,this.originalName=$i(n),this.name=Ui(this.originalName),this.trainable_=i,this.constraint=r,this.val=N.variable(e,this.trainable_,this.name,this.dtype)}read(){return this.assertNotDisposed(),this.val}write(e){return this.assertNotDisposed(),function(e,t){if(e.shape.toString()!==t.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(e.shape)+" vs. "+JSON.stringify(t.shape))}(this.val,e),this.val.id!==e.id&&(this.val.assign(e),null!=this.constraint&&this.val.assign(this.constraint.apply(this.val))),this}dispose(){this.assertNotDisposed(),this.val.dispose()}assertNotDisposed(){if(this.val.isDisposed)throw new Error(`LayersVariable ${this.name} is already disposed.`)}get trainable(){return this.trainable_}set trainable(e){this.trainable_=e,this.val.trainable=e}}function zr(e){return e.map(e=>e.read())}function Vr(e){e.forEach(e=>{e[0].write(e[1])})}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class jr{constructor(e){this.dtype=e.dtype,this.shape=e.shape,null!=e.shape?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}}}class Yr{constructor(e,t,n,i,r,s,o){this.dtype=e,this.shape=t,this.sourceLayer=n,this.inputs=i,this.callArgs=r,this.outputTensorIndex=o,this.id=Ii(),null!=s&&(this.originalName=$i(s),this.name=Ui(this.originalName)),this.rank=t.length}}let Gr=0;class Hr{constructor(e,t){this.callArgs=t,this.id=Gr++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(const t of e.inboundLayers)null!=t&&t.outboundNodes.push(this);e.outboundLayer.inboundNodes.push(this)}getConfig(){const e=[];for(const t of this.inboundLayers)null!=t?e.push(t.name):e.push(null);return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}}}let Wr=0;class Xr extends N.serialization.Serializable{constructor(e={}){super(),this._callHook=null,this._addedWeightNames=[],this._stateful=!1,this.id=Wr++,this.activityRegularizer=null,this.inputSpec=null,this.supportsMasking=!1,this._trainableWeights=[],this._nonTrainableWeights=[],this._losses=[],this._updates=[],this._built=!1,this.inboundNodes=[],this.outboundNodes=[];let t=e.name;if(!t){const e=this.getClassName();t=ci(e)+"_"+Si(e)}if(this.name=t,this.trainable_=null==e.trainable||e.trainable,null!=e.inputShape||null!=e.batchInputShape){let t;if(null!=e.batchInputShape)t=e.batchInputShape;else if(null!=e.inputShape){let n=null;null!=e.batchSize&&(n=e.batchSize),t=[n].concat(e.inputShape)}this.batchInputShape=t;let n=e.dtype;null==n&&(n=e.inputDType),null==n&&(n="float32"),this.dtype=n}null!=e.weights?this.initialWeights=e.weights:this.initialWeights=null,this._refCount=null,this.fastWeightInitDuringBuild=!1}static nodeKey(e,t){return e.name+"_ib-"+t.toString()}getNodeAtIndex(e,t){if(0===this.inboundNodes.length)throw new ei(`The layer has never been called and thus has no defined ${t}.`);if(this.inboundNodes.length<=e)throw new ti(`Asked to get ${t} at node ${e}, but the layer has only ${this.inboundNodes.length} inbound nodes.`);return this.inboundNodes[e]}getInputAt(e){return li(this.getNodeAtIndex(e,"input").inputTensors)}getOutputAt(e){return li(this.getNodeAtIndex(e,"output").outputTensors)}get input(){if(this.inboundNodes.length>1)throw new Jn(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use \`getInputAt(nodeIndex)\` instead.`);if(0===this.inboundNodes.length)throw new Jn(`Layer ${this.name} is not connected, no input to return.`);return li(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(0===this.inboundNodes.length)throw new Jn(`Layer ${this.name} has no inbound nodes.`);if(this.inboundNodes.length>1)throw new Jn(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use \`getOutputAt(nodeIndex)\` instead.`);return li(this.getNodeAtIndex(0,"output").outputTensors)}get losses(){return this._losses}calculateLosses(){return this.losses.map(e=>e())}get updates(){return this._updates}get built(){return this._built}set built(e){this._built=e}get trainable(){return this.trainable_}set trainable(e){this._trainableWeights.forEach(t=>t.trainable=e),this.trainable_=e}get trainableWeights(){return this.trainable_?this._trainableWeights.filter(e=>e.trainable):[]}set trainableWeights(e){this._trainableWeights=e}get nonTrainableWeights(){return this.trainable?this._trainableWeights.filter(e=>!e.trainable).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)}set nonTrainableWeights(e){this._nonTrainableWeights=e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}get stateful(){return this._stateful}resetStates(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}assertInputCompatibility(e){const t=ui(e);if(null==this.inputSpec||0===this.inputSpec.length)return;const n=ui(this.inputSpec);if(t.length!==n.length)throw new ti(`Layer ${this.name} expects ${n.length} inputs, but it received ${t.length} input tensors. Input received: ${e}`);for(let e=0;e<t.length;e++){const i=t[e],r=n[e];if(null==r)continue;const s=i.rank;if(null!=r.ndim&&s!==r.ndim)throw new ti(`Input ${e} is incompatible with layer ${this.name}: expected ndim=${r.ndim}, found ndim=${s}`);if(null!=r.maxNDim&&s>r.maxNDim)throw new ti(`Input ${e} is incompatible with layer ${this.name}: expected max_ndim=${r.maxNDim}, found ndim=${s}`);if(null!=r.minNDim&&s<r.minNDim)throw new ti(`Input ${e} is incompatible with layer ${this.name}: expected min_ndim=${r.minNDim}, found ndim=${s}.`);if(null!=r.dtype&&i.dtype!==r.dtype)throw new ti(`Input ${e} is incompatible with layer ${this.name} : expected dtype=${r.dtype}, found dtype=${i.dtype}.`);if(r.axes){const t=i.shape;for(const n in r.axes){const i=Number(n),s=r.axes[n],o=i>=0?t[i]:t[t.length+i];if(null!=s&&-1===[s,null].indexOf(o))throw new ti(`Input ${e} is incompatible with layer ${this.name}: expected axis ${i} of input shape to have value ${s} but got shape ${t}.`)}}if(null!=r.shape)for(let t=0;t<r.shape.length;++t){const n=r.shape[t],s=i.shape[t];if(null!=n&&null!=s&&n!==s)throw new ti(`Input ${e} is incompatible with layer ${this.name}: expected shape=${r.shape}, found shape=${i.shape}.`)}}}call(e,t){return e}invokeCallHook(e,t){null!=this._callHook&&this._callHook(e,t)}setCallHook(e){this._callHook=e}clearCallHook(){this._callHook=null}apply(e,t){t=t||{},this.assertNotDisposed();const n=ui(e),i=function(e){let t=!0;for(const n of ui(e))if(!(n instanceof Yr)){t=!1;break}return t}(e),r=function(e){let t=!0;for(const n of ui(e))if(n instanceof Yr){t=!1;break}return t}(e);if(i===r)throw new ti("Arguments to apply() must be all SymbolicTensors or all Tensors");return Bi(this.name,()=>{if(!this.built){this.assertInputCompatibility(e);const t=[];for(const n of ui(e))t.push(n.shape);this.build(li(t)),this.built=!0,this.initialWeights&&this.setWeights(this.initialWeights),null===this._refCount&&r&&(this._refCount=1)}if(this.assertInputCompatibility(e),r){let i=this.call(e,t);this.supportsMasking&&this.setMaskMetadata(e,i);const r=ui(i),s=[];for(let e of r)-1!==n.indexOf(e)&&(e=e.clone()),s.push(e);if(i=li(s),null!=this.activityRegularizer)throw new ni("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return i}{const n=function(e){e=ui(e);const t=[];for(const n of e)t.push(n.shape);return li(t)}(e),i=this.computeOutputShape(n);let r;const s="float32";if(this.warnOnIncompatibleInputShape(Array.isArray(e)?n[0]:n),r=null!=i&&i.length>0&&Array.isArray(i[0])?i.map((n,i)=>new Yr(s,n,this,ui(e),t,this.name,i)):new Yr(s,i,this,ui(e),t,this.name),this.addInboundNode(e,r,null,null,n,i,t),this._refCount++,null!=this.activityRegularizer)throw new ni("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return r}})}warnOnIncompatibleInputShape(e){if(null!=this.batchInputShape)if(e.length!==this.batchInputShape.length)console.warn(`The rank of the input tensor provided (shape: ${JSON.stringify(e)}) does not match that of the batchInputShape (${JSON.stringify(this.batchInputShape)}) of the layer ${this.name}`);else{let t=!1;this.batchInputShape.forEach((n,i)=>{null!=n&&null!=e[i]&&e[i]!==n&&(t=!0)}),t&&console.warn(`The shape of the input tensor (${JSON.stringify(e)}) does not match the expectation of layer ${this.name}: ${JSON.stringify(this.batchInputShape)}`)}}get outputShape(){if(null==this.inboundNodes||0===this.inboundNodes.length)throw new Jn(`The layer ${this.name} has never been called and thus has no defined output shape.`);const e=[];for(const t of this.inboundNodes){const n=JSON.stringify(t.outputShapes);-1===e.indexOf(n)&&e.push(n)}if(1===e.length){const e=this.inboundNodes[0].outputShapes;return Array.isArray(e)&&Array.isArray(e[0])&&1===e.length?e[0]:e}throw new Jn(`The layer ${this.name} has multiple inbound nodes with different output shapes. Hence the notion of "output shape" is ill-defined for the layer.`)}countParams(){if(!this.built)throw new ei(`You tried to call countParams() on ${this.name}, but the layer is not built yet. Build it first by calling build(batchInputShape).`);return Br(this.weights)}build(e){this.built=!0}getWeights(e=!1){return zr(e?this.trainableWeights:this.weights)}setWeights(e){(0,N.tidy)(()=>{const t=this.weights;if(t.length!==e.length)throw new ti(`You called setWeights(weights) on layer "${this.name}" with a weight list of length ${e.length}, but the layer was expecting ${t.length} weights. Provided weights: ${e}...`);if(0===t.length)return;const n=[],i=zr(t);for(let r=0;r<i.length;++r){const s=i[r],o=t[r],a=e[r];if(!N.util.arraysEqual(s.shape,a.shape))throw new ti(`Layer weight shape ${s.shape} not compatible with provided weight shape ${a.shape}`);n.push([o,a])}Vr(n)})}addWeight(e,t,n,i,r,s,o,a){if(-1!==this._addedWeightNames.indexOf(e))throw new ti(`Duplicate weight name ${e} for layer ${this.name}`);this._addedWeightNames.push(e),null==n&&(n="float32"),this.fastWeightInitDuringBuild&&(i=null!=a?a():Nr("zeros"));const l=i.apply(t,n),u=new Ur(l,n,e,s,o);return l.dispose(),null!=r&&this.addLoss(()=>r.apply(u.read())),null==s&&(s=!0),s?this._trainableWeights.push(u):this._nonTrainableWeights.push(u),u}setFastWeightInitDuringBuild(e){this.fastWeightInitDuringBuild=e}addLoss(e){null==e||Array.isArray(e)&&0===e.length||(e=ui(e),void 0!==this._losses&&null!==this._losses&&this.losses.push(...e))}computeOutputShape(e){return e}computeMask(e,t){if(!this.supportsMasking){if(null!=t){if(!Array.isArray(t))throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`);t.forEach(e=>{if(null!=e)throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`)})}return null}return t}setMaskMetadata(e,t,n){if(!this.supportsMasking)return;const i=this.computeMask(e,n),r=ui(t),s=ui(i);if(r.length!==s.length)throw new Error(`${this.name} outputs ${r.length} tensors but ${r.length} masks for those tensors`);for(let e=0;e<r.length;e++)r[e].kerasMask=s[e]}addInboundNode(e,t,n,i,r,s,o=null){const a=ui(e);t=ui(t),n=ui(n),i=ui(i),r=Fr(r),s=Fr(s);const l=[],u=[],c=[];for(const e of a)l.push(e.sourceLayer),u.push(e.nodeIndex),c.push(e.tensorIndex);new Hr({outboundLayer:this,inboundLayers:l,nodeIndices:u,tensorIndices:c,inputTensors:a,outputTensors:t,inputMasks:n,outputMasks:i,inputShapes:r,outputShapes:s},o);for(let e=0;e<t.length;e++)t[e].sourceLayer=this,t[e].nodeIndex=this.inboundNodes.length-1,t[e].tensorIndex=e}getConfig(){const e={name:this.name,trainable:this.trainable};return null!=this.batchInputShape&&(e.batchInputShape=this.batchInputShape),null!=this.dtype&&(e.dtype=this.dtype),e}disposeWeights(){return this.weights.forEach(e=>e.dispose()),this.weights.length}assertNotDisposed(){if(0===this._refCount)throw new Error(`Layer '${this.name}' is already disposed.`)}dispose(){if(!this.built)throw new Error(`Cannot dispose Layer ${this.name} because it has not been built yet.`);if(null===this._refCount)throw new Error(`Cannot dispose Layer ${this.name} because it has not been used yet.`);this.assertNotDisposed();let e=0;return 0===--this._refCount&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}}}function qr(e,t,n){if((null==t||null!=n&&n>0)&&(t=e.sourceLayer,n=e.nodeIndex),0===t.inboundNodes.length)return[e];{const e=t.inboundNodes[n];if(0===e.inboundLayers.length)return e.inputTensors;{const t=[];for(let n=0;n<e.inboundLayers.length;n++){const i=qr(e.inputTensors[n],e.inboundLayers[n],e.nodeIndices[n]);for(const e of i)-1===t.indexOf(e)&&t.push(e)}return t}}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class Kr extends Xr{constructor(e){if(super({dtype:e.dtype,name:null!=e.name?e.name:Si("input").toString()}),null==e.batchSize&&(e.batchSize=null),null==e.sparse&&(e.sparse=!1),this.trainable=!1,this.built=!0,this.sparse=e.sparse,null!=e.inputShape&&null!=e.batchInputShape)throw new ti("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");let t=e.batchInputShape;if(null==t){if(null==e.inputShape)throw new ti("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");t=[e.batchSize].concat(e.inputShape)}else if(null!=e.batchSize)throw new ti("Cannot specify batchSize if batchInputShape is specified when creating an InputLayer.");const n=e.dtype||"float32";this.batchInputShape=t,this.dtype=n,this.inputSpec=[{shape:t}];const i=new Yr(this.dtype,this.batchInputShape,this,[],{},this.name);i.nodeIndex=0,i.tensorIndex=0,new Hr({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[i],outputTensors:[i],inputMasks:[null],outputMasks:[null],inputShapes:[t],outputShapes:[t]})}apply(e,t){throw new ti(`Cannot pass any input to an InputLayer's apply() method. InputLayer name: ${this.name}`)}dispose(){return{refCountAfterDispose:this._refCount,numDisposedVariables:0}}getConfig(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}}}function Zr(e){if(null==e.batchShape&&null==e.shape)throw new Error("Please provide to Input either a `shape` or a `batchShape` argument. Note that `shape` does not include the batch dimension.");if(null!=e.batchShape&&null!=e.shape)throw new ti("Please provide either a `shape` or `batchShape` argument to Input, but not both.");let t=e.batchShape;null!=e.shape&&null==t&&(t=[null].concat(e.shape));let n=e.dtype;null==n&&(n="float32");return new Kr({batchInputShape:t,name:e.name,dtype:n,sparse:e.sparse}).inboundNodes[0].outputTensors[0]}Kr.className="InputLayer",N.serialization.registerClass(Kr);class Qr{constructor(e){if(this.id2Value={},this.id2Mask={},this.name2Id={},e instanceof Qr)for(const t in e.id2Value)this.id2Value[t]=e.id2Value[t],t in e.id2Mask&&(this.id2Mask[t]=e.id2Mask[t]);else{if(null==e)return;for(const t of e)this.add(t.key,t.value)}}add(e,t,n){if(null!=this.id2Value[e.id])throw new ti(`Duplicate key: name=${e.name}, id=${e.id}`);return this.id2Value[e.id]=
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function(e,t){if(null==e.dtype||e.dtype===t.dtype)return t;try{return(0,N.cast)(t,e.dtype)}catch(n){throw new ti(`The dtype of the feed (${t.dtype}) can not be cast to the dtype of the key '${e.name}' (${e.dtype}).`)}}(e,t),this.name2Id[e.name]=e.id,null!=n&&(this.id2Mask[e.id]=n),this}addFeed(e){this.add(e.key,e.value)}hasKey(e){return null!=this.id2Value[e.id]}names(){return Object.keys(this.name2Id)}getValue(e){if(e instanceof Yr){if(null==this.id2Value[e.id])throw new ti(`Nonexistent key: ${e.name}`);return this.id2Value[e.id]}{const t=this.name2Id[e];if(null==t)throw new ti(`Feed dict has no SymbolicTensor name: ${e}`);return this.id2Value[t]}}getMask(e){if(e instanceof Yr){if(null==this.id2Value[e.id])throw new ti(`Nonexistent key: ${e.name}`);return this.id2Mask[e.id]}{const t=this.name2Id[e];if(null==t)throw new ti(`Feed dict has no SymbolicTensor name: ${e}`);return this.id2Mask[t]}}disposeMasks(){null!=this.id2Mask&&(0,N.dispose)(this.id2Mask)}}const Jr=new ri,es=new ri;function ts(e,t,n,i){const r=null!=n&&n.training,s=Array.isArray(e),o=s?e:[e],a=o.map(e=>e.name),l=[],u=t.names();for(const e of a)-1!==u.indexOf(e)?l.push(t.getValue(e)):l.push(null);null!=i&&(i.maxNumTensors=-1/0,i.minNumTensors=1/0);const c=a.join(",")+"|"+t.names().sort().join(",");let d,h=Jr.get(c);if(null==h){const e=function(e,t){N.util.assert(null!=e&&e.length>0,()=>"Expected at least one fetch, got none");let n=[],i={};if(1===e.length){const r=is(e[0],t);n=r.sorted,i=r.recipientMap}else{const r=new Set;for(const s of e){const{sorted:e,recipientMap:o}=is(s,t);for(const t of e)r.has(t.name)||(n.push(t),r.add(t.name));for(const e in o)null==i[e]&&(i[e]=new Set),o[e].forEach(t=>i[e].add(t))}}return{sorted:n,recipientCounts:ns(i)}}(o,t);h=e.sorted,d=e.recipientCounts,Jr.put(c,h),es.put(c,d)}d={},r||Object.assign(d,es.get(c));const p=new Qr(t);for(let e=0;e<h.length;++e){if(null!=i){const e=(0,N.memory)().numTensors;e>i.maxNumTensors&&(i.maxNumTensors=e),e<i.minNumTensors&&(i.minNumTensors=e)}const s=h[e],o=s.sourceLayer;if(o instanceof Kr)continue;const u=[],c=[],f=[];let m=!1;for(const e of s.inputs){const n=p.getValue(e),i=p.getMask(e);u.push(n),c.push(i),null!=i&&(m=!0),r||(d[e.name]--,0!==d[e.name]||t.hasKey(e)||-1!==a.indexOf(e.name)||n.isDisposed||!0===e.sourceLayer.stateful||f.push(n))}m&&((n=n||{}).mask=c[0]);const g=ui(o.apply(u,n));let y=null;o.supportsMasking&&(y=o.computeMask(u,c));const _=rs(s),v=Array.isArray(_)?_:[_];for(let e=0;e<v.length;++e){p.hasKey(v[e])||p.add(v[e],g[e],Array.isArray(y)?y[0]:y);const t=a.indexOf(v[e].name);-1!==t&&(l[t]=g[e])}r||(0,N.dispose)(f)}return p.disposeMasks(),s?l:l[0]}function ns(e){const t={};for(const n in e)t[n]=e[n].size;return t}function is(e,t){const n=new Set,i=[],r={};for(const e of t.names())n.add(e);const s=[],o=[];for(s.push(e);s.length>0;){const e=s[s.length-1];if(n.has(e.name)){s.pop();continue}const t=o[o.length-1]===s.length-1;if(0===e.inputs.length||t)s.pop(),i.push(e),n.add(e.name),t&&o.pop();else{o.push(s.length-1);for(const t of e.inputs)null==r[t.name]&&(r[t.name]=new Set),r[t.name].add(e.name),n.has(t.name)||s.push(t)}}return{sorted:i,recipientMap:r}}function rs(e){let t;if(1===e.sourceLayer.inboundNodes.length)t=e.sourceLayer.output;else{let n=null;for(let t=0;t<e.sourceLayer.inboundNodes.length;++t)for(const i of e.sourceLayer.inboundNodes[t].outputTensors)if(i.id===e.id){n=t;break}t=e.sourceLayer.getOutputAt(n)}return t}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function ss(e,t){return(0,N.tidy)(()=>N.sqrt(N.sum(N.mul(e,e),t,!0)))}(0,N.env)().registerFlag("TOPOLOGICAL_SORT_CACHE_MAX_ENTRIES",()=>100,function(e){null!=Jr&&Jr.setMaxEntries(e),null!=es&&es.setMaxEntries(e)});class os extends N.serialization.Serializable{getConfig(){return{}}}class as extends os{constructor(e){super(),this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=null!=e.maxValue?e.maxValue:this.defaultMaxValue,this.axis=null!=e.axis?e.axis:this.defaultAxis}apply(e){return(0,N.tidy)(()=>{const t=ss(e,this.axis),n=N.clipByValue(t,0,this.maxValue);return N.mul(e,N.div(n,N.add(qi(),t)))})}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}}as.className="MaxNorm",N.serialization.registerClass(as);class ls extends os{constructor(e){super(),this.defaultAxis=0,this.axis=null!=e.axis?e.axis:this.defaultAxis}apply(e){return(0,N.tidy)(()=>N.div(e,N.add(qi(),ss(e,this.axis))))}getConfig(){return{axis:this.axis}}}ls.className="UnitNorm",N.serialization.registerClass(ls);class us extends os{apply(e){return N.relu(e)}}us.className="NonNeg",N.serialization.registerClass(us);class cs extends os{constructor(e){super(),this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=null!=e.minValue?e.minValue:this.defaultMinValue,this.maxValue=null!=e.maxValue?e.maxValue:this.defaultMaxValue,this.rate=null!=e.rate?e.rate:this.defaultRate,this.axis=null!=e.axis?e.axis:this.defaultAxis}apply(e){return(0,N.tidy)(()=>{const t=ss(e,this.axis),n=N.add(N.mul(this.rate,N.clipByValue(t,this.minValue,this.maxValue)),N.mul(1-this.rate,t));return N.mul(e,N.div(n,N.add(qi(),t)))})}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}}cs.className="MinMaxNorm",N.serialization.registerClass(cs);const ds={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function hs(e){return pi(e)}function ps(e,t={}){return mi(e,N.serialization.SerializationMap.getMap().classNameMap,t,"constraint")}function fs(e){if(null==e)return null;if("string"==typeof e){return ps({className:e in ds?ds[e]:e,config:{}})}return e instanceof os?e:ps(e)}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function ms(e){return new as(e)}function gs(e){return new ls(e)}function ys(){return new us}function _s(e){return new cs(e)}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function vs(){return new mr}function bs(){return new gr}function Ts(e){return new yr(e)}function xs(e){return new _r(e)}function Es(e){return new vr(e)}function ws(e){return new br(e)}function Is(e){return new Tr(e)}function As(e){return new xr(e)}function Ss(e){return new Er(e)}function Cs(e){return new wr(e)}function Os(e){return new Ir(e)}function Ms(e){return new Ar(e)}function Rs(e){return new Sr(e)}function ks(e){return new Cr(e)}function Ns(e){return new Or(e)}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
async function Ds(e){if(null==e)return;const t=[],n=[],i=[];for(const r in e){const s=e[r];if("number"!=typeof s){const e=s;t.push(e.data()),n.push(r),i.push(e)}}if(t.length>0){const r=await Promise.all(t);for(let t=0;t<r.length;++t)e[n[t]]=r[t][0];(0,N.dispose)(i)}}function Fs(e){if(null!=e)for(const t in e){const n=e[t];"number"!=typeof n&&n.dispose()}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
var Ls;!function(e){e[e.SILENT=0]="SILENT",e[e.VERBOSE=1]="VERBOSE"}(Ls||(Ls={}));class Ps{constructor(){this.validationData=null}setParams(e){this.params=e}async onEpochBegin(e,t){}async onEpochEnd(e,t){}async onBatchBegin(e,t){}async onBatchEnd(e,t){}async onTrainBegin(e){}async onTrainEnd(e){}setModel(e){}}class Bs{constructor(e,t=10){null==e&&(e=[]),this.callbacks=e,this.queueLength=t}append(e){this.callbacks.push(e)}setParams(e){for(const t of this.callbacks)t.setParams(e)}setModel(e){for(const t of this.callbacks)t.setModel(e)}async onEpochBegin(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onEpochBegin(e,t)}async onEpochEnd(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onEpochEnd(e,t)}async onBatchBegin(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onBatchBegin(e,t)}async onBatchEnd(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onBatchEnd(e,t)}async onTrainBegin(e){null==e&&(e={});for(const t of this.callbacks)await t.onTrainBegin(e)}async onTrainEnd(e){null==e&&(e={});for(const t of this.callbacks)await t.onTrainEnd(e)}}class $s extends Ps{constructor(){super()}async onEpochBegin(e){this.seen=0,this.totals={}}async onBatchEnd(e,t){null==t&&(t={});const n=null==t.size?0:t.size;this.seen+=n;for(const e in t){const i=t[e];if("number"==typeof i)this.totals.hasOwnProperty(e)||(this.totals[e]=0),this.totals[e]=this.totals[e]+i*n;else{let t;e in this.totals?t=this.totals[e]:this.totals[e]=0;const r=(0,N.tidy)(()=>(0,N.add)(this.totals[e],(0,N.mul)(i,n)));this.totals[e]=r,null!=t&&t.dispose()}}}async onEpochEnd(e,t){if(null!=t)for(const e of this.params.metrics)null!=this.totals[e]&&("number"==typeof this.totals[e]?t[e]=this.totals[e]/this.seen:(0,N.tidy)(()=>{const n=(0,N.mul)((0,N.div)(1,this.seen),this.totals[e]);t[e]=n,this.totals[e].dispose(),(0,N.keep)(t[e])}))}}class Us extends Ps{async onTrainBegin(e){this.epoch=[],this.history={}}async onEpochEnd(e,t){null==t&&(t={}),this.epoch.push(e);for(const e in t)null==this.history[e]&&(this.history[e]=[]),this.history[e].push(t[e])}async syncData(){const e=[],t=[],n=[];for(const i in this.history){const r=this.history[i];for(let s=0;s<r.length;++s)if("number"!=typeof r[s]){const o=r[s];e.push(o.data()),t.push(i),n.push(s)}}const i=await Promise.all(e);for(let e=0;e<i.length;++e){this.history[t[e]][n[e]].dispose(),this.history[t[e]][n[e]]=i[e][0]}}}class zs extends Ps{constructor(e,t){if(super(),this.currentEpoch=0,this.nowFunc=e.nowFunc,this.nextFrameFunc=e.nextFrameFunc||N.nextFrame,this.yieldEvery=t||"auto","auto"===this.yieldEvery&&(this.yieldEvery=125),"never"===this.yieldEvery&&null!=e.onYield)throw new Error("yieldEvery is `never` but you provided an `onYield` callback. Either change `yieldEvery` or remove the callback");N.util.isNumber(this.yieldEvery)&&(this.maybeWait=function(e,t,n){let i,r=null!=n?n():N.util.now();return(...s)=>{const o=null!=n?n():N.util.now();return o-r<t||(r=o,i=e(...s)),i}}(this.maybeWait.bind(this),this.yieldEvery,this.nowFunc)),this.trainBegin=e.onTrainBegin,this.trainEnd=e.onTrainEnd,this.epochBegin=e.onEpochBegin,this.epochEnd=e.onEpochEnd,this.batchBegin=e.onBatchBegin,this.batchEnd=e.onBatchEnd,this.yield=e.onYield}async maybeWait(e,t,n){const i=[];null!=this.yield&&(await Ds(n),i.push(this.yield(e,t,n))),i.push(this.nextFrameFunc()),await Promise.all(i)}async onEpochBegin(e,t){this.currentEpoch=e,null!=this.epochBegin&&(await Ds(t),await this.epochBegin(e,t))}async onEpochEnd(e,t){const n=[];null!=this.epochEnd&&(await Ds(t),n.push(this.epochEnd(e,t))),"epoch"===this.yieldEvery&&n.push(this.nextFrameFunc()),await Promise.all(n)}async onBatchBegin(e,t){null!=this.batchBegin&&(await Ds(t),await this.batchBegin(e,t))}async onBatchEnd(e,t){const n=[];null!=this.batchEnd&&(await Ds(t),n.push(this.batchEnd(e,t))),"batch"===this.yieldEvery?n.push(this.nextFrameFunc()):N.util.isNumber(this.yieldEvery)&&n.push(this.maybeWait(this.currentEpoch,e,t)),await Promise.all(n)}async onTrainBegin(e){null!=this.trainBegin&&(await Ds(e),await this.trainBegin(e))}async onTrainEnd(e){null!=this.trainEnd&&(await Ds(e),await this.trainEnd(e))}}function Vs(e,t){if(null==e&&(e={}),e instanceof Ps)return[e];if(Array.isArray(e)&&e[0]instanceof Ps)return e;return ui(e).map(e=>new zs(e,t))}class js{constructor(){}static registerCallbackConstructor(e,t){N.util.assert(e>=0&&Number.isInteger(e),()=>`Verbosity level is expected to be an integer >= 0, but got ${e}`),js.checkForDuplicate(t),null==js.constructors[e]&&(js.constructors[e]=[]),js.constructors[e].push(t)}static checkForDuplicate(e){for(const t in js.constructors){js.constructors[+t].forEach(t=>{if(t===e)throw new ti("Duplicate callback constructor.")})}}static clear(){js.constructors={}}static createCallbacks(e){const t=[];for(const n in js.constructors){const i=+n;e>=i&&t.push(...js.constructors[i])}return t.map(e=>new e)}}function Ys(e,t,n,i,r,s,o,a,l){const u=new Us,c=[new $s,...js.createCallbacks(t)];null!=e&&c.push(...e),c.push(u);const d=new Bs(c);return d.setParams({epochs:n,initialEpoch:i,samples:r,steps:s,batchSize:o,verbose:t,doValidation:a,metrics:l}),{callbackList:d,history:u}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Gs(e,t={},n=!1){return mi(e,N.serialization.SerializationMap.getMap().classNameMap,t,"layer",n)}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Hs(e,t){return(0,N.tidy)(()=>{"float32"!==e.dtype&&(e=N.cast(e,"float32"));const n=N.sum(ar(e),t,!0),i=N.fill(n.shape,qi()),r=N.sqrt(N.maximum(n,i));return N.div(e,r)})}function Ws(e,t){return(0,N.tidy)(()=>N.mean(ar(N.sub(t,e)),-1))}function Xs(e,t){return(0,N.tidy)(()=>N.mean(N.abs(N.sub(t,e)),-1))}function qs(e,t){return(0,N.tidy)(()=>{const n=N.sub(e,t),i=N.clipByValue(N.abs(e),qi(),Number.MAX_VALUE),r=N.abs(N.div(n,i));return N.mul(100,N.mean(r,-1))})}function Ks(e,t){return(0,N.tidy)(()=>{const n=N.clipByValue(t,qi(),Number.MAX_VALUE),i=N.log(N.add(1,n)),r=N.clipByValue(e,qi(),Number.MAX_VALUE),s=N.log(N.add(1,r));return N.mean(ar(N.sub(i,s)),-1)})}function Zs(e,t,n=!1){return(0,N.tidy)(()=>{if(n)t=N.softmax(t);else{const e=N.sum(t,t.shape.length-1,!0);t=N.div(t,e)}return t=N.clipByValue(t,qi(),1-qi()),N.neg(N.sum(N.mul(N.cast(e,"float32"),N.log(t)),t.shape.length-1))})}function Qs(e,t,n=!1){return(0,N.tidy)(()=>{const i=N.cast(N.floor(function(e){const t=[Yi(e.shape)];return N.reshape(e,t)}(e)),"int32"),r=(t=N.clipByValue(t,qi(),1-qi())).shape;return Zs(N.reshape(N.oneHot(i,r[r.length-1]),r),t,n)})}function Js(e,t){return(0,N.tidy)(()=>{let n;return n=N.clipByValue(t,qi(),1-qi()),n=N.log(N.div(n,N.sub(1,n))),N.mean(function(e,t){if(!N.util.arraysEqual(e.shape,t.shape))throw new ti(`logits and labels must have the same shape, but got shapes ${JSON.stringify(e.shape)} and ${JSON.stringify(t.shape)}`);return(0,N.tidy)(()=>{const n=N.relu(t),i=N.neg(N.abs(t));return N.add(N.sub(n,N.mul(t,e)),N.log1p(N.exp(i)))})}(e,n),-1)})}function eo(e,t){return(0,N.tidy)(()=>{const n=N.clipByValue(e,qi(),1),i=N.clipByValue(t,qi(),1);return N.sum(N.mul(e,N.log(N.div(n,i))),-1)})}function to(e,t){return(0,N.tidy)(()=>{const n=Hs(e,-1),i=Hs(t,-1),r=N.mul(n,i);return N.neg(N.sum(r,-1))})}js.constructors={};const no={meanSquaredError:Ws,meanAbsoluteError:Xs,meanAbsolutePercentageError:qs,meanSquaredLogarithmicError:Ks,squaredHinge:function(e,t){return(0,N.tidy)(()=>{const n=N.maximum(0,N.sub(1,N.mul(e,t)));return N.mean(ar(n),-1)})},hinge:function(e,t){return(0,N.tidy)(()=>{const n=N.maximum(0,N.sub(1,N.mul(e,t)));return N.mean(n,-1)})},categoricalHinge:function(e,t){return(0,N.tidy)(()=>{const n=N.sum(N.mul(e,t),-1),i=N.max(N.mul(N.sub(1,e),t),-1);return N.maximum(0,N.add(1,N.sub(i,n)))})},logcosh:function(e,t){return(0,N.tidy)(()=>{const n=Math.log(2),i=N.sub(t,e),r=N.sub(N.add(i,N.softplus(N.mul(-2,i))),n);return N.mean(r,-1)})},categoricalCrossentropy:Zs,sparseCategoricalCrossentropy:Qs,binaryCrossentropy:Js,kullbackLeiblerDivergence:eo,poisson:function(e,t){return(0,N.tidy)(()=>{const n=N.log(N.add(qi(),t));return N.mean(N.sub(t,N.mul(e,n)),-1)})},cosineProximity:to};function io(e){if("string"==typeof e){if(e in no)return no[e];let t=`Unknown loss ${e}`;throw e.toLowerCase().includes("softmaxcrossentropy")&&(t=`Unknown loss ${e}. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy`),new ti(t)}return e}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function ro(e,t){return(0,N.tidy)(()=>{const n=N.mul(.5,N.onesLike(t)),i=Ki(N.greater(t,n),e.dtype);return N.mean(N.equal(e,i),-1)})}function so(e,t){return(0,N.tidy)(()=>Ki(N.equal(N.argMax(e,-1),N.argMax(t,-1)),"float32"))}function oo(e,t){return(0,N.tidy)(()=>N.cast(N.sum(N.logicalAnd(N.equal(e,1),N.equal(t,1))),"float32"))}function ao(e,t){return(0,N.tidy)(()=>{const n=oo(e,t),i=function(e,t){return(0,N.tidy)(()=>N.cast(N.sum(N.logicalAnd(N.equal(e,0),N.equal(t,1))),"float32"))}(e,t),r=N.add(n,i);return N.cast(N.where(N.greater(r,0),N.div(n,r),0),"float32")})}function lo(e,t){return(0,N.tidy)(()=>{const n=oo(e,t),i=function(e,t){return(0,N.tidy)(()=>N.cast(N.sum(N.logicalAnd(N.equal(e,1),N.equal(t,0))),"float32"))}(e,t),r=N.add(n,i);return N.cast(N.where(N.greater(r,0),N.div(n,r),0),"float32")})}function uo(e,t){return Js(e,t)}function co(e,t){return e.rank===t.rank&&(e=N.squeeze(e,[e.rank-1])),(t=N.argMax(t,-1)).dtype!==e.dtype&&(t=N.cast(t,e.dtype)),N.cast(N.equal(e,t),"float32")}const ho=Zs,po=Qs,fo={binaryAccuracy:ro,categoricalAccuracy:so,precision:ao,categoricalCrossentropy:ho,sparseCategoricalCrossentropy:po,mse:Ws,MSE:Ws,mae:Xs,MAE:Xs,mape:qs,MAPE:qs,cosine:to};function mo(e){if("string"==typeof e&&e in fo)return fo[e];if("string"!=typeof e&&null!=e)return e;throw new ti(`Unknown metric ${e}`)}function go(e){if(oi(null!==e,`Unknown LossOrMetricFn ${e}`),"string"==typeof e)return e;{let t;for(const n of Object.keys(no))if(no[n]===e){t=n;break}if(void 0!==t)return t;for(const n of Object.keys(fo))if(fo[n]===e){t=n;break}return void 0!==t?t:e.name}}
/**
* @license
* Copyright 2019 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
const yo=1048576;function _o(e,t,n=!1){if(null==e||"object"!=typeof e||Object.getPrototypeOf(e)!==Object.prototype||!vo(e))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(n){const n=JSON.stringify(e);n.length>yo&&console.warn(`User-defined metadata of model "${t}" is too large in size (length=${n.length} when serialized). It is not recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= 1048576.`)}}function vo(e){if(null===e)return!0;if("object"==typeof e){if(Object.getPrototypeOf(e)===Object.prototype){const t=Object.keys(e);for(const n of t){if("string"!=typeof n)return!1;if(!vo(e[n]))return!1}return!0}if(Array.isArray(e)){for(const t of e)if(!vo(t))return!1;return!0}return!1}{const t=typeof e;return"string"===t||"number"===t||"boolean"===t}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function bo(e,t,n,i=console.log){const r=function(e){let t=!0;const n=[],i=[];for(const t in e.nodesByDepth)n.push(e.nodesByDepth[t]);for(const e of n){if(e.length>1||1===e.length&&e[0].inboundLayers.length>1){t=!1;break}i.push(...e)}if(t)for(const n of e.layers){let e=!1;for(const r of n.inboundNodes)if(-1!==i.indexOf(r)){if(e){t=!1;break}e=!0}if(!t)break}return t}(e),s=["Layer (type)","Input Shape","Output shape","Param #"];let o;if(r?(t=t||90,n=n||[.32,.61,.89,1]):(t=t||115,n=n||[.24,.48,.7,.8,1]),n[n.length-1]<=1&&(n=n.map(e=>Math.floor(t*e))),!r){s.push("Receives inputs"),o=[];for(const t in e.nodesByDepth)o.push(...e.nodesByDepth[t])}i("_".repeat(t)),To(s,n,i),i("=".repeat(t));const a=e.layers;for(let e=0;e<a.length;++e)r?xo(a[e],n,i):Eo(a[e],n,o,i),i((e===a.length-1?"=":"_").repeat(t));e.checkTrainableWeightsConsistency();const l=function(e){let t;t=null!=e.collectedTrainableWeights?Br(e.collectedTrainableWeights):Br(e.trainableWeights);return t}(e),u=Br(e.nonTrainableWeights);i(`Total params: ${l+u}`),i(`Trainable params: ${l}`),i(`Non-trainable params: ${u}`),i("_".repeat(t))}function To(e,t,n=console.log){let i="";for(let n=0;n<e.length;++n)n>0&&(i=i.slice(0,i.length-1)+" "),i+=e[n],i=i.slice(0,t[n]),i+=" ".repeat(t[n]-i.length);n(i)}function xo(e,t,n){let i,r;try{r=e.inboundNodes.map(e=>JSON.stringify(e.inputShapes)).join(",")}catch(e){r="multiple"}try{i=JSON.stringify(e.outputShape)}catch(e){i="multiple"}To([`${e.name} (${e.getClassName()})`,r,i,e.countParams().toString()],t,n)}function Eo(e,t,n,i){let r,s;try{s=e.inboundNodes.map(e=>JSON.stringify(e.inputShapes)).join(",")}catch(e){s="multiple"}try{r=JSON.stringify(e.outputShape)}catch(e){r="multiple"}const o=[];for(const t of e.inboundNodes)if(!(null!=n&&n.length>0&&-1===n.indexOf(t)))for(let e=0;e<t.inboundLayers.length;++e){const n=t.inboundLayers[e].name,i=t.nodeIndices[e],r=t.tensorIndices[e];o.push(`${n}[${i}][${r}]`)}const a=e.name,l=e.getClassName(),u=0===o.length?"":o[0];To([`${a} (${l})`,s,r,e.countParams().toString(),u],t,i);for(let e=1;e<o.length;++e)To(["","","","",o[e]],t,i)}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function wo(e,t,n){return("inboundNodes"===e||"outputLayers"===e||"inputLayers"===e)&&0===t&&"string"==typeof n}function Io(e,t){if(null===e)return null;if("string"==typeof e)return di(e);if("number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){const n=[],i=e.length;for(let r=0;r<i;++r){const i=e[r];wo(t,r,i)?n.push(i):n.push(Io(i,t))}return n}{const t={};for(const n of Object.keys(e)){const i=e[n];if("name"===n&&"string"==typeof i)t[n]=i;else{const e=di(n);t[e]=Io(i,e)}}return t}}function Ao(e,t){if(null==e)return null;if("string"==typeof e)return ci(e);if("number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){const n=[],i=e.length;for(let r=0;r<i;++r){const i=e[r];wo(t,r,i)?n.push(i):n.push(Ao(i,t))}return n}{const t={};for(const n of Object.keys(e)){const i=e[n],r=ci(n);t[r]="name"!==n&&"className"!==n||"string"!=typeof i?Ao(i,n):i}return t}}
/** @license See the LICENSE file. */
const So="4.22.0";class Co extends Xr{constructor(e){if(super({}),this.containerNodes=new Set,this.name=e.name,null==this.name){const e=this.getClassName().toLowerCase();this.name=Si(e)}if(this.supportsMasking=!1,this.trainable_=!0,Array.isArray(e.inputs)?this.inputs=e.inputs.slice():this.inputs=[e.inputs],Array.isArray(e.outputs)?this.outputs=e.outputs.slice():this.outputs=[e.outputs],yi(this.inputs).length!==this.inputs.length)throw new ti(`The list of inputs passed to the model is redundant. All inputs should only appear once. Found: ${this.inputs.map(e=>e.name)}`);yi(this.outputs).length!==this.outputs.length&&console.warn(`The list of outputs passed to the model is redundant. All outputs should only appear once. Found: ${this.outputs.map(e=>e.name)}`),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(const e of this.outputs){const t=e.sourceLayer,n=e.nodeIndex,i=e.tensorIndex;this.outputLayers.push(t),this.outputLayersNodeIndices.push(n),this.outputLayersTensorIndices.push(i)}for(const e of this.inputs){const t=e.sourceLayer,n=e.nodeIndex,i=e.tensorIndex;oi(0===n,"input layer has >1 nodes"),oi(0===i,"input layer has >1 tensors"),this.inputLayers.push(t),this.inputLayersNodeIndices.push(n),this.inputLayersTensorIndices.push(i)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let t=0;t<this.inputLayers.length;t++){const n=this.inputLayers[t];if(!(n instanceof Kr))throw new TypeError(`Input layers to a LayersModel must be InputLayer objects. Received inputs: ${e.inputs}. Input ${t} (0-based) originates from layer type ${n.getClassName()}.`);this.inputNames.push(n.name),this.feedInputShapes.push(n.batchInputShape),this.feedInputNames.push(n.name)}for(const e of this.outputLayers)this.outputNames.push(e.name);this.internalInputShapes=this.inputs.map(e=>e.shape),this.internalOutputShapes=this.outputs.map(e=>e.shape);const t={},n={},i={},r={},s={},o=[],a=(e,t,n,i,r,l)=>{null!=i&&null!=r&&null!=l||(i=e.sourceLayer,r=e.nodeIndex,l=e.tensorIndex);const u=i.inboundNodes[r];if(-1!==n.indexOf(u))throw new ei(`The tensor ${e.name} at layer "${i.name}" is part of a cycle.`);if(-1!==t.indexOf(u))return;this.containerNodes.add(Co.nodeKey(i,r)),i.id in s||(s[i.id]=Object.keys(s).length),-1===n.indexOf(u)&&n.push(u);const c=u.inboundLayers.length;for(let e=0;e<c;e++){const i=u.inputTensors[e],r=u.inboundLayers[e],s=u.nodeIndices[e],o=u.tensorIndices[e];a(i,t,n,r,s,o)}for(t.push(u);n.indexOf(u)>=0;)n.splice(n.indexOf(u),1);o.push(u)},l=[],u=[];for(const e of this.outputs)a(e,l,u);const c=o.slice().reverse();for(const e of c){n[e.id]=e,e.id in t||(t[e.id]=0);let s=t[e.id];const o=null==i[e.outboundLayer.id]?0:i[e.outboundLayer.id];s=Math.max(s,o),i[e.outboundLayer.id]=s,r[e.outboundLayer.id]=e.outboundLayer,t[e.id]=s;for(let i=0;i<e.inboundLayers.length;i++){const r=e.inboundLayers[i],o=e.nodeIndices[i],a=r.inboundNodes[o],l=null==t[a.id]?0:t[a.id];t[a.id]=Math.max(s+1,l),n[a.id]=a}}const d={};for(const e in t){const i=t[e];i in d||(d[i]=[]),d[i].push(n[e])}const h={};for(const e in i){const t=i[e];t in h||(h[t]=[]),h[t].push(r[e])}let p=Object.keys(h).map(e=>parseInt(e,10)).sort(gi);this.layers=[];for(const e of p){const t=h[e];t.sort((e,t)=>{const n=s[e.id],i=s[t.id];return n<i?-1:n>i?1:0});for(const e of t)e instanceof Co&&this.internalContainerRefs.push(e),this.layers.push(e)}this.layersByDepth=h,p=Object.keys(d).map(e=>parseInt(e,10)).sort(gi);const f=this.inputs.slice(),m=[];for(const e of p)for(const t of d[e]){const e=t.outboundLayer;if(null!=e){for(const n of t.inputTensors)if(-1===f.indexOf(n))throw new ei(`Graph disconnected: cannot obtain value for tensor ${n} at layer "${e.name}". The following previous layers were accessed without issue: ${m}`);for(const e of t.outputTensors)f.push(e);m.push(e.name)}}this.nodesByDepth=d;const g=this.layers.map(e=>e.name);for(const e of g){const t=g.filter(t=>t===e).length;if(1!==t)throw new ei(`The name "${e}" is used ${t} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(g))}this.outboundNodes=[],this.inboundNodes=[],new Hr({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map(e=>null),outputMasks:this.outputs.map(e=>null),inputShapes:this.inputs.map(e=>e.shape),outputShapes:this.outputs.map(e=>e.shape)}),this.built=!0,this._refCount=1}assertNotDisposed(){if(0===this._refCount)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();const e={refCountAfterDispose:null,numDisposedVariables:0};if(0===--this._refCount){for(const t of this.layers)e.numDisposedVariables+=t.dispose().numDisposedVariables;for(const t of this.internalContainerRefs)e.numDisposedVariables+=t.dispose().numDisposedVariables}return e.refCountAfterDispose=this._refCount,e}get trainable(){return this.trainable_}set trainable(e){this.layers.forEach(t=>{t._trainableWeights.forEach(t=>t.trainable=e)}),this.trainable_=e}get trainableWeights(){if(this._trainableWeights.length>0)throw new ti("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let e=[];for(const t of this.layers)e=e.concat(t.trainableWeights);return e}get nonTrainableWeights(){const e=[];for(const t of this.layers)e.push(...t.nonTrainableWeights);if(!this.trainable){const t=[];for(const e of this.layers)t.push(...e.trainableWeights);return t.concat(e)}return e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(e,t=!0){const n={};let i=0;const r=(e=>{const t=Object.keys(e);if(0===t.length)return!1;const n=t[0].split("/");return!isNaN(parseInt(n[n.length-1],10))})(e);r&&this.parseWeights(e);for(const e of this.layers)for(const[t,s]of e.weights.entries()){const e=r?`${s.name.split("/").slice(0,-1).join("/")+"/"}${t}`:s.originalName;if(null!=n[e])throw new ti(`Duplicate weight name: ${e}`);n[e]=s,i++}const s=[];for(const i in e){let r=i;if(null==n[i]){const e=i.split("/");r=e.slice(0,-2).concat([e[e.length-1]]).join("/")}if(null!=n[r])s.push([n[r],e[i]]);else if(t)throw new ti(`Provided weight data has no target variable: ${i}`);delete n[r]}if(t){const e=[];for(const t in n)e.push(t);if(e.length>0)throw new ti(`${e.length} of ${i} weights are not set: ${e}`)}Vr(s)}parseWeights(e){for(const t in Object.keys(e)){const n=t.split("/"),i=["vars","layer_checkpoint_dependencies"],r=n.map(e=>e.startsWith("_")?e.slice(1):e).filter(e=>!i.includes(e)).join("/");r!==t&&(e[r]=e[t],delete e[t])}}updatedConfig(){const e=this.getConfig(),t={};return t.className=this.getClassName(),t.config=e,t.kerasVersion=`tfjs-layers ${So}`,t.backend="TensorFlow.js",t}toJSON(e,t=!0){const n=Ao(this.updatedConfig());return t?JSON.stringify(n):n}call(e,t){return(0,N.tidy)(()=>{e=ui(e);const n=new Qr;for(let t=0;t<this.inputs.length;++t)n.add(this.inputs[t],e[t]);return ts(this.outputs,n,t)})}computeMask(e,t){return(0,N.tidy)(()=>{let n;return e=ui(e),n=null==t?si(null,e.length):ui(t),this.runInternalGraph(e,n)[1]})}computeOutputShape(e){const t=Fr(e);if(t.length!==this.inputLayers.length)throw new ti(`Invalid inputShape argument ${e}: model has ${this.inputLayers.length} tensor inputs.`);const n={};for(let e=0;e<t.length;e++){const i=this.inputLayers[e],r=t[e];n[i.name+"_0_0"]=r}const i=Object.keys(this.nodesByDepth).map(e=>parseInt(e,10)).sort(gi);if(i.length>1)for(const e of i){const t=this.nodesByDepth[e];for(const e of t){const t=e.outboundLayer;if(-1!==this.inputLayers.map(e=>e.id).indexOf(t.id))continue;const i=[];for(let t=0;t<e.inboundLayers.length;t++){const r=e.inboundLayers[t],s=e.nodeIndices[t],o=e.tensorIndices[t],a=n[`${r.name}_${s}_${o}`];i.push(a)}const r=Fr(t.computeOutputShape(li(i))),s=t.inboundNodes.indexOf(e);for(let e=0;e<r.length;e++){n[`${t.name}_${s}_${e}`]=r[e]}}}const r=[],s=[];for(let e=0;e<this.outputLayers.length;e++){const t=this.outputLayers[e],n=this.outputLayersNodeIndices[e],i=this.outputLayersTensorIndices[e],r=`${t.name}_${n}_${i}`;s.push(r)}for(let e=0;e<s.length;e++){const t=s[e];oi(t in n),r.push(n[t])}return li(r)}runInternalGraph(e,t){null==t&&(t=si(null,e.length));const n={};for(let i=0;i<this.inputs.length;++i){const r=this.inputs[i],s=e[i],o=t[i];n[r.id]=[s,o]}const i=Object.keys(this.nodesByDepth).map(e=>parseInt(e,10)).sort(gi);for(const e of i){const t=this.nodesByDepth[e];for(const e of t){const t=e.outboundLayer,i=e.inputTensors,r=e.outputTensors,s=new Array;for(const e of i)e.id in n&&s.push(n[e.id]);if(s.length===i.length){let i,o,a,l,u={};if(null!=e.callArgs&&(u=e.callArgs),1===s.length){const[e,n]=s[0];null==u.mask&&(u.mask=n),a=ui(t.call(e,u)),l=ui(t.computeMask(e,n)),i=[e],o=[n]}else i=s.map(e=>e[0]),o=s.map(e=>e[1]),null==u.mask&&(u.mask=o),a=ui(t.call(i,u)),l=ui(t.computeMask(i,o));if(t.activityRegularizer)throw new ni("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let e=0;e<r.length;++e){const t=r[e],i=a[e],s=l[e];n[t.id]=[i,s]}}}}const r=[],s=[],o=[];for(const e of this.outputs){oi(e.id in n,`Could not compute output ${e.name} : ${e.id}`);const[t,i]=n[e.id];o.push(t.shape),r.push(t),s.push(i)}return[r,s,o]}buildNodeConversionMap(e){const t={};let n;for(const e of this.layers){n=e instanceof Co?1:0;for(let i=0;i<e.inboundNodes.length;i++){const r=Co.nodeKey(e,i);this.containerNodes.has(r)&&(t[r]=n,n+=1)}}return t}getLayer(e,t){if(null!=t)return this.findLayer(t);if(null==e)throw new ti("Provide either a layer name or layer index");if("number"==typeof e)return this.findLayer(e);for(const t of this.layers)if(t.name===e)return t;throw new ti(`No such layer: ${e}`)}findLayer(e){if(this.layers.length<=e)throw new ti(`Was asked to retrieve layer at index ${e}, but model only has ${this.layers.length} layer(s).`);return this.layers[e]}calculateLosses(){return(0,N.tidy)(()=>{const e=[];for(const t of this.layers)for(let n=0;n<t.inboundNodes.length;++n){const i=Co.nodeKey(t,n);this.containerNodes.has(i)&&e.push(...t.calculateLosses())}return e})}getConfig(){const e={name:this.name},t=this.buildNodeConversionMap(this.layers),n=[];for(const e of this.layers){const i=e.getClassName(),r=e.getConfig(),s=[];for(let n=0;n<e.inboundNodes.length;n++){const i=e.inboundNodes[n],r=Co.nodeKey(e,n);let o={};if(this.containerNodes.has(r)){if(i.callArgs)try{JSON.stringify(i.callArgs),o=i.callArgs}catch(t){console.warn(`Layer ${e.name} was passed non-serializable keyword arguments: ${i.callArgs}. They will not be included in the serialized model (and thus will be missing at deserialization time).`),o={}}if(i.inboundLayers.length>0){const e=[];for(let n=0;n<i.inboundLayers.length;n++){const r=i.inboundLayers[n],s=i.nodeIndices[n],a=i.tensorIndices[n];let l=t[Co.nodeKey(r,s)];null==l&&(l=0),e.push([r.name,l,a,o])}s.push(e)}}}const o={};o.name=e.name,o.className=i,o.config=r,o.inboundNodes=s,n.push(o)}e.layers=n;const i=[];for(let e=0;e<this.inputLayers.length;e++){const n=this.inputLayers[e],r=this.inputLayersNodeIndices[e],s=Co.nodeKey(n,r);if(!this.containerNodes.has(s))continue;let o=t[s];null==o&&(o=0);const a=this.inputLayersTensorIndices[e];i.push([n.name,o,a])}e.inputLayers=i;const r=[];for(let e=0;e<this.outputLayers.length;e++){const n=this.outputLayers[e],i=this.outputLayersNodeIndices[e],s=Co.nodeKey(n,i);if(!this.containerNodes.has(s))continue;let o=t[s];null==o&&(o=0);const a=this.outputLayersTensorIndices[e];r.push([n.name,o,a])}return e.outputLayers=r,e}static fromConfig(e,t,n={},i=!1){const r={},s={};function o(e,t){e.name in s?s[e.name].push(t):s[e.name]=[t]}function a(e,t){const n=[];let i;for(const s of t){const a=s[0],l=s[1],u=s[2];if(i=null==s[3]?{}:s[3],!(a in r))return void o(e,t);const c=r[a];if(c.inboundNodes.length<=l)return void o(e,t);const d=c.inboundNodes[l];n.push(d.outputTensors[u])}n.length>0&&e.apply(li(n),i)}function l(e){const n=e.name,s=Gs(e,null!=t.customObjects?t.customObjects:{});s.setFastWeightInitDuringBuild(i),r[n]=s;e.inboundNodes.forEach(e=>{if(!(e instanceof Array))throw new ti(`Corrupted configuration, expected array for nodeData: ${e}`);o(s,e)})}const u=t.name,c=t.layers;for(const e of c)l(e);for(;!_i(s);)for(const e of c){const t=r[e.name];if(t.name in s){const e=s[t.name];delete s[t.name];for(const n of e)a(t,n)}}const d=[],h=[],p=t.inputLayers;for(const e of p){const t=e[0],n=e[1],i=e[2];oi(t in r);const s=r[t].inboundNodes[n].outputTensors;d.push(s[i])}const f=t.outputLayers;for(const e of f){const t=e[0],n=e[1],i=e[2];oi(t in r);const s=r[t].inboundNodes[n].outputTensors;h.push(s[i])}return new e({inputs:d,outputs:h,name:u})}get stateful(){if(this._stateful)throw new ti("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(const e of this.layers)if(e.stateful)return!0;return!1}resetStates(){(0,N.tidy)(()=>{this.layers.forEach(e=>{e.stateful&&e.resetStates()})})}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Oo(e,t,n){const i=t.length;if(null==e||Array.isArray(e)&&0===e.length)return t.map(e=>null);if(1===i)return Array.isArray(e)&&1===e.length?e:"object"==typeof e&&t[0]in e?[e[t[0]]]:[e];if(Array.isArray(e)){if(e.length!==i)throw new Error(`Provided ${n} is an array of ${e.length} element(s), but the model has ${i} outputs. Make sure a set of weights is provided for each model output.`);return e}if("object"==typeof e&&Object.keys(e).length>0&&"object"==typeof e[Object.keys(e)[0]]){const n=[];return t.forEach(t=>{t in e?n.push(e[t]):n.push(null)}),n}throw new Error(`The model has multiple (${i}) outputs, so ${n} must be either an array with ${i} elements or an object with ${t} keys. Provided ${n} not understood: ${JSON.stringify(e)}`)}function Mo(e,t){return Oo(e,t,"classWeight")}async function Ro(e,t,n,i){if(null!=t||null!=i)throw new Error("Support sampleWeight is not implemented yet");if(null!=n){const t=(0,N.tidy)(()=>{if(1===e.shape.length)return(0,N.clone)(e);if(2===e.shape.length){if(e.shape[1]>1){const t=1;return(0,N.argMax)(e,t)}if(1===e.shape[1])return(0,N.reshape)(e,[e.shape[0]]);throw new Error(`Encountered unexpected last-dimension size (${e.shape[1]}) during handling of class weights. The size is expected to be >= 1.`)}throw new Error(`Unexpected rank of target (y) tensor (${e.rank}) during handling of class weights. The rank is expected to be 1 or 2.`)}),i=Array.from(await t.data());(0,N.dispose)(t);const r=[];return i.forEach(e=>{if(null==n[e])throw new Error(`classWeight must contain all classes in the training data. The class ${e} exists in the data but not in classWeight`);r.push(n[e])}),(0,N.tensor1d)(r,"float32")}return null}function ko(e,t){return(0,N.mul)(e,t)}function No(e,t){let n,i;const r=t;n=r.xs,i=r.ys,N.util.assert(null!=n&&null!=i,()=>`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 ${t}`);const s=Do("input",e.inputNames,n),o=Do("output",e.outputNames,i),a=s[0].shape[0];N.util.assert(s.length===e.inputs.length,()=>`LayersModel has ${e.inputs.length} inputs, but the dataset provides ${s.length} inputs. (Expected input keys: ${JSON.stringify(e.inputNames)})`),N.util.assert(o.length===e.outputs.length,()=>`LayersModel has ${e.outputs.length} outputs, but the dataset provides ${o.length} outputs. (Expected output keys: ${JSON.stringify(e.outputNames)})`);for(let t=0;t<s.length;t++)N.util.assert(s[t].shape[0]===a,()=>`Batch size mismatch: input ${e.inputNames[t]} has ${s[t].shape[0]}; expected ${a} based on input ${e.inputNames[0]}.`);for(let t=0;t<o.length;t++)N.util.assert(o[t].shape[0]===a,()=>`Batch size mismatch: output ${e.outputNames[t]} has ${o[t].shape[0]}; expected ${a} based on input ${e.inputNames[0]}.`);return{xs:s,ys:o}}function Do(e,t,n){if(n instanceof N.Tensor)return[n];if(Array.isArray(n))return N.util.assert(n.length===t.length,()=>`Received an array of ${n.length} Tensors, but expected ${t.length} to match the ${e} keys ${t}.`),n;{const i=[];for(const r of t){if(null==n[r])throw new ti(`The feature data generated by the dataset lacks the required ${e} key '${r}'.`);i.push(n[r])}return i}}async function Fo(e,t,n){const i=null!=n.batchesPerEpoch;if(N.util.assert(null!=e.optimizer,()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."),N.util.assert(null!=n,()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),N.util.assert(null!=n.epochs&&n.epochs>0&&Number.isInteger(n.epochs),()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${n.epochs}`),N.util.assert(!i||n.batchesPerEpoch>0&&Number.isInteger(n.batchesPerEpoch),()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${n.batchesPerEpoch}`),N.util.assert(null==n.validationSplit,()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),e.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");e.isTraining=!0;try{const r=null!=n.validationData;let s,o;if(r)if(Lo(n.validationData))N.util.assert(null==n.validationBatches||n.validationBatches>0&&Number.isInteger(n.validationBatches),()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${n.validationBatches}`);else{const e=function(e){if(3===e.length)throw new ni("Validation with sample weights is not implemented yet.");return{xs:e[0],ys:e[1]}}(n.validationData);s=e.xs,o=e.ys}const a=e.makeTrainFunction(),l=e.getDedupedMetricsNames();let u;u=r?l.slice().concat(l.map(e=>"val_"+e)):l.slice();const c=Vs(n.callbacks,n.yieldEvery),d=null==n.verbose?1:n.verbose,{callbackList:h,history:p}=Ys(c,d,n.epochs,null,null,function(e,t){let n=null;null!=t.batchesPerEpoch?n=t.batchesPerEpoch:Number.isFinite(e.size)&&(n=e.size);return n}(t,n),null,r,u);h.setModel(e),e.history=p,await h.onTrainBegin(),e.stopTraining_=!1;let f=null==n.initialEpoch?0:n.initialEpoch,m=await t.iterator();for(;f<n.epochs;){const u={};await h.onEpochBegin(f);let c=0,d=0;for(i||(m=await t.iterator());!i||c<n.batchesPerEpoch;){const t=await m.next();if(i&&t.done){console.warn(`You provided \`batchesPerEpoch\` as ${n.batchesPerEpoch}, but your dataset iterator ran out of data after ${c} batches; interrupting training. Make sure that your dataset can generate at least \`batchesPerEpoch * epochs\` batches (in this case, `+n.batchesPerEpoch*n.epochs+" batches). You may need to use the repeat() function when building your dataset.");break}if(null!=t.value){const{xs:i,ys:r}=No(e,t.value),s={};s.batch=d,s.size=i[0].shape[0],await h.onBatchBegin(d,s);const o=[];if(null!=n.classWeight){const t=Mo(n.classWeight,e.outputNames);for(let e=0;e<t.length;++e)o.push(await Ro(r[e],null,t[e]))}const u=i.concat(r).concat(o),p=a(u);N.dispose(u);for(let e=0;e<l.length;++e){const t=l[e],n=p[e];s[t]=n,N.keep(n)}await h.onBatchEnd(d,s),Fs(s),d++,c++}if(i?c>=n.batchesPerEpoch:t.done){if(r){let t;t=Lo(n.validationData)?ui(await e.evaluateDataset(n.validationData,{batches:n.validationBatches})):ui(e.evaluate(s,o,{batchSize:null==n.validationBatchSize?32:n.validationBatchSize,verbose:0}));for(let n=0;n<e.metricsNames.length;++n)u[`val_${e.metricsNames[n]}`]=t[n]}break}if(e.stopTraining_)break}if(await h.onEpochEnd(f,u),f++,e.stopTraining_)break}return await h.onTrainEnd(),await e.history.syncData(),e.history}finally{e.isTraining=!1}}function Lo(e){return"function"==typeof e.iterator}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Po(e){N.util.assert(e>0&&Number.isInteger(e),()=>`batchSize is required to be a positive integer, but got ${e}`)}function Bo(e,t,n){return null==e?[null]:Array.isArray(e)?e.map(e=>Qi(e,t,n-t)):Qi(e,t,n-t)}function $o(e,t){return N.tidy(()=>null==e?null:Array.isArray(e)?e.map(e=>$o(e,t)):or(e,"int32"===t.dtype?t:N.cast(t,"int32")))}function Uo(e,t){const n=[];let i=0,r=null;for(;i<e;)r=i+t,r>=e&&(r=e),n.push([i,r]),i=r;return n}function zo(e){const t=[];e instanceof N.Tensor&&(e=[e]);for(let n=0;n<e.length;++n){const i=e[n];if(1===i.rank)t.push(Zi(i,1));else{if(0===i.rank)throw new Error("Expected tensor to be at least 1D, but received a 0D tensor (scalar).");t.push(i)}}return t}function Vo(e,t){if(null==e)return;const n=[];if(t instanceof N.Tensor)n.push(t.id);else if(Array.isArray(t))t.forEach(e=>n.push(e.id));else if(null!=t)for(const e in t){const i=t[e];n.push(i.id)}const i=[];if(e instanceof N.Tensor)-1===n.indexOf(e.id)&&i.push(e);else if(Array.isArray(e))e.forEach(e=>{-1===n.indexOf(e.id)&&i.push(e)});else if(null!=e)for(const t in e){const r=e[t];-1===n.indexOf(r.id)&&i.push(r)}i.forEach(e=>{e.isDisposed||e.dispose()})}function jo(e){return Array.isArray(e)}function Yo(e){return!
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function(e){return e instanceof N.Tensor}(e)&&!jo(e)}function Go(e,t,n,i=!0,r=""){if(null==t||0===t.length){if(null!=e){let t=!1;if(jo(e)&&e.length>0)t=!0;else if(Yo(e)){for(const n in e)if(e.hasOwnProperty(n)){t=!0;break}}else t=!0;if(t)throw new ti(`Error when checking model ${r} expected no data, but got ${e}`)}return[]}if(null==e)return t.map(e=>null);let s;if(Yo(e)){s=[];for(const n of t){if(null==e[n])throw new ti(`No data provided for "${n}". Need data for each key in: ${t}`);s.push(e[n])}}else if(jo(e)){if(e.length!==t.length)throw new ti(`Error when checking model ${r}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${t.length} Tensor(s), but instead got the following list of Tensor(s): ${e}`);s=e}else{if(t.length>1)throw new ti(`The model ${r} expects ${t.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${e.shape}`);s=[e]}if(s=zo(s),null!=n)for(let e=0;e<t.length;++e){if(null==n[e])continue;const o=s[e];if(o.shape.length!==n[e].length)throw new ti(`Error when checking ${r}: expected ${t[e]} to have ${n[e].length} dimension(s). but got array with shape ${o.shape}`);for(let t=0;t<n[e].length;++t){if(0===t&&!i)continue;const s=o.shape[t],a=n[e][t];if(null!=a&&a>=0&&s!==a)throw new ti(`${r} expected a batch of elements where each example has shape [${n[e].slice(1,n[e].length)}] (i.e.,tensor shape [*,${n[e].slice(1,n[e].length)}]) but the ${r} received an input with ${o.shape[0]} examples, each with shape [${o.shape.slice(1,o.shape.length)}] (tensor shape [${o.shape}])`)}}return s}function Ho(e,t,n,i=!0,r=""){let s;if(Array.isArray(e)){if(e.length!==t.length)throw new ti(`Error when checking model ${r}: the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see ${t.length} Tensor(s), but instead got ${e.length} Tensors(s).`);s=e}else{if(t.length>1)throw new ti(`The model expects ${t.length} ${r} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(e.shape)}.`);s=[e]}if(null!=n)for(let e=0;e<t.length;++e){if(null==n[e])continue;const o=s[e];if(o.shape.length!==n[e].length)throw new ti(`Error when checking ${r}: expected ${t[e]} to have ${n[e].length} dimension(s), but got array with shape ${JSON.stringify(o.shape)}`);for(let s=0;s<n[e].length;++s){if(0===s&&!i)continue;const a=o.shape[s],l=n[e][s];if(null!=l&&l!==a)throw new ti(`Error when checking ${r}: expected ${t[e]} to have shape ${JSON.stringify(n[e])} but got array with shape ${JSON.stringify(o.shape)}.`)}}}class Wo extends Co{constructor(e){super(e),this.isTraining=!1}summary(e,t,n=console.log){if(!this.built)throw new ti("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).");bo(this,e,t,n)}compile(e){if(null==e.loss&&(e.loss=[]),this.loss=e.loss,"string"==typeof e.optimizer)this.optimizer_=
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function(e){const t={Adagrad:()=>N.train.adagrad(.01),Adadelta:()=>N.train.adadelta(1,.95,qi()),Adam:()=>N.train.adam(.001,.9,.999,qi()),Adamax:()=>N.train.adamax(.002,.9,.999,qi(),0),RMSProp:()=>N.train.rmsprop(.001,.9,0,qi()),SGD:()=>N.train.sgd(.01)};if(t.adagrad=t.Adagrad,t.adadelta=t.Adadelta,t.adam=t.Adam,t.adamax=t.Adamax,t.rmsprop=t.RMSProp,t.sgd=t.SGD,e in t)return t[e]();throw new ti(`Unknown Optimizer ${e}`)}(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof N.Optimizer))throw new ti("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}let t=[];if(Array.isArray(e.loss)||"string"==typeof e.loss||"function"==typeof e.loss)if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new ti(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${e.loss}.`);const n=e.loss;t=n.map(e=>io(e))}else{const n=io(e.loss);this.outputs.forEach(e=>{t.push(n)})}else{e.loss=e.loss;for(const t in e.loss)if(-1===this.outputNames.indexOf(t))throw new ti(`Unknown entry in loss dictionary: "${t}". Only expected the following keys: ${this.outputNames}`);for(const n of this.outputNames)null==e.loss[n]&&console.warn(`Output "${n}" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to ${n} during training`),t.push(io(e.loss[n]))}this.lossFunctions=t,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let e=0;e<this.outputs.length;++e){const t=this.internalOutputShapes[e],n=this.outputNames[e];this.feedOutputNames.push(n),this.feedOutputShapes.push(t),this.feedLossFns.push(this.lossFunctions[e])}const n=[];this.metrics=e.metrics,this.metricsNames=["loss"],this.metricsTensors=[],Bi("loss",()=>{for(let e=0;e<this.outputs.length;++e){if(-1!==n.indexOf(e))continue;const t=this.lossFunctions[e];this.outputs.length>1&&(this.metricsTensors.push([t,e]),this.metricsNames.push(this.outputNames[e]+"_loss"))}});const i=function(e,t){if(null==e||Array.isArray(e)&&0===e.length)return t.map(e=>[]);let n;if("string"==typeof e||"function"==typeof e)n=[e];else{if(!Array.isArray(e)&&"object"!=typeof e)throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${e}`);n=e}if(Array.isArray(n))return t.map(e=>n);{const e=[];for(const i of t){let t=n.hasOwnProperty(i)?n[i]:[];Array.isArray(t)||(t=[t]),e.push(t)}return e}}(e.metrics,this.outputNames),r=(e,t,n)=>{this.outputNames.length>1&&(t=this.outputNames[e]+"_"+t),this.metricsNames.push(t),this.metricsTensors.push([n,e])};Bi("metric",()=>{for(let e=0;e<this.outputs.length;++e){if(-1!==n.indexOf(e))continue;(t=>{let n,i,s;for(const o of t){if("string"==typeof o&&-1!==["accuracy","acc","crossentropy","ce"].indexOf(o)){const t=this.internalOutputShapes[e];let r;1===t[t.length-1]||this.lossFunctions[e]===Js?-1!==["accuracy","acc"].indexOf(o)?i=ro:-1!==["crossentropy","ce"].indexOf(o)&&(i=uo):this.lossFunctions[e]===Qs?-1!==["accuracy","acc"].indexOf(o)?i=co:-1!==["crossentropy","ce"].indexOf(o)&&(i=po):-1!==["accuracy","acc"].indexOf(o)?i=so:-1!==["crossentropy","ce"].indexOf(o)&&(i=ho),-1!==["accuracy","acc"].indexOf(o)?r="acc":-1!==["crossentropy","ce"].indexOf(o)&&(r="ce"),s=i,n=""+r}else{const e=mo(o);s=e,n=""+go(o)}let t;Bi(n,()=>{t=s}),r(e,n,t)}})(i[e])}}),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){null!=this.collectedTrainableWeights&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(e,t,n={}){const i=null==n.batchSize?32:n.batchSize;Po(i);const r=this.standardizeUserDataXY(e,t,!0,i);try{const e=r[0].concat(r[1]);this.makeTestFunction();const t=this.testFunction;return li(this.testLoop(t,e,i,n.verbose,n.steps))}finally{Vo(r[0],e),Vo(r[1],t)}}async evaluateDataset(e,t){return this.makeTestFunction(),async function(e,t,n){const i=null!=(n=n||{}).batches,r=e.testFunction;let s=[];if(n.verbose>0)throw new ni("Verbose mode is not implemented yet.");N.util.assert(!i||n.batches>0&&Number.isInteger(n.batches),()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(n.batches)}`);const o="function"==typeof t.next?t:await t.iterator();let a=0,l=0;for(;!i||l<n.batches;){const t=await o.next();if(s=N.tidy(()=>{if(t.value){const{xs:n,ys:i}=No(e,t.value),o=n.concat(i),u=N.tidy(()=>r(o));if(N.dispose(o),0===l)for(let e=0;e<u.length;++e)s.push((0,N.scalar)(0));const c=o[0].shape[0];for(let e=0;e<u.length;++e){const t=u[e],n=s[e];s[e]=N.tidy(()=>N.add(s[e],N.mul(c,t))),l>0&&N.dispose(n)}N.dispose(u),a+=c,++l}return s}),t.done){i&&console.warn(`Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least \`batches\` batches (in this case, ${n.batches} batches). You may need to use the repeat() function when building your dataset.`);break}}for(let e=0;e<s.length;++e){const t=s[e];s[e]=N.div(s[e],a),N.dispose(t)}return li(s)}(this,e,t)}checkNumSamples(e,t,n,i="steps"){let r;if(null!=n){if(r=null,null!=t)throw new ti(`If ${i} is set, batchSize must be null or undefined.Got batchSize = ${t}`)}else{if(null==e)throw new ti(`Either the input data should have a defined shape, or ${i} shoud be specified.`);r=Array.isArray(e)?e[0].shape[0]:e.shape[0]}return r}execute(e,t){if(Array.isArray(t)&&0===t.length)throw new ti("`outputs` is an empty Array, which is not allowed.");const n=Array.isArray(t),i=n?t:[t],r=this.retrieveSymbolicTensors(i),s=new Qr;if(e instanceof N.Tensor&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new ti(`The number of inputs provided (${e.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let t=0;t<this.inputs.length;++t)s.add(this.inputs[t],e[t])}else for(const t of this.inputs){const n=e[t.name];if(null==n)throw new ti(`No value is provided for the model's input ${t.name}`);s.add(t,n)}const o=ts(r,s);return n?o:o[0]}retrieveSymbolicTensors(e){const t=si(null,e.length);let n=e.length;for(const i of this.layers){const r=Array.isArray(i.output)?i.output:[i.output],s=r.map(e=>e.name);for(let i=0;i<e.length;++i){const o=s.indexOf(e[i]);if(-1!==o&&(t[i]=r[o],n--),0===n)break}if(0===n)break}if(n>0){const n=[];throw t.forEach((t,i)=>{null==t&&n.push(e[i])}),new ti(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(n)}`)}return t}predictLoop(e,t=32,n=!1){return N.tidy(()=>{const i=this.checkNumSamples(e);if(n)throw new ni("Verbose predictLoop() is not implemented yet.");const r=Uo(i,t),s=this.outputs.map(e=>[]);for(let t=0;t<r.length;++t){N.tidy(()=>{const n=r[t][0],i=r[t][1],s=Bo(e,n,i),o=[];if(Array.isArray(s))for(let e=0;e<s.length;++e)o.push({key:this.inputs[e],value:s[e]});else o.push({key:this.inputs[0],value:s});const a=new Qr(o);return ts(this.outputs,a)}).forEach((e,t)=>s[t].push(e))}return li(s.map(e=>N.concat(e,0)))})}predict(e,t={}){const n=zo(e);Ho(n,this.inputNames,this.feedInputShapes,!1);try{const e=null==t.batchSize?32:t.batchSize;return Po(e),this.predictLoop(n,e)}finally{Vo(n,e)}}predictOnBatch(e){Ho(e,this.inputNames,this.feedInputShapes,!0);const t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}standardizeUserDataXY(e,t,n=!0,i){if(null==this.optimizer_)throw new ei("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");const r=[];for(let e=0;e<this.feedOutputShapes.length;++e){const t=this.feedOutputShapes[e];this.feedLossFns[e]===Qs?r.push(t.slice(0,t.length-1).concat([1])):r.push(t)}if(function(e,t){const n=yi(e.map(e=>e.shape[0]));n.sort();const i=yi(t.map(e=>e.shape[0]));if(i.sort(),n.length>1)throw new ti(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(e.map(e=>e.shape))}`);if(i.length>1)throw new ti(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(t.map(e=>e.shape))}`);if(n.length>0&&i.length>0&&!N.util.arraysEqual(n,i))throw new ti(`Input Tensors should have the same number of samples as target Tensors. Found ${n[0]} input sample(s) and ${i[0]} target sample(s).`)}(e=Go(e,this.feedInputNames,this.feedInputShapes,!1,"input"),t=Go(t,this.feedOutputNames,r,!1,"target")),function(e,t,n){const i=[Ws,Js,Zs];for(let r=0;r<e.length;++r){const s=e[r],o=t[r],a=n[r];if(null!=o){if(o===Zs&&1===s.shape[s.shape.length-1])throw new ti(`You are passing a target array of shape ${s.shape} while using a loss 'categorical_crossentropy'. 'categorical_crossentropy'expects targets to be binary matrices (1s and 0s) of shape [samples, classes].`);if(-1!==i.indexOf(o)){const e=s.shape.slice(1),t=a.slice(1);for(let n=0;n<e.length;++n){const i=e[n],r=t[n];if(null!=r&&i!==r)throw new ti(`A target Tensor with shape ${s.shape} was passed for an output of shape ${a}, while using a loss function that expects targets to have the same shape as the output.`)}}}}}(t,this.feedLossFns,this.feedOutputShapes),this.stateful&&null!=i&&i>0&&e[0].shape[0]%i!==0)throw new ti(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${i}. Found: ${e[0].shape[0]} sample(s).`);return[e,t]}async standardizeUserData(e,t,n,i,r=!0,s){const[o,a]=this.standardizeUserDataXY(e,t,r,s);if(null!=n)throw new Error("sample weight is not supported yet.");let l=null;if(null!=i){const e=Mo(i,this.outputNames);l=[];for(let t=0;t<e.length;++t)l.push(await Ro(a[t],null,e[t]))}return[o,a,l]}testLoop(e,t,n,i=0,r){return N.tidy(()=>{const s=this.checkNumSamples(t,n,r,"steps"),o=[];if(i>0)throw new ni("Verbose mode is not implemented yet.");if(null!=r)throw new ni("steps mode in testLoop() is not implemented yet");{const i=Uo(s,n),r=(0,N.tensor1d)(Wi(0,s));for(let n=0;n<i.length;++n){const s=i[n][0],a=i[n][1],l=Qi(r,s,a-s),u=$o(t,l),c=e(u);if(0===n)for(let e=0;e<c.length;++e)o.push((0,N.scalar)(0));for(let e=0;e<c.length;++e){const t=c[e];o[e]=N.add(o[e],N.mul(a-s,t))}}for(let e=0;e<o.length;++e)o[e]=N.div(o[e],s)}return o})}getDedupedMetricsNames(){const e=this.metricsNames,t=[];for(let n=0;n<e.length;++n){const i=e[n];let r=i;if(ai(e,i)>1){r+=`_${ai(e.slice(0,n),i)}`}t.push(r)}return t}makeTrainFunction(){return e=>{const t=[],n=e.slice(0,this.inputs.length),i=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),r=e.slice(this.inputs.length+this.outputs.length,this.inputs.length+2*this.outputs.length),s=[],o=this.collectedTrainableWeights.map(e=>e.read());return[this.optimizer_.minimize(()=>{const e=[];for(let t=0;t<this.inputs.length;++t)e.push({key:this.inputs[t],value:n[t]});const o=new Qr(e),a=ts(this.outputs,o,{training:!0});let l;for(let e=0;e<this.lossFunctions.length;++e){let n=(0,this.lossFunctions[e])(i[e],a[e]);null!=r[e]&&(n=ko(n,r[e]));const s=N.mean(n);t.push(s),l=0===e?n:N.add(l,n)}for(let e=0;e<this.metricsTensors.length;++e){let n;if(this.outputs.length>1&&e<this.outputs.length)n=t[e];else{const t=this.metricsTensors[e][0],r=this.metricsTensors[e][1];n=N.mean(t(i[r],a[r]))}N.keep(n),s.push(n)}return l=N.mean(l),this.calculateLosses().forEach(e=>{l=N.add(l,e)}),l},!0,o)].concat(s)}}makeTestFunction(){this.testFunction=e=>N.tidy(()=>{const t=[];let n;const i=e.slice(0,this.inputs.length),r=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),s=[];for(let e=0;e<this.inputs.length;++e)s.push({key:this.inputs[e],value:i[e]});const o=new Qr(s),a=ts(this.outputs,o);for(let e=0;e<this.lossFunctions.length;++e){const i=this.lossFunctions[e],s=N.mean(i(r[e],a[e]));n=0===e?s:N.add(n,s),t.push(n)}for(let e=0;e<this.metricsTensors.length;++e){const n=this.metricsTensors[e][0],i=this.metricsTensors[e][1],s=N.mean(n(r[i],a[i]));t.push(s)}return t})}async fit(e,t,n={}){if(this.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");let i,r,s,o,a,l,u,c,d;this.isTraining=!0;try{const h=null==n.batchSize?32:n.batchSize;Po(h);const p=!1,f=await this.standardizeUserData(e,t,n.sampleWeight,n.classWeight,p,h);i=f[0],r=f[1],d=f[2];let m,g=!1;if(null!=n.validationData&&n.validationData.length>0){if(g=!0,2!==n.validationData.length)throw 3===n.validationData.length?new ni("validationData including sample weights is not supported yet."):new ti(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; ${n.validationData} is invalid.`);a=n.validationData[0],l=n.validationData[1];const e=!0,t=await this.standardizeUserData(a,l,null,null,e,h);u=t[0],c=t[1],m=u.concat(c)}else if(null!=n.validationSplit&&n.validationSplit>0&&n.validationSplit<1){g=!0;const e=Math.floor(i[0].shape[0]*(1-n.validationSplit)),t=i[0].shape[0];u=Bo(i,e,t),s=i,i=Bo(i,0,e),c=Bo(r,e,t),o=r,r=Bo(r,0,e),m=u.concat(c)}else null!=n.validationSteps&&(g=!0);const y=i.concat(r).concat(d);this.checkTrainableWeightsConsistency();const _=this.makeTrainFunction(),v=this.getDedupedMetricsNames();let b,T;g?(this.makeTestFunction(),b=this.testFunction,T=v.slice().concat(v.map(e=>"val_"+e))):(b=null,m=[],T=v.slice());const x=Vs(n.callbacks,n.yieldEvery);return await this.fitLoop(_,y,v,h,n.epochs,n.verbose,x,b,m,n.shuffle,T,n.initialEpoch,null,null)}finally{this.isTraining=!1,Vo(i,e),Vo(r,t),Vo(s,e),Vo(o,t),Vo(u,a),Vo(c,l),null!=d&&N.dispose(d)}}async fitLoop(e,t,n,i,r,s,o,a,l,u,c,d,h,p){null==i&&(i=32),null==r&&(r=1),null==u&&(u=!0),null==d&&(d=0);let f=!1;if(null!=a&&null!=l&&(f=!0),null!=p&&(f=!0,null==h))throw new ti("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");const m=this.checkNumSamples(t,i,h,"steps_per_epoch");let g;null!=m&&(g=Wi(0,m)),null==s&&(s=1);const{callbackList:y,history:_}=Ys(o,s,r,d,m,h,i,f,c);y.setModel(this),this.history=_,await y.onTrainBegin(),this.stopTraining_=!1;for(let s=d;s<r;++s){await y.onEpochBegin(s);const r={};if(null!=h)throw new ni("stepsPerEpoch mode is not implemented yet.");{if("batch"===u)throw new ni("batch shuffling is not implemneted yet");u&&N.util.shuffle(g);const s=(0,N.tensor1d)(g),o=Uo(m,i);for(let u=0;u<o.length;++u){const c={};if(await y.onBatchBegin(u,c),N.tidy(()=>{const d=o[u][0],h=o[u][1],p=Qi(s,d,h-d);c.batch=u,c.size=h-d;const m=$o(t,p),g=e(m);for(let e=0;e<n.length;++e){const t=n[e],i=g[e];c[t]=i,N.keep(i)}if(u===o.length-1&&f){const e=this.testLoop(a,l,i);for(let t=0;t<n.length;++t){const i=n[t],s=e[t];N.keep(s),r["val_"+i]=s}}}),await y.onBatchEnd(u,c),Fs(c),this.stopTraining_)break}s.dispose()}if(await y.onEpochEnd(s,r),this.stopTraining_)break}return await y.onTrainEnd(),await this.history.syncData(),this.history}async fitDataset(e,t){return Fo(this,e,t)}async trainOnBatch(e,t){const n=await this.standardizeUserData(e,t),i=n[0],r=n[1],s=this.makeTrainFunction()(i.concat(r)),o=[];for(const e of s){const t=await e.data();o.push(t[0])}return N.dispose(s),Vo(n[0],e),Vo(n[1],t),li(o)}getNamedWeights(e){const t=[],n=null!=e&&e.trainableOnly,i=n?this.trainableWeights:this.weights,r=this.getWeights(n);for(let e=0;e<i.length;++e)n&&!i[e].trainable||t.push({name:i[e].originalName,tensor:r[e]});return t}set stopTraining(e){this.stopTraining_=e}get stopTraining(){return this.stopTraining_}get optimizer(){return this.optimizer_}set optimizer(e){this.optimizer_!==e&&(this.optimizer_=e,this.isOptimizerOwned=!1)}dispose(){const e=super.dispose();if(0===e.refCountAfterDispose&&null!=this.optimizer&&this.isOptimizerOwned){const t=N.memory().numTensors;this.optimizer_.dispose(),e.numDisposedVariables+=t-N.memory().numTensors}return e}getLossIdentifiers(){let e;if("string"==typeof this.loss)e=ci(this.loss);else if(Array.isArray(this.loss)){for(const e of this.loss)if("string"!=typeof e)throw new Error("Serialization of non-string loss is not supported.");e=this.loss.map(e=>ci(e))}else{const t=Object.keys(this.loss);e={};const n=this.loss;for(const i of t){if("string"!=typeof n[i])throw new Error("Serialization of non-string loss is not supported.");e[i]=ci(n[i])}}return e}getMetricIdentifiers(){if("string"==typeof this.metrics||"function"==typeof this.metrics)return[ci(go(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(e=>ci(go(e)));{const e={};for(const t in this.metrics)e[t]=ci(go(this.metrics[t]));return e}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(e){if(null!=e.weighted_metrics)throw new Error("Loading weight_metrics is not supported yet.");if(null!=e.loss_weights)throw new Error("Loading loss_weights is not supported yet.");if(null!=e.sample_weight_mode)throw new Error("Loading sample_weight_mode is not supported yet.");const t=Gs(Io(e.optimizer_config));let n,i;if("string"==typeof e.loss)n=di(e.loss);else if(Array.isArray(e.loss))n=e.loss.map(e=>di(e));else if(null!=e.loss){n={};for(const t in e.loss)n[t]=di(e.loss[t])}if(Array.isArray(e.metrics))i=e.metrics.map(e=>di(e));else if(null!=e.metrics){i={};for(const t in e.metrics)i[t]=di(e.metrics[t])}this.compile({loss:n,metrics:i,optimizer:t})}async save(e,t){if("string"==typeof e){const t=N.io.getSaveHandlers(e);if(0===t.length)throw new ti(`Cannot find any save handlers for URL '${e}'`);if(t.length>1)throw new ti(`Found more than one (${t.length}) save handlers for URL '${e}'`);e=t[0]}if(null==e.save)throw new ti("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");const n=await N.io.encodeWeights(this.getNamedWeights(t)),i={modelTopology:this.toJSON(null,!1),format:"layers-model",generatedBy:`TensorFlow.js tfjs-layers v${So}`,convertedBy:null};if(null!=t&&t.includeOptimizer&&null!=this.optimizer){i.trainingConfig=this.getTrainingConfig();const e="optimizer",{data:t,specs:r}=await N.io.encodeWeights(await this.optimizer.getWeights(),e);n.specs.push(...r),n.data=N.io.concatenateArrayBuffers([n.data,t])}if(null!=this.userDefinedMetadata){const e=!0;_o(this.userDefinedMetadata,this.name,e),i.userDefinedMetadata=this.userDefinedMetadata}return i.weightData=n.data,i.weightSpecs=n.specs,e.save(i)}setUserDefinedMetadata(e){_o(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}}Wo.className="Model",N.serialization.registerClass(Wo);class Xo extends Wo{}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
async function qo(e,t){"modelTopology"in e||(e={modelTopology:e});let n=e.modelTopology;null!=n.model_config&&(n=n.model_config);const i=Gs(Io(n),t);if(null!=e.weightsManifest){const t=await N.io.loadWeights(e.weightsManifest,e.pathPrefix,i.weights.map(e=>e.originalName)),n={};for(const e of i.weights)n[e.originalName]=t[e.originalName];i.loadWeights(n),(0,N.dispose)(t)}return i}async function Ko(e,t){if(null==t&&(t={}),"string"==typeof e){const n=N.io.getLoadHandlers(e,t);if(0===n.length)n.push(N.io.browserHTTPRequest(e,t));else if(n.length>1)throw new ti(`Found more than one (${n.length}) load handlers for URL '${e}'`);e=n[0]}return async function(e,t,n){null==n&&(n={});if(null==e.load)throw new ti("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const i=await e.load();let r=i.modelTopology;null!=r.model_config&&(r=r.model_config);const s=null==n.strict||n.strict,o=null!=i.weightData&&null!=i.weightSpecs&&s,a=Gs(Io(r),t,o),l=i.trainingConfig;null!=l&&a.loadTrainingConfig(l);null!=i.userDefinedMetadata&&a.setUserDefinedMetadata(i.userDefinedMetadata);if(null!=i.weightData){if(null==i.weightSpecs)throw new ti("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");const{modelWeights:e,optimizerWeights:t}=function(e,t){const n=N.io.decodeWeights(e,t),i={},r=[];return t.forEach(e=>{"optimizer"===e.group?r.push({name:e.name,tensor:n[e.name]}):i[e.name]=n[e.name]}),{modelWeights:i,optimizerWeights:r}}(i.weightData,i.weightSpecs);a.loadWeights(e,s),null!=a.optimizer&&t.length>0&&await a.optimizer.setWeights(t),(0,N.dispose)(e),(0,N.dispose)(t.map(e=>e.tensor))}return a}(e,void 0,t)}Xo.className="Functional",N.serialization.registerClass(Xo);class Zo extends Wo{constructor(e){if(super({inputs:[],outputs:[]}),e=e||{},this.trainable=!0,this.built=!1,this.name=null!=e.name?e.name:Si("sequential_"),null!=e.layers)for(const t of e.layers)this.add(t)}checkShape(e){if(e.inboundNodes[0].outputTensors[0].shape.some(e=>e<0))throw new ti(`Negative dimension size caused by adding layer ${e.name} with input shape [${e.inboundNodes[0].inputTensors[0].shape}]`)}add(e){const t=e instanceof Zo||e instanceof Wo;let n;if(t){if(n=e,1!==n.outputs.length)throw new ti("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(1!==n.inputs.length)throw new ti("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(0===this.outputs.length){if(0===e.inboundNodes.length){if(null==e.batchInputShape)throw new ti("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");const t=Zr({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(t)}if(t)this.outputs=n.outputs,this.inputs=n.inputs;else{if(1!==e.inboundNodes.length)throw new ti(`A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer ${e.name} which has ${e.inboundNodes.length} pre-existing inbound connections.`);if(1!==e.inboundNodes[0].outputTensors.length)throw new ti("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=qr(this.outputs[0])}this.inboundNodes=[],new Hr({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:si(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(e=>e.shape),outputShapes:this.outputs[0].shape})}else{const t=e.apply(this.outputs[0]);if(Array.isArray(t))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[t],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1}pop(){if(0===this.layers.length)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),0===this.layers.length)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{const e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}}call(e,t){return null==this.model&&this.build(),this.model.call(e,t)}build(e){if(Pr(e),0===this.inputs.length||0===this.outputs.length)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new Wo({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,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}countParams(){return this.built||this.build(),super.countParams()}summary(e,t,n=console.log){this.built||this.build(),super.summary(e,t,n)}setWeights(e){null==this.model&&this.build(),this.model.setWeights(e)}evaluate(e,t,n={}){if(!this.built)throw new ei("The model needs to be compiled before being used.");return this.model.evaluate(e,t,n)}async evaluateDataset(e,t){if(!this.built)throw new ei("The model needs to be compiled before being used.");return this.model.evaluateDataset(e,t)}predict(e,t={}){return null==this.model&&this.build(),this.model.predict(e,t)}predictOnBatch(e){return null==this.model&&this.build(),this.model.predictOnBatch(e)}compile(e){this.build(),this.model.compile(e),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}get optimizer(){return null==this.model?void 0:this.model.optimizer}set optimizer(e){this.model.optimizer=e}async fit(e,t,n={}){if(!this.built)throw new ei("The model needs to be compiled before being used.");return this.model.fit(e,t,n)}async fitDataset(e,t){if(!this.built)throw new ei("The model needs to be compiled before being used.");return this.model.fitDataset(e,t)}async trainOnBatch(e,t){return this.model.trainOnBatch(e,t)}static fromConfig(e,t,n={},i=!1){let r,s={};if(t instanceof Array){if(null==t[0].className||"Merge"===t[0].className)throw new ti("Legacy serialization format not supported yet.");r=t}else N.util.assert(null!=t.layers,()=>"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."),r=t.layers,delete t.layers,s=t;const o=new e(s);if(!(o instanceof Zo))throw new ni(`Sequential.fromConfig called on non-Sequential input: ${o}`);for(const e of r){const t=Gs(e,void 0,i);i&&t.setFastWeightInitDuringBuild(!0),o.add(t)}return o}set stopTraining(e){if(null==this.model)throw new ti("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=e}get stopTraining(){if(null==this.model)throw new ti("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining}getConfig(){const e=[];for(const t of this.layers){const n={};n.className=t.getClassName(),n.config=t.getConfig(),e.push(n)}return{name:this.name,layers:e}}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Qo(e){return new Wo(e)}function Jo(e){return new Zo(e)}function ea(e){return Zr(e)}function ta(e,t){js.registerCallbackConstructor(e,t)}Zo.className="Sequential",N.serialization.registerClass(Zo);
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class na extends N.serialization.Serializable{getConfig(){return{}}}class ia extends na{apply(e,t=1){return function(e,t=1){if(1!==t)throw new ni(`Support for alpha values other than 1 (${t}) is not implemented yet.`);return N.elu(e)}(e,t)}}ia.className="elu",N.serialization.registerClass(ia);class ra extends na{apply(e){return N.selu(e)}}ra.className="selu",N.serialization.registerClass(ra);class sa extends na{apply(e){return N.relu(e)}}sa.className="relu",N.serialization.registerClass(sa);class oa extends na{apply(e){return(0,N.tidy)(()=>N.minimum(6,N.relu(e)))}}oa.className="relu6",N.serialization.registerClass(oa);class aa extends na{apply(e){return e}}aa.className="linear",N.serialization.registerClass(aa);class la extends na{apply(e){return N.sigmoid(e)}}la.className="sigmoid",N.serialization.registerClass(la);class ua extends na{apply(e){return function(e){return(0,N.tidy)(()=>{const t=N.add(.5,N.mul(.2,e));return N.clipByValue(t,0,1)})}(e)}}ua.className="hardSigmoid",N.serialization.registerClass(ua);class ca extends na{apply(e){return N.softplus(e)}}ca.className="softplus",N.serialization.registerClass(ca);class da extends na{apply(e){return function(e){return(0,N.tidy)(()=>N.div(e,N.add(N.abs(e),1)))}(e)}}da.className="softsign",N.serialization.registerClass(da);class ha extends na{apply(e){return N.tanh(e)}}ha.className="tanh",N.serialization.registerClass(ha);class pa extends na{apply(e,t=-1){return N.softmax(e,t)}}pa.className="softmax",N.serialization.registerClass(pa);class fa extends na{apply(e,t=-1){return N.logSoftmax(e,t)}}fa.className="logSoftmax",N.serialization.registerClass(fa);class ma extends na{apply(e){return(0,N.tidy)(()=>N.tidy(()=>{const t=Math.sqrt(2),n=N.mul(.5,N.add(1,N.erf(N.div(e,t))));return N.mul(e,n)}))}}ma.className="gelu",N.serialization.registerClass(ma);class ga extends na{apply(e){return(0,N.tidy)(()=>N.mul(.5,N.mul(e,N.add(1,N.tanh(N.mul(N.sqrt(N.div(2,Math.PI)),N.add(e,N.mul(.044715,N.pow(e,3)))))))))}}ga.className="gelu_new",N.serialization.registerClass(ga);class ya extends na{apply(e){return(0,N.tidy)(()=>N.mul(e,N.tanh(N.softplus(e))))}}ya.className="mish",N.serialization.registerClass(ya);class _a extends na{apply(e,t=1){return(0,N.tidy)(()=>N.mul(N.sigmoid(N.mul(e,t)),e))}}function va(e){return e.getClassName()}function ba(e,t={}){return mi(e,N.serialization.SerializationMap.getMap().classNameMap,t,"activation")}function Ta(e){if(null==e){const e={className:"linear",config:{}};return ba(e)}if("string"==typeof e){const t={};return t.className=e,t.config={},ba(t)}return e instanceof na?e:ba(e)}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function xa(e){if(null!=e&&"object"!=typeof e)throw new Error(`Argument to L1L2 regularizer's constructor is expected to be an object, but received: ${e}`)}_a.className="swish",N.serialization.registerClass(_a);class Ea extends N.serialization.Serializable{}class wa extends Ea{constructor(e){super(),xa(e),this.l1=null==e||null==e.l1?.01:e.l1,this.l2=null==e||null==e.l2?.01:e.l2,this.hasL1=0!==this.l1,this.hasL2=0!==this.l2}apply(e){return(0,N.tidy)(()=>{let t=(0,N.zeros)([1]);return this.hasL1&&(t=(0,N.add)(t,(0,N.sum)(N.mul(this.l1,(0,N.abs)(e))))),this.hasL2&&(t=(0,N.add)(t,(0,N.sum)(N.mul(this.l2,ar(e))))),N.reshape(t,[])})}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}}wa.className="L1L2",N.serialization.registerClass(wa);const Ia={l1l2:"L1L2"};function Aa(e){return pi(e)}function Sa(e,t={}){return mi(e,N.serialization.SerializationMap.getMap().classNameMap,t,"regularizer")}function Ca(e){if(null==e)return null;if("string"==typeof e){return Sa({className:e in Ia?Ia[e]:e,config:{}})}return e instanceof Ea?e:Sa(e)}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class Oa extends Xr{constructor(e){super(null==e?{}:e),this.supportsMasking=!0,null!=e&&(this.maxValue=e.maxValue)}call(e,t){e=Lr(e);let n=(0,N.relu)(e);return null!=this.maxValue&&(n=(0,N.clipByValue)(n,0,this.maxValue)),n}computeOutputShape(e){return e}getConfig(){const e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}}Oa.className="ReLU",N.serialization.registerClass(Oa);class Ma extends Xr{constructor(e){super(null==e?{}:e),this.DEFAULT_ALPHA=.3,null==e&&(e={}),this.alpha=null==e.alpha?this.DEFAULT_ALPHA:e.alpha}call(e,t){const n=Lr(e);return(0,N.leakyRelu)(n,this.alpha)}computeOutputShape(e){return e}getConfig(){const e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}}Ma.className="LeakyReLU",N.serialization.registerClass(Ma);class Ra extends Xr{constructor(e){if(super(null==e?{}:e),this.DEFAULT_ALPHA_INITIALIZER="zeros",null==e&&(e={}),this.supportsMasking=!0,this.alphaInitializer=Nr(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=Ca(e.alphaRegularizer),this.alphaConstraint=fs(e.alphaConstraint),null==e.sharedAxes)this.sharedAxes=null;else if(Array.isArray(e.sharedAxes))this.sharedAxes=e.sharedAxes;else{if("number"!=typeof e.sharedAxes)throw new ti(`Expected sharedAxes to be a number or an array of numbers, but got ${e.sharedAxes}`);this.sharedAxes=[e.sharedAxes]}}build(e){const t=(e=Pr(e)).slice(1);if(null!=this.sharedAxes)for(const e of this.sharedAxes)t[e-1]=1;this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);const n={};if(null!=this.sharedAxes)for(let t=1;t<e.length;++t)n[t]=e[t];this.inputSpec=[new jr({ndim:e.length,axes:n})],this.built=!0}call(e,t){return e=Lr(e),(0,N.prelu)(e,this.alpha.read())}getConfig(){const e={alphaInitializer:kr(this.alphaInitializer),alphaRegularizer:Aa(this.alphaRegularizer),alphaConstraint:hs(this.alphaConstraint),sharedAxes:this.sharedAxes},t=super.getConfig();return Object.assign(e,t),e}}Ra.className="PReLU",N.serialization.registerClass(Ra);class ka extends Xr{constructor(e){if(super(null==e?{}:e),this.DEFAULT_ALPHA=1,null==e&&(e={}),null!=e.alpha&&e.alpha!==this.DEFAULT_ALPHA)throw new ni(`Non-default alpha value (${e.alpha}) is not supported by the ELU layer yet.`);this.alpha=null==e.alpha?this.DEFAULT_ALPHA:e.alpha}call(e,t){const n=Lr(e);return(0,N.elu)(n)}computeOutputShape(e){return e}getConfig(){const e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}}ka.className="ELU",N.serialization.registerClass(ka);class Na extends Xr{constructor(e){super(null==e?{}:e),this.DEFAULT_THETA=1,null==e&&(e={}),this.theta=null==e.theta?this.DEFAULT_THETA:e.theta}call(e,t){const n=Lr(e);return(0,N.mul)(n,(0,N.cast)((0,N.greater)(n,this.theta),"float32"))}computeOutputShape(e){return e}getConfig(){const e={theta:this.theta},t=super.getConfig();return Object.assign(e,t),e}}Na.className="ThresholdedReLU",N.serialization.registerClass(Na);class Da extends Xr{constructor(e){super(null==e?{}:e),this.DEFAULT_AXIS=1,null==e&&(e={}),this.softmax=(new pa).apply,this.axis=null==e.axis?this.DEFAULT_AXIS:e.axis}call(e,t){return(0,N.tidy)(()=>{let n=Lr(e);const i=t.mask;if(null!=i){const e=(0,N.mul)((0,N.sub)((0,N.ones)(n.shape),(0,N.cast)(i,n.dtype)),(0,N.scalar)(-1e9));n=(0,N.add)(n,e)}return this.axis instanceof Array?this.axis.length>1?(0,N.exp)((0,N.sub)(n,(0,N.logSumExp)(n,this.axis,!0))):this.softmax(n,this.axis[0]):this.softmax(n,this.axis)})}computeOutputShape(e){return e}getConfig(){const e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Fa(e,t,n){if("number"==typeof e)return si(e,t);if(e.length!==t)throw new ti(`The ${n} argument must be an integer or tuple of ${t} integers. Received: ${e.length} elements.`);for(let i=0;i<t;++i){const r=e[i];if(!ji(r))throw new ti(`The ${n} argument must be an integer or tuple of ${t} integers. Received: ${JSON.stringify(e)} including a non-integer number ${r}`)}return e}function La(e,t,n,i,r=1){if(null==e)return e;let s;return s="same"===n?e:e-(t+(t-1)*(r-1))+1,Math.floor((s+i-1)/i)}function Pa(e,t,n,i){if(null==e)return null;if("valid"===i)e=e*t+Hi([n-t,0]);else{if("same"!==i)throw new ti(`Unsupport padding mode: ${i}.`);e*=t}return e}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Ba(e,t){return(0,N.tidy)(()=>(Di(t),"channelsFirst"===t?N.transpose(e,[0,2,3,1]):e))}function $a(e,t){return(0,N.tidy)(()=>(Di(t),"channelsFirst"===t?N.transpose(e,[0,2,3,4,1]):e))}function Ua(e,t,n,i=1,r="valid",s,o=1){return(0,N.tidy)(()=>{if(null==s&&(s="channelsLast"),Di(s),3!==e.shape.length)throw new ti(`The input of a conv1dWithBias operation should be 3, but is ${e.shape.length} instead.`);if(3!==t.shape.length)throw new ti(`The kernel for a conv1dWithBias operation should be 3, but is ${t.shape.length} instead`);if(null!=n&&1!==n.shape.length)throw new ti(`The bias for a conv1dWithBias operation should be 1, but is ${n.shape.length} instead`);if("channelsFirst"===s&&(e=N.transpose(e,[0,2,1])),"causal"===r)throw new ni("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let a=N.conv1d(e,t,i,"same"===r?"same":"valid","NWC",o);return null!=n&&(a=ur(a,n)),a})}function za(e,t,n,i=[1,1],r="valid",s,o,a=null){return(0,N.tidy)(()=>{if(null==s&&(s="channelsLast"),Di(s),3!==e.rank&&4!==e.rank)throw new ti(`conv2dWithBiasActivation expects input to be of rank 3 or 4, but received ${e.rank}.`);if(3!==t.rank&&4!==t.rank)throw new ti(`conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received ${e.rank}.`);let l=Ba(e,s);if("causal"===r)throw new ni("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return l=N.fused.conv2d({x:l,filter:t,strides:i,pad:"same"===r?"same":"valid",dilations:o,dataFormat:"NHWC",bias:n,activation:a}),"channelsFirst"===s&&(l=N.transpose(l,[0,3,1,2])),l})}function Va(e,t,n,i=[1,1,1],r="valid",s,o){return(0,N.tidy)(()=>{if(null==s&&(s="channelsLast"),Di(s),4!==e.rank&&5!==e.rank)throw new ti(`conv3dWithBias expects input to be of rank 4 or 5, but received ${e.rank}.`);if(4!==t.rank&&5!==t.rank)throw new ti(`conv3dWithBias expects kernel to be of rank 4 or 5, but received ${e.rank}.`);let a=$a(e,s);if("causal"===r)throw new ni("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return a=N.conv3d(a,t,i,"same"===r?"same":"valid","NDHWC",o),null!=n&&(a=ur(a,n)),"channelsFirst"===s&&(a=N.transpose(a,[0,4,1,2,3])),a})}Da.className="Softmax",N.serialization.registerClass(Da);class ja extends Xr{constructor(e,t){if(super(t),this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",ja.verifyArgs(t),this.rank=e,Ti(this.rank,"rank"),1!==this.rank&&2!==this.rank&&3!==this.rank)throw new ni(`Convolution layer for rank other than 1, 2, or 3 (${this.rank}) is not implemented yet.`);if(this.kernelSize=Fa(t.kernelSize,e,"kernelSize"),this.strides=Fa(null==t.strides?1:t.strides,e,"strides"),this.padding=null==t.padding?"valid":t.padding,Fi(this.padding),this.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,Di(this.dataFormat),this.activation=Ta(t.activation),this.useBias=null==t.useBias||t.useBias,this.biasInitializer=Nr(t.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=fs(t.biasConstraint),this.biasRegularizer=Ca(t.biasRegularizer),this.activityRegularizer=Ca(t.activityRegularizer),this.dilationRate=Fa(null==t.dilationRate?1:t.dilationRate,e,"dilationRate"),1===this.rank&&Array.isArray(this.dilationRate)&&1!==this.dilationRate.length)throw new ti(`dilationRate must be a number or an array of a single number for 1D convolution, but received ${JSON.stringify(this.dilationRate)}`);if(2===this.rank){if("number"==typeof this.dilationRate)this.dilationRate=[this.dilationRate,this.dilationRate];else if(2!==this.dilationRate.length)throw new ti(`dilationRate must be a number or array of two numbers for 2D convolution, but received ${JSON.stringify(this.dilationRate)}`)}else if(3===this.rank)if("number"==typeof this.dilationRate)this.dilationRate=[this.dilationRate,this.dilationRate,this.dilationRate];else if(3!==this.dilationRate.length)throw new ti(`dilationRate must be a number or array of three numbers for 3D convolution, but received ${JSON.stringify(this.dilationRate)}`)}static verifyArgs(e){if(oi("kernelSize"in e,"required key 'kernelSize' not in config"),"number"!=typeof e.kernelSize&&!bi(e.kernelSize,"number",1,3))throw new ti(`BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received ${JSON.stringify(e.kernelSize)}.`)}getConfig(){const e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:va(this.activation),useBias:this.useBias,biasInitializer:kr(this.biasInitializer),biasRegularizer:Aa(this.biasRegularizer),activityRegularizer:Aa(this.activityRegularizer),biasConstraint:hs(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}class Ya extends ja{constructor(e,t){super(e,t),this.kernel=null,Ya.verifyArgs(t),this.filters=t.filters,Ti(this.filters,"filters"),this.kernelInitializer=Nr(t.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=fs(t.kernelConstraint),this.kernelRegularizer=Ca(t.kernelRegularizer)}build(e){e=Pr(e);const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new ti(`The channel dimension of the input should be defined. Found ${e[t]}`);const n=e[t],i=this.kernelSize.concat([n,this.filters]);this.kernel=this.addWeight("kernel",i,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:{[t]:n}}],this.built=!0}call(e,t){return(0,N.tidy)(()=>{let t;e=Lr(e);const n=null==this.bias?null:this.bias.read(),i=Ei(this.activation.getClassName());if(null!=i&&2===this.rank)t=za(e,this.kernel.read(),n,this.strides,this.padding,this.dataFormat,this.dilationRate,i);else{if(1===this.rank)t=Ua(e,this.kernel.read(),n,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(2===this.rank)t=za(e,this.kernel.read(),n,this.strides,this.padding,this.dataFormat,this.dilationRate);else{if(3!==this.rank)throw new ni("convolutions greater than 3D are not implemented yet.");t=Va(e,this.kernel.read(),n,this.strides,this.padding,this.dataFormat,this.dilationRate)}null!=this.activation&&(t=this.activation.apply(t))}return t})}computeOutputShape(e){e=Pr(e);const t=[],n="channelsLast"===this.dataFormat?e.slice(1,e.length-1):e.slice(2);for(let e=0;e<n.length;++e){const i=La(n[e],this.kernelSize[e],this.padding,this.strides[e],"number"==typeof this.dilationRate?this.dilationRate:this.dilationRate[e]);t.push(i)}let i=[e[0]];return"channelsLast"===this.dataFormat?(i=i.concat(t),i.push(this.filters)):(i.push(this.filters),i=i.concat(t)),i}getConfig(){const e={filters:this.filters,kernelInitializer:kr(this.kernelInitializer),kernelRegularizer:Aa(this.kernelRegularizer),kernelConstraint:hs(this.kernelConstraint)},t=super.getConfig();return Object.assign(e,t),e}static verifyArgs(e){if(!("filters"in e)||"number"!=typeof e.filters||e.filters<1)throw new ti(`Convolution layer expected config.filters to be a 'number' > 0 but got ${JSON.stringify(e.filters)}`)}}class Ga extends Ya{constructor(e){super(2,e),Ga.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if("number"!=typeof e.kernelSize&&!bi(e.kernelSize,"number",1,2))throw new ti(`Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received ${JSON.stringify(e.kernelSize)}.`)}}Ga.className="Conv2D",N.serialization.registerClass(Ga);class Ha extends Ya{constructor(e){super(3,e),Ha.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if("number"!=typeof e.kernelSize&&(!Array.isArray(e.kernelSize)||1!==e.kernelSize.length&&3!==e.kernelSize.length))throw new ti(`Conv3D expects config.kernelSize to be number or [number, number, number], but received ${JSON.stringify(e.kernelSize)}.`)}}Ha.className="Conv3D",N.serialization.registerClass(Ha);class Wa extends Ga{constructor(e){if(super(e),this.inputSpec=[new jr({ndim:4})],"same"!==this.padding&&"valid"!==this.padding)throw new ti(`Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(4!==(e=Pr(e)).length)throw new ti("Input should have rank 4; Received input shape: "+JSON.stringify(e));const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new ti("The channel dimension of the inputs should be defined. Found `None`.");const n=e[t],i=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",i,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new jr({ndim:4,axes:{[t]:n}})],this.built=!0}call(e,t){return N.tidy(()=>{let t=Lr(e);if(4!==t.shape.length)throw new ti(`Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${t.shape.length}`);const n=t.shape,i=n[0];let r,s;"channelsFirst"===this.dataFormat?(r=2,s=3):(r=1,s=2);const o=n[r],a=n[s],l=this.kernelSize[0],u=this.kernelSize[1],c=this.strides[0],d=this.strides[1],h=[i,Pa(o,c,l,this.padding),Pa(a,d,u,this.padding),this.filters];"channelsLast"!==this.dataFormat&&(t=N.transpose(t,[0,2,3,1]));let p=N.conv2dTranspose(t,this.kernel.read(),h,this.strides,this.padding);return"channelsLast"!==this.dataFormat&&(p=N.transpose(p,[0,3,1,2])),null!=this.bias&&(p=ur(p,this.bias.read(),this.dataFormat)),null!=this.activation&&(p=this.activation.apply(p)),p})}computeOutputShape(e){const t=(e=Pr(e)).slice();let n,i,r;"channelsFirst"===this.dataFormat?(n=1,i=2,r=3):(n=3,i=1,r=2);const s=this.kernelSize[0],o=this.kernelSize[1],a=this.strides[0],l=this.strides[1];return t[n]=this.filters,t[i]=Pa(t[i],a,s,this.padding),t[r]=Pa(t[r],l,o,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}Wa.className="Conv2DTranspose",N.serialization.registerClass(Wa);class Xa extends Ha{constructor(e){if(super(e),this.inputSpec=[new jr({ndim:5})],"same"!==this.padding&&"valid"!==this.padding)throw new ti(`Conv3DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(5!==(e=Pr(e)).length)throw new ti("Input should have rank 5; Received input shape: "+JSON.stringify(e));const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new ti("The channel dimension of the inputs should be defined. Found `None`.");const n=e[t],i=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",i,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new jr({ndim:5,axes:{[t]:n}})],this.built=!0}call(e,t){return N.tidy(()=>{let t=Lr(e);if(5!==t.shape.length)throw new ti(`Conv3DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${t.shape.length}`);const n=t.shape,i=n[0];let r,s,o;"channelsFirst"===this.dataFormat?(o=2,r=3,s=4):(o=1,r=2,s=3);const a=n[o],l=n[r],u=n[s],c=this.kernelSize[0],d=this.kernelSize[1],h=this.kernelSize[2],p=this.strides[0],f=this.strides[1],m=this.strides[2],g=[i,Pa(a,p,c,this.padding),Pa(l,f,d,this.padding),Pa(u,m,h,this.padding),this.filters];"channelsLast"!==this.dataFormat&&(t=N.transpose(t,[0,2,3,4,1]));let y=N.conv3dTranspose(t,this.kernel.read(),g,this.strides,this.padding);return"channelsLast"!==this.dataFormat&&(y=N.transpose(y,[0,4,1,2,3])),null!==this.bias&&(y=ur(y,this.bias.read(),this.dataFormat)),null!==this.activation&&(y=this.activation.apply(y)),y})}computeOutputShape(e){const t=(e=Pr(e)).slice();let n,i,r,s;"channelsFirst"===this.dataFormat?(n=1,i=2,r=3,s=4):(n=4,i=1,r=2,s=3);const o=this.kernelSize[0],a=this.kernelSize[1],l=this.kernelSize[2],u=this.strides[0],c=this.strides[1],d=this.strides[2];return t[n]=this.filters,t[i]=Pa(t[i],u,o,this.padding),t[r]=Pa(t[r],c,a,this.padding),t[s]=Pa(t[s],d,l,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}Xa.className="Conv3DTranspose",N.serialization.registerClass(Xa);class qa extends Ya{constructor(e,t){if(super(e,t),this.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",this.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",this.depthwiseKernel=null,this.pointwiseKernel=null,null==t.filters)throw new ti("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(null!=t.kernelInitializer||null!=t.kernelRegularizer||null!=t.kernelConstraint)throw new ti("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(null!=t.padding&&"same"!==t.padding&&"valid"!==t.padding)throw new ti(`SeparableConv${this.rank}D supports only padding modes: 'same' and 'valid', but received ${JSON.stringify(t.padding)}`);this.depthMultiplier=null==t.depthMultiplier?1:t.depthMultiplier,this.depthwiseInitializer=Nr(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=Ca(t.depthwiseRegularizer),this.depthwiseConstraint=fs(t.depthwiseConstraint),this.pointwiseInitializer=Nr(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=Ca(t.pointwiseRegularizer),this.pointwiseConstraint=fs(t.pointwiseConstraint)}build(e){if((e=Pr(e)).length<this.rank+2)throw new ti(`Inputs to SeparableConv${this.rank}D should have rank ${this.rank+2}, but received input shape: ${JSON.stringify(e)}`);const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t]||e[t]<0)throw new ti(`The channel dimension of the inputs should be defined, but found ${JSON.stringify(e[t])}`);const n=e[t],i=this.kernelSize.concat([n,this.depthMultiplier]),r=[];for(let e=0;e<this.rank;++e)r.push(1);r.push(n*this.depthMultiplier,this.filters);const s=!0;this.depthwiseKernel=this.addWeight("depthwise_kernel",i,"float32",this.depthwiseInitializer,this.depthwiseRegularizer,s,this.depthwiseConstraint),this.pointwiseKernel=this.addWeight("pointwise_kernel",r,"float32",this.pointwiseInitializer,this.pointwiseRegularizer,s,this.pointwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,s,this.biasConstraint):this.bias=null,this.inputSpec=[new jr({ndim:this.rank+2,axes:{[t]:n}})],this.built=!0}call(e,t){return(0,N.tidy)(()=>{let t;if(e=Lr(e),1===this.rank)throw new ni("1D separable convolution is not implemented yet.");return 2===this.rank&&("channelsFirst"===this.dataFormat&&(e=N.transpose(e,[0,2,3,1])),t=N.separableConv2d(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(t=ur(t,this.bias.read(),this.dataFormat)),null!=this.activation&&(t=this.activation.apply(t)),"channelsFirst"===this.dataFormat&&(t=N.transpose(t,[0,3,1,2])),t})}getConfig(){const e=super.getConfig();return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=kr(this.depthwiseInitializer),e.pointwiseInitializer=kr(this.pointwiseInitializer),e.depthwiseRegularizer=Aa(this.depthwiseRegularizer),e.pointwiseRegularizer=Aa(this.pointwiseRegularizer),e.depthwiseConstraint=hs(this.depthwiseConstraint),e.pointwiseConstraint=hs(this.pointwiseConstraint),e}}qa.className="SeparableConv";class Ka extends qa{constructor(e){super(2,e)}}Ka.className="SeparableConv2D",N.serialization.registerClass(Ka);class Za extends Ya{constructor(e){super(1,e),Za.verifyArgs(e),this.inputSpec=[{ndim:3}]}getConfig(){const e=super.getConfig();return delete e.rank,delete e.dataFormat,e}static verifyArgs(e){if("number"!=typeof e.kernelSize&&!bi(e.kernelSize,"number",1,1))throw new ti(`Conv1D expects config.kernelSize to be number or number[] with length 1, but received ${JSON.stringify(e.kernelSize)}.`)}}Za.className="Conv1D",N.serialization.registerClass(Za);class Qa extends Xr{constructor(e){super(e),"number"==typeof e.cropping?this.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:"number"==typeof e.cropping[0]?this.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:this.cropping=e.cropping,this.dataFormat=void 0===e.dataFormat?"channelsLast":e.dataFormat,this.inputSpec=[{ndim:4}]}computeOutputShape(e){return"channelsFirst"===this.dataFormat?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]}call(e,t){return(0,N.tidy)(()=>{if(e=Lr(e),"channelsLast"===this.dataFormat){const t=er(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return er(t,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}{const t=er(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return er(t,this.cropping[1][0],e.shape[3]-this.cropping[1][1]-this.cropping[1][0],4)}})}getConfig(){const e={cropping:this.cropping,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}Qa.className="Cropping2D",N.serialization.registerClass(Qa);class Ja extends Xr{constructor(e){var t;super(e),this.DEFAULT_SIZE=[2,2],this.inputSpec=[{ndim:4}],this.size=null==e.size?this.DEFAULT_SIZE:e.size,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,Di(this.dataFormat),this.interpolation=null==e.interpolation?"nearest":e.interpolation,t=this.interpolation,vi(Oi,"InterpolationFormat",t)}computeOutputShape(e){if("channelsFirst"===this.dataFormat){const t=null==e[2]?null:this.size[0]*e[2],n=null==e[3]?null:this.size[1]*e[3];return[e[0],e[1],t,n]}{const t=null==e[1]?null:this.size[0]*e[1],n=null==e[2]?null:this.size[1]*e[2];return[e[0],t,n,e[3]]}}call(e,t){return N.tidy(()=>{let t=Lr(e);const n=t.shape;if("channelsFirst"===this.dataFormat){t=N.transpose(t,[0,2,3,1]);const e=this.size[0]*n[2],i=this.size[1]*n[3],r="nearest"===this.interpolation?N.image.resizeNearestNeighbor(t,[e,i]):N.image.resizeBilinear(t,[e,i]);return N.transpose(r,[0,3,1,2])}{const e=this.size[0]*n[1],i=this.size[1]*n[2];return"nearest"===this.interpolation?N.image.resizeNearestNeighbor(t,[e,i]):N.image.resizeBilinear(t,[e,i])}})}getConfig(){const e={size:this.size,dataFormat:this.dataFormat,interpolation:this.interpolation},t=super.getConfig();return Object.assign(e,t),e}}Ja.className="UpSampling2D",N.serialization.registerClass(Ja);class el extends ja{constructor(e){super(2,e),this.depthwiseKernel=null,this.depthMultiplier=null==e.depthMultiplier?1:e.depthMultiplier,this.depthwiseInitializer=Nr(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=fs(e.depthwiseConstraint),this.depthwiseRegularizer=Ca(e.depthwiseRegularizer)}build(e){if((e=Pr(e)).length<4)throw new ti(`Inputs to DepthwiseConv2D should have rank 4. Received input shape: ${JSON.stringify(e)}.`);const t="channelsFirst"===this.dataFormat?1:3;if(null==e[t]||e[t]<0)throw new ti(`The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not (${e[t]}).`);const n=e[t],i=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",i,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return(0,N.tidy)(()=>{let t=
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function(e,t,n=[1,1],i="valid",r,s){return(0,N.tidy)(()=>{null==r&&(r="channelsLast"),Di(r);let o=Ba(e,r);if(4!==e.rank)throw new ti(`Input for depthwiseConv2d is required to be 4-D, but is instead ${e.rank}-D`);if(4!==t.rank)throw new ti(`depthwiseKernel is required to be 4-D, but is instead ${t.rank}-D`);return o=N.depthwiseConv2d(o,t,n,"same"===i?"same":"valid","NHWC",s),"channelsFirst"===r&&(o=N.transpose(o,[0,3,1,2])),o})}(e=Lr(e),this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(t=ur(t,this.bias.read(),this.dataFormat)),null!=this.activation&&(t=this.activation.apply(t)),t})}computeOutputShape(e){e=Pr(e);const t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2],i="channelsFirst"===this.dataFormat?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,r=La(t,this.kernelSize[0],this.padding,this.strides[0]),s=La(n,this.kernelSize[1],this.padding,this.strides[1]);return"channelsFirst"===this.dataFormat?[e[0],i,r,s]:[e[0],r,s,i]}getConfig(){const e=super.getConfig();return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=kr(this.depthwiseInitializer),e.depthwiseRegularizer=Aa(this.depthwiseRegularizer),e.depthwiseConstraint=hs(this.depthwiseRegularizer),e}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function tl(e,t,n,i){if(Array.isArray(e)){if(null!=t||null!=n)throw new ti("When inputs is an array, neither initialState or constants should be provided");null!=i&&(n=e.slice(e.length-i,e.length),e=e.slice(0,e.length-i)),e.length>1&&(t=e.slice(1,e.length)),e=e[0]}function r(e){return null==e||Array.isArray(e)?e:[e]}return{inputs:e,initialState:t=r(t),constants:n=r(n)}}function nl(e,t,n,i=!1,r,s,o=!1,a=!1){return N.tidy(()=>{const l=t.shape.length;if(l<3)throw new ti(`Input should be at least 3D, but is ${l}D.`);const u=[1,0].concat(Wi(2,l));if(t=N.transpose(t,u),null!=s)throw new ni("The rnn() functoin of the deeplearn.js backend does not support constants yet.");o&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),null!=r&&((r=N.cast(N.cast(r,"bool"),"float32")).rank===l-1&&(r=N.expandDims(r,-1)),r=N.transpose(r,u)),i&&(t=N.reverse(t,0),null!=r&&(r=N.reverse(r,0)));const c=[];let d,h=n;const p=t.shape[0],f=N.unstack(t);let m,g;null!=r&&(m=N.unstack(r));for(let t=0;t<p;++t){const n=f[t],i=N.tidy(()=>e(n,h));if(null==r)d=i[0],h=i[1];else{const e=N.tidy(()=>{const e=m[t],n=N.sub(N.onesLike(e),e);return{output:N.add(N.mul(i[0],e),N.mul(h[0],n)),newStates:h.map((t,r)=>N.add(N.mul(i[1][r],e),N.mul(t,n)))}});d=e.output,h=e.newStates}a&&c.push(d)}if(a){const e=1;g=N.stack(c,e)}return[d,g,h]})}el.className="DepthwiseConv2D",N.serialization.registerClass(el);class il extends Xr{constructor(e){let t;if(super(e),null==e.cell)throw new ti("cell property is missing for the constructor of RNN.");if(t=Array.isArray(e.cell)?new dl({cells:e.cell}):e.cell,null==t.stateSize)throw new ti("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=t,this.returnSequences=null!=e.returnSequences&&e.returnSequences,this.returnState=null!=e.returnState&&e.returnState,this.goBackwards=null!=e.goBackwards&&e.goBackwards,this._stateful=null!=e.stateful&&e.stateful,this.unroll=null!=e.unroll&&e.unroll,this.supportsMasking=!0,this.inputSpec=[new jr({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(null==this.states_){return Wi(0,Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1).map(e=>null)}return this.states_}setStates(e){this.states_=e}computeOutputShape(e){Dr(e)&&(e=e[0]);let t=this.cell.stateSize;Array.isArray(t)||(t=[t]);const n=t[0];let i;if(i=this.returnSequences?[e[0],e[1],n]:[e[0],n],this.returnState){const n=[];for(const i of t)n.push([e[0],i]);return[i].concat(n)}return i}computeMask(e,t){return N.tidy(()=>{Array.isArray(t)&&(t=t[0]);const e=this.returnSequences?t:null;if(this.returnState){const t=this.states.map(e=>null);return[e].concat(t)}return e})}get states(){if(null==this.states_){const e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,t=[];for(let n=0;n<e;++n)t.push(null);return t}return this.states_}set states(e){this.states_=e}build(e){if(null!=this.numConstants)throw new ni("Constants support is not implemented in RNN yet.");Dr(e)&&(e=e[0]);const t=this.stateful?e[0]:null,n=e.slice(2);this.inputSpec[0]=new jr({shape:[t,null,...n]});const i=[e[0]].concat(e.slice(2));let r;if(this.cell.build(i),r=Array.isArray(this.cell.stateSize)?this.cell.stateSize:[this.cell.stateSize],null!=this.stateSpec){if(!N.util.arraysEqual(this.stateSpec.map(e=>e.shape[e.shape.length-1]),r))throw new ti(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=r.map(e=>new jr({shape:[null,e]}));this.stateful&&this.resetStates()}resetStates(e,t=!1){(0,N.tidy)(()=>{if(!this.stateful)throw new Jn("Cannot call resetStates() on an RNN Layer that is not stateful.");const n=this.inputSpec[0].shape[0];if(null==n)throw new ti("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(null==this.states_)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(e=>N.zeros([n,e])):this.states_=[N.zeros([n,this.cell.stateSize])];else if(null==e)N.dispose(this.states_),null!=this.keptStates&&(N.dispose(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(e=>N.zeros([n,e])):this.states_[0]=N.zeros([n,this.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new ti(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);!0===t?this.keptStates.push(this.states_.slice()):N.dispose(this.states_);for(let t=0;t<this.states_.length;++t){const i=e[t],r=Array.isArray(this.cell.stateSize)?this.cell.stateSize[t]:this.cell.stateSize,s=[n,r];if(!N.util.arraysEqual(i.shape,s))throw new ti(`State ${t} is incompatible with layer ${this.name}: expected shape=${s}, received shape=${i.shape}`);this.states_[t]=i}}this.states_=this.states_.map(e=>N.keep(e.clone()))})}apply(e,t){let n=null==t?null:t.initialState,i=null==t?null:t.constants;null==t&&(t={});const r=tl(e,n,i,this.numConstants);e=r.inputs,n=r.initialState,i=r.constants;let s=[],o=[];if(null!=n){t.initialState=n,s=s.concat(n),this.stateSpec=[];for(const e of n)this.stateSpec.push(new jr({shape:e.shape}));o=o.concat(this.stateSpec)}null!=i&&(t.constants=i,s=s.concat(i),this.numConstants=i.length);if(s[0]instanceof Yr){const n=[e].concat(s),i=this.inputSpec.concat(o),r=this.inputSpec;this.inputSpec=i;const a=super.apply(n,t);return this.inputSpec=r,a}return super.apply(e,t)}call(e,t){return(0,N.tidy)(()=>{const n=null==t?null:t.mask,i=null==t?null:t.training;let r=null==t?null:t.initialState;e=Lr(e),null==r&&(r=this.stateful?this.states_:this.getInitialState(e));const s=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(r.length!==s)throw new ti(`RNN Layer has ${s} state(s) but was passed ${r.length} initial state(s).`);this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");const o={training:i},a=nl((e,t)=>{const n=this.cell.call([e].concat(t),o);return[n[0],n.slice(1)]},e,r,this.goBackwards,n,null,this.unroll,this.returnSequences),l=a[0],u=a[1],c=a[2];this.stateful&&this.resetStates(c,i);const d=this.returnSequences?u:l;return this.returnState?[d].concat(c):d})}getInitialState(e){return(0,N.tidy)(()=>{let t=N.zeros(e.shape);return t=N.sum(t,[1,2]),t=Zi(t),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map(e=>e>1?ir(t,[1,e]):t):this.cell.stateSize>1?[ir(t,[1,this.cell.stateSize])]:[t]})}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),null!=this.cell&&this.cell.setFastWeightInitDuringBuild(e)}getConfig(){const e=super.getConfig(),t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};null!=this.numConstants&&(t.numConstants=this.numConstants);const n=this.cell.getConfig();return this.getClassName()===il.className&&(t.cell={className:this.cell.getClassName(),config:n}),Object.assign(Object.assign(Object.assign({},n),e),t)}static fromConfig(e,t,n={}){const i=Gs(t.cell,n);return new e(Object.assign(t,{cell:i}))}}il.className="RNN",N.serialization.registerClass(il);class rl extends Xr{}class sl extends rl{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,Ti(this.units,"units"),this.activation=Ta(null==e.activation?this.DEFAULT_ACTIVATION:e.activation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=Nr(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=Nr(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=Nr(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=Ca(e.kernelRegularizer),this.recurrentRegularizer=Ca(e.recurrentRegularizer),this.biasRegularizer=Ca(e.biasRegularizer),this.kernelConstraint=fs(e.kernelConstraint),this.recurrentConstraint=fs(e.recurrentConstraint),this.biasConstraint=fs(e.biasConstraint),this.dropout=Gi([1,Hi([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=Gi([1,Hi([0,null==e.recurrentDropout?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=Pr(e),this.kernel=this.addWeight("kernel",[e[e.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return(0,N.tidy)(()=>{if(2!==e.length)throw new ti(`SimpleRNNCell expects 2 input Tensors, got ${e.length}.`);let n=e[1];e=e[0];const i=null!=t.training&&t.training;let r;0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=hl({ones:()=>N.onesLike(e),rate:this.dropout,training:i,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=hl({ones:()=>N.onesLike(n),rate:this.recurrentDropout,training:i,dropoutFunc:this.dropoutFunc}));const s=this.dropoutMask,o=this.recurrentDropoutMask;r=sr(null!=s?N.mul(e,s):e,this.kernel.read()),null!=this.bias&&(r=ur(r,this.bias.read())),null!=o&&(n=N.mul(n,o));let a=N.add(r,sr(n,this.recurrentKernel.read()));return null!=this.activation&&(a=this.activation.apply(a)),[a,a]})}getConfig(){const e=super.getConfig(),t={units:this.units,activation:va(this.activation),useBias:this.useBias,kernelInitializer:kr(this.kernelInitializer),recurrentInitializer:kr(this.recurrentInitializer),biasInitializer:kr(this.biasInitializer),kernelRegularizer:Aa(this.kernelRegularizer),recurrentRegularizer:Aa(this.recurrentRegularizer),biasRegularizer:Aa(this.biasRegularizer),activityRegularizer:Aa(this.activityRegularizer),kernelConstraint:hs(this.kernelConstraint),recurrentConstraint:hs(this.recurrentConstraint),biasConstraint:hs(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign(Object.assign({},e),t)}}sl.className="SimpleRNNCell",N.serialization.registerClass(sl);class ol extends il{constructor(e){e.cell=new sl(e),super(e)}call(e,t){return(0,N.tidy)(()=>{null!=this.cell.dropoutMask&&(N.dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(N.dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const n=null==t?null:t.mask,i=null==t?null:t.training,r=null==t?null:t.initialState;return super.call(e,{mask:n,training:i,initialState:r})})}static fromConfig(e,t){return new e(t)}}ol.className="SimpleRNN",N.serialization.registerClass(ol);class al extends rl{constructor(e){if(super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new ti("GRUCell does not support reset_after parameter set to true.");this.units=e.units,Ti(this.units,"units"),this.activation=Ta(void 0===e.activation?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=Ta(void 0===e.recurrentActivation?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=Nr(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=Nr(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=Nr(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=Ca(e.kernelRegularizer),this.recurrentRegularizer=Ca(e.recurrentRegularizer),this.biasRegularizer=Ca(e.biasRegularizer),this.kernelConstraint=fs(e.kernelConstraint),this.recurrentConstraint=fs(e.recurrentConstraint),this.biasConstraint=fs(e.biasConstraint),this.dropout=Gi([1,Hi([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=Gi([1,Hi([0,null==e.recurrentDropout?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){const t=(e=Pr(e))[e.length-1];this.kernel=this.addWeight("kernel",[t,3*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,3*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[3*this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return(0,N.tidy)(()=>{if(2!==e.length)throw new ti(`GRUCell expects 2 input Tensors (inputs, h, c), got ${e.length}.`);const n=null!=t.training&&t.training;let i=e[1];e=e[0],0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=hl({ones:()=>N.onesLike(e),rate:this.dropout,training:n,count:3,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=hl({ones:()=>N.onesLike(i),rate:this.recurrentDropout,training:n,count:3,dropoutFunc:this.dropoutFunc}));const r=this.dropoutMask,s=this.recurrentDropoutMask;let o,a,l;0<this.dropout&&this.dropout<1&&(e=N.mul(e,r[0]));let u=sr(e,this.kernel.read());this.useBias&&(u=ur(u,this.bias.read())),0<this.recurrentDropout&&this.recurrentDropout<1&&(i=N.mul(i,s[0]));const c=this.recurrentKernel.read(),[d,h]=N.split(c,[2*this.units,this.units],c.rank-1),p=sr(i,d),[f,m,g]=N.split(u,3,u.rank-1),[y,_]=N.split(p,2,p.rank-1);o=this.recurrentActivation.apply(N.add(f,y)),a=this.recurrentActivation.apply(N.add(m,_));const v=sr(N.mul(a,i),h);l=this.activation.apply(N.add(g,v));const b=N.add(N.mul(o,i),N.mul(N.add(1,N.neg(o)),l));return[b,b]})}getConfig(){const e=super.getConfig(),t={units:this.units,activation:va(this.activation),recurrentActivation:va(this.recurrentActivation),useBias:this.useBias,kernelInitializer:kr(this.kernelInitializer),recurrentInitializer:kr(this.recurrentInitializer),biasInitializer:kr(this.biasInitializer),kernelRegularizer:Aa(this.kernelRegularizer),recurrentRegularizer:Aa(this.recurrentRegularizer),biasRegularizer:Aa(this.biasRegularizer),activityRegularizer:Aa(this.activityRegularizer),kernelConstraint:hs(this.kernelConstraint),recurrentConstraint:hs(this.recurrentConstraint),biasConstraint:hs(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation,resetAfter:!1};return Object.assign(Object.assign({},e),t)}}al.className="GRUCell",N.serialization.registerClass(al);class ll extends il{constructor(e){0===e.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),e.cell=new al(e),super(e)}call(e,t){return(0,N.tidy)(()=>{null!=this.cell.dropoutMask&&(N.dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(N.dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const n=null==t?null:t.mask,i=null==t?null:t.training,r=null==t?null:t.initialState;return super.call(e,{mask:n,training:i,initialState:r})})}static fromConfig(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)}}ll.className="GRU",N.serialization.registerClass(ll);class ul extends rl{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,Ti(this.units,"units"),this.activation=Ta(void 0===e.activation?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=Ta(void 0===e.recurrentActivation?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=Nr(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=Nr(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=Nr(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=Ca(e.kernelRegularizer),this.recurrentRegularizer=Ca(e.recurrentRegularizer),this.biasRegularizer=Ca(e.biasRegularizer),this.kernelConstraint=fs(e.kernelConstraint),this.recurrentConstraint=fs(e.recurrentConstraint),this.biasConstraint=fs(e.biasConstraint),this.dropout=Gi([1,Hi([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=Gi([1,Hi([0,null==e.recurrentDropout?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){var t;const n=(e=Pr(e))[e.length-1];let i;if(this.kernel=this.addWeight("kernel",[n,4*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,4*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){if(this.unitForgetBias){const e=this.biasInitializer,n=this.units;i=new((t=class extends fr{apply(t,i){const r=e.apply([n]),s=(new gr).apply([n]),o=e.apply([2*n]);return nr(nr(r,s),o)}}).className="CustomInit",t)}else i=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.units],null,i,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(e,t){return(0,N.tidy)(()=>{const n=null!=t.training&&t.training;if(3!==e.length)throw new ti(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let i=e[1];const r=e[2];e=e[0],0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=hl({ones:()=>N.onesLike(e),rate:this.dropout,training:n,count:4,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=hl({ones:()=>N.onesLike(i),rate:this.recurrentDropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));const s=this.dropoutMask,o=this.recurrentDropoutMask;let a,l,u,c;0<this.dropout&&this.dropout<1&&(e=N.mul(e,s[0]));let d=sr(e,this.kernel.read());0<this.recurrentDropout&&this.recurrentDropout<1&&(i=N.mul(i,o[0])),d=N.add(d,sr(i,this.recurrentKernel.read())),this.useBias&&(d=ur(d,this.bias.read()));const[h,p,f,m]=N.split(d,4,d.rank-1);a=this.recurrentActivation.apply(h),l=this.recurrentActivation.apply(p),u=N.add(N.mul(l,r),N.mul(a,this.activation.apply(f))),c=this.recurrentActivation.apply(m);const g=N.mul(c,this.activation.apply(u));return[g,g,u]})}getConfig(){const e=super.getConfig(),t={units:this.units,activation:va(this.activation),recurrentActivation:va(this.recurrentActivation),useBias:this.useBias,kernelInitializer:kr(this.kernelInitializer),recurrentInitializer:kr(this.recurrentInitializer),biasInitializer:kr(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:Aa(this.kernelRegularizer),recurrentRegularizer:Aa(this.recurrentRegularizer),biasRegularizer:Aa(this.biasRegularizer),activityRegularizer:Aa(this.activityRegularizer),kernelConstraint:hs(this.kernelConstraint),recurrentConstraint:hs(this.recurrentConstraint),biasConstraint:hs(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation};return Object.assign(Object.assign({},e),t)}}ul.className="LSTMCell",N.serialization.registerClass(ul);class cl extends il{constructor(e){0===e.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),e.cell=new ul(e),super(e)}call(e,t){return(0,N.tidy)(()=>{null!=this.cell.dropoutMask&&(N.dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(N.dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const n=null==t?null:t.mask,i=null==t?null:t.training,r=null==t?null:t.initialState;return super.call(e,{mask:n,training:i,initialState:r})})}static fromConfig(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)}}cl.className="LSTM",N.serialization.registerClass(cl);class dl extends rl{constructor(e){super(e),this.cells=e.cells}get stateSize(){const e=[];for(const t of this.cells.slice().reverse())Array.isArray(t.stateSize)?e.push(...t.stateSize):e.push(t.stateSize);return e}call(e,t){return(0,N.tidy)(()=>{let n=e.slice(1);const i=[];for(const e of this.cells.slice().reverse())Array.isArray(e.stateSize)?i.push(n.splice(0,e.stateSize.length)):i.push(n.splice(0,1));i.reverse();const r=[];let s;for(let o=0;o<this.cells.length;++o){const a=this.cells[o];n=i[o],s=0===o?[e[0]].concat(n):[s[0]].concat(n),s=a.call(s,t),r.push(s.slice(1))}n=[];for(const e of r.slice().reverse())n.push(...e);return[s[0]].concat(n)})}build(e){let t;Dr(e)&&(e=e[0]),this.cells.forEach((n,i)=>{Bi(`RNNCell_${i}`,()=>{n.build(e),t=Array.isArray(n.stateSize)?n.stateSize[0]:n.stateSize,e=[e[0],t]})}),this.built=!0}getConfig(){const e=super.getConfig(),t={cells:this.cells.map(e=>({className:e.getClassName(),config:e.getConfig()}))};return Object.assign(Object.assign({},e),t)}static fromConfig(e,t,n={}){const i=[];for(const e of t.cells)i.push(Gs(e,n));return new e({cells:i})}get trainableWeights(){if(!this.trainable)return[];const e=[];for(const t of this.cells)e.push(...t.trainableWeights);return e}get nonTrainableWeights(){const e=[];for(const t of this.cells)e.push(...t.nonTrainableWeights);if(!this.trainable){const t=[];for(const e of this.cells)t.push(...e.trainableWeights);return t.concat(e)}return e}getWeights(){const e=[];for(const t of this.cells)e.push(...t.weights);return zr(e)}setWeights(e){const t=[];for(const n of this.cells){const i=n.weights.length,r=e.splice(i);for(let e=0;e<n.weights.length;++e)t.push([n.weights[e],r[e]])}Vr(t)}}function hl(e){const{ones:t,rate:n,training:i=!1,count:r=1,dropoutFunc:s}=e,o=()=>null!=s?s(t(),n):cr(t(),n),a=()=>dr(o,t,i);if(!r||r<=1)return N.keep(a().clone());return Array(r).fill(void 0).map(a).map(e=>N.keep(e.clone()))}dl.className="StackedRNNCells",N.serialization.registerClass(dl);
/**
* @license
* Copyright 2020 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
var pl=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n};class fl extends il{constructor(e){if(e.unroll)throw new ni("Unrolling is not possible with convolutional RNNs.");if(Array.isArray(e.cell))throw new ni("It is not possible at the moment to stack convolutional cells.");super(e),this.inputSpec=[new jr({ndim:5})]}call(e,t){return N.tidy(()=>{if(null!=this.cell.dropoutMask&&(N.dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(N.dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new ti("ConvRNN2D cell does not support constants");const n=null==t?null:t.mask,i=null==t?null:t.training,r=null==t?null:t.initialState;return super.call(e,{mask:n,training:i,initialState:r})})}computeOutputShape(e){let t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0],...t.slice(2)]),this.returnState&&(t=[t,...Array(2).fill([e[0],...t.slice(-3)])]),t}getInitialState(e){return N.tidy(()=>{const{stateSize:t}=this.cell,n=e.shape,i=this.computeSingleOutputShape(n),r=[i[0],...i.slice(2)],s=N.zeros(r);return Array.isArray(t)?Array(t.length).fill(s):[s]})}resetStates(e,t=!1){N.tidy(()=>{if(!this.stateful)throw new Jn("Cannot call resetStates() on an RNN Layer that is not stateful.");const n=this.inputSpec[0].shape,i=this.computeSingleOutputShape(n),r=[i[0],...i.slice(2)];if(null==n[0])throw new ti("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(null==this.getStates())Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>N.zeros(r)):this.states_=[N.zeros(r)];else if(null==e)N.dispose(this.states_),null!=this.keptStates&&(N.dispose(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>N.zeros(r)):this.states_[0]=N.zeros(r);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new ti(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t?this.keptStates.push(this.states_.slice()):N.dispose(this.states_);for(let t=0;t<this.states_.length;++t){const n=e[t],i=r;if(!N.util.arraysEqual(n.shape,i))throw new ti(`State ${t} is incompatible with layer ${this.name}: expected shape=${i}, received shape=${n.shape}`);this.states_[t]=n}}this.states_=this.states_.map(e=>N.keep(e.clone()))})}computeSingleOutputShape(e){const{dataFormat:t,filters:n,kernelSize:i,padding:r,strides:s,dilationRate:o}=this.cell,a="channelsFirst"===t,l=e[a?3:2],u=e[a?4:3],c=La(l,i[0],r,s[0],o[0]),d=La(u,i[1],r,s[1],o[1]);return[...e.slice(0,2),...a?[n,c,d]:[c,d,n]]}}fl.className="ConvRNN2D";class ml extends ul{constructor(e){const{filters:t,kernelSize:n,strides:i,padding:r,dataFormat:s,dilationRate:o}=e;super(Object.assign(Object.assign({},e),{units:t})),this.filters=t,Ti(this.filters,"filters"),this.kernelSize=Fa(n,2,"kernelSize"),this.kernelSize.forEach(e=>Ti(e,"kernelSize")),this.strides=Fa(i||1,2,"strides"),this.strides.forEach(e=>Ti(e,"strides")),this.padding=r||"valid",Fi(this.padding),this.dataFormat=s||"channelsLast",Di(this.dataFormat),this.dilationRate=Fa(o||1,2,"dilationRate"),this.dilationRate.forEach(e=>Ti(e,"dilationRate"))}build(e){var t;e=Pr(e);const n="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[n])throw new ti(`The channel dimension of the input should be defined. Found ${e[n]}`);const i=e[n],r=this.kernelSize.concat([i,4*this.filters]);this.kernel=this.addWeight("kernel",r,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);const s=this.kernelSize.concat([this.filters,4*this.filters]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",s,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let e;if(this.unitForgetBias){const n=this.biasInitializer,i=this.filters;e=new((t=class extends fr{apply(e,t){return tr([n.apply([i]),N.ones([i]),n.apply([2*i])])}}).className="CustomInit",t)}else e=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.filters],null,e,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(e,t){return N.tidy(()=>{if(3!==e.length)throw new ti(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);const n=t.training||!1,i=e[0],r=e[1],s=e[2];0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=hl({ones:()=>N.onesLike(i),rate:this.dropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));const o=this.dropoutMask,a=(e,t,n)=>t&&t[n]?N.mul(t[n],e):e;let l=a(i,o,0),u=a(i,o,1),c=a(i,o,2),d=a(i,o,3);0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=hl({ones:()=>N.onesLike(r),rate:this.recurrentDropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));const h=this.recurrentDropoutMask;let p=a(r,h,0),f=a(r,h,1),m=a(r,h,2),g=a(r,h,3);const[y,_,v,b]=N.split(this.kernel.read(),4,3),[T,x,E,w]=this.useBias?N.split(this.bias.read(),4):[null,null,null,null];l=this.inputConv(l,y,T,this.padding),u=this.inputConv(u,_,x,this.padding),c=this.inputConv(c,v,E,this.padding),d=this.inputConv(d,b,w,this.padding);const[I,A,S,C]=N.split(this.recurrentKernel.read(),4,3);p=this.recurrentConv(p,I),f=this.recurrentConv(f,A),m=this.recurrentConv(m,S),g=this.recurrentConv(g,C);const O=this.recurrentActivation.apply(N.add(l,p)),M=this.recurrentActivation.apply(N.add(u,f)),R=N.add(N.mul(M,s),N.mul(O,this.activation.apply(N.add(c,m)))),k=N.mul(this.recurrentActivation.apply(N.add(d,g)),this.activation.apply(R));return[k,k,R]})}getConfig(){const e=super.getConfig(),{units:t}=e,n=pl(e,["units"]),i={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign(Object.assign({},n),i)}inputConv(e,t,n,i){const r=N.conv2d(e,t,this.strides,i||"valid","channelsFirst"===this.dataFormat?"NCHW":"NHWC",this.dilationRate);return n?ur(r,n,this.dataFormat):r}recurrentConv(e,t){return N.conv2d(e,t,1,"same","channelsFirst"===this.dataFormat?"NCHW":"NHWC")}}ml.className="ConvLSTM2DCell",N.serialization.registerClass(ml);class gl extends fl{constructor(e){const t=new ml(e);super(Object.assign(Object.assign({},e),{cell:t}))}static fromConfig(e,t){return new e(t)}}gl.className="ConvLSTM2D",N.serialization.registerClass(gl);
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class yl extends Xr{constructor(e){super(e),this.rate=Math.max(Math.min(e.rate,1),0),this.noiseShape=e.noiseShape,this.seed=e.seed,this.supportsMasking=!0}getNoiseShape(e){if(null==this.noiseShape)return this.noiseShape;const t=e.shape,n=[];for(let e=0;e<this.noiseShape.length;++e)n.push(null==this.noiseShape[e]?t[e]:this.noiseShape[e]);return n}call(e,t){return(0,N.tidy)(()=>{this.invokeCallHook(e,t);const n=Lr(e);if(0<this.rate&&this.rate<1){const e=null!=t.training&&t.training,i=this.getNoiseShape(n);return dr(()=>cr(n,this.rate,i,this.seed),()=>n,e)}return e})}getConfig(){const e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=super.getConfig();return Object.assign(e,t),e}dispose(){return super.dispose()}}yl.className="Dropout",N.serialization.registerClass(yl);class _l extends yl{constructor(e){super(e),this.inputSpec=[{ndim:3}]}getNoiseShape(e){const t=e.shape;return[t[0],1,t[2]]}}_l.className="SpatialDropout1D",N.serialization.registerClass(_l);class vl extends Xr{constructor(e){if(super(e),this.activation=null,this.useBias=!0,this.kernel=null,this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",null==e.batchInputShape&&null==e.inputShape&&null!=e.inputDim){let t=null;null!=e.batchSize&&(t=e.batchSize),this.batchInputShape=[t,e.inputDim]}this.units=e.units,Ti(this.units,"units"),this.activation=Ta(e.activation),null!=e.useBias&&(this.useBias=e.useBias),this.kernelInitializer=Nr(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=Nr(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=fs(e.kernelConstraint),this.biasConstraint=fs(e.biasConstraint),this.kernelRegularizer=Ca(e.kernelRegularizer),this.biasRegularizer=Ca(e.biasRegularizer),this.activityRegularizer=Ca(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){const t=(e=Pr(e))[e.length-1];null==this.kernel&&(this.kernel=this.addWeight("kernel",[t,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:{[-1]:t}}],this.built=!0}computeOutputShape(e){const t=(e=Pr(e)).slice();return t[t.length-1]=this.units,t}call(e,t){return(0,N.tidy)(()=>{this.invokeCallHook(e,t);const n=Lr(e),i=Ei(this.activation.getClassName());let r;return null!=i?r=sr(n,this.kernel.read(),i,this.bias?this.bias.read():null):(r=sr(n,this.kernel.read()),null!=this.bias&&(r=ur(r,this.bias.read())),null!=this.activation&&(r=this.activation.apply(r))),r})}getConfig(){const e={units:this.units,activation:va(this.activation),useBias:this.useBias,kernelInitializer:kr(this.kernelInitializer),biasInitializer:kr(this.biasInitializer),kernelRegularizer:Aa(this.kernelRegularizer),biasRegularizer:Aa(this.biasRegularizer),activityRegularizer:Aa(this.activityRegularizer),kernelConstraint:hs(this.kernelConstraint),biasConstraint:hs(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}vl.className="Dense",N.serialization.registerClass(vl);class bl extends Xr{constructor(e){super(e=e||{}),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=Pr(e);for(const t of e.slice(1))if(null==t)throw new ti(`The shape of the input to "Flatten" is not fully defined (got ${e.slice(1)}). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.`);return[e[0],Yi(e,1)]}call(e,t){return(0,N.tidy)(()=>{this.invokeCallHook(e,t);let n=Lr(e);if("channelsFirst"===this.dataFormat&&n.rank>1){const e=[0];for(let t=2;t<n.rank;++t)e.push(t);e.push(1),n=(0,N.transpose)(n,e)}return function(e){if(e.rank<=1)throw new ti(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);const t=[e.shape[0],Yi(e.shape,1)];return N.reshape(e,t)}(n)})}getConfig(){const e={};null!=this.dataFormat&&(e.dataFormat=this.dataFormat);const t=super.getConfig();return Object.assign(e,t),e}}bl.className="Flatten",N.serialization.registerClass(bl);class Tl extends Xr{constructor(e){super(e),this.supportsMasking=!0,this.activation=Ta(e.activation)}call(e,t){return(0,N.tidy)(()=>{this.invokeCallHook(e,t);const n=Lr(e);return this.activation.apply(n)})}getConfig(){const e={activation:va(this.activation)},t=super.getConfig();return Object.assign(e,t),e}}Tl.className="Activation",N.serialization.registerClass(Tl);class xl extends Xr{constructor(e){super(e),this.n=e.n,this.inputSpec=[{ndim:2}]}computeOutputShape(e){return[e[0],this.n,e[1]]}call(e,t){return(0,N.tidy)(()=>{return e=Lr(e),t=e,n=this.n,(0,N.tidy)(()=>{if(2!==t.shape.length)throw new ti(`repeat() expects a rank-2 tensor, but received a rank-${t.shape.length} tensor.`);return ir(Zi(t,1),[1,n,1])});var t,n})}getConfig(){const e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}}xl.className="RepeatVector",N.serialization.registerClass(xl);class El extends Xr{constructor(e){super(e),this.targetShape=e.targetShape;for(let e=0;e<this.targetShape.length;++e)this.isUnknown(this.targetShape[e])&&(this.targetShape[e]=null)}isUnknown(e){return e<0||null==e}fixUnknownDimension(e,t){const n="Total size of new array must be unchanged.",i=t.slice();let r=1,s=null;for(let e=0;e<i.length;++e){const t=i[e];if(this.isUnknown(t)){if(null!==s)throw new ti("Can only specifiy one unknown dimension.");s=e}else r*=t}const o=Yi(e);if(null!==s){if(0===r||o%r!==0)throw new ti(n);i[s]=o/r}else if(o!==r)throw new ti(n);return i}computeOutputShape(e){let t=!1;for(let n=0;n<e.length;++n)if(this.isUnknown(e[n])){t=!0;break}return t?e.slice(0,1).concat(this.targetShape):e.slice(0,1).concat(this.fixUnknownDimension(e.slice(1),this.targetShape))}call(e,t){return(0,N.tidy)(()=>{this.invokeCallHook(e,t);const n=Lr(e),i=n.shape,r=i.slice(0,1).concat(this.fixUnknownDimension(i.slice(1),this.targetShape));return(0,N.reshape)(n,r)})}getConfig(){const e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}}El.className="Reshape",N.serialization.registerClass(El);class wl extends Xr{constructor(e){if(super(e),null==e.dims)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error(`Permute constructor requires \`dims\` to be an Array, but received ${e.dims} instead.`);const t=Wi(1,e.dims.length+1);if(!N.util.arraysEqual(e.dims.slice().sort(),t))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");this.dims=e.dims,this.dimsIncludingBatch=[0].concat(this.dims),this.inputSpec=[new jr({ndim:this.dims.length+1})]}computeOutputShape(e){const t=(e=Pr(e)).slice();return this.dims.forEach((n,i)=>{t[i+1]=e[n]}),t}call(e,t){return(0,N.transpose)(Lr(e),this.dimsIncludingBatch)}getConfig(){const e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}}wl.className="Permute",N.serialization.registerClass(wl);class Il extends Xr{constructor(e){super(null==e?{}:e),this.supportsMasking=!0,this.maskValue=null!=e?null==e.maskValue?0:e.maskValue:0}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={maskValue:this.maskValue};return Object.assign(t,e),t}computeMask(e,t){const n=Lr(e);return(0,N.any)((0,N.notEqual)(n,this.maskValue),-1)}call(e,t){return(0,N.tidy)(()=>{this.invokeCallHook(e,t);const n=Lr(e),i=(0,N.any)((0,N.notEqual)(n,this.maskValue),-1,!0);return(0,N.mul)(n,(0,N.cast)(i,n.dtype))})}}Il.className="Masking",N.serialization.registerClass(Il);
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class Al extends Xr{constructor(e){if(super(e),this.embeddings=null,this.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",null==e.batchInputShape&&null==e.inputShape){let t=null;null!=e.batchSize&&(t=e.batchSize),null==e.inputLength?this.batchInputShape=[t,null]:this.batchInputShape=[t].concat(ui(e.inputLength))}this.inputDim=e.inputDim,Ti(this.inputDim,"inputDim"),this.outputDim=e.outputDim,Ti(this.outputDim,"outputDim"),this.embeddingsInitializer=Nr(e.embeddingsInitializer||this.DEFAULT_EMBEDDINGS_INITIALIZER),this.embeddingsRegularizer=Ca(e.embeddingsRegularizer),this.activityRegularizer=Ca(e.activityRegularizer),this.embeddingsConstraint=fs(e.embeddingsConstraint),this.maskZero=e.maskZero,this.supportsMasking=e.maskZero,this.inputLength=e.inputLength}build(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0}warnOnIncompatibleInputShape(e){}computeMask(e,t){return(0,N.tidy)(()=>this.maskZero?(e=Lr(e),(0,N.notEqual)(e,(0,N.zerosLike)(e))):null)}computeOutputShape(e){if(e=Pr(e),null==this.inputLength)return[...e,this.outputDim];const t=ui(this.inputLength);if(t.length!==e.length-1)throw new ti(`"inputLength" is ${this.inputLength}, but received input shape has shape ${e}`);{let n=0;for(let i=0;i<t.length;++i){const r=t[i],s=e[i+1];if(null!=r&&null!=s&&r!==s)throw new ti(`"inputLength" is ${this.inputLength}, but received input shape has shape ${e}`);null==r&&(t[n]=s),n++}}return[e[0],...t,this.outputDim]}call(e,t){return(0,N.tidy)(()=>{this.invokeCallHook(e,t);let n=Lr(e);"int32"!==n.dtype&&(n=Ki(n,"int32"));const i=or(this.embeddings.read(),(0,N.reshape)(n,[n.size]));return(0,N.reshape)(i,Pr(this.computeOutputShape(n.shape)))})}getConfig(){const e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:kr(this.embeddingsInitializer),embeddingsRegularizer:Aa(this.embeddingsRegularizer),activityRegularizer:Aa(this.activityRegularizer),embeddingsConstraint:hs(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},t=super.getConfig();return Object.assign(e,t),e}}Al.className="Embedding",N.serialization.registerClass(Al);
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class Sl extends Xr{constructor(e){super(e||{}),this.supportsMasking=!0}mergeFunction(e){throw new ni}computeElementwiseOpOutputShape(e,t){if(null==e||null==t)return null;if(e.length<t.length)return this.computeElementwiseOpOutputShape(t,e);if(0===t.length)return e;const n=e.slice(0,e.length-t.length);for(let i=0;i<t.length;++i){const r=e[e.length-t.length+i],s=t[i];if(null==r||null==s||r<0||s<0)n.push(null);else if(1===r)n.push(s);else if(1===s)n.push(r);else{if(r!==s)throw new ti("Operands could not be broadcast together with shapes "+JSON.stringify(e)+" "+JSON.stringify(t));n.push(r)}}return n}build(e){if(Array.isArray(e)&&!Array.isArray(e[0])&&(e=[Pr(e)]),e.length<2)throw new ti(`A merge layer should be called on an Array of at least 2 inputs. Got ${e.length} input(s).`);let t=[];for(const n of e)null!=n&&null!==n[0]&&t.push(n[0]);if(t=yi(t),t.length>1)throw new ti(`Can not merge tensors with different batch sizes. Got tensors with shapes: ${JSON.stringify(e)}.`);let n=null==e[0]?null:e[0].slice(1);for(let t=1;t<e.length;++t){const i=null==e[t]?null:e[t].slice(1);n=this.computeElementwiseOpOutputShape(n,i)}const i=e.map(e=>e.length);-1===e.indexOf(null)&&1===yi(i).length?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return(0,N.tidy)(()=>{if(this.reshapeRequired){const t=[],n=e.map(e=>e.rank);if(-1===n.indexOf(null)){const i=Hi(n);for(let n of e){const e=n.rank;for(let t=0;t<i-e;++t)n=Zi(n,1);t.push(n)}return this.mergeFunction(t)}{let n=!1;for(const i of e){const e=i.rank;if(null==e){const e=i.shape,r=e[0],s=e.slice(1).concat([r]);let o=N.reshape(i,[r].concat(Yi(e.slice(1))));o=N.transpose(o,[1,0]),o=N.reshape(o,s),t.push(o),n=!0}else if(e>1){const r=Wi(1,e).concat([0]);t.push(N.transpose(i,r)),n=!0}else t.push(i)}let i=this.mergeFunction(t);const r=i.rank;if(n)if(null==r){const e=i.shape,t=e[e.length-1],n=[t].concat(e.slice(0,e.length-1));i=N.reshape(N.transpose(N.reshape(i,[-1,t]),[1,0]),n)}else if(r>1){const e=[r-1].concat(Wi(0,r-1));i=N.transpose(i,e)}return i}}return this.mergeFunction(e)})}computeOutputShape(e){let t;t=null==e[0]?null:e[0].slice(1);for(let n=1;n<e.length;++n){const i=null==e[n]?null:e[n].slice(1);t=this.computeElementwiseOpOutputShape(t,i)}let n=[];for(const t of e)null!=t&&null!==t[0]&&n.push(t[0]);return n=yi(n),t=1===n.length?n.concat(t):[null].concat(t),t}computeMask(e,t){return N.tidy(()=>{if(null==t)return null;if(!Array.isArray(t))throw new ti("`mask` should be an Array");if(!Array.isArray(e))throw new ti("`inputs` should be an Array");if(t.length!==e.length)throw new ti(`The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths (${e.length} vs ${t.length})`);if(t.every(e=>null==e))return null;let n=(t=t.map(e=>null==e?e:N.expandDims(e,0)))[0];for(let e=1;e<t.length-1;++e)n=N.logicalAnd(n,t[e]);return n})}}class Cl extends Sl{constructor(e){super(e)}mergeFunction(e){return(0,N.tidy)(()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=N.add(t,e[n]);return t})}}Cl.className="Add",N.serialization.registerClass(Cl);class Ol extends Sl{constructor(e){super(e)}mergeFunction(e){return(0,N.tidy)(()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=N.mul(t,e[n]);return t})}}Ol.className="Multiply",N.serialization.registerClass(Ol);class Ml extends Sl{constructor(e){super(e)}mergeFunction(e){return(0,N.tidy)(()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=N.add(t,e[n]);return N.mul(1/e.length,t)})}}Ml.className="Average",N.serialization.registerClass(Ml);class Rl extends Sl{constructor(e){super(e)}mergeFunction(e){return(0,N.tidy)(()=>{let t=e[0];for(let n=1;n<e.length;++n)t=N.maximum(t,e[n]);return t})}}Rl.className="Maximum",N.serialization.registerClass(Rl);class kl extends Sl{constructor(e){super(e)}mergeFunction(e){return(0,N.tidy)(()=>{let t=e[0];for(let n=1;n<e.length;++n)t=N.minimum(t,e[n]);return t})}}kl.className="Minimum",N.serialization.registerClass(kl);class Nl extends Sl{constructor(e){super(e),this.DEFAULT_AXIS=-1,null==e&&(e={}),this.axis=null==e.axis?this.DEFAULT_AXIS:e.axis,this.supportsMasking=!0,this.reshapeRequired=!1}build(e){if(!Array.isArray(e)||!Array.isArray(e[0])||1===e.length)throw new ti("A `Concatenate` layer should be called on a list of at least 2 inputs");let t=!0;for(const n of e)if(null!=n){t=!1;break}if(t)return;const n=[];for(let t=0;t<e.length;++t){const i=e[t].slice();i.splice(this.axis,1);let r=!1;for(const e of n)if(N.util.arraysEqual(e,i)){r=!0;break}r||n.push(i)}if(n.length>1)throw new ti("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return(0,N.tidy)(()=>tr(e,this.axis))}computeOutputShape(e){if(!Array.isArray(e)||!Array.isArray(e[0]))throw new ti("A `Concatenate` layer should be called on a list of inputs.");const t=e,n=t[0].slice(),i=this.axis<0?n.length+this.axis:this.axis;for(const e of t.slice(1)){if(null==n[i]||null==e[i]){n[i]=null;break}n[i]+=e[i]}return n}computeMask(e,t){if(null==t)return null;if(!Array.isArray(t))throw new ti("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new ti("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new ti(`Mismatch in the length of mask (${t.length}) and the legnth of inputs (${e.length})`);return N.tidy(()=>{let n=!0;if(t.forEach(e=>{null==e||(n=!1)}),n)return null;const i=[];for(let n=0;n<e.length;++n)null==t[n]?i.push(N.cast(N.onesLike(e[n]),"bool")):t[n].rank<e[n].rank?i.push(N.expandDims(t[n],-1)):i.push(t[n]);const r=N.concat(i,this.axis);return N.all(r,-1,!1)})}getConfig(){const e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}}function Dl(e,t){for(;e<0;)e+=t;return e}Nl.className="Concatenate",N.serialization.registerClass(Nl);class Fl extends Sl{constructor(e){super(e),this.axes=e.axes,this.normalize=null!=e.normalize&&e.normalize,this.supportsMasking=!0,this.reshapeRequired=!1}build(e){N.util.assert(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&Array.isArray(e[1]),()=>"A `Dot` layer should be called on a list of exactly 2 inputs.");const t=e[0],n=e[1];if(t.length>3||n.length>3)throw new ni("Dot layer does not support tensors of 4D or higher rank yet.");const i=this.interpretAxes(t,n);if(t[i[0]]!==n[i[1]])throw new ti(`Dimension incompatibility: ${t[i[0]]} !== ${n[i[1]]}`)}mergeFunction(e){if(2!==e.length)throw new ti(`A \`Dot\` layer must be called on exactly 2 inputs, but received ${e.length} input(s).`);let t,n=e[0],i=e[1];return t=Array.isArray(this.axes)?this.axes.map((t,n)=>Dl(t,e[n].shape.length)):[Dl(this.axes,n.shape.length),Dl(this.axes,i.shape.length)],this.normalize&&(n=Hs(n,t[0]),i=Hs(i,t[1])),function(e,t,n){if(e.shape.length>3||t.shape.length>3)throw new ni("batchDot is not implemented for tensors of 4D or higher rank yet");if(N.util.assert(e.shape.length>=2,()=>`batchDot requires the rank of x to be >= 2, but got ${e.shape.length}`),N.util.assert(e.shape.length>=2,()=>`batchDot requires the rank of y to be >= 2, but got ${t.shape.length}`),"number"==typeof n&&(n=[n,n]),"complex64"===e.dtype||"complex64"===t.dtype)throw new ni("batchDot is not implemented for complex64-type Tensors yet.");const i=e.shape.length,r=t.shape.length;null==n&&(n=[i-1,r-2]);const s=n;return N.tidy(()=>{let n,o;if(i>r){n=i-r;const e=[];for(let t=0;t<n;++t)e.push(1);t=N.reshape(t,t.shape.concat(e))}else if(r>i){n=r-i;const t=[];for(let e=0;e<n;++e)t.push(1);e=N.reshape(e,e.shape.concat(t))}else n=0;if(2===e.shape.length&&2===t.shape.length)o=s[0]===s[1]?N.sum(N.mul(e,t),s[0]):N.sum(N.mul(N.transpose(e,[1,0]),t),s[1]);else{const n=s[0]!==e.shape.length-1,i=s[1]===t.shape.length-1;o=N.matMul(e,t,n,i)}if(n>0){let e;e=i>r?i+r-3:i-1;const t=[];for(let i=e;i<e+n;++i)t.push(i);o=N.squeeze(o,t)}return 1===o.shape.length&&(o=N.expandDims(o,1)),o})}(n,i,t)}interpretAxes(e,t){let n;return n=Array.isArray(this.axes)?this.axes:[Dl(this.axes,e.length),Dl(this.axes,t.length)],n}computeOutputShape(e){N.util.assert(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&Array.isArray(e[1]),()=>"A `Dot` layer should be called on a list of exactly 2 inputs.");const t=e[0].slice(),n=e[1].slice();if(t.length>3||n.length>3)throw new ni("Dot layer does not support tensors of 4D or higher rank yet.");const i=this.interpretAxes(t,n);t.splice(i[0],1),n.splice(i[1],1),n.splice(0,1);const r=t.concat(n);return 1===r.length&&r.push(1),r}computeMask(e,t){return null}getConfig(){const e={axes:this.axes,normalize:this.normalize},t=super.getConfig();return Object.assign(e,t),e}}Fl.className="Dot",N.serialization.registerClass(Fl);
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class Ll extends Xr{constructor(e){super(e),this.supportsMasking=!0,this.stddev=e.stddev}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={stddev:this.stddev};return Object.assign(t,e),t}call(e,t){return(0,N.tidy)(()=>{this.invokeCallHook(e,t);const n=Lr(e);return dr(()=>(0,N.add)(rr(n.shape,0,this.stddev),n),()=>n,t.training||!1)})}}Ll.className="GaussianNoise",N.serialization.registerClass(Ll);class Pl extends Xr{constructor(e){super(e),this.supportsMasking=!0,this.rate=e.rate}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return(0,N.tidy)(()=>{this.invokeCallHook(e,t);const n=Lr(e);if(this.rate>0&&this.rate<1){return dr(()=>{const e=Math.sqrt(this.rate/(1-this.rate));return(0,N.mul)(n,rr(n.shape,1,e))},()=>n,t.training||!1)}return n})}}Pl.className="GaussianDropout",N.serialization.registerClass(Pl);class Bl extends Xr{constructor(e){super(e),this.supportsMasking=!0,this.rate=e.rate,this.noiseShape=e.noiseShape}_getNoiseShape(e){return this.noiseShape||Lr(e).shape}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return(0,N.tidy)(()=>{if(this.rate<1&&this.rate>0){const n=this._getNoiseShape(e),i=()=>{const t=Lr(e),i=-1.7580993408473766;let r=(0,N.greaterEqual)((0,N.randomUniform)(n),this.rate);r=Ki(r,"float32");const s=((1-this.rate)*(1+this.rate*i**2))**-.5,o=-s*i*this.rate,a=(0,N.add)((0,N.mul)(t,r),(0,N.mul)((0,N.add)(r,-1),i));return(0,N.add)((0,N.mul)(a,s),o)};return dr(i,()=>Lr(e),t.training||!1)}return e})}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function $l(e,t,n,i,r,s=.001){let o;if(2===e.rank)o=N.batchNorm2d(e,t,n,i,r,s);else if(3===e.rank)o=N.batchNorm3d(e,t,n,i,r,s);else{if(4!==e.rank)throw new ni(`batchNormalization is not implemented for array of rank ${e.rank} yet`);o=N.batchNorm4d(e,t,n,i,r,s)}return o}function Ul(e,t,n,i,r=.001){return N.util.arraysEqual(i.slice().sort(),Wi(0,e.rank-1))?function(e,t,n,i,r=.001){return(0,N.tidy)(()=>{const s=N.moments(e,i),o=s.mean,a=s.variance;return[$l(e,o,a,n,t,r),o,a]})}(e,t,n,i,r):function(e,t,n,i,r=.001){return(0,N.tidy)(()=>{const s=N.moments(e,i),o=s.mean,a=s.variance,l=[];for(const t of Wi(0,e.rank))-1!==i.indexOf(t)?l.push(1):l.push(e.shape[t]);const u=(0,N.reshape)(o,l),c=(0,N.reshape)(a,l),d=null==t?null:(0,N.reshape)(t,l),h=null==n?null:(0,N.reshape)(n,l);return[$l(e,u,c,h,d,r),o,a]})}(e,t,n,i,r)}Bl.className="AlphaDropout",N.serialization.registerClass(Bl);class zl extends Xr{constructor(e){null==e&&(e={}),super(e),this.supportsMasking=!0,this.axis=null==e.axis?-1:e.axis,this.momentum=null==e.momentum?.99:e.momentum,this.epsilon=null==e.epsilon?.001:e.epsilon,this.center=null==e.center||e.center,this.scale=null==e.scale||e.scale,this.betaInitializer=Nr(e.betaInitializer||"zeros"),this.gammaInitializer=Nr(e.gammaInitializer||"ones"),this.movingMeanInitializer=Nr(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=Nr(e.movingVarianceInitializer||"ones"),this.betaConstraint=fs(e.betaConstraint),this.gammaConstraint=fs(e.gammaConstraint),this.betaRegularizer=Ca(e.betaRegularizer),this.gammaRegularizer=Ca(e.gammaRegularizer)}build(e){e=Pr(e);const t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(null==n)throw new ti(`Axis ${t} of input tensor should have a defined dimension but the layer received an input with shape ${JSON.stringify(e)}.`);this.inputSpec=[new jr({ndim:e.length,axes:{[t]:n}})];const i=[n];this.scale&&(this.gamma=this.addWeight("gamma",i,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",i,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",i,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",i,null,this.movingVarianceInitializer,null,!1),this.built=!0}call(e,t){return(0,N.tidy)(()=>{const n=null!=t.training&&t.training,i=Lr(e),r=i.shape,s=r.length,o=Wi(0,s),a=this.axis>=0?this.axis:this.axis+s;o.splice(a,1);const l=si(1,s);l[a]=r[a];const u=o.slice();u.sort();const c=!N.util.arraysEqual(u,Wi(0,s).slice(0,s-1));if(!n)return(()=>{if(c){const e=(0,N.reshape)(this.movingMean.read(),l),t=(0,N.reshape)(this.movingVariance.read(),l),n=this.center?(0,N.reshape)(this.beta.read(),l):null,r=this.scale?(0,N.reshape)(this.gamma.read(),l):null;return $l(i,e,t,n,r,this.epsilon)}return $l(i,this.movingMean.read(),this.movingVariance.read(),null==this.beta?null:this.beta.read(),null==this.gamma?null:this.gamma.read(),this.epsilon)})();const[d,h,p]=Ul(i,this.gamma.read(),this.beta.read(),o,this.epsilon),f=(e,t,n)=>{N.tidy(()=>{const i=1-n,r=e.read(),s=N.mul(N.sub(r,t),i);e.write(N.sub(r,s))})};return(()=>{f(this.movingMean,h,this.momentum),f(this.movingVariance,p,this.momentum)})(),d})}getConfig(){const e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:kr(this.betaInitializer),gammaInitializer:kr(this.gammaInitializer),movingMeanInitializer:kr(this.movingMeanInitializer),movingVarianceInitializer:kr(this.movingVarianceInitializer),betaRegularizer:Aa(this.betaRegularizer),gammaRegularizer:Aa(this.gammaRegularizer),betaConstraint:hs(this.betaConstraint),gammaConstraint:hs(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}}zl.className="BatchNormalization",N.serialization.registerClass(zl);class Vl extends Xr{constructor(e){if(null==e&&(e={}),super(e),this.axis=null==e.axis?-1:e.axis,"number"==typeof this.axis){if(!Number.isInteger(this.axis))throw new Error(`Expected axis to be an integer, but received ${this.axis}`)}else{if(!Array.isArray(this.axis))throw new Error(`Expected axis to be an integer or an array of integers, but received ${JSON.stringify(this.axis)}`);for(const e of this.axis)if(!Number.isInteger(e))throw new Error(`Expected axis to be an array of integers, but received ${JSON.stringify(this.axis)}`)}this.epsilon=null==e.epsilon?.001:e.epsilon,this.center=null==e.center||e.center,this.scale=null==e.scale||e.scale,this.betaInitializer=Nr(e.betaInitializer||"zeros"),this.gammaInitializer=Nr(e.gammaInitializer||"ones"),this.betaRegularizer=Ca(e.betaRegularizer),this.gammaRegularizer=Ca(e.gammaRegularizer),this.supportsMasking=!0}build(e){const t=(e=Pr(e)).length;"number"==typeof this.axis&&(this.axis=[this.axis]);for(let e=0;e<this.axis.length;++e)this.axis[e]<0&&(this.axis[e]+=t);for(const e of this.axis)if(e<0||e>=t)throw new Error(`Invalid axis: ${e}`);if(this.axis.length!==yi(this.axis).length)throw new Error(`Found duplicate axes in: ${this.axis}`);const n=this.axis.map(t=>e[t]),i=!0;this.scale?this.gamma=this.addWeight("gamma",n,"float32",this.gammaInitializer,this.gammaRegularizer,i):this.gamma=null,this.center?this.beta=this.addWeight("beta",n,"float32",this.betaInitializer,this.betaRegularizer,i):this.beta=null,this.built=!0}call(e,t){const n=Lr(e),i=n.shape,r=i.length;return(0,N.tidy)(()=>{let{mean:e,variance:t}=(0,N.moments)(n,this.axis,!0);const s=si(1,r);for(const e of this.axis)s[e]=i[e];const o=e=>null!=e&&e.shape.length!==r?N.reshape(e,s):e;let a=this.scale?o(this.gamma.read()):null,l=this.center?o(this.beta.read()):null;const u=[],c=[];for(let e=0;e<r;++e)-1!==this.axis.indexOf(e)?(u.push(i[e]),c.push(1)):(u.push(1),c.push(i[e]));return e=N.tile(e,u),t=N.tile(t,u),null!=a&&(a=N.tile(a,c)),null!=l&&(l=N.tile(l,c)),$l(n,e,t,l,a,this.epsilon)})}getConfig(){const e={axis:this.axis,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:kr(this.betaInitializer),gammaInitializer:kr(this.gammaInitializer),betaRegularizer:Aa(this.betaRegularizer),gammaRegularizer:Aa(this.gammaRegularizer)},t=super.getConfig();return Object.assign(e,t),e}}Vl.className="LayerNormalization",N.serialization.registerClass(Vl);class jl extends Xr{constructor(e){if(null==e&&(e={}),super(e),this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,null==e.padding)this.padding=[[1,1],[1,1]];else if("number"==typeof e.padding)this.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,2!==e.padding.length)throw new ti(`ZeroPadding2D expects padding to be a length-2 array, but received a length-${e.padding.length} array.`);let t,n;if("number"==typeof e.padding[0])t=[e.padding[0],e.padding[0]],n=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,2!==e.padding[0].length)throw new ti(`ZeroPadding2D expects height padding to be a length-2 array, but received a length-${e.padding[0].length} array.`);if(t=e.padding[0],2!==e.padding[1].length)throw new ti(`ZeroPadding2D expects width padding to be a length-2 array, but received a length-${e.padding[1].length} array.`);n=e.padding[1]}this.padding=[t,n]}this.inputSpec=[new jr({ndim:4})]}computeOutputShape(e){let t,n;return e=Pr(e),"channelsFirst"===this.dataFormat?(t=null!=e[2]&&e[2]>=0?e[2]+this.padding[0][0]+this.padding[0][1]:null,n=null!=e[3]&&e[3]>=0?e[3]+this.padding[1][0]+this.padding[1][1]:null,[e[0],e[1],t,n]):(t=null!=e[1]&&e[1]>=0?e[1]+this.padding[0][0]+this.padding[0][1]:null,n=null!=e[2]&&e[2]>=0?e[2]+this.padding[1][0]+this.padding[1][1]:null,[e[0],t,n,e[3]])}call(e,t){return(0,N.tidy)(()=>{return t=Lr(e),n=this.padding,i=this.dataFormat,(0,N.tidy)(()=>{if(4!==t.rank)throw new ti(`temporalPadding expects input tensor to be 4-D, but received a ${t.rank}-D tensor.`);if(null==n&&(n=[[1,1],[1,1]]),2!==n.length||2!==n[0].length||2!==n[1].length)throw new ti("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(null==i&&(i="channelsLast"),"channelsLast"!==i&&"channelsFirst"!==i)throw new ti(`Unknown data format: ${i}. Supported data formats are 'channelsLast' and 'channelsFirst.`);let e;return e="channelsFirst"===i?[[0,0],[0,0],n[0],n[1]]:[[0,0],n[0],n[1],[0,0]],N.pad(t,e)});var t,n,i})}getConfig(){const e={padding:this.padding,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Yl(e,t,n,i,r,s){return(0,N.tidy)(()=>{let o;Di(r),Li(s),Fi(i),null==n&&(n=[1,1]),null==i&&(i="valid"),null==r&&(r="channelsLast"),null==s&&(s="max"),e=Ba(e,r);const a="same"===i?"same":"valid";return o="max"===s?N.maxPool(e,t,n,a):N.avgPool(e,t,n,a),"channelsFirst"===r&&(o=N.transpose(o,[0,3,1,2])),o})}function Gl(e,t,n,i,r,s){return(0,N.tidy)(()=>{let o;Di(r),Li(s),Fi(i),null==n&&(n=[1,1,1]),null==i&&(i="valid"),null==r&&(r="channelsLast"),null==s&&(s="max"),e=$a(e,r);const a="same"===i?"same":"valid";return o="max"===s?N.maxPool3d(e,t,n,a):N.avgPool3d(e,t,n,a),"channelsFirst"===r&&(o=N.transpose(o,[0,4,1,2,3])),o})}jl.className="ZeroPadding2D",N.serialization.registerClass(jl);class Hl extends Xr{constructor(e){if(null==e.poolSize&&(e.poolSize=2),super(e),"number"==typeof e.poolSize)this.poolSize=[e.poolSize];else{if(!Array.isArray(e.poolSize)||1!==e.poolSize.length||"number"!=typeof e.poolSize[0])throw new ti(`poolSize for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.poolSize)}`);this.poolSize=e.poolSize}if(Ti(this.poolSize,"poolSize"),null==e.strides)this.strides=this.poolSize;else if("number"==typeof e.strides)this.strides=[e.strides];else{if(!Array.isArray(e.strides)||1!==e.strides.length||"number"!=typeof e.strides[0])throw new ti(`strides for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.strides)}`);this.strides=e.strides}Ti(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,Fi(this.padding),this.inputSpec=[new jr({ndim:3})]}computeOutputShape(e){const t=La((e=Pr(e))[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return(0,N.tidy)(()=>{this.invokeCallHook(e,t),e=Zi(Lr(e),2);const n=this.poolingFunction(Lr(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return N.squeeze(n,[2])})}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}}class Wl extends Hl{constructor(e){super(e)}poolingFunction(e,t,n,i,r){return Di(r),Fi(i),Yl(e,t,n,i,r,"max")}}Wl.className="MaxPooling1D",N.serialization.registerClass(Wl);class Xl extends Hl{constructor(e){super(e)}poolingFunction(e,t,n,i,r){return Di(r),Fi(i),Yl(e,t,n,i,r,"avg")}}Xl.className="AveragePooling1D",N.serialization.registerClass(Xl);class ql extends Xr{constructor(e){if(null==e.poolSize&&(e.poolSize=[2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],null==e.strides)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(2!==e.strides.length)throw new ti(`If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides];Ti(this.poolSize,"poolSize"),Ti(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,Di(this.dataFormat),Fi(this.padding),this.inputSpec=[new jr({ndim:4})]}computeOutputShape(e){e=Pr(e);let t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2];return t=La(t,this.poolSize[0],this.padding,this.strides[0]),n=La(n,this.poolSize[1],this.padding,this.strides[1]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,n]:[e[0],t,n,e[3]]}call(e,t){return(0,N.tidy)(()=>(this.invokeCallHook(e,t),this.poolingFunction(Lr(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class Kl extends ql{constructor(e){super(e)}poolingFunction(e,t,n,i,r){return Di(r),Fi(i),Yl(e,t,n,i,r,"max")}}Kl.className="MaxPooling2D",N.serialization.registerClass(Kl);class Zl extends ql{constructor(e){super(e)}poolingFunction(e,t,n,i,r){return Di(r),Fi(i),Yl(e,t,n,i,r,"avg")}}Zl.className="AveragePooling2D",N.serialization.registerClass(Zl);class Ql extends Xr{constructor(e){if(null==e.poolSize&&(e.poolSize=[2,2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],null==e.strides)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(3!==e.strides.length)throw new ti(`If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides,e.strides];Ti(this.poolSize,"poolSize"),Ti(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,Di(this.dataFormat),Fi(this.padding),this.inputSpec=[new jr({ndim:5})]}computeOutputShape(e){e=Pr(e);let t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2],i="channelsFirst"===this.dataFormat?e[4]:e[3];return t=La(t,this.poolSize[0],this.padding,this.strides[0]),n=La(n,this.poolSize[1],this.padding,this.strides[1]),i=La(i,this.poolSize[2],this.padding,this.strides[2]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,n,i]:[e[0],t,n,i,e[4]]}call(e,t){return(0,N.tidy)(()=>(this.invokeCallHook(e,t),this.poolingFunction(Lr(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class Jl extends Ql{constructor(e){super(e)}poolingFunction(e,t,n,i,r){return Di(r),Fi(i),Gl(e,t,n,i,r,"max")}}Jl.className="MaxPooling3D",N.serialization.registerClass(Jl);class eu extends Ql{constructor(e){super(e)}poolingFunction(e,t,n,i,r){return Di(r),Fi(i),Gl(e,t,n,i,r,"avg")}}eu.className="AveragePooling3D",N.serialization.registerClass(eu);class tu extends Xr{constructor(e){super(e),this.inputSpec=[new jr({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new ni}}class nu extends tu{constructor(e){super(e||{})}call(e,t){return(0,N.tidy)(()=>{const t=Lr(e);return N.mean(t,1)})}}nu.className="GlobalAveragePooling1D",N.serialization.registerClass(nu);class iu extends tu{constructor(e){super(e||{})}call(e,t){return(0,N.tidy)(()=>{const t=Lr(e);return N.max(t,1)})}}iu.className="GlobalMaxPooling1D",N.serialization.registerClass(iu);class ru extends Xr{constructor(e){super(e),this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,Di(this.dataFormat),this.inputSpec=[new jr({ndim:4})]}computeOutputShape(e){return"channelsLast"===this.dataFormat?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new ni}getConfig(){const e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class su extends ru{call(e,t){return(0,N.tidy)(()=>{const t=Lr(e);return"channelsLast"===this.dataFormat?N.mean(t,[1,2]):N.mean(t,[2,3])})}}su.className="GlobalAveragePooling2D",N.serialization.registerClass(su);class ou extends ru{call(e,t){return(0,N.tidy)(()=>{const t=Lr(e);return"channelsLast"===this.dataFormat?N.max(t,[1,2]):N.max(t,[2,3])})}}ou.className="GlobalMaxPooling2D",N.serialization.registerClass(ou);
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class au extends Xr{constructor(e){super(e),this.layer=e.layer}build(e){this.built=!0}get trainable(){return null!=this.layer&&this.layer.trainable}set trainable(e){null!=this.layer&&(this.layer.trainable=e)}get trainableWeights(){return this.layer.trainableWeights}get nonTrainableWeights(){return this.layer.nonTrainableWeights}get updates(){return this.layer._updates}get losses(){return this.layer.losses}getWeights(){return this.layer.getWeights()}setWeights(e){this.layer.setWeights(e)}getConfig(){const e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=super.getConfig();return Object.assign(e,t),e}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),null!=this.layer&&this.layer.setFastWeightInitDuringBuild(e)}static fromConfig(e,t,n={}){const i=Gs(t.layer,n);delete t.layer;const r={layer:i};return Object.assign(r,t),new e(r)}}class lu extends au{constructor(e){super(e),this.supportsMasking=!0}build(e){if((e=Pr(e)).length<3)throw new ti(`TimeDistributed layer expects an input shape >= 3D, but received input shape ${JSON.stringify(e)}`);this.inputSpec=[{shape:e}];const t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),super.build(e)}computeOutputShape(e){const t=[(e=Pr(e))[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),i=e[1];return[n[0],i].concat(n.slice(1))}call(e,t){return(0,N.tidy)(()=>nl((e,n)=>[Lr(this.layer.call(e,t)),[]],e=Lr(e),[],!1,null,null,!1,!0)[1])}}lu.className="TimeDistributed",N.serialization.registerClass(lu);class uu extends au{constructor(e){super(e);const t=e.layer.getConfig(),n={};n.className=e.layer.getClassName(),n.config=t,this.forwardLayer=Gs(n),t.goBackwards=!0!==t.goBackwards;const i={};var r;if(i.className=e.layer.getClassName(),i.config=t,this.backwardLayer=Gs(i),this.forwardLayer.name="forward_"+this.forwardLayer.name,this.backwardLayer.name="backward_"+this.backwardLayer.name,this.mergeMode=void 0===e.mergeMode?"concat":e.mergeMode,r=this.mergeMode,vi(ki,"BidirectionalMergeMode",r),e.weights)throw new ni("weights support is not implemented for Bidirectional layer yet.");this._stateful=e.layer.stateful,this.returnSequences=e.layer.returnSequences,this.returnState=e.layer.returnState,this.supportsMasking=!0,this._trainable=!0,this.inputSpec=e.layer.inputSpec,this.numConstants=null}get trainable(){return this._trainable}set trainable(e){this._trainable=e,null!=this.forwardLayer&&(this.forwardLayer.trainable=e),null!=this.backwardLayer&&(this.backwardLayer.trainable=e)}getWeights(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}setWeights(e){const t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))}computeOutputShape(e){let t,n,i,r=this.forwardLayer.computeOutputShape(e);return Array.isArray(r)&&Array.isArray(r[0])||(r=[r]),this.returnState?(i=r.slice(1),t=r[0]):t=r[0],"concat"===this.mergeMode?(t[t.length-1]*=2,n=[t]):n=null==this.mergeMode?[t,t.slice()]:[t],this.returnState?null==this.mergeMode?n.concat(i).concat(i.slice()):[t].concat(i).concat(i.slice()):li(n)}apply(e,t){let n=null==t?null:t.initialState,i=null==t?null:t.constants;null==t&&(t={});const r=tl(e,n,i,this.numConstants);if(e=r.inputs,n=r.initialState,i=r.constants,Array.isArray(e)&&(n=e.slice(1),e=e[0]),(null==n||0===n.length)&&null==i)return super.apply(e,t);const s=[],o=[];if(null!=n){const e=n.length;if(e%2>0)throw new ti("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=n,s.push(...n);const i=n.map(e=>new jr({shape:e.shape}));this.forwardLayer.stateSpec=i.slice(0,e/2),this.backwardLayer.stateSpec=i.slice(e/2),o.push(...i)}if(null!=i)throw new ni("Support for constants in Bidirectional layers is not implemented yet.");const a=s[0]instanceof Yr;for(const e of s)if(e instanceof Yr!==a)throw new ti("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(a){const n=[e].concat(s),i=this.inputSpec.concat(o),r=this.inputSpec;this.inputSpec=i;const a=super.apply(n,t);return this.inputSpec=r,a}return super.apply(e,t)}call(e,t){return(0,N.tidy)(()=>{const n=t.initialState;let i,r,s,o;if(null==n)i=this.forwardLayer.call(e,t),r=this.backwardLayer.call(e,t);else{const s=n.slice(0,n.length/2),o=n.slice(n.length/2);i=this.forwardLayer.call(e,Object.assign(t,{initialState:s})),r=this.backwardLayer.call(e,Object.assign(t,{initialState:o}))}return this.returnState&&(Array.isArray(i)&&(s=i.slice(1).concat(r.slice(1))),i=i[0],r=r[0]),this.returnSequences&&(r=N.reverse(r,1)),"concat"===this.mergeMode?o=tr([i,r]):"sum"===this.mergeMode?o=N.add(i,r):"ave"===this.mergeMode?o=N.mul(.5,N.add(i,r)):"mul"===this.mergeMode?o=N.mul(i,r):null==this.mergeMode&&(o=[i,r]),this.returnState?null==this.mergeMode?o.concat(s):[o].concat(s):o})}resetStates(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}build(e){Bi(this.forwardLayer.name,()=>{this.forwardLayer.build(e)}),Bi(this.backwardLayer.name,()=>{this.backwardLayer.build(e)}),this.built=!0}computeMask(e,t){let n;if(Array.isArray(t)&&(t=t[0]),n=this.returnSequences?null==this.mergeMode?[t,t]:t:null==this.mergeMode?[null,null]:null,this.returnState){const e=this.forwardLayer.states.map(e=>null);return Array.isArray(n)?n.concat(e).concat(e):[n].concat(e).concat(e)}return n}get trainableWeights(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}get nonTrainableWeights(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),null!=this.forwardLayer&&this.forwardLayer.setFastWeightInitDuringBuild(e),null!=this.backwardLayer&&this.backwardLayer.setFastWeightInitDuringBuild(e)}getConfig(){const e={mergeMode:this.mergeMode},t=super.getConfig();return Object.assign(e,t),e}static fromConfig(e,t){const n=Gs(t.layer);if(delete t.layer,null!=t.numConstants)throw new ni("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");const i=t;return i.layer=n,new e(i)}}uu.className="Bidirectional",N.serialization.registerClass(uu);
/**
* @license
* Copyright 2022 CodeSmith LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class cu extends Xr{constructor(e){super(e),this.scale=e.scale,e.offset?this.offset=e.offset:this.offset=0}getConfig(){const e={scale:this.scale,offset:this.offset},t=super.getConfig();return Object.assign(e,t),e}call(e,t){return(0,N.tidy)(()=>("float32"!==(e=Lr(e)).dtype&&(e=Ki(e,"float32")),(0,N.add)((0,N.mul)(e,this.scale),this.offset)))}}cu.className="Rescaling",N.serialization.registerClass(cu);
/**
* @license
* Copyright 2022 CodeSmith LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
const{resizeBilinear:du,cropAndResize:hu}=N.image;class pu extends Xr{constructor(e){super(e),this.height=e.height,this.width=e.width}centerCrop(e,t,n,i,r,s,o,a){return(0,N.tidy)(()=>{let l,u=!1;const c=[t/s,n/o,(i+t)/s,(r+n)/o],d=[];3===e.rank?(u=!0,l=(0,N.stack)([e])):l=e;for(let e=0;e<l.shape[0];e++)d.push(c);const h=(0,N.tensor)(d,[d.length,4]),p=(0,N.range)(0,d.length,1,"int32"),f=hu(l,h,p,[i,r],"nearest");return Ki(u?Lr((0,N.unstack)(f)):f,a)})}upsize(e,t,n,i){return(0,N.tidy)(()=>Ki(du(e,[t,n]),i))}call(e,t){return(0,N.tidy)(()=>{const t=Lr(e),n=t.dtype,i=t.shape,r=i[i.length-3],s=i[i.length-2];let o=0;r!==this.height&&(o=Math.floor((r-this.height)/2));let a=0;return s!==this.width&&(a=Math.floor((s-this.width)/2),0===a&&(a=1)),o>=0&&a>=0?this.centerCrop(t,o,a,this.height,this.width,r,s,n):this.upsize(e,this.height,this.width,n)})}getConfig(){const e={height:this.height,width:this.width},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){const t=(e=Pr(e)).length-3,n=e.length-2;return e[t]=this.height,e[n]=this.width,e}}pu.className="CenterCrop",N.serialization.registerClass(pu);
/**
* @license
* Copyright 2022 CodeSmith LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class fu extends Xr{constructor(e){super(e),this.numTokens=e.numTokens,e.outputMode?this.outputMode=e.outputMode:this.outputMode="multiHot"}getConfig(){const e={numTokens:this.numTokens,outputMode:this.outputMode},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){return null==(e=Pr(e))?[this.numTokens]:"oneHot"===this.outputMode&&1!==e[e.length-1]?(e.push(this.numTokens),e):(e[e.length-1]=this.numTokens,e)}call(e,t){return(0,N.tidy)(()=>{let n;if("int32"!==(e=Lr(e)).dtype&&(e=Ki(e,"int32")),void 0!==t.countWeights){if("count"!==this.outputMode)throw new ti(`countWeights is not used when outputMode !== count.\n Received countWeights=${t.countWeights}`);n=Lr(t.countWeights)}const i=(0,N.max)(e),r=(0,N.min)(e),s=(0,N.greater)(this.numTokens,i).bufferSync().get(0),o=(0,N.greaterEqual)(r,0).bufferSync().get(0);if(!s||!o)throw new ti(`Input values must be between 0 < values <= numTokens with numTokens=${this.numTokens}`);
/**
* @license
* Copyright 2022 CodeSmith LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
return function(e,t,n,i){let r=Lr(e);if("int32"!==r.dtype&&(r=Ki(r,"int32")),"int"===t)return r;const s=r.shape;if(0===r.rank&&(r=(0,N.expandDims)(r,-1)),"oneHot"===t&&1!==r.shape[r.shape.length-1]&&(r=(0,N.expandDims)(r,-1)),r.rank>2)throw new ti(`When outputMode is not int, maximum output rank is 2 Received outputMode ${t} and input shape ${s} which would result in output rank ${r.rank}.`);const o=["multiHot","oneHot"].includes(t),a=r;let l;if(l=void 0!==i&&"count"===t?(0,N.denseBincount)(a,i,n,o):(0,N.denseBincount)(a,[],n,o),"tfIdf"!==t)return l;if(i)return(0,N.mul)(l,i);throw new ti("When outputMode is 'tfIdf', weights must be provided.")}(e,this.outputMode,this.numTokens,n)})}}fu.className="CategoryEncoding",N.serialization.registerClass(fu);
/**
* @license
* Copyright 2022 CodeSmith LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
const mu=new Set(["bilinear","nearest"]);class gu extends Xr{constructor(e){if(super(e),this.height=e.height,this.width=e.width,e.interpolation){if(!mu.has(e.interpolation))throw new ti(`Invalid interpolation parameter: ${e.interpolation} is not implemented`);this.interpolation=e.interpolation}else this.interpolation="bilinear";this.cropToAspectRatio=Boolean(e.cropToAspectRatio)}computeOutputShape(e){const t=(e=Pr(e))[2];return[this.height,this.width,t]}getConfig(){const e={height:this.height,width:this.width,interpolation:this.interpolation,cropToAspectRatio:this.cropToAspectRatio},t=super.getConfig();return Object.assign(e,t),e}call(e,t){return(0,N.tidy)(()=>{const t=[this.height,this.width];if("bilinear"===this.interpolation)return N.image.resizeBilinear(e,t,!this.cropToAspectRatio);if("nearest"===this.interpolation)return N.image.resizeNearestNeighbor(e,t,!this.cropToAspectRatio);throw new Error(`Interpolation is ${this.interpolation} but only ${[...mu]} are supported`)})}}gu.className="Resizing",N.serialization.registerClass(gu);
/**
* @license
* Copyright 2023 CodeSmith LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class yu{constructor(e){this.seed=e}next(){if(void 0!==this.seed)return this.seed++}}yu.className="RandomSeed";
/**
* @license
* Copyright 2023 CodeSmith LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class _u extends Xr{constructor(e){super(e),this.randomGenerator=new yu(e.seed)}getConfig(){const e={seed:this.randomGenerator.seed},t=super.getConfig();return Object.assign(e,t),e}}_u.className="BaseRandomLayer";
/**
* @license
* Copyright 2023 CodeSmith LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
const vu=new Set(["bilinear","nearest"]);class bu extends _u{constructor(e){super(e);const{factor:t,interpolation:n="bilinear"}=e;if(this.factor=t,Array.isArray(this.factor)&&2===this.factor.length)this.widthLower=this.factor[0],this.widthUpper=this.factor[1];else{if(Array.isArray(this.factor)||!(this.factor>0))throw new ti(`Invalid factor: ${this.factor}. Must be positive number or tuple of 2 numbers`);this.widthLower=-this.factor,this.widthUpper=this.factor}if(this.widthLower<-1||this.widthUpper<-1)throw new ti(`factor must have values larger than -1. Got: ${this.factor}`);if(this.widthUpper<this.widthLower)throw new ti(`factor cannot have upper bound less than lower bound.\n Got upper bound: ${this.widthUpper}.\n Got lower bound: ${this.widthLower}\n `);if(n){if(!vu.has(n))throw new ti(`Invalid interpolation parameter: ${n} is not implemented`);this.interpolation=n}}getConfig(){const e={factor:this.factor,interpolation:this.interpolation},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){const t=(e=Pr(e))[2];return[this.imgHeight,-1,t]}call(e,t){return(0,N.tidy)(()=>{const t=Lr(e);this.imgHeight=t.shape[t.shape.length-3];const n=t.shape[t.shape.length-2];this.widthFactor=(0,N.randomUniform)([1],1+this.widthLower,1+this.widthUpper,"float32",this.randomGenerator.next());let i=this.widthFactor.dataSync()[0]*n;i=Math.round(i);const r=[this.imgHeight,i];switch(this.interpolation){case"bilinear":return N.image.resizeBilinear(e,r);case"nearest":return N.image.resizeNearestNeighbor(e,r);default:throw new Error(`Interpolation is ${this.interpolation}\n but only ${[...vu]} are supported`)}})}}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function Tu(e){return new Kr(e)}function xu(e){return new ka(e)}function Eu(e){return new Oa(e)}function wu(e){return new Ma(e)}function Iu(e){return new Ra(e)}function Au(e){return new Da(e)}function Su(e){return new Na(e)}function Cu(e){return new Za(e)}function Ou(e){return new Ga(e)}function Mu(e){return new Wa(e)}function Ru(e){return new Ha(e)}function ku(e){return new Xa(e)}function Nu(e){return new Ka(e)}function Du(e){return new Qa(e)}function Fu(e){return new Ja(e)}function Lu(e){return new el(e)}function Pu(e){return new Tl(e)}function Bu(e){return new vl(e)}function $u(e){return new yl(e)}function Uu(e){return new _l(e)}function zu(e){return new bl(e)}function Vu(e){return new xl(e)}function ju(e){return new El(e)}function Yu(e){return new wl(e)}function Gu(e){return new Al(e)}function Hu(e){return new Cl(e)}function Wu(e){return new Ml(e)}function Xu(e){return new Nl(e)}function qu(e){return new Rl(e)}function Ku(e){return new kl(e)}function Zu(e){return new Ol(e)}function Qu(e){return new Fl(e)}function Ju(e){return new zl(e)}function ec(e){return new Vl(e)}function tc(e){return new jl(e)}function nc(e){return new Xl(e)}function ic(e){return nc(e)}function rc(e){return nc(e)}function sc(e){return new Zl(e)}function oc(e){return sc(e)}function ac(e){return sc(e)}function lc(e){return new eu(e)}function uc(e){return lc(e)}function cc(e){return lc(e)}function dc(e){return new nu(e)}function hc(e){return new su(e)}function pc(e){return new iu(e)}function fc(e){return new ou(e)}function mc(e){return new Wl(e)}function gc(e){return new Kl(e)}function yc(e){return new Jl(e)}function _c(e){return new ll(e)}function vc(e){return new al(e)}function bc(e){return new cl(e)}function Tc(e){return new ul(e)}function xc(e){return new ol(e)}function Ec(e){return new sl(e)}function wc(e){return new gl(e)}function Ic(e){return new ml(e)}function Ac(e){return new il(e)}function Sc(e){return new dl(e)}function Cc(e){return new uu(e)}function Oc(e){return new lu(e)}bu.className="RandomWidth",N.serialization.registerClass(bu);const Mc=pc,Rc=fc,kc=mc,Nc=gc;function Dc(e){return new Ll(e)}function Fc(e){return new Pl(e)}function Lc(e){return new Bl(e)}function Pc(e){return new Il(e)}function Bc(e){return new cu(e)}function $c(e){return new pu(e)}function Uc(e){return new gu(e)}function zc(e){return new fu(e)}function Vc(e){return new bu(e)}function jc(e,t){return ro(e,t)}function Yc(e,t){return uo(e,t)}function Gc(e,t){return co(e,t)}function Hc(e,t){return so(e,t)}function Wc(e,t){return ho(e,t)}function Xc(e,t){return ao(e,t)}function qc(e,t){return lo(e,t)}function Kc(e,t){return to(e,t)}function Zc(e,t){return Xs(e,t)}function Qc(e,t){return qs(e,t)}function Jc(e,t){return qs(e,t)}function ed(e,t){return qs(e,t)}function td(e,t){return Ws(e,t)}function nd(e,t){return Ws(e,t)}function id(e,t){return Ws(e,t)}function rd(e,t){return function(e,t){return(0,N.tidy)(()=>{const n=e.sub(t).square().sum(),i=e.sub(e.mean()).square().sum();return N.scalar(1).sub(n.div(i))})}(e,t)}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
function sd(e){return new wa(e)}function od(e){return xa(t=e),new wa({l1:null!=t?t.l1:null,l2:0});var t}function ad(e){return xa(t=e),new wa({l2:null!=t?t.l2:null,l1:0});var t}
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
class ld extends Ps{constructor(){super(...arguments),this.model=null}setModel(e){if(!(e instanceof Wo))throw new Error("model must be a LayersModel, not some other Container");this.model=e}}function ud(e,t){return e<t}function cd(e,t){return e>t}class dd extends ld{constructor(e){if(super(),null==e&&(e={}),e.restoreBestWeights)throw new ni("restoreBestWeights = True is not implemented in EarlyStopping yet.");this.monitor=e.monitor||"val_loss",this.minDelta=Math.abs(e.minDelta||0),this.patience=e.patience||0,this.verbose=e.verbose||0,this.mode=e.mode||"auto",this.baseline=e.baseline,-1===["auto","min","max"].indexOf(this.mode)&&(console.warn(`EarlyStopping mode '${this.mode}' is invalid. Falling back to mode 'auto'.`),this.mode="auto"),"min"===this.mode?this.monitorFunc=ud:"max"===this.mode||-1!==this.monitor.indexOf("acc")?this.monitorFunc=cd:this.monitorFunc=ud,this.monitorFunc===ud&&(this.minDelta*=-1)}async onTrainBegin(e){this.wait=0,this.stoppedEpoch=0,null!=this.baseline?this.best=this.baseline:this.best=this.monitorFunc===ud?1/0:-1/0}async onEpochEnd(e,t){await Ds(t);const n=this.getMonitorValue(t);null!=n&&(this.monitorFunc(n-this.minDelta,this.best)?(this.best=n,this.wait=0):(this.wait++,this.wait>=this.patience&&(this.stoppedEpoch=e,this.model.stopTraining=!0)))}async onTrainEnd(e){this.stoppedEpoch>0&&this.verbose&&console.log(`Epoch ${this.stoppedEpoch}: early stopping.`)}getMonitorValue(e){null==e&&(e={});const t=e[this.monitor];return null==t&&console.warn(`Metric for EarlyStopping ${this.monitor} is not available. Available metrics are: ${Object.keys(e)}`),t}}const hd={earlyStopping:function(e){return new dd(e)}};
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
var pd,fd;(0,N.env)().registerFlag("KEEP_INTERMEDIATE_TENSORS",()=>!1,e=>{e&&console.warn("Keep intermediate tensors is ON. This will print the values of all intermediate tensors during model inference. Not all models support this mode. For details, check e2e/benchmarks/ model_config.js. This significantly impacts performance.")}),function(e){e[e.DT_INVALID=0]="DT_INVALID",e[e.DT_FLOAT=1]="DT_FLOAT",e[e.DT_DOUBLE=2]="DT_DOUBLE",e[e.DT_INT32=3]="DT_INT32",e[e.DT_UINT8=4]="DT_UINT8",e[e.DT_INT16=5]="DT_INT16",e[e.DT_INT8=6]="DT_INT8",e[e.DT_STRING=7]="DT_STRING",e[e.DT_COMPLEX64=8]="DT_COMPLEX64",e[e.DT_INT64=9]="DT_INT64",e[e.DT_BOOL=10]="DT_BOOL",e[e.DT_QINT8=11]="DT_QINT8",e[e.DT_QUINT8=12]="DT_QUINT8",e[e.DT_QINT32=13]="DT_QINT32",e[e.DT_BFLOAT16=14]="DT_BFLOAT16",e[e.DT_QINT16=15]="DT_QINT16",e[e.DT_QUINT16=16]="DT_QUINT16",e[e.DT_UINT16=17]="DT_UINT16",e[e.DT_COMPLEX128=18]="DT_COMPLEX128",e[e.DT_HALF=19]="DT_HALF",e[e.DT_RESOURCE=20]="DT_RESOURCE",e[e.DT_VARIANT=21]="DT_VARIANT",e[e.DT_UINT32=22]="DT_UINT32",e[e.DT_UINT64=23]="DT_UINT64",e[e.DT_FLOAT_REF=101]="DT_FLOAT_REF",e[e.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",e[e.DT_INT32_REF=103]="DT_INT32_REF",e[e.DT_UINT8_REF=104]="DT_UINT8_REF",e[e.DT_INT16_REF=105]="DT_INT16_REF",e[e.DT_INT8_REF=106]="DT_INT8_REF",e[e.DT_STRING_REF=107]="DT_STRING_REF",e[e.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",e[e.DT_INT64_REF=109]="DT_INT64_REF",e[e.DT_BOOL_REF=110]="DT_BOOL_REF",e[e.DT_QINT8_REF=111]="DT_QINT8_REF",e[e.DT_QUINT8_REF=112]="DT_QUINT8_REF",e[e.DT_QINT32_REF=113]="DT_QINT32_REF",e[e.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",e[e.DT_QINT16_REF=115]="DT_QINT16_REF",e[e.DT_QUINT16_REF=116]="DT_QUINT16_REF",e[e.DT_UINT16_REF=117]="DT_UINT16_REF",e[e.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",e[e.DT_HALF_REF=119]="DT_HALF_REF",e[e.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",e[e.DT_VARIANT_REF=121]="DT_VARIANT_REF",e[e.DT_UINT32_REF=122]="DT_UINT32_REF",e[e.DT_UINT64_REF=123]="DT_UINT64_REF"}(pd||(pd={})),function(e){let t;!function(e){e[e.LEGACY=0]="LEGACY",e[e.V1=1]="V1",e[e.V2=2]="V2"}(t=e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))}(fd||(fd={}));
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const md={};function gd(e,t){const n={tfOpName:e,category:"custom",inputs:[],attrs:[],customExecutor:t};md[e]=n}function yd(e){return md[e]}function _d(e){delete md[e]}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function vd(e,t,n,i,r){const s=t.inputParams[e];if(s&&void 0!==s.inputIndexStart){const e=s.inputIndexStart,o=0===s.inputIndexEnd?void 0:void 0===s.inputIndexEnd?e+1:s.inputIndexEnd,a=e<0?t.inputNames.length+e:e;if("tensor"===s.type)return bd(t.inputNames[a],n,i,r);if("tensors"===s.type){const s=t.inputs.slice(e,o);return t.inputNames.slice(e,o).filter((e,t)=>{var n;return"NoOp"!==(null===(n=s[t])||void 0===n?void 0:n.op)}).map(e=>bd(e,n,i,r))}const l=bd(t.inputNames[a],n,i,r),u=l.dataSync();return"number"===s.type?u[0]:N.util.toNestedArray(l.shape,u)}const o=t.attrParams[e];return o&&o.value}function bd(e,t,n,i){const[r,s]=wd(e,n);if(null!=i){const e=i.getHashTableHandleByName(r);if(null!=e)return e}const o=n.currentContextIds.find(e=>!!t[Ed(r,e)]);return void 0!==o?t[Ed(r,o)][s]:void 0}function Td(e,t,n){return t[Ed(e,n.currentContextId)]}function xd(e,t){const[n,i,r]=wd(e,t);return[Ed(n,t&&t.currentContextId),i,r]}function Ed(e,t){return t?`${e}-${t}`:e}function wd(e,t){if(""===e)return["",0,void 0];const n=null!=t&&null!=t.parseNodeNameCache;if(n){const n=t.parseNodeNameCache.get(e);if(null!=n)return n}const i=e.split(":");let r;if(1===i.length)r=[e,0,void 0];else{const e=i[0],t=3===i.length?i[1]:void 0;r=[e,Number(i[i.length-1]),t]}return n&&t.parseNodeNameCache.set(e,r),r}function Id(e,t,n){let i=vd("pad",e,t,n);if("explicit"===i){i=vd("explicitPaddings",e,t,n);const r=[[0,0],[0,0],[0,0],[0,0]];for(let e=0;e<4;e++)r[e][0]=i[2*e],r[e][1]=i[2*e+1];return r}return i}function Ad(e){return e.kept?e:(0,N.clone)(e)}
/**
* @license
* Copyright 2023 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Sd=[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],Cd=[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsFinite",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsInf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],Od=[{tfOpName:"EmptyTensorList",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"maxNumElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"}]},{tfOpName:"StatelessIf",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"If",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"StatelessWhile",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"While",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"TensorListScatter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListScatterV2",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"},{start:3,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGather",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListSetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListReserve",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListFromTensor",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListStack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"},{tfName:"num_elements",name:"numElements",type:"dtype"}]},{tfOpName:"TensorListSplit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"},{start:2,name:"lengths",type:"number[]"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcat",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcatV2",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPopBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPushBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListLength",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}]},{tfOpName:"TensorListResize",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"size",type:"number"}]}],Md=[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}],Rd=[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomStandardNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniformInt",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number"},{tfName:"maxval",name:"maxval",type:"number"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}],kd=[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV4",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"T_threshold",name:"threshold",type:"dtype",notSupported:!0},{tfName:"pad_to_max_output_size",name:"padToMaxOutputSize",type:"bool"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],Nd=[{tfOpName:"LowerBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]},{tfOpName:"UpperBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"Unique",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"UniqueV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]}],Dd=[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}],Fd=[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"InitializeTable",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]},{tfOpName:"InitializeTableV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]}],Ld=[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]},{tfOpName:"ImageProjectiveTransformV3",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"transforms",type:"tensor"},{start:2,name:"outputShape",type:"number[]"},{start:3,name:"fillValue",type:"number"}],attrs:[{tfName:"interpolation",name:"interpolation",type:"string"},{tfName:"fill_mode",name:"fillMode",type:"string"}]}],Pd=[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BitwiseAnd",category:"logical",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}]}],Bd=[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"MatrixBandPart",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"numLower",type:"tensor"},{start:1,name:"numUpper",type:"tensor"}]}],$d=[{tfOpName:"EuclideanNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",defaultValue:!1}]},{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]}],Ud=[{tfOpName:"Bincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}]},{tfOpName:"DenseBincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}],attrs:[{tfName:"binary_output",name:"binaryOutput",type:"bool"}]},{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cumprod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]},{tfOpName:"Cumsum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]}],zd=[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}],attrs:[{tfName:"batch_dims",name:"batchDims",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool[]"}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]},{tfOpName:"TensorScatterUpdate",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"values",type:"tensor"}]}],Vd=[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}],jd=[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}],Yd=[{tfOpName:"StaticRegexReplace",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"pattern",name:"pattern",type:"string"},{tfName:"rewrite",name:"rewrite",type:"string"},{tfName:"replace_global",name:"replaceGlobal",type:"bool"}]},{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}],Gd=[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"EnsureShape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]},{tfOpName:"BroadcastArgs",category:"transformation",inputs:[{start:0,name:"s0",type:"tensor"},{start:1,name:"s1",type:"tensor"}],attrs:[]}];
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Hd{static get Instance(){return this._instance||(this._instance=new this)}constructor(){const e=[].concat(...[u,c,d,h,p,f,m,g,y,_,v,b,T,x,E,w,I,A,S].map(e=>e.json));this.opMappers=e.reduce((e,t)=>(e[t.tfOpName]=t,e),{})}transformGraph(e,t={}){const n=e.node,i=[],r=[],s=[],o=n.reduce((e,t)=>(e[t.name]=this.mapNode(t),t.op.startsWith("Placeholder")?i.push(e[t.name]):"Const"===t.op?r.push(e[t.name]):null!=t.input&&0!==t.input.length||s.push(e[t.name]),e),{});let a=[];const l=[];let u={},c={};null!=t&&(u=this.mapSignatureEntries(t.inputs),c=this.mapSignatureEntries(t.outputs));const d=Object.keys(o);d.forEach(e=>{const t=o[e];t.inputNames.forEach((e,n)=>{const[i,,r]=xd(e),s=o[i];if(null!=s.outputs){const e=s.outputs.indexOf(r);if(-1!==e){const r=`${i}:${e}`;t.inputNames[n]=r}}t.inputs.push(s),s.children.push(t)})}),0===Object.keys(c).length?d.forEach(e=>{const t=o[e];0===t.children.length&&l.push(t)}):Object.keys(c).forEach(e=>{const[t]=xd(e),n=o[t];null!=n&&(n.signatureKey=c[e],l.push(n))}),Object.keys(u).length>0?Object.keys(u).forEach(e=>{const[t]=xd(e),n=o[t];n&&(n.signatureKey=u[e],a.push(n))}):a=i;let h={};null!=e.library&&null!=e.library.function&&(h=e.library.function.reduce((e,t)=>(e[t.signature.name]=this.mapFunction(t),e),{}));const p={nodes:o,inputs:a,outputs:l,weights:r,placeholders:i,signature:t,functions:h};return s.length>0&&(p.initNodes=s),p}mapSignatureEntries(e){return Object.keys(e||{}).reduce((t,n)=>(t[e[n].name]=n,t),{})}mapNode(e){const t=yd(e.op)||this.opMappers[e.op]||{};null==e.attr&&(e.attr={});const n={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map(e=>e.startsWith("^")?e.slice(1):e),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr,outputs:t.outputs};return null!=t.inputs&&(n.inputParams=t.inputs.reduce((e,t)=>(e[t.name]={type:t.type,inputIndexStart:t.start,inputIndexEnd:t.end},e),{})),null!=t.attrs&&(n.attrParams=t.attrs.reduce((t,n)=>{const i=n.type;let r;switch(n.type){case"string":r=Xd(e.attr,n.tfName,n.defaultValue),void 0===r&&n.tfDeprecatedName&&(r=Xd(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"string[]":r=rh(e.attr,n.tfName,n.defaultValue),void 0===r&&n.tfDeprecatedName&&(r=rh(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number":r=Kd(e.attr,n.tfName,n.defaultValue||0),void 0===r&&n.tfDeprecatedName&&(r=Kd(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number[]":r=ih(e.attr,n.tfName,n.defaultValue),void 0===r&&n.tfDeprecatedName&&(r=ih(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool":r=qd(e.attr,n.tfName,n.defaultValue),void 0===r&&n.tfDeprecatedName&&(r=qd(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool[]":r=oh(e.attr,n.tfName,n.defaultValue),void 0===r&&n.tfDeprecatedName&&(r=oh(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape":r=nh(e.attr,n.tfName,n.defaultValue),void 0===r&&n.tfDeprecatedName&&(r=nh(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape[]":r=sh(e.attr,n.tfName,n.defaultValue),void 0===r&&n.tfDeprecatedName&&(r=sh(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype":r=Jd(e.attr,n.tfName,n.defaultValue),void 0===r&&n.tfDeprecatedName&&(r=Jd(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype[]":r=eh(e.attr,n.tfName,n.defaultValue),void 0===r&&n.tfDeprecatedName&&(r=eh(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"func":r=Qd(e.attr,n.tfName,n.defaultValue),void 0===r&&n.tfDeprecatedName&&(r=Qd(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error(`Unsupported param type: ${n.type} for op: ${e.op}`)}return t[n.name]={value:r,type:i},t},{})),n}mapFunction(e){const t=e.nodeDef,n=[];let i={};null!=t&&(i=t.reduce((e,t)=>(e[t.name]=this.mapNode(t),"Const"===t.op&&n.push(e[t.name]),e),{}));const r=[],s=[];e.signature.inputArg.forEach(e=>{const[t]=xd(e.name),n={name:t,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:Zd(e.type),type:"dtype"}},children:[]};n.signatureKey=e.name,r.push(n),i[t]=n});Object.keys(i).forEach(e=>{const t=i[e];t.inputNames.forEach((e,n)=>{const[r,,s]=xd(e),o=i[r];if(null!=o.outputs){const e=o.outputs.indexOf(s);if(-1!==e){const i=`${r}:${e}`;t.inputNames[n]=i}}t.inputs.push(o),o.children.push(t)})});const o=e.ret;e.signature.outputArg.forEach(e=>{const[t,n]=xd(o[e.name]),r=i[t];null!=r&&(r.defaultOutput=n,s.push(r))});const a=this.mapArgsToSignature(e);return{nodes:i,inputs:r,outputs:s,weights:n,placeholders:[],signature:a}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce((e,t)=>(e[t.name]=this.mapArgToTensorInfo(t),e),{}),outputs:e.signature.outputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n,e.ret),t),{})}}mapArgToTensorInfo(e,t){let n=e.name;return null!=t&&(n=t[n]),{name:n,dtype:e.type}}}function Wd(e,t){const n=Array.isArray(e)?String.fromCharCode.apply(null,e):function(e){const t=(0,N.env)().global;if(void 0!==t.atob)return t.atob(e);if("undefined"!=typeof Buffer)return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}(e);return t?n:n.toLowerCase()}function Xd(e,t,n,i=!1){const r=e[t];return null!=r?Wd(r.s,i):n}function qd(e,t,n){const i=e[t];return i?i.b:n}function Kd(e,t,n){const i=e[t]||{},r=null!=i.i?i.i:null!=i.f?i.f:n;return"number"==typeof r?r:parseInt(r,10)}function Zd(e){switch("string"==typeof e&&(e=pd[e]),e){case pd.DT_FLOAT:case pd.DT_HALF:return"float32";case pd.DT_INT32:case pd.DT_INT64:case pd.DT_INT8:case pd.DT_UINT8:return"int32";case pd.DT_BOOL:return"bool";case pd.DT_DOUBLE:return"float32";case pd.DT_STRING:return"string";case pd.DT_COMPLEX64:case pd.DT_COMPLEX128:return"complex64";default:return null}}function Qd(e,t,n){const i=e[t];return i&&i.func?i.func.name:n}function Jd(e,t,n){const i=e[t];return i&&i.type?Zd(i.type):n}function eh(e,t,n){const i=e[t];return i&&i.list&&i.list.type?i.list.type.map(e=>Zd(e)):n}function th(e){if(!e.unknownRank)return null!=e.dim?e.dim.map(e=>"number"==typeof e.size?e.size:parseInt(e.size,10)):[]}function nh(e,t,n){const i=e[t];return i&&i.shape?th(i.shape):n}function ih(e,t,n){const i=e[t];return i?((i.list.f&&i.list.f.length?i.list.f:i.list.i)||[]).map(e=>"number"==typeof e?e:parseInt(e,10)):n}function rh(e,t,n,i=!1){const r=e[t];return r&&r.list&&r.list.s?r.list.s.map(e=>Wd(e,i)):n}function sh(e,t,n){const i=e[t];return i&&i.list&&i.list.shape?i.list.shape.map(e=>th(e)):n}function oh(e,t,n){const i=e[t];return i&&i.list&&i.list.b?i.list.b:n}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class ah{constructor(e,t,n){this.node=e,this.tensorMap=t,this.context=n,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map(e=>this.getInput(e)),null!=e.rawAttrs&&(this.attrs=Object.keys(e.rawAttrs).reduce((e,t)=>(e[t]=this.getAttr(t),e),{}))}getInput(e){return bd(e,this.tensorMap,this.context)}getAttr(e,t){const n=this.node.rawAttrs[e];if(null!=n.tensor)return bd(e,this.tensorMap,this.context);if(null!=n.i||null!=n.f)return Kd(this.node.rawAttrs,e,t);if(null!=n.s)return Xd(this.node.rawAttrs,e,t);if(null!=n.b)return qd(this.node.rawAttrs,e,t);if(null!=n.shape)return nh(this.node.rawAttrs,e,t);if(null!=n.type)return Jd(this.node.rawAttrs,e,t);if(null!=n.list){if(null!=n.list.i||null!=n.list.f)return ih(this.node.rawAttrs,e,t);if(null!=n.list.s)return rh(this.node.rawAttrs,e,t);if(null!=n.list.shape)return sh(this.node.rawAttrs,e,t);if(null!=n.list.b)return oh(this.node.rawAttrs,e,t);if(null!=n.list.type)return eh(this.node.rawAttrs,e,t)}return t}}var lh=n(67270);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function uh(e,t,n=""){if("number"!=typeof e&&"number"!=typeof t){N.util.assert(e.length===t.length,()=>n+` Shapes ${e} and ${t} must match`);for(let i=0;i<e.length;i++){const r=e[i],s=t[i];N.util.assert(r<0||s<0||r===s,()=>n+` Shapes ${e} and ${t} must match`)}}}function ch(e){return"number"!=typeof e&&!e.some(e=>e<0)}function dh(e,t,n){let i=hh(e,n);const r=!ch(i);if(r&&0===t.length)throw new Error(`Tried to calculate elements of an empty list with non-fully-defined elementShape: ${i}`);if(r&&t.forEach(e=>{i=hh(e.shape,i)}),!ch(i))throw new Error(`Non-fully-defined elementShape: ${i}`);return i}function hh(e,t){if("number"==typeof e)return t;if("number"==typeof t)return e;if(e.length!==t.length)throw new Error(`Incompatible ranks during merge: ${e} vs. ${t}`);const n=[];for(let i=0;i<e.length;++i){const r=e[i],s=t[i];if(r>=0&&s>=0&&r!==s)throw new Error(`Incompatible shape during merge: ${e} vs. ${t}`);n[i]=r>=0?r:s}return n}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class ph{constructor(e,t,n,i,r,s,o){this.name=e,this.dtype=t,this.maxSize=n,this.elementShape=i,this.identicalElementShapes=r,this.dynamicSize=s,this.clearAfterRead=o,this.tensors=[],this.closed_=!1,this.idTensor=(0,N.scalar)(0),(0,N.keep)(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach(t=>{null!=e&&e.has(t.tensor.id)||t.tensor.dispose()}),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}size(){return this.tensors.length}read(e){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||e>=this.size())throw new Error(`Tried to read from index ${e}, but array size is: ${this.size()}`);const t=this.tensors[e];if(t.cleared)throw new Error(`TensorArray ${this.name}: Could not read index ${e} twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).`);return this.clearAfterRead&&(t.cleared=!0),t.read=!0,t.tensor}readMany(e){return e.map(e=>this.read(e))}write(e,t){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error(`Tried to write to index ${e}, but array is not resizeable and size is: ${this.maxSize}`);const n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e},\n because the value dtype is ${t.dtype}, but TensorArray dtype is ${this.dtype}.`);if(0!==this.size()||null!=this.elementShape&&0!==this.elementShape.length||(this.elementShape=t.shape),uh(this.elementShape,t.shape,`TensorArray ${this.name}: Could not write to TensorArray index ${e}.`),n.read)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been read.`);if(n.written)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been written.`);n.tensor=t,(0,N.keep)(t),n.written=!0,this.tensors[e]=n}writeMany(e,t){if(e.length!==t.length)throw new Error(`TensorArray ${this.name}: could not write multiple tensors,because the index size: ${e.length} is not the same as tensors size: ${t.length}.`);e.forEach((e,n)=>this.write(e,t[n]))}gather(e,t){if(t&&t!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but gather requested dtype ${t}`);if(e)e=e.slice(0,this.size());else{e=[];for(let t=0;t<this.size();t++)e.push(t)}if(0===e.length)return(0,N.tensor)([],[0].concat(this.elementShape));const n=this.readMany(e);return uh(this.elementShape,n[0].shape,"TensorArray shape mismatch: "),(0,N.stack)(n,0)}concat(e){if(e&&e!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but concat requested dtype ${e}`);if(0===this.size())return(0,N.tensor)([],[0].concat(this.elementShape));const t=[];for(let e=0;e<this.size();e++)t.push(e);const n=this.readMany(t);return uh(this.elementShape,n[0].shape,`TensorArray shape mismatch: tensor array shape (${this.elementShape}) vs first tensor shape (${n[0].shape})`),(0,N.concat)(n,0)}scatter(e,t){if(t.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${t.dtype}`);if(e.length!==t.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${e.length} vs. ${t.shape[0]}`);const n=Math.max(...e);if(!this.dynamicSize&&n>=this.maxSize)throw new Error(`Max index must be < array size (${n} vs. ${this.maxSize})`);this.writeMany(e,(0,N.unstack)(t,0))}split(e,t){if(t.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${t.dtype}`);let n=0;const i=e.map(e=>(n+=e,n));if(n!==t.shape[0])throw new Error(`Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ${n}, and tensor's shape is: ${t.shape}`);if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error(`TensorArray's size is not equal to the size of lengths (${this.maxSize} vs. ${e.length}), and the TensorArray is not marked as dynamically resizeable`);const r=0===n?0:t.size/n,s=[];(0,N.tidy)(()=>{t=(0,N.reshape)(t,[1,n,r]);for(let n=0;n<e.length;++n){const o=[0,0===n?0:i[n-1],0],a=[1,e[n],r];s[n]=(0,N.reshape)((0,N.slice)(t,o,a),this.elementShape)}return s});const o=[];for(let t=0;t<e.length;t++)o[t]=t;this.writeMany(o,s)}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class fh{get id(){return this.idTensor.id}constructor(e,t,n,i=-1){this.tensors=e,this.elementShape=t,this.elementDtype=n,null!=e&&e.forEach(e=>{if(n!==e.dtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${e.dtype}`);uh(t,e.shape,"TensorList shape mismatch: "),(0,N.keep)(e)}),this.idTensor=(0,N.scalar)(0),this.maxNumElements=i,(0,N.keep)(this.idTensor)}copy(){return new fh([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach(t=>{null!=e&&e.has(t.id)||t.dispose()}),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(e,t,n=-1){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(-1!==n&&this.tensors.length!==n)throw new Error(`Operation expected a list with ${n} elements but got a list with ${this.tensors.length} elements.`);uh(e,this.elementShape,"TensorList shape mismatch: ");const i=dh(this.elementShape,this.tensors,e);return(0,N.tidy)(()=>{const e=this.tensors.map(e=>(0,N.reshape)(e,i));return(0,N.stack)(e,0)})}popBack(e,t){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(0===this.size())throw new Error("Trying to pop from an empty list.");const n=dh(this.elementShape,this.tensors,e),i=this.tensors.pop();return i.kept=!1,uh(i.shape,e,"TensorList shape mismatch: "),(0,N.reshape)(i,n)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${this.elementDtype}`);if(uh(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");(0,N.keep)(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${e}`);if(-1!==this.maxNumElements&&e>this.maxNumElements)throw new Error(`TensorListResize input size ${e} is greater maxNumElement ${this.maxNumElements}.`);const t=new fh([],this.elementShape,this.elementDtype,this.maxNumElements);t.tensors.length=e;for(let n=0;n<Math.min(this.tensors.length,e);++n)t.tensors[n]=this.tensors[n];return t}getItem(e,t,n){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);if(e<0||e>this.tensors.length)throw new Error(`Trying to access element ${e} in a list with ${this.tensors.length} elements.`);if(null==this.tensors[e])throw new Error(`element at index ${e} is null.`);uh(this.tensors[e].shape,t,"TensorList shape mismatch: ");const i=dh(this.elementShape,this.tensors,t);return(0,N.reshape)(this.tensors[e],i)}setItem(e,t){if(t.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t.dtype}, but list elements ${this.elementDtype}`);if(e<0||-1!==this.maxNumElements&&e>=this.maxNumElements)throw new Error(`Trying to set element ${e} in a list with max ${this.maxNumElements} elements.`);uh(this.elementShape,t.shape,"TensorList shape mismatch: "),(0,N.keep)(t),null!=this.tensors[e]&&(this.tensors[e].kept=!1),this.tensors[e]=t}gather(e,t,n){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);uh(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());const i=dh(this.elementShape,this.tensors,n);return 0===e.length?(0,N.tensor)([],[0].concat(i)):(0,N.tidy)(()=>{const t=e.map(e=>(0,N.reshape)(this.tensors[e],i));return(0,N.stack)(t,0)})}concat(e,t){if(e&&e!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${e}`);uh(this.elementShape,t,"TensorList shape mismatch: ");const n=dh(this.elementShape,this.tensors,t);return 0===this.size()?(0,N.tensor)([],[0].concat(n)):(0,N.tidy)(()=>{const e=this.tensors.map(e=>(0,N.reshape)(e,n));return(0,N.concat)(e,0)})}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const mh=async(e,t,n)=>{switch(e.op){case"If":case"StatelessIf":{const i=vd("thenBranch",e,t,n),r=vd("elseBranch",e,t,n),s=vd("cond",e,t,n),o=vd("args",e,t,n);return(await s.data())[0]?n.functionMap[i].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap):n.functionMap[r].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{const i=vd("body",e,t,n),r=vd("cond",e,t,n),s=vd("args",e,t,n),o=await n.functionMap[r].executeFunctionAsync(s,n.tensorArrayMap,n.tensorListMap),a=s.map(e=>e.id);let l=await o[0].data();o.forEach(e=>{e.kept||-1!==a.indexOf(e.id)||e.dispose()});let u=s;for(;l[0];){const e=u;u=await n.functionMap[i].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);const t=u.map(e=>e.id);e.forEach(e=>{e.kept||-1!==a.indexOf(e.id)||-1!==t.indexOf(e.id)||e.dispose()});const s=await n.functionMap[r].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);l=await s[0].data(),s.forEach(e=>{e.kept||-1!==a.indexOf(e.id)||-1!==t.indexOf(e.id)||e.dispose()})}return u}case"LoopCond":return[Ad(vd("pred",e,t,n))];case"Switch":{const i=vd("pred",e,t,n);let r=vd("data",e,t,n);return r.kept||(r=Ad(r)),(await i.data())[0]?[void 0,r]:[r,void 0]}case"Merge":{const i=e.inputNames.find(e=>void 0!==bd(e,t,n));if(i){return[Ad(bd(i,t,n))]}return}case"Enter":{const i=vd("frameName",e,t,n),r=vd("tensor",e,t,n);return n.enterFrame(i),[Ad(r)]}case"Exit":{const i=vd("tensor",e,t,n);return n.exitFrame(),[Ad(i)]}case"NextIteration":{const i=vd("tensor",e,t,n);return n.nextIteration(),[Ad(i)]}case"TensorArrayV3":{const i=vd("size",e,t,n),r=vd("dtype",e,t,n),s=vd("elementShape",e,t,n),o=vd("dynamicSize",e,t,n),a=vd("clearAfterRead",e,t,n),l=vd("identicalElementShapes",e,t,n),u=vd("name",e,t,n),c=new ph(u,r,i,s,l,o,a);return n.addTensorArray(c),[c.idTensor,(0,N.scalar)(1)]}case"TensorArrayWriteV3":{const i=vd("tensorArrayId",e,t,n),r=vd("index",e,t,n),s=vd("tensor",e,t,n),o=n.getTensorArray(i.id);return o.write(r,s),[o.idTensor]}case"TensorArrayReadV3":{const i=vd("tensorArrayId",e,t,n),r=vd("index",e,t,n);return[n.getTensorArray(i.id).read(r)]}case"TensorArrayGatherV3":{const i=vd("tensorArrayId",e,t,n),r=vd("indices",e,t,n),s=vd("dtype",e,t,n);return[n.getTensorArray(i.id).gather(r,s)]}case"TensorArrayScatterV3":{const i=vd("tensorArrayId",e,t,n),r=vd("indices",e,t,n),s=vd("tensor",e,t,n),o=n.getTensorArray(i.id);return o.scatter(r,s),[o.idTensor]}case"TensorArrayConcatV3":{const i=vd("tensorArrayId",e,t,n),r=n.getTensorArray(i.id),s=vd("dtype",e,t,n);return[r.concat(s)]}case"TensorArraySplitV3":{const i=vd("tensorArrayId",e,t,n),r=vd("tensor",e,t,n),s=vd("lengths",e,t,n),o=n.getTensorArray(i.id);return o.split(s,r),[o.idTensor]}case"TensorArraySizeV3":{const i=vd("tensorArrayId",e,t,n),r=n.getTensorArray(i.id);return[(0,N.scalar)(r.size(),"int32")]}case"TensorArrayCloseV3":{const i=vd("tensorArrayId",e,t,n),r=n.getTensorArray(i.id);return r.clearAndClose(),[r.idTensor]}case"TensorListSetItem":{const i=vd("tensorListId",e,t,n),r=vd("index",e,t,n),s=vd("tensor",e,t,n),o=n.getTensorList(i.id);return o.setItem(r,s),[o.idTensor]}case"TensorListGetItem":{const i=vd("tensorListId",e,t,n),r=vd("index",e,t,n),s=vd("elementShape",e,t,n),o=vd("elementDType",e,t,n);return[n.getTensorList(i.id).getItem(r,s,o)]}case"TensorListScatterV2":case"TensorListScatter":{const i=vd("indices",e,t,n),r=function(e,t,n,i){if(t.length!==e.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${t.length} vs. ${e.shape[0]}`);const r=Math.max(...t);if(null!=i&&-1!==i&&r>=i)throw new Error(`Max index must be < array size (${r} vs. ${i})`);const s=new fh([],n,e.dtype,i),o=(0,N.unstack)(e,0);return t.forEach((e,t)=>{s.setItem(e,o[t])}),s}(vd("tensor",e,t,n),i,vd("elementShape",e,t,n),vd("numElements",e,t,n));return n.addTensorList(r),[r.idTensor]}case"TensorListReserve":case"EmptyTensorList":{const i=vd("elementShape",e,t,n),r=vd("elementDType",e,t,n);let s;s="TensorListReserve"===e.op?"numElements":"maxNumElements";const o=vd(s,e,t,n),a=function(e,t,n,i){return new fh([],e,t,i)}(i,r,0,"TensorListReserve"===e.op?-1:o);return n.addTensorList(a),[a.idTensor]}case"TensorListGather":{const i=vd("tensorListId",e,t,n),r=vd("indices",e,t,n),s=vd("elementShape",e,t,n),o=vd("elementDType",e,t,n);return[n.getTensorList(i.id).gather(r,o,s)]}case"TensorListStack":{const i=vd("tensorListId",e,t,n),r=vd("elementShape",e,t,n),s=vd("elementDType",e,t,n),o=vd("numElements",e,t,n);return[n.getTensorList(i.id).stack(r,s,o)]}case"TensorListFromTensor":{const i=function(e,t,n){const i=e.dtype;if(e.shape.length<1)throw new Error(`Tensor must be at least a vector, but saw shape: ${e.shape}`);if(e.dtype!==n)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${n}`);uh(e.shape.slice(1),t,"TensorList shape mismatch: ");const r=(0,N.unstack)(e);return new fh(r,t,i)}(vd("tensor",e,t,n),vd("elementShape",e,t,n),vd("elementDType",e,t,n));return n.addTensorList(i),[i.idTensor]}case"TensorListConcat":case"TensorListConcatV2":{const i=vd("tensorListId",e,t,n),r=n.getTensorList(i.id),s=vd("dtype",e,t,n),o=vd("elementShape",e,t,n);return[r.concat(s,o)]}case"TensorListPushBack":{const i=vd("tensorListId",e,t,n),r=vd("tensor",e,t,n),s=n.getTensorList(i.id);return s.pushBack(r),[s.idTensor]}case"TensorListPopBack":{const i=vd("tensorListId",e,t,n),r=vd("elementShape",e,t,n),s=vd("elementDType",e,t,n);return[n.getTensorList(i.id).popBack(r,s)]}case"TensorListSplit":{const i=vd("tensor",e,t,n),r=vd("elementShape",e,t,n),s=function(e,t,n){let i=0;const r=t.map(e=>(i+=e,i));if(i!==e.shape[0])throw new Error(`Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ${i}, and tensor's shape is: ${e.shape}`);const s=hh(e.shape.slice(1),n),o=0===i?0:e.size/i,a=(0,N.tidy)(()=>{const n=[];e=(0,N.reshape)(e,[1,i,o]);for(let i=0;i<t.length;++i){const a=[0,0===i?0:r[i-1],0],l=[1,t[i],o];n[i]=(0,N.reshape)((0,N.slice)(e,a,l),s)}return e.dispose(),n}),l=new fh([],n,e.dtype,t.length);for(let e=0;e<a.length;e++)l.setItem(e,a[e]);return l}(i,vd("lengths",e,t,n),r);return n.addTensorList(s),[s.idTensor]}case"TensorListLength":{const i=vd("tensorListId",e,t,n),r=n.getTensorList(i.id);return[(0,N.scalar)(r.size(),"int32")]}case"TensorListResize":{const i=vd("tensorListId",e,t,n),r=vd("size",e,t,n),s=n.getTensorList(i.id).resize(r);return n.addTensorList(s),[s.idTensor]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function gh(e,t,n){const[i,r]=vd("fusedOps",e,t,n),s="biasadd"===i,o=!s,a="prelu"===r,l="fusedbatchnorm"===i,u=vd("numArgs",e,t,n);if(s){if(a&&2!==u)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!a&&s&&1!==u)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(l)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");const c=vd("strides",e,t,n),d=Id(e,t,n),h=vd("dataFormat",e,t,n).toUpperCase(),p=vd("dilations",e,t,n);let[f,m]=vd("args",e,t,n);o&&(m=f,f=void 0);return{stride:c,pad:d,dataFormat:h,dilations:p,biasArg:f,preluArg:m,activationFunc:r,leakyreluAlpha:vd("leakyreluAlpha",e,t,n)}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function yh(e,t,n){return{boxes:vd("boxes",e,t,n),scores:vd("scores",e,t,n),maxOutputSize:vd("maxOutputSize",e,t,n),iouThreshold:vd("iouThreshold",e,t,n),scoreThreshold:vd("scoreThreshold",e,t,n),softNmsSigma:vd("softNmsSigma",e,t,n)}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class _h{get id(){return this.handle.id}constructor(e,t){this.keyDType=e,this.valueDType=t,this.handle=(0,N.scalar)(0),this.tensorMap=new Map,(0,N.keep)(this.handle)}clearAndClose(){this.tensorMap.forEach(e=>e.dispose()),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return z.d(this.size(),"int32")}async import(e,t){this.checkKeyAndValueTensor(e,t);const n=await e.data();return this.tensorMap.forEach(e=>e.dispose()),this.tensorMap.clear(),(0,N.tidy)(()=>{const e=(0,N.unstack)(t),i=n.length,r=e.length;N.util.assert(i===r,()=>`The number of elements doesn't match, keys has ${i} elements, the values has ${r} elements.`);for(let t=0;t<i;t++){const i=n[t],r=e[t];(0,N.keep)(r),this.tensorMap.set(i,r)}return this.handle})}async find(e,t){this.checkKeyAndValueTensor(e,t);const n=await e.data();return(0,N.tidy)(()=>{const e=[];for(let i=0;i<n.length;i++){const r=n[i],s=this.findWithDefault(r,t);e.push(s)}return(0,N.stack)(e)})}findWithDefault(e,t){const n=this.tensorMap.get(e);return null!=n?n:t}checkKeyAndValueTensor(e,t){if(e.dtype!==this.keyDType)throw new Error(`Expect key dtype ${this.keyDType}, but got ${e.dtype}`);if(t.dtype!==this.valueDType)throw new Error(`Expect value dtype ${this.valueDType}, but got ${t.dtype}`)}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function vh(e,t,n,i,r=N.tidy){const s=((e,t,n)=>{switch(e.category){case"arithmetic":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[i.add(vd("a",e,t,n),vd("b",e,t,n))];case"AddN":return[i.addN(vd("tensors",e,t,n))];case"FloorMod":case"Mod":return[i.mod(vd("a",e,t,n),vd("b",e,t,n))];case"Mul":return[i.mul(vd("a",e,t,n),vd("b",e,t,n))];case"RealDiv":case"Div":return[i.div(vd("a",e,t,n),vd("b",e,t,n))];case"DivNoNan":return[i.divNoNan(vd("a",e,t,n),vd("b",e,t,n))];case"FloorDiv":return[i.floorDiv(vd("a",e,t,n),vd("b",e,t,n))];case"Sub":return[i.sub(vd("a",e,t,n),vd("b",e,t,n))];case"Minimum":return[i.minimum(vd("a",e,t,n),vd("b",e,t,n))];case"Maximum":return[i.maximum(vd("a",e,t,n),vd("b",e,t,n))];case"Pow":return[i.pow(vd("a",e,t,n),vd("b",e,t,n))];case"SquaredDifference":return[i.squaredDifference(vd("a",e,t,n),vd("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"basic_math":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"Abs":case"ComplexAbs":return[i.abs(vd("x",e,t,n))];case"Acos":return[i.acos(vd("x",e,t,n))];case"Acosh":return[i.acosh(vd("x",e,t,n))];case"Asin":return[i.asin(vd("x",e,t,n))];case"Asinh":return[i.asinh(vd("x",e,t,n))];case"Atan":return[i.atan(vd("x",e,t,n))];case"Atan2":return[i.atan2(vd("x",e,t,n),vd("y",e,t,n))];case"Atanh":return[i.atanh(vd("x",e,t,n))];case"Ceil":return[i.ceil(vd("x",e,t,n))];case"Complex":return[i.complex(vd("real",e,t,n),vd("imag",e,t,n))];case"Cos":return[i.cos(vd("x",e,t,n))];case"Cosh":return[i.cosh(vd("x",e,t,n))];case"Elu":return[i.elu(vd("x",e,t,n))];case"Erf":return[i.erf(vd("x",e,t,n))];case"Exp":return[i.exp(vd("x",e,t,n))];case"Expm1":return[i.expm1(vd("x",e,t,n))];case"Floor":return[i.floor(vd("x",e,t,n))];case"Log":return[i.log(vd("x",e,t,n))];case"Log1p":return[i.log1p(vd("x",e,t,n))];case"Imag":return[i.imag(vd("x",e,t,n))];case"Neg":return[i.neg(vd("x",e,t,n))];case"Reciprocal":return[i.reciprocal(vd("x",e,t,n))];case"Real":return[i.real(vd("x",e,t,n))];case"Relu":return[i.relu(vd("x",e,t,n))];case"Round":return[i.round(vd("x",e,t,n))];case"Selu":return[i.selu(vd("x",e,t,n))];case"Sigmoid":return[i.sigmoid(vd("x",e,t,n))];case"Sin":return[i.sin(vd("x",e,t,n))];case"Sign":return[i.sign(vd("x",e,t,n))];case"Sinh":return[i.sinh(vd("x",e,t,n))];case"Softplus":return[i.softplus(vd("x",e,t,n))];case"Sqrt":return[i.sqrt(vd("x",e,t,n))];case"Square":return[i.square(vd("x",e,t,n))];case"Tanh":return[i.tanh(vd("x",e,t,n))];case"Tan":return[i.tan(vd("x",e,t,n))];case"ClipByValue":return[i.clipByValue(vd("x",e,t,n),vd("clipValueMin",e,t,n),vd("clipValueMax",e,t,n))];case"Relu6":return[i.relu6(vd("x",e,t,n))];case"Rsqrt":return[i.rsqrt(bd(e.inputNames[0],t,n))];case"LeakyRelu":return[i.leakyRelu(vd("x",e,t,n),vd("alpha",e,t,n))];case"Prelu":return[i.prelu(vd("x",e,t,n),vd("alpha",e,t,n))];case"IsNan":return[i.isNaN(bd(e.inputNames[0],t,n))];case"IsInf":return[i.isInf(bd(e.inputNames[0],t,n))];case"IsFinite":return[i.isFinite(bd(e.inputNames[0],t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"control":return mh(e,t,n);case"convolution":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"Conv1D":{const r=vd("stride",e,t,n),s=vd("pad",e,t,n),o=vd("dataFormat",e,t,n).toUpperCase(),a=vd("dilation",e,t,n);return[i.conv1d(vd("x",e,t,n),vd("filter",e,t,n),r,s,o,a)]}case"Conv2D":{const r=vd("strides",e,t,n),s=Id(e,t,n),o=vd("dataFormat",e,t,n).toUpperCase(),a=vd("dilations",e,t,n);return[i.conv2d(vd("x",e,t,n),vd("filter",e,t,n),[r[1],r[2]],s,o,[a[1],a[2]])]}case"_FusedConv2D":{const{stride:r,pad:s,dataFormat:o,dilations:a,biasArg:l,preluArg:u,activationFunc:c,leakyreluAlpha:d}=gh(e,t,n);return[i.fused.conv2d({x:vd("x",e,t,n),filter:vd("filter",e,t,n),strides:[r[1],r[2]],pad:s,dataFormat:o,dilations:[a[1],a[2]],bias:l,activation:c,preluActivationWeights:u,leakyreluAlpha:d})]}case"FusedDepthwiseConv2dNative":{const{stride:r,pad:s,dataFormat:o,dilations:a,biasArg:l,preluArg:u,activationFunc:c,leakyreluAlpha:d}=gh(e,t,n);return[i.fused.depthwiseConv2d({x:vd("x",e,t,n),filter:vd("filter",e,t,n),strides:[r[1],r[2]],pad:s,dataFormat:o,dilations:[a[1],a[2]],bias:l,activation:c,preluActivationWeights:u,leakyreluAlpha:d})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{const r=vd("outputShape",e,t,n),s=vd("strides",e,t,n),o=Id(e,t,n);return[i.conv2dTranspose(vd("x",e,t,n),vd("filter",e,t,n),r,[s[1],s[2]],o)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{const r=vd("strides",e,t,n),s=Id(e,t,n),o=vd("dilations",e,t,n),a=vd("dataFormat",e,t,n).toUpperCase();return[i.depthwiseConv2d(vd("input",e,t,n),vd("filter",e,t,n),[r[1],r[2]],s,a,[o[1],o[2]])]}case"Conv3D":{const r=vd("strides",e,t,n),s=vd("pad",e,t,n),o=vd("dataFormat",e,t,n).toUpperCase(),a=vd("dilations",e,t,n);return[i.conv3d(vd("x",e,t,n),vd("filter",e,t,n),[r[1],r[2],r[3]],s,o,[a[1],a[2],a[3]])]}case"AvgPool":{const r=vd("strides",e,t,n),s=vd("pad",e,t,n),o=vd("kernelSize",e,t,n);return[i.avgPool(vd("x",e,t,n),[o[1],o[2]],[r[1],r[2]],s)]}case"MaxPool":{const r=vd("strides",e,t,n),s=vd("pad",e,t,n),o=vd("kernelSize",e,t,n);return[i.maxPool(vd("x",e,t,n),[o[1],o[2]],[r[1],r[2]],s)]}case"MaxPoolWithArgmax":{const r=vd("strides",e,t,n),s=vd("pad",e,t,n),o=vd("kernelSize",e,t,n),a=vd("includeBatchInIndex",e,t,n),{result:l,indexes:u}=i.maxPoolWithArgmax(vd("x",e,t,n),[o[1],o[2]],[r[1],r[2]],s,a);return[l,u]}case"AvgPool3D":{const r=vd("strides",e,t,n),s=vd("pad",e,t,n),o=vd("kernelSize",e,t,n);return[i.avgPool3d(vd("x",e,t,n),[o[1],o[2],o[3]],[r[1],r[2],r[3]],s)]}case"MaxPool3D":{const r=vd("strides",e,t,n),s=vd("pad",e,t,n),o=vd("kernelSize",e,t,n);return[i.maxPool3d(vd("x",e,t,n),[o[1],o[2],o[3]],[r[1],r[2],r[3]],s)]}case"Dilation2D":{const r=vd("strides",e,t,n),s=vd("pad",e,t,n),o=vd("dilations",e,t,n),a=r[1],l=r[2],u=o[1],c=o[2];return[i.dilation2d(vd("x",e,t,n),vd("filter",e,t,n),[a,l],s,[u,c],"NHWC")]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"creation":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"Fill":{const r=vd("shape",e,t,n),s=vd("dtype",e,t,n),o=vd("value",e,t,n);return[i.fill(r,o,s)]}case"LinSpace":{const r=vd("start",e,t,n),s=vd("stop",e,t,n),o=vd("num",e,t,n);return[i.linspace(r,s,o)]}case"Multinomial":{const r=vd("logits",e,t,n),s=vd("numSamples",e,t,n),o=vd("seed",e,t,n);return[i.multinomial(r,s,o)]}case"OneHot":{const r=vd("indices",e,t,n),s=vd("depth",e,t,n),o=vd("onValue",e,t,n),a=vd("offValue",e,t,n),l=vd("dtype",e,t,n);return[i.oneHot(r,s,o,a,l)]}case"Ones":return[i.ones(vd("shape",e,t,n),vd("dtype",e,t,n))];case"OnesLike":return[i.onesLike(vd("x",e,t,n))];case"RandomStandardNormal":return[i.randomStandardNormal(vd("shape",e,t,n),vd("dtype",e,t,n),vd("seed",e,t,n))];case"RandomUniform":return[i.randomUniform(vd("shape",e,t,n),vd("minval",e,t,n),vd("maxval",e,t,n),vd("dtype",e,t,n))];case"RandomUniformInt":return[i.randomUniformInt(vd("shape",e,t,n),vd("minval",e,t,n),vd("maxval",e,t,n),vd("seed",e,t,n))];case"Range":{const r=vd("start",e,t,n),s=vd("stop",e,t,n),o=vd("step",e,t,n);return[i.range(r,s,o,vd("dtype",e,t,n))]}case"TruncatedNormal":{const r=vd("shape",e,t,n),s=vd("mean",e,t,n),o=vd("stdDev",e,t,n),a=vd("seed",e,t,n);return[i.truncatedNormal(r,s,o,vd("dtype",e,t,n),a)]}case"Zeros":return[i.zeros(vd("shape",e,t,n),vd("dtype",e,t,n))];case"ZerosLike":return[i.zerosLike(vd("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"dynamic":return(async(e,t,n,i,r=C)=>{switch(e.op){case"NonMaxSuppressionV5":{const{boxes:i,scores:s,maxOutputSize:o,iouThreshold:a,scoreThreshold:l,softNmsSigma:u}=yh(e,t,n),c=await r.image.nonMaxSuppressionWithScoreAsync(i,s,o,a,l,u);return[c.selectedIndices,c.selectedScores]}case"NonMaxSuppressionV4":{const{boxes:i,scores:s,maxOutputSize:o,iouThreshold:a,scoreThreshold:l}=yh(e,t,n),u=vd("padToMaxOutputSize",e,t,n),c=await r.image.nonMaxSuppressionPaddedAsync(i,s,o,a,l,u);return[c.selectedIndices,c.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{const{boxes:i,scores:s,maxOutputSize:o,iouThreshold:a,scoreThreshold:l}=yh(e,t,n);return[await r.image.nonMaxSuppressionAsync(i,s,o,a,l)]}case"Where":{const i=r.cast(vd("condition",e,t,n),"bool"),s=[await r.whereAsync(i)];return i.dispose(),s}case"ListDiff":return r.setdiff1dAsync(vd("x",e,t,n),vd("y",e,t,n));default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n);case"evaluation":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"LowerBound":{const r=vd("sortedSequence",e,t,n),s=vd("values",e,t,n);return[i.lowerBound(r,s)]}case"TopKV2":{const r=vd("x",e,t,n),s=vd("k",e,t,n),o=vd("sorted",e,t,n),a=i.topk(r,s,o);return[a.values,a.indices]}case"UpperBound":{const r=vd("sortedSequence",e,t,n),s=vd("values",e,t,n);return[i.upperBound(r,s)]}case"Unique":{const r=vd("x",e,t,n),s=i.unique(r);return[s.values,s.indices]}case"UniqueV2":{const r=vd("x",e,t,n),s=vd("axis",e,t,n),o=i.unique(r,s);return[o.values,o.indices]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"image":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"ResizeBilinear":{const r=vd("images",e,t,n),s=vd("size",e,t,n),o=vd("alignCorners",e,t,n),a=vd("halfPixelCenters",e,t,n);return[i.image.resizeBilinear(r,[s[0],s[1]],o,a)]}case"ResizeNearestNeighbor":{const r=vd("images",e,t,n),s=vd("size",e,t,n),o=vd("alignCorners",e,t,n),a=vd("halfPixelCenters",e,t,n);return[i.image.resizeNearestNeighbor(r,[s[0],s[1]],o,a)]}case"CropAndResize":{const r=vd("image",e,t,n),s=vd("boxes",e,t,n),o=vd("boxInd",e,t,n),a=vd("cropSize",e,t,n),l=vd("method",e,t,n),u=vd("extrapolationValue",e,t,n);return[i.image.cropAndResize(r,s,o,a,l,u)]}case"ImageProjectiveTransformV3":{const r=vd("images",e,t,n),s=vd("transforms",e,t,n),o=vd("outputShape",e,t,n),a=vd("fillValue",e,t,n),l=vd("interpolation",e,t,n),u=vd("fillMode",e,t,n);return[i.image.transform(r,s,l.toLowerCase(),u.toLowerCase(),a,o)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"graph":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":const r=vd("default",e,t,n);return[bd(e.name,t,n)||r];case"Placeholder":return[bd(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":case"Snapshot":return[Ad(vd("x",e,t,n))];case"IdentityN":return vd("x",e,t,n).map(e=>Ad(e));case"Shape":return[i.tensor1d(vd("x",e,t,n).shape,"int32")];case"ShapeN":return vd("x",e,t,n).map(e=>i.tensor1d(e.shape));case"Size":return[i.scalar(vd("x",e,t,n).size,"int32")];case"Rank":return[i.scalar(vd("x",e,t,n).rank,"int32")];case"NoOp":return[i.scalar(1)];case"Print":const s=vd("x",e,t,n),o=vd("data",e,t,n),a=vd("message",e,t,n),l=vd("summarize",e,t,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(a);for(let e=0;e<o.length;e++)console.log(Array.prototype.slice.call(o[e].dataSync()).slice(0,l));return[s];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"logical":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"Equal":return[i.equal(vd("a",e,t,n),vd("b",e,t,n))];case"NotEqual":return[i.notEqual(vd("a",e,t,n),vd("b",e,t,n))];case"Greater":return[i.greater(vd("a",e,t,n),vd("b",e,t,n))];case"GreaterEqual":return[i.greaterEqual(vd("a",e,t,n),vd("b",e,t,n))];case"Less":return[i.less(vd("a",e,t,n),vd("b",e,t,n))];case"LessEqual":return[i.lessEqual(vd("a",e,t,n),vd("b",e,t,n))];case"LogicalAnd":return[i.logicalAnd(vd("a",e,t,n),vd("b",e,t,n))];case"LogicalNot":return[i.logicalNot(vd("a",e,t,n))];case"LogicalOr":return[i.logicalOr(vd("a",e,t,n),vd("b",e,t,n))];case"Select":case"SelectV2":return[i.where(vd("condition",e,t,n),vd("a",e,t,n),vd("b",e,t,n))];case"BitwiseAnd":return[i.bitwiseAnd(vd("a",e,t,n),vd("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"matrices":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[i.matMul(vd("a",e,t,n),vd("b",e,t,n),vd("transposeA",e,t,n),vd("transposeB",e,t,n))];case"Einsum":return[i.einsum(vd("equation",e,t,n),...vd("tensors",e,t,n))];case"Transpose":return[i.transpose(vd("x",e,t,n),vd("perm",e,t,n))];case"_FusedMatMul":const[r,s]=vd("fusedOps",e,t,n),o="biasadd"===r,a="prelu"===s,l=vd("numArgs",e,t,n),u=vd("leakyreluAlpha",e,t,n);if(o){if(a&&2!==l)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!a&&1!==l)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}const[c,d]=vd("args",e,t,n);return[i.fused.matMul({a:vd("a",e,t,n),b:vd("b",e,t,n),transposeA:vd("transposeA",e,t,n),transposeB:vd("transposeB",e,t,n),bias:c,activation:s,preluActivationWeights:d,leakyreluAlpha:u})];case"MatrixBandPart":return[i.linalg.bandPart(vd("a",e,t,n),vd("numLower",e,t,n),vd("numUpper",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"normalization":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"EuclideanNorm":return[i.euclideanNorm(vd("x",e,t,n),vd("axis",e,t,n),vd("keepDims",e,t,n))];case"FusedBatchNorm":case"FusedBatchNormV2":case"FusedBatchNormV3":return[i.batchNorm(vd("x",e,t,n),vd("mean",e,t,n),vd("variance",e,t,n),vd("offset",e,t,n),vd("scale",e,t,n),vd("epsilon",e,t,n))];case"LRN":return[i.localResponseNormalization(vd("x",e,t,n),vd("radius",e,t,n),vd("bias",e,t,n),vd("alpha",e,t,n),vd("beta",e,t,n))];case"Softmax":return[i.softmax(vd("x",e,t,n))];case"LogSoftmax":return[i.logSoftmax(vd("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"ragged":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"RaggedGather":{const{outputNestedSplits:r,outputDenseValues:s}=i.raggedGather(vd("paramsNestedSplits",e,t,n),vd("paramsDenseValues",e,t,n),vd("indices",e,t,n),vd("outputRaggedRank",e,t,n));return r.concat(s)}case"RaggedRange":{const{rtNestedSplits:r,rtDenseValues:s}=i.raggedRange(vd("starts",e,t,n),vd("limits",e,t,n),vd("splits",e,t,n));return[r,s]}case"RaggedTensorToTensor":return[i.raggedTensorToTensor(vd("shape",e,t,n),vd("values",e,t,n),vd("defaultValue",e,t,n),vd("rowPartitionTensors",e,t,n),vd("rowPartitionTypes",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"reduction":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"Max":{const r=vd("axis",e,t,n),s=vd("keepDims",e,t,n);return[i.max(vd("x",e,t,n),r,s)]}case"Mean":{const r=vd("axis",e,t,n),s=vd("keepDims",e,t,n);return[i.mean(vd("x",e,t,n),r,s)]}case"Min":{const r=vd("axis",e,t,n),s=vd("keepDims",e,t,n);return[i.min(vd("x",e,t,n),r,s)]}case"Sum":{const r=vd("axis",e,t,n),s=vd("keepDims",e,t,n);return[i.sum(vd("x",e,t,n),r,s)]}case"All":{const r=vd("axis",e,t,n),s=vd("keepDims",e,t,n);return[i.all(vd("x",e,t,n),r,s)]}case"Any":{const r=vd("axis",e,t,n),s=vd("keepDims",e,t,n);return[i.any(vd("x",e,t,n),r,s)]}case"ArgMax":{const r=vd("axis",e,t,n);return[i.argMax(vd("x",e,t,n),r)]}case"ArgMin":{const r=vd("axis",e,t,n);return[i.argMin(vd("x",e,t,n),r)]}case"Prod":{const r=vd("axis",e,t,n),s=vd("keepDims",e,t,n);return[i.prod(vd("x",e,t,n),r,s)]}case"Cumprod":{const r=vd("axis",e,t,n),s=vd("exclusive",e,t,n),o=vd("reverse",e,t,n);return[i.cumprod(vd("x",e,t,n),r,s,o)]}case"Cumsum":{const r=vd("axis",e,t,n),s=vd("exclusive",e,t,n),o=vd("reverse",e,t,n);return[i.cumsum(vd("x",e,t,n),r,s,o)]}case"Bincount":const r=vd("x",e,t,n),s=vd("weights",e,t,n),o=vd("size",e,t,n);return[i.bincount(r,s,o)];case"DenseBincount":{const r=vd("x",e,t,n),s=vd("weights",e,t,n),o=vd("size",e,t,n),a=vd("binaryOutput",e,t,n);return[i.denseBincount(r,s,o,a)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"slice_join":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"ConcatV2":case"Concat":{const r=vd("n",e,t,n),s=vd("axis",e,t,n);let o=vd("tensors",e,t,n);return o=o.slice(0,r),[i.concat(o,s)]}case"Gather":{const r=vd("x",e,t,n),s=vd("indices",e,t,n);return[i.gather(r,i.cast(s,"int32"),0)]}case"GatherV2":{const r=vd("axis",e,t,n),s=vd("batchDims",e,t,n),o=vd("x",e,t,n),a=vd("indices",e,t,n);return[i.gather(o,i.cast(a,"int32"),r,s)]}case"Reverse":{const r=vd("dims",e,t,n),s=[];for(let e=0;e<r.length;e++)r[e]&&s.push(e);const o=vd("x",e,t,n);return[i.reverse(o,s)]}case"ReverseV2":{const r=vd("axis",e,t,n),s=vd("x",e,t,n);return[i.reverse(s,r)]}case"Slice":{const r=vd("begin",e,t,n),s=vd("size",e,t,n);return[i.slice(vd("x",e,t,n),r,s)]}case"StridedSlice":{const r=vd("begin",e,t,n),s=vd("end",e,t,n),o=vd("strides",e,t,n),a=vd("beginMask",e,t,n),l=vd("endMask",e,t,n),u=vd("ellipsisMask",e,t,n),c=vd("newAxisMask",e,t,n),d=vd("shrinkAxisMask",e,t,n),h=vd("x",e,t,n);return[i.stridedSlice(h,r,s,o,a,l,u,c,d)]}case"Pack":return(0,N.tidy)(()=>{const r=vd("axis",e,t,n),s=vd("tensors",e,t,n),o=s[0].shape,a=i.squeeze(s[0]).shape,l=s.map(e=>{const t=N.util.arraysEqual(e.shape,o);if(!t&&!N.util.arraysEqual(i.squeeze(e).shape,a))throw new Error("the input tensors shape does not match");return t?e:i.reshape(e,o)});return[i.stack(l,r)]});case"Unpack":{const r=vd("axis",e,t,n),s=vd("tensor",e,t,n);return i.unstack(s,r)}case"Tile":{const r=vd("reps",e,t,n);return[i.tile(vd("x",e,t,n),r)]}case"Split":case"SplitV":{const r=vd("axis",e,t,n),s=vd("numOrSizeSplits",e,t,n),o=vd("x",e,t,n);return i.split(o,s,r)}case"ScatterNd":{const r=vd("indices",e,t,n),s=vd("values",e,t,n),o=vd("shape",e,t,n);return[i.scatterND(r,s,o)]}case"GatherNd":{const r=vd("x",e,t,n),s=vd("indices",e,t,n);return[i.gatherND(r,s)]}case"SparseToDense":{const r=vd("sparseIndices",e,t,n),s=vd("outputShape",e,t,n),o=vd("sparseValues",e,t,n),a=vd("defaultValue",e,t,n);return[i.sparseToDense(r,o,s,o.dtype===a.dtype?a:i.cast(a,o.dtype))]}case"TensorScatterUpdate":{const r=vd("indices",e,t,n),s=vd("values",e,t,n),o=vd("tensor",e,t,n);return[i.tensorScatterUpdate(o,r,s)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"sparse":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"SparseFillEmptyRows":{const{outputIndices:r,outputValues:s,emptyRowIndicator:o,reverseIndexMap:a}=i.sparse.sparseFillEmptyRows(vd("indices",e,t,n),vd("values",e,t,n),vd("denseShape",e,t,n),vd("defaultValue",e,t,n));return[r,s,o,a]}case"SparseReshape":{const{outputIndices:r,outputShape:s}=i.sparse.sparseReshape(vd("inputIndices",e,t,n),vd("inputShape",e,t,n),vd("newShape",e,t,n));return[r,s]}case"SparseSegmentMean":return[i.sparse.sparseSegmentMean(vd("data",e,t,n),vd("indices",e,t,n),vd("segmentIds",e,t,n))];case"SparseSegmentSum":return[i.sparse.sparseSegmentSum(vd("data",e,t,n),vd("indices",e,t,n),vd("segmentIds",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"spectral":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"FFT":return[i.fft(vd("x",e,t,n))];case"IFFT":return[i.ifft(vd("x",e,t,n))];case"RFFT":return[i.rfft(vd("x",e,t,n))];case"IRFFT":return[i.irfft(vd("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"string":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"StaticRegexReplace":return[i.string.staticRegexReplace(vd("input",e,t,n),vd("pattern",e,t,n),vd("rewrite",e,t,n),vd("replaceGlobal",e,t,n))];case"StringNGrams":{const{nGrams:r,nGramsSplits:s}=i.string.stringNGrams(vd("data",e,t,n),vd("dataSplits",e,t,n),vd("separator",e,t,n),vd("nGramWidths",e,t,n),vd("leftPad",e,t,n),vd("rightPad",e,t,n),vd("padWidth",e,t,n),vd("preserveShortSequences",e,t,n));return[r,s]}case"StringSplit":{const{indices:r,values:s,shape:o}=i.string.stringSplit(vd("input",e,t,n),vd("delimiter",e,t,n),vd("skipEmpty",e,t,n));return[r,s,o]}case"StringToHashBucketFast":return[i.string.stringToHashBucketFast(vd("input",e,t,n),vd("numBuckets",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"transformation":return r(()=>((e,t,n,i=C)=>{switch(e.op){case"Cast":return[i.cast(vd("x",e,t,n),vd("dtype",e,t,n))];case"ExpandDims":{const r=vd("axis",e,t,n);return[i.expandDims(vd("x",e,t,n),r)]}case"Squeeze":{const r=vd("axis",e,t,n);return[i.squeeze(vd("x",e,t,n),r)]}case"Reshape":return[i.reshape(vd("x",e,t,n),vd("shape",e,t,n))];case"EnsureShape":return[i.ensureShape(vd("x",e,t,n),vd("shape",e,t,n))];case"MirrorPad":return[i.mirrorPad(vd("x",e,t,n),vd("padding",e,t,n),vd("mode",e,t,n))];case"PadV2":case"Pad":return[i.pad(vd("x",e,t,n),vd("padding",e,t,n),vd("constantValue",e,t,n))];case"SpaceToBatchND":{const r=vd("blockShape",e,t,n),s=vd("paddings",e,t,n);return[i.spaceToBatchND(vd("x",e,t,n),r,s)]}case"BatchToSpaceND":{const r=vd("blockShape",e,t,n),s=vd("crops",e,t,n);return[i.batchToSpaceND(vd("x",e,t,n),r,s)]}case"DepthToSpace":{const r=vd("blockSize",e,t,n),s=vd("dataFormat",e,t,n).toUpperCase();return[i.depthToSpace(vd("x",e,t,n),r,s)]}case"BroadcastTo":return[i.broadcastTo(vd("x",e,t,n),vd("shape",e,t,n))];case"BroadcastArgs":return[i.broadcastArgs(vd("s0",e,t,n),vd("s1",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n));case"hash_table":return(async(e,t,n,i)=>{switch(e.op){case"HashTable":case"HashTableV2":{const r=i.getHashTableHandleByName(e.name);if(null!=r)return[r];{const r=vd("keyDType",e,t,n),s=vd("valueDType",e,t,n),o=new _h(r,s);return i.addHashTable(e.name,o),[o.handle]}}case"InitializeTable":case"InitializeTableV2":case"LookupTableImport":case"LookupTableImportV2":{const r=vd("tableHandle",e,t,n,i),s=vd("keys",e,t,n),o=vd("values",e,t,n),a=i.getHashTableById(r.id);return[await a.import(s,o)]}case"LookupTableFind":case"LookupTableFindV2":{const r=vd("tableHandle",e,t,n,i),s=vd("keys",e,t,n),o=vd("defaultValue",e,t,n),a=i.getHashTableById(r.id);return[await a.find(s,o)]}case"LookupTableSize":case"LookupTableSizeV2":{const r=vd("tableHandle",e,t,n,i);return[i.getHashTableById(r.id).tensorSize()]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n,i);case"custom":const s=yd(e.op);if(s&&s.customExecutor)return s.customExecutor(new ah(e,t,n));throw TypeError(`Custom op ${e.op} is not registered.`);default:throw TypeError(`Unknown op '${e.op}'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()`)}})(e,t,n);return N.util.isPromise(s)?s.then(e=>[].concat(e)):[].concat(s)}class bh{constructor(e={},t={},n={},i={},r){this.weightMap=e,this.tensorArrayMap=t,this.tensorListMap=n,this.functionMap=i,this.parseNodeNameCache=r,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(e,t){return{id:e,frameName:t,iterationId:0}}set currentContext(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())}get currentContext(){return this.contexts}get currentContextId(){return this._currentContextIds[0]}get currentContextIds(){return this._currentContextIds}generateCurrentContextIds(){const e=[];for(let t=0;t<this.contexts.length-1;t++){const n=this.contexts.slice(0,this.contexts.length-t);e.push(this.contextIdforContexts(n))}e.push(""),this._currentContextIds=e}contextIdforContexts(e){return e?e.map(e=>0===e.id&&0===e.iterationId?"":`${e.frameName}-${e.iterationId}`).join("/"):""}enterFrame(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))}exitFrame(){if(!(this.contexts&&this.contexts.length>1))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()}nextIteration(){if(!(this.contexts&&this.contexts.length>0))throw new Error("Cannot increase frame iteration, the context is empty");{this.contexts=this.contexts.slice(),this.lastId++;const e=Object.assign({},this.contexts[this.contexts.length-1]);e.iterationId+=1,e.id=this.lastId,this.contexts.splice(-1,1,e),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))}}getWeight(e){return this.weightMap[e]}addTensorArray(e){this.tensorArrayMap[e.id]=e}getTensorArray(e){return this.tensorArrayMap[e]}addTensorList(e){this.tensorListMap[e.id]=e}getTensorList(e){return this.tensorListMap[e]}dispose(e){for(const t in this.tensorArrayMap)this.tensorArrayMap[t].clearAndClose(e);for(const t in this.tensorListMap)this.tensorListMap[t].clearAndClose(e)}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Th(e,t,n,i){const r=new Set,s=[];let o=null,a=null;const l=new Set,u=new Set(Object.keys(e).map(e=>wd(e)[0]));i=i||[];const c=new Set(i.map(e=>wd(e.name)[0])),d=[...t];for(;d.length>0;){const e=d.pop();(Sh(e)||Ch(e)||Oh(e))&&null==o&&(o=e,a=o.children.map(e=>e.name).filter(e=>r.has(e))),r.add(e.name),null==n[e.name]&&(u.has(e.name)||c.has(e.name)||(0!==e.inputs.length?e.inputs.forEach(e=>{l.has(e.name)||(l.add(e.name),d.push(e))}):s.push(e.name)))}return{inputs:e,outputs:t,usedNodes:r,missingInputs:s,dynamicNode:o,syncInputs:a}}function xh(e,t){const{usedNodes:n,inputs:i}=t,r=Object.keys(i).map(e=>wd(e)[0]).map(t=>e.nodes[t]),s=e.initNodes||[],o=e=>n.has("string"==typeof e?e:e.name);function a(e){return[...new Map(e.map(e=>[e.name,e])).values()]}const l=a([...r,...e.weights,...s]).filter(o),u=a([...l,...Object.values(e.nodes)]).filter(o),c=new Map(u.map(e=>[e.name,e])),d={};for(const e of u){d[e.name]=d[e.name]||0;for(const t of e.children)o(t)||(d[t.name]=Number.POSITIVE_INFINITY),d[t.name]=(d[t.name]||0)+1}const h=Object.entries(d).filter(([,e])=>0===e).map(([e])=>e),p=[...h];for(;h.length>0;){const e=h.pop(),t=c.get(e);for(const e of t.children.filter(o))0===--d[e.name]&&(p.push(e.name),h.push(e.name))}const f=function(e,t){const n=new Map(e.map(e=>[e.name,e])),i=t.map(e=>e.name),r=new Set(i);for(;i.length>0;){const e=i.pop(),t=n.get(e);for(const e of t.children)n.has(e.name)&&!r.has(e.name)&&(r.add(e.name),i.push(e.name))}const s=e.filter(e=>r.has(e.name));return s}(p.map(e=>c.get(e)),l);return function(e,t){const n=new Map(e.map((e,t)=>[e.name,t])),i=new Set(t.map(e=>e.name)),r=e=>i.has("string"==typeof e?e:e.name),s=new Set(e.map(e=>e.name)),o=e=>s.has("string"==typeof e?e:e.name);for(const t of e){for(const e of t.children.filter(o)){if(!n.has(e.name))throw new Eh(`Child ${e.name} of node ${t.name} is unreachable.`);if(n.get(t.name)>n.get(e.name))throw new Eh(`Node ${t.name} is scheduled to run after its child ${e.name}.`)}if(!r(t))for(const e of t.inputs){if(!n.has(e.name))throw new Eh(`Input ${e.name} of node ${t.name} is unreachable.`);if(n.get(e.name)>n.get(t.name))throw new Eh(`Node ${t.name} is scheduled to run before its input ${e.name}.`)}}}(f,l),f}class Eh extends Error{constructor(e){super(`NodesExecutionOrderError: ${e}`)}}const wh=new Set(["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"]),Ih=new Set(["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"]),Ah=new Set(["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"]);function Sh(e){return wh.has(e.op)}function Ch(e){return Ih.has(e.op)}function Oh(e){return Ah.has(e.op)}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Mh{get weightIds(){return this.parent?this.parent.weightIds:this._weightIds}get functionExecutorMap(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}get weightMap(){return this.parent?this.parent.weightMap:this._weightMap}set weightMap(e){const t=Object.keys(e).map(t=>e[t].map(e=>e.id));this._weightIds=[].concat(...t),this._weightMap=e}set resourceManager(e){this._resourceManager=e}get inputs(){return this._inputs.map(e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}))}get outputs(){return this._outputs.map(e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}))}get inputNodes(){return this._inputs.map(e=>e.signatureKey||e.name)}get outputNodes(){return this._outputs.map(e=>{const t=e.signatureKey||e.name;return e.defaultOutput?`${t}:${e.defaultOutput}`:t})}get functions(){return Object.keys(this._functions).reduce((e,t)=>(e[t]=this._functions[t].signature,e),{})}constructor(e,t){this.graph=e,this.parent=t,this.compiledMap=new Map,this.parseNodeNameCache=new Map,this._weightMap={},this.SEPARATOR=",",this._functions={},this._functionExecutorMap={},this.keepIntermediateTensors=!1,this._outputs=e.outputs,this._inputs=e.inputs,this._initNodes=e.initNodes,this._signature=e.signature,this._functions=e.functions,null!=e.functions&&Object.keys(e.functions).forEach(t=>{this._functionExecutorMap[t]=new Mh(e.functions[t],this)})}getCompilationKey(e,t){const n=e.map(e=>e.name).sort(),i=t.map(e=>e.name).sort();return n.join(this.SEPARATOR)+"--"+i.join(this.SEPARATOR)}compile(e,t){const n=Th(e,t,this.weightMap,this._initNodes),{missingInputs:i,dynamicNode:r,syncInputs:s}=n;if(null!=r)throw new Error(`This execution contains the node '${r.name}', which has the dynamic op '${r.op}'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [${s}]`);if(i.length>0){const n=t.map(e=>e.name),r=Object.keys(e);throw new Error(`Cannot compute the outputs [${n}] from the provided inputs [${r}]. Missing the following inputs: [${i}]`)}const o=xh(this.graph,n),a=function(e){const t=new Map(e.map((e,t)=>[e.name,t])),n=Number.MAX_SAFE_INTEGER,i=e.map((e,t)=>Sh(e)?n:t),r=e=>{const n=i[t.get(e.name)];return null==n?-1:n},s=e.map((e,t)=>e.children.map(r).reduce((e,t)=>Math.max(e,t),i[t])),o=new Map;for(let t=0;t<e.length;++t){const i=s[t];if(i===n)continue;const r=e[t],a=e[i];o.has(a.name)||o.set(a.name,[]),o.get(a.name).push(r)}return o}(o);return{orderedNodes:o,nodeLiveUntilMap:a}}cloneAndKeepTensor(e){if(null==e)return null;const t=e.clone();return(0,N.keep)(t),t}cloneTensorList(e){if(!e)return null;return e.map(e=>this.cloneAndKeepTensor(e))}cloneTensorMap(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,this.cloneTensorList(t)]))}execute(e,t){this.disposeIntermediateTensors(),e=this.mapInputs(e);const n=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t);const i=n.map(e=>this.graph.nodes[wd(e)[0]]),r=t.map(e=>wd(e)[0]),s=new Set(r);let o=r.map(e=>this.graph.nodes[e]);0===o.length&&(o=this._outputs);const a=this.getCompilationKey(i,o);let l=this.compiledMap.get(a);null==l&&(l=this.compile(e,o),this.compiledMap.set(a,l));try{this.keepIntermediateTensors=(0,N.env)().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(e){this.keepIntermediateTensors=!1,console.warn(e.message)}const u={},c={};return(0,N.tidy)(()=>{const n=new bh(this.weightMap,u,c,this.functionExecutorMap,this.parseNodeNameCache),i=Object.assign({},this.weightMap);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap)),Object.keys(e).forEach(t=>{const[r,s]=wd(t,n),o=[];o[s]=e[t],i[r]=o,this.keepIntermediateTensors&&(this.clonedTensorsMap[r]=this.cloneTensorList(o))});const r=this.getFrozenTensorIds(i),{orderedNodes:o,nodeLiveUntilMap:a}=l;for(const e of o){if(i[e.name])continue;const t=vh(e,i,n,this._resourceManager);if(N.util.isPromise(t))throw new Error(`The execution of the op '${e.op}' returned a promise. Please use model.executeAsync() instead.`);i[e.name]=t,this.keepIntermediateTensors&&(this.clonedTensorsMap[e.name]=this.cloneTensorList(t)),this.checkTensorForDisposalWithNodeLiveUntilInfo(e,i,n,r,s,a.get(e.name))}return null==this.parent&&n.dispose(r),t.map(e=>bd(e,i,n))})}getFrozenTensorIds(e){const t=[].concat.apply([],Object.keys(e).map(t=>e[t]).map(e=>e.map(e=>e.id)));return new Set(t)}checkTensorForDisposal(e,t,n,i,r,s,o){if(!Sh(t)&&!s.has(e)){for(const i of n[e])null!=i&&(o[i.id]=(o[i.id]||0)+t.children.length);for(const e of t.inputs){if(Sh(e))continue;const t=Td(e.name,n,i);if(null!=t)for(const e of t){if(!e||e.kept||r.has(e.id))continue;const t=o[e.id];1===t?(e.dispose(),delete o[e.id]):null!=t&&o[e.id]--}}}}checkTensorForDisposalWithNodeLiveUntilInfo(e,t,n,i,r,s){function o(e){return Sh(e)||r.has(e.name)}if(!Sh(e)&&null!=s)for(const e of s){if(o(e))continue;const r=Td(e.name,t,n);for(const e of r)!e||e.kept||i.has(e.id)||e.dispose()}}async executeAsync(e,t){return this._executeAsync(e,t)}disposeIntermediateTensors(){this.clonedTensorsMap&&(Object.values(this.clonedTensorsMap).forEach(e=>{for(const t of e)t&&!t.isDisposed&&t.dispose()}),this.clonedTensorsMap=null)}getIntermediateTensors(){return this.clonedTensorsMap}async _executeAsync(e,t,n=!1,i={},r={}){this.disposeIntermediateTensors(),n||(e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t));try{this.keepIntermediateTensors=(0,N.env)().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(e){this.keepIntermediateTensors=!1,console.warn(e.message)}const s=new bh(this.weightMap,i,r,this.functionExecutorMap,this.parseNodeNameCache);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap));const o=await this.executeWithControlFlow(e,s,t,n),a=t.map(e=>bd(e,o,s)),l=a.map(e=>e.id),u=Object.keys(e).map(t=>e[t].id),c=new Set([...l,...u,...this.weightIds]);return Object.values(o).forEach(e=>{e.forEach(e=>{!e||e.isDisposed||c.has(e.id)||e.dispose()})}),null==this.parent&&s.dispose(c),a}async executeFunctionAsync(e,t,n){const i=e.reduce((e,t,n)=>(e[this.inputs[n].name]=t,e),{});return this._executeAsync(i,this.outputNodes,!0,t,n)}async executeWithControlFlow(e,t,n,i){const r=Object.keys(e),s=r.map(e=>this.graph.nodes[wd(e)[0]]),o=n.map(e=>wd(e)[0]),a=new Set(o);let l=o.map(e=>this.graph.nodes[e]);0===l.length&&(l=this._outputs);const{usedNodes:u,missingInputs:c,dynamicNode:d,syncInputs:h}=Th(e,l,this.weightMap,this._initNodes),p=[...s,...this.graph.weights,...this._initNodes||[]].map(e=>({node:e,contexts:t.currentContext})),f=Object.assign({},this.weightMap);Object.keys(e).forEach(t=>{const[n,i]=wd(t),r=[];r[i]=e[t],f[n]=r});const m={},g=this.getFrozenTensorIds(f),y={};for(;p.length>0;){const e=this.processStack(s,p,t,f,y,g,a,m,u);await Promise.all(e)}null!=d||i||console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead.");const _=l.filter(e=>!Sh(e)&&!bd(e.name,f,t)).map(e=>e.name);if(_.length>0){let e="";throw null!=d&&(e=`Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs [${h}]`),new Error(`Cannot compute the outputs [${_}] from the provided inputs [${r}]. Consider providing the following inputs: [${c}]. ${e}`)}return f}processStack(e,t,n,i,r,s,o,a,l){const u=[];for(;t.length>0;){const e=t.pop();n.currentContext=e.contexts;let c="";if("Enter"===e.node.op&&vd("isConstant",e.node,i,n)&&([c]=xd(e.node.name,n)),null==i[e.node.name]){const d=vh(e.node,i,n,this._resourceManager);c||([c]=xd(e.node.name,n));const h=n.currentContext;N.util.isPromise(d)?u.push(d.then(u=>(i[c]=u,this.keepIntermediateTensors&&(this.clonedTensorsMap[c]=this.cloneTensorList(u)),n.currentContext=h,this.checkTensorForDisposal(c,e.node,i,n,s,o,a),this.processChildNodes(e.node,t,n,i,r,l),u))):(i[c]=d,this.keepIntermediateTensors&&(this.clonedTensorsMap[c]=this.cloneTensorList(d)),this.checkTensorForDisposal(c,e.node,i,n,s,o,a),this.processChildNodes(e.node,t,n,i,r,l))}else this.processChildNodes(e.node,t,n,i,r,l)}return u}processChildNodes(e,t,n,i,r,s){e.children.forEach(e=>{const[o]=xd(e.name,n);!r[o]&&s.has(e.name)&&("Merge"===e.op?e.inputNames.some(e=>!!bd(e,i,n))&&(r[o]=!0,t.push({contexts:n.currentContext,node:e})):e.inputNames.every(e=>!!bd(e,i,n))&&(r[o]=!0,t.push({contexts:n.currentContext,node:e})))})}dispose(){Object.keys(this.weightMap).forEach(e=>this.weightMap[e].forEach(e=>e.dispose()))}checkInputShapeAndType(e){Object.keys(e).forEach(t=>{const n=e[t],[i]=wd(t),r=this.graph.nodes[i];if(r.attrParams.shape&&r.attrParams.shape.value){const e=r.attrParams.shape.value,t=e.length===n.shape.length&&n.shape.every((t,n)=>-1===e[n]||e[n]===t);N.util.assert(t,()=>`The shape of dict['${r.name}'] provided in model.execute(dict) must be [${e}], but was [${n.shape}]`)}r.attrParams.dtype&&r.attrParams.dtype.value&&N.util.assert(n.dtype===r.attrParams.dtype.value,()=>`The dtype of dict['${r.name}'] provided in model.execute(dict) must be ${r.attrParams.dtype.value}, but was ${n.dtype}`)})}mapInputs(e){var t,n;const i={};for(const r in e){const s=null===(n=null===(t=this._signature)||void 0===t?void 0:t.inputs)||void 0===n?void 0:n[r];null!=s?i[s.name]=e[r]:i[r]=e[r]}return i}checkInputs(e){const t=Object.keys(e).filter(e=>{const[t]=wd(e);return null==this.graph.nodes[t]});if(t.length>0)throw new Error(`The dict provided in model.execute(dict) has keys: [${t}] that are not part of graph`)}mapOutputs(e){return e.map(e=>{var t,n;const i=null===(n=null===(t=this._signature)||void 0===t?void 0:t.outputs)||void 0===n?void 0:n[e];return null!=i?i.name:e},{})}checkOutputs(e){e.forEach(e=>{const[t]=wd(e);if(!this.graph.nodes[t])throw new Error(`The output '${e}' is not found in the graph`)})}}class Rh{constructor(e={},t={}){this.hashTableNameToHandle=e,this.hashTableMap=t}addHashTable(e,t){this.hashTableNameToHandle[e]=t.handle,this.hashTableMap[t.id]=t}getHashTableHandleByName(e){return this.hashTableNameToHandle[e]}getHashTableById(e){return this.hashTableMap[e]}dispose(){for(const e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(const e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}}var kh=n(77084);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Nh="?tfjs-format=file",Dh="model.json";class Fh{get modelVersion(){return this.version}get inputNodes(){return this.executor.inputNodes}get outputNodes(){return this.executor.outputNodes}get inputs(){return this.executor.inputs}get outputs(){return this.executor.outputs}get weights(){return this.executor.weightMap}get metadata(){return this.artifacts.userDefinedMetadata}get modelSignature(){return this.signature}get modelStructuredOutputKeys(){return this.structuredOutputKeys}constructor(e,t={},n=N.io){this.modelUrl=e,this.loadOptions=t,this.version="n/a",this.io=n,null==t&&(this.loadOptions={}),this.resourceManager=new Rh}findIOHandler(){const e=this.modelUrl;if(null!=e.load)this.handler=e;else if(null!=this.loadOptions.requestInit)this.handler=this.io.browserHTTPRequest(e,this.loadOptions);else{const t=this.io.getLoadHandlers(e,this.loadOptions);if(0===t.length)t.push(this.io.browserHTTPRequest(e,this.loadOptions));else if(t.length>1)throw new Error(`Found more than one (${t.length}) load handlers for URL '${[e]}'`);this.handler=t[0]}}load(){if(this.findIOHandler(),null==this.handler.load)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const e=this.handler.load();return N.util.isPromise(e)?e.then(e=>null==e.getWeightStream?this.loadSync(e):this.loadStreaming(e)):this.loadSync(e)}loadSync(e){const t=this.io.decodeWeights(e.weightData,e.weightSpecs);return this.loadWithWeightMap(e,t)}async loadStreaming(e){if(null==e.getWeightStream)throw new Error("Model artifacts missing streamWeights function");const t=await(0,kh.s5)(e.getWeightStream(),e.weightSpecs);return this.loadWithWeightMap(e,t)}loadWithWeightMap(e,t){this.artifacts=e;const n=this.artifacts.modelTopology;let i=this.artifacts.signature;if(null!=this.artifacts.userDefinedMetadata){const e=this.artifacts.userDefinedMetadata;null!=e.signature&&(i=e.signature),null!=e.structuredOutputKeys&&(this.structuredOutputKeys=e.structuredOutputKeys)}if(this.signature=i,this.version=`${n.versions.producer}.${n.versions.minConsumer}`,this.executor=new Mh(Hd.Instance.transformGraph(n,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(t),this.executor.resourceManager=this.resourceManager,null!=e.modelInitializer&&null!=e.modelInitializer.node){const t=Hd.Instance.transformGraph(e.modelInitializer);this.initializer=new Mh(t),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializerSignature=e.initializerSignature}return!0}async save(e,t){if("string"==typeof e){const t=this.io.getSaveHandlers(e);if(0===t.length)throw new Error(`Cannot find any save handlers for URL '${e}'`);if(t.length>1)throw new Error(`Found more than one (${t.length}) save handlers for URL '${e}'`);e=t[0]}if(null==e.save)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return e.save(this.artifacts)}addStructuredOutputNames(e){if(this.structuredOutputKeys){const t=e instanceof N.Tensor?[e]:e,n={};return t.forEach((e,t)=>n[this.structuredOutputKeys[t]]=e),n}return e}predict(e,t){const n=this.execute(e,this.outputNodes);return this.addStructuredOutputNames(n)}async predictAsync(e,t){const n=await this.executeAsync(e,this.outputNodes);return this.addStructuredOutputNames(n)}normalizeInputs(e){var t;if(!(e instanceof N.Tensor||Array.isArray(e))){const n=null===(t=this.signature)||void 0===t?void 0:t.inputs;if(null!=n)for(const t in n){const i=n[t];null!=i.resourceId&&(e[t]=this.resourceIdToCapturedInput[i.resourceId])}return e}e=Array.isArray(e)?e:[e];const n=Object.keys(this.resourceIdToCapturedInput).length;if(e.length+n!==this.inputNodes.length)throw new Error(`Input tensor count mismatch, the graph model has ${this.inputNodes.length-n} non-resource placeholders, while there are ${e.length} input tensors provided.`);let i=0;return this.inputNodes.reduce((t,n)=>{var r,s,o;const a=null===(o=null===(s=null===(r=this.signature)||void 0===r?void 0:r.inputs)||void 0===s?void 0:s[n])||void 0===o?void 0:o.resourceId;return t[n]=null!=a?this.resourceIdToCapturedInput[a]:e[i++],t},{})}normalizeOutputs(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}executeInitializerGraph(){return null==this.initializer?[]:null==this.initializerSignature?this.initializer.execute({},[]):this.initializer.execute({},Object.keys(this.initializerSignature.outputs))}async executeInitializerGraphAsync(){return null==this.initializer?[]:null==this.initializerSignature?this.initializer.executeAsync({},[]):this.initializer.executeAsync({},Object.keys(this.initializerSignature.outputs))}setResourceIdToCapturedInput(e){if(this.resourceIdToCapturedInput={},this.initializerSignature){const t=this.initializerSignature.outputs,n=Object.keys(t);for(let i=0;i<n.length;i++){const r=t[n[i]];this.resourceIdToCapturedInput[r.resourceId]=e[i]}}}execute(e,t){null==this.resourceIdToCapturedInput&&this.setResourceIdToCapturedInput(this.executeInitializerGraph()),e=this.normalizeInputs(e),t=this.normalizeOutputs(t);const n=this.executor.execute(e,t);return n.length>1?n:n[0]}async executeAsync(e,t){null==this.resourceIdToCapturedInput&&this.setResourceIdToCapturedInput(await this.executeInitializerGraphAsync()),e=this.normalizeInputs(e),t=this.normalizeOutputs(t);const n=await this.executor.executeAsync(e,t);return n.length>1?n:n[0]}getIntermediateTensors(){return this.executor.getIntermediateTensors()}disposeIntermediateTensors(){this.executor.disposeIntermediateTensors()}convertTensorMapToTensorsMap(e){return Object.keys(e).reduce((t,n)=>(t[n]=[e[n]],t),{})}dispose(){this.executor.dispose(),this.initializer&&(this.initializer.dispose(),this.resourceIdToCapturedInput&&(0,N.dispose)(this.resourceIdToCapturedInput)),this.resourceManager.dispose()}}async function Lh(e,t={},n=N.io){if(null==e)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");null==t&&(t={}),t.fromTFHub&&"string"==typeof e&&(e=function(e){e.endsWith("/")||(e+="/");return`${e}${Dh}${Nh}`}(e));const i=new Fh(e,t,n);return await i.load(),i}function Ph(e){if(null==e)throw new Error("modelUrl in loadGraphModelSync() cannot be null. Please provide model artifacts or an IOHandler that loads the model");let t;if(e instanceof Array){const[n,i]=e;if(!n)throw new Error("modelJSON must be the first element of the array");if(!(i&&i instanceof ArrayBuffer))throw new Error("An ArrayBuffer of weights must be the second element of the array");if(!("modelTopology"in n))throw new Error("Model JSON is missing 'modelTopology'");if(!("weightsManifest"in n))throw new Error("Model JSON is missing 'weightsManifest'");const r=N.io.getWeightSpecs(n.weightsManifest),s=N.io.getModelArtifactsForJSONSync(n,r,i);t=N.io.fromMemorySync(s)}else if("load"in e)t=e;else{if(!("modelTopology"in e&&"weightSpecs"in e&&"weightData"in e))throw new Error("Unknown model format");t=N.io.fromMemorySync(e)}const n=new Fh(t);return n.load(),n}
/** @license See the LICENSE file. */
const Bh="4.22.0";
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
var $h,Uh=n(7391);function zh(e,t,n=new Map,i=new Set){if(null==e)return null;if("function"==typeof Blob&&e instanceof Blob)return e.slice();if(i.has(e))throw new Error("Circular references are not supported.");if(n.has(e))return n.get(e);const r=t(e);if(r.recurse&&null!==r.value)throw new Error("A deep map function may not return both a value and recurse=true.");if(r.recurse){if(Hh(e)){const r=Array.isArray(e)?[]:{};i.add(e);for(const s in e){const o=zh(e[s],t,n,i);r[s]=o}return i.delete(e),e.__proto__&&(r.__proto__=e.__proto__),r}throw new Error(`Can't recurse into non-iterable type: ${e}`)}return n.set(e,r.value),r.value}function Vh(e,t=Yh){return jh(e,t)}function jh(e,t,n=new Set){const i=e[0];if(n.has(i))throw new Error("Circular references are not supported.");const r=t(e);if(r.recurse&&null!==r.value)throw new Error("A deep zip function may not return both a value and recurse=true.");if(r.recurse){if(Hh(i)){const r=Array.isArray(i)?[]:{};n.add(i);for(const s in i){const i=jh(e.map(e=>e[s]),t,n);r[s]=i}return n.delete(i),r}throw new Error(`Can't recurse into non-iterable type: ${i}`)}return r.value}function Yh(e){return null===e?null:Hh(e[0])?{value:null,recurse:!0}:{value:e,recurse:!1}}async function Gh(e,t){const n=new Map;zh(e,t,n);for(const e of Array.from(n.keys())){const t=n.get(e);if(N.util.isPromise(t)){const i=await t;n.set(e,i)}}return zh(e,t,n)}function Hh(e){let t=!1;if(N.env().get("IS_BROWSER"))t=e instanceof TextDecoder;else{const{StringDecoder:i}=n(80551);t=e instanceof i}return null!=e&&!ArrayBuffer.isView(e)&&(Array.isArray(e)||"object"==typeof e&&!(e instanceof N.Tensor)&&!(e instanceof Promise)&&!t)}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
function Wh(e){
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
return function(e,t){return zh(e,t)}(e,Xh)}function Xh(e){return e instanceof N.Tensor?{value:e.clone(),recurse:!1}:Hh(e)?{value:null,recurse:!0}:{value:e,recurse:!1}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class qh{constructor(e){if(this.capacity=e,this.begin=0,this.end=0,null==e)throw new RangeError("Can't create a ring buffer of unknown capacity.");if(e<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(e),this.doubledCapacity=2*e}wrap(e){for(;e<0;)e+=this.doubledCapacity;return e%this.doubledCapacity}get(e){if(e<0)throw new RangeError("Can't get item at a negative index.");return this.data[e%this.capacity]}set(e,t){if(e<0)throw new RangeError("Can't set item at a negative index.");this.data[e%this.capacity]=t}length(){let e=this.end-this.begin;return e<0&&(e=this.doubledCapacity+e),e}isFull(){return this.length()===this.capacity}isEmpty(){return 0===this.length()}push(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,e),this.end=this.wrap(this.end+1)}pushAll(e){for(const t of e)this.push(t)}pop(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);const e=this.get(this.end);return this.set(this.end,void 0),e}unshift(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,e)}shift(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");const e=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),e}shuffleExcise(e){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");const t=this.wrap(this.begin+e),n=this.get(t);return this.set(t,this.pop()),n}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class Kh extends qh{constructor(){super(Kh.INITIAL_CAPACITY)}isFull(){return!1}push(e){super.isFull()&&this.expand(),super.push(e)}unshift(e){super.isFull()&&this.expand(),super.unshift(e)}expand(){const e=2*this.capacity,t=new Array(e),n=this.length();for(let e=0;e<n;e++)t[e]=this.get(this.wrap(this.begin+e));this.data=t,this.capacity=e,this.doubledCapacity=2*this.capacity,this.begin=0,this.end=n}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
function Zh(e){return new tp(e)}function Qh(e){return new np(e)}function Jh(e,t){return new pp(e,t)}Kh.INITIAL_CAPACITY=32;class ep{async toArray(){const e=[];let t=await this.next();for(;!t.done;)e.push(t.value),t=await this.next();return e}async toArrayForTest(){const e=this.prefetch(100),t=[];let n=await e.next();for(;!n.done;)t.push(n.value),n=await e.next();return t}async resolveFully(){let e=await this.next();for(;!e.done;)e=await this.next()}async resolveWhile(e){let t=await this.next(),n=e(t.value);for(;!t.done&&n;)t=await this.next(),n=e(t.value)}handleErrors(e){return new up(this,e)}filter(e){return new ap(this,e)}map(e){return new lp(this,e)}mapAsync(e){return new cp(this,e)}serialMapAsync(e){return new cp(this,e).serial()}flatmap(e){return new hp(this,e)}async forEachAsync(e){return this.map(e).resolveFully()}async serialForEach(e){return this.serialMapAsync(e).resolveWhile(e=>!0===e)}rowMajorBatch(e,t=!0){return new op(this,e,t)}columnMajorBatch(e,t=!0,n=Yh){return this.rowMajorBatch(e,t).map(e=>Vh(e,n))}concatenate(e,t){return new pp(Zh([this,e]),t)}take(e){return e<0||null==e?this:new sp(this,e)}skip(e){return e<0||null==e?this:new rp(this,e)}prefetch(e){return new mp(this,e)}shuffle(e,t){return new gp(this,e,t)}serial(){return new ip(this)}}class tp extends ep{constructor(e){super(),this.items=e,this.trav=0}summary(){return`Array of ${this.items.length} items`}async next(){if(this.trav>=this.items.length)return{value:null,done:!0};const e=this.items[this.trav];return this.trav++,{value:Wh(e),done:!1}}}class np extends ep{constructor(e){super(),this.nextFn=e}summary(){return"Function call"}async next(){try{return this.nextFn()}catch(e){throw e.message=`Error thrown while iterating through a dataset: ${e.message}`,e}}}class ip extends ep{constructor(e){super(),this.upstream=e,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Serial`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){return this.upstream.next()}}class rp extends ep{constructor(e,t){super(),this.upstream=e,this.maxCount=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Skip`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.count++<this.maxCount;){const e=await this.upstream.next();if(e.done)return e;N.dispose(e.value)}return this.upstream.next()}}class sp extends ep{constructor(e,t){super(),this.upstream=e,this.maxCount=t,this.count=0}summary(){return`${this.upstream.summary()} -> Take`}async next(){return this.count++>=this.maxCount?{value:null,done:!0}:this.upstream.next()}}class op extends ep{constructor(e,t,n=!0){super(),this.upstream=e,this.batchSize=t,this.enableSmallLastBatch=n,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> RowMajorBatch`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){const e=[];for(;e.length<this.batchSize;){const t=await this.upstream.next();if(t.done)return this.enableSmallLastBatch&&e.length>0?{value:e,done:!1}:{value:null,done:!0};e.push(t.value)}return{value:e,done:!1}}}class ap extends ep{constructor(e,t){super(),this.upstream=e,this.predicate=t,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Filter`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;){const e=await this.upstream.next();if(e.done||this.predicate(e.value))return e;N.dispose(e.value)}}}class lp extends ep{constructor(e,t){super(),this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Map`}async next(){const e=await this.upstream.next();if(e.done)return{value:null,done:!0};const t=N.tensor_util.getTensorsInContainer(e.value),n=this.transform(e.value),i=N.tensor_util.getTensorsInContainer(n);for(const e of t)N.tensor_util.isTensorInList(e,i)||e.dispose();return{value:n,done:!1}}}class up extends ep{constructor(e,t){super(),this.upstream=e,this.handler=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> handleErrors`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;)try{return await this.upstream.next()}catch(e){if(!this.handler(e))return{value:null,done:!0}}}}class cp extends ep{constructor(e,t){super(),this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> AsyncMap`}async next(){const e=await this.upstream.next();if(e.done)return{value:null,done:!0};const t=N.tensor_util.getTensorsInContainer(e.value),n=await this.transform(e.value),i=N.tensor_util.getTensorsInContainer(n);for(const e of t)N.tensor_util.isTensorInList(e,i)||e.dispose();return{value:n,done:!1}}}class dp extends ep{constructor(){super(),this.outputQueue=new Kh,this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;0===this.outputQueue.length();)if(!await this.pump())return{value:null,done:!0};return{value:this.outputQueue.shift(),done:!1}}}class hp extends dp{constructor(e,t){super(),this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Flatmap`}async pump(){const e=await this.upstream.next();if(e.done)return!1;const t=N.tensor_util.getTensorsInContainer(e.value),n=this.transform(e.value),i=N.tensor_util.getTensorsInContainer(n);this.outputQueue.pushAll(n);for(const e of t)N.tensor_util.isTensorInList(e,i)||e.dispose();return!0}}class pp extends ep{constructor(e,t){super(),this.baseErrorHandler=t,this.lastRead=null,this.iterator=null,this.moreIterators=e}summary(){return"TODO: fill in upstream of chained summaries -> Chained"}async next(){return this.lastRead=this.readFromChain(this.lastRead),this.lastRead}async readFromChain(e){if(await e,null==this.iterator){const e=await this.moreIterators.next();if(e.done)return{value:null,done:!0};this.iterator=e.value,null!=this.baseErrorHandler&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler))}const t=await this.iterator.next();return t.done?(this.iterator=null,this.readFromChain(e)):t}}!function(e){e[e.FAIL=0]="FAIL",e[e.SHORTEST=1]="SHORTEST",e[e.LONGEST=2]="LONGEST"}($h||($h={}));class fp extends ep{constructor(e,t=$h.FAIL){super(),this.iterators=e,this.mismatchMode=t,this.count=0,this.currentPromise=null}summary(){return"{TODO: fill in upstream of zip summaries} -> Zip"}async nextState(e){await e;let t=0,n=0;const i=await Gh(this.iterators,function(e){if(e instanceof ep){return{value:e.next().then(e=>(t++,e.done&&n++,e.value)),recurse:!1}}return{value:null,recurse:!0}});if(t===n)return{value:null,done:!0};if(n>0)switch(this.mismatchMode){case $h.FAIL:throw new Error(`Zipped streams should have the same length. Mismatched at element ${this.count}.`);case $h.SHORTEST:return{value:null,done:!0};case $h.LONGEST:}return this.count++,{value:i,done:!1}}async next(){return this.currentPromise=this.nextState(this.currentPromise),this.currentPromise}}class mp extends ep{constructor(e,t){super(),this.upstream=e,this.bufferSize=t,this.buffer=new qh(t)}summary(){return`${this.upstream.summary()} -> Prefetch`}refill(){for(;!this.buffer.isFull();){const e=this.upstream.next();this.buffer.push(e)}}next(){return this.refill(),this.buffer.shift()}}class gp extends mp{constructor(e,t,n){super(e,t),this.upstream=e,this.windowSize=t,this.upstreamExhausted=!1,this.random=Uh.alea(n||N.util.now().toString()),this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}randomInt(e){return Math.floor(this.random()*e)}chooseIndex(){return this.randomInt(this.buffer.length())}async serialNext(){for(this.upstreamExhausted||this.refill();!this.buffer.isEmpty();){const e=this.chooseIndex(),t=await this.buffer.shuffleExcise(e);if(!t.done)return this.refill(),t;this.upstreamExhausted=!0}return{value:null,done:!0}}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class yp{constructor(){this.size=null}batch(e,t=!0){const n=this;let i;return N.util.assert(e>0,()=>`batchSize needs to be positive, but it is\n ${e}`),i=this.size===1/0||null==this.size?this.size:t?Math.ceil(this.size/e):Math.floor(this.size/e),_p(async()=>(await n.iterator()).columnMajorBatch(e,t,Tp),i)}concatenate(e){const t=this;let n;return n=this.size===1/0||e.size===1/0?1/0:null!=this.size&&null!=e.size?this.size+e.size:null,_p(async()=>(await t.iterator()).concatenate(await e.iterator()),n)}filter(e){const t=this;let n;return n=this.size===1/0?1/0:null,_p(async()=>(await t.iterator()).filter(t=>N.tidy(()=>e(t))),n)}async forEachAsync(e){return(await this.iterator()).forEachAsync(e)}map(e){const t=this;return _p(async()=>(await t.iterator()).map(t=>N.tidy(()=>e(t))),this.size)}mapAsync(e){const t=this;return _p(async()=>(await t.iterator()).mapAsync(e),this.size)}prefetch(e){if(null==e)throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");const t=this;return _p(async()=>(await t.iterator()).prefetch(e),this.size)}repeat(e){const t=this;let n;return n=null!=this.size&&e>0?this.size*e:0===e?0:null!=this.size&&(void 0===e||e<0)?1/0:null,_p(async()=>Jh(Qh(async()=>({value:await t.iterator(),done:!1})).take(e)),n)}skip(e){const t=this;let n;return n=null!=this.size&&e>=0&&this.size>=e?this.size-e:null!=this.size&&(this.size<e||void 0===e||e<0)?0:null,_p(async()=>(await t.iterator()).skip(e),n)}shuffle(e,t,n=!0){if(null==e||e<0)throw null==this.size?new RangeError("`Dataset.shuffle()` requires bufferSize to be specified."):new RangeError(`\`Dataset.shuffle()\` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for \`tf.Tensor\`s), consider setting bufferSize to the dataset size (${this.size} elements)`);const i=this,r=Uh.alea(t||N.util.now().toString());return _p(async()=>{let t=r.int32();return n&&(t+=r.int32()),(await i.iterator()).shuffle(e,t.toString())},this.size)}take(e){const t=this;let n;return n=null!=this.size&&this.size>e?e:null!=this.size&&this.size<=e?this.size:null,_p(async()=>(await t.iterator()).take(e),n)}async toArray(){if(this.size===1/0)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArray()}async toArrayForTest(){if(this.size===1/0)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArrayForTest()}}function _p(e,t=null){return new class extends yp{constructor(){super(...arguments),this.size=t}async iterator(){return e()}}}function vp(e){return _p(async()=>Zh(e),e.length)}function bp(e){if(!Hh(e))throw new Error("The argument to zip() must be an object or array.");let t;if(Array.isArray(e))for(let n=0;n<e.length;n++)t=null==t?e[n].size:Math.min(t,e[n].size);else if(e instanceof Object)for(const n in e)t=null==t?e[n].size:Math.min(t,e[n].size);return _p(async()=>function(e,t=$h.FAIL){return new fp(e,t)}(await Gh(e,e=>{if(e instanceof yp)return{value:e.iterator(),recurse:!1};if(Hh(e))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")}),$h.SHORTEST),t)}function Tp(e){if(null===e)return null;const t=e[0];if(null==(n=t)||null===(i=n)||"object"!=typeof i&&"function"!=typeof i||Array.isArray(n)||"object"==typeof n&&n instanceof N.Tensor||N.util.isTypedArray(n)){return{value:function(e){if(0===e.length)throw new Error("Can't make a batch of zero elements.");return e[0]instanceof N.Tensor?N.stack(e):N.tensor(e)}(e),recurse:!1}}var n,i;return{value:null,recurse:!0}}yp.MAX_BUFFER_SIZE=1e4;
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class xp extends yp{constructor(e){super(),this.input=e}async iterator(){return(await this.input.iterator()).decodeUTF8().split("\n").map(e=>(e.endsWith("\r")&&(e=e.slice(0,-1)),e))}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
const Ep='"',wp=Symbol("out"),Ip=Symbol("field"),Ap=Symbol("quote"),Sp=Symbol("quoteafterquote"),Cp=Symbol("quoteinquote");class Op extends yp{async columnNames(){return this.columnNamesValidated||await this.setColumnNames(),this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames}async setColumnNames(){const e=await this.maybeReadHeaderLine();if(!this.fullColumnNames&&!e)throw new Error("Column names must be provided if there is no header line.");this.fullColumnNames&&e&&N.util.assert(e.length===this.fullColumnNames.length,()=>"The length of provided columnNames ("+this.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+e.length.toString()+")."),this.fullColumnNames||(this.fullColumnNames=e);const t=this.fullColumnNames.reduce((e,t)=>(e[t]=e[t]+1||1,e),{}),n=Object.keys(t).filter(e=>t[e]>1);if(N.util.assert(0===n.length,()=>"Duplicate column names found: "+n.toString()),this.columnConfigs)for(const e of Object.keys(this.columnConfigs)){if(-1===this.fullColumnNames.indexOf(e))throw new Error('The key "'+e+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").")}this.columnNamesValidated=!0}async maybeReadHeaderLine(){if(this.hasHeader){const e=await this.base.iterator(),t=await e.next();if(t.done)throw new Error("No data was found for CSV parsing.");const n=t.value;return this.parseRow(n,!1)}return null}constructor(e,t){super(),this.input=e,this.hasHeader=!0,this.fullColumnNames=null,this.columnNamesValidated=!1,this.columnConfigs=null,this.configuredColumnsOnly=!1,this.delimiter=",",this.delimWhitespace=!1,this.base=new xp(e),t||(t={}),this.hasHeader=!1!==t.hasHeader,this.fullColumnNames=t.columnNames,this.columnConfigs=t.columnConfigs,this.configuredColumnsOnly=t.configuredColumnsOnly,t.delimWhitespace?(N.util.assert(null==t.delimiter,()=>"Delimiter should not be provided when delimWhitespace is true."),this.delimWhitespace=!0,this.delimiter=" "):this.delimiter=t.delimiter?t.delimiter:","}async iterator(){this.columnNamesValidated||await this.setColumnNames();let e=await this.base.iterator();return this.hasHeader&&(e=e.skip(1)),e.map(e=>this.makeDataElement(e))}makeDataElement(e){const t=this.parseRow(e),n={},i={};for(let r=0;r<this.fullColumnNames.length;r++){const s=this.fullColumnNames[r],o=this.columnConfigs?this.columnConfigs[s]:null;if(!this.configuredColumnsOnly||o){const a=t[r];let l=null;if(""===a)if(o&&void 0!==o.default)l=o.default;else{if(o&&(o.required||o.isLabel))throw new Error(`Required column ${s} is empty in this line: ${e}`);l=void 0}else{const e=Number(a);if(isNaN(e))l=o&&"bool"===o.dtype?this.getBoolean(a):a;else if(o&&o.dtype)switch(o.dtype){case"float32":default:l=e;break;case"int32":l=Math.floor(e);break;case"bool":l=this.getBoolean(a)}else l=e}o&&o.isLabel?i[s]=l:n[s]=l}}return 0===Object.keys(i).length?n:{xs:n,ys:i}}getBoolean(e){return"1"===e||"true"===e.toLowerCase()?1:0}parseRow(e,t=!0){const n=[];let i=0;const r=e.length;let s=wp;for(let t=0;t<r;t++)switch(s){case wp:switch(e.charAt(t)){case Ep:i=t+1,s=Ap;break;case this.delimiter:if(i=t+1," "===this.delimiter&&this.delimWhitespace)break;n.push(""),s=wp;break;default:s=Ip,i=t}break;case Ip:if(e.charAt(t)===this.delimiter)n.push(e.substring(i,t)),s=wp,i=t+1;break;case Ap:if(e.charAt(t)===Ep)s=Sp;break;case Sp:switch(e.charAt(t)){case this.delimiter:n.push(e.substring(i,t-1)),s=wp,i=t+1;break;case Ep:s=Ap;break;default:s=Cp}break;case Cp:if(e.charAt(t)===Ep)s=Ap}if(s===Sp?n.push(e.substring(i,r-1)):n.push(e.substring(i)),t&&n.length!==this.fullColumnNames.length)throw new Error(`Invalid row in csv file. Should have ${this.fullColumnNames.length} elements in a row, but got ${n}`);return n}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class Mp extends ep{constructor(e){super(),this.microphoneConfig=e,this.isClosed=!1,this.fftSize=e.fftSize||1024;const t=Math.log2(this.fftSize);if(this.fftSize<0||t<4||t>14||!Number.isInteger(t))throw new Error(`Invalid fftSize: it must be a power of 2 between 2 to 4 and 2 to 14, but got ${this.fftSize}`);if(this.numFrames=e.numFramesPerSpectrogram||43,this.sampleRateHz=e.sampleRateHz,this.columnTruncateLength=e.columnTruncateLength||this.fftSize,this.audioTrackConstraints=e.audioTrackConstraints,this.smoothingTimeConstant=e.smoothingTimeConstant||0,this.includeSpectrogram=!1!==e.includeSpectrogram,this.includeWaveform=!0===e.includeWaveform,!this.includeSpectrogram&&!this.includeWaveform)throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.")}summary(){return"microphone"}static async create(e={}){if(!(0,N.env)().get("IS_BROWSER"))throw new Error("microphone API is only supported in browser environment.");const t=new Mp(e);return await t.start(),t}async start(){try{this.stream=await navigator.mediaDevices.getUserMedia({audio:null==this.audioTrackConstraints||this.audioTrackConstraints,video:!1})}catch(e){throw new Error(`Error thrown while initializing video stream: ${e.message}`)}if(!this.stream)throw new Error("Could not obtain audio from microphone.");const e=window.AudioContext||window.webkitAudioContext;if(this.audioContext=new e,this.sampleRateHz){if(this.audioContext.sampleRate!==this.sampleRateHz)throw new Error(`Mismatch in sampling rate: Expected: ${this.sampleRateHz}; Actual: ${this.audioContext.sampleRate}`)}else this.sampleRateHz=this.audioContext.sampleRate;const t=this.audioContext.createMediaStreamSource(this.stream);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=this.smoothingTimeConstant,t.connect(this.analyser),this.freqData=new Float32Array(this.fftSize),this.timeData=new Float32Array(this.fftSize)}async next(){if(this.isClosed)return{value:null,done:!0};let e,t;const n=await this.getAudioData();if(this.includeSpectrogram){const t=this.flattenQueue(n.freqDataQueue);e=this.getTensorFromAudioDataArray(t,[this.numFrames,this.columnTruncateLength,1])}if(this.includeWaveform){const e=this.flattenQueue(n.timeDataQueue);t=this.getTensorFromAudioDataArray(e,[this.numFrames*this.fftSize,1])}return{value:{spectrogram:e,waveform:t},done:!1}}async capture(){return(await this.next()).value}async getAudioData(){const e=[],t=[];let n=0;return new Promise(i=>{const r=setInterval(()=>{this.includeSpectrogram&&(this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-1/0&&i({freqDataQueue:e,timeDataQueue:t}),e.push(this.freqData.slice(0,this.columnTruncateLength))),this.includeWaveform&&(this.analyser.getFloatTimeDomainData(this.timeData),t.push(this.timeData.slice())),++n===this.numFrames&&(clearInterval(r),i({freqDataQueue:e,timeDataQueue:t}))},this.fftSize/this.sampleRateHz*1e3)})}stop(){this.isClosed||(this.isClosed=!0,this.analyser.disconnect(),this.audioContext.close(),null!=this.stream&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop())}toArray(){throw new Error("Can not convert infinite audio stream to array.")}getSampleRate(){return this.sampleRateHz}flattenQueue(e){const t=e[0].length,n=new Float32Array(e.length*t);return e.forEach((e,i)=>n.set(e,i*t)),n}getTensorFromAudioDataArray(e,t){const n=new Float32Array(N.util.sizeFromShape(t));return n.set(e,n.length-e.length),(0,N.tensor)(n,t)}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class Rp extends ep{constructor(e,t){if(super(),this.webcamVideoElement=e,this.webcamConfig=t,this.isClosed=!0,this.resize=!1,this.needToResize())if(this.resize=!0,this.cropSize=[this.webcamConfig.resizeHeight,this.webcamConfig.resizeWidth],this.cropBoxInd=(0,N.tensor1d)([0],"int32"),this.webcamConfig.centerCrop){const e=1*this.webcamConfig.resizeWidth/this.webcamVideoElement.width,t=1*this.webcamConfig.resizeHeight/this.webcamVideoElement.height,n=(1-e)/2,i=(1-t)/2,r=n+e,s=t+i;this.cropBox=(0,N.tensor2d)([i,n,s,r],[1,4])}else this.cropBox=(0,N.tensor2d)([0,0,1,1],[1,4])}summary(){return"webcam"}static async create(e,t={}){if(!(0,N.env)().get("IS_BROWSER"))throw new Error("tf.data.webcam is only supported in browser environment.");if(!e){if(e=document.createElement("video"),!t.resizeWidth||!t.resizeHeight)throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");e.width=t.resizeWidth,e.height=t.resizeHeight}const n=new Rp(e,t);return await n.start(),n}async start(){this.webcamConfig.facingMode&&N.util.assert("user"===this.webcamConfig.facingMode||"environment"===this.webcamConfig.facingMode,()=>`Invalid webcam facing mode: ${this.webcamConfig.facingMode}. Please provide 'user' or 'environment'`);try{this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:this.webcamConfig.deviceId,facingMode:this.webcamConfig.facingMode?this.webcamConfig.facingMode:"user",width:this.webcamVideoElement.width,height:this.webcamVideoElement.height}})}catch(e){throw e.message=`Error thrown while initializing video stream: ${e.message}`,e}if(!this.stream)throw new Error("Could not obtain video from webcam.");try{this.webcamVideoElement.srcObject=this.stream}catch(e){console.log(e),this.webcamVideoElement.src=window.URL.createObjectURL(this.stream)}return this.webcamVideoElement.play(),this.isClosed=!1,new Promise(e=>{this.webcamVideoElement.onloadedmetadata=()=>{e()}})}async next(){if(this.isClosed)return{value:null,done:!0};let e;try{e=N.browser.fromPixels(this.webcamVideoElement)}catch(e){throw new Error(`Error thrown converting video to pixels: ${JSON.stringify(e)}`)}if(!this.resize)return{value:e,done:!1};try{return{value:this.cropAndResizeFrame(e),done:!1}}catch(e){throw new Error(`Error thrown cropping the video: ${e.message}`)}finally{e.dispose()}}needToResize(){return!(!this.webcamConfig.resizeWidth||!this.webcamConfig.resizeHeight||this.webcamVideoElement.width===this.webcamConfig.resizeWidth&&this.webcamVideoElement.height===this.webcamConfig.resizeHeight)}cropAndResizeFrame(e){return(0,N.tidy)(()=>{const t=(0,N.expandDims)((0,N.cast)(e,"float32"),0);let n;n=N.image.cropAndResize(t,this.cropBox,this.cropBoxInd,this.cropSize,"bilinear");const i=n.shape;return(0,N.reshape)(n,i.slice(1))})}async capture(){return(await this.next()).value}stop(){this.stream.getTracks().forEach(e=>e.stop());try{this.webcamVideoElement.srcObject=null}catch(e){console.log(e),this.webcamVideoElement.src=null}this.isClosed=!0}toArray(){throw new Error("Can not convert infinite video stream to array.")}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class kp{}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class Np extends ep{split(e){return new Dp(this,e)}}class Dp extends Np{constructor(e,t){super(),this.upstream=e,this.impl=new Fp(e,t)}summary(){return this.impl.summary()}async next(){return this.impl.next()}}class Fp extends dp{constructor(e,t){super(),this.upstream=e,this.separator=t,this.carryover=""}summary(){return`${this.upstream.summary()} -> Split('${this.separator}')`}async pump(){const e=await this.upstream.next();if(e.done)return""!==this.carryover&&(this.outputQueue.push(this.carryover),this.carryover="",!0);const t=e.value.split(this.separator);t[0]=this.carryover+t[0];for(const e of t.slice(0,-1))this.outputQueue.push(e);return this.carryover=t[t.length-1],!0}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class Lp extends ep{decodeUTF8(){return new Pp(this)}}class Pp extends Np{constructor(e){super(),this.upstream=e,this.impl=new Bp(e)}summary(){return this.impl.summary()}async next(){return this.impl.next()}}class Bp extends dp{constructor(e){if(super(),this.upstream=e,(0,N.env)().get("IS_BROWSER"))this.decoder=new TextDecoder("utf-8");else{const{StringDecoder:e}=n(4530);this.decoder=new e("utf8")}}summary(){return`${this.upstream.summary()} -> Utf8`}async pump(){const e=await this.upstream.next();let t,n;return!e.done&&(t=e.value,n=(0,N.env)().get("IS_BROWSER")?this.decoder.decode(t,{stream:!0}):this.decoder.write(Buffer.from(t.buffer)),this.outputQueue.push(n),!0)}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class $p extends Lp{constructor(e,t={}){super(),this.file=e,this.options=t,N.util.assert(e instanceof Uint8Array||!!(0,N.env)().get("IS_BROWSER")&&(e instanceof File||e instanceof Blob),()=>"FileChunkIterator only supports File, Blob and Uint8Array right now."),this.offset=t.offset||0,this.chunkSize=t.chunkSize||1048576}summary(){return`FileChunks ${this.file}`}async next(){if(this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size))return{value:null,done:!0};const e=new Promise((e,t)=>{const n=this.offset+this.chunkSize;if(this.file instanceof Uint8Array)e(new Uint8Array(this.file.slice(this.offset,n)));else{const i=new FileReader;i.onload=n=>{let r=i.result;if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),!(r instanceof Uint8Array))return t(new TypeError("FileReader returned unknown type."));e(r)},i.onabort=e=>t(new Error("Aborted")),i.onerror=e=>t(new Error(e.type));const r=this.file.slice(this.offset,n);i.readAsArrayBuffer(r)}this.offset=n});return{value:await e,done:!1}}}const Up=e=>({method:e.method,headers:e.headers,body:e.body,mode:e.mode,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity});
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
function zp(e){return"string"==typeof e&&"file://"===e.slice(0,7)}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class Vp extends kp{constructor(e,t={}){super(),this.input=e,this.options=t}async iterator(){if(zp(this.input)&&(0,N.env)().get("IS_NODE")){const e=n(8108);this.input=e.readFileSync(this.input.slice(7))}return new $p(this.input,this.options)}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
class jp extends kp{constructor(e,t={}){super(),this.url=e,this.fileOptions=t}async iterator(){return zp(this.url)?new Vp(this.url,this.fileOptions).iterator():
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
async function(e,t={},n){let i,r;"string"==typeof e?i=e:(i=e.url,r=Up(e));const s=await(n||N.util.fetch)(i,r);if(s.ok){const e=new Uint8Array(await s.arrayBuffer());return new $p(e,t)}throw new Error(s.statusText)}(this.url,this.fileOptions)}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
function Yp(e,t={}){return new Op(new jp(e),t)}function Gp(e){const t=Qh(e);return _p(async()=>t)}function Hp(e){return _p(async()=>{const t=await e();return Qh(()=>t.next())})}async function Wp(e,t){return Rp.create(e,t)}async function Xp(e){return Mp.create(e)}
/** @license See the LICENSE file. */
const qp="4.22.0";
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Kp(e,t){Array.isArray(e)||(e=[e]),e.forEach(e=>{null!=e&&N.util.assert("complex64"!==e.dtype,()=>`${t} does not support complex64 tensors in the CPU backend.`)})}
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Zp=N.kernel_impls.whereImpl;class Qp extends N.KernelBackend{nextDataId(){return Qp.nextDataId++}constructor(){super(),this.blockSize=48,this.firstUse=!0,this.data=new N.DataStorage(this,(0,N.engine)())}write(e,t,n){this.firstUse&&(this.firstUse=!1,(0,N.env)().get("IS_NODE")&&N.backend_util.warn("\n============================\nHi, looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, visit https://github.com/tensorflow/tfjs-node for more details. \n============================"));const i={id:this.nextDataId()};return this.data.set(i,{values:e,dtype:n,refCount:1}),i}makeTensorInfo(e,t,n){let i;if("string"===t&&null!=n&&n.length>0&&N.util.isString(n[0])){const r=n.map(e=>N.util.encodeString(e));i=this.write(r,e,t)}else i=this.write(n,e,t);return{dataId:i,shape:e,dtype:t}}refCount(e){if(this.data.has(e)){return this.data.get(e).refCount}return 0}incRef(e){this.data.get(e).refCount++}decRef(e){if(this.data.has(e)){this.data.get(e).refCount--}}move(e,t,n,i,r){this.data.set(e,{values:t,dtype:i,refCount:r})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){const{dtype:t,complexTensorInfos:n}=this.data.get(e);if("complex64"===t){const e=this.readSync(n.real.dataId),t=this.readSync(n.imag.dataId);return N.backend_util.mergeRealAndImagArrays(e,t)}return N.util.convertBackendValuesAndArrayBuffer(this.data.get(e).values,t)}bufferSync(e){const t=this.readSync(e.dataId);if("string"===e.dtype)try{const n=t.map(e=>N.util.decodeString(e));return(0,N.buffer)(e.shape,e.dtype,n)}catch(e){throw new Error("Failed to decode encoded string bytes into utf-8")}return(0,N.buffer)(e.shape,e.dtype,t)}makeOutput(e,t,n){return(0,N.engine)().makeTensorFromTensorInfo(this.makeTensorInfo(t,n,e),this)}disposeData(e,t=!1){if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;const{complexTensorInfos:n}=this.data.get(e);null!=n&&(this.disposeData(n.real.dataId,!0),this.disposeData(n.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){const t=N.util.now();e();return{kernelMs:N.util.now()-t}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){Kp([e],"where");const t=this.readSync(e.dataId);return Zp(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Jp(e){const t=new Float32Array(e.length);for(let n=0;n<e.length;++n)t[n]=Math.abs(e[n]);return t}Qp.nextDataId=0;const ef={kernelName:N.Abs,backendName:"cpu",kernelFunc:e=>{const{x:t}=e.inputs,n=e.backend;Kp(t,"abs");let i=new Float32Array(N.util.sizeFromShape(t.shape));return i=Jp(n.data.get(t.dataId).values),n.makeOutput(i,t.shape,t.dtype)}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function tf(e){return(t,n,i,r,s)=>{const o=N.backend_util.assertAndGetBroadcastShape(t,n),a=o.length,l=N.util.computeStrides(o),u=N.util.sizeFromShape(o),c=N.util.getTypedArrayFromDType(s,u),d=t.length,h=n.length,p=N.util.computeStrides(t),f=N.util.computeStrides(n),m=N.backend_util.getBroadcastDims(t,o),g=N.backend_util.getBroadcastDims(n,o);if(m.length+g.length===0)for(let t=0;t<c.length;++t)c[t]=e(i[t%i.length],r[t%r.length]);else for(let t=0;t<c.length;++t){const n=N.util.indexToLoc(t,a,l),s=n.slice(-d);m.forEach(e=>s[e]=0);const o=N.util.locToIndex(s,d,p),u=n.slice(-h);g.forEach(e=>u[e]=0);const y=N.util.locToIndex(u,h,f);c[t]=e(i[o],r[y])}return[c,o]}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function nf(e){const{inputs:t,backend:n}=e,{real:i,imag:r}=t,s=n.data.get(i.dataId).values,o=n.data.get(r.dataId).values,a=n.makeTensorInfo(i.shape,"complex64");return n.data.get(a.dataId).complexTensorInfos={real:n.makeTensorInfo(i.shape,"float32",s),imag:n.makeTensorInfo(r.shape,"float32",o)},a}const rf={kernelName:N.Complex,backendName:"cpu",kernelFunc:nf};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function sf(e,t,n="float32"){if("complex64"===n){return nf({inputs:{real:sf(e,t,"float32"),imag:sf(e,t,"float32")},backend:e})}const i=N.util.makeZerosTypedArray(N.util.sizeFromShape(t),n);return e.makeTensorInfo(t,n,i)}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function of(e){const{inputs:t,backend:n}=e,{x:i}=t;return n.incRef(i.dataId),{dataId:i.dataId,shape:i.shape,dtype:i.dtype}}const af={kernelName:N.Identity,backendName:"cpu",kernelFunc:of};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function lf(e){const{inputs:t,backend:n}=e,{input:i}=t,r=n.data.get(i.dataId).complexTensorInfos.real,s=n.data.get(r.dataId).values;return n.makeTensorInfo(r.shape,r.dtype,s)}const uf={kernelName:N.Real,backendName:"cpu",kernelFunc:lf};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function cf(e,t,n,i){if("int32"===i){return[t,"int32",Int32Array.from(e)]}if("bool"===i){const i=N.util.toTypedArray([0],n),[r,s]=tf((e,t)=>e!==t?1:0)(t,[],e,i,"bool");return[s,"bool",r]}throw new Error(`Error in Cast: failed to cast ${n} to ${i}`)}function df(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{dtype:s}=i;if("complex64"===s){if("complex64"===r.dtype)return of({inputs:{x:r},backend:n});const e=sf(n,r.shape,r.dtype),t=df({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),i=nf({inputs:{real:t,imag:e},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),i}if("complex64"===r.dtype){const e=lf({inputs:{input:r},backend:n}),t=df({inputs:{x:e},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(e),t}if(!N.util.hasEncodingLoss(r.dtype,s)){const e=of({inputs:{x:r},backend:n});return{dataId:e.dataId,shape:e.shape,dtype:s}}const o=n.data.get(r.dataId).values,[a,l,u]=cf(o,r.shape,r.dtype,s);return n.makeTensorInfo(a,l,u)}const hf={kernelName:N.Cast,backendName:"cpu",kernelFunc:df};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function pf(e,t,n,i){return null==n?({inputs:n,backend:r})=>{const{a:s,b:o}=n,a=r;Kp([s,o],e);const l=a.data.get(s.dataId).values,u=a.data.get(o.dataId).values,c="string"===s.dtype?N.backend_util.fromUint8ToStringArray(l):l,d="string"===s.dtype?N.backend_util.fromUint8ToStringArray(u):u,h=i||s.dtype,[p,f]=t(s.shape,o.shape,c,d,h);return a.makeTensorInfo(f,h,p)}:({inputs:e,backend:r})=>{const{a:s,b:o}=e,a=r;if("complex64"===s.dtype||"complex64"===o.dtype){const e=df({inputs:{x:s},backend:a,attrs:{dtype:"complex64"}}),t=a.data.get(e.dataId),i=t.complexTensorInfos.real,r=t.complexTensorInfos.imag,l=a.data.get(i.dataId).values,u=a.data.get(r.dataId).values,c=df({inputs:{x:o},backend:a,attrs:{dtype:"complex64"}}),d=a.data.get(c.dataId),h=d.complexTensorInfos.real,p=d.complexTensorInfos.imag,f=a.data.get(h.dataId).values,m=a.data.get(p.dataId).values,[g,y,_]=n(s.shape,o.shape,l,u,f,m),v=a.makeTensorInfo(_,"float32",g),b=a.makeTensorInfo(_,"float32",y),T=nf({inputs:{real:v,imag:b},backend:a});return a.disposeIntermediateTensorInfo(e),a.disposeIntermediateTensorInfo(c),a.disposeIntermediateTensorInfo(v),a.disposeIntermediateTensorInfo(b),T}{const e=a.data.get(s.dataId).values,n=a.data.get(o.dataId).values,r=i||s.dtype,[l,u]=t(s.shape,o.shape,e,n,r);return a.makeTensorInfo(u,r,l)}}}function ff(e){return(t,n,i,r,s,o)=>{const a=N.backend_util.assertAndGetBroadcastShape(t,n),l=N.util.sizeFromShape(a),u=a.length,c=N.util.computeStrides(a),d=N.util.getTypedArrayFromDType("float32",l),h=N.util.getTypedArrayFromDType("float32",l),p=N.backend_util.getBroadcastDims(t,a),f=N.backend_util.getBroadcastDims(n,a),m=N.backend_util.mergeRealAndImagArrays(i,r),g=N.backend_util.mergeRealAndImagArrays(s,o),y=t.length,_=N.util.computeStrides(t),v=n.length,b=N.util.computeStrides(n);if(p.length+f.length===0)for(let t=0;t<d.length;t++){const n=t%m.length,i=t%g.length,r=e(m[2*n],m[2*n+1],g[2*i],g[2*i+1]);d[t]=r.real,h[t]=r.imag}else for(let t=0;t<d.length;t++){const n=N.util.indexToLoc(t,u,c),i=n.slice(-y);p.forEach(e=>i[e]=0);const r=N.util.locToIndex(i,y,_),s=n.slice(-v);f.forEach(e=>s[e]=0);const o=N.util.locToIndex(s,v,b),a=e(m[2*r],m[2*r+1],g[2*o],g[2*o+1]);d[t]=a.real,h[t]=a.imag}return[d,h,a]}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const mf=tf((e,t)=>e+t),gf=ff((e,t,n,i)=>({real:e+n,imag:t+i})),yf=pf(N.Add,mf,gf),_f={kernelName:N.Add,backendName:"cpu",kernelFunc:yf};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function vf(e,t,n,i,r){const s=N.util.sizeFromShape(i),o=N.util.makeZerosTypedArray(r,n);for(let n=0;n<e.length;n++){const i=e[n];if(i<0)throw new Error("Input x must be non-negative!");i>=r||(o[i]+=s>0?t[n]:1)}return o}function bf(e,t,n,i=!1){const r=e.shape[0],s=e.shape[1],o=(0,N.buffer)([r,n],t.dtype);for(let a=0;a<r;a++)for(let r=0;r<s;r++){const s=e.get(a,r);if(s<0)throw new Error("Input x must be non-negative!");s>=n||(i?o.set(1,a,s):t.size>0?o.set(o.get(a,s)+t.get(a,r),a,s):o.set(o.get(a,s)+1,a,s))}return o}
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Tf=tf((e,t)=>e&t),xf=pf(N.BitwiseAnd,Tf),Ef={kernelName:N.BitwiseAnd,backendName:"cpu",kernelFunc:xf};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function wf(e){return(t,n,i)=>{const r=N.util.getArrayFromDType(n,t.length);for(let n=0;n<t.length;++n)r[n]=e(t[n],i);return r}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function If(e,t,n){return Af(e,wf(t),n)}function Af(e,t,n){return({inputs:i,attrs:r,backend:s})=>{const{x:o}=i;Kp(o,e);const a=s,l=a.data.get(o.dataId).values;let u;if("string"===o.dtype){if(!Array.isArray(l))throw new Error("String tensor's value was not an instance of Array");u=N.backend_util.fromUint8ToStringArray(l)}else u=l;const c=n||o.dtype,d=t(u,c,r);return a.makeTensorInfo(o.shape,c,d)}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Sf=wf(e=>Math.ceil(e)),Cf=Af(N.Ceil,Sf),Of={kernelName:N.Ceil,backendName:"cpu",kernelFunc:Cf};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Mf(e,t,n,i){const r=N.util.getArrayFromDType(n,N.util.sizeFromShape(t));if(i&&"string"!==n){let t=0;e.forEach(e=>{const n=N.util.sizeFromShape(e.shape);r.set(e.vals,t),t+=n})}else{let i=0;e.forEach(e=>{const s="string"===n?N.backend_util.fromUint8ToStringArray(e.vals):e.vals;let o=0;for(let n=0;n<e.shape[0];++n){const a=n*t[1]+i;for(let t=0;t<e.shape[1];++t)r[a+t]=s[o++]}i+=e.shape[1]})}return r}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Rf=tf((e,t)=>e===t?1:0),kf=pf(N.Equal,Rf,null,"bool"),Nf={kernelName:N.Equal,backendName:"cpu",kernelFunc:kf},Df=wf(e=>Math.exp(e)),Ff=Af(N.Exp,Df,"float32"),Lf={kernelName:N.Exp,backendName:"cpu",kernelFunc:Ff},Pf=wf(e=>Math.expm1(e)),Bf=Af(N.Expm1,Pf),$f={kernelName:N.Expm1,backendName:"cpu",kernelFunc:Bf},Uf=wf(e=>Math.floor(e)),zf=Af(N.Floor,Uf),Vf={kernelName:N.Floor,backendName:"cpu",kernelFunc:zf},jf=tf((e,t)=>Math.floor(e/t)),Yf=pf(N.FloorDiv,jf,null,"int32"),Gf={kernelName:N.FloorDiv,backendName:"cpu",kernelFunc:Yf};
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Hf(e,t,n,i,r,s,o,a,l){const u=(0,N.buffer)([i,s],n);for(let n=0;n<i;n++){const i=[];let c=0;for(let t=0;t<r;t++){const s=e[n*r+t];c+=s*o[t],i.push(s)}if(c<0||c>=l/s)throw new Error(`Invalid indices: ${i} does not index into ${a}`);for(let e=0;e<s;e++)u.values[n*s+e]=t.get(...t.indexToLoc(c*s+e))}return u}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Wf(e,t,n){const i=(0,N.buffer)(n,e.dtype);for(let n=0;n<i.size;++n){const r=i.indexToLoc(n).slice(),s=r[0],o=r[2],a=t.locToIndex([s,o]);r[2]=t.values[a];const l=e.locToIndex(r);0<=l&&l<e.values.length&&(i.values[n]=e.values[l])}return i}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Xf=tf((e,t)=>e>t?1:0),qf=pf(N.Greater,Xf,null,"bool"),Kf={kernelName:N.Greater,backendName:"cpu",kernelFunc:qf},Zf=tf((e,t)=>e>=t?1:0),Qf=pf(N.GreaterEqual,Zf,null,"bool"),Jf={kernelName:N.GreaterEqual,backendName:"cpu",kernelFunc:Qf},em=tf((e,t)=>e<t?1:0),tm=pf(N.Less,em,null,"bool"),nm={kernelName:N.Less,backendName:"cpu",kernelFunc:tm},im=tf((e,t)=>e<=t?1:0),rm=pf(N.LessEqual,im,null,"bool"),sm={kernelName:N.LessEqual,backendName:"cpu",kernelFunc:rm};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function om(e,t,n){const i=(t-e)/(n-1),r=N.util.makeZerosTypedArray(n,"float32");r[0]=e;for(let e=1;e<r.length;e++)r[e]=r[e-1]+i;return r}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const am=wf(e=>Math.log(e)),lm=Af(N.Log,am),um={kernelName:N.Log,backendName:"cpu",kernelFunc:lm};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function cm(e,t,n,i){const r=N.util.getTypedArrayFromDType(i,N.util.sizeFromShape(n));for(let n=0;n<r.length;++n){const i=n*t;let s=e[i];for(let n=0;n<t;++n){const t=e[i+n];(Number.isNaN(t)||t>s)&&(s=t)}r[n]=s}return r}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const dm=tf((e,t)=>Math.max(e,t)),hm=pf(N.Maximum,dm),pm={kernelName:N.Maximum,backendName:"cpu",kernelFunc:hm},fm=tf((e,t)=>Math.min(e,t)),mm=pf(N.Minimum,fm),gm={kernelName:N.Minimum,backendName:"cpu",kernelFunc:mm},ym=tf((e,t)=>e*t),_m=ff((e,t,n,i)=>({real:e*n-t*i,imag:e*i+t*n})),vm=pf(N.Multiply,ym,_m),bm={kernelName:N.Multiply,backendName:"cpu",kernelFunc:vm};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Tm(e,t,n){const i=N.util.createScalarValue(-1,n);return ym([],t,i,e,n)}const xm={kernelName:N.Neg,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:i}=t;Kp(i,"neg");const r=n.data.get(i.dataId).values,[s,o]=Tm(r,i.shape,i.dtype);return n.makeTensorInfo(o,i.dtype,s)}},Em=tf((e,t)=>e!==t?1:0),wm=pf(N.NotEqual,Em,null,"bool"),Im={kernelName:N.NotEqual,backendName:"cpu",kernelFunc:wm};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Am(e,t,n,i,r){const s=t.length,o=N.util.sizeFromShape(t),a=N.util.computeStrides(t),l=N.util.computeStrides(r),u=N.util.getTypedArrayFromDType(n,N.util.sizeFromShape(r));for(let t=0;t<o;++t){const n=N.util.indexToLoc(t,s,a),r=new Array(n.length);for(let e=0;e<r.length;e++)r[e]=n[i[e]];u[N.util.locToIndex(r,s,l)]=e[t]}return u}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Sm(e){const{inputs:t,attrs:n,backend:i}=e,{x:r}=t,{perm:s}=n;Kp(r,"transpose");const o=r.shape.length,a=new Array(o);for(let e=0;e<a.length;e++)a[e]=r.shape[s[e]];const l=Am(i.data.get(r.dataId).values,r.shape,r.dtype,s,a);return{dataId:i.write(l,a,r.dtype),shape:a,dtype:r.dtype}}const Cm={kernelName:N.Transpose,backendName:"cpu",kernelFunc:Sm};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Om(e,t,n,i){const[r,s]=N.backend_util.computeOutAndReduceShapes(e,i),o=(0,N.upcastType)(t,"int32"),a=N.util.makeZerosTypedArray(N.util.sizeFromShape(r),o),l=N.util.sizeFromShape(s);for(let e=0;e<a.length;++e){const t=e*l;let i=1;for(let e=0;e<l;++e)i*=n[t+e];a[e]=i}return{outVals:a,outShape:r,outDtype:o}}const Mm={kernelName:N.Prod,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i;Kp(r,"prod");const a=r.shape.length,l=N.util.parseAxisParam(s,r.shape),u=N.backend_util.getAxesPermutation(l,a);let c=l,d=r;const h=[];null!=u&&(d=Sm({inputs:{x:r},backend:n,attrs:{perm:u}}),h.push(d),c=N.backend_util.getInnerMostAxes(c.length,a));const p=n.data.get(d.dataId).values,{outVals:f,outShape:m,outDtype:g}=Om(d.shape,d.dtype,p,c);let y=m;return o&&(y=N.backend_util.expandShapeToKeepDim(m,l)),h.forEach(e=>n.disposeIntermediateTensorInfo(e)),n.makeTensorInfo(y,g,f)}};function Rm(e,t,n,i){const r=[];let s=0;const o=t.length-1+n.length,a=new Array(o).fill(null).map(()=>[0]);!function(e,t){for(let n=0;n<e.length;++n){const i=e[n],r=n===e.length-1?t:e[n+1].length;if(0===i.length)throw new Error("Ragged splits may not be empty");if(i[0]<0)throw new Error("Ragged splits must be non-negative");if(i[i.length-1]>r)throw new Error("Ragged splits must not point past values");for(let e=1;e<i.length;++e)if(i[e-1]>i[e])throw new Error("Ragged splits must be sorted in ascending order")}}(n,i);let l=1;for(let e=0;e<t.length-1;++e){l*=t[e];const n=t[e+1];for(let t=1;t<l+1;++t)a[e].push(t*n)}for(let i=0;i<e.length;++i){let o=e[i],l=e[i]+1;for(let e=0;e<n.length;++e){const i=n[e],r=e+t.length-1;if(r>=0){const e=a[r],t=e[e.length-1]-i[o];for(let e=o;e<l;++e)a[r].push(i[e+1]+t)}o=i[o],l=i[l]}l!==o&&(r.push([o,l]),s+=l-o)}return{outSplits:a,valueSlices:r,numValues:s}}function km(e,t){const n=e.slice(0,t);for(;n.length<t;)n.push(1);for(let i=t;i<e.length;i++)n[t-1]*=e[i];return n}function Nm(e,t,n,i,r){const s=t.slice();s[0]=r;const o=N.util.getArrayFromDType(n,N.util.sizeFromShape(s)),a=e.length;return function(e,t,n,i,r,s){const o=km(t,2)[1],a=km(s,2)[1];let l=0;for(const t of n)for(let n=t[0];n<t[1];++n){for(let t=0;t<i;++t)r[l*a+t]=e[n*o+t];++l}}(e,t,i,0===a?0:a/t[0],o,s),[o,s]}function Dm(e,t,n,i,r,s,o,a){if(0===e.length)throw new Error("paramsNestedSplits must be non empty");if(0===t[0].length)throw new Error("Split tensors must not be scalars");if(
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){e.forEach((e,i)=>{if(e<0||e>=n){const r=N.util.indexToLoc(i,t.length,N.util.computeStrides(t)).join(",");throw new Error(`indices[${r}] = ${e} is not in [0, ${n})`)}})}(s,o,t[0][0]-1),0===i.length)throw new Error("params.rank must be nonzero");const l=i[0],{outSplits:u,valueSlices:c,numValues:d}=Rm(s,o,e,l),h=function(e){const t=[];for(let n=0;n<e.length;++n){const i=e[n].length,r=N.util.getArrayFromDType("int32",i);t.push(r),e[n].forEach((e,t)=>r[t]=e)}return t}(u),p=Nm(n,i,r,c,d);return[h,p[0],p[1]]}
/**
* @license
* Copyright 2022 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Fm=2147483647;function Lm(e,t,n,i,r,s,o){if(t.length>1)throw new Error("starts must be a scalar or vector");if(r.length>1)throw new Error("limits must be a scalar or vector");if(o.length>1)throw new Error("deltas must be a scalar or vector");const a=0===t.length,l=0===r.length,u=0===o.length,c=[];a||c.push(t[0]),l||c.push(r[0]),u||c.push(o[0]);for(let e=1;e<c.length;++e)if(c[e]!==c[e-1])throw new Error("starts, limits, and deltas must have the same shape");const d=0===c.length?1:c[0],h=N.util.getArrayFromDType("int32",d+1);h[0]=0;for(let t=0;t<d;++t){const n=a?e[0]:e[t],r=l?i[0]:i[t],o=u?s[0]:s[t];if(0===o)throw new Error("Requires delta != 0");let c;if(o>0&&r<n||o<0&&r>n)c=0;else if(c=Math.ceil(Math.abs((r-n)/o)),c>Fm)throw new Error(`Requires ((limit - start) / delta) <= ${Fm}`);h[t+1]=h[t]+c}const p=h[d],f=N.util.getArrayFromDType(n,p);let m=0;for(let t=0;t<d;++t){const n=h[t+1]-h[t];let i=a?e[0]:e[t];const r=u?s[0]:s[t];for(let e=0;e<n;++e)f[m++]=i,i+=r}return[h,f]}
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
var Pm=N.backend_util.RowPartitionType;class Bm{constructor(e,t,n,i,r,s,o,a,l,u){this.shape=e,this.shapeShape=t,this.values=n,this.valuesShape=i,this.valuesDType=r,this.defaultValue=s,this.defaultValueShape=o,this.rowPartitionValues=a,this.rowPartitionValuesShapes=l,this.rowPartitionTypes=N.backend_util.getRowPartitionTypesHelper(u),this.raggedRank=N.backend_util.getRaggedRank(this.rowPartitionTypes)}getRowPartitionTypeByDimension(e){return this.rowPartitionTypes[0]===Pm.FIRST_DIM_SIZE?this.rowPartitionTypes[e+1]:this.rowPartitionTypes[e]}getRowPartitionTensor(e){return this.rowPartitionTypes[0]===Pm.FIRST_DIM_SIZE?this.rowPartitionValues[e+1]:this.rowPartitionValues[e]}getMaxWidth(e){const t=this.getRowPartitionTensor(e-1);switch(this.getRowPartitionTypeByDimension(e-1)){case Pm.VALUE_ROWIDS:return Bm.getMaxWidthValueRowID(t);case Pm.ROW_SPLITS:return Bm.getMaxWidthRowSplit(t);default:throw new Error(`Cannot handle partition type ${Pm[this.getRowPartitionTypeByDimension(e-1)]}`)}}static getMaxWidthRowSplit(e){const t=e.length;if(0===t||1===t)return 0;let n=0;for(let i=0;i<t-1;++i){const t=e[i+1]-e[i];t>n&&(n=t)}return n}static getMaxWidthValueRowID(e){const t=e.length;if(0===t)return 0;let n=0,i=e[0],r=0;for(let s=1;s<t;++s){const t=e[s];t!==i&&(i=t,r=Math.max(s-n,r),n=s)}return Math.max(t-n,r)}tensorShapeFromTensor(e,t,n=!0){if(0===t.length){if(-1===e[0])return[];throw new Error("The only valid scalar shape tensor is the fully unknown shape specified as -1.")}return Um(e,n)}calculateOutputSize(e){const t=this.valuesShape,n=this.defaultValueShape;N.backend_util.validateDefaultValueShape(n,t);const i=this.tensorShapeFromTensor(this.shape,this.shapeShape),r=N.backend_util.combineRaggedTensorToTensorShapes(this.raggedRank,i,t);r[0]<0&&(r[0]=e);for(let e=1;e<=this.raggedRank;++e)r[e]<0&&(r[e]=this.getMaxWidth(e));return r}calculateFirstParentOutputIndex(e,t,n){const i=Math.min(e,n),r=[];let s=0;for(let e=0;e<i;++e,s+=t)r.push(s);for(let t=i;t<e;++t)r.push(-1);return N.util.assert(r.length===e,()=>"Final length of result must be equal to firstDimension."),r}calculateOutputIndexRowSplit(e,t,n,i){const r=e.length,s=[];for(let o=0;o<r-1;++o){const r=e[o+1]-e[o];let a=Math.min(i,r),l=t[o];-1===l&&(a=0);for(let e=0;e<a;++e)s.push(l),l+=n;for(let e=0;e<r-a;++e)s.push(-1)}if(r>0&&s.length!==e[r-1])throw new Error("Invalid row split size.");return s}calculateOutputIndexValueRowID(e,t,n,i){const r=e.length,s=[];if(0===r)return[];let o=0,a=e[0];if(a>=t.length)throw new Error(`Got currentValueRowId=${a}, which is not less than ${t.length}`);let l=t[a];s.push(l);for(let u=1;u<r;++u){const r=e[u];if(r===a)l>=0&&(++o,o<i?l+=n:l=-1);else{if(o=0,a=r,r>=t.length)throw new Error(`Got nextValueRowId=${r} which is not less than ${t.length}`);l=t[r]}s.push(l)}if(s.length!==e.length)throw new Error("Invalid row ids.");return s}calculateOutputIndex(e,t,n,i){const r=this.getRowPartitionTensor(e),s=this.getRowPartitionTypeByDimension(e);switch(s){case Pm.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(r,t,n,i);case Pm.ROW_SPLITS:if(r.length-1>t.length)throw new Error(`Row partition size is greater than output size: ${r.length-1} > ${t.length}`);return this.calculateOutputIndexRowSplit(r,t,n,i);default:throw new Error(`Unsupported partition type: ${Pm[s]}`)}}getFirstDimensionSize(){const e=this.rowPartitionValues[0];if(0===this.rowPartitionTypes.length)throw new Error("No row_partition_types given.");const t=this.rowPartitionTypes[0];switch(t){case Pm.FIRST_DIM_SIZE:return e[0];case Pm.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case Pm.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error(`Cannot handle type ${Pm[t]}`)}}compute(){if(this.rowPartitionValues[0].length<=0)throw new Error("Invalid first partition input. Tensor requires at least one element.");const e=this.getFirstDimensionSize(),t=this.calculateOutputSize(e),n=new Array(this.raggedRank+1);n[n.length-1]=1;for(let e=n.length-2;e>=0;--e)n[e]=n[e+1]*t[e+1];const i=Um(t,!1),r=N.util.getArrayFromDType(this.valuesDType,N.util.sizeFromShape(i));if(n[0]*t[0]>0){let s=this.calculateFirstParentOutputIndex(e,n[0],t[0]);for(let e=1;e<=this.raggedRank;++e){s=this.calculateOutputIndex(e-1,s,n[e],t[e])}this.setOutput(this.raggedRank,s,r,i)}return[i,r]}setOutput(e,t,n,i){if(0===n.length)return;const r=this.values,s=n;let o=i.slice();o=o.slice(e+1);const a=N.util.sizeFromShape(o),l=t.length;let u=this.defaultValue;if(u.length!==a&&1!==u.length){const e=this.defaultValueShape;(0,N.tidy)(()=>{const t=(0,N.reshape)(u,e),n=(0,N.broadcastTo)(t,o);u=n.dataSync()})}let c=0,d=0,h=0;for(let e=0;e<=l;++e){let i=e<l?t[e]:-1;if(i!==h){if(d<h){const e=r.subarray(c*a);$m(s.subarray(d*a),e,(h-d)*a)}if(e>=l){const e=n.length;i=Math.floor(e/a)}if(i>h)if(1===this.defaultValue.length)s.subarray(h*a,i*a).fill(this.defaultValue[0]),h=i;else for(;i>h;){$m(s.slice(h*a),u,a),++h}i<0?(c=e+1,d=h):(c=e,d=h,h=d+1)}else++h}}}function $m(e,t,n){for(let i=0;i<n;i++)e[i]=t[i]}function Um(e,t){const n=[];for(let i of e){if(i<0){if(!t)throw new Error(`Dimension ${i} must be >= 0`);if(i<-1)throw new Error(`Dimension ${i} must be >= -1`);i=-1}n.push(i)}return n}function zm(e,t,n,i,r,s,o,a,l,u){return new Bm(e,t,n,i,r,s,o,a,l,u).compute()}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Vm(e,t,n,i){if(e===t||e<t&&n<0||t<e&&n>1)return N.util.makeZerosTypedArray(0,i);const r=Math.abs(Math.ceil((t-e)/n)),s=N.util.makeZerosTypedArray(r,i);t<e&&1===n&&(n=-1),s[0]=e;for(let e=1;e<s.length;e++)s[e]=s[e-1]+n;return s}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const jm=wf(e=>1/Math.sqrt(e)),Ym=Af(N.Rsqrt,jm),Gm={kernelName:N.Rsqrt,backendName:"cpu",kernelFunc:Ym};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Hm(e,t,n,i,r,s,o,a,l,u){const c=[i/r,r],d=e.values,h=t.values;if(0===i)return(0,N.buffer)(n,t.dtype);const p=l instanceof N.TensorBuffer?l:(0,N.buffer)(c,t.dtype);"string"==typeof l||"number"==typeof l?p.values.fill(l):"boolean"==typeof l&&p.values.fill(+l);for(let e=0;e<s;e++){const s=[];let l=0;for(let t=0;t<o;t++){const n=d[e*o+t];s.push(n),l+=n*a[t]}if(l<0||l>=i/r)throw new Error(`Invalid indices: ${s} does not index into ${n}`);for(let n=0;n<r;n++)u?p.values[l*r+n]+=h[e*r+n]:p.values[l*r+n]=0===t.rank?h[0]:h[e*r+n]}return p}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Wm=wf(e=>1/(1+Math.exp(-e))),Xm=If(N.Sigmoid,e=>1/(1+Math.exp(-e))),qm={kernelName:N.Sigmoid,backendName:"cpu",kernelFunc:Xm};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Km(e,t,n,i,r){const s=N.slice_util.isSliceContinous(i,t,n),o=N.util.sizeFromShape(n),a=N.util.computeStrides(i);if(s){const n=N.slice_util.computeFlatOffset(t,a);return"string"===r?e.slice(n,n+o):e.subarray(n,n+o)}const l="string"===r?N.backend_util.fromUint8ToStringArray(e):e,u=(0,N.buffer)(i,r,l),c=(0,N.buffer)(n,r);for(let e=0;e<c.size;++e){const n=c.indexToLoc(e),i=n.map((e,n)=>e+t[n]);c.set(u.get(...i),...n)}return"string"===r?N.backend_util.fromStringArrayToUint8(c.values):c.values}function Zm(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{begin:s,size:o}=i;Kp(r,"slice");const[a,l]=N.slice_util.parseSliceParams(r,s,o);N.slice_util.assertParamsValid(r,a,l);const u=Km(n.data.get(r.dataId).values,a,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,u)}const Qm={kernelName:N.Slice,backendName:"cpu",kernelFunc:Zm};
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Jm(e,t,n,i,r,s,o){const a=t[0],l=s[0],u=new Array(l),c=new Array(a),d=t[1];if(0===l){if(0!==a)throw new Error(N.backend_util.getSparseFillEmptyRowsIndicesDenseShapeMismatch(a));return[N.util.getArrayFromDType(n,0),[0,d],N.util.getArrayFromDType(r,0),u,c]}let h=!0,p=0;const f=new Array(l).fill(0);for(let t=0;t<a;++t){const n=e[t*d];if(n<0)throw new Error(N.backend_util.getSparseFillEmptyRowsNegativeIndexErrorMessage(t,n));if(n>=l)throw new Error(N.backend_util.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(t,n,l));++f[n],h=h&&n>=p,p=n}let m=!0;for(let e=0;e<l;++e){const t=0===f[e];u[e]=t,m=m&&!t,f[e]=Math.max(f[e],1),e>0&&(f[e]+=f[e-1])}if(m&&h){const t=e,n=i;for(let e=0;e<a;++e)c[e]=e;return[t,[a,d],n,u,c]}{const t=f[l-1],s=N.util.getArrayFromDType(n,t*d),h=N.util.getArrayFromDType(r,t),p=new Array(l).fill(0);for(let t=0;t<a;++t){const n=e[t*d],r=p[n],o=(0===n?0:f[n-1])+r;p[n]++;for(let n=0;n<d;++n)s[o*d+n]=e[t*d+n];h[o]=i[t],c[t]=o}for(let e=0;e<l;++e){if(0===p[e]){const t=0===e?0:f[e-1];s[t*d+0]=e;for(let e=1;e<d;++e)s[t*d+e]=0;h[t]=o}}return[s,[t,d],h,u,c]}}
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function eg(e,t,n,i,r){const s=N.util.sizeFromShape(i),o=t[0],a=r.length,l=[];let u=1,c=-1;for(let e=0;e<a;++e){const t=r[e];if(-1===t){if(-1!==c)throw new Error(N.backend_util.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(c,e));c=e,l.push(1)}else{if(t<0)throw new Error(N.backend_util.getSparseReshapeNegativeOutputDimErrorMessage(e,t));u*=t,l.push(t)}}if(-1!==c){if(u<=0)throw new Error(N.backend_util.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage());const e=Math.trunc(s/u);if(u*e!==s)throw new Error(N.backend_util.getSparseReshapeInputOutputMultipleErrorMessage(i,l));l[c]=e}if(N.util.sizeFromShape(l)!==s)throw new Error(N.backend_util.getSparseReshapeInputOutputMismatchErrorMessage(i,l));const d=i.length,h=[];if(d>0){h[d-1]=1;for(let e=d-2;e>=0;--e)h[e]=h[e+1]*i[e+1]}const p=[];if(a>0){p[a-1]=1;for(let e=a-2;e>=0;--e)p[e]=p[e+1]*l[e+1]}const f=N.util.getArrayFromDType(n,o*a);for(let t=0;t<o;++t){let n=0;for(let i=0;i<d;++i)n+=e[t*d+i]*h[i];for(let e=0;e<a;++e)f[t*a+e]=Math.trunc(n/p[e]),n%=p[e]}return[f,[o,a],l]}
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function tg(e,t,n,i,r,s=!1,o=0){const a=i.length,l=[t[0],e.length/t[0]],u=l[1],c=a>0?r[a-1]+1:0;if(c<0)throw new Error(N.backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());const d=t.slice();d[0]=c;const h=d.reduce((e,t)=>e*t,1),p=N.util.getArrayFromDType(n,h);if(0===a)return c>0&&p.fill(o),[p,d];if(c<=0)throw new Error(N.backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());let f=0,m=1,g=0,y=r[f];for(;;){let t=0;if(m<a){if(t=r[m],y===t){++m;continue}if(y>=t)throw new Error(N.backend_util.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage())}if(y<0||y>=c)throw new Error(N.backend_util.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(y,c));y>g&&p.fill(o,g*u,y*u);for(let t=f;t<m;++t){const n=i[t];if(n<0||n>=l[0])throw new Error(N.backend_util.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(t,i[t],l[0]));for(let t=0;t<u;t++)p[y*u+t]+=e[n*u+t]}if(s)for(let e=0;e<u;e++)p[y*u+e]/=m-f;if(f=m,++m,g=y+1,y=t,m>a)break}return g<c&&p.fill(o,g*u,c*u),[p,d]}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const ng=wf(e=>Math.sqrt(e)),ig=If(N.Sqrt,e=>Math.sqrt(e)),rg={kernelName:N.Sqrt,backendName:"cpu",kernelFunc:ig},sg=tf((e,t)=>{const n=e-t;return n*n}),og=pf(N.SquaredDifference,sg),ag={kernelName:N.SquaredDifference,backendName:"cpu",kernelFunc:og},lg=wf((e,t)=>{const{pattern:n,replaceGlobal:i,rewrite:r}=t;return e.replace(new RegExp(n,i?"g":""),r)}),ug=Af(N.StaticRegexReplace,lg),cg={kernelName:N.StaticRegexReplace,backendName:"cpu",kernelFunc:ug};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function dg(e,t,n,i){const r=(0,N.buffer)(e,t.dtype);for(let e=0;e<r.size;e++){const s=r.indexToLoc(e),o=new Array(s.length);for(let e=0;e<o.length;e++)o[e]=s[e]*n[e]+i[e];r.set(t.get(...o),...s)}return r}
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class hg{constructor(e,t,n,i,r,s){this.separator=N.util.encodeString(e),this.nGramWidths=t,this.leftPad=N.util.encodeString(n),this.rightPad=N.util.encodeString(i),this.padWidth=r,this.preserveShort=s}getPadWidth(e){return Math.min(this.padWidth<0?e-1:this.padWidth,e-1)}getNumNGrams(e,t){const n=this.getPadWidth(t);return Math.max(0,e+2*n-t+1)}createNGrams(e,t,n,i,r,s){for(let o=0;o<r;++o){const a=this.getPadWidth(s),l=Math.max(0,a-o),u=Math.max(0,a-(r-(o+1))),c=s-(l+u),d=t+(l>0?0:o-a);let h=0;h+=l*this.leftPad.length;for(let t=0;t<c;++t)h+=e[d+t].length;h+=u*this.rightPad.length;h+=(l+u+c-1)*this.separator.length,n[i+o]=new Uint8Array(h);const p=n[i+o];let f=0;const m=e=>e.forEach(e=>p[f++]=e);for(let e=0;e<l;++e)m(this.leftPad),m(this.separator);for(let t=0;t<c-1;++t)m(e[d+t]),m(this.separator);if(c>0){m(e[d+c-1]);for(let e=0;e<u;++e)m(this.separator),m(this.rightPad)}else{for(let e=0;e<u-1;++e)m(this.rightPad),m(this.separator);m(this.rightPad)}}}compute(e,t){const n=e.length,i=t.length;if(i>0){let e=t[0];if(0!==e)throw new Error(`First split value must be 0, got ${e}`);for(let r=1;r<i;++r){let i=t[r]>=e;if(i=i&&t[r]<=n,!i)throw new Error(`Invalid split value ${t[r]}, must be in [${e}, ${n}]`);e=t[r]}if(e!==n)throw new Error(`Last split value must be data size. Expected ${n}, got ${e}`)}const r=i-1,s=N.util.getArrayFromDType("int32",i);if(0===n||0===i){const e=new Array(n);for(let e=0;e<=r;++e)s[e]=0;return[e,s]}s[0]=0;for(let e=1;e<=r;++e){const n=t[e]-t[e-1];let i=0;this.nGramWidths.forEach(e=>{i+=this.getNumNGrams(n,e)}),this.preserveShort&&n>0&&0===i&&(i=1),s[e]=s[e-1]+i}const o=new Array(s[r]);for(let n=0;n<r;++n){const i=t[n];let r=s[n];if(this.nGramWidths.forEach(s=>{const a=t[n+1]-t[n],l=this.getNumNGrams(a,s);this.createNGrams(e,i,o,r,l,s),r+=l}),this.preserveShort&&r===s[n]){const s=t[n+1]-t[n];if(0===s)continue;const a=s+2*this.padWidth,l=1;this.createNGrams(e,i,o,r,l,a)}}return[o,s]}}function pg(e,t,n,i,r,s,o,a){return new hg(n,i,r,s,o,a).compute(e,t)}
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function fg(e,t,n,i){if(!e.length)return;if(0===t.length){for(let t=0;t<e.length;++t)i.push(e.subarray(t,t+1));return}if(1===t.length){const r=t[0];let s=e.indexOf(r);for(;-1!==s;){const t=e.subarray(0,s);n&&0===t.length||i.push(t),s=(e=e.subarray(s+1)).indexOf(r)}return void(n&&0===e.length||i.push(e))}let r=0;for(let s=0;s<e.length+1;s++)if(s===e.length||-1!==t.indexOf(e[s])){const t=e.subarray(r,s);n&&0===t.length||i.push(t),r=s+1}}function mg(e,t,n){const i=e.length,r=[];let s=0,o=0;const a=new Array(i);for(let l=0;l<i;++l){const i=r.length;fg(e[l],t,n,r);const u=r.length-i;a[l]=u,s+=u,o=Math.max(o,u)}const l=N.util.getArrayFromDType("int32",2*s),u=new Array(s),c=[i,o];let d=0;for(let e=0;e<i;++e)for(let t=0;t<a[e];++t)l[2*d]=e,l[2*d+1]=t,u[d]=r[d],++d;return[l,u,c]}
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function gg(e,t){const n=N.util.getArrayFromDType("int32",e.length);for(let i=0;i<e.length;++i)n[i]=N.util.fingerPrint64(e[i]).modulo(t).getLowBitsUnsigned();return n}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const yg=tf((e,t)=>e-t),_g=ff((e,t,n,i)=>({real:e-n,imag:t-i})),vg=pf(N.Sub,yg,_g),bg={kernelName:N.Sub,backendName:"cpu",kernelFunc:vg};
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Tg(e,t){const n=new Array(e.rank);for(let i=0;i<n.length;i++)n[i]=e.shape[i]*t[i];const i=(0,N.buffer)(n,e.dtype);for(let t=0;t<i.values.length;++t){const n=i.indexToLoc(t),r=new Array(e.rank);for(let t=0;t<r.length;t++)r[t]=n[t]%e.shape[t];const s=e.locToIndex(r);i.values[t]=e.values[s]}return i}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const xg=(e,t)=>{const n=t.value-e.value;return 0===n?e.index-t.index:n};function Eg(e,t,n=0,i=e.length-1){for(;i>n;){if(i-n>600){const r=i-n+1,s=t-n+1,o=Math.log(r),a=.5*Math.exp(2*o/3),l=.5*Math.sqrt(o*a*(r-a)/r)*Math.sign(s-r/2);Eg(e,t,Math.max(n,Math.floor(t-s*a/r+l)),Math.min(i,Math.floor(t+(r-s)*a/r+l)))}const r=e[t];let s=n,o=i;for(N.util.swap(e,n,t),xg(e[i],r)>0&&N.util.swap(e,n,i);s<o;){for(N.util.swap(e,s,o),s++,o--;xg(e[s],r)<0;)s+=1;for(;xg(e[o],r)>0;)o-=1}0===xg(e[n],r)?N.util.swap(e,n,o):(o+=1,N.util.swap(e,o,i)),o<=t&&(n=o+1),t<=o&&(i=o-1)}}function wg(e,t,n,i,r){const s=t[t.length-1],[o,a]=[e.length/s,s],l=N.util.getTypedArrayFromDType(n,o*i),u=N.util.getTypedArrayFromDType("int32",o*i);for(let t=0;t<o;t++){const n=t*a,s=e.subarray(n,n+a);let o=new Array(s.length);s.forEach((e,t)=>o[t]={value:e,index:t}),i<o.length&&(Eg(o,i),o=o.slice(0,i)),r&&o.sort(xg);const c=t*i,d=l.subarray(c,c+i),h=u.subarray(c,c+i);for(let e=0;e<i;e++)d[e]=o[e].value,h[e]=o[e].index}const c=t.slice();return c[c.length-1]=i,[(0,N.buffer)(c,n,l),(0,N.buffer)(c,"int32",u)]}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Ig(e,t,n,i){const r=N.util.parseAxisParam(t,n)[0],s=[1,n[0],1];for(let e=0;e<r;e++)s[0]*=n[e];s[1]=n[r];for(let e=r+1;e<n.length;e++)s[2]*=n[e];const o=new Map,a=new Int32Array(n[r]),l=new N.TensorBuffer(s,i,e),u=[],c=1===s[0]&&1===s[2];for(let t=0;t<n[r];t++){let n;if(c)n=e[t].toString();else{const e=[];for(let n=0;n<s[0];n++)for(let i=0;i<s[2];i++)e.push(l.get(n,t,i));n=e.join(",")}const i=o.get(n);if(null!=i)a[t]=i;else{const e=o.size;o.set(n,e),a[t]=e,u.push(t)}}const d=s.slice();d[1]=o.size;const h=new N.TensorBuffer(d,i);u.forEach((e,t)=>{for(let n=0;n<s[0];n++)for(let i=0;i<s[2];i++)h.set(l.get(n,e,i),n,t,i)});const p=n.slice();return p[r]=d[1],{outputValues:h.values,outputShape:p,indices:a}}
/** @license See the LICENSE file. */
const Ag="4.22.0";
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(0,N.registerBackend)("cpu",()=>new Qp,1);
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Sg=If(N.Elu,e=>e>=0?e:Math.exp(e)-1),Cg={kernelName:N.Elu,backendName:"cpu",kernelFunc:Sg};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Og(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{alpha:s}=i;Kp([r],"leakyRelu");const o=N.util.sizeFromShape(r.shape),a=n.data.get(r.dataId).values,l=N.util.getTypedArrayFromDType("float32",o);for(let e=0;e<a.length;e++)l[e]=a[e]<0?s*a[e]:a[e];return n.makeTensorInfo(r.shape,"float32",l)}const Mg={kernelName:N.LeakyRelu,backendName:"cpu",kernelFunc:Og},Rg=tf((e,t)=>e<0?t*e:e);function kg(e){const{inputs:t,backend:n}=e,{x:i,alpha:r}=t;Kp([i,r],"prelu");const s=n.data.get(i.dataId).values,o=n.data.get(r.dataId).values,[a,l]=Rg(i.shape,r.shape,s,o,"float32");return n.makeTensorInfo(l,"float32",a)}const Ng={kernelName:N.Prelu,backendName:"cpu",kernelFunc:kg},Dg=If(N.Relu,e=>Math.max(0,e)),Fg={kernelName:N.Relu,backendName:"cpu",kernelFunc:Dg},Lg=If(N.Relu6,e=>Math.min(Math.max(0,e),6)),Pg={kernelName:N.Relu6,backendName:"cpu",kernelFunc:Lg};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Bg(e,t,n,i,r){if("linear"===n)return of({inputs:{x:t},backend:e});if("relu"===n)return Dg({inputs:{x:t},backend:e});if("elu"===n)return Sg({inputs:{x:t},backend:e});if("relu6"===n)return Lg({inputs:{x:t},backend:e});if("prelu"===n)return kg({inputs:{x:t,alpha:i},backend:e});if("leakyrelu"===n)return Og({inputs:{x:t},backend:e,attrs:{alpha:r}});if("sigmoid"===n)return Xm({inputs:{x:t},backend:e});throw new Error(`Activation ${n} has not been implemented for the CPU backend.`)}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function $g(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{shape:s}=i,o=N.util.sizeFromShape(r.shape),a=N.util.inferFromImplicitShape(s,o),l=N.util.sizeFromShape(a);N.util.assert(o===l,()=>`The new shape (${a}) has ${l} elements and the old shape (${r.shape}) has ${o} elements. The new shape and old shape must have the same number of elements.`),n.incRef(r.dataId);const u=n.data.get(r.dataId);if(null!=u.complexTensorInfos){const e=u.complexTensorInfos.real,t=u.complexTensorInfos.imag;e.shape=a,t.shape=a}return{dataId:r.dataId,shape:a,dtype:r.dtype}}const Ug={kernelName:N.Reshape,backendName:"cpu",kernelFunc:$g};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function zg(e){const{inputs:t,backend:n,attrs:i}=e,{a:r,b:s}=t,{transposeA:o,transposeB:a}=i;Kp([r,s],"matMul");const l=r.shape.length,u=s.shape.length,c=o?r.shape[l-2]:r.shape[l-1],d=a?s.shape[u-1]:s.shape[u-2],h=o?r.shape[l-1]:r.shape[l-2],p=a?s.shape[u-2]:s.shape[u-1],f=r.shape.slice(0,-2),m=s.shape.slice(0,-2),g=N.util.sizeFromShape(f),y=N.util.sizeFromShape(m),_=N.broadcast_util.assertAndGetBroadcastShape(r.shape.slice(0,-2),s.shape.slice(0,-2)).concat([h,p]);N.util.assert(c===d,()=>`Error in matMul: inner shapes (${c}) and (${d}) of Tensors with shapes ${r.shape} and ${s.shape} and transposeA=${o} and transposeB=${a} must match.`);const v=a?[y,p,d]:[y,d,p],b=$g({inputs:{x:r},backend:n,attrs:{shape:o?[g,c,h]:[g,h,c]}}),T=$g({inputs:{x:s},backend:n,attrs:{shape:v}}),x=o?b.shape[1]:b.shape[2],E=o?b.shape[2]:b.shape[1],w=a?T.shape[1]:T.shape[2],I=Math.max(g,y),A=n.data.get(b.dataId).values,S=n.data.get(T.dataId).values,C=N.util.computeStrides(b.shape),O=N.util.computeStrides(T.shape),[M,R,k]=o?[C[0],1,C[1]]:[C[0],C[1],1],[D,F,L]=a?[1,O[1],O[0]]:[O[1],1,O[0]],P=E*w,B=(0,N.buffer)([I,E,w],b.dtype),$=B.values,U=n.blockSize;for(let e=0;e<I;e++){const t=e%g,n=e%y;for(let i=0;i<E;i+=U){const r=Math.min(i+U,E);for(let s=0;s<w;s+=U){const o=Math.min(s+U,w);for(let a=0;a<x;a+=U){const l=Math.min(a+U,x);for(let u=i;u<r;u++)for(let i=s;i<o;i++){let r=0;for(let e=a;e<l;e++){r+=A[t*M+u*R+e*k]*S[e*D+i*F+n*L]}$[e*P+(u*w+i)]+=r}}}}}return n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(T),n.makeTensorInfo(_,B.dtype,B.values)}const Vg={kernelName:N.BatchMatMul,backendName:"cpu",kernelFunc:zg};const jg={kernelName:N._FusedMatMul,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{a:r,b:s,bias:o,preluActivationWeights:a}=t,{transposeA:l,transposeB:u,activation:c,leakyreluAlpha:d}=i;let h,p,f;const m=[];h=zg({inputs:{a:r,b:s},attrs:{transposeA:l,transposeB:u},backend:n}),o&&(p=yf({inputs:{a:h,b:o},backend:n}),m.push(h),h=p),c&&(f=Bg(n,h,c,a,d),m.push(h),h=f);for(const e of m)n.disposeIntermediateTensorInfo(e);return h}},Yg=If(N.Acos,e=>Math.acos(e)),Gg={kernelName:N.Acos,backendName:"cpu",kernelFunc:Yg},Hg=If(N.Acosh,e=>Math.acosh(e)),Wg={kernelName:N.Acosh,backendName:"cpu",kernelFunc:Hg};const Xg={kernelName:N.AddN,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,i=t;Kp(t,"addN");const r=i.map(e=>n.data.get(e.dataId).values),s=(0,N.buffer)(i[0].shape,i[0].dtype),o=s.values;for(let e=0;e<i.length;e++){const t=r[e];for(let e=0;e<o.length;e++)o[e]+=t[e]}return n.makeTensorInfo(s.shape,s.dtype,s.values)}};const qg={kernelName:N.All,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i;Kp(r,"all");const a=N.util.parseAxisParam(s,r.shape);let l=a;const u=N.backend_util.getAxesPermutation(l,r.shape.length);let c=r;null!=u&&(c=Sm({inputs:{x:r},backend:n,attrs:{perm:u}}),l=N.backend_util.getInnerMostAxes(l.length,r.shape.length)),N.backend_util.assertAxesAreInnerMostDims("all",l,c.shape.length);const[d,h]=N.backend_util.computeOutAndReduceShapes(c.shape,l),p=N.util.sizeFromShape(h),f=N.util.makeZerosTypedArray(N.util.sizeFromShape(d),c.dtype),m=n.data.get(c.dataId).values;for(let e=0;e<f.length;++e){const t=e*p;let n=m[t];for(let e=0;e<p;++e){const i=m[t+e];n=n&&i}f[e]=n}null!=u&&n.disposeIntermediateTensorInfo(c);const g=n.makeTensorInfo(d,c.dtype,f);if(o){const e=$g({inputs:{x:g},backend:n,attrs:{shape:N.backend_util.expandShapeToKeepDim(d,a)}});return n.disposeIntermediateTensorInfo(g),e}return g}};const Kg={kernelName:N.Any,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i;Kp(r,"any");const a=N.util.parseAxisParam(s,r.shape);let l=a;const u=N.backend_util.getAxesPermutation(l,r.shape.length);let c=r;null!=u&&(c=Sm({inputs:{x:r},backend:n,attrs:{perm:u}}),l=N.backend_util.getInnerMostAxes(l.length,r.shape.length)),N.backend_util.assertAxesAreInnerMostDims("any",l,c.shape.length);const[d,h]=N.backend_util.computeOutAndReduceShapes(c.shape,l),p=N.util.sizeFromShape(h),f=N.util.makeZerosTypedArray(N.util.sizeFromShape(d),c.dtype),m=n.data.get(c.dataId).values;for(let e=0;e<f.length;++e){const t=e*p;let n=m[t];for(let e=0;e<p;++e){const i=m[t+e];n=n||i}f[e]=n}null!=u&&n.disposeIntermediateTensorInfo(c);const g=n.makeTensorInfo(d,c.dtype,f);if(o){const e=$g({inputs:{x:g},backend:n,attrs:{shape:N.backend_util.expandShapeToKeepDim(d,a)}});return n.disposeIntermediateTensorInfo(g),e}return g}};const Zg={kernelName:N.ArgMax,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s}=i;Kp(r,"argMax");let o=N.util.parseAxisParam(s,r.shape);const a=N.backend_util.getAxesPermutation(o,r.shape.length);let l=r;const u=[];null!=a&&(l=Sm({inputs:{x:r},backend:n,attrs:{perm:a}}),u.push(l),o=N.backend_util.getInnerMostAxes(o.length,l.shape.length)),o=[o[0]],N.backend_util.assertAxesAreInnerMostDims("argMax",o,l.shape.length);const[c,d]=N.backend_util.computeOutAndReduceShapes(l.shape,o),h=N.util.sizeFromShape(c),p=N.util.makeZerosTypedArray(h,"int32"),f=N.util.sizeFromShape(d),m=n.data.get(l.dataId).values;for(let e=0;e<p.length;++e){const t=e*f;let n=m[t],i=0;for(let e=0;e<f;++e){const r=m[t+e];r>n&&(n=r,i=e)}p[e]=i}return u.forEach(e=>n.disposeIntermediateTensorInfo(e)),n.makeTensorInfo(c,"int32",p)}};const Qg={kernelName:N.ArgMin,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s}=i;Kp(r,"argMin");let o=N.util.parseAxisParam(s,r.shape);const a=N.backend_util.getAxesPermutation(o,r.shape.length);let l=r;const u=[];null!=a&&(l=Sm({inputs:{x:r},backend:n,attrs:{perm:a}}),u.push(l),o=N.backend_util.getInnerMostAxes(o.length,l.shape.length)),o=[o[0]],N.backend_util.assertAxesAreInnerMostDims("argMin",o,l.shape.length);const[c,d]=N.backend_util.computeOutAndReduceShapes(l.shape,o),h=N.util.sizeFromShape(c),p=N.util.makeZerosTypedArray(h,"int32"),f=N.util.sizeFromShape(d),m=n.data.get(l.dataId).values;for(let e=0;e<p.length;++e){const t=e*f;let n=m[t],i=0;for(let e=0;e<f;++e){const r=m[t+e];r<n&&(n=r,i=e)}p[e]=i}return u.forEach(e=>n.disposeIntermediateTensorInfo(e)),n.makeTensorInfo(c,"int32",p)}},Jg=If(N.Asin,e=>Math.asin(e)),ey={kernelName:N.Asin,backendName:"cpu",kernelFunc:Jg},ty=If(N.Asinh,e=>Math.asinh(e)),ny={kernelName:N.Asinh,backendName:"cpu",kernelFunc:ty},iy=If(N.Atan,e=>Math.atan(e)),ry={kernelName:N.Atan,backendName:"cpu",kernelFunc:iy},sy=tf((e,t)=>Math.atan2(e,t)),oy=pf(N.Atan2,sy),ay={kernelName:N.Atan2,backendName:"cpu",kernelFunc:oy},ly=If(N.Atanh,e=>Math.atanh(e)),uy={kernelName:N.Atanh,backendName:"cpu",kernelFunc:ly};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function cy(e,t,n,i,r,s){const o=r.strideHeight,a=r.strideWidth,l=r.dilationHeight,u=r.dilationWidth,c=r.effectiveFilterHeight,d=r.effectiveFilterWidth,h=r.padInfo.top,p=r.padInfo.left,f="max"===s?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,m=(0,N.buffer)(r.outShape,n),g=m.values,y=r.outShape[1]*r.outShape[2]*r.outShape[3],_=r.outShape[2]*r.outShape[3],v=r.outShape[3];for(let t=0;t<r.batchSize;++t){const n=t*y,m=t*i[0];for(let t=0;t<r.inChannels;++t)for(let y=0;y<r.outHeight;++y){const b=y*o-h,T=Math.max(0,b),x=Math.min(r.inHeight,c+b),E=n+y*_;for(let n=0;n<r.outWidth;++n){const o=n*a-p,c=Math.max(0,o),h=Math.min(r.inWidth,d+o);let y=f,_=0,b=0;for(let n=T;n<x;n+=l){const r=m+n*i[1];for(let n=c;n<h;n+=u){const o=e[r+n*i[2]+t];"max"===s&&o>y?y=o:"avg"===s&&(_+=o,b++)}if(isNaN(y))break}g[E+n*v+t]="avg"===s?_/b:y}}}return m}function dy(e,t,n,i,r=!1,s=!1){const o=(0,N.buffer)(i.outShape,"int32"),a=i.strideHeight,l=i.strideWidth,u=i.dilationHeight,c=i.dilationWidth,d=i.effectiveFilterHeight,h=i.effectiveFilterWidth,p=i.padInfo.top,f=i.padInfo.left,m=(0,N.buffer)(t,n,e);for(let e=0;e<i.batchSize;++e)for(let t=0;t<i.inChannels;++t)for(let n=0;n<i.outHeight;++n){const g=n*a-p;let y=g;for(;y<0;)y+=u;const _=Math.min(i.inHeight,d+g);for(let a=0;a<i.outWidth;++a){const d=a*l-f;let p=d;for(;p<0;)p+=c;const v=Math.min(i.inWidth,h+d);let b=Number.NEGATIVE_INFINITY,T=-1;for(let n=y;n<_;n+=u){const o=n-g;for(let a=p;a<v;a+=c){const l=a-d,u=m.get(e,n,a,t);u>b&&(b=u,T=r?s?((e*i.inHeight+n)*i.inWidth+a)*i.inChannels+t:(n*i.inWidth+a)*i.inChannels+t:o*h+l)}}o.set(T,e,n,a,t)}}return o}function hy(e,t,n,i,r,s){const o=r.strideDepth,a=r.strideHeight,l=r.strideWidth,u=r.dilationDepth,c=r.dilationHeight,d=r.dilationWidth,h=r.effectiveFilterDepth,p=r.effectiveFilterHeight,f=r.effectiveFilterWidth,m=r.padInfo.front,g=r.padInfo.top,y=r.padInfo.left,_="max"===s?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,v=(0,N.buffer)(r.outShape,n),b=v.values,T=r.outShape[1]*r.outShape[2]*r.outShape[3]*r.outShape[4],x=r.outShape[2]*r.outShape[3]*r.outShape[4],E=r.outShape[3]*r.outShape[4],w=r.outShape[4];for(let t=0;t<r.batchSize;++t){const n=t*T,v=t*i[0];for(let t=0;t<r.inChannels;++t)for(let T=0;T<r.outDepth;++T){const I=T*o-m;let A=I;for(;A<0;)A+=u;const S=Math.min(r.inDepth,h+I),C=n+T*x;for(let n=0;n<r.outHeight;++n){const o=n*a-g;let h=o;for(;h<0;)h+=c;const m=Math.min(r.inHeight,p+o),T=C+n*E;for(let n=0;n<r.outWidth;++n){const o=n*l-y;let a=o;for(;a<0;)a+=d;const p=Math.min(r.inWidth,f+o),g=T+n*w;let x=_,E=0,I=0;for(let n=A;n<S;n+=u){const r=v+n*i[1];for(let n=h;n<m;n+=c){const o=r+n*i[2];for(let n=a;n<p;n+=d){const r=e[o+n*i[3]+t];if("max"===s&&r>x?x=r:"avg"===s&&(E+=r,I++),isNaN(x))break}if(isNaN(x))break}if(isNaN(x))break}b[g+t]="avg"===s?E/Math.max(I,1):x}}}}return v}const py={kernelName:N.AvgPool,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t;Kp(r,"avgPool");const{filterSize:s,strides:o,pad:a,dimRoundingMode:l}=i;N.util.assert(N.backend_util.eitherStridesOrDilationsAreOne(o,1),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${o} and dilations '1'`);const u=N.backend_util.computePool2DInfo(r.shape,s,o,1,a,l);let c;if(1===u.filterWidth&&1===u.filterHeight&&N.util.arraysEqual(u.inShape,u.outShape))c=of({inputs:{x:r},backend:n});else{const e=n.data.get(r.dataId).values,t=N.util.computeStrides(r.shape),i=cy(e,r.shape,r.dtype,t,u,"avg");c=n.makeTensorInfo(u.outShape,r.dtype,i.values)}return c}};const fy={kernelName:N.AvgPool3D,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{filterSize:s,strides:o,pad:a,dimRoundingMode:l,dataFormat:u}=i;Kp(r,"avgPool3d");const c=N.backend_util.computePool3DInfo(r.shape,s,o,1,a,l,u),d=hy(n.data.get(r.dataId).values,r.shape,r.dtype,N.util.computeStrides(r.shape),c,"avg");return n.makeTensorInfo(d.shape,"float32",d.values)}};const my={kernelName:N.AvgPool3DGrad,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,input:s}=t,{filterSize:o,strides:a,pad:l,dimRoundingMode:u}=i;Kp([r,s],"avgPool3DGrad");const c=N.backend_util.computePool3DInfo(s.shape,o,a,1,l,u),d=c.strideDepth,h=c.strideHeight,p=c.strideWidth,f=c.filterDepth,m=c.filterHeight,g=c.filterWidth,y=c.dilationDepth,_=c.dilationHeight,v=c.dilationWidth,b=c.effectiveFilterDepth,T=c.effectiveFilterHeight,x=c.effectiveFilterWidth,E=b-1-c.padInfo.front,w=x-1-c.padInfo.left,I=T-1-c.padInfo.top,A=(0,N.buffer)(s.shape,"float32"),S=1/(f*m*g),C=n.bufferSync(r);for(let e=0;e<c.batchSize;++e)for(let t=0;t<c.inChannels;++t)for(let n=0;n<c.inDepth;++n)for(let i=0;i<c.inHeight;++i)for(let r=0;r<c.inWidth;++r){const s=n-E,o=i-I,a=r-w;let l=0;for(let n=0;n<b;n+=y){const i=(s+n)/d;if(!(i<0||i>=c.outDepth||Math.floor(i)!==i))for(let n=0;n<T;n+=_){const r=(o+n)/h;if(!(r<0||r>=c.outHeight||Math.floor(r)!==r))for(let n=0;n<x;n+=v){const s=(a+n)/p;if(s<0||s>=c.outWidth||Math.floor(s)!==s)continue;l+=C.get(e,i,r,s,t)}}}A.set(l*S,e,n,i,r,t)}return n.makeTensorInfo(A.shape,A.dtype,A.values)}};const gy={kernelName:N.AvgPoolGrad,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,input:s}=t,o=s;Kp([r,s],"avgPoolGrad");const{filterSize:a,strides:l,pad:u}=i,c=N.backend_util.computePool2DInfo(o.shape,a,l,1,u),d=c.strideHeight,h=c.strideWidth,p=c.filterHeight,f=c.filterWidth,m=c.dilationHeight,g=c.dilationWidth,y=c.effectiveFilterHeight,_=c.effectiveFilterWidth,v=_-1-c.padInfo.left,b=y-1-c.padInfo.top,T=(0,N.buffer)(o.shape,"float32"),x=1/(p*f),E=n.data.get(r.dataId).values,w=(0,N.buffer)(r.shape,"float32",E);for(let e=0;e<c.batchSize;++e)for(let t=0;t<c.inChannels;++t)for(let n=0;n<c.inHeight;++n)for(let i=0;i<c.inWidth;++i){const r=n-b,s=i-v;let o=0;for(let n=0;n<y;n+=m){const i=(r+n)/d;if(!(i<0||i>=c.outHeight||Math.floor(i)!==i))for(let n=0;n<_;n+=g){const r=(s+n)/h;if(r<0||r>=c.outWidth||Math.floor(r)!==r)continue;o+=w.get(e,i,r,t)}}T.set(o*x,e,n,i,t)}return n.makeTensorInfo(T.shape,T.dtype,T.values)}};const yy={kernelName:N.FusedBatchNorm,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,scale:s,offset:o,mean:a,variance:l}=t;N.util.assert(a.shape.length===l.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),N.util.assert(null==o||a.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),N.util.assert(null==s||a.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks."),Kp([r,a,l,s,o],"batchNorm");let{varianceEpsilon:u}=i;null==u&&(u=.001);const c=n.data.get(r.dataId).values,d=n.data.get(a.dataId).values,h=n.data.get(l.dataId).values,p=s?n.data.get(s.dataId).values:new Float32Array([1]),f=o?n.data.get(o.dataId).values:new Float32Array([0]),m=new Float32Array(c.length),g=f.length,y=p.length,_=h.length,v=d.length;let b=0,T=0,x=0,E=0;for(let e=0;e<c.length;++e)m[e]=f[b++]+(c[e]-d[T++])*p[x++]/Math.sqrt(h[E++]+u),b>=g&&(b=0),T>=v&&(T=0),x>=y&&(x=0),E>=_&&(E=0);return n.makeTensorInfo(r.shape,r.dtype,m)}};const _y={kernelName:N.BatchToSpaceND,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{blockShape:s,crops:o}=i;Kp([r],"batchToSpaceND");const a=s.reduce((e,t)=>e*t),l=N.backend_util.getReshaped(r.shape,s,a),u=N.backend_util.getPermuted(l.length,s.length),c=N.backend_util.getReshapedPermuted(r.shape,s,a),d=N.backend_util.getSliceBeginCoords(o,s.length),h=N.backend_util.getSliceSize(c,o,s.length),p=$g({inputs:{x:r},backend:n,attrs:{shape:l}}),f=Sm({inputs:{x:p},backend:n,attrs:{perm:u}}),m=$g({inputs:{x:f},backend:n,attrs:{shape:c}}),g=Zm({inputs:{x:m},backend:n,attrs:{begin:d,size:h}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),g}};const vy={kernelName:N.Bincount,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,weights:s}=t,{size:o}=i,a=vf(n.data.get(r.dataId).values,n.data.get(s.dataId).values,s.dtype,s.shape,o);return n.makeTensorInfo([o],s.dtype,a)}};const by={kernelName:N.BroadcastArgs,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{s0:i,s1:r}=t,s=n.data.get(i.dataId).values,o=n.data.get(r.dataId).values,a=N.backend_util.assertAndGetBroadcastShape(Array.from(s),Array.from(o));return n.makeTensorInfo([a.length],"int32",Int32Array.from(a))}},Ty=If(N.ClipByValue,(e,t)=>{const n=t;return e>n.clipValueMax?n.clipValueMax:e<n.clipValueMin?n.clipValueMin:e}),xy={kernelName:N.ClipByValue,backendName:"cpu",kernelFunc:Ty},Ey={kernelName:N.ComplexAbs,backendName:"cpu",kernelFunc:e=>{const{x:t}=e.inputs,n=e.backend,i=new Float32Array(N.util.sizeFromShape(t.shape)),r=n.data.get(t.dataId),s=r.complexTensorInfos.real,o=r.complexTensorInfos.imag,a=n.data.get(s.dataId).values,l=n.data.get(o.dataId).values;for(let e=0;e<a.length;e++){const t=a[e],n=l[e];i[e]=Math.hypot(t,n)}return n.makeOutput(i,t.shape,"float32")}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function wy(e){const{inputs:t,backend:n}=e,{input:i}=t,r=n.data.get(i.dataId).complexTensorInfos.imag,s=n.data.get(r.dataId).values;return n.makeTensorInfo(r.shape,r.dtype,s)}const Iy={kernelName:N.Imag,backendName:"cpu",kernelFunc:wy};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Ay(e){const{inputs:t,backend:n,attrs:i}=e,{axis:r}=i,s=N.util.parseAxisParam(r,t[0].shape)[0],o=t.map(e=>e.shape);N.backend_util.assertParamsConsistent(o,s);let a=N.backend_util.computeOutShape(t.map(e=>e.shape),s);if(0===N.util.sizeFromShape(a))return n.makeTensorInfo(a,t[0].dtype,[]);const l=t.filter(e=>N.util.sizeFromShape(e.shape)>0);if(1===l.length)return of({inputs:{x:l[0]},backend:n});if("complex64"===l[0].dtype){const e=l.map(e=>lf({inputs:{input:e},backend:n})),t=l.map(e=>wy({inputs:{input:e},backend:n})),i=Ay({inputs:e,backend:n,attrs:{axis:s}}),r=Ay({inputs:t,backend:n,attrs:{axis:s}}),o=nf({inputs:{real:i,imag:r},backend:n});return e.forEach(e=>n.disposeIntermediateTensorInfo(e)),t.forEach(e=>n.disposeIntermediateTensorInfo(e)),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(r),o}const u=l.map(e=>{const t=N.util.sizeFromShape(e.shape.slice(s));return $g({inputs:{x:e},backend:n,attrs:{shape:[-1,t]}})}),c=u.map(e=>({vals:n.data.get(e.dataId).values,shape:e.shape}));a=N.backend_util.computeOutShape(u.map(e=>e.shape),1);const d=1===u[0].shape[0],h=Mf(c,a,t[0].dtype,d),p=N.backend_util.computeOutShape(l.map(e=>e.shape),s),f=n.makeTensorInfo(p,t[0].dtype,h);return u.forEach(e=>n.disposeIntermediateTensorInfo(e)),f}const Sy={kernelName:N.Concat,backendName:"cpu",kernelFunc:Ay};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Cy(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s}=t,{strides:o,pad:a,dataFormat:l,dilations:u,dimRoundingMode:c}=i;Kp([r,s],"conv2d");const d=N.backend_util.convertConv2DDataFormat(l),h=N.backend_util.computeConv2DInfo(r.shape,s.shape,o,u,a,c,!1,d),p=h.filterHeight,f=h.filterWidth,m=h.dilationHeight,g=h.dilationWidth,y=h.padInfo.left,_=h.padInfo.top,v="channelsLast"===h.dataFormat,b=new N.TensorBuffer(h.outShape,r.dtype),T=N.util.computeStrides(r.shape),x=N.util.computeStrides(s.shape),E=T[0],w=v?T[1]:T[2],I=v?T[2]:1,A=v?1:T[1],S=b.strides[0],C=v?b.strides[1]:b.strides[2],O=v?b.strides[2]:1,M=v?1:b.strides[1],R=n.data.get(r.dataId).values,k=n.data.get(s.dataId).values,D=b.values;for(let e=0;e<h.batchSize;++e){const t=e*E,n=e*S;for(let e=0;e<h.outHeight;++e){const i=n+e*C,r=e*h.strideHeight-_;for(let e=0;e<p;++e){const n=r+e*m;if(n<0||n>=h.inHeight)continue;const s=e*x[0],o=t+n*w;for(let e=0;e<h.outWidth;++e){const t=i+e*O,n=e*h.strideWidth-y;for(let e=0;e<f;++e){const i=n+e*g;if(i<0||i>=h.inWidth)continue;const r=o+i*I;let a=s+e*x[1];for(let e=0;e<h.inChannels;++e){const n=R[r+e*A];for(let e=0;e<h.outChannels;++e)D[t+e*M]+=n*k[a+e];a+=h.outChannels}}}}}}return n.makeTensorInfo(b.shape,b.dtype,D)}const Oy={kernelName:N.Conv2D,backendName:"cpu",kernelFunc:Cy};const My={kernelName:N.Conv2DBackpropFilter,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,dy:s}=t,{strides:o,pad:a,dataFormat:l,dimRoundingMode:u,filterShape:c}=i;Kp([r,s],"conv2dBackpropFilter");const d=N.backend_util.convertConv2DDataFormat(l),h=N.backend_util.computeConv2DInfo(r.shape,c,o,1,a,u,!1,d),{strideHeight:p,strideWidth:f,filterHeight:m,filterWidth:g}=h,y="channelsLast"===h.dataFormat,_=new N.TensorBuffer(h.filterShape,"float32"),v=h.padInfo.left,b=h.padInfo.top,T=n.data.get(r.dataId).values,x=n.data.get(s.dataId).values,E=new N.TensorBuffer(r.shape,r.dtype,T),w=new N.TensorBuffer(s.shape,s.dtype,x);for(let e=0;e<m;++e){const t=Math.max(0,Math.ceil((b-e)/p)),n=Math.min(h.outHeight,(h.inHeight+b-e)/p);for(let i=0;i<g;++i){const r=Math.max(0,Math.ceil((v-i)/f)),s=Math.min(h.outWidth,(h.inWidth+v-i)/f);for(let o=0;o<h.inChannels;++o)for(let a=0;a<h.outChannels;++a){let l=0;for(let u=0;u<h.batchSize;++u)for(let c=t;c<n;++c){const t=e+c*p-b;for(let e=r;e<s;++e){const n=i+e*f-v;l+=y?E.get(u,t,n,o)*w.get(u,c,e,a):E.get(u,o,t,n)*w.get(u,a,c,e)}}_.set(l,e,i,o,a)}}}return n.makeTensorInfo(_.shape,_.dtype,_.values)}};const Ry={kernelName:N.Conv2DBackpropInput,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,filter:s}=t,{inputShape:o,strides:a,pad:l,dataFormat:u,dimRoundingMode:c}=i;Kp([r,s],"conv2dBackpropInput");const d=N.util.computeStrides(s.shape),h=N.util.computeStrides(r.shape);let p=N.backend_util.convertConv2DDataFormat(u);const f=N.backend_util.computeConv2DInfo(o,s.shape,a,1,l,c,!1,p),m=new N.TensorBuffer(f.inShape,"float32"),g=m.values,y=n.data.get(r.dataId).values,_=n.data.get(s.dataId).values,[v,b,T]=d,{batchSize:x,filterHeight:E,filterWidth:w,inChannels:I,inHeight:A,inWidth:S,outChannels:C,outHeight:O,outWidth:M,strideHeight:R,strideWidth:k}=f;p=f.dataFormat;const D=E-1-f.padInfo.top,F=w-1-f.padInfo.left,L="channelsLast"===p,P=m.strides[0],B=L?m.strides[1]:m.strides[2],$=L?m.strides[2]:1,U=L?1:m.strides[1],z=h[0],V=L?h[1]:h[2],j=L?h[2]:1,Y=L?1:h[1];for(let e=0;e<x;++e)for(let t=0;t<I;++t)for(let n=0;n<A;++n){const i=n-D,r=Math.max(0,Math.ceil(i/R)),s=Math.min(O,(E+i)/R);for(let o=0;o<S;++o){const a=o-F,l=Math.max(0,Math.ceil(a/k)),u=Math.min(M,(w+a)/k);let c=0;for(let n=r;n<s;++n){const r=n*R-i;for(let i=l;i<u;++i){const s=z*e+V*n+j*i,o=v*(E-1-r)+b*(w-1-(i*k-a))+T*t;for(let e=0;e<C;++e){c+=y[s+Y*e]*_[o+e]}}}g[P*e+B*n+$*o+U*t]=c}}return n.makeTensorInfo(m.shape,m.dtype,m.values)}};const ky={kernelName:N.Conv3D,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s}=t,{strides:o,pad:a,dilations:l}=i;Kp([r,s],"conv3d");const u=N.backend_util.computeConv3DInfo(r.shape,s.shape,o,l,a),{filterDepth:c,filterHeight:d,filterWidth:h,dilationDepth:p,dilationHeight:f,dilationWidth:m,padInfo:g}=u,y=g.front,_=g.left,v=g.top,b=new N.TensorBuffer(u.outShape,r.dtype),T=n.data.get(r.dataId).values,x=n.data.get(s.dataId).values,E=b.values,w=N.util.computeStrides(r.shape),I=N.util.computeStrides(s.shape);for(let e=0;e<u.batchSize;++e){const t=e*w[0],n=e*b.strides[0];for(let e=0;e<u.outDepth;++e){const i=n+e*b.strides[1],r=e*u.strideDepth-y;for(let e=0;e<c;++e){const n=r+e*p;if(n<0||n>=u.inDepth)continue;const s=e*I[0],o=t+n*w[1];for(let e=0;e<u.outHeight;++e){const t=i+e*b.strides[2],n=e*u.strideHeight-v;for(let e=0;e<d;++e){const i=n+e*f;if(i<0||i>=u.inHeight)continue;const r=s+e*I[1],a=o+i*w[2];for(let e=0;e<u.outWidth;++e){const n=t+e*u.outChannels,i=e*u.strideWidth-_;for(let e=0;e<h;++e){const t=i+e*m;if(t<0||t>=u.inWidth)continue;const s=r+e*I[2],o=a+t*u.inChannels;let l=s;for(let e=0;e<u.inChannels;++e){const t=T[o+e];for(let e=0;e<u.outChannels;++e)E[n+e]+=t*x[l+e];l+=u.outChannels}}}}}}}}return n.makeTensorInfo(b.shape,b.dtype,b.values)}};const Ny={kernelName:N.Conv3DBackpropFilterV2,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,dy:s}=t,{strides:o,pad:a,filterShape:l}=i;Kp([r,s],"conv3dBackpropFilterV2");const u=N.util.computeStrides(r.shape),c=N.util.computeStrides(s.shape),d=N.backend_util.computeConv3DInfo(r.shape,l,o,1,a),h=d.strideDepth,p=d.strideHeight,f=d.strideWidth,m=d.filterDepth,g=d.filterHeight,y=d.filterWidth,_=new N.TensorBuffer(d.filterShape,"float32"),v=_.values,[b,T,x,E]=_.strides,w=n.data.get(s.dataId).values,[I,A,S,C]=c,O=n.data.get(r.dataId).values,[M,R,k,D]=u,F=d.padInfo.front,L=d.padInfo.left,P=d.padInfo.top;for(let e=0;e<m;++e){const t=Math.max(0,Math.ceil((F-e)/h)),n=Math.min(d.outDepth,(d.inDepth+F-e)/h),i=e*b;for(let r=0;r<g;++r){const s=Math.max(0,Math.ceil((P-r)/p)),o=Math.min(d.outHeight,(d.inHeight+P-r)/p),a=r*T+i;for(let i=0;i<y;++i){const l=Math.max(0,Math.ceil((L-i)/f)),u=Math.min(d.outWidth,(d.inWidth+L-i)/f),c=i*x+a;for(let a=0;a<d.inChannels;++a){const m=a*E+c;for(let c=0;c<d.outChannels;++c){let g=0;for(let m=0;m<d.batchSize;++m){const d=m*M,y=m*I;for(let m=t;m<n;++m){const t=(e+m*h-F)*R+d,n=m*A+y;for(let e=s;e<o;++e){const s=(r+e*p-P)*k+t,o=e*S+n;for(let e=l;e<u;++e){const t=e*C+o;g+=O[(i+e*f-L)*D+s+a]*w[t+c]}}}}v[m+c]=g}}}}}return n.makeTensorInfo(_.shape,_.dtype,_.values)}};const Dy={kernelName:N.Conv3DBackpropInputV2,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,filter:s}=t,{pad:o,strides:a,inputShape:l}=i;Kp([r],"conv3dBackpropInputV2");const u=N.util.computeStrides(r.shape),c=N.util.computeStrides(s.shape),d=N.backend_util.computeConv3DInfo(l,s.shape,a,1,o),h=new N.TensorBuffer(d.inShape,"float32"),p=h.values,[f,m,g,y]=h.strides,_=n.data.get(r.dataId).values,[v,b,T,x]=u,E=n.data.get(s.dataId).values,[w,I,A,S]=c,{batchSize:C,filterDepth:O,filterHeight:M,filterWidth:R,inChannels:k,inDepth:D,inHeight:F,inWidth:L,outChannels:P,outDepth:B,outHeight:$,outWidth:U,strideDepth:z,strideHeight:V,strideWidth:j}=d,Y=O-1-d.padInfo.front,G=M-1-d.padInfo.top,H=R-1-d.padInfo.left;for(let e=0;e<C;++e)for(let t=0;t<k;++t)for(let n=0;n<D;++n){const i=n-Y,r=Math.max(0,Math.ceil(i/z)),s=Math.min(B,(O+i)/z);for(let o=0;o<F;++o){const a=o-G,l=Math.max(0,Math.ceil(a/V)),u=Math.min($,(M+a)/V);for(let c=0;c<L;++c){const d=c-H,h=Math.max(0,Math.ceil(d/j)),C=Math.min(U,(R+d)/j);let k=0;for(let n=r;n<s;++n){const r=n*z-i;for(let i=l;i<u;++i){const s=i*V-a;for(let o=h;o<C;++o){const a=v*e+b*n+T*i+x*o,l=w*(O-1-r)+I*(M-1-s)+A*(R-1-(o*j-d))+S*t;for(let e=0;e<P;++e){k+=_[a+e]*E[l+e]}}}}p[f*e+m*n+g*o+y*c+t]=k}}}return n.makeTensorInfo(h.shape,h.dtype,h.values)}},Fy=If(N.Cos,e=>Math.cos(e)),Ly={kernelName:N.Cos,backendName:"cpu",kernelFunc:Fy},Py=If(N.Cosh,e=>Math.cosh(e)),By={kernelName:N.Cosh,backendName:"cpu",kernelFunc:Py};const $y={kernelName:N.CropAndResize,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{image:r,boxes:s,boxInd:o}=t,{cropSize:a,method:l,extrapolationValue:u}=i,[c,d,h,p]=r.shape,f=s.shape[0],[m,g]=a,y=(0,N.buffer)([f,m,g,p],"float32"),_=n.data.get(s.dataId).values,v=n.data.get(o.dataId).values,b=n.data.get(r.dataId).values,T=N.util.computeStrides(r.shape),x=N.util.computeStrides(y.shape);for(let e=0;e<f;e++){const t=4*e,n=_[t],i=_[t+1],r=_[t+2],s=_[t+3],o=v[e];if(o>=c)continue;const a=m>1?(r-n)*(d-1)/(m-1):0,f=g>1?(s-i)*(h-1)/(g-1):0;for(let t=0;t<m;t++){const c=m>1?n*(d-1)+t*a:.5*(n+r)*(d-1);if(c<0||c>d-1)for(let n=0;n<g;n++)for(let i=0;i<p;i++){const r=i+n*x[2]+t*x[1]+e*x[0];y.values[r]=u}else if("bilinear"===l){const n=Math.floor(c),r=Math.ceil(c),a=c-n;for(let l=0;l<g;l++){const c=g>1?i*(h-1)+l*f:.5*(i+s)*(h-1);if(c<0||c>h-1){for(let n=0;n<p;n++){const i=n+l*x[2]+t*x[1]+e*x[0];y.values[i]=u}continue}const d=Math.floor(c),m=Math.ceil(c),_=c-d;for(let i=0;i<p;i++){let s=i+d*T[2]+n*T[1]+o*T[0];const u=b[s];s=i+m*T[2]+n*T[1]+o*T[0];const c=b[s];s=i+d*T[2]+r*T[1]+o*T[0];const h=b[s];s=i+m*T[2]+r*T[1]+o*T[0];const p=u+(c-u)*_,f=h+(b[s]-h)*_;s=i+l*x[2]+t*x[1]+e*x[0],y.values[s]=p+(f-p)*a}}}else for(let n=0;n<g;++n){const r=g>1?i*(h-1)+n*f:.5*(i+s)*(h-1);if(r<0||r>h-1){for(let i=0;i<p;i++){const r=i+n*x[2]+t*x[1]+e*x[0];y.values[r]=u}continue}const a=Math.round(r),l=Math.round(c);for(let i=0;i<p;i++){const r=i+a*T[2]+l*T[1]+o*T[0],s=i+n*x[2]+t*x[1]+e*x[0];y.values[s]=b[r]}}}}return n.makeTensorInfo(y.shape,y.dtype,y.values)}};const Uy={kernelName:N.Cumprod,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,exclusive:o,reverse:a}=i;Kp(r,"cumprod");const l=N.backend_util.getAxesPermutation([s],r.shape.length);let u=r;null!=l&&(u=Sm({inputs:{x:r},backend:n,attrs:{perm:l}}));const c=N.backend_util.getInnerMostAxes(1,r.shape.length)[0];if(c!==u.shape.length-1)throw new Error(`backend.cumprod in CPU expects an inner-most axis=${u.shape.length-1} but got axis=${c}`);const d=(0,N.upcastType)(u.dtype,"int32"),h=N.util.makeOnesTypedArray(N.util.sizeFromShape(u.shape),d),p=n.data.get(u.dataId).values,f=u.shape[u.shape.length-1],m=a?(e,t)=>e+f-t-1:(e,t)=>e+t;for(let e=0;e<p.length;e+=f)for(let t=0;t<f;t++){const n=m(e,t);if(0===t)h[n]=o?1:p[n];else{const i=m(e,t-1);h[n]=o?p[i]*h[i]:p[n]*h[i]}}const g=n.makeTensorInfo(u.shape,d,h);if(null!=l){const e=Sm({inputs:{x:g},backend:n,attrs:{perm:N.backend_util.getUndoAxesPermutation(l)}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(u),e}return g}};const zy={kernelName:N.Cumsum,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,exclusive:o,reverse:a}=i;Kp(r,"cumsum");const l=N.backend_util.getAxesPermutation([s],r.shape.length);let u=r;null!=l&&(u=Sm({inputs:{x:r},backend:n,attrs:{perm:l}}));const c=N.backend_util.getInnerMostAxes(1,r.shape.length)[0];if(c!==u.shape.length-1)throw new Error(`backend.cumsum in CPU expects an inner-most axis=${u.shape.length-1} but got axis=${c}`);const d=(0,N.upcastType)(u.dtype,"int32"),h=N.util.makeZerosTypedArray(N.util.sizeFromShape(u.shape),d),p=n.data.get(u.dataId).values,f=u.shape[u.shape.length-1],m=a?(e,t)=>e+f-t-1:(e,t)=>e+t;for(let e=0;e<p.length;e+=f)for(let t=0;t<f;t++){const n=m(e,t);if(0===t)h[n]=o?0:p[n];else{const i=m(e,t-1);h[n]=o?p[i]+h[i]:p[n]+h[i]}}const g=n.makeTensorInfo(u.shape,d,h);if(null!=l){const e=Sm({inputs:{x:g},backend:n,attrs:{perm:N.backend_util.getUndoAxesPermutation(l)}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(u),e}return g}};const Vy={kernelName:N.DenseBincount,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,weights:s}=t,{size:o,binaryOutput:a}=i;if(1===r.shape.length){const e=vf(n.data.get(r.dataId).values,n.data.get(s.dataId).values,s.dtype,s.shape,o);return n.makeTensorInfo([o],s.dtype,e)}if(2===r.shape.length){const e=bf(n.bufferSync(r),n.bufferSync(s),o,a);return n.makeTensorInfo(e.shape,s.dtype,e.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${r.shape.length}.`)}};const jy={kernelName:N.DepthToSpace,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{blockSize:s,dataFormat:o}=i;N.util.assert("NHWC"===o,()=>`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${o}`);const a=r.shape[0],l=r.shape[1],u=r.shape[2],c=r.shape[3],d=l*s,h=u*s,p=c/(s*s),f=n.data.get(r.dataId).values,m=new Float32Array(a*d*h*p);let g=0;for(let e=0;e<a;++e)for(let t=0;t<d;++t){const n=Math.floor(t/s),i=t%s;for(let t=0;t<h;++t){const r=Math.floor(t/s),o=(i*s+t%s)*p;for(let t=0;t<p;++t){const i=t+o+c*(r+u*(n+l*e));m[g++]=f[i]}}}return n.makeTensorInfo([a,d,h,p],r.dtype,m)}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Yy(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s}=t,{strides:o,pad:a,dilations:l,dimRoundingMode:u}=i;Kp([r,s],"depthwiseConv2DNative");const c=N.util.computeStrides(r.shape),d=N.util.computeStrides(s.shape);let h=l;null==h&&(h=[1,1]),N.util.assert(N.backend_util.eitherStridesOrDilationsAreOne(o,h),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${o} and dilations '${h}'`);const p=N.backend_util.computeConv2DInfo(r.shape,s.shape,o,h,a,u,!0),{filterHeight:f,filterWidth:m,dilationHeight:g,dilationWidth:y,padInfo:_}=p,v=_.left,b=_.top,T=p.outChannels/p.inChannels,x=new N.TensorBuffer(p.outShape,r.dtype),E=n.data.get(r.dataId).values,w=n.data.get(s.dataId).values,I=x.values;for(let e=0;e<p.batchSize;++e){const t=e*c[0],n=e*x.strides[0];for(let e=0;e<p.outHeight;++e){const i=n+e*x.strides[1],r=e*p.strideHeight-b;for(let e=0;e<f;++e){const n=r+e*g;if(n<0||n>=p.inHeight)continue;const s=e*d[0],o=t+n*c[1];for(let e=0;e<p.outWidth;++e){const t=i+e*x.strides[2],n=e*p.strideWidth-v;for(let e=0;e<m;++e){const i=n+e*y;if(i<0||i>=p.inWidth)continue;const r=s+e*d[1],a=o+i*p.inChannels;let l=t,u=r;for(let e=0;e<p.inChannels;++e){const t=E[a+e];for(let e=0;e<T;++e)I[l+e]+=t*w[u+e];l+=T,u+=T}}}}}}return n.makeTensorInfo(x.shape,x.dtype,x.values)}const Gy={kernelName:N.DepthwiseConv2dNative,backendName:"cpu",kernelFunc:Yy};const Hy={kernelName:N.DepthwiseConv2dNativeBackpropFilter,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,dy:s}=t,{strides:o,dilations:a,pad:l,dimRoundingMode:u,filterShape:c}=i;Kp([r,s],"depthwiseConv2dNativeBackpropFilter");const d=N.backend_util.computeConv2DInfo(r.shape,c,o,a,l,u,!0),{strideHeight:h,strideWidth:p,filterHeight:f,filterWidth:m}=d,g=new N.TensorBuffer(d.filterShape,"float32"),y=d.padInfo.left,_=d.padInfo.top,v=d.outChannels/d.inChannels,b=n.data.get(r.dataId).values,T=new N.TensorBuffer(r.shape,r.dtype,b),x=n.data.get(s.dataId).values,E=new N.TensorBuffer(s.shape,s.dtype,x);for(let e=0;e<f;++e){const t=Math.max(0,Math.ceil((_-e)/h)),n=Math.min(d.outHeight,(d.inHeight+_-e)/h);for(let i=0;i<m;++i){const r=Math.max(0,Math.ceil((y-i)/p)),s=Math.min(d.outWidth,(d.inWidth+y-i)/p);for(let o=0;o<d.outChannels;++o){const a=Math.trunc(o/v),l=o%v;let u=0;for(let l=0;l<d.batchSize;++l)for(let c=t;c<n;++c){const t=e+c*h-_;for(let e=r;e<s;++e){const n=i+e*p-y;u+=T.get(l,t,n,a)*E.get(l,c,e,o)}}g.set(u,e,i,a,l)}}}return n.makeTensorInfo(g.shape,g.dtype,g.values)}};const Wy={kernelName:N.DepthwiseConv2dNativeBackpropInput,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,filter:s}=t,{strides:o,dilations:a,pad:l,dimRoundingMode:u,inputShape:c}=i;Kp([r,s],"depthwiseConv2DNativeBackpropInput");const d=N.util.computeStrides(r.shape),h=N.util.computeStrides(s.shape),p=N.backend_util.computeConv2DInfo(c,s.shape,o,a,l,u,!0),f=new N.TensorBuffer(p.inShape,"float32"),m=f.values,[g,y,_]=f.strides,v=n.data.get(r.dataId).values,[b,T,x]=d,E=n.data.get(s.dataId).values,[w,I,A]=h,{batchSize:S,filterHeight:C,filterWidth:O,inChannels:M,inHeight:R,inWidth:k,outChannels:D,outHeight:F,outWidth:L,strideHeight:P,strideWidth:B}=p,$=C-1-p.padInfo.top,U=O-1-p.padInfo.left,z=D/M;for(let e=0;e<S;++e)for(let t=0;t<M;++t)for(let n=0;n<R;++n){const i=n-$,r=Math.max(0,Math.ceil(i/P)),s=Math.min(F,(C+i)/P);for(let o=0;o<k;++o){const a=o-U,l=Math.max(0,Math.ceil(a/B)),u=Math.min(L,(O+a)/B);let c=0;for(let n=r;n<s;++n){const r=n*P-i;for(let i=l;i<u;++i){const s=b*e+T*n+x*i,o=w*(C-1-r)+I*(O-1-(i*B-a))+A*t;for(let e=0;e<z;++e){c+=v[s+(t*z+e)]*E[o+e]}}}m[g*e+y*n+_*o+t]=c}}return n.makeTensorInfo(f.shape,f.dtype,f.values)}};const Xy={kernelName:N.Diag,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{x:i}=t,r=N.util.sizeFromShape(i.shape),s=n.data.get(i.dataId).values,o=(0,N.buffer)([r,r],i.dtype),a=o.values;for(let e=0;e<s.length;e++)a[e*r+e]=s[e];const l=[...i.shape,...i.shape];return n.makeTensorInfo(l,o.dtype,o.values)}},qy={kernelName:N.Dilation2D,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:i,filter:r}=e,{strides:s,pad:o,dilations:a}=n,l=t,u=l.data.get(i.dataId).values,c=i.shape.length,d=l.data.get(r.dataId).values,h=r.shape.length,{batchSize:p,inHeight:f,inWidth:m,inChannels:g,outHeight:y,outWidth:_,padInfo:v,strideHeight:b,strideWidth:T,filterHeight:x,filterWidth:E,dilationHeight:w,dilationWidth:I,outShape:A}=N.backend_util.computeDilation2DInfo(i.shape,r.shape,s,o,"NHWC",a),S=N.util.sizeFromShape(A),C=A.length,O=N.util.getArrayFromDType(i.dtype,S);for(let e=0;e<p;++e)for(let t=0;t<y;++t){const n=t*b-v.top;for(let s=0;s<_;++s){const o=s*T-v.left;for(let a=0;a<g;++a){let l=Number.MIN_SAFE_INTEGER;for(let t=0;t<x;++t){const s=n+t*w;if(s>=0&&s<f)for(let n=0;n<E;++n){const p=o+n*I;if(p>=0&&p<m){const o=N.util.locToIndex([e,s,p,a],c,N.util.computeStrides(i.shape)),f=N.util.locToIndex([t,n,a],h,N.util.computeStrides(r.shape)),m=u[o]+d[f];m>l&&(l=m)}}}O[N.util.locToIndex([e,t,s,a],C,N.util.computeStrides(A))]=l}}}return{dataId:l.write(N.util.toTypedArray(O,i.dtype),A,i.dtype),shape:A,dtype:i.dtype}}},Ky={kernelName:N.Dilation2DBackpropFilter,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:i,filter:r,dy:s}=e,{strides:o,pad:a,dilations:l}=n,u=t,c=N.util.toNestedArray(i.shape,u.data.get(i.dataId).values),d=N.util.toNestedArray(r.shape,u.data.get(r.dataId).values),{batchSize:h,inHeight:p,inWidth:f,inChannels:m,outHeight:g,outWidth:y,padInfo:_,strideHeight:v,strideWidth:b,filterHeight:T,filterWidth:x,dilationHeight:E,dilationWidth:w,outShape:I}=N.backend_util.computeDilation2DInfo(i.shape,r.shape,o,a,"NHWC",l);N.util.assert(s.rank===I.length,()=>`Error in ${N.Dilation2DBackpropFilter}, dy must have the same rank as output ${I.length}, but got ${s.rank}`);const A=N.util.toNestedArray(I,u.data.get(s.dataId).values),S=N.util.makeZerosNestedTypedArray(r.shape,r.dtype);for(let e=0;e<h;++e)for(let t=0;t<g;++t){const n=t*v-_.top;for(let i=0;i<y;++i){const r=i*b-_.left;for(let s=0;s<m;++s){let o=Number.MIN_SAFE_INTEGER,a=0,l=0;for(let t=0;t<T;++t){const i=n+t*E;if(i>=0&&i<p)for(let n=0;n<x;++n){const u=r+n*w;if(u>=0&&u<f){const r=c[e][i][u][s]+d[t][n][s];r>o&&(o=r,a=t,l=n)}}}S[a][l][s]+=A[e][t][i][s]}}}return{dataId:u.write(N.util.toTypedArray(S,i.dtype),r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}},Zy={kernelName:N.Dilation2DBackpropInput,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:i,filter:r,dy:s}=e,{strides:o,pad:a,dilations:l}=n,u=t,c=N.util.toNestedArray(i.shape,u.data.get(i.dataId).values),d=N.util.toNestedArray(r.shape,u.data.get(r.dataId).values),{batchSize:h,inHeight:p,inWidth:f,inChannels:m,outHeight:g,outWidth:y,padInfo:_,strideHeight:v,strideWidth:b,filterHeight:T,filterWidth:x,dilationHeight:E,dilationWidth:w,outShape:I}=N.backend_util.computeDilation2DInfo(i.shape,r.shape,o,a,"NHWC",l);N.util.assert(s.rank===I.length,()=>`Error in ${N.Dilation2DBackpropInput}, dy must have the same rank as output ${I.length}, but got ${s.rank}`);const A=N.util.toNestedArray(I,u.data.get(s.dataId).values),S=N.util.makeZerosNestedTypedArray(i.shape,i.dtype);for(let e=0;e<h;++e)for(let t=0;t<g;++t){const n=t*v-_.top;for(let i=0;i<y;++i){const r=i*b-_.left;for(let s=0;s<m;++s){let o=Number.MIN_SAFE_INTEGER,a=n<0?0:n,l=r<0?0:r;for(let t=0;t<T;++t){const i=n+t*E;if(i>=0&&i<p)for(let n=0;n<x;++n){const u=r+n*w;if(u>=0&&u<f){const r=c[e][i][u][s]+d[t][n][s];r>o&&(o=r,a=i,l=u)}}}S[e][a][l][s]+=A[e][t][i][s]}}}return{dataId:u.write(N.util.toTypedArray(S,i.dtype),i.shape,i.dtype),shape:i.shape,dtype:i.dtype}}};const Qy={kernelName:N.Draw,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{image:r}=t,{canvas:s,options:o}=i,{contextOptions:a,imageOptions:l}=o||{},u=(null==l?void 0:l.alpha)||1,c=(null==a?void 0:a.contextType)||"2d";if("2d"!==c)throw new Error(`Context type ${a.contextType} is not supported by the CPU backend.`);const d=s.getContext(c,(null==a?void 0:a.contextAttributes)||{});if(null==d)throw new Error(`Could not get the context with ${c} type.`);const[h,p]=r.shape.slice(0,2),f=2===r.shape.length?1:r.shape[2],m=n.data.get(r.dataId).values,g="float32"===r.dtype?255:1,y=new Uint8ClampedArray(p*h*4);for(let e=0;e<h*p;++e){const t=[0,0,0,255*u];for(let n=0;n<f;n++){const i=m[e*f+n];if("float32"===r.dtype){if(i<0||i>1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${i}.`)}else if("int32"===r.dtype&&(i<0||i>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${i}.`);1===f?(t[0]=i*g,t[1]=i*g,t[2]=i*g):t[n]=i*g}const n=4*e;y[n+0]=Math.round(t[0]),y[n+1]=Math.round(t[1]),y[n+2]=Math.round(t[2]),y[n+3]=Math.round(t[3])}s.width=p,s.height=h;const _=new ImageData(y,p,h);return d.putImageData(_,0,0),r}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Jy(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i;let a;Kp(r,"sum"),a="bool"===r.dtype?df({inputs:{x:r},backend:n,attrs:{dtype:"int32"}}):of({inputs:{x:r},backend:n});const l=a.shape.length,u=N.util.parseAxisParam(s,a.shape),c=N.backend_util.getAxesPermutation(u,l);let d=u,h=a;null!=c&&(h=Sm({inputs:{x:a},backend:n,attrs:{perm:c}}),d=N.backend_util.getInnerMostAxes(d.length,l)),N.backend_util.assertAxesAreInnerMostDims("sum",d,h.shape.length);const[p,f]=N.backend_util.computeOutAndReduceShapes(h.shape,d);let m=sf(n,p,N.backend_util.upcastType(h.dtype,"int32"));const g=N.util.sizeFromShape(f),y=n.data.get(m.dataId).values,_=n.data.get(h.dataId).values;for(let e=0;e<y.length;++e){const t=e*g;let n=0;for(let e=0;e<g;++e)n+=_[t+e];y[e]=n}if(o){const e=m;m=$g({inputs:{x:m},backend:n,attrs:{shape:N.backend_util.expandShapeToKeepDim(m.shape,u)}}),n.disposeIntermediateTensorInfo(e)}return n.disposeIntermediateTensorInfo(a),null!=c&&n.disposeIntermediateTensorInfo(h),m}const e_={kernelName:N.Sum,backendName:"cpu",kernelFunc:Jy};const t_={kernelName:N.Einsum,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{equation:r}=i,s=t,{allDims:o,summedDims:a,idDims:l}=N.backend_util.decodeEinsumEquation(r,s.length);N.backend_util.checkEinsumDimSizes(o.length,l,s);const{path:u,steps:c}=N.backend_util.getEinsumComputePath(a,l),d=c.length;let h=null,p=o.length;const f=[];for(let e=0;e<d;++e){for(const t of c[e]){const{permutationIndices:e,expandDims:i}=N.backend_util.getEinsumPermutation(p,l[t]);let r;N.backend_util.isIdentityPermutation(e)?r=s[t]:(r=Sm({inputs:{x:s[t]},backend:n,attrs:{perm:e}}),f.push(r));const o=r.shape.slice();for(let e=0;e<i.length;++e)o.splice(i[e],0,1);N.util.arraysEqual(r.shape,o)||(r=$g({inputs:{x:r},backend:n,attrs:{shape:o}}),f.push(r)),null===h?h=r:(h=vm({inputs:{a:r,b:h},backend:n}),f.push(h))}e<d-1&&(u[e]>=0&&(h=Jy({inputs:{x:h},backend:n,attrs:{axis:u[e]-(o.length-p),keepDims:!1}}),f.push(h)),p--)}for(const e of f)e!==h&&n.disposeIntermediateTensorInfo(e);return h}};const n_={kernelName:N.EluGrad,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{dy:i,y:r}=t;Kp([i,r],"eluGrad");const s=new Float32Array(N.util.sizeFromShape(r.shape)),o=n.data.get(r.dataId).values,a=n.data.get(i.dataId).values;for(let e=0;e<o.length;++e){const t=o[e];s[e]=t>=0?a[e]:a[e]*(t+1)}return n.makeTensorInfo(r.shape,"float32",s)}},i_=N.backend_util.ERF_P,r_=N.backend_util.ERF_A1,s_=N.backend_util.ERF_A2,o_=N.backend_util.ERF_A3,a_=N.backend_util.ERF_A4,l_=N.backend_util.ERF_A5,u_=If(N.Erf,e=>{const t=Math.sign(e),n=Math.abs(e),i=1/(1+i_*n);return t*(1-((((l_*i+a_)*i+o_)*i+s_)*i+r_)*i*Math.exp(-n*n))}),c_={kernelName:N.Erf,backendName:"cpu",kernelFunc:u_};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function d_(e){const{inputs:t,backend:n,attrs:i}=e,{input:r}=t,{dim:s}=i,o=r.shape.length,a=r.shape.slice();let l=s;return s<0&&(N.util.assert(-(o+1)<=s,()=>`Axis must be in the interval [${-(o+1)}, ${o}]`),l=o+s+1),a.splice(l,0,1),$g({inputs:{x:r},backend:n,attrs:{shape:a}})}const h_={kernelName:N.ExpandDims,backendName:"cpu",kernelFunc:d_},p_=tf((e,t)=>e/t),f_=pf(N.RealDiv,p_),m_={kernelName:N.RealDiv,backendName:"cpu",kernelFunc:f_};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function g_(e,t,n){const i=e.shape,r=i[0],s=i[1],o=n.data.get(e.dataId),a=o.complexTensorInfos.real,l=o.complexTensorInfos.imag,u=[r,s],c=N.util.sizeFromShape(u),d=N.util.getTypedArrayFromDType("float32",c),h=N.util.getTypedArrayFromDType("float32",c);for(let e=0;e<r;e++){const i=Zm({inputs:{x:a},backend:n,attrs:{begin:[e,0],size:[1,s]}}),r=Zm({inputs:{x:l},backend:n,attrs:{begin:[e,0],size:[1,s]}}),o=nf({inputs:{real:i,imag:r},backend:n}),{real:u,imag:c}=y_(o,t,n),p=N.backend_util.mergeRealAndImagArrays(u,c);for(let t=0;t<s;t++){const n=N.backend_util.getComplexWithIndex(p,t);d[e*s+t]=n.real,h[e*s+t]=n.imag}n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(o)}const p=n.makeTensorInfo(u,"float32",d),f=n.makeTensorInfo(u,"float32",h),m=nf({inputs:{real:p,imag:f},backend:n});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),m}function y_(e,t,n){const i=N.util.sizeFromShape(e.shape),r=n.data.get(e.dataId),s=n.data.get(r.complexTensorInfos.real.dataId).values,o=n.data.get(r.complexTensorInfos.imag.dataId).values;if((a=i)&a-1){const e=function(e,t,n){const i=new Float32Array(2*t);for(let r=0;r<t;r++){let s=0,o=0;for(let i=0;i<t;i++){const a=N.backend_util.exponent(r*i,t,n),l=N.backend_util.getComplexWithIndex(e,i);s+=l.real*a.real-l.imag*a.imag,o+=l.real*a.imag+l.imag*a.real}n&&(s/=t,o/=t),N.backend_util.assignToTypedArray(i,s,o,r)}return i}(N.backend_util.mergeRealAndImagArrays(s,o),i,t);return N.backend_util.splitRealAndImagArrays(e)}{const r=__(s,o,i,t,n),a=[e.shape[0],e.shape[1]];if(t){const e=n.makeTensorInfo(a,"float32",r.real),t=n.makeTensorInfo(a,"float32",r.imag),s=n.makeTensorInfo([],"float32",N.util.createScalarValue(i,"float32")),o=of({inputs:{x:s},backend:n}),l=m_.kernelFunc({inputs:{a:e,b:s},backend:n}),u=m_.kernelFunc({inputs:{a:t,b:o},backend:n}),c=n.data.get(l.dataId).values,d=n.data.get(u.dataId).values;return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),n.disposeIntermediateTensorInfo(u),{real:c,imag:d}}return r}var a}function __(e,t,n,i,r){if(1===n)return{real:e,imag:t};const s=N.backend_util.mergeRealAndImagArrays(e,t),o=n/2,a=N.backend_util.complexWithEvenIndex(s),l=a.real,u=a.imag,c=[l.length],d=r.makeTensorInfo(c,"float32",l),h=r.makeTensorInfo(c,"float32",u),p=nf({inputs:{real:d,imag:h},backend:r}),f=N.backend_util.complexWithOddIndex(s),m=f.real,g=f.imag,y=[m.length],_=r.makeTensorInfo(y,"float32",m),v=r.makeTensorInfo(y,"float32",g),b=nf({inputs:{real:_,imag:v},backend:r}),T=__(l,u,o,i,r),x=T.real,E=T.imag,w=[x.length],I=r.makeTensorInfo(w,"float32",x),A=r.makeTensorInfo(w,"float32",E),S=nf({inputs:{real:I,imag:A},backend:r}),C=__(m,g,o,i,r),O=C.real,M=C.imag,R=[O.length],k=r.makeTensorInfo(R,"float32",O),D=r.makeTensorInfo(R,"float32",M),F=nf({inputs:{real:k,imag:D},backend:r}),L=N.backend_util.exponents(n,i),P=[L.real.length],B=r.makeTensorInfo(P,"float32",L.real),$=r.makeTensorInfo(P,"float32",L.imag),U=nf({inputs:{real:B,imag:$},backend:r}),z=vm({inputs:{a:U,b:F},backend:r}),V=yf({inputs:{a:S,b:z},backend:r}),j=vg({inputs:{a:S,b:z},backend:r}),Y=lf({inputs:{input:V},backend:r}),G=lf({inputs:{input:j},backend:r}),H=wy({inputs:{input:V},backend:r}),W=wy({inputs:{input:j},backend:r}),X=Ay({inputs:[Y,G],backend:r,attrs:{axis:0}}),q=Ay({inputs:[H,W],backend:r,attrs:{axis:0}}),K=r.data.get(X.dataId).values,Z=r.data.get(q.dataId).values;return r.disposeIntermediateTensorInfo(d),r.disposeIntermediateTensorInfo(h),r.disposeIntermediateTensorInfo(p),r.disposeIntermediateTensorInfo(_),r.disposeIntermediateTensorInfo(v),r.disposeIntermediateTensorInfo(b),r.disposeIntermediateTensorInfo(I),r.disposeIntermediateTensorInfo(A),r.disposeIntermediateTensorInfo(S),r.disposeIntermediateTensorInfo(k),r.disposeIntermediateTensorInfo(D),r.disposeIntermediateTensorInfo(F),r.disposeIntermediateTensorInfo(B),r.disposeIntermediateTensorInfo($),r.disposeIntermediateTensorInfo(U),r.disposeIntermediateTensorInfo(z),r.disposeIntermediateTensorInfo(V),r.disposeIntermediateTensorInfo(j),r.disposeIntermediateTensorInfo(Y),r.disposeIntermediateTensorInfo(H),r.disposeIntermediateTensorInfo(G),r.disposeIntermediateTensorInfo(W),r.disposeIntermediateTensorInfo(X),r.disposeIntermediateTensorInfo(q),{real:K,imag:Z}}const v_={kernelName:N.FFT,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{input:i}=t,r=N.util.sizeFromShape(i.shape),s=i.shape[i.shape.length-1],o=$g({inputs:{x:i},backend:n,attrs:{shape:[r/s,s]}}),a=g_(o,!1,n),l=$g({inputs:{x:a},backend:n,attrs:{shape:i.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(a),l}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function b_(e){const{backend:t,attrs:n}=e,{shape:i,value:r,dtype:s}=n,o=s||N.util.inferDtype(r),a=N.util.getArrayFromDType(o,N.util.sizeFromShape(i));return function(e,t){e.fill(t)}(a,r),t.makeTensorInfo(i,o,a)}const T_={kernelName:N.Fill,backendName:"cpu",kernelFunc:b_};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const x_={kernelName:N.FlipLeftRight,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{image:i}=e,r=n,s=N.util.getTypedArrayFromDType(i.dtype,N.util.sizeFromShape(i.shape)),[o,a,l,u]=i.shape,c=r.data.get(i.dataId).values;for(let e=0;e<o;e++){const t=e*l*a*u;for(let e=0;e<a;e++){const n=e*(l*u);for(let e=0;e<l;e++){const i=e*u;for(let r=0;r<u;r++){const o=Math.round(l-e-1),a=t+n+i+r;let d=c[a];if(o>=0&&o<l){d=c[t+n+o*u+r]}s[a]=d}}}}return{dataId:r.write(s,i.shape,i.dtype),shape:i.shape,dtype:i.dtype}}};const E_={kernelName:N.FusedConv2D,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s,bias:o,preluActivationWeights:a}=t,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=i;let m=Cy({inputs:{x:r,filter:s},backend:n,attrs:{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h}});if(o){const e=m;if("NCHW"===c&&1===o.shape.length&&1!==o.shape[0]){const e=$g({inputs:{x:o},backend:n,attrs:{shape:[o.shape[0],1,1]}});m=yf({inputs:{a:m,b:e},backend:n}),n.disposeIntermediateTensorInfo(e)}else m=yf({inputs:{a:m,b:o},backend:n});n.disposeIntermediateTensorInfo(e)}if(p){const e=m;if("NCHW"===c&&"prelu"===p&&1===a.shape.length&&1!==a.shape[0]){const e=$g({inputs:{x:a},backend:n,attrs:{shape:[a.shape[0],1,1]}});m=Bg(n,m,p,e,f),n.disposeIntermediateTensorInfo(e)}else m=Bg(n,m,p,a,f);n.disposeIntermediateTensorInfo(e)}return m}};const w_={kernelName:N.FusedDepthwiseConv2D,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s,bias:o,preluActivationWeights:a}=t,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=i;let m=Yy({inputs:{x:r,filter:s},backend:n,attrs:{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h}});if(o){const e=m;m=yf({inputs:{a:m,b:o},backend:n}),n.disposeIntermediateTensorInfo(e)}if(p){const e=m;m=Bg(n,m,p,a,f),n.disposeIntermediateTensorInfo(e)}return m}};const I_={kernelName:N.GatherNd,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{params:i,indices:r}=t,s=N.util.sizeFromShape(i.shape),o=r.shape,a=o[o.length-1],[l,u,c,d]=N.backend_util.prepareAndValidate(i,r);if(0===u)return n.makeTensorInfo(l,i.dtype,[]);const h=Hf(n.data.get(r.dataId).values,n.bufferSync(i),i.dtype,u,a,c,d,i.shape,s);return n.makeTensorInfo(l,i.dtype,h.values)}};const A_={kernelName:N.GatherV2,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,indices:s}=t,{axis:o,batchDims:a}=i;Kp([r,s],"gatherV2");const l=N.util.parseAxisParam(o,r.shape)[0],u=n.data.get(s.dataId).values,c=r.shape[l];for(let e=0;e<u.length;++e){const t=u[e];N.util.assert(t<=c-1&&t>=0,()=>`GatherV2: the index value ${t} is not in [0, ${c-1}]`)}let d=a;null==a&&(d=0);const h=N.util.sizeFromShape(s.shape),p=N.backend_util.segment_util.collectGatherOpShapeInfo(r,s,l,d),f=$g({inputs:{x:r},backend:n,attrs:{shape:[p.batchSize,p.outerSize,p.dimSize,p.sliceSize]}}),m=$g({inputs:{x:s},backend:n,attrs:{shape:[p.batchSize,h/p.batchSize]}}),g=[p.batchSize,p.outerSize,h/p.batchSize,p.sliceSize],y=n.bufferSync(m),_=Wf(n.bufferSync(f),y,g);return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),n.makeTensorInfo(p.outputShape,_.dtype,_.values)}};const S_={kernelName:N.IFFT,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{input:i}=t,r=N.util.sizeFromShape(i.shape),s=i.shape[i.shape.length-1],o=$g({inputs:{x:i},backend:n,attrs:{shape:[r/s,s]}}),a=g_(o,!0,n),l=$g({inputs:{x:a},backend:n,attrs:{shape:i.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(a),l}},C_=If(N.IsFinite,e=>Number.isFinite(e)?1:0,"bool"),O_={kernelName:N.IsFinite,backendName:"cpu",kernelFunc:C_},M_=If(N.IsInf,e=>Math.abs(e)===1/0?1:0,"bool"),R_={kernelName:N.IsInf,backendName:"cpu",kernelFunc:M_},k_=If(N.IsNan,e=>Number.isNaN(e)?1:0,"bool"),N_={kernelName:N.IsNan,backendName:"cpu",kernelFunc:k_};const D_={kernelName:N.LinSpace,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{backend:t,attrs:n}=e,{start:i,stop:r,num:s}=n,o=om(i,r,s);return t.makeTensorInfo([o.length],"float32",o)}},F_=If(N.Log1p,e=>Math.log1p(e)),L_={kernelName:N.Log1p,backendName:"cpu",kernelFunc:F_},P_=tf((e,t)=>e&&t),B_=pf(N.LogicalAnd,P_,null,"bool"),$_={kernelName:N.LogicalAnd,backendName:"cpu",kernelFunc:B_},U_=If(N.LogicalNot,e=>e?0:1,"bool"),z_={kernelName:N.LogicalNot,backendName:"cpu",kernelFunc:U_},V_=tf((e,t)=>e||t),j_=pf(N.LogicalOr,V_,null,"bool"),Y_={kernelName:N.LogicalOr,backendName:"cpu",kernelFunc:j_};const G_={kernelName:N.LRN,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{depthRadius:s,bias:o,alpha:a,beta:l}=i;Kp(r,"LRN");const u=r.shape[3],c=u-1,d=n.data.get(r.dataId).values,h=N.util.sizeFromShape(r.shape),p=new Float32Array(h);function f(e){const t=e%u;let n=e-t+Math.max(0,t-s);const i=e-t+Math.min(t+s,c);let r=0;for(;n<=i;n++){const e=d[n];r+=e*e}return r}for(let e=0;e<h;e++){const t=f(e),n=d[e]*Math.pow(o+a*t,-l);p[e]=n}return n.makeTensorInfo(r.shape,r.dtype,p)}};const H_={kernelName:N.LRNGrad,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,y:s,dy:o}=t,{depthRadius:a,bias:l,alpha:u,beta:c}=i;Kp(o,"LRNGrad");const d=N.util.sizeFromShape(o.shape),h=o.shape[3],p=n.data.get(o.dataId).values,f=n.data.get(r.dataId).values,m=n.data.get(s.dataId).values,g=new Float32Array(d),y=d;for(let e=0;e<y;e++){const t=e%h,n=e-t+Math.max(0,t-a),i=e-t+Math.min(h,t+a+1);let r=0;for(let e=n;e<i;e++)r+=Math.pow(f[e],2);r=u*r+l;for(let t=n;t<i;t++){let n=-2*u*c*f[t]*m[e]/r;e===t&&(n+=Math.pow(r,-c)),n*=p[e],g[t]+=n}}return n.makeTensorInfo(o.shape,r.dtype,g)}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function W_(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{reductionIndices:s,keepDims:o}=i,a=n;let l=r.shape;const u=l.length,c=N.util.parseAxisParam(s,l);let d=c;const h=N.backend_util.getAxesPermutation(d,u);let p=a.data.get(r.dataId).values;if(null!=h){const e=new Array(u);for(let t=0;t<e.length;t++)e[t]=l[h[t]];p=Am(p,l,r.dtype,h,e),d=N.backend_util.getInnerMostAxes(d.length,u),l=e}Kp(r,"max"),N.backend_util.assertAxesAreInnerMostDims("max",d,u);const[f,m]=N.backend_util.computeOutAndReduceShapes(l,d),g=cm(p,N.util.sizeFromShape(m),f,r.dtype),y=a.write(g,f,r.dtype);let _=f;if(o){_=N.backend_util.expandShapeToKeepDim(f,c)}return{dataId:y,shape:_,dtype:r.dtype}}const X_={kernelName:N.Max,backendName:"cpu",kernelFunc:W_};const q_={kernelName:N.MaxPool,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t;Kp(r,"maxPool");const{filterSize:s,strides:o,pad:a,dimRoundingMode:l}=i;N.util.assert(N.backend_util.eitherStridesOrDilationsAreOne(o,1),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${o} and dilations '1'`);const u=N.backend_util.computePool2DInfo(r.shape,s,o,1,a,l);let c;if(1===u.filterWidth&&1===u.filterHeight&&N.util.arraysEqual(u.inShape,u.outShape))c=of({inputs:{x:r},backend:n});else{const e=n.data.get(r.dataId).values,t=N.util.computeStrides(r.shape),i=cy(e,r.shape,r.dtype,t,u,"max");c=n.makeTensorInfo(u.outShape,r.dtype,i.values)}return c}};const K_={kernelName:N.MaxPool3D,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{filterSize:s,strides:o,pad:a,dimRoundingMode:l,dataFormat:u}=i;Kp(r,"maxPool3d");const c=N.backend_util.computePool3DInfo(r.shape,s,o,1,a,l,u),d=hy(n.data.get(r.dataId).values,r.shape,r.dtype,N.util.computeStrides(r.shape),c,"max");return n.makeTensorInfo(d.shape,"float32",d.values)}};const Z_={kernelName:N.MaxPool3DGrad,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,input:s}=t,{filterSize:o,strides:a,pad:l,dimRoundingMode:u}=i;Kp([r,s],"maxPool3DGrad");const c=N.backend_util.computePool3DInfo(s.shape,o,a,1,l,u),d=function(e,t){const n=(0,N.buffer)(t.outShape,"int32"),i=t.strideDepth,r=t.strideHeight,s=t.strideWidth,o=t.dilationDepth,a=t.dilationHeight,l=t.dilationWidth,u=t.effectiveFilterDepth,c=t.effectiveFilterHeight,d=t.effectiveFilterWidth,h=t.padInfo.front,p=t.padInfo.top,f=t.padInfo.left;for(let m=0;m<t.batchSize;++m)for(let g=0;g<t.inChannels;++g)for(let y=0;y<t.outDepth;++y){const _=y*i-h;let v=_;for(;v<0;)v+=o;const b=Math.min(t.inDepth,u+_);for(let i=0;i<t.outHeight;++i){const u=i*r-p;let h=u;for(;h<0;)h+=a;const T=Math.min(t.inHeight,c+u);for(let r=0;r<t.outWidth;++r){const p=r*s-f;let x=p;for(;x<0;)x+=l;const E=Math.min(t.inWidth,d+p);let w=Number.NEGATIVE_INFINITY,I=-1;for(let t=v;t<b;t+=o){const n=t-_;for(let i=h;i<T;i+=a){const r=i-u;for(let s=x;s<E;s+=l){const o=s-p,a=e.get(m,t,i,s,g);a>=w&&(w=a,I=n*c*d+r*c+o)}}}n.set(I,m,y,i,r,g)}}}return n}(n.bufferSync(s),c),h=c.strideDepth,p=c.strideHeight,f=c.strideWidth,m=c.dilationDepth,g=c.dilationHeight,y=c.dilationWidth,_=c.effectiveFilterDepth,v=c.effectiveFilterHeight,b=c.effectiveFilterWidth,T=_-1-c.padInfo.front,x=b-1-c.padInfo.left,E=v-1-c.padInfo.top,w=(0,N.buffer)(s.shape,"float32"),I=n.bufferSync(r);for(let e=0;e<c.batchSize;++e)for(let t=0;t<c.inChannels;++t)for(let n=0;n<c.inDepth;++n)for(let i=0;i<c.inHeight;++i)for(let r=0;r<c.inWidth;++r){const s=n-T,o=i-E,a=r-x;let l=0;for(let n=0;n<_;n+=m){const i=(s+n)/h;if(!(i<0||i>=c.outDepth||Math.floor(i)!==i))for(let r=0;r<v;r+=g){const s=(o+r)/p;if(!(s<0||s>=c.outHeight||Math.floor(s)!==s))for(let o=0;o<b;o+=y){const u=(a+o)/f;if(u<0||u>=c.outWidth||Math.floor(u)!==u)continue;const h=_*v*b-1-d.get(e,i,s,u,t)===n*v*b+r*b+o?1:0;if(0===h)continue;l+=I.get(e,i,s,u,t)*h}}}w.set(l,e,n,i,r,t)}return n.makeTensorInfo(w.shape,w.dtype,w.values)}};const Q_={kernelName:N.MaxPoolGrad,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,input:s,output:o}=t,a=s;Kp([s,o],"maxPoolGrad");const{filterSize:l,strides:u,pad:c,dimRoundingMode:d}=i,h=N.backend_util.computePool2DInfo(a.shape,l,u,1,c,d),p=n.data.get(a.dataId).values,f=(0,N.buffer)(h.outShape,a.dtype,dy(p,a.shape,a.dtype,h).values),m=h.strideHeight,g=h.strideWidth,y=h.dilationHeight,_=h.dilationWidth,v=h.effectiveFilterHeight,b=h.effectiveFilterWidth,T=b-1-h.padInfo.left,x=v-1-h.padInfo.top,E=(0,N.buffer)(a.shape,"float32"),w=n.data.get(r.dataId).values,I=(0,N.buffer)(r.shape,"float32",w);for(let e=0;e<h.batchSize;++e)for(let t=0;t<h.inChannels;++t)for(let n=0;n<h.inHeight;++n)for(let i=0;i<h.inWidth;++i){const r=n-x,s=i-T;let o=0;for(let n=0;n<v;n+=y){const i=(r+n)/m;if(!(i<0||i>=h.outHeight||Math.floor(i)!==i))for(let r=0;r<b;r+=_){const a=(s+r)/g;if(a<0||a>=h.outWidth||Math.floor(a)!==a)continue;const l=v*b-1-f.get(e,i,a,t)===n*b+r?1:0;if(0===l)continue;o+=I.get(e,i,a,t)*l}}E.set(o,e,n,i,t)}return n.makeTensorInfo(E.shape,E.dtype,E.values)}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const J_={kernelName:N.MaxPoolWithArgmax,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{x:i}=e,{filterSize:r,strides:s,pad:o,includeBatchInIndex:a}=t,l=n;Kp(i,"MaxPoolWithArgmax");const u=l.data.get(i.dataId).values,c=N.backend_util.computePool2DInfo(i.shape,r,s,[1,1],o),[d,h]=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i,r){const s=cy(e,0,n,N.util.computeStrides(t),r,"max"),o=dy(e,t,n,r,!0,i);return[s.values,o.values]}(u,i.shape,i.dtype,a,c),p=l.write(d,c.outShape,i.dtype),f=l.write(h,c.outShape,i.dtype);return[{dataId:p,shape:c.outShape,dtype:i.dtype},{dataId:f,shape:c.outShape,dtype:"int32"}]}};const ev={kernelName:N.Mean,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i,a=N.util.parseAxisParam(s,r.shape),l=N.backend_util.computeOutAndReduceShapes(r.shape,a)[1],u=N.util.sizeFromShape(l),c=[],d=n.makeTensorInfo([],"float32",new Float32Array([u]));c.push(d);const h=df({inputs:{x:r},backend:n,attrs:{dtype:"float32"}});c.push(h);const p=f_({inputs:{a:h,b:d},backend:n});c.push(p);const f=Jy({inputs:{x:p},backend:n,attrs:{axis:s,keepDims:o}});return c.forEach(e=>n.disposeIntermediateTensorInfo(e)),f}};const tv={kernelName:N.Min,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i;Kp(r,"min");const a=N.util.parseAxisParam(s,r.shape);let l=a;const u=N.backend_util.getAxesPermutation(l,r.shape.length);let c=r;null!=u&&(c=Sm({inputs:{x:r},backend:n,attrs:{perm:u}}),l=N.backend_util.getInnerMostAxes(l.length,r.shape.length)),N.backend_util.assertAxesAreInnerMostDims("min",l,c.shape.length);const[d,h]=N.backend_util.computeOutAndReduceShapes(c.shape,l),p=N.util.sizeFromShape(h),f=N.util.makeZerosTypedArray(N.util.sizeFromShape(d),c.dtype),m=n.data.get(c.dataId).values;for(let e=0;e<f.length;++e){const t=e*p;let n=m[t];for(let e=0;e<p;++e){const i=m[t+e];(Number.isNaN(i)||i<n)&&(n=i)}f[e]=n}null!=u&&n.disposeIntermediateTensorInfo(c);const g=n.makeTensorInfo(d,c.dtype,f);if(o){const e=$g({inputs:{x:g},backend:n,attrs:{shape:N.backend_util.expandShapeToKeepDim(d,a)}});return n.disposeIntermediateTensorInfo(g),e}return g}};const nv={kernelName:N.MirrorPad,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{paddings:s,mode:o}=i;Kp(r,"mirrorPad");const a=s.map((e,t)=>e[0]+r.shape[t]+e[1]),l=s.map(e=>e[0]),u=s.map((e,t)=>e[0]+r.shape[t]),c="reflect"===o?0:1,d=n.data.get(r.dataId).values,h=r.shape.length,p=N.util.computeStrides(r.shape),f=N.util.sizeFromShape(a),m=a.length,g=N.util.computeStrides(a),y=N.util.getTypedArrayFromDType(r.dtype,f);for(let e=0;e<f;e++){let t=N.util.indexToLoc(e,m,g);for(let e=0;e<m;e++)t[e]<l[e]?t[e]=2*l[e]-t[e]-c:t[e]>=u[e]&&(t[e]=2*(u[e]-1)-t[e]+c);t=t.map((e,t)=>e-l[t]);const n=N.util.locToIndex(t,h,p);y[e]=d[n]}return{dataId:n.write(y,a,r.dtype),shape:a,dtype:r.dtype}}},iv=tf((e,t)=>{const n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t}),rv=pf(N.Mod,iv),sv={kernelName:N.Mod,backendName:"cpu",kernelFunc:rv};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function ov(e){const{inputs:t,backend:n,attrs:i}=e,{logits:r}=t,{dim:s}=i,o=r.shape.length;let a=s;if(-1===a&&(a=o-1),a!==o-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${o} and dim was ${a}`);const l=N.util.parseAxisParam([a],r.shape),u=W_({inputs:{x:r},backend:n,attrs:{reductionIndices:l,keepDims:!1}}),c=N.backend_util.expandShapeToKeepDim(u.shape,l),d=$g({inputs:{x:u},backend:n,attrs:{shape:c}}),h=vg({inputs:{a:r,b:d},backend:n}),p=Ff({inputs:{x:h},backend:n}),f=Jy({inputs:{x:p},backend:n,attrs:{axis:l,keepDims:!1}}),m=$g({inputs:{x:f},backend:n,attrs:{shape:c}}),g=f_({inputs:{a:p,b:m},backend:n});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),g}const av={kernelName:N.Softmax,backendName:"cpu",kernelFunc:ov};const lv={kernelName:N.Multinomial,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{logits:r}=t,{numSamples:s,seed:o,normalized:a}=i;Kp(r,"multinomial");const l=a?r:ov({inputs:{logits:r},backend:n,attrs:{dim:-1}}),u=l.shape[0],c=l.shape[1],d=n.data.get(l.dataId).values,h=[u,s],p=N.util.makeZerosTypedArray(N.util.sizeFromShape(h),"int32");for(let e=0;e<u;++e){const t=e*c,n=new Float32Array(c-1);n[0]=d[t];for(let e=1;e<n.length;++e)n[e]=n[e-1]+d[t+e];const i=Uh.alea(o.toString()),r=e*s;for(let e=0;e<s;++e){const t=i();p[r+e]=n.length;for(let i=0;i<n.length;i++)if(t<n[i]){p[r+e]=i;break}}}return a||n.disposeIntermediateTensorInfo(l),n.makeTensorInfo(h,"int32",p)}},uv=N.kernel_impls.nonMaxSuppressionV3Impl;const cv={kernelName:N.NonMaxSuppressionV3,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:i}=e,{boxes:r,scores:s}=t,{maxOutputSize:o,iouThreshold:a,scoreThreshold:l}=i;Kp(r,"NonMaxSuppression");const u=n.data.get(r.dataId).values,c=n.data.get(s.dataId).values,{selectedIndices:d}=uv(u,c,o,a,l);return n.makeTensorInfo([d.length],"int32",new Int32Array(d))}},dv=N.kernel_impls.nonMaxSuppressionV4Impl;const hv={kernelName:N.NonMaxSuppressionV4,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:i}=e,{boxes:r,scores:s}=t,{maxOutputSize:o,iouThreshold:a,scoreThreshold:l,padToMaxOutputSize:u}=i;Kp(r,"NonMaxSuppressionPadded");const c=n.data.get(r.dataId).values,d=n.data.get(s.dataId).values,{selectedIndices:h,validOutputs:p}=dv(c,d,o,a,l,u);return[n.makeTensorInfo([h.length],"int32",new Int32Array(h)),n.makeTensorInfo([],"int32",new Int32Array([p]))]}},pv=N.kernel_impls.nonMaxSuppressionV5Impl;const fv={kernelName:N.NonMaxSuppressionV5,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:i}=e,{boxes:r,scores:s}=t,{maxOutputSize:o,iouThreshold:a,scoreThreshold:l,softNmsSigma:u}=i;Kp(r,"NonMaxSuppressionWithScore");const c=n.data.get(r.dataId).values,d=n.data.get(s.dataId).values,h=o,p=a,f=l,m=u,{selectedIndices:g,selectedScores:y}=pv(c,d,h,p,f,m);return[n.makeTensorInfo([g.length],"int32",new Int32Array(g)),n.makeTensorInfo([y.length],"float32",new Float32Array(y))]}};const mv={kernelName:N.OneHot,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{indices:r}=t,{dtype:s,depth:o,onValue:a,offValue:l}=i;Kp(r,"oneHot");const u=N.util.sizeFromShape(r.shape),c=new Float32Array(u*o);c.fill(l);const d=n.data.get(r.dataId).values;for(let e=0;e<u;++e)d[e]>=0&&d[e]<o&&(c[e*o+d[e]]=a);return n.makeTensorInfo([...r.shape,o],s,c)}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function gv(e){const{inputs:t,backend:n}=e,{x:i}=t;if("string"===i.dtype)throw new Error("zerosLike is not supported for string tensors");if("complex64"===i.dtype){const e=lf({inputs:{input:i},backend:n}),t=gv({inputs:{x:e},backend:n}),r=wy({inputs:{input:i},backend:n}),s=gv({inputs:{x:r},backend:n}),o=nf({inputs:{real:t,imag:s},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),o}return b_({backend:n,attrs:{shape:i.shape,value:0,dtype:i.dtype}})}const yv={kernelName:N.ZerosLike,backendName:"cpu",kernelFunc:gv};const _v={kernelName:N.OnesLike,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function e(t){const{inputs:n,backend:i}=t,{x:r}=n;if("string"===r.dtype)throw new Error("onesLike is not supported for string tensors");if("complex64"===r.dtype){const t=lf({inputs:{input:r},backend:i}),n=e({inputs:{x:t},backend:i}),s=wy({inputs:{input:r},backend:i}),o=gv({inputs:{x:s},backend:i}),a=nf({inputs:{real:n,imag:o},backend:i});return i.disposeIntermediateTensorInfo(t),i.disposeIntermediateTensorInfo(n),i.disposeIntermediateTensorInfo(s),i.disposeIntermediateTensorInfo(o),a}return b_({backend:i,attrs:{shape:r.shape,value:1,dtype:r.dtype}})}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function vv(e){const{inputs:t,backend:n,attrs:i}=e,{axis:r}=i;if(1===t.length)return d_({inputs:{input:t[0]},backend:n,attrs:{dim:r}});const s=t[0].shape,o=t[0].dtype;t.forEach(e=>{N.util.assertShapesMatch(s,e.shape,"All tensors passed to stack must have matching shapes"),N.util.assert(o===e.dtype,()=>"All tensors passed to stack must have matching dtypes")});const a=[],l=Ay({inputs:t.map(e=>{const t=d_({inputs:{input:e},backend:n,attrs:{dim:r}});return a.push(t),t}),backend:n,attrs:{axis:r}});return a.forEach(e=>n.disposeIntermediateTensorInfo(e)),l}const bv={kernelName:N.Pack,backendName:"cpu",kernelFunc:vv};const Tv={kernelName:N.PadV2,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{paddings:s,constantValue:o}=i;Kp(r,"pad");const a=s.map((e,t)=>e[0]+r.shape[t]+e[1]),l=s.map(e=>e[0]),u=n.data.get(r.dataId).values,c=N.util.sizeFromShape(r.shape),d=r.shape.length,h=N.util.computeStrides(r.shape),p=N.util.sizeFromShape(a),f=a.length,m=N.util.computeStrides(a),g=N.util.getTypedArrayFromDType(r.dtype,p);0!==o&&g.fill(o);for(let e=0;e<c;e++){const t=N.util.indexToLoc(e,d,h).map((e,t)=>e+l[t]);g[N.util.locToIndex(t,f,m)]=u[e]}return{dataId:n.write(g,a,r.dtype),shape:a,dtype:r.dtype}}},xv=tf((e,t)=>Math.pow(e,t)),Ev=pf(N.Pow,xv),wv={kernelName:N.Pow,backendName:"cpu",kernelFunc:Ev};const Iv={kernelName:N.RaggedGather,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{paramsNestedSplits:r,paramsDenseValues:s,indices:o}=t,{outputRaggedRank:a}=i,l=r.map(e=>n.data.get(e.dataId).values),u=r.map(e=>e.shape),c=n.data.get(s.dataId).values,d=n.data.get(o.dataId).values,[h,p,f]=Dm(l,u,c,s.shape,s.dtype,d,o.shape),m=h.map(e=>n.makeTensorInfo([e.length],"int32",e)),g=n.makeTensorInfo(f,s.dtype,p);return m.concat([g])}};const Av={kernelName:N.RaggedRange,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{starts:i,limits:r,deltas:s}=t,o=n.data.get(i.dataId).values,a=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,[u,c]=Lm(o,i.shape,i.dtype,a,r.shape,l,s.shape);return[n.makeTensorInfo([u.length],"int32",u),n.makeTensorInfo([c.length],i.dtype,c)]}};const Sv={kernelName:N.RaggedTensorToTensor,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{shape:r,values:s,defaultValue:o,rowPartitionTensors:a}=t,{rowPartitionTypes:l}=i,u=n.data.get(r.dataId).values,c=n.data.get(s.dataId).values,d=n.data.get(o.dataId).values,h=a.map(e=>n.data.get(e.dataId).values),p=a.map(e=>e.shape),[f,m]=zm(u,r.shape,c,s.shape,s.dtype,d,o.shape,h,p,l);return n.makeTensorInfo(f,s.dtype,m)}};const Cv={kernelName:N.Range,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{backend:t,attrs:n}=e,{start:i,stop:r,dtype:s,step:o}=n,a=Vm(i,r,o,s);return t.makeTensorInfo([a.length],s,a)}},Ov=If(N.Reciprocal,e=>1/e),Mv={kernelName:N.Reciprocal,backendName:"cpu",kernelFunc:Ov};const Rv={kernelName:N.ResizeBilinear,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:o,size:a}=i;Kp(r,"resizeBilinear");const l=N.util.computeStrides(r.shape),[u,c]=a,[d,h,p,f]=r.shape,m=n.data.get(r.dataId).values,g=new Float32Array(N.util.sizeFromShape([d,u,c,f])),y=[s&&u>1?h-1:h,s&&c>1?p-1:p],_=[s&&u>1?u-1:u,s&&c>1?c-1:c];let v=0;const b=y[0]/_[0],T=y[1]/_[1];for(let e=0;e<d;e++)for(let t=0;t<u;t++){let n;n=o?b*(t+.5)-.5:b*t;const i=Math.max(0,Math.floor(n)),r=n-i,s=Math.min(h-1,Math.ceil(n)),a=e*l[0]+i*l[1],u=e*l[0]+s*l[1];for(let e=0;e<c;e++){let t;t=o?T*(e+.5)-.5:T*e;const n=Math.max(0,Math.floor(t)),i=t-n,s=Math.min(p-1,Math.ceil(t)),c=a+n*l[2],d=u+n*l[2],h=a+s*l[2],y=u+s*l[2];for(let e=0;e<f;e++){const t=m[c+e],n=m[d+e],s=t+(m[h+e]-t)*i,o=s+(n+(m[y+e]-n)*i-s)*r;g[v++]=o}}}return n.makeTensorInfo([d,u,c,f],"float32",g)}};const kv={kernelName:N.ResizeBilinearGrad,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{images:r,dy:s}=t,{alignCorners:o}=i;Kp([s,r],"resizeBilinearGrad");const a=N.util.computeStrides(r.shape),[l,u,c,d]=r.shape,[,h,p]=s.shape,f=new Float32Array(l*u*c*d),m=[o&&h>1?u-1:u,o&&p>1?c-1:c],g=[o&&h>1?h-1:h,o&&p>1?p-1:p],y=m[0]/g[0],_=m[1]/g[1],v=n.data.get(s.dataId).values;let b=0;for(let e=0;e<l;e++){const t=e*a[0];for(let e=0;e<h;e++){const n=e*y,i=Math.floor(n),r=Math.min(Math.ceil(n),u-1),s=t+i*a[1],o=t+r*a[1],l=n-i,h=1-l;for(let e=0;e<p;e++){const t=e*_,n=Math.floor(t),i=Math.min(Math.ceil(t),c-1),r=t-n,u=1-r,p=s+n*a[2],m=s+i*a[2],g=o+n*a[2],y=o+i*a[2],T=h*u,x=h*r,E=l*u,w=l*r;for(let e=0;e<d;e++){const t=v[b++];f[p+e]+=t*T,f[m+e]+=t*x,f[g+e]+=t*E,f[y+e]+=t*w}}}}return n.makeTensorInfo([l,c,u,d],"float32",f)}};const Nv={kernelName:N.ResizeNearestNeighbor,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:o,size:a}=i;Kp(r,"resizeNearestNeighbor");const l=N.util.computeStrides(r.shape),[u,c]=a,[d,h,p,f]=r.shape,m=n.data.get(r.dataId).values,g=new Float32Array(d*u*c*f),y=[s&&u>1?h-1:h,s&&c>1?p-1:p],_=[s&&u>1?u-1:u,s&&c>1?c-1:c],v=y[0]/_[0],b=y[1]/_[1];let T=0;for(let e=0;e<d;e++){const t=e*l[0];for(let e=0;e<u;e++){const n=o?v*(e+.5):v*e;let i=Math.min(h-1,s?Math.round(n):Math.floor(n));o&&(i=Math.max(0,i));const r=t+i*l[1];for(let e=0;e<c;e++){const t=o?b*(e+.5):b*e;let n=Math.min(p-1,s?Math.round(t):Math.floor(t));o&&(n=Math.max(0,n));const i=r+n*l[2];for(let e=0;e<f;e++){const t=m[i+e];g[T++]=t}}}}return n.makeTensorInfo([d,u,c,f],r.dtype,g)}};const Dv={kernelName:N.ResizeNearestNeighborGrad,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{images:r,dy:s}=t,{alignCorners:o}=i;Kp([s,r],"resizeNearestNeighborGrad");const a=N.util.computeStrides(r.shape),l=N.util.computeStrides(s.shape),[u,c,d,h]=r.shape,[,p,f]=s.shape,m=new Float32Array(u*c*d*h),g=n.data.get(s.dataId).values,y=[o&&p>1?c-1:c,o&&f>1?d-1:d],_=[o&&p>1?p-1:p,o&&f>1?f-1:f],v=y[0]/_[0],b=y[1]/_[1],T=1/v,x=1/b,E=2*Math.ceil(T)+2,w=2*Math.ceil(x)+2;for(let e=0;e<u;e++){const t=e*a[0];for(let e=0;e<c;e++){const n=t+e*a[1],i=Math.floor(e*T),r=Math.floor(i-E/2);for(let i=0;i<d;i++){const s=n+i*a[2],u=Math.floor(i*x),y=Math.floor(u-w/2);for(let n=0;n<h;n++){let a=0;for(let s=0;s<E;s++){const u=s+r;if(u<0||u>=p)continue;const h=t+u*l[1],m=u*v;if(e===Math.min(c-1,o?Math.round(m):Math.floor(m)))for(let e=0;e<w;e++){const t=e+y;if(t<0||t>=f)continue;const r=h+t*l[2],s=t*b;i===Math.min(d-1,o?Math.round(s):Math.floor(s))&&(a+=g[r+n])}}m[s+n]=a}}}}return n.makeTensorInfo(r.shape,r.dtype,m)}};const Fv={kernelName:N.Reverse,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{dims:s}=i;Kp(r,"reverse");const o=r.shape.length,a=N.util.parseAxisParam(s,r.shape);if(0===o)return of({inputs:{x:r},backend:n});const l=new N.TensorBuffer(r.shape,r.dtype),u=n.bufferSync(r);for(let e=0;e<l.size;e++){const t=l.indexToLoc(e),n=t.slice();a.forEach(e=>n[e]=r.shape[e]-1-n[e]),l.set(u.get(...n),...t)}return n.makeTensorInfo(l.shape,l.dtype,l.values)}},Lv={kernelName:N.RotateWithOffset,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{image:i}=e,{radians:r,fillValue:s,center:o}=t,a=n,l=N.util.getTypedArrayFromDType(i.dtype,N.util.sizeFromShape(i.shape)),[u,c,d,h]=i.shape,[p,f]=N.backend_util.getImageCenter(o,c,d),m=Math.sin(r),g=Math.cos(r),y=a.data.get(i.dataId).values;for(let e=0;e<u;e++){const t=e*d*c*h;for(let e=0;e<c;e++){const n=e*(d*h);for(let i=0;i<d;i++){const r=i*h;for(let o=0;o<h;o++){const a=[u,e,i,o],_=a[2],v=a[1];let b=(_-p)*g-(v-f)*m,T=(_-p)*m+(v-f)*g;b=Math.round(b+p),T=Math.round(T+f);let x=s;if("number"!=typeof s&&(x=3===o?255:s[o]),b>=0&&b<d&&T>=0&&T<c){x=y[t+T*(d*h)+b*h+o]}l[t+n+r+o]=x}}}}return{dataId:a.write(l,i.shape,i.dtype),shape:i.shape,dtype:i.dtype}}},Pv=If(N.Round,e=>{const t=Math.floor(e);return e-t<.5?Math.floor(e):e-t>.5?Math.ceil(e):t%2==0?t:t+1}),Bv={kernelName:N.Round,backendName:"cpu",kernelFunc:Pv};const $v={kernelName:N.ScatterNd,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{indices:r,updates:s}=t,{shape:o}=i,{sliceRank:a,numUpdates:l,sliceSize:u,strides:c,outputSize:d}=N.backend_util.calculateShapes(s,r,o),h=Hm(n.bufferSync(r),n.bufferSync(s),o,d,u,l,a,c,0,!0);return n.makeTensorInfo(o,h.dtype,h.values)}};
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Uv(e,t){let n=0,i=e.length,r=0;for(;n<i;)r=Math.floor((n+i)/2),e[r]<t?n=r+1:i=r;return i}function zv(e,t){let n=0,i=e.length,r=0;for(;n<i;)r=Math.floor((n+i)/2),e[r]<=t?n=r+1:i=r;return i}const Vv={kernelName:N.SearchSorted,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{sortedSequence:r,values:s}=t,{side:o}=i,a=function(e,t,n,i,r,s){const o=N.util.getArrayFromDType("int32",n*r);for(let a=0;a<n;++a){const n=e.slice(a*i,(a+1)*i),l=a*r;for(let e=0;e<r;++e)o[l+e]="left"===s?Uv(n,t[e+l]):zv(n,t[e+l])}return o}(n.data.get(r.dataId).values,n.data.get(s.dataId).values,r.shape[0],r.shape[1],s.shape[1],o);return n.makeTensorInfo(s.shape,"int32",a)}};const jv={kernelName:N.Select,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{condition:i,t:r,e:s}=t;Kp([i,r,s],"select");const o=i.shape.length,a=n.data.get(i.dataId).values,l=n.data.get(r.dataId).values,u=n.data.get(s.dataId).values,c=(0,N.upcastType)(r.dtype,s.dtype),d=N.util.makeZerosTypedArray(N.util.sizeFromShape(r.shape),c);let h=0;const p=0===o||o>1||1===r.shape.length?1:N.util.sizeFromShape(r.shape.slice(1));for(let e=0;e<a.length;e++)for(let t=0;t<p;t++)1===a[e]?d[h++]=l[e]:d[h++]=u[e];return n.makeTensorInfo(r.shape,c,d)}},Yv=N.backend_util.SELU_SCALEALPHA,Gv=N.backend_util.SELU_SCALE,Hv=If(N.Selu,e=>e>=0?Gv*e:Yv*(Math.exp(e)-1)),Wv={kernelName:N.Selu,backendName:"cpu",kernelFunc:Hv},Xv=If(N.Sign,e=>e<0?-1:e>0?1:0),qv={kernelName:N.Sign,backendName:"cpu",kernelFunc:Xv},Kv=If(N.Sin,e=>Math.sin(e)),Zv={kernelName:N.Sin,backendName:"cpu",kernelFunc:Kv},Qv=If(N.Sinh,e=>Math.sinh(e)),Jv={kernelName:N.Sinh,backendName:"cpu",kernelFunc:Qv},eb=Math.log(1.1920928955078125e-7)+2,tb=If(N.Softplus,e=>{const t=e>-eb,n=e<eb,i=Math.exp(e);let r;return r=n?i:t?e:Math.log(1+i),r}),nb={kernelName:N.Softplus,backendName:"cpu",kernelFunc:tb};const ib={kernelName:N.SpaceToBatchND,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{blockShape:s,paddings:o}=i;Kp([r],"spaceToBatchND");const a=N.util.sizeFromShape(s),l=[[0,0]];l.push(...o);for(let e=1+s.length;e<r.shape.length;++e)l.push([0,0]);const u=Tv.kernelFunc({inputs:{x:r},backend:n,attrs:{paddings:l,constantValue:0}}),c=N.backend_util.getReshaped(u.shape,s,a,!1),d=N.backend_util.getPermuted(c.length,s.length,!1),h=N.backend_util.getReshapedPermuted(u.shape,s,a,!1),p=$g({inputs:{x:u},backend:n,attrs:{shape:c}}),f=Sm({inputs:{x:p},backend:n,attrs:{perm:d}}),m=$g({inputs:{x:f},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),m}};const rb={kernelName:N.SparseFillEmptyRows,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{indices:i,values:r,denseShape:s,defaultValue:o}=t;if(1!==s.shape.length)throw new Error(`Dense shape must be a vector, saw:\n ${s.shape}`);if(2!==i.shape.length)throw new Error(`Indices must be a matrix, saw:\n ${i.shape}`);if(1!==r.shape.length)throw new Error(`Values must be a vector, saw:\n ${r.shape}`);if(0!==o.shape.length)throw new Error(`Default value must be a scalar, saw:\n ${o.shape}`);const a=n.data.get(i.dataId).values,l=n.data.get(r.dataId).values,u=n.data.get(s.dataId).values,c=n.data.get(o.dataId).values[0],[d,h,p,f,m]=Jm(a,i.shape,i.dtype,l,r.dtype,u,c);return[n.makeTensorInfo(h,i.dtype,d),n.makeTensorInfo([h[0]],r.dtype,p),n.makeTensorInfo([f.length],"bool",new Uint8Array(f.map(e=>Number(e)))),n.makeTensorInfo([m.length],i.dtype,new Int32Array(m))]}};const sb={kernelName:N.SparseReshape,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{inputIndices:i,inputShape:r,newShape:s}=t;if(2!==i.shape.length)throw new Error(`Input indices should be a matrix but received shape\n ${i.shape}`);if(1!==r.shape.length)throw new Error(`Input shape should be a vector but received shape\n ${r.shape}`);if(1!==s.shape.length)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);const o=Array.from(n.data.get(r.dataId).values),a=n.data.get(i.dataId).values,l=Array.from(n.data.get(s.dataId).values),[u,c,d]=eg(a,i.shape,i.dtype,o,l);return[n.makeTensorInfo(c,i.dtype,u),n.makeTensorInfo([d.length],s.dtype,new Int32Array(d))]}};const ob={kernelName:N.SparseSegmentMean,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{data:i,indices:r,segmentIds:s}=t;if(i.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==r.shape.length)throw new Error(`Indices should be a vector but received shape\n ${r.shape}`);if(1!==s.shape.length)throw new Error(`Segment ids should be a vector but received shape\n ${s.shape}`);if(r.shape[0]!==s.shape[0])throw new Error("segmentIds and indices should have same size.");const o=n.data.get(i.dataId).values,a=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,[u,c]=tg(o,i.shape,i.dtype,a,l,!0);return n.makeTensorInfo(c,i.dtype,u)}};const ab={kernelName:N.SparseSegmentSum,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{data:i,indices:r,segmentIds:s}=t;if(i.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==r.shape.length)throw new Error(`Indices should be a vector but received shape\n ${r.shape}`);if(1!==s.shape.length)throw new Error(`Segment ids should be a vector but received shape\n ${s.shape}`);if(r.shape[0]!==s.shape[0])throw new Error("segmentIds and indices should have same size.");const o=n.data.get(i.dataId).values,a=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,[u,c]=tg(o,i.shape,i.dtype,a,l);return n.makeTensorInfo(c,i.dtype,u)}};const lb={kernelName:N.SparseToDense,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{sparseIndices:r,sparseValues:s,defaultValue:o}=t,{outputShape:a}=i,{sliceRank:l,numUpdates:u,sliceSize:c,strides:d,outputSize:h}=N.backend_util.calculateShapes(s,r,a),p=!1,f=n.bufferSync(r);let m;switch(s.dtype){case"bool":m=Hm(f,n.bufferSync(s),a,h,c,u,l,d,Boolean(n.data.get(o.dataId).values[0]),p);break;case"float32":m=Hm(f,n.bufferSync(s),a,h,c,u,l,d,n.data.get(o.dataId).values[0],p);break;case"int32":m=Hm(f,n.bufferSync(s),a,h,c,u,l,d,n.data.get(o.dataId).values[0],p);break;case"string":m=Hm(f,n.bufferSync(s),a,h,c,u,l,d,N.util.decodeString(n.data.get(o.dataId).values[0]),p);break;default:throw new Error(`Unsupported type ${s.dtype}`)}return n.makeTensorInfo(a,m.dtype,m.values)}};const ub={kernelName:N.SplitV,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{numOrSizeSplits:s,axis:o}=i,a=N.util.parseAxisParam(o,r.shape)[0],l=N.backend_util.prepareSplitSize(r,s,a),u=new Array(r.shape.length).fill(0),c=r.shape.slice();return l.map(e=>{const t=[...c];t[a]=e;const i=Zm({inputs:{x:r},backend:n,attrs:{begin:u,size:t}});return u[a]+=e,i})}},cb={kernelName:N.Square,backendName:"cpu",kernelFunc:({inputs:e,backend:t})=>{const{x:n}=e,i=t;Kp(n,"square");const r=i.data.get(n.dataId).values,s=new Float32Array(r.length);for(let e=0;e<r.length;++e){const t=r[e];s[e]=t*t}return{dataId:i.write(s,n.shape,n.dtype),shape:n.shape,dtype:n.dtype}}},db=If(N.Step,(e,t)=>{const n=t;return isNaN(e)?NaN:e>0?1:n.alpha}),hb={kernelName:N.Step,backendName:"cpu",kernelFunc:db};const pb={kernelName:N.StridedSlice,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{begin:s,end:o,strides:a,beginMask:l,endMask:u,ellipsisMask:c,newAxisMask:d,shrinkAxisMask:h}=i;Kp(r,"stridedSlice");const{finalShapeSparse:p,finalShape:f,isIdentity:m,sliceDim0:g,isSimpleSlice:y,begin:_,end:v,strides:b}=N.slice_util.sliceInfo(r.shape,s,o,a,l,u,c,d,h);let T;if(m)T=$g({inputs:{x:r},backend:n,attrs:{shape:f}});else if(g||y){N.util.assert(r.shape.length>=1,()=>`Input must have rank at least 1, got: ${r.shape.length}`);const e=N.slice_util.computeOutShape(_,v,b),t=Zm({inputs:{x:r},backend:n,attrs:{begin:_,size:e}});T=$g({inputs:{x:t},backend:n,attrs:{shape:f}}),n.disposeIntermediateTensorInfo(t)}else{const e=dg(p,n.bufferSync(r),b,_);T=n.makeTensorInfo(f,e.dtype,e.values)}return T}};const fb={kernelName:N.StringNGrams,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{separator:r,nGramWidths:s,leftPad:o,rightPad:a,padWidth:l,preserveShortSequences:u}=i,{data:c,dataSplits:d}=t,h=n.data.get(c.dataId).values,p=n.data.get(d.dataId).values,[f,m]=pg(h,p,r,s,o,a,l,u);return[n.makeTensorInfo([f.length],"string",f),n.makeTensorInfo(d.shape,"int32",m)]}};const mb={kernelName:N.StringSplit,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{skipEmpty:r}=i,{input:s,delimiter:o}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(1!==s.shape.length)throw new Error(`Input must be a vector, got shape: ${s.shape}`);if(0!==o.shape.length)throw new Error(`Delimiter must be a scalar, got shape: ${o.shape}`);const a=n.data.get(s.dataId).values,l=n.data.get(o.dataId).values[0],[u,c,d]=mg(a,l,r),h=c.length;return[n.makeTensorInfo([h,2],"int32",u),n.makeTensorInfo([h],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(d))]}};const gb={kernelName:N.StringToHashBucketFast,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{numBuckets:r}=i,{input:s}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(r<=0)throw new Error("Number of buckets must be at least 1");const o=gg(n.data.get(s.dataId).values,r);return n.makeTensorInfo(s.shape,"int32",o)}},yb=If(N.Tan,e=>Math.tan(e)),_b={kernelName:N.Tan,backendName:"cpu",kernelFunc:yb},vb=If(N.Tanh,e=>Math.tanh(e)),bb={kernelName:N.Tanh,backendName:"cpu",kernelFunc:vb};const Tb={kernelName:N.TensorScatterUpdate,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{tensor:i,indices:r,updates:s}=t,{sliceRank:o,numUpdates:a,sliceSize:l,strides:u,outputSize:c}=N.backend_util.calculateShapes(s,r,i.shape),d=n.bufferSync(r),h=n.bufferSync(s),p=n.bufferSync(i),f=Hm(d,h,i.shape,c,l,a,o,u,p,!1);return n.makeTensorInfo(i.shape,f.dtype,f.values)}};const xb={kernelName:N.Tile,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{reps:s}=i;Kp(r,"tile");const o=Tg(n.bufferSync(r),s);return n.makeTensorInfo(o.shape,o.dtype,o.values)}};const Eb={kernelName:N.TopK,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{k:s,sorted:o}=i;Kp(r,"topk");const a=n.data.get(r.dataId).values,[l,u]=wg(a,r.shape,r.dtype,s,o);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(u.shape,u.dtype,u.values)]}};const wb={kernelName:N.Transform,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,attrs:n,backend:i}=e,{image:r,transforms:s}=t,{interpolation:o,fillMode:a,fillValue:l,outputShape:u}=n,[c,d,h,p]=r.shape,[f,m]=null!=u?u:[d,h],g=[c,f,m,p],y=N.util.computeStrides(r.shape),_=y[0],v=y[1],b=y[2],T=N.util.computeStrides(g),x=T[0],E=T[1],w=T[2],I=N.util.getTypedArrayFromDType(r.dtype,N.util.sizeFromShape(g));I.fill(l);const A=i.data.get(r.dataId).values,S=i.data.get(s.dataId).values;for(let e=0;e<c;++e){const t=1===s.shape[0]?S:S.subarray(8*e,8*e+8);for(let n=0;n<f;++n)for(let i=0;i<m;++i)for(let r=0;r<p;++r){let s;const u=t[6]*i+t[7]*n+1;if(0===u)continue;const c=(t[0]*i+t[1]*n+t[2])/u,p=(t[3]*i+t[4]*n+t[5])/u,f=Ib(c,h,a),m=Ib(p,d,a);switch(o){case"nearest":s=Sb(A,d,h,_,v,b,e,m,f,r,l);break;case"bilinear":s=Cb(A,d,h,_,v,b,e,m,f,r,l);break;default:throw new Error(`Error in Transform: Expect 'nearest' or 'bilinear', but got ${o}`)}I[e*x+n*E+i*w+r]=s}return i.makeTensorInfo(g,r.dtype,I)}return{dataId:i.write(I,g,r.dtype),shape:r.shape,dtype:r.dtype}}};function Ib(e,t,n){switch(n){case"reflect":return function(e,t){let n=e;if(n<0)if(t<=1)n=0;else{const e=2*t;n<e&&(n=e*Math.trunc(-n/e)+n),n=n<-t?n+e:-n-1}else if(n>t-1)if(t<=1)n=0;else{const e=2*t;n-=e*Math.trunc(n/e),n>=t&&(n=e-n-1)}return N.util.clamp(0,n,t-1)}(e,t);case"wrap":return function(e,t){let n=e;if(n<0)if(t<=1)n=0;else{const e=t-1;n+=t*(Math.trunc(-n/e)+1)}else if(n>t-1)if(t<=1)n=0;else{const e=t-1;n-=t*Math.trunc(n/e)}return N.util.clamp(0,n,t-1)}(e,t);case"nearest":return function(e,t){return N.util.clamp(0,e,t-1)}(e,t);default:return function(e){return e}(e)}}function Ab(e,t,n,i,r,s,o,a,l,u,c){return 0<=a&&a<t&&0<=l&&l<n?e[o*i+a*r+l*s+u]:c}function Sb(e,t,n,i,r,s,o,a,l,u,c){return Ab(e,t,n,i,r,s,o,Math.round(a),Math.round(l),u,c)}function Cb(e,t,n,i,r,s,o,a,l,u,c){const d=Math.floor(a),h=Math.floor(l),p=d+1,f=h+1;return(p-a)*((f-l)*Ab(e,t,n,i,r,s,o,d,h,u,c)+(l-h)*Ab(e,t,n,i,r,s,o,d,f,u,c))+(a-d)*((f-l)*Ab(e,t,n,i,r,s,o,p,h,u,c)+(l-h)*Ab(e,t,n,i,r,s,o,p,f,u,c))}const Ob={kernelName:N.Unique,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,attrs:n,backend:i}=e,{axis:r}=n,{x:s}=t;Kp(s,"unique");const o=i.data.get(s.dataId).values,{outputValues:a,outputShape:l,indices:u}=Ig(o,r,s.shape,s.dtype);return[i.makeTensorInfo(l,s.dtype,a),i.makeTensorInfo([u.length],"int32",u)]}};const Mb={kernelName:N.Unpack,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{value:r}=t;let{axis:s}=i;s<0&&(s+=r.shape.length);const o=r.shape.length,a=r.shape[s],l=new Array(o-1);let u=0;for(let e=0;e<o;e++)e!==s&&(l[u++]=r.shape[e]);const c=new Array(o).fill(0),d=r.shape.slice();d[s]=1;const h=new Array(a);for(let e=0;e<h.length;e++){c[s]=e;const t=Zm({inputs:{x:r},backend:n,attrs:{begin:c,size:d}});h[e]=$g({inputs:{x:t},backend:n,attrs:{shape:l}}),n.disposeIntermediateTensorInfo(t)}return h}};const Rb={kernelName:N.UnsortedSegmentSum,backendName:"cpu",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,segmentIds:s}=t,{numSegments:o}=i;Kp(r,"unsortedSegmentSum");const a=[],l=[],u=r.shape.length-s.shape.length;let c=s;for(let e=0;e<u;++e){const t=d_({inputs:{input:c},backend:n,attrs:{dim:e+1}});c=t,l.push(t)}for(let e=0;e<o;++e){const t=N.util.createScalarValue(e,"int32"),i=n.makeTensorInfo([],"int32",t),s=kf({inputs:{a:i,b:c},backend:n}),o=df({inputs:{x:s},backend:n,attrs:{dtype:"float32"}}),u=vm({inputs:{a:o,b:r},backend:n}),d=Jy({inputs:{x:u},backend:n,attrs:{axis:0,keepDims:!1}});a.push(d),l.push(i),l.push(s),l.push(o),l.push(u),l.push(d)}const d=vv({inputs:a,backend:n,attrs:{axis:0}});return l.forEach(e=>n.disposeIntermediateTensorInfo(e)),d}},kb=[jg,ef,Gg,Wg,_f,Xg,qg,Kg,Zg,Qg,ey,ny,ry,ay,uy,py,fy,my,gy,Vg,yy,_y,vy,Ef,by,hf,Of,xy,rf,Ey,Sy,Oy,My,Ry,ky,Ny,Dy,Ly,By,$y,Uy,zy,Vy,jy,Gy,Hy,Wy,Xy,qy,Ky,Zy,Qy,t_,Cg,n_,Nf,c_,Lf,h_,$f,v_,T_,x_,Vf,Gf,E_,w_,I_,A_,Kf,Jf,af,S_,Iy,O_,R_,N_,Mg,nm,sm,D_,um,L_,$_,z_,Y_,G_,H_,X_,pm,q_,K_,Z_,Q_,J_,ev,tv,gm,nv,sv,lv,bm,xm,cv,hv,fv,Im,mv,_v,bv,Tv,wv,Ng,Mm,Iv,Av,Sv,Cv,uf,m_,Mv,Fg,Pg,Ug,Rv,kv,Nv,Dv,Fv,Lv,Bv,Gm,$v,Vv,jv,Wv,qm,qv,Zv,Jv,Qm,av,nb,ib,rb,sb,ob,ab,lb,ub,rg,cb,ag,cg,hb,pb,fb,mb,gb,bg,e_,_b,bb,Tb,xb,Eb,wb,Cm,Ob,Mb,Rb,yv];for(const e of kb)(0,N.registerKernel)(e);
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Nb={},Db={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function Fb(e,t){Nb[e]=t}function Lb(e,t){if(!(e in Nb)||null!=t){const n=function(e,t){if(1!==e&&2!==e)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");const n=null==t?function(e){if((0,N.env)().getBool("IS_SAFARI")||"undefined"==typeof OffscreenCanvas||2!==e){if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}return new OffscreenCanvas(300,150)}(e):t;n.addEventListener("webglcontextlost",t=>{t.preventDefault(),delete Nb[e]},!1),(0,N.env)().getBool("SOFTWARE_WEBGL_ENABLED")&&(Db.failIfMajorPerformanceCaveat=!1);if(1===e)return n.getContext("webgl",Db)||n.getContext("experimental-webgl",Db);return n.getContext("webgl2",Db)}(e,t);if(null===n)return console.log("Could not get context for WebGL version",e),null;Nb[e]=n}const n=Nb[e];return null==n||n.isContextLost()?(delete Nb[e],Lb(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),Nb[e])}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
var Pb,Bb,$b;function Ub(e,t){return[t,e]}function zb(e){const t=N.util.sizeFromShape(e),n=Math.ceil(t/4);return N.util.sizeToSquarishShape(n)}function Vb(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}function jb(e,t){const n=e;let i,r,s,o,a,l,u,c,d,h;return 2===(0,N.env)().getNumber("WEBGL_VERSION")?(i=n.R32F,r=n.R16F,s=n.RGBA16F,o=n.RGBA32F,a=n.RED,u=4,c=1,d=n.HALF_FLOAT,h=n.FLOAT,l=n.RGBA8):(i=e.RGBA,r=e.RGBA,s=e.RGBA,o=n.RGBA,a=e.RGBA,u=4,c=4,d=null!=t?t.HALF_FLOAT_OES:null,h=e.FLOAT,l=e.RGBA),{internalFormatFloat:i,internalFormatHalfFloat:r,internalFormatPackedHalfFloat:s,internalFormatPackedFloat:o,textureFormatFloat:a,downloadTextureFormat:l,downloadUnpackNumChannels:u,defaultNumChannels:c,textureTypeHalfFloat:d,textureTypeFloat:h}}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Yb(e,t){const n=t();return(0,N.env)().getBool("DEBUG")&&function(e){const t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+Xb(e,t))}(e),n}!function(e){e[e.DENSE=0]="DENSE",e[e.SHARED_BATCH=1]="SHARED_BATCH"}(Pb||(Pb={})),function(e){e[e.RENDER=0]="RENDER",e[e.UPLOAD=1]="UPLOAD",e[e.PIXELS=2]="PIXELS",e[e.DOWNLOAD=3]="DOWNLOAD"}(Bb||(Bb={})),function(e){e[e.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",e[e.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",e[e.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",e[e.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",e[e.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"}($b||($b={}));const Gb=5.96e-8,Hb=65504;function Wb(e){return!!((0,N.env)().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||0===e||Gb<Math.abs(e)&&Math.abs(e)<Hb)}function Xb(e,t){switch(t){case e.NO_ERROR:return"NO_ERROR";case e.INVALID_ENUM:return"INVALID_ENUM";case e.INVALID_VALUE:return"INVALID_VALUE";case e.INVALID_OPERATION:return"INVALID_OPERATION";case e.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case e.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case e.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return`Unknown error code ${t}`}}function qb(e,t){return bT(e,()=>e.getExtension(t),'Extension "'+t+'" not supported on this browser.')}function Kb(e,t){const n=bT(e,()=>e.createShader(e.VERTEX_SHADER),"Unable to create vertex WebGLShader.");if(Yb(e,()=>e.shaderSource(n,t)),Yb(e,()=>e.compileShader(n)),!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw console.log(e.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function Zb(e,t){const n=bT(e,()=>e.createShader(e.FRAGMENT_SHADER),"Unable to create fragment WebGLShader.");if(Yb(e,()=>e.shaderSource(n,t)),Yb(e,()=>e.compileShader(n)),(0,N.env)().get("ENGINE_COMPILE_ONLY"))return n;if(!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw Jb(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}const Qb=/ERROR: [0-9]+:([0-9]+):/g;function Jb(e,t){const n=Qb.exec(t);if(null==n)return console.log(`Couldn't parse line number in error: ${t}`),void console.log(e);const i=+n[1],r=e.split("\n"),s=r.length.toString().length+2,o=r.map((e,t)=>N.util.rightPad((t+1).toString(),s)+e);let a=0;for(let e=0;e<o.length;e++)a=Math.max(o[e].length,a);const l=o.slice(0,i-1),u=o.slice(i-1,i),c=o.slice(i);console.log(l.join("\n")),console.log(t.split("\n")[0]),console.log(`%c ${N.util.rightPad(u[0],a)}`,"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(c.join("\n"))}function eT(e){return bT(e,()=>e.createProgram(),"Unable to create WebGLProgram.")}function tT(e,t){if(Yb(e,()=>e.linkProgram(t)),!(0,N.env)().get("ENGINE_COMPILE_ONLY")&&!1===e.getProgramParameter(t,e.LINK_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function nT(e,t){if(Yb(e,()=>e.validateProgram(t)),!1===e.getProgramParameter(t,e.VALIDATE_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function iT(e,t){const n=bT(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return Yb(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),Yb(e,()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function rT(e,t){const n=bT(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return Yb(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)),Yb(e,()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function sT(){return 2===(0,N.env)().getNumber("WEBGL_VERSION")?1:4}function oT(e){return bT(e,()=>e.createTexture(),"Unable to create WebGLTexture.")}function aT(e,t){const n=(0,N.env)().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){throw new Error("Requested texture size "+`[${e}x${t}]`+" is invalid.")}if(e>n||t>n){throw new Error("Requested texture size "+`[${e}x${t}]`+" greater than WebGL maximum on this browser / GPU "+`[${n}x${n}]`+".")}}function lT(e){return bT(e,()=>e.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function uT(e,t,n,i,r,s,o){const a=e.getAttribLocation(t,n);return-1!==a&&(Yb(e,()=>e.bindBuffer(e.ARRAY_BUFFER,i)),Yb(e,()=>e.vertexAttribPointer(a,r,e.FLOAT,!1,s,o)),Yb(e,()=>e.enableVertexAttribArray(a)),!0)}function cT(e,t,n){TT(e,n),Yb(e,()=>e.activeTexture(e.TEXTURE0+n)),Yb(e,()=>e.bindTexture(e.TEXTURE_2D,t))}function dT(e,t){TT(e,t),Yb(e,()=>e.activeTexture(e.TEXTURE0+t)),Yb(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function hT(e,t,n){return bT(e,()=>e.getUniformLocation(t,n),'uniform "'+n+'" not present in program.')}function pT(e,t,n){return e.getUniformLocation(t,n)}function fT(e,t,n,i){Yb(e,()=>cT(e,t,i)),Yb(e,()=>e.uniform1i(n,i))}function mT(e){Yb(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),Yb(e,()=>e.viewport(0,0,e.canvas.width,e.canvas.height)),Yb(e,()=>e.scissor(0,0,e.canvas.width,e.canvas.height))}function gT(e,t,n){Yb(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,n)),Yb(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0))}function yT(e,t){Yb(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,t)),Yb(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0))}function _T(e){const t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+vT(e,t))}function vT(e,t){switch(t){case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case e.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return`unknown error ${t}`}}function bT(e,t,n){const i=Yb(e,()=>t());if(null==i)throw new Error(n);return i}function TT(e,t){const n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,i=t+e.TEXTURE0;if(i<e.TEXTURE0||i>n){throw new Error(`textureUnit must be in ${`[gl.TEXTURE0, gl.TEXTURE${n}]`}.`)}}function xT(e,t=2){return N.util.sizeFromShape(e.slice(0,e.length-t))}function ET(e){if(0===e.length)throw Error("Cannot get rows and columns of an empty shape array.");return[e.length>1?e[e.length-2]:1,e[e.length-1]]}function wT(e){let t=[1,1,1];return 0===e.length||1===e.length&&1===e[0]||(t=[xT(e),...ET(e)]),t}function IT(e,t=!1){let n=(0,N.env)().getNumber("WEBGL_MAX_TEXTURE_SIZE"),i=(0,N.env)().getNumber("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE");if(i===1/0&&(0,N.env)().getBool("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE")&&(i=n/2),t&&(n*=2,i*=2,1===(e=e.map((t,n)=>n>=e.length-2?N.util.nearestLargerEven(e[n]):e[n])).length&&(e=[2,e[0]])),2!==e.length){const t=N.util.squeezeShape(e);e=t.newShape}let r=N.util.sizeFromShape(e),s=null;e.length<=1&&r<=n?s=[1,r]:2===e.length&&e[0]<=n&&e[1]<=n?s=e:3===e.length&&e[0]*e[1]<=n&&e[2]<=n?s=[e[0]*e[1],e[2]]:3===e.length&&e[0]<=n&&e[1]*e[2]<=n?s=[e[0],e[1]*e[2]]:4===e.length&&e[0]*e[1]*e[2]<=n&&e[3]<=n?s=[e[0]*e[1]*e[2],e[3]]:4===e.length&&e[0]<=n&&e[1]*e[2]*e[3]<=n&&(s=[e[0],e[1]*e[2]*e[3]]);const o=null!=s&&Math.max(...s)>i&&Math.min(...s)<=(t?2:1)&&Math.min(...s)>0;if(null==s||o)if(t){const t=xT(e);let n=2,i=2;e.length&&([n,i]=ET(e)),r=t*(n/2)*(i/2),s=N.util.sizeToSquarishShape(r).map(e=>2*e)}else s=N.util.sizeToSquarishShape(r);return s}function AT(e){return e%2==0}function ST(e,t){if(e=e.slice(-2),t=t.slice(-2),N.util.arraysEqual(e,t))return!0;if(!e.length||!t.length)return!0;if(0===e[0]||0===e[1]||0===t[0]||0===t[1])return!0;if(e.length!==t.length){const n=e[e.length-1],i=t[t.length-1];if(n===i)return!0;if(AT(n)&&AT(i)&&(1===e[0]||1===t[0]))return!0}return e[1]===t[1]&&AT(e[0])&&AT(t[0])}let CT,OT;function MT(e){if(null==CT){const t=Lb(e);CT=t.getParameter(t.MAX_TEXTURE_SIZE)}return CT}function RT(){CT=null}function kT(){OT=null}function NT(e){if(null==OT){const t=Lb(e);OT=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,OT)}function DT(e){if(0===e)return 0;let t;const n=Lb(e);return t=FT(n,"EXT_disjoint_timer_query_webgl2")&&2===e?2:FT(n,"EXT_disjoint_timer_query")?1:0,t}function FT(e,t){return null!=e.getExtension(t)}function LT(e){try{if(null!=Lb(e))return!0}catch(e){return console.log("Error when getting WebGL context: ",e),!1}return!1}function PT(e){if(0===e)return!1;const t=Lb(e);if(1===e){if(!FT(t,"OES_texture_float"))return!1}else if(!FT(t,"EXT_color_buffer_float"))return!1;return $T(t)}function BT(e){if(0===e)return!1;const t=Lb(e);if(1!==e){if(FT(t,"EXT_color_buffer_float"))return $T(t);const e="EXT_color_buffer_half_float";if(FT(t,e)){const n=t.getExtension(e);return function(e,t){const n=jb(e,t),i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);const r=1,s=1;e.texImage2D(e.TEXTURE_2D,0,n.internalFormatHalfFloat,r,s,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);const o=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,o),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0);const a=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(i),e.deleteFramebuffer(o),a}(t,n)}return!1}if(!FT(t,"OES_texture_float"))return!1;if(!FT(t,"WEBGL_color_buffer_float"))return!1;return $T(t)}function $T(e){const t=jb(e),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);e.texImage2D(e.TEXTURE_2D,0,t.internalFormatFloat,1,1,0,t.textureFormatFloat,t.textureTypeFloat,null);const i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);const r=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(n),e.deleteFramebuffer(i),r}function UT(e){if(2!==e)return!1;return null!=Lb(e).fenceSync}function zT(e,t){Array.isArray(e)||(e=[e]),e.forEach(e=>{null!=e&&N.util.assert("complex64"!==e.dtype,()=>`${t} does not support complex64 tensors in the WebGL backend.`)})}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const VT=(0,N.env)();
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function jT(){let e,t,n,i,r,s,o,a,l,u;return 2===(0,N.env)().getNumber("WEBGL_VERSION")?(e="#version 300 es",t="in",n="out",i="in",r="texture",s="outputColor",o="out vec4 outputColor;",a=(0,N.env)().getBool("WEBGL2_ISNAN_CUSTOM")?"\n bool isnan_custom(float val) {\n uint floatToUint = floatBitsToUint(val);\n return (floatToUint & 0x7fffffffu) > 0x7f800000u;\n }\n\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan_custom(val.x),\n isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));\n }\n\n #define isnan(value) isnan_custom(value)\n ":"",l="",u="\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 "):(e="",t="attribute",n="varying",i="varying",r="texture2D",s="gl_FragColor",o="",a="\n #define isnan(value) isnan_custom(value)\n bool isnan_custom(float val) {\n return (val > 0. || val < 1. || val == 0.) ? false : true;\n }\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n }\n ",l="\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 ",u="\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 "),{version:e,attribute:t,varyingVs:n,varyingFs:i,texture2D:r,output:s,defineOutput:o,defineSpecialNaN:a,defineSpecialInf:l,defineRound:u}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function YT(e,t,n="index"){const i=N.util.computeStrides(t);return i.map((t,r)=>`${`int ${e[r]} = ${n} / ${t}`}; ${r===i.length-1?`int ${e[r+1]} = ${n} - ${e[r]} * ${t}`:`index -= ${e[r]} * ${t}`};`).join("")}function GT(e,t,n="index"){const i=N.util.computeStrides(t);return i.map((t,r)=>`${`int ${e[r]} = ${n} / outShapeStrides[${r}]`}; ${r===i.length-1?`int ${e[r+1]} = ${n} - ${e[r]} * outShapeStrides[${r}]`:`index -= ${e[r]} * outShapeStrides[${r}]`};`).join("")}function HT(e,t,n="index"){const i=function(e,t){const n=e.length,i=e.map(e=>`${t}[${e}]`),r=new Array(n-1);r[n-2]=i[n-1];for(let e=n-3;e>=0;--e)r[e]=`(${r[e+1]} * ${i[e+1]})`;return r}(e.map((e,t)=>t),t);return i.map((t,r)=>`${`int ${e[r]} = ${n} / ${i[r]}`}; ${r===i.length-1?`int ${e[r+1]} = ${n} - ${e[r]} * ${i[r]}`:`index -= ${e[r]} * ${i[r]}`};`).join("")}function WT(e){const t=N.util.computeStrides(e).map(e=>e.toString());return`\n int getFlatIndex(ivec3 coords) {\n return coords.x * ${t[0]} + coords.y * ${t[1]} + coords.z;\n }\n`}VT.registerFlag("HAS_WEBGL",()=>VT.getNumber("WEBGL_VERSION")>0),VT.registerFlag("WEBGL_VERSION",()=>LT(2)?2:LT(1)?1:0),VT.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",()=>!1),VT.registerFlag("WEBGL_BUFFER_SUPPORTED",()=>2===VT.get("WEBGL_VERSION")),VT.registerFlag("WEBGL_CPU_FORWARD",()=>!0),VT.registerFlag("WEBGL_FORCE_F16_TEXTURES",()=>!1),VT.registerFlag("WEBGL_PACK",()=>VT.getBool("HAS_WEBGL")),VT.registerFlag("WEBGL_PACK_NORMALIZATION",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_PACK_CLIP",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_PACK_DEPTHWISECONV",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_PACK_REDUCE",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_LAZILY_UNPACK",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_CONV_IM2COL",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_PACK_CONV2DTRANSPOSE",()=>VT.getBool("WEBGL_PACK")),VT.registerFlag("WEBGL_MAX_TEXTURE_SIZE",()=>MT(VT.getNumber("WEBGL_VERSION"))),VT.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",()=>NT(VT.getNumber("WEBGL_VERSION"))),VT.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",()=>{const e=VT.getNumber("WEBGL_VERSION");return 0===e?0:DT(e)}),VT.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",()=>VT.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!N.device_util.isMobile()),VT.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",()=>PT(VT.getNumber("WEBGL_VERSION"))),VT.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",()=>!VT.getBool("WEBGL_FORCE_F16_TEXTURES")&&VT.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")),VT.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",()=>BT(VT.getNumber("WEBGL_VERSION"))),VT.registerFlag("WEBGL_FENCE_API_ENABLED",()=>UT(VT.getNumber("WEBGL_VERSION"))),VT.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",()=>VT.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0),VT.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",()=>-1,e=>{if("number"!=typeof e)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be a number but got ${e}.`);if(e<0&&-1!==e)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${e}.`)}),VT.registerFlag("WEBGL_FLUSH_THRESHOLD",()=>N.device_util.isMobile()?1:-1,e=>{if("number"!=typeof e)throw new Error(`WEBGL_FLUSH_THRESHOLD must be a number but got ${e}.`);if(e<0&&-1!==e)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${e}.`)}),VT.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",()=>128),VT.registerFlag("WEBGL_USE_SHAPES_UNIFORMS",()=>!1),VT.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD",()=>1e5),VT.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD",()=>128),VT.registerFlag("WEBGL_EXP_CONV",()=>!1),VT.registerFlag("SOFTWARE_WEBGL_ENABLED",()=>VT.getBool("IS_TEST")),VT.registerFlag("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE",()=>1/0),VT.registerFlag("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE",()=>!1),VT.registerFlag("WEBGL2_ISNAN_CUSTOM",()=>!1),VT.registerFlag("ENGINE_COMPILE_ONLY",()=>!1);const XT="\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 < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -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",{getBroadcastDims:qT}=N.backend_util;function KT(e,t,n){const i=[];if(e.forEach(e=>{const t=N.util.sizeFromShape(e.shapeInfo.logicalShape);if(e.shapeInfo.isUniform?i.push(`uniform float ${e.name}${t>1?`[${t}]`:""};`):(i.push(`uniform sampler2D ${e.name};`),i.push(`uniform int offset${e.name};`)),n.enableShapeUniforms){const{uniformShape:t}=ax(n.packedInputs,e.shapeInfo.logicalShape,e.shapeInfo.texShape);switch(t.length){case 1:i.push(`uniform int ${e.name}Shape;`);break;case 2:i.push(`uniform ivec2 ${e.name}Shape;`);break;case 3:i.push(`uniform ivec3 ${e.name}Shape;`);break;case 4:i.push(`uniform ivec4 ${e.name}Shape;`)}i.push(`uniform ivec2 ${e.name}TexShape;`)}}),n.enableShapeUniforms){switch(t.logicalShape.length){case 1:i.push("uniform int outShape;");break;case 2:i.push("uniform ivec2 outShape;"),i.push("uniform int outShapeStrides;");break;case 3:i.push("uniform ivec3 outShape;"),i.push("uniform ivec2 outShapeStrides;");break;case 4:i.push("uniform ivec4 outShape;"),i.push("uniform ivec3 outShapeStrides;")}i.push("uniform ivec2 outTexShape;")}n.customUniforms&&n.customUniforms.forEach(e=>{i.push(`uniform ${e.type} ${e.name}${e.arrayIndex?`[${e.arrayIndex}]`:""};`)});const r=i.join("\n"),s=e.map(e=>function(e,t,n=!1,i){let r="";r+=n?QT(e,i):ZT(e,i);const s=e.shapeInfo.logicalShape,o=t.logicalShape;s.length<=o.length&&(r+=n?function(e,t){const n=e.name,i=n.charAt(0).toUpperCase()+n.slice(1),r="get"+i+"AtOutCoords",s=e.shapeInfo.logicalShape.length,o=t.logicalShape.length,a=qT(e.shapeInfo.logicalShape,t.logicalShape),l=ox(o),u=o-s;let c;const d=["x","y","z","w","u","v"];c=0===s?"":o<2&&a.length>=1?"coords = 0;":a.map(e=>`coords.${d[e+u]} = 0;`).join("\n");let h="";h=o<2&&s>0?"coords":e.shapeInfo.logicalShape.map((e,t)=>`coords.${d[t+u]}`).join(", ");let p="return outputValue;";const f=1===N.util.sizeFromShape(e.shapeInfo.logicalShape),m=N.util.sizeFromShape(t.logicalShape),g=1===m;if(1!==s||f||g){if(f&&!g)p=1===o?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(a.length){const e=s-2,t=s-1;a.indexOf(e)>-1&&a.indexOf(t)>-1?p="return vec4(outputValue.x);":a.indexOf(e)>-1?p="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":a.indexOf(t)>-1&&(p="return vec4(outputValue.xx, outputValue.zz);")}}else p="\n return vec4(outputValue.xy, outputValue.xy);\n ";return`\n vec4 ${r}() {\n ${l} coords = getOutputCoords();\n ${c}\n vec4 outputValue = get${i}(${h});\n ${p}\n }\n `}(e,t):function(e,t){const n=e.name,i=n.charAt(0).toUpperCase()+n.slice(1),r="get"+i+"AtOutCoords",s=t.texShape,o=e.shapeInfo.texShape,a=e.shapeInfo.logicalShape.length,l=t.logicalShape.length;if(!e.shapeInfo.isUniform&&a===l&&null==e.shapeInfo.flatOffset&&N.util.arraysEqual(o,s))return`\n float ${r}() {\n return sampleTexture(${n}, resultUV);\n }\n `;const u=ox(l),c=qT(e.shapeInfo.logicalShape,t.logicalShape),d=l-a;let h;const p=["x","y","z","w","u","v"];h=0===a?"":l<2&&c.length>=1?"coords = 0;":c.map(e=>`coords.${p[e+d]} = 0;`).join("\n");let f="";f=l<2&&a>0?"coords":e.shapeInfo.logicalShape.map((e,t)=>`coords.${p[t+d]}`).join(", ");return`\n float ${r}() {\n ${u} coords = getOutputCoords();\n ${h}\n return get${i}(${f});\n }\n `}(e,t));return r}(e,t,n.packedInputs,n.enableShapeUniforms)).join("\n"),o=t.texShape,a=jT(),l=function(e){return`\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return ${e.texture2D}(textureSampler, uv).r;\n }\n `}(a);let u,c,d=function(e){const t=`${e.version}\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n ${e.varyingFs} vec2 resultUV;\n ${e.defineOutput}\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 ${e.defineSpecialNaN}\n ${e.defineSpecialInf}\n ${e.defineRound}\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 < 0. && 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 ${JT}\n ${ex}\n ${tx}\n `;return t}(a);t.isPacked?(u=function(e,t,n){switch(e.length){case 0:return ix();case 1:return function(e,t,n){const i=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(1===i[0])return n?"\n int getOutputCoords() {\n return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0));\n }\n ":`\n int getOutputCoords() {\n return 2 * int(resultUV.x * ${i[1]}.0);\n }\n `;if(1===i[1])return n?"\n int getOutputCoords() {\n return 2 * int(resultUV.y * ceil(float(outTexShape[0]) / 2.0));\n }\n ":`\n int getOutputCoords() {\n return 2 * int(resultUV.y * ${i[0]}.0);\n }\n `;if(n)return"\n int getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n return 2 * (resTexRC.x * packedTexShape[1] + resTexRC.y);\n }\n ";return`\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${i[0]}, ${i[1]}));\n return 2 * (resTexRC.x * ${i[1]} + resTexRC.y);\n }\n `}(0,t,n);case 2:return function(e,t,n){const i=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(N.util.arraysEqual(e,t))return n?"\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1]));\n }\n ":`\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2(${i[0]}, ${i[1]}));\n }\n `;const r=Math.ceil(e[1]/2);if(n)return"\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec2(r, c);\n }\n ";return`\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${i[0]}, ${i[1]}));\n\n int index = resTexRC.x * ${i[1]} + resTexRC.y;\n int r = 2 * (index / ${r});\n int c = imod(index, ${r}) * 2;\n\n return ivec2(r, c);\n }\n `}(e,t,n);case 3:return function(e,t,n){if(n)return"\n ivec3 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec3(b, r, c);\n }\n ";const i=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],r=Math.ceil(e[2]/2),s=r*Math.ceil(e[1]/2);return`\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${i[0]}, ${i[1]}));\n int index = resTexRC.x * ${i[1]} + resTexRC.y;\n\n int b = index / ${s};\n index -= b * ${s};\n\n int r = 2 * (index / ${r});\n int c = imod(index, ${r}) * 2;\n\n return ivec3(b, r, c);\n }\n `}(e,t,n);default:return function(e,t,n){if(n)return"\n ivec4 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int texelsInLogicalRow = int(ceil(float(outShape[3]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatchN = texelsInBatch * outShape[1];\n\n int b2 = index / texelsInBatchN;\n index -= b2 * texelsInBatchN;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec4(b2, b, r, c);\n }\n ";const i=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],r=Math.ceil(e[e.length-1]/2),s=r*Math.ceil(e[e.length-2]/2);let o=s,a="",l="b, r, c";for(let t=2;t<e.length-1;t++)o*=e[e.length-t-1],a=`\n int b${t} = index / ${o};\n index -= b${t} * ${o};\n `+a,l=`b${t}, `+l;return`\n ivec${e.length} getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${i[0]}, ${i[1]}));\n int index = resTexRC.x * ${i[1]} + resTexRC.y;\n\n ${a}\n\n int b = index / ${s};\n index -= b * ${s};\n\n int r = 2 * (index / ${r});\n int c = imod(index, ${r}) * 2;\n\n return ivec${e.length}(${l});\n }\n `}(e,t,n)}}(t.logicalShape,o,n.enableShapeUniforms),c=function(e){return`\n void setOutput(vec4 val) {\n ${e.output} = val;\n }\n `}(a)):(u=function(e,t,n){switch(e.length){case 0:return ix();case 1:return function(e,t,n){if(1===t[0])return n?"\n int getOutputCoords() {\n return int(resultUV.x * float(outTexShape[1]));\n }\n ":`\n int getOutputCoords() {\n return int(resultUV.x * ${t[1]}.0);\n }\n `;if(1===t[1])return n?"\n int getOutputCoords() {\n return int(resultUV.y * float(outTexShape[0]));\n }\n ":`\n int getOutputCoords() {\n return int(resultUV.y * ${t[0]}.0);\n }\n `;if(n)return"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n return resTexRC.x * outTexShape[1] + resTexRC.y;\n }\n ";return`\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n return resTexRC.x * ${t[1]} + resTexRC.y;\n }\n `}(0,t,n);case 2:return function(e,t,n){if(N.util.arraysEqual(e,t))return n?"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1]));\n }\n ":`\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(${t[0]}, ${t[1]}));\n }\n `;if(1===e[1])return n?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(index, 0);\n }\n ":`\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n return ivec2(index, 0);\n }\n `;if(1===e[0])return n?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(0, index);\n }\n ":`\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n return ivec2(0, index);\n }\n `;if(n)return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n int r = index / outShape[1];\n int c = index - r * outShape[1];\n return ivec2(r, c);\n }\n ";return`\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n int r = index / ${e[1]};\n int c = index - r * ${e[1]};\n return ivec2(r, c);\n }\n `}(e,t,n);case 3:return function(e,t,n){if(n){return`\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ${GT(["r","c","d"],e)}\n return ivec3(r, c, d);\n }\n`}const i=YT(["r","c","d"],e);return`\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n ${i}\n return ivec3(r, c, d);\n }\n `}(e,t,n);case 4:return function(e,t,n){if(n){return`\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ${GT(["r","c","d","d2"],e)}\n return ivec4(r, c, d, d2);\n }\n `}const i=YT(["r","c","d","d2"],e);return`\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n ${i}\n return ivec4(r, c, d, d2);\n }\n `}(e,t,n);case 5:return function(e,t){const n=YT(["r","c","d","d2","d3"],e);return`\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(${t[0]},\n ${t[1]}));\n\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n\n ${n}\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n `}(e,t);case 6:return function(e,t){const n=YT(["r","c","d","d2","d3","d4"],e);return`\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${t[0]}, ${t[1]}));\n int index = resTexRC.x * ${t[1]} + resTexRC.y;\n\n ${n}\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n `}(e,t);default:throw new Error(`${e.length}-D output sampling is not yet supported`)}}(t.logicalShape,o,n.enableShapeUniforms),c=function(e){return`\n void setOutput(float val) {\n ${e.output} = vec4(val, 0, 0, 0);\n }\n `}(a)),n.packedInputs&&(d+=nx);return[d,l,c,r,u,s,n.userCode].join("\n")}function ZT(e,t=!1){const n=e.shapeInfo.logicalShape;switch(n.length){case 0:return function(e,t){const n=e.name,i="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return`float ${i}() {return ${n};}`;const[r,s]=e.shapeInfo.texShape;if(1===r&&1===s)return`\n float ${i}() {\n return sampleTexture(${n}, halfCR);\n }\n `;const o=rx(n);if(t)return`\n float ${i}() {\n vec2 uv = uvFromFlat(${n}TexShape[0], ${n}TexShape[1], ${o});\n return sampleTexture(${n}, uv);\n }\n `;const[a,l]=e.shapeInfo.texShape;return`\n float ${i}() {\n vec2 uv = uvFromFlat(${a}, ${l}, ${o});\n return sampleTexture(${n}, uv);\n }\n `}(e,t);case 1:return function(e,t){const n=e.name,i="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return`\n float ${i}(int index) {\n ${sx(e)}\n }\n `;const r=e.shapeInfo.texShape,s=r[0],o=r[1];if(1===o&&1===s)return`\n float ${i}(int index) {\n return sampleTexture(${n}, halfCR);\n }\n `;const a=rx(n);if(1===o)return t?`\n float ${i}(int index) {\n vec2 uv = vec2(0.5, (float(index + ${a}) + 0.5) / float(${n}TexShape[0]));\n return sampleTexture(${n}, uv);\n }\n `:`\n float ${i}(int index) {\n vec2 uv = vec2(0.5, (float(index + ${a}) + 0.5) / ${s}.0);\n return sampleTexture(${n}, uv);\n }\n `;if(1===s)return t?`\n float ${i}(int index) {\n vec2 uv = vec2((float(index + ${a}) + 0.5) / float(${n}TexShape[1]), 0.5);\n return sampleTexture(${n}, uv);\n }\n `:`\n float ${i}(int index) {\n vec2 uv = vec2((float(index + ${a}) + 0.5) / ${o}.0, 0.5);\n return sampleTexture(${n}, uv);\n }\n `;if(t)return`\n float ${i}(int index) {\n vec2 uv = uvFromFlat(${n}TexShape[0], ${n}TexShape[1], index + ${a});\n return sampleTexture(${n}, uv);\n }\n `;return`\n float ${i}(int index) {\n vec2 uv = uvFromFlat(${s}, ${o}, index + ${a});\n return sampleTexture(${n}, uv);\n }\n `}(e,t);case 2:return function(e,t){const n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),s=e.shapeInfo.texShape;if(null!=s&&N.util.arraysEqual(n,s)){if(t)return`\n float ${r}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${i}TexShape[1], ${i}TexShape[0]);\n return sampleTexture(${i}, uv);\n }\n `;const e=s[0];return`\n float ${r}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${s[1]}.0, ${e}.0);\n return sampleTexture(${i}, uv);\n }\n `}const{newShape:o,keptDims:a}=N.util.squeezeShape(n),l=o;if(l.length<n.length){const n=["row","col"];return`\n ${ZT(lx(e,l),t)}\n float ${r}(int row, int col) {\n return ${r}(${ux(n,a)});\n }\n `}if(e.shapeInfo.isUniform)return`\n float ${r}(int row, int col) {\n int index = round(dot(vec2(row, col), vec2(${n[1]}, 1)));\n ${sx(e)}\n }\n `;const u=s[0],c=s[1],d=rx(i);if(1===c)return t?`\n float ${r}(int row, int col) {\n float index = dot(vec3(row, col, ${d}), vec3(${i}Shape[1], 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / float(${i}TexShape[0]));\n return sampleTexture(${i}, uv);\n }\n `:`\n float ${r}(int row, int col) {\n float index = dot(vec3(row, col, ${d}), vec3(${n[1]}, 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / ${u}.0);\n return sampleTexture(${i}, uv);\n }\n `;if(1===u)return t?`\n float ${r}(int row, int col) {\n float index = dot(vec3(row, col, ${d}), vec3(${i}Shape[1], 1, 1));\n vec2 uv = vec2((index + 0.5) / float(${i}TexShape[1]), 0.5);\n return sampleTexture(${i}, uv);\n }\n `:`\n float ${r}(int row, int col) {\n float index = dot(vec3(row, col, ${d}), vec3(${n[1]}, 1, 1));\n vec2 uv = vec2((index + 0.5) / ${c}.0, 0.5);\n return sampleTexture(${i}, uv);\n }\n `;if(t)return`\n float ${r}(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${i}Shape[1] + col + ${d};\n vec2 uv = uvFromFlat(${i}TexShape[0], ${i}TexShape[1], index);\n return sampleTexture(${i}, uv);\n }\n `;return`\n float ${r}(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${n[1]} + col + ${d};\n vec2 uv = uvFromFlat(${u}, ${c}, index);\n return sampleTexture(${i}, uv);\n }\n`}(e,t);case 3:return function(e,t){const n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),s=n[1]*n[2],o=n[2],{newShape:a,keptDims:l}=N.util.squeezeShape(n),u=a;if(u.length<n.length){const n=["row","col","depth"];return`\n ${ZT(lx(e,u),t)}\n float ${r}(int row, int col, int depth) {\n return ${r}(${ux(n,l)});\n }\n `}if(e.shapeInfo.isUniform)return`\n float ${r}(int row, int col, int depth) {\n int index = round(dot(vec3(row, col, depth),\n vec3(${s}, ${o}, 1)));\n ${sx(e)}\n }\n `;const c=e.shapeInfo.texShape,d=c[0],h=c[1],p=e.shapeInfo.flatOffset;if(h===s&&null==p)return t?`\n float ${r}(int row, int col, int depth) {\n int stride1 = ${i}Shape[2];\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(stride1, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${i}TexShape[1], ${i}TexShape[0]);\n return sampleTexture(${i}, uv);\n }\n `:`\n float ${r}(int row, int col, int depth) {\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(${o}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${h}.0, ${d}.0);\n return sampleTexture(${i}, uv);\n }\n `;if(h===o&&null==p)return t?`\n float ${r}(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(${i}Shape[1], 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${i}TexShape[1], ${i}TexShape[0]);\n return sampleTexture(${i}, uv);\n }\n `:`\n float ${r}(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(${n[1]}, 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${h}.0, ${d}.0);\n return sampleTexture(${i}, uv);\n }\n `;const f=rx(i);if(t)return`\n float ${r}(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int stride0 = ${i}Shape[1] * ${i}Shape[2];\n int stride1 = ${i}Shape[2];\n int index = row * stride0 + col * stride1 + depth + ${f};\n vec2 uv = uvFromFlat(${i}TexShape[0], ${i}TexShape[1], index);\n return sampleTexture(${i}, uv);\n }\n `;return`\n float ${r}(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${s} + col * ${o} + depth + ${f};\n vec2 uv = uvFromFlat(${d}, ${h}, index);\n return sampleTexture(${i}, uv);\n }\n `}(e,t);case 4:return function(e,t){const n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),s=n[3],o=n[2]*s,a=n[1]*o,{newShape:l,keptDims:u}=N.util.squeezeShape(n);if(l.length<n.length){const n=["row","col","depth","depth2"];return`\n ${ZT(lx(e,l),t)}\n float ${r}(int row, int col, int depth, int depth2) {\n return ${r}(${ux(n,u)});\n }\n `}if(e.shapeInfo.isUniform)return`\n float ${r}(int row, int col, int depth, int depth2) {\n int index = round(dot(vec4(row, col, depth, depth2),\n vec4(${a}, ${o}, ${s}, 1)));\n ${sx(e)}\n }\n `;const c=e.shapeInfo.flatOffset,d=e.shapeInfo.texShape,h=d[0],p=d[1],f=`int stride2 = ${i}Shape[3];`,m=`int stride1 = ${i}Shape[2] * stride2;`,g=`int stride0 = ${i}Shape[1] * stride1;`;if(p===a&&null==c)return t?`\n float ${r}(int row, int col, int depth, int depth2) {\n ${f}\n ${m}\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(stride1, stride2, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${i}TexShape[1], ${i}TexShape[0]);\n return sampleTexture(${i}, uv);\n }\n `:`\n float ${r}(int row, int col, int depth, int depth2) {\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(${o}, ${s}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${p}.0, ${h}.0);\n return sampleTexture(${i}, uv);\n }\n `;if(p===s&&null==c)return t?`\n float ${r}(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(${i}Shape[1] * ${i}Shape[2], ${i}Shape[2], 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${i}TexShape[1], ${i}TexShape[0]);\n return sampleTexture(${i}, uv);\n }\n `:`\n float ${r}(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(${n[1]*n[2]}, ${n[2]}, 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${p}.0, ${h}.0);\n return sampleTexture(${i}, uv);\n }\n `;const y=rx(i);if(t)return`\n float ${r}(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n ${f}\n ${m}\n ${g}\n int index = row * stride0 + col * stride1 +\n depth * stride2 + depth2;\n vec2 uv = uvFromFlat(${i}TexShape[0], ${i}TexShape[1], index + ${y});\n return sampleTexture(${i}, uv);\n }\n `;return`\n float ${r}(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${a} + col * ${o} +\n depth * ${s} + depth2;\n vec2 uv = uvFromFlat(${h}, ${p}, index + ${y});\n return sampleTexture(${i}, uv);\n }\n `}(e,t);case 5:return function(e){const t=e.shapeInfo.logicalShape,n=e.name,i="get"+n.charAt(0).toUpperCase()+n.slice(1),r=t[4],s=t[3]*r,o=t[2]*s,a=t[1]*o,{newShape:l,keptDims:u}=N.util.squeezeShape(t);if(l.length<t.length){const t=["row","col","depth","depth2","depth3"];return`\n ${ZT(lx(e,l))}\n float ${i}(int row, int col, int depth, int depth2, int depth3) {\n return ${i}(${ux(t,u)});\n }\n `}if(e.shapeInfo.isUniform)return`\n float ${i}(int row, int col, int depth, int depth2, int depth3) {\n float index = dot(\n vec4(row, col, depth, depth2),\n vec4(${a}, ${o}, ${s}, ${r})) +\n depth3;\n ${sx(e)}\n }\n `;const c=e.shapeInfo.flatOffset,d=e.shapeInfo.texShape,h=d[0],p=d[1];if(p===a&&null==c)return`\n float ${i}(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(${o}, ${s}, ${r}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${p}.0, ${h}.0);\n return sampleTexture(${n}, uv);\n }\n `;if(p===r&&null==c)return`\n float ${i}(int row, int col, int depth, int depth2, int depth3) {\n float texR = dot(\n vec4(row, col, depth, depth2),\n vec4(${t[1]*t[2]*t[3]},\n ${t[2]*t[3]}, ${t[3]}, 1));\n int texC = depth3;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${p}.0, ${h}.0);\n return sampleTexture(${n}, uv);\n }\n `;const f=rx(n);return`\n float ${i}(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 * ${a} + col * ${o} + depth * ${s} +\n depth2 * ${r} + depth3 + ${f};\n vec2 uv = uvFromFlat(${h}, ${p}, index);\n return sampleTexture(${n}, uv);\n }\n `}(e);case 6:return function(e){const t=e.shapeInfo.logicalShape,n=e.name,i="get"+n.charAt(0).toUpperCase()+n.slice(1),{newShape:r,keptDims:s}=N.util.squeezeShape(t);if(r.length<t.length){const t=["row","col","depth","depth2","depth3","depth4"];return`\n ${ZT(lx(e,r))}\n float ${i}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n return ${i}(${ux(t,s)});\n }\n `}const o=t[5],a=t[4]*o,l=t[3]*a,u=t[2]*l,c=t[1]*u;if(e.shapeInfo.isUniform)return`\n float ${i}(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(${c}, ${u}, ${l}, ${a})) +\n dot(\n vec2(depth3, depth4),\n vec2(${o}, 1)));\n ${sx(e)}\n }\n `;const d=e.shapeInfo.flatOffset,h=e.shapeInfo.texShape,p=h[0],f=h[1];if(f===c&&null==d)return`\n float ${i}(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(${u}, ${l}, ${a}, ${o})) +\n float(depth4);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${f}.0, ${p}.0);\n return sampleTexture(${n}, uv);\n }\n `;if(f===o&&null==d)return`\n float ${i}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n float texR = dot(vec4(row, col, depth, depth2),\n vec4(${t[1]*t[2]*t[3]*t[4]},\n ${t[2]*t[3]*t[4]},\n ${t[3]*t[4]},\n ${t[4]})) + float(depth3);\n int texC = depth4;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${f}.0, ${p}.0);\n return sampleTexture(${n}, uv);\n }\n `;const m=rx(n);return`\n float ${i}(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 * ${c} + col * ${u} + depth * ${l} +\n depth2 * ${a} + depth3 * ${o} + depth4 + ${m};\n vec2 uv = uvFromFlat(${p}, ${f}, index);\n return sampleTexture(${n}, uv);\n }\n `}(e);default:throw new Error(`${n.length}-D input sampling is not yet supported`)}}function QT(e,t){switch(e.shapeInfo.logicalShape.length){case 0:return function(e){const t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1),i=jT();return`\n vec4 ${n}() {\n return ${i.texture2D}(${t}, halfCR);\n }\n `}(e);case 1:return function(e,t){const n=e.name,i="get"+n.charAt(0).toUpperCase()+n.slice(1),r=e.shapeInfo.texShape,s=jT();if(t)return`\n vec4 ${i}(int index) {\n ivec2 packedTexShape = ivec2(ceil(float(${n}TexShape[0]) / 2.0), ceil(float(${n}TexShape[1]) / 2.0));\n vec2 uv = packedUVfrom1D(\n packedTexShape[0], packedTexShape[1], index);\n return ${s.texture2D}(${n}, uv);\n }\n `;const o=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)];return`\n vec4 ${i}(int index) {\n vec2 uv = packedUVfrom1D(\n ${o[0]}, ${o[1]}, index);\n return ${s.texture2D}(${n}, uv);\n }\n `}(e,t);case 2:return function(e,t){const n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),s=e.shapeInfo.texShape,o=s[0],a=s[1],l=jT();if(null!=s&&N.util.arraysEqual(n,s))return t?`\n vec4 ${r}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${i}TexShape[1], ${i}TexShape[0]);\n\n return ${l.texture2D}(${i}, uv);\n }\n `:`\n vec4 ${r}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${a}.0, ${o}.0);\n\n return ${l.texture2D}(${i}, uv);\n }\n `;if(t)return`\n vec4 ${r}(int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(${i}TexShape[0]) / 2.0), ceil(float(${i}TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(${i}Shape[1]) / 2.0));\n vec2 uv = packedUVfrom2D(valuesPerRow, packedTexShape[0], packedTexShape[1], row, col);\n return ${l.texture2D}(${i}, uv);\n }\n `;const u=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)],c=Math.ceil(n[1]/2);return`\n vec4 ${r}(int row, int col) {\n vec2 uv = packedUVfrom2D(${c}, ${u[0]}, ${u[1]}, row, col);\n return ${l.texture2D}(${i}, uv);\n }\n `}(e,t);case 3:return function(e,t){const n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),s=e.shapeInfo.texShape,o=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)];if(1===n[0]){const i=[1,2],s=["b","row","col"];return`\n ${QT(lx(e,n.slice(1)),t)}\n vec4 ${r}(int b, int row, int col) {\n return ${r}(${ux(s,i)});\n }\n `}const a=jT();if(t)return`\n vec4 ${r}(int b, int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(${i}TexShape[0]) / 2.0), ceil(float(${i}TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(${i}Shape[2]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(${i}Shape[1]) / 2.0));\n vec2 uv = packedUVfrom3D(\n packedTexShape[0], packedTexShape[1], texelsInBatch, valuesPerRow, b, row, col);\n return ${a.texture2D}(${i}, uv);\n }\n `;const l=o[0],u=o[1],c=Math.ceil(n[2]/2),d=c*Math.ceil(n[1]/2);return`\n vec4 ${r}(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n ${l}, ${u}, ${d}, ${c}, b, row, col);\n return ${a.texture2D}(${i}, uv);\n }\n `}(e,t);default:return function(e,t){const n=e.name,i="get"+n.charAt(0).toUpperCase()+n.slice(1),r=jT();if(t)return`\n vec4 ${i}(int b2, int b, int row, int col) {\n int valuesPerRow = int(ceil(float(${n}Shape[3]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(${n}Shape[2]) / 2.0));\n int index = b * texelsInBatch + (row / 2) * valuesPerRow + (col / 2);\n texelsInBatch *= ${n}Shape[1];\n index = b2 * texelsInBatch + index;\n ivec2 packedTexShape = ivec2(ceil(float(${n}TexShape[0]) / 2.0), ceil(float(${n}TexShape[1]) / 2.0));\n int texR = index / packedTexShape[1];\n int texC = index - texR * packedTexShape[1];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(packedTexShape[1], packedTexShape[0]); return ${r.texture2D}(${n}, uv);\n }\n `;const s=e.shapeInfo.logicalShape,o=s.length,a=e.shapeInfo.texShape,l=[Math.ceil(a[0]/2),Math.ceil(a[1]/2)],u=l[0],c=l[1],d=Math.ceil(s[o-1]/2);let h=d*Math.ceil(s[o-2]/2),p="int b, int row, int col",f=`b * ${h} + (row / 2) * ${d} + (col / 2)`;for(let e=2;e<o-1;e++)p=`int b${e}, `+p,h*=s[o-e-1],f=`b${e} * ${h} + `+f;return`\n vec4 ${i}(${p}) {\n int index = ${f};\n int texR = index / ${c};\n int texC = index - texR * ${c};\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${c}, ${u});\n return ${r.texture2D}(${n}, uv);\n }\n `}(e,t)}}const JT="\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",ex="\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",tx="\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",nx="\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";function ix(){return"\n int getOutputCoords() {\n return 0;\n }\n "}function rx(e){return`offset${e}`}function sx(e){const t=e.name,n=N.util.sizeFromShape(e.shapeInfo.logicalShape);return n<2?`return ${t};`:`\n for (int i = 0; i < ${n}; i++) {\n if (i == index) {\n return ${t}[i];\n }\n }\n `}function ox(e){if(e<=1)return"int";if(2===e)return"ivec2";if(3===e)return"ivec3";if(4===e)return"ivec4";if(5===e)return"ivec5";if(6===e)return"ivec6";throw Error(`GPU for rank ${e} is not yet supported`)}function ax(e,t,n){const{newShape:i,keptDims:r}=N.util.squeezeShape(t),s=t.length,o=e&&3===s&&1===t[0],a=o?t.slice(1):i,l=!e&&s>1&&!N.util.arraysEqual(t,n)&&i.length<s||o;return{useSqueezeShape:l,uniformShape:l?a:t,keptDims:r}}function lx(e,t){const n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function ux(e,t){return t.map(t=>e[t]).join(", ")}function cx(e,t,n){const i=[],r=[];let s,o,a,l=null,u=null;u=e.getUniformLocation(n,"NAN",!1),1===(0,N.env)().getNumber("WEBGL_VERSION")&&(l=e.getUniformLocation(n,"INFINITY",!1));const c=!1;for(const r of t.variableNames){const s={name:r,uniform:e.getUniformLocation(n,r,c),offset:e.getUniformLocation(n,`offset${r}`,c)};t.enableShapeUniforms&&(s.shape=e.getUniformLocation(n,`${r}Shape`,c),s.texShape=e.getUniformLocation(n,`${r}TexShape`,c)),i.push(s)}if(t.enableShapeUniforms&&(s=e.getUniformLocation(n,"outShape",c),a=e.getUniformLocation(n,"outShapeStrides",c),o=e.getUniformLocation(n,"outTexShape",c)),t.customUniforms)for(const i of t.customUniforms)r.push(e.getUniformLocation(n,i.name,c));return{variablesLocations:i,customUniformLocations:r,infLoc:l,nanLoc:u,outShapeLocation:s,outShapeStridesLocation:a,outTexShapeLocation:o}}function dx(e,t){if(e.length!==t.length)throw Error(`Binary was compiled with ${e.length} inputs, but was executed with ${t.length} inputs`);e.forEach((e,n)=>{const i=e.logicalShape,r=t[n],s=r.shape;if(!N.util.arraysEqual(i,s))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${i} and ${s} must match`);if(e.isUniform&&r.isUniform)return;const o=e.texShape,a=r.isUniform?null:r.texData.texShape;if(!N.util.arraysEqual(o,a))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${o} and ${a} must match`)})}function hx(e){return(0,N.env)().getBool("WEBGL_USE_SHAPES_UNIFORMS")&&e<=4}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class px{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=Pb.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=jT();this.outputShape=e,this.enableShapeUniforms=hx(this.outputShape.length),this.userCode=`\n ivec3 outCoordsFromFlatIndex(int index) {\n ${this.enableShapeUniforms?GT(["r","c","d"],e):YT(["r","c","d"],e)}\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getA(rc.x, rc.y, rc.z);\n }\n\n ${t.output} = result;\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class fx{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=Pb.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=jT();this.outputShape=e,this.enableShapeUniforms=hx(this.outputShape.length),this.userCode=`\n ivec3 outCoordsFromFlatIndex(int index) {\n ${this.enableShapeUniforms?GT(["r","c","d"],e):YT(["r","c","d"],e)}\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));\n }\n\n ${t.output} = result;\n }\n `}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class mx{constructor(e){this.variableNames=["A"],this.outTexUsage=Bb.DOWNLOAD;const t=jT();this.outputShape=e,this.userCode=`\n ${XT}\n\n void main() {\n float x = getAAtOutCoords();\n ${t.output} = encode_float(x);\n }\n `}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class gx{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=Bb.DOWNLOAD;const t=jT();this.outputShape=e,this.userCode=`\n ${XT}\n\n void main() {\n ivec3 coords = getOutputCoords();\n float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n ${t.output} = encode_float(x);\n }\n `}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const yx={R:0,G:1,B:2,A:3};class _x{constructor(e,t=!1,n="RGBA"){this.variableNames=["A"],this.customUniforms=[{name:"texShape",type:"ivec2"}];const i=jT();this.outputShape=e,this.enableShapeUniforms=hx(this.outputShape.length);let r="result";t&&(r="floor(result * 255. + 0.5)");let s="";for(let e=0;e<n.length;e++){const t=n[e];s+=`\n if(offset == ${e}) {\n result = values[${yx[t]}];\n }`}this.userCode=`\n ${this.enableShapeUniforms?"\n int getFlatIndex(ivec3 coords) {\n return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n }\n":WT(e)}\n\n void main() {\n ivec3 coords = getOutputCoords();\n int flatIndex = getFlatIndex(coords);\n float result = 0.;\n int offset = imod(flatIndex, ${n.length});\n\n flatIndex = idiv(flatIndex, ${n.length}, 1.);\n\n int r = flatIndex / texShape[1];\n if (r < texShape[0]) {\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n vec4 values = ${i.texture2D}(A, uv);\n ${s}\n }\n ${i.output} = vec4(${r}, 0., 0., 0.);\n }\n `}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class vx{constructor(e,t=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.customUniforms=[{name:"texShape",type:"ivec2"}];const n=jT();this.outputShape=e,this.enableShapeUniforms=hx(this.outputShape.length);let i="",r="result";t&&(r="floor(result * 255. + 0.5)");for(let t=0;t<=1;t++)for(let r=0;r<=1;r++){const s=2*t+r;i+=`\n localCoords = coords;\n if(localCoords[2] + ${r} < ${this.enableShapeUniforms?"outShape[2]":`${e[2]}`}) {\n localCoords[2] += ${r};\n if (localCoords[1] + ${t} < ${this.enableShapeUniforms?"outShape[1]":`${e[1]}`}) {\n localCoords[1] += ${t};\n\n flatIndex = getFlatIndex(localCoords);\n offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n int r = flatIndex / texShape[1];\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n values = ${n.texture2D}(A, uv);\n\n if (offset == 0) {\n result[${s}] = values[0];\n } else if (offset == 1) {\n result[${s}] = values[1];\n } else if (offset == 2) {\n result[${s}] = values[2];\n } else {\n result[${s}] = values[3];\n }\n }\n }\n `}this.userCode=`\n ${this.enableShapeUniforms?"\n int getFlatIndex(ivec3 coords) {\n return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n }\n":WT(e)}\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n vec4 result = vec4(0.);\n int flatIndex, r, c, offset;\n ivec3 localCoords;\n vec2 uv;\n vec4 values;\n\n ${i}\n\n ${n.output} = ${r};\n }\n `}}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function bx(e){const t=jT();return Kb(e,`${t.version}\n precision highp float;\n ${t.attribute} vec3 clipSpacePos;\n ${t.attribute} vec2 uv;\n ${t.varyingVs} vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }`)}function Tx(e){return iT(e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function xx(e){return rT(e,new Uint16Array([0,1,2,2,1,3]))}function Ex(e,t,n,i,r,s){aT(t,n);const o=oT(e),a=e.TEXTURE_2D;return Yb(e,()=>e.bindTexture(a,o)),Yb(e,()=>e.texParameteri(a,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)),Yb(e,()=>e.texParameteri(a,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)),Yb(e,()=>e.texParameteri(a,e.TEXTURE_MIN_FILTER,e.NEAREST)),Yb(e,()=>e.texParameteri(a,e.TEXTURE_MAG_FILTER,e.NEAREST)),1===(0,N.env)().getNumber("WEBGL_VERSION")?Yb(e,()=>e.texImage2D(a,0,i,t,n,0,r,s,null)):Yb(e,()=>e.texStorage2D(a,1,i,t,n)),Yb(e,()=>e.bindTexture(e.TEXTURE_2D,null)),{texture:o,texShape:[n,t]}}function wx(e){return e.internalFormatFloat}function Ix(e,t,n,i){const[r,s]=Ub(t,n);return Ex(e,r,s,wx(i),i.textureFormatFloat,e.FLOAT)}function Ax(e){return e.internalFormatHalfFloat}function Sx(e,t,n,i){const[r,s]=Ub(t,n);return Ex(e,r,s,Ax(i),i.textureFormatFloat,i.textureTypeHalfFloat)}function Cx(e){return e.downloadTextureFormat}function Ox(e,t,n,i){const[r,s]=Ub(t,n);return Ex(e,r,s,Cx(i),e.RGBA,e.UNSIGNED_BYTE)}function Mx(e){return e.internalFormatPackedFloat}function Rx(e,t,n,i){const[r,s]=Vb(t,n);return Ex(e,r,s,Mx(i),e.RGBA,e.FLOAT)}function kx(e){return e.internalFormatPackedHalfFloat}function Nx(e,t,n,i){const[r,s]=Vb(t,n);return Ex(e,r,s,kx(i),e.RGBA,i.textureTypeHalfFloat)}function Dx(e,t,n){Yb(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n));return uT(e,t,"clipSpacePos",n,3,20,0)&&uT(e,t,"uv",n,2,20,12)}function Fx(e,t,n,i,r,s){let o,a,l;Yb(e,()=>e.bindTexture(e.TEXTURE_2D,t)),r instanceof Uint8Array?(o=new Uint8Array(n*i*4),a=e.UNSIGNED_BYTE,l=e.RGBA):(o=new Float32Array(n*i*4),a=e.FLOAT,l=s.internalFormatPackedFloat),o.set(r),2===(0,N.env)().getNumber("WEBGL_VERSION")?Yb(e,()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,i,e.RGBA,a,o)):Yb(e,()=>e.texImage2D(e.TEXTURE_2D,0,l,n,i,0,e.RGBA,a,o)),Yb(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function Lx(e,t,n){Yb(e,()=>e.bindTexture(e.TEXTURE_2D,t)),n.data instanceof Uint8Array?2===(0,N.env)().getNumber("WEBGL_VERSION")?Yb(e,()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n.width,n.height,e.RGBA,e.UNSIGNED_BYTE,n.data)):Yb(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)):2===(0,N.env)().getNumber("WEBGL_VERSION")?Yb(e,()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n)):Yb(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)),Yb(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function Px(e,t,n,i){const r=e.createBuffer();Yb(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,r));const s=16*t*n;return Yb(e,()=>e.bufferData(e.PIXEL_PACK_BUFFER,s,e.STREAM_READ)),Yb(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0)),Yb(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null)),r}function Bx(e,t,n){const i=e,r=new Float32Array(n);return i.bindBuffer(i.PIXEL_PACK_BUFFER,t),i.getBufferSubData(i.PIXEL_PACK_BUFFER,0,r),i.bindBuffer(i.PIXEL_PACK_BUFFER,null),r}function $x(e,t,n,i){const[r,s]=Ub(t,n),o=new Uint8Array(t*n*4);return Yb(e,()=>e.readPixels(0,0,r,s,i.downloadTextureFormat,e.UNSIGNED_BYTE,o)),new Float32Array(o.buffer)}function Ux(e,t,n,i,r,s,o,a){const l=e,u=new Float32Array(function(e,t){const[n,i]=Vb(e,t);return n*i*4}(s,o));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,u),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),u}function zx(e,t,n){const i=new Float32Array(t*n*4);return Yb(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,i)),i}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Vx{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.itemsToPoll=[];const t=(0,N.env)().getNumber("WEBGL_VERSION");if(null!=e?(this.gl=e,Fb(t,e)):this.gl=Lb(t),e=this.gl,2===(0,N.env)().getNumber("WEBGL_VERSION")){const t=e;this.createVertexArray=()=>Yb(t,()=>t.createVertexArray()),this.bindVertexArray=e=>Yb(t,()=>t.bindVertexArray(e)),this.deleteVertexArray=e=>Yb(t,()=>t.deleteVertexArray(e)),this.getVertexArray=()=>Yb(t,()=>t.getParameter(t.VERTEX_ARRAY_BINDING))}else if(null!=e){const t=e.getExtension("OES_vertex_array_object");if(null==t)throw new Error("All WebGL1 implementations are expected to offer OES_vertex_array_object.");this.createVertexArray=()=>Yb(e,()=>t.createVertexArrayOES()),this.bindVertexArray=n=>Yb(e,()=>t.bindVertexArrayOES(n)),this.deleteVertexArray=n=>Yb(e,()=>t.deleteVertexArrayOES(n)),this.getVertexArray=()=>Yb(e,()=>e.getParameter(t.VERTEX_ARRAY_BINDING_OES))}let n="WEBGL_color_buffer_float";const i="EXT_color_buffer_half_float";if(this.parallelCompilationExtension=this.gl.getExtension("KHR_parallel_shader_compile"),1===(0,N.env)().getNumber("WEBGL_VERSION")){const e="OES_texture_float",t="OES_texture_half_float";if(this.textureFloatExtension=qb(this.gl,e),FT(this.gl,t))this.textureHalfFloatExtension=qb(this.gl,t);else if((0,N.env)().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(n),FT(this.gl,i))this.colorBufferHalfFloatExtension=qb(this.gl,i);else if((0,N.env)().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(n="EXT_color_buffer_float",FT(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else{if(!FT(this.gl,i))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension(i)}this.vertexBuffer=Tx(this.gl),this.indexBuffer=xx(this.gl),this.framebuffer=lT(this.gl),this.textureConfig=jb(this.gl,this.textureHalfFloatExtension)}get debug(){return(0,N.env)().getBool("DEBUG")}dispose(){if(this.disposed)return;null!=this.program&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),null!=this.outputTexture&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");const e=this.gl;Yb(e,()=>e.finish()),Yb(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),Yb(e,()=>e.deleteFramebuffer(this.framebuffer)),Yb(e,()=>e.bindBuffer(e.ARRAY_BUFFER,null)),Yb(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),Yb(e,()=>e.deleteBuffer(this.indexBuffer)),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),Ix(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),Sx(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),Ox(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),Lx(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,n,i){this.throwIfDisposed(),Fx(this.gl,e,t,n,i,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),Nx(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),Rx(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(yT(this.gl,this.framebuffer),this.outputTexture=null),Yb(this.gl,()=>this.gl.deleteTexture(e))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n){return this.downloadMatrixDriver(e,()=>$x(this.gl,t,n,this.textureConfig))}downloadPackedMatrixFromBuffer(e,t,n,i,r,s){return Ux(this.gl,e,0,0,0,r,s,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return Bx(this.gl,e,t)}createBufferFromTexture(e,t,n){this.bindTextureToFrameBuffer(e);const i=Px(this.gl,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),i}createAndWaitForFence(){const e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t,n;if((0,N.env)().getBool("WEBGL_FENCE_API_ENABLED")){const i=e,r=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=()=>{const e=i.clientWaitSync(r,0,0);return e===i.ALREADY_SIGNALED||e===i.CONDITION_SATISFIED},t=r}else(0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=()=>this.isQueryAvailable(t,(0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):n=()=>!0;return{query:t,isFencePassed:n}}downloadMatrixFromPackedTexture(e,t,n){return this.downloadMatrixDriver(e,()=>zx(this.gl,t,n))}createProgram(e){this.throwIfDisposed();const t=this.gl;null==this.vertexShader&&(this.vertexShader=bx(t));const n=eT(t);Yb(t,()=>t.attachShader(n,this.vertexShader)),Yb(t,()=>t.attachShader(n,e)),tT(t,n);const i=Object.assign(n,{vao:this.createVertexArray()});return this.debug&&nT(t,i),i}buildVao(e){this.setProgram(e),this.bindVertexArray(e.vao);const t=this.gl;Yb(t,()=>t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer)),Dx(t,e,this.vertexBuffer)}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),null!=e&&(Yb(this.gl,()=>this.gl.deleteProgram(e)),this.deleteVertexArray(e.vao))}setProgram(e){this.throwIfDisposed(),this.program=e,null!=this.program&&this.debug&&nT(this.gl,this.program),Yb(this.gl,()=>this.gl.useProgram(e))}getUniformLocation(e,t,n=!0){return this.throwIfDisposed(),n?hT(this.gl,e,t):pT(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),Yb(this.gl,()=>this.gl.getAttribLocation(e,t))}getUniformLocationNoThrow(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)}setInputMatrixTexture(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),fT(this.gl,e,t,n)}setOutputMatrixTexture(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)}setOutputPackedMatrixTexture(e,t,n){this.throwIfDisposed();const[i,r]=Vb(t,n);this.setOutputMatrixTextureDriver(e,i,r)}setOutputMatrixWriteRegion(e,t,n,i){this.setOutputMatrixWriteRegionDriver(n,e,i,t)}setOutputPackedMatrixWriteRegion(e,t,n,i){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){null!=this.program&&nT(this.gl,this.program),_T(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();const e=this.gl;if(this.debug){const e=this.getVertexArray();console.assert(e===this.program.vao,"VAO changed between setProgram and executeProgram!"),this.debugValidate()}Yb(e,()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),Yb(this.gl,()=>this.gl.finish())}getQueryTimerExtension(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=qb(this.gl,2===(0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(2===(0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){const e=this.gl,t=this.getQueryTimerExtensionWebGL2(),n=e.createQuery();return e.beginQuery(t.TIME_ELAPSED_EXT,n),n}const e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(2===(0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){const e=this.gl,t=this.getQueryTimerExtensionWebGL2();return void e.endQuery(t.TIME_ELAPSED_EXT)}const e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await N.util.repeatedTry(()=>this.disposed||this.isQueryAvailable(e,(0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))),this.getQueryTime(e,(0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(0===t)return null;if(2===t){const t=this.gl;return t.getQueryParameter(e,t.QUERY_RESULT)/1e6}{const t=this.getQueryTimerExtensionWebGL1();return t.getQueryObjectEXT(e,t.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(0===t)return!0;if(2===t){const t=this.gl,n=this.getQueryTimerExtensionWebGL2(),i=t.getQueryParameter(e,t.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),i&&!this.disjoint}{const t=this.getQueryTimerExtensionWebGL1(),n=t.getQueryObjectEXT(e,t.QUERY_RESULT_AVAILABLE_EXT);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(t.GPU_DISJOINT_EXT)),n&&!this.disjoint}}pollFence(e){return new Promise(t=>{this.addItemToPoll(()=>e.isFencePassed(),()=>t())})}pollItems(){const e=function(e){let t=0;for(;t<e.length;++t){if(!e[t]())break}return t-1}(this.itemsToPoll.map(e=>e.isDoneFn));for(let t=0;t<=e;++t){const{resolveFn:e}=this.itemsToPoll[t];e()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){if(this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1)return;let n;"setTimeoutCustom"in(0,N.env)().platform&&(n=(0,N.env)().platform.setTimeoutCustom.bind((0,N.env)().platform)),N.util.repeatedTry(()=>(this.pollItems(),0===this.itemsToPoll.length),()=>0,null,n)}bindTextureToFrameBuffer(e){this.throwIfDisposed(),gT(this.gl,e,this.framebuffer),this.debug&&_T(this.gl)}unbindTextureToFrameBuffer(){null!=this.outputTexture?(gT(this.gl,this.outputTexture,this.framebuffer),this.debug&&_T(this.gl)):yT(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);const n=t();return this.unbindTextureToFrameBuffer(),n}setOutputMatrixTextureDriver(e,t,n){this.throwIfDisposed();const i=this.gl;gT(i,e,this.framebuffer),this.debug&&_T(i),this.outputTexture=e,Yb(i,()=>i.viewport(0,0,t,n)),Yb(i,()=>i.scissor(0,0,t,n))}setOutputMatrixWriteRegionDriver(e,t,n,i){this.throwIfDisposed(),Yb(this.gl,()=>this.gl.scissor(e,t,n,i))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(null==this.program)throw new Error("No GPU program is currently set.")}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const{addImpl:jx,bincountImpl:Yx,bincountReduceImpl:Gx,bitwiseAndImpl:Hx,castImpl:Wx,ceilImpl:Xx,concatImpl:qx,equalImpl:Kx,expImpl:Zx,expm1Impl:Qx,floorImpl:Jx,gatherNdImpl:eE,gatherV2Impl:tE,greaterImpl:nE,greaterEqualImpl:iE,lessImpl:rE,lessEqualImpl:sE,linSpaceImpl:oE,logImpl:aE,maxImpl:lE,maximumImpl:uE,minimumImpl:cE,multiplyImpl:dE,negImpl:hE,notEqualImpl:pE,prodImpl:fE,raggedGatherImpl:mE,raggedRangeImpl:gE,raggedTensorToTensorImpl:yE,rangeImpl:_E,rsqrtImpl:vE,scatterImpl:bE,sigmoidImpl:TE,simpleAbsImpl:xE,sliceImpl:EE,sparseFillEmptyRowsImpl:wE,sparseReshapeImpl:IE,sparseSegmentReductionImpl:AE,sqrtImpl:SE,staticRegexReplaceImpl:CE,stridedSliceImpl:OE,stringNGramsImpl:ME,stringSplitImpl:RE,stringToHashBucketFastImpl:kE,subImpl:NE,tileImpl:DE,topKImpl:FE,transposeImpl:LE,uniqueImpl:PE}=M;
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function BE(e,t){return["x","y","z","w","u","v"].slice(0,t).map(t=>`${e}.${t}`)}function $E(e,t){return 1===t?[e]:BE(e,t)}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class UE{constructor(e){if(this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.enableShapeUniforms=hx(this.outputShape.length),0===this.rank)this.userCode="\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n ";else{const e=$E("rc",this.rank),t=ox(this.rank),n=this.getOutOfBoundsCondition(e),i=this.getSetup(e),r=this.getOutput(e);this.userCode=`\n void main() {\n ${t} rc = getOutputCoords();\n\n if(${n}) {\n setOutput(vec4(0));\n } else {\n ${i}\n\n setOutput(vec4(${r}));\n }\n }\n `}}getSourceCoordsArr(e){const t=[];for(let n=0;n<=1;n++)for(let i=0;i<=1;i++){let r=`${0===n?"r":"rp1"}, ${0===i?"c":"cp1"}`;for(let t=2;t<this.rank;t++)r=`${e[e.length-1-t]},`+r;t.push(r)}return t}getOutOfBoundsCondition(e){if(1===this.rank)return`rc > ${this.enableShapeUniforms?"outShape":this.outputShape[0]}`;let t="";for(let n=this.rank-2;n<this.rank;n++)t+=`${e[n]} >= ${this.enableShapeUniforms?`outShape[${n}]`:this.outputShape[n]}`,n<this.rank-1&&(t+="||");return t}getSetup(e){if(1===this.rank)return"";const t=e.slice(-2),n=this.enableShapeUniforms?`outShape[${this.rank} - 1]`:this.outputShape[this.rank-1],i=this.enableShapeUniforms?`outShape[${this.rank} - 2]`:this.outputShape[this.rank-2];return`\n int r = ${t[0]};\n int c = ${t[1]};\n int rp1 = r + 1;\n int cp1 = c + 1;\n\n bool cEdge = cp1 >= ${n};\n bool rEdge = rp1 >= ${i};\n `}getOutput(e){const t=this.getSourceCoordsArr(e);if(1===this.rank){return`getA(rc), (rc + 1 >= ${this.enableShapeUniforms?"outShape":this.outputShape[0]} ? 0. : getA(rc + 1)), 0, 0`}return`getA(${t[0]}),\n cEdge ? 0. : getA(${t[1]}),\n rEdge ? 0. : getA(${t[2]}),\n rEdge || cEdge ? 0. : getA(${t[3]})`}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class zE{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec3"}],this.outputShape=e,this.enableShapeUniforms=hx(this.outputShape.length);let n="";for(let e=0;e<4;e++){let t="thisRC = rc;";e%2==1&&(t+="thisRC.z += 1;"),e>1&&(t+="thisRC.y += 1;"),n+=`\n ${t}\n ${e>0?"if(thisRC.y < rows && thisRC.z < cols){":""}\n int flatIndex = getFlatIndex(thisRC);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result[${e}] =\n getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n ${e>0?"}":""}\n `}var i,r;this.userCode=`\n ${i=t,r=this.enableShapeUniforms,`\n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n ${r?HT(["r","c","d"],"inputShape"):YT(["r","c","d"],i)}\n return ivec3(r, c, d);\n }\n `}\n ${this.enableShapeUniforms?"\n int getFlatIndex(ivec3 coords) {\n return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n }\n":WT(e)}\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.);\n\n ivec3 thisRC;\n int rows = ${this.enableShapeUniforms?"outShape[1]":e[1]};\n int cols = ${this.enableShapeUniforms?"outShape[2]":e[2]};\n\n ${n}\n\n setOutput(result);\n }\n `}}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class VE{constructor(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.usedTextures={},this.logEnabled=!1}acquireTexture(e,t,n){const i=YE(t,n),r=GE(e,i,n);r in this.freeTextures||(this.freeTextures[r]=[]),r in this.usedTextures||(this.usedTextures[r]=[]);const s=jE(e,i,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[r].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=s,this.log();const e=this.freeTextures[r].pop();return this.usedTextures[r].push(e),e}let o;return i===$b.PACKED_2X2_FLOAT32?o=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):i===$b.PACKED_2X2_FLOAT16?o=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):i===$b.UNPACKED_FLOAT32?o=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):i===$b.UNPACKED_FLOAT16?o=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):i===$b.PACKED_4X1_UNSIGNED_BYTE&&(o=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[r].push(o),this.numUsedTextures++,this._numBytesAllocated+=s,this.log(),o}releaseTexture(e,t,n,i){if(null==this.freeTextures)return;const r=YE(n,i),s=GE(t,r,i);s in this.freeTextures||(this.freeTextures[s]=[]);const o=jE(t,r,this.gpgpu.gl,this.gpgpu.textureConfig,i),a=(0,N.env)().getNumber("WEBGL_DELETE_TEXTURE_THRESHOLD");-1!==a&&this._numBytesAllocated>a?(this.gpgpu.deleteMatrixTexture(e.texture),this._numBytesAllocated-=o):(this.freeTextures[s].push(e),this.numFreeTextures++,this._numBytesFree+=o),this.numUsedTextures--;const l=this.usedTextures[s],u=l&&l.indexOf(e);if(null==u||u<0)throw new Error("Cannot release a texture that was never provided by this texture manager");l[u]=l[l.length-1],l.pop(),this.log()}log(){if(!this.logEnabled)return;const e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",`${this.numFreeTextures} / ${this.numUsedTextures}`,`(${e})`);const t=this._numBytesFree/this._numBytesAllocated;console.log(`Bytes allocated: ${this._numBytesAllocated}`),console.log(`Bytes unused: ${this._numBytesFree} (${Math.round(100*t)}%)`)}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(null!=this.freeTextures){for(const e in this.freeTextures)this.freeTextures[e].forEach(e=>{this.gpgpu.deleteMatrixTexture(e.texture)});for(const e in this.usedTextures)this.usedTextures[e].forEach(e=>{this.gpgpu.deleteMatrixTexture(e.texture)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}}function jE(e,t,n,i,r){const s=function(e,t){switch(e){case $b.PACKED_2X2_FLOAT32:return Mx(t);case $b.PACKED_2X2_FLOAT16:return kx(t);case $b.UNPACKED_FLOAT32:return wx(t);case $b.UNPACKED_FLOAT16:return Ax(t);case $b.PACKED_4X1_UNSIGNED_BYTE:return Cx(t);default:throw new Error(`Unknown physical texture type ${e}`)}}(t,i);let o;if(r){const[t,n]=Vb(e[0],e[1]);o=t*n}else{const[t,n]=Ub(e[0],e[1]);o=t*n}const a=function(e,t){const n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F)return 16;if(t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;if(t===n.RGBA8)return 4;throw new Error(`Unknown internal format ${t}`)}(n,s);return o*a}function YE(e,t){if(e===Bb.UPLOAD)return $b.PACKED_2X2_FLOAT32;if(e===Bb.RENDER||null==e)return function(e){return(0,N.env)().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?$b.PACKED_2X2_FLOAT32:$b.UNPACKED_FLOAT32:e?$b.PACKED_2X2_FLOAT16:$b.UNPACKED_FLOAT16}(t);if(e===Bb.DOWNLOAD||e===Bb.PIXELS)return $b.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${e}`)}function GE(e,t,n){return`${e[0]}_${e[1]}_${t}_${n}`}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class HE{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.enableShapeUniforms=hx(this.outputShape.length),this.userCode=`\n float unaryOperation(float x) {\n ${t}\n }\n\n void main() {\n float x = getAAtOutCoords();\n float y = unaryOperation(x);\n\n setOutput(y);\n }\n `}}const WE="if (isnan(x)) return x;",XE="return abs(x);";const qE=WE+"\n return (x < 0.0) ? 0.0 : x;\n",KE=WE+"\n return (x < 0.0) ? 0.0 : min(6.0, x);\n",ZE="return x;";class QE{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.enableShapeUniforms=hx(this.outputShape.length),this.userCode=`\n vec4 unaryOperation(vec4 x) {\n ${t}\n }\n\n void main() {\n vec4 x = getAAtOutCoords();\n vec4 y = unaryOperation(x);\n\n setOutput(y);\n }\n `}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class JE{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e,this.enableShapeUniforms=hx(this.outputShape.length);const t=e.length,n=$E("rc",t),i=ox(t),r=function(e,t){if(1===e)return"rc";let n="";for(let i=0;i<e;i++)n+=t[i],i<e-1&&(n+=",");return n}(t,n),s=n.slice(-2),o=t<=1?"rc":`vec2(${s.join(",")})`;this.userCode=`\n void main() {\n ${i} rc = getOutputCoords();\n vec4 packedInput = getA(${r});\n\n setOutput(getChannel(packedInput, ${o}));\n }\n `}}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const ew=N.kernel_impls.whereImpl,tw={};const nw=(0,N.env)().getNumber("CPU_HANDOFF_SIZE_THRESHOLD");class iw extends N.KernelBackend{nextDataId(){return iw.nextDataId++}constructor(e){if(super(),this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.lastGlFlushTime=0,this.warnedAboutMemory=!1,this.pendingDeletes=0,this.disposed=!1,!(0,N.env)().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");let t;if(null!=e){if(e instanceof Vx)t=e;else{const n=Lb((0,N.env)().getNumber("WEBGL_VERSION"),e);t=new Vx(n)}this.binaryCache={},this.gpgpuCreatedLocally=!1}else{const e=Lb((0,N.env)().getNumber("WEBGL_VERSION"));t=new Vx(e),this.binaryCache=((n=(0,N.env)().getNumber("WEBGL_VERSION"))in tw||(tw[n]={}),tw[n]),this.gpgpuCreatedLocally=!0}var n;this.gpgpu=t,this.canvas=this.gpgpu.gl.canvas,this.textureManager=new VE(this.gpgpu),this.numMBBeforeWarning=null==(0,N.env)().global.screen?1024:(0,N.env)().global.screen.height*(0,N.env)().global.screen.width*window.devicePixelRatio*600/1024/1024,this.texData=new N.DataStorage(this,(0,N.engine)())}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}writeTexture(e,t,n,i,r,s){const o=this.makeTensorInfo(t,n),a=this.texData.get(o.dataId);a.isPacked=!1,a.texture={texture:e,texShape:[i,r]},a.texShape=[i,r];const l=wT(t),u=new _x(l,!1,s),c=this.runWebGLProgram(u,[o],n,[[i,r]]);return c.shape=t,a.texture=null,this.disposeIntermediateTensorInfo(o),c.dataId}write(e,t,n){if(((0,N.env)().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||(0,N.env)().getBool("DEBUG"))&&this.checkNumericalProblems(e),"complex64"===n&&null!=e)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");const i={id:this.nextDataId()};return this.texData.set(i,{shape:t,dtype:n,values:e,usage:Bb.UPLOAD,refCount:1}),i}refCount(e){if(this.texData.has(e)){return this.texData.get(e).refCount}return 0}incRef(e){this.texData.get(e).refCount++}decRef(e){if(this.texData.has(e)){this.texData.get(e).refCount--}}move(e,t,n,i,r){if((0,N.env)().getBool("DEBUG")&&this.checkNumericalProblems(t),"complex64"===i)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:i,values:t,usage:Bb.UPLOAD,refCount:r})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){const t=this.texData.get(e),{values:n,dtype:i,complexTensorInfos:r,slice:s,shape:o,isPacked:a}=t;if(null!=s){let t;t=a?new QE(o,ZE):new HE(o,ZE);const n=this.runWebGLProgram(t,[{dataId:e,shape:o,dtype:i}],i),r=this.readSync(n.dataId);return this.disposeIntermediateTensorInfo(n),r}if(null!=n)return this.convertAndCacheOnCPU(e);if("string"===i)return n;const l=null!=this.activeTimers;let u,c;if(l&&(u=N.util.now()),"complex64"===i){const e=this.readSync(r.real.dataId),t=this.readSync(r.imag.dataId);c=N.backend_util.mergeRealAndImagArrays(e,t)}else c=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=N.util.now()-u),this.convertAndCacheOnCPU(e,c)}async read(e){if(this.pendingRead.has(e)){const t=this.pendingRead.get(e);return new Promise(e=>t.push(e))}const t=this.texData.get(e),{values:n,shape:i,slice:r,dtype:s,complexTensorInfos:o,isPacked:a}=t;if(null!=r){let t;t=a?new QE(i,ZE):new HE(i,ZE);const n=this.runWebGLProgram(t,[{dataId:e,shape:i,dtype:s}],s),r=this.read(n.dataId);return this.disposeIntermediateTensorInfo(n),r}if(null!=n)return this.convertAndCacheOnCPU(e);if((0,N.env)().getBool("DEBUG")&&!(0,N.env)().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&2===(0,N.env)().getNumber("WEBGL_VERSION"))throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let l,u,c=null;if("complex64"!==s&&(0,N.env)().get("WEBGL_BUFFER_SUPPORTED")){l=this.decode(e);const t=this.texData.get(l.dataId);c=this.gpgpu.createBufferFromTexture(t.texture.texture,...zb(i))}if(this.pendingRead.set(e,[]),"complex64"!==s&&await this.gpgpu.createAndWaitForFence(),"complex64"===s){const e=await Promise.all([this.read(o.real.dataId),this.read(o.imag.dataId)]),t=e[0],n=e[1];u=N.backend_util.mergeRealAndImagArrays(t,n)}else if(null==c)u=this.getValuesFromTexture(e);else{const e=N.util.sizeFromShape(i);u=this.gpgpu.downloadFloat32MatrixFromBuffer(c,e)}if(null!=l&&this.disposeIntermediateTensorInfo(l),null!=c){const e=this.gpgpu.gl;Yb(e,()=>e.deleteBuffer(c))}const d=this.convertAndCacheOnCPU(e,u),h=this.pendingRead.get(e);return this.pendingRead.delete(e),h.forEach(e=>e(d)),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&(0,N.engine)().removeDataId(e,this),this.pendingDeletes--),d}readToGPU(e,t={}){const n=this.texData.get(e),{values:i,shape:r,slice:s,dtype:o,isPacked:a,texture:l}=n;if("complex64"===o)throw new Error("Does not support reading texture for complex64 dtype.");if(null!=s){let n;n=a?new QE(r,ZE):new HE(r,ZE);const i=this.runWebGLProgram(n,[{dataId:e,shape:r,dtype:o}],o),s=this.readToGPU(i,t);return this.disposeIntermediateTensorInfo(i),s}if(null==l)throw null!=i?new Error("Data is not on GPU but on CPU."):new Error("There is no data on GPU or CPU.");const u=this.decode(e,t.customTexShape),c=(0,N.engine)().makeTensorFromTensorInfo(u),d=this.texData.get(u.dataId);return Object.assign({tensorRef:c},d.texture)}bufferSync(e){const t=this.readSync(e.dataId);if("string"===e.dtype)try{const n=t.map(e=>N.util.decodeString(e));return(0,N.buffer)(e.shape,e.dtype,n)}catch(e){throw new Error("Failed to decode encoded string bytes into utf-8")}return(0,N.buffer)(e.shape,e.dtype,t)}checkNumericalProblems(e){if(null!=e)for(let t=0;t<e.length;t++){const n=e[t];if(!Wb(n)){if((0,N.env)().getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))throw Error(`The value ${n} cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'`);throw Error(`The value ${n} cannot be represented on this device.`)}}}getValuesFromTexture(e){const{shape:t,dtype:n,isPacked:i}=this.texData.get(e),r=N.util.sizeFromShape(t);if((0,N.env)().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){const n=this.decode(e),i=this.texData.get(n.dataId),s=this.gpgpu.downloadMatrixFromPackedTexture(i.texture.texture,...zb(t)).subarray(0,r);return this.disposeIntermediateTensorInfo(n),s}const s=(0,N.env)().getBool("WEBGL_PACK")&&!0===i,o=s?wT(t):t,a=s?new gx(o):new mx(o),l=this.runWebGLProgram(a,[{shape:o,dtype:n,dataId:e}],"float32"),u=this.texData.get(l.dataId),c=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(u.texture.texture,u.texShape[0],u.texShape[1]).subarray(0,r);return this.disposeIntermediateTensorInfo(l),c}timerAvailable(){return(0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0}time(e){const t=this.activeTimers,n=[];let i=!1;null==this.programTimersStack?(this.programTimersStack=n,i=!0):this.activeTimers.push(n),this.activeTimers=n,e();const r=N.util.flatten(this.activeTimers.map(e=>e.query)).filter(e=>null!=e),s=N.util.flatten(this.activeTimers.map(e=>e.name)).filter(e=>null!=e);this.activeTimers=t,i&&(this.programTimersStack=null);const o={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};return(async()=>{if((0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){const e=await Promise.all(r);o.kernelMs=N.util.sum(e),o.getExtraProfileInfo=()=>e.map((e,t)=>({name:s[t],ms:e})).map(e=>`${e.name}: ${e.ms}`).join(", ")}else o.kernelMs={error:"WebGL query timers are not supported in this environment."};return this.uploadWaitMs=0,this.downloadWaitMs=0,o})()}memory(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}startTimer(){return(0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:N.util.now(),endMs:null}}endTimer(e){return(0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=N.util.now(),e)}async getQueryTime(e){if((0,N.env)().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);const t=e;return t.endMs-t.startMs}disposeData(e,t=!1){if(this.pendingDisposal.has(e))return!1;if(!this.texData.has(e))return!0;if(t?this.texData.get(e).refCount=0:this.texData.get(e).refCount--,!t&&this.texData.get(e).refCount>0)return!1;if(this.pendingRead.has(e))return this.pendingDisposal.add(e),this.pendingDeletes++,!1;this.releaseGPUData(e);const{complexTensorInfos:n}=this.texData.get(e);return null!=n&&(this.disposeData(n.real.dataId,t),this.disposeData(n.imag.dataId,t)),this.texData.delete(e),!0}releaseGPUData(e){const{texture:t,dtype:n,texShape:i,usage:r,isPacked:s,slice:o}=this.texData.get(e),a=o&&o.origDataId||e,l=this.dataRefCount.get(a);l>1?this.dataRefCount.set(a,l-1):(this.dataRefCount.delete(a),null!=t&&(this.numBytesInGPU-=this.computeBytes(i,n),this.textureManager.releaseTexture(t,i,r,s)));const u=this.texData.get(e);u.texture=null,u.texShape=null,u.isPacked=!1,u.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture.texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e,t=nw){return(0,N.env)().getBool("WEBGL_CPU_FORWARD")&&e.every(e=>null==this.texData.get(e.dataId).texture&&N.util.sizeFromShape(e.shape)<t)}getGPGPUContext(){return this.gpgpu}where(e){N.backend_util.warn("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");const t=e.dataSync();return ew(e.shape,t)}packedUnaryOp(e,t,n){const i=new QE(e.shape,t),r=this.compileAndRun(i,[e],n);return(0,N.engine)().makeTensorFromTensorInfo(r)}abs(e){if(this.shouldExecuteOnCPU([e])&&"complex64"!==e.dtype){const t=xE(this.texData.get(e.dataId).values);return this.makeOutput(e.shape,e.dtype,t)}if((0,N.env)().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,XE,e.dtype);const t=new HE(e.shape,XE),n=this.compileAndRun(t,[e]);return(0,N.engine)().makeTensorFromTensorInfo(n)}makeTensorInfo(e,t,n){let i;if("string"===t&&null!=n&&n.length>0&&N.util.isString(n[0])){const r=n.map(e=>N.util.encodeString(e));i=this.write(r,e,t)}else i=this.write(n,e,t);return this.texData.get(i).usage=null,{dataId:i,shape:e,dtype:t}}makeOutput(e,t,n){return(0,N.engine)().makeTensorFromTensorInfo(this.makeTensorInfo(e,t,n),this)}unpackTensor(e){const t=new JE(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){const t=new UE(e.shape);return this.runWebGLProgram(t,[e],e.dtype,null,!0)}packedReshape(e,t){const n=[xT(e.shape),...ET(e.shape)],i={dtype:e.dtype,shape:n,dataId:e.dataId},r=[xT(t),...ET(t)],s=new zE(r,n),o=[n],a=this.runWebGLProgram(s,[i],e.dtype,o,!0);return{dataId:a.dataId,shape:t,dtype:a.dtype}}decode(e,t){const n=this.texData.get(e),{isPacked:i,shape:r,dtype:s}=n;if(null!=t){const e=N.util.sizeFromShape(r),n=t[0]*t[1]*4;N.util.assert(e<=n,()=>"customTexShape is too small. Row * Column * 4 should be equal or larger than the size of the tensor data.")}const o=wT(r);let a;a=i?new fx(o):new px(o);const l=[null!=t?t:zb(o)];return{dtype:s,shape:r,dataId:this.runWebGLProgram(a,[{shape:o,dtype:s,dataId:e}],s,l,!0,t).dataId}}runWebGLProgram(e,t,n,i,r=!1,s){const o=this.makeTensorInfo(e.outputShape,n),a=this.texData.get(o.dataId);if(e.packedOutput&&(a.isPacked=!0),e.outPackingScheme===Pb.DENSE){const t=null!=s?s:zb(e.outputShape);a.texShape=t.map(e=>2*e)}if(null!=e.outTexUsage&&(a.usage=e.outTexUsage),0===N.util.sizeFromShape(o.shape))return a.values=N.util.getTypedArrayFromDType(o.dtype,0),o;const l=[],u=t.map(t=>{if("complex64"===t.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let n=this.texData.get(t.dataId);if(null==n.texture){if(!e.packedInputs&&N.util.sizeFromShape(t.shape)<=(0,N.env)().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:t.shape,texData:null,isUniform:!0,uniformValues:n.values};e.packedInputs&&(n.isPacked=!0,n.shape=t.shape)}if(this.uploadToGPU(t.dataId),!!n.isPacked!=!!e.packedInputs)t=n.isPacked?this.unpackTensor(t):this.packTensor(t),l.push(t),n=this.texData.get(t.dataId);else if(n.isPacked&&!ST(n.shape,t.shape)){const e=t,i=t.shape;t.shape=n.shape,t=this.packedReshape(t,i),l.push(t),n=this.texData.get(t.dataId),e.shape=i}return{shape:t.shape,texData:n,isUniform:!1}});this.uploadToGPU(o.dataId);const c={shape:o.shape,texData:a,isUniform:!1},d=function(e,t,n){let i="";t.concat(n).forEach(t=>{const r=null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0;if(e.enableShapeUniforms&&!t.isUniform){const s=t.texData.texShape,{useSqueezeShape:o,uniformShape:a,keptDims:l}=ax(e.packedInputs,t.shape,s);let u="",c="",d="";if(1===a.length&&e.packedInputs){const e=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)];u=`${e[0]>1}_${e[1]>1}`}else if(2!==a.length||e.packedInputs){if(a.length>2&&!e.packedInputs){const e=N.util.computeStrides(a);d=`${e[0]===s[1]}_${e[e.length-1]===s[1]}`}}else c=`${a[0]>1}_${a[1]>1}`;const h=t.shape.length,p=2===a.length&&N.util.arraysEqual(t.shape,s),f=1===N.util.sizeFromShape(t.shape),m=N.backend_util.getBroadcastDims(t.shape,n.shape),g=!e.packedInputs&&h===n.shape.length&&N.util.arraysEqual(s,n.texData.texShape),y=e.packedInputs||a.length>2?"":`${s[0]>1}_${s[1]>1}`;i+=`${h}_${g}_${o?l:""}_${a.length}_${f}_${m}_${p}_${u}_${c}_${d}_${y}_${r}`}else{const e=t.isUniform?"uniform":t.texData.texShape;i+=`${t.shape}_${e}_${r}`}});const r=e.userCode;let s=e.constructor.name;return s+="_"+i+"_"+r+`${(0,N.env)().getNumber("WEBGL_VERSION")}`,s}(e,u,c),h=this.getAndSaveBinary(d,()=>
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i){const r=n.map((e,n)=>{const i={logicalShape:e.shape,texShape:e.isUniform?null:e.texData.texShape,isUniform:e.isUniform,isPacked:!e.isUniform&&e.texData.isPacked,flatOffset:null};return null!=e.texData&&null!=e.texData.slice&&e.texData.slice.flatOffset>0&&(i.flatOffset=e.texData.slice.flatOffset),{name:t.variableNames[n],shapeInfo:i}}),s=r.map(e=>e.shapeInfo),o={logicalShape:i.shape,texShape:i.texData.texShape,isUniform:!1,isPacked:i.texData.isPacked,flatOffset:null},a=KT(r,o,t),l=Zb(e.gl,a),u=e.createProgram(l);return(0,N.env)().get("ENGINE_COMPILE_ONLY")?{program:t,fragmentShader:l,source:a,webGLProgram:u,inShapeInfos:s,outShapeInfo:o,variablesLocations:null,customUniformLocations:null,infLoc:null,nanLoc:null,outShapeLocation:null,outShapeStridesLocation:null,outTexShapeLocation:null}:(e.buildVao(u),Object.assign({program:t,fragmentShader:l,source:a,webGLProgram:u,inShapeInfos:s,outShapeInfo:o},cx(e,t,u)))}(this.gpgpu,e,u,c)),p=null!=this.activeTimers;let f;p&&(f=this.startTimer()),(0,N.env)().get("ENGINE_COMPILE_ONLY")||function(e,t,n,i,r){t.program.enableShapeUniforms||(dx(t.inShapeInfos,n),dx([t.outShapeInfo],[i]));const s=i.texData.texture,o=i.texData.texShape;i.texData.isPacked?e.setOutputPackedMatrixTexture(s.texture,o[0],o[1]):e.setOutputMatrixTexture(s.texture,o[0],o[1]),e.setProgram(t.webGLProgram),e.bindVertexArray(t.webGLProgram.vao),1===(0,N.env)().getNumber("WEBGL_VERSION")&&null!==t.infLoc&&e.gl.uniform1f(t.infLoc,1/0),null!==t.nanLoc&&e.gl.uniform1f(t.nanLoc,NaN);for(let i=0;i<n.length;++i){const r=n[i],{uniform:s,offset:o,shape:a,texShape:l}=t.variablesLocations[i];if(a){const{uniformShape:n}=ax(t.program.packedInputs,r.shape,r.texData.texShape);switch(n.length){case 1:e.gl.uniform1iv(a,new Int32Array(n));break;case 2:e.gl.uniform2iv(a,new Int32Array(n));break;case 3:e.gl.uniform3iv(a,new Int32Array(n));break;case 4:e.gl.uniform4iv(a,new Int32Array(n))}}if(l&&e.gl.uniform2i(l,r.texData.texShape[0],r.texData.texShape[1]),null!=s)if(r.isUniform)if(N.util.sizeFromShape(r.shape)<2)e.gl.uniform1f(s,r.uniformValues[0]);else{let t=r.uniformValues;t instanceof Float32Array||(t=new Float32Array(t)),e.gl.uniform1fv(s,t)}else null!=r.texData.slice&&null!=o&&e.gl.uniform1i(o,r.texData.slice.flatOffset),e.setInputMatrixTexture(r.texData.texture.texture,s,i)}const a=t.outShapeLocation;if(a)switch(i.shape.length){case 1:e.gl.uniform1iv(a,new Int32Array(i.shape));break;case 2:e.gl.uniform2iv(a,new Int32Array(i.shape));break;case 3:e.gl.uniform3iv(a,new Int32Array(i.shape));break;case 4:e.gl.uniform4iv(a,new Int32Array(i.shape))}if(t.outShapeStridesLocation){const n=N.util.computeStrides(i.shape);switch(i.shape.length){case 2:e.gl.uniform1iv(t.outShapeStridesLocation,new Int32Array(n));break;case 3:e.gl.uniform2iv(t.outShapeStridesLocation,new Int32Array(n));break;case 4:e.gl.uniform3iv(t.outShapeStridesLocation,new Int32Array(n))}}if(t.outTexShapeLocation&&e.gl.uniform2i(t.outTexShapeLocation,i.texData.texShape[0],i.texData.texShape[1]),t.program.customUniforms&&r)for(let n=0;n<t.program.customUniforms.length;++n){const i=t.program.customUniforms[n],s=t.customUniformLocations[n],o=r[n];if("float"===i.type)e.gl.uniform1fv(s,o);else if("vec2"===i.type)e.gl.uniform2fv(s,o);else if("vec3"===i.type)e.gl.uniform3fv(s,o);else if("vec4"===i.type)e.gl.uniform4fv(s,o);else if("int"===i.type)e.gl.uniform1iv(s,o);else if("ivec2"===i.type)e.gl.uniform2iv(s,o);else if("ivec3"===i.type)e.gl.uniform3iv(s,o);else{if("ivec4"!==i.type)throw Error(`uniform type ${i.type} is not supported yet.`);e.gl.uniform4iv(s,o)}}e.executeProgram()}(this.gpgpu,h,u,c,i),l.forEach(e=>this.disposeIntermediateTensorInfo(e)),p&&(f=this.endTimer(f),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(f)}));const m=(0,N.env)().getNumber("WEBGL_FLUSH_THRESHOLD");if(m>0){const e=N.util.now();e-this.lastGlFlushTime>m&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=e)}if(!(0,N.env)().getBool("WEBGL_LAZILY_UNPACK")&&a.isPacked&&!1===r){const e=this.unpackTensor(o);return this.disposeIntermediateTensorInfo(o),e}return o}compileAndRun(e,t,n,i,r=!1){n=n||t[0].dtype;return this.runWebGLProgram(e,t,n,i,r)}getAndSaveBinary(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){if(!this.disposed){if(!(0,N.env)().getBool("IS_TEST")){Object.keys(this.binaryCache).forEach(e=>{this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram),delete this.binaryCache[e]})}this.textureManager.dispose(),null!=this.canvas&&"undefined"!=typeof HTMLCanvasElement&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0}}floatPrecision(){return null==this.floatPrecisionValue&&(this.floatPrecisionValue=(0,N.tidy)(()=>{if(!(0,N.env)().get("WEBGL_RENDER_FLOAT32_ENABLED")){const e=(0,N.env)().getBool("DEBUG");(0,N.env)().set("DEBUG",!1);const t=this.abs((0,N.scalar)(1e-8)).dataSync()[0];if((0,N.env)().set("DEBUG",e),t>0)return 32}return 16})),this.floatPrecisionValue}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}uploadToGPU(e){const t=this.texData.get(e),{shape:n,dtype:i,values:r,texture:s,usage:o,isPacked:a}=t;if(null!=s)return;const l=null!=this.activeTimers;let u;l&&(u=N.util.now());let c=t.texShape;if(null==c&&(c=IT(n,a),t.texShape=c),null!=r){const e=wT(n);let s,o=c[1],d=c[0];const h=r instanceof Uint8Array||r instanceof Uint8ClampedArray;!a&&h||([o,d]=Vb(c[0],c[1])),s=a?new vx(e,h):new _x(e,h);const p=h?[d,o]:c,f=this.makeTensorInfo(p,i),m=this.texData.get(f.dataId);m.usage=h?Bb.PIXELS:Bb.UPLOAD,m.texShape=p,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(f.dataId),o,d,r);const g=[[d,o]],y=!0,_=this.runWebGLProgram(s,[f],i,g,y),v=this.texData.get(_.dataId);t.texShape=v.texShape,t.isPacked=v.isPacked,t.usage=v.usage,(0,N.env)().get("ENGINE_COMPILE_ONLY")?this.disposeData(_.dataId):(t.texture=v.texture,t.values=null,this.texData.delete(_.dataId)),this.disposeIntermediateTensorInfo(f),l&&(this.uploadWaitMs+=N.util.now()-u)}else{const e=this.acquireTexture(c,o,i,a);t.texture=e}}convertAndCacheOnCPU(e,t){const n=this.texData.get(e),{dtype:i}=n;return null!=t&&(n.values=function(e,t){if("float32"===t||"complex64"===t)return e;if("int32"===t||"bool"===t){const n="int32"===t?new Int32Array(e.length):new Uint8Array(e.length);for(let t=0;t<n.length;++t)n[t]=Math.round(e[t]);return n}throw new Error(`Unknown dtype ${t}`)}(t,i)),n.values}acquireTexture(e,t,n,i){if(this.numBytesInGPU+=this.computeBytes(e,n),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){const e=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(`High memory usage in GPU: ${e} MB, most likely due to a memory leak`)}return this.textureManager.acquireTexture(e,t,i)}computeBytes(e,t){return e[0]*e[1]*N.util.bytesPerElement(t)}checkCompileCompletion(){for(const[,e]of Object.entries(this.binaryCache))this.checkCompletion_(e)}async checkCompileCompletionAsync(){const e=[];if(this.gpgpu.parallelCompilationExtension){for(const[,t]of Object.entries(this.binaryCache))e.push(this.checkCompletionAsync_(t));return Promise.all(e)}for(const[,t]of Object.entries(this.binaryCache)){const n=new Promise(e=>{try{this.checkCompletion_(t),e(!0)}catch(e){throw e}});e.push(n)}return Promise.all(e)}async checkCompletionAsync_(e){return this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.parallelCompilationExtension.COMPLETION_STATUS_KHR)?this.checkCompletion_(e):(await(0,N.nextFrame)(),this.checkCompletionAsync_(e))}checkCompletion_(e){if(!1===this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.gl.LINK_STATUS)){if(console.log(this.gpgpu.gl.getProgramInfoLog(e.webGLProgram)),!1===this.gpgpu.gl.getShaderParameter(e.fragmentShader,this.gpgpu.gl.COMPILE_STATUS))throw Jb(e.source,this.gpgpu.gl.getShaderInfoLog(e.fragmentShader)),new Error("Failed to compile fragment shader.");throw new Error("Failed to link vertex and fragment shaders.")}return!0}getUniformLocations(){for(const e of Object.values(this.binaryCache)){this.gpgpu.buildVao(e.webGLProgram);const{variablesLocations:t,customUniformLocations:n,infLoc:i,nanLoc:r,outShapeLocation:s,outShapeStridesLocation:o,outTexShapeLocation:a}=cx(this.gpgpu,e.program,e.webGLProgram);e.variablesLocations=t,e.customUniformLocations=n,e.infLoc=i,e.nanLoc=r,e.outShapeLocation=s,e.outShapeStridesLocation=o,e.outTexShapeLocation=a}}createTensorFromGPUData(e,t,n){e.channels=e.channels||"RGBA";const{texture:i,height:r,width:s,channels:o}=e,a=(0,N.engine)().backend;if(!a.gpgpu.gl.isTexture(i))throw new Error("The texture is invalid. Also, please make sure the texture and the TFJS WebGL backend are using the same canvas. If you want to use your own custom canvas, you have to create and use the custom TFJS WebGL backend created from the canvas through 'new tf.MathBackendWebGL(customCanvas)'.");const l=a.writeTexture(i,t,n,r,s,o);return(0,N.engine)().makeTensorFromDataId(l,t,n,a)}}iw.nextDataId=0;
/** @license See the LICENSE file. */
const rw="4.22.0";
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function sw(){(0,N.env)().set("WEBGL_FORCE_F16_TEXTURES",!0)}
/**
* @license
* Copyright 2020 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
N.device_util.isBrowser()&&(0,N.registerBackend)("webgl",()=>new iw,2);const ow={forceHalfFloat:sw},aw="\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n";class lw{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=N.backend_util.assertAndGetBroadcastShape(t,n),this.enableShapeUniforms=hx(this.outputShape.length),this.userCode=`\n float binaryOperation(float a, float b) {\n ${e}\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n `}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const uw="\n result.r = isNaN.r ? NAN : result.r;\n result.g = isNaN.g ? NAN : result.g;\n result.b = isNaN.b ? NAN : result.b;\n result.a = isNaN.a ? NAN : result.a;\n";class cw{constructor(e,t,n,i=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=N.backend_util.assertAndGetBroadcastShape(t,n);const r=this.outputShape.length;this.enableShapeUniforms=hx(r);let s="";if(i)if(0===r||1===N.util.sizeFromShape(this.outputShape))s="\n result.y = 0.;\n result.z = 0.;\n result.w = 0.;\n ";else{if(s=`\n ${ox(r)} coords = getOutputCoords();\n `,1===r)this.enableShapeUniforms?s+="\n result.y = (coords + 1) >= outShape ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n ":s+=`\n result.y = (coords + 1) >= ${this.outputShape[0]} ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n `;else{const e=$E("coords",r);this.enableShapeUniforms?s+=`\n bool nextRowOutOfBounds =\n (${e[r-2]} + 1) >= outShape[${r} - 2];\n bool nextColOutOfBounds =\n (${e[r-1]} + 1) >= outShape[${r} - 1];\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n `:s+=`\n bool nextRowOutOfBounds =\n (${e[r-2]} + 1) >= ${this.outputShape[r-2]};\n bool nextColOutOfBounds =\n (${e[r-1]} + 1) >= ${this.outputShape[r-1]};\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n `}}this.userCode=`\n vec4 binaryOperation(vec4 a, vec4 b) {\n ${e}\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n\n vec4 result = binaryOperation(a, b);\n ${s}\n\n setOutput(result);\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function dw(e){const{inputs:t,backend:n}=e,{x:i}=t;return n.incRef(i.dataId),{dataId:i.dataId,shape:i.shape,dtype:i.dtype}}const hw={kernelName:N.Identity,backendName:"webgl",kernelFunc:dw};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function pw(e){const{inputs:t,backend:n}=e,{real:i,imag:r}=t,s=n.makeTensorInfo(i.shape,"complex64"),o=n.texData.get(s.dataId),a=dw({inputs:{x:i},backend:n}),l=dw({inputs:{x:r},backend:n});return o.complexTensorInfos={real:a,imag:l},s}const fw={kernelName:N.Complex,backendName:"webgl",kernelFunc:pw},mw="return (a < 0.) ? b * a : a;",gw="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n";const yw={kernelName:N.LeakyRelu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{alpha:s}=i,o=n.makeTensorInfo([],"float32",N.util.createScalarValue(s,"float32")),a=(0,N.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new cw(gw,r.shape,o.shape):new lw(mw,r.shape,o.shape),l=n.runWebGLProgram(a,[r,o],"float32");return n.disposeIntermediateTensorInfo(o),l}},_w="return (a < 0.) ? b * a : a;",vw="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n";const bw={kernelName:N.Prelu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:i,alpha:r}=t,s=(0,N.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new cw(vw,i.shape,r.shape):new lw(_w,i.shape,r.shape);return n.runWebGLProgram(s,[i,r],"float32")}},Tw="if (isnan(x)) return x;";function xw({opSnippet:e,packedOpSnippet:t,cpuKernelImpl:n,dtype:i}){return({inputs:r,backend:s})=>{const{x:o}=r,a=s,l=i||o.dtype;if(a.shouldExecuteOnCPU([o])&&null!=n){const e=a.texData.get(o.dataId),t=n(e.values,l);return a.makeTensorInfo(o.shape,l,t)}let u;return u=(0,N.env)().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&null!=t?new QE(o.shape,t):new HE(o.shape,e),a.runWebGLProgram(u,[o],l)}}function Ew({opSnippet:e,packedOpSnippet:t,checkOutOfBounds:n=!1,supportsComplex:i=!1,cpuKernelImpl:r,dtype:s}){return({inputs:o,backend:a})=>{const{a:l,b:u}=o,c=a;if(i&&"complex64"===l.dtype){const t=c.texData.get(l.dataId),n=c.texData.get(u.dataId),[i,r]=[[t.complexTensorInfos.real,n.complexTensorInfos.real],[t.complexTensorInfos.imag,n.complexTensorInfos.imag]].map(t=>{const[n,i]=t,r={dataId:n.dataId,dtype:n.dtype,shape:l.shape},s={dataId:i.dataId,dtype:i.dtype,shape:u.shape},o=new lw(e,l.shape,u.shape);return c.runWebGLProgram(o,[r,s],(0,N.upcastType)(n.dtype,i.dtype))}),s=pw({inputs:{real:i,imag:r},backend:c});return c.disposeIntermediateTensorInfo(i),c.disposeIntermediateTensorInfo(r),s}const d=s||(0,N.upcastType)(l.dtype,u.dtype);if(("string"===l.dtype||"string"===u.dtype||c.shouldExecuteOnCPU([l,u]))&&null!=r){const e=c.texData.get(l.dataId).values,t=c.texData.get(u.dataId).values,n="string"===l.dtype?N.backend_util.fromUint8ToStringArray(e):e,i="string"===l.dtype?N.backend_util.fromUint8ToStringArray(t):t,[s,o]=r(l.shape,u.shape,n,i,d),a=c.makeTensorInfo(o,d);return c.texData.get(a.dataId).values=s,a}let h;return h=(0,N.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&null!=t?new cw(t,l.shape,u.shape,n):new lw(e,l.shape,u.shape),c.runWebGLProgram(h,[l,u],d)}}function ww(e,t=!1){if("linear"===e)return"return x;";if("relu"===e)return t?"\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":qE;if("elu"===e)return t?"\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n":"return (x >= 0.0) ? x : (exp(x) - 1.0);";if("relu6"===e)return t?"\n vec4 result = min(x, vec4(6.)) * 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":KE;if("prelu"===e)return t?vw:_w;if("leakyrelu"===e)return t?gw:mw;if("sigmoid"===e)return"return 1.0 / (1.0 + exp(-1.0 * x));";throw new Error(`Activation ${e} has not been implemented for the WebGL backend.`)}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Iw{constructor(e,t,n,i=!1,r=!1,s=!1,o=null,a=!1,l=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n,this.enableShapeUniforms=hx(this.outputShape.length);const u=i?e[1]:e[2],c=Math.ceil(u/2),d=i?"i * 2, rc.y":"rc.y, i * 2",h=r?"rc.z, i * 2":"i * 2, rc.z",p=i?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],f=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"];let m="",g="";o&&(m=a?`vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${o}\n }`:l?`vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${o}\n }`:`vec4 activation(vec4 x) {\n ${o}\n }`,g="result = activation(result);");const y=s?"result += getBiasAtOutCoords();":"";s&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),l&&this.variableNames.push("leakyreluAlpha");let _="rc.x",v="rc.x";e[0]<t[0]?_=`imod(rc.x, ${e[0]})`:t[0]<e[0]&&(v=`imod(rc.x, ${t[0]})`),this.userCode=`\n ${m}\n // Don't use uniform for sharedDimensionPacked for performance.\n const float sharedDimension = ${c}.0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n int batchA = ${_};\n int batchB = ${v};\n for (int i = 0; i < ${c}; i++) {\n vec4 a = getMatrixA(batchA, ${d});\n vec4 b = getMatrixB(batchB, ${h});\n\n // These swizzled products need to be separately added.\n // See: https://github.com/tensorflow/tfjs/issues/1735\n result += (${p[0]} * ${f[0]});\n result += (${p[1]} * ${f[1]});\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();\n vec4 result = dot2x2ARowBCol(rc);\n\n ${y}\n\n ${g}\n\n setOutput(result);\n }\n `}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Aw="return areal * breal - aimag * bimag;",Sw="return areal * bimag + aimag * breal;";class Cw{constructor(e,t,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=N.backend_util.assertAndGetBroadcastShape(t,n),this.userCode=`\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n ${e}\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 `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const Ow="return a * b;";function Mw(e){const{inputs:t,backend:n}=e,{a:i,b:r}=t,s=N.backend_util.upcastType(i.dtype,r.dtype);if("complex64"===i.dtype){const e=n.texData.get(i.dataId),t=n.texData.get(r.dataId),s=new Cw(Aw,i.shape,r.shape),o=new Cw(Sw,i.shape,r.shape),a=[{dataId:e.complexTensorInfos.real.dataId,dtype:e.complexTensorInfos.real.dtype,shape:i.shape},{dataId:e.complexTensorInfos.imag.dataId,dtype:e.complexTensorInfos.imag.dtype,shape:i.shape},{dataId:t.complexTensorInfos.real.dataId,dtype:t.complexTensorInfos.real.dtype,shape:r.shape},{dataId:t.complexTensorInfos.imag.dataId,dtype:t.complexTensorInfos.imag.dtype,shape:r.shape}],l=n.runWebGLProgram(s,a,"float32"),u=n.runWebGLProgram(o,a,"float32"),c=pw({inputs:{real:l,imag:u},backend:n});return n.disposeIntermediateTensorInfo(l),n.disposeIntermediateTensorInfo(u),c}if(n.shouldExecuteOnCPU([i,r])){const e=n.texData.get(i.dataId),t=n.texData.get(r.dataId),[o,a]=dE(i.shape,r.shape,e.values,t.values,s),l=n.makeTensorInfo(a,s);return n.texData.get(l.dataId).values=o,l}let o;return o=(0,N.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new cw(Ow,i.shape,r.shape):new lw(Ow,i.shape,r.shape),n.runWebGLProgram(o,[i,r],s)}const Rw={kernelName:N.Multiply,backendName:"webgl",kernelFunc:Mw};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function kw(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{shape:s}=i,o=n,a=N.util.sizeFromShape(r.shape),l=N.util.inferFromImplicitShape(s,a),u=N.util.sizeFromShape(l);N.util.assert(a===u,()=>`The new shape (${l}) has ${u} elements and the old shape (${r.shape}) has ${a} elements. The new shape and old shape must have the same number of elements.`);const c=o.texData.get(r.dataId);return!c.isPacked||ST(r.shape,l)||null!==c.texture&&ST(c.shape,l)?(o.incRef(r.dataId),{dataId:r.dataId,shape:l,dtype:r.dtype}):
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n){const i=[xT(e.shape),...ET(e.shape)],r={dtype:e.dtype,shape:i,dataId:e.dataId},s=[xT(t),...ET(t)],o=new zE(s,i),a=[i],l=n.runWebGLProgram(o,[r],e.dtype,a,!0);return{dataId:l.dataId,shape:t,dtype:l.dtype}}(r,l,o)}const Nw={kernelName:N.Reshape,backendName:"webgl",kernelFunc:kw};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Dw{constructor(e,t){this.variableNames=["x"];const{windowSize:n,batchSize:i,inSize:r,outSize:s}=e;this.outputShape=[i,s];const o=4*Math.floor(n/4),a=n%4;let l="sumValue += dot(values, ones);";if(null!=t){const e=1/t;l=`sumValue += dot(values * ${N.util.isInt(e)?e.toPrecision(2):e}, ones);`}let u="";r%n>0&&(u=`\n if (inIdx < 0 || inIdx >= ${r}) {\n return 0.0;\n }\n `),this.userCode=`\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ${u}\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 * ${n};\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ${o}; 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 ${l}\n }\n\n int inIdx = inOffset + ${o};\n if (${1===a}) {\n vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);\n\n ${l}\n } else if (${2===a}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1), 0.0, 0.0);\n\n ${l}\n } else if (${3===a}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2), 0.0);\n\n ${l}\n }\n setOutput(sumValue);\n }\n `}}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Fw{constructor(e,t){this.variableNames=["x"];const{windowSize:n,batchSize:i,inSize:r,outSize:s}=e;this.outputShape=[i,s];let o="0.0",a="";"prod"===t?o="1.0":"min"===t?(o="1.0 / 1e-20",a="min"):"max"===t&&(o="-1.0 / 1e-20",a="max");let l=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;"sum"===t?l="sumValue":"prod"===t?l="prodValue":"all"===t?l="allValue":"any"===t&&(l="anyValue");const u=4*Math.floor(n/4),c=n%4;let d=`\n if (${"sum"===t}) {\n sumValue += dot(values, ones);\n } else if (${"prod"===t}) {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = ${a}(values, minMaxValue);\n if (${"min"===t} || ${"max"===t}) {\n minMaxValue = ${a}(values, minMaxValue);\n bvec4 isNaN = isnan(values);\n if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {\n minMaxValue = vec4(NAN);\n }\n }\n }\n `,h="vec4";"all"===t?(o="1.0",d="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",h="bvec4"):"any"===t&&(o="0.0",d="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",h="bvec4");let p="";r%n>0&&(p=`\n if (inIdx < 0 || inIdx >= ${r}) {\n return initializationValue;\n }\n `),this.userCode=`\n const float initializationValue = ${o};\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ${p}\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 * ${n};\n\n vec4 minMaxValue = vec4(${o});\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 < ${u}; i += 4) {\n int inIdx = inOffset + i;\n ${h} values = ${h}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n ${d}\n }\n\n int inIdx = inOffset + ${u};\n if (${1===c}) {\n ${h} values = ${h}(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${d}\n } else if (${2===c}) {\n ${h} values = ${h}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n ${d}\n } else if (${3===c}) {\n ${h} values = ${h}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n ${d}\n }\n setOutput(${l});\n }\n `}}function Lw(e,t,n,i){const r=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const t=[];for(;0===t.length||1!==t[t.length-1].outSize;){const n=t.length?t[t.length-1].outSize:e[1],i=N.backend_util.computeOptimalWindowSize(n);t.push({inSize:n,windowSize:i,outSize:Math.ceil(n/i)})}return t}(e.shape);let s=e;for(let o=0;o<r.length;o++){const{inSize:a,windowSize:l,outSize:u}=r[o];let c,d;c="mean"===n?0===o?new Dw({windowSize:l,inSize:a,batchSize:e.shape[0],outSize:u},a):new Dw({windowSize:l,inSize:a,batchSize:e.shape[0],outSize:u}):new Fw({windowSize:l,inSize:a,batchSize:e.shape[0],outSize:u},n),d=s,s=i.runWebGLProgram(c,[s],t),d.dataId!==e.dataId&&i.disposeIntermediateTensorInfo(d)}return s}
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Pw{constructor(e,t){this.variableNames=["A"];const n=new Array(e.length);for(let i=0;i<n.length;i++)n[i]=e[t[i]];this.outputShape=n,this.rank=n.length;const i=ox(this.rank),r=function(e){const t=e.length;if(t>6)throw Error(`Transpose for rank ${t} is not yet supported`);const n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],i=new Array(t);for(let t=0;t<e.length;t++)i[e[t]]=n[t];return i.join()}(t);this.userCode=`\n void main() {\n ${i} resRC = getOutputCoords();\n setOutput(getA(${r}));\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class Bw{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;const n=new Array(e.length);for(let i=0;i<n.length;i++)n[i]=e[t[i]];if(this.outputShape=n,this.rank=n.length,this.rank>6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);const i=ox(this.rank),r=BE("rc",this.rank),s=new Array(this.rank);for(let e=0;e<t.length;e++)s[t[e]]=r[e];const o=`vec2(${s.slice(-2).join()})`,a=`++${r[this.rank-1]} < ${n[this.rank-1]}`,l=`getChannel(getA(${s.join()}), ${o})`;this.userCode=`\n void main() {\n ${i} rc = getOutputCoords();\n vec4 result = vec4(0.);\n result[0] = ${l};\n if(${a}) {\n result[1] = ${l};\n }\n --${r[this.rank-1]};\n if(++${r[this.rank-2]} < ${n[this.rank-2]}) {\n result[2] = ${l};\n if(${a}) {\n result[3] = ${l};\n }\n }\n setOutput(result);\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function $w(e,t,n){const i=(0,N.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Bw(e.shape,t):new Pw(e.shape,t);return n.runWebGLProgram(i,[e],e.dtype)}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Uw(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i;
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
return function(e,t,n,i){const r=t,s=e.shape.length,o=N.util.parseAxisParam(r,e.shape);let a=o;const l=N.backend_util.getAxesPermutation(a,s),u=null!=l;let c=e;u&&(c=$w(e,l,i),a=N.backend_util.getInnerMostAxes(a.length,s)),N.backend_util.assertAxesAreInnerMostDims("sum",a,s);const[d,h]=N.backend_util.computeOutAndReduceShapes(c.shape,a);let p=d;n&&(p=N.backend_util.expandShapeToKeepDim(d,o));const f=N.util.sizeFromShape(h),m=kw({inputs:{x:c},attrs:{shape:[N.util.sizeFromShape(e.shape)/f,f]},backend:i}),g=Lw(m,(0,N.sumOutType)(e.dtype),"sum",i),y=kw({inputs:{x:g},attrs:{shape:p},backend:i});return i.disposeIntermediateTensorInfo(m),i.disposeIntermediateTensorInfo(g),u&&i.disposeIntermediateTensorInfo(c),y}(r,s,o,n)}const zw={kernelName:N.Sum,backendName:"webgl",kernelFunc:Uw};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function Vw(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{perm:s}=i,o=n,a=r.shape.length,l=new Array(a);for(let e=0;e<l.length;e++)l[e]=r.shape[s[e]];let u;if(o.shouldExecuteOnCPU([r])){const e=o.texData.get(r.dataId).values,t=LE(e,r.shape,r.dtype,s,l);u=o.makeTensorInfo(l,r.dtype);o.texData.get(u.dataId).values=t}else u=$w(r,s,o);return u}const jw={kernelName:N.Transpose,backendName:"webgl",kernelFunc:Vw};function Yw({a:e,b:t,transposeA:n,transposeB:i,backend:r,bias:s=null,preluActivationWeights:o=null,leakyreluAlpha:a=0,activation:l=null}){const u=e.shape.length,c=t.shape.length,d=n?e.shape[u-2]:e.shape[u-1],h=i?t.shape[c-1]:t.shape[c-2],p=n?e.shape[u-1]:e.shape[u-2],f=i?t.shape[c-2]:t.shape[c-1],m=e.shape.slice(0,-2),g=t.shape.slice(0,-2),y=N.util.sizeFromShape(m),_=N.util.sizeFromShape(g),v=N.broadcast_util.assertAndGetBroadcastShape(e.shape.slice(0,-2),t.shape.slice(0,-2)).concat([p,f]);N.util.assert(d===h,()=>`Error in matMul: inner shapes (${d}) and (${h}) of Tensors with shapes ${e.shape} and ${t.shape} and transposeA=${n} and transposeB=${i} must match.`);const b=n?[y,d,p]:[y,p,d],T=i?[_,f,h]:[_,h,f],x=kw({inputs:{x:e},backend:r,attrs:{shape:b}}),E=kw({inputs:{x:t},backend:r,attrs:{shape:T}}),w=[x,E],I=Math.max(y,_),A=n?x.shape[1]:x.shape[2],S=null!=s,C=null!=o,O="leakyrelu"===l,M=null!=l?ww(l,!0):null;let R;if((1===p||1===f)&&A>1e3&&!1===(S||C||O||null!=M)){let e=x,t=E;n&&(e=Vw({inputs:{x},backend:r,attrs:{perm:[0,2,1]}}),w.push(e)),i&&(t=Vw({inputs:{x:E},backend:r,attrs:{perm:[0,2,1]}}),w.push(t));const s=1===f;let o=e;1!==f&&(o=kw({inputs:{x:e},backend:r,attrs:{shape:[I,A,1]}}),w.push(o));const a=1===f?2:1;let l=t;s&&(l=kw({inputs:{x:t},backend:r,attrs:{shape:[I,1,A]}}),w.push(l));const u=Mw({inputs:{a:o,b:l},backend:r});R=Uw({inputs:{x:u},backend:r,attrs:{axis:a,keepDims:!0}}),w.push(u)}else{const l=(0,N.upcastType)(e.dtype,t.dtype),u=new Iw(b,T,[I,p,f],n,i,S,M,C,O),c=[x,E];if(null!=s&&c.push(s),C&&c.push(o),O){const e=r.makeTensorInfo([],"float32",N.util.createScalarValue(a,"float32"));c.push(e),w.push(e)}R=r.runWebGLProgram(u,c,l)}const k=kw({inputs:{x:R},backend:r,attrs:{shape:v}});w.push(R);for(const e of w)r.disposeIntermediateTensorInfo(e);return k}const Gw={kernelName:N._FusedMatMul,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{a:r,b:s,bias:o,preluActivationWeights:a}=t,{transposeA:l,transposeB:u,activation:c,leakyreluAlpha:d}=i;return Yw({a:r,b:s,transposeA:l,transposeB:u,backend:n,bias:o,preluActivationWeights:a,leakyreluAlpha:d,activation:c})}},Hw="return abs(x);";const Ww={kernelName:N.Abs,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:i}=t;if(n.shouldExecuteOnCPU([i])&&"complex64"!==i.dtype){const e=n.texData.get(i.dataId),t=xE(e.values);return n.makeTensorInfo(i.shape,i.dtype,t)}let r;return r=(0,N.env)().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new QE(i.shape,Hw):new HE(i.shape,Hw),n.runWebGLProgram(r,[i],i.dtype)}},Xw=xw({opSnippet:WE+"\n if (abs(x) > 1.) {\n return NAN;\n }\n return acos(x);\n"}),qw={kernelName:N.Acos,backendName:"webgl",kernelFunc:Xw},Kw=xw({opSnippet:WE+"\n if (x < 1.0) return NAN;\nreturn log(x + sqrt(x * x - 1.0));"}),Zw={kernelName:N.Acosh,backendName:"webgl",kernelFunc:Kw},Qw="return a + b;",Jw=Ew({opSnippet:Qw,packedOpSnippet:Qw,supportsComplex:!0,cpuKernelImpl:jx}),eI={kernelName:N.Add,backendName:"webgl",kernelFunc:Jw};
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class tI{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map((e,t)=>`T${t}`);const n=[];this.variableNames.forEach(e=>{n.push(`float v${e} = get${e}AtOutCoords();`)});const i=this.variableNames.map(e=>`v${e}`).join(" + ");this.userCode=`\n void main() {\n ${n.join("\n ")}\n\n float result = ${i};\n setOutput(result);\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class nI{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map((e,t)=>`T${t}`);const n=[];this.variableNames.forEach(e=>{n.push(`vec4 v${e} = get${e}AtOutCoords();`)});const i=this.variableNames.map(e=>`v${e}`).join(" + ");this.userCode=`\n void main() {\n ${n.join("\n ")}\n\n vec4 result = ${i};\n setOutput(result);\n }\n `}}const iI={kernelName:N.AddN,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function e(t){const{inputs:n,backend:i}=t,r=n;if(1===r.length)return dw({inputs:{x:r[0]},backend:i});if(r.length>(0,N.env)().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){const t=Math.floor(r.length/2),n=e({inputs:r.slice(0,t),backend:i}),s=e({inputs:r.slice(t),backend:i});return e({inputs:[n,s],backend:i})}const s=r.map(e=>e.dtype).reduce((e,t)=>(0,N.upcastType)(e,t)),o=r.map(e=>e.shape),a=(0,N.env)().getBool("WEBGL_PACK")?new nI(r[0].shape,o):new tI(r[0].shape,o);return i.runWebGLProgram(a,r,s)}};const rI={kernelName:N.All,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i,a=r.shape.length,l=N.util.parseAxisParam(s,r.shape);let u=l;const c=N.backend_util.getAxesPermutation(u,a);let d=r;null!=c&&(d=Vw({inputs:{x:r},backend:n,attrs:{perm:c}}),u=N.backend_util.getInnerMostAxes(u.length,a)),N.backend_util.assertAxesAreInnerMostDims("all",u,a);const[h,p]=N.backend_util.computeOutAndReduceShapes(d.shape,u),f=kw({inputs:{x:d},backend:n,attrs:{shape:[-1,N.util.sizeFromShape(p)]}}),m=Lw(f,f.dtype,"all",n);let g;if(o){g=kw({inputs:{x:m},backend:n,attrs:{shape:N.backend_util.expandShapeToKeepDim(h,l)}})}else g=kw({inputs:{x:m},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),null!=c&&n.disposeIntermediateTensorInfo(d),g}};const sI={kernelName:N.Any,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i,a=r.shape.length,l=N.util.parseAxisParam(s,r.shape);let u=l;const c=N.backend_util.getAxesPermutation(u,a);let d=r;null!=c&&(d=Vw({inputs:{x:r},backend:n,attrs:{perm:c}}),u=N.backend_util.getInnerMostAxes(u.length,a)),N.backend_util.assertAxesAreInnerMostDims("any",u,a);const[h,p]=N.backend_util.computeOutAndReduceShapes(d.shape,u),f=kw({inputs:{x:d},backend:n,attrs:{shape:[-1,N.util.sizeFromShape(p)]}}),m=Lw(f,f.dtype,"any",n);let g;if(o){g=kw({inputs:{x:m},backend:n,attrs:{shape:N.backend_util.expandShapeToKeepDim(h,l)}})}else g=kw({inputs:{x:m},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),null!=c&&n.disposeIntermediateTensorInfo(d),g}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class oI{constructor(e,t,n){this.variableNames=["A"];const{windowSize:i,batchSize:r,outSize:s}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[r,s];const o="max"===t?">":"<",a=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=`\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ${i};\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < ${i}; i++) {\n int inIdx = ${a};\n float candidate = getA(batch, inIdx);\n if (candidate ${o} bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class aI{constructor(e,t,n,i){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,N.util.assert(e.length>2,()=>`Packed arg${n.charAt(0).toUpperCase()+n.slice(1)} supports only inputs with rank above 2.`);const r=e[e.length-1],s=Math.ceil(r/t);this.outputShape=e.slice(0,-1),s>1&&this.outputShape.push(s),i||this.variableNames.push("bestIndicesA");const o=this.outputShape,a=o.length,l=ox(a),u=$E("coords",a);let c,d;if(1===s){d=a+1;const e=ox(d);c=`\n ${e} sourceLocR = ${e}(${u.join()}, 0);\n ++${u[a-1]};\n ${e} sourceLocG = ${e}(${u.join()}, 0);\n ++${u[a-2]};\n ${e} sourceLocA = ${e}(${u.join()}, 0);\n --${u[a-1]};\n ${e} sourceLocB = ${e}(${u.join()}, 0);\n --${u[a-2]};`}else d=a,c=`\n ${l} sourceLocR = coords;\n ++${u[a-1]};\n ${l} sourceLocG = coords;\n ++${u[a-2]};\n ${l} sourceLocA = coords;\n --${u[a-1]};\n ${l} sourceLocB = coords;\n --${u[a-2]};`;const h=["x","y","z","w","u","v"].slice(0,d),p="."+h[d-1],f=h.map(e=>"int "+e),m=$E("sourceLocR",d-1).concat("inIdx.r"),g=$E("sourceLocG",d-1).concat("inIdx.g"),y=$E("sourceLocB",d-1).concat("inIdx.b"),_=$E("sourceLocA",d-1).concat("inIdx.a"),v="max"===n?"greaterThan":"lessThan",b=i?"":`\n inIdx = round(vec4(getBestIndicesAChannel(${m.join()}),\n getBestIndicesAChannel(${g.join()}),\n getBestIndicesAChannel(${y.join()}),\n getBestIndicesAChannel(${_.join()})));`,T=`vec4(\n getAChannel(${m.join()}),\n hasNextCol ? getAChannel(${g.join()}) : 0.,\n hasNextRow ? getAChannel(${y.join()}) : 0.,\n hasNextRow && hasNextCol ? getAChannel(${_.join()}) : 0.)`,x=i?"":`\n float getBestIndicesAChannel(${f.join()}) {\n return getChannel(getBestIndicesA(${h.join()}),\n vec2(${h.slice(-2).join()}));\n }`;this.userCode=`\n float getAChannel(${f.join()}) {\n return getChannel(getA(${h.join()}),\n vec2(${h.slice(-2).join()}));\n }\n ${x}\n void main() {\n ${l} coords = getOutputCoords();\n bool hasNextCol = ${u[a-1]} < ${o[a-1]-1};\n bool hasNextRow = ${u[a-2]} < ${o[a-2]-1};\n ${c}\n ivec4 srcIdx = ivec4(sourceLocR${p}, sourceLocG${p},\n sourceLocB${p}, sourceLocA${p}) * ${t};\n ivec4 inIdx = srcIdx;\n vec4 bestIndex = vec4(inIdx);\n vec4 bestValue = ${T};\n\n for (int i = 0; i < ${t}; i++) {\n inIdx = srcIdx;\n ${b}\n vec4 candidate = ${T};\n bvec4 nan = isnan(candidate);\n bvec4 replace = bvec4(\n vec4(${v}(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 `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function lI(e,t,n,i=null){let r=t.shape[0],s=t.shape[1];null!=i&&(r=i.shape[0],s=i.shape[1]);const o=N.backend_util.computeOptimalWindowSize(s),a={windowSize:o,inSize:s,batchSize:r,outSize:Math.ceil(s/o)},l=new oI(a,n,null==i),u=[t];null!=i&&u.push(i);const c=e.runWebGLProgram(l,u,"int32");if(1===c.shape[1])return c;const d=lI(e,t,n,c);return e.disposeIntermediateTensorInfo(c),d}function uI(e,t,n,i=null){const r=null!=i?i.shape:t.shape,s=r[r.length-1],o=N.backend_util.computeOptimalWindowSize(s),a=new aI(r,o,n,null==i),l=null==i?[t]:[t,i],u=e.runWebGLProgram(a,l,"int32");if(u.shape.length===t.shape.length){const i=uI(e,t,n,u);return e.disposeIntermediateTensorInfo(u),i}return u}function cI(e,t,n,i){const r=[n];if(N.backend_util.assertAxesAreInnerMostDims("arg"+i.charAt(0).toUpperCase()+i.slice(1),r,t.shape.length),!(0,N.env)().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){const n=[],s=e.texData.get(t.dataId);let o=t;null!==s&&s.isPacked&&(o=e.unpackTensor(t),n.push(o));const[a,l]=N.backend_util.computeOutAndReduceShapes(o.shape,r),u=N.util.sizeFromShape(l),c=kw({inputs:{x:o},backend:e,attrs:{shape:[-1,u]}});n.push(c);const d=lI(e,c,i);n.push(d);const h=kw({inputs:{x:d},backend:e,attrs:{shape:a}});return n.forEach(t=>e.disposeIntermediateTensorInfo(t)),h}return uI(e,t,i)}const dI={kernelName:N.ArgMax,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s}=i;let o=N.util.parseAxisParam(s,r.shape);const a=N.backend_util.getAxesPermutation(o,r.shape.length);let l=r;const u=[];null!=a&&(l=Vw({inputs:{x:r},backend:n,attrs:{perm:a}}),u.push(l),o=N.backend_util.getInnerMostAxes(o.length,l.shape.length)),N.backend_util.assertAxesAreInnerMostDims("argMax",[o[0]],l.shape.length);const c=cI(n,l,o[0],"max");return u.forEach(e=>n.disposeIntermediateTensorInfo(e)),c}};const hI={kernelName:N.ArgMin,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s}=i;let o=N.util.parseAxisParam(s,r.shape);const a=N.backend_util.getAxesPermutation(o,r.shape.length);let l=r;const u=[];null!=a&&(l=Vw({inputs:{x:r},backend:n,attrs:{perm:a}}),u.push(l),o=N.backend_util.getInnerMostAxes(o.length,l.shape.length)),N.backend_util.assertAxesAreInnerMostDims("argMin",[o[0]],l.shape.length);const c=cI(n,l,o[0],"min");return u.forEach(e=>n.disposeIntermediateTensorInfo(e)),c}},pI=xw({opSnippet:WE+"\n if (abs(x) > 1.) {\n return NAN;\n }\n return asin(x);\n"}),fI={kernelName:N.Asin,backendName:"webgl",kernelFunc:pI},mI=xw({opSnippet:WE+"return log(x + sqrt(x * x + 1.0));"}),gI={kernelName:N.Asinh,backendName:"webgl",kernelFunc:mI},yI=xw({opSnippet:WE+"\n return atan(x);\n"}),_I={kernelName:N.Atan,backendName:"webgl",kernelFunc:yI},vI=Ew({opSnippet:aw+"\n return atan(a, b);\n",packedOpSnippet:"\n vec4 result = atan(a, b);\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n "+uw+"\n return result;\n"}),bI={kernelName:N.Atan2,backendName:"webgl",kernelFunc:vI},TI=xw({opSnippet:WE+"\n if ((x < -1.0) || (x > 1.0)) return NAN;\nreturn (log(1.0 + x) - log(1.0 - x)) / 2.0;"}),xI={kernelName:N.Atanh,backendName:"webgl",kernelFunc:TI};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class EI{constructor(e,t,n,i=!1,r=!1){if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");const s=e.filterWidth,o=e.strideHeight,a=e.strideWidth,l=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterHeight,d=e.effectiveFilterWidth,h=e.padInfo.top,p=e.padInfo.left;this.outputShape=e.outShape;const f="avg"===t,m=`((batch * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,g=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`;let y="0.0";if(f||(y="-1.0 / 1e-20"),n){const t=">=";return void(this.userCode=`\n const ivec2 strides = ivec2(${o}, ${a});\n const ivec2 pads = ivec2(${h}, ${p});\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 < ${c};\n wR += ${l}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${d};\n wC += ${u}) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ${e.inWidth}) {\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 ${t} currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ${i?r?m:g:`wR * ${d} + wC`};\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n `)}let _=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;"avg"===t&&(_="avgValue / max(count, 1.0)");const v=4*Math.floor(s/4),b=s%4,T=`\n if (${f}) {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n `;this.userCode=`\n const ivec2 strides = ivec2(${o}, ${a});\n const ivec2 pads = ivec2(${h}, ${p});\n const float initializationValue = ${y};\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 < 0 || xC >= ${e.inWidth}) {\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(${y});\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < ${c};\n wR += ${l}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${v}; wC += 4) {\n int xC = xCCorner + wC * ${u};\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${u}, d),\n getValue(batch, xR, xC + 2 * ${u}, d),\n getValue(batch, xR, xC + 3 * ${u}, d)\n );\n\n ${T}\n }\n\n int xC = xCCorner + ${v};\n if (${1===b}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${T}\n } else if (${2===b}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${u}, d),\n initializationValue,\n initializationValue\n );\n\n ${T}\n } else if (${3===b}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${u}, d),\n getValue(batch, xR, xC + 2 * ${u}, d),\n initializationValue\n );\n\n ${T}\n }\n }\n setOutput(${_});\n }\n `}}class wI{constructor(e,t,n,i=!1,r=!1){if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");const s=e.filterWidth,o=e.strideDepth,a=e.strideHeight,l=e.strideWidth,u=e.dilationDepth,c=e.dilationHeight,d=e.dilationWidth,h=e.effectiveFilterDepth,p=e.effectiveFilterHeight,f=e.effectiveFilterWidth,m=e.padInfo.front,g=e.padInfo.top,y=e.padInfo.left;this.outputShape=e.outShape;const _="avg"===t;let v="0.0";if(_||(v="-1.0 / 1e-20"),n){const t=">=";return void(this.userCode=`\n const ivec3 strides =\n ivec3(${o}, ${a}, ${l});\n const ivec3 pads = ivec3(${m}, ${g}, ${y});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n\n for (int wD = 0; wD < ${h};\n wD += ${u}) {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ${e.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${p};\n wR += ${c}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${f};\n wC += ${d}) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n float value = getX(batch, xD, xR, xC, ch);\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 ${t} currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ${i?r?`(((batch * ${e.inDepth} + xD) * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`((xD * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`wD * ${p} * ${f} +\n wR * ${f} + wC`};\n }\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n `)}let b=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;"avg"===t&&(b="avgValue / max(count, 1.0)");const T=4*Math.floor(s/4),x=s%4,E=`\n if (${_}) {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n `;this.userCode=`\n const ivec3 strides =\n ivec3(${o}, ${a}, ${l});\n const ivec3 pads = ivec3(${m}, ${g}, ${y});\n const float initializationValue = ${v};\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 xD, int xR, int xC, int ch) {\n if (xC < 0 || xC >= ${e.inWidth}) {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xD, xR, xC, ch);\n }\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).\n // ? = to be determined\n vec4 minMaxValue = vec4(${v});\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wD = 0; wD < ${h};\n wD += ${u}) {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ${e.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${p};\n wR += ${c}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${T}; wC += 4) {\n int xC = xCCorner + wC * ${d};\n\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${d}, ch),\n getValue(batch, xD, xR, xC + 2 * ${d}, ch),\n getValue(batch, xD, xR, xC + 3 * ${d}, ch)\n );\n\n ${E}\n }\n\n int xC = xCCorner + ${T};\n if (${1===x}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${E}\n } else if (${2===x}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${d}, ch),\n initializationValue,\n initializationValue\n );\n\n ${E}\n } else if (${3===x}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${d}, ch),\n getValue(batch, xD, xR, xC + 2 * ${d}, ch),\n initializationValue\n );\n\n ${E}\n }\n }\n }\n setOutput(${b});\n }\n `}}const II={kernelName:N.AvgPool,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t;zT(r,"avgPool");const{filterSize:s,strides:o,pad:a,dimRoundingMode:l}=i;N.util.assert(N.backend_util.eitherStridesOrDilationsAreOne(o,1),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${o} and dilations '1'`);const u=N.backend_util.computePool2DInfo(r.shape,s,o,1,a,l);if(1===u.filterWidth&&1===u.filterHeight&&N.util.arraysEqual(u.inShape,u.outShape))return dw({inputs:{x:r},backend:n});const c=new EI(u,"avg",!1);return n.runWebGLProgram(c,[r],"float32")}};const AI={kernelName:N.AvgPool3D,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{filterSize:s,strides:o,pad:a,dimRoundingMode:l,dataFormat:u}=i,c=N.backend_util.computePool3DInfo(r.shape,s,o,[1,1,1],a,l,u),d=new wI(c,"avg",!1);return n.runWebGLProgram(d,[r],"float32")}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class SI{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,i=e.strideHeight,r=e.strideWidth,s=e.dilationHeight,o=e.dilationWidth,a=e.effectiveFilterHeight,l=e.effectiveFilterWidth,u=a-1-e.padInfo.top,c=l-1-e.padInfo.left,d=1/(t*n);this.userCode=`\n const ivec2 pads = ivec2(${u}, ${c});\n const float avgMultiplier = float(${d});\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 < ${a};\n wR += ${s}) {\n float dyR = float(dyRCorner + wR) / ${i}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${l};\n wC+= ${o}) {\n float dyC = float(dyCCorner + wC) / ${r}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 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 `}}class CI{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterDepth,n=e.filterHeight,i=e.filterWidth,r=e.strideDepth,s=e.strideHeight,o=e.strideWidth,a=e.dilationDepth,l=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterDepth,d=e.effectiveFilterHeight,h=e.effectiveFilterWidth,p=c-1-e.padInfo.front,f=d-1-e.padInfo.top,m=h-1-e.padInfo.left,g=1/(t*n*i);this.userCode=`\n const ivec3 pads = ivec3(${p}, ${f}, ${m});\n const float avgMultiplier = float(${g});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ${c};\n wD += ${a}) {\n float dyD = float(dyDCorner + wD) / ${r}.0;\n\n if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ${d};\n wR += ${l}) {\n float dyR = float(dyRCorner + wR) / ${s}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${h};\n wC += ${u}) {\n float dyC = float(dyCCorner + wC) / ${o}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n }\n setOutput(dotProd);\n }\n `}}const OI={kernelName:N.AvgPool3DGrad,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,input:s}=t,o=s,{filterSize:a,strides:l,pad:u,dimRoundingMode:c}=i,d=N.backend_util.computePool3DInfo(o.shape,a,l,[1,1,1],u,c),h=new CI(d);return n.runWebGLProgram(h,[r],o.dtype)}};const MI={kernelName:N.AvgPoolGrad,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,input:s}=t,o=s;zT([r,s],"avgPoolGrad");const{filterSize:a,strides:l,pad:u}=i,c=N.backend_util.computePool2DInfo(o.shape,a,l,1,u),d=new SI(c);return n.runWebGLProgram(d,[r],o.dtype)}};const RI={kernelName:N.BatchMatMul,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{a:r,b:s}=t,{transposeA:o,transposeB:a}=i;return Yw({a:r,b:s,transposeA:o,transposeB:a,backend:n})}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class kI{constructor(e,t,n,i,r,s){this.outputShape=[],this.variableNames=["x","mean","variance"],N.backend_util.assertAndGetBroadcastShape(e,t),N.backend_util.assertAndGetBroadcastShape(e,n);let o="0.0";null!=i&&(N.backend_util.assertAndGetBroadcastShape(e,i),this.variableNames.push("offset"),o="getOffsetAtOutCoords()");let a="1.0";null!=r&&(N.backend_util.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),a="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=`\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = ${o};\n float scale = ${a};\n float inv = scale * inversesqrt(variance + float(${s}));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n `}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class NI{constructor(e,t,n,i,r,s){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],N.backend_util.assertAndGetBroadcastShape(e,t),N.backend_util.assertAndGetBroadcastShape(e,n);let o="vec4(0.0)";null!=i&&(N.backend_util.assertAndGetBroadcastShape(e,i),this.variableNames.push("offset"),o="getOffsetAtOutCoords()");let a="vec4(1.0)";null!=r&&(N.backend_util.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),a="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=`\n void main() {\n vec4 offset = ${o};\n vec4 scale = ${a};\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4(${s}));\n\n setOutput((x - mean) * inv + offset);\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const DI={kernelName:N.FusedBatchNorm,backendName:"webgl",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:i,mean:r,variance:s,offset:o,scale:a}=e;N.util.assert(r.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),N.util.assert(null==o||r.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),N.util.assert(null==a||r.shape.length===a.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let{varianceEpsilon:l}=n;null==l&&(l=.001);const u=[i,r,s];let c=null;null!=o&&(c=o.shape,u.push(o));let d=null;null!=a&&(d=a.shape,u.push(a));const h=(0,N.env)().getBool("WEBGL_PACK_NORMALIZATION")?new NI(i.shape,r.shape,s.shape,c,d,l):new kI(i.shape,r.shape,s.shape,c,d,l);return t.runWebGLProgram(h,u,u[0].dtype)}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class FI{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;const t=ox(this.rank);this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const n=function(e){if(1===e)return"sourceLoc";if(e<=6)return LI.slice(0,e).map(e=>"sourceLoc."+e).join(",");throw Error(`Slicing for rank ${e} is not yet supported`)}(this.rank);let i;i=`\n ${t} sourceLoc;\n ${t} coords = getOutputCoords();\n ${e.map((e,t)=>`sourceLoc.${LI[t]} = start[${t}] + coords.${LI[t]};`).join("\n")}\n `,this.userCode=`\n void main() {\n ${i}\n setOutput(getSource(${n}));\n }\n `}}const LI=["x","y","z","w","u","v"];
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class PI{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const t=ox(this.rank),n=$E("coords",this.rank),i=$E("sourceLoc",this.rank),r=1===this.rank?"sourceLoc":`vec2(${i.slice(-2).join()})`,s=`getChannel(getSource(${i.join()}), ${r})`,o=`\n result.x = ${s};\n if (++${n[this.rank-1]} < ${e[this.rank-1]}) {\n ++${i[this.rank-1]};\n result.y = ${s};\n --${i[this.rank-1]};\n }\n `,a=1===this.rank?"":`\n --${n[this.rank-1]};\n if (++${n[this.rank-2]} < ${e[this.rank-2]}) {\n ++${i[this.rank-2]};\n result.z = ${s};\n if (++${n[this.rank-1]} < ${e[this.rank-1]}) {\n ++${i[this.rank-1]};\n result.w = ${s};\n }\n }\n `,l=this.rank<=4?`sourceLoc = coords +\n ${t}(${e.map((e,t)=>`start[${t}]`).join()});`:e.map((e,t)=>`${i[t]} = ${n[t]} + start[${t}];`).join("\n");this.userCode=`\n void main() {\n ${t} coords = getOutputCoords();\n ${t} sourceLoc;\n ${l}\n vec4 result = vec4(0.);\n ${o}\n ${a}\n setOutput(result);\n }\n `}}function BI(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{begin:s,size:o}=i,[a,l]=N.slice_util.parseSliceParams(r,s,o);if(N.slice_util.assertParamsValid(r,a,l),0===N.util.sizeFromShape(l))return n.makeTensorInfo(l,r.dtype,[]);if(n.shouldExecuteOnCPU([r])||"string"===r.dtype){const e=n.texData.get(r.dataId),t=EE(e.values,a,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,t)}const{isPacked:u}=n.texData.get(r.dataId),c=N.slice_util.isSliceContinous(r.shape,a,l);if(u||!c){const e=(0,N.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new PI(l):new FI(l),t=[a];return n.runWebGLProgram(e,[r],r.dtype,t)}return n.uploadToGPU(r.dataId),
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i){const r=i.texData.get(e.dataId),s=i.makeTensorInfo(n,e.dtype),o=i.texData.get(s.dataId);Object.assign(o,r),o.refCount=1,o.shape=n,o.dtype=e.dtype;let a=N.slice_util.computeFlatOffset(t,N.util.computeStrides(e.shape));r.slice&&(a+=r.slice.flatOffset),o.slice={flatOffset:a,origDataId:r.slice&&r.slice.origDataId||e.dataId};const l=i.dataRefCount.get(o.slice.origDataId)||1;return i.dataRefCount.set(o.slice.origDataId,l+1),s}(r,a,l,n)}const $I={kernelName:N.Slice,backendName:"webgl",kernelFunc:BI},UI={kernelName:N.BatchToSpaceND,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{blockShape:s,crops:o}=i;N.util.assert(r.shape.length<=4,()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");const a=s.reduce((e,t)=>e*t),l=N.backend_util.getReshaped(r.shape,s,a),u=N.backend_util.getPermuted(l.length,s.length),c=N.backend_util.getReshapedPermuted(r.shape,s,a),d=N.backend_util.getSliceBeginCoords(o,s.length),h=N.backend_util.getSliceSize(c,o,s.length),p=[],f=kw({inputs:{x:r},backend:n,attrs:{shape:l}}),m=Vw({inputs:{x:f},backend:n,attrs:{perm:u}}),g=kw({inputs:{x:m},backend:n,attrs:{shape:c}}),y=BI({inputs:{x:g},backend:n,attrs:{begin:d,size:h}});return p.push(f),p.push(m),p.push(g),p.forEach(e=>n.disposeIntermediateTensorInfo(e)),y}};const zI={kernelName:N.Bincount,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,weights:s}=t,{size:o}=i,a=n.readSync(r.dataId),l=n.readSync(s.dataId),u=Yx(a,l,s.dtype,s.shape,o);return n.makeTensorInfo([o],s.dtype,u)}};const VI={kernelName:N.BitwiseAnd,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{a:i,b:r}=t,s=(0,N.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS"),o=(0,N.env)().getNumber("WEBGL_VERSION");if(n.shouldExecuteOnCPU([i,r])||1===o){const e=n.texData.get(i.dataId).values,t=n.texData.get(r.dataId).values,[s,o]=Hx(i.shape,r.shape,e,t,i.dtype),a=n.makeTensorInfo(o,i.dtype);return n.texData.get(a.dataId).values=s,a}let a;return a=s?new cw("\n int r = int(a.r) & int(b.r);\n int g = int(a.g) & int(b.g);\n int rb = int(a.b) & int(b.b);\n int ra = int(a.a) & int(b.a);\n return vec4(r, g, rb, ra);\n",i.shape,r.shape,!1):new lw("\n return float(int(a.r) & int(b.r));\n",i.shape,r.shape),n.runWebGLProgram(a,[i,r],i.dtype)}};const jI={kernelName:N.BroadcastArgs,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{s0:i,s1:r}=t,s=n.readSync(i.dataId),o=n.readSync(r.dataId),a=N.backend_util.assertAndGetBroadcastShape(Array.from(s),Array.from(o));return n.makeTensorInfo([a.length],"int32",Int32Array.from(a))}},YI=Ew({opSnippet:"return float(a != b);",cpuKernelImpl:pE,dtype:"bool"}),GI={kernelName:N.NotEqual,backendName:"webgl",kernelFunc:YI};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function HI(e){const{inputs:t,backend:n}=e,{input:i}=t;return dw({inputs:{x:n.texData.get(i.dataId).complexTensorInfos.real},backend:n})}const WI={kernelName:N.Real,backendName:"webgl",kernelFunc:HI};const XI={kernelName:N.Cast,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function e(t){const{inputs:n,backend:i,attrs:r}=t,{x:s}=n,{dtype:o}=r;if("complex64"===o){if("complex64"===s.dtype)return dw({inputs:{x:s},backend:i});const t=N.zeros(s.shape),n=e({inputs:{x:s},backend:i,attrs:{dtype:"float32"}}),r=pw({inputs:{real:n,imag:t},backend:i});return t.dispose(),i.disposeIntermediateTensorInfo(n),r}if("complex64"===s.dtype){const t=HI({inputs:{input:s},backend:i}),n=e({inputs:{x:t},backend:i,attrs:{dtype:o}});return i.disposeIntermediateTensorInfo(t),n}if(!N.util.hasEncodingLoss(s.dtype,o)){const e=dw({inputs:{x:s},backend:i});return{dataId:e.dataId,shape:e.shape,dtype:o}}if(i.shouldExecuteOnCPU([s])){const e=i.texData.get(s.dataId).values,[t,n,r]=Wx(e,s.shape,s.dtype,o);return i.makeTensorInfo(t,n,r)}if("int32"===o)return function(e,t){const n=new HE(e.shape,"return float(int(x));"),i=t.runWebGLProgram(n,[e],"int32");return{dataId:i.dataId,shape:i.shape,dtype:i.dtype}}(s,i);if("bool"===o){const e=i.makeTensorInfo([],"bool",N.util.getTypedArrayFromDType("bool",1)),t=YI({inputs:{a:s,b:e},backend:i});return i.disposeIntermediateTensorInfo(e),t}throw new Error(`Error in Cast: failed to cast ${s.dtype} to ${o}`)}},qI="return ceil(x);",KI=xw({opSnippet:qI,packedOpSnippet:qI,cpuKernelImpl:Xx}),ZI={kernelName:N.Ceil,backendName:"webgl",kernelFunc:KI};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class QI{constructor(e){this.variableNames=["A"],this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode="\n\n void main() {\n float value = getAAtOutCoords();\n if (isnan(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, minVal, maxVal));\n }\n "}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class JI{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode="\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(minVal), vec4(maxVal)));\n }\n "}}const eA={kernelName:N.ClipByValue,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{clipValueMin:s,clipValueMax:o}=i;let a;a=(0,N.env)().getBool("WEBGL_PACK_CLIP")?new JI(r.shape):new QI(r.shape);const l=[[s],[o]];return n.runWebGLProgram(a,[r],r.dtype,l)}};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class tA{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode="\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 "}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function nA(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}const iA={kernelName:N.ComplexAbs,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:i}=t,r=n.texData.get(i.dataId),s=new tA(i.shape),o=[nA(i,r.complexTensorInfos.real),nA(i,r.complexTensorInfos.imag)];return n.runWebGLProgram(s,o,o[0].dtype)}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class rA{constructor(e){this.outputShape=[],this.outputShape=N.backend_util.computeOutShape(e,1),this.variableNames=e.map((e,t)=>`T${t}`);const t=new Array(e.length-1);t[0]=e[0][1];for(let n=1;n<t.length;n++)t[n]=t[n-1]+e[n][1];const n=[`if (yC < ${t[0]}) setOutput(getT0(yR, yC));`];for(let e=1;e<t.length;e++){const i=t[e-1];n.push(`else if (yC < ${t[e]}) setOutput(getT${e}(yR, yC-${i}));`)}const i=t.length,r=t[t.length-1];n.push(`else setOutput(getT${i}(yR, yC-${r}));`),this.userCode=`\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n ${n.join("\n ")}\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class sA{constructor(e,t){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=N.backend_util.computeOutShape(e,t);const n=this.outputShape,i=n.length,r=ox(i),s=$E("coords",i),o=["x","y","z","w","u","v"].slice(0,i);this.variableNames=e.map((e,t)=>`T${t}`);const a=new Array(e.length-1);a[0]=e[0][t];for(let n=1;n<a.length;n++)a[n]=a[n-1]+e[n][t];const l=o[t],u=o.slice(-2),c=o.join();let d=`if (${l} < ${a[0]}) {\n return getChannel(\n getT0(${c}), vec2(${u.join()}));\n }`;for(let e=1;e<a.length;e++){const t=a[e-1];d+=`\n if (${l} < ${a[e]} && ${l} >= ${a[e-1]}) {\n return getChannel(\n getT${e}(${oA(o,l,t)}),\n vec2(${oA(u,l,t)}));\n }`}const h=a.length,p=a[a.length-1];d+=`\n return getChannel(\n getT${h}(${oA(o,l,p)}),\n vec2(${oA(u,l,p)}));`,this.userCode=`\n float getValue(${o.map(e=>"int "+e)}) {\n ${d}\n }\n\n void main() {\n ${r} coords = getOutputCoords();\n vec4 result = vec4(getValue(${s}), 0., 0., 0.);\n\n ${s[i-1]} = ${s[i-1]} + 1;\n if (${s[i-1]} < ${n[i-1]}) {\n result.g = getValue(${s});\n }\n\n ${s[i-2]} = ${s[i-2]} + 1;\n if (${s[i-2]} < ${n[i-2]}) {\n result.a = getValue(${s});\n }\n\n ${s[i-1]} = ${s[i-1]} - 1;\n if (${s[i-2]} < ${n[i-2]} &&\n ${s[i-1]} < ${n[i-1]}) {\n result.b = getValue(${s});\n }\n setOutput(result);\n }\n `}}function oA(e,t,n){const i=e.indexOf(t);return e.map((e,t)=>t===i?`${e} - ${n}`:e).join()}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function aA(e){const{inputs:t,backend:n}=e,{input:i}=t;return dw({inputs:{x:n.texData.get(i.dataId).complexTensorInfos.imag},backend:n})}const lA={kernelName:N.Imag,backendName:"webgl",kernelFunc:aA};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function uA(e,t,n){const i=e[0].dtype;if("complex64"===i){const i=e.map(e=>HI({inputs:{input:e},backend:n})),r=e.map(e=>aA({inputs:{input:e},backend:n})),s=uA(i,t,n),o=uA(r,t,n),a=pw({inputs:{real:s,imag:o},backend:n});return i.forEach(e=>n.disposeIntermediateTensorInfo(e)),r.forEach(e=>n.disposeIntermediateTensorInfo(e)),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(o),a}let r=n.shouldExecuteOnCPU(e);if("string"===i&&(r=!0),r){const r=e.map(e=>{const i=N.util.sizeFromShape(e.shape.slice(t));return kw({inputs:{x:e},backend:n,attrs:{shape:[-1,i]}})}),s=r.map(e=>({vals:n.readSync(e.dataId),shape:e.shape})),o=N.backend_util.computeOutShape(r.map(e=>e.shape),1),a=1===r[0].shape[0],l=qx(s,o,i,a),u=N.backend_util.computeOutShape(e.map(e=>e.shape),t),c=n.makeTensorInfo(u,i,l);return r.forEach(e=>n.disposeIntermediateTensorInfo(e)),c}const s=e.filter(e=>N.util.sizeFromShape(e.shape)>0),o=(0,N.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&s[0].shape.length>1;if(1===s.length){const t=o?new HE(e[0].shape,ZE):new QE(e[0].shape,ZE);return n.runWebGLProgram(t,e,i)}const a=(0,N.env)().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER");if(s.length>a){const e=[];for(let i=0;i<s.length;i+=a){const r=s.slice(i,i+a);e.push(uA(r,t,n))}const i=uA(e,t,n);for(const t of e)n.disposeIntermediateTensorInfo(t);return i}if(o){const e=new sA(s.map(e=>e.shape),t);return n.runWebGLProgram(e,s,i)}const{tensors2D:l,outShape:u}=function(e,t,n){const i=N.backend_util.computeOutShape(e.map(e=>e.shape),t),r=e.map(e=>kw({inputs:{x:e},attrs:{shape:[-1,N.util.sizeFromShape(e.shape.slice(t))]},backend:n}));return{tensors2D:r,outShape:i}}(s,t,n),c=new rA(l.map(e=>e.shape)),d=n.runWebGLProgram(c,l,i);l.forEach(e=>n.disposeIntermediateTensorInfo(e));const h=kw({inputs:{x:d},attrs:{shape:u},backend:n});return n.disposeIntermediateTensorInfo(d),h}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function cA(e){const{inputs:t,backend:n,attrs:i}=e,{axis:r}=i,s=N.util.parseAxisParam(r,t[0].shape)[0],o=t.map(e=>e.shape);N.backend_util.assertParamsConsistent(o,s);const a=N.backend_util.computeOutShape(t.map(e=>e.shape),s);if(0===N.util.sizeFromShape(a))return n.makeTensorInfo(a,t[0].dtype,[]);const l=t.filter(e=>N.util.sizeFromShape(e.shape)>0);return 1===l.length?dw({inputs:{x:l[0]},backend:n}):uA(l,s,n)}const dA={kernelName:N.Concat,backendName:"webgl",kernelFunc:cA};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class hA{constructor(e,t=!1,n=null,i=!1,r=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;const s=e.padInfo.top,o=e.padInfo.left,a=e.strideHeight,l=e.strideWidth,u=e.dilationHeight,c=e.dilationWidth,d=e.filterHeight,h=e.filterWidth,p=4*Math.floor(e.inChannels/4),f=e.inChannels%4,m="channelsLast"===e.dataFormat,g=m?1:2,y=m?2:3,_=m?3:1;let v="",b="";n&&(v=i?`float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ${n}\n }`:r?`float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ${n}\n }`:`\n float activation(float x) {\n ${n}\n }\n `,b="result = activation(result);");const T=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),i&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n ${v}\n\n const ivec2 strides = ivec2(${a}, ${l});\n const ivec2 pads = ivec2(${s}, ${o});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords[${_}];\n\n ivec2 xRCCorner =\n ivec2(coords[${g}], coords[${y}]) * 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 < ${d}; wR++) {\n int xR = xRCorner + wR * ${u};\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${h}; wC++) {\n int xC = xCCorner + wC * ${c};\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n for (int d1 = 0; d1 < ${p}; d1 += 4) {\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 if (${m}) {\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 dotProd += dot(xValues, wValues);\n } else {\n vec4 xValues = vec4(\n getX(batch, d1, xR, xC),\n getX(batch, d1 + 1, xR, xC),\n getX(batch, d1 + 2, xR, xC),\n getX(batch, d1 + 3, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n\n if (${1===f}) {\n\n if (${m}) {\n dotProd +=\n getX(batch, xR, xC, ${p}) *\n getW(wR, wC, ${p}, d2);\n } else {\n dotProd +=\n getX(batch, ${p}, xR, xC) *\n getW(wR, wC, ${p}, d2);\n }\n\n } else if (${2===f}) {\n vec2 wValues = vec2(\n getW(wR, wC, ${p}, d2),\n getW(wR, wC, ${p} + 1, d2)\n );\n\n if (${m}) {\n vec2 xValues = vec2(\n getX(batch, xR, xC, ${p}),\n getX(batch, xR, xC, ${p} + 1)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec2 xValues = vec2(\n getX(batch, ${p}, xR, xC),\n getX(batch, ${p} + 1, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n } else if (${3===f}) {\n vec3 wValues = vec3(\n getW(wR, wC, ${p}, d2),\n getW(wR, wC, ${p} + 1, d2),\n getW(wR, wC, ${p} + 2, d2)\n );\n\n if (${m}) {\n vec3 xValues = vec3(\n getX(batch, xR, xC, ${p}),\n getX(batch, xR, xC, ${p} + 1),\n getX(batch, xR, xC, ${p} + 2)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec3 xValues = vec3(\n getX(batch, ${p}, xR, xC),\n getX(batch, ${p} + 1, xR, xC),\n getX(batch, ${p} + 2, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n }\n }\n }\n\n float result = dotProd;\n ${T}\n ${b}\n setOutput(result);\n }\n `}}class pA{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const t=e.padInfo.front,n=e.padInfo.top,i=e.padInfo.left,r=e.strideDepth,s=e.strideHeight,o=e.strideWidth,a=e.dilationDepth,l=e.dilationHeight,u=e.dilationWidth,c=e.filterDepth,d=e.filterHeight,h=e.filterWidth,p=4*Math.floor(e.inChannels/4),f=e.inChannels%4;this.userCode=`\n const ivec3 strides = ivec3(${r}, ${s}, ${o});\n const ivec3 pads = ivec3(${t}, ${n}, ${i});\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 < ${c}; wF++) {\n int xF = xFCorner + wF * ${a};\n\n if (xF < 0 || xF >= ${e.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${d}; wR++) {\n int xR = xRCorner + wR * ${l};\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${h}; wC++) {\n int xC = xCCorner + wC * ${u};\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n for (int d1 = 0; d1 < ${p}; 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 (${1===f}) {\n dotProd +=\n getX(batch, xF, xR, xC, ${p}) *\n getW(wF, wR, wC, ${p}, d2);\n } else if (${2===f}) {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, ${p}),\n getX(batch, xF, xR, xC, ${p} + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, ${p}, d2),\n getW(wF, wR, wC, ${p} + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if (${3===f}) {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, ${p}),\n getX(batch, xF, xR, xC, ${p} + 1),\n getX(batch, xF, xR, xC, ${p} + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, ${p}, d2),\n getW(wF, wR, wC, ${p} + 1, d2),\n getW(wF, wR, wC, ${p} + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n `}}
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class fA{constructor(e,t=!1,n=null,i=!1,r=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=hx(this.outputShape.length);const s=e.padInfo.left,o=e.strideWidth,a=e.dilationWidth,l=e.filterHeight,u=e.filterWidth,c=u;let d="\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;";for(let e=0;e<u;e++)d+=`\n vec4 xTexelC${2*e};\n int xTexelC${2*e}Ready;\n vec4 xTexelC${2*e+1};\n int xTexelC${2*e+1}Ready;\n vec4 xC${e};`;d+=`\n for (int r = 0; r < ${l}; r++) {\n for (int d1 = 0; d1 < ${e.inChannels}; d1 += 2) {\n `;for(let e=0;e<u;e++)d+=`\n xTexelC${2*e} = vec4(0.0);\n xTexelC${2*e}Ready = 0;\n xTexelC${2*e+1} = vec4(0.0);\n xTexelC${2*e+1}Ready = 0;\n xC${e} = vec4(0.0);`;d+="\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n ";for(let t=0;t<(c+1)/2;t++){const n=2*t;if(d+=`\n xC = xCCorner + ${n*a};\n `,1===o){if(n<u&&(s%2==1?(d+=`\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${n}Ready == 0) {\n xTexelC${n} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${n}.zw = vec2(0.0);\n }\n xTexelC${n}Ready = 1;\n }\n `,d+=1===a&&n>0?`\n xC${n} = vec4(xTexelC${n-2}.zw, xTexelC${n}.xy);\n `:`\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC${n} = vec4(previous.zw, xTexelC${n}.xy);\n } else {\n xC${n} = vec4(0.0, 0.0, xTexelC${n}.xy);\n }\n `):d+=`\n if (xC >= 0 && xC < inDims[1] && xTexelC${n}Ready == 0) {\n xTexelC${n} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${n}.zw = vec2(0.0);\n }\n xTexelC${n}Ready = 1;\n }\n\n xC${n} = xTexelC${n};\n `,n+1<u)){const e=s%2==0?N.util.nearestLargerEven(a):a;a%2==0&&s%2==1||a%2!=0&&s%2!=1?(d+=`\n xCOffset = xC + imod(pads[1], 2) + ${e};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${n+1}Ready == 0) {\n xTexelC${n+1} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${n+1}.zw = vec2(0.0);\n }\n xTexelC${n+1}Ready = 1;\n }\n `,d+=a>1?`\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n xC${n+1} = vec4(previous.zw, xTexelC${n+1}.xy);\n } else {\n xC${n+1} = vec4(0.0, 0.0, xTexelC${n+1}.xy);\n }\n `:`\n xC${n+1} = vec4(xTexelC${n}.zw, xTexelC${n+1}.xy);\n `):d+=1===e?`\n xC${n+1} = xTexelC${n};\n `:`\n xCOffset = xC + ${e};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${n+1}Ready == 0) {\n xTexelC${n+1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${n+1}.zw = vec2(0.0);\n }\n xTexelC${n+1}Ready = 1;\n }\n\n xC${n+1} = xTexelC${n+1};\n `}}else n<u&&(s%2==1?(d+=`\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${n}Ready == 0) {\n xTexelC${n} = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${n}.zw = vec2(0.0);\n }\n xTexelC${n}Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${n+1}Ready == 0) {\n xTexelC${n+1} = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC${n+1}.zw = vec2(0.0);\n }\n xTexelC${n+1}Ready = 1;\n }\n\n xC${n} = vec4(xTexelC${n}.zw, xTexelC${n+1}.zw);\n `,n+1<u&&(d+=`\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC${n+1} = vec4(xTexelC${n+1}.xy, final.xy);\n `)):(d+=`\n if(xC >= 0 && xC < inDims[1] && xTexelC${n}Ready == 0) {\n xTexelC${n} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${n}.zw = vec2(0.0);\n }\n xTexelC${n}Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${n+1}Ready == 0) {\n xTexelC${n+1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${n+1}.zw = vec2(0.);\n }\n xTexelC${n+1}Ready = 1;\n }\n\n xC${n} = vec4(\n xTexelC${n}.xy, xTexelC${n+1}.xy);\n `,n+1<u&&(d+=`\n xC${n+1} = vec4(xTexelC${n}.zw, xTexelC${n+1}.zw);\n `)));n<u&&(d+=`\n wTexel = getW(r, ${n}, d1, d2);\n dotProd += xC${n}.xxzz * vec4(wTexel.xy, wTexel.xy);\n if(d1 + 1 < ${e.inChannels}) {\n dotProd += xC${n}.yyww * vec4(wTexel.zw, wTexel.zw);\n }\n `,n+1<u&&(d+=`\n wTexel = getW(r, ${n+1}, d1, d2);\n dotProd += xC${n+1}.xxzz * vec4(wTexel.xy, wTexel.xy);\n if(d1 + 1 < ${e.inChannels}) {\n dotProd += xC${n+1}.yyww * vec4(wTexel.zw, wTexel.zw);\n }\n `))}d+="\n }\n ",d+="\n }\n ",d+="\n }\n ";let h="",p="";n&&(h=i?`vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${n}\n }`:r?`vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${n}\n }`:`vec4 activation(vec4 x) {\n ${n}\n }`,p="result = activation(result);");const f=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),i&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n ${h}\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 xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ${d}\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ${f}\n ${p}\n setOutput(result);\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class mA{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec4"},{name:"pad",type:"ivec2"},{name:"stride",type:"ivec2"},{name:"dilation",type:"ivec2"},{name:"inChannels",type:"int"},{name:"itemsPerBlockRow",type:"int"},{name:"outWidth",type:"int"}],this.outputShape=e,this.enableShapeUniforms=hx(this.outputShape.length);const{dataFormat:n}=t,i=jT(),r="channelsLast"===n,s=r?1:2,o=r?2:3,a=this.enableShapeUniforms?"if(blockIndex < outShape[2] && pos < outShape[1]) {":`if(blockIndex < ${e[2]} && pos < ${e[1]}) {`;let l="";for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)l+=`\n blockIndex = rc.z + ${t};\n pos = rc.y + ${e};\n\n ${a}\n offsetY = int(blockIndex / outWidth) * stride[0] - pad[0];\n d0 = offsetY + dilation[0] * (pos / itemsPerBlockRow);\n\n if(d0 < inputShape[${s}] && d0 >= 0) {\n // Use custom imod instead mod. On Intel GPU, mod may generate\n // unexpected value.\n // https://github.com/tensorflow/tfjs/issues/5447\n offsetX = imod(blockIndex, outWidth) * stride[1] - pad[1];\n d1 = offsetX + dilation[1] * (imod(pos, itemsPerBlockRow) /\n inChannels);\n\n if(d1 < inputShape[${o}] && d1 >= 0) {\n\n ch = imod(pos, inChannels);\n\n if (${r}) {\n innerDims = vec2(d1, ch);\n result[${2*e+t}] = getChannel(\n getA(rc.x, d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n } else {\n innerDims = vec2(d0, d1);\n result[${2*e+t}] = getChannel(\n getA(rc.x, ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n }\n `;this.userCode=`\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0);\n\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n\n ${l}\n\n ${i.output} = result;\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function gA(e,t){const n=e.length;return n>=3?t?[...e.slice(0,-3),e[n-3]*e[n-2],e[n-1]]:[...e.slice(0,-3),e[n-3],e[n-2]*e[n-1]]:!t&&1===n&&e[0]>1?[e[0],1]:null}function yA({x:e,filter:t,convInfo:n,backend:i,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:o=0,activation:a=null}){const l=e.shape,u=i.texData.get(e.dataId),c=n.inChannels,d=l[0]*l[1]*l[2],h=n.outChannels,p="channelsLast"===n.dataFormat,f=!1;let m;const g=[];if(null!=s){const e=gA(s.shape,p);null!=e&&(s=kw({inputs:{x:s},backend:i,attrs:{shape:e}}),g.push(s))}if(null!=r){const e=gA(r.shape,p);null!=e&&(r=kw({inputs:{x:r},backend:i,attrs:{shape:e}}),g.push(r))}if(!((1===d||1===h)&&c>1e3)&&u.isPacked&&p&&null!=u.texture&&l[2]%2!=0&&N.util.arraysEqual(u.shape.slice(-3),l.slice(-3))){const c=l[0]*l[1]*(l[2]+1),d={dataId:e.dataId,shape:[1,c,n.inChannels],dtype:e.dtype},h=u.shape;u.shape=u.shape.slice(),u.shape[u.shape.length-2]++,N.util.assert(ST(u.shape,d.shape),()=>`packed reshape ${u.shape} to ${d.shape} isn't free`);const p=kw({inputs:{x:t},backend:i,attrs:{shape:[1,n.inChannels,n.outChannels]}});g.push(p);const y=Yw({a:d,b:p,backend:i,transposeA:false,transposeB:f,bias:r,activation:a,preluActivationWeights:s,leakyreluAlpha:o}),_=i.texData.get(y.dataId);N.util.assert(_.isPacked,()=>"batchMatMul result is expected to be packed"),u.shape=h,_.shape=n.outShape,m=dw({inputs:{x:y},backend:i}),m.shape=n.outShape,g.push(y)}else{const l=n.outHeight*n.outWidth,u=kw({inputs:{x:e},backend:i,attrs:{shape:p?[n.batchSize,l,n.inChannels]:[n.batchSize,n.inChannels,l]}}),c=kw({inputs:{x:t},backend:i,attrs:{shape:[1,n.inChannels,n.outChannels]}}),d=Yw({a:p?u:c,b:p?c:u,transposeA:!p,transposeB:f,backend:i,bias:r,activation:a,preluActivationWeights:s,leakyreluAlpha:o});m=kw({inputs:{x:d},backend:i,attrs:{shape:n.outShape}}),g.push(u),g.push(c),g.push(d)}for(const e of g)i.disposeIntermediateTensorInfo(e);return m}function _A({x:e,filter:t,convInfo:n,backend:i,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:o=0,activation:a=null}){const{filterWidth:l,filterHeight:u,inChannels:c,outWidth:d,outHeight:h,dataFormat:p}=n,f="channelsLast"===p,m=l*u*c,g=h*d,y=[n.batchSize,m,g],_=[];if(null!=s){const e=gA(s.shape,f);null!=e&&(s=kw({inputs:{x:s},backend:i,attrs:{shape:e}}),_.push(s))}if(null!=r){const e=gA(r.shape,f);null!=e&&(r=kw({inputs:{x:r},backend:i,attrs:{shape:e}}),_.push(r))}const v=kw({inputs:{x:t},backend:i,attrs:{shape:[1,m,N.util.sizeFromShape(t.shape)/m]}});_.push(v);const b=new mA(y,n),T=[e.shape,[n.padInfo.top,n.padInfo.left],[n.strideHeight,n.strideWidth],[n.dilationHeight,n.dilationWidth],[n.inChannels],[n.filterWidth*n.inChannels],[n.outWidth]],x=i.runWebGLProgram(b,[e],"float32",T),E=kw({inputs:{x},backend:i,attrs:{shape:y}});_.push(x),_.push(E);const w=null!=r,I=null!=s,A="leakyrelu"===a,S=a?ww(a,!0):null,C=new Iw(f?E.shape:v.shape,f?v.shape:E.shape,f?[n.batchSize,g,n.outChannels]:[n.batchSize,n.outChannels,g],!0,!1,w,S,I,A),O=f?[E,v]:[v,E];if(r&&O.push(r),I&&O.push(s),A){const e=i.makeTensorInfo([],"float32",N.util.createScalarValue(o,"float32"));O.push(e),_.push(e)}const M=i.runWebGLProgram(C,O,"float32"),R=kw({inputs:{x:M},backend:i,attrs:{shape:n.outShape}});_.push(M);for(const e of _)i.disposeIntermediateTensorInfo(e);return R}const vA={kernelName:N.Conv2D,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s}=t,{strides:o,pad:a,dataFormat:l,dilations:u,dimRoundingMode:c}=i,d=N.backend_util.convertConv2DDataFormat(l),h=N.backend_util.computeConv2DInfo(r.shape,s.shape,o,u,a,c,!1,d);let p;if(1!==h.filterHeight||1!==h.filterWidth||1!==h.dilationHeight||1!==h.dilationWidth||1!==h.strideHeight||1!==h.strideWidth||"SAME"!==h.padInfo.type&&"VALID"!==h.padInfo.type)if(h.strideWidth<=2&&"channelsLast"===d&&(0,N.env)().getBool("WEBGL_EXP_CONV")){const e=new fA(h),t=[[h.padInfo.top,h.padInfo.left],[h.strideHeight,h.strideWidth],[h.dilationHeight,h.dilationWidth],[h.inHeight,h.inWidth]];p=n.runWebGLProgram(e,[r,s],"float32",t)}else if((0,N.env)().getBool("WEBGL_CONV_IM2COL"))p=_A({x:r,filter:s,convInfo:h,backend:n});else{const e=new hA(h);p=n.runWebGLProgram(e,[r,s],"float32")}else p=yA({x:r,filter:s,convInfo:h,backend:n});const f=kw({inputs:{x:p},backend:n,attrs:{shape:h.outShape}});return n.disposeIntermediateTensorInfo(p),f}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class bA{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,n=e.strideWidth,i=e.padInfo.top,r=e.padInfo.left,s="channelsLast"===e.dataFormat;this.userCode=`\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 < ${e.batchSize}; b++) {\n for (int yR = 0; yR < ${e.outHeight}; yR++) {\n int xR = wR + yR * ${t} - ${i};\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${e.outWidth}; yC++) {\n int xC = wC + yC * ${n} - ${r};\n\n if (xC < 0 || xC >= ${e.inWidth}) {\n continue;\n }\n\n ${s?"float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);":"float dyValue = getDy(b, d2, yR, yC);\n float xValue = getX(b, d1, xR, xC);\n dotProd += (xValue * dyValue);"}\n }\n }\n }\n setOutput(dotProd);\n }\n `}}class TA{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,i=e.strideHeight,r=e.strideWidth,s="channelsLast"===e.dataFormat,o=t-1-e.padInfo.top,a=n-1-e.padInfo.left,l=s?1:2,u=s?2:3,c=s?3:1;this.userCode=`\n const ivec2 pads = ivec2(${o}, ${a});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[${c}];\n\n ivec2 dyCorner = ivec2(coords[${l}], coords[${u}]) - 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 < ${t}; wR++) {\n float dyR = float(dyRCorner + wR) / ${i}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${t} - 1 - wR;\n\n for (int wC = 0; wC < ${n}; wC++) {\n float dyC = float(dyCCorner + wC) / ${r}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${n} - 1 - wC;\n\n for (int d2 = 0; d2 < ${e.outChannels}; d2++) {\n\n if (${s}) {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n } else {\n float xValue = getDy(batch, d2, idyR, idyC);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n `}}class xA{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideDepth,n=e.strideHeight,i=e.strideWidth,r=e.padInfo.front,s=e.padInfo.top,o=e.padInfo.left;this.userCode=`\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 < ${e.batchSize}; b++) {\n for (int yF = 0; yF < ${e.outDepth}; yF++) {\n int xF = wF + yF * ${t} - ${r};\n\n if (xF < 0 || xF >= ${e.inDepth}) {\n continue;\n }\n\n for (int yR = 0; yR < ${e.outHeight}; yR++) {\n int xR = wR + yR * ${n} - ${s};\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${e.outWidth}; yC++) {\n int xC = wC + yC * ${i} - ${o};\n\n if (xC < 0 || xC >= ${e.inWidth}) {\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 `}}class EA{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterDepth,n=e.filterHeight,i=e.filterWidth,r=e.strideDepth,s=e.strideHeight,o=e.strideWidth,a=t-1-e.padInfo.front,l=n-1-e.padInfo.top,u=i-1-e.padInfo.left;this.userCode=`\n const ivec3 pads = ivec3(${a}, ${l}, ${u});\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 < ${t}; wF++) {\n float dyF = float(dyFCorner + wF) / ${r}.0;\n\n if (dyF < 0.0 || dyF >= ${e.outDepth}.0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = ${t} - 1 - wF;\n\n for (int wR = 0; wR < ${n}; wR++) {\n float dyR = float(dyRCorner + wR) / ${s}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${n} - 1 - wR;\n\n for (int wC = 0; wC < ${i}; wC++) {\n float dyC = float(dyCCorner + wC) / ${o}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${i} - 1 - wC;\n\n for (int d2 = 0; d2 < ${e.outChannels}; 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 `}}const wA={kernelName:N.Conv2DBackpropFilter,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,dy:s}=t,{strides:o,pad:a,dataFormat:l,dimRoundingMode:u,filterShape:c}=i,d=N.backend_util.convertConv2DDataFormat(l),h=N.backend_util.computeConv2DInfo(r.shape,c,o,1,a,u,!1,d),p=new bA(h);return n.runWebGLProgram(p,[r,s],"float32")}};
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class IA{constructor(e){this.variableNames=["dy","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"strides",type:"vec2"}],this.outputShape=e.inShape,this.enableShapeUniforms=hx(this.outputShape.length);const t=e.filterHeight,n=e.filterWidth,i=t-1-e.padInfo.top,r=n-1-e.padInfo.left;this.userCode=`\n const ivec2 pads = ivec2(${i}, ${r});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n\n ivec2 dyCorner = ivec2(coords[1], coords[2]) - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n vec4 result = vec4(0.);\n for (int wR = 0; wR < ${t}; wR++) {\n float dyR = float(dyRCorner + wR) / strides[0];\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n int wRPerm = ${t} - 1 - wR;\n\n for (int wC = 0; wC < ${n}; wC++) {\n int wCPerm = ${n} - 1 - wC;\n\n float dyC = float(dyCCorner + wC) / strides[1];\n bool idyCVal = (dyC >= 0.0) && (dyC < ${e.outWidth}.0)\n && (fract(dyC) == 0.0);\n int idyC = int(dyC);\n\n float dyC2 = float(dyCCorner + wC + 1) / strides[1];\n bool idyCVal2 = (dyC2 >= 0.0) && (dyC2 < ${e.outWidth}.0)\n && (fract(dyC2) == 0.0);\n int idyC2 = int(dyC2);\n\n if (idyCVal && idyCVal2) {\n for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {\n vec4 wValue = getW(wRPerm, wCPerm, d1, d2);\n vec4 dySample = getDy(batch, idyR, idyC, d2);\n vec4 dySample2 = (idyC / 2 == idyC2 / 2) ?\n dySample : getDy(batch, idyR, idyC2, d2);\n\n vec2 dyValue = mod(float(idyC), 2.) == 0. ?\n dySample.xy : dySample.zw;\n result.xy += vec2(dot(dyValue, wValue.xy),\n dot(dyValue, wValue.zw));\n\n dyValue = mod(float(idyC2), 2.) == 0. ?\n dySample2.xy : dySample2.zw;\n result.zw += vec2(dot(dyValue, wValue.xy),\n dot(dyValue, wValue.zw));\n }\n } else if (idyCVal) {\n for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {\n vec4 wValue = getW(wRPerm, wCPerm, d1, d2);\n vec4 dySample = getDy(batch, idyR, idyC, d2);\n vec2 dyValue = mod(float(idyC), 2.) == 0. ?\n dySample.xy : dySample.zw;\n result.xy += vec2(dot(dyValue, wValue.xy),\n dot(dyValue, wValue.zw));\n }\n } else if (idyCVal2) {\n for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {\n vec4 wValue = getW(wRPerm, wCPerm, d1, d2);\n vec4 dySample = getDy(batch, idyR, idyC2, d2);\n vec2 dyValue = mod(float(idyC2), 2.) == 0. ?\n dySample.xy : dySample.zw;\n result.zw += vec2(dot(dyValue, wValue.xy),\n dot(dyValue, wValue.zw));\n }\n }\n }\n }\n setOutput(result);\n }\n `}}const AA={kernelName:N.Conv2DBackpropInput,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,filter:s}=t,{inputShape:o,strides:a,pad:l,dataFormat:u,dimRoundingMode:c}=i,d=N.backend_util.convertConv2DDataFormat(u),h=N.backend_util.computeConv2DInfo(o,s.shape,a,1,l,c,!1,d);if((0,N.env)().getBool("WEBGL_PACK_CONV2DTRANSPOSE")&&"channelsLast"===d){const e=[[h.strideHeight,h.strideWidth]],t=new IA(h);return n.runWebGLProgram(t,[r,s],"float32",e)}{const e=new TA(h);return n.runWebGLProgram(e,[r,s],"float32")}}};const SA={kernelName:N.Conv3D,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s}=t,{strides:o,pad:a,dilations:l}=i,u=N.backend_util.computeConv3DInfo(r.shape,s.shape,o,l,a),c=new pA(u);return n.runWebGLProgram(c,[r,s],"float32")}};const CA={kernelName:N.Conv3DBackpropFilterV2,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,dy:s}=t,{strides:o,pad:a,filterShape:l}=i,u=N.backend_util.computeConv3DInfo(r.shape,l,o,1,a),c=new xA(u);return n.runWebGLProgram(c,[r,s],"float32")}};const OA={kernelName:N.Conv3DBackpropInputV2,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,filter:s}=t,{pad:o,strides:a,inputShape:l}=i,u=N.backend_util.computeConv3DInfo(l,s.shape,a,1,o),c=new EA(u);return n.runWebGLProgram(c,[r,s],"float32")}},MA=xw({opSnippet:Tw+"\n return cos(x);\n",packedOpSnippet:`\n vec4 result = cos(x);\n bvec4 isNaN = isnan(x);\n ${uw}\n return result;\n`}),RA={kernelName:N.Cos,backendName:"webgl",kernelFunc:MA},kA=xw({opSnippet:"\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n"}),NA={kernelName:N.Cosh,backendName:"webgl",kernelFunc:kA};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class DA{constructor(e,t,n,i,r){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];const[s,o,a,l]=e,[u]=t,[c,d]=n;this.outputShape=[u,c,d,l];const h="bilinear"===i?1:0,[p,f]=[o-1+".0",a-1+".0"],[m,g,y]=c>1?[""+(o-1)/(c-1),"(y2-y1) * height_ratio",`y1*${p} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${p}`],[_,v,b]=d>1?[""+(a-1)/(d-1),"(x2-x1) * width_ratio",`x1*${f} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${f}`];this.userCode=`\n const float height_ratio = float(${m});\n const float width_ratio = float(${_});\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 < 0 || bInd >= ${s}) {\n return;\n }\n\n float height_scale = ${g};\n float width_scale = ${v};\n\n float in_y = ${y};\n if( in_y < 0.0 || in_y > ${p} ) {\n setOutput(float(${r}));\n return;\n }\n float in_x = ${b};\n if( in_x < 0.0 || in_x > ${f} ) {\n setOutput(float(${r}));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if(${h} == 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 `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const FA={kernelName:N.CropAndResize,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:i}=e,{image:r,boxes:s,boxInd:o}=t,{cropSize:a,method:l,extrapolationValue:u}=i,c=new DA(r.shape,s.shape,a,l,u);return n.runWebGLProgram(c,[r,s,o],"float32")}};var LA;!function(e){e.Prod="*",e.Sum="+"}(LA||(LA={}));class PA{constructor(e,t,n,i){this.op=e,this.outputShape=t,this.variableNames=["x"],this.customUniforms=[{name:"index",type:"float"}];const r=this.outputShape.length,s=this.op===LA.Prod?"1.0":"0.0",o=n?s:`getX(${BA(r,"coords",this.op)})`,a=this.outputShape[this.outputShape.length-1];let l="",u="";n?(l=i?"end != "+(a-1):"end != 0",u=i?"end + 1":"end - 1"):(l=i?`end + pow2 < ${a}`:"end >= pow2",u=i?"end + pow2":"end - pow2"),this.userCode=`\n void main() {\n ${ox(r)} coords = getOutputCoords();\n int end = ${$A(r,"coords",this.op)};\n float val = ${o};\n int pow2 = int(pow(2.0, index));\n if (${l}) {\n int idx = ${u};\n ${$A(r,"coords",this.op)} = idx;\n val ${this.op}= getX(${BA(r,"coords",this.op)});\n }\n setOutput(val);\n }\n `}}function BA(e,t,n){if(1===e)return`${t}`;if(2===e)return`${t}.x, ${t}.y`;if(3===e)return`${t}.x, ${t}.y, ${t}.z`;if(4===e)return`${t}.x, ${t}.y, ${t}.z, ${t}.w`;throw new Error(`Cumulative ${n} for rank ${e} is not yet supported`)}function $A(e,t,n){if(1===e)return`${t}`;if(2===e)return`${t}.y`;if(3===e)return`${t}.z`;if(4===e)return`${t}.w`;throw new Error(`Cumulative ${n} for rank ${e} is not yet supported`)}
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function UA(e,t,n,i,r,s){const o=t.shape.length,a=N.backend_util.getAxesPermutation([i],o);let l=t;null!=a&&(l=Vw({inputs:{x:t},backend:n,attrs:{perm:a}}));const u=N.backend_util.getInnerMostAxes(1,o)[0];if(u!==o-1)throw new Error(`WebGL cumprod shader expects an inner-most axis=${t.shape.length-1} but got axis=${i}`);const c=l.shape[u];let d=dw({inputs:{x:l},backend:n});for(let t=0;t<=Math.ceil(Math.log2(c))-1;t++){const i=new PA(e,l.shape,!1,s),r=[[t]],o=d;d=n.runWebGLProgram(i,[d],d.dtype,r),n.disposeIntermediateTensorInfo(o)}if(r){const t=new PA(e,l.shape,r,s),i=d;d=n.runWebGLProgram(t,[d],d.dtype),n.disposeIntermediateTensorInfo(i)}if(null!=a){const e=Vw({inputs:{x:d},backend:n,attrs:{perm:N.backend_util.getUndoAxesPermutation(a)}});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(l),e}return d}const zA={kernelName:N.Cumprod,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,exclusive:o,reverse:a}=i;return UA(LA.Prod,r,n,s,o,a)}};const VA={kernelName:N.Cumsum,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,exclusive:o,reverse:a}=i;return UA(LA.Sum,r,n,s,o,a)}};const jA={kernelName:N.DenseBincount,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,weights:s}=t,{size:o,binaryOutput:a}=i;if(1===r.shape.length){const e=n.readSync(r.dataId),t=n.readSync(s.dataId),i=Yx(e,t,s.dtype,s.shape,o);return n.makeTensorInfo([o],s.dtype,i)}if(2===r.shape.length){const e=n.bufferSync(r),t=n.bufferSync(s),i=Gx(e,t,o,a);return n.makeTensorInfo(i.shape,s.dtype,i.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${r.shape.length}.`)}};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class YA{constructor(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=n,this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = ${this.getHeightCoordString()};\n int w = ${this.getWidthCoordString()};\n int d = ${this.getDepthCoordString()};\n\n int in_h = h / ${t};\n int offset_h = imod(h, ${t});\n int in_w = w / ${t};\n int offset_w = imod(w, ${t});\n int offset_d = (offset_h * ${t} + offset_w) *\n ${this.getOutputDepthSize()};\n int in_d = d + offset_d;\n\n float result = ${this.getInputSamplingString()};\n setOutput(result);\n }\n `}getHeightCoordString(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"}getWidthCoordString(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"}getDepthCoordString(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"}getOutputDepthSize(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]}getInputSamplingString(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}}const GA={kernelName:N.DepthToSpace,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{blockSize:s,dataFormat:o}=i,a=r.shape[0],l=("NHWC"===o?r.shape[1]:r.shape[2])*s,u=("NHWC"===o?r.shape[2]:r.shape[3])*s,c=("NHWC"===o?r.shape[3]:r.shape[1])/(s*s),d=new YA("NHWC"===o?[a,l,u,c]:[a,c,l,u],s,o);return n.runWebGLProgram(d,[r],r.dtype)}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class HA{constructor(e,t=!1,n=null,i=!1,r=!1){this.variableNames=["x","W"],this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=hx(this.outputShape.length);const s=e.filterHeight,o=e.filterWidth,a=e.outChannels/e.inChannels;let l="",u="";n&&(l=i?`float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ${n}\n }`:r?`float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ${n}\n }`:`\n float activation(float x) {\n ${n}\n }\n `,u="result = activation(result);");const c=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),i&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n ${l}\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 / ${a};\n int q = d2 - d1 * ${a};\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 // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < ${s}; wR++) {\n int xR = xRCorner + wR * dilations[0];\n\n if (xR < 0 || xR >= inDims[0]) {\n continue;\n }\n\n for (int wC = 0; wC < ${o}; wC++) {\n int xC = xCCorner + wC * dilations[1];\n\n if (xC < 0 || xC >= inDims[1]) {\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\n float result = dotProd;\n ${c}\n ${u}\n setOutput(result);\n }\n `}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class WA{constructor(e,t=!1,n=null,i=!1,r=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=hx(this.outputShape.length);const s=e.outChannels/e.inChannels,o=e.padInfo.left,a=e.strideWidth,l=e.dilationWidth,u=e.filterHeight,c=e.filterWidth,d=c;let h="\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;";for(let e=0;e<c;e++)h+=`\n vec4 xTexelC${2*e};\n int xTexelC${2*e}Ready;\n vec4 xTexelC${2*e+1};\n int xTexelC${2*e+1}Ready;\n vec4 xC${e};`;h+=`\n for (int r = 0; r < ${u}; r++) {\n `;for(let e=0;e<c;e++)h+=`\n xTexelC${2*e} = vec4(0.0);\n xTexelC${2*e}Ready = 0;\n xTexelC${2*e+1} = vec4(0.0);\n xTexelC${2*e+1}Ready = 0;\n xC${e} = vec4(0.0);`;h+="\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n ";for(let e=0;e<(d+1)/2;e++){const t=2*e;if(h+=`\n xC = xCCorner + ${t*l};\n `,1===a){if(t<c&&(o%2==1?(h+=`\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t}Ready == 0) {\n xTexelC${t} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${t}.zw = vec2(0.0);\n }\n xTexelC${t}Ready = 1;\n }\n `,h+=1===l&&t>0?`\n xC${t} = vec4(xTexelC${t-2}.zw, xTexelC${t}.xy);\n `:`\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC${t} = vec4(previous.zw, xTexelC${t}.xy);\n } else {\n xC${t} = vec4(0.0, 0.0, xTexelC${t}.xy);\n }\n `):h+=`\n if (xC >= 0 && xC < inDims[1] && xTexelC${t}Ready == 0) {\n xTexelC${t} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${t}.zw = vec2(0.0);\n }\n xTexelC${t}Ready = 1;\n }\n\n xC${t} = xTexelC${t};\n `,t+1<c)){const e=o%2==0?N.util.nearestLargerEven(l):l;l%2==0&&o%2==1||l%2!=0&&o%2!=1?(h+=`\n xCOffset = xC + imod(pads[1], 2) + ${e};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t+1}Ready == 0) {\n xTexelC${t+1} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${t+1}.zw = vec2(0.0);\n }\n xTexelC${t+1}Ready = 1;\n }\n `,h+=l>1?`\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n xC${t+1} = vec4(previous.zw, xTexelC${t+1}.xy);\n } else {\n xC${t+1} = vec4(0.0, 0.0, xTexelC${t+1}.xy);\n }\n `:`\n xC${t+1} = vec4(xTexelC${t}.zw, xTexelC${t+1}.xy);\n `):h+=1===e?`\n xC${t+1} = xTexelC${t};\n `:`\n xCOffset = xC + ${e};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t+1}Ready == 0) {\n xTexelC${t+1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${t+1}.zw = vec2(0.0);\n }\n xTexelC${t+1}Ready = 1;\n }\n\n xC${t+1} = xTexelC${t+1};\n `}}else t<c&&(o%2==1?(h+=`\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t}Ready == 0) {\n xTexelC${t} = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${t}.zw = vec2(0.0);\n }\n xTexelC${t}Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${t+1}Ready == 0) {\n xTexelC${t+1} = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC${t+1}.zw = vec2(0.0);\n }\n xTexelC${t+1}Ready = 1;\n }\n\n xC${t} = vec4(xTexelC${t}.zw, xTexelC${t+1}.zw);\n `,t+1<c&&(h+=`\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC${t+1} = vec4(xTexelC${t+1}.xy, final.xy);\n `)):(h+=`\n if(xC >= 0 && xC < inDims[1] && xTexelC${t}Ready == 0) {\n xTexelC${t} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${t}.zw = vec2(0.0);\n }\n xTexelC${t}Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t+1}Ready == 0) {\n xTexelC${t+1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${t+1}.zw = vec2(0.);\n }\n xTexelC${t+1}Ready = 1;\n }\n\n xC${t} = vec4(\n xTexelC${t}.xy, xTexelC${t+1}.xy);\n `,t+1<c&&(h+=`\n xC${t+1} = vec4(xTexelC${t}.zw, xTexelC${t+1}.zw);\n `)));t<c&&(h+=`\n wTexel = getW(r, ${t}, d1, q);\n dotProd += xC${t} * vec4(wTexel.xz, wTexel.xz);\n `,t+1<c&&(h+=`\n wTexel = getW(r, ${t+1}, d1, q);\n dotProd += xC${t+1} * vec4(wTexel.xz, wTexel.xz);\n `))}h+="\n }\n ",h+="\n }\n ";let p="",f="";n&&(p=i?`vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${n}\n }`:r?`vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${n}\n }`:`vec4 activation(vec4 x) {\n ${n}\n }`,f="result = activation(result);");const m=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),i&&this.variableNames.push("preluActivationWeights"),r&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n ${p}\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 / ${s};\n int q = d2 - d1 * ${s};\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ${h}\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ${m}\n ${f}\n setOutput(result);\n }\n `}}const XA={kernelName:N.DepthwiseConv2dNative,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s}=t,{strides:o,pad:a,dilations:l,dimRoundingMode:u}=i;let c=l;null==c&&(c=[1,1]),N.util.assert(N.backend_util.eitherStridesOrDilationsAreOne(o,c),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${o} and dilations '${c}'`);const d=N.backend_util.computeConv2DInfo(r.shape,s.shape,o,c,a,u,!0);let h;h=(0,N.env)().getBool("WEBGL_PACK_DEPTHWISECONV")&&d.strideWidth<=2&&d.outChannels/d.inChannels===1?new WA(d):new HA(d);const p=[[d.padInfo.top,d.padInfo.left],[d.strideHeight,d.strideWidth],[d.dilationHeight,d.dilationWidth],[d.inHeight,d.inWidth]];return n.runWebGLProgram(h,[r,s],"float32",p)}};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class qA{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,n=e.strideWidth,i=e.padInfo.top,r=e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode=`\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 * ${s} + dm;\n\n float dotProd = 0.0;\n\n // TO DO: Vec4 over the batch size\n for (int b = 0; b < ${e.batchSize}; b++) {\n for (int yR = 0; yR < ${e.outHeight}; yR++) {\n int xR = wR + yR * ${t} - ${i};\n\n if (xR < 0 || xR >= ${e.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${e.outWidth}; yC++) {\n int xC = wC + yC * ${n} - ${r};\n\n if (xC < 0 || xC >= ${e.inWidth}) {\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 `}}class KA{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,i=e.strideHeight,r=e.strideWidth,s=t-1-e.padInfo.top,o=n-1-e.padInfo.left,a=e.outChannels/e.inChannels;this.userCode=`\n const ivec2 pads = ivec2(${s}, ${o});\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 < ${t}; wR++) {\n float dyR = float(dyRCorner + wR) / ${i}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${t} - 1 - wR;\n\n for (int wC = 0; wC < ${n}; wC++) {\n float dyC = float(dyCCorner + wC) / ${r}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${n} - 1 - wC;\n\n // TO DO: Vec4 over the channelMul\n for (int dm = 0; dm < ${a}; dm++) {\n int d2 = d1 * ${a} + 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 `}}const ZA={kernelName:N.DepthwiseConv2dNativeBackpropFilter,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,dy:s}=t,{strides:o,dilations:a,pad:l,dimRoundingMode:u,filterShape:c}=i,d=N.backend_util.computeConv2DInfo(r.shape,c,o,a,l,u,!0),h=new qA(d);return n.runWebGLProgram(h,[r,s],"float32")}};const QA={kernelName:N.DepthwiseConv2dNativeBackpropInput,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,filter:s}=t,{strides:o,dilations:a,pad:l,dimRoundingMode:u,inputShape:c}=i,d=N.backend_util.computeConv2DInfo(c,s.shape,o,a,l,u,!0),h=new KA(d);return n.runWebGLProgram(h,[r,s],"float32")}};
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class JA{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;\n setOutput(val);\n }\n "}}const eS={kernelName:N.Diag,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{x:i}=t,r=[...i.shape,...i.shape],s=N.util.sizeFromShape(i.shape),o=kw({inputs:{x:i},backend:n,attrs:{shape:[s]}}),a=new JA(s),l=n.runWebGLProgram(a,[o],o.dtype),u=kw({inputs:{x:l},backend:n,attrs:{shape:r}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),u}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class tS{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const{inHeight:t,inWidth:n,padInfo:i,strideHeight:r,strideWidth:s,filterHeight:o,filterWidth:a,dilationHeight:l,dilationWidth:u}=e,{top:c,left:d}=i;this.userCode=`\n const ivec2 strides = ivec2(${r}, ${s});\n const ivec2 pads = ivec2(${c}, ${d});\n const float neg_infinity = -3.4e38;\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.w;\n ivec2 outTopLeftCorner =\n coords.yz * strides - pads;\n int hBeg = outTopLeftCorner.x;\n int wBeg = outTopLeftCorner.y;\n\n float curVal = neg_infinity;\n for (int h = 0; h < ${o}; h++) {\n int hIn = hBeg + h * ${l};\n\n if (hIn >= 0 && hIn < ${t}) {\n for (int w = 0; w < ${a}; w++) {\n int wIn = wBeg + w * ${u};\n\n if (wIn >= 0 && wIn < ${n}) {\n float xVal = getX(batch, hIn, wIn, d1);\n float wVal = getW(h, w, d1);\n\n float val = xVal + wVal;\n if (val > curVal) {\n curVal = val;\n }\n }\n }\n }\n }\n\n float result = curVal;\n setOutput(result);\n }\n `}}const nS={kernelName:N.Dilation2D,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s}=t,{strides:o,pad:a,dilations:l}=i,u=N.backend_util.computeDilation2DInfo(r.shape,s.shape,o,a,"NHWC",l);let c;const d=new tS(u);c=n.runWebGLProgram(d,[r,s],"float32");const h=kw({inputs:{x:c},backend:n,attrs:{shape:u.outShape}});return n.disposeIntermediateTensorInfo(c),h}};const iS={kernelName:N.Einsum,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{equation:r}=i,s=t,{allDims:o,summedDims:a,idDims:l}=N.backend_util.decodeEinsumEquation(r,s.length);N.backend_util.checkEinsumDimSizes(o.length,l,s);const{path:u,steps:c}=N.backend_util.getEinsumComputePath(a,l),d=c.length;let h=null,p=o.length;const f=[];for(let e=0;e<d;++e){for(const t of c[e]){const{permutationIndices:e,expandDims:i}=N.backend_util.getEinsumPermutation(p,l[t]);let r;N.backend_util.isIdentityPermutation(e)?r=s[t]:(r=Vw({inputs:{x:s[t]},backend:n,attrs:{perm:e}}),f.push(r));const o=r.shape.slice();for(let e=0;e<i.length;++e)o.splice(i[e],0,1);N.util.arraysEqual(r.shape,o)||(r=kw({inputs:{x:r},backend:n,attrs:{shape:o}}),f.push(r)),null===h?h=r:(h=Mw({inputs:{a:r,b:h},backend:n}),f.push(h))}e<d-1&&(u[e]>=0&&(h=Uw({inputs:{x:h},backend:n,attrs:{axis:u[e]-(o.length-p),keepDims:!1}}),f.push(h)),p--)}for(const e of f)e!==h&&n.disposeIntermediateTensorInfo(e);return h}},rS=xw({opSnippet:"return (x >= 0.0) ? x : (exp(x) - 1.0);",packedOpSnippet:"\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n"}),sS={kernelName:N.Elu,backendName:"webgl",kernelFunc:rS},oS={kernelName:N.EluGrad,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n}=e,{dy:i,y:r}=t,s=(0,N.env)().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new cw("\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",i.shape,r.shape):new lw("return (b >= 0.0) ? a : a * (b + 1.0);",i.shape,r.shape);return n.runWebGLProgram(s,[i,r],i.dtype)}},aS=Ew({opSnippet:"return float(a == b);",packedOpSnippet:"\n return vec4(equal(a, b));\n",dtype:"bool",cpuKernelImpl:Kx}),lS={kernelName:N.Equal,backendName:"webgl",kernelFunc:aS},uS=xw({opSnippet:`\n // Error function is calculated approximately with elementary function.\n // See "Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n float p = ${N.backend_util.ERF_P};\n float a1 = ${N.backend_util.ERF_A1};\n float a2 = ${N.backend_util.ERF_A2};\n float a3 = ${N.backend_util.ERF_A3};\n float a4 = ${N.backend_util.ERF_A4};\n float a5 = ${N.backend_util.ERF_A5};\n\n float sign = sign(x);\n x = abs(x);\n float t = 1.0 / (1.0 + p * x);\n return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));\n`}),cS={kernelName:N.Erf,backendName:"webgl",kernelFunc:uS},dS=xw({opSnippet:Tw+"\n return exp(x);\n",packedOpSnippet:"\n vec4 result = exp(x);\n bvec4 isNaN = isnan(x);\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",cpuKernelImpl:Zx,dtype:"float32"}),hS={kernelName:N.Exp,backendName:"webgl",kernelFunc:dS};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function pS(e){const{inputs:t,attrs:n,backend:i}=e,{dim:r}=n,{input:s}=t,o=s.shape.length,a=s.shape.slice();let l=r;return r<0&&(N.util.assert(-(o+1)<=r,()=>`Axis must be in the interval [${-(o+1)}, ${o}]`),l=o+r+1),a.splice(l,0,1),kw({inputs:{x:s},backend:i,attrs:{shape:a}})}const fS={kernelName:N.ExpandDims,backendName:"webgl",kernelFunc:pS},mS="return exp(x) - 1.0;",gS=xw({opSnippet:mS,packedOpSnippet:mS,cpuKernelImpl:Qx}),yS={kernelName:N.Expm1,backendName:"webgl",kernelFunc:gS};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class _S{constructor(e,t,n){this.variableNames=["real","imag"];const i=t[1];this.outputShape=t;const r=n?`2.0 * ${Math.PI}`:`-2.0 * ${Math.PI}`,s=n?`${i}.0`:"1.0";let o;if("real"===e)o="return real * expR - imag * expI;";else{if("imag"!==e)throw new Error(`FFT component must be either "real" or "imag", got ${e}.`);o="return real * expI + imag * expR;"}this.userCode=`\n const float exponentMultiplier = ${r};\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n ${o}\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float(${i});\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < ${i}; 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) / ${s};\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function vS(e,t,n){const i=n.texData.get(e.dataId),r=N.util.sizeFromShape(e.shape),s=e.shape[e.shape.length-1],o=kw({inputs:{x:e},backend:n,attrs:{shape:[r/s,s]}}),a=o.shape,l=new _S("real",a,t),u=new _S("imag",a,t),c=[{dataId:i.complexTensorInfos.real.dataId,dtype:i.complexTensorInfos.real.dtype,shape:a},{dataId:i.complexTensorInfos.imag.dataId,dtype:i.complexTensorInfos.imag.dtype,shape:a}],d=n.runWebGLProgram(l,c,"float32"),h=n.runWebGLProgram(u,c,"float32"),p=pw({inputs:{real:d,imag:h},backend:n});n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h);const f=kw({inputs:{x:p},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(p),f}const bS={kernelName:N.FFT,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{input:i}=t;return vS(i,!1,n)}};
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class TS{constructor(e,t){this.outputShape=[],this.customUniforms=[{name:"value",type:"float"}],this.variableNames=["x"],this.outputShape=e,this.userCode="\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n "}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function xS(e){const{backend:t,attrs:n}=e,{shape:i,value:r}=n;let{dtype:s}=n;if(s=s||N.util.inferDtype(r),"string"===s){const e=N.util.getArrayFromDType(s,N.util.sizeFromShape(i));return e.fill(r),t.makeTensorInfo(i,s,e)}{const e=new TS(i,r),n=[[r]];return t.runWebGLProgram(e,[],s,n)}}const ES={kernelName:N.Fill,backendName:"webgl",kernelFunc:xS};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class wS{constructor(e){this.variableNames=["Image"],this.outputShape=[];const t=e[2];this.outputShape=e,this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n\n int coordX = ${t} - x - 1;\n float outputValue;\n if(coordX >= 0 && coordX < ${t}) {\n outputValue = getImage(coords[0], coords[1], coordX, coords[3]);\n } else {\n outputValue = getImage(coords[0], coords[1], coords[2], coords[3]);\n }\n setOutput(outputValue);\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const IS={kernelName:N.FlipLeftRight,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{const{image:n}=e,i=t,r=new wS(n.shape);return i.runWebGLProgram(r,[n],n.dtype)}},AS="return floor(x);",SS=xw({opSnippet:AS,packedOpSnippet:AS,cpuKernelImpl:Jx}),CS={kernelName:N.Floor,backendName:"webgl",kernelFunc:SS},OS=Ew({opSnippet:"\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",packedOpSnippet:"\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",dtype:"int32"}),MS={kernelName:N.FloorDiv,backendName:"webgl",kernelFunc:OS};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class RS{constructor(e){this.variableNames=["A"];const t=jT(),[n,i]=e;this.outputShape=e,this.userCode=`\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(${i}.0, ${n}.0);\n\n vec4 values = ${t.texture2D}(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 `}}
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class kS{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;const t=jT(),[n,i]=e;this.outputShape=e,this.userCode=`\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n\n vec4 result = vec4(0.);\n\n for(int row=0; row<=1; row++) {\n for(int col=0; col<=1; col++) {\n texC = coords[1] + row;\n depth = coords[2] + col;\n\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${i}.0, ${n}.0);\n vec4 values = ${t.texture2D}(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 result[row * 2 + col] = floor(value * 255.0 + 0.5);\n }\n }\n\n ${t.output} = result;\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const NS={kernelName:N.FromPixels,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:i}=e;let{pixels:r}=t;const{numChannels:s}=i,o="undefined"!=typeof HTMLVideoElement&&r instanceof HTMLVideoElement,a="undefined"!=typeof HTMLImageElement&&r instanceof HTMLImageElement,[l,u]=o?[r.videoWidth,r.videoHeight]:[r.width,r.height],c=[u,l],d=[u,l,s];if(a||o){const e=(0,N.env)().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");null!=DS&&e===FS||(FS=e,DS=document.createElement("canvas").getContext("2d",{willReadFrequently:FS})),DS.canvas.width=l,DS.canvas.height=u,DS.drawImage(r,0,0,l,u),r=DS.canvas}const h=n.makeTensorInfo(c,"int32");n.texData.get(h.dataId).usage=Bb.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(h.dataId),r);const p=(0,N.env)().getBool("WEBGL_PACK")?new kS(d):new RS(d),f=n.runWebGLProgram(p,[h],"int32");return n.disposeData(h.dataId),f}};let DS,FS=(0,N.env)().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");const LS={kernelName:N.FusedConv2D,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s,bias:o,preluActivationWeights:a}=t,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=i,m=N.backend_util.convertConv2DDataFormat(c),g=N.backend_util.computeConv2DInfo(r.shape,s.shape,l,d,u,h,!1,m);let y;const _=[],v=null!=o,b=null!=a,T="leakyrelu"===p,x=()=>{const e=[r,s],t=(e,t)=>{if("NCHW"===t&&1===e.shape.length&&1!==e.shape[0]){const t=kw({inputs:{x:e},backend:n,attrs:{shape:[e.shape[0],1,1]}});return _.push(t),t}return e};if(v&&e.push(t(o,c)),b&&e.push(t(a,c)),T){const t=n.makeTensorInfo([],"float32",N.util.createScalarValue(f,"float32"));e.push(t),_.push(t)}return e};if(1!==g.filterHeight||1!==g.filterWidth||1!==g.dilationHeight||1!==g.dilationWidth||1!==g.strideHeight||1!==g.strideWidth||"SAME"!==g.padInfo.type&&"VALID"!==g.padInfo.type)if(g.strideWidth<=2&&"channelsLast"===m&&(0,N.env)().getBool("WEBGL_EXP_CONV")){const e=p?ww(p,!0):null,t=new fA(g,v,e,b,T),i=[[g.padInfo.top,g.padInfo.left],[g.strideHeight,g.strideWidth],[g.dilationHeight,g.dilationWidth],[g.inHeight,g.inWidth]],r=x();y=n.runWebGLProgram(t,r,"float32",i)}else if((0,N.env)().getBool("WEBGL_CONV_IM2COL"))y=_A({x:r,filter:s,convInfo:g,backend:n,bias:o,activation:p,preluActivationWeights:a,leakyreluAlpha:f});else{const e=p?ww(p,!1):null,t=new hA(g,v,e,b,T),i=x();y=n.runWebGLProgram(t,i,"float32")}else y=yA({x:r,filter:s,convInfo:g,backend:n,bias:o,activation:p,preluActivationWeights:a,leakyreluAlpha:f});const E=kw({inputs:{x:y},backend:n,attrs:{shape:g.outShape}});return _.push(y),_.forEach(e=>n.disposeIntermediateTensorInfo(e)),E}};const PS={kernelName:N.FusedDepthwiseConv2D,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,filter:s,bias:o,preluActivationWeights:a}=t,{strides:l,pad:u,dilations:c,dimRoundingMode:d,activation:h,leakyreluAlpha:p}=i,f=[];let m=c;null==m&&(m=[1,1]),N.util.assert(N.backend_util.eitherStridesOrDilationsAreOne(l,m),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${l} and dilations '${m}'`);const g=N.backend_util.computeConv2DInfo(r.shape,s.shape,l,m,u,d,!0),y=(0,N.env)().getBool("WEBGL_PACK_DEPTHWISECONV")&&g.strideWidth<=2&&g.outChannels/g.inChannels===1,_=h?ww(h,y):null,v=[r,s],b=null!=o,T=null!=a,x="leakyrelu"===h;if(b&&v.push(o),T&&v.push(a),x){const e=n.makeTensorInfo([],"float32",N.util.createScalarValue(p,"float32"));v.push(e),f.push(e)}let E;E=y?new WA(g,b,_,T,x):new HA(g,b,_,T,x);const w=[[g.padInfo.top,g.padInfo.left],[g.strideHeight,g.strideWidth],[g.dilationHeight,g.dilationWidth],[g.inHeight,g.inWidth]],I=n.runWebGLProgram(E,v,"float32",w);return f.forEach(e=>n.disposeIntermediateTensorInfo(e)),I}};class BS{constructor(e,t,n,i){this.sliceDim=e,this.strides=t,this.paramsShape=i,this.variableNames=["x","indices"],this.outputShape=n;const r=ox(n.length);let s="\n int index;";for(let e=0;e<this.sliceDim;e++)s+=`\n index = round(getIndices(coords[0], ${e}));\n out_of_bounds = out_of_bounds || index < 0;\n out_of_bounds = out_of_bounds || index >= ${this.paramsShape[e]};\n flattenIndex += index * ${this.strides[e]};`;this.userCode=`\n void main() {\n ${r} coords = getOutputCoords();\n int flattenIndex = 0;\n bool out_of_bounds = false;\n\n ${s}\n\n setOutput(out_of_bounds ? 0.0 : getX(flattenIndex, coords[1]));\n }\n `}}const $S={kernelName:N.GatherNd,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{params:i,indices:r}=t,s=r.shape,o=s[s.length-1],a=N.util.sizeFromShape(i.shape),[l,u,c,d]=N.backend_util.prepareAndValidate(i,r),h=kw({inputs:{x:r},backend:n,attrs:{shape:[u,o]}}),p=kw({inputs:{x:i},backend:n,attrs:{shape:[N.util.sizeFromShape(i.shape)/c,c]}});if(n.shouldExecuteOnCPU([i,r])||"string"===i.dtype){const e=n.readSync(r.dataId),t=n.bufferSync(i),s=eE(e,t,i.dtype,u,o,c,d,i.shape,a);return n.makeTensorInfo(l,i.dtype,s.values)}const f=new BS(o,d,[u,c],i.shape),m=n.runWebGLProgram(f,[p,h],p.dtype),g=kw({inputs:{x:m},backend:n,attrs:{shape:l}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(m),g}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class US{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;const n=ox(this.rank),i=function(e){const t=["resRC.x","resRC.y","resRC.z","resRC.w"],n=[];for(let i=0;i<e.length;i++)2===i?n.push("index"):n.push(`${t[i]}`);return n.join()}(e);this.userCode=`\n void main() {\n ${n} resRC = getOutputCoords();\n int index = int(getIndices(resRC.x, resRC.z));\n float inBounds = (index >= 0) && (index < ${e[2]}) ? 1.0 : 0.0;\n setOutput(inBounds * getA(${i}));\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function zS(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,indices:s}=t,{axis:o,batchDims:a}=i,l=N.util.parseAxisParam(o,r.shape)[0];if((0,N.env)().get("DEBUG")){const e=n.readSync(s.dataId),t=r.shape[l];for(let n=0;n<e.length;++n){const i=e[n];N.util.assert(i<=t-1&&i>=0,()=>`GatherV2: the index value ${i} is not in [0, ${t-1}]`)}}const u=N.backend_util.segment_util.collectGatherOpShapeInfo(r,s,l,a),c=N.util.sizeFromShape(s.shape),d=[],h=kw({inputs:{x:r},backend:n,attrs:{shape:[u.batchSize,u.outerSize,u.dimSize,u.sliceSize]}}),p=kw({inputs:{x:s},backend:n,attrs:{shape:[u.batchSize,c/u.batchSize]}});d.push(h),d.push(p);const f=[u.batchSize,u.outerSize,c/u.batchSize,u.sliceSize];if(n.shouldExecuteOnCPU([r,s])||"string"===r.dtype){const e=n.bufferSync(p),t=n.bufferSync(h),i=tE(t,e,f);return d.forEach(e=>n.disposeIntermediateTensorInfo(e)),n.makeTensorInfo(u.outputShape,i.dtype,i.values)}const m=new US(h.shape,f),g=n.runWebGLProgram(m,[h,p],h.dtype);d.push(g);const y=kw({inputs:{x:g},backend:n,attrs:{shape:u.outputShape}});return d.forEach(e=>n.disposeIntermediateTensorInfo(e)),y}const VS={kernelName:N.GatherV2,backendName:"webgl",kernelFunc:zS},jS=Ew({opSnippet:"return float(a > b);",packedOpSnippet:"\n return vec4(greaterThan(a, b));\n",cpuKernelImpl:nE,dtype:"bool"}),YS={kernelName:N.Greater,backendName:"webgl",kernelFunc:jS},GS=Ew({opSnippet:"return float(a >= b);",packedOpSnippet:"\n return vec4(greaterThanEqual(a, b));\n",dtype:"bool",cpuKernelImpl:iE}),HS={kernelName:N.GreaterEqual,backendName:"webgl",kernelFunc:GS};const WS={kernelName:N.IFFT,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{input:i}=t;return vS(i,!0,n)}},XS=xw({opSnippet:"return float(!isnan(x) && !isinf(x));",dtype:"bool"}),qS={kernelName:N.IsFinite,backendName:"webgl",kernelFunc:XS},KS=xw({opSnippet:"return float(isinf(x));",dtype:"bool"}),ZS={kernelName:N.IsInf,backendName:"webgl",kernelFunc:KS},QS=xw({opSnippet:"return float(isnan(x));",dtype:"bool"}),JS={kernelName:N.IsNan,backendName:"webgl",kernelFunc:QS},eC=Ew({opSnippet:"return float(a < b);",packedOpSnippet:"\n return vec4(lessThan(a, b));\n",cpuKernelImpl:rE,dtype:"bool"}),tC={kernelName:N.Less,backendName:"webgl",kernelFunc:eC},nC=Ew({opSnippet:"return float(a <= b);",packedOpSnippet:"\n return vec4(lessThanEqual(a, b));\n",cpuKernelImpl:sE,dtype:"bool"}),iC={kernelName:N.LessEqual,backendName:"webgl",kernelFunc:nC};const rC={kernelName:N.LinSpace,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{backend:t,attrs:n}=e,{start:i,stop:r,num:s}=n,o=oE(i,r,s);return t.makeTensorInfo([o.length],"float32",o)}},sC=xw({opSnippet:Tw+"\n return x < 0.0 ? 0./0. : log(x);\n",packedOpSnippet:"\n vec4 result = log(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r);\n result.g = isNaN.g ? x.g : (x.g < 0.0 ? 0./0. : result.g);\n result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);\n result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);\n return result;\n",cpuKernelImpl:aE}),oC={kernelName:N.Log,backendName:"webgl",kernelFunc:sC},aC=xw({opSnippet:Tw+"\n return log(1.0 + x);\n"}),lC={kernelName:N.Log1p,backendName:"webgl",kernelFunc:aC},uC=Ew({opSnippet:"return float(a >= 1.0 && b >= 1.0);",packedOpSnippet:"\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n",dtype:"bool"}),cC={kernelName:N.LogicalAnd,backendName:"webgl",kernelFunc:uC},dC=xw({opSnippet:"return float(!(x >= 1.0));"}),hC={kernelName:N.LogicalNot,backendName:"webgl",kernelFunc:dC},pC=Ew({opSnippet:"return float(a >= 1.0 || b >= 1.0);",packedOpSnippet:"\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n",dtype:"bool"}),fC={kernelName:N.LogicalOr,backendName:"webgl",kernelFunc:pC};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class mC{constructor(e,t,n,i,r){this.variableNames=["x"],this.outputShape=[];const s=t,o=e[3]-1;let a;this.outputShape=e;const l=`float(${n}) + float(${i}) * sum`;a=.5===r?`inversesqrt(${l})`:1===r?`1.0/(${l})`:`exp(log(${l}) * float(-${r}));`,this.userCode=`\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 = -${s}; j <= ${s}; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= ${o}) {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * ${a};\n setOutput(val);\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class gC{constructor(e,t,n,i,r){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;const s=t,o=e[3]-1;let a;this.outputShape=e;const l=`float(${n}) + float(${i}) * sum`;a=.5===r?`inversesqrt(${l})`:1===r?`1.0/(${l})`:`exp(log(${l}) * float(-${r}));`,this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords.x;\n int r = coords.y;\n int c = coords.z;\n int d = coords.w;\n\n bool hasNextCol = d < ${this.outputShape[3]};\n bool hasNextRow = c < ${this.outputShape[2]};\n\n vec4 sum = vec4(0.);\n vec4 xFragAtOutputCoords = getX(b, r, c, d);\n\n vec4 xAtOutputCoords = vec4(\n getChannel(xFragAtOutputCoords, vec2(c, d)),\n hasNextCol ?\n getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,\n hasNextRow ?\n getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,\n (hasNextRow && hasNextCol) ?\n getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0\n );\n\n int firstChannel = d - ${s};\n vec2 cache = vec2(0.);\n if(firstChannel >= 0){\n vec4 firstChannelFrag = getX(b, r, c, firstChannel);\n cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));\n if(hasNextRow){\n cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));\n }\n }\n\n ivec2 depth = ivec2(d, d + 1);\n for (int j = - ${s}; j <= ${s}; j++) {\n ivec2 idx = depth + j;\n bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n bvec2 belowUpperBound = lessThanEqual(idx, ivec2(${o}));\n\n bool depthInRange = aboveLowerBound.x && belowUpperBound.x;\n bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;\n\n if(depthInRange || depthPlusOneInRange){\n vec4 z = vec4(0.);\n vec4 xFragAtCurrentDepth;\n z.xz = cache.xy;\n if(depthPlusOneInRange && hasNextCol){\n xFragAtCurrentDepth = idx.y != d ?\n getX(b, r, c, idx.y) : xFragAtOutputCoords;\n z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));\n if(hasNextRow){\n z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));\n }\n }\n cache.xy = z.yw;\n sum += z * z;\n }\n }\n vec4 result = xAtOutputCoords * ${a};\n setOutput(result);\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const yC={kernelName:N.LRN,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{depthRadius:s,bias:o,alpha:a,beta:l}=i,u=(0,N.env)().getBool("WEBGL_PACK_NORMALIZATION")?new gC(r.shape,s,o,a,l):new mC(r.shape,s,o,a,l);return n.runWebGLProgram(u,[r],r.dtype)}};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class _C{constructor(e,t,n,i,r){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=n,this.alpha=i,this.beta=r,this.userCode=`\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 < ${this.depth}; ++d) {\n int depthBegin = int(max(0.0, float(d - ${t})));\n int depthEnd = int(min(float(${this.depth}),\n float(d + ${t} + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = ${this.depth};\n\n float norm = 0.0;\n for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd) {\n norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n }\n else {\n break;\n }\n }\n\n norm = float(${i}) * norm + float(${n});\n\n for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd){\n float dyi = -2.0 * float(${i})\n * float(${r})\n * getInputImage(b, r, c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * ${r});\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 `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const vC={kernelName:N.LRNGrad,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:i}=e,{x:r,y:s,dy:o}=t,{depthRadius:a,bias:l,alpha:u,beta:c}=i,d=new _C(r.shape,a,l,u,c);return n.runWebGLProgram(d,[r,s,o],r.dtype)}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function bC(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{reductionIndices:s,keepDims:o}=i,a=r.shape.length,l=N.util.parseAxisParam(s,r.shape);let u=l;const c=N.backend_util.getAxesPermutation(u,a),d=null!=c,h=n.shouldExecuteOnCPU([r]);let p=r;if(d){if(h){const e=n.texData.get(p.dataId).values,t=new Array(a);for(let e=0;e<t.length;e++)t[e]=r.shape[c[e]];const i=LE(e,r.shape,r.dtype,c,t);p=n.makeTensorInfo(t,r.dtype);n.texData.get(p.dataId).values=i}else p=$w(r,c,n);u=N.backend_util.getInnerMostAxes(u.length,a)}N.backend_util.assertAxesAreInnerMostDims("max",u,a);const[f,m]=N.backend_util.computeOutAndReduceShapes(p.shape,u);let g,y=f;if(o&&(y=N.backend_util.expandShapeToKeepDim(f,l)),h){const e=n.texData.get(p.dataId).values,t=lE(e,N.util.sizeFromShape(m),y,r.dtype);g=n.makeTensorInfo(y,r.dtype);n.texData.get(g.dataId).values=t}else g=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i){const r=N.util.sizeFromShape(t),s=kw({inputs:{x:e},attrs:{shape:[N.util.sizeFromShape(e.shape)/r,r]},backend:i}),o=Lw(s,e.dtype,"max",i),a=kw({inputs:{x:o},attrs:{shape:n},backend:i});return i.disposeIntermediateTensorInfo(s),i.disposeIntermediateTensorInfo(o),a}(p,m,y,n);return d&&n.disposeIntermediateTensorInfo(p),g}const TC={kernelName:N.Max,backendName:"webgl",kernelFunc:bC},xC=Ew({opSnippet:aw+"\n return max(a, b);\n",packedOpSnippet:"\n vec4 result = vec4(max(a, b));\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n "+uw+"\n return result;\n",cpuKernelImpl:uE}),EC={kernelName:N.Maximum,backendName:"webgl",kernelFunc:xC};const wC={kernelName:N.MaxPool,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t;zT(r,"maxPool");const{filterSize:s,strides:o,pad:a,dimRoundingMode:l}=i;N.util.assert(N.backend_util.eitherStridesOrDilationsAreOne(o,1),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${o} and dilations '1'`);const u=N.backend_util.computePool2DInfo(r.shape,s,o,1,a,l);if(1===u.filterWidth&&1===u.filterHeight&&N.util.arraysEqual(u.inShape,u.outShape))return dw({inputs:{x:r},backend:n});const c=new EI(u,"max",!1);return n.runWebGLProgram(c,[r],r.dtype)}};const IC={kernelName:N.MaxPool3D,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{filterSize:s,strides:o,pad:a,dataFormat:l,dimRoundingMode:u}=i,c=N.backend_util.computePool3DInfo(r.shape,s,o,[1,1,1],a,u,l),d=new wI(c,"max",!1);return n.runWebGLProgram(d,[r],r.dtype)}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class AC{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideHeight,n=e.strideWidth,i=e.dilationHeight,r=e.effectiveFilterHeight,s=e.effectiveFilterWidth,o=r-1-e.padInfo.top,a=s-1-e.padInfo.left,l=r*s-1;this.userCode=`\n const ivec2 pads = ivec2(${o}, ${a});\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 < ${r};\n wR += ${i}) {\n float dyR = float(dyRCorner + wR) / ${t}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${s}; wC++) {\n float dyC = float(dyCCorner + wC) / ${n}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = ${l} - 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 * ${s} + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n `}}class SC{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideDepth,n=e.strideHeight,i=e.strideWidth,r=e.dilationDepth,s=e.dilationHeight,o=e.dilationWidth,a=e.effectiveFilterDepth,l=e.effectiveFilterHeight,u=e.effectiveFilterWidth,c=a-1-e.padInfo.front,d=l-1-e.padInfo.top,h=u-1-e.padInfo.left,p=a*l*u-1;this.userCode=`\n const ivec3 pads = ivec3(${c}, ${d}, ${h});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ${a};\n wD += ${r}) {\n float dyD = float(dyDCorner + wD) / ${t}.0;\n\n if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ${l};\n wR += ${s}) {\n float dyR = float(dyRCorner + wR) / ${n}.0;\n\n if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${u};\n wC += ${o}) {\n float dyC = float(dyCCorner + wC) / ${i}.0;\n\n if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n int maxPosValue = ${p} -\n int(getMaxPos(batch, idyD, idyR, idyC, ch));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue =\n wD * ${l} * ${u} +\n wR * ${u} + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n }\n setOutput(dotProd);\n }\n `}}const CC={kernelName:N.MaxPool3DGrad,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,input:s}=t,o=s,{filterSize:a,strides:l,pad:u,dimRoundingMode:c}=i,d=N.backend_util.computePool3DInfo(o.shape,a,l,[1,1,1],u,c),h=new wI(d,"max",!0),p=n.runWebGLProgram(h,[o],o.dtype),f=new SC(d),m=n.runWebGLProgram(f,[r,p],o.dtype);return n.disposeIntermediateTensorInfo(p),m}};const OC={kernelName:N.MaxPoolGrad,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{dy:r,input:s,output:o}=t,a=s;zT([s,o],"maxPoolGrad");const{filterSize:l,strides:u,pad:c,dimRoundingMode:d}=i,h=N.backend_util.computePool2DInfo(a.shape,l,u,1,c,d),p=new EI(h,"max",!0),f=n.runWebGLProgram(p,[a],a.dtype),m=new AC(h),g=n.runWebGLProgram(m,[r,f],a.dtype);return n.disposeIntermediateTensorInfo(f),g}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const MC={kernelName:N.MaxPoolWithArgmax,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{x:i}=e,{filterSize:r,strides:s,pad:o,includeBatchInIndex:a}=t,l=n;N.util.assert(4===i.shape.length,()=>`Error in maxPool: input must be rank 4 but got rank ${i.shape.length}.`);const u=[1,1];N.util.assert(N.backend_util.eitherStridesOrDilationsAreOne(s,u),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${s} and dilations '${u}'`);const c=N.backend_util.computePool2DInfo(i.shape,r,s,u,o),[d,h]=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i){let r=new EI(n,"max",!1);const s=i.runWebGLProgram(r,[e],"float32");return r=new EI(n,"max",!0,!0,t),[s,i.runWebGLProgram(r,[e],"float32")]}(i,a,c,l);return[d,h]}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const RC={kernelName:N.Mean,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{x:i}=e,{keepDims:r,axis:s}=t,o=n,a=i.shape.length,l=N.util.parseAxisParam(s,i.shape);let u=l;const c=N.backend_util.getAxesPermutation(u,a),d=null!=c,h=o.shouldExecuteOnCPU([i]),p=[];let f=i;if(d){if(h){const e=o.texData.get(f.dataId).values,t=new Array(a);for(let e=0;e<t.length;e++)t[e]=i.shape[c[e]];const n=LE(e,i.shape,i.dtype,c,t);f=o.makeTensorInfo(t,i.dtype);o.texData.get(f.dataId).values=n}else f=$w(i,c,o);p.push(f),u=N.backend_util.getInnerMostAxes(u.length,a)}N.backend_util.assertAxesAreInnerMostDims("sum",u,a);const[m,g]=N.backend_util.computeOutAndReduceShapes(f.shape,u);let y=m;r&&(y=N.backend_util.expandShapeToKeepDim(m,l));const _=
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e,t,n,i){const r=N.util.sizeFromShape(t),s=kw({inputs:{x:e},attrs:{shape:[N.util.sizeFromShape(e.shape)/r,r]},backend:i}),o=Lw(s,"float32","mean",i),a=kw({inputs:{x:o},attrs:{shape:n},backend:i});return i.disposeIntermediateTensorInfo(s),i.disposeIntermediateTensorInfo(o),a}(f,g,y,o);for(const e of p)o.disposeIntermediateTensorInfo(e);return _}};const kC={kernelName:N.Min,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i,a=r.shape.length,l=N.util.parseAxisParam(s,r.shape);let u=l;const c=N.backend_util.getAxesPermutation(u,a);let d=r;null!=c&&(d=Vw({inputs:{x:r},backend:n,attrs:{perm:c}}),u=N.backend_util.getInnerMostAxes(u.length,r.shape.length)),N.backend_util.assertAxesAreInnerMostDims("min",u,a);const[h,p]=N.backend_util.computeOutAndReduceShapes(d.shape,u),f=kw({inputs:{x:d},backend:n,attrs:{shape:[-1,N.util.sizeFromShape(p)]}}),m=Lw(f,f.dtype,"min",n);let g;if(o){g=kw({inputs:{x:m},backend:n,attrs:{shape:N.backend_util.expandShapeToKeepDim(h,l)}})}else g=kw({inputs:{x:m},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),null!=c&&n.disposeIntermediateTensorInfo(d),g}},NC=Ew({opSnippet:aw+"\n return min(a, b);\n",packedOpSnippet:"\n vec4 result = vec4(min(a, b));\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n "+uw+"\n return result;\n",cpuKernelImpl:cE}),DC={kernelName:N.Minimum,backendName:"webgl",kernelFunc:NC};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class FC{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((t,n)=>t[0]+e[n]+t[1]);const i=e.length,r=ox(i),s=t.map(e=>e[0]).join(","),o=t.map((t,n)=>t[0]+e[n]).join(","),a=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,i),l="reflect"===n?0:1;this.userCode=1!==i?`\n ${r} start = ${r}(${s});\n ${r} end = ${r}(${o});\n\n void main() {\n ${r} outC = getOutputCoords();\n for (int i = 0; i < ${i}; i++) {\n if (outC[i] < start[i]) {\n outC[i] = start[i] * 2 - outC[i] - ${l};\n } else if(outC[i] >= end[i]) {\n outC[i] = (end[i] - 1) * 2 - outC[i] + ${l};\n }\n }\n ${r} coords = outC - start;\n setOutput(getX(${a}));\n }\n `:`\n int start = ${s};\n int end = ${o};\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start) {\n outC = start * 2 - outC - ${l};\n } else if(outC >= end) {\n outC = (end - 1) * 2 - outC + ${l};\n }\n setOutput(getX(outC - start));\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class LC{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((t,n)=>t[0]+e[n]+t[1]);const i=e.length,r=ox(i),s=t.map(e=>e[0]).join(","),o=t.map((t,n)=>t[0]+e[n]).join(","),a=$E("rc",i),l=$E("source",i),u=`${a[i-1]} < ${this.outputShape[i-1]}`,c=1===i?"source":`vec2(${l.slice(-2).join()})`,d="reflect"===n?0:1;let h="";if(1===i){const e=`\n ${r} source = rc;\n if (source < start) {\n source = start * 2 - source - ${d};\n } else if (source >= end) {\n source = (end - 1) * 2 - source + ${d};\n }\n source -= start;\n `;h=`\n ${r} rc = outputLoc;\n ${e}\n result[0] = getChannel(getX(${l.join()}), ${c});\n ${a[i-1]} += 1;\n if(${u}) {\n ${e}\n result[1] = getChannel(getX(${l.join()}), ${c});\n }\n `}else{const e=`\n ${r} source = rc;\n ${r} lt = ${r}(lessThan(source, start));\n ${r} gte = ${r}(greaterThanEqual(source, end));\n ${r} orig = 1 - (lt + gte);\n source = orig * source +\n lt * (start * 2 - source - ${d}) +\n gte * ((end - 1) * 2 - source + ${d});\n source -= start;\n `;h=`\n ${r} rc = outputLoc;\n ${e}\n result[0] = getChannel(getX(${l.join()}), ${c});\n ${a[i-1]} += 1;\n if(${u}) {\n ${e}\n result[1] = getChannel(getX(${l.join()}), ${c});\n }\n rc = outputLoc;\n ${a[i-2]} += 1;\n if(${a[i-2]} < ${this.outputShape[i-2]}) {\n ${e}\n result[2] = getChannel(getX(${l.join()}), ${c});\n ${a[i-1]} += 1;\n if(${u}) {\n ${e}\n result[3] = getChannel(getX(${l.join()}), ${c});\n }\n }\n `}this.userCode=`\n const ${r} start = ${r}(${s});\n const ${r} end = ${r}(${o});\n\n void main() {\n ${r} outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ${h}\n setOutput(result);\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const PC={kernelName:N.MirrorPad,backendName:"webgl",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:i}=e,{paddings:r,mode:s}=n,o=(0,N.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new LC(i.shape,r,s):new FC(i.shape,r,s);return t.runWebGLProgram(o,[i],i.dtype)}},BC=Ew({opSnippet:"if (b == 0.0) return NAN;\n return mod(a, b);",packedOpSnippet:"\n vec4 result = mod(a, b);\n bvec4 isNaN = equal(b, vec4(0.0));\n "+uw+"\n return result;\n"}),$C={kernelName:N.Mod,backendName:"webgl",kernelFunc:BC};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class UC{constructor(e,t,n){this.variableNames=["probs"],this.customUniforms=[{name:"seed",type:"float"}],this.outputShape=[e,n],this.userCode=`\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 < ${t-1}; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float(${t-1}));\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const zC=Ew({opSnippet:"\nif (a == b) {\n return 1.0;\n};\nreturn a / b;",packedOpSnippet:"\n // vec4 one = vec4(equal(a, b));\n // return one + (vec4(1.0) - one) * a / b;\n vec4 result = a / b;\n if(a.x == b.x) {\n result.x = 1.;\n }\n if(a.y == b.y) {\n result.y = 1.;\n }\n if(a.z == b.z) {\n result.z = 1.;\n }\n if(a.w == b.w) {\n result.w = 1.;\n }\n\n return result;\n",checkOutOfBounds:!0}),VC={kernelName:N.RealDiv,backendName:"webgl",kernelFunc:zC},jC="return a - b;",YC=Ew({opSnippet:jC,packedOpSnippet:jC,supportsComplex:!0,cpuKernelImpl:NE}),GC={kernelName:N.Sub,backendName:"webgl",kernelFunc:YC};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function HC(e){const{inputs:t,backend:n,attrs:i}=e,{logits:r}=t,{dim:s}=i,o=N.util.parseAxisParam([s],r.shape),a=bC({inputs:{x:r},backend:n,attrs:{reductionIndices:o,keepDims:!1}}),l=N.backend_util.expandShapeToKeepDim(a.shape,o),u=kw({inputs:{x:a},backend:n,attrs:{shape:l}}),c=YC({inputs:{a:r,b:u},backend:n}),d=dS({inputs:{x:c},backend:n}),h=Uw({inputs:{x:d},backend:n,attrs:{axis:o,keepDims:!1}}),p=kw({inputs:{x:h},backend:n,attrs:{shape:l}}),f=zC({inputs:{a:d,b:p},backend:n});return n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),f}const WC={kernelName:N.Softmax,backendName:"webgl",kernelFunc:HC};const XC={kernelName:N.Multinomial,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{logits:r}=t,{numSamples:s,seed:o,normalized:a}=i,l=a?r:HC({inputs:{logits:r},backend:n,attrs:{dim:r.shape.length-1}}),u=l.shape[0],c=l.shape[1],d=new UC(u,c,s),h=[[o]],p=n.runWebGLProgram(d,[l],"int32",h);return a||n.disposeIntermediateTensorInfo(l),p}},qC=WE+"\n return -x;\n";const KC={kernelName:N.Neg,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:i}=t;if(n.shouldExecuteOnCPU([i])){const e=n.texData.get(i.dataId),[t,r]=hE(e.values,i.shape,i.dtype);return n.makeTensorInfo(r,i.dtype,t)}let r;return r=(0,N.env)().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new QE(i.shape,"\n vec4 result = -x;\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"):new HE(i.shape,qC),n.runWebGLProgram(r,[i],i.dtype)}},ZC=N.kernel_impls.nonMaxSuppressionV3Impl;const QC={kernelName:N.NonMaxSuppressionV3,backendName:"webgl",kernelFunc:function(e){N.backend_util.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:t,backend:n,attrs:i}=e,{boxes:r,scores:s}=t,{maxOutputSize:o,iouThreshold:a,scoreThreshold:l}=i,u=n.readSync(r.dataId),c=n.readSync(s.dataId),{selectedIndices:d}=ZC(u,c,o,a,l);return n.makeTensorInfo([d.length],"int32",new Int32Array(d))}},JC=N.kernel_impls.nonMaxSuppressionV4Impl;const eO={kernelName:N.NonMaxSuppressionV4,backendName:"webgl",kernelFunc:function(e){N.backend_util.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:t,backend:n,attrs:i}=e,{boxes:r,scores:s}=t,{maxOutputSize:o,iouThreshold:a,scoreThreshold:l,padToMaxOutputSize:u}=i,c=n.readSync(r.dataId),d=n.readSync(s.dataId),{selectedIndices:h,validOutputs:p}=JC(c,d,o,a,l,u);return[n.makeTensorInfo([h.length],"int32",new Int32Array(h)),n.makeTensorInfo([],"int32",new Int32Array([p]))]}},tO=N.kernel_impls.nonMaxSuppressionV5Impl;const nO={kernelName:N.NonMaxSuppressionV5,backendName:"webgl",kernelFunc:function(e){N.backend_util.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:t,backend:n,attrs:i}=e,{boxes:r,scores:s}=t,{maxOutputSize:o,iouThreshold:a,scoreThreshold:l,softNmsSigma:u}=i,c=n.readSync(r.dataId),d=n.readSync(s.dataId),h=o,p=a,f=l,m=u,{selectedIndices:g,selectedScores:y}=tO(c,d,h,p,f,m);return[n.makeTensorInfo([g.length],"int32",new Int32Array(g)),n.makeTensorInfo([y.length],"float32",new Float32Array(y))]}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class iO{constructor(e,t,n,i){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode=`\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float(${i}), float(${n}),\n float(index == coords.y)));\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const rO={kernelName:N.OneHot,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:i}=e,{indices:r}=t,{dtype:s,depth:o,onValue:a,offValue:l}=i,u=N.util.sizeFromShape(r.shape),c=new iO(u,o,a,l),d=kw({inputs:{x:r},backend:n,attrs:{shape:[u]}}),h=n.runWebGLProgram(c,[d],s);n.disposeIntermediateTensorInfo(d);const p=kw({inputs:{x:h},backend:n,attrs:{shape:[...r.shape,o]}});return n.disposeIntermediateTensorInfo(h),p}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function sO(e){const{inputs:t,backend:n}=e,{x:i}=t;if("complex64"===i.dtype){const e=HI({inputs:{input:i},backend:n}),t=sO({inputs:{x:e},backend:n}),r=aA({inputs:{input:i},backend:n}),s=sO({inputs:{x:r},backend:n}),o=pw({inputs:{real:t,imag:s},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),o}return xS({attrs:{shape:i.shape,dtype:i.dtype,value:"string"===i.dtype?"":0},backend:n})}const oO={kernelName:N.ZerosLike,backendName:"webgl",kernelFunc:sO};const aO={kernelName:N.OnesLike,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function e(t){const{inputs:n,backend:i}=t,{x:r}=n;if("string"===r.dtype)throw new Error("onesLike is not supported under string dtype");if("complex64"===r.dtype){const t=HI({inputs:{input:r},backend:i}),n=e({inputs:{x:t},backend:i}),s=aA({inputs:{input:r},backend:i}),o=sO({inputs:{x:s},backend:i}),a=pw({inputs:{real:n,imag:o},backend:i});return i.disposeIntermediateTensorInfo(t),i.disposeIntermediateTensorInfo(n),i.disposeIntermediateTensorInfo(s),i.disposeIntermediateTensorInfo(o),a}return xS({attrs:{shape:r.shape,dtype:r.dtype,value:1},backend:i})}};const lO={kernelName:N.Pack,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{axis:r}=i;if(1===t.length)return pS({inputs:{input:t[0]},backend:n,attrs:{dim:r}});const s=t[0].shape,o=t[0].dtype;t.forEach(e=>{N.util.assertShapesMatch(s,e.shape,"All tensors passed to stack must have matching shapes"),N.util.assert(o===e.dtype,()=>"All tensors passed to stack must have matching dtypes")});const a=[],l=cA({inputs:t.map(e=>{const t=pS({inputs:{input:e},backend:n,attrs:{dim:r}});return a.push(t),t}),backend:n,attrs:{axis:r}});return a.forEach(e=>n.disposeIntermediateTensorInfo(e)),l}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class uO{constructor(e,t,n){this.variableNames=["x"],this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map((t,n)=>t[0]+e[n]+t[1]);const i=e.length,r=ox(i),s=t.map(e=>e[0]).join(","),o=t.map((t,n)=>t[0]+e[n]).join(","),a=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,i);this.userCode=1!==i?`\n ${r} start = ${r}(${s});\n ${r} end = ${r}(${o});\n\n void main() {\n ${r} outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(value);\n } else {\n ${r} coords = outC - start;\n setOutput(getX(${a}));\n }\n }\n `:`\n int start = ${s};\n int end = ${o};\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(value);\n } else {\n setOutput(getX(outC - start));\n }\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class cO{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map((t,n)=>t[0]+e[n]+t[1]);const i=e.length,r=ox(i),s=t.map(e=>e[0]).join(","),o=t.map((t,n)=>t[0]+e[n]).join(","),a=$E("rc",i),l=$E("source",i),u=`${a[i-1]} < ${this.outputShape[i-1]}`,c=1===i?"source":`vec2(${l.slice(-2).join()})`,d=[`${r} rc = outputLoc;`,`${a[i-1]} += 1;\n if(${u}) {\n `,1===i?"":`}\n rc = outputLoc;\n ${a[i-2]} += 1;\n if(${a[i-2]} < ${this.outputShape[i-2]}) {`,1===i?"":` ${a[i-1]} += 1;\n if(${u}) {`],h=1===i?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))";let p="";for(let e=0,t=1===i?2:4;e<t;e++)p+=`\n ${d[e]}\n if (${h}) {\n result[${e}] = float(value);\n } else {\n ${r} source = rc - start;\n result[${e}] = getChannel(getX(${l.join()}), ${c});\n }\n `;p+=1===i?"} ":"}}",this.userCode=`\n const ${r} start = ${r}(${s});\n const ${r} end = ${r}(${o});\n\n void main() {\n ${r} outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ${p}\n setOutput(result);\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const dO=e=>{const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{paddings:s,constantValue:o}=i;if(0===N.util.sizeFromShape(r.shape)){const e=s.map((e,t)=>e[0]+r.shape[t]+e[1]);return xS({backend:n,attrs:{shape:e,value:o,dtype:r.dtype}})}const a=(0,N.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new cO(r.shape,s,o):new uO(r.shape,s,o),l=[[o]];return n.runWebGLProgram(a,[r],r.dtype,l)},hO={kernelName:N.PadV2,backendName:"webgl",kernelFunc:dO},pO=Ew({opSnippet:"\n if(a < 0.0 && floor(b) < b){\n return NAN;\n }\n if (b == 0.0) {\n return 1.0;\n }\n return (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",packedOpSnippet:"\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 // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n bvec4 isExpZero = equal(b, vec4(0.0));\n result.r = isExpZero.r ? 1.0 : result.r;\n result.g = isExpZero.g ? 1.0 : result.g;\n result.b = isExpZero.b ? 1.0 : result.b;\n result.a = isExpZero.a ? 1.0 : result.a;\n\n bvec4 isNaN1 = lessThan(a, vec4(0.0));\n bvec4 isNaN2 = lessThan(floor(b), b);\n bvec4 isNaN = bvec4(isNaN1.x && isNaN2.x, isNaN1.y && isNaN2.y, isNaN1.z && isNaN2.z, isNaN1.w && isNaN2.w);\n "+uw+"\n return result;\n"}),fO={kernelName:N.Pow,backendName:"webgl",kernelFunc:pO};const mO={kernelName:N.Prod,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{axis:s,keepDims:o}=i,a=r.shape.length,l=[],u=N.util.parseAxisParam(s,r.shape);let c=u;const d=N.backend_util.getAxesPermutation(c,a);let h,p=r;if(null!=d&&(p=Vw({inputs:{x:r},backend:n,attrs:{perm:d}}),c=N.backend_util.getInnerMostAxes(c.length,a),l.push(p)),N.backend_util.assertAxesAreInnerMostDims("prod",c,a),n.shouldExecuteOnCPU([p])){const e=n.texData.get(p.dataId).values,{outVals:t,outShape:i,outDtype:r}=fE(p.shape,p.dtype,e,c);h=n.makeTensorInfo(i,r,t)}else{const[e,t]=N.backend_util.computeOutAndReduceShapes(p.shape,c),i=N.util.sizeFromShape(t),s=kw({inputs:{x:p},backend:n,attrs:{shape:[-1,i]}}),o=Lw(s,(0,N.sumOutType)(r.dtype),"prod",n);h=kw({inputs:{x:o},backend:n,attrs:{shape:e}}),l.push(s),l.push(o)}if(o){l.push(h);const e=N.backend_util.expandShapeToKeepDim(h.shape,u);h=kw({inputs:{x:h},backend:n,attrs:{shape:e}})}return l.forEach(e=>n.disposeIntermediateTensorInfo(e)),h}};const gO={kernelName:N.RaggedGather,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{paramsNestedSplits:r,paramsDenseValues:s,indices:o}=t,{outputRaggedRank:a}=i,l=r.map(e=>n.readSync(e.dataId)),u=r.map(e=>e.shape),c=n.readSync(s.dataId),d=n.readSync(o.dataId),[h,p,f]=mE(l,u,c,s.shape,s.dtype,d,o.shape,a),m=h.map(e=>n.makeTensorInfo([e.length],"int32",e)),g=n.makeTensorInfo(f,s.dtype,p);return m.concat([g])}};const yO={kernelName:N.RaggedRange,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{starts:i,limits:r,deltas:s}=t,o=n.readSync(i.dataId),a=n.readSync(r.dataId),l=n.readSync(s.dataId),[u,c]=gE(o,i.shape,i.dtype,a,r.shape,l,s.shape);return[n.makeTensorInfo([u.length],"int32",u),n.makeTensorInfo([c.length],i.dtype,c)]}};const _O={kernelName:N.RaggedTensorToTensor,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{shape:r,values:s,defaultValue:o,rowPartitionTensors:a}=t,{rowPartitionTypes:l}=i,u=n.readSync(r.dataId),c=n.readSync(s.dataId),d=n.readSync(o.dataId),h=a.map(e=>n.readSync(e.dataId)),p=a.map(e=>e.shape),[f,m]=yE(u,r.shape,c,s.shape,s.dtype,d,o.shape,h,p,l);return n.makeTensorInfo(f,s.dtype,m)}},vO=e=>{const{backend:t,attrs:n}=e,{start:i,stop:r,step:s,dtype:o}=n,a=_E(i,r,s,o);return t.makeTensorInfo([a.length],o,a)},bO={kernelName:N.Range,backendName:"webgl",kernelFunc:vO},TO=xw({opSnippet:"return 1.0 / x;"}),xO={kernelName:N.Reciprocal,backendName:"webgl",kernelFunc:TO},EO=xw({opSnippet:WE+"\n return (x < 0.0) ? 0.0 : x;\n",packedOpSnippet:"\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"}),wO={kernelName:N.Relu,backendName:"webgl",kernelFunc:EO},IO=xw({opSnippet:WE+"\n return (x < 0.0) ? 0.0 : min(6.0, x);\n",packedOpSnippet:"\n vec4 result = min(x, vec4(6.)) * 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"}),AO={kernelName:N.Relu6,backendName:"webgl",kernelFunc:IO};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class SO{constructor(e,t,n,i,r){this.variableNames=["A"],this.outputShape=[];const[s,o,a,l]=e;this.outputShape=[s,t,n,l];const u=[i&&t>1?o-1:o,i&&n>1?a-1:a],c=[i&&t>1?t-1:t,i&&n>1?n-1:n];let d;d=r?"(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":"vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ${u[0]/c[0]},\n ${u[1]/c[1]});\n const vec2 inputShapeRC = vec2(${o}.0, ${a}.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 = ${d};\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0)));\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 `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class CO{constructor(e,t,n,i,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[s,o,a,l]=e;this.outputShape=[s,t,n,l];const u=[i&&t>1?o-1:o,i&&n>1?a-1:a],c=[i&&t>1?t-1:t,i&&n>1?n-1:n];let d;d=r?"(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":"vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ${u[0]/c[0]},\n ${u[1]/c[1]},\n ${u[1]/c[1]});\n const vec3 inputShapeRC = vec3(${o}.0, ${a}.0,\n ${a}.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 = ${d};\n\n // Compute the four integer indices.\n ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0)));\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 < ${l-1};\n bool hasNextRow = coords.z < ${n-1};\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 && 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 && 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 && 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 && 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 `}}const OO={kernelName:N.ResizeBilinear,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:o,size:a}=i,[l,u]=a,c=(0,N.env)().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new CO(r.shape,l,u,s,o):new SO(r.shape,l,u,s,o);return n.runWebGLProgram(c,[r],"float32")}};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class MO{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,i,r]=t,[,s,o]=e,a=[n&&s>1?i-1:i,n&&o>1?r-1:r],l=[n&&s>1?s-1:s,n&&o>1?o-1:o],u=a[0]/l[0],c=a[1]/l[1],d=1/u,h=1/c,p=2*Math.ceil(d)+2,f=2*Math.ceil(h)+2;this.userCode=`\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(${u});\n const float widthScale = float(${c});\n\n const float invHeightScale = float(${d});\n const float invWidthScale = float(${h});\n\n const int winHeight = int(${p});\n const int winWidth = int(${f});\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 < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= ${s}) {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= ${o}) {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), ${i-1}.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), ${r-1}.0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && 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 `}}const RO={kernelName:N.ResizeBilinearGrad,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{images:r,dy:s}=t,{alignCorners:o}=i,a=new MO(s.shape,r.shape,o);return n.runWebGLProgram(a,[s],s.dtype)}};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class kO{constructor(e,t,n,i,r){this.variableNames=["A"],this.outputShape=[];const[s,o,a,l]=e;this.outputShape=[s,t,n,l];const u=[i&&t>1?o-1:o,i&&n>1?a-1:a],c=[i&&t>1?t-1:t,i&&n>1?n-1:n],d=i?"0.5":"0.0";let h;h=r?"max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":"vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ${u[0]/c[0]},\n ${u[1]/c[1]});\n const vec2 inputShapeRC = vec2(${o}.0, ${a}.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 = ${h};\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${d})));\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class NO{constructor(e,t,n,i,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[s,o,a,l]=e;this.outputShape=[s,t,n,l];const u=[i&&t>1?o-1:o,i&&n>1?a-1:a],c=[i&&t>1?t-1:t,i&&n>1?n-1:n],d=i?"0.5":"0.0";let h;h=r?"max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":"vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ${u[0]/c[0]},\n ${u[1]/c[1]},\n ${u[1]/c[1]});\n const vec3 inputShapeRC = vec3(${o}.0, ${a}.0,\n ${a}.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 = ${h};\n\n // Compute the coordinators of nearest neighbor point.\n ivec3 sourceNearestRC = ivec3(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${d})));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ${l-1};\n bool hasNextRow = coords.z < ${n-1};\n\n vec4 newValue = vec4(\n getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d),\n hasNextCol ? getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d + 1) : 0.0);\n\n setOutput(newValue);\n }\n `}}const DO={kernelName:N.ResizeNearestNeighbor,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:o,size:a}=i,[l,u]=a,c=(0,N.env)().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new NO(r.shape,l,u,s,o):new kO(r.shape,l,u,s,o);return n.runWebGLProgram(c,[r],r.dtype)}};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class FO{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,i,r]=t,[,s,o]=e,a=[n&&s>1?i-1:i,n&&o>1?r-1:r],l=[n&&s>1?s-1:s,n&&o>1?o-1:o],u=a[0]/l[0],c=a[1]/l[1],d=1/u,h=1/c,p=2*Math.ceil(d)+2,f=2*Math.ceil(h)+2;this.userCode=`\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(${u});\n const float widthScale = float(${c});\n\n const float invHeightScale = float(${d});\n const float invWidthScale = float(${h});\n\n const int winHeight = int(${p});\n const int winWidth = int(${f});\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 < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= ${s}) {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= ${o}) {\n continue;\n }\n\n float sourceFracRow =\n float(${a[0]}) *\n (float(dyR) / float(${l[0]}));\n\n float sourceFracCol =\n float(${a[1]}) *\n (float(dyC) / float(${l[1]}));\n\n int sourceNearestRow = int(min(\n float(int(${i}) - 1),\n ${n} ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int(${r}) - 1),\n ${n} ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n `}}const LO={kernelName:N.ResizeNearestNeighborGrad,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{images:r,dy:s}=t,{alignCorners:o}=i,a=new FO(s.shape,r.shape,o);return n.runWebGLProgram(a,[s],s.dtype)}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class PO{constructor(e,t){this.variableNames=["x"];const n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);if(this.outputShape=e,1===n)return void(this.userCode=`\n void main() {\n int coord = getOutputCoords();\n setOutput(getX(${e[0]} - coord - 1));\n }\n `);const i=e.map((n,i)=>(n=>-1!==t.indexOf(n)&&1!==e[n]?`${e[n]} - coords[${n}] - 1`:`coords[${n}]`)(i)).join(","),r=ox(n);this.userCode=`\n void main() {\n ${r} coords = getOutputCoords();\n setOutput(getX(${i}));\n }\n `}}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class BO{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;const n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);this.outputShape=e;const i=$E("rc",n),r=`${i[n-1]} + 1 < ${this.outputShape[n-1]}`,s=`${i[n-2]} + 1 < ${this.outputShape[n-2]}`,o=ox(n);function a(n){const i=e.map((i,r)=>function(n,i){return-1!==t.indexOf(n)&&1!==e[n]?`${e[n]} - ${i[n]} - 1`:`${i[n]}`}(r,n));return`getChannel(getX(${i.join(",")}), vec2(${i.slice(-2).join(",")}))`}this.userCode=1===n?`\n void main(){\n int rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = getChannel(getX(${e[0]} - rc - 1),\n ${e[0]} - rc - 1);\n if(${r}){\n result.g = getChannel(getX(${e[0]} - (rc + 1) - 1),\n ${e[0]} - (rc + 1) - 1);\n }\n setOutput(result);\n }\n `:`\n void main() {\n ${o} rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = ${function(e){return a(e)}(i.slice())};\n if(${r}){\n result.g = ${function(e){return e[n-1]="("+e[n-1]+" + 1)",a(e)}(i.slice())};\n }\n if(${s}) {\n result.b = ${function(e){return e[n-2]="("+e[n-2]+" + 1)",a(e)}(i.slice())};\n if(${r}) {\n result.a = ${function(e){return e[n-1]="("+e[n-1]+" + 1)",e[n-2]="("+e[n-2]+" + 1)",a(e)}(i.slice())};\n }\n }\n setOutput(result);\n }\n `}}const $O={kernelName:N.Reverse,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{dims:s}=i,o=r.shape.length,a=N.util.parseAxisParam(s,r.shape);if(0===o)return dw({inputs:{x:r},backend:n});const l=(0,N.env)().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new BO(r.shape,a):new PO(r.shape,a);return n.runWebGLProgram(l,[r],r.dtype)}};
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class UO{constructor(e,t){this.variableNames=["Image"],this.outputShape=[],this.customUniforms=[{name:"params",type:"vec4"}];const n=e[1],i=e[2];this.outputShape=e;let r="";r="number"==typeof t?`float outputValue = ${t.toFixed(2)};`:`\n vec3 fill = vec3(${t.join(",")});\n float outputValue = fill[coords[3]];`,this.userCode=`\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n int y = coords[1];\n float coordXFloat = (float(x) - params[0]) * params[3] -\n (float(y) - params[1]) * params[2];\n float coordYFloat = (float(x) - params[0]) * params[2] +\n (float(y) - params[1]) * params[3];\n int coordX = int(round(coordXFloat + params[0]));\n int coordY = int(round(coordYFloat + params[1]));\n ${r}\n if(coordX >= 0 && coordX < ${i} && coordY >= 0 && coordY < ${n}) {\n outputValue = getImage(coords[0], coordY, coordX, coords[3]);\n }\n setOutput(outputValue);\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
const zO={kernelName:N.RotateWithOffset,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{image:i}=e,{radians:r,fillValue:s,center:o}=t,a=n,l=new UO(i.shape,s),[u,c]=N.backend_util.getImageCenter(o,i.shape[1],i.shape[2]),d=[[u,c,Math.sin(r),Math.cos(r)]];return a.runWebGLProgram(l,[i],i.dtype,d)}},VO=xw({opSnippet:"\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 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"}),jO={kernelName:N.Round,backendName:"webgl",kernelFunc:VO},YO=xw({opSnippet:"return inversesqrt(x);",cpuKernelImpl:vE}),GO={kernelName:N.Rsqrt,backendName:"webgl",kernelFunc:YO};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class HO{constructor(e,t,n,i,r,s,o=!0,a=!1){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;const l=ox(r.length),u=ox(s.length);let c="";1===n?c="i":2===n&&(c="i, j");const d=`getIndices(${c})`;let h="";1===i?h="i":2===i&&(h="i, coords[1]");const p=`getUpdates(${h})`;let f="";a&&(f="coords[0], coords[1]");const m=`getDefaultValue(${f})`,g=t>1?"strides[j]":"strides";this.userCode=`\n ${l} strides = ${l}(${r});\n\n void main() {\n ${u} coords = getOutputCoords();\n float sum = 0.0;\n bool found = false;\n for (int i = 0; i < ${e}; i++) {\n int flattenedIndex = 0;\n for (int j = 0; j < ${t}; j++) {\n int index = round(${d});\n flattenedIndex += index * ${g};\n }\n if (flattenedIndex == coords[0]) {\n sum += ${p};\n found = true;\n }\n }\n setOutput(mix(${m}, sum, float(found)));\n }\n `}}
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class WO{constructor(e,t,n,i,r,s,o=!0,a=!1){this.variableNames=["updates","indices","defaultValue"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=s;const l=ox(r.length),u=ox(s.length);let c="";1===n?c="i":2===n&&(c="i, j");const d=`getIndices(${c})`;let h="";1===i?h="i":2===i&&(h="i, coords[1]");const p=`getUpdates(${h})`;let f="";a&&(f="coords[0], coords[1]");const m=`getDefaultValue(${f})`,g=t>1?"strides[j]":"strides",y=t>1?"strides[j + 1]":"strides";this.userCode=`\n ${l} strides = ${l}(${r});\n\n void main() {\n ${u} coords = getOutputCoords();\n vec4 sum = vec4(0.);\n vec4 found = vec4(0.);\n for (int i = 0; i < ${e}; i+=2) {\n ivec2 flattenedIndex = ivec2(0);\n for (int j = 0; j < ${t}; j+=2) {\n ivec4 index = round(${d});\n flattenedIndex += index.xz * ${g};\n if (j + 1 < ${t}) {\n flattenedIndex += index.yw * ${y};\n }\n }\n if (flattenedIndex[0] == coords[0] || flattenedIndex[1] == coords[0] ||\n flattenedIndex[0] == coords[0] + 1 || flattenedIndex[1] == coords[0] + 1) {\n vec4 updVals = ${p};\n if (flattenedIndex[0] == coords[0]) {\n sum.xy += updVals.xy;\n found.xy = vec2(1.);\n } else if (flattenedIndex[0] == coords[0] + 1) {\n sum.zw += updVals.xy;\n found.zw = vec2(1.);\n }\n if (flattenedIndex[1] == coords[0]) {\n sum.xy += updVals.zw;\n found.xy = vec2(1.);\n } else if (flattenedIndex[1] == coords[0] + 1) {\n sum.zw += updVals.zw;\n found.zw = vec2(1.);\n }\n }\n }\n setOutput(mix(${m}, sum, found));\n }\n `}}const XO={kernelName:N.ScatterNd,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{indices:r,updates:s}=t,{shape:o}=i,{sliceRank:a,numUpdates:l,sliceSize:u,strides:c,outputSize:d}=N.backend_util.calculateShapes(s,r,o),h=[d/u,u];if(0===d)return n.makeTensorInfo(o,r.dtype);const p=kw({inputs:{x:r},backend:n,attrs:{shape:[l,a]}}),f=kw({inputs:{x:s},backend:n,attrs:{shape:[l,u]}}),m=n.makeTensorInfo([],"float32",new Float32Array([0]));let g;g=(0,N.env)().getBool("WEBGL_PACK")?new WO(l,a,p.shape.length,f.shape.length,c,h):new HO(l,a,p.shape.length,f.shape.length,c,h);const y=n.runWebGLProgram(g,[f,p,m],f.dtype),_=kw({inputs:{x:y},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(m),_}};
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class qO{constructor(e,t,n,i){this.variableNames=["sortedSequence","values"],this.customUniforms=[{name:"numInputs",type:"int"}],this.outputShape=[e,n];const r=`for (int i = 0; i < ${Math.ceil(Math.log2(t+1))}; ++i) { if (left >= right) break;`,s=2===(0,N.env)().getNumber("WEBGL_VERSION")?"while (left < right) {":r,o="left"===i?"<":"<=";this.userCode=`\n int findBound(int batch, float value) {\n int left = 0;\n int right = numInputs;\n int mid;\n ${s}\n mid = (left + right) / 2;\n if (getSortedSequence(batch, mid) ${o} value) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return right;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int valueIndex = coords[1];\n\n float value = getValues(batch, valueIndex);\n\n setOutput(float(findBound(batch, value)));\n }\n `}}const KO={kernelName:N.SearchSorted,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{sortedSequence:r,values:s}=t,{side:o}=i,a=new qO(r.shape[0],r.shape[1],s.shape[1],o),l=[[r.shape[1]]];return n.runWebGLProgram(a,[r,s],"int32",l)}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class ZO{constructor(e,t,n){let i,r;if(this.variableNames=["c","a","b"],this.outputShape=t,n>4)throw Error(`Where for rank ${n} is not yet supported`);if(1===n)r="resRC",i="resRC";else{const n=["resRC.x","resRC.y","resRC.z","resRC.w"],s=[],o=[];for(let i=0;i<t.length;i++)o.push(`${n[i]}`),i<e&&s.push(`${n[i]}`);i=s.join(),r=o.join()}const s=ox(n);this.userCode=`\n void main() {\n ${s} resRC = getOutputCoords();\n float cVal = getC(${i});\n if (cVal >= 1.0) {\n setOutput(getA(${r}));\n } else {\n setOutput(getB(${r}));\n }\n }\n `}}const QO={kernelName:N.Select,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{condition:i,t:r,e:s}=t,o=new ZO(i.shape.length,r.shape,r.shape.length);return n.runWebGLProgram(o,[i,r,s],(0,N.upcastType)(r.dtype,s.dtype))}},JO=xw({opSnippet:`\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = ${N.backend_util.SELU_SCALEALPHA};\n float scale = ${N.backend_util.SELU_SCALE};\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n`}),eM={kernelName:N.Selu,backendName:"webgl",kernelFunc:JO},tM=xw({opSnippet:Tw+"\n return 1.0 / (1.0 + exp(-1.0 * x));\n",packedOpSnippet:"\n vec4 result = 1.0 / (1.0 + exp(-1.0 * x));\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",cpuKernelImpl:TE}),nM={kernelName:N.Sigmoid,backendName:"webgl",kernelFunc:tM},iM=xw({opSnippet:"\n if (isnan(x)) { return 0.0; }\n return sign(x);\n"}),rM={kernelName:N.Sign,backendName:"webgl",kernelFunc:iM},sM=xw({opSnippet:Tw+"\n return sin(x);\n",packedOpSnippet:`\n vec4 result = sin(x);\n bvec4 isNaN = isnan(x);\n ${uw}\n return result;\n`}),oM={kernelName:N.Sin,backendName:"webgl",kernelFunc:sM},aM=xw({opSnippet:"\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n"}),lM={kernelName:N.Sinh,backendName:"webgl",kernelFunc:aM},uM=xw({opSnippet:"\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < 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"}),cM={kernelName:N.Softplus,backendName:"webgl",kernelFunc:uM},dM={kernelName:N.SpaceToBatchND,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{blockShape:s,paddings:o}=i;N.util.assert(r.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");const a=s.reduce((e,t)=>e*t),l=[[0,0]];l.push(...o);for(let e=1+s.length;e<r.shape.length;++e)l.push([0,0]);const u=[],c=dO({inputs:{x:r},backend:n,attrs:{paddings:l,constantValue:0}}),d=N.backend_util.getReshaped(c.shape,s,a,!1),h=N.backend_util.getPermuted(d.length,s.length,!1),p=N.backend_util.getReshapedPermuted(c.shape,s,a,!1),f=kw({inputs:{x:c},backend:n,attrs:{shape:d}}),m=Vw({inputs:{x:f},backend:n,attrs:{perm:h}}),g=kw({inputs:{x:m},backend:n,attrs:{shape:p}});return u.push(c),u.push(f),u.push(m),u.forEach(e=>n.disposeIntermediateTensorInfo(e)),g}};const hM={kernelName:N.SparseFillEmptyRows,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{indices:i,values:r,denseShape:s,defaultValue:o}=t;if(1!==s.shape.length)throw new Error(`Dense shape must be a vector, saw:\n ${s.shape}`);if(2!==i.shape.length)throw new Error(`Indices must be a matrix, saw:\n ${i.shape}`);if(1!==r.shape.length)throw new Error(`Values must be a vector, saw:\n ${r.shape}`);if(0!==o.shape.length)throw new Error(`Default value must be a scalar, saw:\n ${o.shape}`);const a=n.readSync(i.dataId),l=n.readSync(r.dataId),u=n.readSync(s.dataId),c=n.readSync(o.dataId)[0],[d,h,p,f,m]=wE(a,i.shape,i.dtype,l,r.dtype,u,c);return[n.makeTensorInfo(h,i.dtype,d),n.makeTensorInfo([h[0]],r.dtype,p),n.makeTensorInfo([f.length],"bool",new Uint8Array(f.map(e=>Number(e)))),n.makeTensorInfo([m.length],i.dtype,new Int32Array(m))]}};const pM={kernelName:N.SparseReshape,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{inputIndices:i,inputShape:r,newShape:s}=t;if(2!==i.shape.length)throw new Error(`Input indices should be a matrix but received shape ${i.shape}`);if(1!==r.shape.length)throw new Error(`Input shape should be a vector but received shape ${r.shape}`);if(1!==s.shape.length)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);const o=Array.from(n.readSync(r.dataId)),a=n.readSync(i.dataId),l=Array.from(n.readSync(s.dataId)),[u,c,d]=IE(a,i.shape,i.dtype,o,l);return[n.makeTensorInfo(c,i.dtype,u),n.makeTensorInfo([d.length],s.dtype,new Int32Array(d))]}};const fM={kernelName:N.SparseSegmentMean,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{data:i,indices:r,segmentIds:s}=t;if(i.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==r.shape.length)throw new Error(`Indices should be a vector but received shape\n ${r.shape}`);if(1!==s.shape.length)throw new Error(`Segment ids should be a vector but received shape\n ${s.shape}`);const o=n.readSync(i.dataId),a=n.readSync(r.dataId),l=n.readSync(s.dataId),[u,c]=AE(o,i.shape,i.dtype,a,l,!0);return n.makeTensorInfo(c,i.dtype,u)}};const mM={kernelName:N.SparseSegmentSum,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n}=e,{data:i,indices:r,segmentIds:s}=t;if(i.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==r.shape.length)throw new Error(`Indices should be a vector but received shape\n ${r.shape}`);if(1!==s.shape.length)throw new Error(`Segment ids should be a vector but received shape\n ${s.shape}`);const o=n.readSync(i.dataId),a=n.readSync(r.dataId),l=n.readSync(s.dataId),[u,c]=AE(o,i.shape,i.dtype,a,l);return n.makeTensorInfo(c,i.dtype,u)}};const gM={kernelName:N.SparseToDense,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{sparseIndices:r,sparseValues:s,defaultValue:o}=t,{outputShape:a}=i,{sliceRank:l,numUpdates:u,sliceSize:c,strides:d,outputSize:h}=N.backend_util.calculateShapes(s,r,a),p=!1;if("string"===s.dtype){const e=n.bufferSync(r),t=n.bufferSync(s),i=N.util.decodeString(n.readSync(o.dataId)[0]),f=bE(e,t,a,h,c,u,l,d,i,p);return n.makeTensorInfo(a,f.dtype,f.values)}const f=new HO(u,l,r.shape.length,s.shape.length,d,[h,1],p),m=n.runWebGLProgram(f,[s,r,o],s.dtype),g=kw({inputs:{x:m},backend:n,attrs:{shape:a}});return n.disposeIntermediateTensorInfo(m),g}};const yM={kernelName:N.SplitV,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{numOrSizeSplits:s,axis:o}=i,a=N.util.parseAxisParam(o,r.shape)[0],l=N.backend_util.prepareSplitSize(r,s,a),u=r.shape.length,c=new Array(u).fill(0),d=r.shape.slice();return l.map(e=>{const t=[...d];t[a]=e;const i=BI({inputs:{x:r},backend:n,attrs:{begin:c,size:t}});return c[a]+=e,i})}},_M="return sqrt(x);",vM=xw({opSnippet:_M,packedOpSnippet:_M,cpuKernelImpl:SE}),bM={kernelName:N.Sqrt,backendName:"webgl",kernelFunc:vM},TM=xw({opSnippet:"return x * x;"}),xM={kernelName:N.Square,backendName:"webgl",kernelFunc:TM},EM="return (a - b) * (a - b);",wM=Ew({opSnippet:EM,packedOpSnippet:EM}),IM={kernelName:N.SquaredDifference,backendName:"webgl",kernelFunc:wM};const AM={kernelName:N.StaticRegexReplace,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2023 Google LLC.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t;if("string"!==r.dtype)throw new Error("Input must be of datatype string");const s=n.readSync(r.dataId),o=N.backend_util.fromUint8ToStringArray(s),a=CE(o,"string",i);return n.makeTensorInfo(r.shape,"string",a)}};const SM={kernelName:N.Step,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function({inputs:e,attrs:t,backend:n}){const{x:i}=e,r=WE+`\n return x > 0.0 ? 1.0 : float(${t.alpha});\n `,s=new HE(i.shape,r);return n.runWebGLProgram(s,[i],i.dtype)}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class CM{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;const i=n.length,r=ox(n.length),s=ox(n.length);let o="";if(1===i)o="coords * strides + begin";else{let e=0;o=n.map((t,i)=>(e++,1===n.length?`coords * strides[${i}] + begin[${i}]`:`coords[${e-1}] * strides[${i}] + begin[${i}]`)).join(",")}this.userCode=`\n ${r} begin = ${r}(${e});\n ${r} strides = ${r}(${t});\n\n void main() {\n ${s} coords = getOutputCoords();\n setOutput(getX(${o}));\n }\n `}}const OM={kernelName:N.StridedSlice,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{begin:s,end:o,strides:a,beginMask:l,endMask:u,ellipsisMask:c,newAxisMask:d,shrinkAxisMask:h}=i,{finalShapeSparse:p,finalShape:f,isIdentity:m,sliceDim0:g,isSimpleSlice:y,begin:_,end:v,strides:b}=N.slice_util.sliceInfo(r.shape,s,o,a,l,u,c,d,h);let T;if(m)T=kw({inputs:{x:r},backend:n,attrs:{shape:f}});else if(g||y){N.util.assert(r.shape.length>=1,()=>`Input must have rank at least 1, got: ${r.shape.length}`);const e=N.slice_util.computeOutShape(_,v,b),t=BI({inputs:{x:r},backend:n,attrs:{begin:_,size:e}});T=kw({inputs:{x:t},backend:n,attrs:{shape:f}}),n.disposeIntermediateTensorInfo(t)}else{if(n.shouldExecuteOnCPU([r])){const e=n.readSync(r.dataId),t=(0,N.buffer)(r.shape,r.dtype,e),i=OE(p,t,b,_);T=n.makeTensorInfo(f,r.dtype,i.values)}else{const e=new CM(_,b,p);T=n.runWebGLProgram(e,[r],r.dtype)}}const x=kw({inputs:{x:T},backend:n,attrs:{shape:f}});return n.disposeIntermediateTensorInfo(T),x}};const MM={kernelName:N.StringNGrams,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{separator:r,nGramWidths:s,leftPad:o,rightPad:a,padWidth:l,preserveShortSequences:u}=i,{data:c,dataSplits:d}=t,h=n.readSync(c.dataId),p=n.readSync(d.dataId),[f,m]=ME(h,p,r,s,o,a,l,u);return[n.makeTensorInfo([f.length],"string",f),n.makeTensorInfo(d.shape,"int32",m)]}};const RM={kernelName:N.StringSplit,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{skipEmpty:r}=i,{input:s,delimiter:o}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(1!==s.shape.length)throw new Error(`Input must be a vector, got shape: ${s.shape}`);if(0!==o.shape.length)throw new Error(`Delimiter must be a scalar, got shape: ${o.shape}`);const a=n.readSync(s.dataId),l=n.readSync(o.dataId)[0],[u,c,d]=RE(a,l,r),h=c.length;return[n.makeTensorInfo([h,2],"int32",u),n.makeTensorInfo([h],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(d))]}};const kM={kernelName:N.StringToHashBucketFast,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{numBuckets:r}=i,{input:s}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(r<=0)throw new Error("Number of buckets must be at least 1");const o=n.readSync(s.dataId),a=kE(o,r);return n.makeTensorInfo(s.shape,"int32",a)}},NM=xw({opSnippet:"return tan(x);"}),DM={kernelName:N.Tan,backendName:"webgl",kernelFunc:NM},FM=xw({opSnippet:"\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n"}),LM={kernelName:N.Tanh,backendName:"webgl",kernelFunc:FM};const PM={kernelName:N.TensorScatterUpdate,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{tensor:r,indices:s,updates:o}=t,{}=i,{sliceRank:a,numUpdates:l,sliceSize:u,strides:c,outputSize:d}=N.backend_util.calculateShapes(o,s,r.shape),h=[d/u,u];if(0===d)return n.makeTensorInfo(r.shape,s.dtype);const p=kw({inputs:{x:s},backend:n,attrs:{shape:[l,a]}}),f=kw({inputs:{x:o},backend:n,attrs:{shape:[l,u]}}),m=kw({inputs:{x:r},backend:n,attrs:{shape:h}}),g=new HO(l,a,p.shape.length,f.shape.length,c,h,!1,!0),y=n.runWebGLProgram(g,[f,p,m],m.dtype),_=kw({inputs:{x:y},backend:n,attrs:{shape:r.shape}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(y),_}};
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class BM{constructor(e,t){this.variableNames=["A"];const n=new Array(e.length);for(let i=0;i<n.length;i++)n[i]=e[i]*t[i];this.outputShape=n,this.rank=n.length;const i=ox(this.rank),r=function(e){const t=e.length;if(t>5)throw Error(`Tile for rank ${t} is not yet supported`);if(1===t)return`imod(resRC, ${e[0]})`;const n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],i=[];for(let t=0;t<e.length;t++)i.push(`imod(${n[t]}, ${e[t]})`);return i.join()}(e);this.userCode=`\n void main() {\n ${i} resRC = getOutputCoords();\n setOutput(getA(${r}));\n }\n `}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function $M(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{reps:s}=i;if("string"===r.dtype||r.shape.length>5){const e=n.readSync(r.dataId),t="string"===r.dtype?e.map(e=>N.util.decodeString(e)):e,i=(0,N.buffer)(r.shape,r.dtype,t),o=DE(i,s);return n.makeTensorInfo(o.shape,o.dtype,o.values)}const o=new BM(r.shape,s);return n.runWebGLProgram(o,[r],r.dtype)}const UM={kernelName:N.Tile,backendName:"webgl",kernelFunc:$M};class zM{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"negativeInf",type:"float"},{name:"dir",type:"int"},{name:"inc",type:"int"}],this.outputShape=e,this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // We compare elements pair-wise within a group of size 2 * inc.\n // The comparing rule for each group alternates between ascending\n // and descending. Within each group, we compare each pair at\n // positions i and i+inc. To decide whether an element at position i\n // is x0 or x1, we mod it by 2 * inc, if the result is smaller than\n // inc, it is in the first half of the group, we denote it as x0,\n // otherwise we denote it as x1.\n // For example, as shown in the Bitonic top K paper referenced above,\n // Figure5(a) shows that element[1] is in the\n // second half of the group when group size is 2, but it is in the\n // first half of the group when group size is 4.\n\n bool isFirstInPair = imod(elemIdx, 2 * inc) < inc;\n int i = isFirstInPair ? elemIdx : elemIdx - inc;\n\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + inc : int(getIndices(batch, i + inc));\n float x0 = i0 < n ? getX(batch, i0) : negativeInf;\n float x1 = i1 < n ? getX(batch, i1) : negativeInf;\n\n // Denotes which direction indices are in (ascending or descending).\n bool reverse = imod(elemIdx, 2 * dir) >= dir;\n bool isGreater = x0 > x1 || (x0 == x1 && i1 > i0);\n if (reverse == isGreater) { // Elements in opposite order of direction\n int iTemp = i0;\n i0 = i1;\n i1 = iTemp;\n }\n if (isFirstInPair) {\n setOutput(float(i0));\n } else {\n setOutput(float(i1));\n }\n }\n "}}class VM{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"k",type:"int"}],this.outputShape=e,this.userCode="\n void main() {\n // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ...\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // The output size is half of the previous size.\n // If the previous sequence is | | | | _ _ _ _ | | | | _ _ _ _ (k=4),\n // we only need to output the indices at positions |, the indices at\n // positions _ can be thrown away, see Figure5(b) After Phase 2\n // (Merge phase) in the Bitonic Top K paper referenced above.\n // For example, the paper shows we only need to output the orange bars.\n // The output sequence should look like this | | | | | | | |.\n // Because the sequence is halved, to map the output index back\n // to the previous sequence to find the corresponding value,\n // we need to double the index. When we double the index,\n // we basically interpolate a position, so 2i looks like\n // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k position\n // of each 2k positions by - elemIdx % k. E.g. for output at\n // index 4,5,6,7, we want to get the corresponding element at\n // original index 8,9,10,11, for output at index 8,9,10,11,\n // we want to get the corresponding element at original index\n // 16,17,18,19, so on and so forth.\n\n int i = elemIdx < k ? elemIdx : (elemIdx * 2 - imod(elemIdx, k));\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + k : int(getIndices(batch, i + k));\n\n float x0 = getX(batch, i0);\n float x1 = i1 < n ? getX(batch, i1) : x0;\n\n setOutput(x0 >= x1 ? float(i0) : float(i1));\n }\n "}}
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function jM(e,t){null!==t&&e.disposeIntermediateTensorInfo(t)}function YM(e){let t=1;for(;t<e;)t*=2;return t}const GM={kernelName:N.TopK,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r}=t,{k:s,sorted:o}=i,a=(0,N.env)().getNumber("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD"),l=(0,N.env)().getNumber("TOPK_K_CPU_HANDOFF_THRESHOLD"),u=r.shape,c=u[u.length-1];if(n.shouldExecuteOnCPU([r])||c<a||s>l){const e=n.readSync(r.dataId),[t,i]=FE(e,u,r.dtype,s,o);return[n.makeTensorInfo(t.shape,t.dtype,t.values),n.makeTensorInfo(i.shape,i.dtype,i.values)]}if(0===s)return u[u.length-1]=0,[n.makeTensorInfo(u,r.dtype,[]),n.makeTensorInfo(u,"int32",[])];if(1===c)return[r,xS({attrs:{shape:u,dtype:"int32",value:0},backend:n})];const d=n.texData.get(r.dataId),h=null!==d&&d.isPacked,p=h?n.unpackTensor(r):r,f=N.util.sizeFromShape(u)/c,m=kw({inputs:{x:p},attrs:{shape:[f,c]},backend:n});h&&jM(n,p);const g=YM(s),y=YM(c);let _=null;const v=()=>null===_?[m,m]:[m,_],b=(e,t,i)=>{const r=v(),s=new zM(i),o=[[c],[null===_?1:0],[Number.NEGATIVE_INFINITY],[e],[t]],a=_;_=n.runWebGLProgram(s,r,"int32",o),jM(n,a)};for(let e=1;e<g;e*=2){const t=2*e;for(let n=e;n>=1;n/=2)b(t,n,[f,y])}for(let e=y;e>g;e/=2){const t=v(),i=new VM([f,e/2]),r=[[c],[null===_?1:0],[g]],s=_;_=n.runWebGLProgram(i,t,"int32",r),jM(n,s);const o=g/2,a=2*o;for(let e=o;e>=1;e/=2)b(a,e,_.shape)}let T=_;_=BI({inputs:{x:_},backend:n,attrs:{begin:0,size:[f,s]}}),jM(n,T);let x=zS({inputs:{x:m,indices:_},backend:n,attrs:{axis:1,batchDims:1}});jM(n,m);const E=u.slice(0,-1);E.push(s),T=_,_=kw({inputs:{x:_},attrs:{shape:E},backend:n}),jM(n,T);const w=x;return x=kw({inputs:{x},attrs:{shape:E},backend:n}),jM(n,w),[x,_]}};
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class HM{constructor(e,t,n,i,r,s){this.variableNames=["Image","Transforms"],this.outputShape=s;const o="nearest"===n?1:2;let a;switch(i){case"constant":default:a=1;break;case"reflect":a=2;break;case"wrap":a=3;break;case"nearest":a=4}this.userCode=`\n float mapCoord(float outCoord, float len) {\n float inCoord = outCoord;\n if(${a} == 2) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n if (inCoord < sz2) {\n inCoord = sz2 * float(int(float(-inCoord / sz2))) +\n inCoord;\n }\n inCoord = inCoord < -len ? inCoord + sz2 : -inCoord - 1.0;\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n inCoord -= sz2 * float(int(float(inCoord / sz2)));\n if (inCoord >= len) {\n inCoord = sz2 - inCoord - 1.0;\n }\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (${a} == 3) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord += len * (float(int(float(-inCoord / sz))) + 1.0);\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord -= len * float(int(float(inCoord / sz)));\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (${a} == 4) {\n return clamp(outCoord, 0.0, len - 1.0);\n } else {\n return outCoord;\n }\n }\n\n float readWithFillValue(int batch, int coordY, int coordX,\n int channel) {\n float outputValue;\n if (0 <= coordY && coordY < ${e} && 0 <= coordX && coordX < ${t}) {\n outputValue = getImage(batch, coordY, coordX, channel);\n } else {\n outputValue = float(${r});\n }\n return outputValue;\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n float outputValue;\n int batch = coords[0];\n int x = coords[2];\n int y = coords[1];\n int channel = coords[3];\n float xf = float(x);\n float yf = float(y);\n float a1 = getTransforms(batch, 0);\n float a2 = getTransforms(batch, 1);\n float a3 = getTransforms(batch, 2);\n float b1 = getTransforms(batch, 3);\n float b2 = getTransforms(batch, 4);\n float b3 = getTransforms(batch, 5);\n float c1 = getTransforms(batch, 6);\n float c2 = getTransforms(batch, 7);\n float projection = c1 * xf + c2 * yf + 1.0;\n if (projection == 0.0) {\n outputValue = float(${r});\n } else {\n float inX = (a1 * xf + a2 * yf + a3) / projection;\n float inY = (b1 * xf + b2 * yf + b3) / projection;\n float mapX = mapCoord(inX, float(${t}));\n float mapY = mapCoord(inY, float(${e}));\n\n if (${o} == 1) {\n int coordY = int(round(mapY));\n int coordX = int(round(mapX));\n outputValue = readWithFillValue(batch, coordY, coordX,\n channel);\n } else {\n float yFloor = floor(mapY);\n float xFloor = floor(mapX);\n float yCeil = yFloor + 1.0;\n float xCeil = xFloor + 1.0;\n float valueYFloor = (xCeil - mapX) *\n readWithFillValue(batch, int(yFloor), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yFloor), int(xCeil), channel);\n float valueYCeil = (xCeil - mapX) *\n readWithFillValue(batch, int(yCeil), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yCeil), int(xCeil), channel);\n outputValue = (yCeil - mapY) * valueYFloor +\n (mapY - yFloor) * valueYCeil;\n }\n }\n setOutput(outputValue);\n }\n `}}const WM={kernelName:N.Transform,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{image:r,transforms:s}=t,{interpolation:o,fillMode:a,fillValue:l,outputShape:u}=i,[c,d,h,p]=r.shape,[f,m]=null!=u?u:[d,h],g=new HM(d,h,o,a,l,[c,f,m,p]);return n.runWebGLProgram(g,[r,s],"float32")}};const XM={kernelName:N.Unique,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,attrs:n,backend:i}=e,{axis:r}=n,{x:s}=t;zT(s,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");const o=i.readSync(s.dataId),{outputValues:a,outputShape:l,indices:u}=PE(o,r,s.shape,s.dtype);return[i.makeTensorInfo(l,s.dtype,a),i.makeTensorInfo([u.length],"int32",u)]}};const qM={kernelName:N.Unpack,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{value:r}=t;let{axis:s}=i;s<0&&(s+=r.shape.length);const o=r,a=o.shape.length,l=r.shape[s],u=new Array(a-1);let c=0;for(let e=0;e<a;e++)e!==s&&(u[c++]=o.shape[e]);const d=[],h=new Array(a).fill(0),p=o.shape.slice();p[s]=1;const f=new Array(l);for(let e=0;e<f.length;e++){h[s]=e;const t=BI({inputs:{x:o},backend:n,attrs:{begin:h,size:p}}),i=kw({inputs:{x:t},backend:n,attrs:{shape:u}});f[e]=i,d.push(t)}return d.forEach(e=>n.disposeIntermediateTensorInfo(e)),f}};
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
class KM{constructor(e,t){this.variableNames=["x","segmentIds"];const n=e.windowSize,i=e.batchSize,r=e.inSize,s=e.numSegments,o=s*Math.ceil(r/n);this.outputShape=[i,o];const a=4*Math.floor(n/4),l=n%4,u="\n sumValue += dot(values, segFilter);\n ";let c="";r%n>0&&(c=`\n if (inIdx < 0 || inIdx >= ${r}) {\n return initializationValue;\n }\n `);let d="";r%n>0&&(d=`\n if (inIdx < 0 || inIdx >= ${r}) {\n return -1.0;\n }\n `),this.userCode=`\n const float initializationValue = 0.0;\n\n float getValue(int batch, int inIdx) {\n ${c}\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n ${d}\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 ${s})) * float(${n}));\n int currentSeg = int(mod(float(outIdx), float(${s})));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ${a}; 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 ${u}\n }\n\n int inIdx = inOffset + ${a};\n if (${1===l}) {\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 ${u}\n } else if (${2===l}) {\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 ${u}\n } else if (${3===l}) {\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 ${u}\n }\n setOutput(sumValue);\n }\n `}}const ZM={kernelName:N.UnsortedSegmentSum,backendName:"webgl",kernelFunc:
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
function(e){const{inputs:t,backend:n,attrs:i}=e,{x:r,segmentIds:s}=t,{numSegments:o}=i,a=r.shape.length,l=[];let u=0;const c=N.backend_util.getAxesPermutation([u],a);let d=r;null!=c&&(d=Vw({inputs:{x:r},backend:n,attrs:{perm:c}}),l.push(d),u=N.backend_util.getInnerMostAxes(1,a)[0]);const h=N.backend_util.segment_util.computeOutShape(d.shape,u,o),p=N.util.sizeFromShape([d.shape[u]]),f=kw({inputs:{x:d},backend:n,attrs:{shape:[-1,p]}});l.push(f);const m=(0,N.sumOutType)(r.dtype),g=(e,t,i,r,s)=>{const o=e.shape[0],a=e.shape[1],u=N.backend_util.segment_util.segOpComputeOptimalWindowSize(a,s),c=new KM({windowSize:u,inSize:a,batchSize:o,numSegments:s},t),d=n.compileAndRun(c,[e,i],r);if(l.push(d),d.shape[1]===s)return d;const h=vO({backend:n,attrs:{start:0,stop:s,step:1,dtype:"float32"}}),p=$M({inputs:{x:h},backend:n,attrs:{reps:[a/u]}});l.push(h),l.push(p);return g(d,t,p,r,s)},y=kw({inputs:{x:g(f,"unsortedSegmentSum",s,m,o)},backend:n,attrs:{shape:h}});let _=y;if(null!=c){l.push(y);const e=N.backend_util.getUndoAxesPermutation(c);_=Vw({inputs:{x:_},backend:n,attrs:{perm:e}})}return l.forEach(e=>n.disposeIntermediateTensorInfo(e)),_}},QM=[Gw,Ww,qw,Zw,eI,iI,rI,sI,dI,hI,fI,gI,_I,bI,xI,II,AI,OI,MI,RI,DI,UI,zI,VI,jI,XI,ZI,eA,fw,iA,dA,vA,wA,AA,SA,CA,OA,RA,NA,FA,zA,VA,jA,GA,XA,ZA,QA,eS,nS,iS,sS,oS,lS,cS,hS,fS,yS,bS,ES,IS,CS,MS,NS,LS,PS,$S,VS,YS,HS,hw,WS,lA,qS,ZS,JS,yw,tC,iC,rC,oC,lC,cC,hC,fC,yC,vC,TC,EC,wC,IC,CC,OC,MC,RC,kC,DC,PC,$C,XC,Rw,KC,QC,eO,nO,GI,rO,aO,lO,hO,fO,bw,mO,gO,yO,_O,bO,WI,VC,xO,wO,AO,Nw,OO,RO,DO,LO,$O,zO,jO,GO,XO,KO,QO,eM,nM,rM,oM,lM,$I,WC,cM,dM,hM,pM,fM,mM,gM,yM,bM,xM,IM,AM,SM,OM,MM,RM,kM,GC,zw,DM,LM,PM,UM,GM,WM,jw,XM,qM,ZM,oO];for(const e of QM)(0,N.registerKernel)(e);
/** @license See the LICENSE file. */
const JM={"tfjs-core":N.version_core,"tfjs-backend-cpu":Ag,"tfjs-backend-webgl":rw,"tfjs-data":qp,"tfjs-layers":So,"tfjs-converter":Bh,tfjs:"4.22.0"}},30153:(e,t,n)=>{"use strict";const{SymbolDispose:i}=n(4184),{AbortError:r,codes:s}=n(66605),{isNodeStream:o,isWebStream:a,kControllerErrorFunction:l}=n(66569),u=n(29700),{ERR_INVALID_ARG_TYPE:c}=s;let d;e.exports.addAbortSignal=function(t,n){if(((e,t)=>{if("object"!=typeof e||!("aborted"in e))throw new c(t,"AbortSignal",e)})(t,"signal"),!o(n)&&!a(n))throw new c("stream",["ReadableStream","WritableStream","Stream"],n);return e.exports.addAbortSignalNoValidate(t,n)},e.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const s=o(t)?()=>{t.destroy(new r(void 0,{cause:e.reason}))}:()=>{t[l](new r(void 0,{cause:e.reason}))};if(e.aborted)s();else{d=d||n(20798).addAbortListener;const r=d(e,s);u(t,r[i])}return t}},1515:(e,t,n)=>{"use strict";const{StringPrototypeSlice:i,SymbolIterator:r,TypedArrayPrototypeSet:s,Uint8Array:o}=n(4184),{Buffer:a}=n(48287),{inspect:l}=n(20798);e.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(0===this.length)return"";let t=this.head,n=""+t.data;for(;null!==(t=t.next);)n+=e+t.data;return n}concat(e){if(0===this.length)return a.alloc(0);const t=a.allocUnsafe(e>>>0);let n=this.head,i=0;for(;n;)s(t,n.data,i),i+=n.data.length,n=n.next;return t}consume(e,t){const n=this.head.data;if(e<n.length){const t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[r](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t="",n=this.head,r=0;do{const s=n.data;if(!(e>s.length)){e===s.length?(t+=s,++r,n.next?this.head=n.next:this.head=this.tail=null):(t+=i(s,0,e),this.head=n,n.data=i(s,e));break}t+=s,e-=s.length,++r}while(null!==(n=n.next));return this.length-=r,t}_getBuffer(e){const t=a.allocUnsafe(e),n=e;let i=this.head,r=0;do{const a=i.data;if(!(e>a.length)){e===a.length?(s(t,a,n-e),++r,i.next?this.head=i.next:this.head=this.tail=null):(s(t,new o(a.buffer,a.byteOffset,e),n-e),this.head=i,i.data=a.slice(e));break}s(t,a,n-e),e-=a.length,++r}while(null!==(i=i.next));return this.length-=r,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return l(this,{...t,depth:0,customInspect:!1})}}},6864:(e,t,n)=>{"use strict";const{pipeline:i}=n(60872),r=n(94992),{destroyer:s}=n(42430),{isNodeStream:o,isReadable:a,isWritable:l,isWebStream:u,isTransformStream:c,isWritableStream:d,isReadableStream:h}=n(66569),{AbortError:p,codes:{ERR_INVALID_ARG_VALUE:f,ERR_MISSING_ARGS:m}}=n(66605),g=n(29700);e.exports=function(...e){if(0===e.length)throw new m("streams");if(1===e.length)return r.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=r.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=r.from(e[t])}for(let n=0;n<e.length;++n)if(o(e[n])||u(e[n])){if(n<e.length-1&&!(a(e[n])||h(e[n])||c(e[n])))throw new f(`streams[${n}]`,t[n],"must be readable");if(n>0&&!(l(e[n])||d(e[n])||c(e[n])))throw new f(`streams[${n}]`,t[n],"must be writable")}let n,y,_,v,b;const T=e[0],x=i(e,function(e){const t=v;v=null,t?t(e):e?b.destroy(e):w||E||b.destroy()}),E=!!(l(T)||d(T)||c(T)),w=!!(a(x)||h(x)||c(x));if(b=new r({writableObjectMode:!(null==T||!T.writableObjectMode),readableObjectMode:!(null==x||!x.readableObjectMode),writable:E,readable:w}),E){if(o(T))b._write=function(e,t,i){T.write(e,t)?i():n=i},b._final=function(e){T.end(),y=e},T.on("drain",function(){if(n){const e=n;n=null,e()}});else if(u(T)){const e=(c(T)?T.writable:T).getWriter();b._write=async function(t,n,i){try{await e.ready,e.write(t).catch(()=>{}),i()}catch(e){i(e)}},b._final=async function(t){try{await e.ready,e.close().catch(()=>{}),y=t}catch(e){t(e)}}}const e=c(x)?x.readable:x;g(e,()=>{if(y){const e=y;y=null,e()}})}if(w)if(o(x))x.on("readable",function(){if(_){const e=_;_=null,e()}}),x.on("end",function(){b.push(null)}),b._read=function(){for(;;){const e=x.read();if(null===e)return void(_=b._read);if(!b.push(e))return}};else if(u(x)){const e=(c(x)?x.readable:x).getReader();b._read=async function(){for(;;)try{const{value:t,done:n}=await e.read();if(!b.push(t))return;if(n)return void b.push(null)}catch{return}}}return b._destroy=function(e,t){e||null===v||(e=new p),_=null,n=null,y=null,null===v?t(e):(v=t,o(x)&&s(x,e))},b}},42430:(e,t,n)=>{"use strict";const i=n(65606),{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:s},AbortError:o}=n(66605),{Symbol:a}=n(4184),{kIsDestroyed:l,isDestroyed:u,isFinished:c,isServerRequest:d}=n(66569),h=a("kDestroy"),p=a("kConstruct");function f(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function m(e,t,n){let r=!1;function s(t){if(r)return;r=!0;const s=e._readableState,o=e._writableState;f(t,o,s),o&&(o.closed=!0),s&&(s.closed=!0),"function"==typeof n&&n(t),t?i.nextTick(g,e,t):i.nextTick(y,e)}try{e._destroy(t||null,s)}catch(t){s(t)}}function g(e,t){_(e,t),y(e)}function y(e){const t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=n&&n.emitClose||null!=t&&t.emitClose)&&e.emit("close")}function _(e,t){const n=e._readableState,i=e._writableState;null!=i&&i.errorEmitted||null!=n&&n.errorEmitted||(i&&(i.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit("error",t))}function v(e,t,n){const r=e._readableState,s=e._writableState;if(null!=s&&s.destroyed||null!=r&&r.destroyed)return this;null!=r&&r.autoDestroy||null!=s&&s.autoDestroy?e.destroy(t):t&&(t.stack,s&&!s.errored&&(s.errored=t),r&&!r.errored&&(r.errored=t),n?i.nextTick(_,e,t):_(e,t))}function b(e){let t=!1;function n(n){if(t)return void v(e,null!=n?n:new s);t=!0;const r=e._readableState,o=e._writableState,a=o||r;r&&(r.constructed=!0),o&&(o.constructed=!0),a.destroyed?e.emit(h,n):n?v(e,n,!0):i.nextTick(T,e)}try{e._construct(e=>{i.nextTick(n,e)})}catch(e){i.nextTick(n,e)}}function T(e){e.emit(p)}function x(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function E(e){e.emit("close")}function w(e,t){e.emit("error",t),i.nextTick(E,e)}e.exports={construct:function(e,t){if("function"!=typeof e._construct)return;const n=e._readableState,r=e._writableState;n&&(n.constructed=!1),r&&(r.constructed=!1),e.once(p,t),e.listenerCount(p)>1||i.nextTick(b,e)},destroyer:function(e,t){e&&!u(e)&&(t||c(e)||(t=new o),d(e)?(e.socket=null,e.destroy(t)):x(e)?e.abort():x(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?i.nextTick(w,e,t):i.nextTick(E,e),e.destroyed||(e[l]=!0))},destroy:function(e,t){const n=this._readableState,i=this._writableState,s=i||n;return null!=i&&i.destroyed||null!=n&&n.destroyed?("function"==typeof t&&t(),this):(f(e,i,n),i&&(i.destroyed=!0),n&&(n.destroyed=!0),s.constructed?m(this,e,t):this.once(h,function(n){m(this,r(n,e),t)}),this)},undestroy:function(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:v}},94992:(e,t,n)=>{"use strict";const{ObjectDefineProperties:i,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:s,ObjectSetPrototypeOf:o}=n(4184);e.exports=u;const a=n(76566),l=n(10394);o(u.prototype,a.prototype),o(u,a);{const e=s(l.prototype);for(let t=0;t<e.length;t++){const n=e[t];u.prototype[n]||(u.prototype[n]=l.prototype[n])}}function u(e){if(!(this instanceof u))return new u(e);a.call(this,e),l.call(this,e),e?(this.allowHalfOpen=!1!==e.allowHalfOpen,!1===e.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===e.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}let c,d;function h(){return void 0===c&&(c={}),c}i(u.prototype,{writable:{__proto__:null,...r(l.prototype,"writable")},writableHighWaterMark:{__proto__:null,...r(l.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...r(l.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...r(l.prototype,"writableBuffer")},writableLength:{__proto__:null,...r(l.prototype,"writableLength")},writableFinished:{__proto__:null,...r(l.prototype,"writableFinished")},writableCorked:{__proto__:null,...r(l.prototype,"writableCorked")},writableEnded:{__proto__:null,...r(l.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...r(l.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}}),u.fromWeb=function(e,t){return h().newStreamDuplexFromReadableWritablePair(e,t)},u.toWeb=function(e){return h().newReadableWritablePairFromDuplex(e)},u.from=function(e){return d||(d=n(34512)),d(e,"body")}},34512:(e,t,n)=>{const i=n(65606),r=n(48287),{isReadable:s,isWritable:o,isIterable:a,isNodeStream:l,isReadableNodeStream:u,isWritableNodeStream:c,isDuplexNodeStream:d,isReadableStream:h,isWritableStream:p}=n(66569),f=n(29700),{AbortError:m,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:y}}=n(66605),{destroyer:_}=n(42430),v=n(94992),b=n(76566),T=n(10394),{createDeferredPromise:x}=n(20798),E=n(3182),w=globalThis.Blob||r.Blob,I=void 0!==w?function(e){return e instanceof w}:function(e){return!1},A=globalThis.AbortController||n(25568).AbortController,{FunctionPrototypeCall:S}=n(4184);class C extends v{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}function O(e){const t=e.readable&&"function"!=typeof e.readable.read?b.wrap(e.readable):e.readable,n=e.writable;let i,r,a,l,u,c=!!s(t),d=!!o(n);function h(e){const t=l;l=null,t?t(e):e&&u.destroy(e)}return u=new C({readableObjectMode:!(null==t||!t.readableObjectMode),writableObjectMode:!(null==n||!n.writableObjectMode),readable:c,writable:d}),d&&(f(n,e=>{d=!1,e&&_(t,e),h(e)}),u._write=function(e,t,r){n.write(e,t)?r():i=r},u._final=function(e){n.end(),r=e},n.on("drain",function(){if(i){const e=i;i=null,e()}}),n.on("finish",function(){if(r){const e=r;r=null,e()}})),c&&(f(t,e=>{c=!1,e&&_(t,e),h(e)}),t.on("readable",function(){if(a){const e=a;a=null,e()}}),t.on("end",function(){u.push(null)}),u._read=function(){for(;;){const e=t.read();if(null===e)return void(a=u._read);if(!u.push(e))return}}),u._destroy=function(e,s){e||null===l||(e=new m),a=null,i=null,r=null,null===l?s(e):(l=s,_(n,e),_(t,e))},u}e.exports=function e(t,n){if(d(t))return t;if(u(t))return O({readable:t});if(c(t))return O({writable:t});if(l(t))return O({writable:!1,readable:!1});if(h(t))return O({readable:b.fromWeb(t)});if(p(t))return O({writable:T.fromWeb(t)});if("function"==typeof t){const{value:e,write:r,final:s,destroy:o}=function(e){let{promise:t,resolve:n}=x();const r=new A,s=r.signal,o=e(async function*(){for(;;){const e=t;t=null;const{chunk:r,done:o,cb:a}=await e;if(i.nextTick(a),o)return;if(s.aborted)throw new m(void 0,{cause:s.reason});({promise:t,resolve:n}=x()),yield r}}(),{signal:s});return{value:o,write(e,t,i){const r=n;n=null,r({chunk:e,done:!1,cb:i})},final(e){const t=n;n=null,t({done:!0,cb:e})},destroy(e,t){r.abort(),t(e)}}}(t);if(a(e))return E(C,e,{objectMode:!0,write:r,final:s,destroy:o});const l=null==e?void 0:e.then;if("function"==typeof l){let t;const n=S(l,e,e=>{if(null!=e)throw new y("nully","body",e)},e=>{_(t,e)});return t=new C({objectMode:!0,readable:!1,write:r,final(e){s(async()=>{try{await n,i.nextTick(e,null)}catch(t){i.nextTick(e,t)}})},destroy:o})}throw new y("Iterable, AsyncIterable or AsyncFunction",n,e)}if(I(t))return e(t.arrayBuffer());if(a(t))return E(C,t,{objectMode:!0,writable:!1});if(h(null==t?void 0:t.readable)&&p(null==t?void 0:t.writable))return C.fromWeb(t);if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable)){return O({readable:null!=t&&t.readable?u(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?c(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0})}const r=null==t?void 0:t.then;if("function"==typeof r){let e;return S(r,t,t=>{null!=t&&e.push(t),e.push(null)},t=>{_(e,t)}),e=new C({objectMode:!0,writable:!1,read(){}})}throw new g(n,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)}},29700:(e,t,n)=>{const i=n(65606),{AbortError:r,codes:s}=n(66605),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_PREMATURE_CLOSE:a}=s,{kEmptyObject:l,once:u}=n(20798),{validateAbortSignal:c,validateFunction:d,validateObject:h,validateBoolean:p}=n(86283),{Promise:f,PromisePrototypeThen:m,SymbolDispose:g}=n(4184),{isClosed:y,isReadable:_,isReadableNodeStream:v,isReadableStream:b,isReadableFinished:T,isReadableErrored:x,isWritable:E,isWritableNodeStream:w,isWritableStream:I,isWritableFinished:A,isWritableErrored:S,isNodeStream:C,willEmitClose:O,kIsClosedPromise:M}=n(66569);let R;const k=()=>{};function N(e,t,s){var p,f;if(2===arguments.length?(s=t,t=l):null==t?t=l:h(t,"options"),d(s,"callback"),c(t.signal,"options.signal"),s=u(s),b(e)||I(e))return function(e,t,s){let o=!1,a=k;if(t.signal)if(a=()=>{o=!0,s.call(e,new r(void 0,{cause:t.signal.reason}))},t.signal.aborted)i.nextTick(a);else{R=R||n(20798).addAbortListener;const i=R(t.signal,a),r=s;s=u((...t)=>{i[g](),r.apply(e,t)})}const l=(...t)=>{o||i.nextTick(()=>s.apply(e,t))};return m(e[M].promise,l,l),k}(e,t,s);if(!C(e))throw new o("stream",["ReadableStream","WritableStream","Stream"],e);const N=null!==(p=t.readable)&&void 0!==p?p:v(e),D=null!==(f=t.writable)&&void 0!==f?f:w(e),F=e._writableState,L=e._readableState,P=()=>{e.writable||U()};let B=O(e)&&v(e)===N&&w(e)===D,$=A(e,!1);const U=()=>{$=!0,e.destroyed&&(B=!1),(!B||e.readable&&!N)&&(N&&!z||s.call(e))};let z=T(e,!1);const V=()=>{z=!0,e.destroyed&&(B=!1),(!B||e.writable&&!D)&&(D&&!$||s.call(e))},j=t=>{s.call(e,t)};let Y=y(e);const G=()=>{Y=!0;const t=S(e)||x(e);return t&&"boolean"!=typeof t?s.call(e,t):N&&!z&&v(e,!0)&&!T(e,!1)?s.call(e,new a):!D||$||A(e,!1)?void s.call(e):s.call(e,new a)},H=()=>{Y=!0;const t=S(e)||x(e);if(t&&"boolean"!=typeof t)return s.call(e,t);s.call(e)},W=()=>{e.req.on("finish",U)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?D&&!F&&(e.on("end",P),e.on("close",P)):(e.on("complete",U),B||e.on("abort",G),e.req?W():e.on("request",W)),B||"boolean"!=typeof e.aborted||e.on("aborted",G),e.on("end",V),e.on("finish",U),!1!==t.error&&e.on("error",j),e.on("close",G),Y?i.nextTick(G):null!=F&&F.errorEmitted||null!=L&&L.errorEmitted?B||i.nextTick(H):(N||B&&!_(e)||!$&&!1!==E(e))&&(D||B&&!E(e)||!z&&!1!==_(e))?L&&e.req&&e.aborted&&i.nextTick(H):i.nextTick(H);const X=()=>{s=k,e.removeListener("aborted",G),e.removeListener("complete",U),e.removeListener("abort",G),e.removeListener("request",W),e.req&&e.req.removeListener("finish",U),e.removeListener("end",P),e.removeListener("close",P),e.removeListener("finish",U),e.removeListener("end",V),e.removeListener("error",j),e.removeListener("close",G)};if(t.signal&&!Y){const o=()=>{const n=s;X(),n.call(e,new r(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)i.nextTick(o);else{R=R||n(20798).addAbortListener;const i=R(t.signal,o),r=s;s=u((...t)=>{i[g](),r.apply(e,t)})}}return X}e.exports=N,e.exports.finished=function(e,t){var n;let i=!1;return null===t&&(t=l),null!==(n=t)&&void 0!==n&&n.cleanup&&(p(t.cleanup,"cleanup"),i=t.cleanup),new f((n,r)=>{const s=N(e,t,e=>{i&&s(),e?r(e):n()})})}},3182:(e,t,n)=>{"use strict";const i=n(65606),{PromisePrototypeThen:r,SymbolAsyncIterator:s,SymbolIterator:o}=n(4184),{Buffer:a}=n(48287),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_NULL_VALUES:u}=n(66605).codes;e.exports=function(e,t,n){let c,d;if("string"==typeof t||t instanceof a)return new e({objectMode:!0,...n,read(){this.push(t),this.push(null)}});if(t&&t[s])d=!0,c=t[s]();else{if(!t||!t[o])throw new l("iterable",["Iterable"],t);d=!1,c=t[o]()}const h=new e({objectMode:!0,highWaterMark:1,...n});let p=!1;return h._read=function(){p||(p=!0,async function(){for(;;){try{const{value:e,done:t}=d?await c.next():c.next();if(t)h.push(null);else{const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw p=!1,new u;if(h.push(t))continue;p=!1}}catch(e){h.destroy(e)}break}}())},h._destroy=function(e,t){r(async function(e){const t=null!=e,n="function"==typeof c.throw;if(t&&n){const{value:t,done:n}=await c.throw(e);if(await t,n)return}if("function"==typeof c.return){const{value:e}=await c.return();await e}}(e),()=>i.nextTick(t,e),n=>i.nextTick(t,n||e))},h}},32913:(e,t,n)=>{"use strict";const{ArrayIsArray:i,ObjectSetPrototypeOf:r}=n(4184),{EventEmitter:s}=n(37007);function o(e){s.call(this,e)}function a(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?i(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}r(o.prototype,s.prototype),r(o,s),o.prototype.pipe=function(e,t){const n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function r(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",r),e._isStdio||t&&!1===t.end||(n.on("end",l),n.on("close",u));let o=!1;function l(){o||(o=!0,e.end())}function u(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){d(),0===s.listenerCount(this,"error")&&this.emit("error",e)}function d(){n.removeListener("data",i),e.removeListener("drain",r),n.removeListener("end",l),n.removeListener("close",u),n.removeListener("error",c),e.removeListener("error",c),n.removeListener("end",d),n.removeListener("close",d),e.removeListener("close",d)}return a(n,"error",c),a(e,"error",c),n.on("end",d),n.on("close",d),e.on("close",d),e.emit("pipe",n),e},e.exports={Stream:o,prependListener:a}},65589:(e,t,n)=>{"use strict";const i=globalThis.AbortController||n(25568).AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:s,ERR_MISSING_ARGS:o,ERR_OUT_OF_RANGE:a},AbortError:l}=n(66605),{validateAbortSignal:u,validateInteger:c,validateObject:d}=n(86283),h=n(4184).Symbol("kWeak"),p=n(4184).Symbol("kResistStopPropagation"),{finished:f}=n(29700),m=n(6864),{addAbortSignalNoValidate:g}=n(30153),{isWritable:y,isNodeStream:_}=n(66569),{deprecate:v}=n(20798),{ArrayPrototypePush:b,Boolean:T,MathFloor:x,Number:E,NumberIsNaN:w,Promise:I,PromiseReject:A,PromiseResolve:S,PromisePrototypeThen:C,Symbol:O}=n(4184),M=O("kEmpty"),R=O("kEof");function k(e,t){if("function"!=typeof e)throw new s("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal");let i=1;null!=(null==t?void 0:t.concurrency)&&(i=x(t.concurrency));let r=i-1;return null!=(null==t?void 0:t.highWaterMark)&&(r=x(t.highWaterMark)),c(i,"options.concurrency",1),c(r,"options.highWaterMark",0),r+=i,async function*(){const s=n(20798).AbortSignalAny([null==t?void 0:t.signal].filter(T)),o=this,a=[],u={signal:s};let c,d,h=!1,p=0;function f(){h=!0,m()}function m(){p-=1,g()}function g(){d&&!h&&p<i&&a.length<r&&(d(),d=null)}!async function(){try{for await(let t of o){if(h)return;if(s.aborted)throw new l;try{if(t=e(t,u),t===M)continue;t=S(t)}catch(e){t=A(e)}p+=1,C(t,m,f),a.push(t),c&&(c(),c=null),!h&&(a.length>=r||p>=i)&&await new I(e=>{d=e})}a.push(R)}catch(e){const t=A(e);C(t,m,f),a.push(t)}finally{h=!0,c&&(c(),c=null)}}();try{for(;;){for(;a.length>0;){const e=await a[0];if(e===R)return;if(s.aborted)throw new l;e!==M&&(yield e),a.shift(),g()}await new I(e=>{c=e})}}finally{h=!0,d&&(d(),d=null)}}.call(this)}async function N(e,t=void 0){for await(const n of D.call(this,e,t))return!0;return!1}function D(e,t){if("function"!=typeof e)throw new s("fn",["Function","AsyncFunction"],e);return k.call(this,async function(t,n){return await e(t,n)?t:M},t)}class F extends o{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function L(e){if(e=E(e),w(e))return 0;if(e<0)throw new a("number",">= 0",e);return e}e.exports.streamReturningOperators={asIndexedPairs:v(function(e=void 0){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal"),async function*(){let t=0;for await(const i of this){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new l({cause:e.signal.reason});yield[t++,i]}}.call(this)},"readable.asIndexedPairs will be removed in a future version."),drop:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=L(e),async function*(){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;for await(const n of this){var i;if(null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted)throw new l;e--<=0&&(yield n)}}.call(this)},filter:D,flatMap:function(e,t){const n=k.call(this,e,t);return async function*(){for await(const e of n)yield*e}.call(this)},map:k,take:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=L(e),async function*(){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;for await(const n of this){var i;if(null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted)throw new l;if(e-- >0&&(yield n),e<=0)return}}.call(this)},compose:function(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),_(e)&&!y(e))throw new r("stream",e,"must be writable");const n=m(this,e);return null!=t&&t.signal&&g(t.signal,n),n}},e.exports.promiseReturningOperators={every:async function(e,t=void 0){if("function"!=typeof e)throw new s("fn",["Function","AsyncFunction"],e);return!await N.call(this,async(...t)=>!await e(...t),t)},forEach:async function(e,t){if("function"!=typeof e)throw new s("fn",["Function","AsyncFunction"],e);for await(const n of k.call(this,async function(t,n){return await e(t,n),M},t));},reduce:async function(e,t,n){var r;if("function"!=typeof e)throw new s("reducer",["Function","AsyncFunction"],e);null!=n&&d(n,"options"),null!=(null==n?void 0:n.signal)&&u(n.signal,"options.signal");let o=arguments.length>1;if(null!=n&&null!==(r=n.signal)&&void 0!==r&&r.aborted){const e=new l(void 0,{cause:n.signal.reason});throw this.once("error",()=>{}),await f(this.destroy(e)),e}const a=new i,c=a.signal;if(null!=n&&n.signal){const e={once:!0,[h]:this,[p]:!0};n.signal.addEventListener("abort",()=>a.abort(),e)}let m=!1;try{for await(const i of this){var g;if(m=!0,null!=n&&null!==(g=n.signal)&&void 0!==g&&g.aborted)throw new l;o?t=await e(t,i,{signal:c}):(t=i,o=!0)}if(!m&&!o)throw new F}finally{a.abort()}return t},toArray:async function(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal");const t=[];for await(const i of this){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new l(void 0,{cause:e.signal.reason});b(t,i)}return t},some:N,find:async function(e,t){for await(const n of D.call(this,e,t))return n}}},6898:(e,t,n)=>{"use strict";const{ObjectSetPrototypeOf:i}=n(4184);e.exports=s;const r=n(50208);function s(e){if(!(this instanceof s))return new s(e);r.call(this,e)}i(s.prototype,r.prototype),i(s,r),s.prototype._transform=function(e,t,n){n(null,e)}},60872:(e,t,n)=>{const i=n(65606),{ArrayIsArray:r,Promise:s,SymbolAsyncIterator:o,SymbolDispose:a}=n(4184),l=n(29700),{once:u}=n(20798),c=n(42430),d=n(94992),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:p,ERR_INVALID_RETURN_VALUE:f,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:_}=n(66605),{validateFunction:v,validateAbortSignal:b}=n(86283),{isIterable:T,isReadable:x,isReadableNodeStream:E,isNodeStream:w,isTransformStream:I,isWebStream:A,isReadableStream:S,isReadableFinished:C}=n(66569),O=globalThis.AbortController||n(25568).AbortController;let M,R,k;function N(e,t,n){let i=!1;e.on("close",()=>{i=!0});return{destroy:t=>{i||(i=!0,c.destroyer(e,t||new g("pipe")))},cleanup:l(e,{readable:t,writable:n},e=>{i=!e})}}function D(e){if(T(e))return e;if(E(e))return async function*(e){R||(R=n(76566));yield*R.prototype[o].call(e)}(e);throw new p("val",["Readable","Iterable","AsyncIterable"],e)}async function F(e,t,n,{end:i}){let r,o=null;const a=e=>{if(e&&(r=e),o){const e=o;o=null,e()}},u=()=>new s((e,t)=>{r?t(r):o=()=>{r?t(r):e()}});t.on("drain",a);const c=l(t,{readable:!1},a);try{t.writableNeedDrain&&await u();for await(const n of e)t.write(n)||await u();i&&(t.end(),await u()),n()}catch(e){n(r!==e?h(r,e):e)}finally{c(),t.off("drain",a)}}async function L(e,t,n,{end:i}){I(t)&&(t=t.writable);const r=t.getWriter();try{for await(const t of e)await r.ready,r.write(t).catch(()=>{});await r.ready,i&&await r.close(),n()}catch(e){try{await r.abort(e),n(e)}catch(e){n(e)}}}function P(e,t,s){if(1===e.length&&r(e[0])&&(e=e[0]),e.length<2)throw new m("streams");const o=new O,l=o.signal,u=null==s?void 0:s.signal,c=[];function h(){U(new _)}let g,y,v;b(u,"options.signal"),k=k||n(20798).addAbortListener,u&&(g=k(u,h));const C=[];let R,P=0;function $(e){U(e,0===--P)}function U(e,n){var r;if(!e||y&&"ERR_STREAM_PREMATURE_CLOSE"!==y.code||(y=e),y||n){for(;C.length;)C.shift()(y);null===(r=g)||void 0===r||r[a](),o.abort(),n&&(y||c.forEach(e=>e()),i.nextTick(t,y,v))}}for(let Y=0;Y<e.length;Y++){const G=e[Y],H=Y<e.length-1,W=Y>0,X=H||!1!==(null==s?void 0:s.end),q=Y===e.length-1;if(w(G)){if(X){const{destroy:K,cleanup:Z}=N(G,H,W);C.push(K),x(G)&&q&&c.push(Z)}function z(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&$(e)}G.on("error",z),x(G)&&q&&c.push(()=>{G.removeListener("error",z)})}if(0===Y)if("function"==typeof G){if(R=G({signal:l}),!T(R))throw new f("Iterable, AsyncIterable or Stream","source",R)}else R=T(G)||E(G)||I(G)?G:d.from(G);else if("function"==typeof G){var V;if(I(R))R=D(null===(V=R)||void 0===V?void 0:V.readable);else R=D(R);if(R=G(R,{signal:l}),H){if(!T(R,!0))throw new f("AsyncIterable",`transform[${Y-1}]`,R)}else{var j;M||(M=n(6898));const Q=new M({objectMode:!0}),J=null===(j=R)||void 0===j?void 0:j.then;if("function"==typeof J)P++,J.call(R,e=>{v=e,null!=e&&Q.write(e),X&&Q.end(),i.nextTick($)},e=>{Q.destroy(e),i.nextTick($,e)});else if(T(R,!0))P++,F(R,Q,$,{end:X});else{if(!S(R)&&!I(R))throw new f("AsyncIterable or Promise","destination",R);{const ne=R.readable||R;P++,F(ne,Q,$,{end:X})}}R=Q;const{destroy:ee,cleanup:te}=N(R,!1,!0);C.push(ee),q&&c.push(te)}}else if(w(G)){if(E(R)){P+=2;const ie=B(R,G,$,{end:X});x(G)&&q&&c.push(ie)}else if(I(R)||S(R)){const re=R.readable||R;P++,F(re,G,$,{end:X})}else{if(!T(R))throw new p("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],R);P++,F(R,G,$,{end:X})}R=G}else if(A(G)){if(E(R))P++,L(D(R),G,$,{end:X});else if(S(R)||T(R))P++,L(R,G,$,{end:X});else{if(!I(R))throw new p("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],R);P++,L(R.readable,G,$,{end:X})}R=G}else R=d.from(G)}return(null!=l&&l.aborted||null!=u&&u.aborted)&&i.nextTick(h),R}function B(e,t,n,{end:r}){let s=!1;if(t.on("close",()=>{s||n(new y)}),e.pipe(t,{end:!1}),r){function o(){s=!0,t.end()}C(e)?i.nextTick(o):e.once("end",o)}else n();return l(e,{readable:!0,writable:!1},t=>{const i=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&i&&i.ended&&!i.errored&&!i.errorEmitted?e.once("end",n).once("error",n):n(t)}),l(t,{readable:!1,writable:!0},n)}e.exports={pipelineImpl:P,pipeline:function(...e){return P(e,u(function(e){return v(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}}},76566:(e,t,n)=>{const i=n(65606),{ArrayPrototypeIndexOf:r,NumberIsInteger:s,NumberIsNaN:o,NumberParseInt:a,ObjectDefineProperties:l,ObjectKeys:u,ObjectSetPrototypeOf:c,Promise:d,SafeSet:h,SymbolAsyncDispose:p,SymbolAsyncIterator:f,Symbol:m}=n(4184);e.exports=W,W.ReadableState=H;const{EventEmitter:g}=n(37007),{Stream:y,prependListener:_}=n(32913),{Buffer:v}=n(48287),{addAbortSignal:b}=n(30153),T=n(29700);let x=n(20798).debuglog("stream",e=>{x=e});const E=n(1515),w=n(42430),{getHighWaterMark:I,getDefaultHighWaterMark:A}=n(19153),{aggregateTwoErrors:S,codes:{ERR_INVALID_ARG_TYPE:C,ERR_METHOD_NOT_IMPLEMENTED:O,ERR_OUT_OF_RANGE:M,ERR_STREAM_PUSH_AFTER_EOF:R,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:k},AbortError:N}=n(66605),{validateObject:D}=n(86283),F=m("kPaused"),{StringDecoder:L}=n(98707),P=n(3182);c(W.prototype,y.prototype),c(W,y);const B=()=>{},{errorOrDestroy:$}=w,U=1,z=16,V=32,j=2048,Y=4096;function G(e){return{enumerable:!1,get(){return 0!==(this.state&e)},set(t){t?this.state|=e:this.state&=~e}}}function H(e,t,i){"boolean"!=typeof i&&(i=t instanceof n(94992)),this.state=j|Y|z|V,e&&e.objectMode&&(this.state|=U),i&&e&&e.readableObjectMode&&(this.state|=U),this.highWaterMark=e?I(this,e,"readableHighWaterMark",i):A(!1),this.buffer=new E,this.length=0,this.pipes=[],this.flowing=null,this[F]=null,e&&!1===e.emitClose&&(this.state&=~j),e&&!1===e.autoDestroy&&(this.state&=~Y),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new L(e.encoding),this.encoding=e.encoding)}function W(e){if(!(this instanceof W))return new W(e);const t=this instanceof n(94992);this._readableState=new H(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&b(e.signal,this)),y.call(this,e),w.construct(this,()=>{this._readableState.needReadable&&J(this,this._readableState)})}function X(e,t,n,i){x("readableAddChunk",t);const r=e._readableState;let s;if(0===(r.state&U)&&("string"==typeof t?(n=n||r.defaultEncoding,r.encoding!==n&&(i&&r.encoding?t=v.from(t,n).toString(r.encoding):(t=v.from(t,n),n=""))):t instanceof v?n="":y._isUint8Array(t)?(t=y._uint8ArrayToBuffer(t),n=""):null!=t&&(s=new C("chunk",["string","Buffer","Uint8Array"],t))),s)$(e,s);else if(null===t)r.state&=-9,function(e,t){if(x("onEofChunk"),t.ended)return;if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?Z(e):(t.needReadable=!1,t.emittedReadable=!0,Q(e))}(e,r);else if(0!==(r.state&U)||t&&t.length>0)if(i)if(4&r.state)$(e,new k);else{if(r.destroyed||r.errored)return!1;q(e,r,t,!0)}else if(r.ended)$(e,new R);else{if(r.destroyed||r.errored)return!1;r.state&=-9,r.decoder&&!n?(t=r.decoder.write(t),r.objectMode||0!==t.length?q(e,r,t,!1):J(e,r)):q(e,r,t,!1)}else i||(r.state&=-9,J(e,r));return!r.ended&&(r.length<r.highWaterMark||0===r.length)}function q(e,t,n,i){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(65536&t.state?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),64&t.state&&Z(e)),J(e,t)}l(H.prototype,{objectMode:G(U),ended:G(2),endEmitted:G(4),reading:G(8),constructed:G(z),sync:G(V),needReadable:G(64),emittedReadable:G(128),readableListening:G(256),resumeScheduled:G(512),errorEmitted:G(1024),emitClose:G(j),autoDestroy:G(Y),destroyed:G(8192),closed:G(16384),closeEmitted:G(32768),multiAwaitDrain:G(65536),readingMore:G(1<<17),dataEmitted:G(1<<18)}),W.prototype.destroy=w.destroy,W.prototype._undestroy=w.undestroy,W.prototype._destroy=function(e,t){t(e)},W.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},W.prototype[p]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new N,this.destroy(e)),new d((t,n)=>T(this,i=>i&&i!==e?n(i):t(null)))},W.prototype.push=function(e,t){return X(this,e,t,!1)},W.prototype.unshift=function(e,t){return X(this,e,t,!0)},W.prototype.isPaused=function(){const e=this._readableState;return!0===e[F]||!1===e.flowing},W.prototype.setEncoding=function(e){const t=new L(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const n=this._readableState.buffer;let i="";for(const e of n)i+=t.write(e);return n.clear(),""!==i&&n.push(i),this._readableState.length=i.length,this};function K(e,t){return e<=0||0===t.length&&t.ended?0:0!==(t.state&U)?1:o(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function Z(e){const t=e._readableState;x("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(x("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(Q,e))}function Q(e){const t=e._readableState;x("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,re(e)}function J(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,i.nextTick(ee,e,t))}function ee(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){const n=t.length;if(x("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function te(e){const t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[F]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function ne(e){x("readable nexttick read 0"),e.read(0)}function ie(e,t){x("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),re(e),t.flowing&&!t.reading&&e.read(0)}function re(e){const t=e._readableState;for(x("flow",t.flowing);t.flowing&&null!==e.read(););}function se(e,t){"function"!=typeof e.read&&(e=W.wrap(e,{objectMode:!0}));const n=async function*(e,t){let n,i=B;function r(t){this===e?(i(),i=B):i=t}e.on("readable",r);const s=T(e,{writable:!1},e=>{n=e?S(n,e):null,i(),i=B});try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(n)throw n;if(null===n)return;await new d(r)}}}catch(e){throw n=S(n,e),n}finally{!n&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==n&&!e._readableState.autoDestroy?(e.off("readable",r),s()):w.destroyer(e,null)}}(e,t);return n.stream=e,n}function oe(e,t){if(0===t.length)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function ae(e){const t=e._readableState;x("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(le,t,e))}function le(e,t){if(x("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)i.nextTick(ue,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy()}}function ue(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}let ce;function de(){return void 0===ce&&(ce={}),ce}W.prototype.read=function(e){x("read",e),void 0===e?e=NaN:s(e)||(e=a(e,10));const t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new M("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.state&=-129),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return x("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ae(this):Z(this),null;if(0===(e=K(e,t))&&t.ended)return 0===t.length&&ae(this),null;let i,r=!!(64&t.state);if(x("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&(r=!0,x("length less than watermark",r)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)r=!1,x("reading, ended or constructing",r);else if(r){x("do read"),t.state|=8|V,0===t.length&&(t.state|=64);try{this._read(t.highWaterMark)}catch(e){$(this,e)}t.state&=~V,t.reading||(e=K(n,t))}return i=e>0?oe(e,t):null,null===i?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&ae(this)),null===i||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",i)),i},W.prototype._read=function(e){throw new O("_read()")},W.prototype.pipe=function(e,t){const n=this,r=this._readableState;1===r.pipes.length&&(r.multiAwaitDrain||(r.multiAwaitDrain=!0,r.awaitDrainWriters=new h(r.awaitDrainWriters?[r.awaitDrainWriters]:[]))),r.pipes.push(e),x("pipe count=%d opts=%j",r.pipes.length,t);const s=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?a:g;function o(t,i){x("onunpipe"),t===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,function(){x("cleanup"),e.removeListener("close",f),e.removeListener("finish",m),l&&e.removeListener("drain",l);e.removeListener("error",p),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",g),n.removeListener("data",d),u=!0,l&&r.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&l()}())}function a(){x("onend"),e.end()}let l;r.endEmitted?i.nextTick(s):n.once("end",s),e.on("unpipe",o);let u=!1;function c(){u||(1===r.pipes.length&&r.pipes[0]===e?(x("false write response, pause",0),r.awaitDrainWriters=e,r.multiAwaitDrain=!1):r.pipes.length>1&&r.pipes.includes(e)&&(x("false write response, pause",r.awaitDrainWriters.size),r.awaitDrainWriters.add(e)),n.pause()),l||(l=function(e,t){return function(){const n=e._readableState;n.awaitDrainWriters===t?(x("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(x("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),n.awaitDrainWriters&&0!==n.awaitDrainWriters.size||!e.listenerCount("data")||e.resume()}}(n,e),e.on("drain",l))}function d(t){x("ondata");const n=e.write(t);x("dest.write",n),!1===n&&c()}function p(t){if(x("onerror",t),g(),e.removeListener("error",p),0===e.listenerCount("error")){const n=e._writableState||e._readableState;n&&!n.errorEmitted?$(e,t):e.emit("error",t)}}function f(){e.removeListener("finish",m),g()}function m(){x("onfinish"),e.removeListener("close",f),g()}function g(){x("unpipe"),n.unpipe(e)}return n.on("data",d),_(e,"error",p),e.once("close",f),e.once("finish",m),e.emit("pipe",n),!0===e.writableNeedDrain?c():r.flowing||(x("pipe resume"),n.resume()),e},W.prototype.unpipe=function(e){const t=this._readableState;if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit("unpipe",this,{hasUnpiped:!1});return this}const n=r(t.pipes,e);return-1===n||(t.pipes.splice(n,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,{hasUnpiped:!1})),this},W.prototype.on=function(e,t){const n=y.prototype.on.call(this,e,t),r=this._readableState;return"data"===e?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,x("on readable",r.length,r.reading),r.length?Z(this):r.reading||i.nextTick(ne,this))),n},W.prototype.addListener=W.prototype.on,W.prototype.removeListener=function(e,t){const n=y.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(te,this),n},W.prototype.off=W.prototype.removeListener,W.prototype.removeAllListeners=function(e){const t=y.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(te,this),t},W.prototype.resume=function(){const e=this._readableState;return e.flowing||(x("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(ie,e,t))}(this,e)),e[F]=!1,this},W.prototype.pause=function(){return x("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(x("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[F]=!0,this},W.prototype.wrap=function(e){let t=!1;e.on("data",n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())}),e.on("end",()=>{this.push(null)}),e.on("error",e=>{$(this,e)}),e.on("close",()=>{this.destroy()}),e.on("destroy",()=>{this.destroy()}),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};const n=u(e);for(let t=1;t<n.length;t++){const i=n[t];void 0===this[i]&&"function"==typeof e[i]&&(this[i]=e[i].bind(e))}return this},W.prototype[f]=function(){return se(this)},W.prototype.iterator=function(e){return void 0!==e&&D(e,"options"),se(this,e)},l(W.prototype,{readable:{__proto__:null,get(){const e=this._readableState;return!(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._readableState.readable||!this._readableState.destroyed&&!this._readableState.errored||this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.objectMode}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return!!this._readableState&&this._readableState.closed}},destroyed:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.destroyed},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.endEmitted}}}),l(H.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return!1!==this[F]},set(e){this[F]=!!e}}}),W._fromList=oe,W.from=function(e,t){return P(W,e,t)},W.fromWeb=function(e,t){return de().newStreamReadableFromReadableStream(e,t)},W.toWeb=function(e,t){return de().newReadableStreamFromStreamReadable(e,t)},W.wrap=function(e,t){var n,i;return new W({objectMode:null===(n=null!==(i=e.readableObjectMode)&&void 0!==i?i:e.objectMode)||void 0===n||n,...t,destroy(t,n){w.destroyer(e,t),n(t)}}).wrap(e)}},19153:(e,t,n)=>{"use strict";const{MathFloor:i,NumberIsInteger:r}=n(4184),{validateInteger:s}=n(86283),{ERR_INVALID_ARG_VALUE:o}=n(66605).codes;let a=16384,l=16;function u(e){return e?l:a}e.exports={getHighWaterMark:function(e,t,n,s){const a=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,s,n);if(null!=a){if(!r(a)||a<0){throw new o(s?`options.${n}`:"options.highWaterMark",a)}return i(a)}return u(e.objectMode)},getDefaultHighWaterMark:u,setDefaultHighWaterMark:function(e,t){s(t,"value",0),e?l=t:a=t}}},50208:(e,t,n)=>{"use strict";const{ObjectSetPrototypeOf:i,Symbol:r}=n(4184);e.exports=u;const{ERR_METHOD_NOT_IMPLEMENTED:s}=n(66605).codes,o=n(94992),{getHighWaterMark:a}=n(19153);i(u.prototype,o.prototype),i(u,o);const l=r("kCallback");function u(e){if(!(this instanceof u))return new u(e);const t=e?a(this,e,"readableHighWaterMark",!0):null;0===t&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),o.call(this,e),this._readableState.sync=!1,this[l]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d)}function c(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush((t,n)=>{t?e?e(t):this.destroy(t):(null!=n&&this.push(n),this.push(null),e&&e())})}function d(){this._final!==c&&c.call(this)}u.prototype._final=c,u.prototype._transform=function(e,t,n){throw new s("_transform()")},u.prototype._write=function(e,t,n){const i=this._readableState,r=this._writableState,s=i.length;this._transform(e,t,(e,t)=>{e?n(e):(null!=t&&this.push(t),r.ended||s===i.length||i.length<i.highWaterMark?n():this[l]=n)})},u.prototype._read=function(){if(this[l]){const e=this[l];this[l]=null,e()}}},66569:(e,t,n)=>{"use strict";const{SymbolAsyncIterator:i,SymbolIterator:r,SymbolFor:s}=n(4184),o=s("nodejs.stream.destroyed"),a=s("nodejs.stream.errored"),l=s("nodejs.stream.readable"),u=s("nodejs.stream.writable"),c=s("nodejs.stream.disturbed"),d=s("nodejs.webstream.isClosedPromise"),h=s("nodejs.webstream.controllerErrorFunction");function p(e,t=!1){var n;return!(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(n=e._readableState)||void 0===n?void 0:n.readable)||e._writableState&&!e._readableState)}function f(e){var t;return!(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function m(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function g(e){return!(!e||m(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function y(e){return!(!e||m(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function _(e){return!(!e||m(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function v(e){if(!m(e))return null;const t=e._writableState,n=e._readableState,i=t||n;return!!(e.destroyed||e[o]||null!=i&&i.destroyed)}function b(e){if(!f(e))return null;if(!0===e.writableEnded)return!0;const t=e._writableState;return(null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function T(e,t){if(!p(e))return null;const n=e._readableState;return(null==n||!n.errored)&&("boolean"!=typeof(null==n?void 0:n.endEmitted)?null:!!(n.endEmitted||!1===t&&!0===n.ended&&0===n.length))}function x(e){return e&&null!=e[l]?e[l]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!v(e)&&(p(e)&&e.readable&&!T(e))}function E(e){return e&&null!=e[u]?e[u]:"boolean"!=typeof(null==e?void 0:e.writable)?null:!v(e)&&(f(e)&&e.writable&&!b(e))}function w(e){return"boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function I(e){return"boolean"==typeof e._sent100&&w(e)}e.exports={isDestroyed:v,kIsDestroyed:o,isDisturbed:function(e){var t;return!(!e||!(null!==(t=e[c])&&void 0!==t?t:e.readableDidRead||e.readableAborted))},kIsDisturbed:c,isErrored:function(e){var t,n,i,r,s,o,l,u,c,d;return!(!e||!(null!==(t=null!==(n=null!==(i=null!==(r=null!==(s=null!==(o=e[a])&&void 0!==o?o:e.readableErrored)&&void 0!==s?s:e.writableErrored)&&void 0!==r?r:null===(l=e._readableState)||void 0===l?void 0:l.errorEmitted)&&void 0!==i?i:null===(u=e._writableState)||void 0===u?void 0:u.errorEmitted)&&void 0!==n?n:null===(c=e._readableState)||void 0===c?void 0:c.errored)&&void 0!==t?t:null===(d=e._writableState)||void 0===d?void 0:d.errored))},kIsErrored:a,isReadable:x,kIsReadable:l,kIsClosedPromise:d,kControllerErrorFunction:h,kIsWritable:u,isClosed:function(e){if(!m(e))return null;if("boolean"==typeof e.closed)return e.closed;const t=e._writableState,n=e._readableState;return"boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==n?void 0:n.closed)?(null==t?void 0:t.closed)||(null==n?void 0:n.closed):"boolean"==typeof e._closed&&w(e)?e._closed:null},isDuplexNodeStream:function(e){return!(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)},isFinished:function(e,t){return m(e)?!!v(e)||(!1===(null==t?void 0:t.readable)||!x(e))&&(!1===(null==t?void 0:t.writable)||!E(e)):null},isIterable:function(e,t){return null!=e&&(!0===t?"function"==typeof e[i]:!1===t?"function"==typeof e[r]:"function"==typeof e[i]||"function"==typeof e[r])},isReadableNodeStream:p,isReadableStream:g,isReadableEnded:function(e){if(!p(e))return null;if(!0===e.readableEnded)return!0;const t=e._readableState;return!(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)},isReadableFinished:T,isReadableErrored:function(e){var t,n;return m(e)?e.readableErrored?e.readableErrored:null!==(t=null===(n=e._readableState)||void 0===n?void 0:n.errored)&&void 0!==t?t:null:null},isNodeStream:m,isWebStream:function(e){return g(e)||y(e)||_(e)},isWritable:E,isWritableNodeStream:f,isWritableStream:y,isWritableEnded:b,isWritableFinished:function(e,t){if(!f(e))return null;if(!0===e.writableFinished)return!0;const n=e._writableState;return(null==n||!n.errored)&&("boolean"!=typeof(null==n?void 0:n.finished)?null:!!(n.finished||!1===t&&!0===n.ended&&0===n.length))},isWritableErrored:function(e){var t,n;return m(e)?e.writableErrored?e.writableErrored:null!==(t=null===(n=e._writableState)||void 0===n?void 0:n.errored)&&void 0!==t?t:null:null},isServerRequest:function(e){var t;return"boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)},isServerResponse:I,willEmitClose:function(e){if(!m(e))return null;const t=e._writableState,n=e._readableState,i=t||n;return!i&&I(e)||!!(i&&i.autoDestroy&&i.emitClose&&!1===i.closed)},isTransformStream:_}},10394:(e,t,n)=>{const i=n(65606),{ArrayPrototypeSlice:r,Error:s,FunctionPrototypeSymbolHasInstance:o,ObjectDefineProperty:a,ObjectDefineProperties:l,ObjectSetPrototypeOf:u,StringPrototypeToLowerCase:c,Symbol:d,SymbolHasInstance:h}=n(4184);e.exports=D,D.WritableState=k;const{EventEmitter:p}=n(37007),f=n(32913).Stream,{Buffer:m}=n(48287),g=n(42430),{addAbortSignal:y}=n(30153),{getHighWaterMark:_,getDefaultHighWaterMark:v}=n(19153),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:T,ERR_MULTIPLE_CALLBACK:x,ERR_STREAM_CANNOT_PIPE:E,ERR_STREAM_DESTROYED:w,ERR_STREAM_ALREADY_FINISHED:I,ERR_STREAM_NULL_VALUES:A,ERR_STREAM_WRITE_AFTER_END:S,ERR_UNKNOWN_ENCODING:C}=n(66605).codes,{errorOrDestroy:O}=g;function M(){}u(D.prototype,f.prototype),u(D,f);const R=d("kOnFinished");function k(e,t,i){"boolean"!=typeof i&&(i=t instanceof n(94992)),this.objectMode=!(!e||!e.objectMode),i&&(this.objectMode=this.objectMode||!(!e||!e.writableObjectMode)),this.highWaterMark=e?_(this,e,"writableHighWaterMark",i):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const r=!(!e||!1!==e.decodeStrings);this.decodeStrings=!r,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=B.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,N(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||!1!==e.emitClose,this.autoDestroy=!e||!1!==e.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[R]=[]}function N(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}function D(e){const t=this instanceof n(94992);if(!t&&!o(D,this))return new D(e);this._writableState=new k(e,this,t),e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&y(e.signal,this)),f.call(this,e),g.construct(this,()=>{const e=this._writableState;e.writing||V(this,e),G(this,e)})}function F(e,t,n,r){const s=e._writableState;if("function"==typeof n)r=n,n=s.defaultEncoding;else{if(n){if("buffer"!==n&&!m.isEncoding(n))throw new C(n)}else n=s.defaultEncoding;"function"!=typeof r&&(r=M)}if(null===t)throw new A;if(!s.objectMode)if("string"==typeof t)!1!==s.decodeStrings&&(t=m.from(t,n),n="buffer");else if(t instanceof m)n="buffer";else{if(!f._isUint8Array(t))throw new b("chunk",["string","Buffer","Uint8Array"],t);t=f._uint8ArrayToBuffer(t),n="buffer"}let o;return s.ending?o=new S:s.destroyed&&(o=new w("write")),o?(i.nextTick(r,o),O(e,o,!0),o):(s.pendingcb++,function(e,t,n,i,r){const s=t.objectMode?1:n.length;t.length+=s;const o=t.length<t.highWaterMark;o||(t.needDrain=!0);t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:i,callback:r}),t.allBuffers&&"buffer"!==i&&(t.allBuffers=!1),t.allNoop&&r!==M&&(t.allNoop=!1)):(t.writelen=s,t.writecb=r,t.writing=!0,t.sync=!0,e._write(n,i,t.onwrite),t.sync=!1);return o&&!t.errored&&!t.destroyed}(e,s,t,n,r))}function L(e,t,n,i,r,s,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new w("write")):n?e._writev(r,t.onwrite):e._write(r,s,t.onwrite),t.sync=!1}function P(e,t,n,i){--t.pendingcb,i(n),z(t),O(e,n)}function B(e,t){const n=e._writableState,r=n.sync,s=n.writecb;"function"==typeof s?(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t?(t.stack,n.errored||(n.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),r?i.nextTick(P,e,n,t,s):P(e,n,t,s)):(n.buffered.length>n.bufferedIndex&&V(e,n),r?null!==n.afterWriteTickInfo&&n.afterWriteTickInfo.cb===s?n.afterWriteTickInfo.count++:(n.afterWriteTickInfo={count:1,cb:s,stream:e,state:n},i.nextTick($,n.afterWriteTickInfo)):U(e,n,1,s))):O(e,new x)}function $({stream:e,state:t,count:n,cb:i}){return t.afterWriteTickInfo=null,U(e,t,n,i)}function U(e,t,n,i){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));n-- >0;)t.pendingcb--,i();t.destroyed&&z(t),G(e,t)}function z(e){if(e.writing)return;for(let n=e.bufferedIndex;n<e.buffered.length;++n){var t;const{chunk:i,callback:r}=e.buffered[n],s=e.objectMode?1:i.length;e.length-=s,r(null!==(t=e.errored)&&void 0!==t?t:new w("write"))}const n=e[R].splice(0);for(let t=0;t<n.length;t++){var i;n[t](null!==(i=e.errored)&&void 0!==i?i:new w("end"))}N(e)}function V(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;const{buffered:n,bufferedIndex:i,objectMode:s}=t,o=n.length-i;if(!o)return;let a=i;if(t.bufferProcessing=!0,o>1&&e._writev){t.pendingcb-=o-1;const i=t.allNoop?M:e=>{for(let t=a;t<n.length;++t)n[t].callback(e)},s=t.allNoop&&0===a?n:r(n,a);s.allBuffers=t.allBuffers,L(e,t,!0,t.length,s,"",i),N(t)}else{do{const{chunk:i,encoding:r,callback:o}=n[a];n[a++]=null;L(e,t,!1,s?1:i.length,i,r,o)}while(a<n.length&&!t.writing);a===n.length?N(t):a>256?(n.splice(0,a),t.bufferedIndex=0):t.bufferedIndex=a}t.bufferProcessing=!1}function j(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function Y(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,function(e,t){let n=!1;function r(r){if(n)O(e,null!=r?r:x());else if(n=!0,t.pendingcb--,r){const n=t[R].splice(0);for(let e=0;e<n.length;e++)n[e](r);O(e,r,t.sync)}else j(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,i.nextTick(H,e,t))}t.sync=!0,t.pendingcb++;try{e._final(r)}catch(e){r(e)}t.sync=!1}(e,t)))}function G(e,t,n){j(t)&&(Y(e,t),0===t.pendingcb&&(n?(t.pendingcb++,i.nextTick((e,t)=>{j(t)?H(e,t):t.pendingcb--},e,t)):j(t)&&(t.pendingcb++,H(e,t))))}function H(e,t){t.pendingcb--,t.finished=!0;const n=t[R].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit("finish"),t.autoDestroy){const t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||!1===t.readable))&&e.destroy()}}k.prototype.getBuffer=function(){return r(this.buffered,this.bufferedIndex)},a(k.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),a(D,h,{__proto__:null,value:function(e){return!!o(this,e)||this===D&&(e&&e._writableState instanceof k)}}),D.prototype.pipe=function(){O(this,new E)},D.prototype.write=function(e,t,n){return!0===F(this,e,t,n)},D.prototype.cork=function(){this._writableState.corked++},D.prototype.uncork=function(){const e=this._writableState;e.corked&&(e.corked--,e.writing||V(this,e))},D.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=c(e)),!m.isEncoding(e))throw new C(e);return this._writableState.defaultEncoding=e,this},D.prototype._write=function(e,t,n){if(!this._writev)throw new T("_write()");this._writev([{chunk:e,encoding:t}],n)},D.prototype._writev=null,D.prototype.end=function(e,t,n){const r=this._writableState;let o;if("function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e){const n=F(this,e,t);n instanceof s&&(o=n)}return r.corked&&(r.corked=1,this.uncork()),o||(r.errored||r.ending?r.finished?o=new I("end"):r.destroyed&&(o=new w("end")):(r.ending=!0,G(this,r,!0),r.ended=!0)),"function"==typeof n&&(o||r.finished?i.nextTick(n,o):r[R].push(n)),this},l(D.prototype,{closed:{__proto__:null,get(){return!!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return!!this._writableState&&this._writableState.destroyed},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){const e=this._writableState;return!(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return!!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return!!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return!!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){const e=this._writableState;return!!e&&(!e.destroyed&&!e.ending&&e.needDrain)}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});const W=g.destroy;let X;function q(){return void 0===X&&(X={}),X}D.prototype.destroy=function(e,t){const n=this._writableState;return!n.destroyed&&(n.bufferedIndex<n.buffered.length||n[R].length)&&i.nextTick(z,n),W.call(this,e,t),this},D.prototype._undestroy=g.undestroy,D.prototype._destroy=function(e,t){t(e)},D.prototype[p.captureRejectionSymbol]=function(e){this.destroy(e)},D.fromWeb=function(e,t){return q().newStreamWritableFromWritableStream(e,t)},D.toWeb=function(e){return q().newWritableStreamFromStreamWritable(e)}},86283:(e,t,n)=>{"use strict";const{ArrayIsArray:i,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:s,ArrayPrototypeMap:o,NumberIsInteger:a,NumberIsNaN:l,NumberMAX_SAFE_INTEGER:u,NumberMIN_SAFE_INTEGER:c,NumberParseInt:d,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:p,String:f,StringPrototypeToUpperCase:m,StringPrototypeTrim:g}=n(4184),{hideStackFrames:y,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:b,ERR_OUT_OF_RANGE:T,ERR_UNKNOWN_SIGNAL:x}}=n(66605),{normalizeEncoding:E}=n(20798),{isAsyncFunction:w,isArrayBufferView:I}=n(20798).types,A={};const S=/^[0-7]+$/;const C=y((e,t,n=c,i=u)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!a(e))throw new T(t,"an integer",e);if(e<n||e>i)throw new T(t,`>= ${n} && <= ${i}`,e)}),O=y((e,t,n=-2147483648,i=2147483647)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!a(e))throw new T(t,"an integer",e);if(e<n||e>i)throw new T(t,`>= ${n} && <= ${i}`,e)}),M=y((e,t,n=!1)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!a(e))throw new T(t,"an integer",e);const i=n?1:0,r=4294967295;if(e<i||e>r)throw new T(t,`>= ${i} && <= ${r}`,e)});function R(e,t){if("string"!=typeof e)throw new v(t,"string",e)}const k=y((e,t,n)=>{if(!r(n,e)){const i=s(o(n,e=>"string"==typeof e?`'${e}'`:f(e)),", ");throw new b(t,e,"must be one of: "+i)}});function N(e,t){if("boolean"!=typeof e)throw new v(t,"boolean",e)}function D(e,t,n){return null!=e&&h(e,t)?e[t]:n}const F=y((e,t,n=null)=>{const r=D(n,"allowArray",!1),s=D(n,"allowFunction",!1);if(!D(n,"nullable",!1)&&null===e||!r&&i(e)||"object"!=typeof e&&(!s||"function"!=typeof e))throw new v(t,"Object",e)}),L=y((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new v(t,"a dictionary",e)}),P=y((e,t,n=0)=>{if(!i(e))throw new v(t,"Array",e);if(e.length<n){throw new b(t,e,`must be longer than ${n}`)}});const B=y((e,t="buffer")=>{if(!I(e))throw new v(t,["Buffer","TypedArray","DataView"],e)});const $=y((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new v(t,"AbortSignal",e)}),U=y((e,t)=>{if("function"!=typeof e)throw new v(t,"Function",e)}),z=y((e,t)=>{if("function"!=typeof e||w(e))throw new v(t,"Function",e)}),V=y((e,t)=>{if(void 0!==e)throw new v(t,"undefined",e)});const j=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Y(e,t){if(void 0===e||!p(j,e))throw new b(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}e.exports={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,n){if(void 0===e&&(e=n),"string"==typeof e){if(null===p(S,e))throw new b(t,e,"must be a 32-bit unsigned integer or an octal string");e=d(e,8)}return M(e,t),e},validateArray:P,validateStringArray:function(e,t){P(e,t);for(let n=0;n<e.length;n++)R(e[n],`${t}[${n}]`)},validateBooleanArray:function(e,t){P(e,t);for(let n=0;n<e.length;n++)N(e[n],`${t}[${n}]`)},validateAbortSignalArray:function(e,t){P(e,t);for(let n=0;n<e.length;n++){const i=e[n],r=`${t}[${n}]`;if(null==i)throw new v(r,"AbortSignal",i);$(i,r)}},validateBoolean:N,validateBuffer:B,validateDictionary:L,validateEncoding:function(e,t){const n=E(t),i=e.length;if("hex"===n&&i%2!=0)throw new b("encoding",t,`is invalid for data of length ${i}`)},validateFunction:U,validateInt32:O,validateInteger:C,validateNumber:function(e,t,n=void 0,i){if("number"!=typeof e)throw new v(t,"number",e);if(null!=n&&e<n||null!=i&&e>i||(null!=n||null!=i)&&l(e))throw new T(t,`${null!=n?`>= ${n}`:""}${null!=n&&null!=i?" && ":""}${null!=i?`<= ${i}`:""}`,e)},validateObject:F,validateOneOf:k,validatePlainFunction:z,validatePort:function(e,t="Port",n=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===g(e).length||+e!==+e>>>0||e>65535||0===e&&!n)throw new _(t,e,n);return 0|e},validateSignalName:function(e,t="signal"){if(R(e,t),void 0===A[e]){if(void 0!==A[m(e)])throw new x(e+" (signals must use all capital letters)");throw new x(e)}},validateString:R,validateUint32:M,validateUndefined:V,validateUnion:function(e,t,n){if(!r(n,e))throw new v(t,`('${s(n,"|")}')`,e)},validateAbortSignal:$,validateLinkHeaderValue:function(e){if("string"==typeof e)return Y(e,"hints"),e;if(i(e)){const t=e.length;let n="";if(0===t)return n;for(let i=0;i<t;i++){const r=e[i];Y(r,"hints"),n+=r,i!==t-1&&(n+=", ")}return n}throw new b("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}}},86248:(e,t,n)=>{"use strict";const i=n(54612),r=n(70105),s=i.Readable.destroy;e.exports=i.Readable,e.exports._uint8ArrayToBuffer=i._uint8ArrayToBuffer,e.exports._isUint8Array=i._isUint8Array,e.exports.isDisturbed=i.isDisturbed,e.exports.isErrored=i.isErrored,e.exports.isReadable=i.isReadable,e.exports.Readable=i.Readable,e.exports.Writable=i.Writable,e.exports.Duplex=i.Duplex,e.exports.Transform=i.Transform,e.exports.PassThrough=i.PassThrough,e.exports.addAbortSignal=i.addAbortSignal,e.exports.finished=i.finished,e.exports.destroy=i.destroy,e.exports.destroy=s,e.exports.pipeline=i.pipeline,e.exports.compose=i.compose,Object.defineProperty(i,"promises",{configurable:!0,enumerable:!0,get:()=>r}),e.exports.Stream=i.Stream,e.exports.default=e.exports},66605:(e,t,n)=>{"use strict";const{format:i,inspect:r,AggregateError:s}=n(20798),o=globalThis.AggregateError||s,a=Symbol("kIsNodeError"),l=["string","function","number","object","Function","Object","boolean","bigint","symbol"],u=/^([A-Z][a-z0-9]*)+$/,c={};function d(e,t){if(!e)throw new c.ERR_INTERNAL_ASSERTION(t)}function h(e){let t="",n=e.length;const i="-"===e[0]?1:0;for(;n>=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function p(e,t,n){n||(n=Error);class r extends n{constructor(...n){super(function(e,t,n){if("function"==typeof t)return d(t.length<=n.length,`Code: ${e}; The provided arguments length (${n.length}) does not match the required ones (${t.length}).`),t(...n);const r=(t.match(/%[dfijoOs]/g)||[]).length;return d(r===n.length,`Code: ${e}; The provided arguments length (${n.length}) does not match the required ones (${r}).`),0===n.length?t:i(t,...n)}(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=e,r.prototype[a]=!0,c[e]=r}function f(e){const t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}class m extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new c.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}}p("ERR_ASSERTION","%s",Error),p("ERR_INVALID_ARG_TYPE",(e,t,n)=>{d("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let i="The ";e.endsWith(" argument")?i+=`${e} `:i+=`"${e}" ${e.includes(".")?"property":"argument"} `,i+="must be ";const s=[],o=[],a=[];for(const e of t)d("string"==typeof e,"All expected entries have to be of type string"),l.includes(e)?s.push(e.toLowerCase()):u.test(e)?o.push(e):(d("object"!==e,'The value "object" should be written as "Object"'),a.push(e));if(o.length>0){const e=s.indexOf("object");-1!==e&&(s.splice(s,e,1),o.push("Object"))}if(s.length>0){switch(s.length){case 1:i+=`of type ${s[0]}`;break;case 2:i+=`one of type ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();i+=`one of type ${s.join(", ")}, or ${e}`}}(o.length>0||a.length>0)&&(i+=" or ")}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();i+=`an instance of ${o.join(", ")}, or ${e}`}}a.length>0&&(i+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(i+="an "),i+=`${a[0]}`;break;case 2:i+=`one of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();i+=`one of ${a.join(", ")}, or ${e}`}}if(null==n)i+=`. Received ${n}`;else if("function"==typeof n&&n.name)i+=`. Received function ${n.name}`;else if("object"==typeof n){var c;if(null!==(c=n.constructor)&&void 0!==c&&c.name)i+=`. Received an instance of ${n.constructor.name}`;else{i+=`. Received ${r(n,{depth:-1})}`}}else{let e=r(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),i+=`. Received type ${typeof n} (${e})`}return i},TypeError),p("ERR_INVALID_ARG_VALUE",(e,t,n="is invalid")=>{let i=r(t);i.length>128&&(i=i.slice(0,128)+"...");return`The ${e.includes(".")?"property":"argument"} '${e}' ${n}. Received ${i}`},TypeError),p("ERR_INVALID_RETURN_VALUE",(e,t,n)=>{var i;return`Expected ${e} to be returned from the "${t}" function but got ${null!=n&&null!==(i=n.constructor)&&void 0!==i&&i.name?`instance of ${n.constructor.name}`:"type "+typeof n}.`},TypeError),p("ERR_MISSING_ARGS",(...e)=>{let t;d(e.length>0,"At least one arg needs to be specified");const n=e.length;switch(e=(Array.isArray(e)?e:[e]).map(e=>`"${e}"`).join(" or "),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const n=e.pop();t+=`The ${e.join(", ")}, and ${n} arguments`}}return`${t} must be specified`},TypeError),p("ERR_OUT_OF_RANGE",(e,t,n)=>{let i;return d(t,'Missing "range" argument'),Number.isInteger(n)&&Math.abs(n)>2**32?i=h(String(n)):"bigint"==typeof n?(i=String(n),(n>2n**32n||n<-(2n**32n))&&(i=h(i)),i+="n"):i=r(n),`The value of "${e}" is out of range. It must be ${t}. Received ${i}`},RangeError),p("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),p("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),p("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),p("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),p("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),p("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),p("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),p("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),p("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),p("ERR_STREAM_WRITE_AFTER_END","write after end",Error),p("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),e.exports={AbortError:m,aggregateTwoErrors:f(function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const n=new o([t,e],t.message);return n.code=t.code,n}return e||t}),hideStackFrames:f,codes:c}},4184:e=>{"use strict";e.exports={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,n)=>e.slice(t,n),Error,FunctionPrototypeCall:(e,t,...n)=>e.call(t,...n),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,n)=>Object.defineProperty(e,t,n),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,n)=>e.then(t,n),PromiseReject:e=>Promise.reject(e),PromiseResolve:e=>Promise.resolve(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String,StringPrototypeSlice:(e,t,n)=>e.slice(t,n),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet:(e,t,n)=>e.set(t,n),Boolean,Uint8Array}},20798:(e,t,n)=>{"use strict";const i=n(48287),{kResistStopPropagation:r,SymbolDispose:s}=n(4184),o=globalThis.AbortSignal||n(25568).AbortSignal,a=globalThis.AbortController||n(25568).AbortController,l=Object.getPrototypeOf(async function(){}).constructor,u=globalThis.Blob||i.Blob,c=void 0!==u?function(e){return e instanceof u}:function(e){return!1},d=(e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new ERR_INVALID_ARG_TYPE(t,"AbortSignal",e)};class h extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name="AggregateError",this.errors=e}}e.exports={AggregateError:h,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}},promisify:e=>new Promise((t,n)=>{e((e,...i)=>e?n(e):t(...i))}),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,function(...[e,n]){const i=t.shift();if("f"===n)return i.toFixed(6);if("j"===n)return JSON.stringify(i);if("s"===n&&"object"==typeof i){return`${i.constructor!==Object?i.constructor.name:""} {}`.trim()}return i.toString()}),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction:e=>e instanceof l,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:c,deprecate:(e,t)=>e,addAbortListener:n(37007).addAbortListener||function(e,t){if(void 0===e)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);let n;return d(e,"signal"),((e,t)=>{if("function"!=typeof e)throw new ERR_INVALID_ARG_TYPE(t,"Function",e)})(t,"listener"),e.aborted?queueMicrotask(()=>t()):(e.addEventListener("abort",t,{__proto__:null,once:!0,[r]:!0}),n=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[s](){var e;null===(e=n)||void 0===e||e()}}},AbortSignalAny:o.any||function(e){if(1===e.length)return e[0];const t=new a,n=()=>t.abort();return e.forEach(e=>{d(e,"signals"),e.addEventListener("abort",n,{once:!0})}),t.signal.addEventListener("abort",()=>{e.forEach(e=>e.removeEventListener("abort",n))},{once:!0}),t.signal}},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")},54612:(e,t,n)=>{const{Buffer:i}=n(48287),{ObjectDefineProperty:r,ObjectKeys:s,ReflectApply:o}=n(4184),{promisify:{custom:a}}=n(20798),{streamReturningOperators:l,promiseReturningOperators:u}=n(65589),{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=n(66605),d=n(6864),{setDefaultHighWaterMark:h,getDefaultHighWaterMark:p}=n(19153),{pipeline:f}=n(60872),{destroyer:m}=n(42430),g=n(29700),y=n(70105),_=n(66569),v=e.exports=n(32913).Stream;v.isDestroyed=_.isDestroyed,v.isDisturbed=_.isDisturbed,v.isErrored=_.isErrored,v.isReadable=_.isReadable,v.isWritable=_.isWritable,v.Readable=n(76566);for(const x of s(l)){const E=l[x];function b(...e){if(new.target)throw c();return v.Readable.from(o(E,this,e))}r(b,"name",{__proto__:null,value:E.name}),r(b,"length",{__proto__:null,value:E.length}),r(v.Readable.prototype,x,{__proto__:null,value:b,enumerable:!1,configurable:!0,writable:!0})}for(const w of s(u)){const I=u[w];function b(...e){if(new.target)throw c();return o(I,this,e)}r(b,"name",{__proto__:null,value:I.name}),r(b,"length",{__proto__:null,value:I.length}),r(v.Readable.prototype,w,{__proto__:null,value:b,enumerable:!1,configurable:!0,writable:!0})}v.Writable=n(10394),v.Duplex=n(94992),v.Transform=n(50208),v.PassThrough=n(6898),v.pipeline=f;const{addAbortSignal:T}=n(30153);v.addAbortSignal=T,v.finished=g,v.destroy=m,v.compose=d,v.setDefaultHighWaterMark=h,v.getDefaultHighWaterMark=p,r(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>y}),r(f,a,{__proto__:null,enumerable:!0,get:()=>y.pipeline}),r(g,a,{__proto__:null,enumerable:!0,get:()=>y.finished}),v.Stream=v,v._isUint8Array=function(e){return e instanceof Uint8Array},v._uint8ArrayToBuffer=function(e){return i.from(e.buffer,e.byteOffset,e.byteLength)}},70105:(e,t,n)=>{"use strict";const{ArrayPrototypePop:i,Promise:r}=n(4184),{isIterable:s,isNodeStream:o,isWebStream:a}=n(66569),{pipelineImpl:l}=n(60872),{finished:u}=n(29700);n(54612),e.exports={finished:u,pipeline:function(...e){return new r((t,n)=>{let r,u;const c=e[e.length-1];if(c&&"object"==typeof c&&!o(c)&&!s(c)&&!a(c)){const t=i(e);r=t.signal,u=t.end}l(e,(e,i)=>{e?n(e):t(i)},{signal:r,end:u})})}}},98707:(e,t,n)=>{"use strict";var i=n(92861).Buffer,r=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=d,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"<22>";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"<22>";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"<22>"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"<22>":t},s.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var r=o(t[i]);if(r>=0)return r>0&&(e.lastNeed=r-1),r;if(--i<n||-2===r)return 0;if(r=o(t[i]),r>=0)return r>0&&(e.lastNeed=r-2),r;if(--i<n||-2===r)return 0;if(r=o(t[i]),r>=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},25568:e=>{"use strict";const{AbortController:t,AbortSignal:n}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=n,e.exports.default=t},44083:(e,t,n)=>{var i;
/*!
* async
* https://github.com/caolan/async
*
* Copyright 2010-2014 Caolan McMahon
* Released under the MIT license
*/!function(){var r,s={};function o(){}function a(e){return e}function l(e){return!!e}function u(e){return!e}var c="object"==typeof self&&self.self===self&&self||"object"==typeof n.g&&n.g.global===n.g&&n.g||this;function d(e){return function(){if(null===e)throw new Error("Callback was already called.");e.apply(this,arguments),e=null}}function h(e){return function(){null!==e&&(e.apply(this,arguments),e=null)}}null!=c&&(r=c.async),s.noConflict=function(){return c.async=r,s};var p=Object.prototype.toString,f=Array.isArray||function(e){return"[object Array]"===p.call(e)};function m(e){return f(e)||"number"==typeof e.length&&e.length>=0&&e.length%1==0}function g(e,t){for(var n=-1,i=e.length;++n<i;)t(e[n],n,e)}function y(e,t){for(var n=-1,i=e.length,r=Array(i);++n<i;)r[n]=t(e[n],n,e);return r}function _(e){return y(Array(e),function(e,t){return t})}function v(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}var b=Object.keys||function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t};function T(e){var t,n,i=-1;return m(e)?(t=e.length,function(){return++i<t?i:null}):(n=b(e),t=n.length,function(){return++i<t?n[i]:null})}function x(e,t){return t=null==t?e.length-1:+t,function(){for(var n=Math.max(arguments.length-t,0),i=Array(n),r=0;r<n;r++)i[r]=arguments[r+t];switch(t){case 0:return e.call(this,i);case 1:return e.call(this,arguments[0],i)}}}function E(e){return function(t,n,i){return e(t,i)}}var w="function"==typeof setImmediate&&setImmediate,I=w?function(e){w(e)}:function(e){setTimeout(e,0)};function A(e){return function(t,n,i){i=h(i||o);var r=T(t=t||[]);if(e<=0)return i(null);var s=!1,a=0,l=!1;!function o(){if(s&&a<=0)return i(null);for(;a<e&&!l;){var u=r();if(null===u)return s=!0,void(a<=0&&i(null));a+=1,n(t[u],u,d(function(e){a-=1,e?(i(e),l=!0):o()}))}}()}}function S(e){return function(t,n,i){return e(s.eachOf,t,n,i)}}function C(e){return function(t,n,i,r){return e(A(n),t,i,r)}}function O(e){return function(t,n,i){return e(s.eachOfSeries,t,n,i)}}function M(e,t,n,i){i=h(i||o);var r=m(t=t||[])?[]:{};e(t,function(e,t,i){n(e,function(e,n){r[t]=n,i(e)})},function(e){i(e,r)})}function R(e,t,n,i){var r=[];e(t,function(e,t,i){n(e,function(n){n&&r.push({index:t,value:e}),i()})},function(){i(y(r.sort(function(e,t){return e.index-t.index}),function(e){return e.value}))})}function k(e,t,n,i){R(e,t,function(e,t){n(e,function(e){t(!e)})},i)}function N(e,t,n){return function(i,r,s,o){function a(){o&&o(n(!1,void 0))}function l(e,i,r){if(!o)return r();s(e,function(i){o&&t(i)&&(o(n(!0,e)),o=s=!1),r()})}arguments.length>3?e(i,r,l,a):(o=s,s=r,e(i,l,a))}}function D(e,t){return t}function F(e,t,n){n=n||o;var i=m(t)?[]:{};e(t,function(e,t,n){e(x(function(e,r){r.length<=1&&(r=r[0]),i[t]=r,n(e)}))},function(e){n(e,i)})}function L(e,t,n,i){var r=[];e(t,function(e,t,i){n(e,function(e,t){r=r.concat(t||[]),i(e)})},function(e){i(e,r)})}function P(e,t,n){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");function i(e,t,n,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");if(e.started=!0,f(t)||(t=[t]),0===t.length&&e.idle())return s.setImmediate(function(){e.drain()});g(t,function(t){var r={data:t,callback:i||o};n?e.tasks.unshift(r):e.tasks.push(r),e.tasks.length===e.concurrency&&e.saturated()}),s.setImmediate(e.process)}function r(e,t){return function(){a-=1;var n=!1,i=arguments;g(t,function(e){g(l,function(t,i){t!==e||n||(l.splice(i,1),n=!0)}),e.callback.apply(e,i)}),e.tasks.length+a===0&&e.drain(),e.process()}}var a=0,l=[],u={tasks:[],concurrency:t,payload:n,saturated:o,empty:o,drain:o,started:!1,paused:!1,push:function(e,t){i(u,e,!1,t)},kill:function(){u.drain=o,u.tasks=[]},unshift:function(e,t){i(u,e,!0,t)},process:function(){for(;!u.paused&&a<u.concurrency&&u.tasks.length;){var t=u.payload?u.tasks.splice(0,u.payload):u.tasks.splice(0,u.tasks.length),n=y(t,function(e){return e.data});0===u.tasks.length&&u.empty(),a+=1,l.push(t[0]);var i=d(r(u,t));e(n,i)}},length:function(){return u.tasks.length},running:function(){return a},workersList:function(){return l},idle:function(){return u.tasks.length+a===0},pause:function(){u.paused=!0},resume:function(){if(!1!==u.paused){u.paused=!1;for(var e=Math.min(u.concurrency,u.tasks.length),t=1;t<=e;t++)s.setImmediate(u.process)}}};return u}function B(e){return x(function(t,n){t.apply(null,n.concat([x(function(t,n){"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&g(n,function(t){console[e](t)}))})]))})}function $(e){return function(t,n,i){e(_(t),n,i)}}function U(e){return x(function(t,n){var i=x(function(n){var i=this,r=n.pop();return e(t,function(e,t,r){e.apply(i,n.concat([r]))},r)});return n.length?i.apply(this,n):i})}function z(e){return x(function(t){var n=t.pop();t.push(function(){var e=arguments;i?s.setImmediate(function(){n.apply(null,e)}):n.apply(null,e)});var i=!0;e.apply(this,t),i=!1})}"object"==typeof process&&"function"==typeof process.nextTick?s.nextTick=process.nextTick:s.nextTick=I,s.setImmediate=w?I:s.nextTick,s.forEach=s.each=function(e,t,n){return s.eachOf(e,E(t),n)},s.forEachSeries=s.eachSeries=function(e,t,n){return s.eachOfSeries(e,E(t),n)},s.forEachLimit=s.eachLimit=function(e,t,n,i){return A(t)(e,E(n),i)},s.forEachOf=s.eachOf=function(e,t,n){n=h(n||o);for(var i,r=T(e=e||[]),s=0;null!=(i=r());)s+=1,t(e[i],i,d(a));function a(e){s--,e?n(e):null===i&&s<=0&&n(null)}0===s&&n(null)},s.forEachOfSeries=s.eachOfSeries=function(e,t,n){n=h(n||o);var i=T(e=e||[]),r=i();!function o(){var a=!0;if(null===r)return n(null);t(e[r],r,d(function(e){if(e)n(e);else{if(null===(r=i()))return n(null);a?s.setImmediate(o):o()}})),a=!1}()},s.forEachOfLimit=s.eachOfLimit=function(e,t,n,i){A(t)(e,n,i)},s.map=S(M),s.mapSeries=O(M),s.mapLimit=C(M),s.inject=s.foldl=s.reduce=function(e,t,n,i){s.eachOfSeries(e,function(e,i,r){n(t,e,function(e,n){t=n,r(e)})},function(e){i(e,t)})},s.foldr=s.reduceRight=function(e,t,n,i){var r=y(e,a).reverse();s.reduce(r,t,n,i)},s.transform=function(e,t,n,i){3===arguments.length&&(i=n,n=t,t=f(e)?[]:{}),s.eachOf(e,function(e,i,r){n(t,e,i,r)},function(e){i(e,t)})},s.select=s.filter=S(R),s.selectLimit=s.filterLimit=C(R),s.selectSeries=s.filterSeries=O(R),s.reject=S(k),s.rejectLimit=C(k),s.rejectSeries=O(k),s.any=s.some=N(s.eachOf,l,a),s.someLimit=N(s.eachOfLimit,l,a),s.all=s.every=N(s.eachOf,u,u),s.everyLimit=N(s.eachOfLimit,u,u),s.detect=N(s.eachOf,a,D),s.detectSeries=N(s.eachOfSeries,a,D),s.detectLimit=N(s.eachOfLimit,a,D),s.sortBy=function(e,t,n){function i(e,t){var n=e.criteria,i=t.criteria;return n<i?-1:n>i?1:0}s.map(e,function(e,n){t(e,function(t,i){t?n(t):n(null,{value:e,criteria:i})})},function(e,t){if(e)return n(e);n(null,y(t.sort(i),function(e){return e.value}))})},s.auto=function(e,t,n){"function"==typeof arguments[1]&&(n=t,t=null),n=h(n||o);var i=b(e),r=i.length;if(!r)return n(null);t||(t=r);var a={},l=0,u=!1,c=[];function d(e){c.unshift(e)}function p(){r--,g(c.slice(0),function(e){e()})}d(function(){r||n(null,a)}),g(i,function(i){if(!u){for(var r,o=f(e[i])?e[i]:[e[i]],h=x(function(e,t){if(l--,t.length<=1&&(t=t[0]),e){var r={};c=function(e,t){r[t]=e},g(b(o=a),function(e){c(o[e],e)}),r[i]=t,u=!0,n(e,r)}else a[i]=t,s.setImmediate(p);var o,c}),m=o.slice(0,o.length-1),y=m.length;y--;){if(!(r=e[m[y]]))throw new Error("Has nonexistent dependency in "+m.join(", "));if(f(r)&&v(r,i)>=0)throw new Error("Has cyclic dependencies")}_()?(l++,o[o.length-1](h,a)):d(function e(){_()&&(l++,(t=v(c,e))>=0&&c.splice(t,1),o[o.length-1](h,a));var t})}function _(){return l<t&&(e=function(e,t){return e&&a.hasOwnProperty(t)},n=!0,g(m,function(t,i,r){n=e(n,t,i,r)}),n)&&!a.hasOwnProperty(i);var e,n}})},s.retry=function(e,t,n){var i=[],r={times:5,interval:0};var o=arguments.length;if(o<1||o>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");function a(e,t){function n(e,n){return function(i){e(function(e,t){i(!e||n,{err:e,result:t})},t)}}function o(e){return function(t){setTimeout(function(){t(null)},e)}}for(;r.times;){var a=!(r.times-=1);i.push(n(r.task,a)),!a&&r.interval>0&&i.push(o(r.interval))}s.series(i,function(t,n){n=n[n.length-1],(e||r.callback)(n.err,n.result)})}return o<=2&&"function"==typeof e&&(n=t,t=e),"function"!=typeof e&&function(e,t){if("number"==typeof t)e.times=parseInt(t,10)||5;else{if("object"!=typeof t)throw new Error("Unsupported argument type for 'times': "+typeof t);e.times=parseInt(t.times,10)||5,e.interval=parseInt(t.interval,10)||0}}(r,e),r.callback=n,r.task=t,r.callback?a():a},s.waterfall=function(e,t){if(t=h(t||o),!f(e)){var n=new Error("First argument to waterfall must be an array of functions");return t(n)}if(!e.length)return t();!function e(n){return x(function(i,r){if(i)t.apply(null,[i].concat(r));else{var s=n.next();s?r.push(e(s)):r.push(t),z(n).apply(null,r)}})}(s.iterator(e))()},s.parallel=function(e,t){F(s.eachOf,e,t)},s.parallelLimit=function(e,t,n){F(A(t),e,n)},s.series=function(e,t){F(s.eachOfSeries,e,t)},s.iterator=function(e){return function t(n){function i(){return e.length&&e[n].apply(null,arguments),i.next()}return i.next=function(){return n<e.length-1?t(n+1):null},i}(0)},s.apply=x(function(e,t){return x(function(n){return e.apply(null,t.concat(n))})}),s.concat=S(L),s.concatSeries=O(L),s.whilst=function(e,t,n){if(n=n||o,e()){var i=x(function(r,s){r?n(r):e.apply(this,s)?t(i):n.apply(null,[null].concat(s))});t(i)}else n(null)},s.doWhilst=function(e,t,n){var i=0;return s.whilst(function(){return++i<=1||t.apply(this,arguments)},e,n)},s.until=function(e,t,n){return s.whilst(function(){return!e.apply(this,arguments)},t,n)},s.doUntil=function(e,t,n){return s.doWhilst(e,function(){return!t.apply(this,arguments)},n)},s.during=function(e,t,n){n=n||o;var i=x(function(t,i){t?n(t):(i.push(r),e.apply(this,i))}),r=function(e,r){e?n(e):r?t(i):n(null)};e(r)},s.doDuring=function(e,t,n){var i=0;s.during(function(e){i++<1?e(null,!0):t.apply(this,arguments)},e,n)},s.queue=function(e,t){return P(function(t,n){e(t[0],n)},t,1)},s.priorityQueue=function(e,t){function n(e,t){return e.priority-t.priority}var i=s.queue(e,t);return i.push=function(e,t,r){!function(e,t,i,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(e.started=!0,f(t)||(t=[t]),0===t.length)return s.setImmediate(function(){e.drain()});g(t,function(t){var a={data:t,priority:i,callback:"function"==typeof r?r:o};e.tasks.splice(function(e,t,n){for(var i=-1,r=e.length-1;i<r;){var s=i+(r-i+1>>>1);n(t,e[s])>=0?i=s:r=s-1}return i}(e.tasks,a,n)+1,0,a),e.tasks.length===e.concurrency&&e.saturated(),s.setImmediate(e.process)})}(i,e,t,r)},delete i.unshift,i},s.cargo=function(e,t){return P(e,1,t)},s.log=B("log"),s.dir=B("dir"),s.memoize=function(e,t){var n={},i={},r=Object.prototype.hasOwnProperty;t=t||a;var o=x(function(o){var a=o.pop(),l=t.apply(null,o);r.call(n,l)?s.setImmediate(function(){a.apply(null,n[l])}):r.call(i,l)?i[l].push(a):(i[l]=[a],e.apply(null,o.concat([x(function(e){n[l]=e;var t=i[l];delete i[l];for(var r=0,s=t.length;r<s;r++)t[r].apply(null,e)})])))});return o.memo=n,o.unmemoized=e,o},s.unmemoize=function(e){return function(){return(e.unmemoized||e).apply(null,arguments)}},s.times=$(s.map),s.timesSeries=$(s.mapSeries),s.timesLimit=function(e,t,n,i){return s.mapLimit(_(e),t,n,i)},s.seq=function(){var e=arguments;return x(function(t){var n=this,i=t[t.length-1];"function"==typeof i?t.pop():i=o,s.reduce(e,t,function(e,t,i){t.apply(n,e.concat([x(function(e,t){i(e,t)})]))},function(e,t){i.apply(n,[e].concat(t))})})},s.compose=function(){return s.seq.apply(null,Array.prototype.reverse.call(arguments))},s.applyEach=U(s.eachOf),s.applyEachSeries=U(s.eachOfSeries),s.forever=function(e,t){var n=d(t||o),i=z(e);!function e(t){if(t)return n(t);i(e)}()},s.ensureAsync=z,s.constant=x(function(e){var t=[null].concat(e);return function(e){return e.apply(this,t)}}),s.wrapSync=s.asyncify=function(e){return x(function(t){var n,i,r,s=t.pop();try{n=e.apply(this,t)}catch(e){return s(e)}("function"===(r=typeof(i=n))||"object"===r&&i)&&"function"==typeof n.then?n.then(function(e){s(null,e)}).catch(function(e){s(e.message?e:new Error(e))}):s(null,n)})},e.exports?e.exports=s:void 0===(i=function(){return s}.apply(t,[]))||(e.exports=i)}()},67526:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,s=a(e),o=s[0],l=s[1],u=new r(function(e,t,n){return 3*(t+n)/4-n}(0,o,l)),c=0,d=l>0?o-4:o;for(n=0;n<d;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;2===l&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[c++]=255&t);1===l&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t);return u},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,s=[],o=16383,a=0,l=i-r;a<l;a+=o)s.push(u(e,a,a+o>l?l:a+o));1===r?(t=e[i-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var i,r=[],s=t;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),r.push(l(i));return r.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},48287:(e,t,n)=>{"use strict";
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/const i=n(67526),r=n(251),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let i=a(n);const r=i.write(e,t);r!==n&&(i=i.slice(0,r));return i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(q(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(q(e,SharedArrayBuffer)||e&&q(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return l.from(i,t,n);const r=function(e){if(l.isBuffer(e)){const t=0|f(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||K(e.length)?a(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return c(e),a(e<0?0:0|f(e))}function h(e){const t=e.length<0?0:0|f(e.length),n=a(t);for(let i=0;i<t;i+=1)n[i]=255&e[i];return n}function p(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(i,l.prototype),i}function f(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function m(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(e).length;default:if(r)return i?-1:H(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return C(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function y(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function _(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),K(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:v(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,i,r){let s,o=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){let i=-1;for(s=n;s<a;s++)if(u(e,s)===u(t,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===l)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){let n=!0;for(let i=0;i<l;i++)if(u(e,s+i)!==u(t,i)){n=!1;break}if(n)return s}return-1}function b(e,t,n,i){n=Number(n)||0;const r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;const s=t.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(t.substr(2*o,2),16);if(K(i))return o;e[n+o]=i}return o}function T(e,t,n,i){return X(H(t,e.length-n),e,n,i)}function x(e,t,n,i){return X(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function E(e,t,n,i){return X(W(t),e,n,i)}function w(e,t,n,i){return X(function(e,t){let n,i,r;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),i=n>>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function I(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);const i=[];let r=t;for(;r<n;){const t=e[r];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(r+o<=n){let n,i,a,l;switch(o){case 1:t<128&&(s=t);break;case 2:n=e[r+1],128==(192&n)&&(l=(31&t)<<6|63&n,l>127&&(s=l));break;case 3:n=e[r+1],i=e[r+2],128==(192&n)&&128==(192&i)&&(l=(15&t)<<12|(63&n)<<6|63&i,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:n=e[r+1],i=e[r+2],a=e[r+3],128==(192&n)&&128==(192&i)&&128==(192&a)&&(l=(15&t)<<18|(63&n)<<12|(63&i)<<6|63&a,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(e){const t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);let n="",i=0;for(;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=S));return n}(i)}t.kMaxLength=o,l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,n){return function(e,t,n){return c(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},l.allocUnsafe=function(e){return d(e)},l.allocUnsafeSlow=function(e){return d(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(q(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),q(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let r=0,s=Math.min(n,i);r<s;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const i=l.allocUnsafe(t);let r=0;for(n=0;n<e.length;++n){let t=e[n];if(q(t,Uint8Array))r+t.length>i.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(i,r)):Uint8Array.prototype.set.call(i,t,r);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,r)}r+=t.length}return i},l.byteLength=m,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?A(this,0,e):g.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(e,t,n,i,r){if(q(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;let s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0);const a=Math.min(s,o),u=this.slice(i,r),c=e.slice(t,n);for(let e=0;e<a;++e)if(u[e]!==c[e]){s=u[e],o=c[e];break}return s<o?-1:o<s?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return _(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return _(this,e,t,n,!1)},l.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return T(this,e,t,n);case"ascii":case"latin1":case"binary":return x(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function C(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function O(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function M(e,t,n){const i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);let r="";for(let i=t;i<n;++i)r+=Z[e[i]];return r}function R(e,t,n){const i=e.slice(t,n);let r="";for(let e=0;e<i.length-1;e+=2)r+=String.fromCharCode(i[e]+256*i[e+1]);return r}function k(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,i,r,s){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<s)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function D(e,t,n,i,r){V(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function F(e,t,n,i,r){V(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function L(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(e,t,n,i,s){return t=+t,n>>>=0,s||L(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function B(e,t,n,i,s){return t=+t,n>>>=0,s||L(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||k(e,t,this.length);let i=this[e],r=1,s=0;for(;++s<t&&(r*=256);)i+=this[e+s]*r;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||k(e,t,this.length);let i=this[e+--t],r=1;for(;t>0&&(r*=256);)i+=this[e+--t]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||k(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||k(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||k(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=Q(function(e){j(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Y(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,r=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(i)+(BigInt(r)<<BigInt(32))}),l.prototype.readBigUInt64BE=Q(function(e){j(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Y(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],r=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(i)<<BigInt(32))+BigInt(r)}),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||k(e,t,this.length);let i=this[e],r=1,s=0;for(;++s<t&&(r*=256);)i+=this[e+s]*r;return r*=128,i>=r&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||k(e,t,this.length);let i=t,r=1,s=this[e+--i];for(;i>0&&(r*=256);)s+=this[e+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return e>>>=0,t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||k(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||k(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=Q(function(e){j(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Y(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)}),l.prototype.readBigInt64BE=Q(function(e){j(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Y(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)}),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||k(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||k(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||k(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||k(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t>>>=0,n>>>=0,!i){N(this,e,t,n,Math.pow(2,8*n)-1,0)}let r=1,s=0;for(this[t]=255&e;++s<n&&(r*=256);)this[t+s]=e/r&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t>>>=0,n>>>=0,!i){N(this,e,t,n,Math.pow(2,8*n)-1,0)}let r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=Q(function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Q(function(e,t=0){return F(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}let r=0,s=1,o=0;for(this[t]=255&e;++r<n&&(s*=256);)e<0&&0===o&&0!==this[t+r-1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}let r=n-1,s=1,o=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=Q(function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Q(function(e,t=0){return F(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeFloatLE=function(e,t,n){return P(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return P(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,i){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);const r=i-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),r},l.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let r;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(r=t;r<n;++r)this[r]=e;else{const s=l.isBuffer(e)?e:l.from(e,i),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(r=0;r<n-t;++r)this[r+t]=s[r%o]}return this};const $={};function U(e,t,n){$[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function z(e){let t="",n=e.length;const i="-"===e[0]?1:0;for(;n>=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function V(e,t,n,i,r,s){if(e>n||e<t){const i="bigint"==typeof t?"n":"";let r;throw r=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new $.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){j(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||Y(t,e.length-(n+1))}(i,r,s)}function j(e,t){if("number"!=typeof e)throw new $.ERR_INVALID_ARG_TYPE(t,"number",e)}function Y(e,t,n){if(Math.floor(e)!==e)throw j(e,n),new $.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}U("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),U("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),U("ERR_OUT_OF_RANGE",function(e,t,n){let i=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=z(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=z(r)),r+="n"),i+=` It must be ${t}. Received ${r}`,i},RangeError);const G=/[^+/0-9A-Za-z-_]/g;function H(e,t){let n;t=t||1/0;const i=e.length;let r=null;const s=[];for(let o=0;o<i;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function W(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,n,i){let r;for(r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function K(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)t[i+r]=e[n]+e[r]}return t}();function Q(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}},1779:e=>{var t=function(){"use strict";function e(e,t){return null!=t&&e instanceof t}var t,n,i;try{t=Map}catch(e){t=function(){}}try{n=Set}catch(e){n=function(){}}try{i=Promise}catch(e){i=function(){}}function r(s,a,l,u,c){"object"==typeof a&&(l=a.depth,u=a.prototype,c=a.includeNonEnumerable,a=a.circular);var d=[],h=[],p="undefined"!=typeof Buffer;return void 0===a&&(a=!0),void 0===l&&(l=1/0),function s(l,f){if(null===l)return null;if(0===f)return l;var m,g;if("object"!=typeof l)return l;if(e(l,t))m=new t;else if(e(l,n))m=new n;else if(e(l,i))m=new i(function(e,t){l.then(function(t){e(s(t,f-1))},function(e){t(s(e,f-1))})});else if(r.__isArray(l))m=[];else if(r.__isRegExp(l))m=new RegExp(l.source,o(l)),l.lastIndex&&(m.lastIndex=l.lastIndex);else if(r.__isDate(l))m=new Date(l.getTime());else{if(p&&Buffer.isBuffer(l))return m=Buffer.allocUnsafe?Buffer.allocUnsafe(l.length):new Buffer(l.length),l.copy(m),m;e(l,Error)?m=Object.create(l):void 0===u?(g=Object.getPrototypeOf(l),m=Object.create(g)):(m=Object.create(u),g=u)}if(a){var y=d.indexOf(l);if(-1!=y)return h[y];d.push(l),h.push(m)}for(var _ in e(l,t)&&l.forEach(function(e,t){var n=s(t,f-1),i=s(e,f-1);m.set(n,i)}),e(l,n)&&l.forEach(function(e){var t=s(e,f-1);m.add(t)}),l){var v;g&&(v=Object.getOwnPropertyDescriptor(g,_)),v&&null==v.set||(m[_]=s(l[_],f-1))}if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(l);for(_=0;_<b.length;_++){var T=b[_];(!(E=Object.getOwnPropertyDescriptor(l,T))||E.enumerable||c)&&(m[T]=s(l[T],f-1),E.enumerable||Object.defineProperty(m,T,{enumerable:!1}))}}if(c){var x=Object.getOwnPropertyNames(l);for(_=0;_<x.length;_++){var E,w=x[_];(E=Object.getOwnPropertyDescriptor(l,w))&&E.enumerable||(m[w]=s(l[w],f-1),Object.defineProperty(m,w,{enumerable:!1}))}}return m}(s,l)}function s(e){return Object.prototype.toString.call(e)}function o(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return r.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},r.__objToStr=s,r.__isDate=function(e){return"object"==typeof e&&"[object Date]"===s(e)},r.__isArray=function(e){return"object"==typeof e&&"[object Array]"===s(e)},r.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===s(e)},r.__getRegExpFlags=o,r}();e.exports&&(e.exports=t)},65721:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,s.default)(e)};var i,r=n(45685),s=(i=r)&&i.__esModule?i:{default:i};e.exports=t.default},44014:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return"string"==typeof e&&n.test(e)};var n=/-webkit-|-moz-|-ms-/;e.exports=t.default},34410:(e,t,n)=>{"use strict";function i(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function r(e){return(e=i(Math.abs(e)))?e[1]:NaN}n.r(t),n.d(t,{format:()=>p,formatDefaultLocale:()=>y,formatLocale:()=>g,formatPrefix:()=>f,formatSpecifier:()=>a,precisionFixed:()=>_,precisionPrefix:()=>v,precisionRound:()=>b});var s,o=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function a(e){return new l(e)}function l(e){if(!(t=o.exec(e)))throw new Error("invalid format: "+e);var t;this.fill=t[1]||" ",this.align=t[2]||">",this.sign=t[3]||"-",this.symbol=t[4]||"",this.zero=!!t[5],this.width=t[6]&&+t[6],this.comma=!!t[7],this.precision=t[8]&&+t[8].slice(1),this.trim=!!t[9],this.type=t[10]||""}function u(e,t){var n=i(e,t);if(!n)return e+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}a.prototype=l.prototype,l.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const c={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return u(100*e,t)},r:u,s:function(e,t){var n=i(e,t);if(!n)return e+"";var r=n[0],o=n[1],a=o-(s=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,l=r.length;return a===l?r:a>l?r+new Array(a-l+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+i(e,Math.max(0,t+a-1))[0]},X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}};function d(e){return e}var h,p,f,m=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function g(e){var t,n,i=e.grouping&&e.thousands?(t=e.grouping,n=e.thousands,function(e,i){for(var r=e.length,s=[],o=0,a=t[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),s.push(e.substring(r-=a,r+a)),!((l+=a+1)>i));)a=t[o=(o+1)%t.length];return s.reverse().join(n)}):d,o=e.currency,l=e.decimal,u=e.numerals?function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(e.numerals):d,h=e.percent||"%";function p(e){var t=(e=a(e)).fill,n=e.align,r=e.sign,d=e.symbol,p=e.zero,f=e.width,g=e.comma,y=e.precision,_=e.trim,v=e.type;"n"===v?(g=!0,v="g"):c[v]||(null==y&&(y=12),_=!0,v="g"),(p||"0"===t&&"="===n)&&(p=!0,t="0",n="=");var b="$"===d?o[0]:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T="$"===d?o[1]:/[%p]/.test(v)?h:"",x=c[v],E=/[defgprs%]/.test(v);function w(e){var o,a,c,d=b,h=T;if("c"===v)h=x(e)+h,e="";else{var w=(e=+e)<0;if(e=x(Math.abs(e),y),_&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i<n;++i)switch(e[i]){case".":r=t=i;break;case"0":0===r&&(r=i),t=i;break;default:if(r>0){if(!+e[i])break e;r=0}}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),w&&0===+e&&(w=!1),d=(w?"("===r?r:"-":"-"===r||"("===r?"":r)+d,h=("s"===v?m[8+s/3]:"")+h+(w&&"("===r?")":""),E)for(o=-1,a=e.length;++o<a;)if(48>(c=e.charCodeAt(o))||c>57){h=(46===c?l+e.slice(o+1):e.slice(o))+h,e=e.slice(0,o);break}}g&&!p&&(e=i(e,1/0));var I=d.length+e.length+h.length,A=I<f?new Array(f-I+1).join(t):"";switch(g&&p&&(e=i(A+e,A.length?f-h.length:1/0),A=""),n){case"<":e=d+e+h+A;break;case"=":e=d+A+e+h;break;case"^":e=A.slice(0,I=A.length>>1)+d+e+h+A.slice(I);break;default:e=A+d+e+h}return u(e)}return y=null==y?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),w.toString=function(){return e+""},w}return{format:p,formatPrefix:function(e,t){var n=p(((e=a(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(r(t)/3))),s=Math.pow(10,-i),o=m[8+i/3];return function(e){return n(s*e)+o}}}}function y(e){return h=g(e),p=h.format,f=h.formatPrefix,h}function _(e){return Math.max(0,-r(Math.abs(e)))}function v(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(r(t)/3)))-r(Math.abs(e)))}function b(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,r(t)-r(e))+1}y({decimal:".",thousands:",",grouping:[3],currency:["$",""]})},90716:(e,t,n)=>{"use strict";n.r(t),n.d(t,{clientPoint:()=>xe,create:()=>ye,creator:()=>l,customEvent:()=>le,event:()=>ie,local:()=>ve,matcher:()=>g,mouse:()=>Ee,namespace:()=>s,namespaces:()=>r,select:()=>ge,selectAll:()=>we,selection:()=>me,selector:()=>c,selectorAll:()=>h,style:()=>k,touch:()=>Ie,touches:()=>Ae,window:()=>C});var i="http://www.w3.org/1999/xhtml";const r={svg:"http://www.w3.org/2000/svg",xhtml:i,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function s(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),r.hasOwnProperty(t)?{space:r[t],local:e}:e}function o(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===i&&t.documentElement.namespaceURI===i?t.createElement(e):t.createElementNS(n,e)}}function a(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function l(e){var t=s(e);return(t.local?a:o)(t)}function u(){}function c(e){return null==e?u:function(){return this.querySelector(e)}}function d(){return[]}function h(e){return null==e?d:function(){return this.querySelectorAll(e)}}var p=function(e){return function(){return this.matches(e)}};if("undefined"!=typeof document){var f=document.documentElement;if(!f.matches){var m=f.webkitMatchesSelector||f.msMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector;p=function(e){return function(){return m.call(this,e)}}}}const g=p;function y(e){return new Array(e.length)}function _(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}_.prototype={constructor:_,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function v(e,t,n,i,r,s){for(var o,a=0,l=t.length,u=s.length;a<u;++a)(o=t[a])?(o.__data__=s[a],i[a]=o):n[a]=new _(e,s[a]);for(;a<l;++a)(o=t[a])&&(r[a]=o)}function b(e,t,n,i,r,s,o){var a,l,u,c={},d=t.length,h=s.length,p=new Array(d);for(a=0;a<d;++a)(l=t[a])&&(p[a]=u="$"+o.call(l,l.__data__,a,t),u in c?r[a]=l:c[u]=l);for(a=0;a<h;++a)(l=c[u="$"+o.call(e,s[a],a,s)])?(i[a]=l,l.__data__=s[a],c[u]=null):n[a]=new _(e,s[a]);for(a=0;a<d;++a)(l=t[a])&&c[p[a]]===l&&(r[a]=l)}function T(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function x(e){return function(){this.removeAttribute(e)}}function E(e){return function(){this.removeAttributeNS(e.space,e.local)}}function w(e,t){return function(){this.setAttribute(e,t)}}function I(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function A(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function S(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function C(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function O(e){return function(){this.style.removeProperty(e)}}function M(e,t,n){return function(){this.style.setProperty(e,t,n)}}function R(e,t,n){return function(){var i=t.apply(this,arguments);null==i?this.style.removeProperty(e):this.style.setProperty(e,i,n)}}function k(e,t){return e.style.getPropertyValue(t)||C(e).getComputedStyle(e,null).getPropertyValue(t)}function N(e){return function(){delete this[e]}}function D(e,t){return function(){this[e]=t}}function F(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function L(e){return e.trim().split(/^|\s+/)}function P(e){return e.classList||new B(e)}function B(e){this._node=e,this._names=L(e.getAttribute("class")||"")}function $(e,t){for(var n=P(e),i=-1,r=t.length;++i<r;)n.add(t[i])}function U(e,t){for(var n=P(e),i=-1,r=t.length;++i<r;)n.remove(t[i])}function z(e){return function(){$(this,e)}}function V(e){return function(){U(this,e)}}function j(e,t){return function(){(t.apply(this,arguments)?$:U)(this,e)}}function Y(){this.textContent=""}function G(e){return function(){this.textContent=e}}function H(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function W(){this.innerHTML=""}function X(e){return function(){this.innerHTML=e}}function q(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function K(){this.nextSibling&&this.parentNode.appendChild(this)}function Z(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Q(){return null}function J(){var e=this.parentNode;e&&e.removeChild(this)}function ee(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function te(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}B.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var ne={},ie=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(ne={mouseenter:"mouseover",mouseleave:"mouseout"}));function re(e,t,n){return e=se(e,t,n),function(t){var n=t.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||e.call(this,t)}}function se(e,t,n){return function(i){var r=ie;ie=i;try{e.call(this,this.__data__,t,n)}finally{ie=r}}}function oe(e){return function(){var t=this.__on;if(t){for(var n,i=0,r=-1,s=t.length;i<s;++i)n=t[i],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.capture);++r?t.length=r:delete this.__on}}}function ae(e,t,n){var i=ne.hasOwnProperty(e.type)?re:se;return function(r,s,o){var a,l=this.__on,u=i(t,s,o);if(l)for(var c=0,d=l.length;c<d;++c)if((a=l[c]).type===e.type&&a.name===e.name)return this.removeEventListener(a.type,a.listener,a.capture),this.addEventListener(a.type,a.listener=u,a.capture=n),void(a.value=t);this.addEventListener(e.type,u,n),a={type:e.type,name:e.name,value:t,listener:u,capture:n},l?l.push(a):this.__on=[a]}}function le(e,t,n,i){var r=ie;e.sourceEvent=ie,ie=e;try{return t.apply(n,i)}finally{ie=r}}function ue(e,t,n){var i=C(e),r=i.CustomEvent;"function"==typeof r?r=new r(t,n):(r=i.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ce(e,t){return function(){return ue(this,e,t)}}function de(e,t){return function(){return ue(this,e,t.apply(this,arguments))}}var he=[null];function pe(e,t){this._groups=e,this._parents=t}function fe(){return new pe([[document.documentElement]],he)}pe.prototype=fe.prototype={constructor:pe,select:function(e){"function"!=typeof e&&(e=c(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s,o,a=t[r],l=a.length,u=i[r]=new Array(l),d=0;d<l;++d)(s=a[d])&&(o=e.call(s,s.__data__,d,a))&&("__data__"in s&&(o.__data__=s.__data__),u[d]=o);return new pe(i,this._parents)},selectAll:function(e){"function"!=typeof e&&(e=h(e));for(var t=this._groups,n=t.length,i=[],r=[],s=0;s<n;++s)for(var o,a=t[s],l=a.length,u=0;u<l;++u)(o=a[u])&&(i.push(e.call(o,o.__data__,u,a)),r.push(o));return new pe(i,r)},filter:function(e){"function"!=typeof e&&(e=g(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s,o=t[r],a=o.length,l=i[r]=[],u=0;u<a;++u)(s=o[u])&&e.call(s,s.__data__,u,o)&&l.push(s);return new pe(i,this._parents)},data:function(e,t){if(!e)return f=new Array(this.size()),c=-1,this.each(function(e){f[++c]=e}),f;var n,i=t?b:v,r=this._parents,s=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var o=s.length,a=new Array(o),l=new Array(o),u=new Array(o),c=0;c<o;++c){var d=r[c],h=s[c],p=h.length,f=e.call(d,d&&d.__data__,c,r),m=f.length,g=l[c]=new Array(m),y=a[c]=new Array(m);i(d,h,g,y,u[c]=new Array(p),f,t);for(var _,T,x=0,E=0;x<m;++x)if(_=g[x]){for(x>=E&&(E=x+1);!(T=y[E])&&++E<m;);_._next=T||null}}return(a=new pe(a,r))._enter=l,a._exit=u,a},enter:function(){return new pe(this._enter||this._groups.map(y),this._parents)},exit:function(){return new pe(this._exit||this._groups.map(y),this._parents)},merge:function(e){for(var t=this._groups,n=e._groups,i=t.length,r=n.length,s=Math.min(i,r),o=new Array(i),a=0;a<s;++a)for(var l,u=t[a],c=n[a],d=u.length,h=o[a]=new Array(d),p=0;p<d;++p)(l=u[p]||c[p])&&(h[p]=l);for(;a<i;++a)o[a]=t[a];return new pe(o,this._parents)},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var i,r=e[t],s=r.length-1,o=r[s];--s>=0;)(i=r[s])&&(o&&o!==i.nextSibling&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=T);for(var n=this._groups,i=n.length,r=new Array(i),s=0;s<i;++s){for(var o,a=n[s],l=a.length,u=r[s]=new Array(l),c=0;c<l;++c)(o=a[c])&&(u[c]=o);u.sort(t)}return new pe(r,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){var e=new Array(this.size()),t=-1;return this.each(function(){e[++t]=this}),e},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],r=0,s=i.length;r<s;++r){var o=i[r];if(o)return o}return null},size:function(){var e=0;return this.each(function(){++e}),e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,i=t.length;n<i;++n)for(var r,s=t[n],o=0,a=s.length;o<a;++o)(r=s[o])&&e.call(r,r.__data__,o,s);return this},attr:function(e,t){var n=s(e);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==t?n.local?E:x:"function"==typeof t?n.local?S:A:n.local?I:w)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?O:"function"==typeof t?R:M)(e,t,null==n?"":n)):k(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?N:"function"==typeof t?F:D)(e,t)):this.node()[e]},classed:function(e,t){var n=L(e+"");if(arguments.length<2){for(var i=P(this.node()),r=-1,s=n.length;++r<s;)if(!i.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?j:t?z:V)(n,t))},text:function(e){return arguments.length?this.each(null==e?Y:("function"==typeof e?H:G)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?W:("function"==typeof e?q:X)(e)):this.node().innerHTML},raise:function(){return this.each(K)},lower:function(){return this.each(Z)},append:function(e){var t="function"==typeof e?e:l(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:l(e),i=null==t?Q:"function"==typeof t?t:c(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})},remove:function(){return this.each(J)},clone:function(e){return this.select(e?te:ee)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var i,r,s=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),o=s.length;if(!(arguments.length<2)){for(a=t?ae:oe,null==n&&(n=!1),i=0;i<o;++i)this.each(a(s[i],t,n));return this}var a=this.node().__on;if(a)for(var l,u=0,c=a.length;u<c;++u)for(i=0,l=a[u];i<o;++i)if((r=s[i]).type===l.type&&r.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?de:ce)(e,t))}};const me=fe;function ge(e){return"string"==typeof e?new pe([[document.querySelector(e)]],[document.documentElement]):new pe([[e]],he)}function ye(e){return ge(l(e).call(document.documentElement))}var _e=0;function ve(){return new be}function be(){this._="@"+(++_e).toString(36)}function Te(){for(var e,t=ie;e=t.sourceEvent;)t=e;return t}function xe(e,t){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,[(i=i.matrixTransform(e.getScreenCTM().inverse())).x,i.y]}var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}function Ee(e){var t=Te();return t.changedTouches&&(t=t.changedTouches[0]),xe(e,t)}function we(e){return"string"==typeof e?new pe([document.querySelectorAll(e)],[document.documentElement]):new pe([null==e?[]:e],he)}function Ie(e,t,n){arguments.length<3&&(n=t,t=Te().changedTouches);for(var i,r=0,s=t?t.length:0;r<s;++r)if((i=t[r]).identifier===n)return xe(e,i);return null}function Ae(e,t){null==t&&(t=Te().touches);for(var n=0,i=t?t.length:0,r=new Array(i);n<i;++n)r[n]=xe(e,t[n]);return r}be.prototype=ve.prototype={constructor:be,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}}},66570:e=>{"use strict";function t(e,t,i){i=i||2;var s,o,a,l,d,h,f,m=t&&t.length,g=m?t[0]*i:e.length,y=n(e,0,g,i,!0),_=[];if(!y||y.next===y.prev)return _;if(m&&(y=function(e,t,i,r){var s,o,a,l=[];for(s=0,o=t.length;s<o;s++)(a=n(e,t[s]*r,s<o-1?t[s+1]*r:e.length,r,!1))===a.next&&(a.steiner=!0),l.push(p(a));for(l.sort(u),s=0;s<l.length;s++)i=c(l[s],i);return i}(e,t,y,i)),e.length>80*i){s=a=e[0],o=l=e[1];for(var v=i;v<g;v+=i)(d=e[v])<s&&(s=d),(h=e[v+1])<o&&(o=h),d>a&&(a=d),h>l&&(l=h);f=0!==(f=Math.max(a-s,l-o))?32767/f:0}return r(y,_,i,s,o,f,0),_}function n(e,t,n,i,r){var s,o;if(r===A(e,t,n,i)>0)for(s=t;s<n;s+=i)o=E(s,e[s],e[s+1],o);else for(s=n-i;s>=t;s-=i)o=E(s,e[s],e[s+1],o);return o&&y(o,o.next)&&(w(o),o=o.next),o}function i(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!y(i,i.next)&&0!==g(i.prev,i,i.next))i=i.next;else{if(w(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function r(e,t,n,u,c,d,p){if(e){!p&&d&&function(e,t,n,i){var r=e;do{0===r.z&&(r.z=h(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,s,o,a,l,u=1;do{for(n=e,e=null,s=null,o=0;n;){for(o++,i=n,a=0,t=0;t<u&&(a++,i=i.nextZ);t++);for(l=u;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,u*=2}while(o>1)}(r)}(e,u,c,d);for(var f,m,g=e;e.prev!==e.next;)if(f=e.prev,m=e.next,d?o(e,u,c,d):s(e))t.push(f.i/n|0),t.push(e.i/n|0),t.push(m.i/n|0),w(e),e=m.next,g=m.next;else if((e=m)===g){p?1===p?r(e=a(i(e),t,n),t,n,u,c,d,2):2===p&&l(e,t,n,u,c,d):r(i(e),t,n,u,c,d,1);break}}}function s(e){var t=e.prev,n=e,i=e.next;if(g(t,n,i)>=0)return!1;for(var r=t.x,s=n.x,o=i.x,a=t.y,l=n.y,u=i.y,c=r<s?r<o?r:o:s<o?s:o,d=a<l?a<u?a:u:l<u?l:u,h=r>s?r>o?r:o:s>o?s:o,p=a>l?a>u?a:u:l>u?l:u,m=i.next;m!==t;){if(m.x>=c&&m.x<=h&&m.y>=d&&m.y<=p&&f(r,a,s,l,o,u,m.x,m.y)&&g(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function o(e,t,n,i){var r=e.prev,s=e,o=e.next;if(g(r,s,o)>=0)return!1;for(var a=r.x,l=s.x,u=o.x,c=r.y,d=s.y,p=o.y,m=a<l?a<u?a:u:l<u?l:u,y=c<d?c<p?c:p:d<p?d:p,_=a>l?a>u?a:u:l>u?l:u,v=c>d?c>p?c:p:d>p?d:p,b=h(m,y,t,n,i),T=h(_,v,t,n,i),x=e.prevZ,E=e.nextZ;x&&x.z>=b&&E&&E.z<=T;){if(x.x>=m&&x.x<=_&&x.y>=y&&x.y<=v&&x!==r&&x!==o&&f(a,c,l,d,u,p,x.x,x.y)&&g(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,E.x>=m&&E.x<=_&&E.y>=y&&E.y<=v&&E!==r&&E!==o&&f(a,c,l,d,u,p,E.x,E.y)&&g(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;x&&x.z>=b;){if(x.x>=m&&x.x<=_&&x.y>=y&&x.y<=v&&x!==r&&x!==o&&f(a,c,l,d,u,p,x.x,x.y)&&g(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;E&&E.z<=T;){if(E.x>=m&&E.x<=_&&E.y>=y&&E.y<=v&&E!==r&&E!==o&&f(a,c,l,d,u,p,E.x,E.y)&&g(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function a(e,t,n){var r=e;do{var s=r.prev,o=r.next.next;!y(s,o)&&_(s,r,r.next,o)&&T(s,o)&&T(o,s)&&(t.push(s.i/n|0),t.push(r.i/n|0),t.push(o.i/n|0),w(r),w(r.next),r=e=o),r=r.next}while(r!==e);return i(r)}function l(e,t,n,s,o,a){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&m(l,u)){var c=x(l,u);return l=i(l,l.next),c=i(c,c.next),r(l,t,n,s,o,a,0),void r(c,t,n,s,o,a,0)}u=u.next}l=l.next}while(l!==e)}function u(e,t){return e.x-t.x}function c(e,t){var n=function(e,t){var n,i=t,r=e.x,s=e.y,o=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var a=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=r&&a>o&&(o=a,n=i.x<i.next.x?i:i.next,a===r))return n}i=i.next}while(i!==t);if(!n)return null;var l,u=n,c=n.x,h=n.y,p=1/0;i=n;do{r>=i.x&&i.x>=c&&r!==i.x&&f(s<h?r:o,s,c,h,s<h?o:r,s,i.x,i.y)&&(l=Math.abs(s-i.y)/(r-i.x),T(i,e)&&(l<p||l===p&&(i.x>n.x||i.x===n.x&&d(n,i)))&&(n=i,p=l)),i=i.next}while(i!==u);return n}(e,t);if(!n)return t;var r=x(n,e);return i(r,r.next),i(n,n.next)}function d(e,t){return g(e.prev,e,t.prev)<0&&g(t.next,e,e.next)<0}function h(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function p(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function f(e,t,n,i,r,s,o,a){return(r-o)*(t-a)>=(e-o)*(s-a)&&(e-o)*(i-a)>=(n-o)*(t-a)&&(n-o)*(s-a)>=(r-o)*(i-a)}function m(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&_(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(T(e,t)&&T(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(g(e.prev,e,t.prev)||g(e,t.prev,t))||y(e,t)&&g(e.prev,e,e.next)>0&&g(t.prev,t,t.next)>0)}function g(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function y(e,t){return e.x===t.x&&e.y===t.y}function _(e,t,n,i){var r=b(g(e,t,n)),s=b(g(e,t,i)),o=b(g(n,i,e)),a=b(g(n,i,t));return r!==s&&o!==a||(!(0!==r||!v(e,n,t))||(!(0!==s||!v(e,i,t))||(!(0!==o||!v(n,e,i))||!(0!==a||!v(n,t,i)))))}function v(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function b(e){return e>0?1:e<0?-1:0}function T(e,t){return g(e.prev,e,e.next)<0?g(e,t,e.next)>=0&&g(e,e.prev,t)>=0:g(e,t,e.prev)<0||g(e,e.next,t)<0}function x(e,t){var n=new I(e.i,e.x,e.y),i=new I(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function E(e,t,n,i){var r=new I(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function w(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function I(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function A(e,t,n,i){for(var r=0,s=t,o=n-i;s<n;s+=i)r+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return r}e.exports=t,e.exports.default=t,t.deviation=function(e,t,n,i){var r=t&&t.length,s=r?t[0]*n:e.length,o=Math.abs(A(e,0,s,n));if(r)for(var a=0,l=t.length;a<l;a++){var u=t[a]*n,c=a<l-1?t[a+1]*n:e.length;o-=Math.abs(A(e,u,c,n))}var d=0;for(a=0;a<i.length;a+=3){var h=i[a]*n,p=i[a+1]*n,f=i[a+2]*n;d+=Math.abs((e[h]-e[f])*(e[p+1]-e[h+1])-(e[h]-e[p])*(e[f+1]-e[h+1]))}return 0===o&&0===d?0:Math.abs((d-o)/o)},t.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},i=0,r=0;r<e.length;r++){for(var s=0;s<e[r].length;s++)for(var o=0;o<t;o++)n.vertices.push(e[r][s][o]);r>0&&(i+=e[r-1].length,n.holes.push(i))}return n}},30228:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,i,s,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new r(i,s||e,o),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,s=i.length,o=new Array(s);r<s;r++)o[r]=i[r].fn;return o},a.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,r,s,o){var a=n?n+e:e;if(!this._events[a])return!1;var l,u,c=this._events[a],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,r),!0;case 5:return c.fn.call(c.context,t,i,r,s),!0;case 6:return c.fn.call(c.context,t,i,r,s,o),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var h,p=c.length;for(u=0;u<p;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,i);break;case 4:c[u].fn.call(c[u].context,t,i,r);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c[u].fn.apply(c[u].context,l)}}return!0},a.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,i,r){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||r&&!a.once||i&&a.context!==i||o(this,s);else{for(var l=0,u=[],c=a.length;l<c;l++)(a[l].fn!==t||r&&!a[l].once||i&&a[l].context!==i)&&u.push(a[l]);u.length?this._events[s]=1===u.length?u[0]:u:o(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a},37007:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise(function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}m(e,t,s,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,n)}(e,r,{once:!0})})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,n,i){var r,s,o,u;if(a(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=l(e))>0&&o.length>r&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,u=c,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=c.bind(i);return r.listener=n,i.wrapFn=r,r}function h(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):f(r,r.length)}function p(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function f(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function m(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function r(s){i.once&&e.removeEventListener(t,r),n(s)})}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=f(l,u);for(n=0;n<u;++n)i(c[n],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,i,r,s,o;if(a(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,s=Object.keys(n);for(i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},32017:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,s;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!==r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!==r--;)if(!Object.prototype.hasOwnProperty.call(n,s[r]))return!1;for(r=i;0!==r--;){var o=s[r];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},72492:e=>{"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n,i="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(n=t.cmp,function(e){return function(t,i){var r={key:t,value:e[t]},s={key:i,value:e[i]};return n(r,s)}}),s=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var n,o;if(Array.isArray(t)){for(o="[",n=0;n<t.length;n++)n&&(o+=","),o+=e(t[n])||"null";return o+"]"}if(null===t)return"null";if(-1!==s.indexOf(t)){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var a=s.push(t)-1,l=Object.keys(t).sort(r&&r(t));for(o="",n=0;n<l.length;n++){var u=l[n],c=e(t[u]);c&&(o&&(o+=","),o+=JSON.stringify(u)+":"+c)}return s.splice(a,1),"{"+o+"}"}}(e)}},8748:e=>{"use strict";var t=/-(.)/g;e.exports=function(e){return e.replace(t,function(e,t){return t.toUpperCase()})}},70480:(e,t,n)=>{"use strict";var i=n(8748),r=/^-ms-/;e.exports=function(e){return i(e.replace(r,"ms-"))}},59395:e=>{"use strict";function t(e){return function(){return e}}var n=function(){};n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},13998:e=>{"use strict";var t=/([A-Z])/g;e.exports=function(e){return e.replace(t,"-$1").toLowerCase()}},61254:(e,t,n)=>{"use strict";var i=n(13998),r=/^ms-/;e.exports=function(e){return i(e).replace(r,"-ms-")}},94793:e=>{"use strict";e.exports=function(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}},14594:(e,t,n)=>{"use strict";var i=n(59395);e.exports=i},4213:function(e,t,n){var i,r,s;r=[],void 0===(s="function"==typeof(i=function(){"use strict";function t(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function i(e,t,n){var i=new XMLHttpRequest;i.open("GET",e),i.responseType="blob",i.onload=function(){l(i.response,t,n)},i.onerror=function(){console.error("could not download file")},i.send()}function r(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function s(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,a=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=o.saveAs||("object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(e,t,n){var a=o.URL||o.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?s(l):r(l.href)?i(e,t,n):s(l,l.target="_blank")):(l.href=a.createObjectURL(e),setTimeout(function(){a.revokeObjectURL(l.href)},4e4),setTimeout(function(){s(l)},0))}:"msSaveOrOpenBlob"in navigator?function(e,n,o){if(n=n||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,o),n);else if(r(e))i(e,n,o);else{var a=document.createElement("a");a.href=e,a.target="_blank",setTimeout(function(){s(a)})}}:function(e,t,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return i(e,t,n);var s="application/octet-stream"===e.type,l=/constructor/i.test(o.HTMLElement)||o.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||s&&l||a)&&"undefined"!=typeof FileReader){var c=new FileReader;c.onloadend=function(){var e=c.result;e=u?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},c.readAsDataURL(e)}else{var d=o.URL||o.webkitURL,h=d.createObjectURL(e);r?r.location=h:location.href=h,r=null,setTimeout(function(){d.revokeObjectURL(h)},4e4)}});o.saveAs=l.saveAs=l,e.exports=l})?i.apply(t,r):i)||(e.exports=s)},52208:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowStart:!0,gridRowEnd:!0,gridColumn:!0,gridColumnStart:!0,gridColumnEnd:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0};var i=["Webkit","ms","Moz","O"];Object.keys(n).forEach(function(e){i.forEach(function(t){n[function(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}(t,e)]=n[e]})});var r={isUnitlessNumber:n,shorthandPropertyExpansions:{background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}}};t.default=r},11104:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(52208));r(n(14594));function r(e){return e&&e.__esModule?e:{default:e}}var s=i.default.isUnitlessNumber;t.default=function(e,t,n){return null==t||"boolean"==typeof t||""===t?"":isNaN(t)||0===t||s.hasOwnProperty(e)&&s[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}},26050:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.processStyleName=void 0,t.createMarkupForStyles=function(e,t){var n="";for(var r in e){var s=0===r.indexOf("--");if(e.hasOwnProperty(r)&&"label"!==r){var o=e[r];0,null!=o&&(s?n+=r+":"+o+";":(n+=a(r)+":",n+=(0,i.default)(r,o,t)+";"))}}return n||null};o(n(70480));var i=o(n(11104)),r=o(n(61254)),s=o(n(94793));o(n(14594));function o(e){return e&&e.__esModule?e:{default:e}}var a=t.processStyleName=(0,s.default)(r.default)},5960:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e){if(function(e){return null==e||!1===e||"object"===(void 0===e?"undefined":n(e))&&0===Object.keys(e).length}(e))return null;if("object"!==(void 0===e?"undefined":n(e)))return e;for(var t={},i=Object.keys(e),s=!1,o=0;o<i.length;o++){var a=e[i[o]],l=r(a);null!==l&&l===a||(s=!0),null!==l&&(t[i[o]]=l)}return 0===Object.keys(t).length?null:s?t:e}function r(e){return Array.isArray(e)?(n=!1,s=[],(t=e).forEach(function(e){var t=r(e);null!==t&&t===e||(n=!0),null!==t&&s.push(t)}),0==s.length?null:n?s:t):i(e);var t,n,s}t.default=r},2493:(e,t)=>{"use strict";function n(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)+(e.charCodeAt(t++)<<16)+(e.charCodeAt(t)<<24)}function i(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)}function r(e,t){return(65535&(e|=0))*(t|=0)+(((e>>>16)*t&65535)<<16)|0}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var s=1540483477,o=t^e.length,a=e.length,l=0;for(;a>=4;){var u=n(e,l);u=r(u,s),u=r(u^=u>>>24,s),o=r(o,s),o^=u,l+=4,a-=4}switch(a){case 3:o^=i(e,l),o=r(o^=e.charCodeAt(l+2)<<16,s);break;case 2:o=r(o^=i(e,l),s);break;case 1:o=r(o^=e.charCodeAt(l),s)}return o=r(o^=o>>>13,s),(o^=o>>>15)>>>0}},38205:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compose=t.merge=t.$=t.style=t.presets=t.keyframes=t.fontFace=t.insertGlobal=t.insertRule=t.plugins=t.styleSheet=void 0,t.speedy=function(e){return d.speedy(e)},t.simulations=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];g=!!e},t.simulate=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!(t=(0,o.default)(t)))return{};if(!g)return y||(console.warn("can't simulate without once calling simulations(true)"),y=!0),p||f||_||(console.warn("don't use simulation outside dev"),_=!0),{};return t.reduce(function(e,t){return e["data-simulate-"+b(t)]="",e},{})},t.cssLabels=function(e){v=!!e},t.isLikeRule=x,t.idFor=E,t.css=H,t.rehydrate=function(e){(0,i.default)(M,e.reduce(function(e,t){return e[t]=!0,e},{}))},t.flush=function(){M=d.inserted={},R=d.registered={},N={},d.flush(),d.inject()},t.select=X,t.parent=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return H(c({},e+" &",n))},t.media=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return H(c({},"@media "+e,n))},t.pseudo=q,t.active=function(e){return q(":active",e)},t.any=function(e){return q(":any",e)},t.checked=function(e){return q(":checked",e)},t.disabled=function(e){return q(":disabled",e)},t.empty=function(e){return q(":empty",e)},t.enabled=function(e){return q(":enabled",e)},t._default=function(e){return q(":default",e)},t.first=function(e){return q(":first",e)},t.firstChild=function(e){return q(":first-child",e)},t.firstOfType=function(e){return q(":first-of-type",e)},t.fullscreen=function(e){return q(":fullscreen",e)},t.focus=function(e){return q(":focus",e)},t.hover=function(e){return q(":hover",e)},t.indeterminate=function(e){return q(":indeterminate",e)},t.inRange=function(e){return q(":in-range",e)},t.invalid=function(e){return q(":invalid",e)},t.lastChild=function(e){return q(":last-child",e)},t.lastOfType=function(e){return q(":last-of-type",e)},t.left=function(e){return q(":left",e)},t.link=function(e){return q(":link",e)},t.onlyChild=function(e){return q(":only-child",e)},t.onlyOfType=function(e){return q(":only-of-type",e)},t.optional=function(e){return q(":optional",e)},t.outOfRange=function(e){return q(":out-of-range",e)},t.readOnly=function(e){return q(":read-only",e)},t.readWrite=function(e){return q(":read-write",e)},t.required=function(e){return q(":required",e)},t.right=function(e){return q(":right",e)},t.root=function(e){return q(":root",e)},t.scope=function(e){return q(":scope",e)},t.target=function(e){return q(":target",e)},t.valid=function(e){return q(":valid",e)},t.visited=function(e){return q(":visited",e)},t.dir=function(e,t){return q(":dir("+e+")",t)},t.lang=function(e,t){return q(":lang("+e+")",t)},t.not=function(e,t){var n=e.split(",").map(function(e){return e.trim()}).map(function(e){return":not("+e+")"});if(1===n.length)return q(":not("+e+")",t);return X(n.join(""),t)},t.nthChild=function(e,t){return q(":nth-child("+e+")",t)},t.nthLastChild=function(e,t){return q(":nth-last-child("+e+")",t)},t.nthLastOfType=function(e,t){return q(":nth-last-of-type("+e+")",t)},t.nthOfType=function(e,t){return q(":nth-of-type("+e+")",t)},t.after=function(e){return q("::after",e)},t.before=function(e){return q("::before",e)},t.firstLetter=function(e){return q("::first-letter",e)},t.firstLine=function(e){return q("::first-line",e)},t.selection=function(e){return q("::selection",e)},t.backdrop=function(e){return q("::backdrop",e)},t.placeholder=function(e){return H({"::placeholder":e})},t.cssFor=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(t=(0,o.default)(t))?t.map(function(e){var t={label:[]};return $(t,{src:e}),O(T(t),C(t)).join("")}).join(""):""},t.attribsFor=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(t=(0,o.default)(t))?t.map(function(e){E(e);var t=Object.keys(e)[0];return t+'="'+(e[t]||"")+'"'}).join(" "):""};var i=u(n(45228)),r=n(56314),s=n(26050),o=u(n(5960)),a=n(77769),l=u(n(2493));function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d=t.styleSheet=new r.StyleSheet;d.inject();var h=t.plugins=d.plugins=new a.PluginSet([a.prefixes,a.contentWrap,a.fallbacks]);h.media=new a.PluginSet,h.fontFace=new a.PluginSet,h.keyframes=new a.PluginSet([a.prefixes,a.fallbacks]);var p=!1,f=!1,m="undefined"!=typeof window,g=p,y=!1,_=!1;var v=p;function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.toLowerCase().replace(/[^a-z0-9]/g,t)}function T(e){var t=JSON.stringify(e),n=(0,l.default)(t).toString(36);return e.label&&e.label.length>0&&p?b(e.label.join("."),"-")+"-"+n:n}function x(e){var t=Object.keys(e).filter(function(e){return"toString"!==e});return 1===t.length&&!!/data\-css\-([a-zA-Z0-9\-_]+)/.exec(t[0])}function E(e){var t=Object.keys(e).filter(function(e){return"toString"!==e});if(1!==t.length)throw new Error("not a rule");var n=/data\-css\-([a-zA-Z0-9\-_]+)/.exec(t[0]);if(!n)throw new Error("not a rule");return n[1]}var w=/[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g;function I(e){if(-1===e.indexOf(","))return[e];for(var t,n=[],i=[],r=0;t=w.exec(e);)switch(t[0]){case"(":r++;break;case")":r--;break;case",":if(r)break;n.push(t.index)}for(t=n.length;t--;)i.unshift(e.slice(n[t]+1)),e=e.slice(0,n[t]);return i.unshift(e),i}function A(e,t){if(!e)return t.replace(/\&/g,"");if(!t)return".css-"+e+",[data-css-"+e+"]";var n=I(t).map(function(t){return t.indexOf("&")>=0?[t.replace(/\&/gm,".css-"+e),t.replace(/\&/gm,"[data-css-"+e+"]")].join(","):".css-"+e+t+",[data-css-"+e+"]"+t}).join(",");return g&&/^\&\:/.exec(t)&&!/\s/.exec(t)&&(n+=",.css-"+e+"[data-simulate-"+b(t)+"],[data-css-"+e+"][data-simulate-"+b(t)+"]"),n}function S(e){var t=e.selector,n=e.style,i=h.transform({selector:t,style:n});return i.selector+"{"+(0,s.createMarkupForStyles)(i.style)+"}"}function C(e){var t=void 0,n=void 0,i=void 0,r=void 0;return Object.keys(e).forEach(function(s){s.indexOf("&")>=0?(n=n||{})[s]=e[s]:0===s.indexOf("@media")?(i=i||{})[s]=C(e[s]):0===s.indexOf("@supports")?(r=r||{})[s]=C(e[s]):"label"===s?e.label.length>0&&((t=t||{}).label=v?e.label.join("."):""):(t=t||{})[s]=e[s]}),{plain:t,selects:n,medias:i,supports:r}}function O(e,t){var n=[],i=t.plain,r=t.selects,s=t.medias,o=t.supports;return i&&n.push(S({style:i,selector:A(e)})),r&&Object.keys(r).forEach(function(t){return n.push(S({style:r[t],selector:A(e,t)}))}),s&&Object.keys(s).forEach(function(t){return n.push(t+"{"+O(e,s[t]).join("")+"}")}),o&&Object.keys(o).forEach(function(t){return n.push(t+"{"+O(e,o[t]).join("")+"}")}),n}var M=d.inserted={};var R=d.registered={};function k(e){R[e.id]||(R[e.id]=e)}var N={};function D(e){if(k(e),function(e){if(!M[e.id]){M[e.id]=!0;var t=C(e.style),n=O(e.id,t);M[e.id]=!!m||n,n.forEach(function(e){return d.insert(e)})}}(e),N[e.id])return N[e.id];var t=c({},"data-css-"+e.id,v&&e.label||"");return Object.defineProperty(t,"toString",{enumerable:!1,value:function(){return"css-"+e.id}}),N[e.id]=t,t}function F(e,t){var n=I(e).map(function(e){return e.indexOf("&")>=0?e:"&"+e}),i=I(t).map(function(e){return e.indexOf("&")>=0?e:"&"+e});return i.reduce(function(e,t){return e.concat(n.map(function(e){return t.replace(/\&/g,e)}))},[]).join(",")}function L(e,t){return e?"@supports "+e.substring(9)+" and "+t.substring(9):t}function P(e){for(var t=[],n=0;n<e.length;n++)t=Array.isArray(e[n])?t.concat(P(e[n])):t.concat(e[n]);return t}var B={"::placeholder":["::-webkit-input-placeholder","::-moz-placeholder","::-ms-input-placeholder"],":fullscreen":[":-webkit-full-screen",":-moz-full-screen",":-ms-fullscreen"]};function $(e,t){var n=t.selector,i=void 0===n?"":n,r=t.mq,s=void 0===r?"":r,a=t.supp,l=void 0===a?"":a,u=t.src,c=void 0===u?{}:u;Array.isArray(c)||(c=[c]),(c=P(c)).forEach(function(t){if(x(t)){var n=function(e){if(x(e)){var t=R[E(e)];if(null==t)throw new Error("[glamor] an unexpected rule cache miss occurred. This is probably a sign of multiple glamor instances in your app. See https://github.com/threepointone/glamor/issues/79");return t}return e}(t);if("css"!==n.type)throw new Error("cannot merge this rule");t=n.style}(t=(0,o.default)(t))&&t.composes&&$(e,{selector:i,mq:s,supp:l,src:t.composes}),Object.keys(t||{}).forEach(function(n){if(function(e){for(var t=[":",".","[",">"," "],n=!1,i=e.charAt(0),r=0;r<t.length;r++)if(i===t[r]){n=!0;break}return n||e.indexOf("&")>=0}(n))B[n]&&B[n].forEach(function(r){return $(e,{selector:F(i,r),mq:s,supp:l,src:t[n]})}),$(e,{selector:F(i,n),mq:s,supp:l,src:t[n]});else if(function(e){return 0===e.indexOf("@media")}(n))$(e,{selector:i,mq:(o=s,a=n,o?"@media "+o.substring(6)+" and "+a.substring(6):a),supp:l,src:t[n]});else if(function(e){return 0===e.indexOf("@supports")}(n))$(e,{selector:i,mq:s,supp:L(l,n),src:t[n]});else if("composes"===n);else{var r=e;l&&(r[l]=r[l]||{},r=r[l]),s&&(r[s]=r[s]||{},r=r[s]),i&&(r[i]=r[i]||{},r=r[i]),"label"===n?v&&(e.label=e.label.concat(t.label)):r[n]=t[n]}var o,a})})}function U(e){var t={label:[]};return $(t,{src:e}),D({id:T(t),style:t,label:v?t.label.join("."):"",type:"css"})}var z={};Object.defineProperty(z,"toString",{enumerable:!1,value:function(){return"css-nil"}});var V="undefined"!=typeof WeakMap?[z,new WeakMap,new WeakMap,new WeakMap]:[z],j=!1;var Y,G="undefined"!=typeof WeakMap?(Y=U,function(e){if(V[e.length]){for(var t=V[e.length],n=0;n<e.length-1;)t.has(e[n])||t.set(e[n],new WeakMap),t=t.get(e[n]),n++;if(t.has(e[e.length-1])){var i=t.get(e[n]);if(R[i.toString().substring(4)])return i}}var r=Y(e);if(V[e.length]){for(var s=0,o=V[e.length];s<e.length-1;)o=o.get(e[s]),s++;try{o.set(e[s],r)}catch(t){var a;p&&!j&&(j=!0,(a=console).warn.apply(a,["failed setting the WeakMap cache for args:"].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e))),console.warn("this should NOT happen, please file a bug on the github repo."))}}return r}):U;function H(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(t[0]&&t[0].length&&t[0].raw)throw new Error("you forgot to include glamor/babel in your babel plugins.");return(t=(0,o.default)(t))?G(t):z}H.insert=function(e){var t={id:T(e),css:e,type:"raw"};k(t),M[t.id]||(d.insert(t.css),M[t.id]=!!m||[t.css])};t.insertRule=H.insert;H.global=function(e,t){if(t=(0,o.default)(t))return H.insert(S({selector:e,style:t}))};t.insertGlobal=H.global;H.keyframes=function(e,t){t||(t=e,e="animation");var n={id:T({name:e,kfs:t=(0,o.default)(t)||{}}),type:"keyframes",name:e,keyframes:t};return k(n),function(e){if(!M[e.id]){var t=Object.keys(e.keyframes).map(function(t){var n=h.keyframes.transform({id:e.id,name:t,style:e.keyframes[t]});return n.name+"{"+(0,s.createMarkupForStyles)(n.style)+"}"}).join(""),n=["-webkit-","-moz-","-o-",""].map(function(n){return"@"+n+"keyframes "+e.name+"_"+e.id+"{"+t+"}"});n.forEach(function(e){return d.insert(e)}),M[e.id]=!!m||n}}(n),e+"_"+n.id},H.fontFace=function(e){var t={id:T(e=(0,o.default)(e)),type:"font-face",font:e};return k(t),function(e){if(!M[e.id]){var t="@font-face{"+(0,s.createMarkupForStyles)(e.font)+"}";d.insert(t),M[e.id]=!!m||[t]}}(t),e.fontFamily};t.fontFace=H.fontFace,t.keyframes=H.keyframes;t.presets={mobile:"(min-width: 400px)",Mobile:"@media (min-width: 400px)",phablet:"(min-width: 550px)",Phablet:"@media (min-width: 550px)",tablet:"(min-width: 750px)",Tablet:"@media (min-width: 750px)",desktop:"(min-width: 1000px)",Desktop:"@media (min-width: 1000px)",hd:"(min-width: 1200px)",Hd:"@media (min-width: 1200px)"};var W=t.style=H;function X(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return e?H(c({},e,n)):W(n)}t.$=X;t.merge=H,t.compose=H;function q(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return H(c({},e,n))}},77769:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.PluginSet=l,t.fallbacks=function(e){if(Object.keys(e.style).map(function(t){return Array.isArray(e.style[t])}).indexOf(!0)>=0){var t=e.style,n=Object.keys(t).reduce(function(e,n){return e[n]=Array.isArray(t[n])?t[n].join("; "+(0,s.processStyleName)(n)+": "):t[n],e},{});return(0,r.default)({},e,{style:n})}return e},t.contentWrap=function(e){if(e.style.content){var t=e.style.content;return u.indexOf(t)>=0||/^(attr|calc|counters?|url)\(/.test(t)?e:t.charAt(0)!==t.charAt(t.length-1)||'"'!==t.charAt(0)&&"'"!==t.charAt(0)?i({},e,{style:i({},e.style,{content:'"'+t+'"'})}):e}return e},t.prefixes=function(e){return(0,r.default)({},e,{style:(0,o.default)(i({},e.style))})};var r=a(n(45228)),s=n(26050),o=a(n(19654));function a(e){return e&&e.__esModule?e:{default:e}}function l(e){this.fns=e||[]}(0,r.default)(l.prototype,{add:function(){for(var e=this,t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];n.forEach(function(t){e.fns.indexOf(t)>=0||(e.fns=[t].concat(e.fns))})},remove:function(e){this.fns=this.fns.filter(function(t){return t!==e})},clear:function(){this.fns=[]},transform:function(e){return this.fns.reduce(function(e,t){return t(e)},e)}});var u=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit"]},19654:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){for(var t in e){var n=e[t],i=(0,s.default)(y,t,n,e,_);i&&(e[t]=i),(0,r.default)(_,t,e)}return e};var i=g(n(10113)),r=g(n(84397)),s=g(n(66127)),o=g(n(91244)),a=g(n(93038)),l=g(n(80436)),u=g(n(1421)),c=g(n(80807)),d=g(n(65086)),h=g(n(77637)),p=g(n(18877)),f=g(n(14796)),m=g(n(55309));function g(e){return e&&e.__esModule?e:{default:e}}var y=[a.default,o.default,l.default,c.default,d.default,h.default,p.default,f.default,m.default,u.default],_=i.default.prefixMap},56314:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StyleSheet=p;var i,r=n(45228),s=(i=r)&&i.__esModule?i:{default:i};function o(e){return e[e.length-1]}function a(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}var l="undefined"!=typeof window,u=!1,c=!1,d=function(){if(l){var e=document.createElement("div");return e.innerHTML="\x3c!--[if lt IE 10]><i></i><![endif]--\x3e",1===e.getElementsByTagName("i").length}}();function h(){var e=document.createElement("style");return e.type="text/css",e.setAttribute("data-glamor",""),e.appendChild(document.createTextNode("")),(document.head||document.getElementsByTagName("head")[0]).appendChild(e),e}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.speedy,n=void 0===t?!u&&!c:t,i=e.maxLength,r=void 0===i?l&&d?4e3:65e3:i;this.isSpeedy=n,this.sheet=void 0,this.tags=[],this.maxLength=r,this.ctr=0}(0,s.default)(p.prototype,{getSheet:function(){return a(o(this.tags))},inject:function(){var e=this;if(this.injected)throw new Error("already injected stylesheet!");l?this.tags[0]=h():this.sheet={cssRules:[],insertRule:function(t){e.sheet.cssRules.push({cssText:t})}},this.injected=!0},speedy:function(e){if(0!==this.ctr)throw new Error("cannot change speedy mode after inserting any rule to sheet. Either call speedy("+e+") earlier in your app, or call flush() before speedy("+e+")");this.isSpeedy=!!e},_insert:function(e){try{var t=this.getSheet();t.insertRule(e,-1!==e.indexOf("@import")?0:t.cssRules.length)}catch(t){u&&console.warn("whoops, illegal rule inserted",e)}},insert:function(e){if(l)if(this.isSpeedy&&this.getSheet().insertRule)this._insert(e);else if(-1!==e.indexOf("@import")){var t=o(this.tags);t.insertBefore(document.createTextNode(e),t.firstChild)}else o(this.tags).appendChild(document.createTextNode(e));else this.sheet.insertRule(e,-1!==e.indexOf("@import")?0:this.sheet.cssRules.length);return this.ctr++,l&&this.ctr%this.maxLength===0&&this.tags.push(h()),this.ctr-1},delete:function(e){return this.replace(e,"")},flush:function(){l?(this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.sheet=null,this.ctr=0):this.sheet.cssRules=[],this.injected=!1},rules:function(){if(!l)return this.sheet.cssRules;var e=[];return this.tags.forEach(function(t){return e.splice.apply(e,[e.length,0].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(Array.from(a(t).cssRules))))}),e}})},45685:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>a});var i=/[A-Z]/g,r=/^ms-/,s={};function o(e){return"-"+e.toLowerCase()}const a=function(e){if(s.hasOwnProperty(e))return s[e];var t=e.replace(i,o);return s[e]=r.test(t)?"-"+t:t}},251:(e,t)=>{
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
t.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,l=(1<<a)-1,u=l>>1,c=-7,d=n?r-1:0,h=n?-1:1,p=e[t+d];for(d+=h,s=p&(1<<-c)-1,p>>=-c,c+=a;c>0;s=256*s+e[t+d],d+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=i;c>0;o=256*o+e[t+d],d+=h,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=u}return(p?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var o,a,l,u=8*s-r-1,c=(1<<u)-1,d=c>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=c?(a=0,o=c):o+d>=1?(a=(t*l-1)*Math.pow(2,r),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+p]=255&a,p+=f,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;e[n+p]=255&o,p+=f,o/=256,u-=8);e[n+p-f]|=128*m}},93038:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("string"==typeof t&&!(0,s.default)(t)&&t.indexOf("cross-fade(")>-1)return o.map(function(e){return t.replace(/cross-fade\(/g,e+"cross-fade(")})};var i,r=n(44014),s=(i=r)&&i.__esModule?i:{default:i};var o=["-webkit-",""];e.exports=t.default},91244:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("cursor"===e&&i.hasOwnProperty(t))return n.map(function(e){return e+t})};var n=["-webkit-","-moz-",""],i={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};e.exports=t.default},80436:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("string"==typeof t&&!(0,s.default)(t)&&t.indexOf("filter(")>-1)return o.map(function(e){return t.replace(/filter\(/g,e+"filter(")})};var i,r=n(44014),s=(i=r)&&i.__esModule?i:{default:i};var o=["-webkit-",""];e.exports=t.default},1421:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("display"===e&&n.hasOwnProperty(t))return n[t]};var n={flex:["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex","flex"],"inline-flex":["-webkit-inline-box","-moz-inline-box","-ms-inline-flexbox","-webkit-inline-flex","inline-flex"]};e.exports=t.default},80807:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){"flexDirection"===e&&"string"==typeof t&&(t.indexOf("column")>-1?r.WebkitBoxOrient="vertical":r.WebkitBoxOrient="horizontal",t.indexOf("reverse")>-1?r.WebkitBoxDirection="reverse":r.WebkitBoxDirection="normal");i.hasOwnProperty(e)&&(r[i[e]]=n[t]||t)};var n={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},i={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines"};e.exports=t.default},65086:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("string"==typeof t&&!(0,s.default)(t)&&a.test(t))return o.map(function(e){return e+t})};var i,r=n(44014),s=(i=r)&&i.__esModule?i:{default:i};var o=["-webkit-","-moz-",""],a=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;e.exports=t.default},77637:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("string"==typeof t&&!(0,s.default)(t)&&t.indexOf("image-set(")>-1)return o.map(function(e){return t.replace(/image-set\(/g,e+"image-set(")})};var i,r=n(44014),s=(i=r)&&i.__esModule?i:{default:i};var o=["-webkit-",""];e.exports=t.default},18877:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("position"===e&&"sticky"===t)return["-webkit-sticky","sticky"]},e.exports=t.default},14796:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(i.hasOwnProperty(e)&&r.hasOwnProperty(t))return n.map(function(e){return e+t})};var n=["-webkit-","-moz-",""],i={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},r={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};e.exports=t.default},55309:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,o){if("string"==typeof t&&a.hasOwnProperty(e)){var u=function(e,t){if((0,r.default)(e))return e;for(var n=e.split(/,(?![^()]*(?:\([^()]*\))?\))/g),s=0,o=n.length;s<o;++s){var a=n[s],u=[a];for(var c in t){var d=(0,i.default)(c);if(a.indexOf(d)>-1&&"order"!==d)for(var h=t[c],p=0,f=h.length;p<f;++p)u.unshift(a.replace(d,l[h[p]]+d))}n[s]=u.join(",")}return n.join(",")}(t,o),c=u.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return!/-moz-|-ms-/.test(e)}).join(",");if(e.indexOf("Webkit")>-1)return c;var d=u.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return!/-webkit-|-ms-/.test(e)}).join(",");return e.indexOf("Moz")>-1?d:(n["Webkit"+(0,s.default)(e)]=c,n["Moz"+(0,s.default)(e)]=d,u)}};var i=o(n(65721)),r=o(n(44014)),s=o(n(87479));function o(e){return e&&e.__esModule?e:{default:e}}var a={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},l={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-"};e.exports=t.default},10113:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=["Webkit"],i=["Moz"],r=["ms"],s=["Webkit","Moz"],o=["Webkit","ms"],a=["Webkit","Moz","ms"];t.default={plugins:[],prefixMap:{appearance:s,userSelect:a,textEmphasisPosition:n,textEmphasis:n,textEmphasisStyle:n,textEmphasisColor:n,boxDecorationBreak:n,clipPath:n,maskImage:n,maskMode:n,maskRepeat:n,maskPosition:n,maskClip:n,maskOrigin:n,maskSize:n,maskComposite:n,mask:n,maskBorderSource:n,maskBorderMode:n,maskBorderSlice:n,maskBorderWidth:n,maskBorderOutset:n,maskBorderRepeat:n,maskBorder:n,maskType:n,textDecorationStyle:n,textDecorationSkip:n,textDecorationLine:n,textDecorationColor:n,filter:n,fontFeatureSettings:n,breakAfter:a,breakBefore:a,breakInside:a,columnCount:s,columnFill:s,columnGap:s,columnRule:s,columnRuleColor:s,columnRuleStyle:s,columnRuleWidth:s,columns:s,columnSpan:s,columnWidth:s,writingMode:o,flex:n,flexBasis:n,flexDirection:n,flexGrow:n,flexFlow:n,flexShrink:n,flexWrap:n,alignContent:n,alignItems:n,alignSelf:n,justifyContent:n,order:n,transform:n,transformOrigin:n,transformOriginX:n,transformOriginY:n,backfaceVisibility:n,perspective:n,perspectiveOrigin:n,transformStyle:n,transformOriginZ:n,animation:n,animationDelay:n,animationDirection:n,animationFillMode:n,animationDuration:n,animationIterationCount:n,animationName:n,animationPlayState:n,animationTimingFunction:n,backdropFilter:n,fontKerning:n,scrollSnapType:o,scrollSnapPointsX:o,scrollSnapPointsY:o,scrollSnapDestination:o,scrollSnapCoordinate:o,shapeImageThreshold:n,shapeImageMargin:n,shapeImageOutside:n,hyphens:a,flowInto:o,flowFrom:o,regionFragment:o,textAlignLast:i,tabSize:i,wrapFlow:r,wrapThrough:r,wrapMargin:r,gridTemplateColumns:r,gridTemplateRows:r,gridTemplateAreas:r,gridTemplate:r,gridAutoColumns:r,gridAutoRows:r,gridAutoFlow:r,grid:r,gridRowStart:r,gridColumnStart:r,gridRowEnd:r,gridRow:r,gridColumn:r,gridColumnEnd:r,gridColumnGap:r,gridRowGap:r,gridArea:r,gridGap:r,textSizeAdjust:o,borderImage:n,borderImageOutset:n,borderImageRepeat:n,borderImageSlice:n,borderImageSource:n,borderImageWidth:n,transitionDelay:n,transitionDuration:n,transitionProperty:n,transitionTimingFunction:n}},e.exports=t.default},87479:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},e.exports=t.default},84397:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){if(e.hasOwnProperty(t))for(var i=e[t],r=0,o=i.length;r<o;++r)n[i[r]+(0,s.default)(t)]=n[t]};var i,r=n(87479),s=(i=r)&&i.__esModule?i:{default:i};e.exports=t.default},66127:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,i,r){for(var s=0,o=e.length;s<o;++s){var a=e[s](t,n,i,r);if(a)return a}},e.exports=t.default},71710:(e,t,n)=>{
/*!
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/main/LICENSE
*/
e.exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){return r(t[o][1][e]||e)},u,u.exports,e,t,n,i)}return n[o].exports}for(var s=void 0,o=0;o<i.length;o++)r(i[o]);return r}({1:[function(e,t,n){"use strict";var i=e("./utils"),r=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(e){for(var t,n,r,o,a,l,u,c=[],d=0,h=e.length,p=h,f="string"!==i.getTypeOf(e);d<e.length;)p=h-d,r=f?(t=e[d++],n=d<h?e[d++]:0,d<h?e[d++]:0):(t=e.charCodeAt(d++),n=d<h?e.charCodeAt(d++):0,d<h?e.charCodeAt(d++):0),o=t>>2,a=(3&t)<<4|n>>4,l=1<p?(15&n)<<2|r>>6:64,u=2<p?63&r:64,c.push(s.charAt(o)+s.charAt(a)+s.charAt(l)+s.charAt(u));return c.join("")},n.decode=function(e){var t,n,i,o,a,l,u=0,c=0,d="data:";if(e.substr(0,d.length)===d)throw new Error("Invalid base64 input, it looks like a data url.");var h,p=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&p--,e.charAt(e.length-2)===s.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=r.uint8array?new Uint8Array(0|p):new Array(0|p);u<e.length;)t=s.indexOf(e.charAt(u++))<<2|(o=s.indexOf(e.charAt(u++)))>>4,n=(15&o)<<4|(a=s.indexOf(e.charAt(u++)))>>2,i=(3&a)<<6|(l=s.indexOf(e.charAt(u++))),h[c++]=t,64!==a&&(h[c++]=n),64!==l&&(h[c++]=i);return h}},{"./support":30,"./utils":32}],2:[function(e,t,n){"use strict";var i=e("./external"),r=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,n,i,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=i,this.compressedContent=r}a.prototype={getContentWorker:function(){var e=new r(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new r(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,n){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){"use strict";var i=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){"use strict";var i=e("./utils"),r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==i.getTypeOf(e)?function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){"use strict";var i=null;i="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:i}},{lie:37}],7:[function(e,t,n){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,r=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=i?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",s.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new l("Deflate",e)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){"use strict";function i(e,t){var n,i="";for(n=0;n<t;n++)i+=String.fromCharCode(255&e),e>>>=8;return i}function r(e,t,n,r,o,c){var d,h,p=e.file,f=e.compression,m=c!==a.utf8encode,g=s.transformTo("string",c(p.name)),y=s.transformTo("string",a.utf8encode(p.name)),_=p.comment,v=s.transformTo("string",c(_)),b=s.transformTo("string",a.utf8encode(_)),T=y.length!==p.name.length,x=b.length!==_.length,E="",w="",I="",A=p.dir,S=p.date,C={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(C.crc32=e.crc32,C.compressedSize=e.compressedSize,C.uncompressedSize=e.uncompressedSize);var O=0;t&&(O|=8),m||!T&&!x||(O|=2048);var M=0,R=0;A&&(M|=16),"UNIX"===o?(R=798,M|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,A)):(R=20,M|=function(e){return 63&(e||0)}(p.dosPermissions)),d=S.getUTCHours(),d<<=6,d|=S.getUTCMinutes(),d<<=5,d|=S.getUTCSeconds()/2,h=S.getUTCFullYear()-1980,h<<=4,h|=S.getUTCMonth()+1,h<<=5,h|=S.getUTCDate(),T&&(w=i(1,1)+i(l(g),4)+y,E+="up"+i(w.length,2)+w),x&&(I=i(1,1)+i(l(v),4)+b,E+="uc"+i(I.length,2)+I);var k="";return k+="\n\0",k+=i(O,2),k+=f.magic,k+=i(d,2),k+=i(h,2),k+=i(C.crc32,4),k+=i(C.compressedSize,4),k+=i(C.uncompressedSize,4),k+=i(g.length,2),k+=i(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+k+g+E,dirRecord:u.CENTRAL_FILE_HEADER+i(R,2)+k+i(v.length,2)+"\0\0\0\0"+i(M,4)+i(r,4)+g+E+v}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),u=e("../signature");function c(e,t,n,i){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(c,o),c.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-i-1))/n:100}}))},c.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=r(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=r(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+i(e.crc32,4)+i(e.compressedSize,4)+i(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var n=this.bytesWritten-e,r=function(e,t,n,r,o){var a=s.transformTo("string",o(r));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(e,2)+i(e,2)+i(t,4)+i(n,4)+i(a.length,2)+a}(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:r,meta:{percent:100}})},c.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},c.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},c.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},c.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch(e){}return!0},c.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=c},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,n){"use strict";var i=e("../compressions"),r=e("./ZipFileWorker");n.generateWorker=function(e,t,n){var s=new r(t.streamFiles,n,t.platform,t.encodeFileName),o=0;try{e.forEach(function(e,n){o++;var r=function(e,t){var n=e||t,r=i[n];if(!r)throw new Error(n+" is not a valid compression method !");return r}(n.options.compression,t.compression),a=n.options.compressionOptions||t.compressionOptions||{},l=n.dir,u=n.date;n._compressWorker(r,a).withStreamInfo("file",{name:e,dir:l,date:u,comment:n.comment||"",unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions}).pipe(s)}),s.entriesCount=o}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,n){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new i;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(i.prototype=e("./object")).loadAsync=e("./load"),i.support=e("./support"),i.defaults=e("./defaults"),i.version="3.10.1",i.loadAsync=function(e,t){return(new i).loadAsync(e,t)},i.external=e("./external"),t.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,n){"use strict";var i=e("./utils"),r=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function u(e){return new r.Promise(function(t,n){var i=e.decompressed.getContentWorker().pipe(new a);i.on("error",function(e){n(e)}).on("end",function(){i.streamInfo.crc32!==e.decompressed.crc32?n(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var n=this;return t=i.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),l.isNode&&l.isStream(e)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var n=new o(t);return n.load(e),n}).then(function(e){var n=[r.Promise.resolve(e)],i=e.files;if(t.checkCRC32)for(var s=0;s<i.length;s++)n.push(u(i[s]));return r.Promise.all(n)}).then(function(e){for(var r=e.shift(),s=r.files,o=0;o<s.length;o++){var a=s[o],l=a.fileNameStr,u=i.resolve(a.fileNameStr);n.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(n.file(u).unsafeOriginalName=l)}return r.zipComment.length&&(n.comment=r.zipComment),n})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,n){"use strict";var i=e("../utils"),r=e("../stream/GenericWorker");function s(e,t){r.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}i.inherits(s,r),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},s.prototype.pause=function(){return!!r.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,n){"use strict";var i=e("readable-stream").Readable;function r(e,t,n){i.call(this,t),this._helper=e;var r=this;e.on("data",function(e,t){r.push(e)||r._helper.pause(),n&&n(t)}).on("error",function(e){r.emit("error",e)}).on("end",function(){r.push(null)})}e("../utils").inherits(r,i),r.prototype._read=function(){this._helper.resume()},t.exports=r},{"../utils":32,"readable-stream":16}],14:[function(e,t,n){"use strict";t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,n){"use strict";function i(e,t,n){var i,r=s.getTypeOf(t),a=s.extend(n||{},l);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=m(e)),a.createFolders&&(i=f(e))&&g.call(this,i,!0);var d="string"===r&&!1===a.binary&&!1===a.base64;n&&void 0!==n.binary||(a.binary=!d),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",r="string");var y=null;y=t instanceof u||t instanceof o?t:h.isNode&&h.isStream(t)?new p(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var _=new c(e,y,a);this.files[e]=_}var r=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),l=e("./defaults"),u=e("./compressedObject"),c=e("./zipObject"),d=e("./generate"),h=e("./nodejsUtils"),p=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:l.createFolders,e=m(e),this.files[e]||i.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function y(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var _={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,i;for(t in this.files)i=this.files[t],(n=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(n,i)},filter:function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(i)}),t},file:function(e,t,n){if(1!==arguments.length)return e=this.root+e,i.call(this,e,t,n),this;if(y(e)){var r=e;return this.filter(function(e,t){return!t.dir&&r.test(e)})}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(y(e))return this.filter(function(t,n){return n.dir&&e.test(t)});var t=this.root+e,n=g.call(this,t),i=this.clone();return i.root=n.name,i},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var n=this.filter(function(t,n){return n.name.slice(0,e.length)===e}),i=0;i<n.length;i++)delete this.files[n[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,n={};try{if((n=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:r.utf8encode})).type=n.type.toLowerCase(),n.compression=n.compression.toUpperCase(),"binarystring"===n.type&&(n.type="string"),!n.type)throw new Error("No output type specified.");s.checkSupport(n.type),"darwin"!==n.platform&&"freebsd"!==n.platform&&"linux"!==n.platform&&"sunos"!==n.platform||(n.platform="UNIX"),"win32"===n.platform&&(n.platform="DOS");var i=n.comment||this.comment||"";t=d.generateWorker(this,n,i)}catch(e){(t=new o("error")).error(e)}return new a(t,n.type||"string",n.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=_},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,n){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,n){"use strict";var i=e("./DataReader");function r(e){i.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(r,i),r.prototype.byteAt=function(e){return this.data[this.zero+e]},r.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2),r=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===n&&this.data[s+2]===i&&this.data[s+3]===r)return s-this.zero;return-1},r.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2),r=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&n===s[1]&&i===s[2]&&r===s[3]},r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./DataReader":18}],18:[function(e,t,n){"use strict";var i=e("../utils");function r(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,n=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=r},{"../utils":32}],19:[function(e,t,n){"use strict";var i=e("./Uint8ArrayReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){"use strict";var i=e("./DataReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},r.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},r.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){"use strict";var i=e("./ArrayReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){"use strict";var i=e("../utils"),r=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=i.getTypeOf(e);return i.checkSupport(t),"string"!==t||r.uint8array?"nodebuffer"===t?new a(e):r.uint8array?new l(i.transformTo("uint8array",e)):new s(i.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){"use strict";n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){"use strict";var i=e("./GenericWorker"),r=e("../utils");function s(e){i.call(this,"ConvertWorker to "+e),this.destType=e}r.inherits(s,i),s.prototype.processChunk=function(e){this.push({data:r.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){"use strict";var i=e("./GenericWorker"),r=e("../crc32");function s(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,i),s.prototype.processChunk=function(e){this.streamInfo.crc32=r(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){"use strict";var i=e("../utils"),r=e("./GenericWorker");function s(e){r.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}i.inherits(s,r),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}r.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){"use strict";var i=e("../utils"),r=e("./GenericWorker");function s(e){r.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}i.inherits(s,r),s.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){"use strict";function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n<this._listeners[e].length;n++)this._listeners[e][n].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=i},{}],29:[function(e,t,n){"use strict";var i=e("../utils"),r=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),a=e("../support"),l=e("../external"),u=null;if(a.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function c(e,t){return new l.Promise(function(n,r){var s=[],a=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",function(e,n){s.push(e),t&&t(n)}).on("error",function(e){s=[],r(e)}).on("end",function(){try{var e=function(e,t,n){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),n);case"base64":return o.encode(t);default:return i.transformTo(e,t)}}(l,function(e,t){var n,i=0,r=null,s=0;for(n=0;n<t.length;n++)s+=t[n].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(r=new Uint8Array(s),n=0;n<t.length;n++)r.set(t[n],i),i+=t[n].length;return r;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,s),u);n(e)}catch(e){r(e)}s=[]}).resume()})}function d(e,t,n){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=n,i.checkSupport(o),this._worker=e.pipe(new r(o)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}d.prototype={accumulate:function(e){return c(this,e)},on:function(e,t){var n=this;return"data"===e?this._worker.on(e,function(e){t.call(n,e.data,e.meta)}):this._worker.on(e,function(){i.delay(t,arguments,n)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(i.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,n){"use strict";if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,n.nodebuffer="undefined"!=typeof Buffer,n.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)n.blob=!1;else{var i=new ArrayBuffer(0);try{n.blob=0===new Blob([i],{type:"application/zip"}).size}catch(e){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);r.append(i),n.blob=0===r.getBlob("application/zip").size}catch(e){n.blob=!1}}}try{n.nodestream=!!e("readable-stream").Readable}catch(e){n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){"use strict";for(var i=e("./utils"),r=e("./support"),s=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function c(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,n.utf8encode=function(e){return r.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,n,i,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(i-56320),s++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=r.uint8array?new Uint8Array(l):new Array(l),s=o=0;o<l;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(i-56320),s++),n<128?t[o++]=n:(n<2048?t[o++]=192|n>>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return r.nodebuffer?i.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,r,s,o=e.length,l=new Array(2*o);for(t=n=0;t<o;)if((r=e[t++])<128)l[n++]=r;else if(4<(s=a[r]))l[n++]=65533,t+=s-1;else{for(r&=2===s?31:3===s?15:7;1<s&&t<o;)r=r<<6|63&e[t++],s--;1<s?l[n++]=65533:r<65536?l[n++]=r:(r-=65536,l[n++]=55296|r>>10&1023,l[n++]=56320|1023&r)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),i.applyFromCharCode(l)}(e=i.transformTo(r.uint8array?"uint8array":"array",e))},i.inherits(u,o),u.prototype.processChunk=function(e){var t=i.transformTo(r.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}(t),l=t;o!==t.length&&(r.uint8array?(l=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(l=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(l),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=u,i.inherits(c,o),c.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){"use strict";var i=e("./support"),r=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function l(e,t){for(var n=0;n<e.length;++n)t[n]=255&e.charCodeAt(n);return t}e("setimmediate"),n.newBlob=function(e,t){n.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return i.append(e),i.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,n){var i=[],r=0,s=e.length;if(s<=n)return String.fromCharCode.apply(null,e);for(;r<s;)"array"===t||"nodebuffer"===t?i.push(String.fromCharCode.apply(null,e.slice(r,Math.min(r+n,s)))):i.push(String.fromCharCode.apply(null,e.subarray(r,Math.min(r+n,s)))),r+=n;return i.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(e){return!1}}()}};function c(e){var t=65536,i=n.getTypeOf(e),r=!0;if("uint8array"===i?r=u.applyCanBeUsed.uint8array:"nodebuffer"===i&&(r=u.applyCanBeUsed.nodebuffer),r)for(;1<t;)try{return u.stringifyByChunk(e,i,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function d(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}n.applyFromCharCode=c;var h={};h.string={string:a,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,s.allocBuffer(e.length))}},h.array={string:c,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(e)}},h.arraybuffer={string:function(e){return c(new Uint8Array(e))},array:function(e){return d(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:c,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return s.newBufferFrom(e)}},h.nodebuffer={string:c,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return d(e,new Uint8Array(e.length))},nodebuffer:a},n.transformTo=function(e,t){if(t=t||"",!e)return t;n.checkSupport(e);var i=n.getTypeOf(t);return h[i][e](t)},n.resolve=function(e){for(var t=e.split("/"),n=[],i=0;i<t.length;i++){var r=t[i];"."===r||""===r&&0!==i&&i!==t.length-1||(".."===r?n.pop():n.push(r))}return n.join("/")},n.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":i.nodebuffer&&s.isBuffer(e)?"nodebuffer":i.uint8array&&e instanceof Uint8Array?"uint8array":i.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(e){if(!i[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(e){var t,n,i="";for(n=0;n<(e||"").length;n++)i+="\\x"+((t=e.charCodeAt(n))<16?"0":"")+t.toString(16).toUpperCase();return i},n.delay=function(e,t,n){setImmediate(function(){e.apply(n||null,t||[])})},n.inherits=function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n},n.extend=function(){var e,t,n={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===n[t]&&(n[t]=arguments[e][t]);return n},n.prepareContent=function(e,t,s,a,u){return o.Promise.resolve(t).then(function(e){return i.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise(function(t,n){var i=new FileReader;i.onload=function(e){t(e.target.result)},i.onerror=function(e){n(e.target.error)},i.readAsArrayBuffer(e)}):e}).then(function(t){var c=n.getTypeOf(t);return c?("arraybuffer"===c?t=n.transformTo("uint8array",t):"string"===c&&(u?t=r.decode(t):s&&!0!==a&&(t=function(e){return l(e,i.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,n){"use strict";var i=e("./reader/readerFor"),r=e("./utils"),s=e("./signature"),o=e("./zipEntry"),a=e("./support");function l(e){this.files=[],this.loadOptions=e}l.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(t)+", expected "+r.pretty(e)+")")}},isSignature:function(e,t){var n=this.reader.index;this.reader.setIndex(e);var i=this.reader.readString(4)===t;return this.reader.setIndex(n),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",n=r.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(n)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,n,i=this.zip64EndOfCentralSize-44;0<i;)e=this.reader.readInt(2),t=this.reader.readInt(4),n=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var i=t-n;if(0<i)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(e){this.reader=i(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,n){"use strict";var i=e("./reader/readerFor"),r=e("./utils"),s=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),l=e("./compressions"),u=e("./support");function c(e,t){this.options=e,this.loadOptions=t}c.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(n),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,i,r=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<r;)t=e.readInt(2),n=e.readInt(2),i=e.readData(n),this.extraFields[t]={id:t,length:n,value:i};e.setIndex(r)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var n=r.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else{var s=r.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=i(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=i(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=c},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,n){"use strict";function i(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}}var r=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),l=e("./stream/GenericWorker");i.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");var i="string"===(n=e.toLowerCase())||"text"===n;"binarystring"!==n&&"text"!==n||(n="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!i&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&i&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new l("error")).error(e)}return new r(t,n,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof l?this._data:new s(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<u.length;d++)i.prototype[u[d]]=c;t.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){"use strict";var n,i,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var s=0,o=new r(c),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(c,0)};else{var l=new e.MessageChannel;l.port1.onmessage=c,n=function(){l.port2.postMessage(0)}}var u=[];function c(){var e,t;i=!0;for(var n=u.length;n;){for(t=u,u=[],e=-1;++e<n;)t[e]();n=u.length}i=!1}t.exports=function(e){1!==u.push(e)||i||n()}}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,n){"use strict";var i=e("immediate");function r(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==r&&p(this,e)}function c(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function d(e,t,n){i(function(){var i;try{i=t(n)}catch(i){return s.reject(e,i)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)})}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var n=!1;function i(t){n||(n=!0,s.reject(e,t))}function r(t){n||(n=!0,s.resolve(e,t))}var o=f(function(){t(r,i)});"error"===o.status&&i(o.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})},u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(r);return this.state!==l?d(n,this.state===a?e:t,this.outcome):this.queue.push(new c(n,e,t)),n},c.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){s.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=f(h,t);if("error"===n.status)return s.reject(e,n.value);var i=n.value;if(i)p(e,i);else{e.state=a,e.outcome=t;for(var r=-1,o=e.queue.length;++r<o;)e.queue[r].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:s.resolve(new this(r),e)},u.reject=function(e){var t=new this(r);return s.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,u=new this(r);++l<n;)c(e[l],l);return u;function c(e,r){t.resolve(e).then(function(e){o[r]=e,++a!==n||i||(i=!0,s.resolve(u,o))},function(e){i||(i=!0,s.reject(u,e))})}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o,a=-1,l=new this(r);++a<n;)o=e[a],t.resolve(o).then(function(e){i||(i=!0,s.resolve(l,e))},function(e){i||(i=!0,s.reject(l,e))});return l}},{immediate:36}],38:[function(e,t,n){"use strict";var i={};(0,e("./lib/utils/common").assign)(i,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,n){"use strict";var i=e("./zlib/deflate"),r=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),l=Object.prototype.toString,u=0,c=-1,d=0,h=8;function p(e){if(!(this instanceof p))return new p(e);this.options=r.assign({level:c,method:h,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==u)throw new Error(o[n]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var f;if(f="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(n=i.deflateSetDictionary(this.strm,f))!==u)throw new Error(o[n]);this._dict_set=!0}}function f(e,t){var n=new p(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}p.prototype.push=function(e,t){var n,o,a=this.strm,c=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new r.Buf8(c),a.next_out=0,a.avail_out=c),1!==(n=i.deflate(a,o))&&n!==u)return this.onEnd(n),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(r.shrinkBuf(a.output,a.next_out))):this.onData(r.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==n);return 4===o?(n=i.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===u):2!==o||(this.onEnd(u),!(a.avail_out=0))},p.prototype.onData=function(e){this.chunks.push(e)},p.prototype.onEnd=function(e){e===u&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Deflate=p,n.deflate=f,n.deflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},n.gzip=function(e,t){return(t=t||{}).gzip=!0,f(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,n){"use strict";var i=e("./zlib/inflate"),r=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),u=e("./zlib/gzheader"),c=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=r.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=i.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(a[n]);this.header=new u,i.inflateGetHeader(this.strm,this.header)}function h(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}d.prototype.push=function(e,t){var n,a,l,u,d,h,p=this.strm,f=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?p.input=s.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new r.Buf8(f),p.next_out=0,p.avail_out=f),(n=i.inflate(p,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(h="string"==typeof m?s.string2buf(m):"[object ArrayBuffer]"===c.call(m)?new Uint8Array(m):m,n=i.inflateSetDictionary(this.strm,h)),n===o.Z_BUF_ERROR&&!0===g&&(n=o.Z_OK,g=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),!(this.ended=!0);p.next_out&&(0!==p.avail_out&&n!==o.Z_STREAM_END&&(0!==p.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=s.utf8border(p.output,p.next_out),u=p.next_out-l,d=s.buf2string(p.output,l),p.next_out=u,p.avail_out=f-u,u&&r.arraySet(p.output,p.output,l,u,0),this.onData(d)):this.onData(r.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((0<p.avail_in||0===p.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(n=i.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(p.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=h,n.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},n.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,n){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,i,r){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+i),r);else for(var s=0;s<i;s++)e[r+s]=t[n+s]},flattenChunks:function(e){var t,n,i,r,s,o;for(t=i=0,n=e.length;t<n;t++)i+=e[t].length;for(o=new Uint8Array(i),t=r=0,n=e.length;t<n;t++)s=e[t],o.set(s,r),r+=s.length;return o}},s={arraySet:function(e,t,n,i,r){for(var s=0;s<i;s++)e[r+s]=t[n+s]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,r)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,s))},n.setTyped(i)},{}],42:[function(e,t,n){"use strict";var i=e("./common"),r=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new i.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function l(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&r))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var n="",o=0;o<t;o++)n+=String.fromCharCode(e[o]);return n}o[254]=o[254]=1,n.string2buf=function(e){var t,n,r,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new i.Buf8(l),s=o=0;o<l;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),n<128?t[o++]=n:(n<2048?t[o++]=192|n>>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new i.Buf8(e.length),n=0,r=t.length;n<r;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,i,r,s,a=t||e.length,u=new Array(2*a);for(n=i=0;n<a;)if((r=e[n++])<128)u[i++]=r;else if(4<(s=o[r]))u[i++]=65533,n+=s-1;else{for(r&=2===s?31:3===s?15:7;1<s&&n<a;)r=r<<6|63&e[n++],s--;1<s?u[i++]=65533:r<65536?u[i++]=r:(r-=65536,u[i++]=55296|r>>10&1023,u[i++]=56320|1023&r)}return l(u,i)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){"use strict";t.exports=function(e,t,n,i){for(var r=65535&e,s=e>>>16&65535,o=0;0!==n;){for(n-=o=2e3<n?2e3:n;s=s+(r=r+t[i++]|0)|0,--o;);r%=65521,s%=65521}return r|s<<16}},{}],44:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,n){"use strict";var i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,r){var s=i,o=r+n;e^=-1;for(var a=r;a<o;a++)e=e>>>8^s[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,n){"use strict";var i,r=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),l=e("./messages"),u=0,c=4,d=0,h=-2,p=-1,f=4,m=2,g=8,y=9,_=286,v=30,b=19,T=2*_+1,x=15,E=3,w=258,I=w+E+1,A=42,S=113,C=1,O=2,M=3,R=4;function k(e,t){return e.msg=l[t],t}function N(e){return(e<<1)-(4<e?9:0)}function D(e){for(var t=e.length;0<=--t;)e[t]=0}function F(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(r.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function L(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function P(e,t){e.pending_buf[e.pending++]=t}function B(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function $(e,t){var n,i,r=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-I?e.strstart-(e.w_size-I):0,u=e.window,c=e.w_mask,d=e.prev,h=e.strstart+w,p=u[s+o-1],f=u[s+o];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(n=t)+o]===f&&u[n+o-1]===p&&u[n]===u[s]&&u[++n]===u[s+1]){s+=2,n++;do{}while(u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&s<h);if(i=w-(h-s),s=h-w,o<i){if(e.match_start=t,a<=(o=i))break;p=u[s+o-1],f=u[s+o]}}}while((t=d[t&c])>l&&0!=--r);return o<=e.lookahead?o:e.lookahead}function U(e){var t,n,i,s,l,u,c,d,h,p,f=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-I)){for(r.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=n=e.hash_size;i=e.head[--t],e.head[t]=f<=i?i-f:0,--n;);for(t=n=f;i=e.prev[--t],e.prev[t]=f<=i?i-f:0,--n;);s+=f}if(0===e.strm.avail_in)break;if(u=e.strm,c=e.window,d=e.strstart+e.lookahead,p=void 0,(h=s)<(p=u.avail_in)&&(p=h),n=0===p?0:(u.avail_in-=p,r.arraySet(c,u.input,u.next_in,p,d),1===u.state.wrap?u.adler=o(u.adler,c,p,d):2===u.state.wrap&&(u.adler=a(u.adler,c,p,d)),u.next_in+=p,u.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=E)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+E-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<E)););}while(e.lookahead<I&&0!==e.strm.avail_in)}function z(e,t){for(var n,i;;){if(e.lookahead<I){if(U(e),e.lookahead<I&&t===u)return C;if(0===e.lookahead)break}if(n=0,e.lookahead>=E&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+E-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-I&&(e.match_length=$(e,n)),e.match_length>=E)if(i=s._tr_tally(e,e.strstart-e.match_start,e.match_length-E),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=E){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+E-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(L(e,!1),0===e.strm.avail_out))return C}return e.insert=e.strstart<E-1?e.strstart:E-1,t===c?(L(e,!0),0===e.strm.avail_out?M:R):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?C:O}function V(e,t){for(var n,i,r;;){if(e.lookahead<I){if(U(e),e.lookahead<I&&t===u)return C;if(0===e.lookahead)break}if(n=0,e.lookahead>=E&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+E-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=E-1,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-I&&(e.match_length=$(e,n),e.match_length<=5&&(1===e.strategy||e.match_length===E&&4096<e.strstart-e.match_start)&&(e.match_length=E-1)),e.prev_length>=E&&e.match_length<=e.prev_length){for(r=e.strstart+e.lookahead-E,i=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-E),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=r&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+E-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=E-1,e.strstart++,i&&(L(e,!1),0===e.strm.avail_out))return C}else if(e.match_available){if((i=s._tr_tally(e,0,e.window[e.strstart-1]))&&L(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return C}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<E-1?e.strstart:E-1,t===c?(L(e,!0),0===e.strm.avail_out?M:R):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?C:O}function j(e,t,n,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=r}function Y(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r.Buf16(2*T),this.dyn_dtree=new r.Buf16(2*(2*v+1)),this.bl_tree=new r.Buf16(2*(2*b+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16(x+1),this.heap=new r.Buf16(2*_+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(2*_+1),D(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function G(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=m,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?A:S,e.adler=2===t.wrap?0:1,t.last_flush=u,s._tr_init(t),d):k(e,h)}function H(e){var t=G(e);return t===d&&function(e){e.window_size=2*e.w_size,D(e.head),e.max_lazy_match=i[e.level].max_lazy,e.good_match=i[e.level].good_length,e.nice_match=i[e.level].nice_length,e.max_chain_length=i[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=E-1,e.match_available=0,e.ins_h=0}(e.state),t}function W(e,t,n,i,s,o){if(!e)return h;var a=1;if(t===p&&(t=6),i<0?(a=0,i=-i):15<i&&(a=2,i-=16),s<1||y<s||n!==g||i<8||15<i||t<0||9<t||o<0||f<o)return k(e,h);8===i&&(i=9);var l=new Y;return(e.state=l).strm=e,l.wrap=a,l.gzhead=null,l.w_bits=i,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=s+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+E-1)/E),l.window=new r.Buf8(2*l.w_size),l.head=new r.Buf16(l.hash_size),l.prev=new r.Buf16(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new r.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=o,l.method=n,H(e)}i=[new j(0,0,0,0,function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return C;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+n;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,L(e,!1),0===e.strm.avail_out))return C;if(e.strstart-e.block_start>=e.w_size-I&&(L(e,!1),0===e.strm.avail_out))return C}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?M:R):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),C)}),new j(4,4,8,4,z),new j(4,5,16,8,z),new j(4,6,32,32,z),new j(4,4,16,16,V),new j(8,16,32,32,V),new j(8,16,128,128,V),new j(8,32,128,256,V),new j(32,128,258,1024,V),new j(32,258,258,4096,V)],n.deflateInit=function(e,t){return W(e,t,g,15,8,0)},n.deflateInit2=W,n.deflateReset=H,n.deflateResetKeep=G,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?h:(e.state.gzhead=t,d):h},n.deflate=function(e,t){var n,r,o,l;if(!e||!e.state||5<t||t<0)return e?k(e,h):h;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||666===r.status&&t!==c)return k(e,0===e.avail_out?-5:h);if(r.strm=e,n=r.last_flush,r.last_flush=t,r.status===A)if(2===r.wrap)e.adler=0,P(r,31),P(r,139),P(r,8),r.gzhead?(P(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),P(r,255&r.gzhead.time),P(r,r.gzhead.time>>8&255),P(r,r.gzhead.time>>16&255),P(r,r.gzhead.time>>24&255),P(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),P(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(P(r,255&r.gzhead.extra.length),P(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=a(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(P(r,0),P(r,0),P(r,0),P(r,0),P(r,0),P(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),P(r,3),r.status=S);else{var p=g+(r.w_bits-8<<4)<<8;p|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(p|=32),p+=31-p%31,r.status=S,B(r,p),0!==r.strstart&&(B(r,e.adler>>>16),B(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(o=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),F(e),o=r.pending,r.pending!==r.pending_buf_size));)P(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),F(e),o=r.pending,r.pending===r.pending_buf_size)){l=1;break}l=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,P(r,l)}while(0!==l);r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),0===l&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),F(e),o=r.pending,r.pending===r.pending_buf_size)){l=1;break}l=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,P(r,l)}while(0!==l);r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),0===l&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&F(e),r.pending+2<=r.pending_buf_size&&(P(r,255&e.adler),P(r,e.adler>>8&255),e.adler=0,r.status=S)):r.status=S),0!==r.pending){if(F(e),0===e.avail_out)return r.last_flush=-1,d}else if(0===e.avail_in&&N(t)<=N(n)&&t!==c)return k(e,-5);if(666===r.status&&0!==e.avail_in)return k(e,-5);if(0!==e.avail_in||0!==r.lookahead||t!==u&&666!==r.status){var f=2===r.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return C;break}if(e.match_length=0,n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(L(e,!1),0===e.strm.avail_out))return C}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?M:R):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?C:O}(r,t):3===r.strategy?function(e,t){for(var n,i,r,o,a=e.window;;){if(e.lookahead<=w){if(U(e),e.lookahead<=w&&t===u)return C;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=E&&0<e.strstart&&(i=a[r=e.strstart-1])===a[++r]&&i===a[++r]&&i===a[++r]){o=e.strstart+w;do{}while(i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&r<o);e.match_length=w-(o-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=E?(n=s._tr_tally(e,1,e.match_length-E),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(L(e,!1),0===e.strm.avail_out))return C}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?M:R):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?C:O}(r,t):i[r.level].func(r,t);if(f!==M&&f!==R||(r.status=666),f===C||f===M)return 0===e.avail_out&&(r.last_flush=-1),d;if(f===O&&(1===t?s._tr_align(r):5!==t&&(s._tr_stored_block(r,0,0,!1),3===t&&(D(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),F(e),0===e.avail_out))return r.last_flush=-1,d}return t!==c?d:r.wrap<=0?1:(2===r.wrap?(P(r,255&e.adler),P(r,e.adler>>8&255),P(r,e.adler>>16&255),P(r,e.adler>>24&255),P(r,255&e.total_in),P(r,e.total_in>>8&255),P(r,e.total_in>>16&255),P(r,e.total_in>>24&255)):(B(r,e.adler>>>16),B(r,65535&e.adler)),F(e),0<r.wrap&&(r.wrap=-r.wrap),0!==r.pending?d:1)},n.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==A&&69!==t&&73!==t&&91!==t&&103!==t&&t!==S&&666!==t?k(e,h):(e.state=null,t===S?k(e,-3):d):h},n.deflateSetDictionary=function(e,t){var n,i,s,a,l,u,c,p,f=t.length;if(!e||!e.state)return h;if(2===(a=(n=e.state).wrap)||1===a&&n.status!==A||n.lookahead)return h;for(1===a&&(e.adler=o(e.adler,t,f,0)),n.wrap=0,f>=n.w_size&&(0===a&&(D(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new r.Buf8(n.w_size),r.arraySet(p,t,f-n.w_size,n.w_size,0),t=p,f=n.w_size),l=e.avail_in,u=e.next_in,c=e.input,e.avail_in=f,e.next_in=0,e.input=t,U(n);n.lookahead>=E;){for(i=n.strstart,s=n.lookahead-(E-1);n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+E-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++,--s;);n.strstart=i,n.lookahead=E-1,U(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=E-1,n.match_available=0,e.next_in=u,e.input=c,e.avail_in=l,n.wrap=a,d},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,n){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,n){"use strict";t.exports=function(e,t){var n,i,r,s,o,a,l,u,c,d,h,p,f,m,g,y,_,v,b,T,x,E,w,I,A;n=e.state,i=e.next_in,I=e.input,r=i+(e.avail_in-5),s=e.next_out,A=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),l=n.dmax,u=n.wsize,c=n.whave,d=n.wnext,h=n.window,p=n.hold,f=n.bits,m=n.lencode,g=n.distcode,y=(1<<n.lenbits)-1,_=(1<<n.distbits)-1;e:do{f<15&&(p+=I[i++]<<f,f+=8,p+=I[i++]<<f,f+=8),v=m[p&y];t:for(;;){if(p>>>=b=v>>>24,f-=b,0==(b=v>>>16&255))A[s++]=65535&v;else{if(!(16&b)){if(!(64&b)){v=m[(65535&v)+(p&(1<<b)-1)];continue t}if(32&b){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}T=65535&v,(b&=15)&&(f<b&&(p+=I[i++]<<f,f+=8),T+=p&(1<<b)-1,p>>>=b,f-=b),f<15&&(p+=I[i++]<<f,f+=8,p+=I[i++]<<f,f+=8),v=g[p&_];n:for(;;){if(p>>>=b=v>>>24,f-=b,!(16&(b=v>>>16&255))){if(!(64&b)){v=g[(65535&v)+(p&(1<<b)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(x=65535&v,f<(b&=15)&&(p+=I[i++]<<f,(f+=8)<b&&(p+=I[i++]<<f,f+=8)),l<(x+=p&(1<<b)-1)){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=b,f-=b,(b=s-o)<x){if(c<(b=x-b)&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(w=h,(E=0)===d){if(E+=u-b,b<T){for(T-=b;A[s++]=h[E++],--b;);E=s-x,w=A}}else if(d<b){if(E+=u+d-b,(b-=d)<T){for(T-=b;A[s++]=h[E++],--b;);if(E=0,d<T){for(T-=b=d;A[s++]=h[E++],--b;);E=s-x,w=A}}}else if(E+=d-b,b<T){for(T-=b;A[s++]=h[E++],--b;);E=s-x,w=A}for(;2<T;)A[s++]=w[E++],A[s++]=w[E++],A[s++]=w[E++],T-=3;T&&(A[s++]=w[E++],1<T&&(A[s++]=w[E++]))}else{for(E=s-x;A[s++]=A[E++],A[s++]=A[E++],A[s++]=A[E++],2<(T-=3););T&&(A[s++]=A[E++],1<T&&(A[s++]=A[E++]))}break}}break}}while(i<r&&s<a);i-=T=f>>3,p&=(1<<(f-=T<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=s<a?a-s+257:257-(s-a),n.hold=p,n.bits=f}},{}],49:[function(e,t,n){"use strict";var i=e("../utils/common"),r=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),l=1,u=2,c=0,d=-2,h=1,p=852,f=592;function m(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=h,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(p),t.distcode=t.distdyn=new i.Buf32(f),t.sane=1,t.back=-1,c):d}function _(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,y(e)):d}function v(e,t){var n,i;return e&&e.state?(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?d:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,_(e))):d}function b(e,t){var n,i;return e?(i=new g,(e.state=i).window=null,(n=v(e,t))!==c&&(e.state=null),n):d}var T,x,E=!0;function w(e){if(E){var t;for(T=new i.Buf32(512),x=new i.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(l,e.lens,0,288,T,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(u,e.lens,0,32,x,0,e.work,{bits:5}),E=!1}e.lencode=T,e.lenbits=9,e.distcode=x,e.distbits=5}function I(e,t,n,r){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new i.Buf8(o.wsize)),r>=o.wsize?(i.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r<(s=o.wsize-o.wnext)&&(s=r),i.arraySet(o.window,t,n-r,s,o.wnext),(r-=s)?(i.arraySet(o.window,t,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}n.inflateReset=_,n.inflateReset2=v,n.inflateResetKeep=y,n.inflateInit=function(e){return b(e,15)},n.inflateInit2=b,n.inflate=function(e,t){var n,p,f,g,y,_,v,b,T,x,E,A,S,C,O,M,R,k,N,D,F,L,P,B,$=0,U=new i.Buf8(4),z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return d;12===(n=e.state).mode&&(n.mode=13),y=e.next_out,f=e.output,v=e.avail_out,g=e.next_in,p=e.input,_=e.avail_in,b=n.hold,T=n.bits,x=_,E=v,L=c;e:for(;;)switch(n.mode){case h:if(0===n.wrap){n.mode=13;break}for(;T<16;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}if(2&n.wrap&&35615===b){U[n.check=0]=255&b,U[1]=b>>>8&255,n.check=s(n.check,U,2,0),T=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&b)){e.msg="unknown compression method",n.mode=30;break}if(T-=4,F=8+(15&(b>>>=4)),0===n.wbits)n.wbits=F;else if(F>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<F,e.adler=n.check=1,n.mode=512&b?10:12,T=b=0;break;case 2:for(;T<16;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}if(n.flags=b,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=b>>8&1),512&n.flags&&(U[0]=255&b,U[1]=b>>>8&255,n.check=s(n.check,U,2,0)),T=b=0,n.mode=3;case 3:for(;T<32;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}n.head&&(n.head.time=b),512&n.flags&&(U[0]=255&b,U[1]=b>>>8&255,U[2]=b>>>16&255,U[3]=b>>>24&255,n.check=s(n.check,U,4,0)),T=b=0,n.mode=4;case 4:for(;T<16;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}n.head&&(n.head.xflags=255&b,n.head.os=b>>8),512&n.flags&&(U[0]=255&b,U[1]=b>>>8&255,n.check=s(n.check,U,2,0)),T=b=0,n.mode=5;case 5:if(1024&n.flags){for(;T<16;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}n.length=b,n.head&&(n.head.extra_len=b),512&n.flags&&(U[0]=255&b,U[1]=b>>>8&255,n.check=s(n.check,U,2,0)),T=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(_<(A=n.length)&&(A=_),A&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),i.arraySet(n.head.extra,p,g,A,F)),512&n.flags&&(n.check=s(n.check,p,A,g)),_-=A,g+=A,n.length-=A),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===_)break e;for(A=0;F=p[g+A++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F)),F&&A<_;);if(512&n.flags&&(n.check=s(n.check,p,A,g)),_-=A,g+=A,F)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===_)break e;for(A=0;F=p[g+A++],n.head&&F&&n.length<65536&&(n.head.comment+=String.fromCharCode(F)),F&&A<_;);if(512&n.flags&&(n.check=s(n.check,p,A,g)),_-=A,g+=A,F)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;T<16;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}if(b!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}T=b=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;T<32;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}e.adler=n.check=m(b),T=b=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=y,e.avail_out=v,e.next_in=g,e.avail_in=_,n.hold=b,n.bits=T,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last){b>>>=7&T,T-=7&T,n.mode=27;break}for(;T<3;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}switch(n.last=1&b,T-=1,3&(b>>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,6!==t)break;b>>>=2,T-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}b>>>=2,T-=2;break;case 14:for(b>>>=7&T,T-=7&T;T<32;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}if((65535&b)!=(b>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&b,T=b=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(A=n.length){if(_<A&&(A=_),v<A&&(A=v),0===A)break e;i.arraySet(f,p,g,A,y),_-=A,g+=A,v-=A,y+=A,n.length-=A;break}n.mode=12;break;case 17:for(;T<14;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}if(n.nlen=257+(31&b),b>>>=5,T-=5,n.ndist=1+(31&b),b>>>=5,T-=5,n.ncode=4+(15&b),b>>>=4,T-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;T<3;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}n.lens[z[n.have++]]=7&b,b>>>=3,T-=3}for(;n.have<19;)n.lens[z[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,P={bits:n.lenbits},L=a(0,n.lens,0,19,n.lencode,0,n.work,P),n.lenbits=P.bits,L){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;M=($=n.lencode[b&(1<<n.lenbits)-1])>>>16&255,R=65535&$,!((O=$>>>24)<=T);){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}if(R<16)b>>>=O,T-=O,n.lens[n.have++]=R;else{if(16===R){for(B=O+2;T<B;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}if(b>>>=O,T-=O,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}F=n.lens[n.have-1],A=3+(3&b),b>>>=2,T-=2}else if(17===R){for(B=O+3;T<B;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}T-=O,F=0,A=3+(7&(b>>>=O)),b>>>=3,T-=3}else{for(B=O+7;T<B;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}T-=O,F=0,A=11+(127&(b>>>=O)),b>>>=7,T-=7}if(n.have+A>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;A--;)n.lens[n.have++]=F}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,P={bits:n.lenbits},L=a(l,n.lens,0,n.nlen,n.lencode,0,n.work,P),n.lenbits=P.bits,L){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,P={bits:n.distbits},L=a(u,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,P),n.distbits=P.bits,L){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=_&&258<=v){e.next_out=y,e.avail_out=v,e.next_in=g,e.avail_in=_,n.hold=b,n.bits=T,o(e,E),y=e.next_out,f=e.output,v=e.avail_out,g=e.next_in,p=e.input,_=e.avail_in,b=n.hold,T=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;M=($=n.lencode[b&(1<<n.lenbits)-1])>>>16&255,R=65535&$,!((O=$>>>24)<=T);){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}if(M&&!(240&M)){for(k=O,N=M,D=R;M=($=n.lencode[D+((b&(1<<k+N)-1)>>k)])>>>16&255,R=65535&$,!(k+(O=$>>>24)<=T);){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}b>>>=k,T-=k,n.back+=k}if(b>>>=O,T-=O,n.back+=O,n.length=R,0===M){n.mode=26;break}if(32&M){n.back=-1,n.mode=12;break}if(64&M){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&M,n.mode=22;case 22:if(n.extra){for(B=n.extra;T<B;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}n.length+=b&(1<<n.extra)-1,b>>>=n.extra,T-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;M=($=n.distcode[b&(1<<n.distbits)-1])>>>16&255,R=65535&$,!((O=$>>>24)<=T);){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}if(!(240&M)){for(k=O,N=M,D=R;M=($=n.distcode[D+((b&(1<<k+N)-1)>>k)])>>>16&255,R=65535&$,!(k+(O=$>>>24)<=T);){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}b>>>=k,T-=k,n.back+=k}if(b>>>=O,T-=O,n.back+=O,64&M){e.msg="invalid distance code",n.mode=30;break}n.offset=R,n.extra=15&M,n.mode=24;case 24:if(n.extra){for(B=n.extra;T<B;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}n.offset+=b&(1<<n.extra)-1,b>>>=n.extra,T-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===v)break e;if(A=E-v,n.offset>A){if((A=n.offset-A)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}S=A>n.wnext?(A-=n.wnext,n.wsize-A):n.wnext-A,A>n.length&&(A=n.length),C=n.window}else C=f,S=y-n.offset,A=n.length;for(v<A&&(A=v),v-=A,n.length-=A;f[y++]=C[S++],--A;);0===n.length&&(n.mode=21);break;case 26:if(0===v)break e;f[y++]=n.length,v--,n.mode=21;break;case 27:if(n.wrap){for(;T<32;){if(0===_)break e;_--,b|=p[g++]<<T,T+=8}if(E-=v,e.total_out+=E,n.total+=E,E&&(e.adler=n.check=n.flags?s(n.check,f,E,y-E):r(n.check,f,E,y-E)),E=v,(n.flags?b:m(b))!==n.check){e.msg="incorrect data check",n.mode=30;break}T=b=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;T<32;){if(0===_)break e;_--,b+=p[g++]<<T,T+=8}if(b!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}T=b=0}n.mode=29;case 29:L=1;break e;case 30:L=-3;break e;case 31:return-4;default:return d}return e.next_out=y,e.avail_out=v,e.next_in=g,e.avail_in=_,n.hold=b,n.bits=T,(n.wsize||E!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&I(e,e.output,e.next_out,E-e.avail_out)?(n.mode=31,-4):(x-=e.avail_in,E-=e.avail_out,e.total_in+=x,e.total_out+=E,n.total+=E,n.wrap&&E&&(e.adler=n.check=n.flags?s(n.check,f,E,e.next_out-E):r(n.check,f,E,e.next_out-E)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0==x&&0===E||4===t)&&L===c&&(L=-5),L)},n.inflateEnd=function(e){if(!e||!e.state)return d;var t=e.state;return t.window&&(t.window=null),e.state=null,c},n.inflateGetHeader=function(e,t){var n;return e&&e.state&&2&(n=e.state).wrap?((n.head=t).done=!1,c):d},n.inflateSetDictionary=function(e,t){var n,i=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?d:11===n.mode&&r(1,t,i,0)!==n.check?-3:I(e,t,i,i)?(n.mode=31,-4):(n.havedict=1,c):d},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,n){"use strict";var i=e("../utils/common"),r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,l,u,c,d,h){var p,f,m,g,y,_,v,b,T,x=h.bits,E=0,w=0,I=0,A=0,S=0,C=0,O=0,M=0,R=0,k=0,N=null,D=0,F=new i.Buf16(16),L=new i.Buf16(16),P=null,B=0;for(E=0;E<=15;E++)F[E]=0;for(w=0;w<l;w++)F[t[n+w]]++;for(S=x,A=15;1<=A&&0===F[A];A--);if(A<S&&(S=A),0===A)return u[c++]=20971520,u[c++]=20971520,h.bits=1,0;for(I=1;I<A&&0===F[I];I++);for(S<I&&(S=I),E=M=1;E<=15;E++)if(M<<=1,(M-=F[E])<0)return-1;if(0<M&&(0===e||1!==A))return-1;for(L[1]=0,E=1;E<15;E++)L[E+1]=L[E]+F[E];for(w=0;w<l;w++)0!==t[n+w]&&(d[L[t[n+w]]++]=w);if(_=0===e?(N=P=d,19):1===e?(N=r,D-=257,P=s,B-=257,256):(N=o,P=a,-1),E=I,y=c,O=w=k=0,m=-1,g=(R=1<<(C=S))-1,1===e&&852<R||2===e&&592<R)return 1;for(;;){for(v=E-O,T=d[w]<_?(b=0,d[w]):d[w]>_?(b=P[B+d[w]],N[D+d[w]]):(b=96,0),p=1<<E-O,I=f=1<<C;u[y+(k>>O)+(f-=p)]=v<<24|b<<16|T,0!==f;);for(p=1<<E-1;k&p;)p>>=1;if(0!==p?(k&=p-1,k+=p):k=0,w++,0==--F[E]){if(E===A)break;E=t[n+d[w]]}if(S<E&&(k&g)!==m){for(0===O&&(O=S),y+=I,M=1<<(C=E-O);C+O<A&&!((M-=F[C+O])<=0);)C++,M<<=1;if(R+=1<<C,1===e&&852<R||2===e&&592<R)return 1;u[m=k&g]=S<<24|C<<16|y-c}}return 0!==k&&(u[y+k]=E-O<<24|64<<16),h.bits=S,0}},{"../utils/common":41}],51:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,n){"use strict";var i=e("../utils/common"),r=0,s=1;function o(e){for(var t=e.length;0<=--t;)e[t]=0}var a=0,l=29,u=256,c=u+1+l,d=30,h=19,p=2*c+1,f=15,m=16,g=7,y=256,_=16,v=17,b=18,T=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],x=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=new Array(2*(c+2));o(I);var A=new Array(2*d);o(A);var S=new Array(512);o(S);var C=new Array(256);o(C);var O=new Array(l);o(O);var M,R,k,N=new Array(d);function D(e,t,n,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}function F(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function L(e){return e<256?S[e]:S[256+(e>>>7)]}function P(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function B(e,t,n){e.bi_valid>m-n?(e.bi_buf|=t<<e.bi_valid&65535,P(e,e.bi_buf),e.bi_buf=t>>m-e.bi_valid,e.bi_valid+=n-m):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function $(e,t,n){B(e,n[2*t],n[2*t+1])}function U(e,t){for(var n=0;n|=1&e,e>>>=1,n<<=1,0<--t;);return n>>>1}function z(e,t,n){var i,r,s=new Array(f+1),o=0;for(i=1;i<=f;i++)s[i]=o=o+n[i-1]<<1;for(r=0;r<=t;r++){var a=e[2*r+1];0!==a&&(e[2*r]=U(s[a]++,a))}}function V(e){var t;for(t=0;t<c;t++)e.dyn_ltree[2*t]=0;for(t=0;t<d;t++)e.dyn_dtree[2*t]=0;for(t=0;t<h;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*y]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function j(e){8<e.bi_valid?P(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Y(e,t,n,i){var r=2*t,s=2*n;return e[r]<e[s]||e[r]===e[s]&&i[t]<=i[n]}function G(e,t,n){for(var i=e.heap[n],r=n<<1;r<=e.heap_len&&(r<e.heap_len&&Y(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Y(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i}function H(e,t,n){var i,r,s,o,a=0;if(0!==e.last_lit)for(;i=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],r=e.pending_buf[e.l_buf+a],a++,0===i?$(e,r,t):($(e,(s=C[r])+u+1,t),0!==(o=T[s])&&B(e,r-=O[s],o),$(e,s=L(--i),n),0!==(o=x[s])&&B(e,i-=N[s],o)),a<e.last_lit;);$(e,y,t)}function W(e,t){var n,i,r,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,l=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=p,n=0;n<l;n++)0!==s[2*n]?(e.heap[++e.heap_len]=u=n,e.depth[n]=0):s[2*n+1]=0;for(;e.heap_len<2;)s[2*(r=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[r]=0,e.opt_len--,a&&(e.static_len-=o[2*r+1]);for(t.max_code=u,n=e.heap_len>>1;1<=n;n--)G(e,s,n);for(r=l;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=i,s[2*r]=s[2*n]+s[2*i],e.depth[r]=(e.depth[n]>=e.depth[i]?e.depth[n]:e.depth[i])+1,s[2*n+1]=s[2*i+1]=r,e.heap[1]=r++,G(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,i,r,s,o,a,l=t.dyn_tree,u=t.max_code,c=t.stat_desc.static_tree,d=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,m=t.stat_desc.extra_base,g=t.stat_desc.max_length,y=0;for(s=0;s<=f;s++)e.bl_count[s]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<p;n++)g<(s=l[2*l[2*(i=e.heap[n])+1]+1]+1)&&(s=g,y++),l[2*i+1]=s,u<i||(e.bl_count[s]++,o=0,m<=i&&(o=h[i-m]),a=l[2*i],e.opt_len+=a*(s+o),d&&(e.static_len+=a*(c[2*i+1]+o)));if(0!==y){do{for(s=g-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[g]--,y-=2}while(0<y);for(s=g;0!==s;s--)for(i=e.bl_count[s];0!==i;)u<(r=e.heap[--n])||(l[2*r+1]!==s&&(e.opt_len+=(s-l[2*r+1])*l[2*r],l[2*r+1]=s),i--)}}(e,t),z(s,u,e.bl_count)}function X(e,t,n){var i,r,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)r=o,o=t[2*(i+1)+1],++a<l&&r===o||(a<u?e.bl_tree[2*r]+=a:0!==r?(r!==s&&e.bl_tree[2*r]++,e.bl_tree[2*_]++):a<=10?e.bl_tree[2*v]++:e.bl_tree[2*b]++,s=r,u=(a=0)===o?(l=138,3):r===o?(l=6,3):(l=7,4))}function q(e,t,n){var i,r,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),i=0;i<=n;i++)if(r=o,o=t[2*(i+1)+1],!(++a<l&&r===o)){if(a<u)for(;$(e,r,e.bl_tree),0!=--a;);else 0!==r?(r!==s&&($(e,r,e.bl_tree),a--),$(e,_,e.bl_tree),B(e,a-3,2)):a<=10?($(e,v,e.bl_tree),B(e,a-3,3)):($(e,b,e.bl_tree),B(e,a-11,7));s=r,u=(a=0)===o?(l=138,3):r===o?(l=6,3):(l=7,4)}}o(N);var K=!1;function Z(e,t,n,r){B(e,(a<<1)+(r?1:0),3),function(e,t,n,r){j(e),r&&(P(e,n),P(e,~n)),i.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}(e,t,n,!0)}n._tr_init=function(e){K||(function(){var e,t,n,i,r,s=new Array(f+1);for(i=n=0;i<l-1;i++)for(O[i]=n,e=0;e<1<<T[i];e++)C[n++]=i;for(C[n-1]=i,i=r=0;i<16;i++)for(N[i]=r,e=0;e<1<<x[i];e++)S[r++]=i;for(r>>=7;i<d;i++)for(N[i]=r<<7,e=0;e<1<<x[i]-7;e++)S[256+r++]=i;for(t=0;t<=f;t++)s[t]=0;for(e=0;e<=143;)I[2*e+1]=8,e++,s[8]++;for(;e<=255;)I[2*e+1]=9,e++,s[9]++;for(;e<=279;)I[2*e+1]=7,e++,s[7]++;for(;e<=287;)I[2*e+1]=8,e++,s[8]++;for(z(I,c+1,s),e=0;e<d;e++)A[2*e+1]=5,A[2*e]=U(e,5);M=new D(I,T,u+1,c,f),R=new D(A,x,0,d,f),k=new D(new Array(0),E,0,h,g)}(),K=!0),e.l_desc=new F(e.dyn_ltree,M),e.d_desc=new F(e.dyn_dtree,R),e.bl_desc=new F(e.bl_tree,k),e.bi_buf=0,e.bi_valid=0,V(e)},n._tr_stored_block=Z,n._tr_flush_block=function(e,t,n,i){var o,a,l=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return r;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return s;for(t=32;t<u;t++)if(0!==e.dyn_ltree[2*t])return s;return r}(e)),W(e,e.l_desc),W(e,e.d_desc),l=function(e){var t;for(X(e,e.dyn_ltree,e.l_desc.max_code),X(e,e.dyn_dtree,e.d_desc.max_code),W(e,e.bl_desc),t=h-1;3<=t&&0===e.bl_tree[2*w[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=n+5,n+4<=o&&-1!==t?Z(e,t,n,i):4===e.strategy||a===o?(B(e,2+(i?1:0),3),H(e,I,A)):(B(e,4+(i?1:0),3),function(e,t,n,i){var r;for(B(e,t-257,5),B(e,n-1,5),B(e,i-4,4),r=0;r<i;r++)B(e,e.bl_tree[2*w[r]+1],3);q(e,e.dyn_ltree,t-1),q(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,l+1),H(e,e.dyn_ltree,e.dyn_dtree)),V(e),i&&j(e)},n._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(C[n]+u+1)]++,e.dyn_dtree[2*L(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){B(e,2,3),$(e,y,I),function(e){16===e.bi_valid?(P(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,i){(function(e){!function(e,t){"use strict";if(!e.setImmediate){var n,i,r,s,o=1,a={},l=!1,u=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,n="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick(function(){h(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(s="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",p,!1):e.attachEvent("onmessage",p),function(t){e.postMessage(s+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){h(e.data)},function(e){r.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(i=u.documentElement,function(e){var t=u.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(h,0,e)},c.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];var r={callback:e,args:t};return a[o]=r,n(o),o++},c.clearImmediate=d}function d(e){delete a[e]}function h(e){if(l)setTimeout(h,0,e);else{var n=a[e];if(n){l=!0;try{!function(e){var n=e.callback,i=e.args;switch(i.length){case 0:n();break;case 1:n(i[0]);break;case 2:n(i[0],i[1]);break;case 3:n(i[0],i[1],i[2]);break;default:n.apply(t,i)}}(n)}finally{d(e),l=!1}}}}function p(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&h(+t.data.slice(s.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)},28570:e=>{e.exports=n;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function i(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var r={},s={};function o(e,t){var n,i,o;return t?(o=0<=(e>>>=0)&&e<256)&&(i=s[e])?i:(n=l(e,(0|e)<0?-1:0,!0),o&&(s[e]=n),n):(o=-128<=(e|=0)&&e<128)&&(i=r[e])?i:(n=l(e,e<0?-1:0,!1),o&&(r[e]=n),n)}function a(e,t){if(isNaN(e))return t?y:g;if(t){if(e<0)return y;if(e>=p)return x}else{if(e<=-f)return E;if(e+1>=f)return T}return e<0?a(-e,t).neg():l(e%h|0,e/h|0,t)}function l(e,t,i){return new n(e,t,i)}n.fromInt=o,n.fromNumber=a,n.fromBits=l;var u=Math.pow;function c(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return c(e.substring(1),t,n).neg();for(var r=a(u(n,8)),s=g,o=0;o<e.length;o+=8){var l=Math.min(8,e.length-o),d=parseInt(e.substring(o,o+l),n);if(l<8){var h=a(u(n,l));s=s.mul(h).add(a(d))}else s=(s=s.mul(r)).add(a(d))}return s.unsigned=t,s}function d(e,t){return"number"==typeof e?a(e,t):"string"==typeof e?c(e,t):l(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=c,n.fromValue=d;var h=4294967296,p=h*h,f=p/2,m=o(1<<24),g=o(0);n.ZERO=g;var y=o(0,!0);n.UZERO=y;var _=o(1);n.ONE=_;var v=o(1,!0);n.UONE=v;var b=o(-1);n.NEG_ONE=b;var T=l(-1,2147483647,!1);n.MAX_VALUE=T;var x=l(-1,-1,!0);n.MAX_UNSIGNED_VALUE=x;var E=l(0,-2147483648,!1);n.MIN_VALUE=E;var w=n.prototype;w.toInt=function(){return this.unsigned?this.low>>>0:this.low},w.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},w.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(E)){var t=a(e),n=this.div(t),i=n.mul(t).sub(this);return n.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var r=a(u(e,6),this.unsigned),s=this,o="";;){var l=s.div(r),c=(s.sub(l.mul(r)).toInt()>>>0).toString(e);if((s=l).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},w.getHighBits=function(){return this.high},w.getHighBitsUnsigned=function(){return this.high>>>0},w.getLowBits=function(){return this.low},w.getLowBitsUnsigned=function(){return this.low>>>0},w.getNumBitsAbs=function(){if(this.isNegative())return this.eq(E)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},w.isZero=function(){return 0===this.high&&0===this.low},w.eqz=w.isZero,w.isNegative=function(){return!this.unsigned&&this.high<0},w.isPositive=function(){return this.unsigned||this.high>=0},w.isOdd=function(){return!(1&~this.low)},w.isEven=function(){return!(1&this.low)},w.equals=function(e){return i(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},w.eq=w.equals,w.notEquals=function(e){return!this.eq(e)},w.neq=w.notEquals,w.ne=w.notEquals,w.lessThan=function(e){return this.comp(e)<0},w.lt=w.lessThan,w.lessThanOrEqual=function(e){return this.comp(e)<=0},w.lte=w.lessThanOrEqual,w.le=w.lessThanOrEqual,w.greaterThan=function(e){return this.comp(e)>0},w.gt=w.greaterThan,w.greaterThanOrEqual=function(e){return this.comp(e)>=0},w.gte=w.greaterThanOrEqual,w.ge=w.greaterThanOrEqual,w.compare=function(e){if(i(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},w.comp=w.compare,w.negate=function(){return!this.unsigned&&this.eq(E)?E:this.not().add(_)},w.neg=w.negate,w.add=function(e){i(e)||(e=d(e));var t=this.high>>>16,n=65535&this.high,r=this.low>>>16,s=65535&this.low,o=e.high>>>16,a=65535&e.high,u=e.low>>>16,c=0,h=0,p=0,f=0;return p+=(f+=s+(65535&e.low))>>>16,h+=(p+=r+u)>>>16,c+=(h+=n+a)>>>16,c+=t+o,l((p&=65535)<<16|(f&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},w.subtract=function(e){return i(e)||(e=d(e)),this.add(e.neg())},w.sub=w.subtract,w.multiply=function(e){if(this.isZero())return g;if(i(e)||(e=d(e)),t)return l(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(E))return e.isOdd()?E:g;if(e.eq(E))return this.isOdd()?E:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return a(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,r=65535&this.high,s=this.low>>>16,o=65535&this.low,u=e.high>>>16,c=65535&e.high,h=e.low>>>16,p=65535&e.low,f=0,y=0,_=0,v=0;return _+=(v+=o*p)>>>16,y+=(_+=s*p)>>>16,_&=65535,y+=(_+=o*h)>>>16,f+=(y+=r*p)>>>16,y&=65535,f+=(y+=s*h)>>>16,y&=65535,f+=(y+=o*c)>>>16,f+=n*p+r*h+s*c+o*u,l((_&=65535)<<16|(v&=65535),(f&=65535)<<16|(y&=65535),this.unsigned)},w.mul=w.multiply,w.divide=function(e){if(i(e)||(e=d(e)),e.isZero())throw Error("division by zero");var n,r,s;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?y:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return y;if(e.gt(this.shru(1)))return v;s=y}else{if(this.eq(E))return e.eq(_)||e.eq(b)?E:e.eq(E)?_:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?_:b:(r=this.sub(e.mul(n)),s=n.add(r.div(e)));if(e.eq(E))return this.unsigned?y:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=g}for(r=this;r.gte(e);){n=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(n)/Math.LN2),c=o<=48?1:u(2,o-48),h=a(n),p=h.mul(e);p.isNegative()||p.gt(r);)p=(h=a(n-=c,this.unsigned)).mul(e);h.isZero()&&(h=_),s=s.add(h),r=r.sub(p)}return s},w.div=w.divide,w.modulo=function(e){return i(e)||(e=d(e)),t?l((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},w.mod=w.modulo,w.rem=w.modulo,w.not=function(){return l(~this.low,~this.high,this.unsigned)},w.and=function(e){return i(e)||(e=d(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},w.or=function(e){return i(e)||(e=d(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},w.xor=function(e){return i(e)||(e=d(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},w.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):l(0,this.low<<e-32,this.unsigned)},w.shl=w.shiftLeft,w.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},w.shr=w.shiftRight,w.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?l(this.low>>>e|t<<32-e,t>>>e,this.unsigned):l(32===e?t:t>>>e-32,0,this.unsigned)},w.shru=w.shiftRightUnsigned,w.shr_u=w.shiftRightUnsigned,w.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},w.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},w.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},w.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},w.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,i){return i?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},45228:e=>{"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(e){i[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(e,r){for(var s,o,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l<arguments.length;l++){for(var u in s=Object(arguments[l]))n.call(s,u)&&(a[u]=s[u]);if(t){o=t(s);for(var c=0;c<o.length;c++)i.call(s,o[c])&&(a[o[c]]=s[o[c]])}}return a}},84678:e=>{"use strict";e.exports=(e,t={})=>{if(!e)return;const n={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:/?#]+):)?(?:\/\/([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,loose:/^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?([^/?#]*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/}},i=(t.strictMode?n.parser.strict:n.parser.loose).exec(e);if(!i)return;const r={};if(r[n.key[0]]=e,r[n.key[1]]=i[1]||"",r[n.key[2]]=i[2]||"",r[n.key[8]]=i[3]||"",r[n.key[12]]=i[4]||"",r[n.key[13]]=i[5]||"",r[n.key[2]]){const e=/^(?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?/.exec(r[n.key[2]]);e&&(r[n.key[3]]=e[1]||"",r[n.key[4]]=e[2]||"",r[n.key[5]]=e[3]||"",r[n.key[6]]=e[4]||"",r[n.key[7]]=e[5]||"")}return r[n.q.name]={},r[n.key[12]].replace(n.q.parser,function(e,t,i){t&&(r[n.q.name][t]=i)}),r}},65585:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="function"!=typeof Object.create&&"~";function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(){}r.prototype._events=void 0,r.prototype.eventNames=function(){var e,i=this._events,r=[];if(!i)return r;for(e in i)t.call(i,e)&&r.push(n?e.slice(1):e);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(i)):r},r.prototype.listeners=function(e,t){var i=n?n+e:e,r=this._events&&this._events[i];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,a=new Array(o);s<o;s++)a[s]=r[s].fn;return a},r.prototype.emit=function(e,t,i,r,s,o){var a=n?n+e:e;if(!this._events||!this._events[a])return!1;var l,u,c=this._events[a],d=arguments.length;if("function"==typeof c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,r),!0;case 5:return c.fn.call(c.context,t,i,r,s),!0;case 6:return c.fn.call(c.context,t,i,r,s,o),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var h,p=c.length;for(u=0;u<p;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,i);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c[u].fn.apply(c[u].context,l)}}return!0},r.prototype.on=function(e,t,r){var s=new i(t,r||this),o=n?n+e:e;return this._events||(this._events=n?{}:Object.create(null)),this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],s]:this._events[o].push(s):this._events[o]=s,this},r.prototype.once=function(e,t,r){var s=new i(t,r||this,!0),o=n?n+e:e;return this._events||(this._events=n?{}:Object.create(null)),this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],s]:this._events[o].push(s):this._events[o]=s,this},r.prototype.removeListener=function(e,t,i,r){var s=n?n+e:e;if(!this._events||!this._events[s])return this;var o=this._events[s],a=[];if(t)if(o.fn)(o.fn!==t||r&&!o.once||i&&o.context!==i)&&a.push(o);else for(var l=0,u=o.length;l<u;l++)(o[l].fn!==t||r&&!o[l].once||i&&o[l].context!==i)&&a.push(o[l]);return a.length?this._events[s]=1===a.length?a[0]:a:delete this._events[s],this},r.prototype.removeAllListeners=function(e){return this._events?(e?delete this._events[n?n+e:e]:this._events=n?{}:Object.create(null),this):this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prototype.setMaxListeners=function(){return this},r.prefixed=n,e.exports=r},46192:(e,t,n)=>{var i={VERSION:n(21045).rE,PI_2:2*Math.PI,RAD_TO_DEG:180/Math.PI,DEG_TO_RAD:Math.PI/180,TARGET_FPMS:.06,RENDERER_TYPE:{UNKNOWN:0,WEBGL:1,CANVAS:2},BLEND_MODES:{NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},DRAW_MODES:{POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},SCALE_MODES:{DEFAULT:0,LINEAR:0,NEAREST:1},RETINA_PREFIX:/@(.+)x/,RESOLUTION:1,FILTER_RESOLUTION:1,DEFAULT_RENDER_OPTIONS:{view:null,resolution:1,antialias:!1,forceFXAA:!1,autoResize:!1,transparent:!1,backgroundColor:0,clearBeforeRender:!0,preserveDrawingBuffer:!1,roundPixels:!1},SHAPES:{POLY:0,RECT:1,CIRC:2,ELIP:3,RREC:4},SPRITE_BATCH_SIZE:2e3};e.exports=i},67673:(e,t,n)=>{var i=n(74650),r=n(52295),s=n(57443),o=new i.Matrix;function a(){r.call(this),this.children=[]}a.prototype=Object.create(r.prototype),a.prototype.constructor=a,e.exports=a,Object.defineProperties(a.prototype,{width:{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(e){var t=this.getLocalBounds().width;this.scale.x=0!==t?e/t:1,this._width=e}},height:{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(e){var t=this.getLocalBounds().height;this.scale.y=0!==t?e/t:1,this._height=e}}}),a.prototype.onChildrenChange=function(){},a.prototype.addChild=function(e){return this.addChildAt(e,this.children.length)},a.prototype.addChildAt=function(e,t){if(e===this)return e;if(t>=0&&t<=this.children.length)return e.parent&&e.parent.removeChild(e),e.parent=this,this.children.splice(t,0,e),this.onChildrenChange(t),e.emit("added",this),e;throw new Error(e+"addChildAt: The index "+t+" supplied is out of bounds "+this.children.length)},a.prototype.swapChildren=function(e,t){if(e!==t){var n=this.getChildIndex(e),i=this.getChildIndex(t);if(n<0||i<0)throw new Error("swapChildren: Both the supplied DisplayObjects must be children of the caller.");this.children[n]=t,this.children[i]=e,this.onChildrenChange(n<i?n:i)}},a.prototype.getChildIndex=function(e){var t=this.children.indexOf(e);if(-1===t)throw new Error("The supplied DisplayObject must be a child of the caller");return t},a.prototype.setChildIndex=function(e,t){if(t<0||t>=this.children.length)throw new Error("The supplied index is out of bounds");var n=this.getChildIndex(e);this.children.splice(n,1),this.children.splice(t,0,e),this.onChildrenChange(t)},a.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Supplied index "+e+" does not exist in the child list, or the supplied DisplayObject is not a child of the caller");return this.children[e]},a.prototype.removeChild=function(e){var t=this.children.indexOf(e);if(-1!==t)return this.removeChildAt(t)},a.prototype.removeChildAt=function(e){var t=this.getChildAt(e);return t.parent=null,this.children.splice(e,1),this.onChildrenChange(e),t.emit("removed",this),t},a.prototype.removeChildren=function(e,t){var n,i,r=e||0,s="number"==typeof t?t:this.children.length,o=s-r;if(o>0&&o<=s){for(n=this.children.splice(r,o),i=0;i<n.length;++i)n[i].parent=null;for(this.onChildrenChange(e),i=0;i<n.length;++i)n[i].emit("removed",this);return n}if(0===o&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},a.prototype.generateTexture=function(e,t,n){var i=this.getLocalBounds(),r=new s(e,0|i.width,0|i.height,n,t);return o.tx=-i.x,o.ty=-i.y,r.render(this,o),r},a.prototype.updateTransform=function(){if(this.visible){this.displayObjectUpdateTransform();for(var e=0,t=this.children.length;e<t;++e)this.children[e].updateTransform()}},a.prototype.containerUpdateTransform=a.prototype.updateTransform,a.prototype.getBounds=function(){if(!this._currentBounds){if(0===this.children.length)return i.Rectangle.EMPTY;for(var e,t,n,r=1/0,s=1/0,o=-1/0,a=-1/0,l=!1,u=0,c=this.children.length;u<c;++u){this.children[u].visible&&(l=!0,r=r<(e=this.children[u].getBounds()).x?r:e.x,s=s<e.y?s:e.y,o=o>(t=e.width+e.x)?o:t,a=a>(n=e.height+e.y)?a:n)}if(!l)return i.Rectangle.EMPTY;var d=this._bounds;d.x=r,d.y=s,d.width=o-r,d.height=a-s,this._currentBounds=d}return this._currentBounds},a.prototype.containerGetBounds=a.prototype.getBounds,a.prototype.getLocalBounds=function(){var e=this.worldTransform;this.worldTransform=i.Matrix.IDENTITY;for(var t=0,n=this.children.length;t<n;++t)this.children[t].updateTransform();return this.worldTransform=e,this._currentBounds=null,this.getBounds(i.Matrix.IDENTITY)},a.prototype.renderWebGL=function(e){var t,n;if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this._filters){for(e.currentRenderer.flush(),this._filters&&this._filters.length&&e.filterManager.pushFilter(this,this._filters),this._mask&&e.maskManager.pushMask(this,this._mask),e.currentRenderer.start(),this._renderWebGL(e),t=0,n=this.children.length;t<n;t++)this.children[t].renderWebGL(e);e.currentRenderer.flush(),this._mask&&e.maskManager.popMask(this,this._mask),this._filters&&e.filterManager.popFilter(),e.currentRenderer.start()}else for(this._renderWebGL(e),t=0,n=this.children.length;t<n;++t)this.children[t].renderWebGL(e)},a.prototype._renderWebGL=function(e){},a.prototype._renderCanvas=function(e){},a.prototype.renderCanvas=function(e){if(this.visible&&!(this.alpha<=0)&&this.renderable){this._mask&&e.maskManager.pushMask(this._mask,e),this._renderCanvas(e);for(var t=0,n=this.children.length;t<n;++t)this.children[t].renderCanvas(e);this._mask&&e.maskManager.popMask(e)}},a.prototype.destroy=function(e){if(r.prototype.destroy.call(this),e)for(var t=0,n=this.children.length;t<n;++t)this.children[t].destroy(e);this.removeChildren(),this.children=null}},52295:(e,t,n)=>{var i=n(74650),r=n(57443),s=n(65585),o=n(46192),a=new i.Matrix,l={worldTransform:new i.Matrix,worldAlpha:1,children:[]};function u(){s.call(this),this.position=new i.Point,this.scale=new i.Point(1,1),this.pivot=new i.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.renderable=!0,this.parent=null,this.worldAlpha=1,this.worldTransform=new i.Matrix,this.filterArea=null,this._sr=0,this._cr=1,this._bounds=new i.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null}u.prototype=Object.create(s.prototype),u.prototype.constructor=u,e.exports=u,Object.defineProperties(u.prototype,{x:{get:function(){return this.position.x},set:function(e){this.position.x=e}},y:{get:function(){return this.position.y},set:function(e){this.position.y=e}},worldVisible:{get:function(){var e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0}},mask:{get:function(){return this._mask},set:function(e){this._mask&&(this._mask.renderable=!0),this._mask=e,this._mask&&(this._mask.renderable=!1)}},filters:{get:function(){return this._filters&&this._filters.slice()},set:function(e){this._filters=e&&e.slice()}}}),u.prototype.updateTransform=function(){var e,t,n,i,r,s,a=this.parent.worldTransform,l=this.worldTransform;this.rotation%o.PI_2?(this.rotation!==this.rotationCache&&(this.rotationCache=this.rotation,this._sr=Math.sin(this.rotation),this._cr=Math.cos(this.rotation)),e=this._cr*this.scale.x,t=this._sr*this.scale.x,n=-this._sr*this.scale.y,i=this._cr*this.scale.y,r=this.position.x,s=this.position.y,(this.pivot.x||this.pivot.y)&&(r-=this.pivot.x*e+this.pivot.y*n,s-=this.pivot.x*t+this.pivot.y*i),l.a=e*a.a+t*a.c,l.b=e*a.b+t*a.d,l.c=n*a.a+i*a.c,l.d=n*a.b+i*a.d,l.tx=r*a.a+s*a.c+a.tx,l.ty=r*a.b+s*a.d+a.ty):(e=this.scale.x,i=this.scale.y,r=this.position.x-this.pivot.x*e,s=this.position.y-this.pivot.y*i,l.a=e*a.a,l.b=e*a.b,l.c=i*a.c,l.d=i*a.d,l.tx=r*a.a+s*a.c+a.tx,l.ty=r*a.b+s*a.d+a.ty),this.worldAlpha=this.alpha*this.parent.worldAlpha,this._currentBounds=null},u.prototype.displayObjectUpdateTransform=u.prototype.updateTransform,u.prototype.getBounds=function(e){return i.Rectangle.EMPTY},u.prototype.getLocalBounds=function(){return this.getBounds(i.Matrix.IDENTITY)},u.prototype.toGlobal=function(e){return this.parent?this.displayObjectUpdateTransform():(this.parent=l,this.displayObjectUpdateTransform(),this.parent=null),this.worldTransform.apply(e)},u.prototype.toLocal=function(e,t){return t&&(e=t.toGlobal(e)),this.parent?this.displayObjectUpdateTransform():(this.parent=l,this.displayObjectUpdateTransform(),this.parent=null),this.worldTransform.applyInverse(e)},u.prototype.renderWebGL=function(e){},u.prototype.renderCanvas=function(e){},u.prototype.generateTexture=function(e,t,n){var i=this.getLocalBounds(),s=new r(e,0|i.width,0|i.height,t,n);return a.tx=-i.x,a.ty=-i.y,s.render(this,a),s},u.prototype.setParent=function(e){if(!e||!e.addChild)throw new Error("setParent: Argument must be a Container");return e.addChild(this),e},u.prototype.destroy=function(){this.position=null,this.scale=null,this.pivot=null,this.parent=null,this._bounds=null,this._currentBounds=null,this._mask=null,this.worldTransform=null,this.filterArea=null}},6720:(e,t,n)=>{var i=n(67673),r=n(22699),s=n(61549),o=n(34694),a=n(7240),l=n(74650),u=n(46192),c=new l.Point;function d(){i.call(this),this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this._prevTint=16777215,this.blendMode=u.BLEND_MODES.NORMAL,this.currentPath=null,this._webGL={},this.isMask=!1,this.boundsPadding=0,this._localBounds=new l.Rectangle(0,0,1,1),this.dirty=!0,this.glDirty=!1,this.boundsDirty=!0,this.cachedSpriteDirty=!1}d.prototype=Object.create(i.prototype),d.prototype.constructor=d,e.exports=d,d.prototype.clone=function(){var e=new d;e.renderable=this.renderable,e.fillAlpha=this.fillAlpha,e.lineWidth=this.lineWidth,e.lineColor=this.lineColor,e.tint=this.tint,e.blendMode=this.blendMode,e.isMask=this.isMask,e.boundsPadding=this.boundsPadding,e.dirty=!0,e.glDirty=!0,e.cachedSpriteDirty=this.cachedSpriteDirty;for(var t=0;t<this.graphicsData.length;++t)e.graphicsData.push(this.graphicsData[t].clone());return e.currentPath=e.graphicsData[e.graphicsData.length-1],e.updateLocalBounds(),e},d.prototype.lineStyle=function(e,t,n){if(this.lineWidth=e||0,this.lineColor=t||0,this.lineAlpha=void 0===n?1:n,this.currentPath)if(this.currentPath.shape.points.length){var i=new l.Polygon(this.currentPath.shape.points.slice(-2));i.closed=!1,this.drawShape(i)}else this.currentPath.lineWidth=this.lineWidth,this.currentPath.lineColor=this.lineColor,this.currentPath.lineAlpha=this.lineAlpha;return this},d.prototype.moveTo=function(e,t){var n=new l.Polygon([e,t]);return n.closed=!1,this.drawShape(n),this},d.prototype.lineTo=function(e,t){return this.currentPath.shape.points.push(e,t),this.dirty=!0,this},d.prototype.quadraticCurveTo=function(e,t,n,i){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);var r,s,o=this.currentPath.shape.points;0===o.length&&this.moveTo(0,0);for(var a=o[o.length-2],l=o[o.length-1],u=0,c=1;c<=20;++c)r=a+(e-a)*(u=c/20),s=l+(t-l)*u,o.push(r+(e+(n-e)*u-r)*u,s+(t+(i-t)*u-s)*u);return this.dirty=this.boundsDirty=!0,this},d.prototype.bezierCurveTo=function(e,t,n,i,r,s){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);for(var o,a,l,u,c,d=this.currentPath.shape.points,h=d[d.length-2],p=d[d.length-1],f=0,m=1;m<=20;++m)l=(a=(o=1-(f=m/20))*o)*o,c=(u=f*f)*f,d.push(l*h+3*a*f*e+3*o*u*n+c*r,l*p+3*a*f*t+3*o*u*i+c*s);return this.dirty=this.boundsDirty=!0,this},d.prototype.arcTo=function(e,t,n,i,r){this.currentPath?0===this.currentPath.shape.points.length&&this.currentPath.shape.points.push(e,t):this.moveTo(e,t);var s=this.currentPath.shape.points,o=s[s.length-2],a=s[s.length-1]-t,l=o-e,u=i-t,c=n-e,d=Math.abs(a*c-l*u);if(d<1e-8||0===r)s[s.length-2]===e&&s[s.length-1]===t||s.push(e,t);else{var h=a*a+l*l,p=u*u+c*c,f=a*u+l*c,m=r*Math.sqrt(h)/d,g=r*Math.sqrt(p)/d,y=m*f/h,_=g*f/p,v=m*c+g*l,b=m*u+g*a,T=l*(g+y),x=a*(g+y),E=c*(m+_),w=u*(m+_),I=Math.atan2(x-b,T-v),A=Math.atan2(w-b,E-v);this.arc(v+e,b+t,r,I,A,l*u>c*a)}return this.dirty=this.boundsDirty=!0,this},d.prototype.arc=function(e,t,n,i,r,s){if(i===r)return this;!(s=s||!1)&&r<=i?r+=2*Math.PI:s&&i<=r&&(i+=2*Math.PI);var o=s?-1*(i-r):r-i,a=40*Math.ceil(Math.abs(o)/(2*Math.PI));if(0===o)return this;var l=e+Math.cos(i)*n,u=t+Math.sin(i)*n;this.currentPath?this.currentPath.shape.points.push(l,u):this.moveTo(l,u);for(var c=this.currentPath.shape.points,d=o/(2*a),h=2*d,p=Math.cos(d),f=Math.sin(d),m=a-1,g=m%1/m,y=0;y<=m;y++){var _=d+i+h*(y+g*y),v=Math.cos(_),b=-Math.sin(_);c.push((p*v+f*b)*n+e,(p*-b+f*v)*n+t)}return this.dirty=this.boundsDirty=!0,this},d.prototype.beginFill=function(e,t){return this.filling=!0,this.fillColor=e||0,this.fillAlpha=void 0===t?1:t,this.currentPath&&this.currentPath.shape.points.length<=2&&(this.currentPath.fill=this.filling,this.currentPath.fillColor=this.fillColor,this.currentPath.fillAlpha=this.fillAlpha),this},d.prototype.endFill=function(){return this.filling=!1,this.fillColor=null,this.fillAlpha=1,this},d.prototype.drawRect=function(e,t,n,i){return this.drawShape(new l.Rectangle(e,t,n,i)),this},d.prototype.drawRoundedRect=function(e,t,n,i,r){return this.drawShape(new l.RoundedRectangle(e,t,n,i,r)),this},d.prototype.drawCircle=function(e,t,n){return this.drawShape(new l.Circle(e,t,n)),this},d.prototype.drawEllipse=function(e,t,n,i){return this.drawShape(new l.Ellipse(e,t,n,i)),this},d.prototype.drawPolygon=function(e){var t=e,n=!0;if(t instanceof l.Polygon&&(n=t.closed,t=t.points),!Array.isArray(t)){t=new Array(arguments.length);for(var i=0;i<t.length;++i)t[i]=arguments[i]}var r=new l.Polygon(t);return r.closed=n,this.drawShape(r),this},d.prototype.clear=function(){return this.lineWidth=0,this.filling=!1,this.dirty=!0,this.clearDirty=!0,this.graphicsData=[],this},d.prototype.generateTexture=function(e,t,n){t=t||1;var i=this.getLocalBounds(),a=new s(i.width*t,i.height*t),l=r.fromCanvas(a.canvas,n);return l.baseTexture.resolution=t,a.context.scale(t,t),a.context.translate(-i.x,-i.y),o.renderGraphics(this,a.context),l},d.prototype._renderWebGL=function(e){this.glDirty&&(this.dirty=!0,this.glDirty=!1),e.setObjectRenderer(e.plugins.graphics),e.plugins.graphics.render(this)},d.prototype._renderCanvas=function(e){if(!0!==this.isMask){this._prevTint!==this.tint&&(this.dirty=!0);var t=e.context,n=this.worldTransform,i=e.blendModes[this.blendMode];i!==t.globalCompositeOperation&&(t.globalCompositeOperation=i);var r=e.resolution;t.setTransform(n.a*r,n.b*r,n.c*r,n.d*r,n.tx*r,n.ty*r),o.renderGraphics(this,t)}},d.prototype.getBounds=function(e){if(!this._currentBounds){if(!this.renderable)return l.Rectangle.EMPTY;this.boundsDirty&&(this.updateLocalBounds(),this.glDirty=!0,this.cachedSpriteDirty=!0,this.boundsDirty=!1);var t=this._localBounds,n=t.x,i=t.width+t.x,r=t.y,s=t.height+t.y,o=e||this.worldTransform,a=o.a,u=o.b,c=o.c,d=o.d,h=o.tx,p=o.ty,f=a*i+c*s+h,m=d*s+u*i+p,g=a*n+c*s+h,y=d*s+u*n+p,_=a*n+c*r+h,v=d*r+u*n+p,b=a*i+c*r+h,T=d*r+u*i+p,x=f,E=m,w=f,I=m;w=b<(w=_<(w=g<w?g:w)?_:w)?b:w,I=T<(I=v<(I=y<I?y:I)?v:I)?T:I,x=b>(x=_>(x=g>x?g:x)?_:x)?b:x,E=T>(E=v>(E=y>E?y:E)?v:E)?T:E,this._bounds.x=w,this._bounds.width=x-w,this._bounds.y=I,this._bounds.height=E-I,this._currentBounds=this._bounds}return this._currentBounds},d.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,c);for(var t=this.graphicsData,n=0;n<t.length;n++){var i=t[n];if(i.fill&&(i.shape&&i.shape.contains(c.x,c.y)))return!0}return!1},d.prototype.updateLocalBounds=function(){var e=1/0,t=-1/0,n=1/0,i=-1/0;if(this.graphicsData.length)for(var r,s,o,a,l,c,d=0;d<this.graphicsData.length;d++){var h=this.graphicsData[d],p=h.type,f=h.lineWidth;if(r=h.shape,p===u.SHAPES.RECT||p===u.SHAPES.RREC)o=r.x-f/2,a=r.y-f/2,e=o<e?o:e,t=o+(l=r.width+f)>t?o+l:t,n=a<n?a:n,i=a+(c=r.height+f)>i?a+c:i;else if(p===u.SHAPES.CIRC)o=r.x,a=r.y,e=o-(l=r.radius+f/2)<e?o-l:e,t=o+l>t?o+l:t,n=a-(c=r.radius+f/2)<n?a-c:n,i=a+c>i?a+c:i;else if(p===u.SHAPES.ELIP)o=r.x,a=r.y,e=o-(l=r.width+f/2)<e?o-l:e,t=o+l>t?o+l:t,n=a-(c=r.height+f/2)<n?a-c:n,i=a+c>i?a+c:i;else{s=r.points;for(var m=0;m<s.length;m+=2)e=(o=s[m])-f<e?o-f:e,t=o+f>t?o+f:t,n=(a=s[m+1])-f<n?a-f:n,i=a+f>i?a+f:i}}else e=0,t=0,n=0,i=0;var g=this.boundsPadding;this._localBounds.x=e-g,this._localBounds.width=t-e+2*g,this._localBounds.y=n-g,this._localBounds.height=i-n+2*g},d.prototype.drawShape=function(e){this.currentPath&&this.currentPath.shape.points.length<=2&&this.graphicsData.pop(),this.currentPath=null;var t=new a(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,e);return this.graphicsData.push(t),t.type===u.SHAPES.POLY&&(t.shape.closed=t.shape.closed||this.filling,this.currentPath=t),this.dirty=this.boundsDirty=!0,t},d.prototype.destroy=function(){i.prototype.destroy.apply(this,arguments);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();for(var t in this._webgl)for(var n=0;n<this._webgl[t].data.length;++n)this._webgl[t].data[n].destroy();this.graphicsData=null,this.currentPath=null,this._webgl=null,this._localBounds=null}},7240:e=>{function t(e,t,n,i,r,s,o){this.lineWidth=e,this.lineColor=t,this.lineAlpha=n,this._lineTint=t,this.fillColor=i,this.fillAlpha=r,this._fillTint=i,this.fill=s,this.shape=o,this.type=o.type}t.prototype.constructor=t,e.exports=t,t.prototype.clone=function(){return new t(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.fill,this.shape)},t.prototype.destroy=function(){this.shape=null}},84237:(e,t,n)=>{var i=n(70501),r=n(74650),s=n(46192),o=n(91830),a=n(65092),l=n(65075),u=n(66570);function c(e){o.call(this,e),this.graphicsDataPool=[],this.primitiveShader=null,this.complexPrimitiveShader=null,this.maximumSimplePolySize=200}c.prototype=Object.create(o.prototype),c.prototype.constructor=c,e.exports=c,a.registerPlugin("graphics",c),c.prototype.onContextChange=function(){},c.prototype.destroy=function(){o.prototype.destroy.call(this);for(var e=0;e<this.graphicsDataPool.length;++e)this.graphicsDataPool[e].destroy();this.graphicsDataPool=null},c.prototype.render=function(e){var t,n=this.renderer,r=n.gl,s=n.shaderManager.plugins.primitiveShader;e.dirty&&this.updateGraphics(e);var o=e._webGL[r.id];n.blendModeManager.setBlendMode(e.blendMode);for(var a=0,l=o.data.length;a<l;a++)t=o.data[a],1===o.data[a].mode?(n.stencilManager.pushStencil(e,t),r.uniform1f(n.shaderManager.complexPrimitiveShader.uniforms.alpha._location,e.worldAlpha*t.alpha),r.drawElements(r.TRIANGLE_FAN,4,r.UNSIGNED_SHORT,2*(t.indices.length-4)),n.stencilManager.popStencil(e,t)):(s=n.shaderManager.primitiveShader,n.shaderManager.setShader(s),r.uniformMatrix3fv(s.uniforms.translationMatrix._location,!1,e.worldTransform.toArray(!0)),r.uniformMatrix3fv(s.uniforms.projectionMatrix._location,!1,n.currentRenderTarget.projectionMatrix.toArray(!0)),r.uniform3fv(s.uniforms.tint._location,i.hex2rgb(e.tint)),r.uniform1f(s.uniforms.alpha._location,e.worldAlpha),r.bindBuffer(r.ARRAY_BUFFER,t.buffer),r.vertexAttribPointer(s.attributes.aVertexPosition,2,r.FLOAT,!1,24,0),r.vertexAttribPointer(s.attributes.aColor,4,r.FLOAT,!1,24,8),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.indexBuffer),r.drawElements(r.TRIANGLE_STRIP,t.indices.length,r.UNSIGNED_SHORT,0)),n.drawCount++},c.prototype.updateGraphics=function(e){var t,n,i=this.renderer.gl,r=e._webGL[i.id];if(r||(r=e._webGL[i.id]={lastIndex:0,data:[],gl:i}),e.dirty=!1,e.clearDirty){for(e.clearDirty=!1,t=0;t<r.data.length;t++){var o=r.data[t];o.reset(),this.graphicsDataPool.push(o)}r.data=[],r.lastIndex=0}for(t=r.lastIndex;t<e.graphicsData.length;t++){var a=e.graphicsData[t];if(a.type===s.SHAPES.POLY){if(a.points=a.shape.points.slice(),a.shape.closed&&(a.points[0]===a.points[a.points.length-2]&&a.points[1]===a.points[a.points.length-1]||a.points.push(a.points[0],a.points[1])),a.fill)if(a.points.length>=6)if(a.points.length<2*this.maximumSimplePolySize)n=this.switchMode(r,0),this.buildPoly(a,n)||(n=this.switchMode(r,1),this.buildComplexPoly(a,n));else n=this.switchMode(r,1),this.buildComplexPoly(a,n);a.lineWidth>0&&(n=this.switchMode(r,0),this.buildLine(a,n))}else n=this.switchMode(r,0),a.type===s.SHAPES.RECT?this.buildRectangle(a,n):a.type===s.SHAPES.CIRC||a.type===s.SHAPES.ELIP?this.buildCircle(a,n):a.type===s.SHAPES.RREC&&this.buildRoundedRectangle(a,n);r.lastIndex++}for(t=0;t<r.data.length;t++)(n=r.data[t]).dirty&&n.upload()},c.prototype.switchMode=function(e,t){var n;return e.data.length?((n=e.data[e.data.length-1]).points.length>32e4||n.mode!==t||1===t)&&((n=this.graphicsDataPool.pop()||new l(e.gl)).mode=t,e.data.push(n)):((n=this.graphicsDataPool.pop()||new l(e.gl)).mode=t,e.data.push(n)),n.dirty=!0,n},c.prototype.buildRectangle=function(e,t){var n=e.shape,r=n.x,s=n.y,o=n.width,a=n.height;if(e.fill){var l=i.hex2rgb(e.fillColor),u=e.fillAlpha,c=l[0]*u,d=l[1]*u,h=l[2]*u,p=t.points,f=t.indices,m=p.length/6;p.push(r,s),p.push(c,d,h,u),p.push(r+o,s),p.push(c,d,h,u),p.push(r,s+a),p.push(c,d,h,u),p.push(r+o,s+a),p.push(c,d,h,u),f.push(m,m,m+1,m+2,m+3,m+3)}if(e.lineWidth){var g=e.points;e.points=[r,s,r+o,s,r+o,s+a,r,s+a,r,s],this.buildLine(e,t),e.points=g}},c.prototype.buildRoundedRectangle=function(e,t){var n=e.shape,r=n.x,s=n.y,o=n.width,a=n.height,l=n.radius,c=[];if(c.push(r,s+l),this.quadraticBezierCurve(r,s+a-l,r,s+a,r+l,s+a,c),this.quadraticBezierCurve(r+o-l,s+a,r+o,s+a,r+o,s+a-l,c),this.quadraticBezierCurve(r+o,s+l,r+o,s,r+o-l,s,c),this.quadraticBezierCurve(r+l,s,r,s,r,s+l+1e-10,c),e.fill){var d=i.hex2rgb(e.fillColor),h=e.fillAlpha,p=d[0]*h,f=d[1]*h,m=d[2]*h,g=t.points,y=t.indices,_=g.length/6,v=u(c,null,2),b=0;for(b=0;b<v.length;b+=3)y.push(v[b]+_),y.push(v[b]+_),y.push(v[b+1]+_),y.push(v[b+2]+_),y.push(v[b+2]+_);for(b=0;b<c.length;b++)g.push(c[b],c[++b],p,f,m,h)}if(e.lineWidth){var T=e.points;e.points=c,this.buildLine(e,t),e.points=T}},c.prototype.quadraticBezierCurve=function(e,t,n,i,r,s,o){var a,l,u,c,d,h,p=o||[];function f(e,t,n){return e+(t-e)*n}for(var m=0,g=0;g<=20;g++)a=f(e,n,m=g/20),l=f(t,i,m),u=f(n,r,m),c=f(i,s,m),d=f(a,u,m),h=f(l,c,m),p.push(d,h);return p},c.prototype.buildCircle=function(e,t){var n,r,o=e.shape,a=o.x,l=o.y;e.type===s.SHAPES.CIRC?(n=o.radius,r=o.radius):(n=o.width,r=o.height);var u=Math.floor(30*Math.sqrt(o.radius))||Math.floor(15*Math.sqrt(o.width+o.height)),c=2*Math.PI/u,d=0;if(e.fill){var h=i.hex2rgb(e.fillColor),p=e.fillAlpha,f=h[0]*p,m=h[1]*p,g=h[2]*p,y=t.points,_=t.indices,v=y.length/6;for(_.push(v),d=0;d<u+1;d++)y.push(a,l,f,m,g,p),y.push(a+Math.sin(c*d)*n,l+Math.cos(c*d)*r,f,m,g,p),_.push(v++,v++);_.push(v-1)}if(e.lineWidth){var b=e.points;for(e.points=[],d=0;d<u+1;d++)e.points.push(a+Math.sin(c*d)*n,l+Math.cos(c*d)*r);this.buildLine(e,t),e.points=b}},c.prototype.buildLine=function(e,t){var n=0,s=e.points;if(0!==s.length){var o=new r.Point(s[0],s[1]),a=new r.Point(s[s.length-2],s[s.length-1]);if(o.x===a.x&&o.y===a.y){(s=s.slice()).pop(),s.pop();var l=(a=new r.Point(s[s.length-2],s[s.length-1])).x+.5*(o.x-a.x),u=a.y+.5*(o.y-a.y);s.unshift(l,u),s.push(l,u)}var c,d,h,p,f,m,g,y,_,v,b,T,x,E,w,I,A,S,C,O,M,R,k=t.points,N=t.indices,D=s.length/2,F=s.length,L=k.length/6,P=e.lineWidth/2,B=i.hex2rgb(e.lineColor),$=e.lineAlpha,U=B[0]*$,z=B[1]*$,V=B[2]*$;for(h=s[0],p=s[1],f=s[2],_=-(p-(m=s[3])),v=h-f,_/=R=Math.sqrt(_*_+v*v),v/=R,_*=P,v*=P,k.push(h-_,p-v,U,z,V,$),k.push(h+_,p+v,U,z,V,$),n=1;n<D-1;n++)h=s[2*(n-1)],p=s[2*(n-1)+1],f=s[2*n],m=s[2*n+1],g=s[2*(n+1)],y=s[2*(n+1)+1],_=-(p-m),v=h-f,_/=R=Math.sqrt(_*_+v*v),v/=R,_*=P,v*=P,b=-(m-y),T=f-g,b/=R=Math.sqrt(b*b+T*T),T/=R,A=(-_+h)*(-v+m)-(-_+f)*(-v+p),O=(-(b*=P)+g)*(-(T*=P)+m)-(-b+f)*(-T+y),M=(w=-v+p-(-v+m))*(C=-b+f-(-b+g))-(S=-T+y-(-T+m))*(I=-_+f-(-_+h)),Math.abs(M)<.1?(M+=10.1,k.push(f-_,m-v,U,z,V,$),k.push(f+_,m+v,U,z,V,$)):((c=(I*O-C*A)/M)-f)*(c-f)+((d=(S*A-w*O)/M)-m)+(d-m)>19600?(x=_-b,E=v-T,x/=R=Math.sqrt(x*x+E*E),E/=R,x*=P,E*=P,k.push(f-x,m-E),k.push(U,z,V,$),k.push(f+x,m+E),k.push(U,z,V,$),k.push(f-x,m-E),k.push(U,z,V,$),F++):(k.push(c,d),k.push(U,z,V,$),k.push(f-(c-f),m-(d-m)),k.push(U,z,V,$));for(h=s[2*(D-2)],p=s[2*(D-2)+1],f=s[2*(D-1)],_=-(p-(m=s[2*(D-1)+1])),v=h-f,_/=R=Math.sqrt(_*_+v*v),v/=R,_*=P,v*=P,k.push(f-_,m-v),k.push(U,z,V,$),k.push(f+_,m+v),k.push(U,z,V,$),N.push(L),n=0;n<F;n++)N.push(L++);N.push(L-1)}},c.prototype.buildComplexPoly=function(e,t){var n=e.points.slice();if(!(n.length<6)){var r=t.indices;t.points=n,t.alpha=e.fillAlpha,t.color=i.hex2rgb(e.fillColor);for(var s,o,a=1/0,l=-1/0,u=1/0,c=-1/0,d=0;d<n.length;d+=2)a=(s=n[d])<a?s:a,l=s>l?s:l,u=(o=n[d+1])<u?o:u,c=o>c?o:c;n.push(a,u,l,u,l,c,a,c);var h=n.length/2;for(d=0;d<h;d++)r.push(d)}},c.prototype.buildPoly=function(e,t){var n=e.points;if(!(n.length<6)){var r=t.points,s=t.indices,o=n.length/2,a=i.hex2rgb(e.fillColor),l=e.fillAlpha,c=a[0]*l,d=a[1]*l,h=a[2]*l,p=u(n,null,2);if(!p)return!1;var f=r.length/6,m=0;for(m=0;m<p.length;m+=3)s.push(p[m]+f),s.push(p[m]+f),s.push(p[m+1]+f),s.push(p[m+2]+f),s.push(p[m+2]+f);for(m=0;m<o;m++)r.push(n[2*m],n[2*m+1],c,d,h,l);return!0}}},65075:e=>{function t(e){this.gl=e,this.color=[0,0,0],this.points=[],this.indices=[],this.buffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),this.mode=1,this.alpha=1,this.dirty=!0,this.glPoints=null,this.glIndices=null}t.prototype.constructor=t,e.exports=t,t.prototype.reset=function(){this.points.length=0,this.indices.length=0},t.prototype.upload=function(){var e=this.gl;this.glPoints=new Float32Array(this.points),e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.bufferData(e.ARRAY_BUFFER,this.glPoints,e.STATIC_DRAW),this.glIndices=new Uint16Array(this.indices),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.glIndices,e.STATIC_DRAW),this.dirty=!1},t.prototype.destroy=function(){this.color=null,this.points=null,this.indices=null,this.gl.deleteBuffer(this.buffer),this.gl.deleteBuffer(this.indexBuffer),this.gl=null,this.buffer=null,this.indexBuffer=null,this.glPoints=null,this.glIndices=null}},44651:(e,t,n)=>{
/**
* @file Main export of the PIXI core library
* @author Mat Groves <mat@goodboydigital.com>
* @copyright 2013-2015 GoodBoyDigital
* @license {@link https://github.com/pixijs/pixi.js/blob/master/LICENSE|MIT License}
*/
var i=e.exports=Object.assign(n(46192),n(74650),{utils:n(70501),ticker:n(2410),DisplayObject:n(52295),Container:n(67673),Sprite:n(52861),ParticleContainer:n(53326),SpriteRenderer:n(77920),ParticleRenderer:n(22952),Text:n(99252),Graphics:n(6720),GraphicsData:n(7240),GraphicsRenderer:n(84237),Texture:n(22699),BaseTexture:n(61936),RenderTexture:n(57443),VideoBaseTexture:n(3367),TextureUvs:n(21507),CanvasRenderer:n(88010),CanvasGraphics:n(34694),CanvasBuffer:n(61549),WebGLRenderer:n(65092),ShaderManager:n(43779),Shader:n(8306),ObjectRenderer:n(91830),RenderTarget:n(97955),AbstractFilter:n(50580),FXAAFilter:n(1438),SpriteMaskFilter:n(45207),autoDetectRenderer:function(e,t,n,r){return e=e||800,t=t||600,!r&&i.utils.isWebGLSupported()?new i.WebGLRenderer(e,t,n):new i.CanvasRenderer(e,t,n)}})},2825:(e,t,n)=>{var i=n(8840);function r(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0}r.prototype.constructor=r,e.exports=r,r.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},r.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));var n=t||this.array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n},r.prototype.apply=function(e,t){t=t||new i;var n=e.x,r=e.y;return t.x=this.a*n+this.c*r+this.tx,t.y=this.b*n+this.d*r+this.ty,t},r.prototype.applyInverse=function(e,t){t=t||new i;var n=1/(this.a*this.d+this.c*-this.b),r=e.x,s=e.y;return t.x=this.d*n*r+-this.c*n*s+(this.ty*this.c-this.tx*this.d)*n,t.y=this.a*n*s+-this.b*n*r+(-this.ty*this.a+this.tx*this.b)*n,t},r.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},r.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},r.prototype.rotate=function(e){var t=Math.cos(e),n=Math.sin(e),i=this.a,r=this.c,s=this.tx;return this.a=i*t-this.b*n,this.b=i*n+this.b*t,this.c=r*t-this.d*n,this.d=r*n+this.d*t,this.tx=s*t-this.ty*n,this.ty=s*n+this.ty*t,this},r.prototype.append=function(e){var t=this.a,n=this.b,i=this.c,r=this.d;return this.a=e.a*t+e.b*i,this.b=e.a*n+e.b*r,this.c=e.c*t+e.d*i,this.d=e.c*n+e.d*r,this.tx=e.tx*t+e.ty*i+this.tx,this.ty=e.tx*n+e.ty*r+this.ty,this},r.prototype.prepend=function(e){var t=this.tx;if(1!==e.a||0!==e.b||0!==e.c||1!==e.d){var n=this.a,i=this.c;this.a=n*e.a+this.b*e.c,this.b=n*e.b+this.b*e.d,this.c=i*e.a+this.d*e.c,this.d=i*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this},r.prototype.invert=function(){var e=this.a,t=this.b,n=this.c,i=this.d,r=this.tx,s=e*i-t*n;return this.a=i/s,this.b=-t/s,this.c=-n/s,this.d=e/s,this.tx=(n*this.ty-i*r)/s,this.ty=-(e*this.ty-t*r)/s,this},r.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},r.prototype.clone=function(){var e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copy=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.IDENTITY=new r,r.TEMP_MATRIX=new r},8840:e=>{function t(e,t){this.x=e||0,this.y=t||0}t.prototype.constructor=t,e.exports=t,t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copy=function(e){this.set(e.x,e.y)},t.prototype.equals=function(e){return e.x===this.x&&e.y===this.y},t.prototype.set=function(e,t){this.x=e||0,this.y=t||(0!==t?this.x:0)}},74650:(e,t,n)=>{e.exports={Point:n(8840),Matrix:n(2825),Circle:n(25385),Ellipse:n(28419),Polygon:n(83671),Rectangle:n(92068),RoundedRectangle:n(71347)}},25385:(e,t,n)=>{var i=n(92068),r=n(46192);function s(e,t,n){this.x=e||0,this.y=t||0,this.radius=n||0,this.type=r.SHAPES.CIRC}s.prototype.constructor=s,e.exports=s,s.prototype.clone=function(){return new s(this.x,this.y,this.radius)},s.prototype.contains=function(e,t){if(this.radius<=0)return!1;var n=this.x-e,i=this.y-t;return(n*=n)+(i*=i)<=this.radius*this.radius},s.prototype.getBounds=function(){return new i(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}},28419:(e,t,n)=>{var i=n(92068),r=n(46192);function s(e,t,n,i){this.x=e||0,this.y=t||0,this.width=n||0,this.height=i||0,this.type=r.SHAPES.ELIP}s.prototype.constructor=s,e.exports=s,s.prototype.clone=function(){return new s(this.x,this.y,this.width,this.height)},s.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;var n=(e-this.x)/this.width,i=(t-this.y)/this.height;return(n*=n)+(i*=i)<=1},s.prototype.getBounds=function(){return new i(this.x-this.width,this.y-this.height,this.width,this.height)}},83671:(e,t,n)=>{var i=n(8840),r=n(46192);function s(e){var t=e;if(!Array.isArray(t)){t=new Array(arguments.length);for(var n=0;n<t.length;++n)t[n]=arguments[n]}if(t[0]instanceof i){for(var s=[],o=0,a=t.length;o<a;o++)s.push(t[o].x,t[o].y);t=s}this.closed=!0,this.points=t,this.type=r.SHAPES.POLY}s.prototype.constructor=s,e.exports=s,s.prototype.clone=function(){return new s(this.points.slice())},s.prototype.contains=function(e,t){for(var n=!1,i=this.points.length/2,r=0,s=i-1;r<i;s=r++){var o=this.points[2*r],a=this.points[2*r+1],l=this.points[2*s],u=this.points[2*s+1];a>t!=u>t&&e<(l-o)*(t-a)/(u-a)+o&&(n=!n)}return n}},92068:(e,t,n)=>{var i=n(46192);function r(e,t,n,r){this.x=e||0,this.y=t||0,this.width=n||0,this.height=r||0,this.type=i.SHAPES.RECT}r.prototype.constructor=r,e.exports=r,r.EMPTY=new r(0,0,0,0),r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.contains=function(e,t){return!(this.width<=0||this.height<=0)&&(e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height)}},71347:(e,t,n)=>{var i=n(46192);function r(e,t,n,r,s){this.x=e||0,this.y=t||0,this.width=n||0,this.height=r||0,this.radius=s||20,this.type=i.SHAPES.RREC}r.prototype.constructor=r,e.exports=r,r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height,this.radius)},r.prototype.contains=function(e,t){return!(this.width<=0||this.height<=0)&&(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height)}},53326:(e,t,n)=>{var i=n(67673),r=n(46192);function s(e,t,n){i.call(this);(n=n||15e3)>16384&&(n=16384),n>(e=e||15e3)&&(n=e),this._properties=[!1,!0,!1,!1,!1],this._maxSize=e,this._batchSize=n,this._buffers=null,this._bufferToUpdate=0,this.interactiveChildren=!1,this.blendMode=r.BLEND_MODES.NORMAL,this.roundPixels=!0,this.setProperties(t)}s.prototype=Object.create(i.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.setProperties=function(e){e&&(this._properties[0]="scale"in e?!!e.scale:this._properties[0],this._properties[1]="position"in e?!!e.position:this._properties[1],this._properties[2]="rotation"in e?!!e.rotation:this._properties[2],this._properties[3]="uvs"in e?!!e.uvs:this._properties[3],this._properties[4]="alpha"in e?!!e.alpha:this._properties[4])},s.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},s.prototype.renderWebGL=function(e){this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(e.setObjectRenderer(e.plugins.particle),e.plugins.particle.render(this))},s.prototype.onChildrenChange=function(e){var t=Math.floor(e/this._batchSize);t<this._bufferToUpdate&&(this._bufferToUpdate=t)},s.prototype.renderCanvas=function(e){if(this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable){var t=e.context,n=this.worldTransform,i=!0,r=0,s=0,o=0,a=0;t.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var l=0;l<this.children.length;++l){var u=this.children[l];if(u.visible){var c=u.texture.frame;if(t.globalAlpha=this.worldAlpha*u.alpha,u.rotation%(2*Math.PI)==0)i&&(t.setTransform(n.a,n.b,n.c,n.d,n.tx,n.ty),i=!1),r=u.anchor.x*(-c.width*u.scale.x)+u.position.x+.5,s=u.anchor.y*(-c.height*u.scale.y)+u.position.y+.5,o=c.width*u.scale.x,a=c.height*u.scale.y;else{i||(i=!0),u.displayObjectUpdateTransform();var d=u.worldTransform;e.roundPixels?t.setTransform(d.a,d.b,d.c,d.d,0|d.tx,0|d.ty):t.setTransform(d.a,d.b,d.c,d.d,d.tx,d.ty),r=u.anchor.x*-c.width+.5,s=u.anchor.y*-c.height+.5,o=c.width,a=c.height}t.drawImage(u.texture.baseTexture.source,c.x,c.y,c.width,c.height,r,s,o,a)}}}},s.prototype.destroy=function(){if(i.prototype.destroy.apply(this,arguments),this._buffers)for(var e=0;e<this._buffers.length;++e)this._buffers[e].destroy();this._properties=null,this._buffers=null}},33361:e=>{function t(e,t,n,i){this.gl=e,this.vertSize=2,this.vertByteSize=4*this.vertSize,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(var r=0;r<t.length;r++){var s=t[r];n[r]?this.dynamicProperties.push(s):this.staticProperties.push(s)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.initBuffers()}t.prototype.constructor=t,e.exports=t,t.prototype.initBuffers=function(){var e,t,n=this.gl,i=0;for(this.dynamicStride=0,e=0;e<this.dynamicProperties.length;e++)(t=this.dynamicProperties[e]).offset=i,i+=t.size,this.dynamicStride+=t.size;this.dynamicData=new Float32Array(this.size*this.dynamicStride*4),this.dynamicBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this.dynamicBuffer),n.bufferData(n.ARRAY_BUFFER,this.dynamicData,n.DYNAMIC_DRAW);var r=0;for(this.staticStride=0,e=0;e<this.staticProperties.length;e++)(t=this.staticProperties[e]).offset=r,r+=t.size,this.staticStride+=t.size;this.staticData=new Float32Array(this.size*this.staticStride*4),this.staticBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this.staticBuffer),n.bufferData(n.ARRAY_BUFFER,this.staticData,n.DYNAMIC_DRAW)},t.prototype.uploadDynamic=function(e,t,n){for(var i=this.gl,r=0;r<this.dynamicProperties.length;r++){var s=this.dynamicProperties[r];s.uploadFunction(e,t,n,this.dynamicData,this.dynamicStride,s.offset)}i.bindBuffer(i.ARRAY_BUFFER,this.dynamicBuffer),i.bufferSubData(i.ARRAY_BUFFER,0,this.dynamicData)},t.prototype.uploadStatic=function(e,t,n){for(var i=this.gl,r=0;r<this.staticProperties.length;r++){var s=this.staticProperties[r];s.uploadFunction(e,t,n,this.staticData,this.staticStride,s.offset)}i.bindBuffer(i.ARRAY_BUFFER,this.staticBuffer),i.bufferSubData(i.ARRAY_BUFFER,0,this.staticData)},t.prototype.bind=function(){var e,t,n=this.gl;for(n.bindBuffer(n.ARRAY_BUFFER,this.dynamicBuffer),e=0;e<this.dynamicProperties.length;e++)t=this.dynamicProperties[e],n.vertexAttribPointer(t.attribute,t.size,n.FLOAT,!1,4*this.dynamicStride,4*t.offset);for(n.bindBuffer(n.ARRAY_BUFFER,this.staticBuffer),e=0;e<this.staticProperties.length;e++)t=this.staticProperties[e],n.vertexAttribPointer(t.attribute,t.size,n.FLOAT,!1,4*this.staticStride,4*t.offset)},t.prototype.destroy=function(){this.dynamicProperties=null,this.dynamicData=null,this.gl.deleteBuffer(this.dynamicBuffer),this.staticProperties=null,this.staticData=null,this.gl.deleteBuffer(this.staticBuffer)}},22952:(e,t,n)=>{var i=n(91830),r=n(65092),s=n(63646),o=n(33361),a=n(74650);function l(e){i.call(this,e);this.indices=new Uint16Array(98304);for(var t=0,n=0;t<98304;t+=6,n+=4)this.indices[t+0]=n+0,this.indices[t+1]=n+1,this.indices[t+2]=n+2,this.indices[t+3]=n+0,this.indices[t+4]=n+2,this.indices[t+5]=n+3;this.shader=null,this.indexBuffer=null,this.properties=null,this.tempMatrix=new a.Matrix}l.prototype=Object.create(i.prototype),l.prototype.constructor=l,e.exports=l,r.registerPlugin("particle",l),l.prototype.onContextChange=function(){var e=this.renderer.gl;this.shader=new s(this.renderer.shaderManager),this.indexBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW),this.properties=[{attribute:this.shader.attributes.aVertexPosition,size:2,uploadFunction:this.uploadVertices,offset:0},{attribute:this.shader.attributes.aPositionCoord,size:2,uploadFunction:this.uploadPosition,offset:0},{attribute:this.shader.attributes.aRotation,size:1,uploadFunction:this.uploadRotation,offset:0},{attribute:this.shader.attributes.aTextureCoord,size:2,uploadFunction:this.uploadUvs,offset:0},{attribute:this.shader.attributes.aColor,size:1,uploadFunction:this.uploadAlpha,offset:0}]},l.prototype.start=function(){var e=this.renderer.gl;e.activeTexture(e.TEXTURE0),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var t=this.shader;this.renderer.shaderManager.setShader(t)},l.prototype.render=function(e){var t=e.children,n=t.length,i=e._maxSize,r=e._batchSize;if(0!==n){n>i&&(n=i),e._buffers||(e._buffers=this.generateBuffers(e)),this.renderer.blendModeManager.setBlendMode(e.blendMode);var s=this.renderer.gl,o=e.worldTransform.copy(this.tempMatrix);o.prepend(this.renderer.currentRenderTarget.projectionMatrix),s.uniformMatrix3fv(this.shader.uniforms.projectionMatrix._location,!1,o.toArray(!0)),s.uniform1f(this.shader.uniforms.uAlpha._location,e.worldAlpha);var a=t[0]._texture.baseTexture;if(a._glTextures[s.id])s.bindTexture(s.TEXTURE_2D,a._glTextures[s.id]);else{if(!this.renderer.updateTexture(a))return;e._properties[0]&&e._properties[3]||(e._bufferToUpdate=0)}for(var l=0,u=0;l<n;l+=r,u+=1){var c=n-l;c>r&&(c=r);var d=e._buffers[u];d.uploadDynamic(t,l,c),e._bufferToUpdate===u&&(d.uploadStatic(t,l,c),e._bufferToUpdate=u+1),d.bind(this.shader),s.drawElements(s.TRIANGLES,6*c,s.UNSIGNED_SHORT,0),this.renderer.drawCount++}}},l.prototype.generateBuffers=function(e){var t,n=this.renderer.gl,i=[],r=e._maxSize,s=e._batchSize,a=e._properties;for(t=0;t<r;t+=s)i.push(new o(n,this.properties,a,s));return i},l.prototype.uploadVertices=function(e,t,n,i,r,s){for(var o,a,l,u,c,d,h,p,f,m=0;m<n;m++)a=(o=e[t+m])._texture,u=o.scale.x,c=o.scale.y,a.trim?(d=(h=(l=a.trim).x-o.anchor.x*l.width)+a.crop.width,p=(f=l.y-o.anchor.y*l.height)+a.crop.height):(d=a._frame.width*(1-o.anchor.x),h=a._frame.width*-o.anchor.x,p=a._frame.height*(1-o.anchor.y),f=a._frame.height*-o.anchor.y),i[s]=h*u,i[s+1]=f*c,i[s+r]=d*u,i[s+r+1]=f*c,i[s+2*r]=d*u,i[s+2*r+1]=p*c,i[s+3*r]=h*u,i[s+3*r+1]=p*c,s+=4*r},l.prototype.uploadPosition=function(e,t,n,i,r,s){for(var o=0;o<n;o++){var a=e[t+o].position;i[s]=a.x,i[s+1]=a.y,i[s+r]=a.x,i[s+r+1]=a.y,i[s+2*r]=a.x,i[s+2*r+1]=a.y,i[s+3*r]=a.x,i[s+3*r+1]=a.y,s+=4*r}},l.prototype.uploadRotation=function(e,t,n,i,r,s){for(var o=0;o<n;o++){var a=e[t+o].rotation;i[s]=a,i[s+r]=a,i[s+2*r]=a,i[s+3*r]=a,s+=4*r}},l.prototype.uploadUvs=function(e,t,n,i,r,s){for(var o=0;o<n;o++){var a=e[t+o]._texture._uvs;a?(i[s]=a.x0,i[s+1]=a.y0,i[s+r]=a.x1,i[s+r+1]=a.y1,i[s+2*r]=a.x2,i[s+2*r+1]=a.y2,i[s+3*r]=a.x3,i[s+3*r+1]=a.y3,s+=4*r):(i[s]=0,i[s+1]=0,i[s+r]=0,i[s+r+1]=0,i[s+2*r]=0,i[s+2*r+1]=0,i[s+3*r]=0,i[s+3*r+1]=0,s+=4*r)}},l.prototype.uploadAlpha=function(e,t,n,i,r,s){for(var o=0;o<n;o++){var a=e[t+o].alpha;i[s]=a,i[s+r]=a,i[s+2*r]=a,i[s+3*r]=a,s+=4*r}},l.prototype.destroy=function(){this.renderer.gl&&this.renderer.gl.deleteBuffer(this.indexBuffer),i.prototype.destroy.apply(this,arguments),this.shader.destroy(),this.indices=null,this.tempMatrix=null}},63646:(e,t,n)=>{var i=n(38297);function r(e){i.call(this,e,["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aColor;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","uniform mat3 projectionMatrix;","varying vec2 vTextureCoord;","varying float vColor;","void main(void){"," vec2 v = aVertexPosition;"," v.x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);"," v.y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);"," v = v + aPositionCoord;"," gl_Position = vec4((projectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"].join("\n"),["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","uniform float uAlpha;","void main(void){"," vec4 color = texture2D(uSampler, vTextureCoord) * vColor * uAlpha;"," if (color.a == 0.0) discard;"," gl_FragColor = color;","}"].join("\n"),{uAlpha:{type:"1f",value:1}},{aPositionCoord:0,aRotation:0})}r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r},56820:(e,t,n)=>{var i=n(70501),r=n(74650),s=n(46192),o=n(65585);function a(e,t,n,a){if(o.call(this),i.sayHello(e),a)for(var l in s.DEFAULT_RENDER_OPTIONS)void 0===a[l]&&(a[l]=s.DEFAULT_RENDER_OPTIONS[l]);else a=s.DEFAULT_RENDER_OPTIONS;this.type=s.RENDERER_TYPE.UNKNOWN,this.width=t||800,this.height=n||600,this.view=a.view||document.createElement("canvas"),this.resolution=a.resolution,this.transparent=a.transparent,this.autoResize=a.autoResize||!1,this.blendModes=null,this.preserveDrawingBuffer=a.preserveDrawingBuffer,this.clearBeforeRender=a.clearBeforeRender,this.roundPixels=a.roundPixels,this._backgroundColor=0,this._backgroundColorRgb=[0,0,0],this._backgroundColorString="#000000",this.backgroundColor=a.backgroundColor||this._backgroundColor,this._tempDisplayObjectParent={worldTransform:new r.Matrix,worldAlpha:1,children:[]},this._lastObjectRendered=this._tempDisplayObjectParent}a.prototype=Object.create(o.prototype),a.prototype.constructor=a,e.exports=a,Object.defineProperties(a.prototype,{backgroundColor:{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this._backgroundColorString=i.hex2string(e),i.hex2rgb(e,this._backgroundColorRgb)}}}),a.prototype.resize=function(e,t){this.width=e*this.resolution,this.height=t*this.resolution,this.view.width=this.width,this.view.height=this.height,this.autoResize&&(this.view.style.width=this.width/this.resolution+"px",this.view.style.height=this.height/this.resolution+"px")},a.prototype.destroy=function(e){e&&this.view.parentNode&&this.view.parentNode.removeChild(this.view),this.type=s.RENDERER_TYPE.UNKNOWN,this.width=0,this.height=0,this.view=null,this.resolution=0,this.transparent=!1,this.autoResize=!1,this.blendModes=null,this.preserveDrawingBuffer=!1,this.clearBeforeRender=!1,this.roundPixels=!1,this._backgroundColor=0,this._backgroundColorRgb=null,this._backgroundColorString=null}},88010:(e,t,n)=>{var i=n(56820),r=n(39252),s=n(70501),o=n(74650),a=n(46192);function l(e,t,n){n=n||{},i.call(this,"Canvas",e,t,n),this.type=a.RENDERER_TYPE.CANVAS,this.context=this.view.getContext("2d",{alpha:this.transparent}),this.refresh=!0,this.maskManager=new r,this.smoothProperty="imageSmoothingEnabled",this.context.imageSmoothingEnabled||(this.context.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":this.context.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":this.context.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":this.context.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")),this.initPlugins(),this._mapBlendModes(),this._tempDisplayObjectParent={worldTransform:new o.Matrix,worldAlpha:1},this.resize(e,t)}l.prototype=Object.create(i.prototype),l.prototype.constructor=l,e.exports=l,s.pluginTarget.mixin(l),l.prototype.render=function(e){var t=e.parent;this._lastObjectRendered=e,e.parent=this._tempDisplayObjectParent,e.updateTransform(),e.parent=t,this.context.setTransform(1,0,0,1,0,0),this.context.globalAlpha=1,this.context.globalCompositeOperation=this.blendModes[a.BLEND_MODES.NORMAL],navigator.isCocoonJS&&this.view.screencanvas&&(this.context.fillStyle="black",this.context.clear()),this.clearBeforeRender&&(this.transparent?this.context.clearRect(0,0,this.width,this.height):(this.context.fillStyle=this._backgroundColorString,this.context.fillRect(0,0,this.width,this.height))),this.renderDisplayObject(e,this.context)},l.prototype.destroy=function(e){this.destroyPlugins(),i.prototype.destroy.call(this,e),this.context=null,this.refresh=!0,this.maskManager.destroy(),this.maskManager=null,this.smoothProperty=null},l.prototype.renderDisplayObject=function(e,t){var n=this.context;this.context=t,e.renderCanvas(this),this.context=n},l.prototype.resize=function(e,t){i.prototype.resize.call(this,e,t),this.smoothProperty&&(this.context[this.smoothProperty]=a.SCALE_MODES.DEFAULT===a.SCALE_MODES.LINEAR)},l.prototype._mapBlendModes=function(){this.blendModes||(this.blendModes={},s.canUseNewCanvasBlendModes()?(this.blendModes[a.BLEND_MODES.NORMAL]="source-over",this.blendModes[a.BLEND_MODES.ADD]="lighter",this.blendModes[a.BLEND_MODES.MULTIPLY]="multiply",this.blendModes[a.BLEND_MODES.SCREEN]="screen",this.blendModes[a.BLEND_MODES.OVERLAY]="overlay",this.blendModes[a.BLEND_MODES.DARKEN]="darken",this.blendModes[a.BLEND_MODES.LIGHTEN]="lighten",this.blendModes[a.BLEND_MODES.COLOR_DODGE]="color-dodge",this.blendModes[a.BLEND_MODES.COLOR_BURN]="color-burn",this.blendModes[a.BLEND_MODES.HARD_LIGHT]="hard-light",this.blendModes[a.BLEND_MODES.SOFT_LIGHT]="soft-light",this.blendModes[a.BLEND_MODES.DIFFERENCE]="difference",this.blendModes[a.BLEND_MODES.EXCLUSION]="exclusion",this.blendModes[a.BLEND_MODES.HUE]="hue",this.blendModes[a.BLEND_MODES.SATURATION]="saturate",this.blendModes[a.BLEND_MODES.COLOR]="color",this.blendModes[a.BLEND_MODES.LUMINOSITY]="luminosity"):(this.blendModes[a.BLEND_MODES.NORMAL]="source-over",this.blendModes[a.BLEND_MODES.ADD]="lighter",this.blendModes[a.BLEND_MODES.MULTIPLY]="source-over",this.blendModes[a.BLEND_MODES.SCREEN]="source-over",this.blendModes[a.BLEND_MODES.OVERLAY]="source-over",this.blendModes[a.BLEND_MODES.DARKEN]="source-over",this.blendModes[a.BLEND_MODES.LIGHTEN]="source-over",this.blendModes[a.BLEND_MODES.COLOR_DODGE]="source-over",this.blendModes[a.BLEND_MODES.COLOR_BURN]="source-over",this.blendModes[a.BLEND_MODES.HARD_LIGHT]="source-over",this.blendModes[a.BLEND_MODES.SOFT_LIGHT]="source-over",this.blendModes[a.BLEND_MODES.DIFFERENCE]="source-over",this.blendModes[a.BLEND_MODES.EXCLUSION]="source-over",this.blendModes[a.BLEND_MODES.HUE]="source-over",this.blendModes[a.BLEND_MODES.SATURATION]="source-over",this.blendModes[a.BLEND_MODES.COLOR]="source-over",this.blendModes[a.BLEND_MODES.LUMINOSITY]="source-over"))}},61549:e=>{function t(e,t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.canvas.width=e,this.canvas.height=t}t.prototype.constructor=t,e.exports=t,Object.defineProperties(t.prototype,{width:{get:function(){return this.canvas.width},set:function(e){this.canvas.width=e}},height:{get:function(){return this.canvas.height},set:function(e){this.canvas.height=e}}}),t.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},t.prototype.resize=function(e,t){this.canvas.width=e,this.canvas.height=t},t.prototype.destroy=function(){this.context=null,this.canvas=null}},34694:(e,t,n)=>{var i=n(46192),r={};e.exports=r,r.renderGraphics=function(e,t){var n=e.worldAlpha;e.dirty&&(this.updateGraphicsTint(e),e.dirty=!1);for(var r=0;r<e.graphicsData.length;r++){var s=e.graphicsData[r],o=s.shape,a=s._fillTint,l=s._lineTint;if(t.lineWidth=s.lineWidth,s.type===i.SHAPES.POLY){t.beginPath();var u=o.points;t.moveTo(u[0],u[1]);for(var c=1;c<u.length/2;c++)t.lineTo(u[2*c],u[2*c+1]);o.closed&&t.lineTo(u[0],u[1]),u[0]===u[u.length-2]&&u[1]===u[u.length-1]&&t.closePath(),s.fill&&(t.globalAlpha=s.fillAlpha*n,t.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),t.fill()),s.lineWidth&&(t.globalAlpha=s.lineAlpha*n,t.strokeStyle="#"+("00000"+(0|l).toString(16)).substr(-6),t.stroke())}else if(s.type===i.SHAPES.RECT)(s.fillColor||0===s.fillColor)&&(t.globalAlpha=s.fillAlpha*n,t.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),t.fillRect(o.x,o.y,o.width,o.height)),s.lineWidth&&(t.globalAlpha=s.lineAlpha*n,t.strokeStyle="#"+("00000"+(0|l).toString(16)).substr(-6),t.strokeRect(o.x,o.y,o.width,o.height));else if(s.type===i.SHAPES.CIRC)t.beginPath(),t.arc(o.x,o.y,o.radius,0,2*Math.PI),t.closePath(),s.fill&&(t.globalAlpha=s.fillAlpha*n,t.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),t.fill()),s.lineWidth&&(t.globalAlpha=s.lineAlpha*n,t.strokeStyle="#"+("00000"+(0|l).toString(16)).substr(-6),t.stroke());else if(s.type===i.SHAPES.ELIP){var d=2*o.width,h=2*o.height,p=o.x-d/2,f=o.y-h/2;t.beginPath();var m=.5522848,g=d/2*m,y=h/2*m,_=p+d,v=f+h,b=p+d/2,T=f+h/2;t.moveTo(p,T),t.bezierCurveTo(p,T-y,b-g,f,b,f),t.bezierCurveTo(b+g,f,_,T-y,_,T),t.bezierCurveTo(_,T+y,b+g,v,b,v),t.bezierCurveTo(b-g,v,p,T+y,p,T),t.closePath(),s.fill&&(t.globalAlpha=s.fillAlpha*n,t.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),t.fill()),s.lineWidth&&(t.globalAlpha=s.lineAlpha*n,t.strokeStyle="#"+("00000"+(0|l).toString(16)).substr(-6),t.stroke())}else if(s.type===i.SHAPES.RREC){var x=o.x,E=o.y,w=o.width,I=o.height,A=o.radius,S=Math.min(w,I)/2|0;A=A>S?S:A,t.beginPath(),t.moveTo(x,E+A),t.lineTo(x,E+I-A),t.quadraticCurveTo(x,E+I,x+A,E+I),t.lineTo(x+w-A,E+I),t.quadraticCurveTo(x+w,E+I,x+w,E+I-A),t.lineTo(x+w,E+A),t.quadraticCurveTo(x+w,E,x+w-A,E),t.lineTo(x+A,E),t.quadraticCurveTo(x,E,x,E+A),t.closePath(),(s.fillColor||0===s.fillColor)&&(t.globalAlpha=s.fillAlpha*n,t.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),t.fill()),s.lineWidth&&(t.globalAlpha=s.lineAlpha*n,t.strokeStyle="#"+("00000"+(0|l).toString(16)).substr(-6),t.stroke())}}},r.renderGraphicsMask=function(e,t){var n=e.graphicsData.length;if(0!==n){t.beginPath();for(var r=0;r<n;r++){var s=e.graphicsData[r],o=s.shape;if(s.type===i.SHAPES.POLY){var a=o.points;t.moveTo(a[0],a[1]);for(var l=1;l<a.length/2;l++)t.lineTo(a[2*l],a[2*l+1]);a[0]===a[a.length-2]&&a[1]===a[a.length-1]&&t.closePath()}else if(s.type===i.SHAPES.RECT)t.rect(o.x,o.y,o.width,o.height),t.closePath();else if(s.type===i.SHAPES.CIRC)t.arc(o.x,o.y,o.radius,0,2*Math.PI),t.closePath();else if(s.type===i.SHAPES.ELIP){var u=2*o.width,c=2*o.height,d=o.x-u/2,h=o.y-c/2,p=.5522848,f=u/2*p,m=c/2*p,g=d+u,y=h+c,_=d+u/2,v=h+c/2;t.moveTo(d,v),t.bezierCurveTo(d,v-m,_-f,h,_,h),t.bezierCurveTo(_+f,h,g,v-m,g,v),t.bezierCurveTo(g,v+m,_+f,y,_,y),t.bezierCurveTo(_-f,y,d,v+m,d,v),t.closePath()}else if(s.type===i.SHAPES.RREC){var b=o.x,T=o.y,x=o.width,E=o.height,w=o.radius,I=Math.min(x,E)/2|0;w=w>I?I:w,t.moveTo(b,T+w),t.lineTo(b,T+E-w),t.quadraticCurveTo(b,T+E,b+w,T+E),t.lineTo(b+x-w,T+E),t.quadraticCurveTo(b+x,T+E,b+x,T+E-w),t.lineTo(b+x,T+w),t.quadraticCurveTo(b+x,T,b+x-w,T),t.lineTo(b+w,T),t.quadraticCurveTo(b,T,b,T+w),t.closePath()}}}},r.updateGraphicsTint=function(e){if(16777215!==e.tint||e._prevTint!==e.tint){e._prevTint=e.tint;for(var t=(e.tint>>16&255)/255,n=(e.tint>>8&255)/255,i=(255&e.tint)/255,r=0;r<e.graphicsData.length;r++){var s=e.graphicsData[r],o=0|s.fillColor,a=0|s.lineColor;s._fillTint=((o>>16&255)/255*t*255<<16)+((o>>8&255)/255*n*255<<8)+(255&o)/255*i*255,s._lineTint=((a>>16&255)/255*t*255<<16)+((a>>8&255)/255*n*255<<8)+(255&a)/255*i*255}}}},39252:(e,t,n)=>{var i=n(34694);function r(){}r.prototype.constructor=r,e.exports=r,r.prototype.pushMask=function(e,t){t.context.save();var n=e.alpha,r=e.worldTransform,s=t.resolution;t.context.setTransform(r.a*s,r.b*s,r.c*s,r.d*s,r.tx*s,r.ty*s),e.texture||(i.renderGraphicsMask(e,t.context),t.context.clip()),e.worldAlpha=n},r.prototype.popMask=function(e){e.context.restore()},r.prototype.destroy=function(){}},87809:(e,t,n)=>{var i=n(70501),r={};e.exports=r,r.getTintedTexture=function(e,t){var n=e.texture,i="#"+("00000"+(0|(t=r.roundColor(t))).toString(16)).substr(-6);if(n.tintCache=n.tintCache||{},n.tintCache[i])return n.tintCache[i];var s=r.canvas||document.createElement("canvas");if(r.tintMethod(n,t,s),r.convertTintToImage){var o=new Image;o.src=s.toDataURL(),n.tintCache[i]=o}else n.tintCache[i]=s,r.canvas=null;return s},r.tintWithMultiply=function(e,t,n){var i=n.getContext("2d"),r=e.baseTexture.resolution,s=e.crop.clone();s.x*=r,s.y*=r,s.width*=r,s.height*=r,n.width=s.width,n.height=s.height,i.fillStyle="#"+("00000"+(0|t).toString(16)).substr(-6),i.fillRect(0,0,s.width,s.height),i.globalCompositeOperation="multiply",i.drawImage(e.baseTexture.source,s.x,s.y,s.width,s.height,0,0,s.width,s.height),i.globalCompositeOperation="destination-atop",i.drawImage(e.baseTexture.source,s.x,s.y,s.width,s.height,0,0,s.width,s.height)},r.tintWithOverlay=function(e,t,n){var i=n.getContext("2d"),r=e.baseTexture.resolution,s=e.crop.clone();s.x*=r,s.y*=r,s.width*=r,s.height*=r,n.width=s.width,n.height=s.height,i.globalCompositeOperation="copy",i.fillStyle="#"+("00000"+(0|t).toString(16)).substr(-6),i.fillRect(0,0,s.width,s.height),i.globalCompositeOperation="destination-atop",i.drawImage(e.baseTexture.source,s.x,s.y,s.width,s.height,0,0,s.width,s.height)},r.tintWithPerPixel=function(e,t,n){var r=n.getContext("2d"),s=e.baseTexture.resolution,o=e.crop.clone();o.x*=s,o.y*=s,o.width*=s,o.height*=s,n.width=o.width,n.height=o.height,r.globalCompositeOperation="copy",r.drawImage(e.baseTexture.source,o.x,o.y,o.width,o.height,0,0,o.width,o.height);for(var a=i.hex2rgb(t),l=a[0],u=a[1],c=a[2],d=r.getImageData(0,0,o.width,o.height),h=d.data,p=0;p<h.length;p+=4)h[p+0]*=l,h[p+1]*=u,h[p+2]*=c;r.putImageData(d,0,0)},r.roundColor=function(e){var t=r.cacheStepsPerColorChannel,n=i.hex2rgb(e);return n[0]=Math.min(255,n[0]/t*t),n[1]=Math.min(255,n[1]/t*t),n[2]=Math.min(255,n[2]/t*t),i.rgb2hex(n)},r.cacheStepsPerColorChannel=8,r.convertTintToImage=!1,r.canUseMultiply=i.canUseNewCanvasBlendModes(),r.tintMethod=r.canUseMultiply?r.tintWithMultiply:r.tintWithPerPixel},65092:(e,t,n)=>{var i=n(56820),r=n(43779),s=n(89240),o=n(15468),a=n(64598),l=n(25396),u=n(97955),c=n(91830),d=n(1438),h=n(70501),p=n(46192);function f(e,t,n){n=n||{},i.call(this,"WebGL",e,t,n),this.type=p.RENDERER_TYPE.WEBGL,this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.handleContextLost,!1),this.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1),this._useFXAA=!!n.forceFXAA&&n.antialias,this._FXAAFilter=null,this._contextOptions={alpha:this.transparent,antialias:n.antialias,premultipliedAlpha:this.transparent&&"notMultiplied"!==this.transparent,stencil:!0,preserveDrawingBuffer:n.preserveDrawingBuffer},this.drawCount=0,this.shaderManager=new r(this),this.maskManager=new s(this),this.stencilManager=new o(this),this.filterManager=new a(this),this.blendModeManager=new l(this),this.currentRenderTarget=null,this.currentRenderer=new c(this),this.initPlugins(),this._createContext(),this._initContext(),this._mapGlModes(),this._renderTargetStack=[]}f.prototype=Object.create(i.prototype),f.prototype.constructor=f,e.exports=f,h.pluginTarget.mixin(f),f.glContextId=0,f.prototype._createContext=function(){var e=this.view.getContext("webgl",this._contextOptions)||this.view.getContext("experimental-webgl",this._contextOptions);if(this.gl=e,!e)throw new Error("This browser does not support webGL. Try using the canvas renderer");this.glContextId=f.glContextId++,e.id=this.glContextId,e.renderer=this},f.prototype._initContext=function(){var e=this.gl;e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.enable(e.BLEND),this.renderTarget=new u(e,this.width,this.height,null,this.resolution,!0),this.setRenderTarget(this.renderTarget),this.emit("context",e),this.resize(this.width,this.height),this._useFXAA||(this._useFXAA=this._contextOptions.antialias&&!e.getContextAttributes().antialias),this._useFXAA&&(window.console.warn("FXAA antialiasing being used instead of native antialiasing"),this._FXAAFilter=[new d])},f.prototype.render=function(e){if(!this.gl.isContextLost()){this.drawCount=0,this._lastObjectRendered=e,this._useFXAA&&(this._FXAAFilter[0].uniforms.resolution.value.x=this.width,this._FXAAFilter[0].uniforms.resolution.value.y=this.height,e.filterArea=this.renderTarget.size,e.filters=this._FXAAFilter);var t=e.parent;e.parent=this._tempDisplayObjectParent,e.updateTransform(),e.parent=t;var n=this.gl;this.setRenderTarget(this.renderTarget),this.clearBeforeRender&&(this.transparent?n.clearColor(0,0,0,0):n.clearColor(this._backgroundColorRgb[0],this._backgroundColorRgb[1],this._backgroundColorRgb[2],1),n.clear(n.COLOR_BUFFER_BIT)),this.renderDisplayObject(e,this.renderTarget)}},f.prototype.renderDisplayObject=function(e,t,n){this.setRenderTarget(t),n&&t.clear(),this.filterManager.setFilterStack(t.filterStack),e.renderWebGL(this),this.currentRenderer.flush()},f.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},f.prototype.setRenderTarget=function(e){this.currentRenderTarget!==e&&(this.currentRenderTarget=e,this.currentRenderTarget.activate(),this.stencilManager.setMaskStack(e.stencilMaskStack))},f.prototype.resize=function(e,t){i.prototype.resize.call(this,e,t),this.filterManager.resize(e,t),this.renderTarget.resize(e,t),this.currentRenderTarget===this.renderTarget&&(this.renderTarget.activate(),this.gl.viewport(0,0,this.width,this.height))},f.prototype.updateTexture=function(e){if((e=e.baseTexture||e).hasLoaded){var t=this.gl;return e._glTextures[t.id]||(e._glTextures[t.id]=t.createTexture(),e.on("update",this.updateTexture,this),e.on("dispose",this.destroyTexture,this)),t.bindTexture(t.TEXTURE_2D,e._glTextures[t.id]),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultipliedAlpha),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e.source),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,e.scaleMode===p.SCALE_MODES.LINEAR?t.LINEAR:t.NEAREST),e.mipmap&&e.isPowerOfTwo?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,e.scaleMode===p.SCALE_MODES.LINEAR?t.LINEAR_MIPMAP_LINEAR:t.NEAREST_MIPMAP_NEAREST),t.generateMipmap(t.TEXTURE_2D)):t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,e.scaleMode===p.SCALE_MODES.LINEAR?t.LINEAR:t.NEAREST),e.isPowerOfTwo?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)),e._glTextures[t.id]}},f.prototype.destroyTexture=function(e){(e=e.baseTexture||e).hasLoaded&&e._glTextures[this.gl.id]&&this.gl.deleteTexture(e._glTextures[this.gl.id])},f.prototype.handleContextLost=function(e){e.preventDefault()},f.prototype.handleContextRestored=function(){for(var e in this._initContext(),h.BaseTextureCache)h.BaseTextureCache[e]._glTextures.length=0},f.prototype.destroy=function(e){for(var t in this.destroyPlugins(),this.view.removeEventListener("webglcontextlost",this.handleContextLost),this.view.removeEventListener("webglcontextrestored",this.handleContextRestored),h.BaseTextureCache){var n=h.BaseTextureCache[t];n.off("update",this.updateTexture,this),n.off("dispose",this.destroyTexture,this)}i.prototype.destroy.call(this,e),this.uid=0,this.shaderManager.destroy(),this.maskManager.destroy(),this.stencilManager.destroy(),this.filterManager.destroy(),this.blendModeManager.destroy(),this.shaderManager=null,this.maskManager=null,this.filterManager=null,this.blendModeManager=null,this.currentRenderer=null,this.handleContextLost=null,this.handleContextRestored=null,this._contextOptions=null,this.drawCount=0,this.gl.useProgram(null),this.gl=null},f.prototype._mapGlModes=function(){var e=this.gl;this.blendModes||(this.blendModes={},this.blendModes[p.BLEND_MODES.NORMAL]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.ADD]=[e.SRC_ALPHA,e.DST_ALPHA],this.blendModes[p.BLEND_MODES.MULTIPLY]=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.SCREEN]=[e.SRC_ALPHA,e.ONE],this.blendModes[p.BLEND_MODES.OVERLAY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.DARKEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.LIGHTEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.COLOR_DODGE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.COLOR_BURN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.HARD_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.SOFT_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.DIFFERENCE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.EXCLUSION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.HUE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.SATURATION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.COLOR]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],this.blendModes[p.BLEND_MODES.LUMINOSITY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA]),this.drawModes||(this.drawModes={},this.drawModes[p.DRAW_MODES.POINTS]=e.POINTS,this.drawModes[p.DRAW_MODES.LINES]=e.LINES,this.drawModes[p.DRAW_MODES.LINE_LOOP]=e.LINE_LOOP,this.drawModes[p.DRAW_MODES.LINE_STRIP]=e.LINE_STRIP,this.drawModes[p.DRAW_MODES.TRIANGLES]=e.TRIANGLES,this.drawModes[p.DRAW_MODES.TRIANGLE_STRIP]=e.TRIANGLE_STRIP,this.drawModes[p.DRAW_MODES.TRIANGLE_FAN]=e.TRIANGLE_FAN)}},50580:(e,t,n)=>{var i=n(38297);function r(e,t,n){this.shaders=[],this.padding=0,this.uniforms=n||{},this.vertexSrc=e||i.defaultVertexSrc,this.fragmentSrc=t||i.defaultFragmentSrc}r.prototype.constructor=r,e.exports=r,r.prototype.getShader=function(e){var t=e.gl,n=this.shaders[t.id];return n||(n=new i(e.shaderManager,this.vertexSrc,this.fragmentSrc,this.uniforms,this.attributes),this.shaders[t.id]=n),n},r.prototype.applyFilter=function(e,t,n,i){var r=this.getShader(e);e.filterManager.applyFilter(r,t,n,i)},r.prototype.syncUniform=function(e){for(var t=0,n=this.shaders.length;t<n;++t)this.shaders[t].syncUniform(e)}},1438:(e,t,n)=>{var i=n(50580),r=n(67425);function s(){i.call(this,r.readFileSync("//FXAA.vert","utf8"),r.readFileSync("//FXAA.frag","utf8"),{resolution:{type:"v2",value:{x:1,y:1}}})}s.prototype=Object.create(i.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.applyFilter=function(e,t,n){var i=e.filterManager,r=this.getShader(e);i.applyFilter(r,t,n)}},45207:(e,t,n)=>{var i=n(50580),r=n(74650),s=n(67425);function o(e){var t=new r.Matrix;i.call(this,s.readFileSync("//spriteMaskFilter.vert","utf8"),s.readFileSync("//spriteMaskFilter.frag","utf8"),{mask:{type:"sampler2D",value:e._texture},alpha:{type:"f",value:1},otherMatrix:{type:"mat3",value:t.toArray(!0)}}),this.maskSprite=e,this.maskMatrix=t}o.prototype=Object.create(i.prototype),o.prototype.constructor=o,e.exports=o,o.prototype.applyFilter=function(e,t,n){var i=e.filterManager;this.uniforms.mask.value=this.maskSprite._texture,i.calculateMappedMatrix(t.frame,this.maskSprite,this.maskMatrix),this.uniforms.otherMatrix.value=this.maskMatrix.toArray(!0),this.uniforms.alpha.value=this.maskSprite.worldAlpha;var r=this.getShader(e);i.applyFilter(r,t,n)},Object.defineProperties(o.prototype,{map:{get:function(){return this.uniforms.mask.value},set:function(e){this.uniforms.mask.value=e}},offset:{get:function(){return this.uniforms.offset.value},set:function(e){this.uniforms.offset.value=e}}})},25396:(e,t,n)=>{var i=n(61103);function r(e){i.call(this,e),this.currentBlendMode=99999}r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.setBlendMode=function(e){if(this.currentBlendMode===e)return!1;this.currentBlendMode=e;var t=this.renderer.blendModes[this.currentBlendMode];return this.renderer.gl.blendFunc(t[0],t[1]),!0}},64598:(e,t,n)=>{var i=n(61103),r=n(97955),s=n(46192),o=n(3885),a=n(74650);function l(e){i.call(this,e),this.filterStack=[],this.filterStack.push({renderTarget:e.currentRenderTarget,filter:[],bounds:null}),this.texturePool=[],this.textureSize=new a.Rectangle(0,0,e.width,e.height),this.currentFrame=null}l.prototype=Object.create(i.prototype),l.prototype.constructor=l,e.exports=l,l.prototype.onContextChange=function(){this.texturePool.length=0;var e=this.renderer.gl;this.quad=new o(e)},l.prototype.setFilterStack=function(e){this.filterStack=e},l.prototype.pushFilter=function(e,t){var n=e.filterArea?e.filterArea.clone():e.getBounds();n.x=0|n.x,n.y=0|n.y,n.width=0|n.width,n.height=0|n.height;var i=0|t[0].padding;if(n.x-=i,n.y-=i,n.width+=2*i,n.height+=2*i,this.renderer.currentRenderTarget.transform){var r=this.renderer.currentRenderTarget.transform;n.x+=r.tx,n.y+=r.ty,this.capFilterArea(n),n.x-=r.tx,n.y-=r.ty}else this.capFilterArea(n);if(n.width>0&&n.height>0){this.currentFrame=n;var s=this.getRenderTarget();this.renderer.setRenderTarget(s),s.clear(),this.filterStack.push({renderTarget:s,filter:t})}else this.filterStack.push({renderTarget:null,filter:t})},l.prototype.popFilter=function(){var e=this.filterStack.pop(),t=this.filterStack[this.filterStack.length-1],n=e.renderTarget;if(e.renderTarget){var i=t.renderTarget,r=this.renderer.gl;this.currentFrame=n.frame,this.quad.map(this.textureSize,n.frame),r.bindBuffer(r.ARRAY_BUFFER,this.quad.vertexBuffer),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.quad.indexBuffer);var o=e.filter;if(r.vertexAttribPointer(this.renderer.shaderManager.defaultShader.attributes.aVertexPosition,2,r.FLOAT,!1,0,0),r.vertexAttribPointer(this.renderer.shaderManager.defaultShader.attributes.aTextureCoord,2,r.FLOAT,!1,0,32),r.vertexAttribPointer(this.renderer.shaderManager.defaultShader.attributes.aColor,4,r.FLOAT,!1,0,64),this.renderer.blendModeManager.setBlendMode(s.BLEND_MODES.NORMAL),1===o.length)o[0].uniforms.dimensions&&(o[0].uniforms.dimensions.value[0]=this.renderer.width,o[0].uniforms.dimensions.value[1]=this.renderer.height,o[0].uniforms.dimensions.value[2]=this.quad.vertices[0],o[0].uniforms.dimensions.value[3]=this.quad.vertices[5]),o[0].applyFilter(this.renderer,n,i),this.returnRenderTarget(n);else{for(var a=n,l=this.getRenderTarget(!0),u=0;u<o.length-1;u++){var c=o[u];c.uniforms.dimensions&&(c.uniforms.dimensions.value[0]=this.renderer.width,c.uniforms.dimensions.value[1]=this.renderer.height,c.uniforms.dimensions.value[2]=this.quad.vertices[0],c.uniforms.dimensions.value[3]=this.quad.vertices[5]),c.applyFilter(this.renderer,a,l);var d=a;a=l,l=d}o[o.length-1].applyFilter(this.renderer,a,i),this.returnRenderTarget(a),this.returnRenderTarget(l)}return e.filter}},l.prototype.getRenderTarget=function(e){var t=this.texturePool.pop()||new r(this.renderer.gl,this.textureSize.width,this.textureSize.height,s.SCALE_MODES.LINEAR,this.renderer.resolution*s.FILTER_RESOLUTION);return t.frame=this.currentFrame,e&&t.clear(!0),t},l.prototype.returnRenderTarget=function(e){this.texturePool.push(e)},l.prototype.applyFilter=function(e,t,n,i){var r=this.renderer.gl;this.renderer.setRenderTarget(n),i&&n.clear(),this.renderer.shaderManager.setShader(e),e.uniforms.projectionMatrix.value=this.renderer.currentRenderTarget.projectionMatrix.toArray(!0),e.syncUniforms(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,t.texture),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0),this.renderer.drawCount++},l.prototype.calculateMappedMatrix=function(e,t,n){var i=t.worldTransform.copy(a.Matrix.TEMP_MATRIX),r=t._texture.baseTexture,s=n.identity(),o=this.textureSize.height/this.textureSize.width;s.translate(e.x/this.textureSize.width,e.y/this.textureSize.height),s.scale(1,o);var l=this.textureSize.width/r.width,u=this.textureSize.height/r.height;return i.tx/=r.width*l,i.ty/=r.width*l,i.invert(),s.prepend(i),s.scale(1,1/o),s.scale(l,u),s.translate(t.anchor.x,t.anchor.y),s},l.prototype.capFilterArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0),e.x+e.width>this.textureSize.width&&(e.width=this.textureSize.width-e.x),e.y+e.height>this.textureSize.height&&(e.height=this.textureSize.height-e.y)},l.prototype.resize=function(e,t){this.textureSize.width=e,this.textureSize.height=t;for(var n=0;n<this.texturePool.length;n++)this.texturePool[n].resize(e,t)},l.prototype.destroy=function(){this.quad.destroy(),i.prototype.destroy.call(this),this.filterStack=null,this.offsetY=0;for(var e=0;e<this.texturePool.length;e++)this.texturePool[e].destroy();this.texturePool=null}},89240:(e,t,n)=>{var i=n(61103),r=n(45207);function s(e){i.call(this,e),this.stencilStack=[],this.reverse=!0,this.count=0,this.alphaMaskPool=[]}s.prototype=Object.create(i.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.pushMask=function(e,t){t.texture?this.pushSpriteMask(e,t):this.pushStencilMask(e,t)},s.prototype.popMask=function(e,t){t.texture?this.popSpriteMask(e,t):this.popStencilMask(e,t)},s.prototype.pushSpriteMask=function(e,t){var n=this.alphaMaskPool.pop();n||(n=[new r(t)]),n[0].maskSprite=t,this.renderer.filterManager.pushFilter(e,n)},s.prototype.popSpriteMask=function(){var e=this.renderer.filterManager.popFilter();this.alphaMaskPool.push(e)},s.prototype.pushStencilMask=function(e,t){this.renderer.stencilManager.pushMask(t)},s.prototype.popStencilMask=function(e,t){this.renderer.stencilManager.popMask(t)}},43779:(e,t,n)=>{var i=n(61103),r=n(38297),s=n(47151),o=n(69691),a=n(70501);function l(e){i.call(this,e),this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var t=0;t<this.maxAttibs;t++)this.attribState[t]=!1;this.stack=[],this._currentId=-1,this.currentShader=null}l.prototype=Object.create(i.prototype),l.prototype.constructor=l,a.pluginTarget.mixin(l),e.exports=l,l.prototype.onContextChange=function(){this.initPlugins();var e=this.renderer.gl;this.maxAttibs=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.attribState=[];for(var t=0;t<this.maxAttibs;t++)this.attribState[t]=!1;this.defaultShader=new r(this),this.primitiveShader=new o(this),this.complexPrimitiveShader=new s(this)},l.prototype.setAttribs=function(e){var t;for(t=0;t<this.tempAttribState.length;t++)this.tempAttribState[t]=!1;for(var n in e)this.tempAttribState[e[n]]=!0;var i=this.renderer.gl;for(t=0;t<this.attribState.length;t++)this.attribState[t]!==this.tempAttribState[t]&&(this.attribState[t]=this.tempAttribState[t],this.attribState[t]?i.enableVertexAttribArray(t):i.disableVertexAttribArray(t))},l.prototype.setShader=function(e){return this._currentId!==e.uid&&(this._currentId=e.uid,this.currentShader=e,this.renderer.gl.useProgram(e.program),this.setAttribs(e.attributes),!0)},l.prototype.destroy=function(){this.primitiveShader.destroy(),this.complexPrimitiveShader.destroy(),i.prototype.destroy.call(this),this.destroyPlugins(),this.attribState=null,this.tempAttribState=null}},15468:(e,t,n)=>{var i=n(61103),r=n(70501);function s(e){i.call(this,e),this.stencilMaskStack=null}s.prototype=Object.create(i.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.setMaskStack=function(e){this.stencilMaskStack=e;var t=this.renderer.gl;0===e.stencilStack.length?t.disable(t.STENCIL_TEST):t.enable(t.STENCIL_TEST)},s.prototype.pushStencil=function(e,t){this.renderer.currentRenderTarget.attachStencilBuffer();var n=this.renderer.gl,i=this.stencilMaskStack;this.bindGraphics(e,t),0===i.stencilStack.length&&(n.enable(n.STENCIL_TEST),n.clear(n.STENCIL_BUFFER_BIT),i.reverse=!0,i.count=0),i.stencilStack.push(t);var r=i.count;n.colorMask(!1,!1,!1,!1),n.stencilFunc(n.ALWAYS,0,255),n.stencilOp(n.KEEP,n.KEEP,n.INVERT),1===t.mode?(n.drawElements(n.TRIANGLE_FAN,t.indices.length-4,n.UNSIGNED_SHORT,0),i.reverse?(n.stencilFunc(n.EQUAL,255-r,255),n.stencilOp(n.KEEP,n.KEEP,n.DECR)):(n.stencilFunc(n.EQUAL,r,255),n.stencilOp(n.KEEP,n.KEEP,n.INCR)),n.drawElements(n.TRIANGLE_FAN,4,n.UNSIGNED_SHORT,2*(t.indices.length-4)),i.reverse?n.stencilFunc(n.EQUAL,255-(r+1),255):n.stencilFunc(n.EQUAL,r+1,255),i.reverse=!i.reverse):(i.reverse?(n.stencilFunc(n.EQUAL,r,255),n.stencilOp(n.KEEP,n.KEEP,n.INCR)):(n.stencilFunc(n.EQUAL,255-r,255),n.stencilOp(n.KEEP,n.KEEP,n.DECR)),n.drawElements(n.TRIANGLE_STRIP,t.indices.length,n.UNSIGNED_SHORT,0),i.reverse?n.stencilFunc(n.EQUAL,r+1,255):n.stencilFunc(n.EQUAL,255-(r+1),255)),n.colorMask(!0,!0,!0,!0),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),i.count++},s.prototype.bindGraphics=function(e,t){var n,i=this.renderer.gl;1===t.mode?(n=this.renderer.shaderManager.complexPrimitiveShader,this.renderer.shaderManager.setShader(n),i.uniformMatrix3fv(n.uniforms.translationMatrix._location,!1,e.worldTransform.toArray(!0)),i.uniformMatrix3fv(n.uniforms.projectionMatrix._location,!1,this.renderer.currentRenderTarget.projectionMatrix.toArray(!0)),i.uniform3fv(n.uniforms.tint._location,r.hex2rgb(e.tint)),i.uniform3fv(n.uniforms.color._location,t.color),i.uniform1f(n.uniforms.alpha._location,e.worldAlpha),i.bindBuffer(i.ARRAY_BUFFER,t.buffer),i.vertexAttribPointer(n.attributes.aVertexPosition,2,i.FLOAT,!1,8,0),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.indexBuffer)):(n=this.renderer.shaderManager.primitiveShader,this.renderer.shaderManager.setShader(n),i.uniformMatrix3fv(n.uniforms.translationMatrix._location,!1,e.worldTransform.toArray(!0)),i.uniformMatrix3fv(n.uniforms.projectionMatrix._location,!1,this.renderer.currentRenderTarget.projectionMatrix.toArray(!0)),i.uniform3fv(n.uniforms.tint._location,r.hex2rgb(e.tint)),i.uniform1f(n.uniforms.alpha._location,e.worldAlpha),i.bindBuffer(i.ARRAY_BUFFER,t.buffer),i.vertexAttribPointer(n.attributes.aVertexPosition,2,i.FLOAT,!1,24,0),i.vertexAttribPointer(n.attributes.aColor,4,i.FLOAT,!1,24,8),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.indexBuffer))},s.prototype.popStencil=function(e,t){var n=this.renderer.gl,i=this.stencilMaskStack;if(i.stencilStack.pop(),i.count--,0===i.stencilStack.length)n.disable(n.STENCIL_TEST);else{var r=i.count;this.bindGraphics(e,t),n.colorMask(!1,!1,!1,!1),1===t.mode?(i.reverse=!i.reverse,i.reverse?(n.stencilFunc(n.EQUAL,255-(r+1),255),n.stencilOp(n.KEEP,n.KEEP,n.INCR)):(n.stencilFunc(n.EQUAL,r+1,255),n.stencilOp(n.KEEP,n.KEEP,n.DECR)),n.drawElements(n.TRIANGLE_FAN,4,n.UNSIGNED_SHORT,2*(t.indices.length-4)),n.stencilFunc(n.ALWAYS,0,255),n.stencilOp(n.KEEP,n.KEEP,n.INVERT),n.drawElements(n.TRIANGLE_FAN,t.indices.length-4,n.UNSIGNED_SHORT,0),this.renderer.drawCount+=2,i.reverse?n.stencilFunc(n.EQUAL,r,255):n.stencilFunc(n.EQUAL,255-r,255)):(i.reverse?(n.stencilFunc(n.EQUAL,r+1,255),n.stencilOp(n.KEEP,n.KEEP,n.DECR)):(n.stencilFunc(n.EQUAL,255-(r+1),255),n.stencilOp(n.KEEP,n.KEEP,n.INCR)),n.drawElements(n.TRIANGLE_STRIP,t.indices.length,n.UNSIGNED_SHORT,0),this.renderer.drawCount++,i.reverse?n.stencilFunc(n.EQUAL,r,255):n.stencilFunc(n.EQUAL,255-r,255)),n.colorMask(!0,!0,!0,!0),n.stencilOp(n.KEEP,n.KEEP,n.KEEP)}},s.prototype.destroy=function(){i.prototype.destroy.call(this),this.stencilMaskStack.stencilStack=null},s.prototype.pushMask=function(e){this.renderer.setObjectRenderer(this.renderer.plugins.graphics),e.dirty&&this.renderer.plugins.graphics.updateGraphics(e,this.renderer.gl),e._webGL[this.renderer.gl.id].data.length&&this.pushStencil(e,e._webGL[this.renderer.gl.id].data[0])},s.prototype.popMask=function(e){this.renderer.setObjectRenderer(this.renderer.plugins.graphics),this.popStencil(e,e._webGL[this.renderer.gl.id].data[0])}},61103:e=>{function t(e){this.renderer=e,this.renderer.on("context",this.onContextChange,this)}t.prototype.constructor=t,e.exports=t,t.prototype.onContextChange=function(){},t.prototype.destroy=function(){this.renderer.off("context",this.onContextChange,this),this.renderer=null}},47151:(e,t,n)=>{var i=n(8306);function r(e){i.call(this,e,["attribute vec2 aVertexPosition;","uniform mat3 translationMatrix;","uniform mat3 projectionMatrix;","uniform vec3 tint;","uniform float alpha;","uniform vec3 color;","varying vec4 vColor;","void main(void){"," gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);"," vColor = vec4(color * alpha * tint, alpha);","}"].join("\n"),["precision mediump float;","varying vec4 vColor;","void main(void){"," gl_FragColor = vColor;","}"].join("\n"),{tint:{type:"3f",value:[0,0,0]},alpha:{type:"1f",value:0},color:{type:"3f",value:[0,0,0]},translationMatrix:{type:"mat3",value:new Float32Array(9)},projectionMatrix:{type:"mat3",value:new Float32Array(9)}},{aVertexPosition:0})}r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r},69691:(e,t,n)=>{var i=n(8306);function r(e){i.call(this,e,["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform mat3 projectionMatrix;","uniform float alpha;","uniform float flipY;","uniform vec3 tint;","varying vec4 vColor;","void main(void){"," gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"].join("\n"),["precision mediump float;","varying vec4 vColor;","void main(void){"," gl_FragColor = vColor;","}"].join("\n"),{tint:{type:"3f",value:[0,0,0]},alpha:{type:"1f",value:0},translationMatrix:{type:"mat3",value:new Float32Array(9)},projectionMatrix:{type:"mat3",value:new Float32Array(9)}},{aVertexPosition:0,aColor:0})}r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r},8306:(e,t,n)=>{var i=n(70501);function r(e,t,n,r,s){if(!t||!n)throw new Error("Pixi.js Error. Shader requires vertexSrc and fragmentSrc");this.uid=i.uid(),this.gl=e.renderer.gl,this.shaderManager=e,this.program=null,this.uniforms=r||{},this.attributes=s||{},this.textureCount=1,this.vertexSrc=t,this.fragmentSrc=n,this.init()}r.prototype.constructor=r,e.exports=r,r.prototype.init=function(){this.compile(),this.gl.useProgram(this.program),this.cacheUniformLocations(Object.keys(this.uniforms)),this.cacheAttributeLocations(Object.keys(this.attributes))},r.prototype.cacheUniformLocations=function(e){for(var t=0;t<e.length;++t)this.uniforms[e[t]]._location=this.gl.getUniformLocation(this.program,e[t])},r.prototype.cacheAttributeLocations=function(e){for(var t=0;t<e.length;++t)this.attributes[e[t]]=this.gl.getAttribLocation(this.program,e[t])},r.prototype.compile=function(){var e=this.gl,t=this._glCompile(e.VERTEX_SHADER,this.vertexSrc),n=this._glCompile(e.FRAGMENT_SHADER,this.fragmentSrc),i=e.createProgram();return e.attachShader(i,t),e.attachShader(i,n),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS)||(console.error("Pixi.js Error: Could not initialize shader."),console.error("gl.VALIDATE_STATUS",e.getProgramParameter(i,e.VALIDATE_STATUS)),console.error("gl.getError()",e.getError()),""!==e.getProgramInfoLog(i)&&console.warn("Pixi.js Warning: gl.getProgramInfoLog()",e.getProgramInfoLog(i)),e.deleteProgram(i),i=null),e.deleteShader(t),e.deleteShader(n),this.program=i},r.prototype.syncUniform=function(e){var t,n,r=e._location,s=e.value,o=this.gl;switch(e.type){case"b":case"bool":case"boolean":o.uniform1i(r,s?1:0);break;case"i":case"1i":o.uniform1i(r,s);break;case"f":case"1f":o.uniform1f(r,s);break;case"2f":o.uniform2f(r,s[0],s[1]);break;case"3f":o.uniform3f(r,s[0],s[1],s[2]);break;case"4f":o.uniform4f(r,s[0],s[1],s[2],s[3]);break;case"v2":o.uniform2f(r,s.x,s.y);break;case"v3":o.uniform3f(r,s.x,s.y,s.z);break;case"v4":o.uniform4f(r,s.x,s.y,s.z,s.w);break;case"1iv":case"iv1":o.uniform1iv(r,s);break;case"2iv":o.uniform2iv(r,s);break;case"3iv":case"iv":o.uniform3iv(r,s);break;case"4iv":o.uniform4iv(r,s);break;case"1fv":case"fv1":o.uniform1fv(r,s);break;case"2fv":o.uniform2fv(r,s);break;case"3fv":case"fv":o.uniform3fv(r,s);break;case"4fv":o.uniform4fv(r,s);break;case"m2":case"mat2":case"Matrix2fv":o.uniformMatrix2fv(r,e.transpose,s);break;case"m3":case"mat3":case"Matrix3fv":o.uniformMatrix3fv(r,e.transpose,s);break;case"m4":case"mat4":case"Matrix4fv":o.uniformMatrix4fv(r,e.transpose,s);break;case"c":"number"==typeof s&&(s=i.hex2rgb(s)),o.uniform3f(r,s[0],s[1],s[2]);break;case"v2v":for(e._array||(e._array=new Float32Array(2*s.length)),t=0,n=s.length;t<n;++t)e._array[2*t]=s[t].x,e._array[2*t+1]=s[t].y;o.uniform2fv(r,e._array);break;case"v3v":for(e._array||(e._array=new Float32Array(3*s.length)),t=0,n=s.length;t<n;++t)e._array[3*t]=s[t].x,e._array[3*t+1]=s[t].y,e._array[3*t+2]=s[t].z;o.uniform3fv(r,e._array);break;case"v4v":for(e._array||(e._array=new Float32Array(4*s.length)),t=0,n=s.length;t<n;++t)e._array[4*t]=s[t].x,e._array[4*t+1]=s[t].y,e._array[4*t+2]=s[t].z,e._array[4*t+3]=s[t].w;o.uniform4fv(r,e._array);break;case"t":case"sampler2D":if(!e.value||!e.value.baseTexture.hasLoaded)break;o.activeTexture(o["TEXTURE"+this.textureCount]);var a=e.value.baseTexture._glTextures[o.id];a||(this.initSampler2D(e),a=e.value.baseTexture._glTextures[o.id]),o.bindTexture(o.TEXTURE_2D,a),o.uniform1i(e._location,this.textureCount),this.textureCount++;break;default:console.warn("Pixi.js Shader Warning: Unknown uniform type: "+e.type)}},r.prototype.syncUniforms=function(){for(var e in this.textureCount=1,this.uniforms)this.syncUniform(this.uniforms[e])},r.prototype.initSampler2D=function(e){var t=this.gl,n=e.value.baseTexture;if(n.hasLoaded)if(e.textureData){var i=e.textureData;n._glTextures[t.id]=t.createTexture(),t.bindTexture(t.TEXTURE_2D,n._glTextures[t.id]),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultipliedAlpha),t.texImage2D(t.TEXTURE_2D,0,i.luminance?t.LUMINANCE:t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n.source),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,i.magFilter?i.magFilter:t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,i.wrapS?i.wrapS:t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i.wrapS?i.wrapS:t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i.wrapT?i.wrapT:t.CLAMP_TO_EDGE)}else this.shaderManager.renderer.updateTexture(n)},r.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.gl=null,this.uniforms=null,this.attributes=null,this.vertexSrc=null,this.fragmentSrc=null},r.prototype._glCompile=function(e,t){var n=this.gl.createShader(e);return this.gl.shaderSource(n,t),this.gl.compileShader(n),this.gl.getShaderParameter(n,this.gl.COMPILE_STATUS)?n:(console.log(this.gl.getShaderInfoLog(n)),null)}},38297:(e,t,n)=>{var i=n(8306);function r(e,t,n,s,o){var a={uSampler:{type:"sampler2D",value:0},projectionMatrix:{type:"mat3",value:new Float32Array([1,0,0,0,1,0,0,0,1])}};if(s)for(var l in s)a[l]=s[l];var u={aVertexPosition:0,aTextureCoord:0,aColor:0};if(o)for(var c in o)u[c]=o[c];t=t||r.defaultVertexSrc,n=n||r.defaultFragmentSrc,i.call(this,e,t,n,a,u)}r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r,r.defaultVertexSrc=["precision lowp float;","attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec4 aColor;","uniform mat3 projectionMatrix;","varying vec2 vTextureCoord;","varying vec4 vColor;","void main(void){"," gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);","}"].join("\n"),r.defaultFragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void){"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"].join("\n")},91830:(e,t,n)=>{var i=n(61103);function r(e){i.call(this,e)}r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.start=function(){},r.prototype.stop=function(){this.flush()},r.prototype.flush=function(){},r.prototype.render=function(e){}},3885:e=>{function t(e){this.gl=e,this.vertices=new Float32Array([0,0,200,0,200,200,0,200]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.colors=new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]),this.indices=new Uint16Array([0,1,2,0,3,2]),this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,128,e.DYNAMIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW),this.upload()}t.prototype.constructor=t,t.prototype.map=function(e,t){var n=0,i=0;this.uvs[0]=n,this.uvs[1]=i,this.uvs[2]=n+t.width/e.width,this.uvs[3]=i,this.uvs[4]=n+t.width/e.width,this.uvs[5]=i+t.height/e.height,this.uvs[6]=n,this.uvs[7]=i+t.height/e.height,n=t.x,i=t.y,this.vertices[0]=n,this.vertices[1]=i,this.vertices[2]=n+t.width,this.vertices[3]=i,this.vertices[4]=n+t.width,this.vertices[5]=i+t.height,this.vertices[6]=n,this.vertices[7]=i+t.height,this.upload()},t.prototype.upload=function(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bufferSubData(e.ARRAY_BUFFER,0,this.vertices),e.bufferSubData(e.ARRAY_BUFFER,32,this.uvs),e.bufferSubData(e.ARRAY_BUFFER,64,this.colors)},t.prototype.destroy=function(){var e=this.gl;e.deleteBuffer(this.vertexBuffer),e.deleteBuffer(this.indexBuffer)},e.exports=t},97955:(e,t,n)=>{var i=n(74650),r=n(70501),s=n(46192),o=n(68614),a=function(e,t,n,a,l,u){(this.gl=e,this.frameBuffer=null,this.texture=null,this.size=new i.Rectangle(0,0,1,1),this.resolution=l||s.RESOLUTION,this.projectionMatrix=new i.Matrix,this.transform=null,this.frame=null,this.stencilBuffer=null,this.stencilMaskStack=new o,this.filterStack=[{renderTarget:this,filter:[],bounds:this.size}],this.scaleMode=a||s.SCALE_MODES.DEFAULT,this.root=u,this.root)||(this.frameBuffer=e.createFramebuffer(),this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,a===s.SCALE_MODES.LINEAR?e.LINEAR:e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,a===s.SCALE_MODES.LINEAR?e.LINEAR:e.NEAREST),r.isPowerOfTwo(t,n)?(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT)):(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)),e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture,0));this.resize(t,n)};a.prototype.constructor=a,e.exports=a,a.prototype.clear=function(e){var t=this.gl;e&&t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},a.prototype.attachStencilBuffer=function(){if(!this.stencilBuffer&&!this.root){var e=this.gl;this.stencilBuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.stencilBuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,this.stencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,this.size.width*this.resolution,this.size.height*this.resolution)}},a.prototype.activate=function(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer);var t=this.frame||this.size;this.calculateProjection(t),this.transform&&this.projectionMatrix.append(this.transform),e.viewport(0,0,t.width*this.resolution,t.height*this.resolution)},a.prototype.calculateProjection=function(e){var t=this.projectionMatrix;t.identity(),this.root?(t.a=1/e.width*2,t.d=-1/e.height*2,t.tx=-1-e.x*t.a,t.ty=1-e.y*t.d):(t.a=1/e.width*2,t.d=1/e.height*2,t.tx=-1-e.x*t.a,t.ty=-1-e.y*t.d)},a.prototype.resize=function(e,t){if(e|=0,t|=0,this.size.width!==e||this.size.height!==t){if(this.size.width=e,this.size.height=t,!this.root){var n=this.gl;n.bindTexture(n.TEXTURE_2D,this.texture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,e*this.resolution,t*this.resolution,0,n.RGBA,n.UNSIGNED_BYTE,null),this.stencilBuffer&&(n.bindRenderbuffer(n.RENDERBUFFER,this.stencilBuffer),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,e*this.resolution,t*this.resolution))}var i=this.frame||this.size;this.calculateProjection(i)}},a.prototype.destroy=function(){var e=this.gl;e.deleteRenderbuffer(this.stencilBuffer),e.deleteFramebuffer(this.frameBuffer),e.deleteTexture(this.texture),this.frameBuffer=null,this.texture=null}},68614:e=>{function t(){this.stencilStack=[],this.reverse=!0,this.count=0}t.prototype.constructor=t,e.exports=t},52861:(e,t,n)=>{var i=n(74650),r=n(22699),s=n(67673),o=n(87809),a=n(70501),l=n(46192),u=new i.Point;function c(e){s.call(this),this.anchor=new i.Point,this._texture=null,this._width=0,this._height=0,this.tint=16777215,this.blendMode=l.BLEND_MODES.NORMAL,this.shader=null,this.cachedTint=16777215,this.texture=e||r.EMPTY}c.prototype=Object.create(s.prototype),c.prototype.constructor=c,e.exports=c,Object.defineProperties(c.prototype,{width:{get:function(){return Math.abs(this.scale.x)*this.texture._frame.width},set:function(e){this.scale.x=a.sign(this.scale.x)*e/this.texture._frame.width,this._width=e}},height:{get:function(){return Math.abs(this.scale.y)*this.texture._frame.height},set:function(e){this.scale.y=a.sign(this.scale.y)*e/this.texture._frame.height,this._height=e}},texture:{get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture=e,this.cachedTint=16777215,e&&(e.baseTexture.hasLoaded?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}}),c.prototype._onTextureUpdate=function(){this._width&&(this.scale.x=a.sign(this.scale.x)*this._width/this.texture.frame.width),this._height&&(this.scale.y=a.sign(this.scale.y)*this._height/this.texture.frame.height)},c.prototype._renderWebGL=function(e){e.setObjectRenderer(e.plugins.sprite),e.plugins.sprite.render(this)},c.prototype.getBounds=function(e){if(!this._currentBounds){var t,n,i,r,s=this._texture._frame.width,o=this._texture._frame.height,a=s*(1-this.anchor.x),l=s*-this.anchor.x,u=o*(1-this.anchor.y),c=o*-this.anchor.y,d=e||this.worldTransform,h=d.a,p=d.b,f=d.c,m=d.d,g=d.tx,y=d.ty;if(0===p&&0===f)h<0&&(h*=-1),m<0&&(m*=-1),t=h*l+g,n=h*a+g,i=m*c+y,r=m*u+y;else{var _=h*l+f*c+g,v=m*c+p*l+y,b=h*a+f*c+g,T=m*c+p*a+y,x=h*a+f*u+g,E=m*u+p*a+y,w=h*l+f*u+g,I=m*u+p*l+y;t=w<(t=x<(t=b<(t=_)?b:t)?x:t)?w:t,i=I<(i=E<(i=T<(i=v)?T:i)?E:i)?I:i,n=w>(n=x>(n=b>(n=_)?b:n)?x:n)?w:n,r=I>(r=E>(r=T>(r=v)?T:r)?E:r)?I:r}if(this.children.length){var A=this.containerGetBounds();a=A.x,l=A.x+A.width,t=t<a?t:a,i=i<(u=A.y)?i:u,n=n>l?n:l,r=r>(c=A.y+A.height)?r:c}var S=this._bounds;S.x=t,S.width=n-t,S.y=i,S.height=r-i,this._currentBounds=S}return this._currentBounds},c.prototype.getLocalBounds=function(){return this._bounds.x=-this._texture._frame.width*this.anchor.x,this._bounds.y=-this._texture._frame.height*this.anchor.y,this._bounds.width=this._texture._frame.width,this._bounds.height=this._texture._frame.height,this._bounds},c.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,u);var t,n=this._texture._frame.width,i=this._texture._frame.height,r=-n*this.anchor.x;return u.x>r&&u.x<r+n&&(t=-i*this.anchor.y,u.y>t&&u.y<t+i)},c.prototype._renderCanvas=function(e){if(!(this.texture.crop.width<=0||this.texture.crop.height<=0)){var t=e.blendModes[this.blendMode];if(t!==e.context.globalCompositeOperation&&(e.context.globalCompositeOperation=t),this.texture.valid){var n,i,r,s,a=this._texture,u=this.worldTransform;e.context.globalAlpha=this.worldAlpha;var c=a.baseTexture.scaleMode===l.SCALE_MODES.LINEAR;if(e.smoothProperty&&e.context[e.smoothProperty]!==c&&(e.context[e.smoothProperty]=c),a.rotate){var d=u.a,h=u.b;u.a=-u.c,u.b=-u.d,u.c=d,u.d=h,r=a.crop.height,s=a.crop.width,n=a.trim?a.trim.y-this.anchor.y*a.trim.height:this.anchor.y*-a._frame.height,i=a.trim?a.trim.x-this.anchor.x*a.trim.width:this.anchor.x*-a._frame.width}else r=a.crop.width,s=a.crop.height,n=a.trim?a.trim.x-this.anchor.x*a.trim.width:this.anchor.x*-a._frame.width,i=a.trim?a.trim.y-this.anchor.y*a.trim.height:this.anchor.y*-a._frame.height;e.roundPixels?(e.context.setTransform(u.a,u.b,u.c,u.d,u.tx*e.resolution|0,u.ty*e.resolution|0),n|=0,i|=0):e.context.setTransform(u.a,u.b,u.c,u.d,u.tx*e.resolution,u.ty*e.resolution);var p=a.baseTexture.resolution;16777215!==this.tint?(this.cachedTint!==this.tint&&(this.cachedTint=this.tint,this.tintedTexture=o.getTintedTexture(this,this.tint)),e.context.drawImage(this.tintedTexture,0,0,r*p,s*p,n*e.resolution,i*e.resolution,r*e.resolution,s*e.resolution)):e.context.drawImage(a.baseTexture.source,a.crop.x*p,a.crop.y*p,r*p,s*p,n*e.resolution,i*e.resolution,r*e.resolution,s*e.resolution)}}},c.prototype.destroy=function(e,t){s.prototype.destroy.call(this),this.anchor=null,e&&this._texture.destroy(t),this._texture=null,this.shader=null},c.fromFrame=function(e){var t=a.TextureCache[e];if(!t)throw new Error('The frameId "'+e+'" does not exist in the texture cache');return new c(t)},c.fromImage=function(e,t,n){return new c(r.fromImage(e,t,n))}},77920:(e,t,n)=>{var i=n(91830),r=n(65092),s=n(46192);function o(e){i.call(this,e),this.vertSize=5,this.vertByteSize=4*this.vertSize,this.size=s.SPRITE_BATCH_SIZE;var t=4*this.size*this.vertByteSize,n=6*this.size;this.vertices=new ArrayBuffer(t),this.positions=new Float32Array(this.vertices),this.colors=new Uint32Array(this.vertices),this.indices=new Uint16Array(n);for(var r=0,o=0;r<n;r+=6,o+=4)this.indices[r+0]=o+0,this.indices[r+1]=o+1,this.indices[r+2]=o+2,this.indices[r+3]=o+0,this.indices[r+4]=o+2,this.indices[r+5]=o+3;this.currentBatchSize=0,this.sprites=[],this.shader=null}o.prototype=Object.create(i.prototype),o.prototype.constructor=o,e.exports=o,r.registerPlugin("sprite",o),o.prototype.onContextChange=function(){var e=this.renderer.gl;this.shader=this.renderer.shaderManager.defaultShader,this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices,e.DYNAMIC_DRAW),this.currentBlendMode=99999},o.prototype.render=function(e){var t=e._texture;this.currentBatchSize>=this.size&&this.flush();var n=t._uvs;if(n){var i,r,s,o,a=e.anchor.x,l=e.anchor.y;if(t.trim&&void 0===e.tileScale){var u=t.trim;i=(r=u.x-a*u.width)+t.crop.width,s=(o=u.y-l*u.height)+t.crop.height}else i=t._frame.width*(1-a),r=t._frame.width*-a,s=t._frame.height*(1-l),o=t._frame.height*-l;var c=this.currentBatchSize*this.vertByteSize,d=e.worldTransform,h=d.a,p=d.b,f=d.c,m=d.d,g=d.tx,y=d.ty,_=this.colors,v=this.positions;this.renderer.roundPixels?(v[c]=h*r+f*o+g|0,v[c+1]=m*o+p*r+y|0,v[c+5]=h*i+f*o+g|0,v[c+6]=m*o+p*i+y|0,v[c+10]=h*i+f*s+g|0,v[c+11]=m*s+p*i+y|0,v[c+15]=h*r+f*s+g|0,v[c+16]=m*s+p*r+y|0):(v[c]=h*r+f*o+g,v[c+1]=m*o+p*r+y,v[c+5]=h*i+f*o+g,v[c+6]=m*o+p*i+y,v[c+10]=h*i+f*s+g,v[c+11]=m*s+p*i+y,v[c+15]=h*r+f*s+g,v[c+16]=m*s+p*r+y),v[c+2]=n.x0,v[c+3]=n.y0,v[c+7]=n.x1,v[c+8]=n.y1,v[c+12]=n.x2,v[c+13]=n.y2,v[c+17]=n.x3,v[c+18]=n.y3;var b=e.tint;_[c+4]=_[c+9]=_[c+14]=_[c+19]=(b>>16)+(65280&b)+((255&b)<<16)+(255*e.worldAlpha<<24),this.sprites[this.currentBatchSize++]=e}},o.prototype.flush=function(){if(0!==this.currentBatchSize){var e,t,n,i,r=this.renderer.gl;if(this.currentBatchSize>.5*this.size)r.bufferSubData(r.ARRAY_BUFFER,0,this.vertices);else{var s=this.positions.subarray(0,this.currentBatchSize*this.vertByteSize);r.bufferSubData(r.ARRAY_BUFFER,0,s)}for(var o,a=0,l=0,u=null,c=this.renderer.blendModeManager.currentBlendMode,d=null,h=!1,p=!1,f=0,m=this.currentBatchSize;f<m;f++)t=(o=this.sprites[f])._texture.baseTexture,h=c!==(n=o.blendMode),p=d!==(i=o.shader||this.shader),(u!==t||h||p)&&(this.renderBatch(u,a,l),l=f,a=0,u=t,h&&(c=n,this.renderer.blendModeManager.setBlendMode(c)),p&&((e=(d=i).shaders?d.shaders[r.id]:d)||(e=d.getShader(this.renderer)),this.renderer.shaderManager.setShader(e),e.uniforms.projectionMatrix.value=this.renderer.currentRenderTarget.projectionMatrix.toArray(!0),e.syncUniforms(),r.activeTexture(r.TEXTURE0))),a++;this.renderBatch(u,a,l),this.currentBatchSize=0}},o.prototype.renderBatch=function(e,t,n){if(0!==t){var i=this.renderer.gl;e._glTextures[i.id]?i.bindTexture(i.TEXTURE_2D,e._glTextures[i.id]):this.renderer.updateTexture(e),i.drawElements(i.TRIANGLES,6*t,i.UNSIGNED_SHORT,6*n*2),this.renderer.drawCount++}},o.prototype.start=function(){var e=this.renderer.gl;e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var t=this.vertByteSize;e.vertexAttribPointer(this.shader.attributes.aVertexPosition,2,e.FLOAT,!1,t,0),e.vertexAttribPointer(this.shader.attributes.aTextureCoord,2,e.FLOAT,!1,t,8),e.vertexAttribPointer(this.shader.attributes.aColor,4,e.UNSIGNED_BYTE,!0,t,16)},o.prototype.destroy=function(){this.renderer.gl.deleteBuffer(this.vertexBuffer),this.renderer.gl.deleteBuffer(this.indexBuffer),i.prototype.destroy.call(this),this.shader.destroy(),this.renderer=null,this.vertices=null,this.positions=null,this.colors=null,this.indices=null,this.vertexBuffer=null,this.indexBuffer=null,this.sprites=null,this.shader=null}},99252:(e,t,n)=>{var i=n(52861),r=n(22699),s=n(74650),o=n(70501),a=n(46192);function l(e,t,n){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.resolution=n||a.RESOLUTION,this._text=null,this._style=null;var o=r.fromCanvas(this.canvas);o.trim=new s.Rectangle,i.call(this,o),this.text=e,this.style=t}l.prototype=Object.create(i.prototype),l.prototype.constructor=l,e.exports=l,l.fontPropertiesCache={},l.fontPropertiesCanvas=document.createElement("canvas"),l.fontPropertiesContext=l.fontPropertiesCanvas.getContext("2d"),Object.defineProperties(l.prototype,{width:{get:function(){return this.dirty&&this.updateText(),this.scale.x*this._texture._frame.width},set:function(e){this.scale.x=e/this._texture._frame.width,this._width=e}},height:{get:function(){return this.dirty&&this.updateText(),this.scale.y*this._texture._frame.height},set:function(e){this.scale.y=e/this._texture._frame.height,this._height=e}},style:{get:function(){return this._style},set:function(e){"number"==typeof(e=e||{}).fill&&(e.fill=o.hex2string(e.fill)),"number"==typeof e.stroke&&(e.stroke=o.hex2string(e.stroke)),"number"==typeof e.dropShadowColor&&(e.dropShadowColor=o.hex2string(e.dropShadowColor)),e.font=e.font||"bold 20pt Arial",e.fill=e.fill||"black",e.align=e.align||"left",e.stroke=e.stroke||"black",e.strokeThickness=e.strokeThickness||0,e.wordWrap=e.wordWrap||!1,e.wordWrapWidth=e.wordWrapWidth||100,e.dropShadow=e.dropShadow||!1,e.dropShadowColor=e.dropShadowColor||"#000000",e.dropShadowAngle=e.dropShadowAngle||Math.PI/6,e.dropShadowDistance=e.dropShadowDistance||5,e.padding=e.padding||0,e.textBaseline=e.textBaseline||"alphabetic",e.lineJoin=e.lineJoin||"miter",e.miterLimit=e.miterLimit||10,this._style=e,this.dirty=!0}},text:{get:function(){return this._text},set:function(e){e=e.toString()||" ",this._text!==e&&(this._text=e,this.dirty=!0)}}}),l.prototype.updateText=function(){var e=this._style;this.context.font=e.font;for(var t=(e.wordWrap?this.wordWrap(this._text):this._text).split(/(?:\r\n|\r|\n)/),n=new Array(t.length),i=0,r=this.determineFontProperties(e.font),s=0;s<t.length;s++){var o=this.context.measureText(t[s]).width;n[s]=o,i=Math.max(i,o)}var a=i+e.strokeThickness;e.dropShadow&&(a+=e.dropShadowDistance),this.canvas.width=(a+this.context.lineWidth)*this.resolution;var l,u,c=this.style.lineHeight||r.fontSize+e.strokeThickness,d=c*t.length;if(e.dropShadow&&(d+=e.dropShadowDistance),this.canvas.height=(d+2*this._style.padding)*this.resolution,this.context.scale(this.resolution,this.resolution),navigator.isCocoonJS&&this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.font=e.font,this.context.strokeStyle=e.stroke,this.context.lineWidth=e.strokeThickness,this.context.textBaseline=e.textBaseline,this.context.lineJoin=e.lineJoin,this.context.miterLimit=e.miterLimit,e.dropShadow){this.context.fillStyle=e.dropShadowColor;var h=Math.cos(e.dropShadowAngle)*e.dropShadowDistance,p=Math.sin(e.dropShadowAngle)*e.dropShadowDistance;for(s=0;s<t.length;s++)l=e.strokeThickness/2,u=e.strokeThickness/2+s*c+r.ascent,"right"===e.align?l+=i-n[s]:"center"===e.align&&(l+=(i-n[s])/2),e.fill&&this.context.fillText(t[s],l+h,u+p+this._style.padding)}for(this.context.fillStyle=e.fill,s=0;s<t.length;s++)l=e.strokeThickness/2,u=e.strokeThickness/2+s*c+r.ascent,"right"===e.align?l+=i-n[s]:"center"===e.align&&(l+=(i-n[s])/2),e.stroke&&e.strokeThickness&&this.context.strokeText(t[s],l,u+this._style.padding),e.fill&&this.context.fillText(t[s],l,u+this._style.padding);this.updateTexture()},l.prototype.updateTexture=function(){var e=this._texture;e.baseTexture.hasLoaded=!0,e.baseTexture.resolution=this.resolution,e.baseTexture.width=this.canvas.width/this.resolution,e.baseTexture.height=this.canvas.height/this.resolution,e.crop.width=e._frame.width=this.canvas.width/this.resolution,e.crop.height=e._frame.height=this.canvas.height/this.resolution,e.trim.x=0,e.trim.y=-this._style.padding,e.trim.width=e._frame.width,e.trim.height=e._frame.height-2*this._style.padding,this._width=this.canvas.width/this.resolution,this._height=this.canvas.height/this.resolution,e.baseTexture.emit("update",e.baseTexture),this.dirty=!1},l.prototype.renderWebGL=function(e){this.dirty&&this.updateText(),i.prototype.renderWebGL.call(this,e)},l.prototype._renderCanvas=function(e){this.dirty&&this.updateText(),i.prototype._renderCanvas.call(this,e)},l.prototype.determineFontProperties=function(e){var t=l.fontPropertiesCache[e];if(!t){t={};var n=l.fontPropertiesCanvas,i=l.fontPropertiesContext;i.font=e;var r=Math.ceil(i.measureText("|MÉq").width),s=Math.ceil(i.measureText("M").width),o=2*s;s=1.4*s|0,n.width=r,n.height=o,i.fillStyle="#f00",i.fillRect(0,0,r,o),i.font=e,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText("|MÉq",0,s);var a,u,c=i.getImageData(0,0,r,o).data,d=c.length,h=4*r,p=0,f=!1;for(a=0;a<s;a++){for(u=0;u<h;u+=4)if(255!==c[p+u]){f=!0;break}if(f)break;p+=h}for(t.ascent=s-a,p=d-h,f=!1,a=o;a>s;a--){for(u=0;u<h;u+=4)if(255!==c[p+u]){f=!0;break}if(f)break;p-=h}t.descent=a-s,t.fontSize=t.ascent+t.descent,l.fontPropertiesCache[e]=t}return t},l.prototype.wordWrap=function(e){for(var t="",n=e.split("\n"),i=this._style.wordWrapWidth,r=0;r<n.length;r++){for(var s=i,o=n[r].split(" "),a=0;a<o.length;a++){var l=this.context.measureText(o[a]).width,u=l+this.context.measureText(" ").width;0===a||u>s?(a>0&&(t+="\n"),t+=o[a],s=i-l):(s-=u,t+=" "+o[a])}r<n.length-1&&(t+="\n")}return t},l.prototype.getBounds=function(e){return this.dirty&&this.updateText(),i.prototype.getBounds.call(this,e)},l.prototype.destroy=function(e){this.context=null,this.canvas=null,this._style=null,this._texture.destroy(void 0===e||e)}},61936:(e,t,n)=>{var i=n(70501),r=n(46192),s=n(65585);function o(e,t,n){s.call(this),this.uid=i.uid(),this.resolution=n||1,this.width=100,this.height=100,this.realWidth=100,this.realHeight=100,this.scaleMode=t||r.SCALE_MODES.DEFAULT,this.hasLoaded=!1,this.isLoading=!1,this.source=null,this.premultipliedAlpha=!0,this.imageUrl=null,this.isPowerOfTwo=!1,this.mipmap=!1,this._glTextures=[],e&&this.loadSource(e)}o.prototype=Object.create(s.prototype),o.prototype.constructor=o,e.exports=o,o.prototype.update=function(){this.realWidth=this.source.naturalWidth||this.source.width,this.realHeight=this.source.naturalHeight||this.source.height,this.width=this.realWidth/this.resolution,this.height=this.realHeight/this.resolution,this.isPowerOfTwo=i.isPowerOfTwo(this.realWidth,this.realHeight),this.emit("update",this)},o.prototype.loadSource=function(e){var t=this.isLoading;if(this.hasLoaded=!1,this.isLoading=!1,t&&this.source&&(this.source.onload=null,this.source.onerror=null),this.source=e,(this.source.complete||this.source.getContext)&&this.source.width&&this.source.height)this._sourceLoaded();else if(!e.getContext){this.isLoading=!0;var n=this;e.onload=function(){e.onload=null,e.onerror=null,n.isLoading&&(n.isLoading=!1,n._sourceLoaded(),n.emit("loaded",n))},e.onerror=function(){e.onload=null,e.onerror=null,n.isLoading&&(n.isLoading=!1,n.emit("error",n))},e.complete&&e.src&&(this.isLoading=!1,e.onload=null,e.onerror=null,e.width&&e.height?(this._sourceLoaded(),t&&this.emit("loaded",this)):t&&this.emit("error",this))}},o.prototype._sourceLoaded=function(){this.hasLoaded=!0,this.update()},o.prototype.destroy=function(){this.imageUrl?(delete i.BaseTextureCache[this.imageUrl],delete i.TextureCache[this.imageUrl],this.imageUrl=null,navigator.isCocoonJS||(this.source.src="")):this.source&&this.source._pixiId&&delete i.BaseTextureCache[this.source._pixiId],this.source=null,this.dispose()},o.prototype.dispose=function(){this.emit("dispose",this),this._glTextures.length=0},o.prototype.updateSourceImage=function(e){this.source.src=e,this.loadSource(this.source)},o.fromImage=function(e,t,n){var r=i.BaseTextureCache[e];if(void 0===t&&0!==e.indexOf("data:")&&(t=!0),!r){var s=new Image;t&&(s.crossOrigin=""),(r=new o(s,n)).imageUrl=e,s.src=e,i.BaseTextureCache[e]=r,r.resolution=i.getResolutionOfUrl(e)}return r},o.fromCanvas=function(e,t){e._pixiId||(e._pixiId="canvas_"+i.uid());var n=i.BaseTextureCache[e._pixiId];return n||(n=new o(e,t),i.BaseTextureCache[e._pixiId]=n),n}},57443:(e,t,n)=>{var i=n(61936),r=n(22699),s=n(97955),o=n(64598),a=n(61549),l=n(74650),u=n(46192),c=new l.Matrix;function d(e,t,n,c,d){if(!e)throw new Error("Unable to create RenderTexture, you must pass a renderer into the constructor.");t=t||100,n=n||100,d=d||u.RESOLUTION;var h=new i;if(h.width=t,h.height=n,h.resolution=d,h.scaleMode=c||u.SCALE_MODES.DEFAULT,h.hasLoaded=!0,r.call(this,h,new l.Rectangle(0,0,t,n)),this.width=t,this.height=n,this.resolution=d,this.render=null,this.renderer=e,this.renderer.type===u.RENDERER_TYPE.WEBGL){var p=this.renderer.gl;this.textureBuffer=new s(p,this.width,this.height,h.scaleMode,this.resolution),this.baseTexture._glTextures[p.id]=this.textureBuffer.texture,this.filterManager=new o(this.renderer),this.filterManager.onContextChange(),this.filterManager.resize(t,n),this.render=this.renderWebGL,this.renderer.currentRenderer.start(),this.renderer.currentRenderTarget.activate()}else this.render=this.renderCanvas,this.textureBuffer=new a(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this._updateUvs()}d.prototype=Object.create(r.prototype),d.prototype.constructor=d,e.exports=d,d.prototype.resize=function(e,t,n){e===this.width&&t===this.height||(this.valid=e>0&&t>0,this.width=this._frame.width=this.crop.width=e,this.height=this._frame.height=this.crop.height=t,n&&(this.baseTexture.width=this.width,this.baseTexture.height=this.height),this.valid&&(this.textureBuffer.resize(this.width,this.height),this.filterManager&&this.filterManager.resize(this.width,this.height)))},d.prototype.clear=function(){this.valid&&(this.renderer.type===u.RENDERER_TYPE.WEBGL&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},d.prototype.renderWebGL=function(e,t,n,i){if(this.valid){if(i=void 0===i||i,//!updateTransform;
this.textureBuffer.transform=t,this.textureBuffer.activate(),e.worldAlpha=1,i){e.worldTransform.identity(),e.currentBounds=null;var r,s,o=e.children;for(r=0,s=o.length;r<s;++r)o[r].updateTransform()}var a=this.renderer.filterManager;this.renderer.filterManager=this.filterManager,this.renderer.renderDisplayObject(e,this.textureBuffer,n),this.renderer.filterManager=a}},d.prototype.renderCanvas=function(e,t,n,i){if(this.valid){i=!!i;var r=c;r.identity(),t&&r.append(t),e.worldTransform=r;var s=e.worldTransform;e.worldAlpha=1;var o,a,l=e.children;for(o=0,a=l.length;o<a;++o)l[o].updateTransform();n&&this.textureBuffer.clear();var u=this.textureBuffer.context,d=this.renderer.resolution;this.renderer.resolution=this.resolution,this.renderer.renderDisplayObject(e,u),this.renderer.resolution=d,e.worldTransform=s}},d.prototype.destroy=function(){r.prototype.destroy.call(this,!0),this.textureBuffer.destroy(),this.filterManager&&this.filterManager.destroy(),this.renderer=null},d.prototype.getImage=function(){var e=new Image;return e.src=this.getBase64(),e},d.prototype.getBase64=function(){return this.getCanvas().toDataURL()},d.prototype.getCanvas=function(){if(this.renderer.type===u.RENDERER_TYPE.WEBGL){var e=this.renderer.gl,t=this.textureBuffer.size.width,n=this.textureBuffer.size.height,i=new Uint8Array(4*t*n);e.bindFramebuffer(e.FRAMEBUFFER,this.textureBuffer.frameBuffer),e.readPixels(0,0,t,n,e.RGBA,e.UNSIGNED_BYTE,i),e.bindFramebuffer(e.FRAMEBUFFER,null);var r=new a(t,n),s=r.context.getImageData(0,0,t,n);return s.data.set(i),r.context.putImageData(s,0,0),r.canvas}return this.textureBuffer.canvas},d.prototype.getPixels=function(){var e,t;if(this.renderer.type===u.RENDERER_TYPE.WEBGL){var n=this.renderer.gl;e=this.textureBuffer.size.width,t=this.textureBuffer.size.height;var i=new Uint8Array(4*e*t);return n.bindFramebuffer(n.FRAMEBUFFER,this.textureBuffer.frameBuffer),n.readPixels(0,0,e,t,n.RGBA,n.UNSIGNED_BYTE,i),n.bindFramebuffer(n.FRAMEBUFFER,null),i}return e=this.textureBuffer.canvas.width,t=this.textureBuffer.canvas.height,this.textureBuffer.canvas.getContext("2d").getImageData(0,0,e,t).data},d.prototype.getPixel=function(e,t){if(this.renderer.type===u.RENDERER_TYPE.WEBGL){var n=this.renderer.gl,i=new Uint8Array(4);return n.bindFramebuffer(n.FRAMEBUFFER,this.textureBuffer.frameBuffer),n.readPixels(e,t,1,1,n.RGBA,n.UNSIGNED_BYTE,i),n.bindFramebuffer(n.FRAMEBUFFER,null),i}return this.textureBuffer.canvas.getContext("2d").getImageData(e,t,1,1).data}},22699:(e,t,n)=>{var i=n(61936),r=n(3367),s=n(21507),o=n(65585),a=n(74650),l=n(70501);function u(e,t,n,i,r){o.call(this),this.noFrame=!1,t||(this.noFrame=!0,t=new a.Rectangle(0,0,1,1)),e instanceof u&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=i,this.valid=!1,this.requiresUpdate=!1,this._uvs=null,this.width=0,this.height=0,this.crop=n||t,this.rotate=!!r,e.hasLoaded?(this.noFrame&&(t=new a.Rectangle(0,0,e.width,e.height),e.on("update",this.onBaseTextureUpdated,this)),this.frame=t):e.once("loaded",this.onBaseTextureLoaded,this)}u.prototype=Object.create(o.prototype),u.prototype.constructor=u,e.exports=u,Object.defineProperties(u.prototype,{frame:{get:function(){return this._frame},set:function(e){if(this._frame=e,this.noFrame=!1,this.width=e.width,this.height=e.height,!this.trim&&!this.rotate&&(e.x+e.width>this.baseTexture.width||e.y+e.height>this.baseTexture.height))throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=e&&e.width&&e.height&&this.baseTexture.hasLoaded,this.trim?(this.width=this.trim.width,this.height=this.trim.height,this._frame.width=this.trim.width,this._frame.height=this.trim.height):this.crop=e,this.valid&&this._updateUvs()}}}),u.prototype.update=function(){this.baseTexture.update()},u.prototype.onBaseTextureLoaded=function(e){this.noFrame?this.frame=new a.Rectangle(0,0,e.width,e.height):this.frame=this._frame,this.emit("update",this)},u.prototype.onBaseTextureUpdated=function(e){this._frame.width=e.width,this._frame.height=e.height,this.emit("update",this)},u.prototype.destroy=function(e){this.baseTexture&&(e&&this.baseTexture.destroy(),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture.off("loaded",this.onBaseTextureLoaded,this),this.baseTexture=null),this._frame=null,this._uvs=null,this.trim=null,this.crop=null,this.valid=!1,this.off("dispose",this.dispose,this),this.off("update",this.update,this)},u.prototype.clone=function(){return new u(this.baseTexture,this.frame,this.crop,this.trim,this.rotate)},u.prototype._updateUvs=function(){this._uvs||(this._uvs=new s),this._uvs.set(this.crop,this.baseTexture,this.rotate)},u.fromImage=function(e,t,n){var r=l.TextureCache[e];return r||(r=new u(i.fromImage(e,t,n)),l.TextureCache[e]=r),r},u.fromFrame=function(e){var t=l.TextureCache[e];if(!t)throw new Error('The frameId "'+e+'" does not exist in the texture cache');return t},u.fromCanvas=function(e,t){return new u(i.fromCanvas(e,t))},u.fromVideo=function(e,t){return"string"==typeof e?u.fromVideoUrl(e,t):new u(r.fromVideo(e,t))},u.fromVideoUrl=function(e,t){return new u(r.fromUrl(e,t))},u.addTextureToCache=function(e,t){l.TextureCache[t]=e},u.removeTextureFromCache=function(e){var t=l.TextureCache[e];return delete l.TextureCache[e],delete l.BaseTextureCache[e],t},u.EMPTY=new u(new i)},21507:e=>{function t(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1}e.exports=t,t.prototype.set=function(e,t,n){var i=t.width,r=t.height;n?(this.x0=(e.x+e.height)/i,this.y0=e.y/r,this.x1=(e.x+e.height)/i,this.y1=(e.y+e.width)/r,this.x2=e.x/i,this.y2=(e.y+e.width)/r,this.x3=e.x/i,this.y3=e.y/r):(this.x0=e.x/i,this.y0=e.y/r,this.x1=(e.x+e.width)/i,this.y1=e.y/r,this.x2=(e.x+e.width)/i,this.y2=(e.y+e.height)/r,this.x3=e.x/i,this.y3=(e.y+e.height)/r)}},3367:(e,t,n)=>{var i=n(61936),r=n(70501);function s(e,t){if(!e)throw new Error("No video source element specified.");(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),i.call(this,e,t),this.autoUpdate=!1,this._onUpdate=this._onUpdate.bind(this),this._onCanPlay=this._onCanPlay.bind(this),e.complete||(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("play",this._onPlayStart.bind(this)),e.addEventListener("pause",this._onPlayStop.bind(this))),this.__loaded=!1}function o(e,t){t||(t="video/"+e.substr(e.lastIndexOf(".")+1));var n=document.createElement("source");return n.src=e,n.type=t,n}s.prototype=Object.create(i.prototype),s.prototype.constructor=s,e.exports=s,s.prototype._onUpdate=function(){this.autoUpdate&&(window.requestAnimationFrame(this._onUpdate),this.update())},s.prototype._onPlayStart=function(){this.autoUpdate||(window.requestAnimationFrame(this._onUpdate),this.autoUpdate=!0)},s.prototype._onPlayStop=function(){this.autoUpdate=!1},s.prototype._onCanPlay=function(){this.hasLoaded=!0,this.source&&(this.source.removeEventListener("canplay",this._onCanPlay),this.source.removeEventListener("canplaythrough",this._onCanPlay),this.width=this.source.videoWidth,this.height=this.source.videoHeight,this.source.play(),this.__loaded||(this.__loaded=!0,this.emit("loaded",this)))},s.prototype.destroy=function(){this.source&&this.source._pixiId&&(delete r.BaseTextureCache[this.source._pixiId],delete this.source._pixiId),i.prototype.destroy.call(this)},s.fromVideo=function(e,t){e._pixiId||(e._pixiId="video_"+r.uid());var n=r.BaseTextureCache[e._pixiId];return n||(n=new s(e,t),r.BaseTextureCache[e._pixiId]=n),n},s.fromUrl=function(e,t){var n=document.createElement("video");if(Array.isArray(e))for(var i=0;i<e.length;++i)n.appendChild(o(e[i].src||e[i],e[i].mime));else n.appendChild(o(e.src||e,e.mime));return n.load(),n.play(),s.fromVideo(n,t)},s.fromUrls=s.fromUrl},17974:(e,t,n)=>{var i=n(46192),r=n(65585),s="tick";function o(){var e=this;this._tick=function(t){e._requestId=null,e.started&&(e.update(t),e.started&&null===e._requestId&&e._emitter.listeners(s,!0)&&(e._requestId=requestAnimationFrame(e._tick)))},this._emitter=new r,this._requestId=null,this._maxElapsedMS=100,this.autoStart=!1,this.deltaTime=1,this.elapsedMS=1/i.TARGET_FPMS,this.lastTime=0,this.speed=1,this.started=!1}Object.defineProperties(o.prototype,{FPS:{get:function(){return 1e3/this.elapsedMS}},minFPS:{get:function(){return 1e3/this._maxElapsedMS},set:function(e){var t=Math.min(Math.max(0,e)/1e3,i.TARGET_FPMS);this._maxElapsedMS=1/t}}}),o.prototype._requestIfNeeded=function(){null===this._requestId&&this._emitter.listeners(s,!0)&&(this.lastTime=performance.now(),this._requestId=requestAnimationFrame(this._tick))},o.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},o.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},o.prototype.add=function(e,t){return this._emitter.on(s,e,t),this._startIfPossible(),this},o.prototype.addOnce=function(e,t){return this._emitter.once(s,e,t),this._startIfPossible(),this},o.prototype.remove=function(e,t){return this._emitter.off(s,e,t),this._emitter.listeners(s,!0)||this._cancelIfNeeded(),this},o.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},o.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},o.prototype.update=function(e){var t;e=e||performance.now(),(t=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(t=this._maxElapsedMS),this.deltaTime=t*i.TARGET_FPMS*this.speed,this._emitter.emit(s,this.deltaTime),this.lastTime=e},e.exports=o},2410:(e,t,n)=>{var i=n(17974),r=new i;r.autoStart=!0,e.exports={shared:r,Ticker:i}},70501:(e,t,n)=>{var i=n(46192),r=e.exports={_uid:0,_saidHello:!1,EventEmitter:n(65585),pluginTarget:n(17987),async:n(44083),uid:function(){return++r._uid},hex2rgb:function(e,t){return(t=t||[])[0]=(e>>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t},hex2string:function(e){return e=e.toString(16),"#"+(e="000000".substr(0,6-e.length)+e)},rgb2hex:function(e){return(255*e[0]<<16)+(255*e[1]<<8)+255*e[2]},canUseNewCanvasBlendModes:function(){if("undefined"==typeof document)return!1;var e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",t="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",n=new Image;n.src=e+"AP804Oa6"+t;var i=new Image;i.src=e+"/wCKxvRF"+t;var r=document.createElement("canvas");r.width=6,r.height=1;var s=r.getContext("2d");s.globalCompositeOperation="multiply",s.drawImage(n,0,0),s.drawImage(i,2,0);var o=s.getImageData(2,0,1,1).data;return 255===o[0]&&0===o[1]&&0===o[2]},getNextPowerOfTwo:function(e){if(e>0&&!(e&e-1))return e;for(var t=1;t<e;)t<<=1;return t},isPowerOfTwo:function(e,t){return e>0&&!(e&e-1)&&t>0&&!(t&t-1)},getResolutionOfUrl:function(e){var t=i.RETINA_PREFIX.exec(e);return t?parseFloat(t[1]):1},sayHello:function(e){if(!r._saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var t=["\n %c %c %c Pixi.js "+i.VERSION+" - ✰ "+e+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];window.console.log.apply(console,t)}else window.console&&window.console.log("Pixi.js "+i.VERSION+" - "+e+" - http://www.pixijs.com/");r._saidHello=!0}},isWebGLSupported:function(){var e={stencil:!0};try{if(!window.WebGLRenderingContext)return!1;var t=document.createElement("canvas"),n=t.getContext("webgl",e)||t.getContext("experimental-webgl",e);return!(!n||!n.getContextAttributes().stencil)}catch(e){return!1}},sign:function(e){return e?e<0?-1:1:0},TextureCache:{},BaseTextureCache:{}}},17987:e=>{e.exports={mixin:function(e){!function(e){e.__plugins={},e.registerPlugin=function(t,n){e.__plugins[t]=n},e.prototype.initPlugins=function(){for(var t in this.plugins=this.plugins||{},e.__plugins)this.plugins[t]=new e.__plugins[t](this)},e.prototype.destroyPlugins=function(){for(var e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null;this.plugins=null}}(e)}}},49513:(e,t,n)=>{var i=n(44651),r=n(38653),s=n(63323),o=n(38319);i.SpriteBatch=function(){throw new ReferenceError("SpriteBatch does not exist any more, please use the new ParticleContainer instead.")},i.AssetLoader=function(){throw new ReferenceError("The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.")},Object.defineProperties(i,{Stage:{get:function(){return console.warn("You do not need to use a PIXI Stage any more, you can simply render any container."),i.Container}},DisplayObjectContainer:{get:function(){return console.warn("DisplayObjectContainer has been shortened to Container, please use Container from now on."),i.Container}},Strip:{get:function(){return console.warn("The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on."),r.Mesh}},Rope:{get:function(){return console.warn("The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on."),r.Rope}},MovieClip:{get:function(){return console.warn("The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on."),s.MovieClip}},TilingSprite:{get:function(){return console.warn("The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on."),s.TilingSprite}},BitmapText:{get:function(){return console.warn("The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on."),s.BitmapText}},blendModes:{get:function(){return console.warn("The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on."),i.BLEND_MODES}},scaleModes:{get:function(){return console.warn("The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on."),i.SCALE_MODES}},BaseTextureCache:{get:function(){return console.warn("The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on."),i.utils.BaseTextureCache}},TextureCache:{get:function(){return console.warn("The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on."),i.utils.TextureCache}},math:{get:function(){return console.warn("The math namespace is deprecated, please access members already accessible on PIXI."),i}}}),i.Sprite.prototype.setTexture=function(e){this.texture=e,console.warn("setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;")},s.BitmapText.prototype.setText=function(e){this.text=e,console.warn("setText is now deprecated, please use the text property, e.g : myBitmapText.text = 'my text';")},i.Text.prototype.setText=function(e){this.text=e,console.warn("setText is now deprecated, please use the text property, e.g : myText.text = 'my text';")},i.Text.prototype.setStyle=function(e){this.style=e,console.warn("setStyle is now deprecated, please use the style property, e.g : myText.style = style;")},i.Texture.prototype.setFrame=function(e){this.frame=e,console.warn("setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;")},Object.defineProperties(o,{AbstractFilter:{get:function(){return console.warn("filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on."),i.AbstractFilter}},FXAAFilter:{get:function(){return console.warn("filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on."),i.FXAAFilter}},SpriteMaskFilter:{get:function(){return console.warn("filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on."),i.SpriteMaskFilter}}}),i.utils.uuid=function(){return console.warn("utils.uuid() is deprecated, please use utils.uid() from now on."),i.utils.uid()}},23635:(e,t,n)=>{var i=n(44651);function r(e,t){i.Container.call(this),t=t||{},this.textWidth=0,this.textHeight=0,this._glyphs=[],this._font={tint:void 0!==t.tint?t.tint:16777215,align:t.align||"left",name:null,size:0},this.font=t.font,this._text=e,this.maxWidth=0,this.maxLineHeight=0,this.dirty=!1,this.updateText()}r.prototype=Object.create(i.Container.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{tint:{get:function(){return this._font.tint},set:function(e){this._font.tint="number"==typeof e&&e>=0?e:16777215,this.dirty=!0}},align:{get:function(){return this._font.align},set:function(e){this._font.align=e||"left",this.dirty=!0}},font:{get:function(){return this._font},set:function(e){e&&("string"==typeof e?(e=e.split(" "),this._font.name=1===e.length?e[0]:e.slice(1).join(" "),this._font.size=e.length>=2?parseInt(e[0],10):r.fonts[this._font.name].size):(this._font.name=e.name,this._font.size="number"==typeof e.size?e.size:parseInt(e.size,10)),this.dirty=!0)}},text:{get:function(){return this._text},set:function(e){e=e.toString()||" ",this._text!==e&&(this._text=e,this.dirty=!0)}}}),r.prototype.updateText=function(){for(var e=r.fonts[this._font.name],t=new i.Point,n=null,s=[],o=0,a=0,l=[],u=0,c=this._font.size/e.size,d=-1,h=0,p=0;p<this.text.length;p++){var f=this.text.charCodeAt(p);if(d=/(\s)/.test(this.text.charAt(p))?p:d,/(?:\r\n|\r|\n)/.test(this.text.charAt(p)))l.push(o),a=Math.max(a,o),u++,t.x=0,t.y+=e.lineHeight,n=null;else if(-1!==d&&this.maxWidth>0&&t.x*c>this.maxWidth)s.splice(d,p-d),p=d,d=-1,l.push(o),a=Math.max(a,o),u++,t.x=0,t.y+=e.lineHeight,n=null;else{var m=e.chars[f];m&&(n&&m.kerning[n]&&(t.x+=m.kerning[n]),s.push({texture:m.texture,line:u,charCode:f,position:new i.Point(t.x+m.xOffset,t.y+m.yOffset)}),o=t.x+(m.texture.width+m.xOffset),t.x+=m.xAdvance,h=Math.max(h,m.yOffset+m.texture.height),n=f)}}l.push(o),a=Math.max(a,o);var g=[];for(p=0;p<=u;p++){var y=0;"right"===this._font.align?y=a-l[p]:"center"===this._font.align&&(y=(a-l[p])/2),g.push(y)}var _=s.length,v=this.tint;for(p=0;p<_;p++){var b=this._glyphs[p];b?b.texture=s[p].texture:(b=new i.Sprite(s[p].texture),this._glyphs.push(b)),b.position.x=(s[p].position.x+g[s[p].line])*c,b.position.y=s[p].position.y*c,b.scale.x=b.scale.y=c,b.tint=v,b.parent||this.addChild(b)}for(p=_;p<this._glyphs.length;++p)this.removeChild(this._glyphs[p]);this.textWidth=a*c,this.textHeight=(t.y+e.lineHeight)*c,this.maxLineHeight=h*c},r.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},r.prototype.getLocalBounds=function(){return this.validate(),i.Container.prototype.getLocalBounds.call(this)},r.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},r.fonts={}},47901:(e,t,n)=>{var i=n(44651);function r(e){i.Sprite.call(this,e[0]instanceof i.Texture?e[0]:e[0].texture),this._textures=null,this._durations=null,this.textures=e,this.animationSpeed=1,this.loop=!0,this.onComplete=null,this._currentTime=0,this.playing=!1}r.prototype=Object.create(i.Sprite.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{totalFrames:{get:function(){return this._textures.length}},textures:{get:function(){return this._textures},set:function(e){if(e[0]instanceof i.Texture)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(var t=0;t<e.length;t++)this._textures.push(e[t].texture),this._durations.push(e[t].time)}}},currentFrame:{get:function(){var e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e}}}),r.prototype.stop=function(){this.playing&&(this.playing=!1,i.ticker.shared.remove(this.update,this))},r.prototype.play=function(){this.playing||(this.playing=!0,i.ticker.shared.add(this.update,this))},r.prototype.gotoAndStop=function(e){this.stop(),this._currentTime=e,this._texture=this._textures[this.currentFrame]},r.prototype.gotoAndPlay=function(e){this._currentTime=e,this.play()},r.prototype.update=function(e){var t=this.animationSpeed*e;if(null!==this._durations){var n=this._currentTime%1*this._durations[this.currentFrame];for(n+=t/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];var i=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*i,this._currentTime+=i;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=t;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):this._texture=this._textures[this.currentFrame]},r.prototype.destroy=function(){this.stop(),i.Sprite.prototype.destroy.call(this)},r.fromFrames=function(e){for(var t=[],n=0;n<e.length;++n)t.push(new i.Texture.fromFrame(e[n]));return new r(t)},r.fromImages=function(e){for(var t=[],n=0;n<e.length;++n)t.push(new i.Texture.fromImage(e[n]));return new r(t)}},77377:(e,t,n)=>{var i=n(44651),r=new i.Point,s=n(87809);function o(e,t,n){i.Sprite.call(this,e),this.tileScale=new i.Point(1,1),this.tilePosition=new i.Point(0,0),this._width=t||100,this._height=n||100,this._uvs=new i.TextureUvs,this._canvasPattern=null,this.shader=new i.AbstractFilter(["precision lowp float;","attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec4 aColor;","uniform mat3 projectionMatrix;","uniform vec4 uFrame;","uniform vec4 uTransform;","varying vec2 vTextureCoord;","varying vec4 vColor;","void main(void){"," gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);"," vec2 coord = aTextureCoord;"," coord -= uTransform.xy;"," coord /= uTransform.zw;"," vTextureCoord = coord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);","}"].join("\n"),["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform vec4 uFrame;","uniform vec2 uPixelSize;","void main(void){"," vec2 coord = mod(vTextureCoord, uFrame.zw);"," coord = clamp(coord, uPixelSize, uFrame.zw - uPixelSize);"," coord += uFrame.xy;"," gl_FragColor = texture2D(uSampler, coord) * vColor ;","}"].join("\n"),{uFrame:{type:"4fv",value:[0,0,1,1]},uTransform:{type:"4fv",value:[0,0,1,1]},uPixelSize:{type:"2fv",value:[1,1]}})}o.prototype=Object.create(i.Sprite.prototype),o.prototype.constructor=o,e.exports=o,Object.defineProperties(o.prototype,{width:{get:function(){return this._width},set:function(e){this._width=e}},height:{get:function(){return this._height},set:function(e){this._height=e}}}),o.prototype._onTextureUpdate=function(){},o.prototype._renderWebGL=function(e){var t=this._texture;if(t&&t._uvs){var n=t._uvs,i=t._frame.width,r=t._frame.height,s=t.baseTexture.width,o=t.baseTexture.height;t._uvs=this._uvs,t._frame.width=this.width,t._frame.height=this.height,this.shader.uniforms.uPixelSize.value[0]=1/s,this.shader.uniforms.uPixelSize.value[1]=1/o,this.shader.uniforms.uFrame.value[0]=n.x0,this.shader.uniforms.uFrame.value[1]=n.y0,this.shader.uniforms.uFrame.value[2]=n.x1-n.x0,this.shader.uniforms.uFrame.value[3]=n.y2-n.y0,this.shader.uniforms.uTransform.value[0]=this.tilePosition.x%(i*this.tileScale.x)/this._width,this.shader.uniforms.uTransform.value[1]=this.tilePosition.y%(r*this.tileScale.y)/this._height,this.shader.uniforms.uTransform.value[2]=s/this._width*this.tileScale.x,this.shader.uniforms.uTransform.value[3]=o/this._height*this.tileScale.y,e.setObjectRenderer(e.plugins.sprite),e.plugins.sprite.render(this),t._uvs=n,t._frame.width=i,t._frame.height=r}},o.prototype._renderCanvas=function(e){var t=this._texture;if(t.baseTexture.hasLoaded){var n=e.context,r=this.worldTransform,o=e.resolution,a=t.baseTexture,l=this.tilePosition.x/this.tileScale.x%t._frame.width,u=this.tilePosition.y/this.tileScale.y%t._frame.height;if(!this._canvasPattern){var c=new i.CanvasBuffer(t._frame.width,t._frame.height);16777215!==this.tint?(this.cachedTint!==this.tint&&(this.cachedTint=this.tint,this.tintedTexture=s.getTintedTexture(this,this.tint)),c.context.drawImage(this.tintedTexture,0,0)):c.context.drawImage(a.source,-t._frame.x,-t._frame.y),this._canvasPattern=c.context.createPattern(c.canvas,"repeat")}n.globalAlpha=this.worldAlpha,n.setTransform(r.a*o,r.b*o,r.c*o,r.d*o,r.tx*o,r.ty*o),n.scale(this.tileScale.x,this.tileScale.y),n.translate(l+this.anchor.x*-this._width,u+this.anchor.y*-this._height);var d=e.blendModes[this.blendMode];d!==e.context.globalCompositeOperation&&(n.globalCompositeOperation=d),n.fillStyle=this._canvasPattern,n.fillRect(-l,-u,this._width/this.tileScale.x,this._height/this.tileScale.y)}},o.prototype.getBounds=function(){var e,t,n,i,r=this._width,s=this._height,o=r*(1-this.anchor.x),a=r*-this.anchor.x,l=s*(1-this.anchor.y),u=s*-this.anchor.y,c=this.worldTransform,d=c.a,h=c.b,p=c.c,f=c.d,m=c.tx,g=c.ty,y=d*a+p*u+m,_=f*u+h*a+g,v=d*o+p*u+m,b=f*u+h*o+g,T=d*o+p*l+m,x=f*l+h*o+g,E=d*a+p*l+m,w=f*l+h*a+g;e=E<(e=T<(e=v<(e=y)?v:e)?T:e)?E:e,n=w<(n=x<(n=b<(n=_)?b:n)?x:n)?w:n,t=E>(t=T>(t=v>(t=y)?v:t)?T:t)?E:t,i=w>(i=x>(i=b>(i=_)?b:i)?x:i)?w:i;var I=this._bounds;return I.x=e,I.width=t-e,I.y=n,I.height=i-n,this._currentBounds=I,I},o.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,r);var t,n=this._width,i=this._height,s=-n*this.anchor.x;return r.x>s&&r.x<s+n&&(t=-i*this.anchor.y,r.y>t&&r.y<t+i)},o.prototype.destroy=function(){i.Sprite.prototype.destroy.call(this),this.tileScale=null,this._tileScaleOffset=null,this.tilePosition=null,this._uvs=null},o.fromFrame=function(e,t,n){var r=i.utils.TextureCache[e];if(!r)throw new Error('The frameId "'+e+'" does not exist in the texture cache '+this);return new o(r,t,n)},o.fromImage=function(e,t,n,r,s){return new o(i.Texture.fromImage(e,r,s),t,n)}},94262:(e,t,n)=>{var i=n(44651),r=i.DisplayObject,s=new i.Matrix;r.prototype._cacheAsBitmap=!1,r.prototype._originalRenderWebGL=null,r.prototype._originalRenderCanvas=null,r.prototype._originalUpdateTransform=null,r.prototype._originalHitTest=null,r.prototype._originalDestroy=null,r.prototype._cachedSprite=null,Object.defineProperties(r.prototype,{cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(e){this._cacheAsBitmap!==e&&(this._cacheAsBitmap=e,e?(this._originalRenderWebGL=this.renderWebGL,this._originalRenderCanvas=this.renderCanvas,this._originalUpdateTransform=this.updateTransform,this._originalGetBounds=this.getBounds,this._originalDestroy=this.destroy,this._originalContainsPoint=this.containsPoint,this.renderWebGL=this._renderCachedWebGL,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(this._cachedSprite&&this._destroyCachedDisplayObject(),this.renderWebGL=this._originalRenderWebGL,this.renderCanvas=this._originalRenderCanvas,this.getBounds=this._originalGetBounds,this.destroy=this._originalDestroy,this.updateTransform=this._originalUpdateTransform,this.containsPoint=this._originalContainsPoint))}}}),r.prototype._renderCachedWebGL=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(e),this._cachedSprite.worldAlpha=this.worldAlpha,e.setObjectRenderer(e.plugins.sprite),e.plugins.sprite.render(this._cachedSprite))},r.prototype._initCachedDisplayObject=function(e){if(!this._cachedSprite){e.currentRenderer.flush();var t=this.getLocalBounds().clone();if(this._filters){var n=this._filters[0].padding;t.x-=n,t.y-=n,t.width+=2*n,t.height+=2*n}var r=e.currentRenderTarget,o=e.filterManager.filterStack,a=new i.RenderTexture(e,0|t.width,0|t.height),l=s;l.tx=-t.x,l.ty=-t.y,this.renderWebGL=this._originalRenderWebGL,a.render(this,l,!0,!0),e.setRenderTarget(r),e.filterManager.filterStack=o,this.renderWebGL=this._renderCachedWebGL,this.updateTransform=this.displayObjectUpdateTransform,this.getBounds=this._getCachedBounds,this._cachedSprite=new i.Sprite(a),this._cachedSprite.worldTransform=this.worldTransform,this._cachedSprite.anchor.x=-t.x/t.width,this._cachedSprite.anchor.y=-t.y/t.height,this.updateTransform(),this.containsPoint=this._cachedSprite.containsPoint.bind(this._cachedSprite)}},r.prototype._renderCachedCanvas=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(e),this._cachedSprite.worldAlpha=this.worldAlpha,this._cachedSprite.renderCanvas(e))},r.prototype._initCachedDisplayObjectCanvas=function(e){if(!this._cachedSprite){var t=this.getLocalBounds(),n=e.context,r=new i.RenderTexture(e,0|t.width,0|t.height),o=s;o.tx=-t.x,o.ty=-t.y,this.renderCanvas=this._originalRenderCanvas,r.render(this,o,!0),e.context=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.getBounds=this._getCachedBounds,this._cachedSprite=new i.Sprite(r),this._cachedSprite.worldTransform=this.worldTransform,this._cachedSprite.anchor.x=-t.x/t.width,this._cachedSprite.anchor.y=-t.y/t.height,this.updateTransform(),this.containsPoint=this._cachedSprite.containsPoint.bind(this._cachedSprite)}},r.prototype._getCachedBounds=function(){return this._cachedSprite._currentBounds=null,this._cachedSprite.getBounds()},r.prototype._destroyCachedDisplayObject=function(){this._cachedSprite._texture.destroy(),this._cachedSprite=null},r.prototype._cacheAsBitmapDestroy=function(){this.cacheAsBitmap=!1,this._originalDestroy()}},37231:(e,t,n)=>{var i=n(44651);i.DisplayObject.prototype.name=null,i.Container.prototype.getChildByName=function(e){for(var t=0;t<this.children.length;t++)if(this.children[t].name===e)return this.children[t];return null}},34247:(e,t,n)=>{var i=n(44651);i.DisplayObject.prototype.getGlobalPosition=function(e){return e=e||new i.Point,this.parent?(this.displayObjectUpdateTransform(),e.x=this.worldTransform.tx,e.y=this.worldTransform.ty):(e.x=this.position.x,e.y=this.position.y),e}},63323:(e,t,n)=>{
/**
* @file Main export of the PIXI extras library
* @author Mat Groves <mat@goodboydigital.com>
* @copyright 2013-2015 GoodBoyDigital
* @license {@link https://github.com/pixijs/pixi.js/blob/master/LICENSE|MIT License}
*/
n(94262),n(37231),n(34247),e.exports={MovieClip:n(47901),TilingSprite:n(77377),BitmapText:n(23635)}},64350:(e,t,n)=>{var i=n(44651),r=n(9496);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//ascii.frag","utf8"),{dimensions:{type:"4fv",value:new Float32Array([0,0,0,0])},pixelSize:{type:"1f",value:8}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{size:{get:function(){return this.uniforms.pixelSize.value},set:function(e){this.uniforms.pixelSize.value=e}}})},5966:(e,t,n)=>{var i=n(44651),r=n(34356),s=n(63779);function o(){i.AbstractFilter.call(this),this.blurXFilter=new r,this.blurYFilter=new s,this.defaultFilter=new i.AbstractFilter}o.prototype=Object.create(i.AbstractFilter.prototype),o.prototype.constructor=o,e.exports=o,o.prototype.applyFilter=function(e,t,n){var r=e.filterManager.getRenderTarget(!0);this.defaultFilter.applyFilter(e,t,n),this.blurXFilter.applyFilter(e,t,r),e.blendModeManager.setBlendMode(i.BLEND_MODES.SCREEN),this.blurYFilter.applyFilter(e,r,n),e.blendModeManager.setBlendMode(i.BLEND_MODES.NORMAL),e.filterManager.returnRenderTarget(r)},Object.defineProperties(o.prototype,{blur:{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=this.blurYFilter.blur=e}},blurX:{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=e}},blurY:{get:function(){return this.blurYFilter.blur},set:function(e){this.blurYFilter.blur=e}}})},10415:(e,t,n)=>{var i=n(44651),r=n(26786);function s(e,t){i.AbstractFilter.call(this,r.readFileSync("//blurDir.vert","utf8"),r.readFileSync("//blurDir.frag","utf8"),{strength:{type:"1f",value:1},dirX:{type:"1f",value:e||0},dirY:{type:"1f",value:t||0}}),this.defaultFilter=new i.AbstractFilter,this.passes=1,this.dirX=e||0,this.dirY=t||0,this.strength=4}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.applyFilter=function(e,t,n,i){var r=this.getShader(e);if(this.uniforms.strength.value=this.strength/4/this.passes*(t.frame.width/t.size.width),1===this.passes)e.filterManager.applyFilter(r,t,n,i);else{var s=e.filterManager.getRenderTarget(!0);e.filterManager.applyFilter(r,t,s,i);for(var o=0;o<this.passes-2;o++)e.filterManager.applyFilter(r,s,s,i);e.filterManager.applyFilter(r,s,n,i),e.filterManager.returnRenderTarget(s)}},Object.defineProperties(s.prototype,{blur:{get:function(){return this.strength},set:function(e){this.padding=.5*e,this.strength=e}},dirX:{get:function(){return this.dirX},set:function(e){this.uniforms.dirX.value=e}},dirY:{get:function(){return this.dirY},set:function(e){this.uniforms.dirY.value=e}}})},16762:(e,t,n)=>{var i=n(44651),r=n(34356),s=n(63779);function o(){i.AbstractFilter.call(this),this.blurXFilter=new r,this.blurYFilter=new s}o.prototype=Object.create(i.AbstractFilter.prototype),o.prototype.constructor=o,e.exports=o,o.prototype.applyFilter=function(e,t,n){var i=e.filterManager.getRenderTarget(!0);this.blurXFilter.applyFilter(e,t,i),this.blurYFilter.applyFilter(e,i,n),e.filterManager.returnRenderTarget(i)},Object.defineProperties(o.prototype,{blur:{get:function(){return this.blurXFilter.blur},set:function(e){this.padding=.5*Math.abs(e),this.blurXFilter.blur=this.blurYFilter.blur=e}},passes:{get:function(){return this.blurXFilter.passes},set:function(e){this.blurXFilter.passes=this.blurYFilter.passes=e}},blurX:{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=e}},blurY:{get:function(){return this.blurYFilter.blur},set:function(e){this.blurYFilter.blur=e}}})},34356:(e,t,n)=>{var i=n(44651),r=n(26786);function s(){i.AbstractFilter.call(this,r.readFileSync("//blurX.vert","utf8"),r.readFileSync("//blur.frag","utf8"),{strength:{type:"1f",value:1}}),this.passes=1,this.strength=4}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.applyFilter=function(e,t,n,i){var r=this.getShader(e);if(this.uniforms.strength.value=this.strength/4/this.passes*(t.frame.width/t.size.width),1===this.passes)e.filterManager.applyFilter(r,t,n,i);else{for(var s=e.filterManager.getRenderTarget(!0),o=t,a=s,l=0;l<this.passes-1;l++){e.filterManager.applyFilter(r,o,a,!0);var u=a;a=o,o=u}e.filterManager.applyFilter(r,o,n,i),e.filterManager.returnRenderTarget(s)}},Object.defineProperties(s.prototype,{blur:{get:function(){return this.strength},set:function(e){this.padding=.5*Math.abs(e),this.strength=e}}})},63779:(e,t,n)=>{var i=n(44651),r=n(26786);function s(){i.AbstractFilter.call(this,r.readFileSync("//blurY.vert","utf8"),r.readFileSync("//blur.frag","utf8"),{strength:{type:"1f",value:1}}),this.passes=1,this.strength=4}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.applyFilter=function(e,t,n,i){var r=this.getShader(e);if(this.uniforms.strength.value=Math.abs(this.strength)/4/this.passes*(t.frame.height/t.size.height),1===this.passes)e.filterManager.applyFilter(r,t,n,i);else{for(var s=e.filterManager.getRenderTarget(!0),o=t,a=s,l=0;l<this.passes-1;l++){e.filterManager.applyFilter(r,o,a,!0);var u=a;a=o,o=u}e.filterManager.applyFilter(r,o,n,i),e.filterManager.returnRenderTarget(s)}},Object.defineProperties(s.prototype,{blur:{get:function(){return this.strength},set:function(e){this.padding=.5*Math.abs(e),this.strength=e}}})},81327:(e,t,n)=>{var i=n(44651),r=n(26786);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//smartBlur.frag","utf8"),{delta:{type:"v2",value:{x:.1,y:0}}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s},19375:(e,t,n)=>{var i=n(44651),r=n(48884);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//colorMatrix.frag","utf8"),{m:{type:"1fv",value:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,s.prototype._loadMatrix=function(e,t){var n=e;(t=!!t)&&(this._multiply(n,this.uniforms.m.value,e),n=this._colorMatrix(n)),this.uniforms.m.value=n},s.prototype._multiply=function(e,t,n){return e[0]=t[0]*n[0]+t[1]*n[5]+t[2]*n[10]+t[3]*n[15],e[1]=t[0]*n[1]+t[1]*n[6]+t[2]*n[11]+t[3]*n[16],e[2]=t[0]*n[2]+t[1]*n[7]+t[2]*n[12]+t[3]*n[17],e[3]=t[0]*n[3]+t[1]*n[8]+t[2]*n[13]+t[3]*n[18],e[4]=t[0]*n[4]+t[1]*n[9]+t[2]*n[14]+t[3]*n[19],e[5]=t[5]*n[0]+t[6]*n[5]+t[7]*n[10]+t[8]*n[15],e[6]=t[5]*n[1]+t[6]*n[6]+t[7]*n[11]+t[8]*n[16],e[7]=t[5]*n[2]+t[6]*n[7]+t[7]*n[12]+t[8]*n[17],e[8]=t[5]*n[3]+t[6]*n[8]+t[7]*n[13]+t[8]*n[18],e[9]=t[5]*n[4]+t[6]*n[9]+t[7]*n[14]+t[8]*n[19],e[10]=t[10]*n[0]+t[11]*n[5]+t[12]*n[10]+t[13]*n[15],e[11]=t[10]*n[1]+t[11]*n[6]+t[12]*n[11]+t[13]*n[16],e[12]=t[10]*n[2]+t[11]*n[7]+t[12]*n[12]+t[13]*n[17],e[13]=t[10]*n[3]+t[11]*n[8]+t[12]*n[13]+t[13]*n[18],e[14]=t[10]*n[4]+t[11]*n[9]+t[12]*n[14]+t[13]*n[19],e[15]=t[15]*n[0]+t[16]*n[5]+t[17]*n[10]+t[18]*n[15],e[16]=t[15]*n[1]+t[16]*n[6]+t[17]*n[11]+t[18]*n[16],e[17]=t[15]*n[2]+t[16]*n[7]+t[17]*n[12]+t[18]*n[17],e[18]=t[15]*n[3]+t[16]*n[8]+t[17]*n[13]+t[18]*n[18],e[19]=t[15]*n[4]+t[16]*n[9]+t[17]*n[14]+t[18]*n[19],e},s.prototype._colorMatrix=function(e){var t=new Float32Array(e);return t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t},s.prototype.brightness=function(e,t){var n=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(n,t)},s.prototype.greyscale=function(e,t){var n=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(n,t)},s.prototype.grayscale=s.prototype.greyscale,s.prototype.blackAndWhite=function(e){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],e)},s.prototype.hue=function(e,t){e=(e||0)/180*Math.PI;var n=Math.cos(e),i=Math.sin(e),r=.213,s=.715,o=.072,a=[r+.787*n+i*-r,s+n*-s+i*-s,o+n*-o+.928*i,0,0,r+n*-r+.143*i,s+n*(1-s)+.14*i,o+n*-o+-.283*i,0,0,r+n*-r+-.787*i,s+n*-s+i*s,o+.928*n+i*o,0,0,0,0,0,1,0];this._loadMatrix(a,t)},s.prototype.contrast=function(e,t){var n=(e||0)+1,i=-128*(n-1),r=[n,0,0,0,i,0,n,0,0,i,0,0,n,0,i,0,0,0,1,0];this._loadMatrix(r,t)},s.prototype.saturate=function(e,t){var n=2*(e||0)/3+1,i=-.5*(n-1),r=[n,i,i,0,0,i,n,i,0,0,i,i,n,0,0,0,0,0,1,0];this._loadMatrix(r,t)},s.prototype.desaturate=function(e){this.saturate(-1)},s.prototype.negative=function(e){this._loadMatrix([0,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0],e)},s.prototype.sepia=function(e){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],e)},s.prototype.technicolor=function(e){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],e)},s.prototype.polaroid=function(e){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],e)},s.prototype.toBGR=function(e){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],e)},s.prototype.kodachrome=function(e){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],e)},s.prototype.browni=function(e){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],e)},s.prototype.vintage=function(e){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],e)},s.prototype.colorTone=function(e,t,n,i,r){var s=((n=n||16770432)>>16&255)/255,o=(n>>8&255)/255,a=(255&n)/255,l=((i=i||3375104)>>16&255)/255,u=(i>>8&255)/255,c=(255&i)/255,d=[.3,.59,.11,0,0,s,o,a,e=e||.2,0,l,u,c,t=t||.15,0,s-l,o-u,a-c,0,0];this._loadMatrix(d,r)},s.prototype.night=function(e,t){var n=[-2*(e=e||.1),-e,0,0,0,-e,0,e,0,0,0,e,2*e,0,0,0,0,0,1,0];this._loadMatrix(n,t)},s.prototype.predator=function(e,t){var n=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(n,t)},s.prototype.lsd=function(e){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],e)},s.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperties(s.prototype,{matrix:{get:function(){return this.uniforms.m.value},set:function(e){this.uniforms.m.value=e}}})},53640:(e,t,n)=>{var i=n(44651),r=n(48884);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//colorStep.frag","utf8"),{step:{type:"1f",value:5}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{step:{get:function(){return this.uniforms.step.value},set:function(e){this.uniforms.step.value=e}}})},46982:(e,t,n)=>{var i=n(44651),r=n(98001);function s(e,t,n){i.AbstractFilter.call(this,null,r.readFileSync("//convolution.frag","utf8"),{matrix:{type:"1fv",value:new Float32Array(e)},texelSize:{type:"v2",value:{x:1/t,y:1/n}}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{matrix:{get:function(){return this.uniforms.matrix.value},set:function(e){this.uniforms.matrix.value=new Float32Array(e)}},width:{get:function(){return 1/this.uniforms.texelSize.value.x},set:function(e){this.uniforms.texelSize.value.x=1/e}},height:{get:function(){return 1/this.uniforms.texelSize.value.y},set:function(e){this.uniforms.texelSize.value.y=1/e}}})},56280:(e,t,n)=>{var i=n(44651),r=n(71613);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//crosshatch.frag","utf8"))}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s},48286:(e,t,n)=>{var i=n(44651),r=n(15312);function s(e,t){var n=new i.Matrix;e.renderable=!1,i.AbstractFilter.call(this,r.readFileSync("//displacement.vert","utf8"),r.readFileSync("//displacement.frag","utf8"),{mapSampler:{type:"sampler2D",value:e.texture},otherMatrix:{type:"mat3",value:n.toArray(!0)},scale:{type:"v2",value:{x:1,y:1}}}),this.maskSprite=e,this.maskMatrix=n,null==t&&(t=20),this.scale=new i.Point(t,t)}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.applyFilter=function(e,t,n){var i=e.filterManager;i.calculateMappedMatrix(t.frame,this.maskSprite,this.maskMatrix),this.uniforms.otherMatrix.value=this.maskMatrix.toArray(!0),this.uniforms.scale.value.x=this.scale.x*(1/t.frame.width),this.uniforms.scale.value.y=this.scale.y*(1/t.frame.height);var r=this.getShader(e);i.applyFilter(r,t,n)},Object.defineProperties(s.prototype,{map:{get:function(){return this.uniforms.mapSampler.value},set:function(e){this.uniforms.mapSampler.value=e}}})},83466:(e,t,n)=>{var i=n(44651),r=n(89032);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//dotScreen.frag","utf8"),{scale:{type:"1f",value:1},angle:{type:"1f",value:5},dimensions:{type:"4fv",value:[0,0,0,0]}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{scale:{get:function(){return this.uniforms.scale.value},set:function(e){this.uniforms.scale.value=e}},angle:{get:function(){return this.uniforms.angle.value},set:function(e){this.uniforms.angle.value=e}}})},5038:(e,t,n)=>{var i=n(44651),r=n(60574);function s(){i.AbstractFilter.call(this,r.readFileSync("//blurYTint.vert","utf8"),r.readFileSync("//blurYTint.frag","utf8"),{blur:{type:"1f",value:1/512},color:{type:"c",value:[0,0,0]},alpha:{type:"1f",value:.7},offset:{type:"2f",value:[5,5]},strength:{type:"1f",value:1}}),this.passes=1,this.strength=4}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.applyFilter=function(e,t,n,i){var r=this.getShader(e);if(this.uniforms.strength.value=this.strength/4/this.passes*(t.frame.height/t.size.height),1===this.passes)e.filterManager.applyFilter(r,t,n,i);else{for(var s=e.filterManager.getRenderTarget(!0),o=t,a=s,l=0;l<this.passes-1;l++){e.filterManager.applyFilter(r,o,a,i);var u=a;a=o,o=u}e.filterManager.applyFilter(r,o,n,i),e.filterManager.returnRenderTarget(s)}},Object.defineProperties(s.prototype,{blur:{get:function(){return this.strength},set:function(e){this.padding=.5*e,this.strength=e}}})},91726:(e,t,n)=>{var i=n(44651),r=n(34356),s=n(5038);function o(){i.AbstractFilter.call(this),this.blurXFilter=new r,this.blurYTintFilter=new s,this.defaultFilter=new i.AbstractFilter,this.padding=30,this._dirtyPosition=!0,this._angle=45*Math.PI/180,this._distance=10,this.alpha=.75,this.hideObject=!1,this.blendMode=i.BLEND_MODES.MULTIPLY}o.prototype=Object.create(i.AbstractFilter.prototype),o.prototype.constructor=o,e.exports=o,o.prototype.applyFilter=function(e,t,n){var r=e.filterManager.getRenderTarget(!0);this._dirtyPosition&&(this._dirtyPosition=!1,this.blurYTintFilter.uniforms.offset.value[0]=Math.sin(this._angle)*this._distance,this.blurYTintFilter.uniforms.offset.value[1]=Math.cos(this._angle)*this._distance),this.blurXFilter.applyFilter(e,t,r),e.blendModeManager.setBlendMode(this.blendMode),this.blurYTintFilter.applyFilter(e,r,n),e.blendModeManager.setBlendMode(i.BLEND_MODES.NORMAL),this.hideObject||this.defaultFilter.applyFilter(e,t,n),e.filterManager.returnRenderTarget(r)},Object.defineProperties(o.prototype,{blur:{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=this.blurYTintFilter.blur=e}},blurX:{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=e}},blurY:{get:function(){return this.blurYTintFilter.blur},set:function(e){this.blurYTintFilter.blur=e}},color:{get:function(){return i.utils.rgb2hex(this.blurYTintFilter.uniforms.color.value)},set:function(e){this.blurYTintFilter.uniforms.color.value=i.utils.hex2rgb(e)}},alpha:{get:function(){return this.blurYTintFilter.uniforms.alpha.value},set:function(e){this.blurYTintFilter.uniforms.alpha.value=e}},distance:{get:function(){return this._distance},set:function(e){this._dirtyPosition=!0,this._distance=e}},angle:{get:function(){return this._angle},set:function(e){this._dirtyPosition=!0,this._angle=e}}})},65518:(e,t,n)=>{var i=n(44651),r=n(2672);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//gray.frag","utf8"),{gray:{type:"1f",value:1}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{gray:{get:function(){return this.uniforms.gray.value},set:function(e){this.uniforms.gray.value=e}}})},38319:(e,t,n)=>{
/**
* @file Main export of the PIXI filters library
* @author Mat Groves <mat@goodboydigital.com>
* @copyright 2013-2015 GoodBoyDigital
* @license {@link https://github.com/pixijs/pixi.js/blob/master/LICENSE|MIT License}
*/
e.exports={AsciiFilter:n(64350),BloomFilter:n(5966),BlurFilter:n(16762),BlurXFilter:n(34356),BlurYFilter:n(63779),BlurDirFilter:n(10415),ColorMatrixFilter:n(19375),ColorStepFilter:n(53640),ConvolutionFilter:n(46982),CrossHatchFilter:n(56280),DisplacementFilter:n(48286),DotScreenFilter:n(83466),GrayFilter:n(65518),DropShadowFilter:n(91726),InvertFilter:n(55976),NoiseFilter:n(97898),PixelateFilter:n(240),RGBSplitFilter:n(41952),ShockwaveFilter:n(22942),SepiaFilter:n(43578),SmartBlurFilter:n(81327),TiltShiftFilter:n(66422),TiltShiftXFilter:n(53080),TiltShiftYFilter:n(84407),TwistFilter:n(37326)}},55976:(e,t,n)=>{var i=n(44651),r=n(58215);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//invert.frag","utf8"),{invert:{type:"1f",value:1}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{invert:{get:function(){return this.uniforms.invert.value},set:function(e){this.uniforms.invert.value=e}}})},97898:(e,t,n)=>{var i=n(44651),r=n(1417);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//noise.frag","utf8"),{noise:{type:"1f",value:.5}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{noise:{get:function(){return this.uniforms.noise.value},set:function(e){this.uniforms.noise.value=e}}})},240:(e,t,n)=>{var i=n(44651),r=n(49391);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//pixelate.frag","utf8"),{dimensions:{type:"4fv",value:new Float32Array([0,0,0,0])},pixelSize:{type:"v2",value:{x:10,y:10}}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{size:{get:function(){return this.uniforms.pixelSize.value},set:function(e){this.uniforms.pixelSize.value=e}}})},41952:(e,t,n)=>{var i=n(44651),r=n(83220);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//rgbSplit.frag","utf8"),{red:{type:"v2",value:{x:20,y:20}},green:{type:"v2",value:{x:-20,y:20}},blue:{type:"v2",value:{x:20,y:-20}},dimensions:{type:"4fv",value:[0,0,0,0]}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{red:{get:function(){return this.uniforms.red.value},set:function(e){this.uniforms.red.value=e}},green:{get:function(){return this.uniforms.green.value},set:function(e){this.uniforms.green.value=e}},blue:{get:function(){return this.uniforms.blue.value},set:function(e){this.uniforms.blue.value=e}}})},43578:(e,t,n)=>{var i=n(44651),r=n(73985);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//sepia.frag","utf8"),{sepia:{type:"1f",value:1}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{sepia:{get:function(){return this.uniforms.sepia.value},set:function(e){this.uniforms.sepia.value=e}}})},22942:(e,t,n)=>{var i=n(44651),r=n(80032);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//shockwave.frag","utf8"),{center:{type:"v2",value:{x:.5,y:.5}},params:{type:"v3",value:{x:10,y:.8,z:.1}},time:{type:"1f",value:0}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{center:{get:function(){return this.uniforms.center.value},set:function(e){this.uniforms.center.value=e}},params:{get:function(){return this.uniforms.params.value},set:function(e){this.uniforms.params.value=e}},time:{get:function(){return this.uniforms.time.value},set:function(e){this.uniforms.time.value=e}}})},81519:(e,t,n)=>{var i=n(44651),r=n(75650);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//tiltShift.frag","utf8"),{blur:{type:"1f",value:100},gradientBlur:{type:"1f",value:600},start:{type:"v2",value:{x:0,y:window.innerHeight/2}},end:{type:"v2",value:{x:600,y:window.innerHeight/2}},delta:{type:"v2",value:{x:30,y:30}},texSize:{type:"v2",value:{x:window.innerWidth,y:window.innerHeight}}}),this.updateDelta()}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.updateDelta=function(){this.uniforms.delta.value.x=0,this.uniforms.delta.value.y=0},Object.defineProperties(s.prototype,{blur:{get:function(){return this.uniforms.blur.value},set:function(e){this.uniforms.blur.value=e}},gradientBlur:{get:function(){return this.uniforms.gradientBlur.value},set:function(e){this.uniforms.gradientBlur.value=e}},start:{get:function(){return this.uniforms.start.value},set:function(e){this.uniforms.start.value=e,this.updateDelta()}},end:{get:function(){return this.uniforms.end.value},set:function(e){this.uniforms.end.value=e,this.updateDelta()}}})},66422:(e,t,n)=>{var i=n(44651),r=n(53080),s=n(84407);function o(){i.AbstractFilter.call(this),this.tiltShiftXFilter=new r,this.tiltShiftYFilter=new s}o.prototype=Object.create(i.AbstractFilter.prototype),o.prototype.constructor=o,e.exports=o,o.prototype.applyFilter=function(e,t,n){var i=e.filterManager.getRenderTarget(!0);this.tiltShiftXFilter.applyFilter(e,t,i),this.tiltShiftYFilter.applyFilter(e,i,n),e.filterManager.returnRenderTarget(i)},Object.defineProperties(o.prototype,{blur:{get:function(){return this.tiltShiftXFilter.blur},set:function(e){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=e}},gradientBlur:{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(e){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=e}},start:{get:function(){return this.tiltShiftXFilter.start},set:function(e){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=e}},end:{get:function(){return this.tiltShiftXFilter.end},set:function(e){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=e}}})},53080:(e,t,n)=>{var i=n(81519);function r(){i.call(this)}r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.updateDelta=function(){var e=this.uniforms.end.value.x-this.uniforms.start.value.x,t=this.uniforms.end.value.y-this.uniforms.start.value.y,n=Math.sqrt(e*e+t*t);this.uniforms.delta.value.x=e/n,this.uniforms.delta.value.y=t/n}},84407:(e,t,n)=>{var i=n(81519);function r(){i.call(this)}r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.updateDelta=function(){var e=this.uniforms.end.value.x-this.uniforms.start.value.x,t=this.uniforms.end.value.y-this.uniforms.start.value.y,n=Math.sqrt(e*e+t*t);this.uniforms.delta.value.x=-t/n,this.uniforms.delta.value.y=e/n}},37326:(e,t,n)=>{var i=n(44651),r=n(56644);function s(){i.AbstractFilter.call(this,null,r.readFileSync("//twist.frag","utf8"),{radius:{type:"1f",value:.5},angle:{type:"1f",value:5},offset:{type:"v2",value:{x:.5,y:.5}}})}s.prototype=Object.create(i.AbstractFilter.prototype),s.prototype.constructor=s,e.exports=s,Object.defineProperties(s.prototype,{offset:{get:function(){return this.uniforms.offset.value},set:function(e){this.uniforms.offset.value=e}},radius:{get:function(){return this.uniforms.radius.value},set:function(e){this.uniforms.radius.value=e}},angle:{get:function(){return this.uniforms.angle.value},set:function(e){this.uniforms.angle.value=e}}})},66619:(e,t,n)=>{n(30255);var i=e.exports=n(44651);i.extras=n(63323),i.filters=n(38319),i.interaction=n(64816),i.loaders=n(25296),i.mesh=n(38653),i.loader=new i.loaders.Loader,Object.assign(i,n(49513)),n.g.PIXI=i},99440:(e,t,n)=>{var i=n(44651);function r(){this.global=new i.Point,this.target=null,this.originalEvent=null}r.prototype.constructor=r,e.exports=r,r.prototype.getLocalPosition=function(e,t,n){return e.toLocal(n||this.global,t)}},10509:(e,t,n)=>{var i=n(44651),r=n(99440);function s(e,t){t=t||{},this.renderer=e,this.autoPreventDefault=void 0===t.autoPreventDefault||t.autoPreventDefault,this.interactionFrequency=t.interactionFrequency||10,this.mouse=new r,this.eventData={stopped:!1,target:null,type:null,data:this.mouse,stopPropagation:function(){this.stopped=!0}},this.interactiveDataPool=[],this.interactionDOMElement=null,this.eventsAdded=!1,this.onMouseUp=this.onMouseUp.bind(this),this.processMouseUp=this.processMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.processMouseDown=this.processMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.processMouseMove=this.processMouseMove.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.processMouseOverOut=this.processMouseOverOut.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.processTouchStart=this.processTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.processTouchEnd=this.processTouchEnd.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.processTouchMove=this.processTouchMove.bind(this),this.last=0,this.currentCursorStyle="inherit",this._tempPoint=new i.Point,this.resolution=1,this.setTargetElement(this.renderer.view,this.renderer.resolution)}Object.assign(i.DisplayObject.prototype,n(74241)),s.prototype.constructor=s,e.exports=s,s.prototype.setTargetElement=function(e,t){this.removeEvents(),this.interactionDOMElement=e,this.resolution=t||1,this.addEvents()},s.prototype.addEvents=function(){this.interactionDOMElement&&(i.ticker.shared.add(this.update,this),window.navigator.msPointerEnabled&&(this.interactionDOMElement.style["-ms-content-zooming"]="none",this.interactionDOMElement.style["-ms-touch-action"]="none"),window.document.addEventListener("mousemove",this.onMouseMove,!0),this.interactionDOMElement.addEventListener("mousedown",this.onMouseDown,!0),this.interactionDOMElement.addEventListener("mouseout",this.onMouseOut,!0),this.interactionDOMElement.addEventListener("touchstart",this.onTouchStart,!0),this.interactionDOMElement.addEventListener("touchend",this.onTouchEnd,!0),this.interactionDOMElement.addEventListener("touchmove",this.onTouchMove,!0),window.addEventListener("mouseup",this.onMouseUp,!0),this.eventsAdded=!0)},s.prototype.removeEvents=function(){this.interactionDOMElement&&(i.ticker.shared.remove(this.update),window.navigator.msPointerEnabled&&(this.interactionDOMElement.style["-ms-content-zooming"]="",this.interactionDOMElement.style["-ms-touch-action"]=""),window.document.removeEventListener("mousemove",this.onMouseMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onMouseDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onMouseOut,!0),this.interactionDOMElement.removeEventListener("touchstart",this.onTouchStart,!0),this.interactionDOMElement.removeEventListener("touchend",this.onTouchEnd,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onTouchMove,!0),this.interactionDOMElement=null,window.removeEventListener("mouseup",this.onMouseUp,!0),this.eventsAdded=!1)},s.prototype.update=function(e){this._deltaTime+=e,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.interactionDOMElement&&(this.didMove?this.didMove=!1:(this.cursor="inherit",this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseOverOut,!0),this.currentCursorStyle!==this.cursor&&(this.currentCursorStyle=this.cursor,this.interactionDOMElement.style.cursor=this.cursor))))},s.prototype.dispatchEvent=function(e,t,n){n.stopped||(n.target=e,n.type=t,e.emit(t,n),e[t]&&e[t](n))},s.prototype.mapPositionToPoint=function(e,t,n){var i=this.interactionDOMElement.getBoundingClientRect();e.x=(t-i.left)*(this.interactionDOMElement.width/i.width)/this.resolution,e.y=(n-i.top)*(this.interactionDOMElement.height/i.height)/this.resolution},s.prototype.processInteractive=function(e,t,n,i,r){if(!t||!t.visible)return!1;var s=t.children,o=!1;if(r=r||t.interactive,t.interactiveChildren)for(var a=s.length-1;a>=0;a--)!o&&i?o=this.processInteractive(e,s[a],n,!0,r):this.processInteractive(e,s[a],n,!1,!1);return r&&(i&&(t.hitArea?(t.worldTransform.applyInverse(e,this._tempPoint),o=t.hitArea.contains(this._tempPoint.x,this._tempPoint.y)):t.containsPoint&&(o=t.containsPoint(e))),t.interactive&&n(t,o)),o},s.prototype.onMouseDown=function(e){this.mouse.originalEvent=e,this.eventData.data=this.mouse,this.eventData.stopped=!1,this.mapPositionToPoint(this.mouse.global,e.clientX,e.clientY),this.autoPreventDefault&&this.mouse.originalEvent.preventDefault(),this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseDown,!0)},s.prototype.processMouseDown=function(e,t){var n=this.mouse.originalEvent,i=2===n.button||3===n.which;t&&(e[i?"_isRightDown":"_isLeftDown"]=!0,this.dispatchEvent(e,i?"rightdown":"mousedown",this.eventData))},s.prototype.onMouseUp=function(e){this.mouse.originalEvent=e,this.eventData.data=this.mouse,this.eventData.stopped=!1,this.mapPositionToPoint(this.mouse.global,e.clientX,e.clientY),this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseUp,!0)},s.prototype.processMouseUp=function(e,t){var n=this.mouse.originalEvent,i=2===n.button||3===n.which,r=i?"_isRightDown":"_isLeftDown";t?(this.dispatchEvent(e,i?"rightup":"mouseup",this.eventData),e[r]&&(e[r]=!1,this.dispatchEvent(e,i?"rightclick":"click",this.eventData))):e[r]&&(e[r]=!1,this.dispatchEvent(e,i?"rightupoutside":"mouseupoutside",this.eventData))},s.prototype.onMouseMove=function(e){this.mouse.originalEvent=e,this.eventData.data=this.mouse,this.eventData.stopped=!1,this.mapPositionToPoint(this.mouse.global,e.clientX,e.clientY),this.didMove=!0,this.cursor="inherit",this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseMove,!0),this.currentCursorStyle!==this.cursor&&(this.currentCursorStyle=this.cursor,this.interactionDOMElement.style.cursor=this.cursor)},s.prototype.processMouseMove=function(e,t){this.dispatchEvent(e,"mousemove",this.eventData),this.processMouseOverOut(e,t)},s.prototype.onMouseOut=function(e){this.mouse.originalEvent=e,this.eventData.stopped=!1,this.mapPositionToPoint(this.mouse.global,e.clientX,e.clientY),this.interactionDOMElement.style.cursor="inherit",this.mapPositionToPoint(this.mouse.global,e.clientX,e.clientY),this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseOverOut,!1)},s.prototype.processMouseOverOut=function(e,t){t?(e._over||(e._over=!0,this.dispatchEvent(e,"mouseover",this.eventData)),e.buttonMode&&(this.cursor=e.defaultCursor)):e._over&&(e._over=!1,this.dispatchEvent(e,"mouseout",this.eventData))},s.prototype.onTouchStart=function(e){this.autoPreventDefault&&e.preventDefault();for(var t=e.changedTouches,n=t.length,i=0;i<n;i++){var r=t[i],s=this.getTouchData(r);s.originalEvent=e,this.eventData.data=s,this.eventData.stopped=!1,this.processInteractive(s.global,this.renderer._lastObjectRendered,this.processTouchStart,!0),this.returnTouchData(s)}},s.prototype.processTouchStart=function(e,t){t&&(e._touchDown=!0,this.dispatchEvent(e,"touchstart",this.eventData))},s.prototype.onTouchEnd=function(e){this.autoPreventDefault&&e.preventDefault();for(var t=e.changedTouches,n=t.length,i=0;i<n;i++){var r=t[i],s=this.getTouchData(r);s.originalEvent=e,this.eventData.data=s,this.eventData.stopped=!1,this.processInteractive(s.global,this.renderer._lastObjectRendered,this.processTouchEnd,!0),this.returnTouchData(s)}},s.prototype.processTouchEnd=function(e,t){t?(this.dispatchEvent(e,"touchend",this.eventData),e._touchDown&&(e._touchDown=!1,this.dispatchEvent(e,"tap",this.eventData))):e._touchDown&&(e._touchDown=!1,this.dispatchEvent(e,"touchendoutside",this.eventData))},s.prototype.onTouchMove=function(e){this.autoPreventDefault&&e.preventDefault();for(var t=e.changedTouches,n=t.length,i=0;i<n;i++){var r=t[i],s=this.getTouchData(r);s.originalEvent=e,this.eventData.data=s,this.eventData.stopped=!1,this.processInteractive(s.global,this.renderer._lastObjectRendered,this.processTouchMove,!0),this.returnTouchData(s)}},s.prototype.processTouchMove=function(e,t){this.dispatchEvent(e,"touchmove",this.eventData)},s.prototype.getTouchData=function(e){var t=this.interactiveDataPool.pop();return t||(t=new r),t.identifier=e.identifier,this.mapPositionToPoint(t.global,e.clientX,e.clientY),navigator.isCocoonJS&&(t.global.x=t.global.x/this.resolution,t.global.y=t.global.y/this.resolution),e.globalX=t.global.x,e.globalY=t.global.y,t},s.prototype.returnTouchData=function(e){this.interactiveDataPool.push(e)},s.prototype.destroy=function(){this.removeEvents(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactiveDataPool=null,this.interactionDOMElement=null,this.onMouseUp=null,this.processMouseUp=null,this.onMouseDown=null,this.processMouseDown=null,this.onMouseMove=null,this.processMouseMove=null,this.onMouseOut=null,this.processMouseOverOut=null,this.onTouchStart=null,this.processTouchStart=null,this.onTouchEnd=null,this.processTouchEnd=null,this.onTouchMove=null,this.processTouchMove=null,this._tempPoint=null},i.WebGLRenderer.registerPlugin("interaction",s),i.CanvasRenderer.registerPlugin("interaction",s)},64816:(e,t,n)=>{
/**
* @file Main export of the PIXI interactions library
* @author Mat Groves <mat@goodboydigital.com>
* @copyright 2013-2015 GoodBoyDigital
* @license {@link https://github.com/pixijs/pixi.js/blob/master/LICENSE|MIT License}
*/
e.exports={InteractionData:n(99440),InteractionManager:n(10509),interactiveTarget:n(74241)}},74241:e=>{e.exports={interactive:!1,buttonMode:!1,interactiveChildren:!0,defaultCursor:"pointer",_over:!1,_touchDown:!1}},74095:(e,t,n)=>{var i=n(542).Resource,r=n(44651),s=n(63323),o=n(26944);function a(e,t){var n={},i=e.data.getElementsByTagName("info")[0],o=e.data.getElementsByTagName("common")[0];n.font=i.getAttribute("face"),n.size=parseInt(i.getAttribute("size"),10),n.lineHeight=parseInt(o.getAttribute("lineHeight"),10),n.chars={};for(var a=e.data.getElementsByTagName("char"),l=0;l<a.length;l++){var u=parseInt(a[l].getAttribute("id"),10),c=new r.Rectangle(parseInt(a[l].getAttribute("x"),10)+t.frame.x,parseInt(a[l].getAttribute("y"),10)+t.frame.y,parseInt(a[l].getAttribute("width"),10),parseInt(a[l].getAttribute("height"),10));n.chars[u]={xOffset:parseInt(a[l].getAttribute("xoffset"),10),yOffset:parseInt(a[l].getAttribute("yoffset"),10),xAdvance:parseInt(a[l].getAttribute("xadvance"),10),kerning:{},texture:new r.Texture(t.baseTexture,c)}}var d=e.data.getElementsByTagName("kerning");for(l=0;l<d.length;l++){var h=parseInt(d[l].getAttribute("first"),10),p=parseInt(d[l].getAttribute("second"),10),f=parseInt(d[l].getAttribute("amount"),10);n.chars[p].kerning[h]=f}e.bitmapFont=n,s.BitmapText.fonts[n.font]=n}e.exports=function(){return function(e,t){if(!e.data||!e.isXml)return t();if(0===e.data.getElementsByTagName("page").length||0===e.data.getElementsByTagName("info").length||null===e.data.getElementsByTagName("info")[0].getAttribute("face"))return t();var n=o.dirname(e.url);"."===n&&(n=""),this.baseUrl&&n&&("/"===this.baseUrl.charAt(this.baseUrl.length-1)&&(n+="/"),n=n.replace(this.baseUrl,"")),n&&"/"!==n.charAt(n.length-1)&&(n+="/");var s=n+e.data.getElementsByTagName("page")[0].getAttribute("file");if(r.utils.TextureCache[s])a(e,r.utils.TextureCache[s]),t();else{var l={crossOrigin:e.crossOrigin,loadType:i.LOAD_TYPE.IMAGE};this.add(e.name+"_image",s,l,function(n){a(e,n.texture),t()})}}}},25296:(e,t,n)=>{
/**
* @file Main export of the PIXI loaders library
* @author Mat Groves <mat@goodboydigital.com>
* @copyright 2013-2015 GoodBoyDigital
* @license {@link https://github.com/pixijs/pixi.js/blob/master/LICENSE|MIT License}
*/
e.exports={Loader:n(17397),bitmapFontParser:n(74095),spritesheetParser:n(26695),textureParser:n(13968),Resource:n(542).Resource}},17397:(e,t,n)=>{var i=n(542),r=n(13968),s=n(26695),o=n(74095);function a(e,t){i.call(this,e,t);for(var n=0;n<a._pixiMiddleware.length;++n)this.use(a._pixiMiddleware[n]())}a.prototype=Object.create(i.prototype),a.prototype.constructor=a,e.exports=a,a._pixiMiddleware=[i.middleware.parsing.blob,r,s,o],a.addPixiMiddleware=function(e){a._pixiMiddleware.push(e)};var l=i.Resource;l.setExtensionXhrType("fnt",l.XHR_RESPONSE_TYPE.DOCUMENT)},26695:(e,t,n)=>{var i=n(542).Resource,r=n(26944),s=n(44651);e.exports=function(){return function(e,t){if(!e.data||!e.isJson||!e.data.frames)return t();var n={crossOrigin:e.crossOrigin,loadType:i.LOAD_TYPE.IMAGE},o=r.dirname(e.url.replace(this.baseUrl,"")),a=s.utils.getResolutionOfUrl(e.url);this.add(e.name+"_image",o+"/"+e.data.meta.image,n,function(n){e.textures={};var i=e.data.frames;for(var r in i){var o=i[r].frame;if(o){var l=null,u=null;if(l=i[r].rotated?new s.Rectangle(o.x,o.y,o.h,o.w):new s.Rectangle(o.x,o.y,o.w,o.h),i[r].trimmed&&(u=new s.Rectangle(i[r].spriteSourceSize.x/a,i[r].spriteSourceSize.y/a,i[r].sourceSize.w/a,i[r].sourceSize.h/a)),i[r].rotated){var c=l.width;l.width=l.height,l.height=c}l.x/=a,l.y/=a,l.width/=a,l.height/=a,e.textures[r]=new s.Texture(n.texture.baseTexture,l,l.clone(),u,i[r].rotated),s.utils.TextureCache[r]=e.textures[r]}}t()})}}},13968:(e,t,n)=>{var i=n(44651);e.exports=function(){return function(e,t){if(e.data&&e.isImage){var n=new i.BaseTexture(e.data,null,i.utils.getResolutionOfUrl(e.url));n.imageUrl=e.url,e.texture=new i.Texture(n),i.utils.BaseTextureCache[e.url]=n,i.utils.TextureCache[e.url]=e.texture}t()}}},2876:(e,t,n)=>{var i=n(44651),r=new i.Point,s=new i.Polygon;function o(e,t,n,r,s){i.Container.call(this),this._texture=null,this.uvs=n||new Float32Array([0,1,1,1,1,0,0,1]),this.vertices=t||new Float32Array([0,0,100,0,100,100,0,100]),this.indices=r||new Uint16Array([0,1,2,3]),this.dirty=!0,this.blendMode=i.BLEND_MODES.NORMAL,this.canvasPadding=0,this.drawMode=s||o.DRAW_MODES.TRIANGLE_MESH,this.texture=e}o.prototype=Object.create(i.Container.prototype),o.prototype.constructor=o,e.exports=o,Object.defineProperties(o.prototype,{texture:{get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture=e,e&&(e.baseTexture.hasLoaded?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}}),o.prototype._renderWebGL=function(e){e.setObjectRenderer(e.plugins.mesh),e.plugins.mesh.render(this)},o.prototype._renderCanvas=function(e){var t=e.context,n=this.worldTransform;e.roundPixels?t.setTransform(n.a,n.b,n.c,n.d,0|n.tx,0|n.ty):t.setTransform(n.a,n.b,n.c,n.d,n.tx,n.ty),this.drawMode===o.DRAW_MODES.TRIANGLE_MESH?this._renderCanvasTriangleMesh(t):this._renderCanvasTriangles(t)},o.prototype._renderCanvasTriangleMesh=function(e){for(var t=this.vertices,n=this.uvs,i=t.length/2,r=0;r<i-2;r++){var s=2*r;this._renderCanvasDrawTriangle(e,t,n,s,s+2,s+4)}},o.prototype._renderCanvasTriangles=function(e){for(var t=this.vertices,n=this.uvs,i=this.indices,r=i.length,s=0;s<r;s+=3){var o=2*i[s],a=2*i[s+1],l=2*i[s+2];this._renderCanvasDrawTriangle(e,t,n,o,a,l)}},o.prototype._renderCanvasDrawTriangle=function(e,t,n,i,r,s){var o=this._texture.baseTexture.source,a=this._texture.baseTexture.width,l=this._texture.baseTexture.height,u=t[i],c=t[r],d=t[s],h=t[i+1],p=t[r+1],f=t[s+1],m=n[i]*a,g=n[r]*a,y=n[s]*a,_=n[i+1]*l,v=n[r+1]*l,b=n[s+1]*l;if(this.canvasPadding>0){var T=this.canvasPadding/this.worldTransform.a,x=this.canvasPadding/this.worldTransform.d,E=(u+c+d)/3,w=(h+p+f)/3,I=u-E,A=h-w,S=Math.sqrt(I*I+A*A);u=E+I/S*(S+T),h=w+A/S*(S+x),A=p-w,c=E+(I=c-E)/(S=Math.sqrt(I*I+A*A))*(S+T),p=w+A/S*(S+x),A=f-w,d=E+(I=d-E)/(S=Math.sqrt(I*I+A*A))*(S+T),f=w+A/S*(S+x)}e.save(),e.beginPath(),e.moveTo(u,h),e.lineTo(c,p),e.lineTo(d,f),e.closePath(),e.clip();var C=m*v+_*y+g*b-v*y-_*g-m*b,O=u*v+_*d+c*b-v*d-_*c-u*b,M=m*c+u*y+g*d-c*y-u*g-m*d,R=m*v*d+_*c*y+u*g*b-u*v*y-_*g*d-m*c*b,k=h*v+_*f+p*b-v*f-_*p-h*b,N=m*p+h*y+g*f-p*y-h*g-m*f,D=m*v*f+_*p*y+h*g*b-h*v*y-_*g*f-m*p*b;e.transform(O/C,k/C,M/C,N/C,R/C,D/C),e.drawImage(o,0,0),e.restore()},o.prototype.renderMeshFlat=function(e){var t=this.context,n=e.vertices,i=n.length/2;t.beginPath();for(var r=1;r<i-2;r++){var s=2*r,o=n[s],a=n[s+2],l=n[s+4],u=n[s+1],c=n[s+3],d=n[s+5];t.moveTo(o,u),t.lineTo(a,c),t.lineTo(l,d)}t.fillStyle="#FF0000",t.fill(),t.closePath()},o.prototype._onTextureUpdate=function(){this.updateFrame=!0},o.prototype.getBounds=function(e){if(!this._currentBounds){for(var t=e||this.worldTransform,n=t.a,r=t.b,s=t.c,o=t.d,a=t.tx,l=t.ty,u=-1/0,c=-1/0,d=1/0,h=1/0,p=this.vertices,f=0,m=p.length;f<m;f+=2){var g=p[f],y=p[f+1],_=n*g+s*y+a,v=o*y+r*g+l;d=_<d?_:d,h=v<h?v:h,u=_>u?_:u,c=v>c?v:c}if(d===-1/0||c===1/0)return i.Rectangle.EMPTY;var b=this._bounds;b.x=d,b.width=u-d,b.y=h,b.height=c-h,this._currentBounds=b}return this._currentBounds},o.prototype.containsPoint=function(e){if(!this.getBounds().contains(e.x,e.y))return!1;this.worldTransform.applyInverse(e,r);var t,n,i=this.vertices,a=s.points;if(this.drawMode===o.DRAW_MODES.TRIANGLES){var l=this.indices;for(n=this.indices.length,t=0;t<n;t+=3){var u=2*l[t],c=2*l[t+1],d=2*l[t+2];if(a[0]=i[u],a[1]=i[u+1],a[2]=i[c],a[3]=i[c+1],a[4]=i[d],a[5]=i[d+1],s.contains(r.x,r.y))return!0}}else for(n=i.length,t=0;t<n;t+=6)if(a[0]=i[t],a[1]=i[t+1],a[2]=i[t+2],a[3]=i[t+3],a[4]=i[t+4],a[5]=i[t+5],s.contains(r.x,r.y))return!0;return!1},o.DRAW_MODES={TRIANGLE_MESH:0,TRIANGLES:1}},97005:(e,t,n)=>{var i=n(2876),r=n(44651);function s(e,t){i.call(this,e),this.points=t,this.vertices=new Float32Array(4*t.length),this.uvs=new Float32Array(4*t.length),this.colors=new Float32Array(2*t.length),this.indices=new Uint16Array(2*t.length),this._ready=!0,this.refresh()}s.prototype=Object.create(i.prototype),s.prototype.constructor=s,e.exports=s,s.prototype.refresh=function(){var e=this.points;if(!(e.length<1)&&this._texture._uvs){var t=this.uvs,n=this.indices,i=this.colors,s=this._texture._uvs,o=new r.Point(s.x0,s.y0),a=new r.Point(s.x2-s.x0,s.y2-s.y0);t[0]=0+o.x,t[1]=0+o.y,t[2]=0+o.x,t[3]=1*a.y+o.y,i[0]=1,i[1]=1,n[0]=0,n[1]=1;for(var l,u,c=e.length,d=1;d<c;d++)e[d],u=d/(c-1),t[l=4*d]=u*a.x+o.x,t[l+1]=0+o.y,t[l+2]=u*a.x+o.x,t[l+3]=1*a.y+o.y,i[l=2*d]=1,i[l+1]=1,n[l=2*d]=l,n[l+1]=l+1;this.dirty=!0}},s.prototype._onTextureUpdate=function(){i.prototype._onTextureUpdate.call(this),this._ready&&this.refresh()},s.prototype.updateTransform=function(){var e=this.points;if(!(e.length<1)){for(var t,n,i,r,s,o=e[0],a=0,l=0,u=this.vertices,c=e.length,d=0;d<c;d++)n=e[d],i=4*d,l=-((t=d<e.length-1?e[d+1]:n).x-o.x),a=t.y-o.y,10*(1-d/(c-1))>1&&1,a/=r=Math.sqrt(a*a+l*l),l/=r,a*=s=this._texture.height/2,l*=s,u[i]=n.x+a,u[i+1]=n.y+l,u[i+2]=n.x-a,u[i+3]=n.y-l,o=n;this.containerUpdateTransform()}}},38653:(e,t,n)=>{
/**
* @file Main export of the PIXI extras library
* @author Mat Groves <mat@goodboydigital.com>
* @copyright 2013-2015 GoodBoyDigital
* @license {@link https://github.com/pixijs/pixi.js/blob/master/LICENSE|MIT License}
*/
e.exports={Mesh:n(2876),Rope:n(97005),MeshRenderer:n(16709),MeshShader:n(42003)}},16709:(e,t,n)=>{var i=n(44651),r=n(2876);function s(e){i.ObjectRenderer.call(this,e),this.indices=new Uint16Array(15e3);for(var t=0,n=0;t<15e3;t+=6,n+=4)this.indices[t+0]=n+0,this.indices[t+1]=n+1,this.indices[t+2]=n+2,this.indices[t+3]=n+0,this.indices[t+4]=n+2,this.indices[t+5]=n+3}s.prototype=Object.create(i.ObjectRenderer.prototype),s.prototype.constructor=s,e.exports=s,i.WebGLRenderer.registerPlugin("mesh",s),s.prototype.onContextChange=function(){},s.prototype.render=function(e){e._vertexBuffer||this._initWebGL(e);var t=this.renderer,n=t.gl,i=e._texture.baseTexture,s=t.shaderManager.plugins.meshShader,o=e.drawMode===r.DRAW_MODES.TRIANGLE_MESH?n.TRIANGLE_STRIP:n.TRIANGLES;t.blendModeManager.setBlendMode(e.blendMode),n.uniformMatrix3fv(s.uniforms.translationMatrix._location,!1,e.worldTransform.toArray(!0)),n.uniformMatrix3fv(s.uniforms.projectionMatrix._location,!1,t.currentRenderTarget.projectionMatrix.toArray(!0)),n.uniform1f(s.uniforms.alpha._location,e.worldAlpha),e.dirty?(e.dirty=!1,n.bindBuffer(n.ARRAY_BUFFER,e._vertexBuffer),n.bufferData(n.ARRAY_BUFFER,e.vertices,n.STATIC_DRAW),n.vertexAttribPointer(s.attributes.aVertexPosition,2,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,e._uvBuffer),n.bufferData(n.ARRAY_BUFFER,e.uvs,n.STATIC_DRAW),n.vertexAttribPointer(s.attributes.aTextureCoord,2,n.FLOAT,!1,0,0),n.activeTexture(n.TEXTURE0),i._glTextures[n.id]?n.bindTexture(n.TEXTURE_2D,i._glTextures[n.id]):this.renderer.updateTexture(i),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e._indexBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.indices,n.STATIC_DRAW)):(n.bindBuffer(n.ARRAY_BUFFER,e._vertexBuffer),n.bufferSubData(n.ARRAY_BUFFER,0,e.vertices),n.vertexAttribPointer(s.attributes.aVertexPosition,2,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,e._uvBuffer),n.vertexAttribPointer(s.attributes.aTextureCoord,2,n.FLOAT,!1,0,0),n.activeTexture(n.TEXTURE0),i._glTextures[n.id]?n.bindTexture(n.TEXTURE_2D,i._glTextures[n.id]):this.renderer.updateTexture(i),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e._indexBuffer),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,e.indices)),n.drawElements(o,e.indices.length,n.UNSIGNED_SHORT,0)},s.prototype._initWebGL=function(e){var t=this.renderer.gl;e._vertexBuffer=t.createBuffer(),e._indexBuffer=t.createBuffer(),e._uvBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,e._vertexBuffer),t.bufferData(t.ARRAY_BUFFER,e.vertices,t.DYNAMIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,e._uvBuffer),t.bufferData(t.ARRAY_BUFFER,e.uvs,t.STATIC_DRAW),e.colors&&(e._colorBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,e._colorBuffer),t.bufferData(t.ARRAY_BUFFER,e.colors,t.STATIC_DRAW)),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e._indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,e.indices,t.STATIC_DRAW)},s.prototype.flush=function(){},s.prototype.start=function(){var e=this.renderer.shaderManager.plugins.meshShader;this.renderer.shaderManager.setShader(e)},s.prototype.destroy=function(){i.ObjectRenderer.prototype.destroy.call(this)}},42003:(e,t,n)=>{var i=n(44651);function r(e){i.Shader.call(this,e,["precision lowp float;","attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat3 translationMatrix;","uniform mat3 projectionMatrix;","varying vec2 vTextureCoord;","void main(void){"," gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);"," vTextureCoord = aTextureCoord;","}"].join("\n"),["precision lowp float;","varying vec2 vTextureCoord;","uniform float alpha;","uniform sampler2D uSampler;","void main(void){"," gl_FragColor = texture2D(uSampler, vTextureCoord) * alpha ;","}"].join("\n"),{alpha:{type:"1f",value:0},translationMatrix:{type:"mat3",value:new Float32Array(9)},projectionMatrix:{type:"mat3",value:new Float32Array(9)}},{aVertexPosition:0,aTextureCoord:0})}r.prototype=Object.create(i.Shader.prototype),r.prototype.constructor=r,e.exports=r,i.ShaderManager.registerPlugin("meshShader",r)},99206:()=>{Math.sign||(Math.sign=function(e){return 0===(e=+e)||isNaN(e)?e:e>0?1:-1})},87537:(e,t,n)=>{Object.assign||(Object.assign=n(45228))},30255:(e,t,n)=>{n(87537),n(34377),n(99206)},34377:(e,t,n)=>{if(Date.now&&Date.prototype.getTime||(Date.now=function(){return(new Date).getTime()}),!n.g.performance||!n.g.performance.now){var i=Date.now();n.g.performance||(n.g.performance={}),n.g.performance.now=function(){return Date.now()-i}}for(var r=Date.now(),s=["ms","moz","webkit","o"],o=0;o<s.length&&!n.g.requestAnimationFrame;++o)n.g.requestAnimationFrame=n.g[s[o]+"RequestAnimationFrame"],n.g.cancelAnimationFrame=n.g[s[o]+"CancelAnimationFrame"]||n.g[s[o]+"CancelRequestAnimationFrame"];n.g.requestAnimationFrame||(n.g.requestAnimationFrame=function(e){if("function"!=typeof e)throw new TypeError(e+"is not a function");var t=Date.now(),n=16+r-t;return n<0&&(n=0),r=t,setTimeout(function(){r=Date.now(),e(performance.now())},n)}),n.g.cancelAnimationFrame||(n.g.cancelAnimationFrame=function(e){clearTimeout(e)})},95237:(e,t,n)=>{"use strict";function i(){}n.r(t),n.d(t,{Component:()=>L,cloneElement:()=>c,createElement:()=>a,default:()=>B,h:()=>a,options:()=>r,render:()=>P,rerender:()=>f});var r={},s=[],o=[];function a(e,t){var n,a,l,u,c=o;for(u=arguments.length;u-- >2;)s.push(arguments[u]);for(t&&null!=t.children&&(s.length||s.push(t.children),delete t.children);s.length;)if((a=s.pop())&&void 0!==a.pop)for(u=a.length;u--;)s.push(a[u]);else"boolean"==typeof a&&(a=null),(l="function"!=typeof e)&&(null==a?a="":"number"==typeof a?a=String(a):"string"!=typeof a&&(l=!1)),l&&n?c[c.length-1]+=a:c===o?c=[a]:c.push(a),n=l;var d=new i;return d.nodeName=e,d.children=c,d.attributes=null==t?void 0:t,d.key=null==t?void 0:t.key,void 0!==r.vnode&&r.vnode(d),d}function l(e,t){for(var n in t)e[n]=t[n];return e}var u="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout;function c(e,t){return a(e.nodeName,l(l({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}var d=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,h=[];function p(e){!e._dirty&&(e._dirty=!0)&&1==h.push(e)&&(r.debounceRendering||u)(f)}function f(){var e,t=h;for(h=[];e=t.pop();)e._dirty&&D(e)}function m(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&g(e,t.nodeName):n||e._componentConstructor===t.nodeName}function g(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function y(e){var t=l({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var i in n)void 0===t[i]&&(t[i]=n[i]);return t}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n,i,r){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),i&&i(e);else if("class"!==t||r)if("style"===t){if(i&&"string"!=typeof i&&"string"!=typeof n||(e.style.cssText=i||""),i&&"object"==typeof i){if("string"!=typeof n)for(var s in n)s in i||(e.style[s]="");for(var s in i)e.style[s]="number"==typeof i[s]&&!1===d.test(s)?i[s]+"px":i[s]}}else if("dangerouslySetInnerHTML"===t)i&&(e.innerHTML=i.__html||"");else if("o"==t[0]&&"n"==t[1]){var o=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),i?n||e.addEventListener(t,b,o):e.removeEventListener(t,b,o),(e._listeners||(e._listeners={}))[t]=i}else if("list"!==t&&"type"!==t&&!r&&t in e)!function(e,t,n){try{e[t]=n}catch(e){}}(e,t,null==i?"":i),null!=i&&!1!==i||e.removeAttribute(t);else{var a=r&&t!==(t=t.replace(/^xlink:?/,""));null==i||!1===i?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof i&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),i):e.setAttribute(t,i))}else e.className=i||""}function b(e){return this._listeners[e.type](r.event&&r.event(e)||e)}var T=[],x=0,E=!1,w=!1;function I(){for(var e;e=T.pop();)r.afterMount&&r.afterMount(e),e.componentDidMount&&e.componentDidMount()}function A(e,t,n,i,r,s){x++||(E=null!=r&&void 0!==r.ownerSVGElement,w=null!=e&&!("__preactattr_"in e));var o=S(e,t,n,i,s);return r&&o.parentNode!==r&&r.appendChild(o),--x||(w=!1,s||I()),o}function S(e,t,n,i,r){var s=e,o=E;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||r)?e.nodeValue!=t&&(e.nodeValue=t):(s=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(s,e),C(e,!0))),s.__preactattr_=!0,s;var a,l,u=t.nodeName;if("function"==typeof u)return function(e,t,n,i){var r=e&&e._component,s=r,o=e,a=r&&e._componentConstructor===t.nodeName,l=a,u=y(t);for(;r&&!l&&(r=r._parentComponent);)l=r.constructor===t.nodeName;r&&l&&(!i||r._component)?(N(r,u,3,n,i),e=r.base):(s&&!a&&(F(s),e=o=null),r=R(t.nodeName,u,n),e&&!r.nextBase&&(r.nextBase=e,o=null),N(r,u,1,n,i),e=r.base,o&&e!==o&&(o._component=null,C(o,!1)));return e}(e,t,n,i);if(E="svg"===u||"foreignObject"!==u&&E,u=String(u),(!e||!g(e,u))&&(a=u,(l=E?document.createElementNS("http://www.w3.org/2000/svg",a):document.createElement(a)).normalizedNodeName=a,s=l,e)){for(;e.firstChild;)s.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(s,e),C(e,!0)}var c=s.firstChild,d=s.__preactattr_,h=t.children;if(null==d){d=s.__preactattr_={};for(var p=s.attributes,f=p.length;f--;)d[p[f].name]=p[f].value}return!w&&h&&1===h.length&&"string"==typeof h[0]&&null!=c&&void 0!==c.splitText&&null==c.nextSibling?c.nodeValue!=h[0]&&(c.nodeValue=h[0]):(h&&h.length||null!=c)&&function(e,t,n,i,r){var s,o,a,l,u,c=e.childNodes,d=[],h={},p=0,f=0,g=c.length,y=0,v=t?t.length:0;if(0!==g)for(var b=0;b<g;b++){var T=c[b],x=T.__preactattr_;null!=(E=v&&x?T._component?T._component.__key:x.key:null)?(p++,h[E]=T):(x||(void 0!==T.splitText?!r||T.nodeValue.trim():r))&&(d[y++]=T)}if(0!==v)for(b=0;b<v;b++){var E;if(u=null,null!=(E=(l=t[b]).key))p&&void 0!==h[E]&&(u=h[E],h[E]=void 0,p--);else if(!u&&f<y)for(s=f;s<y;s++)if(void 0!==d[s]&&m(o=d[s],l,r)){u=o,d[s]=void 0,s===y-1&&y--,s===f&&f++;break}u=S(u,l,n,i),a=c[b],u&&u!==e&&u!==a&&(null==a?e.appendChild(u):u===a.nextSibling?_(a):e.insertBefore(u,a))}if(p)for(var b in h)void 0!==h[b]&&C(h[b],!1);for(;f<=y;)void 0!==(u=d[y--])&&C(u,!1)}(s,h,n,i,w||null!=d.dangerouslySetInnerHTML),function(e,t,n){var i;for(i in n)t&&null!=t[i]||null==n[i]||v(e,i,n[i],n[i]=void 0,E);for(i in t)"children"===i||"innerHTML"===i||i in n&&t[i]===("value"===i||"checked"===i?e[i]:n[i])||v(e,i,n[i],n[i]=t[i],E)}(s,t.attributes,d),E=o,s}function C(e,t){var n=e._component;n?F(n):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||_(e),O(e))}function O(e){for(e=e.lastChild;e;){var t=e.previousSibling;C(e,!0),e=t}}var M={};function R(e,t,n){var i,r=M[e.name];if(e.prototype&&e.prototype.render?(i=new e(t,n),L.call(i,t,n)):((i=new L(t,n)).constructor=e,i.render=k),r)for(var s=r.length;s--;)if(r[s].constructor===e){i.nextBase=r[s].nextBase,r.splice(s,1);break}return i}function k(e,t,n){return this.constructor(e,n)}function N(e,t,n,i,s){e._disable||(e._disable=!0,(e.__ref=t.ref)&&delete t.ref,(e.__key=t.key)&&delete t.key,!e.base||s?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,i),i&&i!==e.context&&(e.prevContext||(e.prevContext=e.context),e.context=i),e.prevProps||(e.prevProps=e.props),e.props=t,e._disable=!1,0!==n&&(1!==n&&!1===r.syncComponentUpdates&&e.base?p(e):D(e,1,s)),e.__ref&&e.__ref(e))}function D(e,t,n,i){if(!e._disable){var s,o,a,u=e.props,c=e.state,d=e.context,h=e.prevProps||u,p=e.prevState||c,f=e.prevContext||d,m=e.base,g=e.nextBase,_=m||g,v=e._component,b=!1;if(m&&(e.props=h,e.state=p,e.context=f,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(u,c,d)?b=!0:e.componentWillUpdate&&e.componentWillUpdate(u,c,d),e.props=u,e.state=c,e.context=d),e.prevProps=e.prevState=e.prevContext=e.nextBase=null,e._dirty=!1,!b){s=e.render(u,c,d),e.getChildContext&&(d=l(l({},d),e.getChildContext()));var E,w,S=s&&s.nodeName;if("function"==typeof S){var O=y(s);(o=v)&&o.constructor===S&&O.key==o.__key?N(o,O,1,d,!1):(E=o,e._component=o=R(S,O,d),o.nextBase=o.nextBase||g,o._parentComponent=e,N(o,O,0,d,!1),D(o,1,n,!0)),w=o.base}else a=_,(E=v)&&(a=e._component=null),(_||1===t)&&(a&&(a._component=null),w=A(a,s,d,n||!m,_&&_.parentNode,!0));if(_&&w!==_&&o!==v){var M=_.parentNode;M&&w!==M&&(M.replaceChild(w,_),E||(_._component=null,C(_,!1)))}if(E&&F(E),e.base=w,w&&!i){for(var k=e,L=e;L=L._parentComponent;)(k=L).base=w;w._component=k,w._componentConstructor=k.constructor}}if(!m||n?T.unshift(e):b||(e.componentDidUpdate&&e.componentDidUpdate(h,p,f),r.afterUpdate&&r.afterUpdate(e)),null!=e._renderCallbacks)for(;e._renderCallbacks.length;)e._renderCallbacks.pop().call(e);x||i||I()}}function F(e){r.beforeUnmount&&r.beforeUnmount(e);var t=e.base;e._disable=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?F(n):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.nextBase=t,_(t),function(e){var t=e.constructor.name;(M[t]||(M[t]=[])).push(e)}(e),O(t)),e.__ref&&e.__ref(null)}function L(e,t){this._dirty=!0,this.context=t,this.props=e,this.state=this.state||{}}function P(e,t,n){return A(n,e,{},!1,t,!1)}l(L.prototype,{setState:function(e,t){var n=this.state;this.prevState||(this.prevState=l({},n)),l(n,"function"==typeof e?e(n,this.props):e),t&&(this._renderCallbacks=this._renderCallbacks||[]).push(t),p(this)},forceUpdate:function(e){e&&(this._renderCallbacks=this._renderCallbacks||[]).push(e),D(this,2)},render:function(){}});const B={h:a,createElement:a,cloneElement:c,Component:L,render:P,rerender:f,options:r}},65606:e=>{var t,n,i=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var a,l=[],u=!1,c=-1;function d(){u&&a&&(u=!1,a.length?l=a.concat(l):c=-1,l.length&&h())}function h(){if(!u){var e=o(d);u=!0;for(var t=l.length;t;){for(a=l,l=[];++c<t;)a&&a[c].run();c=-1,t=l.length}a=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function f(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new p(e,t)),1!==l.length||u||o(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=f,i.addListener=f,i.once=f,i.off=f,i.removeListener=f,i.removeAllListeners=f,i.emit=f,i.prependListener=f,i.prependOnceListener=f,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},69610:(e,t,n)=>{"use strict";n.d(t,{D:()=>i});var i=function(){function e(e){var t=this;void 0===e&&(e=!1),this.ignoreMultipleSettles=e,this.isSettled=!1,this.promise=new Promise(function(e,n){t.resolveCallback=e,t.rejectCallback=n})}return e.prototype.markAsSettled=function(){var e=this.isSettled;if(e&&!this.ignoreMultipleSettles)throw new Error("PromiseDelegate is already settled!");return this.isSettled=!0,!e},Object.defineProperty(e.prototype,"settled",{get:function(){return this.isSettled},enumerable:!1,configurable:!0}),e.prototype.resolve=function(e){this.markAsSettled()&&this.resolveCallback(e)},e.prototype.reject=function(e){this.markAsSettled()&&this.rejectCallback(e)},e}()},95006:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e,t){var i=n?n+e:e,r=this._events[i];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,a=new Array(o);s<o;s++)a[s]=r[s].fn;return a},s.prototype.emit=function(e,t,i,r,s,o){var a=n?n+e:e;if(!this._events[a])return!1;var l,u,c=this._events[a],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,r),!0;case 5:return c.fn.call(c.context,t,i,r,s),!0;case 6:return c.fn.call(c.context,t,i,r,s,o),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var h,p=c.length;for(u=0;u<p;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,i);break;case 4:c[u].fn.call(c[u].context,t,i,r);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c[u].fn.apply(c[u].context,l)}}return!0},s.prototype.on=function(e,t,i){var s=new r(t,i||this),o=n?n+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],s]:this._events[o].push(s):(this._events[o]=s,this._eventsCount++),this},s.prototype.once=function(e,t,i){var s=new r(t,i||this,!0),o=n?n+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],s]:this._events[o].push(s):(this._events[o]=s,this._eventsCount++),this},s.prototype.removeListener=function(e,t,r,s){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return 0===--this._eventsCount?this._events=new i:delete this._events[o],this;var a=this._events[o];if(a.fn)a.fn!==t||s&&!a.once||r&&a.context!==r||(0===--this._eventsCount?this._events=new i:delete this._events[o]);else{for(var l=0,u=[],c=a.length;l<c;l++)(a[l].fn!==t||s&&!a[l].once||r&&a[l].context!==r)&&u.push(a[l]);u.length?this._events[o]=1===u.length?u[0]:u:0===--this._eventsCount?this._events=new i:delete this._events[o]}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&(0===--this._eventsCount?this._events=new i:delete this._events[t])):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prototype.setMaxListeners=function(){return this},s.prefixed=n,s.EventEmitter=s,e.exports=s},93723:(e,t,n)=>{"use strict";var i=n(84678),r=n(40978),s=n(88664),o=n(95006);function a(e,t){o.call(this),t=t||10,this.baseUrl=e||"",this.progress=0,this.loading=!1,this._progressChunk=0,this._beforeMiddleware=[],this._afterMiddleware=[],this._boundLoadResource=this._loadResource.bind(this),this._buffer=[],this._numToLoad=0,this._queue=r.queue(this._boundLoadResource,t),this.resources={}}a.prototype=Object.create(o.prototype),a.prototype.constructor=a,e.exports=a,a.prototype.add=a.prototype.enqueue=function(e,t,n,i){if(Array.isArray(e)){for(var r=0;r<e.length;++r)this.add(e[r]);return this}if("object"==typeof e&&(i=t||e.callback||e.onComplete,n=e,t=e.url,e=e.name||e.key||e.url),"string"!=typeof t&&(i=n,n=t,t=e),"string"!=typeof t)throw new Error("No url passed to add resource to loader.");if("function"==typeof n&&(i=n,n=null),this.resources[e])throw new Error('Resource with name "'+e+'" already exists.');return t=this._prepareUrl(t),this.resources[e]=new s(e,t,n),"function"==typeof i&&this.resources[e].once("afterMiddleware",i),this._numToLoad++,this._queue.started?(this._queue.push(this.resources[e]),this._progressChunk=(100-this.progress)/(this._queue.length()+this._queue.running())):(this._buffer.push(this.resources[e]),this._progressChunk=100/this._buffer.length),this},a.prototype.before=a.prototype.pre=function(e){return this._beforeMiddleware.push(e),this},a.prototype.after=a.prototype.use=function(e){return this._afterMiddleware.push(e),this},a.prototype.reset=function(){for(var e in this.progress=0,this.loading=!1,this._progressChunk=0,this._buffer.length=0,this._numToLoad=0,this._queue.kill(),this._queue.started=!1,this.resources){var t=this.resources[e];t.off("complete",this._onLoad,this),t.isLoading&&t.abort()}return this.resources={},this},a.prototype.load=function(e){if("function"==typeof e&&this.once("complete",e),this._queue.started)return this;this.emit("start",this),this.loading=!0;for(var t=0;t<this._buffer.length;++t)this._queue.push(this._buffer[t]);return this._buffer.length=0,this},a.prototype._prepareUrl=function(e){var t=i(e,{strictMode:!0});return t.protocol||!t.path||0===t.path.indexOf("//")?e:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&"/"!==e.charAt(0)?this.baseUrl+"/"+e:this.baseUrl+e},a.prototype._loadResource=function(e,t){var n=this;e._dequeue=t,r.eachSeries(this._beforeMiddleware,function(t,i){t.call(n,e,function(){i(e.isComplete?{}:null)})},function(){e.isComplete?n._onLoad(e):(e.once("complete",n._onLoad,n),e.load())})},a.prototype._onComplete=function(){this.loading=!1,this.emit("complete",this,this.resources)},a.prototype._onLoad=function(e){var t=this;r.eachSeries(this._afterMiddleware,function(n,i){n.call(t,e,i)},function(){e.emit("afterMiddleware",e),t._numToLoad--,t.progress+=t._progressChunk,t.emit("progress",t,e),e.error?t.emit("error",e.error,t,e):t.emit("load",t,e),0===t._numToLoad&&(t.progress=100,t._onComplete())}),e._dequeue()},a.LOAD_TYPE=s.LOAD_TYPE,a.XHR_RESPONSE_TYPE=s.XHR_RESPONSE_TYPE},88664:(e,t,n)=>{"use strict";var i=n(95006),r=n(84678),s=!(!window.XDomainRequest||"withCredentials"in new XMLHttpRequest),o=null;function a(e,t,n){if(i.call(this),n=n||{},"string"!=typeof e||"string"!=typeof t)throw new Error("Both name and url are required for constructing a resource.");this.name=e,this.url=t,this.isDataUrl=0===this.url.indexOf("data:"),this.data=null,this.crossOrigin=!0===n.crossOrigin?"anonymous":n.crossOrigin,this.loadType=n.loadType||this._determineLoadType(),this.xhrType=n.xhrType,this.metadata=n.metadata||{},this.error=null,this.xhr=null,this.isJson=!1,this.isXml=!1,this.isImage=!1,this.isAudio=!1,this.isVideo=!1,this.isComplete=!1,this.isLoading=!1,this._dequeue=null,this._boundComplete=this.complete.bind(this),this._boundOnError=this._onError.bind(this),this._boundOnProgress=this._onProgress.bind(this),this._boundXhrOnError=this._xhrOnError.bind(this),this._boundXhrOnAbort=this._xhrOnAbort.bind(this),this._boundXhrOnLoad=this._xhrOnLoad.bind(this),this._boundXdrOnTimeout=this._xdrOnTimeout.bind(this)}function l(e){return e.toString().replace("object ","")}function u(e,t,n){t&&0===t.indexOf(".")&&(t=t.substring(1)),t&&(e[t]=n)}a.prototype=Object.create(i.prototype),a.prototype.constructor=a,e.exports=a,a.prototype.complete=function(){if(this.data&&this.data.removeEventListener&&(this.data.removeEventListener("error",this._boundOnError,!1),this.data.removeEventListener("load",this._boundComplete,!1),this.data.removeEventListener("progress",this._boundOnProgress,!1),this.data.removeEventListener("canplaythrough",this._boundComplete,!1)),this.xhr&&(this.xhr.removeEventListener?(this.xhr.removeEventListener("error",this._boundXhrOnError,!1),this.xhr.removeEventListener("abort",this._boundXhrOnAbort,!1),this.xhr.removeEventListener("progress",this._boundOnProgress,!1),this.xhr.removeEventListener("load",this._boundXhrOnLoad,!1)):(this.xhr.onerror=null,this.xhr.ontimeout=null,this.xhr.onprogress=null,this.xhr.onload=null)),this.isComplete)throw new Error("Complete called again for an already completed resource.");this.isComplete=!0,this.isLoading=!1,this.emit("complete",this)},a.prototype.abort=function(e){if(!this.error){if(this.error=new Error(e),this.xhr)this.xhr.abort();else if(this.xdr)this.xdr.abort();else if(this.data)if(void 0!==this.data.src)this.data.src="";else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this.complete()}},a.prototype.load=function(e){if(!this.isLoading)if(this.isComplete){if(e){var t=this;setTimeout(function(){e(t)},1)}}else switch(e&&this.once("complete",e),this.isLoading=!0,this.emit("start",this),!1!==this.crossOrigin&&"string"==typeof this.crossOrigin||(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case a.LOAD_TYPE.IMAGE:this._loadElement("image");break;case a.LOAD_TYPE.AUDIO:this._loadSourceElement("audio");break;case a.LOAD_TYPE.VIDEO:this._loadSourceElement("video");break;case a.LOAD_TYPE.XHR:default:s&&this.crossOrigin?this._loadXdr():this._loadXhr()}},a.prototype._loadElement=function(e){this.metadata.loadElement?this.data=this.metadata.loadElement:"image"===e&&void 0!==window.Image?this.data=new Image:this.data=document.createElement(e),this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),this.metadata.skipSource||(this.data.src=this.url);var t="is"+e[0].toUpperCase()+e.substring(1);!1===this[t]&&(this[t]=!0),this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1)},a.prototype._loadSourceElement=function(e){if(this.metadata.loadElement?this.data=this.metadata.loadElement:"audio"===e&&void 0!==window.Audio?this.data=new Audio:this.data=document.createElement(e),null!==this.data){if(!this.metadata.skipSource)if(navigator.isCocoonJS)this.data.src=Array.isArray(this.url)?this.url[0]:this.url;else if(Array.isArray(this.url))for(var t=0;t<this.url.length;++t)this.data.appendChild(this._createSource(e,this.url[t]));else this.data.appendChild(this._createSource(e,this.url));this["is"+e[0].toUpperCase()+e.substring(1)]=!0,this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.data.addEventListener("canplaythrough",this._boundComplete,!1),this.data.load()}else this.abort("Unsupported element "+e)},a.prototype._loadXhr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var e=this.xhr=new XMLHttpRequest;e.open("GET",this.url,!0),this.xhrType===a.XHR_RESPONSE_TYPE.JSON||this.xhrType===a.XHR_RESPONSE_TYPE.DOCUMENT?e.responseType=a.XHR_RESPONSE_TYPE.TEXT:e.responseType=this.xhrType,e.addEventListener("error",this._boundXhrOnError,!1),e.addEventListener("abort",this._boundXhrOnAbort,!1),e.addEventListener("progress",this._boundOnProgress,!1),e.addEventListener("load",this._boundXhrOnLoad,!1),e.send()},a.prototype._loadXdr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var e=this.xhr=new XDomainRequest;e.timeout=5e3,e.onerror=this._boundXhrOnError,e.ontimeout=this._boundXdrOnTimeout,e.onprogress=this._boundOnProgress,e.onload=this._boundXhrOnLoad,e.open("GET",this.url,!0),setTimeout(function(){e.send()},0)},a.prototype._createSource=function(e,t,n){n||(n=e+"/"+t.substr(t.lastIndexOf(".")+1));var i=document.createElement("source");return i.src=t,i.type=n,i},a.prototype._onError=function(e){this.abort("Failed to load element using "+e.target.nodeName)},a.prototype._onProgress=function(e){e&&e.lengthComputable&&this.emit("progress",this,e.loaded/e.total)},a.prototype._xhrOnError=function(){var e=this.xhr;this.abort(l(e)+" Request failed. Status: "+e.status+', text: "'+e.statusText+'"')},a.prototype._xhrOnAbort=function(){this.abort(l(this.xhr)+" Request was aborted by the user.")},a.prototype._xdrOnTimeout=function(){this.abort(l(this.xhr)+" Request timed out.")},a.prototype._xhrOnLoad=function(){var e=this.xhr,t=void 0===e.status?e.status:200;if(200===t||204===t||0===t&&e.responseText.length>0){if(this.xhrType===a.XHR_RESPONSE_TYPE.TEXT)this.data=e.responseText;else if(this.xhrType===a.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(e.responseText),this.isJson=!0}catch(e){return void this.abort("Error trying to parse loaded json:",e)}else if(this.xhrType===a.XHR_RESPONSE_TYPE.DOCUMENT)try{if(window.DOMParser){var n=new DOMParser;this.data=n.parseFromString(e.responseText,"text/xml")}else{var i=document.createElement("div");i.innerHTML=e.responseText,this.data=i}this.isXml=!0}catch(e){return void this.abort("Error trying to parse loaded xml:",e)}else this.data=e.response||e.responseText;this.complete()}else this.abort("["+e.status+"]"+e.statusText+":"+e.responseURL)},a.prototype._determineCrossOrigin=function(e,t){if(0===e.indexOf("data:"))return"";t=t||window.location,o||(o=document.createElement("a")),o.href=e;var n=!(e=r(o.href,{strictMode:!0})).port&&""===t.port||e.port===t.port,i=e.protocol?e.protocol+":":"";return e.host===t.hostname&&n&&i===t.protocol?"":"anonymous"},a.prototype._determineXhrType=function(){return a._xhrTypeMap[this._getExtension()]||a.XHR_RESPONSE_TYPE.TEXT},a.prototype._determineLoadType=function(){return a._loadTypeMap[this._getExtension()]||a.LOAD_TYPE.XHR},a.prototype._getExtension=function(){var e=this.url,t="";if(this.isDataUrl){var n=e.indexOf("/");t=e.substring(n+1,e.indexOf(";",n))}else{var i=e.indexOf("?");-1!==i&&(e=e.substring(0,i)),t=e.substring(e.lastIndexOf(".")+1)}return t.toLowerCase()},a.prototype._getMimeFromXhrType=function(e){switch(e){case a.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case a.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case a.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case a.XHR_RESPONSE_TYPE.JSON:return"application/json";case a.XHR_RESPONSE_TYPE.DEFAULT:case a.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},a.LOAD_TYPE={XHR:1,IMAGE:2,AUDIO:3,VIDEO:4},a.XHR_RESPONSE_TYPE={DEFAULT:"text",BUFFER:"arraybuffer",BLOB:"blob",DOCUMENT:"document",JSON:"json",TEXT:"text"},a._loadTypeMap={gif:a.LOAD_TYPE.IMAGE,png:a.LOAD_TYPE.IMAGE,bmp:a.LOAD_TYPE.IMAGE,jpg:a.LOAD_TYPE.IMAGE,jpeg:a.LOAD_TYPE.IMAGE,tif:a.LOAD_TYPE.IMAGE,tiff:a.LOAD_TYPE.IMAGE,webp:a.LOAD_TYPE.IMAGE,tga:a.LOAD_TYPE.IMAGE,"svg+xml":a.LOAD_TYPE.IMAGE},a._xhrTypeMap={xhtml:a.XHR_RESPONSE_TYPE.DOCUMENT,html:a.XHR_RESPONSE_TYPE.DOCUMENT,htm:a.XHR_RESPONSE_TYPE.DOCUMENT,xml:a.XHR_RESPONSE_TYPE.DOCUMENT,tmx:a.XHR_RESPONSE_TYPE.DOCUMENT,tsx:a.XHR_RESPONSE_TYPE.DOCUMENT,svg:a.XHR_RESPONSE_TYPE.DOCUMENT,gif:a.XHR_RESPONSE_TYPE.BLOB,png:a.XHR_RESPONSE_TYPE.BLOB,bmp:a.XHR_RESPONSE_TYPE.BLOB,jpg:a.XHR_RESPONSE_TYPE.BLOB,jpeg:a.XHR_RESPONSE_TYPE.BLOB,tif:a.XHR_RESPONSE_TYPE.BLOB,tiff:a.XHR_RESPONSE_TYPE.BLOB,webp:a.XHR_RESPONSE_TYPE.BLOB,tga:a.XHR_RESPONSE_TYPE.BLOB,json:a.XHR_RESPONSE_TYPE.JSON,text:a.XHR_RESPONSE_TYPE.TEXT,txt:a.XHR_RESPONSE_TYPE.TEXT},a.setExtensionLoadType=function(e,t){u(a._loadTypeMap,e,t)},a.setExtensionXhrType=function(e,t){u(a._xhrTypeMap,e,t)}},40978:e=>{"use strict";function t(){}function n(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}}e.exports={eachSeries:function(e,t,n){var i=0,r=e.length;!function s(o){o||i===r?n&&n(o):t(e[i++],s)}()},queue:function(e,i){if(null==i)i=1;else if(0===i)throw new Error("Concurrency must not be zero");var r=0,s={_tasks:[],concurrency:i,saturated:t,unsaturated:t,buffer:i/4,empty:t,drain:t,error:t,started:!1,paused:!1,push:function(e,t){o(e,!1,t)},kill:function(){s.drain=t,s._tasks=[]},unshift:function(e,t){o(e,!0,t)},process:function(){for(;!s.paused&&r<s.concurrency&&s._tasks.length;){var t=s._tasks.shift();0===s._tasks.length&&s.empty(),(r+=1)===s.concurrency&&s.saturated(),e(t.data,n(a(t)))}},length:function(){return s._tasks.length},running:function(){return r},idle:function(){return s._tasks.length+r===0},pause:function(){!0!==s.paused&&(s.paused=!0)},resume:function(){if(!1!==s.paused){s.paused=!1;for(var e=1;e<=s.concurrency;e++)s.process()}}};function o(e,n,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");if(s.started=!0,null==e&&s.idle())setTimeout(function(){s.drain()},1);else{var r={data:e,callback:"function"==typeof i?i:t};n?s._tasks.unshift(r):s._tasks.push(r),setTimeout(function(){s.process()},1)}}function a(e){return function(){r-=1,e.callback.apply(e,arguments),null!=arguments[0]&&s.error(arguments[0],e.data),r<=s.concurrency-s.buffer&&s.unsaturated(),s.idle()&&s.drain(),s.process()}}return s}}},39350:e=>{"use strict";e.exports={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encodeBinary:function(e){for(var t,n="",i=new Array(4),r=0,s=0;r<e.length;){for(t=new Array(3),s=0;s<t.length;s++)r<e.length?t[s]=255&e.charCodeAt(r++):t[s]=0;switch(i[0]=t[0]>>2,i[1]=(3&t[0])<<4|t[1]>>4,i[2]=(15&t[1])<<2|t[2]>>6,i[3]=63&t[2],r-(e.length-1)){case 2:i[3]=64,i[2]=64;break;case 1:i[3]=64}for(s=0;s<i.length;s++)n+=this._keyStr.charAt(i[s])}return n}}},542:(e,t,n)=>{"use strict";e.exports=n(93723),e.exports.Resource=n(88664),e.exports.middleware={caching:{memory:n(99911)},parsing:{blob:n(62796)}},e.exports.async=n(40978)},99911:e=>{"use strict";var t={};e.exports=function(){return function(e,n){t[e.url]?(e.data=t[e.url],e.complete()):e.once("complete",function(){t[this.url]=this.data}),n()}}},62796:(e,t,n)=>{"use strict";var i=n(88664),r=n(39350),s=window.URL||window.webkitURL;e.exports=function(){return function(e,t){if(e.data){if(e.xhr&&e.xhrType===i.XHR_RESPONSE_TYPE.BLOB)if(window.Blob&&"string"!=typeof e.data){if(0===e.data.type.indexOf("image")){var n=s.createObjectURL(e.data);return e.blob=e.data,e.data=new Image,e.data.src=n,e.isImage=!0,void(e.data.onload=function(){s.revokeObjectURL(n),e.data.onload=null,t()})}}else{var o=e.xhr.getResponseHeader("content-type");if(o&&0===o.indexOf("image"))return e.data=new Image,e.data.src="data:"+o+";base64,"+r.encodeBinary(e.xhr.responseText),e.isImage=!0,void(e.data.onload=function(){e.data.onload=null,t()})}t()}else t()}}},92861:(e,t,n)=>{
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var i=n(48287),r=i.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=i:(s(i,t),t.Buffer=o),o.prototype=Object.create(r.prototype),s(r,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},7391:(e,t,n)=>{var i=n(7180),r=n(43181),s=n(43031),o=n(9067),a=n(96833),l=n(43717),u=n(74801);u.alea=i,u.xor128=r,u.xorwow=s,u.xorshift7=o,u.xor4096=a,u.tychei=l,e.exports=u},7180:function(e,t,n){var i;!function(e,r){function s(e){var t=this,n=function(){var e=4022871197,t=function(t){t=String(t);for(var n=0;n<t.length;n++){var i=.02519603282416938*(e+=t.charCodeAt(n));i-=e=i>>>0,e=(i*=e)>>>0,e+=4294967296*(i-=e)}return 2.3283064365386963e-10*(e>>>0)};return t}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=n(" "),t.s1=n(" "),t.s2=n(" "),t.s0-=n(e),t.s0<0&&(t.s0+=1),t.s1-=n(e),t.s1<0&&(t.s1+=1),t.s2-=n(e),t.s2<0&&(t.s2+=1),n=null}function o(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function a(e,t){var n=new s(e),i=t&&t.state,r=n.next;return r.int32=function(){return 4294967296*n.next()|0},r.double=function(){return r()+11102230246251565e-32*(2097152*r()|0)},r.quick=r,i&&("object"==typeof i&&o(i,n),r.state=function(){return o(n,{})}),r}r&&r.exports?r.exports=a:n.amdD&&n.amdO?void 0===(i=function(){return a}.call(t,n,t,r))||(r.exports=i):this.alea=a}(0,e=n.nmd(e),n.amdD)},43717:function(e,t,n){var i;!function(e,r){function s(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,i=t.d,r=t.a;return e=e<<25^e>>>7^n,n=n-i|0,i=i<<24^i>>>8^r,r=r-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-i|0,t.d=i<<16^n>>>16^r,t.a=r-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var i=0;i<n.length+20;i++)t.b^=0|n.charCodeAt(i),t.next()}function o(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function a(e,t){var n=new s(e),i=t&&t.state,r=function(){return(n.next()>>>0)/4294967296};return r.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=n.next,r.quick=r,i&&("object"==typeof i&&o(i,n),r.state=function(){return o(n,{})}),r}r&&r.exports?r.exports=a:n.amdD&&n.amdO?void 0===(i=function(){return a}.call(t,n,t,r))||(r.exports=i):this.tychei=a}(0,e=n.nmd(e),n.amdD)},43181:function(e,t,n){var i;!function(e,r){function s(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var i=0;i<n.length+64;i++)t.x^=0|n.charCodeAt(i),t.next()}function o(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function a(e,t){var n=new s(e),i=t&&t.state,r=function(){return(n.next()>>>0)/4294967296};return r.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=n.next,r.quick=r,i&&("object"==typeof i&&o(i,n),r.state=function(){return o(n,{})}),r}r&&r.exports?r.exports=a:n.amdD&&n.amdO?void 0===(i=function(){return a}.call(t,n,t,r))||(r.exports=i):this.xor128=a}(0,e=n.nmd(e),n.amdD)},96833:function(e,t,n){var i;!function(e,r){function s(e){var t=this;t.next=function(){var e,n,i=t.w,r=t.X,s=t.i;return t.w=i=i+1640531527|0,n=r[s+34&127],e=r[s=s+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=r[s]=n^e,t.i=s,n+(i^i>>>16)|0},function(e,t){var n,i,r,s,o,a=[],l=128;for(t===(0|t)?(i=t,t=null):(t+="\0",i=0,l=Math.max(l,t.length)),r=0,s=-32;s<l;++s)t&&(i^=t.charCodeAt((s+32)%t.length)),0===s&&(o=i),i^=i<<10,i^=i>>>15,i^=i<<4,i^=i>>>13,s>=0&&(o=o+1640531527|0,r=0==(n=a[127&s]^=i+o)?r+1:0);for(r>=128&&(a[127&(t&&t.length||0)]=-1),r=127,s=512;s>0;--s)i=a[r+34&127],n=a[r=r+1&127],i^=i<<13,n^=n<<17,i^=i>>>15,n^=n>>>12,a[r]=i^n;e.w=o,e.X=a,e.i=r}(t,e)}function o(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function a(e,t){null==e&&(e=+new Date);var n=new s(e),i=t&&t.state,r=function(){return(n.next()>>>0)/4294967296};return r.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=n.next,r.quick=r,i&&(i.X&&o(i,n),r.state=function(){return o(n,{})}),r}r&&r.exports?r.exports=a:n.amdD&&n.amdO?void 0===(i=function(){return a}.call(t,n,t,r))||(r.exports=i):this.xor4096=a}(0,e=n.nmd(e),n.amdD)},9067:function(e,t,n){var i;!function(e,r){function s(e){var t=this;t.next=function(){var e,n,i=t.x,r=t.i;return e=i[r],n=(e^=e>>>7)^e<<24,n^=(e=i[r+1&7])^e>>>10,n^=(e=i[r+3&7])^e>>>3,n^=(e=i[r+4&7])^e<<7,e=i[r+7&7],n^=(e^=e<<13)^e<<9,i[r]=n,t.i=r+1&7,n},function(e,t){var n,i=[];if(t===(0|t))i[0]=t;else for(t=""+t,n=0;n<t.length;++n)i[7&n]=i[7&n]<<15^t.charCodeAt(n)+i[n+1&7]<<13;for(;i.length<8;)i.push(0);for(n=0;n<8&&0===i[n];++n);for(8==n?i[7]=-1:i[n],e.x=i,e.i=0,n=256;n>0;--n)e.next()}(t,e)}function o(e,t){return t.x=e.x.slice(),t.i=e.i,t}function a(e,t){null==e&&(e=+new Date);var n=new s(e),i=t&&t.state,r=function(){return(n.next()>>>0)/4294967296};return r.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=n.next,r.quick=r,i&&(i.x&&o(i,n),r.state=function(){return o(n,{})}),r}r&&r.exports?r.exports=a:n.amdD&&n.amdO?void 0===(i=function(){return a}.call(t,n,t,r))||(r.exports=i):this.xorshift7=a}(0,e=n.nmd(e),n.amdD)},43031:function(e,t,n){var i;!function(e,r){function s(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var i=0;i<n.length+64;i++)t.x^=0|n.charCodeAt(i),i==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function o(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function a(e,t){var n=new s(e),i=t&&t.state,r=function(){return(n.next()>>>0)/4294967296};return r.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=n.next,r.quick=r,i&&("object"==typeof i&&o(i,n),r.state=function(){return o(n,{})}),r}r&&r.exports?r.exports=a:n.amdD&&n.amdO?void 0===(i=function(){return a}.call(t,n,t,r))||(r.exports=i):this.xorwow=a}(0,e=n.nmd(e),n.amdD)},74801:function(e,t,n){var i;!function(r,s,o){var a,l=256,u=o.pow(l,6),c=o.pow(2,52),d=2*c,h=255;function p(e,t,n){var i=[],h=y(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,_(s)]:null==e?function(){try{var e;return a&&(e=a.randomBytes)?e=e(l):(e=new Uint8Array(l),(r.crypto||r.msCrypto).getRandomValues(e)),_(e)}catch(e){var t=r.navigator,n=t&&t.plugins;return[+new Date,r,n,r.screen,_(s)]}}():e,3),i),p=new f(i),v=function(){for(var e=p.g(6),t=u,n=0;e<c;)e=(e+n)*l,t*=l,n=p.g(1);for(;e>=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return v.int32=function(){return 0|p.g(4)},v.quick=function(){return p.g(4)/4294967296},v.double=v,y(_(p.S),s),(t.pass||n||function(e,t,n,i){return i&&(i.S&&m(i,p),e.state=function(){return m(p,{})}),n?(o.random=e,t):e})(v,h,"global"in t?t.global:this==o,t.state)}function f(e){var t,n=e.length,i=this,r=0,s=i.i=i.j=0,o=i.S=[];for(n||(e=[n++]);r<l;)o[r]=r++;for(r=0;r<l;r++)o[r]=o[s=h&s+e[r%n]+(t=o[r])],o[s]=t;(i.g=function(e){for(var t,n=0,r=i.i,s=i.j,o=i.S;e--;)t=o[r=h&r+1],n=n*l+o[h&(o[r]=o[s=h&s+t])+(o[s]=t)];return i.i=r,i.j=s,n})(l)}function m(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function g(e,t){var n,i=[],r=typeof e;if(t&&"object"==r)for(n in e)try{i.push(g(e[n],t-1))}catch(e){}return i.length?i:"string"==r?e:e+"\0"}function y(e,t){for(var n,i=e+"",r=0;r<i.length;)t[h&r]=h&(n^=19*t[h&r])+i.charCodeAt(r++);return _(t)}function _(e){return String.fromCharCode.apply(0,e)}if(y(o.random(),s),e.exports){e.exports=p;try{a=n(41234)}catch(e){}}else void 0===(i=function(){return p}.call(t,n,t,e))||(e.exports=i)}("undefined"!=typeof self?self:this,[],Math)},93904:(e,t,n)=>{"use strict";const i=Symbol("SemVer ANY");class r{static get ANY(){return i}constructor(e,t){if(t=s(t),e instanceof r){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),u("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===i?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){const t=this.options.loose?o[a.COMPARATORLOOSE]:o[a.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==n[1]?n[1]:"","="===this.operator&&(this.operator=""),n[2]?this.semver=new c(n[2],this.options.loose):this.semver=i}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===i||e===i)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):(!(t=s(t)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}e.exports=r;const s=n(98587),{safeRe:o,t:a}=n(99718),l=n(72111),u=n(57272),c=n(53908),d=n(78311)},78311:(e,t,n)=>{"use strict";const i=/\s+/g;class r{constructor(e,t){if(t=o(t),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof a)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(i," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!y(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&_(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&m)|(this.options.loose&&g))+":"+e,n=s.get(t);if(n)return n;const i=this.options.loose,r=i?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];e=e.replace(r,M(this.options.includePrerelease)),l("hyphen replace",e),e=e.replace(c[d.COMPARATORTRIM],h),l("comparator trim",e),e=e.replace(c[d.TILDETRIM],p),l("tilde trim",e),e=e.replace(c[d.CARETTRIM],f),l("caret trim",e);let o=e.split(" ").map(e=>b(e,this.options)).join(" ").split(/\s+/).map(e=>O(e,this.options));i&&(o=o.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(c[d.COMPARATORLOOSE])))),l("range list",o);const u=new Map,_=o.map(e=>new a(e,this.options));for(const e of _){if(y(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");const v=[...u.values()];return s.set(t,v),v}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some(n=>v(n,t)&&e.set.some(e=>v(e,t)&&n.every(n=>e.every(e=>n.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(R(this.set[t],e,this.options))return!0;return!1}}e.exports=r;const s=new(n(68794)),o=n(98587),a=n(93904),l=n(57272),u=n(53908),{safeRe:c,t:d,comparatorTrimReplace:h,tildeTrimReplace:p,caretTrimReplace:f}=n(99718),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:g}=n(16874),y=e=>"<0.0.0-0"===e.value,_=e=>""===e.value,v=(e,t)=>{let n=!0;const i=e.slice();let r=i.pop();for(;n&&i.length;)n=i.every(e=>r.intersects(e,t)),r=i.pop();return n},b=(e,t)=>(l("comp",e,t),e=w(e,t),l("caret",e),e=x(e,t),l("tildes",e),e=A(e,t),l("xrange",e),e=C(e,t),l("stars",e),e),T=e=>!e||"x"===e.toLowerCase()||"*"===e,x=(e,t)=>e.trim().split(/\s+/).map(e=>E(e,t)).join(" "),E=(e,t)=>{const n=t.loose?c[d.TILDELOOSE]:c[d.TILDE];return e.replace(n,(t,n,i,r,s)=>{let o;return l("tilde",e,t,n,i,r,s),T(n)?o="":T(i)?o=`>=${n}.0.0 <${+n+1}.0.0-0`:T(r)?o=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:s?(l("replaceTilde pr",s),o=`>=${n}.${i}.${r}-${s} <${n}.${+i+1}.0-0`):o=`>=${n}.${i}.${r} <${n}.${+i+1}.0-0`,l("tilde return",o),o})},w=(e,t)=>e.trim().split(/\s+/).map(e=>I(e,t)).join(" "),I=(e,t)=>{l("caret",e,t);const n=t.loose?c[d.CARETLOOSE]:c[d.CARET],i=t.includePrerelease?"-0":"";return e.replace(n,(t,n,r,s,o)=>{let a;return l("caret",e,t,n,r,s,o),T(n)?a="":T(r)?a=`>=${n}.0.0${i} <${+n+1}.0.0-0`:T(s)?a="0"===n?`>=${n}.${r}.0${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.0${i} <${+n+1}.0.0-0`:o?(l("replaceCaret pr",o),a="0"===n?"0"===r?`>=${n}.${r}.${s}-${o} <${n}.${r}.${+s+1}-0`:`>=${n}.${r}.${s}-${o} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${s}-${o} <${+n+1}.0.0-0`):(l("no pr"),a="0"===n?"0"===r?`>=${n}.${r}.${s}${i} <${n}.${r}.${+s+1}-0`:`>=${n}.${r}.${s}${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${s} <${+n+1}.0.0-0`),l("caret return",a),a})},A=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>S(e,t)).join(" ")),S=(e,t)=>{e=e.trim();const n=t.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return e.replace(n,(n,i,r,s,o,a)=>{l("xRange",e,n,i,r,s,o,a);const u=T(r),c=u||T(s),d=c||T(o),h=d;return"="===i&&h&&(i=""),a=t.includePrerelease?"-0":"",u?n=">"===i||"<"===i?"<0.0.0-0":"*":i&&h?(c&&(s=0),o=0,">"===i?(i=">=",c?(r=+r+1,s=0,o=0):(s=+s+1,o=0)):"<="===i&&(i="<",c?r=+r+1:s=+s+1),"<"===i&&(a="-0"),n=`${i+r}.${s}.${o}${a}`):c?n=`>=${r}.0.0${a} <${+r+1}.0.0-0`:d&&(n=`>=${r}.${s}.0${a} <${r}.${+s+1}.0-0`),l("xRange return",n),n})},C=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[d.STAR],"")),O=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),M=e=>(t,n,i,r,s,o,a,l,u,c,d,h)=>`${n=T(i)?"":T(r)?`>=${i}.0.0${e?"-0":""}`:T(s)?`>=${i}.${r}.0${e?"-0":""}`:o?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=T(u)?"":T(c)?`<${+u+1}.0.0-0`:T(d)?`<${u}.${+c+1}.0-0`:h?`<=${u}.${c}.${d}-${h}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`}`.trim(),R=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(l(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){const i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}},53908:(e,t,n)=>{"use strict";const i=n(57272),{MAX_LENGTH:r,MAX_SAFE_INTEGER:s}=n(16874),{safeRe:o,t:a}=n(99718),l=n(98587),{compareIdentifiers:u}=n(61123);class c{constructor(e,t){if(t=l(t),e instanceof c){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>r)throw new TypeError(`version is longer than ${r} characters`);i("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?o[a.LOOSE]:o[a.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>s||this.major<0)throw new TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<s)return t}return e}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(i("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof c||(e=new c(e,this.options)),u(this.major,e.major)||u(this.minor,e.minor)||u(this.patch,e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],r=e.prerelease[t];if(i("prerelease compare",t,n,r),void 0===n&&void 0===r)return 0;if(void 0===r)return 1;if(void 0===n)return-1;if(n!==r)return u(n,r)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{const n=this.build[t],r=e.build[t];if(i("build compare",t,n,r),void 0===n&&void 0===r)return 0;if(void 0===r)return 1;if(void 0===n)return-1;if(n!==r)return u(n,r)}while(++t)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?o[a.PRERELEASELOOSE]:o[a.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let i=this.prerelease.length;for(;--i>=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let i=[t,e];!1===n&&(i=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=c},57414:(e,t,n)=>{"use strict";const i=n(30144);e.exports=(e,t)=>{const n=i(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null}},72111:(e,t,n)=>{"use strict";const i=n(94641),r=n(13999),s=n(35580),o=n(54089),a=n(7059),l=n(25200);e.exports=(e,t,n,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return i(e,n,u);case"!=":return r(e,n,u);case">":return s(e,n,u);case">=":return o(e,n,u);case"<":return a(e,n,u);case"<=":return l(e,n,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},46170:(e,t,n)=>{"use strict";const i=n(53908),r=n(30144),{safeRe:s,t:o}=n(99718);e.exports=(e,t)=>{if(e instanceof i)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let n=null;if((t=t||{}).rtl){const i=t.includePrerelease?s[o.COERCERTLFULL]:s[o.COERCERTL];let r;for(;(r=i.exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&r.index+r[0].length===n.index+n[0].length||(n=r),i.lastIndex=r.index+r[1].length+r[2].length;i.lastIndex=-1}else n=e.match(t.includePrerelease?s[o.COERCEFULL]:s[o.COERCE]);if(null===n)return null;const a=n[2],l=n[3]||"0",u=n[4]||"0",c=t.includePrerelease&&n[5]?`-${n[5]}`:"",d=t.includePrerelease&&n[6]?`+${n[6]}`:"";return r(`${a}.${l}.${u}${c}${d}`,t)}},40909:(e,t,n)=>{"use strict";const i=n(53908);e.exports=(e,t,n)=>{const r=new i(e,n),s=new i(t,n);return r.compare(s)||r.compareBuild(s)}},11763:(e,t,n)=>{"use strict";const i=n(50560);e.exports=(e,t)=>i(e,t,!0)},50560:(e,t,n)=>{"use strict";const i=n(53908);e.exports=(e,t,n)=>new i(e,n).compare(new i(t,n))},51832:(e,t,n)=>{"use strict";const i=n(30144);e.exports=(e,t)=>{const n=i(e,null,!0),r=i(t,null,!0),s=n.compare(r);if(0===s)return null;const o=s>0,a=o?n:r,l=o?r:n,u=!!a.prerelease.length;if(!!l.prerelease.length&&!u){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(a))return l.minor&&!l.patch?"minor":"patch"}const c=u?"pre":"";return n.major!==r.major?c+"major":n.minor!==r.minor?c+"minor":n.patch!==r.patch?c+"patch":"prerelease"}},94641:(e,t,n)=>{"use strict";const i=n(50560);e.exports=(e,t,n)=>0===i(e,t,n)},35580:(e,t,n)=>{"use strict";const i=n(50560);e.exports=(e,t,n)=>i(e,t,n)>0},54089:(e,t,n)=>{"use strict";const i=n(50560);e.exports=(e,t,n)=>i(e,t,n)>=0},93007:(e,t,n)=>{"use strict";const i=n(53908);e.exports=(e,t,n,r,s)=>{"string"==typeof n&&(s=r,r=n,n=void 0);try{return new i(e instanceof i?e.version:e,n).inc(t,r,s).version}catch(e){return null}}},7059:(e,t,n)=>{"use strict";const i=n(50560);e.exports=(e,t,n)=>i(e,t,n)<0},25200:(e,t,n)=>{"use strict";const i=n(50560);e.exports=(e,t,n)=>i(e,t,n)<=0},32938:(e,t,n)=>{"use strict";const i=n(53908);e.exports=(e,t)=>new i(e,t).major},46254:(e,t,n)=>{"use strict";const i=n(53908);e.exports=(e,t)=>new i(e,t).minor},13999:(e,t,n)=>{"use strict";const i=n(50560);e.exports=(e,t,n)=>0!==i(e,t,n)},30144:(e,t,n)=>{"use strict";const i=n(53908);e.exports=(e,t,n=!1)=>{if(e instanceof i)return e;try{return new i(e,t)}catch(e){if(!n)return null;throw e}}},24493:(e,t,n)=>{"use strict";const i=n(53908);e.exports=(e,t)=>new i(e,t).patch},31729:(e,t,n)=>{"use strict";const i=n(30144);e.exports=(e,t)=>{const n=i(e,t);return n&&n.prerelease.length?n.prerelease:null}},9970:(e,t,n)=>{"use strict";const i=n(50560);e.exports=(e,t,n)=>i(t,e,n)},74277:(e,t,n)=>{"use strict";const i=n(40909);e.exports=(e,t)=>e.sort((e,n)=>i(n,e,t))},97638:(e,t,n)=>{"use strict";const i=n(78311);e.exports=(e,t,n)=>{try{t=new i(t,n)}catch(e){return!1}return t.test(e)}},43927:(e,t,n)=>{"use strict";const i=n(40909);e.exports=(e,t)=>e.sort((e,n)=>i(e,n,t))},56953:(e,t,n)=>{"use strict";const i=n(30144);e.exports=(e,t)=>{const n=i(e,t);return n?n.version:null}},99589:(e,t,n)=>{"use strict";const i=n(99718),r=n(16874),s=n(53908),o=n(61123),a=n(30144),l=n(56953),u=n(57414),c=n(93007),d=n(51832),h=n(32938),p=n(46254),f=n(24493),m=n(31729),g=n(50560),y=n(9970),_=n(11763),v=n(40909),b=n(43927),T=n(74277),x=n(35580),E=n(7059),w=n(94641),I=n(13999),A=n(54089),S=n(25200),C=n(72111),O=n(46170),M=n(93904),R=n(78311),k=n(97638),N=n(77631),D=n(19628),F=n(270),L=n(41261),P=n(13874),B=n(97075),$=n(75571),U=n(5342),z=n(76780),V=n(72525),j=n(75032);e.exports={parse:a,valid:l,clean:u,inc:c,diff:d,major:h,minor:p,patch:f,prerelease:m,compare:g,rcompare:y,compareLoose:_,compareBuild:v,sort:b,rsort:T,gt:x,lt:E,eq:w,neq:I,gte:A,lte:S,cmp:C,coerce:O,Comparator:M,Range:R,satisfies:k,toComparators:N,maxSatisfying:D,minSatisfying:F,minVersion:L,validRange:P,outside:B,gtr:$,ltr:U,intersects:z,simplifyRange:V,subset:j,SemVer:s,re:i.re,src:i.src,tokens:i.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:o.compareIdentifiers,rcompareIdentifiers:o.rcompareIdentifiers}},16874:e=>{"use strict";const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},57272:e=>{"use strict";const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},61123:e=>{"use strict";const t=/^[0-9]+$/,n=(e,n)=>{const i=t.test(e),r=t.test(n);return i&&r&&(e=+e,n=+n),e===n?0:i&&!r?-1:r&&!i?1:e<n?-1:1};e.exports={compareIdentifiers:n,rcompareIdentifiers:(e,t)=>n(t,e)}},68794:e=>{"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},98587:e=>{"use strict";const t=Object.freeze({loose:!0}),n=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:n},99718:(e,t,n)=>{"use strict";const{MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:s}=n(16874),o=n(57272),a=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={};let h=0;const p="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",s],[p,r]],m=(e,t,n)=>{const i=(e=>{for(const[t,n]of f)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),r=h++;o(e,r,t),d[e]=r,u[r]=t,c[r]=i,a[r]=new RegExp(t,n?"g":void 0),l[r]=new RegExp(i,n?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),m("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${p}+`),m("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),m("FULL",`^${u[d.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),m("LOOSE",`^${u[d.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),m("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${i}})(?:\\.(\\d{1,${i}}))?(?:\\.(\\d{1,${i}}))?`),m("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?(?:$|[^\\d])`),m("COERCERTL",u[d.COERCE],!0),m("COERCERTLFULL",u[d.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},75571:(e,t,n)=>{"use strict";const i=n(97075);e.exports=(e,t,n)=>i(e,t,">",n)},76780:(e,t,n)=>{"use strict";const i=n(78311);e.exports=(e,t,n)=>(e=new i(e,n),t=new i(t,n),e.intersects(t,n))},5342:(e,t,n)=>{"use strict";const i=n(97075);e.exports=(e,t,n)=>i(e,t,"<",n)},19628:(e,t,n)=>{"use strict";const i=n(53908),r=n(78311);e.exports=(e,t,n)=>{let s=null,o=null,a=null;try{a=new r(t,n)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(s&&-1!==o.compare(e)||(s=e,o=new i(s,n)))}),s}},270:(e,t,n)=>{"use strict";const i=n(53908),r=n(78311);e.exports=(e,t,n)=>{let s=null,o=null,a=null;try{a=new r(t,n)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(s&&1!==o.compare(e)||(s=e,o=new i(s,n)))}),s}},41261:(e,t,n)=>{"use strict";const i=n(53908),r=n(78311),s=n(35580);e.exports=(e,t)=>{e=new r(e,t);let n=new i("0.0.0");if(e.test(n))return n;if(n=new i("0.0.0-0"),e.test(n))return n;n=null;for(let t=0;t<e.set.length;++t){const r=e.set[t];let o=null;r.forEach(e=>{const t=new i(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":o&&!s(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),!o||n&&!s(n,o)||(n=o)}return n&&e.test(n)?n:null}},97075:(e,t,n)=>{"use strict";const i=n(53908),r=n(93904),{ANY:s}=r,o=n(78311),a=n(97638),l=n(35580),u=n(7059),c=n(25200),d=n(54089);e.exports=(e,t,n,h)=>{let p,f,m,g,y;switch(e=new i(e,h),t=new o(t,h),n){case">":p=l,f=c,m=u,g=">",y=">=";break;case"<":p=u,f=d,m=l,g="<",y="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,h))return!1;for(let n=0;n<t.set.length;++n){const i=t.set[n];let o=null,a=null;if(i.forEach(e=>{e.semver===s&&(e=new r(">=0.0.0")),o=o||e,a=a||e,p(e.semver,o.semver,h)?o=e:m(e.semver,a.semver,h)&&(a=e)}),o.operator===g||o.operator===y)return!1;if((!a.operator||a.operator===g)&&f(e,a.semver))return!1;if(a.operator===y&&m(e,a.semver))return!1}return!0}},72525:(e,t,n)=>{"use strict";const i=n(97638),r=n(50560);e.exports=(e,t,n)=>{const s=[];let o=null,a=null;const l=e.sort((e,t)=>r(e,t,n));for(const e of l){i(e,t,n)?(a=e,o||(o=e)):(a&&s.push([o,a]),a=null,o=null)}o&&s.push([o,null]);const u=[];for(const[e,t]of s)e===t?u.push(e):t||e!==l[0]?t?e===l[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const c=u.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return c.length<d.length?c:t}},75032:(e,t,n)=>{"use strict";const i=n(78311),r=n(93904),{ANY:s}=r,o=n(97638),a=n(50560),l=[new r(">=0.0.0-0")],u=[new r(">=0.0.0")],c=(e,t,n)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===s){if(1===t.length&&t[0].semver===s)return!0;e=n.includePrerelease?l:u}if(1===t.length&&t[0].semver===s){if(n.includePrerelease)return!0;t=u}const i=new Set;let r,c,p,f,m,g,y;for(const t of e)">"===t.operator||">="===t.operator?r=d(r,t,n):"<"===t.operator||"<="===t.operator?c=h(c,t,n):i.add(t.semver);if(i.size>1)return null;if(r&&c){if(p=a(r.semver,c.semver,n),p>0)return null;if(0===p&&(">="!==r.operator||"<="!==c.operator))return null}for(const e of i){if(r&&!o(e,String(r),n))return null;if(c&&!o(e,String(c),n))return null;for(const i of t)if(!o(e,String(i),n))return!1;return!0}let _=!(!c||n.includePrerelease||!c.semver.prerelease.length)&&c.semver,v=!(!r||n.includePrerelease||!r.semver.prerelease.length)&&r.semver;_&&1===_.prerelease.length&&"<"===c.operator&&0===_.prerelease[0]&&(_=!1);for(const e of t){if(y=y||">"===e.operator||">="===e.operator,g=g||"<"===e.operator||"<="===e.operator,r)if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),">"===e.operator||">="===e.operator){if(f=d(r,e,n),f===e&&f!==r)return!1}else if(">="===r.operator&&!o(r.semver,String(e),n))return!1;if(c)if(_&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===_.major&&e.semver.minor===_.minor&&e.semver.patch===_.patch&&(_=!1),"<"===e.operator||"<="===e.operator){if(m=h(c,e,n),m===e&&m!==c)return!1}else if("<="===c.operator&&!o(c.semver,String(e),n))return!1;if(!e.operator&&(c||r)&&0!==p)return!1}return!(r&&g&&!c&&0!==p)&&(!(c&&y&&!r&&0!==p)&&(!v&&!_))},d=(e,t,n)=>{if(!e)return t;const i=a(e.semver,t.semver,n);return i>0?e:i<0||">"===t.operator&&">="===e.operator?t:e},h=(e,t,n)=>{if(!e)return t;const i=a(e.semver,t.semver,n);return i<0?e:i>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,n={})=>{if(e===t)return!0;e=new i(e,n),t=new i(t,n);let r=!1;e:for(const i of e.set){for(const e of t.set){const t=c(i,e,n);if(r=r||null!==t,t)continue e}if(r)return!1}return!0}},77631:(e,t,n)=>{"use strict";const i=n(78311);e.exports=(e,t)=>new i(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},13874:(e,t,n)=>{"use strict";const i=n(78311);e.exports=(e,t)=>{try{return new i(e,t).range||"*"}catch(e){return null}}},45780:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DEFAULT_ACTIONS:()=>oye,default:()=>_ye,guessMode:()=>fye,vega:()=>iye,vegaLite:()=>rye});var i={};n.r(i),n.d(i,{JsonPatchError:()=>N,_areEquals:()=>j,applyOperation:()=>B,applyPatch:()=>$,applyReducer:()=>U,deepClone:()=>D,getValueByPointer:()=>P,validate:()=>V,validator:()=>z});var r={};n.r(r),n.d(r,{compare:()=>Z,generate:()=>q,observe:()=>X,unobserve:()=>W});var s={};n.r(s),n.d(s,{aggregate:()=>Oc,bin:()=>Mc,collect:()=>kc,compare:()=>Nc,countpattern:()=>Fc,cross:()=>Lc,density:()=>Uc,dotbin:()=>Gc,expression:()=>Hc,extent:()=>Xc,facet:()=>Kc,field:()=>Zc,filter:()=>Jc,flatten:()=>ed,fold:()=>td,formula:()=>nd,generate:()=>id,impute:()=>od,joinaggregate:()=>ad,kde:()=>ld,key:()=>ud,load:()=>dd,lookup:()=>pd,multiextent:()=>fd,multivalues:()=>gd,params:()=>_d,pivot:()=>vd,prefacet:()=>bd,project:()=>Td,proxy:()=>xd,quantile:()=>Ed,relay:()=>wd,sample:()=>Id,sequence:()=>Ad,sieve:()=>Sd,subflow:()=>qc,timeunit:()=>Cd,tupleindex:()=>Md,values:()=>Rd,window:()=>Ld});var o={};n.r(o),n.d(o,{interpolate:()=>u_,interpolateArray:()=>t_,interpolateBasis:()=>Vy,interpolateBasisClosed:()=>jy,interpolateCubehelix:()=>sb,interpolateCubehelixLong:()=>ob,interpolateDate:()=>i_,interpolateDiscrete:()=>cv,interpolateHcl:()=>Hv,interpolateHclLong:()=>Wv,interpolateHsl:()=>xv,interpolateHslLong:()=>Ev,interpolateHue:()=>dv,interpolateLab:()=>Yv,interpolateNumber:()=>r_,interpolateNumberArray:()=>Jy,interpolateObject:()=>s_,interpolateRgb:()=>qy,interpolateRgbBasis:()=>Zy,interpolateRgbBasisClosed:()=>Qy,interpolateRound:()=>c_,interpolateString:()=>l_,interpolateTransformCss:()=>yv,interpolateTransformSvg:()=>_v,interpolateZoom:()=>bv,piecewise:()=>Q_,quantize:()=>ab});var a={};n.r(a),n.d(a,{bound:()=>dA,identifier:()=>fA,mark:()=>mA,overlap:()=>gA,render:()=>EA,viewlayout:()=>GA});var l={};n.r(l),n.d(l,{interpolate:()=>wS,interpolateArray:()=>gS,interpolateBasis:()=>iS,interpolateBasisClosed:()=>rS,interpolateCubehelix:()=>rM,interpolateCubehelixLong:()=>sM,interpolateDate:()=>_S,interpolateDiscrete:()=>$O,interpolateHcl:()=>tM,interpolateHclLong:()=>nM,interpolateHsl:()=>ZO,interpolateHslLong:()=>QO,interpolateHue:()=>UO,interpolateLab:()=>JO,interpolateNumber:()=>vS,interpolateNumberArray:()=>fS,interpolateObject:()=>bS,interpolateRgb:()=>cS,interpolateRgbBasis:()=>hS,interpolateRgbBasisClosed:()=>pS,interpolateRound:()=>IS,interpolateString:()=>ES,interpolateTransformCss:()=>HO,interpolateTransformSvg:()=>WO,interpolateZoom:()=>qO,piecewise:()=>LO,quantize:()=>oM});var u={};n.r(u),n.d(u,{axisticks:()=>bR,datajoin:()=>TR,encode:()=>ER,legendentries:()=>wR,linkpath:()=>OR,pie:()=>DR,scale:()=>PR,sortitems:()=>zR,stack:()=>HR});var c={};n.r(c),n.d(c,{contour:()=>wF,geojson:()=>SF,geopath:()=>CF,geopoint:()=>OF,geoshape:()=>MF,graticule:()=>RF,heatmap:()=>kF,isocontour:()=>fF,kde2d:()=>TF,projection:()=>DF});var d={};n.r(d),n.d(d,{force:()=>OL});var h={};n.r(h),n.d(h,{nest:()=>OP,pack:()=>FP,partition:()=>PP,stratify:()=>BP,tree:()=>zP,treelinks:()=>VP,treemap:()=>GP});var p={};n.r(p),n.d(p,{label:()=>vG});var f={};n.r(f),n.d(f,{loess:()=>TG,regression:()=>EG});var m={};n.r(m),n.d(m,{voronoi:()=>HG});var g={};n.r(g),n.d(g,{interpolate:()=>YH,interpolateArray:()=>LH,interpolateBasis:()=>EH,interpolateBasisClosed:()=>wH,interpolateCubehelix:()=>jX,interpolateCubehelixLong:()=>YX,interpolateDate:()=>BH,interpolateDiscrete:()=>wX,interpolateHcl:()=>UX,interpolateHclLong:()=>zX,interpolateHsl:()=>LX,interpolateHslLong:()=>PX,interpolateHue:()=>IX,interpolateLab:()=>BX,interpolateNumber:()=>$H,interpolateNumberArray:()=>DH,interpolateObject:()=>UH,interpolateRgb:()=>MH,interpolateRgbBasis:()=>kH,interpolateRgbBasisClosed:()=>NH,interpolateRound:()=>GH,interpolateString:()=>jH,interpolateTransformCss:()=>RX,interpolateTransformSvg:()=>kX,interpolateZoom:()=>DX,piecewise:()=>_X,quantize:()=>GX});var y={};n.r(y),n.d(y,{wordcloud:()=>Zq});var _={};n.r(_),n.d(_,{crossfilter:()=>rK,resolvefilter:()=>sK});var v={};n.r(v),n.d(v,{Bounds:()=>fz,CanvasHandler:()=>Hj,CanvasRenderer:()=>Zj,DATE:()=>uu,DAY:()=>cu,DAYOFYEAR:()=>du,Dataflow:()=>Yo,Debug:()=>Te,Error:()=>_e,EventStream:()=>Oo,Gradient:()=>TU,GroupItem:()=>gz,HOURS:()=>hu,Handler:()=>Sj,Info:()=>be,Item:()=>mz,MILLISECONDS:()=>mu,MINUTES:()=>pu,MONTH:()=>au,Marks:()=>dj,MultiPulse:()=>$o,None:()=>ye,Operator:()=>Ao,Parameters:()=>Eo,Pulse:()=>Fo,QUARTER:()=>ou,RenderType:()=>zY,Renderer:()=>Oj,ResourceLoader:()=>yz,SECONDS:()=>fu,SVGHandler:()=>Jj,SVGRenderer:()=>wY,SVGStringRenderer:()=>BY,Scenegraph:()=>vj,TIME_UNITS:()=>gu,Transform:()=>Ho,View:()=>C2,WEEK:()=>lu,Warn:()=>ve,YEAR:()=>su,accessor:()=>te,accessorFields:()=>ie,accessorName:()=>ne,array:()=>Xe,ascending:()=>Je,bandwidthNRD:()=>la,bin:()=>ua,bootstrapCI:()=>ha,boundClip:()=>qY,boundContext:()=>Bz,boundItem:()=>hj,boundMark:()=>fj,boundStroke:()=>bz,changeset:()=>To,clampRange:()=>qe,codegenExpression:()=>e7,compare:()=>Qe,constant:()=>it,cumulativeLogNormal:()=>Sa,cumulativeNormal:()=>Ta,cumulativeUniform:()=>Na,dayofyear:()=>Eu,debounce:()=>rt,defaultLocale:()=>z$,definition:()=>Xo,densityLogNormal:()=>Aa,densityNormal:()=>ba,densityUniform:()=>ka,domChild:()=>Ej,domClear:()=>wj,domCreate:()=>Tj,domFind:()=>xj,dotbin:()=>pa,error:()=>ae,expressionFunction:()=>l1,extend:()=>st,extent:()=>ot,extentIndex:()=>at,falsy:()=>me,fastmap:()=>dt,field:()=>ue,flush:()=>ht,font:()=>ij,fontFamily:()=>nj,fontSize:()=>ZV,format:()=>dU,formatLocale:()=>N$,formats:()=>hU,hasOwnProperty:()=>ut,id:()=>ce,identity:()=>de,inferType:()=>rU,inferTypes:()=>sU,ingest:()=>mo,inherits:()=>pt,inrange:()=>ft,interpolate:()=>XM,interpolateColors:()=>GM,interpolateRange:()=>YM,intersect:()=>YY,intersectBoxLine:()=>qz,intersectPath:()=>Gz,intersectPoint:()=>Hz,intersectRule:()=>Xz,isArray:()=>Ee,isBoolean:()=>mt,isDate:()=>gt,isFunction:()=>Ke,isIterable:()=>yt,isNumber:()=>_t,isObject:()=>we,isRegExp:()=>vt,isString:()=>bt,isTuple:()=>ho,key:()=>Tt,lerp:()=>xt,lineHeight:()=>QV,loader:()=>mU,locale:()=>U$,logger:()=>xe,lruCache:()=>wt,markup:()=>yY,merge:()=>It,mergeConfig:()=>Ae,multiLineOffset:()=>ej,one:()=>pe,pad:()=>St,panLinear:()=>Pe,panLog:()=>Be,panPow:()=>$e,panSymlog:()=>Ue,parse:()=>c8,parseExpression:()=>Z9,parseSelector:()=>f7,pathCurves:()=>EU,pathEqual:()=>QY,pathParse:()=>AU,pathRectangle:()=>KU,pathRender:()=>PU,pathSymbols:()=>zU,pathTrail:()=>ZU,peek:()=>Oe,point:()=>Aj,projection:()=>tF,quantileLogNormal:()=>Ca,quantileNormal:()=>xa,quantileUniform:()=>Da,quantiles:()=>oa,quantizeInterpolator:()=>HM,quarter:()=>He,quartiles:()=>aa,random:()=>ca,randomInteger:()=>ma,randomKDE:()=>wa,randomLCG:()=>fa,randomLogNormal:()=>Oa,randomMixture:()=>Ma,randomNormal:()=>Ea,randomUniform:()=>Fa,read:()=>fU,regressionExp:()=>Va,regressionLinear:()=>Ua,regressionLoess:()=>qa,regressionLog:()=>za,regressionPoly:()=>Ga,regressionPow:()=>ja,regressionQuad:()=>Ya,renderModule:()=>jY,repeat:()=>At,resetDefaultLocale:()=>V$,resetSVGClipId:()=>hz,resetSVGDefIds:()=>JY,responseType:()=>pU,runtimeContext:()=>P1,sampleCurve:()=>Ja,sampleLogNormal:()=>Ia,sampleNormal:()=>va,sampleUniform:()=>Ra,scale:()=>DM,sceneEqual:()=>ZY,sceneFromJSON:()=>yj,scenePickVisit:()=>oV,sceneToJSON:()=>gj,sceneVisit:()=>sV,sceneZOrder:()=>rV,scheme:()=>QM,serializeXML:()=>_Y,setRandom:()=>da,span:()=>Ct,splitAccessPath:()=>le,stringValue:()=>Ot,textMetrics:()=>GV,timeBin:()=>pc,timeFloor:()=>$u,timeFormatLocale:()=>B$,timeInterval:()=>Gu,timeOffset:()=>Xu,timeSequence:()=>Zu,timeUnitSpecifier:()=>bu,timeUnits:()=>_u,toBoolean:()=>Mt,toDate:()=>kt,toNumber:()=>Me,toSet:()=>Dt,toString:()=>Nt,transform:()=>qo,transforms:()=>Wo,truncate:()=>Ft,truthy:()=>fe,tupleid:()=>po,typeParsers:()=>tU,utcFloor:()=>Vu,utcInterval:()=>Hu,utcOffset:()=>qu,utcSequence:()=>Qu,utcdayofyear:()=>Ou,utcquarter:()=>We,utcweek:()=>Mu,version:()=>v7,visitArray:()=>Lt,week:()=>wu,writeConfig:()=>Se,zero:()=>he,zoomLinear:()=>Ve,zoomLog:()=>je,zoomPow:()=>Ye,zoomSymlog:()=>Ge});var b={};n.r(b),n.d(b,{compile:()=>Bme,extractTransforms:()=>Ume,normalize:()=>Ile,version:()=>zme});var T={};n.r(T),n.d(T,{carbong10:()=>Vge,carbong100:()=>Yge,carbong90:()=>jge,carbonwhite:()=>zge,dark:()=>Hme,excel:()=>Xme,fivethirtyeight:()=>Jme,ggplot2:()=>tge,googlecharts:()=>xge,latimes:()=>age,powerbi:()=>Fge,quartz:()=>cge,urbaninstitute:()=>_ge,version:()=>Gge,vox:()=>hge});
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2022 Joachim Wester
* MIT licensed
*/
var x=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),E=Object.prototype.hasOwnProperty;function w(e,t){return E.call(e,t)}function I(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var i=[];for(var r in e)w(e,r)&&i.push(r);return i}function A(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function S(e){for(var t,n=0,i=e.length;n<i;){if(!((t=e.charCodeAt(n))>=48&&t<=57))return!1;n++}return!0}function C(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function O(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function M(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(M(e[t]))return!0}else if("object"==typeof e)for(var i=I(e),r=i.length,s=0;s<r;s++)if(M(e[i[s]]))return!0;return!1}function R(e,t){var n=[e];for(var i in t){var r="object"==typeof t[i]?JSON.stringify(t[i],null,2):t[i];void 0!==r&&n.push(i+": "+r)}return n.join("\n")}var k=function(e){function t(t,n,i,r,s){var o=this.constructor,a=e.call(this,R(t,{name:n,index:i,operation:r,tree:s}))||this;return a.name=n,a.index=i,a.operation=r,a.tree=s,Object.setPrototypeOf(a,o.prototype),a.message=R(t,{name:n,index:i,operation:r,tree:s}),a}return x(t,e),t}(Error),N=k,D=A,F={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var i=e[t];return delete e[t],{newDocument:n,removed:i}},replace:function(e,t,n){var i=e[t];return e[t]=this.value,{newDocument:n,removed:i}},move:function(e,t,n){var i=P(n,this.path);i&&(i=A(i));var r=B(n,{op:"remove",path:this.from}).removed;return B(n,{op:"add",path:this.path,value:r}),{newDocument:n,removed:i}},copy:function(e,t,n){var i=P(n,this.from);return B(n,{op:"add",path:this.path,value:A(i)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:j(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},L={add:function(e,t,n){return S(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var i=e[t];return e[t]=this.value,{newDocument:n,removed:i}},move:F.move,copy:F.copy,test:F.test,_get:F._get};function P(e,t){if(""==t)return e;var n={op:"_get",path:t};return B(e,n),n.value}function B(e,t,n,i,r,s){if(void 0===n&&(n=!1),void 0===i&&(i=!0),void 0===r&&(r=!0),void 0===s&&(s=0),n&&("function"==typeof n?n(t,0,e,t.path):z(t,0)),""===t.path){var o={newDocument:e};if("add"===t.op)return o.newDocument=t.value,o;if("replace"===t.op)return o.newDocument=t.value,o.removed=e,o;if("move"===t.op||"copy"===t.op)return o.newDocument=P(e,t.from),"move"===t.op&&(o.removed=e),o;if("test"===t.op){if(o.test=j(e,t.value),!1===o.test)throw new N("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o.newDocument=e,o}if("remove"===t.op)return o.removed=e,o.newDocument=null,o;if("_get"===t.op)return t.value=e,o;if(n)throw new N("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,t,e);return o}i||(e=A(e));var a=(t.path||"").split("/"),l=e,u=1,c=a.length,d=void 0,h=void 0,p=void 0;for(p="function"==typeof n?n:z;;){if((h=a[u])&&-1!=h.indexOf("~")&&(h=O(h)),r&&("__proto__"==h||"prototype"==h&&u>0&&"constructor"==a[u-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===d&&(void 0===l[h]?d=a.slice(0,u).join("/"):u==c-1&&(d=t.path),void 0!==d&&p(t,0,e,d)),u++,Array.isArray(l)){if("-"===h)h=l.length;else{if(n&&!S(h))throw new N("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,t,e);S(h)&&(h=~~h)}if(u>=c){if(n&&"add"===t.op&&h>l.length)throw new N("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,t,e);if(!1===(o=L[t.op].call(t,l,h,e)).test)throw new N("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o}}else if(u>=c){if(!1===(o=F[t.op].call(t,l,h,e)).test)throw new N("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o}if(l=l[h],n&&u<c&&(!l||"object"!=typeof l))throw new N("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,t,e)}}function $(e,t,n,i,r){if(void 0===i&&(i=!0),void 0===r&&(r=!0),n&&!Array.isArray(t))throw new N("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");i||(e=A(e));for(var s=new Array(t.length),o=0,a=t.length;o<a;o++)s[o]=B(e,t[o],n,!0,r,o),e=s[o].newDocument;return s.newDocument=e,s}function U(e,t,n){var i=B(e,t);if(!1===i.test)throw new N("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return i.newDocument}function z(e,t,n,i){if("object"!=typeof e||null===e||Array.isArray(e))throw new N("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(!F[e.op])throw new N("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n);if("string"!=typeof e.path)throw new N("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new N('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new N("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new N("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&M(e.value))throw new N("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var r=e.path.split("/").length,s=i.split("/").length;if(r!==s+1&&r!==s)throw new N("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==i)throw new N("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var o=V([{op:"_get",path:e.from,value:void 0}],n);if(o&&"OPERATION_PATH_UNRESOLVABLE"===o.name)throw new N("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function V(e,t,n){try{if(!Array.isArray(e))throw new N("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)$(A(t),A(e),n||!0);else{n=n||z;for(var i=0;i<e.length;i++)n(e[i],i,t,void 0)}}catch(e){if(e instanceof N)return e;throw e}}function j(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,i,r,s=Array.isArray(e),o=Array.isArray(t);if(s&&o){if((i=e.length)!=t.length)return!1;for(n=i;0!==n--;)if(!j(e[n],t[n]))return!1;return!0}if(s!=o)return!1;var a=Object.keys(e);if((i=a.length)!==Object.keys(t).length)return!1;for(n=i;0!==n--;)if(!t.hasOwnProperty(a[n]))return!1;for(n=i;0!==n--;)if(!j(e[r=a[n]],t[r]))return!1;return!0}return e!=e&&t!=t}
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2021 Joachim Wester
* MIT license
*/
var Y=new WeakMap,G=function(e){this.observers=new Map,this.obj=e},H=function(e,t){this.callback=e,this.observer=t};function W(e,t){t.unobserve()}function X(e,t){var n,i=function(e){return Y.get(e)}(e);if(i){var r=function(e,t){return e.observers.get(t)}(i,t);n=r&&r.observer}else i=new G(e),Y.set(e,i);if(n)return n;if(n={},i.value=A(e),t){n.callback=t,n.next=null;var s=function(){q(n)},o=function(){clearTimeout(n.next),n.next=setTimeout(s)};"undefined"!=typeof window&&(window.addEventListener("mouseup",o),window.addEventListener("keyup",o),window.addEventListener("mousedown",o),window.addEventListener("keydown",o),window.addEventListener("change",o))}return n.patches=[],n.object=e,n.unobserve=function(){q(n),clearTimeout(n.next),function(e,t){e.observers.delete(t.callback)}(i,n),"undefined"!=typeof window&&(window.removeEventListener("mouseup",o),window.removeEventListener("keyup",o),window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o),window.removeEventListener("change",o))},i.observers.set(t,new H(t,n)),n}function q(e,t){void 0===t&&(t=!1);var n=Y.get(e.object);K(n.value,e.object,e.patches,"",t),e.patches.length&&$(n.value,e.patches);var i=e.patches;return i.length>0&&(e.patches=[],e.callback&&e.callback(i)),i}function K(e,t,n,i,r){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var s=I(t),o=I(e),a=!1,l=o.length-1;l>=0;l--){var u=e[d=o[l]];if(!w(t,d)||void 0===t[d]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:i+"/"+C(d),value:A(u)}),n.push({op:"remove",path:i+"/"+C(d)}),a=!0):(r&&n.push({op:"test",path:i,value:e}),n.push({op:"replace",path:i,value:t}),!0);else{var c=t[d];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?K(u,c,n,i+"/"+C(d),r):u!==c&&(r&&n.push({op:"test",path:i+"/"+C(d),value:A(u)}),n.push({op:"replace",path:i+"/"+C(d),value:A(c)}))}}if(a||s.length!=o.length)for(l=0;l<s.length;l++){var d;w(e,d=s[l])||void 0===t[d]||n.push({op:"add",path:i+"/"+C(d),value:A(t[d])})}}}function Z(e,t,n){void 0===n&&(n=!1);var i=[];return K(e,t,i,"",n),i}Object.assign({},i,r,{JsonPatchError:k,deepClone:A,escapePathComponent:C,unescapePathComponent:O});var Q=n(48487),J=n.n(Q),ee=n(99589);function te(e,t,n){return e.fields=t||[],e.fname=n,e}function ne(e){return null==e?null:e.fname}function ie(e){return null==e?null:e.fields}function re(e){return 1===e.length?se(e[0]):oe(e)}const se=e=>function(t){return t[e]},oe=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function ae(e){throw Error(e)}function le(e){const t=[],n=e.length;let i,r,s,o=null,a=0,l="";function u(){t.push(l+e.substring(i,r)),l="",i=r+1}for(e+="",i=r=0;r<n;++r)if(s=e[r],"\\"===s)l+=e.substring(i,r),l+=e.substring(++r,++r),i=r;else if(s===o)u(),o=null,a=-1;else{if(o)continue;i===a&&'"'===s||i===a&&"'"===s?(i=r+1,o=s):"."!==s||a?"["===s?(r>i&&u(),a=i=r+1):"]"===s&&(a||ae("Access path missing open bracket: "+e),a>0&&u(),a=0,i=r+1):r>i?u():i=r+1}return a&&ae("Access path missing closing bracket: "+e),o&&ae("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function ue(e,t,n){const i=le(e);return e=1===i.length?i[0]:e,te((n&&n.get||re)(i),[e],t||e)}const ce=ue("id"),de=te(e=>e,[],"identity"),he=te(()=>0,[],"zero"),pe=te(()=>1,[],"one"),fe=te(()=>!0,[],"true"),me=te(()=>!1,[],"false");function ge(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const ye=0,_e=1,ve=2,be=3,Te=4;function xe(e,t){let n=e||ye;return{level(e){return arguments.length?(n=+e,this):n},error(){return n>=_e&&ge(t||"error","ERROR",arguments),this},warn(){return n>=ve&&ge(t||"warn","WARN",arguments),this},info(){return n>=be&&ge(t||"log","INFO",arguments),this},debug(){return n>=Te&&ge(t||"log","DEBUG",arguments),this}}}var Ee=Array.isArray;function we(e){return e===Object(e)}const Ie=e=>"__proto__"!==e;function Ae(...e){return e.reduce((e,t)=>{for(const n in t)if("signals"===n)e.signals=Ce(e.signals,t.signals);else{const i="legend"===n?{layout:1}:"style"===n||null;Se(e,n,t[n],i)}return e},{})}function Se(e,t,n,i){if(!Ie(t))return;let r,s;if(we(n)&&!Ee(n))for(r in s=we(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?Se(s,r,n[r]):Ie(r)&&(s[r]=n[r]);else e[t]=n}function Ce(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function Oe(e){return e[e.length-1]}function Me(e){return null==e||""===e?null:+e}const Re=e=>t=>e*Math.exp(t),ke=e=>t=>Math.log(e*t),Ne=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),De=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Fe=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function Le(e,t,n,i){const r=n(e[0]),s=n(Oe(e)),o=(s-r)*t;return[i(r-o),i(s-o)]}function Pe(e,t){return Le(e,t,Me,de)}function Be(e,t){var n=Math.sign(e[0]);return Le(e,t,ke(n),Re(n))}function $e(e,t,n){return Le(e,t,Fe(n),Fe(1/n))}function Ue(e,t,n){return Le(e,t,Ne(n),De(n))}function ze(e,t,n,i,r){const s=i(e[0]),o=i(Oe(e)),a=null!=t?i(t):(s+o)/2;return[r(a+(s-a)*n),r(a+(o-a)*n)]}function Ve(e,t,n){return ze(e,t,n,Me,de)}function je(e,t,n){const i=Math.sign(e[0]);return ze(e,t,n,ke(i),Re(i))}function Ye(e,t,n,i){return ze(e,t,n,Fe(i),Fe(1/i))}function Ge(e,t,n,i){return ze(e,t,n,Ne(i),De(i))}function He(e){return 1+~~(new Date(e).getMonth()/3)}function We(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Xe(e){return null!=e?Ee(e)?e:[e]:[]}function qe(e,t,n){let i,r=e[0],s=e[1];return s<r&&(i=s,s=r,r=i),i=s-r,i>=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-i),r+i]}function Ke(e){return"function"==typeof e}const Ze="descending";function Qe(e,t,n){n=n||{},t=Xe(t)||[];const i=[],r=[],s={},o=n.comparator||et;return Xe(e).forEach((e,o)=>{null!=e&&(i.push(t[o]===Ze?-1:1),r.push(e=Ke(e)?e:ue(e,null,n)),(ie(e)||[]).forEach(e=>s[e]=1))}),0===r.length?null:te(o(r,i),Object.keys(s))}const Je=(e,t)=>(e<t||null==e)&&null!=t?-1:(e>t||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0),et=(e,t)=>1===e.length?tt(e[0],t[0]):nt(e,t,e.length),tt=(e,t)=>function(n,i){return Je(e(n),e(i))*t},nt=(e,t,n)=>(t.push(0),function(i,r){let s,o=0,a=-1;for(;0===o&&++a<n;)s=e[a],o=Je(s(i),s(r));return o*t[a]});function it(e){return Ke(e)?e:()=>e}function rt(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout(()=>(t(i),n=null),e)}}function st(e){for(let t,n,i=1,r=arguments.length;i<r;++i)for(n in t=arguments[i],t)e[n]=t[n];return e}function ot(e,t){let n,i,r,s,o=0;if(e&&(n=e.length))if(null==t){for(i=e[o];o<n&&(null==i||i!=i);i=e[++o]);for(r=s=i;o<n;++o)i=e[o],null!=i&&(i<r&&(r=i),i>s&&(s=i))}else{for(i=t(e[o]);o<n&&(null==i||i!=i);i=t(e[++o]));for(r=s=i;o<n;++o)i=t(e[o]),null!=i&&(i<r&&(r=i),i>s&&(s=i))}return[r,s]}function at(e,t){const n=e.length;let i,r,s,o,a,l=-1;if(null==t){for(;++l<n;)if(r=e[l],null!=r&&r>=r){i=s=r;break}if(l===n)return[-1,-1];for(o=a=l;++l<n;)r=e[l],null!=r&&(i>r&&(i=r,o=l),s<r&&(s=r,a=l))}else{for(;++l<n;)if(r=t(e[l],l,e),null!=r&&r>=r){i=s=r;break}if(l===n)return[-1,-1];for(o=a=l;++l<n;)r=t(e[l],l,e),null!=r&&(i>r&&(i=r,o=l),s<r&&(s=r,a=l))}return[o,a]}const lt=Object.prototype.hasOwnProperty;function ut(e,t){return lt.call(e,t)}const ct={};function dt(e){let t,n={};function i(e){return ut(n,e)&&n[e]!==ct}const r={size:0,empty:0,object:n,has:i,get:e=>i(e)?n[e]:void 0,set(e,t){return i(e)||(++r.size,n[e]===ct&&--r.empty),n[e]=t,this},delete(e){return i(e)&&(--r.size,++r.empty,n[e]=ct),this},clear(){r.size=r.empty=0,r.object=n={}},test(e){return arguments.length?(t=e,r):t},clean(){const e={};let i=0;for(const r in n){const s=n[r];s===ct||t&&t(s)||(e[r]=s,++i)}r.size=i,r.empty=0,r.object=n=e}};return e&&Object.keys(e).forEach(t=>{r.set(t,e[t])}),r}function ht(e,t,n,i,r,s){if(!n&&0!==n)return s;const o=+n;let a,l=e[0],u=Oe(e);u<l&&(a=l,l=u,u=a),a=Math.abs(t-l);const c=Math.abs(u-t);return a<c&&a<=o?i:c<=o?r:s}function pt(e,t,n){const i=e.prototype=Object.create(t.prototype);return Object.defineProperty(i,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),st(i,n)}function ft(e,t,n,i){let r,s=t[0],o=t[t.length-1];return s>o&&(r=s,s=o,o=r),i=void 0===i||i,((n=void 0===n||n)?s<=e:s<e)&&(i?e<=o:e<o)}function mt(e){return"boolean"==typeof e}function gt(e){return"[object Date]"===Object.prototype.toString.call(e)}function yt(e){return e&&Ke(e[Symbol.iterator])}function _t(e){return"number"==typeof e}function vt(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function bt(e){return"string"==typeof e}function Tt(e,t,n){e&&(e=t?Xe(e).map(e=>e.replace(/\\(.)/g,"$1")):Xe(e));const i=e&&e.length,r=n&&n.get||re,s=e=>r(t?[e]:le(e));let o;if(i)if(1===i){const t=s(e[0]);o=function(e){return""+t(e)}}else{const t=e.map(s);o=function(e){let n=""+t[0](e),r=0;for(;++r<i;)n+="|"+t[r](e);return n}}else o=function(){return""};return te(o,e,"key")}function xt(e,t){const n=e[0],i=Oe(e),r=+t;return r?1===r?i:n+r*(i-n):n}const Et=1e4;function wt(e){let t,n,i;e=+e||Et;const r=()=>{t={},n={},i=0},s=(r,s)=>(++i>e&&(n=t,t={},i=1),t[r]=s);return r(),{clear:r,has:e=>ut(t,e)||ut(n,e),get:e=>ut(t,e)?t[e]:ut(n,e)?s(e,n[e]):void 0,set:(e,n)=>ut(t,e)?t[e]=n:s(e,n)}}function It(e,t,n,i){const r=t.length,s=n.length;if(!s)return t;if(!r)return n;const o=i||new t.constructor(r+s);let a=0,l=0,u=0;for(;a<r&&l<s;++u)o[u]=e(t[a],n[l])>0?n[l++]:t[a++];for(;a<r;++a,++u)o[u]=t[a];for(;l<s;++l,++u)o[u]=n[l];return o}function At(e,t){let n="";for(;--t>=0;)n+=e;return n}function St(e,t,n,i){const r=n||" ",s=e+"",o=t-s.length;return o<=0?s:"left"===i?At(r,o)+s:"center"===i?At(r,~~(o/2))+s+At(r,Math.ceil(o/2)):s+At(r,o)}function Ct(e){return e&&Oe(e)-e[0]||0}function Ot(e){return Ee(e)?"["+e.map(Ot)+"]":we(e)||bt(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function Mt(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e)&&!!e}const Rt=e=>_t(e)||gt(e)?e:Date.parse(e);function kt(e,t){return t=t||Rt,null==e||""===e?null:t(e)}function Nt(e){return null==e||""===e?null:e+""}function Dt(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]]=!0;return t}function Ft(e,t,n,i){const r=null!=i?i:"…",s=e+"",o=s.length,a=Math.max(0,t-r.length);return o<=t?s:"left"===n?r+s.slice(o-a):"center"===n?s.slice(0,Math.ceil(a/2))+r+s.slice(o-~~(a/2)):s.slice(0,a)+r}function Lt(e,t,n){if(e)if(t){const i=e.length;for(let r=0;r<i;++r){const i=t(e[r]);i&&n(i,r,e)}}else e.forEach(n)}function Pt(e,t,n){return e.fields=t||[],e.fname=n,e}function Bt(e){return 1===e.length?$t(e[0]):Ut(e)}const $t=e=>function(t){return t[e]},Ut=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function zt(e){throw Error(e)}function Vt(e){const t=[],n=e.length;let i,r,s,o=null,a=0,l="";function u(){t.push(l+e.substring(i,r)),l="",i=r+1}for(e+="",i=r=0;r<n;++r)if(s=e[r],"\\"===s)l+=e.substring(i,r++),i=r;else if(s===o)u(),o=null,a=-1;else{if(o)continue;i===a&&'"'===s||i===a&&"'"===s?(i=r+1,o=s):"."!==s||a?"["===s?(r>i&&u(),a=i=r+1):"]"===s&&(a||zt("Access path missing open bracket: "+e),a>0&&u(),a=0,i=r+1):r>i?u():i=r+1}return a&&zt("Access path missing closing bracket: "+e),o&&zt("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function jt(e,t,n){const i=Vt(e);return e=1===i.length?i[0]:e,Pt((n&&n.get||Bt)(i),[e],t||e)}const Yt=jt("id"),Gt=Pt(e=>e,[],"identity"),Ht=(Pt(()=>0,[],"zero"),Pt(()=>1,[],"one"),Pt(()=>!0,[],"true"));Pt(()=>!1,[],"false");function Wt(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const Xt=0,qt=1,Kt=2,Zt=3,Qt=4;var Jt=Array.isArray;function en(e){return e===Object(e)}function tn(e){return null==e||""===e?null:+e}function nn(e){return null!=e?Jt(e)?e:[e]:[]}function rn(e){return"function"==typeof e}function sn(e){return rn(e)?e:()=>e}function on(e){for(let t,n,i=1,r=arguments.length;i<r;++i)for(n in t=arguments[i],t)e[n]=t[n];return e}function an(e,t){return Object.hasOwn(e,t)}function ln(e,t,n){const i=e.prototype=Object.create(t.prototype);return Object.defineProperty(i,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),on(i,n)}function un(e){return"string"==typeof e}function cn(e){return Jt(e)?"["+e.map(cn)+"]":en(e)||un(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}const dn=e=>function(e){return"number"==typeof e}(e)||function(e){return"[object Date]"===Object.prototype.toString.call(e)}(e)?e:Date.parse(e);function hn(e,t,n){if(e)if(t){const i=e.length;for(let r=0;r<i;++r){const i=t(e[r]);i&&n(i,r,e)}}else e.forEach(n)}var pn={},fn={};function mn(e){return new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'}).join(",")+"}")}function gn(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var i in e)i in t||n.push(t[i]=i)}),n}function yn(e,t){var n=e+"",i=n.length;return i<t?new Array(t-i+1).join(0)+n:n}function _n(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),r=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":function(e){return e<0?"-"+yn(-e,6):e>9999?"+"+yn(e,6):yn(e,4)}(e.getUTCFullYear())+"-"+yn(e.getUTCMonth()+1,2)+"-"+yn(e.getUTCDate(),2)+(r?"T"+yn(t,2)+":"+yn(n,2)+":"+yn(i,2)+"."+yn(r,3)+"Z":i?"T"+yn(t,2)+":"+yn(n,2)+":"+yn(i,2)+"Z":n||t?"T"+yn(t,2)+":"+yn(n,2)+"Z":"")}function vn(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function i(e,t){var i,r=[],s=e.length,o=0,a=0,l=s<=0,u=!1;function c(){if(l)return fn;if(u)return u=!1,pn;var t,i,r=o;if(34===e.charCodeAt(r)){for(;o++<s&&34!==e.charCodeAt(o)||34===e.charCodeAt(++o););return(t=o)>=s?l=!0:10===(i=e.charCodeAt(o++))?u=!0:13===i&&(u=!0,10===e.charCodeAt(o)&&++o),e.slice(r+1,t-1).replace(/""/g,'"')}for(;o<s;){if(10===(i=e.charCodeAt(t=o++)))u=!0;else if(13===i)u=!0,10===e.charCodeAt(o)&&++o;else if(i!==n)continue;return e.slice(r,t)}return l=!0,e.slice(r,s)}for(10===e.charCodeAt(s-1)&&--s,13===e.charCodeAt(s-1)&&--s;(i=c())!==fn;){for(var d=[];i!==pn&&i!==fn;)d.push(i),i=c();t&&null==(d=t(d,a++))||r.push(d)}return r}function r(t,n){return t.map(function(t){return n.map(function(e){return o(t[e])}).join(e)})}function s(t){return t.map(o).join(e)}function o(e){return null==e?"":e instanceof Date?_n(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,r,s=i(e,function(e,i){if(n)return n(e,i-1);r=e,n=t?function(e,t){var n=mn(e);return function(i,r){return t(n(i),r,e)}}(e,t):mn(e)});return s.columns=r||[],s},parseRows:i,format:function(t,n){return null==n&&(n=gn(t)),[n.map(o).join(e)].concat(r(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=gn(e)),r(e,t).join("\n")},formatRows:function(e){return e.map(s).join("\n")},formatRow:s,formatValue:o}}function bn(e){return e}function Tn(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return xn(e,t)})}:xn(e,t)}function xn(e,t){var n=t.id,i=t.bbox,r=null==t.properties?{}:t.properties,s=En(e,t);return null==n&&null==i?{type:"Feature",properties:r,geometry:s}:null==i?{type:"Feature",id:n,properties:r,geometry:s}:{type:"Feature",id:n,bbox:i,properties:r,geometry:s}}function En(e,t){var n=function(e){if(null==e)return bn;var t,n,i=e.scale[0],r=e.scale[1],s=e.translate[0],o=e.translate[1];return function(e,a){a||(t=n=0);var l=2,u=e.length,c=new Array(u);for(c[0]=(t+=e[0])*i+s,c[1]=(n+=e[1])*r+o;l<u;)c[l]=e[l],++l;return c}}(e.transform),i=e.arcs;function r(e,t){t.length&&t.pop();for(var r=i[e<0?~e:e],s=0,o=r.length;s<o;++s)t.push(n(r[s],s));e<0&&function(e,t){for(var n,i=e.length,r=i-t;r<--i;)n=e[r],e[r++]=e[i],e[i]=n}(t,o)}function s(e){return n(e)}function o(e){for(var t=[],n=0,i=e.length;n<i;++n)r(e[n],t);return t.length<2&&t.push(t[0]),t}function a(e){for(var t=o(e);t.length<4;)t.push(t[0]);return t}function l(e){return e.map(a)}return function e(t){var n,i=t.type;switch(i){case"GeometryCollection":return{type:i,geometries:t.geometries.map(e)};case"Point":n=s(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(s);break;case"LineString":n=o(t.arcs);break;case"MultiLineString":n=t.arcs.map(o);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:i,coordinates:n}}(t)}function wn(e,t){var n={},i={},r={},s=[],o=-1;function a(e,t){for(var i in e){var r=e[i];delete t[r.start],delete r.start,delete r.end,r.forEach(function(e){n[e<0?~e:e]=1}),s.push(r)}}return t.forEach(function(n,i){var r,s=e.arcs[n<0?~n:n];s.length<3&&!s[1][0]&&!s[1][1]&&(r=t[++o],t[o]=n,t[i]=r)}),t.forEach(function(t){var n,s,o=function(t){var n,i=e.arcs[t<0?~t:t],r=i[0];e.transform?(n=[0,0],i.forEach(function(e){n[0]+=e[0],n[1]+=e[1]})):n=i[i.length-1];return t<0?[n,r]:[r,n]}(t),a=o[0],l=o[1];if(n=r[a])if(delete r[n.end],n.push(t),n.end=l,s=i[l]){delete i[s.start];var u=s===n?n:n.concat(s);i[u.start=n.start]=r[u.end=s.end]=u}else i[n.start]=r[n.end]=n;else if(n=i[l])if(delete i[n.start],n.unshift(t),n.start=a,s=r[a]){delete r[s.end];var c=s===n?n:s.concat(n);i[c.start=s.start]=r[c.end=n.end]=c}else i[n.start]=r[n.end]=n;else i[(n=[t]).start=a]=r[n.end=l]=n}),a(r,i),a(i,r),t.forEach(function(e){n[e<0?~e:e]||s.push([e])}),s}function In(e){return En(e,An.apply(this,arguments))}function An(e,t,n){var i,r,s;if(arguments.length>1)i=function(e,t,n){var i,r=[],s=[];function o(e){var t=e<0?~e:e;(s[t]||(s[t]=[])).push({i:e,g:i})}function a(e){e.forEach(o)}function l(e){e.forEach(a)}function u(e){e.forEach(l)}function c(e){switch(i=e,e.type){case"GeometryCollection":e.geometries.forEach(c);break;case"LineString":a(e.arcs);break;case"MultiLineString":case"Polygon":l(e.arcs);break;case"MultiPolygon":u(e.arcs)}}return c(t),s.forEach(null==n?function(e){r.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&r.push(e[0].i)}),r}(0,t,n);else for(r=0,i=new Array(s=e.arcs.length);r<s;++r)i[r]=r;return{type:"MultiLineString",arcs:wn(e,i)}}const Sn=Math.sqrt(50),Cn=Math.sqrt(10),On=Math.sqrt(2);function Mn(e,t,n){const i=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),o=s>=Sn?10:s>=Cn?5:s>=On?2:1;let a,l,u;return r<0?(u=Math.pow(10,-r)/o,a=Math.round(e*u),l=Math.round(t*u),a/u<e&&++a,l/u>t&&--l,u=-u):(u=Math.pow(10,r)*o,a=Math.round(e/u),l=Math.round(t/u),a*u<e&&++a,l*u>t&&--l),l<a&&.5<=n&&n<2?Mn(e,t,2*n):[a,l,u]}function Rn(e,t,n){return Mn(e=+e,t=+t,n=+n)[2]}var kn,Nn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Dn(e){if(!(t=Nn.exec(e)))throw new Error("invalid format: "+e);var t;return new Fn({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function Fn(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function Ln(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function Pn(e){return(e=Ln(Math.abs(e)))?e[1]:NaN}function Bn(e,t){var n=Ln(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}Dn.prototype=Fn.prototype,Fn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const $n={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Bn(100*e,t),r:Bn,s:function(e,t){var n=Ln(e,t);if(!n)return e+"";var i=n[0],r=n[1],s=r-(kn=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+Ln(e,Math.max(0,t+s-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Un(e){return e}var zn,Vn,jn,Yn=Array.prototype.map,Gn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Hn(e){var t,n,i=void 0===e.grouping||void 0===e.thousands?Un:(t=Yn.call(e.grouping,Number),n=e.thousands+"",function(e,i){for(var r=e.length,s=[],o=0,a=t[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),s.push(e.substring(r-=a,r+a)),!((l+=a+1)>i));)a=t[o=(o+1)%t.length];return s.reverse().join(n)}),r=void 0===e.currency?"":e.currency[0]+"",s=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",a=void 0===e.numerals?Un:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(Yn.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=Dn(e)).fill,n=e.align,d=e.sign,h=e.symbol,p=e.zero,f=e.width,m=e.comma,g=e.precision,y=e.trim,_=e.type;"n"===_?(m=!0,_="g"):$n[_]||(void 0===g&&(g=12),y=!0,_="g"),(p||"0"===t&&"="===n)&&(p=!0,t="0",n="=");var v="$"===h?r:"#"===h&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",b="$"===h?s:/[%p]/.test(_)?l:"",T=$n[_],x=/[defgprs%]/.test(_);function E(e){var r,s,l,h=v,E=b;if("c"===_)E=T(e)+E,e="";else{var w=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:T(Math.abs(e),g),y&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i<n;++i)switch(e[i]){case".":r=t=i;break;case"0":0===r&&(r=i),t=i;break;default:if(!+e[i])break e;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),w&&0===+e&&"+"!==d&&(w=!1),h=(w?"("===d?d:u:"-"===d||"("===d?"":d)+h,E=("s"===_?Gn[8+kn/3]:"")+E+(w&&"("===d?")":""),x)for(r=-1,s=e.length;++r<s;)if(48>(l=e.charCodeAt(r))||l>57){E=(46===l?o+e.slice(r+1):e.slice(r))+E,e=e.slice(0,r);break}}m&&!p&&(e=i(e,1/0));var I=h.length+e.length+E.length,A=I<f?new Array(f-I+1).join(t):"";switch(m&&p&&(e=i(A+e,A.length?f-E.length:1/0),A=""),n){case"<":e=h+e+E+A;break;case"=":e=h+A+e+E;break;case"^":e=A.slice(0,I=A.length>>1)+h+e+E+A.slice(I);break;default:e=A+h+e+E}return a(e)}return g=void 0===g?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),E.toString=function(){return e+""},E}return{format:d,formatPrefix:function(e,t){var n=d(((e=Dn(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(Pn(t)/3))),r=Math.pow(10,-i),s=Gn[8+i/3];return function(e){return n(r*e)+s}}}}!function(e){zn=Hn(e),Vn=zn.format,jn=zn.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const Wn=new Date,Xn=new Date;function qn(e,t,n,i){function r(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return r.floor=t=>(e(t=new Date(+t)),t),r.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),r.round=e=>{const t=r(e),n=r.ceil(e);return e-t<n-e?t:n},r.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),r.range=(n,i,s)=>{const o=[];if(n=r.ceil(n),s=null==s?1:Math.floor(s),!(n<i&&s>0))return o;let a;do{o.push(a=new Date(+n)),t(n,s),e(n)}while(a<n&&n<i);return o},r.filter=n=>qn(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,i)=>{if(e>=e)if(i<0)for(;++i<=0;)for(;t(e,-1),!n(e););else for(;--i>=0;)for(;t(e,1),!n(e););}),n&&(r.count=(t,i)=>(Wn.setTime(+t),Xn.setTime(+i),e(Wn),e(Xn),Math.floor(n(Wn,Xn))),r.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?r.filter(i?t=>i(t)%e===0:t=>r.count(0,t)%e===0):r:null)),r}const Kn=1e3,Zn=6e4,Qn=36e5,Jn=864e5,ei=6048e5,ti=qn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Zn)/Jn,e=>e.getDate()-1),ni=(ti.range,qn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Jn,e=>e.getUTCDate()-1)),ii=(ni.range,qn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Jn,e=>Math.floor(e/Jn)));ii.range;function ri(e){return qn(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Zn)/ei)}const si=ri(0),oi=ri(1),ai=ri(2),li=ri(3),ui=ri(4),ci=ri(5),di=ri(6);si.range,oi.range,ai.range,li.range,ui.range,ci.range,di.range;function hi(e){return qn(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/ei)}const pi=hi(0),fi=hi(1),mi=hi(2),gi=hi(3),yi=hi(4),_i=hi(5),vi=hi(6),bi=(pi.range,fi.range,mi.range,gi.range,yi.range,_i.range,vi.range,qn(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear()));bi.every=e=>isFinite(e=Math.floor(e))&&e>0?qn(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null;bi.range;const Ti=qn(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Ti.every=e=>isFinite(e=Math.floor(e))&&e>0?qn(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null;Ti.range;const xi=qn(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear()),e=>e.getMonth()),Ei=(xi.range,qn(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear()),e=>e.getUTCMonth())),wi=(Ei.range,qn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Kn-e.getMinutes()*Zn)},(e,t)=>{e.setTime(+e+t*Qn)},(e,t)=>(t-e)/Qn,e=>e.getHours())),Ii=(wi.range,qn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Qn)},(e,t)=>(t-e)/Qn,e=>e.getUTCHours())),Ai=(Ii.range,qn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Kn)},(e,t)=>{e.setTime(+e+t*Zn)},(e,t)=>(t-e)/Zn,e=>e.getMinutes())),Si=(Ai.range,qn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Zn)},(e,t)=>(t-e)/Zn,e=>e.getUTCMinutes())),Ci=(Si.range,qn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Kn)},(e,t)=>(t-e)/Kn,e=>e.getUTCSeconds())),Oi=(Ci.range,qn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e));Oi.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?qn(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Oi:null);Oi.range;const Mi="year",Ri="quarter",ki="month",Ni="week",Di="date",Fi="day",Li="dayofyear",Pi="hours",Bi="minutes",$i="seconds",Ui="milliseconds";[Mi,Ri,ki,Ni,Di,Fi,Li,Pi,Bi,$i,Ui].reduce((e,t,n)=>(e[t]=1+n,e),{});new Date;const zi={[Mi]:bi,[Ri]:xi.every(3),[ki]:xi,[Ni]:si,[Di]:ti,[Fi]:ti,[Li]:ti,[Pi]:wi,[Bi]:Ai,[$i]:Ci,[Ui]:Oi},Vi={[Mi]:Ti,[Ri]:Ei.every(3),[ki]:Ei,[Ni]:pi,[Di]:ni,[Fi]:ni,[Li]:ni,[Pi]:Ii,[Bi]:Si,[$i]:Ci,[Ui]:Oi};function ji(e){return zi[e]}function Yi(e){return Vi[e]}const Gi=[Mi,ki,Di,Pi,Bi,$i,Ui],Hi=Gi.slice(0,-1),Wi=Hi.slice(0,-1),Xi=Wi.slice(0,-1);Xi.slice(0,-1);function qi(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Ki(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Zi(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Qi(e){var t=e.dateTime,n=e.date,i=e.time,r=e.periods,s=e.days,o=e.shortDays,a=e.months,l=e.shortMonths,u=cr(r),c=dr(r),d=cr(s),h=dr(s),p=cr(o),f=dr(o),m=cr(a),g=dr(a),y=cr(l),_=dr(l),v={a:function(e){return o[e.getDay()]},A:function(e){return s[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return a[e.getMonth()]},c:null,d:kr,e:kr,f:Pr,g:Xr,G:Kr,H:Nr,I:Dr,j:Fr,L:Lr,m:Br,M:$r,p:function(e){return r[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:vs,s:bs,S:Ur,u:zr,U:Vr,V:Yr,w:Gr,W:Hr,x:null,X:null,y:Wr,Y:qr,Z:Zr,"%":_s},b={a:function(e){return o[e.getUTCDay()]},A:function(e){return s[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return a[e.getUTCMonth()]},c:null,d:Qr,e:Qr,f:is,g:fs,G:gs,H:Jr,I:es,j:ts,L:ns,m:rs,M:ss,p:function(e){return r[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:vs,s:bs,S:os,u:as,U:ls,V:cs,w:ds,W:hs,x:null,X:null,y:ps,Y:ms,Z:ys,"%":_s},T={a:function(e,t,n){var i=p.exec(t.slice(n));return i?(e.w=f.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(e,t,n){var i=d.exec(t.slice(n));return i?(e.w=h.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(e,t,n){var i=y.exec(t.slice(n));return i?(e.m=_.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(e,t,n){var i=m.exec(t.slice(n));return i?(e.m=g.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(e,n,i){return w(e,t,n,i)},d:xr,e:xr,f:Cr,g:_r,G:yr,H:wr,I:wr,j:Er,L:Sr,m:Tr,M:Ir,p:function(e,t,n){var i=u.exec(t.slice(n));return i?(e.p=c.get(i[0].toLowerCase()),n+i[0].length):-1},q:br,Q:Mr,s:Rr,S:Ar,u:pr,U:fr,V:mr,w:hr,W:gr,x:function(e,t,i){return w(e,n,t,i)},X:function(e,t,n){return w(e,i,t,n)},y:_r,Y:yr,Z:vr,"%":Or};function x(e,t){return function(n){var i,r,s,o=[],a=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++a<u;)37===e.charCodeAt(a)&&(o.push(e.slice(l,a)),null!=(r=rr[i=e.charAt(++a)])?i=e.charAt(++a):r="e"===i?" ":"0",(s=t[i])&&(i=s(n,r)),o.push(i),l=a+1);return o.push(e.slice(l,a)),o.join("")}}function E(e,t){return function(n){var i,r,s=Zi(1900,void 0,1);if(w(s,e,n+="",0)!=n.length)return null;if("Q"in s)return new Date(s.Q);if("s"in s)return new Date(1e3*s.s+("L"in s?s.L:0));if(t&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"V"in s){if(s.V<1||s.V>53)return null;"w"in s||(s.w=1),"Z"in s?(r=(i=Ki(Zi(s.y,0,1))).getUTCDay(),i=r>4||0===r?fi.ceil(i):fi(i),i=ni.offset(i,7*(s.V-1)),s.y=i.getUTCFullYear(),s.m=i.getUTCMonth(),s.d=i.getUTCDate()+(s.w+6)%7):(r=(i=qi(Zi(s.y,0,1))).getDay(),i=r>4||0===r?oi.ceil(i):oi(i),i=ti.offset(i,7*(s.V-1)),s.y=i.getFullYear(),s.m=i.getMonth(),s.d=i.getDate()+(s.w+6)%7)}else("W"in s||"U"in s)&&("w"in s||(s.w="u"in s?s.u%7:"W"in s?1:0),r="Z"in s?Ki(Zi(s.y,0,1)).getUTCDay():qi(Zi(s.y,0,1)).getDay(),s.m=0,s.d="W"in s?(s.w+6)%7+7*s.W-(r+5)%7:s.w+7*s.U-(r+6)%7);return"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,Ki(s)):qi(s)}}function w(e,t,n,i){for(var r,s,o=0,a=t.length,l=n.length;o<a;){if(i>=l)return-1;if(37===(r=t.charCodeAt(o++))){if(r=t.charAt(o++),!(s=T[r in rr?t.charAt(o++):r])||(i=s(e,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return v.x=x(n,v),v.X=x(i,v),v.c=x(t,v),b.x=x(n,b),b.X=x(i,b),b.c=x(t,b),{format:function(e){var t=x(e+="",v);return t.toString=function(){return e},t},parse:function(e){var t=E(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=x(e+="",b);return t.toString=function(){return e},t},utcParse:function(e){var t=E(e+="",!0);return t.toString=function(){return e},t}}}var Ji,er,tr,nr,ir,rr={"-":"",_:" ",0:"0"},sr=/^\s*\d+/,or=/^%/,ar=/[\\^$*+?|[\]().{}]/g;function lr(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",s=r.length;return i+(s<n?new Array(n-s+1).join(t)+r:r)}function ur(e){return e.replace(ar,"\\$&")}function cr(e){return new RegExp("^(?:"+e.map(ur).join("|")+")","i")}function dr(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function hr(e,t,n){var i=sr.exec(t.slice(n,n+1));return i?(e.w=+i[0],n+i[0].length):-1}function pr(e,t,n){var i=sr.exec(t.slice(n,n+1));return i?(e.u=+i[0],n+i[0].length):-1}function fr(e,t,n){var i=sr.exec(t.slice(n,n+2));return i?(e.U=+i[0],n+i[0].length):-1}function mr(e,t,n){var i=sr.exec(t.slice(n,n+2));return i?(e.V=+i[0],n+i[0].length):-1}function gr(e,t,n){var i=sr.exec(t.slice(n,n+2));return i?(e.W=+i[0],n+i[0].length):-1}function yr(e,t,n){var i=sr.exec(t.slice(n,n+4));return i?(e.y=+i[0],n+i[0].length):-1}function _r(e,t,n){var i=sr.exec(t.slice(n,n+2));return i?(e.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function vr(e,t,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function br(e,t,n){var i=sr.exec(t.slice(n,n+1));return i?(e.q=3*i[0]-3,n+i[0].length):-1}function Tr(e,t,n){var i=sr.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function xr(e,t,n){var i=sr.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function Er(e,t,n){var i=sr.exec(t.slice(n,n+3));return i?(e.m=0,e.d=+i[0],n+i[0].length):-1}function wr(e,t,n){var i=sr.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function Ir(e,t,n){var i=sr.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function Ar(e,t,n){var i=sr.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function Sr(e,t,n){var i=sr.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function Cr(e,t,n){var i=sr.exec(t.slice(n,n+6));return i?(e.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function Or(e,t,n){var i=or.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function Mr(e,t,n){var i=sr.exec(t.slice(n));return i?(e.Q=+i[0],n+i[0].length):-1}function Rr(e,t,n){var i=sr.exec(t.slice(n));return i?(e.s=+i[0],n+i[0].length):-1}function kr(e,t){return lr(e.getDate(),t,2)}function Nr(e,t){return lr(e.getHours(),t,2)}function Dr(e,t){return lr(e.getHours()%12||12,t,2)}function Fr(e,t){return lr(1+ti.count(bi(e),e),t,3)}function Lr(e,t){return lr(e.getMilliseconds(),t,3)}function Pr(e,t){return Lr(e,t)+"000"}function Br(e,t){return lr(e.getMonth()+1,t,2)}function $r(e,t){return lr(e.getMinutes(),t,2)}function Ur(e,t){return lr(e.getSeconds(),t,2)}function zr(e){var t=e.getDay();return 0===t?7:t}function Vr(e,t){return lr(si.count(bi(e)-1,e),t,2)}function jr(e){var t=e.getDay();return t>=4||0===t?ui(e):ui.ceil(e)}function Yr(e,t){return e=jr(e),lr(ui.count(bi(e),e)+(4===bi(e).getDay()),t,2)}function Gr(e){return e.getDay()}function Hr(e,t){return lr(oi.count(bi(e)-1,e),t,2)}function Wr(e,t){return lr(e.getFullYear()%100,t,2)}function Xr(e,t){return lr((e=jr(e)).getFullYear()%100,t,2)}function qr(e,t){return lr(e.getFullYear()%1e4,t,4)}function Kr(e,t){var n=e.getDay();return lr((e=n>=4||0===n?ui(e):ui.ceil(e)).getFullYear()%1e4,t,4)}function Zr(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+lr(t/60|0,"0",2)+lr(t%60,"0",2)}function Qr(e,t){return lr(e.getUTCDate(),t,2)}function Jr(e,t){return lr(e.getUTCHours(),t,2)}function es(e,t){return lr(e.getUTCHours()%12||12,t,2)}function ts(e,t){return lr(1+ni.count(Ti(e),e),t,3)}function ns(e,t){return lr(e.getUTCMilliseconds(),t,3)}function is(e,t){return ns(e,t)+"000"}function rs(e,t){return lr(e.getUTCMonth()+1,t,2)}function ss(e,t){return lr(e.getUTCMinutes(),t,2)}function os(e,t){return lr(e.getUTCSeconds(),t,2)}function as(e){var t=e.getUTCDay();return 0===t?7:t}function ls(e,t){return lr(pi.count(Ti(e)-1,e),t,2)}function us(e){var t=e.getUTCDay();return t>=4||0===t?yi(e):yi.ceil(e)}function cs(e,t){return e=us(e),lr(yi.count(Ti(e),e)+(4===Ti(e).getUTCDay()),t,2)}function ds(e){return e.getUTCDay()}function hs(e,t){return lr(fi.count(Ti(e)-1,e),t,2)}function ps(e,t){return lr(e.getUTCFullYear()%100,t,2)}function fs(e,t){return lr((e=us(e)).getUTCFullYear()%100,t,2)}function ms(e,t){return lr(e.getUTCFullYear()%1e4,t,4)}function gs(e,t){var n=e.getUTCDay();return lr((e=n>=4||0===n?yi(e):yi.ceil(e)).getUTCFullYear()%1e4,t,4)}function ys(){return"+0000"}function _s(){return"%"}function vs(e){return+e}function bs(e){return Math.floor(+e/1e3)}function Ts(e){const t={};return n=>t[n]||(t[n]=e(n))}function xs(e){const t=Ts(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){const n=Dn(e||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return function(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let s=function(e,t){let n,i=e.lastIndexOf("e");if(i>0)return i;for(i=e.length;--i>t;)if(n=e.charCodeAt(i),n>=48&&n<=57)return i+1}(i,r);const o=s<i.length?i.slice(s):"";for(;--s>r;)if("0"!==i[s]){++s;break}return i.slice(0,s)+o}}(t(n),t(".1f")(1)[1])}return t(n)},formatSpan(e,i,r,s){s=Dn(null==s?",f":s);const o=function(e,t,n){n=+n;const i=(t=+t)<(e=+e),r=i?Rn(t,e,n):Rn(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}(e,i,r),a=Math.max(Math.abs(e),Math.abs(i));let l;if(null==s.precision)switch(s.type){case"s":return isNaN(l=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Pn(t)/3)))-Pn(Math.abs(e)))}(o,a))||(s.precision=l),n(s,a);case"":case"e":case"g":case"p":case"r":isNaN(l=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Pn(t)-Pn(e))+1}(o,a))||(s.precision=l-("e"===s.type));break;case"f":case"%":isNaN(l=function(e){return Math.max(0,-Pn(Math.abs(e)))}(o))||(s.precision=l-2*("%"===s.type))}return t(s)}}}let Es,ws;function Is(){return Es=xs({format:Vn,formatPrefix:jn})}function As(e){return xs(Hn(e))}function Ss(e){return arguments.length?Es=As(e):Es}function Cs(e,t,n){en(n=n||{})||zt(`Invalid time multi-format specifier: ${n}`);const i=t($i),r=t(Bi),s=t(Pi),o=t(Di),a=t(Ni),l=t(ki),u=t(Ri),c=t(Mi),d=e(n[Ui]||".%L"),h=e(n[$i]||":%S"),p=e(n[Bi]||"%I:%M"),f=e(n[Pi]||"%I %p"),m=e(n[Di]||n[Fi]||"%a %d"),g=e(n[Ni]||"%b %d"),y=e(n[ki]||"%B"),_=e(n[Ri]||"%B"),v=e(n[Mi]||"%Y");return e=>(i(e)<e?d:r(e)<e?h:s(e)<e?p:o(e)<e?f:l(e)<e?a(e)<e?m:g:c(e)<e?u(e)<e?y:_:v)(e)}function Os(e){const t=Ts(e.format),n=Ts(e.utcFormat);return{timeFormat:e=>un(e)?t(e):Cs(t,ji,e),utcFormat:e=>un(e)?n(e):Cs(n,Yi,e),timeParse:Ts(e.parse),utcParse:Ts(e.utcParse)}}function Ms(){return ws=Os({format:er,parse:tr,utcFormat:nr,utcParse:ir})}function Rs(e){return Os(Qi(e))}function ks(e){return arguments.length?ws=Rs(e):ws}!function(e){Ji=Qi(e),er=Ji.format,tr=Ji.parse,nr=Ji.utcFormat,ir=Ji.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Is(),Ms();const Ns=(e,t)=>on({},e,t);function Ds(e,t){const n=arguments.length;return n&&2!==n&&zt("defaultLocale expects either zero or two arguments."),n?Ns(Ss(e),ks(t)):Ns(Ss(),ks())}const Fs=/^(data:|([A-Za-z]+:)?\/\/)/,Ls=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Ps=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Bs="file://";async function $s(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t)}async function Us(e,t){t=on({},this.options,t);const n=this.fileAccess,i={href:null};let r,s,o;const a=Ls.test(e.replace(Ps,""));null!=e&&"string"==typeof e&&a||zt("Sanitize failure, invalid URI: "+cn(e));const l=Fs.test(e);return(o=t.baseURL)&&!l&&(e.startsWith("/")||o.endsWith("/")||(e="/"+e),e=o+e),s=(r=e.startsWith(Bs))||"file"===t.mode||"http"!==t.mode&&!l&&n,r?e=e.slice(7):e.startsWith("//")&&("file"===t.defaultProtocol?(e=e.slice(2),s=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!s}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),"image"===t.context&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function zs(e){return e?t=>new Promise((n,i)=>{e.readFile(t,(e,t)=>{e?i(e):n(t)})}):Vs}async function Vs(){zt("No file system access.")}function js(e){return e?async function(t,n){const i=on({},this.options.http,n),r=n&&n.response,s=await e(t,i);return s.ok?rn(s[r])?s[r]():s.text():zt(s.status+""+s.statusText)}:Ys}async function Ys(){zt("No HTTP fetch method available.")}const Gs=e=>null!=e&&e==e,Hs=e=>!(Number.isNaN(+e)||e instanceof Date),Ws={boolean:function(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e)&&!!e},integer:tn,number:tn,date:function(e,t){return t=t||dn,null==e||""===e?null:t(e)},string:function(e){return null==e||""===e?null:e+""},unknown:Gt},Xs=[e=>"true"===e||"false"===e||!0===e||!1===e,e=>Hs(e)&&Number.isInteger(+e),Hs,e=>!Number.isNaN(Date.parse(e))],qs=["boolean","integer","number","date"];function Ks(e,t){return t.reduce((t,n)=>(t[n]=function(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=Xs.length,r=Xs.map((e,t)=>t+1);for(let s,o,a=0,l=0;a<n;++a)for(o=t?e[a][t]:e[a],s=0;s<i;++s)if(r[s]&&Gs(o)&&!Xs[s](o)&&(r[s]=0,++l,l===Xs.length))return"string";return qs[r.reduce((e,t)=>0===e?t:e,0)-1]}(e,n),t),{})}function Zs(e){const t=function(t,n){const i={delimiter:e};return Qs(t,n?on(n,i):i)};return t.responseType="text",t}function Qs(e,t){return t.header&&(e=t.header.map(cn).join(t.delimiter)+"\n"+e),vn(t.delimiter).parse(e+"")}function Js(e,t){const n=t&&t.property?jt(t.property):Gt;return!en(e)||(i=e,"function"==typeof Buffer&&rn(Buffer.isBuffer)&&Buffer.isBuffer(i))?n(JSON.parse(e)):function(e,t){!Jt(e)&&function(e){return e&&rn(e[Symbol.iterator])}(e)&&(e=[...e]);return t&&t.copy?JSON.parse(JSON.stringify(e)):e}(n(e),t);var i}Qs.responseType="text",Js.responseType="json";const eo={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function to(e,t){let n,i,r,s;return e=Js(e,t),t&&t.feature?(n=Tn,r=t.feature):t&&t.mesh?(n=In,r=t.mesh,s=eo[t.filter]):zt("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,s):zt("Invalid TopoJSON object: "+r),i&&i.features||[i]}to.responseType="json";const no={dsv:Qs,csv:Zs(","),tsv:Zs("\t"),json:Js,topojson:to};function io(e,t){return arguments.length>1?(no[e]=t,this):an(no,e)?no[e]:null}function ro(e){const t=io(e);return t&&t.responseType||"text"}function so(e,t,n,i){const r=io((t=t||{}).type||"json");return r||zt("Unknown data format type: "+t.type),e=r(e,t),t.parse&&function(e,t,n,i){if(!e.length)return;const r=ks();n=n||r.timeParse,i=i||r.utcParse;let s,o,a,l,u,c,d=e.columns||Object.keys(e[0]);"auto"===t&&(t=Ks(e,d));d=Object.keys(t);const h=d.map(e=>{const r=t[e];let s,o;if(r&&(r.startsWith("date:")||r.startsWith("utc:"))){s=r.split(/:(.+)?/,2),o=s[1],("'"===o[0]&&"'"===o[o.length-1]||'"'===o[0]&&'"'===o[o.length-1])&&(o=o.slice(1,-1));return("utc"===s[0]?i:n)(o)}if(!Ws[r])throw Error("Illegal format pattern: "+e+":"+r);return Ws[r]});for(a=0,u=e.length,c=d.length;a<u;++a)for(s=e[a],l=0;l<c;++l)o=d[l],s[o]=h[l](s[o])}(e,t.parse,n,i),an(e,"columns")&&delete e.columns,e}const oo=function(e,t){return n=>({options:n||{},sanitize:Us,load:$s,fileAccess:!1,file:zs(t),http:js(e)})}("undefined"!=typeof fetch&&fetch,null);function ao(e){const t=e||Gt,n=[],i={};return n.add=e=>{const r=t(e);return i[r]||(i[r]=1,n.push(e)),n},n.remove=e=>{const r=t(e);if(i[r]){i[r]=0;const t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function lo(e,t){try{await t(e)}catch(t){e.error(t)}}const uo=Symbol("vega_id");let co=1;function ho(e){return!(!e||!po(e))}function po(e){return e[uo]}function fo(e,t){return e[uo]=t,e}function mo(e){const t=e===Object(e)?e:{data:e};return po(t)?t:fo(t,co++)}function go(e){return yo(e,mo({}))}function yo(e,t){for(const n in e)t[n]=e[n];return t}function _o(e,t){return fo(t,po(e))}function vo(e,t){return e?t?(n,i)=>e(n,i)||po(t(n))-po(t(i)):(t,n)=>e(t,n)||po(t)-po(n):null}function bo(e){return e&&e.constructor===To}function To(){const e=[],t=[],n=[],i=[],r=[];let s=null,o=!1;return{constructor:To,insert(t){const n=nn(t),i=n.length;for(let t=0;t<i;++t)e.push(n[t]);return this},remove(e){const n=rn(e)?i:t,r=nn(e),s=r.length;for(let e=0;e<s;++e)n.push(r[e]);return this},modify(e,t,i){const s={field:t,value:sn(i)};return rn(e)?(s.filter=e,r.push(s)):(s.tuple=e,n.push(s)),this},encode(e,t){return rn(e)?r.push({filter:e,field:t}):n.push({tuple:e,field:t}),this},clean(e){return s=e,this},reflow(){return o=!0,this},pulse(a,l){const u={},c={};let d,h,p,f,m,g;for(d=0,h=l.length;d<h;++d)u[po(l[d])]=1;for(d=0,h=t.length;d<h;++d)m=t[d],u[po(m)]=-1;for(d=0,h=i.length;d<h;++d)f=i[d],l.forEach(e=>{f(e)&&(u[po(e)]=-1)});for(d=0,h=e.length;d<h;++d)m=e[d],g=po(m),u[g]?u[g]=1:a.add.push(mo(e[d]));for(d=0,h=l.length;d<h;++d)m=l[d],u[po(m)]<0&&a.rem.push(m);function y(e,t,n){n?e[t]=n(e):a.encode=t,o||(c[po(e)]=e)}for(d=0,h=n.length;d<h;++d)p=n[d],m=p.tuple,f=p.field,g=u[po(m)],g>0&&(y(m,f,p.value),a.modifies(f));for(d=0,h=r.length;d<h;++d)p=r[d],f=p.filter,l.forEach(e=>{f(e)&&u[po(e)]>0&&y(e,p.field,p.value)}),a.modifies(p.field);if(o)a.mod=t.length||i.length?l.filter(e=>u[po(e)]>0):l.slice();else for(g in c)a.mod.push(c[g]);return(s||null==s&&(t.length||i.length))&&a.clean(!0),a}}}const xo="_:mod:_";function Eo(){Object.defineProperty(this,xo,{writable:!0,value:{}})}Eo.prototype={set(e,t,n,i){const r=this,s=r[e],o=r[xo];return null!=t&&t>=0?(s[t]!==n||i)&&(s[t]=n,o[t+":"+e]=-1,o[e]=-1):(s!==n||i)&&(r[e]=n,o[e]=Jt(n)?1+n.length:-1),r},modified(e,t){const n=this[xo];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(Jt(e)){for(let t=0;t<e.length;++t)if(n[e[t]])return!0;return!1}return null!=t&&t>=0?t+1<n[e]||!!n[t+":"+e]:!!n[e]},clear(){return this[xo]={},this}};let wo=0;const Io=new Eo;function Ao(e,t,n,i){this.id=++wo,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,i)}function So(e){return function(t){const n=this.flags;return 0===arguments.length?!!(n&e):(this.flags=t?n|e:n&~e,this)}}Ao.prototype={targets(){return this._targets||(this._targets=ao(Yt))},set(e){return this.value!==e?(this.value=e,1):0},skip:So(1),modified:So(2),parameters(e,t,n){t=!1!==t;const i=this._argval=this._argval||new Eo,r=this._argops=this._argops||[],s=[];let o,a,l,u;const c=(e,n,o)=>{o instanceof Ao?(o!==this&&(t&&o.targets().add(this),s.push(o)),r.push({op:o,name:e,index:n})):i.set(e,n,o)};for(o in e)if(a=e[o],"pulse"===o)nn(a).forEach(e=>{e instanceof Ao?e!==this&&(e.targets().add(this),s.push(e)):zt("Pulse parameters must be operator instances.")}),this.source=a;else if(Jt(a))for(i.set(o,-1,Array(l=a.length)),u=0;u<l;++u)c(o,u,a[u]);else c(o,-1,a);return this.marshall().clear(),n&&(r.initonly=!0),s},marshall(e){const t=this._argval||Io,n=this._argops;let i,r,s,o;if(n){const a=n.length;for(r=0;r<a;++r)i=n[r],s=i.op,o=s.modified()&&s.stamp===e,t.set(i.name,i.index,s.value,o);if(n.initonly){for(r=0;r<a;++r)i=n[r],i.op.targets().remove(this);this._argops=null,this._update=null}}return t},detach(){const e=this._argops;let t,n,i,r;if(e)for(t=0,n=e.length;t<n;++t)i=e[t],r=i.op,r._targets&&r._targets.remove(this);this.pulse=null,this.source=null},evaluate(e){const t=this._update;if(t){const n=this.marshall(e.stamp),i=t.call(this,n,e);if(n.clear(),i!==this.value)this.value=i;else if(!this.modified())return e.StopPropagation}},run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?(this.skip(!1),t=0):t=this.evaluate(e),this.pulse=t||e}};let Co=0;function Oo(e,t,n){this.id=++Co,this.value=null,n&&(this.receive=n),e&&(this._filter=e),t&&(this._apply=t)}function Mo(e,t,n){return new Oo(e,t,n)}Oo.prototype={_filter:Ht,_apply:Gt,targets(){return this._targets||(this._targets=ao(Yt))},consume(e){return arguments.length?(this._consume=!!e,this):!!this._consume},receive(e){if(this._filter(e)){const t=this.value=this._apply(e),n=this._targets,i=n?n.length:0;for(let e=0;e<i;++e)n[e].receive(t);this._consume&&(e.preventDefault(),e.stopPropagation())}},filter(e){const t=Mo(e);return this.targets().add(t),t},apply(e){const t=Mo(null,e);return this.targets().add(t),t},merge(){const e=Mo();this.targets().add(e);for(let t=0,n=arguments.length;t<n;++t)arguments[t].targets().add(e);return e},throttle(e){let t=-1;return this.filter(()=>{const n=Date.now();return n-t>e?(t=n,1):0})},debounce(e){const t=Mo();return this.targets().add(Mo(null,null,function(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout(()=>(t(i),n=null),e)}}(e,e=>{const n=e.dataflow;t.receive(e),n&&n.run&&n.run()}))),t},between(e,t){let n=!1;return e.targets().add(Mo(null,null,()=>n=!0)),t.targets().add(Mo(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=Ht,this._targets=null}};const Ro={skip:!0};function ko(e,t,n,i,r,s){const o=on({},s,Ro);let a,l;rn(n)||(n=sn(n)),void 0===i?a=t=>e.touch(n(t)):rn(i)?(l=new Ao(null,i,r,!1),a=t=>{l.evaluate(t);const i=n(t),r=l.value;bo(r)?e.pulse(i,r,s):e.update(i,r,o)}):a=t=>e.update(n(t),i,o),t.apply(a)}function No(e,t,n,i,r,s){if(void 0===i)t.targets().add(n);else{const o=s||{},a=new Ao(null,function(e,t){return t=rn(t)?t:sn(t),e?function(n,i){const r=t(n,i);return e.skip()||(e.skip(r!==this.value).value=r),r}:t}(n,i),r,!1);a.modified(o.force),a.rank=t.rank,t.targets().add(a),n&&(a.skip(!0),a.value=n.value,a.targets().add(n),e.connect(n,[a]))}}const Do={};function Fo(e,t,n){this.dataflow=e,this.stamp=null==t?-1:t,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function Lo(e,t){const n=[];return hn(e,t,e=>n.push(e)),n}function Po(e,t){const n={};return e.visit(t,e=>{n[po(e)]=1}),e=>n[po(e)]?null:e}function Bo(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function $o(e,t,n,i){const r=this;let s=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const e of n)if(e.stamp===t){if(e.fields){const t=r.fields||(r.fields={});for(const n in e.fields)t[n]=1}e.changed(r.ADD)&&(s|=r.ADD),e.changed(r.REM)&&(s|=r.REM),e.changed(r.MOD)&&(s|=r.MOD)}this.changes=s}function Uo(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}Fo.prototype={StopPropagation:Do,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(e){return new Fo(this.dataflow).init(this,e)},clone(){const e=this.fork(7);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new Fo(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,!e.fields||64&t||(n.fields=e.fields),1&t?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),2&t?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),4&t?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),32&t?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||7;return 1&t&&this.add.length||2&t&&this.rem.length||4&t&&this.mod.length},reflow(e){if(e)return this.fork(7).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(4,Po(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return Jt(e)?e.forEach(e=>t[e]=!0):t[e]=!0,this},modified(e,t){const n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?Jt(e)?e.some(e=>n[e]):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=Bo(n.addF,t)),2&e&&(n.remF=Bo(n.remF,t)),4&e&&(n.modF=Bo(n.modF,t)),16&e&&(n.srcF=Bo(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=Lo(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=Lo(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=Lo(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,i=t;if(16&e)return hn(n.source,n.srcF,i),n;1&e&&hn(n.add,n.addF,i),2&e&&hn(n.rem,n.remF,i),4&e&&hn(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||hn(r,e?Po(n,5):n.srcF,i)}return n}},ln($o,Fo,{fork(e){const t=new Fo(this.dataflow).init(this,e&this.NO_FIELDS);return void 0!==e&&(e&t.ADD&&this.visit(t.ADD,e=>t.add.push(e)),e&t.REM&&this.visit(t.REM,e=>t.rem.push(e)),e&t.MOD&&this.visit(t.MOD,e=>t.mod.push(e))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?Jt(e)?e.some(e=>n[e]):n[e]:0},filter(){zt("MultiPulse does not support filtering.")},materialize(){zt("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let s=0;if(e&n.SOURCE)for(;s<r;++s)i[s].visit(e,t);else for(;s<r;++s)i[s].stamp===n.stamp&&i[s].visit(e,t);return n}});const zo={skip:!1,force:!1};function Vo(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),jo(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let i;return t.length?(i=t[0],t[0]=n,function(e,t,n){const i=t,r=e.length,s=e[t];let o,a=1+(t<<1);for(;a<r;)o=a+1,o<r&&n(e[a],e[o])>=0&&(a=o),e[t]=e[a],a=1+((t=a)<<1);e[t]=s,jo(e,i,t,n)}(t,0,e)):i=n,i}}}function jo(e,t,n,i){let r,s;const o=e[n];for(;n>t&&(s=n-1>>1,r=e[s],i(o,r)<0);)e[n]=r,n=s;return e[n]=o}function Yo(){this.logger(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wt,i=e||Xt;return{level(e){return arguments.length?(i=+e,this):i},error(){return i>=qt&&n(t||"error","ERROR",arguments),this},warn(){return i>=Kt&&n(t||"warn","WARN",arguments),this},info(){return i>=Zt&&n(t||"log","INFO",arguments),this},debug(){return i>=Qt&&n(t||"log","DEBUG",arguments),this}}}()),this.logLevel(qt),this._clock=0,this._rank=0,this._locale=Ds();try{this._loader=oo()}catch(e){}this._touched=ao(Yt),this._input={},this._pulse=null,this._heap=Vo((e,t)=>e.qrank-t.qrank),this._postrun=[]}function Go(e){return function(){return this._log[e].apply(this,arguments)}}function Ho(e,t){Ao.call(this,e,null,t)}Yo.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:Go("error"),warn:Go("warn"),info:Go("info"),debug:Go("debug"),logLevel:Go("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,s=1;return e instanceof Ao?r=e:e&&e.prototype instanceof Ao?r=new e:rn(e)?r=new Ao(null,e):(s=0,r=new Ao(e,t)),this.rank(r),s&&(i=n,n=t),n&&this.connect(r,r.parameters(n,i)),this.touch(r),r},connect:function(e,t){const n=e.rank,i=t.length;for(let r=0;r<i;++r)if(n<t[r].rank)return void this.rerank(e)},rank:function(e){e.rank=++this._rank},rerank:function(e){const t=[e];let n,i,r;for(;t.length;)if(this.rank(n=t.pop()),i=n._targets)for(r=i.length;--r>=0;)t.push(n=i[r]),n===e&&zt("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||zo);const i=new Fo(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return i.target=e,this._input[e.id]=t.pulse(i,r),this},touch:function(e,t){const n=t||zo;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||zo;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:To,ingest:function(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))},parse:function(e,t){const n=this.locale();return so(e,t,n.timeParse,n.utcParse)},preload:async function(e,t,n){const i=this,r=i._pending||function(e){let t;const n=new Promise(e=>t=e);return n.requests=0,n.done=()=>{0===--n.requests&&(e._pending=null,t(e))},e._pending=n}(i);r.requests+=1;const s=await i.request(t,n);return i.pulse(e,i.changeset().remove(Ht).insert(s.data||[])),r.done(),s},request:async function(e,t){const n=this;let i,r=0;try{i=await n.loader().load(e,{context:"dataflow",response:ro(t&&t.type)});try{i=n.parse(i,t)}catch(t){r=-2,n.warn("Data ingestion failed",e,t)}}catch(t){r=-1,n.warn("Loading failed",e,t)}return{data:i,status:r}},events:function(e,t,n,i){const r=this,s=Mo(n,i),o=function(e){e.dataflow=r;try{s.receive(e)}catch(e){r.error(e)}finally{r.run()}};let a;a="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):nn(e);const l=a.length;for(let e=0;e<l;++e)a[e].addEventListener(t,o);return s},on:function(e,t,n,i,r){return(e instanceof Ao?No:ko)(this,e,t,n,i,r),this},evaluate:async function(e,t,n){const i=this,r=[];if(i._pulse)return Uo(i);if(i._pending&&await i._pending,t&&await lo(i,t),!i._touched.length)return i.debug("Dataflow invoked, but nothing to do."),i;const s=++i._clock;i._pulse=new Fo(i,s,e),i._touched.forEach(e=>i._enqueue(e,!0)),i._touched=ao(Yt);let o,a,l,u=0;try{for(;i._heap.size()>0;)o=i._heap.pop(),o.rank===o.qrank?(a=o.run(i._getPulse(o,e)),a.then?a=await a:a.async&&(r.push(a.async),a=Do),a!==Do&&o._targets&&o._targets.forEach(e=>i._enqueue(e)),++u):i._enqueue(o,!0)}catch(e){i._heap.clear(),l=e}if(i._input={},i._pulse=null,i.debug(`Pulse ${s}: ${u} operators`),l&&(i._postrun=[],i.error(l)),i._postrun.length){const e=i._postrun.sort((e,t)=>t.priority-e.priority);i._postrun=[];for(let t=0;t<e.length;++t)await lo(i,e[t].callback)}return n&&await lo(i,n),r.length&&Promise.all(r).then(e=>i.runAsync(null,()=>{e.forEach(e=>{try{e(i)}catch(e){i.error(e)}})})),i},run:function(e,t,n){return this._pulse?Uo(this):(this.evaluate(e,t,n),this)},runAsync:async function(e,t,n){for(;this._running;)await this._running;const i=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(i,i),this._running},runAfter:function(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(e){this.error(e)}},_enqueue:function(e,t){const n=e.stamp<this._clock;n&&(e.stamp=this._clock),(n||t)&&(e.qrank=e.rank,this._heap.push(e))},_getPulse:function(e,t){const n=e.source,i=this._clock;return n&&Jt(n)?new $o(this,i,n.map(e=>e.pulse),t):this._input[e.id]||function(e,t){if(t&&t.stamp===e.stamp)return t;e=e.fork(),t&&t!==Do&&(e.source=t.source);return e}(this._pulse,n&&n.pulse)}},ln(Ho,Ao,{run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?this.skip(!1):t=this.evaluate(e),t=t||e,t.then?t=t.then(e=>this.pulse=e):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const Wo={};function Xo(e){const t=qo(e);return t&&t.Definition||null}function qo(e){return e=e&&e.toLowerCase(),an(Wo,e)?Wo[e]:null}function Ko(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Zo(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n<t||void 0===n&&t>=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n<r||void 0===n&&r>=r)&&(n=r)}return n}function Qo(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n>r||void 0===n&&r>=r)&&(n=r)}return n}function Jo(e,t,n=0,i=e.length-1,r=Ko){for(;i>n;){if(i-n>600){const s=i-n+1,o=t-n+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);Jo(e,t,Math.max(n,Math.floor(t-o*l/s+u)),Math.min(i,Math.floor(t+(s-o)*l/s+u)),r)}const s=e[t];let o=n,a=i;for(ea(e,n,t),r(e[i],s)>0&&ea(e,n,i);o<a;){for(ea(e,o,a),++o,--a;r(e[o],s)<0;)++o;for(;r(e[a],s)>0;)--a}0===r(e[n],s)?ea(e,n,a):(++a,ea(e,a,i)),a<=t&&(n=a+1),t<=a&&(i=a-1)}return e}function ea(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function ta(e){return null===e?NaN:+e}function na(e,t,n){if(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)null!=(i=t(i,++n,e))&&(i=+i)>=i&&(yield i)}}(e,n)),i=e.length){if((t=+t)<=0||i<2)return Qo(e);if(t>=1)return Zo(e);var i,r=(i-1)*t,s=Math.floor(r),o=Zo(Jo(e,s).subarray(0,s+1));return o+(Qo(e.subarray(s+1))-o)*(r-s)}}function ia(e,t,n=ta){if(i=e.length){if((t=+t)<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,s=Math.floor(r),o=+n(e[s],s,e);return o+(+n(e[s+1],s+1,e)-o)*(r-s)}}function ra(e,t){return na(e,.5,t)}function*sa(e,t){if(null==t)for(let t of e)null!=t&&""!==t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)i=t(i,++n,e),null!=i&&""!==i&&(i=+i)>=i&&(yield i)}}function oa(e,t,n){const i=Float64Array.from(sa(e,n));return i.sort(Ko),t.map(e=>ia(i,e))}function aa(e,t){return oa(e,[.25,.5,.75],t)}function la(e,t){const n=e.length,i=function(e,t){const n=function(e,t){let n,i=0,r=0,s=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(n=t-r,r+=n/++i,s+=n*(t-r));else{let o=-1;for(let a of e)null!=(a=t(a,++o,e))&&(a=+a)>=a&&(n=a-r,r+=n/++i,s+=n*(a-r))}if(i>1)return s/(i-1)}(e,t);return n?Math.sqrt(n):n}(e,t),r=aa(e,t),s=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,s)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function ua(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let s,o,a,l,u,c,d=e.extent[0],h=e.extent[1];const p=e.span||h-d||Math.abs(d)||1;if(e.step)s=e.step;else if(e.steps){for(l=p/t,u=0,c=e.steps.length;u<c&&e.steps[u]<l;++u);s=e.steps[Math.max(0,u-1)]}else{for(o=Math.ceil(Math.log(t)/i),a=e.minstep||0,s=Math.max(a,Math.pow(n,Math.round(Math.log(p)/i)-o));Math.ceil(p/s)>t;)s*=n;for(u=0,c=r.length;u<c;++u)l=s/r[u],l>=a&&p/l<=t&&(s=l)}l=Math.log(s);const f=l>=0?0:1+~~(-l/i),m=Math.pow(n,-f-1);return(e.nice||void 0===e.nice)&&(l=Math.floor(d/s+m)*s,d=d<l?l-s:l,h=Math.ceil(h/s)*s),{start:d,stop:h===d?d+s:h,step:s}}var ca=Math.random;function da(e){ca=e}function ha(e,t,n,i){if(!e.length)return[void 0,void 0];const r=Float64Array.from(sa(e,i)),s=r.length,o=t;let a,l,u,c;for(u=0,c=Array(o);u<o;++u){for(a=0,l=0;l<s;++l)a+=r[~~(ca()*s)];c[u]=a/s}return c.sort(Ko),[na(c,n/2),na(c,1-n/2)]}function pa(e,t,n,i){i=i||(e=>e);const r=e.length,s=new Float64Array(r);let o,a=0,l=1,u=i(e[0]),c=u,d=u+t;for(;l<r;++l){if(o=i(e[l]),o>=d){for(c=(u+c)/2;a<l;++a)s[a]=c;d=o+t,u=o}c=o}for(c=(u+c)/2;a<l;++a)s[a]=c;return n?function(e,t){const n=e.length;let i,r,s=0,o=1;for(;e[s]===e[o];)++o;for(;o<n;){for(i=o+1;e[o]===e[i];)++i;if(e[o]-e[o-1]<t){for(r=o+(s+i-o-o>>1);r<o;)e[r++]=e[o];for(;r>o;)e[r--]=e[s]}s=o,o=i}return e}(s,t+t/4):s}function fa(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}}function ma(e,t){let n,i,r;null==t&&(t=e,e=0);const s={min(e){return arguments.length?(n=e||0,r=i-n,s):n},max(e){return arguments.length?(i=e||0,r=i-n,s):i},sample:()=>n+Math.floor(r*ca()),pdf:e=>e===Math.floor(e)&&e>=n&&e<i?1/r:0,cdf(e){const t=Math.floor(e);return t<n?0:t>=i?1:(t-n+1)/r},icdf:e=>e>=0&&e<=1?n-1+Math.floor(e*r):NaN};return s.min(e).max(t)}const ga=Math.sqrt(2*Math.PI),ya=Math.SQRT2;let _a=NaN;function va(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,s=0;if(_a==_a)r=_a,_a=NaN;else{do{r=2*ca()-1,s=2*ca()-1,n=r*r+s*s}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,_a=s*i}return e+r*t}function ba(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*ga)}function Ta(e,t,n){const i=(e-(t=t||0))/(n=null==n?1:n),r=Math.abs(i);let s;if(r>37)s=0;else{const e=Math.exp(-r*r/2);let t;r<7.07106781186547?(t=.0352624965998911*r+.700383064443688,t=t*r+6.37396220353165,t=t*r+33.912866078383,t=t*r+112.079291497871,t=t*r+221.213596169931,t=t*r+220.206867912376,s=e*t,t=.0883883476483184*r+1.75566716318264,t=t*r+16.064177579207,t=t*r+86.7807322029461,t=t*r+296.564248779674,t=t*r+637.333633378831,t=t*r+793.826512519948,t=t*r+440.413735824752,s/=t):(t=r+.65,t=r+4/t,t=r+3/t,t=r+2/t,t=r+1/t,s=e/t/2.506628274631)}return i>0?1-s:s}function xa(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*ya*function(e){let t,n=-Math.log((1-e)*(1+e));n<6.25?(n-=3.125,t=-364441206401782e-35,t=t*n-16850591381820166e-35,t=128584807152564e-32+t*n,t=11157877678025181e-33+t*n,t=t*n-1333171662854621e-31,t=20972767875968562e-33+t*n,t=6637638134358324e-30+t*n,t=t*n-4054566272975207e-29,t=t*n-8151934197605472e-29,t=26335093153082323e-28+t*n,t=t*n-12975133253453532e-27,t=t*n-5415412054294628e-26,t=1.0512122733215323e-9+t*n,t=t*n-4.112633980346984e-9,t=t*n-2.9070369957882005e-8,t=4.2347877827932404e-7+t*n,t=t*n-13654692000834679e-22,t=t*n-13882523362786469e-21,t=.00018673420803405714+t*n,t=t*n-.000740702534166267,t=t*n-.006033670871430149,t=.24015818242558962+t*n,t=1.6536545626831027+t*n):n<16?(n=Math.sqrt(n)-3.25,t=2.2137376921775787e-9,t=9.075656193888539e-8+t*n,t=t*n-2.7517406297064545e-7,t=1.8239629214389228e-8+t*n,t=15027403968909828e-22+t*n,t=t*n-4013867526981546e-21,t=29234449089955446e-22+t*n,t=12475304481671779e-21+t*n,t=t*n-47318229009055734e-21,t=6828485145957318e-20+t*n,t=24031110387097894e-21+t*n,t=t*n-.0003550375203628475,t=.0009532893797373805+t*n,t=t*n-.0016882755560235047,t=.002491442096107851+t*n,t=t*n-.003751208507569241,t=.005370914553590064+t*n,t=1.0052589676941592+t*n,t=3.0838856104922208+t*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,t=-27109920616438573e-27,t=t*n-2.555641816996525e-10,t=1.5076572693500548e-9+t*n,t=t*n-3.789465440126737e-9,t=7.61570120807834e-9+t*n,t=t*n-1.496002662714924e-8,t=2.914795345090108e-8+t*n,t=t*n-6.771199775845234e-8,t=2.2900482228026655e-7+t*n,t=t*n-9.9298272942317e-7,t=4526062597223154e-21+t*n,t=t*n-1968177810553167e-20,t=7599527703001776e-20+t*n,t=t*n-.00021503011930044477,t=t*n-.00013871931833623122,t=1.0103004648645344+t*n,t=4.849906401408584+t*n):t=1/0;return t*e}(2*e-1)}function Ea(e,t){let n,i;const r={mean(e){return arguments.length?(n=e||0,r):n},stdev(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>va(n,i),pdf:e=>ba(e,n,i),cdf:e=>Ta(e,n,i),icdf:e=>xa(e,n,i)};return r.mean(e).stdev(t)}function wa(e,t){const n=Ea();let i=0;const r={data(n){return arguments.length?(e=n,i=n?n.length:0,r.bandwidth(t)):e},bandwidth(n){return arguments.length?(!(t=n)&&e&&(t=la(e)),r):t},sample:()=>e[~~(ca()*i)]+t*n.sample(),pdf(r){let s=0,o=0;for(;o<i;++o)s+=n.pdf((r-e[o])/t);return s/t/i},cdf(r){let s=0,o=0;for(;o<i;++o)s+=n.cdf((r-e[o])/t);return s/i},icdf(){throw Error("KDE icdf not supported.")}};return r.data(e)}function Ia(e,t){return e=e||0,t=null==t?1:t,Math.exp(e+va()*t)}function Aa(e,t,n){if(e<=0)return 0;t=t||0,n=null==n?1:n;const i=(Math.log(e)-t)/n;return Math.exp(-.5*i*i)/(n*ga*e)}function Sa(e,t,n){return Ta(Math.log(e),t,n)}function Ca(e,t,n){return Math.exp(xa(e,t,n))}function Oa(e,t){let n,i;const r={mean(e){return arguments.length?(n=e||0,r):n},stdev(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>Ia(n,i),pdf:e=>Aa(e,n,i),cdf:e=>Sa(e,n,i),icdf:e=>Ca(e,n,i)};return r.mean(e).stdev(t)}function Ma(e,t){let n,i=0;const r={weights(e){return arguments.length?(n=function(e){const t=[];let n,r=0;for(n=0;n<i;++n)r+=t[n]=null==e[n]?1:+e[n];for(n=0;n<i;++n)t[n]/=r;return t}(t=e||[]),r):t},distributions(n){return arguments.length?(n?(i=n.length,e=n):(i=0,e=[]),r.weights(t)):e},sample(){const t=ca();let r=e[i-1],s=n[0],o=0;for(;o<i-1;s+=n[++o])if(t<s){r=e[o];break}return r.sample()},pdf(t){let r=0,s=0;for(;s<i;++s)r+=n[s]*e[s].pdf(t);return r},cdf(t){let r=0,s=0;for(;s<i;++s)r+=n[s]*e[s].cdf(t);return r},icdf(){throw Error("Mixture icdf not supported.")}};return r.distributions(e).weights(t)}function Ra(e,t){return null==t&&(t=null==e?1:e,e=0),e+(t-e)*ca()}function ka(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=t&&e<=n?1/(n-t):0}function Na(e,t,n){return null==n&&(n=null==t?1:t,t=0),e<t?0:e>n?1:(e-t)/(n-t)}function Da(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function Fa(e,t){let n,i;const r={min(e){return arguments.length?(n=e||0,r):n},max(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>Ra(n,i),pdf:e=>ka(e,n,i),cdf:e=>Na(e,n,i),icdf:e=>Da(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function La(e,t,n,i){const r=i-e*e,s=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-s*e,s]}function Pa(e,t,n,i){e=e.filter(e=>{let i=t(e),r=n(e);return null!=i&&(i=+i)>=i&&null!=r&&(r=+r)>=r}),i&&e.sort((e,n)=>t(e)-t(n));const r=e.length,s=new Float64Array(r),o=new Float64Array(r);let a,l,u,c=0,d=0,h=0;for(u of e)s[c]=a=+t(u),o[c]=l=+n(u),++c,d+=(a-d)/c,h+=(l-h)/c;for(c=0;c<r;++c)s[c]-=d,o[c]-=h;return[s,o,d,h]}function Ba(e,t,n,i){let r,s,o=-1;for(const a of e)r=t(a),s=n(a),null!=r&&(r=+r)>=r&&null!=s&&(s=+s)>=s&&i(r,s,++o)}function $a(e,t,n,i,r){let s=0,o=0;return Ba(e,t,n,(e,t)=>{const n=t-r(e),a=t-i;s+=n*n,o+=a*a}),1-s/o}function Ua(e,t,n){let i=0,r=0,s=0,o=0,a=0;Ba(e,t,n,(e,t)=>{++a,i+=(e-i)/a,r+=(t-r)/a,s+=(e*t-s)/a,o+=(e*e-o)/a});const l=La(i,r,s,o),u=e=>l[0]+l[1]*e;return{coef:l,predict:u,rSquared:$a(e,t,n,r,u)}}function za(e,t,n){let i=0,r=0,s=0,o=0,a=0;Ba(e,t,n,(e,t)=>{++a,e=Math.log(e),i+=(e-i)/a,r+=(t-r)/a,s+=(e*t-s)/a,o+=(e*e-o)/a});const l=La(i,r,s,o),u=e=>l[0]+l[1]*Math.log(e);return{coef:l,predict:u,rSquared:$a(e,t,n,r,u)}}function Va(e,t,n){const[i,r,s,o]=Pa(e,t,n);let a,l,u,c=0,d=0,h=0,p=0,f=0;Ba(e,t,n,(e,t)=>{a=i[f++],l=Math.log(t),u=a*t,c+=(t*l-c)/f,d+=(u-d)/f,h+=(u*l-h)/f,p+=(a*u-p)/f});const[m,g]=La(d/o,c/o,h/o,p/o),y=e=>Math.exp(m+g*(e-s));return{coef:[Math.exp(m-g*s),g],predict:y,rSquared:$a(e,t,n,o,y)}}function ja(e,t,n){let i=0,r=0,s=0,o=0,a=0,l=0;Ba(e,t,n,(e,t)=>{const n=Math.log(e),u=Math.log(t);++l,i+=(n-i)/l,r+=(u-r)/l,s+=(n*u-s)/l,o+=(n*n-o)/l,a+=(t-a)/l});const u=La(i,r,s,o),c=e=>u[0]*Math.pow(e,u[1]);return u[0]=Math.exp(u[0]),{coef:u,predict:c,rSquared:$a(e,t,n,a,c)}}function Ya(e,t,n){const[i,r,s,o]=Pa(e,t,n),a=i.length;let l,u,c,d,h=0,p=0,f=0,m=0,g=0;for(l=0;l<a;)u=i[l],c=r[l++],d=u*u,h+=(d-h)/l,p+=(d*u-p)/l,f+=(d*d-f)/l,m+=(u*c-m)/l,g+=(d*c-g)/l;const y=f-h*h,_=h*y-p*p,v=(g*h-m*p)/_,b=(m*y-g*p)/_,T=-v*h,x=e=>v*(e-=s)*e+b*e+T+o;return{coef:[T-b*s+v*s*s+o,b-2*v*s,v],predict:x,rSquared:$a(e,t,n,o,x)}}function Ga(e,t,n,i){if(1===i)return Ua(e,t,n);if(2===i)return Ya(e,t,n);const[r,s,o,a]=Pa(e,t,n),l=r.length,u=[],c=[],d=i+1;let h,p,f,m,g;for(h=0;h<d;++h){for(f=0,m=0;f<l;++f)m+=Math.pow(r[f],h)*s[f];for(u.push(m),g=new Float64Array(d),p=0;p<d;++p){for(f=0,m=0;f<l;++f)m+=Math.pow(r[f],h+p);g[p]=m}c.push(g)}c.push(u);const y=function(e){const t=e.length-1,n=[];let i,r,s,o,a;for(i=0;i<t;++i){for(o=i,r=i+1;r<t;++r)Math.abs(e[i][r])>Math.abs(e[i][o])&&(o=r);for(s=i;s<t+1;++s)a=e[s][i],e[s][i]=e[s][o],e[s][o]=a;for(r=i+1;r<t;++r)for(s=t;s>=i;s--)e[s][r]-=e[s][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(a=0,s=r+1;s<t;++s)a+=e[s][r]*n[s];n[r]=(e[t][r]-a)/e[r][r]}return n}(c),_=e=>{e-=o;let t=a+y[0]+y[1]*e+y[2]*e*e;for(h=3;h<d;++h)t+=y[h]*Math.pow(e,h);return t};return{coef:Ha(d,y,-o,a),predict:_,rSquared:$a(e,t,n,a,_)}}function Ha(e,t,n,i){const r=Array(e);let s,o,a,l;for(s=0;s<e;++s)r[s]=0;for(s=e-1;s>=0;--s)for(a=t[s],l=1,r[s]+=a,o=1;o<=s;++o)l*=(s+1-o)/o,r[s-o]+=a*Math.pow(n,o)*l;return r[0]+=i,r}const Wa=2,Xa=1e-12;function qa(e,t,n,i){const[r,s,o,a]=Pa(e,t,n,!0),l=r.length,u=Math.max(2,~~(i*l)),c=new Float64Array(l),d=new Float64Array(l),h=new Float64Array(l).fill(1);for(let e=-1;++e<=Wa;){const t=[0,u-1];for(let e=0;e<l;++e){const n=r[e],i=t[0],o=t[1],a=n-r[i]>r[o]-n?i:o;let l=0,u=0,p=0,f=0,m=0;const g=1/Math.abs(r[a]-n||1);for(let e=i;e<=o;++e){const t=r[e],i=s[e],o=Ka(Math.abs(n-t)*g)*h[e],a=t*o;l+=o,u+=a,p+=i*o,f+=i*a,m+=t*a}const[y,_]=La(u/l,p/l,f/l,m/l);c[e]=y+_*n,d[e]=Math.abs(s[e]-c[e]),Za(r,e+1,t)}if(e===Wa)break;const n=ra(d);if(Math.abs(n)<Xa)break;for(let e,t,i=0;i<l;++i)e=d[i]/(6*n),h[i]=e>=1?Xa:(t=1-e*e)*t}return function(e,t,n,i){const r=e.length,s=[];let o,a=0,l=0,u=[];for(;a<r;++a)o=e[a]+n,u[0]===o?u[1]+=(t[a]-u[1])/++l:(l=0,u[1]+=i,u=[o,t[a]],s.push(u));return u[1]+=i,s}(r,c,o,a)}function Ka(e){return(e=1-e*e*e)*e*e}function Za(e,t,n){const i=e[t];let r=n[0],s=n[1]+1;if(!(s>=e.length))for(;t>r&&e[s]-i<=i-e[r];)n[0]=++r,n[1]=s,++s}const Qa=.5*Math.PI/180;function Ja(e,t,n,i){n=n||25,i=Math.max(n,i||200);const r=t=>[t,e(t)],s=t[0],o=t[1],a=o-s,l=a/i,u=[r(s)],c=[];if(n===i){for(let e=1;e<i;++e)u.push(r(s+e/n*a));return u.push(r(o)),u}c.push(r(o));for(let e=n;--e>0;)c.push(r(s+e/n*a));let d=u[0],h=c[c.length-1];const p=1/a,f=function(e,t){let n=e,i=e;const r=t.length;for(let e=0;e<r;++e){const r=t[e][1];r<n&&(n=r),r>i&&(i=r)}return 1/(i-n)}(d[1],c);for(;h;){const e=r((d[0]+h[0])/2);e[0]-d[0]>=l&&el(d,e,h,p,f)>Qa?c.push(e):(d=h,u.push(h),c.pop()),h=c[c.length-1]}return u}function el(e,t,n,i,r){const s=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),o=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(s-o)}function tl(e,t,n){e=+e,t=+t,n=(r=arguments.length)<2?(t=e,e=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((t-e)/n)),s=new Array(r);++i<r;)s[i]=e+i*n;return s}function nl(e){let t=e,n=e;function i(e,t,i,r){for(null==i&&(i=0),null==r&&(r=e.length);i<r;){const s=i+r>>>1;n(e[s],t)<0?i=s+1:r=s}return i}return 1===e.length&&(t=(t,n)=>e(t)-n,n=function(e){return(t,n)=>Ko(e(t),n)}(e)),{left:i,center:function(e,n,r,s){null==r&&(r=0),null==s&&(s=e.length);const o=i(e,n,r,s-1);return o>r&&t(e[o-1],n)>-t(e[o],n)?o-1:o},right:function(e,t,i,r){for(null==i&&(i=0),null==r&&(r=e.length);i<r;){const s=i+r>>>1;n(e[s],t)>0?r=s:i=s+1}return i}}}var il=new Date,rl=new Date;function sl(e,t,n,i){function r(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return r.floor=function(t){return e(t=new Date(+t)),t},r.ceil=function(n){return e(n=new Date(n-1)),t(n,1),e(n),n},r.round=function(e){var t=r(e),n=r.ceil(e);return e-t<n-e?t:n},r.offset=function(e,n){return t(e=new Date(+e),null==n?1:Math.floor(n)),e},r.range=function(n,i,s){var o,a=[];if(n=r.ceil(n),s=null==s?1:Math.floor(s),!(n<i&&s>0))return a;do{a.push(o=new Date(+n)),t(n,s),e(n)}while(o<n&&n<i);return a},r.filter=function(n){return sl(function(t){if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},function(e,i){if(e>=e)if(i<0)for(;++i<=0;)for(;t(e,-1),!n(e););else for(;--i>=0;)for(;t(e,1),!n(e););})},n&&(r.count=function(t,i){return il.setTime(+t),rl.setTime(+i),e(il),e(rl),Math.floor(n(il,rl))},r.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?r.filter(i?function(t){return i(t)%e===0}:function(t){return r.count(0,t)%e===0}):r:null}),r}const ol=1e3,al=6e4,ll=36e5,ul=864e5,cl=6048e5,dl=2592e6,hl=31536e6;var pl=sl(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*al)/ul,e=>e.getDate()-1);const fl=pl;pl.range;function ml(e){return sl(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*al)/cl})}var gl=ml(0),yl=ml(1),_l=ml(2),vl=ml(3),bl=ml(4),Tl=ml(5),xl=ml(6),El=(gl.range,yl.range,_l.range,vl.range,bl.range,Tl.range,xl.range,sl(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/ul},function(e){return e.getUTCDate()-1}));const wl=El;El.range;function Il(e){return sl(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/cl})}var Al=Il(0),Sl=Il(1),Cl=Il(2),Ol=Il(3),Ml=Il(4),Rl=Il(5),kl=Il(6),Nl=(Al.range,Sl.range,Cl.range,Ol.range,Ml.range,Rl.range,kl.range,sl(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()}));Nl.every=function(e){return isFinite(e=Math.floor(e))&&e>0?sl(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n*e)}):null};const Dl=Nl;Nl.range;var Fl=sl(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()});const Ll=Fl;Fl.range;var Pl=sl(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*ol-e.getMinutes()*al)},function(e,t){e.setTime(+e+t*ll)},function(e,t){return(t-e)/ll},function(e){return e.getHours()});const Bl=Pl;Pl.range;var $l=sl(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*ol)},function(e,t){e.setTime(+e+t*al)},function(e,t){return(t-e)/al},function(e){return e.getMinutes()});const Ul=$l;$l.range;var zl=sl(function(e){e.setTime(e-e.getMilliseconds())},function(e,t){e.setTime(+e+t*ol)},function(e,t){return(t-e)/ol},function(e){return e.getUTCSeconds()});const Vl=zl;zl.range;var jl=sl(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});jl.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?sl(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):jl:null};const Yl=jl;jl.range;var Gl=sl(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});Gl.every=function(e){return isFinite(e=Math.floor(e))&&e>0?sl(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null};const Hl=Gl;Gl.range;var Wl=sl(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()});const Xl=Wl;Wl.range;var ql=sl(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+t*ll)},function(e,t){return(t-e)/ll},function(e){return e.getUTCHours()});const Kl=ql;ql.range;var Zl=sl(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*al)},function(e,t){return(t-e)/al},function(e){return e.getUTCMinutes()});const Ql=Zl;Zl.range;var Jl=Math.sqrt(50),eu=Math.sqrt(10),tu=Math.sqrt(2);function nu(e,t,n){var i,r,s,o,a=-1;if(n=+n,(e=+e)===(t=+t)&&n>0)return[e];if((i=t<e)&&(r=e,e=t,t=r),0===(o=iu(e,t,n))||!isFinite(o))return[];if(o>0){let n=Math.round(e/o),i=Math.round(t/o);for(n*o<e&&++n,i*o>t&&--i,s=new Array(r=i-n+1);++a<r;)s[a]=(n+a)*o}else{o=-o;let n=Math.round(e*o),i=Math.round(t*o);for(n/o<e&&++n,i/o>t&&--i,s=new Array(r=i-n+1);++a<r;)s[a]=(n+a)/o}return i&&s.reverse(),s}function iu(e,t,n){var i=(t-e)/Math.max(0,n),r=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,r);return r>=0?(s>=Jl?10:s>=eu?5:s>=tu?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(s>=Jl?10:s>=eu?5:s>=tu?2:1)}function ru(e,t,n){var i=Math.abs(t-e)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),s=i/r;return s>=Jl?r*=10:s>=eu?r*=5:s>=tu&&(r*=2),t<e?-r:r}const su="year",ou="quarter",au="month",lu="week",uu="date",cu="day",du="dayofyear",hu="hours",pu="minutes",fu="seconds",mu="milliseconds",gu=[su,ou,au,lu,uu,cu,du,hu,pu,fu,mu],yu=gu.reduce((e,t,n)=>(e[t]=1+n,e),{});function _u(e){const t=Xe(e).slice(),n={};t.length||ae("Missing time unit."),t.forEach(e=>{ut(yu,e)?n[e]=1:ae("Invalid time unit: ".concat(e,"."))});return(n[lu]||n[cu]?1:0)+(n[ou]||n[au]||n[uu]?1:0)+(n[du]?1:0)>1&&ae("Incompatible time units: ".concat(e)),t.sort((e,t)=>yu[e]-yu[t]),t}const vu={[su]:"%Y ",[ou]:"Q%q ",[au]:"%b ",[uu]:"%d ",[lu]:"W%U ",[cu]:"%a ",[du]:"%j ",[hu]:"%H:00",[pu]:"00:%M",[fu]:":%S",[mu]:".%L",["".concat(su,"-").concat(au)]:"%Y-%m ",["".concat(su,"-").concat(au,"-").concat(uu)]:"%Y-%m-%d ",["".concat(hu,"-").concat(pu)]:"%H:%M"};function bu(e,t){const n=st({},vu,t),i=_u(e),r=i.length;let s,o,a="",l=0;for(l=0;l<r;)for(s=i.length;s>l;--s)if(o=i.slice(l,s).join("-"),null!=n[o]){a+=n[o],l=s;break}return a.trim()}const Tu=new Date;function xu(e){return Tu.setFullYear(e),Tu.setMonth(0),Tu.setDate(1),Tu.setHours(0,0,0,0),Tu}function Eu(e){return Iu(new Date(e))}function wu(e){return Au(new Date(e))}function Iu(e){return fl.count(xu(e.getFullYear())-1,e)}function Au(e){return gl.count(xu(e.getFullYear())-1,e)}function Su(e){return xu(e).getDay()}function Cu(e,t,n,i,r,s,o){if(0<=e&&e<100){const a=new Date(-1,t,n,i,r,s,o);return a.setFullYear(e),a}return new Date(e,t,n,i,r,s,o)}function Ou(e){return Ru(new Date(e))}function Mu(e){return ku(new Date(e))}function Ru(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return wl.count(t-1,e)}function ku(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Al.count(t-1,e)}function Nu(e){return Tu.setTime(Date.UTC(e,0,1)),Tu.getUTCDay()}function Du(e,t,n,i,r,s,o){if(0<=e&&e<100){const e=new Date(Date.UTC(-1,t,n,i,r,s,o));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,i,r,s,o))}function Fu(e,t,n,i,r){const s=t||1,o=Oe(e),a=(e,t,r)=>function(e,t,n,i){const r=n<=1?e:i?(t,r)=>i+n*Math.floor((e(t,r)-i)/n):(t,i)=>n*Math.floor(e(t,i)/n);return t?(e,n)=>t(r(e,n),n):r}(n[r=r||e],i[r],e===o&&s,t),l=new Date,u=Dt(e),c=u[su]?a(su):it(2012),d=u[au]?a(au):u[ou]?a(ou):he,h=u[lu]&&u[cu]?a(cu,1,lu+cu):u[lu]?a(lu,1):u[cu]?a(cu,1):u[uu]?a(uu,1):u[du]?a(du,1):pe,p=u[hu]?a(hu):he,f=u[pu]?a(pu):he,m=u[fu]?a(fu):he,g=u[mu]?a(mu):he;return function(e){l.setTime(+e);const t=c(l);return r(t,d(l),h(l,t),p(l),f(l),m(l),g(l))}}function Lu(e,t,n){return t+7*e-(n+6)%7}const Pu={[su]:e=>e.getFullYear(),[ou]:e=>Math.floor(e.getMonth()/3),[au]:e=>e.getMonth(),[uu]:e=>e.getDate(),[hu]:e=>e.getHours(),[pu]:e=>e.getMinutes(),[fu]:e=>e.getSeconds(),[mu]:e=>e.getMilliseconds(),[du]:e=>Iu(e),[lu]:e=>Au(e),[lu+cu]:(e,t)=>Lu(Au(e),e.getDay(),Su(t)),[cu]:(e,t)=>Lu(1,e.getDay(),Su(t))},Bu={[ou]:e=>3*e,[lu]:(e,t)=>Lu(e,0,Su(t))};function $u(e,t){return Fu(e,t||1,Pu,Bu,Cu)}const Uu={[su]:e=>e.getUTCFullYear(),[ou]:e=>Math.floor(e.getUTCMonth()/3),[au]:e=>e.getUTCMonth(),[uu]:e=>e.getUTCDate(),[hu]:e=>e.getUTCHours(),[pu]:e=>e.getUTCMinutes(),[fu]:e=>e.getUTCSeconds(),[mu]:e=>e.getUTCMilliseconds(),[du]:e=>Ru(e),[lu]:e=>ku(e),[cu]:(e,t)=>Lu(1,e.getUTCDay(),Nu(t)),[lu+cu]:(e,t)=>Lu(ku(e),e.getUTCDay(),Nu(t))},zu={[ou]:e=>3*e,[lu]:(e,t)=>Lu(e,0,Nu(t))};function Vu(e,t){return Fu(e,t||1,Uu,zu,Du)}const ju={[su]:Dl,[ou]:Ll.every(3),[au]:Ll,[lu]:gl,[uu]:fl,[cu]:fl,[du]:fl,[hu]:Bl,[pu]:Ul,[fu]:Vl,[mu]:Yl},Yu={[su]:Hl,[ou]:Xl.every(3),[au]:Xl,[lu]:Al,[uu]:wl,[cu]:wl,[du]:wl,[hu]:Kl,[pu]:Ql,[fu]:Vl,[mu]:Yl};function Gu(e){return ju[e]}function Hu(e){return Yu[e]}function Wu(e,t,n){return e?e.offset(t,n):void 0}function Xu(e,t,n){return Wu(Gu(e),t,n)}function qu(e,t,n){return Wu(Hu(e),t,n)}function Ku(e,t,n,i){return e?e.range(t,n,i):void 0}function Zu(e,t,n,i){return Ku(Gu(e),t,n,i)}function Qu(e,t,n,i){return Ku(Hu(e),t,n,i)}const Ju=1e3,ec=6e4,tc=36e5,nc=864e5,ic=2592e6,rc=31536e6,sc=[su,au,uu,hu,pu,fu,mu],oc=sc.slice(0,-1),ac=oc.slice(0,-1),lc=ac.slice(0,-1),uc=lc.slice(0,-1),cc=[su,au],dc=[su],hc=[[oc,1,Ju],[oc,5,5e3],[oc,15,15e3],[oc,30,3e4],[ac,1,ec],[ac,5,3e5],[ac,15,9e5],[ac,30,18e5],[lc,1,tc],[lc,3,108e5],[lc,6,216e5],[lc,12,432e5],[uc,1,nc],[[su,lu],1,6048e5],[cc,1,ic],[cc,3,7776e6],[dc,1,rc]];function pc(e){const t=e.extent,n=e.maxbins||40,i=Math.abs(Ct(t))/n;let r,s,o=nl(e=>e[2]).right(hc,i);return o===hc.length?(r=dc,s=ru(t[0]/rc,t[1]/rc,n)):o?(o=hc[i/hc[o-1][2]<hc[o][2]/i?o-1:o],r=o[0],s=o[1]):(r=sc,s=Math.max(ru(t[0],t[1],n),1)),{units:r,step:s}}function fc(e){return e&&e.length?1===e.length?e[0]:(t=e,e=>{const n=t.length;let i=1,r=String(t[0](e));for(;i<n;++i)r+="|"+t[i](e);return r}):function(){return""};var t}function mc(e,t,n){return n||e+(t?"_"+t:"")}const gc=()=>{},yc={init:gc,add:gc,rem:gc,idx:0},_c={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.sum,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t<e.min||void 0===e.min)&&(e.min=t)},rem:(e,t)=>{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||void 0===e.max)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t<e.min&&(e.argmin=n)},rem:(e,t)=>{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3}},vc=Object.keys(_c);function bc(e,t){return _c[e](t)}function Tc(e,t){return e.idx-t.idx}function xc(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.init(this))}function Ec(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t))):++this.missing}function wc(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t))):--this.missing}function Ic(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function Ac(e,t){const n=t||de,i=function(e){const t={};e.forEach(e=>t[e.name]=e);const n=e=>{e.req&&e.req.forEach(e=>{t[e]||n(t[e]=_c[e]())})};return e.forEach(n),Object.values(t).sort(Tc)}(e),r=e.slice().sort(Tc);function s(e){this._ops=i,this._out=r,this.cell=e,this.init()}return s.prototype.init=xc,s.prototype.add=Ec,s.prototype.rem=wc,s.prototype.set=Ic,s.prototype.get=n,s.fields=e.map(e=>e.out),s}function Sc(e){this._key=e?ue(e):po,this.reset()}vc.forEach(e=>{_c[e]=function(e,t){return n=>st({name:e,out:n||e},yc,t)}(e,_c[e])});const Cc=Sc.prototype;function Oc(e){Ho.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}Cc.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Cc.add=function(e){this._add.push(e)},Cc.rem=function(e){this._rem.push(e)},Cc.values=function(){if(this._get=null,0===this._rem.length)return this._add;const e=this._add,t=this._rem,n=this._key,i=e.length,r=t.length,s=Array(i-r),o={};let a,l,u;for(a=0;a<r;++a)o[n(t[a])]=1;for(a=0,l=0;a<i;++a)o[n(u=e[a])]?o[n(u)]=0:s[l++]=u;return this._rem=[],this._add=s},Cc.distinct=function(e){const t=this.values(),n={};let i,r=t.length,s=0;for(;--r>=0;)i=e(t[r])+"",ut(n,i)||(n[i]=1,++s);return s},Cc.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=at(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},Cc.argmin=function(e){return this.extent(e)[0]||{}},Cc.argmax=function(e){return this.extent(e)[1]||{}},Cc.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},Cc.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},Cc.quartile=function(e){return this._get===e&&this._q||(this._q=aa(this.values(),e),this._get=e),this._q},Cc.q1=function(e){return this.quartile(e)[0]},Cc.q2=function(e){return this.quartile(e)[1]},Cc.q3=function(e){return this.quartile(e)[2]},Cc.ci=function(e){return this._get===e&&this._ci||(this._ci=ha(this.values(),1e3,.05,e),this._get=e),this._ci},Cc.ci0=function(e){return this.ci(e)[0]},Cc.ci1=function(e){return this.ci(e)[1]},Oc.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:vc},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},pt(Oc,Ho,{transform(e,t){const n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=i.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):{},t.visit(t.SOURCE,e=>n.add(e))):(n.value=n.value||n.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),i.modifies(n._outputs),n._drop=!1!==e.drop,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter(()=>this.clean()),n.changes(i)},cross(){const e=this,t=e.value,n=e._dnames,i=n.map(()=>({})),r=n.length;function s(e){let t,s,o,a;for(t in e)for(o=e[t].tuple,s=0;s<r;++s)i[s][a=o[n[s]]]=a}s(e._prev),s(t),function s(o,a,l){const u=n[l],c=i[l++];for(const n in c){const i=o?o+"|"+n:n;a[u]=c[n],l<r?s(i,a,l):t[i]||e.cell(i,a)}}("",{},0)},init(e){const t=this._inputs=[],n=this._outputs=[],i={};function r(e){const n=Xe(ie(e)),r=n.length;let s,o=0;for(;o<r;++o)i[s=n[o]]||(i[s]=1,t.push(s))}this._dims=Xe(e.groupby),this._dnames=this._dims.map(e=>{const t=ne(e);return r(e),n.push(t),t}),this.cellkey=e.key?e.key:fc(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const s=e.fields||[null],o=e.ops||["count"],a=e.as||[],l=s.length,u={};let c,d,h,p,f,m;for(l!==o.length&&ae("Unmatched number of fields and aggregate ops."),m=0;m<l;++m)c=s[m],d=o[m],null==c&&"count"!==d&&ae("Null aggregate field specified."),p=ne(c),f=mc(d,p,a[m]),n.push(f),"count"!==d?(h=u[p],h||(r(c),h=u[p]=[],h.field=c,this._measures.push(h)),"count"!==d&&(this._countOnly=!1),h.push(bc(d,f))):this._counts.push(f);return this._measures=this._measures.map(e=>Ac(e,e.field)),{}},cellkey:fc(),cell(e,t){let n=this.value[e];return n?0===n.num&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[e]=this.newcell(e,t),this._adds[this._alen++]=n),n},newcell(e,t){const n={key:e,num:0,agg:null,tuple:this.newtuple(t,this._prev&&this._prev[e]),stamp:this.stamp,store:!1};if(!this._countOnly){const e=this._measures,t=e.length;n.agg=Array(t);for(let i=0;i<t;++i)n.agg[i]=new e[i](n)}return n.store&&(n.data=new Sc),n},newtuple(e,t){const n=this._dnames,i=this._dims,r=i.length,s={};for(let t=0;t<r;++t)s[n[t]]=i[t](e);return t?_o(t.tuple,s):mo(s)},clean(){const e=this.value;for(const t in e)0===e[t].num&&delete e[t]},add(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num+=1,this._countOnly)return;n.store&&n.data.add(e);const i=n.agg;for(let t=0,n=i.length;t<n;++t)i[t].add(i[t].get(e),e)},rem(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num-=1,this._countOnly)return;n.store&&n.data.rem(e);const i=n.agg;for(let t=0,n=i.length;t<n;++t)i[t].rem(i[t].get(e),e)},celltuple(e){const t=e.tuple,n=this._counts;e.store&&e.data.values();for(let i=0,r=n.length;i<r;++i)t[n[i]]=e.num;if(!this._countOnly){const n=e.agg;for(let e=0,i=n.length;e<i;++e)n[e].set(t)}return t},changes(e){const t=this._adds,n=this._mods,i=this._prev,r=this._drop,s=e.add,o=e.rem,a=e.mod;let l,u,c,d;if(i)for(u in i)l=i[u],r&&!l.num||o.push(l.tuple);for(c=0,d=this._alen;c<d;++c)s.push(this.celltuple(t[c])),t[c]=null;for(c=0,d=this._mlen;c<d;++c)l=n[c],(0===l.num&&r?o:a).push(this.celltuple(l)),n[c]=null;return this._alen=this._mlen=0,this._prev=null,e}});function Mc(e){Ho.call(this,null,e)}function Rc(e,t,n){const i=e;let r=t||[],s=n||[],o={},a=0;return{add:e=>s.push(e),remove:e=>o[i(e)]=++a,size:()=>r.length,data:(e,t)=>(a&&(r=r.filter(e=>!o[i(e)]),o={},a=0),t&&e&&r.sort(e),s.length&&(r=e?It(e,r,s.sort(e)):r.concat(s),s=[]),r)}}function kc(e){Ho.call(this,[],e)}function Nc(e){Ao.call(this,null,Dc,e)}function Dc(e){return this.value&&!e.modified()?this.value:Qe(e.fields,e.orders)}function Fc(e){Ho.call(this,null,e)}function Lc(e){Ho.call(this,null,e)}Mc.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},pt(Mc,Ho,{transform(e,t){const n=!1!==e.interval,i=this._bins(e),r=i.start,s=i.step,o=e.as||["bin0","bin1"],a=o[0],l=o[1];let u;return u=e.modified()?(t=t.reflow(!0)).SOURCE:t.modified(ie(e.field))?t.ADD_MOD:t.ADD,t.visit(u,n?e=>{const t=i(e);e[a]=t,e[l]=null==t?null:r+s*(1+(t-r)/s)}:e=>e[a]=i(e)),t.modifies(n?o:a)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=ua(e),i=n.step;let r,s,o=n.start,a=o+Math.ceil((n.stop-o)/i)*i;null!=(r=e.anchor)&&(s=r-(o+i*Math.floor((r-o)/i)),o+=s,a+=s);const l=function(e){let n=Me(t(e));return null==n?null:n<o?-1/0:n>a?1/0:(n=Math.max(o,Math.min(n,a-i)),o+i*Math.floor(1e-14+(n-o)/i))};return l.start=o,l.stop=n.stop,l.step=i,this.value=te(l,ie(t),e.name||"bin_"+ne(t))}}),kc.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},pt(kc,Ho,{transform(e,t){const n=t.fork(t.ALL),i=Rc(po,this.value,n.materialize(n.ADD).add),r=e.sort,s=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(s),this.value=n.source=i.data(vo(r),s),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),pt(Nc,Ao),Fc.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},pt(Fc,Ho,{transform(e,t){const n=t=>n=>{for(var i,r=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(a(n),e.case,s)||[],l=0,u=r.length;l<u;++l)o.test(i=r[l])||t(i)},i=this._parameterCheck(e,t),r=this._counts,s=this._match,o=this._stop,a=e.field,l=e.as||["text","count"],u=n(e=>r[e]=1+(r[e]||0)),c=n(e=>r[e]-=1);return i?t.visit(t.SOURCE,u):(t.visit(t.ADD,u),t.visit(t.REM,c)),this._finish(t,l)},_parameterCheck(e,t){let n=!1;return!e.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),!e.modified("pattern")&&this._match||(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,i=this._tuples||(this._tuples={}),r=t[0],s=t[1],o=e.fork(e.NO_SOURCE|e.NO_FIELDS);let a,l,u;for(a in n)l=i[a],u=n[a]||0,!l&&u?(i[a]=l=mo({}),l[r]=a,l[s]=u,o.add.push(l)):0===u?(l&&o.rem.push(l),n[a]=null,i[a]=null):l[s]!==u&&(l[s]=u,o.mod.push(l));return o.modifies(t)}}),Lc.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},pt(Lc,Ho,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],s=i[1],o=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let a=this.value;return o?(a&&(n.rem=a),a=t.materialize(t.SOURCE).source,n.add=this.value=function(e,t,n,i){for(var r,s,o=[],a={},l=e.length,u=0;u<l;++u)for(a[t]=s=e[u],r=0;r<l;++r)a[n]=e[r],i(a)&&(o.push(mo(a)),(a={})[t]=s);return o}(a,r,s,e.filter||fe)):n.mod=a,n.source=this.value,n.modifies(i)}});const Pc={kde:wa,mixture:Ma,normal:Ea,lognormal:Oa,uniform:Fa},Bc="function";function $c(e,t){const n=e[Bc];ut(Pc,n)||ae("Unknown distribution function: "+n);const i=Pc[n]();for(const n in e)"field"===n?i.data((e.from||t()).map(e[n])):"distributions"===n?i[n](e[n].map(e=>$c(e,t))):typeof i[n]===Bc&&i[n](e[n]);return i}function Uc(e){Ho.call(this,null,e)}const zc=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],Vc={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:zc},{name:"weights",type:"number",array:!0}]};function jc(e,t){return e?e.map((e,n)=>t[n]||ne(e)):null}function Yc(e,t,n){const i=[],r=e=>e(l);let s,o,a,l,u,c;if(null==t)i.push(e.map(n));else for(s={},o=0,a=e.length;o<a;++o)l=e[o],u=t.map(r),c=s[u],c||(s[u]=c=[],c.dims=u,i.push(c)),c.push(n(l));return i}Uc.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:zc.concat(Vc)},{name:"as",type:"string",array:!0,default:["value","density"]}]},pt(Uc,Ho,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=$c(e.distribution,function(e){return()=>e.materialize(e.SOURCE).source}(t)),r=e.steps||e.minsteps||25,s=e.steps||e.maxsteps||200;let o=e.method||"pdf";"pdf"!==o&&"cdf"!==o&&ae("Invalid density method: "+o),e.extent||i.data||ae("Missing density extent parameter."),o=i[o];const a=e.as||["value","density"],l=Ja(o,e.extent||ot(i.data()),r,s).map(e=>{const t={};return t[a[0]]=e[0],t[a[1]]=e[1],mo(t)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function Gc(e){Ho.call(this,null,e)}Gc.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function Hc(e){Ao.call(this,null,Wc,e),this.modified(!0)}function Wc(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:te(n=>t(n,e),ie(t),ne(t))}function Xc(e){Ho.call(this,[void 0,void 0],e)}function qc(e,t){Ao.call(this,e),this.parent=t,this.count=0}function Kc(e){Ho.call(this,{},e),this._keys=dt();const t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,i=t.active;n<i;++n)e(t[n],n,t)}}function Zc(e){Ao.call(this,null,Qc,e)}function Qc(e){return this.value&&!e.modified()?this.value:Ee(e.name)?Xe(e.name).map(e=>ue(e)):ue(e.name,e.as)}function Jc(e){Ho.call(this,dt(),e)}function ed(e){Ho.call(this,[],e)}function td(e){Ho.call(this,[],e)}function nd(e){Ho.call(this,null,e)}function id(e){Ho.call(this,[],e)}pt(Gc,Ho,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=Yc(t.source,e.groupby,de),r=e.smooth||!1,s=e.field,o=e.step||((e,t)=>Ct(ot(e,t))/30)(n,s),a=vo((e,t)=>s(e)-s(t)),l=e.as||"bin",u=i.length;let c,d=1/0,h=-1/0,p=0;for(;p<u;++p){const e=i[p].sort(a);c=-1;for(const t of pa(e,o,r,s))t<d&&(d=t),t>h&&(h=t),e[++c][l]=t}return this.value={start:d,stop:h,step:o},t.reflow(!0).modifies(l)}}),pt(Hc,Ao),Xc.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},pt(Xc,Ho,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let s=n[0],o=n[1];if((r||null==s)&&(s=1/0,o=-1/0),t.visit(r?t.SOURCE:t.ADD,e=>{const t=Me(i(e));null!=t&&(t<s&&(s=t),t>o&&(o=t))}),!Number.isFinite(s)||!Number.isFinite(o)){let e=ne(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${s}, ${o}]`),s=o=void 0}this.value=[s,o]}}),pt(qc,Ao,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),pt(Kc,Ho,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let s,o,a=ut(r,e)&&r[e];return a?a.value.stamp<n.stamp&&(a.init(n),this.activate(a)):(o=i||(o=this._group[e])&&o.tuple,s=n.dataflow,a=new qc(n.fork(n.NO_SOURCE),this),s.add(a).connect(t(s,e,o)),r[e]=a,this.activate(a)),a},clean(){const e=this.value;let t=0;for(const n in e)if(0===e[n].count){const i=e[n].detachSubflow;i&&i(),delete e[n],++t}if(t){const e=this._targets.filter(e=>e&&e.count>0);this.initTargets(e)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;r<i;++r)t[r]=e[r];for(;r<n&&null!=t[r];++r)t[r]=null;t.active=i},transform(e,t){const n=t.dataflow,i=e.key,r=e.subflow,s=this._keys,o=e.modified("key"),a=e=>this.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,e=>{const t=po(e),n=s.get(t);void 0!==n&&(s.delete(t),a(n).rem(e))}),t.visit(t.ADD,e=>{const t=i(e);s.set(po(e),t),a(t).add(e)}),o||t.modified(i.fields)?t.visit(t.MOD,e=>{const t=po(e),n=s.get(t),r=i(e);n===r?a(r).mod(e):(s.set(t,r),a(n).rem(e),a(r).add(e))}):t.changed(t.MOD)&&t.visit(t.MOD,e=>{a(s.get(po(e))).mod(e)}),o&&t.visit(t.REFLOW,e=>{const t=po(e),n=s.get(t),r=i(e);n!==r&&(s.set(t,r),a(n).rem(e),a(r).add(e))}),t.clean()?n.runAfter(()=>{this.clean(),s.clean()}):s.empty>n.cleanThreshold&&n.runAfter(s.clean),t}}),pt(Zc,Ao),Jc.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},pt(Jc,Ho,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),s=r.add,o=r.rem,a=r.mod,l=e.expr;let u=!0;function c(t){const n=po(t),r=l(t,e),c=i.get(n);r&&c?(i.delete(n),s.push(t)):r||c?u&&r&&!c&&a.push(t):(i.set(n,1),o.push(t))}return t.visit(t.REM,e=>{const t=po(e);i.has(t)?i.delete(t):o.push(e)}),t.visit(t.ADD,t=>{l(t,e)?s.push(t):i.set(po(t),1)}),t.visit(t.MOD,c),e.modified()&&(u=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}}),ed.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},pt(ed,Ho,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=jc(i,e.as||[]),s=e.index||null,o=r.length;return n.rem=this.value,t.visit(t.SOURCE,e=>{const t=i.map(t=>t(e)),a=t.reduce((e,t)=>Math.max(e,t.length),0);let l,u,c,d=0;for(;d<a;++d){for(u=go(e),l=0;l<o;++l)u[r[l]]=null==(c=t[l][d])?null:c;s&&(u[s]=d),n.add.push(u)}}),this.value=n.source=n.add,s&&n.modifies(s),n.modifies(r)}}),td.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},pt(td,Ho,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=i.map(ne),s=e.as||["key","value"],o=s[0],a=s[1],l=i.length;return n.rem=this.value,t.visit(t.SOURCE,e=>{for(let t,s=0;s<l;++s)t=go(e),t[o]=r[s],t[a]=i[s](e),n.add.push(t)}),this.value=n.source=n.add,n.modifies(s)}}),nd.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},pt(nd,Ho,{transform(e,t){const n=e.expr,i=e.as,r=e.modified(),s=e.initonly?t.ADD:r?t.SOURCE:t.modified(n.fields)||t.modified(i)?t.ADD_MOD:t.ADD;return r&&(t=t.materialize().reflow(!0)),e.initonly||t.modifies(i),t.visit(s,t=>t[i]=n(t,e))}}),pt(id,Ho,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r,s,o,a=this.value,l=e.size-a.length;if(l>0){for(r=[];--l>=0;)r.push(o=mo(i(e))),a.push(o);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else s=a.slice(0,-l),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(s):s,a=a.slice(-l);return n.source=this.value=a,n}});const rd={value:"value",median:ra,mean:function(e,t){let n=0,i=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++n,i+=t);else{let r=-1;for(let s of e)null!=(s=t(s,++r,e))&&(s=+s)>=s&&(++n,i+=s)}if(n)return i/n},min:Qo,max:Zo},sd=[];function od(e){Ho.call(this,[],e)}function ad(e){Oc.call(this,e)}function ld(e){Ho.call(this,null,e)}function ud(e){Ao.call(this,null,cd,e)}function cd(e){return this.value&&!e.modified()?this.value:Tt(e.fields,e.flat)}function dd(e){Ho.call(this,[],e),this._pending=null}function hd(e,t,n){n.forEach(mo);const i=t.fork(t.NO_FIELDS&t.NO_SOURCE);return i.rem=e.value,e.value=i.source=i.add=n,e._pending=null,i.rem.length&&i.clean(!0),i}function pd(e){Ho.call(this,{},e)}function fd(e){Ao.call(this,null,md,e)}function md(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i,r,s=1/0,o=-1/0;for(i=0;i<n;++i)r=t[i],r[0]<s&&(s=r[0]),r[1]>o&&(o=r[1]);return[s,o]}function gd(e){Ao.call(this,null,yd,e)}function yd(e){return this.value&&!e.modified()?this.value:e.values.reduce((e,t)=>e.concat(t),[])}function _d(e){Ho.call(this,null,e)}function vd(e){Oc.call(this,e)}function bd(e){Kc.call(this,e)}function Td(e){Ho.call(this,null,e)}function xd(e){Ho.call(this,null,e)}function Ed(e){Ho.call(this,null,e)}od.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},pt(od,Ho,{transform(e,t){var n,i,r,s,o,a,l,u,c,d,h=t.fork(t.ALL),p=function(e){var t,n=e.method||rd.value;if(null!=rd[n])return n===rd.value?(t=void 0!==e.value?e.value:0,()=>t):rd[n];ae("Unrecognized imputation method: "+n)}(e),f=function(e){const t=e.field;return e=>e?t(e):NaN}(e),m=ne(e.field),g=ne(e.key),y=(e.groupby||[]).map(ne),_=function(e,t,n,i){var r,s,o,a,l,u,c,d,h=e=>e(d),p=[],f=i?i.slice():[],m={},g={};for(f.forEach((e,t)=>m[e]=t+1),a=0,c=e.length;a<c;++a)u=n(d=e[a]),l=m[u]||(m[u]=f.push(u)),(o=g[s=(r=t?t.map(h):sd)+""])||(o=g[s]=[],p.push(o),o.values=r),o[l-1]=d;return p.domain=f,p}(t.source,e.groupby,e.key,e.keyvals),v=[],b=this.value,T=_.domain.length;for(o=0,u=_.length;o<u;++o)for(r=(n=_[o]).values,i=NaN,l=0;l<T;++l)if(null==n[l]){for(s=_.domain[l],d={_impute:!0},a=0,c=r.length;a<c;++a)d[y[a]]=r[a];d[g]=s,d[m]=Number.isNaN(i)?i=p(n,f):i,v.push(mo(d))}return v.length&&(h.add=h.materialize(h.ADD).add.concat(v)),b.length&&(h.rem=h.materialize(h.REM).rem.concat(b)),this.value=v,h}}),ad.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:vc},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},pt(ad,Oc,{transform(e,t){const n=this,i=e.modified();let r;return n.value&&(i||t.modified(n._inputs,!0))?(r=n.value=i?n.init(e):{},t.visit(t.SOURCE,e=>n.add(e))):(r=n.value=n.value||this.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),n.changes(),t.visit(t.SOURCE,e=>{st(e,r[n.cellkey(e)].tuple)}),t.reflow(i).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,i;for(n=0,i=this._alen;n<i;++n)this.celltuple(e[n]),e[n]=null;for(n=0,i=this._mlen;n<i;++n)this.celltuple(t[n]),t[n]=null;this._alen=this._mlen=0}}),ld.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]},pt(ld,Ho,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=t.materialize(t.SOURCE).source,r=Yc(i,e.groupby,e.field),s=(e.groupby||[]).map(ne),o=e.bandwidth,a=e.cumulative?"cdf":"pdf",l=e.as||["value","density"],u=[];let c=e.extent,d=e.steps||e.minsteps||25,h=e.steps||e.maxsteps||200;"pdf"!==a&&"cdf"!==a&&ae("Invalid density method: "+a),"shared"===e.resolve&&(c||(c=ot(i,e.field)),d=h=e.steps||h),r.forEach(t=>{const n=wa(t,o)[a],i=e.counts?t.length:1;Ja(n,c||ot(t),d,h).forEach(e=>{const n={};for(let e=0;e<s.length;++e)n[s[e]]=t.dims[e];n[l[0]]=e[0],n[l[1]]=e[1]*i,u.push(mo(n))})}),this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}}),pt(ud,Ao),pt(dd,Ho,{transform(e,t){const n=t.dataflow;if(this._pending)return hd(this,t,this._pending);if(function(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}(e))return t.StopPropagation;if(e.values)return hd(this,t,n.parse(e.values,e.format));if(e.async){const t=n.request(e.url,e.format).then(e=>(this._pending=Xe(e.data),e=>e.touch(this)));return{async:t}}return n.request(e.url,e.format).then(e=>hd(this,t,Xe(e.data)))}}),pd.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},pt(pd,Ho,{transform(e,t){const n=e.fields,i=e.index,r=e.values,s=null==e.default?null:e.default,o=e.modified(),a=n.length;let l,u,c,d=o?t.SOURCE:t.ADD,h=t,p=e.as;return r?(u=r.length,a>1&&!p&&ae('Multi-field lookup requires explicit "as" parameter.'),p&&p.length!==a*u&&ae('The "as" parameter has too few output field names.'),p=p||r.map(ne),l=function(e){for(var t,o,l=0,c=0;l<a;++l)if(null==(o=i.get(n[l](e))))for(t=0;t<u;++t,++c)e[p[c]]=s;else for(t=0;t<u;++t,++c)e[p[c]]=r[t](o)}):(p||ae("Missing output field names."),l=function(e){for(var t,r=0;r<a;++r)t=i.get(n[r](e)),e[p[r]]=null==t?s:t}),o?h=t.reflow(!0):(c=n.some(e=>t.modified(e.fields)),d|=c?t.MOD:0),t.visit(d,l),h.modifies(p)}}),pt(fd,Ao),pt(gd,Ao),pt(_d,Ho,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),vd.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:vc,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},pt(vd,Oc,{_transform:Oc.prototype.transform,transform(e,t){return this._transform(function(e,t){const n=e.field,i=e.value,r=("count"===e.op?"__count__":e.op)||"sum",s=ie(n).concat(ie(i)),o=function(e,t,n){const i={},r=[];return n.visit(n.SOURCE,t=>{const n=e(t);i[n]||(i[n]=1,r.push(n))}),r.sort(Je),t?r.slice(0,t):r}(n,e.limit||0,t);t.changed()&&e.set("__pivot__",null,null,!0);return{key:e.key,groupby:e.groupby,ops:o.map(()=>r),fields:o.map(e=>function(e,t,n,i){return te(i=>t(i)===e?n(i):NaN,i,e+"")}(e,n,i,s)),as:o.map(e=>e+""),modified:e.modified.bind(e)}}(e,t),t)}}),pt(bd,Kc,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(po(e),n,t,e);return(e.modified("field")||i&&t.modified(ie(i)))&&ae("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,e=>{const t=r(e);i(e).forEach(e=>t.mod(e))}),t.visit(t.ADD,e=>{const t=r(e);i(e).forEach(e=>t.add(mo(e)))}),t.visit(t.REM,e=>{const t=r(e);i(e).forEach(e=>t.rem(e))})):(t.visit(t.MOD,e=>r(e).mod(e)),t.visit(t.ADD,e=>r(e).add(e)),t.visit(t.REM,e=>r(e).rem(e))),t.clean()&&t.runAfter(()=>this.clean()),t}}),Td.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},pt(Td,Ho,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=jc(e.fields,e.as||[]),s=i?(e,t)=>function(e,t,n,i){for(let r=0,s=n.length;r<s;++r)t[i[r]]=n[r](e);return t}(e,t,i,r):yo;let o;return this.value?o=this.value:(t=t.addAll(),o=this.value={}),t.visit(t.REM,e=>{const t=po(e);n.rem.push(o[t]),o[t]=null}),t.visit(t.ADD,e=>{const t=s(e,mo({}));o[po(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{n.mod.push(s(e,o[po(e)]))}),n}}),pt(xd,Ho,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),Ed.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};function wd(e){Ho.call(this,null,e)}function Id(e){Ho.call(this,[],e),this.count=0}function Ad(e){Ho.call(this,null,e)}function Sd(e){Ho.call(this,null,e),this.modified(!0)}function Cd(e){Ho.call(this,null,e)}pt(Ed,Ho,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;const r=Yc(t.materialize(t.SOURCE).source,e.groupby,e.field),s=(e.groupby||[]).map(ne),o=[],a=e.step||.01,l=e.probs||tl(a/2,1-1e-14,a),u=l.length;return r.forEach(e=>{const t=oa(e,l);for(let n=0;n<u;++n){const r={};for(let t=0;t<s.length;++t)r[s[t]]=e.dims[t];r[i[0]]=l[n],r[i[1]]=t[n],o.push(mo(r))}}),this.value&&(n.rem=this.value),this.value=n.add=n.source=o,n}}),pt(wd,Ho,{transform(e,t){let n,i;return this.value?i=this.value:(n=t=t.addAll(),i=this.value={}),e.derive&&(n=t.fork(t.NO_SOURCE),t.visit(t.REM,e=>{const t=po(e);n.rem.push(i[t]),i[t]=null}),t.visit(t.ADD,e=>{const t=go(e);i[po(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{const t=i[po(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)})),n}}),Id.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},pt(Id,Ho,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,s=this.value.reduce((e,t)=>(e[po(t)]=1,e),{});let o=this.value,a=this.count,l=0;function u(e){let t,i;o.length<r?o.push(e):(i=~~((a+1)*ca()),i<o.length&&i>=l&&(t=o[i],s[po(t)]&&n.rem.push(t),o[i]=e)),++a}if(t.rem.length&&(t.visit(t.REM,e=>{const t=po(e);s[t]&&(s[t]=-1,n.rem.push(e)),--a}),o=o.filter(e=>-1!==s[po(e)])),(t.rem.length||i)&&o.length<r&&t.source&&(l=a=o.length,t.visit(t.SOURCE,e=>{s[po(e)]||u(e)}),l=-1),i&&o.length>r){const e=o.length-r;for(let t=0;t<e;++t)s[po(o[t])]=-1,n.rem.push(o[t]);o=o.slice(e)}return t.mod.length&&t.visit(t.MOD,e=>{s[po(e)]&&n.mod.push(e)}),t.add.length&&t.visit(t.ADD,u),(t.add.length||l<0)&&(n.add=o.filter(e=>!s[po(e)])),this.count=a,this.value=n.source=o,n}}),Ad.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},pt(Ad,Ho,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),i=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=tl(e.start,e.stop,e.step||1).map(e=>{const t={};return t[i]=e,mo(t)}),n.add=t.add.concat(this.value),n}}),pt(Sd,Ho,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const Od=["unit0","unit1"];function Md(e){Ho.call(this,dt(),e)}function Rd(e){Ho.call(this,null,e)}Cd.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:gu,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:Od}]},pt(Cd,Ho,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,s=this._floor(e,t),o=(r?Hu:Gu)(s.unit).offset,a=e.as||Od,l=a[0],u=a[1],c=s.step;let d=s.start||1/0,h=s.stop||-1/0,p=t.ADD;return(e.modified()||t.modified(ie(n)))&&(p=(t=t.reflow(!0)).SOURCE,d=1/0,h=-1/0),t.visit(p,e=>{const t=n(e);let r,a;null==t?(e[l]=null,i&&(e[u]=null)):(e[l]=r=a=s(t),i&&(e[u]=a=o(r,c)),r<d&&(d=r),a>h&&(h=a))}),s.start=d,s.stop=h,t.modifies(i?a:l)},_floor(e,t){const n="utc"===e.timezone,{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:pc({extent:e.extent||ot(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),s=_u(i),o=this.value||{},a=(n?Vu:$u)(s,r);return a.unit=Oe(s),a.units=s,a.step=r,a.start=o.start,a.stop=o.stop,this.value=a}}),pt(Md,Ho,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,s=e=>r.set(i(e),e);let o=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,s)):t.changed()?(t.visit(t.REM,e=>r.delete(i(e))),t.visit(t.ADD,s)):o=!1,this.modified(o),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}}),pt(Rd,Ho,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(vo(e.sort)):t.source).map(e.field))}});const kd={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){const e=kd.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,i=t.compare;let r=t.index;if(e<r){for(;r+1<n.length&&!i(n[r],n[r+1]);)++r;e=r}return(1+e)/n.length}}},ntile:function(e,t){(t=+t)>0||ae("ntile num must be greater than zero.");const n=kd.cume_dist(),i=n.next;return{init:n.init,next:e=>Math.ceil(t*i(e))}},lag:function(e,t){return t=+t||1,{next:n=>{const i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const i=n.index+t,r=n.data;return i<r.length?e(r[i]):null}}},first_value:function(e){return{next:t=>e(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return(t=+t)>0||ae("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return i<n.i1?e(n.data[i]):null}}},prev_value:function(e){let t;return{init:()=>t=null,next:n=>{const i=e(n.data[n.index]);return null!=i?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{const r=i.data;return i.index<=n?t:(n=function(e,t,n){for(let i=t.length;n<i;++n){if(null!=e(t[n]))return n}return-1}(e,r,i.index))<0?(n=r.length,t=null):t=e(r[n])}}}};const Nd=Object.keys(kd);function Dd(e){const t=Xe(e.ops),n=Xe(e.fields),i=Xe(e.params),r=Xe(e.as),s=this.outputs=[],o=this.windows=[],a={},l={},u=[],c=[];let d=!0;function h(e){Xe(ie(e)).forEach(e=>a[e]=1)}h(e.sort),t.forEach((e,t)=>{const a=n[t],p=ne(a),f=mc(e,p,r[t]);if(h(a),s.push(f),ut(kd,e))o.push(function(e,t,n,i){const r=kd[e](t,n);return{init:r.init||he,update:function(e,t){t[i]=r.next(e)}}}(e,n[t],i[t],f));else{if(null==a&&"count"!==e&&ae("Null aggregate field specified."),"count"===e)return void u.push(f);d=!1;let t=l[p];t||(t=l[p]=[],t.field=a,c.push(t)),t.push(bc(e,f))}}),(u.length||c.length)&&(this.cell=function(e,t,n){e=e.map(e=>Ac(e,e.field));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,s=i.agg=Array(r),o=0;o<r;++o)s[o]=new e[o](i);if(i.store)var a=i.data=new Sc;return i.add=function(e){if(i.num+=1,!n){a&&a.add(e);for(let t=0;t<r;++t)s[t].add(s[t].get(e),e)}},i.rem=function(e){if(i.num-=1,!n){a&&a.rem(e);for(let t=0;t<r;++t)s[t].rem(s[t].get(e),e)}},i.set=function(e){let r,o;for(a&&a.values(),r=0,o=t.length;r<o;++r)e[t[r]]=i.num;if(!n)for(r=0,o=s.length;r<o;++r)s[r].set(e)},i.init=function(){i.num=0,a&&a.reset();for(let e=0;e<r;++e)s[e].init()},i}(c,u,d)),this.inputs=Object.keys(a)}const Fd=Dd.prototype;function Ld(e){Ho.call(this,{},e),this._mlen=0,this._mods=[]}function Pd(e,t,n,i){const r=i.sort,s=r&&!i.ignorePeers,o=i.frame||[null,0],a=e.data(n),l=a.length,u=s?nl(r):null,c={i0:0,i1:0,p0:0,p1:0,index:0,data:a,compare:r||it(-1)};t.init();for(let e=0;e<l;++e)Bd(c,o,e,l),s&&$d(c,u),t.update(c,a[e])}function Bd(e,t,n,i){e.p0=e.i0,e.p1=e.i1,e.i0=null==t[0]?0:Math.max(0,n-Math.abs(t[0])),e.i1=null==t[1]?i:Math.min(i,n+Math.abs(t[1])+1),e.index=n}function $d(e,t){const n=e.i0,i=e.i1-1,r=e.compare,s=e.data,o=s.length-1;n>0&&!r(s[n],s[n-1])&&(e.i0=t.left(s,s[n])),i<o&&!r(s[i],s[i+1])&&(e.i1=t.right(s,s[i]))}function Ud(e,t,n){return e.fields=t||[],e.fname=n,e}function zd(e){return 1===e.length?Vd(e[0]):jd(e)}Fd.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()},Fd.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,s=i&&i.length;let o;if(n){for(o=e.p0;o<e.i0;++o)n.rem(r[o]);for(o=e.p1;o<e.i1;++o)n.add(r[o]);n.set(t)}for(o=0;o<s;++o)i[o].update(e,t)},Ld.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Nd.concat(vc)},{name:"params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]},pt(Ld,Ho,{transform(e,t){this.stamp=t.stamp;const n=e.modified(),i=vo(e.sort),r=fc(e.groupby),s=e=>this.group(r(e));let o=this.state;o&&!n||(o=this.state=new Dd(e)),n||t.modified(o.inputs)?(this.value={},t.visit(t.SOURCE,e=>s(e).add(e))):(t.visit(t.REM,e=>s(e).remove(e)),t.visit(t.ADD,e=>s(e).add(e)));for(let t=0,n=this._mlen;t<n;++t)Pd(this._mods[t],o,i,e);return this._mlen=0,this._mods=[],t.reflow(n).modifies(o.outputs)},group(e){let t=this.value[e];return t||(t=this.value[e]=Rc(po),t.stamp=-1),t.stamp<this.stamp&&(t.stamp=this.stamp,this._mods[this._mlen++]=t),t}});const Vd=e=>function(t){return t[e]},jd=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function Yd(e){throw Error(e)}function Gd(e){const t=[],n=e.length;let i,r,s,o=null,a=0,l="";function u(){t.push(l+e.substring(i,r)),l="",i=r+1}for(e+="",i=r=0;r<n;++r)if(s=e[r],"\\"===s)l+=e.substring(i,r++),i=r;else if(s===o)u(),o=null,a=-1;else{if(o)continue;i===a&&'"'===s||i===a&&"'"===s?(i=r+1,o=s):"."!==s||a?"["===s?(r>i&&u(),a=i=r+1):"]"===s&&(a||Yd("Access path missing open bracket: "+e),a>0&&u(),a=0,i=r+1):r>i?u():i=r+1}return a&&Yd("Access path missing closing bracket: "+e),o&&Yd("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function Hd(e,t,n){const i=Gd(e);return e=1===i.length?i[0]:e,Ud((n&&n.get||zd)(i),[e],t||e)}Hd("id");const Wd=Ud(e=>e,[],"identity"),Xd=(Ud(()=>0,[],"zero"),Ud(()=>1,[],"one"),Ud(()=>!0,[],"true"));Ud(()=>!1,[],"false");var qd=Array.isArray;function Kd(e){return e===Object(e)}function Zd(e){return e[e.length-1]}function Qd(e){return null==e||""===e?null:+e}function Jd(e){return null!=e?qd(e)?e:[e]:[]}function eh(e){return"function"==typeof e}function th(e){for(let t,n,i=1,r=arguments.length;i<r;++i)for(n in t=arguments[i],t)e[n]=t[n];return e}function nh(e,t){return Object.hasOwn(e,t)}function ih(e,t,n){const i=e.prototype=Object.create(t.prototype);return Object.defineProperty(i,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),th(i,n)}function rh(e){return"string"==typeof e}function sh(e){return qd(e)?"["+e.map(sh)+"]":Kd(e)||rh(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function oh(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]]=!0;return t}function ah(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function lh(e){this._context=e}function uh(){}function ch(e){this._context=e}function dh(e){this._context=e}function hh(e,t){this._basis=new lh(e),this._beta=t}lh.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:ah(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ah(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},ch.prototype={areaStart:uh,areaEnd:uh,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:ah(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},dh.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&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,i=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:ah(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},hh.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var i,r=e[0],s=t[0],o=e[n]-r,a=t[n]-s,l=-1;++l<=n;)i=l/n,this._basis.point(this._beta*e[l]+(1-this._beta)*(r+i*o),this._beta*t[l]+(1-this._beta)*(s+i*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const ph=function e(t){function n(e){return 1===t?new lh(e):new hh(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function fh(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function mh(e,t){this._context=e,this._k=(1-t)/6}mh.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:fh(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:fh(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const gh=function e(t){function n(e){return new mh(e,t)}return n.tension=function(t){return e(+t)},n}(0);function yh(e,t){this._context=e,this._k=(1-t)/6}yh.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&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:fh(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const _h=function e(t){function n(e){return new yh(e,t)}return n.tension=function(t){return e(+t)},n}(0);function vh(e,t){this._context=e,this._k=(1-t)/6}vh.prototype={areaStart:uh,areaEnd:uh,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:fh(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const bh=function e(t){function n(e){return new vh(e,t)}return n.tension=function(t){return e(+t)},n}(0),Th=Math.abs,xh=Math.atan2,Eh=Math.cos,wh=Math.max,Ih=Math.min,Ah=Math.sin,Sh=Math.sqrt,Ch=1e-12,Oh=Math.PI,Mh=Oh/2,Rh=2*Oh;function kh(e){return e>=1?Mh:e<=-1?-Mh:Math.asin(e)}function Nh(e,t,n){var i=e._x1,r=e._y1,s=e._x2,o=e._y2;if(e._l01_a>Ch){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,r=(r*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>Ch){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*u+e._x1*e._l23_2a-t*e._l12_2a)/c,o=(o*u+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(i,r,s,o,e._x2,e._y2)}function Dh(e,t){this._context=e,this._alpha=t}Dh.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&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Nh(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Fh=function e(t){function n(e){return t?new Dh(e,t):new mh(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Lh(e,t){this._context=e,this._alpha=t}Lh.prototype={areaStart:uh,areaEnd:uh,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Nh(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Ph=function e(t){function n(e){return t?new Lh(e,t):new vh(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Bh(e,t){this._context=e,this._alpha=t}Bh.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&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,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:Nh(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const $h=function e(t){function n(e){return t?new Bh(e,t):new yh(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Uh(e){this._context=e}function zh(e){return new Uh(e)}function Vh(e){this._context=e}function jh(e){return e<0?-1:1}function Yh(e,t,n){var i=e._x1-e._x0,r=t-e._x1,s=(e._y1-e._y0)/(i||r<0&&-0),o=(n-e._y1)/(r||i<0&&-0),a=(s*r+o*i)/(i+r);return(jh(s)+jh(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function Gh(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Hh(e,t,n){var i=e._x0,r=e._y0,s=e._x1,o=e._y1,a=(s-i)/3;e._context.bezierCurveTo(i+a,r+a*t,s-a,o-a*n,s,o)}function Wh(e){this._context=e}function Xh(e){this._context=new qh(e)}function qh(e){this._context=e}function Kh(e){this._context=e}function Zh(e){var t,n,i=e.length-1,r=new Array(i),s=new Array(i),o=new Array(i);for(r[0]=0,s[0]=2,o[0]=e[0]+2*e[1],t=1;t<i-1;++t)r[t]=1,s[t]=4,o[t]=4*e[t]+2*e[t+1];for(r[i-1]=2,s[i-1]=7,o[i-1]=8*e[i-1]+e[i],t=1;t<i;++t)n=r[t]/s[t-1],s[t]-=n,o[t]-=n*o[t-1];for(r[i-1]=o[i-1]/s[i-1],t=i-2;t>=0;--t)r[t]=(o[t]-r[t+1])/s[t];for(s[i-1]=(e[i]+r[i-1])/2,t=0;t<i-1;++t)s[t]=2*e[t+1]-r[t+1];return[r,s]}function Qh(e,t){this._context=e,this._t=t}function Jh(e){return function(){return e}}Uh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}},Vh.prototype={areaStart:uh,areaEnd:uh,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}},Wh.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:Hh(this,this._t0,Gh(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Hh(this,Gh(this,n=Yh(this,e,t)),n);break;default:Hh(this,this._t0,n=Yh(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(Xh.prototype=Object.create(Wh.prototype)).point=function(e,t){Wh.prototype.point.call(this,t,e)},qh.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,i,r,s){this._context.bezierCurveTo(t,e,i,n,s,r)}},Kh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var i=Zh(e),r=Zh(t),s=0,o=1;o<n;++s,++o)this._context.bezierCurveTo(i[0][s],r[0][s],i[1][s],r[1][s],e[o],t[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},Qh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};const ep=Math.PI,tp=2*ep,np=1e-6,ip=tp-np;function rp(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class sp{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?rp:function(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return rp;const n=10**t;return function(e){this._+=e[0];for(let t=1,i=e.length;t<i;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,i){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,t,n,i,r,s){this._append`C${+e},${+t},${+n},${+i},${this._x1=+r},${this._y1=+s}`}arcTo(e,t,n,i,r){if(e=+e,t=+t,n=+n,i=+i,(r=+r)<0)throw new Error(`negative radius: ${r}`);let s=this._x1,o=this._y1,a=n-e,l=i-t,u=s-e,c=o-t,d=u*u+c*c;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>np)if(Math.abs(c*a-l*u)>np&&r){let h=n-s,p=i-o,f=a*a+l*l,m=h*h+p*p,g=Math.sqrt(f),y=Math.sqrt(d),_=r*Math.tan((ep-Math.acos((f+d-m)/(2*g*y)))/2),v=_/y,b=_/g;Math.abs(v-1)>np&&this._append`L${e+v*u},${t+v*c}`,this._append`A${r},${r},0,0,${+(c*h>u*p)},${this._x1=e+b*a},${this._y1=t+b*l}`}else this._append`L${this._x1=e},${this._y1=t}`;else;}arc(e,t,n,i,r,s){if(e=+e,t=+t,s=!!s,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(i),a=n*Math.sin(i),l=e+o,u=t+a,c=1^s,d=s?i-r:r-i;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>np||Math.abs(this._y1-u)>np)&&this._append`L${l},${u}`,n&&(d<0&&(d=d%tp+tp),d>ip?this._append`A${n},${n},0,1,${c},${e-o},${t-a}A${n},${n},0,1,${c},${this._x1=l},${this._y1=u}`:d>np&&this._append`A${n},${n},0,${+(d>=ep)},${c},${this._x1=e+n*Math.cos(r)},${this._y1=t+n*Math.sin(r)}`)}rect(e,t,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function op(){return new sp}function ap(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new sp(t)}function lp(e){return e.innerRadius}function up(e){return e.outerRadius}function cp(e){return e.startAngle}function dp(e){return e.endAngle}function hp(e){return e&&e.padAngle}function pp(e,t,n,i,r,s,o){var a=e-n,l=t-i,u=(o?s:-s)/Sh(a*a+l*l),c=u*l,d=-u*a,h=e+c,p=t+d,f=n+c,m=i+d,g=(h+f)/2,y=(p+m)/2,_=f-h,v=m-p,b=_*_+v*v,T=r-s,x=h*m-f*p,E=(v<0?-1:1)*Sh(wh(0,T*T*b-x*x)),w=(x*v-_*E)/b,I=(-x*_-v*E)/b,A=(x*v+_*E)/b,S=(-x*_+v*E)/b,C=w-g,O=I-y,M=A-g,R=S-y;return C*C+O*O>M*M+R*R&&(w=A,I=S),{cx:w,cy:I,x01:-c,y01:-d,x11:w*(r/T-1),y11:I*(r/T-1)}}op.prototype=sp.prototype;Array.prototype.slice;function fp(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function mp(e){return e[0]}function gp(e){return e[1]}function yp(e,t){var n=Jh(!0),i=null,r=zh,s=null,o=ap(a);function a(a){var l,u,c,d=(a=fp(a)).length,h=!1;for(null==i&&(s=r(c=o())),l=0;l<=d;++l)!(l<d&&n(u=a[l],l,a))===h&&((h=!h)?s.lineStart():s.lineEnd()),h&&s.point(+e(u,l,a),+t(u,l,a));if(c)return s=null,c+""||null}return e="function"==typeof e?e:void 0===e?mp:Jh(e),t="function"==typeof t?t:void 0===t?gp:Jh(t),a.x=function(t){return arguments.length?(e="function"==typeof t?t:Jh(+t),a):e},a.y=function(e){return arguments.length?(t="function"==typeof e?e:Jh(+e),a):t},a.defined=function(e){return arguments.length?(n="function"==typeof e?e:Jh(!!e),a):n},a.curve=function(e){return arguments.length?(r=e,null!=i&&(s=r(i)),a):r},a.context=function(e){return arguments.length?(null==e?i=s=null:s=r(i=e),a):i},a}function _p(e,t,n){var i=null,r=Jh(!0),s=null,o=zh,a=null,l=ap(u);function u(u){var c,d,h,p,f,m=(u=fp(u)).length,g=!1,y=new Array(m),_=new Array(m);for(null==s&&(a=o(f=l())),c=0;c<=m;++c){if(!(c<m&&r(p=u[c],c,u))===g)if(g=!g)d=c,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),h=c-1;h>=d;--h)a.point(y[h],_[h]);a.lineEnd(),a.areaEnd()}g&&(y[c]=+e(p,c,u),_[c]=+t(p,c,u),a.point(i?+i(p,c,u):y[c],n?+n(p,c,u):_[c]))}if(f)return a=null,f+""||null}function c(){return yp().defined(r).curve(o).context(s)}return e="function"==typeof e?e:void 0===e?mp:Jh(+e),t="function"==typeof t?t:Jh(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?gp:Jh(+n),u.x=function(t){return arguments.length?(e="function"==typeof t?t:Jh(+t),i=null,u):e},u.x0=function(t){return arguments.length?(e="function"==typeof t?t:Jh(+t),u):e},u.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:Jh(+e),u):i},u.y=function(e){return arguments.length?(t="function"==typeof e?e:Jh(+e),n=null,u):t},u.y0=function(e){return arguments.length?(t="function"==typeof e?e:Jh(+e),u):t},u.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:Jh(+e),u):n},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(n)},u.lineX1=function(){return c().x(i).y(t)},u.defined=function(e){return arguments.length?(r="function"==typeof e?e:Jh(!!e),u):r},u.curve=function(e){return arguments.length?(o=e,null!=s&&(a=o(s)),u):o},u.context=function(e){return arguments.length?(null==e?s=a=null:a=o(s=e),u):s},u}Sh(3);const vp={draw(e,t){const n=Sh(t/Oh);e.moveTo(n,0),e.arc(0,0,n,0,Rh)}},bp=(Sh(1/3),Ah(Oh/10)/Ah(7*Oh/10));Ah(Rh/10),Eh(Rh/10),Sh(3),Sh(3),Sh(3),Sh(12);function Tp(e,t){if("undefined"!=typeof document&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}const xp=()=>"undefined"!=typeof Image?Image:null;var Ep={},wp={};function Ip(e){return new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'}).join(",")+"}")}function Ap(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var i in e)i in t||n.push(t[i]=i)}),n}function Sp(e,t){var n=e+"",i=n.length;return i<t?new Array(t-i+1).join(0)+n:n}function Cp(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),r=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":function(e){return e<0?"-"+Sp(-e,6):e>9999?"+"+Sp(e,6):Sp(e,4)}(e.getUTCFullYear())+"-"+Sp(e.getUTCMonth()+1,2)+"-"+Sp(e.getUTCDate(),2)+(r?"T"+Sp(t,2)+":"+Sp(n,2)+":"+Sp(i,2)+"."+Sp(r,3)+"Z":i?"T"+Sp(t,2)+":"+Sp(n,2)+":"+Sp(i,2)+"Z":n||t?"T"+Sp(t,2)+":"+Sp(n,2)+"Z":"")}function Op(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function i(e,t){var i,r=[],s=e.length,o=0,a=0,l=s<=0,u=!1;function c(){if(l)return wp;if(u)return u=!1,Ep;var t,i,r=o;if(34===e.charCodeAt(r)){for(;o++<s&&34!==e.charCodeAt(o)||34===e.charCodeAt(++o););return(t=o)>=s?l=!0:10===(i=e.charCodeAt(o++))?u=!0:13===i&&(u=!0,10===e.charCodeAt(o)&&++o),e.slice(r+1,t-1).replace(/""/g,'"')}for(;o<s;){if(10===(i=e.charCodeAt(t=o++)))u=!0;else if(13===i)u=!0,10===e.charCodeAt(o)&&++o;else if(i!==n)continue;return e.slice(r,t)}return l=!0,e.slice(r,s)}for(10===e.charCodeAt(s-1)&&--s,13===e.charCodeAt(s-1)&&--s;(i=c())!==wp;){for(var d=[];i!==Ep&&i!==wp;)d.push(i),i=c();t&&null==(d=t(d,a++))||r.push(d)}return r}function r(t,n){return t.map(function(t){return n.map(function(e){return o(t[e])}).join(e)})}function s(t){return t.map(o).join(e)}function o(e){return null==e?"":e instanceof Date?Cp(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,r,s=i(e,function(e,i){if(n)return n(e,i-1);r=e,n=t?function(e,t){var n=Ip(e);return function(i,r){return t(n(i),r,e)}}(e,t):Ip(e)});return s.columns=r||[],s},parseRows:i,format:function(t,n){return null==n&&(n=Ap(t)),[n.map(o).join(e)].concat(r(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=Ap(e)),r(e,t).join("\n")},formatRows:function(e){return e.map(s).join("\n")},formatRow:s,formatValue:o}}const Mp=Math.sqrt(50),Rp=Math.sqrt(10),kp=Math.sqrt(2);function Np(e,t,n){const i=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),o=s>=Mp?10:s>=Rp?5:s>=kp?2:1;let a,l,u;return r<0?(u=Math.pow(10,-r)/o,a=Math.round(e*u),l=Math.round(t*u),a/u<e&&++a,l/u>t&&--l,u=-u):(u=Math.pow(10,r)*o,a=Math.round(e/u),l=Math.round(t/u),a*u<e&&++a,l*u>t&&--l),l<a&&.5<=n&&n<2?Np(e,t,2*n):[a,l,u]}function Dp(e,t,n){if(!((n=+n)>0))return[];if((e=+e)===(t=+t))return[e];const i=t<e,[r,s,o]=i?Np(t,e,n):Np(e,t,n);if(!(s>=r))return[];const a=s-r+1,l=new Array(a);if(i)if(o<0)for(let e=0;e<a;++e)l[e]=(s-e)/-o;else for(let e=0;e<a;++e)l[e]=(s-e)*o;else if(o<0)for(let e=0;e<a;++e)l[e]=(r+e)/-o;else for(let e=0;e<a;++e)l[e]=(r+e)*o;return l}function Fp(e,t,n){return Np(e=+e,t=+t,n=+n)[2]}function Lp(e,t,n){n=+n;const i=(t=+t)<(e=+e),r=i?Fp(t,e,n):Fp(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}var Pp,Bp=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $p(e){if(!(t=Bp.exec(e)))throw new Error("invalid format: "+e);var t;return new Up({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function Up(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function zp(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function Vp(e){return(e=zp(Math.abs(e)))?e[1]:NaN}function jp(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Vp(t)/3)))-Vp(Math.abs(e)))}function Yp(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Vp(t)-Vp(e))+1}function Gp(e){return Math.max(0,-Vp(Math.abs(e)))}function Hp(e,t){var n=zp(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}$p.prototype=Up.prototype,Up.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Wp={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Hp(100*e,t),r:Hp,s:function(e,t){var n=zp(e,t);if(!n)return e+"";var i=n[0],r=n[1],s=r-(Pp=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+zp(e,Math.max(0,t+s-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Xp(e){return e}var qp,Kp,Zp,Qp=Array.prototype.map,Jp=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ef(e){var t,n,i=void 0===e.grouping||void 0===e.thousands?Xp:(t=Qp.call(e.grouping,Number),n=e.thousands+"",function(e,i){for(var r=e.length,s=[],o=0,a=t[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),s.push(e.substring(r-=a,r+a)),!((l+=a+1)>i));)a=t[o=(o+1)%t.length];return s.reverse().join(n)}),r=void 0===e.currency?"":e.currency[0]+"",s=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",a=void 0===e.numerals?Xp:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(Qp.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=$p(e)).fill,n=e.align,d=e.sign,h=e.symbol,p=e.zero,f=e.width,m=e.comma,g=e.precision,y=e.trim,_=e.type;"n"===_?(m=!0,_="g"):Wp[_]||(void 0===g&&(g=12),y=!0,_="g"),(p||"0"===t&&"="===n)&&(p=!0,t="0",n="=");var v="$"===h?r:"#"===h&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",b="$"===h?s:/[%p]/.test(_)?l:"",T=Wp[_],x=/[defgprs%]/.test(_);function E(e){var r,s,l,h=v,E=b;if("c"===_)E=T(e)+E,e="";else{var w=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:T(Math.abs(e),g),y&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i<n;++i)switch(e[i]){case".":r=t=i;break;case"0":0===r&&(r=i),t=i;break;default:if(!+e[i])break e;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),w&&0===+e&&"+"!==d&&(w=!1),h=(w?"("===d?d:u:"-"===d||"("===d?"":d)+h,E=("s"===_?Jp[8+Pp/3]:"")+E+(w&&"("===d?")":""),x)for(r=-1,s=e.length;++r<s;)if(48>(l=e.charCodeAt(r))||l>57){E=(46===l?o+e.slice(r+1):e.slice(r))+E,e=e.slice(0,r);break}}m&&!p&&(e=i(e,1/0));var I=h.length+e.length+E.length,A=I<f?new Array(f-I+1).join(t):"";switch(m&&p&&(e=i(A+e,A.length?f-E.length:1/0),A=""),n){case"<":e=h+e+E+A;break;case"=":e=h+A+e+E;break;case"^":e=A.slice(0,I=A.length>>1)+h+e+E+A.slice(I);break;default:e=A+h+e+E}return a(e)}return g=void 0===g?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),E.toString=function(){return e+""},E}return{format:d,formatPrefix:function(e,t){var n=d(((e=$p(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(Vp(t)/3))),r=Math.pow(10,-i),s=Jp[8+i/3];return function(e){return n(r*e)+s}}}}!function(e){qp=ef(e),Kp=qp.format,Zp=qp.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const tf=new Date,nf=new Date;function rf(e,t,n,i){function r(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return r.floor=t=>(e(t=new Date(+t)),t),r.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),r.round=e=>{const t=r(e),n=r.ceil(e);return e-t<n-e?t:n},r.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),r.range=(n,i,s)=>{const o=[];if(n=r.ceil(n),s=null==s?1:Math.floor(s),!(n<i&&s>0))return o;let a;do{o.push(a=new Date(+n)),t(n,s),e(n)}while(a<n&&n<i);return o},r.filter=n=>rf(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,i)=>{if(e>=e)if(i<0)for(;++i<=0;)for(;t(e,-1),!n(e););else for(;--i>=0;)for(;t(e,1),!n(e););}),n&&(r.count=(t,i)=>(tf.setTime(+t),nf.setTime(+i),e(tf),e(nf),Math.floor(n(tf,nf))),r.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?r.filter(i?t=>i(t)%e===0:t=>r.count(0,t)%e===0):r:null)),r}const sf=1e3,of=6e4,af=36e5,lf=864e5,uf=6048e5,cf=2592e6,df=31536e6,hf=rf(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*of)/lf,e=>e.getDate()-1),pf=(hf.range,rf(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/lf,e=>e.getUTCDate()-1)),ff=(pf.range,rf(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/lf,e=>Math.floor(e/lf)));ff.range;function mf(e){return rf(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*of)/uf)}const gf=mf(0),yf=mf(1),_f=mf(2),vf=mf(3),bf=mf(4),Tf=mf(5),xf=mf(6);gf.range,yf.range,_f.range,vf.range,bf.range,Tf.range,xf.range;function Ef(e){return rf(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/uf)}const wf=Ef(0),If=Ef(1),Af=Ef(2),Sf=Ef(3),Cf=Ef(4),Of=Ef(5),Mf=Ef(6),Rf=(wf.range,If.range,Af.range,Sf.range,Cf.range,Of.range,Mf.range,rf(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear()));Rf.every=e=>isFinite(e=Math.floor(e))&&e>0?rf(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null;Rf.range;const kf=rf(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());kf.every=e=>isFinite(e=Math.floor(e))&&e>0?rf(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null;kf.range;const Nf=rf(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear()),e=>e.getMonth()),Df=(Nf.range,rf(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear()),e=>e.getUTCMonth())),Ff=(Df.range,rf(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*sf-e.getMinutes()*of)},(e,t)=>{e.setTime(+e+t*af)},(e,t)=>(t-e)/af,e=>e.getHours())),Lf=(Ff.range,rf(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*af)},(e,t)=>(t-e)/af,e=>e.getUTCHours())),Pf=(Lf.range,rf(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*sf)},(e,t)=>{e.setTime(+e+t*of)},(e,t)=>(t-e)/of,e=>e.getMinutes())),Bf=(Pf.range,rf(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*of)},(e,t)=>(t-e)/of,e=>e.getUTCMinutes())),$f=(Bf.range,rf(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*sf)},(e,t)=>(t-e)/sf,e=>e.getUTCSeconds())),Uf=($f.range,rf(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e));Uf.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?rf(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Uf:null);Uf.range;const zf="year",Vf="quarter",jf="month",Yf="week",Gf="date",Hf="day",Wf="dayofyear",Xf="hours",qf="minutes",Kf="seconds",Zf="milliseconds";[zf,Vf,jf,Yf,Gf,Hf,Wf,Xf,qf,Kf,Zf].reduce((e,t,n)=>(e[t]=1+n,e),{});new Date;const Qf={[zf]:Rf,[Vf]:Nf.every(3),[jf]:Nf,[Yf]:gf,[Gf]:hf,[Hf]:hf,[Wf]:hf,[Xf]:Ff,[qf]:Pf,[Kf]:$f,[Zf]:Uf},Jf={[zf]:kf,[Vf]:Df.every(3),[jf]:Df,[Yf]:wf,[Gf]:pf,[Hf]:pf,[Wf]:pf,[Xf]:Lf,[qf]:Bf,[Kf]:$f,[Zf]:Uf};function em(e){return Qf[e]}function tm(e){return Jf[e]}const nm=[zf,jf,Gf,Xf,qf,Kf,Zf],im=nm.slice(0,-1),rm=im.slice(0,-1),sm=rm.slice(0,-1);sm.slice(0,-1);function om(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function am(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function lm(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var um,cm,dm,hm,pm,fm={"-":"",_:" ",0:"0"},mm=/^\s*\d+/,gm=/^%/,ym=/[\\^$*+?|[\]().{}]/g;function _m(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",s=r.length;return i+(s<n?new Array(n-s+1).join(t)+r:r)}function vm(e){return e.replace(ym,"\\$&")}function bm(e){return new RegExp("^(?:"+e.map(vm).join("|")+")","i")}function Tm(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function xm(e,t,n){var i=mm.exec(t.slice(n,n+1));return i?(e.w=+i[0],n+i[0].length):-1}function Em(e,t,n){var i=mm.exec(t.slice(n,n+1));return i?(e.u=+i[0],n+i[0].length):-1}function wm(e,t,n){var i=mm.exec(t.slice(n,n+2));return i?(e.U=+i[0],n+i[0].length):-1}function Im(e,t,n){var i=mm.exec(t.slice(n,n+2));return i?(e.V=+i[0],n+i[0].length):-1}function Am(e,t,n){var i=mm.exec(t.slice(n,n+2));return i?(e.W=+i[0],n+i[0].length):-1}function Sm(e,t,n){var i=mm.exec(t.slice(n,n+4));return i?(e.y=+i[0],n+i[0].length):-1}function Cm(e,t,n){var i=mm.exec(t.slice(n,n+2));return i?(e.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Om(e,t,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function Mm(e,t,n){var i=mm.exec(t.slice(n,n+1));return i?(e.q=3*i[0]-3,n+i[0].length):-1}function Rm(e,t,n){var i=mm.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function km(e,t,n){var i=mm.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function Nm(e,t,n){var i=mm.exec(t.slice(n,n+3));return i?(e.m=0,e.d=+i[0],n+i[0].length):-1}function Dm(e,t,n){var i=mm.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function Fm(e,t,n){var i=mm.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function Lm(e,t,n){var i=mm.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function Pm(e,t,n){var i=mm.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function Bm(e,t,n){var i=mm.exec(t.slice(n,n+6));return i?(e.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function $m(e,t,n){var i=gm.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function Um(e,t,n){var i=mm.exec(t.slice(n));return i?(e.Q=+i[0],n+i[0].length):-1}function zm(e,t,n){var i=mm.exec(t.slice(n));return i?(e.s=+i[0],n+i[0].length):-1}function Vm(e,t){return _m(e.getDate(),t,2)}function jm(e,t){return _m(e.getHours(),t,2)}function Ym(e,t){return _m(e.getHours()%12||12,t,2)}function Gm(e,t){return _m(1+hf.count(Rf(e),e),t,3)}function Hm(e,t){return _m(e.getMilliseconds(),t,3)}function Wm(e,t){return Hm(e,t)+"000"}function Xm(e,t){return _m(e.getMonth()+1,t,2)}function qm(e,t){return _m(e.getMinutes(),t,2)}function Km(e,t){return _m(e.getSeconds(),t,2)}function Zm(e){var t=e.getDay();return 0===t?7:t}function Qm(e,t){return _m(gf.count(Rf(e)-1,e),t,2)}function Jm(e){var t=e.getDay();return t>=4||0===t?bf(e):bf.ceil(e)}function eg(e,t){return e=Jm(e),_m(bf.count(Rf(e),e)+(4===Rf(e).getDay()),t,2)}function tg(e){return e.getDay()}function ng(e,t){return _m(yf.count(Rf(e)-1,e),t,2)}function ig(e,t){return _m(e.getFullYear()%100,t,2)}function rg(e,t){return _m((e=Jm(e)).getFullYear()%100,t,2)}function sg(e,t){return _m(e.getFullYear()%1e4,t,4)}function og(e,t){var n=e.getDay();return _m((e=n>=4||0===n?bf(e):bf.ceil(e)).getFullYear()%1e4,t,4)}function ag(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+_m(t/60|0,"0",2)+_m(t%60,"0",2)}function lg(e,t){return _m(e.getUTCDate(),t,2)}function ug(e,t){return _m(e.getUTCHours(),t,2)}function cg(e,t){return _m(e.getUTCHours()%12||12,t,2)}function dg(e,t){return _m(1+pf.count(kf(e),e),t,3)}function hg(e,t){return _m(e.getUTCMilliseconds(),t,3)}function pg(e,t){return hg(e,t)+"000"}function fg(e,t){return _m(e.getUTCMonth()+1,t,2)}function mg(e,t){return _m(e.getUTCMinutes(),t,2)}function gg(e,t){return _m(e.getUTCSeconds(),t,2)}function yg(e){var t=e.getUTCDay();return 0===t?7:t}function _g(e,t){return _m(wf.count(kf(e)-1,e),t,2)}function vg(e){var t=e.getUTCDay();return t>=4||0===t?Cf(e):Cf.ceil(e)}function bg(e,t){return e=vg(e),_m(Cf.count(kf(e),e)+(4===kf(e).getUTCDay()),t,2)}function Tg(e){return e.getUTCDay()}function xg(e,t){return _m(If.count(kf(e)-1,e),t,2)}function Eg(e,t){return _m(e.getUTCFullYear()%100,t,2)}function wg(e,t){return _m((e=vg(e)).getUTCFullYear()%100,t,2)}function Ig(e,t){return _m(e.getUTCFullYear()%1e4,t,4)}function Ag(e,t){var n=e.getUTCDay();return _m((e=n>=4||0===n?Cf(e):Cf.ceil(e)).getUTCFullYear()%1e4,t,4)}function Sg(){return"+0000"}function Cg(){return"%"}function Og(e){return+e}function Mg(e){return Math.floor(+e/1e3)}function Rg(e){const t={};return n=>t[n]||(t[n]=e(n))}function kg(e){const t=Rg(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){const n=$p(e||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return function(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let s=function(e,t){let n,i=e.lastIndexOf("e");if(i>0)return i;for(i=e.length;--i>t;)if(n=e.charCodeAt(i),n>=48&&n<=57)return i+1}(i,r);const o=s<i.length?i.slice(s):"";for(;--s>r;)if("0"!==i[s]){++s;break}return i.slice(0,s)+o}}(t(n),t(".1f")(1)[1])}return t(n)},formatSpan(e,i,r,s){s=$p(null==s?",f":s);const o=Lp(e,i,r),a=Math.max(Math.abs(e),Math.abs(i));let l;if(null==s.precision)switch(s.type){case"s":return isNaN(l=jp(o,a))||(s.precision=l),n(s,a);case"":case"e":case"g":case"p":case"r":isNaN(l=Yp(o,a))||(s.precision=l-("e"===s.type));break;case"f":case"%":isNaN(l=Gp(o))||(s.precision=l-2*("%"===s.type))}return t(s)}}}let Ng,Dg;function Fg(){return Ng=kg({format:Kp,formatPrefix:Zp})}function Lg(e,t,n){Kd(n=n||{})||Yd(`Invalid time multi-format specifier: ${n}`);const i=t(Kf),r=t(qf),s=t(Xf),o=t(Gf),a=t(Yf),l=t(jf),u=t(Vf),c=t(zf),d=e(n[Zf]||".%L"),h=e(n[Kf]||":%S"),p=e(n[qf]||"%I:%M"),f=e(n[Xf]||"%I %p"),m=e(n[Gf]||n[Hf]||"%a %d"),g=e(n[Yf]||"%b %d"),y=e(n[jf]||"%B"),_=e(n[Vf]||"%B"),v=e(n[zf]||"%Y");return e=>(i(e)<e?d:r(e)<e?h:s(e)<e?p:o(e)<e?f:l(e)<e?a(e)<e?m:g:c(e)<e?u(e)<e?y:_:v)(e)}function Pg(e){const t=Rg(e.format),n=Rg(e.utcFormat);return{timeFormat:e=>rh(e)?t(e):Lg(t,em,e),utcFormat:e=>rh(e)?n(e):Lg(n,tm,e),timeParse:Rg(e.parse),utcParse:Rg(e.utcParse)}}function Bg(){return Dg=Pg({format:cm,parse:dm,utcFormat:hm,utcParse:pm})}!function(e){um=function(e){var t=e.dateTime,n=e.date,i=e.time,r=e.periods,s=e.days,o=e.shortDays,a=e.months,l=e.shortMonths,u=bm(r),c=Tm(r),d=bm(s),h=Tm(s),p=bm(o),f=Tm(o),m=bm(a),g=Tm(a),y=bm(l),_=Tm(l),v={a:function(e){return o[e.getDay()]},A:function(e){return s[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return a[e.getMonth()]},c:null,d:Vm,e:Vm,f:Wm,g:rg,G:og,H:jm,I:Ym,j:Gm,L:Hm,m:Xm,M:qm,p:function(e){return r[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Og,s:Mg,S:Km,u:Zm,U:Qm,V:eg,w:tg,W:ng,x:null,X:null,y:ig,Y:sg,Z:ag,"%":Cg},b={a:function(e){return o[e.getUTCDay()]},A:function(e){return s[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return a[e.getUTCMonth()]},c:null,d:lg,e:lg,f:pg,g:wg,G:Ag,H:ug,I:cg,j:dg,L:hg,m:fg,M:mg,p:function(e){return r[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Og,s:Mg,S:gg,u:yg,U:_g,V:bg,w:Tg,W:xg,x:null,X:null,y:Eg,Y:Ig,Z:Sg,"%":Cg},T={a:function(e,t,n){var i=p.exec(t.slice(n));return i?(e.w=f.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(e,t,n){var i=d.exec(t.slice(n));return i?(e.w=h.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(e,t,n){var i=y.exec(t.slice(n));return i?(e.m=_.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(e,t,n){var i=m.exec(t.slice(n));return i?(e.m=g.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(e,n,i){return w(e,t,n,i)},d:km,e:km,f:Bm,g:Cm,G:Sm,H:Dm,I:Dm,j:Nm,L:Pm,m:Rm,M:Fm,p:function(e,t,n){var i=u.exec(t.slice(n));return i?(e.p=c.get(i[0].toLowerCase()),n+i[0].length):-1},q:Mm,Q:Um,s:zm,S:Lm,u:Em,U:wm,V:Im,w:xm,W:Am,x:function(e,t,i){return w(e,n,t,i)},X:function(e,t,n){return w(e,i,t,n)},y:Cm,Y:Sm,Z:Om,"%":$m};function x(e,t){return function(n){var i,r,s,o=[],a=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++a<u;)37===e.charCodeAt(a)&&(o.push(e.slice(l,a)),null!=(r=fm[i=e.charAt(++a)])?i=e.charAt(++a):r="e"===i?" ":"0",(s=t[i])&&(i=s(n,r)),o.push(i),l=a+1);return o.push(e.slice(l,a)),o.join("")}}function E(e,t){return function(n){var i,r,s=lm(1900,void 0,1);if(w(s,e,n+="",0)!=n.length)return null;if("Q"in s)return new Date(s.Q);if("s"in s)return new Date(1e3*s.s+("L"in s?s.L:0));if(t&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"V"in s){if(s.V<1||s.V>53)return null;"w"in s||(s.w=1),"Z"in s?(r=(i=am(lm(s.y,0,1))).getUTCDay(),i=r>4||0===r?If.ceil(i):If(i),i=pf.offset(i,7*(s.V-1)),s.y=i.getUTCFullYear(),s.m=i.getUTCMonth(),s.d=i.getUTCDate()+(s.w+6)%7):(r=(i=om(lm(s.y,0,1))).getDay(),i=r>4||0===r?yf.ceil(i):yf(i),i=hf.offset(i,7*(s.V-1)),s.y=i.getFullYear(),s.m=i.getMonth(),s.d=i.getDate()+(s.w+6)%7)}else("W"in s||"U"in s)&&("w"in s||(s.w="u"in s?s.u%7:"W"in s?1:0),r="Z"in s?am(lm(s.y,0,1)).getUTCDay():om(lm(s.y,0,1)).getDay(),s.m=0,s.d="W"in s?(s.w+6)%7+7*s.W-(r+5)%7:s.w+7*s.U-(r+6)%7);return"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,am(s)):om(s)}}function w(e,t,n,i){for(var r,s,o=0,a=t.length,l=n.length;o<a;){if(i>=l)return-1;if(37===(r=t.charCodeAt(o++))){if(r=t.charAt(o++),!(s=T[r in fm?t.charAt(o++):r])||(i=s(e,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return v.x=x(n,v),v.X=x(i,v),v.c=x(t,v),b.x=x(n,b),b.X=x(i,b),b.c=x(t,b),{format:function(e){var t=x(e+="",v);return t.toString=function(){return e},t},parse:function(e){var t=E(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=x(e+="",b);return t.toString=function(){return e},t},utcParse:function(e){var t=E(e+="",!0);return t.toString=function(){return e},t}}}(e),cm=um.format,dm=um.parse,hm=um.utcFormat,pm=um.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Fg(),Bg();const $g=/^(data:|([A-Za-z]+:)?\/\/)/,Ug=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,zg=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Vg="file://";async function jg(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t)}async function Yg(e,t){t=th({},this.options,t);const n=this.fileAccess,i={href:null};let r,s,o;const a=Ug.test(e.replace(zg,""));null!=e&&"string"==typeof e&&a||Yd("Sanitize failure, invalid URI: "+sh(e));const l=$g.test(e);return(o=t.baseURL)&&!l&&(e.startsWith("/")||o.endsWith("/")||(e="/"+e),e=o+e),s=(r=e.startsWith(Vg))||"file"===t.mode||"http"!==t.mode&&!l&&n,r?e=e.slice(7):e.startsWith("//")&&("file"===t.defaultProtocol?(e=e.slice(2),s=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!s}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),"image"===t.context&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function Gg(e){return e?t=>new Promise((n,i)=>{e.readFile(t,(e,t)=>{e?i(e):n(t)})}):Hg}async function Hg(){Yd("No file system access.")}function Wg(e){return e?async function(t,n){const i=th({},this.options.http,n),r=n&&n.response,s=await e(t,i);return s.ok?eh(s[r])?s[r]():s.text():Yd(s.status+""+s.statusText)}:Xg}async function Xg(){Yd("No HTTP fetch method available.")}function qg(e){const t=function(t,n){const i={delimiter:e};return Kg(t,n?th(n,i):i)};return t.responseType="text",t}function Kg(e,t){return t.header&&(e=t.header.map(sh).join(t.delimiter)+"\n"+e),Op(t.delimiter).parse(e+"")}function Zg(e,t){const n=t&&t.property?Hd(t.property):Wd;return!Kd(e)||(i=e,"function"==typeof Buffer&&eh(Buffer.isBuffer)&&Buffer.isBuffer(i))?n(JSON.parse(e)):function(e,t){!qd(e)&&function(e){return e&&eh(e[Symbol.iterator])}(e)&&(e=[...e]);return t&&t.copy?JSON.parse(JSON.stringify(e)):e}(n(e),t);var i}Kg.responseType="text",Zg.responseType="json";const Qg={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function Jg(e,t){let n,i,r,s;return e=Zg(e,t),t&&t.feature?(n=Tn,r=t.feature):t&&t.mesh?(n=In,r=t.mesh,s=Qg[t.filter]):Yd("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,s):Yd("Invalid TopoJSON object: "+r),i&&i.features||[i]}Jg.responseType="json";qg(","),qg("\t");const ey=function(e,t){return n=>({options:n||{},sanitize:Yg,load:jg,fileAccess:!1,file:Gg(t),http:Wg(e)})}("undefined"!=typeof fetch&&fetch,null);function ty(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function ny(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function iy(e){let t,n,i;function r(e,i,r=0,s=e.length){if(r<s){if(0!==t(i,i))return s;do{const t=r+s>>>1;n(e[t],i)<0?r=t+1:s=t}while(r<s)}return r}return 2!==e.length?(t=ty,n=(t,n)=>ty(e(t),n),i=(t,n)=>e(t)-n):(t=e===ty||e===ny?e:ry,n=e,i=e),{left:r,center:function(e,t,n=0,s=e.length){const o=r(e,t,n,s-1);return o>n&&i(e[o-1],t)>-i(e[o],t)?o-1:o},right:function(e,i,r=0,s=e.length){if(r<s){if(0!==t(i,i))return s;do{const t=r+s>>>1;n(e[t],i)<=0?r=t+1:s=t}while(r<s)}return r}}}function ry(){return 0}function sy(e){return null===e?NaN:+e}const oy=iy(ty),ay=oy.right,ly=(oy.left,iy(sy).center,ay);function uy(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function cy(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function dy(){}var hy=.7,py=1/hy,fy="\\s*([+-]?\\d+)\\s*",my="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",gy="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yy=/^#([0-9a-f]{3,8})$/,_y=new RegExp("^rgb\\("+[fy,fy,fy]+"\\)$"),vy=new RegExp("^rgb\\("+[gy,gy,gy]+"\\)$"),by=new RegExp("^rgba\\("+[fy,fy,fy,my]+"\\)$"),Ty=new RegExp("^rgba\\("+[gy,gy,gy,my]+"\\)$"),xy=new RegExp("^hsl\\("+[my,gy,gy]+"\\)$"),Ey=new RegExp("^hsla\\("+[my,gy,gy,my]+"\\)$"),wy={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 Iy(){return this.rgb().formatHex()}function Ay(){return this.rgb().formatRgb()}function Sy(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=yy.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Cy(t):3===n?new ky(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Oy(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Oy(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=_y.exec(e))?new ky(t[1],t[2],t[3],1):(t=vy.exec(e))?new ky(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=by.exec(e))?Oy(t[1],t[2],t[3],t[4]):(t=Ty.exec(e))?Oy(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=xy.exec(e))?Ly(t[1],t[2]/100,t[3]/100,1):(t=Ey.exec(e))?Ly(t[1],t[2]/100,t[3]/100,t[4]):wy.hasOwnProperty(e)?Cy(wy[e]):"transparent"===e?new ky(NaN,NaN,NaN,0):null}function Cy(e){return new ky(e>>16&255,e>>8&255,255&e,1)}function Oy(e,t,n,i){return i<=0&&(e=t=n=NaN),new ky(e,t,n,i)}function My(e){return e instanceof dy||(e=Sy(e)),e?new ky((e=e.rgb()).r,e.g,e.b,e.opacity):new ky}function Ry(e,t,n,i){return 1===arguments.length?My(e):new ky(e,t,n,null==i?1:i)}function ky(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}function Ny(){return"#"+Fy(this.r)+Fy(this.g)+Fy(this.b)}function Dy(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function Fy(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Ly(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $y(e,t,n,i)}function Py(e){if(e instanceof $y)return new $y(e.h,e.s,e.l,e.opacity);if(e instanceof dy||(e=Sy(e)),!e)return new $y;if(e instanceof $y)return e;var t=(e=e.rgb()).r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),o=NaN,a=s-r,l=(s+r)/2;return a?(o=t===s?(n-i)/a+6*(n<i):n===s?(i-t)/a+2:(t-n)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new $y(o,a,l,e.opacity)}function By(e,t,n,i){return 1===arguments.length?Py(e):new $y(e,t,n,null==i?1:i)}function $y(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function Uy(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function zy(e,t,n,i,r){var s=e*e,o=s*e;return((1-3*e+3*s-o)*t+(4-6*s+3*o)*n+(1+3*e+3*s-3*o)*i+o*r)/6}function Vy(e){var t=e.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[i],s=e[i+1],o=i>0?e[i-1]:2*r-s,a=i<t-1?e[i+2]:2*s-r;return zy((n-i/t)*t,o,r,s,a)}}function jy(e){var t=e.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*t),r=e[(i+t-1)%t],s=e[i%t],o=e[(i+1)%t],a=e[(i+2)%t];return zy((n-i/t)*t,r,s,o,a)}}uy(dy,Sy,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:Iy,formatHex:Iy,formatHsl:function(){return Py(this).formatHsl()},formatRgb:Ay,toString:Ay}),uy(ky,Ry,cy(dy,{brighter:function(e){return e=null==e?py:Math.pow(py,e),new ky(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?hy:Math.pow(hy,e),new ky(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ny,formatHex:Ny,formatRgb:Dy,toString:Dy})),uy($y,By,cy(dy,{brighter:function(e){return e=null==e?py:Math.pow(py,e),new $y(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?hy:Math.pow(hy,e),new $y(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new ky(Uy(e>=240?e-240:e+120,r,i),Uy(e,r,i),Uy(e<120?e+240:e-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));const Yy=e=>()=>e;function Gy(e,t){return function(n){return e+n*t}}function Hy(e,t){var n=t-e;return n?Gy(e,n>180||n<-180?n-360*Math.round(n/360):n):Yy(isNaN(e)?t:e)}function Wy(e){return 1===(e=+e)?Xy:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}(t,n,e):Yy(isNaN(t)?n:t)}}function Xy(e,t){var n=t-e;return n?Gy(e,n):Yy(isNaN(e)?t:e)}const qy=function e(t){var n=Wy(t);function i(e,t){var i=n((e=Ry(e)).r,(t=Ry(t)).r),r=n(e.g,t.g),s=n(e.b,t.b),o=Xy(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=r(t),e.b=s(t),e.opacity=o(t),e+""}}return i.gamma=e,i}(1);function Ky(e){return function(t){var n,i,r=t.length,s=new Array(r),o=new Array(r),a=new Array(r);for(n=0;n<r;++n)i=Ry(t[n]),s[n]=i.r||0,o[n]=i.g||0,a[n]=i.b||0;return s=e(s),o=e(o),a=e(a),i.opacity=1,function(e){return i.r=s(e),i.g=o(e),i.b=a(e),i+""}}}var Zy=Ky(Vy),Qy=Ky(jy);function Jy(e,t){t||(t=[]);var n,i=e?Math.min(t.length,e.length):0,r=t.slice();return function(s){for(n=0;n<i;++n)r[n]=e[n]*(1-s)+t[n]*s;return r}}function e_(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function t_(e,t){return(e_(t)?Jy:n_)(e,t)}function n_(e,t){var n,i=t?t.length:0,r=e?Math.min(i,e.length):0,s=new Array(r),o=new Array(i);for(n=0;n<r;++n)s[n]=u_(e[n],t[n]);for(;n<i;++n)o[n]=t[n];return function(e){for(n=0;n<r;++n)o[n]=s[n](e);return o}}function i_(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function r_(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function s_(e,t){var n,i={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?i[n]=u_(e[n],t[n]):r[n]=t[n];return function(e){for(n in i)r[n]=i[n](e);return r}}var o_=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,a_=new RegExp(o_.source,"g");function l_(e,t){var n,i,r,s=o_.lastIndex=a_.lastIndex=0,o=-1,a=[],l=[];for(e+="",t+="";(n=o_.exec(e))&&(i=a_.exec(t));)(r=i.index)>s&&(r=t.slice(s,r),a[o]?a[o]+=r:a[++o]=r),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:r_(n,i)})),s=a_.lastIndex;return s<t.length&&(r=t.slice(s),a[o]?a[o]+=r:a[++o]=r),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,i=0;i<t;++i)a[(n=l[i]).i]=n.x(e);return a.join("")})}function u_(e,t){var n,i=typeof t;return null==t||"boolean"===i?Yy(t):("number"===i?r_:"string"===i?(n=Sy(t))?(t=n,qy):l_:t instanceof Sy?qy:t instanceof Date?i_:e_(t)?Jy:Array.isArray(t)?n_:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?s_:r_)(e,t)}function c_(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function d_(e){return+e}var h_=[0,1];function p_(e){return e}function f_(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function m_(e,t,n){var i=e[0],r=e[1],s=t[0],o=t[1];return r<i?(i=f_(r,i),s=n(o,s)):(i=f_(i,r),s=n(s,o)),function(e){return s(i(e))}}function g_(e,t,n){var i=Math.min(e.length,t.length)-1,r=new Array(i),s=new Array(i),o=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<i;)r[o]=f_(e[o],e[o+1]),s[o]=n(t[o],t[o+1]);return function(t){var n=ly(e,t,1,i)-1;return s[n](r[n](t))}}function y_(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function __(){var e,t,n,i,r,s,o=h_,a=h_,l=u_,u=p_;function c(){var e=Math.min(o.length,a.length);return u!==p_&&(u=function(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(o[0],o[e-1])),i=e>2?g_:m_,r=s=null,d}function d(t){return null==t||isNaN(t=+t)?n:(r||(r=i(o.map(e),a,l)))(e(u(t)))}return d.invert=function(n){return u(t((s||(s=i(a,o.map(e),r_)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,d_),c()):o.slice()},d.range=function(e){return arguments.length?(a=Array.from(e),c()):a.slice()},d.rangeRound=function(e){return a=Array.from(e),l=c_,c()},d.clamp=function(e){return arguments.length?(u=!!e||p_,c()):u!==p_},d.interpolate=function(e){return arguments.length?(l=e,c()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,i){return e=n,t=i,c()}}function v_(){return __()(p_,p_)}function b_(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function T_(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}function x_(e,t,n,i){var r,s=Lp(e,t,n);switch((i=$p(null==i?",f":i)).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=i.precision||isNaN(r=jp(s,o))||(i.precision=r),Zp(i,o);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=Yp(s,Math.max(Math.abs(e),Math.abs(t))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=Gp(s))||(i.precision=r-2*("%"===i.type))}return Kp(i)}function E_(e){var t=e.domain;return e.ticks=function(e){var n=t();return Dp(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var i=t();return x_(i[0],i[i.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var i,r,s=t(),o=0,a=s.length-1,l=s[o],u=s[a],c=10;for(u<l&&(r=l,l=u,u=r,r=o,o=a,a=r);c-- >0;){if((r=Fp(l,u,n))===i)return s[o]=l,s[a]=u,t(s);if(r>0)l=Math.floor(l/r)*r,u=Math.ceil(u/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,u=Math.floor(u*r)/r}i=r}return e},e}function w_(e,t){var n,i=0,r=(e=e.slice()).length-1,s=e[i],o=e[r];return o<s&&(n=i,i=r,r=n,n=s,s=o,o=n),e[i]=t.floor(s),e[r]=t.ceil(o),e}function I_(e){return Math.log(e)}function A_(e){return Math.exp(e)}function S_(e){return-Math.log(-e)}function C_(e){return-Math.exp(-e)}function O_(e){return isFinite(e)?+("1e"+e):e<0?0:e}function M_(e){return(t,n)=>-e(-t,n)}function R_(e){const t=e(I_,A_),n=t.domain;let i,r,s=10;function o(){return i=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(s),r=function(e){return 10===e?O_:e===Math.E?Math.exp:t=>Math.pow(e,t)}(s),n()[0]<0?(i=M_(i),r=M_(r),e(S_,C_)):e(I_,A_),t}return t.base=function(e){return arguments.length?(s=+e,o()):s},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{const t=n();let o=t[0],a=t[t.length-1];const l=a<o;l&&([o,a]=[a,o]);let u,c,d=i(o),h=i(a);const p=null==e?10:+e;let f=[];if(!(s%1)&&h-d<p){if(d=Math.floor(d),h=Math.ceil(h),o>0){for(;d<=h;++d)for(u=1;u<s;++u)if(c=d<0?u/r(-d):u*r(d),!(c<o)){if(c>a)break;f.push(c)}}else for(;d<=h;++d)for(u=s-1;u>=1;--u)if(c=d>0?u/r(-d):u*r(d),!(c<o)){if(c>a)break;f.push(c)}2*f.length<p&&(f=Dp(o,a,p))}else f=Dp(d,h,Math.min(h-d,p)).map(r);return l?f.reverse():f},t.tickFormat=(e,n)=>{if(null==e&&(e=10),null==n&&(n=10===s?"s":","),"function"!=typeof n&&(s%1||null!=(n=$p(n)).precision||(n.trim=!0),n=Kp(n)),e===1/0)return n;const o=Math.max(1,s*e/t.ticks().length);return e=>{let t=e/r(Math.round(i(e)));return t*s<s-.5&&(t*=s),t<=o?n(e):""}},t.nice=()=>n(w_(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function k_(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function N_(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function D_(e){return e<0?-e*e:e*e}function F_(e){var t=e(p_,p_),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e(p_,p_):.5===n?e(N_,D_):e(k_(n),k_(1/n)):n},E_(t)}function L_(){var e=F_(__());return e.copy=function(){return y_(e,L_()).exponent(e.exponent())},b_.apply(e,arguments),e}function P_(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function B_(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function $_(e){var t=1,n=e(P_(t),B_(t));return n.constant=function(n){return arguments.length?e(P_(t=+n),B_(t)):t},E_(n)}function U_(e,t,n,i,r,s){const o=[[$f,1,sf],[$f,5,5e3],[$f,15,15e3],[$f,30,3e4],[s,1,of],[s,5,3e5],[s,15,9e5],[s,30,18e5],[r,1,af],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,lf],[i,2,1728e5],[n,1,uf],[t,1,cf],[t,3,7776e6],[e,1,df]];function a(t,n,i){const r=Math.abs(n-t)/i,s=iy(([,,e])=>e).right(o,r);if(s===o.length)return e.every(Lp(t/df,n/df,i));if(0===s)return Uf.every(Math.max(Lp(t,n,i),1));const[a,l]=o[r/o[s-1][2]<o[s][2]/r?s-1:s];return a.every(l)}return[function(e,t,n){const i=t<e;i&&([e,t]=[t,e]);const r=n&&"function"==typeof n.range?n:a(e,t,n),s=r?r.range(e,+t+1):[];return i?s.reverse():s},a]}const[z_,V_]=U_(kf,Df,wf,ff,Lf,Bf),[j_,Y_]=U_(Rf,Nf,gf,hf,Ff,Pf);function G_(e){return new Date(e)}function H_(e){return e instanceof Date?+e:+new Date(+e)}function W_(e,t,n,i,r,s,o,a,l,u){var c=v_(),d=c.invert,h=c.domain,p=u(".%L"),f=u(":%S"),m=u("%I:%M"),g=u("%I %p"),y=u("%a %d"),_=u("%b %d"),v=u("%B"),b=u("%Y");function T(e){return(l(e)<e?p:a(e)<e?f:o(e)<e?m:s(e)<e?g:i(e)<e?r(e)<e?y:_:n(e)<e?v:b)(e)}return c.invert=function(e){return new Date(d(e))},c.domain=function(e){return arguments.length?h(Array.from(e,H_)):h().map(G_)},c.ticks=function(t){var n=h();return e(n[0],n[n.length-1],null==t?10:t)},c.tickFormat=function(e,t){return null==t?T:u(t)},c.nice=function(e){var n=h();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?h(w_(n,e)):c},c.copy=function(){return y_(c,W_(e,t,n,i,r,s,o,a,l,u))},c}function X_(){var e,t,n,i,r,s=0,o=1,a=p_,l=!1;function u(t){return null==t||isNaN(t=+t)?r:a(0===n?.5:(t=(i(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function c(e){return function(t){var n,i;return arguments.length?([n,i]=t,a=e(n,i),u):[a(0),a(1)]}}return u.domain=function(r){return arguments.length?([s,o]=r,e=i(s=+s),t=i(o=+o),n=e===t?0:1/(t-e),u):[s,o]},u.clamp=function(e){return arguments.length?(l=!!e,u):l},u.interpolator=function(e){return arguments.length?(a=e,u):a},u.range=c(u_),u.rangeRound=c(c_),u.unknown=function(e){return arguments.length?(r=e,u):r},function(r){return i=r,e=r(s),t=r(o),n=e===t?0:1/(t-e),u}}function q_(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function K_(){var e=E_(X_()(p_));return e.copy=function(){return q_(e,K_())},T_.apply(e,arguments)}function Z_(){var e=F_(X_());return e.copy=function(){return q_(e,Z_()).exponent(e.exponent())},T_.apply(e,arguments)}function Q_(e,t){void 0===t&&(t=e,e=u_);for(var n=0,i=t.length-1,r=t[0],s=new Array(i<0?0:i);n<i;)s[n]=e(r,r=t[++n]);return function(e){var t=Math.max(0,Math.min(i-1,Math.floor(e*=i)));return s[t](e-t)}}function J_(){var e,t,n,i,r,s,o,a=0,l=.5,u=1,c=1,d=p_,h=!1;function p(e){return isNaN(e=+e)?o:(e=.5+((e=+s(e))-t)*(c*e<c*t?i:r),d(h?Math.max(0,Math.min(1,e)):e))}function f(e){return function(t){var n,i,r;return arguments.length?([n,i,r]=t,d=Q_(e,[n,i,r]),p):[d(0),d(.5),d(1)]}}return p.domain=function(o){return arguments.length?([a,l,u]=o,e=s(a=+a),t=s(l=+l),n=s(u=+u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,p):[a,l,u]},p.clamp=function(e){return arguments.length?(h=!!e,p):h},p.interpolator=function(e){return arguments.length?(d=e,p):d},p.range=f(u_),p.rangeRound=f(c_),p.unknown=function(e){return arguments.length?(o=e,p):o},function(o){return s=o,e=o(a),t=o(l),n=o(u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,p}}function ev(){var e=F_(J_());return e.copy=function(){return q_(e,ev()).exponent(e.exponent())},T_.apply(e,arguments)}function tv(e,t,n=sy){if((i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,s=Math.floor(r),o=+n(e[s],s,e);return o+(+n(e[s+1],s+1,e)-o)*(r-s)}}class nv extends Map{constructor(e,t=av){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(rv(this,e))}has(e){return super.has(rv(this,e))}set(e,t){return super.set(sv(this,e),t)}delete(e){return super.delete(ov(this,e))}}class iv extends Set{constructor(e,t=av){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const t of e)this.add(t)}has(e){return super.has(rv(this,e))}add(e){return super.add(sv(this,e))}delete(e){return super.delete(ov(this,e))}}function rv({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):n}function sv({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):(e.set(i,n),n)}function ov({_intern:e,_key:t},n){const i=t(n);return e.has(i)&&(n=e.get(n),e.delete(i)),n}function av(e){return null!==e&&"object"==typeof e?e.valueOf():e}const lv=Symbol("implicit");function uv(){var e=new nv,t=[],n=[],i=lv;function r(r){let s=e.get(r);if(void 0===s){if(i!==lv)return i;e.set(r,s=t.push(r)-1)}return n[s%n.length]}return r.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new nv;for(const i of n)e.has(i)||e.set(i,t.push(i)-1);return r},r.range=function(e){return arguments.length?(n=Array.from(e),r):n.slice()},r.unknown=function(e){return arguments.length?(i=e,r):i},r.copy=function(){return uv(t,n).unknown(i)},b_.apply(r,arguments),r}function cv(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}function dv(e,t){var n=Hy(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}}var hv,pv=180/Math.PI,fv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mv(e,t,n,i,r,s){var o,a,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*i)&&(n-=e*l,i-=t*l),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,l/=a),e*i<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*pv,skewX:Math.atan(l)*pv,scaleX:o,scaleY:a}}function gv(e,t,n,i){function r(e){return e.length?e.pop()+" ":""}return function(s,o){var a=[],l=[];return s=e(s),o=e(o),function(e,i,r,s,o,a){if(e!==r||i!==s){var l=o.push("translate(",null,t,null,n);a.push({i:l-4,x:r_(e,r)},{i:l-2,x:r_(i,s)})}else(r||s)&&o.push("translate("+r+t+s+n)}(s.translateX,s.translateY,o.translateX,o.translateY,a,l),function(e,t,n,s){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),s.push({i:n.push(r(n)+"rotate(",null,i)-2,x:r_(e,t)})):t&&n.push(r(n)+"rotate("+t+i)}(s.rotate,o.rotate,a,l),function(e,t,n,s){e!==t?s.push({i:n.push(r(n)+"skewX(",null,i)-2,x:r_(e,t)}):t&&n.push(r(n)+"skewX("+t+i)}(s.skewX,o.skewX,a,l),function(e,t,n,i,s,o){if(e!==n||t!==i){var a=s.push(r(s)+"scale(",null,",",null,")");o.push({i:a-4,x:r_(e,n)},{i:a-2,x:r_(t,i)})}else 1===n&&1===i||s.push(r(s)+"scale("+n+","+i+")")}(s.scaleX,s.scaleY,o.scaleX,o.scaleY,a,l),s=o=null,function(e){for(var t,n=-1,i=l.length;++n<i;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var yv=gv(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?fv:mv(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),_v=gv(function(e){return null==e?fv:(hv||(hv=document.createElementNS("http://www.w3.org/2000/svg","g")),hv.setAttribute("transform",e),(e=hv.transform.baseVal.consolidate())?mv((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):fv)},", ",")",")");function vv(e){return((e=Math.exp(e))+1/e)/2}const bv=function e(t,n,i){function r(e,r){var s,o,a=e[0],l=e[1],u=e[2],c=r[0],d=r[1],h=r[2],p=c-a,f=d-l,m=p*p+f*f;if(m<1e-12)o=Math.log(h/u)/t,s=function(e){return[a+e*p,l+e*f,u*Math.exp(t*e*o)]};else{var g=Math.sqrt(m),y=(h*h-u*u+i*m)/(2*u*n*g),_=(h*h-u*u-i*m)/(2*h*n*g),v=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(_*_+1)-_);o=(b-v)/t,s=function(e){var i=e*o,r=vv(v),s=u/(n*g)*(r*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*i+v)-function(e){return((e=Math.exp(e))-1/e)/2}(v));return[a+s*p,l+s*f,u*r/vv(t*i+v)]}}return s.duration=1e3*o*t/Math.SQRT2,s}return r.rho=function(t){var n=Math.max(.001,+t),i=n*n;return e(n,i,i*i)},r}(Math.SQRT2,2,4);function Tv(e){return function(t,n){var i=e((t=By(t)).h,(n=By(n)).h),r=Xy(t.s,n.s),s=Xy(t.l,n.l),o=Xy(t.opacity,n.opacity);return function(e){return t.h=i(e),t.s=r(e),t.l=s(e),t.opacity=o(e),t+""}}}const xv=Tv(Hy);var Ev=Tv(Xy);const wv=Math.PI/180,Iv=180/Math.PI,Av=.96422,Sv=1,Cv=.82521,Ov=4/29,Mv=6/29,Rv=3*Mv*Mv,kv=.008856451679035631;function Nv(e){if(e instanceof Fv)return new Fv(e.l,e.a,e.b,e.opacity);if(e instanceof Vv)return jv(e);e instanceof ky||(e=My(e));var t,n,i=$v(e.r),r=$v(e.g),s=$v(e.b),o=Lv((.2225045*i+.7168786*r+.0606169*s)/Sv);return i===r&&r===s?t=n=o:(t=Lv((.4360747*i+.3850649*r+.1430804*s)/Av),n=Lv((.0139322*i+.0971045*r+.7141733*s)/Cv)),new Fv(116*o-16,500*(t-o),200*(o-n),e.opacity)}function Dv(e,t,n,i){return 1===arguments.length?Nv(e):new Fv(e,t,n,null==i?1:i)}function Fv(e,t,n,i){this.l=+e,this.a=+t,this.b=+n,this.opacity=+i}function Lv(e){return e>kv?Math.pow(e,1/3):e/Rv+Ov}function Pv(e){return e>Mv?e*e*e:Rv*(e-Ov)}function Bv(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function $v(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Uv(e){if(e instanceof Vv)return new Vv(e.h,e.c,e.l,e.opacity);if(e instanceof Fv||(e=Nv(e)),0===e.a&&0===e.b)return new Vv(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Iv;return new Vv(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function zv(e,t,n,i){return 1===arguments.length?Uv(e):new Vv(e,t,n,null==i?1:i)}function Vv(e,t,n,i){this.h=+e,this.c=+t,this.l=+n,this.opacity=+i}function jv(e){if(isNaN(e.h))return new Fv(e.l,0,0,e.opacity);var t=e.h*wv;return new Fv(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}function Yv(e,t){var n=Xy((e=Dv(e)).l,(t=Dv(t)).l),i=Xy(e.a,t.a),r=Xy(e.b,t.b),s=Xy(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=i(t),e.b=r(t),e.opacity=s(t),e+""}}function Gv(e){return function(t,n){var i=e((t=zv(t)).h,(n=zv(n)).h),r=Xy(t.c,n.c),s=Xy(t.l,n.l),o=Xy(t.opacity,n.opacity);return function(e){return t.h=i(e),t.c=r(e),t.l=s(e),t.opacity=o(e),t+""}}}uy(Fv,Dv,cy(dy,{brighter:function(e){return new Fv(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker:function(e){return new Fv(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new ky(Bv(3.1338561*(t=Av*Pv(t))-1.6168667*(e=Sv*Pv(e))-.4906146*(n=Cv*Pv(n))),Bv(-.9787684*t+1.9161415*e+.033454*n),Bv(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),uy(Vv,zv,cy(dy,{brighter:function(e){return new Vv(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker:function(e){return new Vv(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb:function(){return jv(this).rgb()}}));const Hv=Gv(Hy);var Wv=Gv(Xy),Xv=-.14861,qv=1.78277,Kv=-.29227,Zv=-.90649,Qv=1.97294,Jv=Qv*Zv,eb=Qv*qv,tb=qv*Kv-Zv*Xv;function nb(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof ib)return new ib(e.h,e.s,e.l,e.opacity);e instanceof ky||(e=My(e));var t=e.r/255,n=e.g/255,i=e.b/255,r=(tb*i+Jv*t-eb*n)/(tb+Jv-eb),s=i-r,o=(Qv*(n-r)-Kv*s)/Zv,a=Math.sqrt(o*o+s*s)/(Qv*r*(1-r)),l=a?Math.atan2(o,s)*Iv-120:NaN;return new ib(l<0?l+360:l,a,r,e.opacity)}(e):new ib(e,t,n,null==i?1:i)}function ib(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function rb(e){return function t(n){function i(t,i){var r=e((t=nb(t)).h,(i=nb(i)).h),s=Xy(t.s,i.s),o=Xy(t.l,i.l),a=Xy(t.opacity,i.opacity);return function(e){return t.h=r(e),t.s=s(e),t.l=o(Math.pow(e,n)),t.opacity=a(e),t+""}}return n=+n,i.gamma=t,i}(1)}uy(ib,nb,cy(dy,{brighter:function(e){return e=null==e?py:Math.pow(py,e),new ib(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?hy:Math.pow(hy,e),new ib(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=isNaN(this.h)?0:(this.h+120)*wv,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),i=Math.cos(e),r=Math.sin(e);return new ky(255*(t+n*(Xv*i+qv*r)),255*(t+n*(Kv*i+Zv*r)),255*(t+n*(Qv*i)),this.opacity)}}));const sb=rb(Hy);var ob=rb(Xy);function ab(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}function lb(e){for(var t=e.length/6|0,n=new Array(t),i=0;i<t;)n[i]="#"+e.slice(6*i,6*++i);return n}const ub=lb("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),cb=lb("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),db=lb("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),hb=lb("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),pb=lb("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),fb=lb("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),mb=lb("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),gb=lb("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),yb=lb("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),_b=lb("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");const vb="linear",bb="log",Tb="pow",xb="sqrt",Eb="symlog",wb="time",Ib="utc",Ab="sequential",Sb="diverging",Cb="quantile",Ob="quantize",Mb="threshold",Rb="continuous",kb="discrete",Nb="discretizing",Db="interpolating",Fb="temporal";function Lb(){const e=uv().unknown(void 0),t=e.domain,n=e.range;let i,r,s=[0,1],o=!1,a=0,l=0,u=.5;function c(){const e=t().length,c=s[1]<s[0],d=s[1-c],h=function(e,t,n){const i=e-t+2*n;return e?i>0?i:1:0}(e,a,l);let p=s[c-0];i=(d-p)/(h||1),o&&(i=Math.floor(i)),p+=(d-p-i*(e-a))*u,r=i*(1-a),o&&(p=Math.round(p),r=Math.round(r));const f=function(e,t,n){e=+e,t=+t,n=(r=arguments.length)<2?(t=e,e=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((t-e)/n)),s=new Array(r);++i<r;)s[i]=e+i*n;return s}(e).map(e=>p+i*e);return n(c?f.reverse():f)}return delete e.unknown,e.domain=function(e){return arguments.length?(t(e),c()):t()},e.range=function(e){return arguments.length?(s=[+e[0],+e[1]],c()):s.slice()},e.rangeRound=function(e){return s=[+e[0],+e[1]],o=!0,c()},e.bandwidth=function(){return r},e.step=function(){return i},e.round=function(e){return arguments.length?(o=!!e,c()):o},e.padding=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),a=l,c()):a},e.paddingInner=function(e){return arguments.length?(a=Math.max(0,Math.min(1,e)),c()):a},e.paddingOuter=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),c()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=s[1]<s[0],o=i?n().reverse():n(),a=o.length-1;let l,u,c,d=+e[0],h=+e[1];return d!=d||h!=h||(h<d&&(c=d,d=h,h=c),h<o[0]||d>s[1-i])?void 0:(l=Math.max(0,ay(o,d)-1),u=d===h?l:ay(o,h)-1,d-o[l]>r+1e-10&&++l,i&&(c=l,l=a-u,u=a-c),l>u?void 0:t().slice(l,u+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return Lb().domain(t()).range(s).round(o).paddingInner(a).paddingOuter(l).align(u)},c()}function Pb(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Pb(t())},e}var Bb=Array.prototype.map;const $b=Array.prototype.slice;const Ub=new Map,zb=Symbol("vega_scale");function Vb(e,t,n){const i=function(){const n=t();return n.invertRange||(n.invertRange=n.invert?function(e){return function(t){let n,i=t[0],r=t[1];return r<i&&(n=i,i=r,r=n),[e.invert(i),e.invert(r)]}}(n):n.invertExtent?function(e){return function(t){const n=e.range();let i,r,s,o,a=t[0],l=t[1],u=-1;for(l<a&&(r=a,a=l,l=r),s=0,o=n.length;s<o;++s)n[s]>=a&&n[s]<=l&&(u<0&&(u=s),i=s);if(!(u<0))return a=e.invertExtent(n[u]),l=e.invertExtent(n[i]),[void 0===a[0]?a[1]:a[0],void 0===l[1]?l[0]:l[1]]}}(n):void 0),n.type=e,function(e){return e[zb]=!0,e}(n)};return i.metadata=oh(Jd(n)),i}function jb(e,t,n){return arguments.length>1?(Ub.set(e,Vb(e,t,n)),this):function(e){return Ub.has(e)}(e)?Ub.get(e):void 0}function Yb(e,t){const n=Ub.get(e);return n&&n.metadata[t]}function Gb(e){return Yb(e,kb)}jb("identity",function e(t){var n;function i(e){return null==e||isNaN(e=+e)?n:e}return i.invert=i,i.domain=i.range=function(e){return arguments.length?(t=Array.from(e,d_),i):t.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,d_):[0,1],E_(i)}),jb(vb,function e(){var t=v_();return t.copy=function(){return y_(t,e())},b_.apply(t,arguments),E_(t)},Rb),jb(bb,function e(){const t=R_(__()).domain([1,10]);return t.copy=()=>y_(t,e()).base(t.base()),b_.apply(t,arguments),t},[Rb,bb]),jb(Tb,L_,Rb),jb(xb,function(){return L_.apply(null,arguments).exponent(.5)},Rb),jb(Eb,function e(){var t=$_(__());return t.copy=function(){return y_(t,e()).constant(t.constant())},b_.apply(t,arguments)},Rb),jb(wb,function(){return b_.apply(W_(j_,Y_,Rf,Nf,gf,hf,Ff,Pf,$f,cm).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},[Rb,Fb]),jb(Ib,function(){return b_.apply(W_(z_,V_,kf,Df,wf,pf,Lf,Bf,$f,hm).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},[Rb,Fb]),jb(Ab,K_,[Rb,Db]),jb(`${Ab}-${vb}`,K_,[Rb,Db]),jb(`${Ab}-${bb}`,function e(){var t=R_(X_()).domain([1,10]);return t.copy=function(){return q_(t,e()).base(t.base())},T_.apply(t,arguments)},[Rb,Db,bb]),jb(`${Ab}-${Tb}`,Z_,[Rb,Db]),jb(`${Ab}-${xb}`,function(){return Z_.apply(null,arguments).exponent(.5)},[Rb,Db]),jb(`${Ab}-${Eb}`,function e(){var t=$_(X_());return t.copy=function(){return q_(t,e()).constant(t.constant())},T_.apply(t,arguments)},[Rb,Db]),jb(`${Sb}-${vb}`,function e(){var t=E_(J_()(p_));return t.copy=function(){return q_(t,e())},T_.apply(t,arguments)},[Rb,Db]),jb(`${Sb}-${bb}`,function e(){var t=R_(J_()).domain([.1,1,10]);return t.copy=function(){return q_(t,e()).base(t.base())},T_.apply(t,arguments)},[Rb,Db,bb]),jb(`${Sb}-${Tb}`,ev,[Rb,Db]),jb(`${Sb}-${xb}`,function(){return ev.apply(null,arguments).exponent(.5)},[Rb,Db]),jb(`${Sb}-${Eb}`,function e(){var t=$_(J_());return t.copy=function(){return q_(t,e()).constant(t.constant())},T_.apply(t,arguments)},[Rb,Db]),jb(Cb,function e(){var t,n=[],i=[],r=[];function s(){var e=0,t=Math.max(1,i.length);for(r=new Array(t-1);++e<t;)r[e-1]=tv(n,e/t);return o}function o(e){return null==e||isNaN(e=+e)?t:i[ly(r,e)]}return o.invertExtent=function(e){var t=i.indexOf(e);return t<0?[NaN,NaN]:[t>0?r[t-1]:n[0],t<r.length?r[t]:n[n.length-1]]},o.domain=function(e){if(!arguments.length)return n.slice();n=[];for(let t of e)null==t||isNaN(t=+t)||n.push(t);return n.sort(ty),s()},o.range=function(e){return arguments.length?(i=Array.from(e),s()):i.slice()},o.unknown=function(e){return arguments.length?(t=e,o):t},o.quantiles=function(){return r.slice()},o.copy=function(){return e().domain(n).range(i).unknown(t)},b_.apply(o,arguments)},[Nb,Cb]),jb(Ob,function e(){var t,n=0,i=1,r=1,s=[.5],o=[0,1];function a(e){return null!=e&&e<=e?o[ly(s,e,0,r)]:t}function l(){var e=-1;for(s=new Array(r);++e<r;)s[e]=((e+1)*i-(e-r)*n)/(r+1);return a}return a.domain=function(e){return arguments.length?([n,i]=e,n=+n,i=+i,l()):[n,i]},a.range=function(e){return arguments.length?(r=(o=Array.from(e)).length-1,l()):o.slice()},a.invertExtent=function(e){var t=o.indexOf(e);return t<0?[NaN,NaN]:t<1?[n,s[0]]:t>=r?[s[r-1],i]:[s[t-1],s[t]]},a.unknown=function(e){return arguments.length?(t=e,a):a},a.thresholds=function(){return s.slice()},a.copy=function(){return e().domain([n,i]).range(o).unknown(t)},b_.apply(E_(a),arguments)},Nb),jb(Mb,function e(){var t,n=[.5],i=[0,1],r=1;function s(e){return null!=e&&e<=e?i[ly(n,e,0,r)]:t}return s.domain=function(e){return arguments.length?(n=Array.from(e),r=Math.min(n.length,i.length-1),s):n.slice()},s.range=function(e){return arguments.length?(i=Array.from(e),r=Math.min(n.length,i.length-1),s):i.slice()},s.invertExtent=function(e){var t=i.indexOf(e);return[n[t-1],n[t]]},s.unknown=function(e){return arguments.length?(t=e,s):t},s.copy=function(){return e().domain(n).range(i).unknown(t)},b_.apply(s,arguments)},Nb),jb("bin-ordinal",function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[(ly(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return Bb.call(e,Qd)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=$b.call(e),i):n.slice()},i.tickFormat=function(e,n){return x_(t[0],Zd(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i},[kb,Nb]),jb("ordinal",uv,kb),jb("band",Lb,kb),jb("point",function(){return Pb(Lb().paddingInner(1))},kb);function Hb(e,t,n){return Q_(function(e,t){const n=o[function(e){return"interpolate"+e.toLowerCase().split("-").map(e=>e[0].toUpperCase()+e.slice(1)).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}(t||"rgb",n),e)}function Wb(e){if(qd(e))return e;const t=e.length/6|0,n=new Array(t);for(let i=0;i<t;)n[i]="#"+e.slice(6*i,6*++i);return n}function Xb(e,t){for(const n in e)Kb(n,t(e[n]))}const qb={};function Kb(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(qb[e]=t,this):qb[e]}Xb({accent:ub,category10:cb,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:db,observable10:hb,paired:pb,pastel1:fb,pastel2:mb,set1:gb,set2:yb,set3:_b,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},Wb),Xb({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},e=>Hb(Wb(e)));const Zb=e=>qd(e)?e.map(e=>String(e)):String(e),Qb=(e,t)=>e[1]-t[1],Jb=(e,t)=>t[1]-e[1];function eT(e,t){return e.bins?function(e,t,n){let i=e.range(),r=i[0],s=Zd(i),o=Qb;if(r>s&&(i=s,s=r,r=i,o=Jb),r=Math.floor(r),s=Math.ceil(s),t=t.map(t=>[t,e(t)]).filter(e=>r<=e[1]&&e[1]<=s).sort(o).map(e=>e[0]),n>0&&t.length>1){const e=[t[0],Zd(t)];for(;t.length>n&&t.length>=3;)t=t.filter((e,t)=>!(t%2));t.length<3&&(t=e)}return t}(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function tT(e,t,n,i,r,s){const o=t.type;let a=Zb;if(o===wb||r===wb)a=e.timeFormat(i);else if(o===Ib||r===Ib)a=e.utcFormat(i);else if(function(e){return Yb(e,bb)}(o)){const r=e.formatFloat(i);if(s||t.bins)a=r;else{const e=nT(t,n,!1);a=t=>e(t)?r(t):""}}else if(t.tickFormat){const r=t.domain();a=e.formatSpan(r[0],r[r.length-1],n,i)}else i&&(a=e.format(i));return a}function nT(e,t,n){const i=eT(e,t),r=e.base(),s=Math.log(r),o=Math.max(1,r*t/i.length),a=e=>{let t=e/Math.pow(r,Math.round(Math.log(e)/s));return t*r<r-.5&&(t*=r),t<=o};return n?i.filter(a):a}const iT={[Cb]:"quantiles",[Ob]:"thresholds",[Mb]:"domain"},rT={[Cb]:"quantiles",[Ob]:"domain"};function sT(e,t){return e.bins?function(e){const t=e.slice(0,-1);return t.max=Zd(e),t}(e.bins):e.type===bb?nT(e,t,!0):iT[e.type]?function(e){const t=[-1/0].concat(e);return t.max=1/0,t}(e[iT[e.type]]()):eT(e,t)}function oT(e,t,n,i,r,s,o){const a=rT[t.type]&&s!==wb&&s!==Ib?function(e,t,n){const i=t[rT[t.type]](),r=i.length;let s,o=r>1?i[1]-i[0]:i[0];for(s=1;s<r;++s)o=Math.min(o,i[s]-i[s-1]);return e.formatSpan(0,o,30,n)}(e,t,r):tT(e,t,n,r,s,o);return"symbol"===i&&(e=>iT[e.type]||e.bins)(t)?aT(a):"discrete"===i?uT(a):cT(a)}const aT=e=>(t,n,i)=>{const r=lT(i[n+1],lT(i.max,1/0)),s=dT(t,e),o=dT(r,e);return s&&o?s+" "+o:o?"< "+o:"≥ "+s},lT=(e,t)=>null!=e?e:t,uT=e=>(t,n)=>n?e(t):null,cT=e=>t=>e(t),dT=(e,t)=>Number.isFinite(e)?t(e):null;function hT(e,t,n,i){const r=i||t.type;return rh(n)&&function(e){return Yb(e,Fb)}(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==wb?n||r!==Ib?oT(e,t,5,null,n,i,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}function pT(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=hT(e,t,n.format,n.formatType);if(function(e){return Yb(e,Nb)}(t.type)){const e=sT(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(Gb(t.type)){const e=t.domain(),n=e.length;return`${n} value${1===n?"":"s"}: ${n>i?e.slice(0,i-2).map(r).join(", ")+", ending with "+e.slice(-1).map(r):e.map(r).join(", ")}`}{const e=t.domain();return`values from ${r(e[0])} to ${r(Zd(e))}`}}let fT=0;const mT="p_";function gT(e){return e&&e.gradient}function yT(e,t,n){const i=e.gradient;let r=e.id,s="radial"===i?mT:"";return r||(r=e.id="gradient_"+fT++,"radial"===i?(e.x1=_T(e.x1,.5),e.y1=_T(e.y1,.5),e.r1=_T(e.r1,0),e.x2=_T(e.x2,.5),e.y2=_T(e.y2,.5),e.r2=_T(e.r2,.5),s=mT):(e.x1=_T(e.x1,0),e.y1=_T(e.y1,0),e.x2=_T(e.x2,1),e.y2=_T(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+s+r+")"}function _T(e,t){return null!=e?e:t}const vT={basis:{curve:function(e){return new lh(e)}},"basis-closed":{curve:function(e){return new ch(e)}},"basis-open":{curve:function(e){return new dh(e)}},bundle:{curve:ph,tension:"beta",value:.85},cardinal:{curve:gh,tension:"tension",value:0},"cardinal-open":{curve:_h,tension:"tension",value:0},"cardinal-closed":{curve:bh,tension:"tension",value:0},"catmull-rom":{curve:Fh,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Ph,tension:"alpha",value:.5},"catmull-rom-open":{curve:$h,tension:"alpha",value:.5},linear:{curve:zh},"linear-closed":{curve:function(e){return new Vh(e)}},monotone:{horizontal:function(e){return new Xh(e)},vertical:function(e){return new Wh(e)}},natural:{curve:function(e){return new Kh(e)}},step:{curve:function(e){return new Qh(e,.5)}},"step-after":{curve:function(e){return new Qh(e,1)}},"step-before":{curve:function(e){return new Qh(e,0)}}};function bT(e,t,n){var i=nh(vT,e)&&vT[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const TT={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},xT=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,ET=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,wT=/^((\s+,?\s*)|(,\s*))/,IT=/^[01]/;function AT(e){const t=[];return(e.match(xT)||[]).forEach(e=>{let n=e[0];const i=n.toLowerCase(),r=TT[i],s=function(e,t,n){const i=[];for(let r=0;t&&r<n.length;)for(let s=0;s<t;++s){const t="a"!==e||3!==s&&4!==s?ET:IT,o=n.slice(r).match(t);if(null===o)throw Error("Invalid SVG path, incorrect parameter type");r+=o[0].length,i.push(+o[0]);const a=n.slice(r).match(wT);null!==a&&(r+=a[0].length)}return i}(i,r,e.slice(1).trim()),o=s.length;if(o<r||o&&o%r!==0)throw Error("Invalid SVG path, incorrect parameter count");if(t.push([n,...s.slice(0,r)]),o!==r){"m"===i&&(n="M"===n?"L":"l");for(let e=r;e<o;e+=r)t.push([n,...s.slice(e,e+r)])}}),t}const ST=Math.PI/180,CT=Math.PI/2,OT=2*Math.PI,MT=Math.sqrt(3)/2;var RT={},kT={},NT=[].join;function DT(e){const t=NT.call(e);if(kT[t])return kT[t];var n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7];const c=u*o,d=-l*a,h=l*o,p=u*a,f=Math.cos(r),m=Math.sin(r),g=Math.cos(s),y=Math.sin(s),_=.5*(s-r),v=Math.sin(.5*_),b=8/3*v*v/Math.sin(_),T=n+f-b*m,x=i+m+b*f,E=n+g,w=i+y,I=E+b*y,A=w-b*g;return kT[t]=[c*T+d*x,h*T+p*x,c*I+d*A,h*I+p*A,c*E+d*w,h*E+p*w]}const FT=["l",0,0,0,0,0,0,0];function LT(e,t,n){const i=FT[0]=e[0];if("a"===i||"A"===i)FT[1]=t*e[1],FT[2]=n*e[2],FT[3]=e[3],FT[4]=e[4],FT[5]=e[5],FT[6]=t*e[6],FT[7]=n*e[7];else if("h"===i||"H"===i)FT[1]=t*e[1];else if("v"===i||"V"===i)FT[1]=n*e[1];else for(var r=1,s=e.length;r<s;++r)FT[r]=(r%2==1?t:n)*e[r];return FT}function PT(e,t,n,i,r,s){var o,a,l,u,c,d=null,h=0,p=0,f=0,m=0,g=0,y=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),null==s&&(s=r),e.beginPath&&e.beginPath();for(var _=0,v=t.length;_<v;++_){switch(o=t[_],1===r&&1===s||(o=LT(o,r,s)),o[0]){case"l":h+=o[1],p+=o[2],e.lineTo(h+n,p+i);break;case"L":h=o[1],p=o[2],e.lineTo(h+n,p+i);break;case"h":h+=o[1],e.lineTo(h+n,p+i);break;case"H":h=o[1],e.lineTo(h+n,p+i);break;case"v":p+=o[1],e.lineTo(h+n,p+i);break;case"V":p=o[1],e.lineTo(h+n,p+i);break;case"m":g=h+=o[1],y=p+=o[2],e.moveTo(h+n,p+i);break;case"M":g=h=o[1],y=p=o[2],e.moveTo(h+n,p+i);break;case"c":a=h+o[5],l=p+o[6],f=h+o[3],m=p+o[4],e.bezierCurveTo(h+o[1]+n,p+o[2]+i,f+n,m+i,a+n,l+i),h=a,p=l;break;case"C":h=o[5],p=o[6],f=o[3],m=o[4],e.bezierCurveTo(o[1]+n,o[2]+i,f+n,m+i,h+n,p+i);break;case"s":a=h+o[3],l=p+o[4],f=2*h-f,m=2*p-m,e.bezierCurveTo(f+n,m+i,h+o[1]+n,p+o[2]+i,a+n,l+i),f=h+o[1],m=p+o[2],h=a,p=l;break;case"S":a=o[3],l=o[4],f=2*h-f,m=2*p-m,e.bezierCurveTo(f+n,m+i,o[1]+n,o[2]+i,a+n,l+i),h=a,p=l,f=o[1],m=o[2];break;case"q":a=h+o[3],l=p+o[4],f=h+o[1],m=p+o[2],e.quadraticCurveTo(f+n,m+i,a+n,l+i),h=a,p=l;break;case"Q":a=o[3],l=o[4],e.quadraticCurveTo(o[1]+n,o[2]+i,a+n,l+i),h=a,p=l,f=o[1],m=o[2];break;case"t":a=h+o[1],l=p+o[2],null===d[0].match(/[QqTt]/)?(f=h,m=p):"t"===d[0]?(f=2*h-u,m=2*p-c):"q"===d[0]&&(f=2*h-f,m=2*p-m),u=f,c=m,e.quadraticCurveTo(f+n,m+i,a+n,l+i),p=l,f=(h=a)+o[1],m=p+o[2];break;case"T":a=o[1],l=o[2],f=2*h-f,m=2*p-m,e.quadraticCurveTo(f+n,m+i,a+n,l+i),h=a,p=l;break;case"a":BT(e,h+n,p+i,[o[1],o[2],o[3],o[4],o[5],o[6]+h+n,o[7]+p+i]),h+=o[6],p+=o[7];break;case"A":BT(e,h+n,p+i,[o[1],o[2],o[3],o[4],o[5],o[6]+n,o[7]+i]),h=o[6],p=o[7];break;case"z":case"Z":h=g,p=y,e.closePath()}d=o}}function BT(e,t,n,i){const r=function(e,t,n,i,r,s,o,a,l){const u=NT.call(arguments);if(RT[u])return RT[u];const c=o*ST,d=Math.sin(c),h=Math.cos(c),p=h*(a-e)*.5+d*(l-t)*.5,f=h*(l-t)*.5-d*(a-e)*.5;let m=p*p/((n=Math.abs(n))*n)+f*f/((i=Math.abs(i))*i);m>1&&(m=Math.sqrt(m),n*=m,i*=m);const g=h/n,y=d/n,_=-d/i,v=h/i,b=g*a+y*l,T=_*a+v*l,x=g*e+y*t,E=_*e+v*t;let w=1/((x-b)*(x-b)+(E-T)*(E-T))-.25;w<0&&(w=0);let I=Math.sqrt(w);s==r&&(I=-I);const A=.5*(b+x)-I*(E-T),S=.5*(T+E)+I*(x-b),C=Math.atan2(T-S,b-A);let O=Math.atan2(E-S,x-A)-C;O<0&&1===s?O+=OT:O>0&&0===s&&(O-=OT);const M=Math.ceil(Math.abs(O/(CT+.001))),R=[];for(let e=0;e<M;++e){const t=C+e*O/M,r=C+(e+1)*O/M;R[e]=[A,S,t,r,n,i,d,h]}return RT[u]=R}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],t,n);for(let t=0;t<r.length;++t){const n=DT(r[t]);e.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5])}}const $T=.5773502691896257,UT={circle:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,OT)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/2.5;e.moveTo(-n,-i),e.lineTo(-n,i),e.lineTo(-i,i),e.lineTo(-i,n),e.lineTo(i,n),e.lineTo(i,i),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(i,-i),e.lineTo(i,-n),e.lineTo(-i,-n),e.lineTo(-i,-i),e.closePath()}},diamond:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),i=-n/2;e.rect(i,i,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/7,r=n/2.5,s=n/8;e.moveTo(-i,n),e.lineTo(i,n),e.lineTo(i,-s),e.lineTo(r,-s),e.lineTo(0,-n),e.lineTo(-r,-s),e.lineTo(-i,-s),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,i=MT*n,r=i-n*$T,s=n/4;e.moveTo(0,-i-r),e.lineTo(-s,i-r),e.lineTo(s,i-r),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,i=MT*n,r=i-n*$T;e.moveTo(0,-i-r),e.lineTo(-n,i-r),e.lineTo(n,i-r),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,i=MT*n;e.moveTo(0,-i),e.lineTo(-n,i),e.lineTo(n,i),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,i=MT*n;e.moveTo(0,i),e.lineTo(-n,-i),e.lineTo(n,-i),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,i=MT*n;e.moveTo(i,0),e.lineTo(-i,-n),e.lineTo(-i,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,i=MT*n;e.moveTo(-i,0),e.lineTo(i,-n),e.lineTo(i,n),e.closePath()}},stroke:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}};function zT(e){return nh(UT,e)?UT[e]:function(e){if(!nh(VT,e)){const t=AT(e);VT[e]={draw:function(e,n){PT(e,t,0,0,Math.sqrt(n)/2)}}}return VT[e]}(e)}var VT={};const jT=.448084975506;function YT(e){return e.x}function GT(e){return e.y}function HT(e){return e.width}function WT(e){return e.height}function XT(e){return"function"==typeof e?e:()=>+e}function qT(e,t,n){return Math.max(t,Math.min(e,n))}function KT(e,t){return null!=e?e:t}const ZT=e=>e.x||0,QT=e=>e.y||0,JT=e=>!(!1===e.defined),ex=function(){var e=lp,t=up,n=Jh(0),i=null,r=cp,s=dp,o=hp,a=null,l=ap(u);function u(){var u,c,d=+e.apply(this,arguments),h=+t.apply(this,arguments),p=r.apply(this,arguments)-Mh,f=s.apply(this,arguments)-Mh,m=Th(f-p),g=f>p;if(a||(a=u=l()),h<d&&(c=h,h=d,d=c),h>Ch)if(m>Rh-Ch)a.moveTo(h*Eh(p),h*Ah(p)),a.arc(0,0,h,p,f,!g),d>Ch&&(a.moveTo(d*Eh(f),d*Ah(f)),a.arc(0,0,d,f,p,g));else{var y,_,v=p,b=f,T=p,x=f,E=m,w=m,I=o.apply(this,arguments)/2,A=I>Ch&&(i?+i.apply(this,arguments):Sh(d*d+h*h)),S=Ih(Th(h-d)/2,+n.apply(this,arguments)),C=S,O=S;if(A>Ch){var M=kh(A/d*Ah(I)),R=kh(A/h*Ah(I));(E-=2*M)>Ch?(T+=M*=g?1:-1,x-=M):(E=0,T=x=(p+f)/2),(w-=2*R)>Ch?(v+=R*=g?1:-1,b-=R):(w=0,v=b=(p+f)/2)}var k=h*Eh(v),N=h*Ah(v),D=d*Eh(x),F=d*Ah(x);if(S>Ch){var L,P=h*Eh(b),B=h*Ah(b),$=d*Eh(T),U=d*Ah(T);if(m<Oh)if(L=function(e,t,n,i,r,s,o,a){var l=n-e,u=i-t,c=o-r,d=a-s,h=d*l-c*u;if(!(h*h<Ch))return[e+(h=(c*(t-s)-d*(e-r))/h)*l,t+h*u]}(k,N,$,U,P,B,D,F)){var z=k-L[0],V=N-L[1],j=P-L[0],Y=B-L[1],G=1/Ah(function(e){return e>1?0:e<-1?Oh:Math.acos(e)}((z*j+V*Y)/(Sh(z*z+V*V)*Sh(j*j+Y*Y)))/2),H=Sh(L[0]*L[0]+L[1]*L[1]);C=Ih(S,(d-H)/(G-1)),O=Ih(S,(h-H)/(G+1))}else C=O=0}w>Ch?O>Ch?(y=pp($,U,k,N,h,O,g),_=pp(P,B,D,F,h,O,g),a.moveTo(y.cx+y.x01,y.cy+y.y01),O<S?a.arc(y.cx,y.cy,O,xh(y.y01,y.x01),xh(_.y01,_.x01),!g):(a.arc(y.cx,y.cy,O,xh(y.y01,y.x01),xh(y.y11,y.x11),!g),a.arc(0,0,h,xh(y.cy+y.y11,y.cx+y.x11),xh(_.cy+_.y11,_.cx+_.x11),!g),a.arc(_.cx,_.cy,O,xh(_.y11,_.x11),xh(_.y01,_.x01),!g))):(a.moveTo(k,N),a.arc(0,0,h,v,b,!g)):a.moveTo(k,N),d>Ch&&E>Ch?C>Ch?(y=pp(D,F,P,B,d,-C,g),_=pp(k,N,$,U,d,-C,g),a.lineTo(y.cx+y.x01,y.cy+y.y01),C<S?a.arc(y.cx,y.cy,C,xh(y.y01,y.x01),xh(_.y01,_.x01),!g):(a.arc(y.cx,y.cy,C,xh(y.y01,y.x01),xh(y.y11,y.x11),!g),a.arc(0,0,d,xh(y.cy+y.y11,y.cx+y.x11),xh(_.cy+_.y11,_.cx+_.x11),g),a.arc(_.cx,_.cy,C,xh(_.y11,_.x11),xh(_.y01,_.x01),!g))):a.arc(0,0,d,x,T,g):a.lineTo(D,F)}else a.moveTo(0,0);if(a.closePath(),u)return a=null,u+""||null}return u.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +s.apply(this,arguments))/2-Oh/2;return[Eh(i)*n,Ah(i)*n]},u.innerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Jh(+t),u):e},u.outerRadius=function(e){return arguments.length?(t="function"==typeof e?e:Jh(+e),u):t},u.cornerRadius=function(e){return arguments.length?(n="function"==typeof e?e:Jh(+e),u):n},u.padRadius=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:Jh(+e),u):i},u.startAngle=function(e){return arguments.length?(r="function"==typeof e?e:Jh(+e),u):r},u.endAngle=function(e){return arguments.length?(s="function"==typeof e?e:Jh(+e),u):s},u.padAngle=function(e){return arguments.length?(o="function"==typeof e?e:Jh(+e),u):o},u.context=function(e){return arguments.length?(a=null==e?null:e,u):a},u}().startAngle(e=>e.startAngle||0).endAngle(e=>e.endAngle||0).padAngle(e=>e.padAngle||0).innerRadius(e=>e.innerRadius||0).outerRadius(e=>e.outerRadius||0).cornerRadius(e=>e.cornerRadius||0),tx=_p().x(ZT).y1(QT).y0(e=>(e.y||0)+(e.height||0)).defined(JT),nx=_p().y(QT).x1(ZT).x0(e=>(e.x||0)+(e.width||0)).defined(JT),ix=yp().x(ZT).y(QT).defined(JT),rx=function(){var e=YT,t=GT,n=HT,i=WT,r=XT(0),s=r,o=r,a=r,l=null;function u(u,c,d){var h,p=null!=c?c:+e.call(this,u),f=null!=d?d:+t.call(this,u),m=+n.call(this,u),g=+i.call(this,u),y=Math.min(m,g)/2,_=qT(+r.call(this,u),0,y),v=qT(+s.call(this,u),0,y),b=qT(+o.call(this,u),0,y),T=qT(+a.call(this,u),0,y);if(l||(l=h=op()),_<=0&&v<=0&&b<=0&&T<=0)l.rect(p,f,m,g);else{var x=p+m,E=f+g;l.moveTo(p+_,f),l.lineTo(x-v,f),l.bezierCurveTo(x-jT*v,f,x,f+jT*v,x,f+v),l.lineTo(x,E-T),l.bezierCurveTo(x,E-jT*T,x-jT*T,E,x-T,E),l.lineTo(p+b,E),l.bezierCurveTo(p+jT*b,E,p,E-jT*b,p,E-b),l.lineTo(p,f+_),l.bezierCurveTo(p,f+jT*_,p+jT*_,f,p+_,f),l.closePath()}if(h)return l=null,h+""||null}return u.x=function(t){return arguments.length?(e=XT(t),u):e},u.y=function(e){return arguments.length?(t=XT(e),u):t},u.width=function(e){return arguments.length?(n=XT(e),u):n},u.height=function(e){return arguments.length?(i=XT(e),u):i},u.cornerRadius=function(e,t,n,i){return arguments.length?(r=XT(e),s=null!=t?XT(t):r,a=null!=n?XT(n):r,o=null!=i?XT(i):s,u):r},u.context=function(e){return arguments.length?(l=null==e?null:e,u):l},u}().x(ZT).y(QT).width(e=>e.width||0).height(e=>e.height||0).cornerRadius(e=>KT(e.cornerRadiusTopLeft,e.cornerRadius)||0,e=>KT(e.cornerRadiusTopRight,e.cornerRadius)||0,e=>KT(e.cornerRadiusBottomRight,e.cornerRadius)||0,e=>KT(e.cornerRadiusBottomLeft,e.cornerRadius)||0),sx=function(e,t){let n=null,i=ap(r);function r(){let r;if(n||(n=r=i()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return e="function"==typeof e?e:Jh(e||vp),t="function"==typeof t?t:Jh(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:Jh(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:Jh(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type(e=>zT(e.shape||"circle")).size(e=>KT(e.size,64)),ox=function(){var e,t,n,i,r,s,o,a,l=null;function u(e,t,n){const i=n/2;if(r){var u=o-t,c=e-s;if(u||c){var d=Math.hypot(u,c),h=(u/=d)*a,p=(c/=d)*a,f=Math.atan2(c,u);l.moveTo(s-h,o-p),l.lineTo(e-u*i,t-c*i),l.arc(e,t,i,f-Math.PI,f),l.lineTo(s+h,o+p),l.arc(s,o,a,f,f+Math.PI)}else l.arc(e,t,i,0,OT);l.closePath()}else r=1;s=e,o=t,a=i}function c(s){var o,a,c,d=s.length,h=!1;for(null==l&&(l=c=op()),o=0;o<=d;++o)!(o<d&&i(a=s[o],o,s))===h&&(h=!h)&&(r=0),h&&u(+e(a,o,s),+t(a,o,s),+n(a,o,s));if(c)return l=null,c+""||null}return c.x=function(t){return arguments.length?(e=t,c):e},c.y=function(e){return arguments.length?(t=e,c):t},c.size=function(e){return arguments.length?(n=e,c):n},c.defined=function(e){return arguments.length?(i=e,c):i},c.context=function(e){return arguments.length?(l=null==e?null:e,c):l},c}().x(ZT).y(QT).defined(JT).size(e=>e.size||1);function ax(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function lx(e,t,n,i){return rx.context(e)(t,n,i)}var ux=1;function cx(e,t,n){var i=t.clip,r=e._defs,s=t.clip_id||(t.clip_id="clip"+ux++),o=r.clipping[s]||(r.clipping[s]={id:s});return eh(i)?o.path=i(null):ax(n)?o.path=lx(null,n,0,0):(o.width=n.width||0,o.height=n.height||0),"url(#"+s+")"}function dx(e){this.clear(),e&&this.union(e)}function hx(e){this.mark=e,this.bounds=this.bounds||new dx}function px(e){hx.call(this,e),this.items=this.items||[]}dx.prototype={clone(){return new dx(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),i<t?(this.y2=t,this.y1=i):(this.y1=t,this.y2=i),this},add(e,t){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:s,y2:o}=this,a=Math.cos(e),l=Math.sin(e),u=t-t*a+n*l,c=n-t*l-n*a;return[a*i-l*r+u,l*i+a*r+c,a*i-l*o+u,l*i+a*o+c,a*s-l*r+u,l*s+a*r+c,a*s-l*o+u,l*s+a*o+c]},union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this},encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)},contains(e,t){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},ih(px,hx);class fx{constructor(e){this._pending=0,this._loader=e||ey()}pending(){return this._pending}sanitizeURL(e){const t=this;return mx(t),t._loader.sanitize(e,{context:"href"}).then(e=>(gx(t),e)).catch(()=>(gx(t),null))}loadImage(e){const t=this,n=xp();return mx(t),t._loader.sanitize(e,{context:"image"}).then(e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,s=nh(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=s&&(r.crossOrigin=s),r.onload=()=>gx(t),r.onerror=()=>gx(t),r.src=i,r}).catch(e=>(gx(t),{complete:!1,width:0,height:0,src:e&&e.url||""}))}ready(){const e=this;return new Promise(t=>{!function n(i){e.pending()?setTimeout(()=>{n(!0)},10):t(i)}(!1)})}}function mx(e){e._pending+=1}function gx(e){e._pending-=1}function yx(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){const i=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(i+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,i):0))}return e}const _x=OT-1e-8;let vx,bx,Tx,xx,Ex,wx,Ix,Ax;const Sx=(e,t)=>vx.add(e,t),Cx=(e,t)=>Sx(bx=e,Tx=t),Ox=e=>Sx(e,vx.y1),Mx=e=>Sx(vx.x1,e),Rx=(e,t)=>Ex*e+Ix*t,kx=(e,t)=>wx*e+Ax*t,Nx=(e,t)=>Sx(Rx(e,t),kx(e,t)),Dx=(e,t)=>Cx(Rx(e,t),kx(e,t));function Fx(e,t){return vx=e,t?(xx=t*ST,Ex=Ax=Math.cos(xx),wx=Math.sin(xx),Ix=-wx):(Ex=Ax=1,xx=wx=Ix=0),Lx}const Lx={beginPath(){},closePath(){},moveTo:Dx,lineTo:Dx,rect(e,t,n,i){xx?(Nx(e+n,t),Nx(e+n,t+i),Nx(e,t+i),Dx(e,t)):(Sx(e+n,t+i),Cx(e,t))},quadraticCurveTo(e,t,n,i){const r=Rx(e,t),s=kx(e,t),o=Rx(n,i),a=kx(n,i);Px(bx,r,o,Ox),Px(Tx,s,a,Mx),Cx(o,a)},bezierCurveTo(e,t,n,i,r,s){const o=Rx(e,t),a=kx(e,t),l=Rx(n,i),u=kx(n,i),c=Rx(r,s),d=kx(r,s);Bx(bx,o,l,c,Ox),Bx(Tx,a,u,d,Mx),Cx(c,d)},arc(e,t,n,i,r,s){if(i+=xx,r+=xx,bx=n*Math.cos(r)+e,Tx=n*Math.sin(r)+t,Math.abs(r-i)>_x)Sx(e-n,t-n),Sx(e+n,t+n);else{const o=i=>Sx(n*Math.cos(i)+e,n*Math.sin(i)+t);let a,l;if(o(i),o(r),r!==i)if((i%=OT)<0&&(i+=OT),(r%=OT)<0&&(r+=OT),r<i&&(s=!s,a=i,i=r,r=a),s)for(r-=OT,a=i-i%CT,l=0;l<4&&a>r;++l,a-=CT)o(a);else for(a=i-i%CT+CT,l=0;l<4&&a<r;++l,a+=CT)o(a)}}};function Px(e,t,n,i){const r=(e-t)/(e+n-2*t);0<r&&r<1&&i(e+(t-e)*r)}function Bx(e,t,n,i,r){const s=i-e+3*t-3*n,o=e+n-2*t,a=e-t;let l,u=0,c=0;Math.abs(s)>1e-14?(l=o*o+a*s,l>=0&&(l=Math.sqrt(l),u=(-o+l)/s,c=(-o-l)/s)):u=.5*a/o,0<u&&u<1&&r($x(u,e,t,n,i)),0<c&&c<1&&r($x(c,e,t,n,i))}function $x(e,t,n,i,r){const s=1-e,o=s*s,a=e*e;return o*s*t+3*o*e*n+3*s*a*i+a*e*r}var Ux=(Ux=Tp(1,1))?Ux.getContext("2d"):null;const zx=new dx;function Vx(e){return function(t,n){if(!Ux)return!0;e(Ux,t),zx.clear().union(t.bounds).intersect(n).round();const{x1:i,y1:r,x2:s,y2:o}=zx;for(let e=r;e<=o;++e)for(let t=i;t<=s;++t)if(Ux.isPointInPath(t,e))return!0;return!1}}function jx(e,t){return t.contains(e.x||0,e.y||0)}function Yx(e,t){const n=e.x||0,i=e.y||0,r=e.width||0,s=e.height||0;return t.intersects(zx.set(n,i,n+r,i+s))}function Gx(e,t,n,i,r){const{x1:s,y1:o,x2:a,y2:l}=e,u=i-t,c=r-n;let d,h,p,f,m=0,g=1;for(f=0;f<4;++f){if(0===f&&(d=-u,h=-(s-t)),1===f&&(d=u,h=a-t),2===f&&(d=-c,h=-(o-n)),3===f&&(d=c,h=l-n),Math.abs(d)<1e-10&&h<0)return!1;if(p=h/d,d<0){if(p>g)return!1;p>m&&(m=p)}else if(d>0){if(p<m)return!1;p<g&&(g=p)}}return!0}function Hx(e,t){e.globalCompositeOperation=t.blend||"source-over"}function Wx(e,t){return null==e?t:e}function Xx(e,t){const n=t.length;for(let i=0;i<n;++i)e.addColorStop(t[i].offset,t[i].color);return e}function qx(e,t,n){return gT(n)?function(e,t,n){const i=n.width(),r=n.height();let s;if("radial"===t.gradient)s=e.createRadialGradient(n.x1+Wx(t.x1,.5)*i,n.y1+Wx(t.y1,.5)*r,Math.max(i,r)*Wx(t.r1,0),n.x1+Wx(t.x2,.5)*i,n.y1+Wx(t.y2,.5)*r,Math.max(i,r)*Wx(t.r2,.5));else{const o=Wx(t.x1,0),a=Wx(t.y1,0),l=Wx(t.x2,1),u=Wx(t.y2,0);if(o!==l&&a!==u&&i!==r){const n=Tp(Math.ceil(i),Math.ceil(r)),s=n.getContext("2d");return s.scale(i,r),s.fillStyle=Xx(s.createLinearGradient(o,a,l,u),t.stops),s.fillRect(0,0,i,r),e.createPattern(n,"no-repeat")}s=e.createLinearGradient(n.x1+o*i,n.y1+a*r,n.x1+l*i,n.y1+u*r)}return Xx(s,t.stops)}(e,n,t.bounds):n}function Kx(e,t,n){return(n*=null==t.fillOpacity?1:t.fillOpacity)>0&&(e.globalAlpha=n,e.fillStyle=qx(e,t,t.fill),!0)}var Zx=[];function Qx(e,t,n){var i=null!=(i=t.strokeWidth)?i:1;return!(i<=0)&&((n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=qx(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||Zx),e.lineDashOffset=t.strokeDashOffset||0),!0))}function Jx(e,t){return e.zindex-t.zindex||e.index-t.index}function eE(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,s=[];for(n=0,i=r.length;n<i;++n)(t=r[n]).index=n,t.zindex&&s.push(t);return e.zdirty=!1,e.zitems=s.sort(Jx)}function tE(e,t){var n,i,r=e.items;if(!r||!r.length)return;const s=eE(e);if(s&&s.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||t(r[n]);r=s}for(n=0,i=r.length;n<i;++n)t(r[n])}function nE(e,t){var n,i,r=e.items;if(!r||!r.length)return null;const s=eE(e);for(s&&s.length&&(r=s),i=r.length;--i>=0;)if(n=t(r[i]))return n;if(r===s)for(i=(r=e.items).length;--i>=0;)if(!r[i].zindex&&(n=t(r[i])))return n;return null}function iE(e){return function(t,n,i){tE(n,n=>{i&&!i.intersects(n.bounds)||sE(e,t,n,n)})}}function rE(e){return function(t,n,i){!n.items.length||i&&!i.intersects(n.bounds)||sE(e,t,n.items[0],n.items)}}function sE(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(Hx(t,n),n.fill&&Kx(t,n,r)&&t.fill(),n.stroke&&Qx(t,n,r)&&t.stroke()))}function oE(e){return e=e||Xd,function(t,n,i,r,s,o){return i*=t.pixelRatio,r*=t.pixelRatio,nE(n,n=>{const a=n.bounds;if((!a||a.contains(s,o))&&a)return e(t,n,i,r,s,o)?n:void 0})}}function aE(e,t){return function(n,i,r,s){var o,a,l=Array.isArray(i)?i[0]:i,u=null==t?l.fill:t,c=l.stroke&&n.isPointInStroke;return c&&(o=l.strokeWidth,a=l.strokeCap,n.lineWidth=null!=o?o:1,n.lineCap=null!=a?a:"butt"),!e(n,i)&&(u&&n.isPointInPath(r,s)||c&&n.isPointInStroke(r,s))}}function lE(e){return oE(aE(e))}function uE(e,t){return"translate("+e+","+t+")"}function cE(e){return"rotate("+e+")"}function dE(e){return uE(e.x||0,e.y||0)}function hE(e,t,n){function i(e,n){var i=n.x||0,r=n.y||0,s=n.angle||0;e.translate(i,r),s&&e.rotate(s*=ST),e.beginPath(),t(e,n),s&&e.rotate(-s),e.translate(-i,-r)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",function(e){return uE(e.x||0,e.y||0)+(e.angle?" "+cE(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(Fx(e,n.angle),n),yx(e,n).translate(n.x||0,n.y||0)},draw:iE(i),pick:lE(i),isect:n||Vx(i)}}var pE=hE("arc",function(e,t){return ex.context(e)(t)});function fE(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=aE(i);return{type:e,tag:"path",nested:!0,attr:function(e,n){var i=n.mark.items;i.length&&e("d",t(null,i))},bound:function(e,n){var i=n.items;return 0===i.length?e:(t(Fx(e),i),yx(e,i[0]))},draw:rE(i),pick:function(e,t,n,i,s,o){var a=t.items,l=t.bounds;return!a||!a.length||l&&!l.contains(s,o)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,a,n,i)?a[0]:null)},isect:jx,tip:n}}var mE=fE("area",function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?nx:tx).curve(bT(i,n.orient,n.tension)).context(e)(t)},function(e,t){for(var n,i,r="horizontal"===e[0].orient?t[1]:t[0],s="horizontal"===e[0].orient?"y":"x",o=e.length,a=1/0;--o>=0;)!1!==e[o].defined&&(i=Math.abs(e[o][s]-r))<a&&(a=i,n=e[o]);return n});function gE(e,t){e.beginPath(),ax(t)?lx(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function yE(e){const t=Wx(e.strokeWidth,1);return null!=e.strokeOffset?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function _E(e,t){const n=yE(t);e("d",lx(null,t,n,n))}function vE(e,t,n,i){const r=yE(t);e.beginPath(),lx(e,t,(n||0)+r,(i||0)+r)}const bE=aE(vE),TE=aE(vE,!1),xE=aE(vE,!0);var EE={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",dE(t))},bound:function(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let t=0;t<i;++t)e.union(n[t].bounds)}return(t.clip||t.width||t.height)&&!t.noBound&&e.add(0,0).add(t.width||0,t.height||0),yx(e,t),e.translate(t.x||0,t.y||0)},draw:function(e,t,n,i){tE(t,t=>{const r=t.x||0,s=t.y||0,o=t.strokeForeground,a=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&a&&(vE(e,t,r,s),Hx(e,t),t.fill&&Kx(e,t,a)&&e.fill(),t.stroke&&!o&&Qx(e,t,a)&&e.stroke()),e.save(),e.translate(r,s),t.clip&&gE(e,t),n&&n.translate(-r,-s),tE(t,t=>{("group"===t.marktype||null==i||i.includes(t.marktype))&&this.draw(e,t,n,i)}),n&&n.translate(r,s),e.restore(),o&&t.stroke&&a&&(vE(e,t,r,s),Hx(e,t),Qx(e,t,a)&&e.stroke())})},pick:function(e,t,n,i,r,s){if(t.bounds&&!t.bounds.contains(r,s)||!t.items)return null;const o=n*e.pixelRatio,a=i*e.pixelRatio;return nE(t,l=>{let u,c,d;const h=l.bounds;if(h&&!h.contains(r,s))return;c=l.x||0,d=l.y||0;const p=c+(l.width||0),f=d+(l.height||0),m=l.clip;if(m&&(r<c||r>p||s<d||s>f))return;if(e.save(),e.translate(c,d),c=r-c,d=s-d,m&&ax(l)&&!xE(e,l,o,a))return e.restore(),null;const g=l.strokeForeground,y=!1!==t.interactive;return y&&g&&l.stroke&&TE(e,l,o,a)?(e.restore(),l):(u=nE(l,e=>function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,c,d)?this.pick(e,n,i,c,d):null),!u&&y&&(l.fill||!g&&l.stroke)&&bE(e,l,o,a)&&(u=l),e.restore(),u||null)})},isect:Yx,content:function(e,t,n){e("clip-path",t.clip?cx(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),_E(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?_E(e,t):e("d","")}},wE={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function IE(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(t=>{e.image=t,e.image.url=e.url})),n}function AE(e,t){return null!=e.width?e.width:t&&t.width?!1!==e.aspect&&e.height?e.height*t.width/t.height:t.width:0}function SE(e,t){return null!=e.height?e.height:t&&t.height?!1!==e.aspect&&e.width?e.width*t.height/t.width:t.height:0}function CE(e,t){return"center"===e?t/2:"right"===e?t:0}function OE(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var ME={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=IE(t,n),r=AE(t,i),s=SE(t,i),o=(t.x||0)-CE(t.align,r),a=(t.y||0)-OE(t.baseline,s);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",wE["xmlns:xlink"],"xlink:href"),e("transform",uE(o,a)),e("width",r),e("height",s),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=AE(t,n),r=SE(t,n),s=(t.x||0)-CE(t.align,i),o=(t.y||0)-OE(t.baseline,r);return e.set(s,o,s+i,o+r)},draw:function(e,t,n){tE(t,t=>{if(n&&!n.intersects(t.bounds))return;const i=IE(t,this);let r=AE(t,i),s=SE(t,i);if(0===r||0===s)return;let o,a,l,u,c=(t.x||0)-CE(t.align,r),d=(t.y||0)-OE(t.baseline,s);!1!==t.aspect&&(a=i.width/i.height,l=t.width/t.height,a==a&&l==l&&a!==l&&(l<a?(u=r/a,d+=(s-u)/2,s=u):(u=s*a,c+=(r-u)/2,r=u))),(i.complete||i.toDataURL)&&(Hx(e,t),e.globalAlpha=null!=(o=t.opacity)?o:1,e.imageSmoothingEnabled=!1!==t.smooth,e.drawImage(i,c,d,r,s))})},pick:oE(),isect:Xd,get:IE,xOffset:CE,yOffset:OE},RE=fE("line",function(e,t){const n=t[0],i=n.interpolate||"linear";return ix.curve(bT(i,n.orient,n.tension)).context(e)(t)},function(e,t){for(var n,i,r=Math.pow(e[0].strokeWidth||1,2),s=e.length;--s>=0;)if(!1!==e[s].defined&&(n=e[s].x-t[0])*n+(i=e[s].y-t[1])*i<r)return e[s];return null});function kE(e,t){var n=t.path;if(null==n)return!0;var i=t.x||0,r=t.y||0,s=t.scaleX||1,o=t.scaleY||1,a=(t.angle||0)*ST,l=t.pathCache;l&&l.path===n||((t.pathCache=l=AT(n)).path=n),a&&e.rotate&&e.translate?(e.translate(i,r),e.rotate(a),PT(e,l,0,0,s,o),e.rotate(-a),e.translate(-i,-r)):PT(e,l,i,r,s,o)}var NE={type:"path",tag:"path",nested:!1,attr:function(e,t){var n=t.scaleX||1,i=t.scaleY||1;1===n&&1===i||e("vector-effect","non-scaling-stroke"),e("transform",function(e){return uE(e.x||0,e.y||0)+(e.angle?" "+cE(e.angle):"")+(e.scaleX||e.scaleY?" "+function(e,t){return"scale("+e+","+t+")"}(e.scaleX||1,e.scaleY||1):"")}(t)),e("d",t.path)},bound:function(e,t){return kE(Fx(e,t.angle),t)?e.set(0,0,0,0):yx(e,t,!0)},draw:iE(kE),pick:lE(kE),isect:Vx(kE)};function DE(e,t){e.beginPath(),lx(e,t)}var FE={type:"rect",tag:"path",nested:!1,attr:function(e,t){e("d",lx(null,t))},bound:function(e,t){var n,i;return yx(e.set(n=t.x||0,i=t.y||0,n+t.width||0,i+t.height||0),t)},draw:iE(DE),pick:lE(DE),isect:Yx};function LE(e,t,n){var i,r,s,o;return!(!t.stroke||!Qx(e,t,n))&&(i=t.x||0,r=t.y||0,s=null!=t.x2?t.x2:i,o=null!=t.y2?t.y2:r,e.beginPath(),e.moveTo(i,r),e.lineTo(s,o),!0)}var PE={type:"rule",tag:"line",nested:!1,attr:function(e,t){e("transform",dE(t)),e("x2",null!=t.x2?t.x2-(t.x||0):0),e("y2",null!=t.y2?t.y2-(t.y||0):0)},bound:function(e,t){var n,i;return yx(e.set(n=t.x||0,i=t.y||0,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i),t)},draw:function(e,t,n){tE(t,t=>{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&LE(e,t,i)&&(Hx(e,t),e.stroke())}})},pick:oE(function(e,t,n,i){return!!e.isPointInStroke&&(LE(e,t,1)&&e.isPointInStroke(n,i))}),isect:function(e,t){const n=e.x||0,i=e.y||0;return Gx(t,n,i,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i)}},BE=hE("shape",function(e,t){return(t.mark.shape||t.shape).context(e)(t)}),$E=hE("symbol",function(e,t){return sx.context(e)(t)},jx);const UE=function(e){let t,n,i;e=+e||1e4;const r=()=>{t={},n={},i=0},s=(r,s)=>(++i>e&&(n=t,t={},i=1),t[r]=s);return r(),{clear:r,has:e=>nh(t,e)||nh(n,e),get:e=>nh(t,e)?t[e]:nh(n,e)?s(e,n[e]):void 0,set:(e,n)=>nh(t,e)?t[e]=n:s(e,n)}}();var zE={height:WE,measureWidth:GE,estimateWidth:jE,width:jE,canvas:VE};function VE(e){zE.width=e&&Ux?GE:jE}function jE(e,t){return YE(ZE(e,t),WE(e))}function YE(e,t){return~~(.8*e.length*t)}function GE(e,t){return WE(e)<=0||!(t=ZE(e,t))?0:HE(t,JE(e))}function HE(e,t){const n=`(${t}) ${e}`;let i=UE.get(n);return void 0===i&&(Ux.font=t,i=Ux.measureText(e).width,UE.set(n,i)),i}function WE(e){return null!=e.fontSize?+e.fontSize||0:11}function XE(e){return null!=e.lineHeight?e.lineHeight:WE(e)+2}function qE(e){return t=e.lineBreak&&e.text&&!qd(e.text)?e.text.split(e.lineBreak):e.text,qd(t)?t.length>1?t:t[0]:t;var t}function KE(e){const t=qE(e);return(qd(t)?t.length-1:0)*XE(e)}function ZE(e,t){const n=null==t?"":(t+"").trim();return e.limit>0&&n.length?function(e,t){var n=+e.limit,i=function(e){if(zE.width===GE){const t=JE(e);return e=>HE(e,t)}if(zE.width===jE){const t=WE(e);return e=>YE(e,t)}return t=>zE.width(e,t)}(e);if(i(t)<n)return t;var r,s=e.ellipsis||"…",o="rtl"===e.dir,a=0,l=t.length;if(n-=i(s),o){for(;a<l;)r=a+l>>>1,i(t.slice(r))>n?a=r+1:l=r;return s+t.slice(a)}for(;a<l;)r=1+(a+l>>>1),i(t.slice(0,r))<n?a=r:l=r-1;return t.slice(0,a)+s}(e,n):n}function QE(e,t){var n=e.font;return(t&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function JE(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+WE(e)+"px "+QE(e,t)}function ew(e){var t=e.baseline,n=WE(e);return Math.round("top"===t?.79*n:"middle"===t?.3*n:"bottom"===t?-.21*n:"line-top"===t?.29*n+.5*XE(e):"line-bottom"===t?.29*n-.5*XE(e):0)}VE(!0);const tw={left:"start",center:"middle",right:"end"},nw=new dx;function iw(e){var t,n=e.x||0,i=e.y||0,r=e.radius||0;return r&&(t=(e.theta||0)-CT,n+=r*Math.cos(t),i+=r*Math.sin(t)),nw.x1=n,nw.y1=i,nw}function rw(e,t,n){var i,r=zE.height(t),s=t.align,o=iw(t),a=o.x1,l=o.y1,u=t.dx||0,c=(t.dy||0)+ew(t)-Math.round(.8*r),d=qE(t);if(qd(d)?(r+=XE(t)*(d.length-1),i=d.reduce((e,n)=>Math.max(e,zE.width(t,n)),0)):i=zE.width(t,d),"center"===s?u-=i/2:"right"===s&&(u-=i),e.set(u+=a,c+=l,u+i,c+r),t.angle&&!n)e.rotate(t.angle*ST,a,l);else if(2===n)return e.rotatedPoints(t.angle*ST,a,l);return e}var sw={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+ew(t),s=iw(t),o=s.x1,a=s.y1,l=t.angle||0;e("text-anchor",tw[t.align]||"start"),l?(n=uE(o,a)+" "+cE(l),(i||r)&&(n+=" "+uE(i,r))):n=uE(o+i,a+r),e("transform",n)},bound:rw,draw:function(e,t,n){tE(t,t=>{var i,r,s,o,a,l,u,c=null==t.opacity?1:t.opacity;if(!(n&&!n.intersects(t.bounds)||0===c||t.fontSize<=0||null==t.text||0===t.text.length)){if(e.font=JE(t),e.textAlign=t.align||"left",r=(i=iw(t)).x1,s=i.y1,t.angle&&(e.save(),e.translate(r,s),e.rotate(t.angle*ST),r=s=0),r+=t.dx||0,s+=(t.dy||0)+ew(t),l=qE(t),Hx(e,t),qd(l))for(a=XE(t),o=0;o<l.length;++o)u=ZE(t,l[o]),t.fill&&Kx(e,t,c)&&e.fillText(u,r,s),t.stroke&&Qx(e,t,c)&&e.strokeText(u,r,s),s+=a;else u=ZE(t,l),t.fill&&Kx(e,t,c)&&e.fillText(u,r,s),t.stroke&&Qx(e,t,c)&&e.strokeText(u,r,s);t.angle&&e.restore()}})},pick:oE(function(e,t,n,i,r,s){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var o=iw(t),a=o.x1,l=o.y1,u=rw(nw,t,1),c=-t.angle*ST,d=Math.cos(c),h=Math.sin(c),p=d*r-h*s+(a-d*a+h*l),f=h*r+d*s+(l-h*a-d*l);return u.contains(p,f)}),isect:function(e,t){const n=rw(nw,e,2);return Gx(t,n[0],n[1],n[2],n[3])||Gx(t,n[0],n[1],n[4],n[5])||Gx(t,n[4],n[5],n[6],n[7])||Gx(t,n[2],n[3],n[6],n[7])}},ow=fE("trail",function(e,t){return ox.context(e)(t)},function(e,t){for(var n,i,r=e.length;--r>=0;)if(!1!==e[r].defined&&(n=e[r].x-t[0])*n+(i=e[r].y-t[1])*i<(n=e[r].size||1)*n)return e[r];return null}),aw={arc:pE,area:mE,group:EE,image:ME,line:RE,path:NE,rect:FE,rule:PE,shape:BE,symbol:$E,text:sw,trail:ow};function lw(e,t,n){return!e&&"undefined"!=typeof document&&document.createElement&&(e=document),e?n?e.createElementNS(n,t):e.createElement(t):null}function uw(e,t){t=t.toLowerCase();for(var n=e.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===t)return n[i]}function cw(e,t,n,i){var r,s=e.childNodes[t];return s&&s.tagName.toLowerCase()===n.toLowerCase()||(r=s||null,s=lw(e.ownerDocument,n,i),e.insertBefore(s,r)),s}function dw(e,t){for(var n=e.childNodes,i=n.length;i>t;)e.removeChild(n[--i]);return e}function hw(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function pw(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}class fw{constructor(e,t){this._active=null,this._handlers={},this._loader=e||ey(),this._tooltip=t||mw}initialize(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()}scene(e){return arguments.length?(this._scene=e,this):this._scene}on(){}off(){}_handlerIndex(e,t,n){for(let i=e?e.length:0;--i>=0;)if(e[i].type===t&&(!n||e[i].handler===n))return i;return-1}handlers(e){const t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(const e in t)n.push(...t[e]);return n}eventName(e){const t=e.indexOf(".");return t<0?e:e.slice(0,t)}handleHref(e,t,n){this._loader.sanitize(n,{context:"href"}).then(t=>{const n=new MouseEvent(e.type,e),i=lw(null,"a");for(const e in t)i.setAttribute(e,t[e]);i.dispatchEvent(n)}).catch(()=>{})}handleTooltip(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,i){var r,s,o=e&&e.mark;if(o&&(r=aw[o.marktype]).tip){for((s=pw(t,n))[0]-=i[0],s[1]-=i[1];e=e.mark.group;)s[0]-=e.x||0,s[1]-=e.y||0;e=r.tip(o.items,s)}return e}(t,e,this.canvas(),this._origin);const i=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,i)}}getItemBoundingClientRect(e){const t=this.canvas();if(!t)return;const n=t.getBoundingClientRect(),i=this._origin,r=e.bounds,s=r.width(),o=r.height();let a=r.x1+i[0]+n.left,l=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)a+=e.x||0,l+=e.y||0;return{x:a,y:l,width:s,height:o,left:a,top:l,right:a+s,bottom:l+o}}}function mw(e,t,n,i){e.element().setAttribute("title",i||"")}class gw{constructor(e){this._el=null,this._bgcolor=null,this._loader=new fx(e)}initialize(e,t,n,i,r){return this._el=e,this.resize(t,n,i,r)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)}resize(e,t,n,i){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=i||1,this}dirty(){}render(e,t){const n=this;return n._call=function(){n._render(e,t)},n._call(),n._call=null,n}_render(){}renderAsync(e,t){const n=this.render(e,t);return this._ready?this._ready.then(()=>n):Promise.resolve(n)}_load(e,t){var n=this,i=n._loader[e](t);if(!n._ready){const e=n._call;n._ready=n._loader.ready().then(t=>{t&&e(),n._ready=null})}return i}sanitizeURL(e){return this._load("sanitizeURL",e)}loadImage(e){return this._load("loadImage",e)}}const yw="dragenter",_w="dragleave",vw="dragover",bw="pointerdown",Tw="pointermove",xw="pointerout",Ew="pointerover",ww="mousedown",Iw="mousemove",Aw="mouseout",Sw="mouseover",Cw="click",Ow="mousewheel",Mw="touchstart",Rw="touchmove",kw="touchend",Nw=["keydown","keypress","keyup",yw,_w,vw,bw,"pointerup",Tw,xw,Ew,ww,"mouseup",Iw,Aw,Sw,Cw,"dblclick","wheel",Ow,Mw,Rw,kw],Dw=Tw,Fw=Aw,Lw=Cw;class Pw extends fw{constructor(e,t){super(e,t),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=Nw,this.pointermove=zw([Tw,Iw],[Ew,Sw],[xw,Aw]),this.dragover=zw([vw],[yw],[_w]),this.pointerout=Vw([xw,Aw]),this.dragleave=Vw([_w])}initialize(e,t,n){return this._canvas=e&&uw(e,"canvas"),[Cw,ww,bw,Tw,xw,_w].forEach(e=>$w(this,e)),super.initialize(e,t,n)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(e){this.fire(Ow,e)}pointerdown(e){this._down=this._active,this.fire(bw,e)}mousedown(e){this._down=this._active,this.fire(ww,e)}click(e){this._down===this._active&&(this.fire(Cw,e),this._down=null)}touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(Mw,e,!0)}touchmove(e){this.fire(Rw,e,!0)}touchend(e){this.fire(kw,e,!0),this._touch=null}fire(e,t,n){const i=n?this._touch:this._active,r=this._handlers[e];if(t.vegaType=e,e===Lw&&i&&i.href?this.handleHref(t,i,i.href):e!==Dw&&e!==Fw||this.handleTooltip(t,i,e!==Fw),r)for(let e=0,n=r.length;e<n;++e)r[e].handler.call(this._obj,t,i)}on(e,t){const n=this.eventName(e),i=this._handlers;return this._handlerIndex(i[n],e,t)<0&&($w(this,e),(i[n]||(i[n]=[])).push({type:e,handler:t})),this}off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&i.splice(r,1),this}pickEvent(e){const t=pw(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])}pick(e,t,n,i,r){const s=this.context();return aw[e.marktype].pick.call(this,s,e,t,n,i,r)}}const Bw=e=>e===Mw||e===Rw||e===kw?[Mw,Rw,kw]:[e];function $w(e,t){Bw(t).forEach(t=>function(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}(e,t))}function Uw(e,t,n){t.forEach(t=>e.fire(t,n))}function zw(e,t,n){return function(i){const r=this._active,s=this.pickEvent(i);s===r||(r&&r.exit||Uw(this,n,i),this._active=s,Uw(this,t,i)),Uw(this,e,i)}}function Vw(e){return function(t){Uw(this,e,t),this._active=null}}function jw(e,t,n,i,r,s){const o="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,a=e.getContext("2d"),l=o?"undefined"!=typeof window&&window.devicePixelRatio||1:r;e.width=t*l,e.height=n*l;for(const e in s)a[e]=s[e];return o&&1!==l&&(e.style.width=t+"px",e.style.height=n+"px"),a.pixelRatio=l,a.setTransform(l,0,0,l,l*i[0],l*i[1]),e}class Yw extends gw{constructor(e){super(e),this._options={},this._redraw=!1,this._dirty=new dx,this._tempb=new dx}initialize(e,t,n,i,r,s){return this._options=s||{},this._canvas=this._options.externalContext?null:Tp(1,1,this._options.type),e&&this._canvas&&(dw(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(e,t,n,i,r)}resize(e,t,n,i){if(super.resize(e,t,n,i),this._canvas)jw(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||Yd("CanvasRenderer is missing a valid canvas or context"),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(e){const t=this._tempb.clear().union(e.bounds);let n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)}_render(e,t){const n=this.context(),i=this._origin,r=this._width,s=this._height,o=this._dirty,a=Gw(i,r,s);n.save();const l=this._redraw||o.empty()?(this._redraw=!1,a.expand(1)):function(e,t,n){t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio);return t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(n,a.intersect(o),i);return this.clear(-i[0],-i[1],r,s),this.draw(n,e,l,t),n.restore(),o.clear(),this}draw(e,t,n,i){if("group"!==t.marktype&&null!=i&&!i.includes(t.marktype))return;const r=aw[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),eh(n)?(e.beginPath(),n(e),e.clip()):gE(e,t.group)}(e,t),r.draw.call(this,e,t,n,i),t.clip&&e.restore()}clear(e,t,n,i){const r=this._options,s=this.context();"pdf"===r.type||r.externalContext||s.clearRect(e,t,n,i),null!=this._bgcolor&&(s.fillStyle=this._bgcolor,s.fillRect(e,t,n,i))}}const Gw=(e,t,n)=>(new dx).set(0,0,t,n).translate(-e[0],-e[1]);const Hw=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)},Ww="aria-hidden",Xw="aria-label",qw="role",Kw="aria-roledescription",Zw="graphics-object",Qw="graphics-symbol",Jw=(e,t,n)=>({[qw]:e,[Kw]:t,[Xw]:n||void 0}),eI=oh(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),tI={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?oI(e):null,r=e.context,s=r.scales[t.scale].value,o=r.dataflow.locale(),a=s.type,l="left"===n||"right"===n?"Y":"X";return`${l}-axis`+(i?` titled '${i}'`:"")+` for a ${Gb(a)?"discrete":a} scale`+` with ${pT(o,s,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?oI(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,s=Object.keys(r),o=e.context,a=o.scales[r[s[0]]].value,l=o.dataflow.locale();return function(e){return e.length?e[0].toUpperCase()+e.slice(1):e}(i)+(n?` titled '${n}'`:"")+` for ${function(e){return e=e.map(e=>e+("fill"===e||"stroke"===e?" color":"")),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+Zd(e)}(s)}`+` with ${pT(l,a,e)}`}},"title-text":{desc:"title",caption:e=>`Title text '${sI(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${sI(e)}'`}},nI={ariaRole:qw,ariaRoleDescription:Kw,description:Xw};function iI(e,t){const n=!1===t.aria;if(e(Ww,n||void 0),n||null==t.description)for(const t in nI)e(nI[t],void 0);else{const n=t.mark.marktype;e(Xw,t.description),e(qw,t.ariaRole||("group"===n?Zw:Qw)),e(Kw,t.ariaRoleDescription||`${n} mark`)}}function rI(e){return!1===e.aria?{[Ww]:!0}:eI[e.role]?null:tI[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return Jw(t.role||Qw,t.desc,n.description||i(n))}catch(e){return null}}(e,tI[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some(e=>null!=e.description&&!1!==e.aria);return Jw(n?Zw:Qw,`${t} mark container`,e.description)}(e)}function sI(e){return Jd(e.text).join(" ")}function oI(e){try{return Jd(Zd(e.items).items[0].text).join(" ")}catch(e){return null}}const aI=e=>(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function lI(){let e="",t="",n="";const i=[],r=()=>t=n="",s=(e,n)=>{var i;return null!=n&&(t+=` ${e}="${i=n,aI(i).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")}"`),o},o={open(a){(s=>{t&&(e+=`${t}>${n}`,r()),i.push(s)})(a),t="<"+a;for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c<l;c++)u[c-1]=arguments[c];for(const e of u)for(const t in e)s(t,e[t]);return o},close(){const s=i.pop();return e+=t?t+(n?`>${n}</${s}>`:"/>"):`</${s}>`,r(),o},attr:s,text:e=>(n+=aI(e),o),toString:()=>e};return o}const uI=e=>cI(lI(),e)+"";function cI(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let t=0;t<i;++t)e.attr(n[t].name,n[t].value)}if(t.hasChildNodes()){const n=t.childNodes;for(const t of n)3===t.nodeType?e.text(t.nodeValue):cI(e,t)}return e.close()}const dI={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},hI={blend:"mix-blend-mode"},pI={fill:"none","stroke-miterlimit":10},fI="http://www.w3.org/2000/xmlns/",mI=wE.xmlns;class gI extends gw{constructor(e){super(e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(e,t,n,i,r){return this._defs={},this._clearDefs(),e&&(this._svg=cw(e,0,"svg",mI),this._svg.setAttributeNS(fI,"xmlns",mI),this._svg.setAttributeNS(fI,"xmlns:xlink",wE["xmlns:xlink"]),this._svg.setAttribute("version",wE.version),this._svg.setAttribute("class","marks"),dw(e,1),this._root=cw(this._svg,0,"g",mI),AI(this._root,pI),dw(this._svg,1)),this.background(this._bgcolor),super.initialize(e,t,n,i,r)}background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),super.background(...arguments)}resize(e,t,n,i){return super.resize(e,t,n,i),this._svg&&(AI(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){const e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute("style"),n=cw(e,0,"rect",mI),AI(n,{width:this._width,height:this._height,fill:t}));const i=uI(e);return t&&(e.removeChild(n),this._svg.style.setProperty("background-color",t)),i}_render(e,t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e,void 0,t),dw(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))}isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;const e=this._dirty;if(!e.length||!this._dirtyID)return!0;const t=++this._dirtyID;let n,i,r,s,o,a,l;for(o=0,a=e.length;o<a;++o)n=e[o],i=n.mark,i.marktype!==r&&(r=i.marktype,s=aw[r]),i.zdirty&&i.dirty!==t&&(this._dirtyAll=!1,yI(n,t),i.items.forEach(e=>{e.dirty=t})),i.zdirty||(n.exit?(s.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(s,l._svg,l)):n._svg&&(l=n._svg.parentNode,l&&l.removeChild(n._svg)),n._svg=null):(n=s.nested?i.items[0]:n,n._update!==t&&(n._svg&&n._svg.ownerSVGElement?this._update(s,n._svg,n):(this._dirtyAll=!1,yI(n,t)),n._update=t)));return!this._dirtyAll}mark(e,t,n,i){if(!this.isDirty(t))return t._svg;const r=this._svg,s=t.marktype,o=aw[s],a=!1===t.interactive?"none":null,l="g"===o.tag,u=bI(t,e,n,"g",r);if("group"!==s&&null!=i&&!i.includes(s))return dw(u,0),t._svg;u.setAttribute("class",hw(t));const c=rI(t);for(const e in c)SI(u,e,c[e]);l||SI(u,"pointer-events",a),SI(u,"clip-path",t.clip?cx(this,t,t.group):null);let d=null,h=0;const p=e=>{const t=this.isDirty(e),n=bI(e,u,d,o.tag,r);t&&(this._update(o,n,e),l&&function(e,t,n,i){t=t.lastChild.previousSibling;let r,s=0;tE(n,n=>{r=e.mark(t,n,r,i),++s}),dw(t,1+s)}(this,n,e,i)),d=n,++h};return o.nested?t.items.length&&p(t.items[0]):tE(t,p),dw(u,h),u}_update(e,t,n){TI=t,xI=t.__values__,iI(wI,n),e.attr(wI,n,this);const i=EI[e.type];i&&i.call(this,e,t,n),TI&&this.style(TI,n)}style(e,t){if(null!=t){for(const n in dI){let i="font"===n?QE(t):t[n];if(i===xI[n])continue;const r=dI[n];null==i?e.removeAttribute(r):(gT(i)&&(i=yT(i,this._defs.gradient,CI())),e.setAttribute(r,i+"")),xI[n]=i}for(const n in hI)II(e,hI[n],t[n])}}defs(){const e=this._svg,t=this._defs;let n=t.el,i=0;for(const r in t.gradient)n||(t.el=n=cw(e,1,"defs",mI)),i=_I(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=cw(e,1,"defs",mI)),i=vI(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):dw(n,i))}_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}}function yI(e,t){for(;e&&e.dirty!==t;e=e.mark.group){if(e.dirty=t,!e.mark||e.mark.dirty===t)return;e.mark.dirty=t}}function _I(e,t,n){let i,r,s;if("radial"===t.gradient){let i=cw(e,n++,"pattern",mI);AI(i,{id:mT+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),i=cw(i,0,"rect",mI),AI(i,{width:1,height:1,fill:`url(${CI()}#${t.id})`}),AI(e=cw(e,n++,"radialGradient",mI),{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else AI(e=cw(e,n++,"linearGradient",mI),{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(i=0,r=t.stops.length;i<r;++i)s=cw(e,i,"stop",mI),s.setAttribute("offset",t.stops[i].offset),s.setAttribute("stop-color",t.stops[i].color);return dw(e,i),n}function vI(e,t,n){let i;return(e=cw(e,n,"clipPath",mI)).setAttribute("id",t.id),t.path?(i=cw(e,0,"path",mI),i.setAttribute("d",t.path)):(i=cw(e,0,"rect",mI),AI(i,{x:0,y:0,width:t.width,height:t.height})),dw(e,1),n+1}function bI(e,t,n,i,r){let s,o=e._svg;if(!o&&(s=t.ownerDocument,o=lw(s,i,mI),e._svg=o,e.mark&&(o.__data__=e,o.__values__={fill:"default"},"g"===i))){const t=lw(s,"path",mI);o.appendChild(t),t.__data__=e;const n=lw(s,"g",mI);o.appendChild(n),n.__data__=e;const i=lw(s,"path",mI);o.appendChild(i),i.__data__=e,i.__values__={fill:"default"}}return(o.ownerSVGElement!==r||function(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}(o,n))&&t.insertBefore(o,n?n.nextSibling:t.firstChild),o}let TI=null,xI=null;const EI={group(e,t,n){const i=TI=t.childNodes[2];xI=i.__values__,e.foreground(wI,n,this),xI=t.__values__,TI=t.childNodes[1],e.content(wI,n,this);const r=TI=t.childNodes[0];e.background(wI,n,this);const s=!1===n.mark.interactive?"none":null;if(s!==xI.events&&(SI(i,"pointer-events",s),SI(r,"pointer-events",s),xI.events=s),n.strokeForeground&&n.stroke){const e=n.fill;SI(i,"display",null),this.style(r,n),SI(r,"stroke",null),e&&(n.fill=null),xI=i.__values__,this.style(i,n),e&&(n.fill=e),TI=null}else SI(i,"display","none")},image(e,t,n){!1===n.smooth?(II(t,"image-rendering","optimizeSpeed"),II(t,"image-rendering","pixelated")):II(t,"image-rendering",null)},text(e,t,n){const i=qE(n);let r,s,o,a;qd(i)?(s=i.map(e=>ZE(n,e)),r=s.join("\n"),r!==xI.text&&(dw(t,0),o=t.ownerDocument,a=XE(n),s.forEach((e,i)=>{const r=lw(o,"tspan",mI);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",a)),t.appendChild(r)}),xI.text=r)):(s=ZE(n,i),s!==xI.text&&(t.textContent=s,xI.text=s)),SI(t,"font-family",QE(n)),SI(t,"font-size",WE(n)+"px"),SI(t,"font-style",n.fontStyle),SI(t,"font-variant",n.fontVariant),SI(t,"font-weight",n.fontWeight)}};function wI(e,t,n){t!==xI[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(TI,e,t,n):SI(TI,e,t),xI[e]=t)}function II(e,t,n){n!==xI[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),xI[t]=n)}function AI(e,t){for(const n in t)SI(e,n,t[n])}function SI(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function CI(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}const OI={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};class MI extends gw{constructor(e){super(e),this._svgRenderer=new gI(e),this._canvasRenderer=new Yw(e)}initialize(e,t,n,i,r){this._root_el=cw(e,0,"div");const s=cw(this._root_el,0,"div"),o=cw(this._root_el,1,"div");return this._root_el.style.position="relative",OI.debug||(s.style.height="100%",o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.height="100%",o.style.width="100%"),this._svgEl=OI.svgOnTop?o:s,this._canvasEl=OI.svgOnTop?s:o,this._svgEl.style.pointerEvents="none",this._canvasRenderer.initialize(this._canvasEl,t,n,i,r),this._svgRenderer.initialize(this._svgEl,t,n,i,r),super.initialize(e,t,n,i,r)}dirty(e){return OI.svgMarkTypes.includes(e.mark.marktype)?this._svgRenderer.dirty(e):this._canvasRenderer.dirty(e),this}_render(e,t){const n=(t??["arc","area","image","line","path","rect","rule","shape","symbol","text","trail"]).filter(e=>!OI.svgMarkTypes.includes(e));this._svgRenderer.render(e,OI.svgMarkTypes),this._canvasRenderer.render(e,n)}resize(e,t,n,i){return super.resize(e,t,n,i),this._svgRenderer.resize(e,t,n,i),this._canvasRenderer.resize(e,t,n,i),this}background(e){return OI.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}}const RI="canvas",kI="hybrid",NI="none",DI={};DI[RI]=DI.png={renderer:Yw,headless:Yw,handler:Pw},DI.svg={renderer:gI,headless:class extends gw{constructor(e){super(e),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(e){const t=lI();t.open("svg",th({},wE,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&t.open("rect",{width:this._width,height:this._height,fill:n}).close(),t.open("g",pI,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this}mark(e,t){const n=aw[t.marktype],i=n.tag,r=[iI,n.attr];e.open("g",{class:hw(t),"clip-path":t.clip?cx(this,t,t.group):null},rI(t),{"pointer-events":"g"!==i&&!1===t.interactive?"none":null});const s=s=>{const o=this.href(s);if(o&&e.open("a",o),e.open(i,this.attr(t,s,r,"g"!==i?i:null)),"text"===i){const t=qE(s);if(qd(t)){const n={x:0,dy:XE(s)};for(let i=0;i<t.length;++i)e.open("tspan",i?n:null).text(ZE(s,t[i])).close()}else e.text(ZE(s,t))}else if("g"===i){const i=s.strokeForeground,r=s.fill,o=s.stroke;i&&o&&(s.stroke=null),e.open("path",this.attr(t,s,n.background,"bgrect")).close(),e.open("g",this.attr(t,s,n.content)),tE(s,t=>this.mark(e,t)),e.close(),i&&o?(r&&(s.fill=null),s.stroke=o,e.open("path",this.attr(t,s,n.foreground,"bgrect")).close(),r&&(s.fill=r)):e.open("path",this.attr(t,s,n.foreground,"bgfore")).close()}e.close(),o&&e.close()};return n.nested?t.items&&t.items.length&&s(t.items[0]):tE(t,s),e.close()}href(e){const t=e.href;let n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then(e=>{e["xlink:href"]=e.href,e.href=null,(this._hrefs||(this._hrefs={}))[t]=e})}return null}attr(e,t,n,i){const r={},s=(e,t,n,i)=>{r[i||e]=t};return Array.isArray(n)?n.forEach(e=>e(s,t,this)):n(s,t,this),i&&function(e,t,n,i,r){let s;if(null==t)return e;"bgrect"===i&&!1===n.interactive&&(e["pointer-events"]="none");if("bgfore"===i&&(!1===n.interactive&&(e["pointer-events"]="none"),e.display="none",null!==t.fill))return e;"image"===i&&!1===t.smooth&&(s=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]);"text"===i&&(e["font-family"]=QE(t),e["font-size"]=WE(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const n in dI){let i=t[n];const s=dI[n];("transparent"!==i||"fill"!==s&&"stroke"!==s)&&null!=i&&(gT(i)&&(i=yT(i,r.gradient,"")),e[s]=i)}for(const e in hI){const n=t[e];null!=n&&(s=s||[],s.push(`${hI[e]}: ${n};`))}s&&(e.style=s.join(" "))}(r,t,e,i,this._defs),r}defs(e){const t=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(t).length+Object.keys(n).length){e.open("defs");for(const n in t){const i=t[n],r=i.stops;"radial"===i.gradient?(e.open("pattern",{id:mT+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),e.close(),e.open("radialGradient",{id:n,fx:i.x1,fy:i.y1,fr:i.r1,cx:i.x2,cy:i.y2,r:i.r2})):e.open("linearGradient",{id:n,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2});for(let t=0;t<r.length;++t)e.open("stop",{offset:r[t].offset,"stop-color":r[t].color}).close();e.close()}for(const t in n){const i=n[t];e.open("clipPath",{id:t}),i.path?e.open("path",{d:i.path}).close():e.open("rect",{x:0,y:0,width:i.width,height:i.height}).close(),e.close()}e.close()}}},handler:class extends fw{constructor(e,t){super(e,t);const n=this;n._hrefHandler=Hw(n,(e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)}),n._tooltipHandler=Hw(n,(e,t)=>{n.handleTooltip(e,t,e.type!==Fw)})}initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(Lw,this._hrefHandler),i.removeEventListener(Dw,this._tooltipHandler),i.removeEventListener(Fw,this._tooltipHandler)),this._svg=i=e&&uw(e,"svg"),i&&(i.addEventListener(Lw,this._hrefHandler),i.addEventListener(Dw,this._tooltipHandler),i.addEventListener(Fw,this._tooltipHandler)),super.initialize(e,t,n)}canvas(){return this._svg}on(e,t){const n=this.eventName(e),i=this._handlers;if(this._handlerIndex(i[n],e,t)<0){const r={type:e,handler:t,listener:Hw(this,t)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this}off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this}}},DI[kI]={renderer:MI,headless:MI,handler:class extends Pw{constructor(e,t){super(e,t)}initialize(e,t,n){const i=cw(cw(e,0,"div"),OI.svgOnTop?0:1,"div");return super.initialize(i,t,n)}}},DI[NI]={};const FI=new dx;const LI="top",PI="left",BI="right",$I="bottom",UI="start",zI="middle",VI="end",jI="group",YI="axis",GI="title",HI="frame",WI="scope",XI="legend",qI="row-header",KI="row-footer",ZI="row-title",QI="column-header",JI="column-footer",eA="column-title",tA="padding",nA="fit",iA="fit-x",rA="fit-y",sA="none",oA="all",aA="each",lA="flush",uA="column",cA="row";function dA(e){Ho.call(this,null,e)}function hA(e,t,n){return t(e.bounds.clear(),e,n)}ih(dA,Ho,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,s=aw[r],o=s.bound;let a,l=i.bounds;if(s.nested)i.items.length&&n.dirty(i.items[0]),l=hA(i,o),i.items.forEach(e=>{e.bounds.clear().union(l)});else if(r===jI||e.modified())switch(t.visit(t.MOD,e=>n.dirty(e)),l.clear(),i.items.forEach(e=>l.union(hA(e,o))),i.role){case YI:case XI:case GI:t.reflow()}else a=t.changed(t.REM),t.visit(t.ADD,e=>{l.union(hA(e,o))}),t.visit(t.MOD,e=>{a=a||l.alignsWith(e.bounds),n.dirty(e),l.union(hA(e,o))}),a&&(l.clear(),i.items.forEach(e=>l.union(e.bounds)));return function(e){const t=e.clip;if(eh(t))t(Fx(FI.clear()));else{if(!t)return;FI.set(0,0,e.group.width,e.group.height)}e.bounds.intersect(FI)}(i),t.modifies("bounds")}});const pA=":vega_identifier:";function fA(e){Ho.call(this,0,e)}function mA(e){Ho.call(this,null,e)}function gA(e){Ho.call(this,null,e)}fA.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},ih(fA,Ho,{transform(e,t){const n=(r=t.dataflow)._signals[pA]||(r._signals[pA]=r.add(0)),i=e.as;var r;let s=n.value;return t.visit(t.ADD,e=>e[i]=e[i]||++s),n.set(this.value=s),t}}),ih(mA,Ho,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,function(e){const t=e.groups,n=e.parent;return t&&1===t.size?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const i=n.marktype===jI?px:hx;return t.visit(t.ADD,e=>i.call(e,n)),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});const yA={parity:e=>e.filter((e,t)=>t%2?e.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((e,i)=>i&&_A(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1))}},_A=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),vA=(e,t)=>{for(var n,i=1,r=e.length,s=e[0].bounds;i<r;s=n,++i)if(_A(s,n=e[i].bounds,t))return!0},bA=e=>{const t=e.bounds;return t.width()>1&&t.height()>1},TA=e=>(e.forEach(e=>e.opacity=1),e),xA=(e,t)=>e.reflow(t.modified()).modifies("opacity");function EA(e){Ho.call(this,null,e)}ih(gA,Ho,{transform(e,t){const n=yA[e.method]||yA.parity,i=e.separation||0;let r,s,o=t.materialize(t.SOURCE).source;if(!o||!o.length)return;if(!e.method)return e.modified("method")&&(TA(o),t=xA(t,e)),t;if(o=o.filter(bA),!o.length)return;if(e.sort&&(o=o.slice().sort(e.sort)),r=TA(o),t=xA(t,e),r.length>=3&&vA(r,i)){do{r=n(r,i)}while(r.length>=3&&vA(r,i));r.length<3&&!Zd(o).opacity&&(r.length>1&&(Zd(r).opacity=0),Zd(o).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(s=((e,t,n)=>{var i=e.range(),r=new dx;return t===LI||t===$I?r.set(i[0],-1/0,i[1],1/0):r.set(-1/0,i[0],1/0,i[1]),r.expand(n||1),e=>r.encloses(e.bounds)})(e.boundScale,e.boundOrient,+e.boundTolerance),o.forEach(e=>{s(e)||(e.opacity=0)}));const a=r[0].mark.bounds.clear();return o.forEach(e=>{e.opacity&&a.union(e.bounds)}),t}}),ih(EA,Ho,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,e=>n.dirty(e)),t.fields&&t.fields.zindex){const e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}});const wA=new dx;function IA(e,t,n){return e[t]===n?0:(e[t]=n,1)}function AA(e){var t=e.items[0].orient;return t===PI||t===BI}function SA(e,t,n,i){var r,s,o=t.items[0],a=o.datum,l=null!=o.translate?o.translate:.5,u=o.orient,c=function(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(a),d=o.range,h=o.offset,p=o.position,f=o.minExtent,m=o.maxExtent,g=a.title&&o.items[c[2]].items[0],y=o.titlePadding,_=o.bounds,v=g&&KE(g),b=0,T=0;switch(wA.clear().union(_),_.clear(),(r=c[0])>-1&&_.union(o.items[r].bounds),(r=c[1])>-1&&_.union(o.items[r].bounds),u){case LI:b=p||0,T=-h,s=Math.max(f,Math.min(m,-_.y1)),_.add(0,-s).add(d,0),g&&CA(e,g,s,y,v,0,-1,_);break;case PI:b=-h,T=p||0,s=Math.max(f,Math.min(m,-_.x1)),_.add(-s,0).add(0,d),g&&CA(e,g,s,y,v,1,-1,_);break;case BI:b=n+h,T=p||0,s=Math.max(f,Math.min(m,_.x2)),_.add(0,0).add(s,d),g&&CA(e,g,s,y,v,1,1,_);break;case $I:b=p||0,T=i+h,s=Math.max(f,Math.min(m,_.y2)),_.add(0,0).add(d,s),g&&CA(e,g,s,y,0,0,1,_);break;default:b=o.x,T=o.y}return yx(_.translate(b,T),o),IA(o,"x",b+l)|IA(o,"y",T+l)&&(o.bounds=wA,e.dirty(o),o.bounds=_,e.dirty(o)),o.mark.bounds.clear().union(_)}function CA(e,t,n,i,r,s,o,a){const l=t.bounds;if(t.auto){const a=o*(n+r+i);let u=0,c=0;e.dirty(t),s?u=(t.x||0)-(t.x=a):c=(t.y||0)-(t.y=a),t.mark.bounds.clear().union(l.translate(-u,-c)),e.dirty(t)}a.union(l)}const OA=(e,t)=>Math.floor(Math.min(e,t)),MA=(e,t)=>Math.ceil(Math.max(e,t));function RA(e){return(new dx).set(0,0,e.width||0,e.height||0)}function kA(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function NA(e,t,n){const i=Kd(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function DA(e){return e<0?Math.ceil(-e):0}function FA(e,t,n){var i,r,s,o,a,l,u,c,d,h,p,f=!n.nodirty,m=n.bounds===lA?RA:kA,g=wA.set(0,0,0,0),y=NA(n.align,uA),_=NA(n.align,cA),v=NA(n.padding,uA),b=NA(n.padding,cA),T=n.columns||t.length,x=T<=0?1:Math.ceil(t.length/T),E=t.length,w=Array(E),I=Array(T),A=0,S=Array(E),C=Array(x),O=0,M=Array(E),R=Array(E),k=Array(E);for(r=0;r<T;++r)I[r]=0;for(r=0;r<x;++r)C[r]=0;for(r=0;r<E;++r)l=t[r],a=k[r]=m(l),l.x=l.x||0,M[r]=0,l.y=l.y||0,R[r]=0,s=r%T,o=~~(r/T),A=Math.max(A,u=Math.ceil(a.x2)),O=Math.max(O,c=Math.ceil(a.y2)),I[s]=Math.max(I[s],u),C[o]=Math.max(C[o],c),w[r]=v+DA(a.x1),S[r]=b+DA(a.y1),f&&e.dirty(t[r]);for(r=0;r<E;++r)r%T===0&&(w[r]=0),r<T&&(S[r]=0);if(y===aA)for(s=1;s<T;++s){for(p=0,r=s;r<E;r+=T)p<w[r]&&(p=w[r]);for(r=s;r<E;r+=T)w[r]=p+I[s-1]}else if(y===oA){for(p=0,r=0;r<E;++r)r%T&&p<w[r]&&(p=w[r]);for(r=0;r<E;++r)r%T&&(w[r]=p+A)}else for(y=!1,s=1;s<T;++s)for(r=s;r<E;r+=T)w[r]+=I[s-1];if(_===aA)for(o=1;o<x;++o){for(p=0,i=(r=o*T)+T;r<i;++r)p<S[r]&&(p=S[r]);for(r=o*T;r<i;++r)S[r]=p+C[o-1]}else if(_===oA){for(p=0,r=T;r<E;++r)p<S[r]&&(p=S[r]);for(r=T;r<E;++r)S[r]=p+O}else for(_=!1,o=1;o<x;++o)for(i=(r=o*T)+T;r<i;++r)S[r]+=C[o-1];for(d=0,r=0;r<E;++r)d=w[r]+(r%T?d:0),M[r]+=d-t[r].x;for(s=0;s<T;++s)for(h=0,r=s;r<E;r+=T)h+=S[r],R[r]+=h-t[r].y;if(y&&NA(n.center,uA)&&x>1)for(r=0;r<E;++r)(d=(a=y===oA?A:I[r%T])-k[r].x2-t[r].x-M[r])>0&&(M[r]+=d/2);if(_&&NA(n.center,cA)&&1!==T)for(r=0;r<E;++r)(h=(a=_===oA?O:C[~~(r/T)])-k[r].y2-t[r].y-R[r])>0&&(R[r]+=h/2);for(r=0;r<E;++r)g.union(k[r].translate(M[r],R[r]));switch(d=NA(n.anchor,"x"),h=NA(n.anchor,"y"),NA(n.anchor,uA)){case VI:d-=g.width();break;case zI:d-=g.width()/2}switch(NA(n.anchor,cA)){case VI:h-=g.height();break;case zI:h-=g.height()/2}for(d=Math.round(d),h=Math.round(h),g.clear(),r=0;r<E;++r)t[r].mark.bounds.clear();for(r=0;r<E;++r)(l=t[r]).x+=M[r]+=d,l.y+=R[r]+=h,g.union(l.mark.bounds.union(l.bounds.translate(M[r],R[r]))),f&&e.dirty(l);return g}function LA(e,t,n){var i,r,s,o,a,l,u,c=function(e){var t,n,i=e.items,r=i.length,s=0;const o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;s<r;++s)if(n=(t=i[s]).items,t.marktype===jI)switch(t.role){case YI:case XI:case GI:break;case qI:o.rowheaders.push(...n);break;case KI:o.rowfooters.push(...n);break;case QI:o.colheaders.push(...n);break;case JI:o.colfooters.push(...n);break;case ZI:o.rowtitle=n[0];break;case eA:o.coltitle=n[0];break;default:o.marks.push(...n)}return o}(t),d=c.marks,h=n.bounds===lA?PA:BA,p=n.offset,f=n.columns||d.length,m=f<=0?1:Math.ceil(d.length/f),g=m*f;const y=FA(e,d,n);y.empty()&&y.set(0,0,0,0),c.rowheaders&&(l=NA(n.headerBand,cA,null),i=$A(e,c.rowheaders,d,f,m,-NA(p,"rowHeader"),OA,0,h,"x1",0,f,1,l)),c.colheaders&&(l=NA(n.headerBand,uA,null),r=$A(e,c.colheaders,d,f,f,-NA(p,"columnHeader"),OA,1,h,"y1",0,1,f,l)),c.rowfooters&&(l=NA(n.footerBand,cA,null),s=$A(e,c.rowfooters,d,f,m,NA(p,"rowFooter"),MA,0,h,"x2",f-1,f,1,l)),c.colfooters&&(l=NA(n.footerBand,uA,null),o=$A(e,c.colfooters,d,f,f,NA(p,"columnFooter"),MA,1,h,"y2",g-f,1,f,l)),c.rowtitle&&(a=NA(n.titleAnchor,cA),u=NA(p,"rowTitle"),u=a===VI?s+u:i-u,l=NA(n.titleBand,cA,.5),UA(e,c.rowtitle,u,0,y,l)),c.coltitle&&(a=NA(n.titleAnchor,uA),u=NA(p,"columnTitle"),u=a===VI?o+u:r-u,l=NA(n.titleBand,uA,.5),UA(e,c.coltitle,u,1,y,l))}function PA(e,t){return"x1"===t?e.x||0:"y1"===t?e.y||0:"x2"===t?(e.x||0)+(e.width||0):"y2"===t?(e.y||0)+(e.height||0):void 0}function BA(e,t){return e.bounds[t]}function $A(e,t,n,i,r,s,o,a,l,u,c,d,h,p){var f,m,g,y,_,v,b,T,x,E=n.length,w=0,I=0;if(!E)return w;for(f=c;f<E;f+=d)n[f]&&(w=o(w,l(n[f],u)));if(!t.length)return w;for(t.length>r&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),w+=s,m=0,y=t.length;m<y;++m)e.dirty(t[m]),t[m].mark.bounds.clear();for(f=c,m=0,y=t.length;m<y;++m,f+=d){for(_=(v=t[m]).mark.bounds,g=f;g>=0&&null==(b=n[g]);g-=h);a?(T=null==p?b.x:Math.round(b.bounds.x1+p*b.bounds.width()),x=w):(T=w,x=null==p?b.y:Math.round(b.bounds.y1+p*b.bounds.height())),_.union(v.bounds.translate(T-(v.x||0),x-(v.y||0))),v.x=T,v.y=x,e.dirty(v),I=o(I,_[u])}return I}function UA(e,t,n,i,r,s){if(t){e.dirty(t);var o=n,a=n;i?o=Math.round(r.x1+s*r.width()):a=Math.round(r.y1+s*r.height()),t.bounds.translate(o-(t.x||0),a-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=o,t.y=a,e.dirty(t)}}function zA(e,t,n,i,r,s,o){const a=function(e,t){const n=e[t]||{};return(t,i)=>null!=n[t]?n[t]:null!=e[t]?e[t]:i}(n,t),l=function(e,t){let n=-1/0;return e.forEach(e=>{null!=e.offset&&(n=Math.max(n,e.offset))}),n>-1/0?n:t}(e,a("offset",0)),u=a("anchor",UI),c=u===VI?1:u===zI?.5:0,d={align:aA,bounds:a("bounds",lA),columns:"vertical"===a("direction")?1:e.length,padding:a("margin",8),center:a("center"),nodirty:!0};switch(t){case PI:d.anchor={x:Math.floor(i.x1)-l,column:VI,y:c*(o||i.height()+2*i.y1),row:u};break;case BI:d.anchor={x:Math.ceil(i.x2)+l,y:c*(o||i.height()+2*i.y1),row:u};break;case LI:d.anchor={y:Math.floor(r.y1)-l,row:VI,x:c*(s||r.width()+2*r.x1),column:u};break;case $I:d.anchor={y:Math.ceil(r.y2)+l,x:c*(s||r.width()+2*r.x1),column:u};break;case"top-left":d.anchor={x:l,y:l};break;case"top-right":d.anchor={x:s-l,y:l,column:VI};break;case"bottom-left":d.anchor={x:l,y:o-l,row:VI};break;case"bottom-right":d.anchor={x:s-l,y:o-l,column:VI,row:VI}}return d}function VA(e,t){var n,i,r=t.items[0],s=r.datum,o=r.orient,a=r.bounds,l=r.x,u=r.y;return r._bounds?r._bounds.clear().union(a):r._bounds=a.clone(),a.clear(),function(e,t,n){var i=t.padding,r=i-n.x,s=i-n.y;if(t.datum.title){var o=t.items[1].items[0],a=o.anchor,l=t.titlePadding||0,u=i-o.x,c=i-o.y;switch(o.orient){case PI:r+=Math.ceil(o.bounds.width())+l;break;case BI:case $I:break;default:s+=o.bounds.height()+l}switch((r||s)&&YA(e,n,r,s),o.orient){case PI:c+=jA(t,n,o,a,1,1);break;case BI:u+=jA(t,n,o,VI,0,0)+l,c+=jA(t,n,o,a,1,1);break;case $I:u+=jA(t,n,o,a,0,0),c+=jA(t,n,o,VI,-1,0,1)+l;break;default:u+=jA(t,n,o,a,0,0)}(u||c)&&YA(e,o,u,c),(u=Math.round(o.bounds.x1-i))<0&&(YA(e,n,-u,0),YA(e,o,-u,0))}else(r||s)&&YA(e,n,r,s)}(e,r,r.items[0].items[0]),a=function(e,t){return e.items.forEach(e=>t.union(e.bounds)),t.x1=e.padding,t.y1=e.padding,t}(r,a),n=2*r.padding,i=2*r.padding,a.empty()||(n=Math.ceil(a.width()+n),i=Math.ceil(a.height()+i)),"symbol"===s.type&&function(e){const t=e.reduce((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e),{});e.forEach(e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y})}(r.items[0].items[0].items[0].items),o!==sA&&(r.x=l=0,r.y=u=0),r.width=n,r.height=i,yx(a.set(l,u,l+n,u+i),r),r.mark.bounds.clear().union(a),r}function jA(e,t,n,i,r,s,o){const a="symbol"!==e.datum.type,l=n.datum.vgrad,u=(!a||!s&&l||o?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,c=l&&s?u:0,d=l&&s?0:u,h=r<=0?0:KE(n);return Math.round(i===UI?c:i===VI?d-h:.5*(u-h))}function YA(e,t,n,i){t.x+=n,t.y+=i,t.bounds.translate(n,i),t.mark.bounds.translate(n,i),e.dirty(t)}function GA(e){Ho.call(this,null,e)}ih(GA,Ho,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach(t=>{e.layout&&LA(n,t,e.layout),function(e,t,n){var i,r,s,o,a,l=t.items,u=Math.max(0,t.width||0),c=Math.max(0,t.height||0),d=(new dx).set(0,0,u,c),h=d.clone(),p=d.clone(),f=[];for(o=0,a=l.length;o<a;++o)switch((r=l[o]).role){case YI:(AA(r)?h:p).union(SA(e,r,u,c));break;case GI:i=r;break;case XI:f.push(VA(e,r));break;case HI:case WI:case qI:case KI:case ZI:case QI:case JI:case eA:h.union(r.bounds),p.union(r.bounds);break;default:d.union(r.bounds)}if(f.length){const t={};f.forEach(e=>{(s=e.orient||BI)!==sA&&(t[s]||(t[s]=[])).push(e)});for(const i in t){const r=t[i];FA(e,r,zA(r,i,n.legends,h,p,u,c))}f.forEach(t=>{const i=t.bounds;if(i.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=i,e.dirty(t)),!n.autosize||n.autosize.type!==nA&&n.autosize.type!==iA&&n.autosize.type!==rA)d.union(i);else switch(t.orient){case PI:case BI:d.add(i.x1,0).add(i.x2,0);break;case LI:case $I:d.add(0,i.y1).add(0,i.y2)}})}d.union(h).union(p),i&&d.union(function(e,t,n,i,r){var s,o=t.items[0],a=o.frame,l=o.orient,u=o.anchor,c=o.offset,d=o.padding,h=o.items[0].items[0],p=o.items[1]&&o.items[1].items[0],f=l===PI||l===BI?i:n,m=0,g=0,y=0,_=0,v=0;if(a!==jI?l===PI?(m=r.y2,f=r.y1):l===BI?(m=r.y1,f=r.y2):(m=r.x1,f=r.x2):l===PI&&(m=i,f=0),s=u===UI?m:u===VI?f:(m+f)/2,p&&p.text){switch(l){case LI:case $I:v=h.bounds.height()+d;break;case PI:_=h.bounds.width()+d;break;case BI:_=-h.bounds.width()-d}wA.clear().union(p.bounds),wA.translate(_-(p.x||0),v-(p.y||0)),IA(p,"x",_)|IA(p,"y",v)&&(e.dirty(p),p.bounds.clear().union(wA),p.mark.bounds.clear().union(wA),e.dirty(p)),wA.clear().union(p.bounds)}else wA.clear();switch(wA.union(h.bounds),l){case LI:g=s,y=r.y1-wA.height()-c;break;case PI:g=r.x1-wA.width()-c,y=s;break;case BI:g=r.x2+wA.width()+c,y=s;break;case $I:g=s,y=r.y2+c;break;default:g=o.x,y=o.y}return IA(o,"x",g)|IA(o,"y",y)&&(wA.translate(g,y),e.dirty(o),o.bounds.clear().union(wA),t.bounds.clear().union(wA),e.dirty(o)),o.bounds}(e,i,u,c,d));t.clip&&d.set(0,0,t.width||0,t.height||0);!function(e,t,n,i){const r=i.autosize||{},s=r.type;if(e._autosize<1||!s)return;let o=e._width,a=e._height,l=Math.max(0,t.width||0),u=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),d=Math.max(0,Math.ceil(-n.y1));const h=Math.max(0,Math.ceil(n.x2-l)),p=Math.max(0,Math.ceil(n.y2-c));if(r.contains===tA){const t=e.padding();o-=t.left+t.right,a-=t.top+t.bottom}s===sA?(u=0,d=0,l=o,c=a):s===nA?(l=Math.max(0,o-u-h),c=Math.max(0,a-d-p)):s===iA?(l=Math.max(0,o-u-h),a=c+d+p):s===rA?(o=l+u+h,c=Math.max(0,a-d-p)):"pad"===s&&(o=l+u+h,a=c+d+p);e._resizeView(o,a,l,c,[u,d],r.resize)}(e,t,d,n)}(n,t,e)}),function(e){return e&&"legend-entry"!==e.mark.role}(e.mark.group)?t.reflow():t}});const HA=nl(Ko),WA=HA.right,XA=HA.left,qA=(nl(ta).center,WA);function KA(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function ZA(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}const QA=Symbol("implicit");function JA(){var e=new Map,t=[],n=[],i=QA;function r(r){var s=r+"",o=e.get(s);if(!o){if(i!==QA)return i;e.set(s,o=t.push(r))}return n[(o-1)%n.length]}return r.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Map;for(const i of n){const n=i+"";e.has(n)||e.set(n,t.push(i))}return r},r.range=function(e){return arguments.length?(n=Array.from(e),r):n.slice()},r.unknown=function(e){return arguments.length?(i=e,r):i},r.copy=function(){return JA(t,n).unknown(i)},KA.apply(r,arguments),r}var eS=n(34410);function tS(e,t,n,i){var r,s=ru(e,t,n);switch((i=(0,eS.formatSpecifier)(null==i?",f":i)).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=i.precision||isNaN(r=(0,eS.precisionPrefix)(s,o))||(i.precision=r),(0,eS.formatPrefix)(i,o);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=(0,eS.precisionRound)(s,Math.max(Math.abs(e),Math.abs(t))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=(0,eS.precisionFixed)(s))||(i.precision=r-2*("%"===i.type))}return(0,eS.format)(i)}function nS(e,t,n,i,r){var s=e*e,o=s*e;return((1-3*e+3*s-o)*t+(4-6*s+3*o)*n+(1+3*e+3*s-3*o)*i+o*r)/6}function iS(e){var t=e.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[i],s=e[i+1],o=i>0?e[i-1]:2*r-s,a=i<t-1?e[i+2]:2*s-r;return nS((n-i/t)*t,o,r,s,a)}}function rS(e){var t=e.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*t),r=e[(i+t-1)%t],s=e[i%t],o=e[(i+1)%t],a=e[(i+2)%t];return nS((n-i/t)*t,r,s,o,a)}}const sS=e=>()=>e;function oS(e,t){return function(n){return e+n*t}}function aS(e,t){var n=t-e;return n?oS(e,n>180||n<-180?n-360*Math.round(n/360):n):sS(isNaN(e)?t:e)}function lS(e){return 1===(e=+e)?uS:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}(t,n,e):sS(isNaN(t)?n:t)}}function uS(e,t){var n=t-e;return n?oS(e,n):sS(isNaN(e)?t:e)}const cS=function e(t){var n=lS(t);function i(e,t){var i=n((e=Ry(e)).r,(t=Ry(t)).r),r=n(e.g,t.g),s=n(e.b,t.b),o=uS(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=r(t),e.b=s(t),e.opacity=o(t),e+""}}return i.gamma=e,i}(1);function dS(e){return function(t){var n,i,r=t.length,s=new Array(r),o=new Array(r),a=new Array(r);for(n=0;n<r;++n)i=Ry(t[n]),s[n]=i.r||0,o[n]=i.g||0,a[n]=i.b||0;return s=e(s),o=e(o),a=e(a),i.opacity=1,function(e){return i.r=s(e),i.g=o(e),i.b=a(e),i+""}}}var hS=dS(iS),pS=dS(rS);function fS(e,t){t||(t=[]);var n,i=e?Math.min(t.length,e.length):0,r=t.slice();return function(s){for(n=0;n<i;++n)r[n]=e[n]*(1-s)+t[n]*s;return r}}function mS(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gS(e,t){return(mS(t)?fS:yS)(e,t)}function yS(e,t){var n,i=t?t.length:0,r=e?Math.min(i,e.length):0,s=new Array(r),o=new Array(i);for(n=0;n<r;++n)s[n]=wS(e[n],t[n]);for(;n<i;++n)o[n]=t[n];return function(e){for(n=0;n<r;++n)o[n]=s[n](e);return o}}function _S(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function vS(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function bS(e,t){var n,i={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?i[n]=wS(e[n],t[n]):r[n]=t[n];return function(e){for(n in i)r[n]=i[n](e);return r}}var TS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xS=new RegExp(TS.source,"g");function ES(e,t){var n,i,r,s=TS.lastIndex=xS.lastIndex=0,o=-1,a=[],l=[];for(e+="",t+="";(n=TS.exec(e))&&(i=xS.exec(t));)(r=i.index)>s&&(r=t.slice(s,r),a[o]?a[o]+=r:a[++o]=r),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:vS(n,i)})),s=xS.lastIndex;return s<t.length&&(r=t.slice(s),a[o]?a[o]+=r:a[++o]=r),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,i=0;i<t;++i)a[(n=l[i]).i]=n.x(e);return a.join("")})}function wS(e,t){var n,i=typeof t;return null==t||"boolean"===i?sS(t):("number"===i?vS:"string"===i?(n=Sy(t))?(t=n,cS):ES:t instanceof Sy?cS:t instanceof Date?_S:mS(t)?fS:Array.isArray(t)?yS:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?bS:vS)(e,t)}function IS(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function AS(e){return+e}var SS=[0,1];function CS(e){return e}function OS(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function MS(e,t,n){var i=e[0],r=e[1],s=t[0],o=t[1];return r<i?(i=OS(r,i),s=n(o,s)):(i=OS(i,r),s=n(s,o)),function(e){return s(i(e))}}function RS(e,t,n){var i=Math.min(e.length,t.length)-1,r=new Array(i),s=new Array(i),o=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<i;)r[o]=OS(e[o],e[o+1]),s[o]=n(t[o],t[o+1]);return function(t){var n=qA(e,t,1,i)-1;return s[n](r[n](t))}}function kS(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function NS(){var e,t,n,i,r,s,o=SS,a=SS,l=wS,u=CS;function c(){var e=Math.min(o.length,a.length);return u!==CS&&(u=function(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(o[0],o[e-1])),i=e>2?RS:MS,r=s=null,d}function d(t){return null==t||isNaN(t=+t)?n:(r||(r=i(o.map(e),a,l)))(e(u(t)))}return d.invert=function(n){return u(t((s||(s=i(a,o.map(e),vS)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,AS),c()):o.slice()},d.range=function(e){return arguments.length?(a=Array.from(e),c()):a.slice()},d.rangeRound=function(e){return a=Array.from(e),l=IS,c()},d.clamp=function(e){return arguments.length?(u=!!e||CS,c()):u!==CS},d.interpolate=function(e){return arguments.length?(l=e,c()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,i){return e=n,t=i,c()}}function DS(){return NS()(CS,CS)}function FS(e){var t=e.domain;return e.ticks=function(e){var n=t();return nu(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var i=t();return tS(i[0],i[i.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var i,r,s=t(),o=0,a=s.length-1,l=s[o],u=s[a],c=10;for(u<l&&(r=l,l=u,u=r,r=o,o=a,a=r);c-- >0;){if((r=iu(l,u,n))===i)return s[o]=l,s[a]=u,t(s);if(r>0)l=Math.floor(l/r)*r,u=Math.ceil(u/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,u=Math.floor(u*r)/r}i=r}return e},e}function LS(e,t){var n,i=0,r=(e=e.slice()).length-1,s=e[i],o=e[r];return o<s&&(n=i,i=r,r=n,n=s,s=o,o=n),e[i]=t.floor(s),e[r]=t.ceil(o),e}function PS(e){return Math.log(e)}function BS(e){return Math.exp(e)}function $S(e){return-Math.log(-e)}function US(e){return-Math.exp(-e)}function zS(e){return isFinite(e)?+("1e"+e):e<0?0:e}function VS(e){return function(t){return-e(-t)}}function jS(e){var t,n,i=e(PS,BS),r=i.domain,s=10;function o(){return t=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),function(t){return Math.log(t)/e})}(s),n=function(e){return 10===e?zS:e===Math.E?Math.exp:function(t){return Math.pow(e,t)}}(s),r()[0]<0?(t=VS(t),n=VS(n),e($S,US)):e(PS,BS),i}return i.base=function(e){return arguments.length?(s=+e,o()):s},i.domain=function(e){return arguments.length?(r(e),o()):r()},i.ticks=function(e){var i,o=r(),a=o[0],l=o[o.length-1];(i=l<a)&&(h=a,a=l,l=h);var u,c,d,h=t(a),p=t(l),f=null==e?10:+e,m=[];if(!(s%1)&&p-h<f){if(h=Math.floor(h),p=Math.ceil(p),a>0){for(;h<=p;++h)for(c=1,u=n(h);c<s;++c)if(!((d=u*c)<a)){if(d>l)break;m.push(d)}}else for(;h<=p;++h)for(c=s-1,u=n(h);c>=1;--c)if(!((d=u*c)<a)){if(d>l)break;m.push(d)}2*m.length<f&&(m=nu(a,l,f))}else m=nu(h,p,Math.min(p-h,f)).map(n);return i?m.reverse():m},i.tickFormat=function(e,r){if(null==r&&(r=10===s?".0e":","),"function"!=typeof r&&(r=(0,eS.format)(r)),e===1/0)return r;null==e&&(e=10);var o=Math.max(1,s*e/i.ticks().length);return function(e){var i=e/n(Math.round(t(e)));return i*s<s-.5&&(i*=s),i<=o?r(e):""}},i.nice=function(){return r(LS(r(),{floor:function(e){return n(Math.floor(t(e)))},ceil:function(e){return n(Math.ceil(t(e)))}}))},i}function YS(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function GS(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function HS(e){return e<0?-e*e:e*e}function WS(e){var t=e(CS,CS),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e(CS,CS):.5===n?e(GS,HS):e(YS(n),YS(1/n)):n},FS(t)}function XS(){var e=WS(NS());return e.copy=function(){return kS(e,XS()).exponent(e.exponent())},KA.apply(e,arguments),e}function qS(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function KS(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function ZS(e){var t=1,n=e(qS(t),KS(t));return n.constant=function(n){return arguments.length?e(qS(t=+n),KS(t)):t},FS(n)}function QS(e,t,n,i,r,s){const o=[[Vl,1,ol],[Vl,5,5e3],[Vl,15,15e3],[Vl,30,3e4],[s,1,al],[s,5,3e5],[s,15,9e5],[s,30,18e5],[r,1,ll],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,ul],[i,2,1728e5],[n,1,cl],[t,1,dl],[t,3,7776e6],[e,1,hl]];function a(t,n,i){const r=Math.abs(n-t)/i,s=nl(([,,e])=>e).right(o,r);if(s===o.length)return e.every(ru(t/hl,n/hl,i));if(0===s)return Yl.every(Math.max(ru(t,n,i),1));const[a,l]=o[r/o[s-1][2]<o[s][2]/r?s-1:s];return a.every(l)}return[function(e,t,n){const i=t<e;i&&([e,t]=[t,e]);const r=n&&"function"==typeof n.range?n:a(e,t,n),s=r?r.range(e,+t+1):[];return i?s.reverse():s},a]}const[JS,eC]=QS(Hl,Xl,Al,wl,Kl,Ql),[tC,nC]=QS(Dl,Ll,gl,fl,Bl,Ul);function iC(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function rC(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function sC(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function oC(e){var t=e.dateTime,n=e.date,i=e.time,r=e.periods,s=e.days,o=e.shortDays,a=e.months,l=e.shortMonths,u=_C(r),c=vC(r),d=_C(s),h=vC(s),p=_C(o),f=vC(o),m=_C(a),g=vC(a),y=_C(l),_=vC(l),v={a:function(e){return o[e.getDay()]},A:function(e){return s[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return a[e.getMonth()]},c:null,d:UC,e:UC,f:GC,g:nO,G:rO,H:zC,I:VC,j:jC,L:YC,m:HC,M:WC,p:function(e){return r[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:SO,s:CO,S:XC,u:qC,U:KC,V:QC,w:JC,W:eO,x:null,X:null,y:tO,Y:iO,Z:sO,"%":AO},b={a:function(e){return o[e.getUTCDay()]},A:function(e){return s[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return a[e.getUTCMonth()]},c:null,d:oO,e:oO,f:dO,g:xO,G:wO,H:aO,I:lO,j:uO,L:cO,m:hO,M:pO,p:function(e){return r[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:SO,s:CO,S:fO,u:mO,U:gO,V:_O,w:vO,W:bO,x:null,X:null,y:TO,Y:EO,Z:IO,"%":AO},T={a:function(e,t,n){var i=p.exec(t.slice(n));return i?(e.w=f.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(e,t,n){var i=d.exec(t.slice(n));return i?(e.w=h.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(e,t,n){var i=y.exec(t.slice(n));return i?(e.m=_.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(e,t,n){var i=m.exec(t.slice(n));return i?(e.m=g.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(e,n,i){return w(e,t,n,i)},d:MC,e:MC,f:LC,g:AC,G:IC,H:kC,I:kC,j:RC,L:FC,m:OC,M:NC,p:function(e,t,n){var i=u.exec(t.slice(n));return i?(e.p=c.get(i[0].toLowerCase()),n+i[0].length):-1},q:CC,Q:BC,s:$C,S:DC,u:TC,U:xC,V:EC,w:bC,W:wC,x:function(e,t,i){return w(e,n,t,i)},X:function(e,t,n){return w(e,i,t,n)},y:AC,Y:IC,Z:SC,"%":PC};function x(e,t){return function(n){var i,r,s,o=[],a=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++a<u;)37===e.charCodeAt(a)&&(o.push(e.slice(l,a)),null!=(r=hC[i=e.charAt(++a)])?i=e.charAt(++a):r="e"===i?" ":"0",(s=t[i])&&(i=s(n,r)),o.push(i),l=a+1);return o.push(e.slice(l,a)),o.join("")}}function E(e,t){return function(n){var i,r,s=sC(1900,void 0,1);if(w(s,e,n+="",0)!=n.length)return null;if("Q"in s)return new Date(s.Q);if("s"in s)return new Date(1e3*s.s+("L"in s?s.L:0));if(t&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"V"in s){if(s.V<1||s.V>53)return null;"w"in s||(s.w=1),"Z"in s?(r=(i=rC(sC(s.y,0,1))).getUTCDay(),i=r>4||0===r?Sl.ceil(i):Sl(i),i=wl.offset(i,7*(s.V-1)),s.y=i.getUTCFullYear(),s.m=i.getUTCMonth(),s.d=i.getUTCDate()+(s.w+6)%7):(r=(i=iC(sC(s.y,0,1))).getDay(),i=r>4||0===r?yl.ceil(i):yl(i),i=fl.offset(i,7*(s.V-1)),s.y=i.getFullYear(),s.m=i.getMonth(),s.d=i.getDate()+(s.w+6)%7)}else("W"in s||"U"in s)&&("w"in s||(s.w="u"in s?s.u%7:"W"in s?1:0),r="Z"in s?rC(sC(s.y,0,1)).getUTCDay():iC(sC(s.y,0,1)).getDay(),s.m=0,s.d="W"in s?(s.w+6)%7+7*s.W-(r+5)%7:s.w+7*s.U-(r+6)%7);return"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,rC(s)):iC(s)}}function w(e,t,n,i){for(var r,s,o=0,a=t.length,l=n.length;o<a;){if(i>=l)return-1;if(37===(r=t.charCodeAt(o++))){if(r=t.charAt(o++),!(s=T[r in hC?t.charAt(o++):r])||(i=s(e,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return v.x=x(n,v),v.X=x(i,v),v.c=x(t,v),b.x=x(n,b),b.X=x(i,b),b.c=x(t,b),{format:function(e){var t=x(e+="",v);return t.toString=function(){return e},t},parse:function(e){var t=E(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=x(e+="",b);return t.toString=function(){return e},t},utcParse:function(e){var t=E(e+="",!0);return t.toString=function(){return e},t}}}var aC,lC,uC,cC,dC,hC={"-":"",_:" ",0:"0"},pC=/^\s*\d+/,fC=/^%/,mC=/[\\^$*+?|[\]().{}]/g;function gC(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",s=r.length;return i+(s<n?new Array(n-s+1).join(t)+r:r)}function yC(e){return e.replace(mC,"\\$&")}function _C(e){return new RegExp("^(?:"+e.map(yC).join("|")+")","i")}function vC(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function bC(e,t,n){var i=pC.exec(t.slice(n,n+1));return i?(e.w=+i[0],n+i[0].length):-1}function TC(e,t,n){var i=pC.exec(t.slice(n,n+1));return i?(e.u=+i[0],n+i[0].length):-1}function xC(e,t,n){var i=pC.exec(t.slice(n,n+2));return i?(e.U=+i[0],n+i[0].length):-1}function EC(e,t,n){var i=pC.exec(t.slice(n,n+2));return i?(e.V=+i[0],n+i[0].length):-1}function wC(e,t,n){var i=pC.exec(t.slice(n,n+2));return i?(e.W=+i[0],n+i[0].length):-1}function IC(e,t,n){var i=pC.exec(t.slice(n,n+4));return i?(e.y=+i[0],n+i[0].length):-1}function AC(e,t,n){var i=pC.exec(t.slice(n,n+2));return i?(e.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function SC(e,t,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function CC(e,t,n){var i=pC.exec(t.slice(n,n+1));return i?(e.q=3*i[0]-3,n+i[0].length):-1}function OC(e,t,n){var i=pC.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function MC(e,t,n){var i=pC.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function RC(e,t,n){var i=pC.exec(t.slice(n,n+3));return i?(e.m=0,e.d=+i[0],n+i[0].length):-1}function kC(e,t,n){var i=pC.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function NC(e,t,n){var i=pC.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function DC(e,t,n){var i=pC.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function FC(e,t,n){var i=pC.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function LC(e,t,n){var i=pC.exec(t.slice(n,n+6));return i?(e.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function PC(e,t,n){var i=fC.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function BC(e,t,n){var i=pC.exec(t.slice(n));return i?(e.Q=+i[0],n+i[0].length):-1}function $C(e,t,n){var i=pC.exec(t.slice(n));return i?(e.s=+i[0],n+i[0].length):-1}function UC(e,t){return gC(e.getDate(),t,2)}function zC(e,t){return gC(e.getHours(),t,2)}function VC(e,t){return gC(e.getHours()%12||12,t,2)}function jC(e,t){return gC(1+fl.count(Dl(e),e),t,3)}function YC(e,t){return gC(e.getMilliseconds(),t,3)}function GC(e,t){return YC(e,t)+"000"}function HC(e,t){return gC(e.getMonth()+1,t,2)}function WC(e,t){return gC(e.getMinutes(),t,2)}function XC(e,t){return gC(e.getSeconds(),t,2)}function qC(e){var t=e.getDay();return 0===t?7:t}function KC(e,t){return gC(gl.count(Dl(e)-1,e),t,2)}function ZC(e){var t=e.getDay();return t>=4||0===t?bl(e):bl.ceil(e)}function QC(e,t){return e=ZC(e),gC(bl.count(Dl(e),e)+(4===Dl(e).getDay()),t,2)}function JC(e){return e.getDay()}function eO(e,t){return gC(yl.count(Dl(e)-1,e),t,2)}function tO(e,t){return gC(e.getFullYear()%100,t,2)}function nO(e,t){return gC((e=ZC(e)).getFullYear()%100,t,2)}function iO(e,t){return gC(e.getFullYear()%1e4,t,4)}function rO(e,t){var n=e.getDay();return gC((e=n>=4||0===n?bl(e):bl.ceil(e)).getFullYear()%1e4,t,4)}function sO(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+gC(t/60|0,"0",2)+gC(t%60,"0",2)}function oO(e,t){return gC(e.getUTCDate(),t,2)}function aO(e,t){return gC(e.getUTCHours(),t,2)}function lO(e,t){return gC(e.getUTCHours()%12||12,t,2)}function uO(e,t){return gC(1+wl.count(Hl(e),e),t,3)}function cO(e,t){return gC(e.getUTCMilliseconds(),t,3)}function dO(e,t){return cO(e,t)+"000"}function hO(e,t){return gC(e.getUTCMonth()+1,t,2)}function pO(e,t){return gC(e.getUTCMinutes(),t,2)}function fO(e,t){return gC(e.getUTCSeconds(),t,2)}function mO(e){var t=e.getUTCDay();return 0===t?7:t}function gO(e,t){return gC(Al.count(Hl(e)-1,e),t,2)}function yO(e){var t=e.getUTCDay();return t>=4||0===t?Ml(e):Ml.ceil(e)}function _O(e,t){return e=yO(e),gC(Ml.count(Hl(e),e)+(4===Hl(e).getUTCDay()),t,2)}function vO(e){return e.getUTCDay()}function bO(e,t){return gC(Sl.count(Hl(e)-1,e),t,2)}function TO(e,t){return gC(e.getUTCFullYear()%100,t,2)}function xO(e,t){return gC((e=yO(e)).getUTCFullYear()%100,t,2)}function EO(e,t){return gC(e.getUTCFullYear()%1e4,t,4)}function wO(e,t){var n=e.getUTCDay();return gC((e=n>=4||0===n?Ml(e):Ml.ceil(e)).getUTCFullYear()%1e4,t,4)}function IO(){return"+0000"}function AO(){return"%"}function SO(e){return+e}function CO(e){return Math.floor(+e/1e3)}function OO(e){return new Date(e)}function MO(e){return e instanceof Date?+e:+new Date(+e)}function RO(e,t,n,i,r,s,o,a,l,u){var c=DS(),d=c.invert,h=c.domain,p=u(".%L"),f=u(":%S"),m=u("%I:%M"),g=u("%I %p"),y=u("%a %d"),_=u("%b %d"),v=u("%B"),b=u("%Y");function T(e){return(l(e)<e?p:a(e)<e?f:o(e)<e?m:s(e)<e?g:i(e)<e?r(e)<e?y:_:n(e)<e?v:b)(e)}return c.invert=function(e){return new Date(d(e))},c.domain=function(e){return arguments.length?h(Array.from(e,MO)):h().map(OO)},c.ticks=function(t){var n=h();return e(n[0],n[n.length-1],null==t?10:t)},c.tickFormat=function(e,t){return null==t?T:u(t)},c.nice=function(e){var n=h();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?h(LS(n,e)):c},c.copy=function(){return kS(c,RO(e,t,n,i,r,s,o,a,l,u))},c}function kO(){var e,t,n,i,r,s=0,o=1,a=CS,l=!1;function u(t){return null==t||isNaN(t=+t)?r:a(0===n?.5:(t=(i(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function c(e){return function(t){var n,i;return arguments.length?([n,i]=t,a=e(n,i),u):[a(0),a(1)]}}return u.domain=function(r){return arguments.length?([s,o]=r,e=i(s=+s),t=i(o=+o),n=e===t?0:1/(t-e),u):[s,o]},u.clamp=function(e){return arguments.length?(l=!!e,u):l},u.interpolator=function(e){return arguments.length?(a=e,u):a},u.range=c(wS),u.rangeRound=c(IS),u.unknown=function(e){return arguments.length?(r=e,u):r},function(r){return i=r,e=r(s),t=r(o),n=e===t?0:1/(t-e),u}}function NO(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function DO(){var e=FS(kO()(CS));return e.copy=function(){return NO(e,DO())},ZA.apply(e,arguments)}function FO(){var e=WS(kO());return e.copy=function(){return NO(e,FO()).exponent(e.exponent())},ZA.apply(e,arguments)}function LO(e,t){void 0===t&&(t=e,e=wS);for(var n=0,i=t.length-1,r=t[0],s=new Array(i<0?0:i);n<i;)s[n]=e(r,r=t[++n]);return function(e){var t=Math.max(0,Math.min(i-1,Math.floor(e*=i)));return s[t](e-t)}}function PO(){var e,t,n,i,r,s,o,a=0,l=.5,u=1,c=1,d=CS,h=!1;function p(e){return isNaN(e=+e)?o:(e=.5+((e=+s(e))-t)*(c*e<c*t?i:r),d(h?Math.max(0,Math.min(1,e)):e))}function f(e){return function(t){var n,i,r;return arguments.length?([n,i,r]=t,d=LO(e,[n,i,r]),p):[d(0),d(.5),d(1)]}}return p.domain=function(o){return arguments.length?([a,l,u]=o,e=s(a=+a),t=s(l=+l),n=s(u=+u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,p):[a,l,u]},p.clamp=function(e){return arguments.length?(h=!!e,p):h},p.interpolator=function(e){return arguments.length?(d=e,p):d},p.range=f(wS),p.rangeRound=f(IS),p.unknown=function(e){return arguments.length?(o=e,p):o},function(o){return s=o,e=o(a),t=o(l),n=o(u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,p}}function BO(){var e=WS(PO());return e.copy=function(){return NO(e,BO()).exponent(e.exponent())},ZA.apply(e,arguments)}function $O(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}function UO(e,t){var n=aS(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}}!function(e){aC=oC(e),lC=aC.format,uC=aC.parse,cC=aC.utcFormat,dC=aC.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var zO,VO=180/Math.PI,jO={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function YO(e,t,n,i,r,s){var o,a,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*i)&&(n-=e*l,i-=t*l),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,l/=a),e*i<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*VO,skewX:Math.atan(l)*VO,scaleX:o,scaleY:a}}function GO(e,t,n,i){function r(e){return e.length?e.pop()+" ":""}return function(s,o){var a=[],l=[];return s=e(s),o=e(o),function(e,i,r,s,o,a){if(e!==r||i!==s){var l=o.push("translate(",null,t,null,n);a.push({i:l-4,x:vS(e,r)},{i:l-2,x:vS(i,s)})}else(r||s)&&o.push("translate("+r+t+s+n)}(s.translateX,s.translateY,o.translateX,o.translateY,a,l),function(e,t,n,s){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),s.push({i:n.push(r(n)+"rotate(",null,i)-2,x:vS(e,t)})):t&&n.push(r(n)+"rotate("+t+i)}(s.rotate,o.rotate,a,l),function(e,t,n,s){e!==t?s.push({i:n.push(r(n)+"skewX(",null,i)-2,x:vS(e,t)}):t&&n.push(r(n)+"skewX("+t+i)}(s.skewX,o.skewX,a,l),function(e,t,n,i,s,o){if(e!==n||t!==i){var a=s.push(r(s)+"scale(",null,",",null,")");o.push({i:a-4,x:vS(e,n)},{i:a-2,x:vS(t,i)})}else 1===n&&1===i||s.push(r(s)+"scale("+n+","+i+")")}(s.scaleX,s.scaleY,o.scaleX,o.scaleY,a,l),s=o=null,function(e){for(var t,n=-1,i=l.length;++n<i;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var HO=GO(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?jO:YO(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),WO=GO(function(e){return null==e?jO:(zO||(zO=document.createElementNS("http://www.w3.org/2000/svg","g")),zO.setAttribute("transform",e),(e=zO.transform.baseVal.consolidate())?YO((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):jO)},", ",")",")");function XO(e){return((e=Math.exp(e))+1/e)/2}const qO=function e(t,n,i){function r(e,r){var s,o,a=e[0],l=e[1],u=e[2],c=r[0],d=r[1],h=r[2],p=c-a,f=d-l,m=p*p+f*f;if(m<1e-12)o=Math.log(h/u)/t,s=function(e){return[a+e*p,l+e*f,u*Math.exp(t*e*o)]};else{var g=Math.sqrt(m),y=(h*h-u*u+i*m)/(2*u*n*g),_=(h*h-u*u-i*m)/(2*h*n*g),v=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(_*_+1)-_);o=(b-v)/t,s=function(e){var i=e*o,r=XO(v),s=u/(n*g)*(r*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*i+v)-function(e){return((e=Math.exp(e))-1/e)/2}(v));return[a+s*p,l+s*f,u*r/XO(t*i+v)]}}return s.duration=1e3*o*t/Math.SQRT2,s}return r.rho=function(t){var n=Math.max(.001,+t),i=n*n;return e(n,i,i*i)},r}(Math.SQRT2,2,4);function KO(e){return function(t,n){var i=e((t=By(t)).h,(n=By(n)).h),r=uS(t.s,n.s),s=uS(t.l,n.l),o=uS(t.opacity,n.opacity);return function(e){return t.h=i(e),t.s=r(e),t.l=s(e),t.opacity=o(e),t+""}}}const ZO=KO(aS);var QO=KO(uS);function JO(e,t){var n=uS((e=Dv(e)).l,(t=Dv(t)).l),i=uS(e.a,t.a),r=uS(e.b,t.b),s=uS(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=i(t),e.b=r(t),e.opacity=s(t),e+""}}function eM(e){return function(t,n){var i=e((t=zv(t)).h,(n=zv(n)).h),r=uS(t.c,n.c),s=uS(t.l,n.l),o=uS(t.opacity,n.opacity);return function(e){return t.h=i(e),t.c=r(e),t.l=s(e),t.opacity=o(e),t+""}}}const tM=eM(aS);var nM=eM(uS);function iM(e){return function t(n){function i(t,i){var r=e((t=nb(t)).h,(i=nb(i)).h),s=uS(t.s,i.s),o=uS(t.l,i.l),a=uS(t.opacity,i.opacity);return function(e){return t.h=r(e),t.s=s(e),t.l=o(Math.pow(e,n)),t.opacity=a(e),t+""}}return n=+n,i.gamma=t,i}(1)}const rM=iM(aS);var sM=iM(uS);function oM(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}function aM(e,t,n){const i=e-t+2*n;return e?i>0?i:1:0}const lM="linear",uM="log",cM="pow",dM="sqrt",hM="symlog",pM="time",fM="utc",mM="sequential",gM="diverging",yM="quantile",_M="quantize",vM="threshold",bM="ordinal",TM="point",xM="band",EM="bin-ordinal",wM="continuous",IM="discrete",AM="discretizing",SM="interpolating",CM="temporal";function OM(){const e=JA().unknown(void 0),t=e.domain,n=e.range;let i,r,s=[0,1],o=!1,a=0,l=0,u=.5;function c(){const e=t().length,c=s[1]<s[0],d=s[1-c],h=aM(e,a,l);let p=s[c-0];i=(d-p)/(h||1),o&&(i=Math.floor(i)),p+=(d-p-i*(e-a))*u,r=i*(1-a),o&&(p=Math.round(p),r=Math.round(r));const f=tl(e).map(e=>p+i*e);return n(c?f.reverse():f)}return delete e.unknown,e.domain=function(e){return arguments.length?(t(e),c()):t()},e.range=function(e){return arguments.length?(s=[+e[0],+e[1]],c()):s.slice()},e.rangeRound=function(e){return s=[+e[0],+e[1]],o=!0,c()},e.bandwidth=function(){return r},e.step=function(){return i},e.round=function(e){return arguments.length?(o=!!e,c()):o},e.padding=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),a=l,c()):a},e.paddingInner=function(e){return arguments.length?(a=Math.max(0,Math.min(1,e)),c()):a},e.paddingOuter=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),c()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=s[1]<s[0],o=i?n().reverse():n(),a=o.length-1;let l,u,c,d=+e[0],h=+e[1];return d!=d||h!=h||(h<d&&(c=d,d=h,h=c),h<o[0]||d>s[1-i])?void 0:(l=Math.max(0,WA(o,d)-1),u=d===h?l:WA(o,h)-1,d-o[l]>r+1e-10&&++l,i&&(c=l,l=a-u,u=a-c),l>u?void 0:t().slice(l,u+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return OM().domain(t()).range(s).round(o).paddingInner(a).paddingOuter(l).align(u)},c()}function MM(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return MM(t())},e}var RM=Array.prototype.map;const kM=Array.prototype.slice;const NM={};function DM(e,t,n){return arguments.length>1?(NM[e]=function(e,t,n){const i=function(){const n=t();return n.invertRange||(n.invertRange=n.invert?function(e){return function(t){let n,i=t[0],r=t[1];return r<i&&(n=i,i=r,r=n),[e.invert(i),e.invert(r)]}}(n):n.invertExtent?function(e){return function(t){const n=e.range();let i,r,s,o,a=t[0],l=t[1],u=-1;for(l<a&&(r=a,a=l,l=r),s=0,o=n.length;s<o;++s)n[s]>=a&&n[s]<=l&&(u<0&&(u=s),i=s);if(!(u<0))return a=e.invertExtent(n[u]),l=e.invertExtent(n[i]),[void 0===a[0]?a[1]:a[0],void 0===l[1]?l[0]:l[1]]}}(n):void 0),n.type=e,n};return i.metadata=Dt(Xe(n)),i}(e,t,n),this):FM(e)?NM[e]:void 0}function FM(e){return ut(NM,e)}function LM(e,t){const n=NM[e];return n&&n.metadata[t]}function PM(e){return LM(e,wM)}function BM(e){return LM(e,IM)}function $M(e){return LM(e,AM)}function UM(e){return LM(e,uM)}function zM(e){return LM(e,SM)}function VM(e){return LM(e,yM)}DM("identity",function e(t){var n;function i(e){return null==e||isNaN(e=+e)?n:e}return i.invert=i,i.domain=i.range=function(e){return arguments.length?(t=Array.from(e,AS),i):t.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,AS):[0,1],FS(i)}),DM(lM,function e(){var t=DS();return t.copy=function(){return kS(t,e())},KA.apply(t,arguments),FS(t)},wM),DM(uM,function e(){var t=jS(NS()).domain([1,10]);return t.copy=function(){return kS(t,e()).base(t.base())},KA.apply(t,arguments),t},[wM,uM]),DM(cM,XS,wM),DM(dM,function(){return XS.apply(null,arguments).exponent(.5)},wM),DM(hM,function e(){var t=ZS(NS());return t.copy=function(){return kS(t,e()).constant(t.constant())},KA.apply(t,arguments)},wM),DM(pM,function(){return KA.apply(RO(tC,nC,Dl,Ll,gl,fl,Bl,Ul,Vl,lC).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},[wM,CM]),DM(fM,function(){return KA.apply(RO(JS,eC,Hl,Xl,Al,wl,Kl,Ql,Vl,cC).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},[wM,CM]),DM(mM,DO,[wM,SM]),DM("".concat(mM,"-").concat(lM),DO,[wM,SM]),DM("".concat(mM,"-").concat(uM),function e(){var t=jS(kO()).domain([1,10]);return t.copy=function(){return NO(t,e()).base(t.base())},ZA.apply(t,arguments)},[wM,SM,uM]),DM("".concat(mM,"-").concat(cM),FO,[wM,SM]),DM("".concat(mM,"-").concat(dM),function(){return FO.apply(null,arguments).exponent(.5)},[wM,SM]),DM("".concat(mM,"-").concat(hM),function e(){var t=ZS(kO());return t.copy=function(){return NO(t,e()).constant(t.constant())},ZA.apply(t,arguments)},[wM,SM]),DM("".concat(gM,"-").concat(lM),function e(){var t=FS(PO()(CS));return t.copy=function(){return NO(t,e())},ZA.apply(t,arguments)},[wM,SM]),DM("".concat(gM,"-").concat(uM),function e(){var t=jS(PO()).domain([.1,1,10]);return t.copy=function(){return NO(t,e()).base(t.base())},ZA.apply(t,arguments)},[wM,SM,uM]),DM("".concat(gM,"-").concat(cM),BO,[wM,SM]),DM("".concat(gM,"-").concat(dM),function(){return BO.apply(null,arguments).exponent(.5)},[wM,SM]),DM("".concat(gM,"-").concat(hM),function e(){var t=ZS(PO());return t.copy=function(){return NO(t,e()).constant(t.constant())},ZA.apply(t,arguments)},[wM,SM]),DM(yM,function e(){var t,n=[],i=[],r=[];function s(){var e=0,t=Math.max(1,i.length);for(r=new Array(t-1);++e<t;)r[e-1]=ia(n,e/t);return o}function o(e){return null==e||isNaN(e=+e)?t:i[qA(r,e)]}return o.invertExtent=function(e){var t=i.indexOf(e);return t<0?[NaN,NaN]:[t>0?r[t-1]:n[0],t<r.length?r[t]:n[n.length-1]]},o.domain=function(e){if(!arguments.length)return n.slice();n=[];for(let t of e)null==t||isNaN(t=+t)||n.push(t);return n.sort(Ko),s()},o.range=function(e){return arguments.length?(i=Array.from(e),s()):i.slice()},o.unknown=function(e){return arguments.length?(t=e,o):t},o.quantiles=function(){return r.slice()},o.copy=function(){return e().domain(n).range(i).unknown(t)},KA.apply(o,arguments)},[AM,yM]),DM(_M,function e(){var t,n=0,i=1,r=1,s=[.5],o=[0,1];function a(e){return null!=e&&e<=e?o[qA(s,e,0,r)]:t}function l(){var e=-1;for(s=new Array(r);++e<r;)s[e]=((e+1)*i-(e-r)*n)/(r+1);return a}return a.domain=function(e){return arguments.length?([n,i]=e,n=+n,i=+i,l()):[n,i]},a.range=function(e){return arguments.length?(r=(o=Array.from(e)).length-1,l()):o.slice()},a.invertExtent=function(e){var t=o.indexOf(e);return t<0?[NaN,NaN]:t<1?[n,s[0]]:t>=r?[s[r-1],i]:[s[t-1],s[t]]},a.unknown=function(e){return arguments.length?(t=e,a):a},a.thresholds=function(){return s.slice()},a.copy=function(){return e().domain([n,i]).range(o).unknown(t)},KA.apply(FS(a),arguments)},AM),DM(vM,function e(){var t,n=[.5],i=[0,1],r=1;function s(e){return null!=e&&e<=e?i[qA(n,e,0,r)]:t}return s.domain=function(e){return arguments.length?(n=Array.from(e),r=Math.min(n.length,i.length-1),s):n.slice()},s.range=function(e){return arguments.length?(i=Array.from(e),r=Math.min(n.length,i.length-1),s):i.slice()},s.invertExtent=function(e){var t=i.indexOf(e);return[n[t-1],n[t]]},s.unknown=function(e){return arguments.length?(t=e,s):t},s.copy=function(){return e().domain(n).range(i).unknown(t)},KA.apply(s,arguments)},AM),DM(EM,function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[(qA(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return RM.call(e,Me)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=kM.call(e),i):n.slice()},i.tickFormat=function(e,n){return tS(t[0],Oe(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i},[IM,AM]),DM(bM,JA,IM),DM(xM,OM,IM),DM(TM,function(){return MM(OM().paddingInner(1))},IM);const jM=["clamp","base","constant","exponent"];function YM(e,t){const n=t[0],i=Oe(t)-n;return function(t){return e(n+t*i)}}function GM(e,t,n){return LO(XM(t||"rgb",n),e)}function HM(e,t){const n=new Array(t),i=t+1;for(let r=0;r<t;)n[r]=e(++r/i);return n}function WM(e,t,n){const i=n-t;let r,s,o;return i&&Number.isFinite(i)?(r=(s=e.type).indexOf("-"),s=r<0?s:s.slice(r+1),o=DM(s)().domain([t,n]).range([0,1]),jM.forEach(t=>e[t]?o[t](e[t]()):0),o):it(.5)}function XM(e,t){const n=l[function(e){return"interpolate"+e.toLowerCase().split("-").map(e=>e[0].toUpperCase()+e.slice(1)).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}function qM(e){const t=e.length/6|0,n=new Array(t);for(let i=0;i<t;)n[i]="#"+e.slice(6*i,6*++i);return n}function KM(e,t){for(const n in e)QM(n,t(e[n]))}const ZM={};function QM(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(ZM[e]=t,this):ZM[e]}KM({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},qM),KM({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},e=>GM(qM(e)));const JM="symbol",eR=e=>Ee(e)?e.map(e=>String(e)):String(e),tR=(e,t)=>e[1]-t[1],nR=(e,t)=>t[1]-e[1];function iR(e,t,n){let i;return _t(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,Math.floor(Ct(e.domain())/n||1)))),we(t)&&(i=t.step,t=t.interval),bt(t)&&(t=e.type===pM?Gu(t):e.type==fM?Hu(t):ae("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function rR(e,t,n){let i=e.range(),r=i[0],s=Oe(i),o=tR;if(r>s&&(i=s,s=r,r=i,o=nR),r=Math.floor(r),s=Math.ceil(s),t=t.map(t=>[t,e(t)]).filter(e=>r<=e[1]&&e[1]<=s).sort(o).map(e=>e[0]),n>0&&t.length>1){const e=[t[0],Oe(t)];for(;t.length>n&&t.length>=3;)t=t.filter((e,t)=>!(t%2));t.length<3&&(t=e)}return t}function sR(e,t){return e.bins?rR(e,e.bins):e.ticks?e.ticks(t):e.domain()}function oR(e,t,n,i,r,s){const o=t.type;let a=eR;if(o===pM||r===pM)a=e.timeFormat(i);else if(o===fM||r===fM)a=e.utcFormat(i);else if(UM(o)){const r=e.formatFloat(i);if(s||t.bins)a=r;else{const e=aR(t,n,!1);a=t=>e(t)?r(t):""}}else if(t.tickFormat){const r=t.domain();a=e.formatSpan(r[0],r[r.length-1],n,i)}else i&&(a=e.format(i));return a}function aR(e,t,n){const i=sR(e,t),r=e.base(),s=Math.log(r),o=Math.max(1,r*t/i.length),a=e=>{let t=e/Math.pow(r,Math.round(Math.log(e)/s));return t*r<r-.5&&(t*=r),t<=o};return n?i.filter(a):a}const lR={[yM]:"quantiles",[_M]:"thresholds",[vM]:"domain"},uR={[yM]:"quantiles",[_M]:"domain"};function cR(e,t){return e.bins?function(e){const t=e.slice(0,-1);return t.max=Oe(e),t}(e.bins):e.type===uM?aR(e,t,!0):lR[e.type]?function(e){const t=[-1/0].concat(e);return t.max=1/0,t}(e[lR[e.type]]()):sR(e,t)}function dR(e,t,n,i,r,s,o){const a=uR[t.type]&&s!==pM&&s!==fM?function(e,t,n){const i=t[uR[t.type]](),r=i.length;let s,o=r>1?i[1]-i[0]:i[0];for(s=1;s<r;++s)o=Math.min(o,i[s]-i[s-1]);return e.formatSpan(0,o,30,n)}(e,t,r):oR(e,t,n,r,s,o);return i===JM&&(e=>lR[e.type]||e.bins)(t)?hR(a):"discrete"===i?fR(a):mR(a)}const hR=e=>(t,n,i)=>{const r=pR(i[n+1],pR(i.max,1/0)),s=gR(t,e),o=gR(r,e);return s&&o?s+" "+o:o?"< "+o:"≥ "+s},pR=(e,t)=>null!=e?e:t,fR=e=>(t,n)=>n?e(t):null,mR=e=>t=>e(t),gR=(e,t)=>Number.isFinite(e)?t(e):null;function yR(e,t,n,i){const r=i||t.type;return bt(n)&&function(e){return LM(e,CM)}(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==pM?n||r!==fM?dR(e,t,5,null,n,i,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}function _R(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=yR(e,t,n.format,n.formatType);if($M(t.type)){const e=cR(t).slice(1).map(r),n=e.length;return"".concat(n," boundar").concat(1===n?"y":"ies",": ").concat(e.join(", "))}if(BM(t.type)){const e=t.domain(),n=e.length,s=n>i?e.slice(0,i-2).map(r).join(", ")+", ending with "+e.slice(-1).map(r):e.map(r).join(", ");return"".concat(n," value").concat(1===n?"":"s",": ").concat(s)}{const e=t.domain();return"values from ".concat(r(e[0])," to ").concat(r(Oe(e)))}}function vR(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function bR(e){Ho.call(this,null,e)}function TR(e){Ho.call(this,null,e)}function xR(){return mo({})}function ER(e){Ho.call(this,null,e)}function wR(e){Ho.call(this,[],e)}pt(bR,Ho,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,s=e.scale,o=iR(s,null==e.count?e.values?e.values.length:10:e.count,e.minstep),a=e.format||oR(n,s,o,e.formatSpecifier,e.formatType,!!e.values),l=e.values?rR(s,e.values,o):sR(s,o);return r&&(i.rem=r),r=l.map((e,t)=>mo({index:t/(l.length-1||1),value:e,label:a(e)})),e.extra&&r.length&&r.push(mo({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),pt(TR,Ho,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||xR,s=e.key||po,o=this.value;return Ee(i.encode)&&(i.encode=null),o&&(e.modified("key")||t.modified(s))&&ae("DataJoin does not support modified key function or fields."),o||(t=t.addAll(),this.value=o=function(e){const t=dt().test(e=>e.exit);return t.lookup=n=>t.get(e(n)),t}(s)),t.visit(t.ADD,e=>{const t=s(e);let n=o.get(t);n?n.exit?(o.empty--,i.add.push(n)):i.mod.push(n):(n=r(e),o.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1}),t.visit(t.MOD,e=>{const t=s(e),n=o.get(t);n&&(n.datum=e,i.mod.push(n))}),t.visit(t.REM,e=>{const t=s(e),n=o.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++o.empty)}),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),i}}),pt(ER,Ho,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,s=t.encode;if(Ee(s)){if(!n.changed()&&!s.every(e=>r[e]))return t.StopPropagation;s=s[0],n.encode=null}var o="enter"===s,a=r.update||me,l=r.enter||me,u=r.exit||me,c=(s&&!o?r[s]:a)||me;if(t.changed(t.ADD)&&(t.visit(t.ADD,t=>{l(t,e),a(t,e)}),n.modifies(l.output),n.modifies(a.output),c!==me&&c!==a&&(t.visit(t.ADD,t=>{c(t,e)}),n.modifies(c.output))),t.changed(t.REM)&&u!==me&&(t.visit(t.REM,t=>{u(t,e)}),n.modifies(u.output)),o||c!==me){const r=t.MOD|(e.modified()?t.REFLOW:0);o?(t.visit(r,t=>{const r=l(t,e)||i;(c(t,e)||r)&&n.mod.push(t)}),n.mod.length&&n.modifies(l.output)):t.visit(r,t=>{(c(t,e)||i)&&n.mod.push(t)}),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}}),pt(wR,Ho,{transform(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,i,r,s,o,a=t.dataflow.locale(),l=t.fork(t.NO_SOURCE|t.NO_FIELDS),u=this.value,c=e.type||JM,d=e.scale,h=+e.limit,p=iR(d,null==e.count?5:e.count,e.minstep),f=!!e.values||c===JM,m=e.format||dR(a,d,p,c,e.formatSpecifier,e.formatType,f),g=e.values||cR(d,p);return u&&(l.rem=u),c===JM?(h&&g.length>h?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),u=g.slice(0,h-1),o=!0):u=g,Ke(r=e.size)?(e.values||0!==d(u[0])||(u=u.slice(1)),s=u.reduce((t,n)=>Math.max(t,r(n,e)),0)):r=it(s=r||8),u=u.map((t,n)=>mo({index:n,label:m(t,n,u),value:t,offset:s,size:r(t,e)})),o&&(o=g[u.length],u.push(mo({index:u.length,label:"…".concat(g.length-u.length," entries"),value:o,offset:s,size:r(o,e)})))):"gradient"===c?(n=d.domain(),i=WM(d,n[0],Oe(n)),g.length<3&&!e.values&&n[0]!==Oe(n)&&(g=[n[0],Oe(n)]),u=g.map((e,t)=>mo({index:t,label:m(e,t,g),value:e,perc:i(e)}))):(r=g.length-1,i=function(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+Oe(t),s=r-i;if(e.type===vM){const e=n?s/n:.1;i-=e,r+=e,s=r-i}return e=>(e-i)/s}(d),u=g.map((e,t)=>mo({index:t,label:m(e,t,g),value:e,perc:t?i(e):0,perc2:t===r?1:i(g[t+1])}))),l.source=u,l.add=u,this.value=u,l}});const IR=e=>e.source.x,AR=e=>e.source.y,SR=e=>e.target.x,CR=e=>e.target.y;function OR(e){Ho.call(this,{},e)}OR.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},pt(OR,Ho,{transform(e,t){var n=e.sourceX||IR,i=e.sourceY||AR,r=e.targetX||SR,s=e.targetY||CR,o=e.as||"path",a=e.orient||"vertical",l=e.shape||"line",u=NR.get(l+"-"+a)||NR.get(l);return u||ae("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,e=>{e[o]=u(n(e),i(e),r(e),s(e))}),t.reflow(e.modified()).modifies(o)}});const MR=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,RR=(e,t,n,i)=>{var r=n-e,s=i-t,o=Math.sqrt(r*r+s*s)/2;return"M"+e+","+t+"A"+o+","+o+" "+180*Math.atan2(s,r)/Math.PI+" 0 1 "+n+","+i},kR=(e,t,n,i)=>{const r=n-e,s=i-t,o=.2*(r+s),a=.2*(s-r);return"M"+e+","+t+"C"+(e+o)+","+(t+a)+" "+(n+a)+","+(i-o)+" "+n+","+i},NR=dt({line:MR,"line-radial":(e,t,n,i)=>MR(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:RR,"arc-radial":(e,t,n,i)=>RR(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:kR,"curve-radial":(e,t,n,i)=>kR(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),"orthogonal-horizontal":(e,t,n,i)=>"M"+e+","+t+"V"+i+"H"+n,"orthogonal-vertical":(e,t,n,i)=>"M"+e+","+t+"H"+n+"V"+i,"orthogonal-radial":(e,t,n,i)=>{const r=Math.cos(e),s=Math.sin(e),o=Math.cos(n),a=Math.sin(n);return"M"+t*r+","+t*s+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*o+","+t*a+"L"+i*o+","+i*a},"diagonal-horizontal":(e,t,n,i)=>{const r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+i+" "+n+","+i},"diagonal-vertical":(e,t,n,i)=>{const r=(t+i)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+i},"diagonal-radial":(e,t,n,i)=>{const r=Math.cos(e),s=Math.sin(e),o=Math.cos(n),a=Math.sin(n),l=(t+i)/2;return"M"+t*r+","+t*s+"C"+l*r+","+l*s+" "+l*o+","+l*a+" "+i*o+","+i*a}});function DR(e){Ho.call(this,null,e)}DR.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},pt(DR,Ho,{transform(e,t){var n,i,r,s=e.as||["startAngle","endAngle"],o=s[0],a=s[1],l=e.field||pe,u=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,d=t.source,h=d.map(l),p=h.length,f=u,m=(c-u)/vR(h),g=tl(p);for(e.sort&&g.sort((e,t)=>h[e]-h[t]),n=0;n<p;++n)r=h[g[n]],(i=d[g[n]])[o]=f,i[a]=f+=r*m;return this.value=h,t.reflow(e.modified()).modifies(s)}});function FR(e){return PM(e)&&e!==mM}const LR=Dt(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function PR(e){Ho.call(this,null,e),this.modified(!0)}function BR(e,t,n){UM(e)&&(Math.abs(t.reduce((e,t)=>e+(t<0?-1:t>0?1:0),0))!==t.length&&n.warn("Log scale domain includes zero: "+Ot(t)));return t}function $R(e,t,n){return Ke(e)&&(t||n)?YM(e,UR(t||[0,1],n)):e}function UR(e,t){return t?e.slice().reverse():e}function zR(e){Ho.call(this,null,e)}pt(PR,Ho,{transform(e,t){var n=t.dataflow,i=this.value,r=function(e){var t,n=e.type,i="";if(n===mM)return mM+"-"+lM;(function(e){const t=e.type;return PM(t)&&t!==pM&&t!==fM&&(e.scheme||e.range&&e.range.length&&e.range.every(bt))})(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?mM+"-":3===t?gM+"-":"");return(i+n||lM).toLowerCase()}(e);for(r in i&&r===i.type||(this.value=i=DM(r)()),e)if(!LR[r]){if("padding"===r&&FR(i.type))continue;Ke(i[r])?i[r](e[r]):n.warn("Unsupported scale property: "+r)}return function(e,t,n){var i=e.type,r=t.round||!1,s=t.range;if(null!=t.rangeStep)s=function(e,t,n){e!==xM&&e!==TM&&ae("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===TM?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*aM(n,r,i)]}(i,t,n);else if(t.scheme&&(s=function(e,t,n){var i,r=t.schemeExtent;Ee(t.scheme)?i=GM(t.scheme,t.interpolate,t.interpolateGamma):(i=QM(t.scheme.toLowerCase()))||ae("Unrecognized scheme name: ".concat(t.scheme));return n=e===vM?n+1:e===EM?n-1:e===yM||e===_M?+t.schemeCount||5:n,zM(e)?$R(i,r,t.reverse):Ke(i)?HM($R(i,r),n):e===bM?i:i.slice(0,n)}(i,t,n),Ke(s))){if(e.interpolator)return e.interpolator(s);ae("Scale type ".concat(i," does not support interpolating color schemes."))}if(s&&zM(i))return e.interpolator(GM(UR(s,t.reverse),t.interpolate,t.interpolateGamma));s&&t.interpolate&&e.interpolate?e.interpolate(XM(t.interpolate,t.interpolateGamma)):Ke(e.round)?e.round(r):Ke(e.rangeRound)&&e.interpolate(r?IS:wS);s&&e.range(UR(s,t.reverse))}(i,e,function(e,t,n){let i=t.bins;if(i&&!Ee(i)){const t=e.domain(),n=t[0],r=Oe(t),s=i.step;let o=null==i.start?n:i.start,a=null==i.stop?r:i.stop;s||ae("Scale bins parameter missing step property."),o<n&&(o=s*Math.ceil(n/s)),a>r&&(a=s*Math.floor(r/s)),i=tl(o,a+s/2,s)}i?e.bins=i:e.bins&&delete e.bins;e.type===EM&&(i?t.domain||t.domainRaw||(e.domain(i),n=i.length):e.bins=e.domain());return n}(i,e,function(e,t,n){const i=function(e,t,n){return t?(e.domain(BR(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(i>-1)return i;var r,s,o=t.domain,a=e.type,l=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===lM||t===cM||t===dM)}(e);if(!o)return 0;FR(a)&&t.padding&&o[0]!==Oe(o)&&(o=function(e,t,n,i,r,s){var o=Math.abs(Oe(n)-n[0]),a=o/(o-2*i),l=e===uM?je(t,null,a):e===dM?Ye(t,null,a,.5):e===cM?Ye(t,null,a,r||1):e===hM?Ge(t,null,a,s||1):Ve(t,null,a);return t=t.slice(),t[0]=l[0],t[t.length-1]=l[1],t}(a,o,t.range,t.padding,t.exponent,t.constant));if((l||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(r=(o=o.slice()).length-1||1,l&&(o[0]>0&&(o[0]=0),o[r]<0&&(o[r]=0)),null!=t.domainMin&&(o[0]=t.domainMin),null!=t.domainMax&&(o[r]=t.domainMax),null!=t.domainMid)){const e=(s=t.domainMid)>o[r]?r+1:s<o[0]?0:r;e!==r&&n.warn("Scale domainMid exceeds domain min or max.",s),o.splice(e,0,s)}e.domain(BR(a,o,n)),a===bM&&e.unknown(t.domainImplicit?QA:void 0);t.nice&&e.nice&&e.nice(!0!==t.nice&&iR(e,t.nice)||null);return o.length}(i,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),pt(zR,Ho,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(vo(e.sort)),this.modified(n),t}});const VR="zero",jR="center",YR="normalize",GR=["y0","y1"];function HR(e){Ho.call(this,null,e)}function WR(e,t,n,i,r){for(var s,o=(t-e.sum)/2,a=e.length,l=0;l<a;++l)(s=e[l])[i]=o,s[r]=o+=Math.abs(n(s))}function XR(e,t,n,i,r){for(var s,o=1/e.sum,a=0,l=e.length,u=0,c=0;u<l;++u)(s=e[u])[i]=a,s[r]=a=o*(c+=Math.abs(n(s)))}function qR(e,t,n,i,r){for(var s,o,a=0,l=0,u=e.length,c=0;c<u;++c)(s=+n(o=e[c]))<0?(o[i]=l,o[r]=l+=s):(o[i]=a,o[r]=a+=s)}HR.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:VR,values:[VR,jR,YR]},{name:"as",type:"string",array:!0,length:2,default:GR}]},pt(HR,Ho,{transform(e,t){var n,i,r,s,o=e.as||GR,a=o[0],l=o[1],u=vo(e.sort),c=e.field||pe,d=e.offset===jR?WR:e.offset===YR?XR:qR;for(n=function(e,t,n,i){var r,s,o,a,l,u,c,d,h,p=[],f=e=>e(l);if(null==t)p.push(e.slice());else for(r={},s=0,o=e.length;s<o;++s)l=e[s],(c=r[u=t.map(f)])||(r[u]=c=[],p.push(c)),c.push(l);for(u=0,h=0,a=p.length;u<a;++u){for(s=0,d=0,o=(c=p[u]).length;s<o;++s)d+=Math.abs(i(c[s]));c.sum=d,d>h&&(h=d),n&&c.sort(n)}return p.max=h,p}(t.source,e.groupby,u,c),i=0,r=n.length,s=n.max;i<r;++i)d(n[i],s,c,a,l);return t.reflow(e.modified()).modifies(o)}});const KR=e=>e;function ZR(e,t){e&&JR.hasOwnProperty(e.type)&&JR[e.type](e,t)}var QR={Feature:function(e,t){ZR(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i<r;)ZR(n[i].geometry,t)}},JR={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)e=n[i],t.point(e[0],e[1],e[2])},LineString:function(e,t){ek(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)ek(n[i],t,0)},Polygon:function(e,t){tk(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)tk(n[i],t)},GeometryCollection:function(e,t){for(var n=e.geometries,i=-1,r=n.length;++i<r;)ZR(n[i],t)}};function ek(e,t,n){var i,r=-1,s=e.length-n;for(t.lineStart();++r<s;)i=e[r],t.point(i[0],i[1],i[2]);t.lineEnd()}function tk(e,t){var n=-1,i=e.length;for(t.polygonStart();++n<i;)ek(e[n],t,1);t.polygonEnd()}function nk(e,t){e&&QR.hasOwnProperty(e.type)?QR[e.type](e,t):ZR(e,t)}class ik{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const r=t[i],s=e+r,o=Math.abs(e)<Math.abs(r)?e-(s-r):r-(s-e);o&&(t[n++]=o),e=s}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t,n,i,r=this._n,s=0;if(r>0){for(s=e[--r];r>0&&(t=s,n=e[--r],s=t+n,i=n-(s-t),!i););r>0&&(i<0&&e[r-1]<0||i>0&&e[r-1]>0)&&(n=2*i,t=s+n,n==t-s&&(s=t))}return s}}var rk=1e-6,sk=1e-12,ok=Math.PI,ak=ok/2,lk=ok/4,uk=2*ok,ck=180/ok,dk=ok/180,hk=Math.abs,pk=Math.atan,fk=Math.atan2,mk=Math.cos,gk=Math.ceil,yk=Math.exp,_k=(Math.floor,Math.hypot),vk=Math.log,bk=Math.pow,Tk=Math.sin,xk=Math.sign||function(e){return e>0?1:e<0?-1:0},Ek=Math.sqrt,wk=Math.tan;function Ik(e){return e>1?0:e<-1?ok:Math.acos(e)}function Ak(e){return e>1?ak:e<-1?-ak:Math.asin(e)}function Sk(){}var Ck,Ok,Mk,Rk,kk=new ik,Nk=new ik,Dk={point:Sk,lineStart:Sk,lineEnd:Sk,polygonStart:function(){Dk.lineStart=Fk,Dk.lineEnd=Bk},polygonEnd:function(){Dk.lineStart=Dk.lineEnd=Dk.point=Sk,kk.add(hk(Nk)),Nk=new ik},result:function(){var e=kk/2;return kk=new ik,e}};function Fk(){Dk.point=Lk}function Lk(e,t){Dk.point=Pk,Ck=Mk=e,Ok=Rk=t}function Pk(e,t){Nk.add(Rk*e-Mk*t),Mk=e,Rk=t}function Bk(){Pk(Ck,Ok)}const $k=Dk;var Uk=1/0,zk=Uk,Vk=-Uk,jk=Vk,Yk={point:function(e,t){e<Uk&&(Uk=e);e>Vk&&(Vk=e);t<zk&&(zk=t);t>jk&&(jk=t)},lineStart:Sk,lineEnd:Sk,polygonStart:Sk,polygonEnd:Sk,result:function(){var e=[[Uk,zk],[Vk,jk]];return Vk=jk=-(zk=Uk=1/0),e}};const Gk=Yk;var Hk,Wk,Xk,qk,Kk=0,Zk=0,Qk=0,Jk=0,eN=0,tN=0,nN=0,iN=0,rN=0,sN={point:oN,lineStart:aN,lineEnd:cN,polygonStart:function(){sN.lineStart=dN,sN.lineEnd=hN},polygonEnd:function(){sN.point=oN,sN.lineStart=aN,sN.lineEnd=cN},result:function(){var e=rN?[nN/rN,iN/rN]:tN?[Jk/tN,eN/tN]:Qk?[Kk/Qk,Zk/Qk]:[NaN,NaN];return Kk=Zk=Qk=Jk=eN=tN=nN=iN=rN=0,e}};function oN(e,t){Kk+=e,Zk+=t,++Qk}function aN(){sN.point=lN}function lN(e,t){sN.point=uN,oN(Xk=e,qk=t)}function uN(e,t){var n=e-Xk,i=t-qk,r=Ek(n*n+i*i);Jk+=r*(Xk+e)/2,eN+=r*(qk+t)/2,tN+=r,oN(Xk=e,qk=t)}function cN(){sN.point=oN}function dN(){sN.point=pN}function hN(){fN(Hk,Wk)}function pN(e,t){sN.point=fN,oN(Hk=Xk=e,Wk=qk=t)}function fN(e,t){var n=e-Xk,i=t-qk,r=Ek(n*n+i*i);Jk+=r*(Xk+e)/2,eN+=r*(qk+t)/2,tN+=r,nN+=(r=qk*e-Xk*t)*(Xk+e),iN+=r*(qk+t),rN+=3*r,oN(Xk=e,qk=t)}const mN=sN;function gN(e){this._context=e}gN.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,uk)}},result:Sk};var yN,_N,vN,bN,TN,xN=new ik,EN={point:Sk,lineStart:function(){EN.point=wN},lineEnd:function(){yN&&IN(_N,vN),EN.point=Sk},polygonStart:function(){yN=!0},polygonEnd:function(){yN=null},result:function(){var e=+xN;return xN=new ik,e}};function wN(e,t){EN.point=IN,_N=bN=e,vN=TN=t}function IN(e,t){bN-=e,TN-=t,xN.add(Ek(bN*bN+TN*TN)),bN=e,TN=t}const AN=EN;function SN(){this._string=[]}function CN(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function ON(e,t){var n,i,r=4.5;function s(e){return e&&("function"==typeof r&&i.pointRadius(+r.apply(this,arguments)),nk(e,n(i))),i.result()}return s.area=function(e){return nk(e,n($k)),$k.result()},s.measure=function(e){return nk(e,n(AN)),AN.result()},s.bounds=function(e){return nk(e,n(Gk)),Gk.result()},s.centroid=function(e){return nk(e,n(mN)),mN.result()},s.projection=function(t){return arguments.length?(n=null==t?(e=null,KR):(e=t).stream,s):e},s.context=function(e){return arguments.length?(i=null==e?(t=null,new SN):new gN(t=e),"function"!=typeof r&&i.pointRadius(r),s):t},s.pointRadius=function(e){return arguments.length?(r="function"==typeof e?e:(i.pointRadius(+e),+e),s):r},s.projection(e).context(t)}function MN(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:Sk,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function RN(e,t){return hk(e[0]-t[0])<rk&&hk(e[1]-t[1])<rk}function kN(e,t,n,i){this.x=e,this.z=t,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function NN(e,t,n,i,r){var s,o,a=[],l=[];if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n,i=e[0],o=e[t];if(RN(i,o)){if(!i[2]&&!o[2]){for(r.lineStart(),s=0;s<t;++s)r.point((i=e[s])[0],i[1]);return void r.lineEnd()}o[0]+=2*rk}a.push(n=new kN(i,e,null,!0)),l.push(n.o=new kN(i,null,n,!1)),a.push(n=new kN(o,e,null,!1)),l.push(n.o=new kN(o,null,n,!0))}}),a.length){for(l.sort(t),DN(a),DN(l),s=0,o=l.length;s<o;++s)l[s].e=n=!n;for(var u,c,d=a[0];;){for(var h=d,p=!0;h.v;)if((h=h.n)===d)return;u=h.z,r.lineStart();do{if(h.v=h.o.v=!0,h.e){if(p)for(s=0,o=u.length;s<o;++s)r.point((c=u[s])[0],c[1]);else i(h.x,h.n.x,1,r);h=h.n}else{if(p)for(u=h.p.z,s=u.length-1;s>=0;--s)r.point((c=u[s])[0],c[1]);else i(h.x,h.p.x,-1,r);h=h.p}u=(h=h.o).z,p=!p}while(!h.v);r.lineEnd()}}}function DN(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i<t;)r.n=n=e[i],n.p=r,r=n;r.n=n=e[0],n.p=r}}function FN(e){return[fk(e[1],e[0]),Ak(e[2])]}function LN(e){var t=e[0],n=e[1],i=mk(n);return[i*mk(t),i*Tk(t),Tk(n)]}function PN(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function BN(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function $N(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function UN(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function zN(e){var t=Ek(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function VN(e){return hk(e[0])<=ok?e[0]:xk(e[0])*((hk(e[0])+ok)%uk-ok)}function jN(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function YN(e,t,n,i){return function(r){var s,o,a,l=t(r),u=MN(),c=t(u),d=!1,h={point:p,lineStart:m,lineEnd:g,polygonStart:function(){h.point=y,h.lineStart=_,h.lineEnd=v,o=[],s=[]},polygonEnd:function(){h.point=p,h.lineStart=m,h.lineEnd=g,o=jN(o);var e=function(e,t){var n=VN(t),i=t[1],r=Tk(i),s=[Tk(n),-mk(n),0],o=0,a=0,l=new ik;1===r?i=ak+rk:-1===r&&(i=-ak-rk);for(var u=0,c=e.length;u<c;++u)if(h=(d=e[u]).length)for(var d,h,p=d[h-1],f=VN(p),m=p[1]/2+lk,g=Tk(m),y=mk(m),_=0;_<h;++_,f=b,g=x,y=E,p=v){var v=d[_],b=VN(v),T=v[1]/2+lk,x=Tk(T),E=mk(T),w=b-f,I=w>=0?1:-1,A=I*w,S=A>ok,C=g*x;if(l.add(fk(C*I*Tk(A),y*E+C*mk(A))),o+=S?w+I*uk:w,S^f>=n^b>=n){var O=BN(LN(p),LN(v));zN(O);var M=BN(s,O);zN(M);var R=(S^w>=0?-1:1)*Ak(M[2]);(i>R||i===R&&(O[0]||O[1]))&&(a+=S^w>=0?1:-1)}}return(o<-rk||o<rk&&l<-1e-12)^1&a}(s,i);o.length?(d||(r.polygonStart(),d=!0),NN(o,HN,e,n,r)):e&&(d||(r.polygonStart(),d=!0),r.lineStart(),n(null,null,1,r),r.lineEnd()),d&&(r.polygonEnd(),d=!1),o=s=null},sphere:function(){r.polygonStart(),r.lineStart(),n(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function p(t,n){e(t,n)&&r.point(t,n)}function f(e,t){l.point(e,t)}function m(){h.point=f,l.lineStart()}function g(){h.point=p,l.lineEnd()}function y(e,t){a.push([e,t]),c.point(e,t)}function _(){c.lineStart(),a=[]}function v(){y(a[0][0],a[0][1]),c.lineEnd();var e,t,n,i,l=c.clean(),h=u.result(),p=h.length;if(a.pop(),s.push(a),a=null,p)if(1&l){if((t=(n=h[0]).length-1)>0){for(d||(r.polygonStart(),d=!0),r.lineStart(),e=0;e<t;++e)r.point((i=n[e])[0],i[1]);r.lineEnd()}}else p>1&&2&l&&h.push(h.pop().concat(h.shift())),o.push(h.filter(GN))}return h}}function GN(e){return e.length>1}function HN(e,t){return((e=e.x)[0]<0?e[1]-ak-rk:ak-e[1])-((t=t.x)[0]<0?t[1]-ak-rk:ak-t[1])}SN.prototype={_radius:4.5,_circle:CN(4.5),pointRadius:function(e){return(e=+e)!==this._radius&&(this._radius=e,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._string.push("M",e,",",t),this._point=1;break;case 1:this._string.push("L",e,",",t);break;default:null==this._circle&&(this._circle=CN(this._radius)),this._string.push("M",e,",",t,this._circle)}},result:function(){if(this._string.length){var e=this._string.join("");return this._string=[],e}return null}};const WN=YN(function(){return!0},function(e){var t,n=NaN,i=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(s,o){var a=s>0?ok:-ok,l=hk(s-n);hk(l-ok)<rk?(e.point(n,i=(i+o)/2>0?ak:-ak),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(a,i),e.point(s,i),t=0):r!==a&&l>=ok&&(hk(n-r)<rk&&(n-=r*rk),hk(s-a)<rk&&(s-=a*rk),i=function(e,t,n,i){var r,s,o=Tk(e-n);return hk(o)>rk?pk((Tk(t)*(s=mk(i))*Tk(n)-Tk(i)*(r=mk(t))*Tk(e))/(r*s*o)):(t+i)/2}(n,i,s,o),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(a,i),t=0),e.point(n=s,i=o),r=a},lineEnd:function(){e.lineEnd(),n=i=NaN},clean:function(){return 2-t}}},function(e,t,n,i){var r;if(null==e)r=n*ak,i.point(-ok,r),i.point(0,r),i.point(ok,r),i.point(ok,0),i.point(ok,-r),i.point(0,-r),i.point(-ok,-r),i.point(-ok,0),i.point(-ok,r);else if(hk(e[0]-t[0])>rk){var s=e[0]<t[0]?ok:-ok;r=n*s/2,i.point(-s,r),i.point(0,r),i.point(s,r)}else i.point(t[0],t[1])},[-ok,-ak]);function XN(e,t,n,i,r,s){if(n){var o=mk(t),a=Tk(t),l=i*n;null==r?(r=t+i*uk,s=t-l/2):(r=qN(o,r),s=qN(o,s),(i>0?r<s:r>s)&&(r+=i*uk));for(var u,c=r;i>0?c>s:c<s;c-=l)u=FN([o,-a*mk(c),-a*Tk(c)]),e.point(u[0],u[1])}}function qN(e,t){(t=LN(t))[0]-=e,zN(t);var n=Ik(-t[1]);return((-t[2]<0?-n:n)+uk-rk)%uk}var KN=1e9,ZN=-KN;function QN(e,t,n,i){function r(r,s){return e<=r&&r<=n&&t<=s&&s<=i}function s(r,s,a,u){var c=0,d=0;if(null==r||(c=o(r,a))!==(d=o(s,a))||l(r,s)<0^a>0)do{u.point(0===c||3===c?e:n,c>1?i:t)}while((c=(c+a+4)%4)!==d);else u.point(s[0],s[1])}function o(i,r){return hk(i[0]-e)<rk?r>0?0:3:hk(i[0]-n)<rk?r>0?2:1:hk(i[1]-t)<rk?r>0?1:0:r>0?3:2}function a(e,t){return l(e.x,t.x)}function l(e,t){var n=o(e,1),i=o(t,1);return n!==i?n-i:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(o){var l,u,c,d,h,p,f,m,g,y,_,v=o,b=MN(),T={point:x,lineStart:function(){T.point=E,u&&u.push(c=[]);y=!0,g=!1,f=m=NaN},lineEnd:function(){l&&(E(d,h),p&&g&&b.rejoin(),l.push(b.result()));T.point=x,g&&v.lineEnd()},polygonStart:function(){v=b,l=[],u=[],_=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,r=u.length;n<r;++n)for(var s,o,a=u[n],l=1,c=a.length,d=a[0],h=d[0],p=d[1];l<c;++l)s=h,o=p,h=(d=a[l])[0],p=d[1],o<=i?p>i&&(h-s)*(i-o)>(p-o)*(e-s)&&++t:p<=i&&(h-s)*(i-o)<(p-o)*(e-s)&&--t;return t}(),n=_&&t,r=(l=jN(l)).length;(n||r)&&(o.polygonStart(),n&&(o.lineStart(),s(null,null,1,o),o.lineEnd()),r&&NN(l,a,t,s,o),o.polygonEnd());v=o,l=u=c=null}};function x(e,t){r(e,t)&&v.point(e,t)}function E(s,o){var a=r(s,o);if(u&&c.push([s,o]),y)d=s,h=o,p=a,y=!1,a&&(v.lineStart(),v.point(s,o));else if(a&&g)v.point(s,o);else{var l=[f=Math.max(ZN,Math.min(KN,f)),m=Math.max(ZN,Math.min(KN,m))],b=[s=Math.max(ZN,Math.min(KN,s)),o=Math.max(ZN,Math.min(KN,o))];!function(e,t,n,i,r,s){var o,a=e[0],l=e[1],u=0,c=1,d=t[0]-a,h=t[1]-l;if(o=n-a,d||!(o>0)){if(o/=d,d<0){if(o<u)return;o<c&&(c=o)}else if(d>0){if(o>c)return;o>u&&(u=o)}if(o=r-a,d||!(o<0)){if(o/=d,d<0){if(o>c)return;o>u&&(u=o)}else if(d>0){if(o<u)return;o<c&&(c=o)}if(o=i-l,h||!(o>0)){if(o/=h,h<0){if(o<u)return;o<c&&(c=o)}else if(h>0){if(o>c)return;o>u&&(u=o)}if(o=s-l,h||!(o<0)){if(o/=h,h<0){if(o>c)return;o>u&&(u=o)}else if(h>0){if(o<u)return;o<c&&(c=o)}return u>0&&(e[0]=a+u*d,e[1]=l+u*h),c<1&&(t[0]=a+c*d,t[1]=l+c*h),!0}}}}}(l,b,e,t,n,i)?a&&(v.lineStart(),v.point(s,o),_=!1):(g||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),a||v.lineEnd(),_=!1)}f=s,m=o,g=a}return T}}function JN(e,t){function n(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,i){return(n=t.invert(n,i))&&e.invert(n[0],n[1])}),n}function eD(e,t){return[hk(e)>ok?e+Math.round(-e/uk)*uk:e,t]}function tD(e,t,n){return(e%=uk)?t||n?JN(iD(e),rD(t,n)):iD(e):t||n?rD(t,n):eD}function nD(e){return function(t,n){return[(t+=e)>ok?t-uk:t<-ok?t+uk:t,n]}}function iD(e){var t=nD(e);return t.invert=nD(-e),t}function rD(e,t){var n=mk(e),i=Tk(e),r=mk(t),s=Tk(t);function o(e,t){var o=mk(t),a=mk(e)*o,l=Tk(e)*o,u=Tk(t),c=u*n+a*i;return[fk(l*r-c*s,a*n-u*i),Ak(c*r+l*s)]}return o.invert=function(e,t){var o=mk(t),a=mk(e)*o,l=Tk(e)*o,u=Tk(t),c=u*r-l*s;return[fk(l*r+u*s,a*n+c*i),Ak(c*n-a*i)]},o}function sD(e){return function(t){var n=new oD;for(var i in e)n[i]=e[i];return n.stream=t,n}}function oD(){}function aD(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),nk(n,e.stream(Gk)),t(Gk.result()),null!=i&&e.clipExtent(i),e}function lD(e,t,n){return aD(e,function(n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],s=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),o=+t[0][0]+(i-s*(n[1][0]+n[0][0]))/2,a=+t[0][1]+(r-s*(n[1][1]+n[0][1]))/2;e.scale(150*s).translate([o,a])},n)}function uD(e,t,n){return lD(e,[[0,0],t],n)}function cD(e,t,n){return aD(e,function(n){var i=+t,r=i/(n[1][0]-n[0][0]),s=(i-r*(n[1][0]+n[0][0]))/2,o=-r*n[0][1];e.scale(150*r).translate([s,o])},n)}function dD(e,t,n){return aD(e,function(n){var i=+t,r=i/(n[1][1]-n[0][1]),s=-r*n[0][0],o=(i-r*(n[1][1]+n[0][1]))/2;e.scale(150*r).translate([s,o])},n)}eD.invert=eD,oD.prototype={constructor:oD,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var hD=mk(30*dk);function pD(e,t){return+t?function(e,t){function n(i,r,s,o,a,l,u,c,d,h,p,f,m,g){var y=u-i,_=c-r,v=y*y+_*_;if(v>4*t&&m--){var b=o+h,T=a+p,x=l+f,E=Ek(b*b+T*T+x*x),w=Ak(x/=E),I=hk(hk(x)-1)<rk||hk(s-d)<rk?(s+d)/2:fk(T,b),A=e(I,w),S=A[0],C=A[1],O=S-i,M=C-r,R=_*O-y*M;(R*R/v>t||hk((y*O+_*M)/v-.5)>.3||o*h+a*p+l*f<hD)&&(n(i,r,s,o,a,l,S,C,I,b/=E,T/=E,x,m,g),g.point(S,C),n(S,C,I,b,T,x,u,c,d,h,p,f,m,g))}}return function(t){var i,r,s,o,a,l,u,c,d,h,p,f,m={point:g,lineStart:y,lineEnd:v,polygonStart:function(){t.polygonStart(),m.lineStart=b},polygonEnd:function(){t.polygonEnd(),m.lineStart=y}};function g(n,i){n=e(n,i),t.point(n[0],n[1])}function y(){c=NaN,m.point=_,t.lineStart()}function _(i,r){var s=LN([i,r]),o=e(i,r);n(c,d,u,h,p,f,c=o[0],d=o[1],u=i,h=s[0],p=s[1],f=s[2],16,t),t.point(c,d)}function v(){m.point=g,t.lineEnd()}function b(){y(),m.point=T,m.lineEnd=x}function T(e,t){_(i=e,t),r=c,s=d,o=h,a=p,l=f,m.point=_}function x(){n(c,d,u,h,p,f,r,s,i,o,a,l,16,t),m.lineEnd=v,v()}return m}}(e,t):function(e){return sD({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}(e)}var fD=sD({point:function(e,t){this.stream.point(e*dk,t*dk)}});function mD(e,t,n,i,r,s){if(!s)return function(e,t,n,i,r){function s(s,o){return[t+e*(s*=i),n-e*(o*=r)]}return s.invert=function(s,o){return[(s-t)/e*i,(n-o)/e*r]},s}(e,t,n,i,r);var o=mk(s),a=Tk(s),l=o*e,u=a*e,c=o/e,d=a/e,h=(a*n-o*t)/e,p=(a*t+o*n)/e;function f(e,s){return[l*(e*=i)-u*(s*=r)+t,n-u*e-l*s]}return f.invert=function(e,t){return[i*(c*e-d*t+h),r*(p-d*e-c*t)]},f}function gD(e){return yD(function(){return e})()}function yD(e){var t,n,i,r,s,o,a,l,u,c,d=150,h=480,p=250,f=0,m=0,g=0,y=0,_=0,v=0,b=1,T=1,x=null,E=WN,w=null,I=KR,A=.5;function S(e){return l(e[0]*dk,e[1]*dk)}function C(e){return(e=l.invert(e[0],e[1]))&&[e[0]*ck,e[1]*ck]}function O(){var e=mD(d,0,0,b,T,v).apply(null,t(f,m)),i=mD(d,h-e[0],p-e[1],b,T,v);return n=tD(g,y,_),a=JN(t,i),l=JN(n,a),o=pD(a,A),M()}function M(){return u=c=null,S}return S.stream=function(e){return u&&c===e?u:u=fD(function(e){return sD({point:function(t,n){var i=e(t,n);return this.stream.point(i[0],i[1])}})}(n)(E(o(I(c=e)))))},S.preclip=function(e){return arguments.length?(E=e,x=void 0,M()):E},S.postclip=function(e){return arguments.length?(I=e,w=i=r=s=null,M()):I},S.clipAngle=function(e){return arguments.length?(E=+e?function(e){var t=mk(e),n=6*dk,i=t>0,r=hk(t)>rk;function s(e,n){return mk(e)*mk(n)>t}function o(e,n,i){var r=[1,0,0],s=BN(LN(e),LN(n)),o=PN(s,s),a=s[0],l=o-a*a;if(!l)return!i&&e;var u=t*o/l,c=-t*a/l,d=BN(r,s),h=UN(r,u);$N(h,UN(s,c));var p=d,f=PN(h,p),m=PN(p,p),g=f*f-m*(PN(h,h)-1);if(!(g<0)){var y=Ek(g),_=UN(p,(-f-y)/m);if($N(_,h),_=FN(_),!i)return _;var v,b=e[0],T=n[0],x=e[1],E=n[1];T<b&&(v=b,b=T,T=v);var w=T-b,I=hk(w-ok)<rk;if(!I&&E<x&&(v=x,x=E,E=v),I||w<rk?I?x+E>0^_[1]<(hk(_[0]-b)<rk?x:E):x<=_[1]&&_[1]<=E:w>ok^(b<=_[0]&&_[0]<=T)){var A=UN(p,(-f+y)/m);return $N(A,h),[_,FN(A)]}}}function a(t,n){var r=i?e:ok-e,s=0;return t<-r?s|=1:t>r&&(s|=2),n<-r?s|=4:n>r&&(s|=8),s}return YN(s,function(e){var t,n,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(d,h){var p,f=[d,h],m=s(d,h),g=i?m?0:a(d,h):m?a(d+(d<0?ok:-ok),h):0;if(!t&&(u=l=m)&&e.lineStart(),m!==l&&(!(p=o(t,f))||RN(t,p)||RN(f,p))&&(f[2]=1),m!==l)c=0,m?(e.lineStart(),p=o(f,t),e.point(p[0],p[1])):(p=o(t,f),e.point(p[0],p[1],2),e.lineEnd()),t=p;else if(r&&t&&i^m){var y;g&n||!(y=o(f,t,!0))||(c=0,i?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||t&&RN(t,f)||e.point(f[0],f[1]),t=f,l=m,n=g},lineEnd:function(){l&&e.lineEnd(),t=null},clean:function(){return c|(u&&l)<<1}}},function(t,i,r,s){XN(s,e,n,r,t,i)},i?[0,-e]:[-ok,e-ok])}(x=e*dk):(x=null,WN),M()):x*ck},S.clipExtent=function(e){return arguments.length?(I=null==e?(w=i=r=s=null,KR):QN(w=+e[0][0],i=+e[0][1],r=+e[1][0],s=+e[1][1]),M()):null==w?null:[[w,i],[r,s]]},S.scale=function(e){return arguments.length?(d=+e,O()):d},S.translate=function(e){return arguments.length?(h=+e[0],p=+e[1],O()):[h,p]},S.center=function(e){return arguments.length?(f=e[0]%360*dk,m=e[1]%360*dk,O()):[f*ck,m*ck]},S.rotate=function(e){return arguments.length?(g=e[0]%360*dk,y=e[1]%360*dk,_=e.length>2?e[2]%360*dk:0,O()):[g*ck,y*ck,_*ck]},S.angle=function(e){return arguments.length?(v=e%360*dk,O()):v*ck},S.reflectX=function(e){return arguments.length?(b=e?-1:1,O()):b<0},S.reflectY=function(e){return arguments.length?(T=e?-1:1,O()):T<0},S.precision=function(e){return arguments.length?(o=pD(a,A=e*e),M()):Ek(A)},S.fitExtent=function(e,t){return lD(S,e,t)},S.fitSize=function(e,t){return uD(S,e,t)},S.fitWidth=function(e,t){return cD(S,e,t)},S.fitHeight=function(e,t){return dD(S,e,t)},function(){return t=e.apply(this,arguments),S.invert=t.invert&&C,O()}}function _D(e){var t=0,n=ok/3,i=yD(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*dk,n=e[1]*dk):[t*ck,n*ck]},r}function vD(e,t){var n=Tk(e),i=(n+Tk(t))/2;if(hk(i)<rk)return function(e){var t=mk(e);function n(e,n){return[e*t,Tk(n)/t]}return n.invert=function(e,n){return[e/t,Ak(n*t)]},n}(e);var r=1+n*(2*i-n),s=Ek(r)/i;function o(e,t){var n=Ek(r-2*i*Tk(t))/i;return[n*Tk(e*=i),s-n*mk(e)]}return o.invert=function(e,t){var n=s-t,o=fk(e,hk(n))*xk(n);return n*i<0&&(o-=ok*xk(e)*xk(n)),[o/i,Ak((r-(e*e+n*n)*i*i)/(2*i))]},o}function bD(){return _D(vD).scale(155.424).center([0,33.6442])}function TD(){return bD().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function xD(e){return function(t,n){var i=mk(t),r=mk(n),s=e(i*r);return s===1/0?[2,0]:[s*r*Tk(t),s*Tk(n)]}}function ED(e){return function(t,n){var i=Ek(t*t+n*n),r=e(i),s=Tk(r),o=mk(r);return[fk(t*s,i*o),Ak(i&&n*s/i)]}}var wD=xD(function(e){return Ek(2/(1+e))});wD.invert=ED(function(e){return 2*Ak(e/2)});var ID=xD(function(e){return(e=Ik(e))&&e/Tk(e)});function AD(e,t){return[e,vk(wk((ak+t)/2))]}function SD(e){var t,n,i,r=gD(e),s=r.center,o=r.scale,a=r.translate,l=r.clipExtent,u=null;function c(){var s=ok*o(),a=r(function(e){function t(t){return(t=e(t[0]*dk,t[1]*dk))[0]*=ck,t[1]*=ck,t}return e=tD(e[0]*dk,e[1]*dk,e.length>2?e[2]*dk:0),t.invert=function(t){return(t=e.invert(t[0]*dk,t[1]*dk))[0]*=ck,t[1]*=ck,t},t}(r.rotate()).invert([0,0]));return l(null==u?[[a[0]-s,a[1]-s],[a[0]+s,a[1]+s]]:e===AD?[[Math.max(a[0]-s,u),t],[Math.min(a[0]+s,n),i]]:[[u,Math.max(a[1]-s,t)],[n,Math.min(a[1]+s,i)]])}return r.scale=function(e){return arguments.length?(o(e),c()):o()},r.translate=function(e){return arguments.length?(a(e),c()):a()},r.center=function(e){return arguments.length?(s(e),c()):s()},r.clipExtent=function(e){return arguments.length?(null==e?u=t=n=i=null:(u=+e[0][0],t=+e[0][1],n=+e[1][0],i=+e[1][1]),c()):null==u?null:[[u,t],[n,i]]},c()}function CD(e){return wk((ak+e)/2)}function OD(e,t){var n=mk(e),i=e===t?Tk(e):vk(n/mk(t))/vk(CD(t)/CD(e)),r=n*bk(CD(e),i)/i;if(!i)return AD;function s(e,t){r>0?t<-ak+rk&&(t=-ak+rk):t>ak-rk&&(t=ak-rk);var n=r/bk(CD(t),i);return[n*Tk(i*e),r-n*mk(i*e)]}return s.invert=function(e,t){var n=r-t,s=xk(i)*Ek(e*e+n*n),o=fk(e,hk(n))*xk(n);return n*i<0&&(o-=ok*xk(e)*xk(n)),[o/i,2*pk(bk(r/s,1/i))-ak]},s}function MD(e,t){return[e,t]}function RD(e,t){var n=mk(e),i=e===t?Tk(e):(n-mk(t))/(t-e),r=n/i+e;if(hk(i)<rk)return MD;function s(e,t){var n=r-t,s=i*e;return[n*Tk(s),r-n*mk(s)]}return s.invert=function(e,t){var n=r-t,s=fk(e,hk(n))*xk(n);return n*i<0&&(s-=ok*xk(e)*xk(n)),[s/i,r-xk(i)*Ek(e*e+n*n)]},s}ID.invert=ED(function(e){return e}),AD.invert=function(e,t){return[e,2*pk(yk(t))-ak]},MD.invert=MD;var kD=1.340264,ND=-.081106,DD=893e-6,FD=.003796,LD=Ek(3)/2;function PD(e,t){var n=Ak(LD*Tk(t)),i=n*n,r=i*i*i;return[e*mk(n)/(LD*(kD+3*ND*i+r*(7*DD+9*FD*i))),n*(kD+ND*i+r*(DD+FD*i))]}function BD(e,t){var n=mk(t),i=mk(e)*n;return[n*Tk(e)/i,Tk(t)/i]}function $D(e,t){var n=t*t,i=n*n;return[e*(.8707-.131979*n+i*(i*(.003971*n-.001529*i)-.013791)),t*(1.007226+n*(.015085+i*(.028874*n-.044475-.005916*i)))]}function UD(e,t){return[mk(t)*Tk(e),Tk(t)]}function zD(e,t){var n=mk(t),i=1+mk(e)*n;return[n*Tk(e)/i,Tk(t)/i]}function VD(e,t){return[vk(wk((ak+t)/2)),-e]}PD.invert=function(e,t){for(var n,i=t,r=i*i,s=r*r*r,o=0;o<12&&(s=(r=(i-=n=(i*(kD+ND*r+s*(DD+FD*r))-t)/(kD+3*ND*r+s*(7*DD+9*FD*r)))*i)*r*r,!(hk(n)<sk));++o);return[LD*e*(kD+3*ND*r+s*(7*DD+9*FD*r))/mk(i),Ak(Tk(i)/LD)]},BD.invert=ED(pk),$D.invert=function(e,t){var n,i=t,r=25;do{var s=i*i,o=s*s;i-=n=(i*(1.007226+s*(.015085+o*(.028874*s-.044475-.005916*o)))-t)/(1.007226+s*(.045255+o*(.259866*s-.311325-.005916*11*o)))}while(hk(n)>rk&&--r>0);return[e/(.8707+(s=i*i)*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979)),i]},UD.invert=ED(Ak),zD.invert=ED(function(e){return 2*pk(e)}),VD.invert=function(e,t){return[-t,2*pk(yk(e))-ak]};var jD=Math.abs,YD=(Math.atan,Math.atan2,Math.ceil,Math.cos),GD=(Math.exp,Math.floor,Math.log,Math.max,Math.min,Math.pow,Math.round,Math.sign,Math.sin),HD=(Math.tan,Math.PI),WD=HD/2,XD=(Math.SQRT1_2,KD(2));KD(HD);function qD(e){return e>1?WD:e<-1?-WD:Math.asin(e)}function KD(e){return e>0?Math.sqrt(e):0}function ZD(e,t){var n,i=e*GD(t),r=30;do{t-=n=(t+GD(t)-i)/(1+YD(t))}while(jD(n)>1e-6&&--r>0);return t/2}var QD=function(e,t,n){function i(i,r){return[e*i*YD(r=ZD(n,r)),t*GD(r)]}return i.invert=function(i,r){return r=qD(r/t),[i/(e*YD(r)),qD((2*r+GD(2*r))/n)]},i}(XD/WD,XD,HD);const JD=ON(),eF=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function tF(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(iF[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=ON().projection(i),i.copy=i.copy||function(){const e=n();return eF.forEach(t=>{i[t]&&e[t](i[t]())}),e.path.pointRadius(i.path.pointRadius()),e},i}}(e,t),this):iF[e]||null}function nF(e){return e&&e.path||JD}const iF={albers:TD,albersusa:function(){var e,t,n,i,r,s,o=TD(),a=bD().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=bD().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(e,t){s=[e,t]}};function c(e){var t=e[0],o=e[1];return s=null,n.point(t,o),s||(i.point(t,o),s)||(r.point(t,o),s)}function d(){return e=t=null,c}return c.invert=function(e){var t=o.scale(),n=o.translate(),i=(e[0]-n[0])/t,r=(e[1]-n[1])/t;return(r>=.12&&r<.234&&i>=-.425&&i<-.214?a:r>=.166&&r<.234&&i>=-.214&&i<-.115?l:o).invert(e)},c.stream=function(n){return e&&t===n?e:(i=[o.stream(t=n),a.stream(n),l.stream(n)],r=i.length,e={point:function(e,t){for(var n=-1;++n<r;)i[n].point(e,t)},sphere:function(){for(var e=-1;++e<r;)i[e].sphere()},lineStart:function(){for(var e=-1;++e<r;)i[e].lineStart()},lineEnd:function(){for(var e=-1;++e<r;)i[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<r;)i[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<r;)i[e].polygonEnd()}});var i,r},c.precision=function(e){return arguments.length?(o.precision(e),a.precision(e),l.precision(e),d()):o.precision()},c.scale=function(e){return arguments.length?(o.scale(e),a.scale(.35*e),l.scale(e),c.translate(o.translate())):o.scale()},c.translate=function(e){if(!arguments.length)return o.translate();var t=o.scale(),s=+e[0],c=+e[1];return n=o.translate(e).clipExtent([[s-.455*t,c-.238*t],[s+.455*t,c+.238*t]]).stream(u),i=a.translate([s-.307*t,c+.201*t]).clipExtent([[s-.425*t+rk,c+.12*t+rk],[s-.214*t-rk,c+.234*t-rk]]).stream(u),r=l.translate([s-.205*t,c+.212*t]).clipExtent([[s-.214*t+rk,c+.166*t+rk],[s-.115*t-rk,c+.234*t-rk]]).stream(u),d()},c.fitExtent=function(e,t){return lD(c,e,t)},c.fitSize=function(e,t){return uD(c,e,t)},c.fitWidth=function(e,t){return cD(c,e,t)},c.fitHeight=function(e,t){return dD(c,e,t)},c.scale(1070)},azimuthalequalarea:function(){return gD(wD).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return gD(ID).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return _D(OD).scale(109.5).parallels([30,30])},conicequalarea:bD,conicequidistant:function(){return _D(RD).scale(131.154).center([0,13.9389])},equalEarth:function(){return gD(PD).scale(177.158)},equirectangular:function(){return gD(MD).scale(152.63)},gnomonic:function(){return gD(BD).scale(144.049).clipAngle(60)},identity:function(){var e,t,n,i,r,s,o,a=1,l=0,u=0,c=1,d=1,h=0,p=null,f=1,m=1,g=sD({point:function(e,t){var n=v([e,t]);this.stream.point(n[0],n[1])}}),y=KR;function _(){return f=a*c,m=a*d,s=o=null,v}function v(n){var i=n[0]*f,r=n[1]*m;if(h){var s=r*e-i*t;i=i*e+r*t,r=s}return[i+l,r+u]}return v.invert=function(n){var i=n[0]-l,r=n[1]-u;if(h){var s=r*e+i*t;i=i*e-r*t,r=s}return[i/f,r/m]},v.stream=function(e){return s&&o===e?s:s=g(y(o=e))},v.postclip=function(e){return arguments.length?(y=e,p=n=i=r=null,_()):y},v.clipExtent=function(e){return arguments.length?(y=null==e?(p=n=i=r=null,KR):QN(p=+e[0][0],n=+e[0][1],i=+e[1][0],r=+e[1][1]),_()):null==p?null:[[p,n],[i,r]]},v.scale=function(e){return arguments.length?(a=+e,_()):a},v.translate=function(e){return arguments.length?(l=+e[0],u=+e[1],_()):[l,u]},v.angle=function(n){return arguments.length?(t=Tk(h=n%360*dk),e=mk(h),_()):h*ck},v.reflectX=function(e){return arguments.length?(c=e?-1:1,_()):c<0},v.reflectY=function(e){return arguments.length?(d=e?-1:1,_()):d<0},v.fitExtent=function(e,t){return lD(v,e,t)},v.fitSize=function(e,t){return uD(v,e,t)},v.fitWidth=function(e,t){return cD(v,e,t)},v.fitHeight=function(e,t){return dD(v,e,t)},v},mercator:function(){return SD(AD).scale(961/uk)},mollweide:function(){return gD(QD).scale(169.529)},naturalEarth1:function(){return gD($D).scale(175.295)},orthographic:function(){return gD(UD).scale(249.5).clipAngle(90+rk)},stereographic:function(){return gD(zD).scale(250).clipAngle(142)},transversemercator:function(){var e=SD(VD),t=e.center,n=e.rotate;return e.center=function(e){return arguments.length?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return arguments.length?n([e[0],e[1],e.length>2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)}};for(const e in iF)tF(e,iF[e]);function rF(e,t,n){var i=tl(e,t-rk,n).concat(t);return function(e){return i.map(function(t){return[e,t]})}}function sF(e,t,n){var i=tl(e,t-rk,n).concat(t);return function(e){return i.map(function(t){return[t,e]})}}function oF(){var e,t,n,i,r,s,o,a,l,u,c,d,h=10,p=h,f=90,m=360,g=2.5;function y(){return{type:"MultiLineString",coordinates:_()}}function _(){return tl(gk(i/f)*f,n,f).map(c).concat(tl(gk(a/m)*m,o,m).map(d)).concat(tl(gk(t/h)*h,e,h).filter(function(e){return hk(e%f)>rk}).map(l)).concat(tl(gk(s/p)*p,r,p).filter(function(e){return hk(e%m)>rk}).map(u))}return y.lines=function(){return _().map(function(e){return{type:"LineString",coordinates:e}})},y.outline=function(){return{type:"Polygon",coordinates:[c(i).concat(d(o).slice(1),c(n).reverse().slice(1),d(a).reverse().slice(1))]}},y.extent=function(e){return arguments.length?y.extentMajor(e).extentMinor(e):y.extentMinor()},y.extentMajor=function(e){return arguments.length?(i=+e[0][0],n=+e[1][0],a=+e[0][1],o=+e[1][1],i>n&&(e=i,i=n,n=e),a>o&&(e=a,a=o,o=e),y.precision(g)):[[i,a],[n,o]]},y.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],s=+n[0][1],r=+n[1][1],t>e&&(n=t,t=e,e=n),s>r&&(n=s,s=r,r=n),y.precision(g)):[[t,s],[e,r]]},y.step=function(e){return arguments.length?y.stepMajor(e).stepMinor(e):y.stepMinor()},y.stepMajor=function(e){return arguments.length?(f=+e[0],m=+e[1],y):[f,m]},y.stepMinor=function(e){return arguments.length?(h=+e[0],p=+e[1],y):[h,p]},y.precision=function(h){return arguments.length?(g=+h,l=rF(s,r,90),u=sF(t,e,g),c=rF(a,o,90),d=sF(i,n,g),y):g},y.extentMajor([[-180,-90+rk],[180,90-rk]]).extentMinor([[-180,-80-rk],[180,80+rk]])}function aF(){}const lF=[[],[[[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 uF(){var e=1,t=1,n=o;function i(e,t){return t.map(t=>r(e,t))}function r(i,r){var o=[],a=[];return function(n,i,r){var o,a,l,u,c,d,h=new Array,p=new Array;o=a=-1,u=n[0]>=i,lF[u<<1].forEach(f);for(;++o<e-1;)l=u,u=n[o+1]>=i,lF[l|u<<1].forEach(f);lF[u|0].forEach(f);for(;++a<t-1;){for(o=-1,u=n[a*e+e]>=i,c=n[a*e]>=i,lF[u<<1|c<<2].forEach(f);++o<e-1;)l=u,u=n[a*e+e+o+1]>=i,d=c,c=n[a*e+o+1]>=i,lF[l|u<<1|c<<2|d<<3].forEach(f);lF[u|c<<3].forEach(f)}o=-1,c=n[a*e]>=i,lF[c<<2].forEach(f);for(;++o<e-1;)d=c,c=n[a*e+o+1]>=i,lF[c<<2|d<<3].forEach(f);function f(e){var t,n,i=[e[0][0]+o,e[0][1]+a],l=[e[1][0]+o,e[1][1]+a],u=s(i),c=s(l);(t=p[u])?(n=h[c])?(delete p[t.end],delete h[n.start],t===n?(t.ring.push(l),r(t.ring)):h[t.start]=p[n.end]={start:t.start,end:n.end,ring:t.ring.concat(n.ring)}):(delete p[t.end],t.ring.push(l),p[t.end=c]=t):(t=h[c])?(n=p[u])?(delete h[t.start],delete p[n.end],t===n?(t.ring.push(l),r(t.ring)):h[n.start]=p[t.end]={start:n.start,end:t.end,ring:n.ring.concat(t.ring)}):(delete h[t.start],t.ring.unshift(i),h[t.start=u]=t):h[u]=p[c]={start:u,end:c,ring:[i,l]}}lF[c<<3].forEach(f)}(i,r,e=>{n(e,i,r),function(e){var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];for(;++t<n;)i+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return i}(e)>0?o.push([e]):a.push(e)}),a.forEach(e=>{for(var t,n=0,i=o.length;n<i;++n)if(-1!==cF((t=o[n])[0],e))return void t.push(e)}),{type:"MultiPolygon",value:r,coordinates:o}}function s(t){return 2*t[0]+t[1]*(e+1)*4}function o(n,i,r){n.forEach(n=>{var s,o=n[0],a=n[1],l=0|o,u=0|a,c=i[u*e+l];o>0&&o<e&&l===o&&(s=i[u*e+l-1],n[0]=o+(r-s)/(c-s)-.5),a>0&&a<t&&u===a&&(s=i[(u-1)*e+l],n[1]=a+(r-s)/(c-s)-.5)})}return i.contour=r,i.size=function(n){if(!arguments.length)return[e,t];var r=Math.floor(n[0]),s=Math.floor(n[1]);return r>=0&&s>=0||ae("invalid size"),e=r,t=s,i},i.smooth=function(e){return arguments.length?(n=e?o:aF,i):n===o},i}function cF(e,t){for(var n,i=-1,r=t.length;++i<r;)if(n=dF(e,t[i]))return n;return 0}function dF(e,t){for(var n=t[0],i=t[1],r=-1,s=0,o=e.length,a=o-1;s<o;a=s++){var l=e[s],u=l[0],c=l[1],d=e[a],h=d[0],p=d[1];if(hF(l,d,t))return 0;c>i!=p>i&&n<(h-u)*(i-c)/(p-c)+u&&(r=-r)}return r}function hF(e,t,n){var i,r,s,o;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&(r=e[i=+(e[0]===t[0])],s=n[i],o=t[i],r<=s&&s<=o||o<=s&&s<=r)}function pF(e,t,n){return function(i){var r=ot(i),s=n?Math.min(r[0],0):r[0],o=r[1],a=o-s,l=t?ru(s,o,e):a/(e+1);return tl(s+l,o,l)}}function fF(e){Ho.call(this,null,e)}function mF(e,t,n,i,r){const s=e.x1||0,o=e.y1||0,a=t*n<0;function l(e){e.forEach(u)}function u(e){a&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-s)*t+i,e[1]=(e[1]-o)*n+r}return function(e){return e.coordinates.forEach(l),e}}function gF(e,t,n){const i=e>=0?e:la(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function yF(e){return Ke(e)?e:it(+e)}function _F(){var e=e=>e[0],t=e=>e[1],n=pe,i=[-1,-1],r=960,s=500,o=2;function a(a,l){const u=gF(i[0],a,e)>>o,c=gF(i[1],a,t)>>o,d=u?u+2:0,h=c?c+2:0,p=2*d+(r>>o),f=2*h+(s>>o),m=new Float32Array(p*f),g=new Float32Array(p*f);let y=m;a.forEach(i=>{const r=d+(+e(i)>>o),s=h+(+t(i)>>o);r>=0&&r<p&&s>=0&&s<f&&(m[r+s*p]+=+n(i))}),u>0&&c>0?(vF(p,f,m,g,u),bF(p,f,g,m,c),vF(p,f,m,g,u),bF(p,f,g,m,c),vF(p,f,m,g,u),bF(p,f,g,m,c)):u>0?(vF(p,f,m,g,u),vF(p,f,g,m,u),vF(p,f,m,g,u),y=g):c>0&&(bF(p,f,m,g,c),bF(p,f,g,m,c),bF(p,f,m,g,c),y=g);const _=l?Math.pow(2,-2*o):1/vR(y);for(let e=0,t=p*f;e<t;++e)y[e]*=_;return{values:y,scale:1<<o,width:p,height:f,x1:d,y1:h,x2:d+(r>>o),y2:h+(s>>o)}}return a.x=function(t){return arguments.length?(e=yF(t),a):e},a.y=function(e){return arguments.length?(t=yF(e),a):t},a.weight=function(e){return arguments.length?(n=yF(e),a):n},a.size=function(e){if(!arguments.length)return[r,s];var t=+e[0],n=+e[1];return t>=0&&n>=0||ae("invalid size"),r=t,s=n,a},a.cellSize=function(e){return arguments.length?((e=+e)>=1||ae("invalid cell size"),o=Math.floor(Math.log(e)/Math.LN2),a):1<<o},a.bandwidth=function(e){return arguments.length?(1===(e=Xe(e)).length&&(e=[+e[0],+e[0]]),2!==e.length&&ae("invalid bandwidth"),i=e,a):i},a}function vF(e,t,n,i,r){const s=1+(r<<1);for(let o=0;o<t;++o)for(let t=0,a=0;t<e+r;++t)t<e&&(a+=n[t+o*e]),t>=r&&(t>=s&&(a-=n[t-s+o*e]),i[t-r+o*e]=a/Math.min(t+1,e-1+s-t,s))}function bF(e,t,n,i,r){const s=1+(r<<1);for(let o=0;o<e;++o)for(let a=0,l=0;a<t+r;++a)a<t&&(l+=n[o+a*e]),a>=r&&(a>=s&&(l-=n[o+(a-s)*e]),i[o+(a-r)*e]=l/Math.min(a+1,t-1+s-a,s))}function TF(e){Ho.call(this,null,e)}fF.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},pt(fF,Ho,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=e.field||de,s=uF().smooth(!1!==e.smooth),o=e.thresholds||function(e,t,n){const i=pF(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map(e=>Zo(t(e).values)))}(i,r,e),a=null===e.as?null:e.as||"contour",l=[];return i.forEach(t=>{const n=r(t),i=s.size([n.width,n.height])(n.values,Ee(o)?o:o(n.values));!function(e,t,n,i){let r=i.scale||t.scale,s=i.translate||t.translate;Ke(r)&&(r=r(n,i));Ke(s)&&(s=s(n,i));if((1===r||null==r)&&!s)return;const o=(_t(r)?r:r[0])||1,a=(_t(r)?r:r[1])||1,l=s&&s[0]||0,u=s&&s[1]||0;e.forEach(mF(t,o,a,l,u))}(i,n,t,e),i.forEach(e=>{l.push(yo(t,mo(null!=a?{[a]:e}:e)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=l,n}}),TF.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const xF=["x","y","weight","size","cellSize","bandwidth"];function EF(e,t){return xF.forEach(n=>null!=t[n]?e[n](t[n]):0),e}function wF(e){Ho.call(this,null,e)}pt(TF,Ho,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=function(e,t){var n,i,r,s,o,a,l=[],u=e=>e(s);if(null==t)l.push(e);else for(n={},i=0,r=e.length;i<r;++i)s=e[i],(a=n[o=t.map(u)])||(n[o]=a=[],a.dims=o,l.push(a)),a.push(s);return l}(t.materialize(t.SOURCE).source,e.groupby),s=(e.groupby||[]).map(ne),o=EF(_F(),e),a=e.as||"grid";return n=r.map(t=>mo(function(e,t){for(let n=0;n<s.length;++n)e[s[n]]=t[n];return e}({[a]:o(t,e.counts)},t.dims))),this.value&&(i.rem=this.value),this.value=i.source=i.add=n,i}}),wF.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]},pt(wF,Ho,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),s=uF().smooth(!1!==e.smooth),o=e.values,a=e.thresholds||pF(e.count||10,e.nice,!!o),l=e.size;return o||(o=t.materialize(t.SOURCE).source,i=mF(n=EF(_F(),e)(o,!0),n.scale||1,n.scale||1,0,0),l=[n.width,n.height],o=n.values),a=Ee(a)?a:a(o),o=s.size(l)(o,a),i&&o.forEach(i),this.value&&(r.rem=this.value),this.value=r.source=r.add=(o||[]).map(mo),r}});const IF="Feature",AF="FeatureCollection";function SF(e){Ho.call(this,null,e)}function CF(e){Ho.call(this,null,e)}function OF(e){Ho.call(this,null,e)}function MF(e){Ho.call(this,null,e)}function RF(e){Ho.call(this,[],e),this.generator=oF()}function kF(e){Ho.call(this,null,e)}function NF(e){if(!Ke(e))return!1;const t=Dt(ie(e));return t.$x||t.$y||t.$value||t.$max}function DF(e){Ho.call(this,null,e),this.modified(!0)}function FF(e,t,n){Ke(e[t])&&e[t](n)}function LF(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,s,o,a,l,u,c,d,h,p=e._root,f={data:i},m=e._x0,g=e._y0,y=e._x1,_=e._y1;if(!p)return e._root=f,e;for(;p.length;)if((u=t>=(s=(m+y)/2))?m=s:y=s,(c=n>=(o=(g+_)/2))?g=o:_=o,r=p,!(p=p[d=c<<1|u]))return r[d]=f,e;if(a=+e._x.call(null,p.data),l=+e._y.call(null,p.data),t===a&&n===l)return f.next=p,r?r[d]=f:e._root=f,e;do{r=r?r[d]=new Array(4):e._root=new Array(4),(u=t>=(s=(m+y)/2))?m=s:y=s,(c=n>=(o=(g+_)/2))?g=o:_=o}while((d=c<<1|u)==(h=(l>=o)<<1|a>=s));return r[h]=p,r[d]=f,e}function PF(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function BF(e){return e[0]}function $F(e){return e[1]}function UF(e,t,n){var i=new zF(null==t?BF:t,null==n?$F:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function zF(e,t,n,i,r,s){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=s,this._root=void 0}function VF(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}SF.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},pt(SF,Ho,{transform(e,t){var n,i=this._features,r=this._points,s=e.fields,o=s&&s[0],a=s&&s[1],l=e.geojson||!s&&de,u=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(ie(l))||o&&t.modified(ie(o))||a&&t.modified(ie(a)),this.value&&!n||(u=t.SOURCE,this._features=i=[],this._points=r=[]),l&&t.visit(u,e=>i.push(l(e))),o&&a&&(t.visit(u,e=>{var t=o(e),n=a(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])}),i=i.concat({type:IF,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:AF,features:i}}}),CF.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},pt(CF,Ho,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||de,s=e.as||"path",o=n.SOURCE;!i||e.modified()?(this.value=i=nF(e.projection),n.materialize().reflow()):o=r===de||t.modified(r.fields)?n.ADD_MOD:n.ADD;const a=function(e,t){const n=e.pointRadius();e.context(null),null!=t&&e.pointRadius(t);return n}(i,e.pointRadius);return n.visit(o,e=>e[s]=i(r(e))),i.pointRadius(a),n.modifies(s)}}),OF.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},pt(OF,Ho,{transform(e,t){var n,i=e.projection,r=e.fields[0],s=e.fields[1],o=e.as||["x","y"],a=o[0],l=o[1];function u(e){const t=i([r(e),s(e)]);t?(e[a]=t[0],e[l]=t[1]):(e[a]=void 0,e[l]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,u):(n=t.modified(r.fields)||t.modified(s.fields),t.visit(n?t.ADD_MOD:t.ADD,u)),t.modifies(o)}}),MF.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},pt(MF,Ho,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",s=n.ADD;return i&&!e.modified()||(this.value=i=function(e,t,n){const i=null==n?n=>e(t(n)):i=>{var r=e.pointRadius(),s=e.pointRadius(n)(t(i));return e.pointRadius(r),s};return i.context=t=>(e.context(t),i),i}(nF(e.projection),e.field||ue("datum"),e.pointRadius),n.materialize().reflow(),s=n.SOURCE),n.visit(s,e=>e[r]=i),n.modifies(r)}}),RF.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},pt(RF,Ho,{transform(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(const t in e)Ke(r[t])&&r[t](e[t]);return n=r(),i.length?t.mod.push(_o(i[0],n)):t.add.push(mo(n)),i[0]=n,t}}),kF.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},pt(kF,Ho,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i="shared"===e.resolve,r=e.field||de,s=function(e,t){let n;Ke(e)?(n=n=>e(n,t),n.dep=NF(e)):e?n=it(e):(n=e=>e.$value/e.$max||0,n.dep=!0);return n}(e.opacity,e),o=function(e,t){let n;Ke(e)?(n=n=>Ry(e(n,t)),n.dep=NF(e)):n=it(Ry(e||"#888"));return n}(e.color,e),a=e.as||"image",l={$x:0,$y:0,$value:0,$max:i?Zo(n.map(e=>Zo(r(e).values))):0};return n.forEach(e=>{const t=r(e),n=st({},e,l);i||(n.$max=Zo(t.values||[])),e[a]=function(e,t,n,i){const r=e.width,s=e.height,o=e.x1||0,a=e.y1||0,l=e.x2||r,u=e.y2||s,c=e.values,d=c?e=>c[e]:he,h=Tp(l-o,u-a),p=h.getContext("2d"),f=p.getImageData(0,0,l-o,u-a),m=f.data;for(let e=a,s=0;e<u;++e){t.$y=e-a;for(let a=o,u=e*r;a<l;++a,s+=4){t.$x=a-o,t.$value=d(a+u);const e=n(t);m[s+0]=e.r,m[s+1]=e.g,m[s+2]=e.b,m[s+3]=~~(255*i(t))}}return p.putImageData(f,0,0),h}(t,n,o.dep?o:it(o(n)),s.dep?s:it(s(n)))}),t.reflow(!0).modifies(a)}}),pt(DF,Ho,{transform(e,t){let n=this.value;return!n||e.modified("type")?(this.value=n=function(e){const t=tF((e||"mercator").toLowerCase());t||ae("Unrecognized projection type: "+e);return t()}(e.type),eF.forEach(t=>{null!=e[t]&&FF(n,t,e[t])})):eF.forEach(t=>{e.modified(t)&&FF(n,t,e[t])}),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&function(e,t){const n=function(e){return e=Xe(e),1===e.length?e[0]:{type:AF,features:e.reduce((e,t)=>e.concat(function(e){return e.type===AF?e.features:Xe(e).filter(e=>null!=e).map(e=>e.type===IF?e:{type:IF,geometry:e})}(t)),[])}}(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});var jF=UF.prototype=zF.prototype;function YF(e){return function(){return e}}function GF(e){return 1e-6*(e()-.5)}function HF(e){return e.x+e.vx}function WF(e){return e.y+e.vy}jF.copy=function(){var e,t,n=new zF(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=VF(i),n;for(e=[{source:i,target:n._root=new Array(4)}];i=e.pop();)for(var r=0;r<4;++r)(t=i.source[r])&&(t.length?e.push({source:t,target:i.target[r]=new Array(4)}):i.target[r]=VF(t));return n},jF.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return LF(this.cover(t,n),t,n,e)},jF.addAll=function(e){var t,n,i,r,s=e.length,o=new Array(s),a=new Array(s),l=1/0,u=1/0,c=-1/0,d=-1/0;for(n=0;n<s;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(o[n]=i,a[n]=r,i<l&&(l=i),i>c&&(c=i),r<u&&(u=r),r>d&&(d=r));if(l>c||u>d)return this;for(this.cover(l,u).cover(c,d),n=0;n<s;++n)LF(this,o[n],a[n],e[n]);return this},jF.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,i=this._y0,r=this._x1,s=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,s=(i=Math.floor(t))+1;else{for(var o,a,l=r-n||1,u=this._root;n>e||e>=r||i>t||t>=s;)switch(a=(t<i)<<1|e<n,(o=new Array(4))[a]=u,u=o,l*=2,a){case 0:r=n+l,s=i+l;break;case 1:n=r-l,s=i+l;break;case 2:r=n+l,i=s-l;break;case 3:n=r-l,i=s-l}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=i,this._x1=r,this._y1=s,this},jF.data=function(){var e=[];return this.visit(function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)}),e},jF.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},jF.find=function(e,t,n){var i,r,s,o,a,l,u,c=this._x0,d=this._y0,h=this._x1,p=this._y1,f=[],m=this._root;for(m&&f.push(new PF(m,c,d,h,p)),null==n?n=1/0:(c=e-n,d=t-n,h=e+n,p=t+n,n*=n);l=f.pop();)if(!(!(m=l.node)||(r=l.x0)>h||(s=l.y0)>p||(o=l.x1)<c||(a=l.y1)<d))if(m.length){var g=(r+o)/2,y=(s+a)/2;f.push(new PF(m[3],g,y,o,a),new PF(m[2],r,y,g,a),new PF(m[1],g,s,o,y),new PF(m[0],r,s,g,y)),(u=(t>=y)<<1|e>=g)&&(l=f[f.length-1],f[f.length-1]=f[f.length-1-u],f[f.length-1-u]=l)}else{var _=e-+this._x.call(null,m.data),v=t-+this._y.call(null,m.data),b=_*_+v*v;if(b<n){var T=Math.sqrt(n=b);c=e-T,d=t-T,h=e+T,p=t+T,i=m.data}}return i},jF.remove=function(e){if(isNaN(s=+this._x.call(null,e))||isNaN(o=+this._y.call(null,e)))return this;var t,n,i,r,s,o,a,l,u,c,d,h,p=this._root,f=this._x0,m=this._y0,g=this._x1,y=this._y1;if(!p)return this;if(p.length)for(;;){if((u=s>=(a=(f+g)/2))?f=a:g=a,(c=o>=(l=(m+y)/2))?m=l:y=l,t=p,!(p=p[d=c<<1|u]))return this;if(!p.length)break;(t[d+1&3]||t[d+2&3]||t[d+3&3])&&(n=t,h=d)}for(;p.data!==e;)if(i=p,!(p=p.next))return this;return(r=p.next)&&delete p.next,i?(r?i.next=r:delete i.next,this):t?(r?t[d]=r:delete t[d],(p=t[0]||t[1]||t[2]||t[3])&&p===(t[3]||t[2]||t[1]||t[0])&&!p.length&&(n?n[h]=p:this._root=p),this):(this._root=r,this)},jF.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},jF.root=function(){return this._root},jF.size=function(){var e=0;return this.visit(function(t){if(!t.length)do{++e}while(t=t.next)}),e},jF.visit=function(e){var t,n,i,r,s,o,a=[],l=this._root;for(l&&a.push(new PF(l,this._x0,this._y0,this._x1,this._y1));t=a.pop();)if(!e(l=t.node,i=t.x0,r=t.y0,s=t.x1,o=t.y1)&&l.length){var u=(i+s)/2,c=(r+o)/2;(n=l[3])&&a.push(new PF(n,u,c,s,o)),(n=l[2])&&a.push(new PF(n,i,c,u,o)),(n=l[1])&&a.push(new PF(n,u,r,s,c)),(n=l[0])&&a.push(new PF(n,i,r,u,c))}return this},jF.visitAfter=function(e){var t,n=[],i=[];for(this._root&&n.push(new PF(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var r=t.node;if(r.length){var s,o=t.x0,a=t.y0,l=t.x1,u=t.y1,c=(o+l)/2,d=(a+u)/2;(s=r[0])&&n.push(new PF(s,o,a,c,d)),(s=r[1])&&n.push(new PF(s,c,a,l,d)),(s=r[2])&&n.push(new PF(s,o,d,c,u)),(s=r[3])&&n.push(new PF(s,c,d,l,u))}i.push(t)}for(;t=i.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},jF.x=function(e){return arguments.length?(this._x=e,this):this._x},jF.y=function(e){return arguments.length?(this._y=e,this):this._y};var XF={value:()=>{}};function qF(){for(var e,t=0,n=arguments.length,i={};t<n;++t){if(!(e=arguments[t]+"")||e in i||/[\s.]/.test(e))throw new Error("illegal type: "+e);i[e]=[]}return new KF(i)}function KF(e){this._=e}function ZF(e,t){for(var n,i=0,r=e.length;i<r;++i)if((n=e[i]).name===t)return n.value}function QF(e,t,n){for(var i=0,r=e.length;i<r;++i)if(e[i].name===t){e[i]=XF,e=e.slice(0,i).concat(e.slice(i+1));break}return null!=n&&e.push({name:t,value:n}),e}KF.prototype=qF.prototype={constructor:KF,on:function(e,t){var n,i=this._,r=function(e,t){return e.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");if(i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}})}(e+"",i),s=-1,o=r.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++s<o;)if(n=(e=r[s]).type)i[n]=QF(i[n],e.name,t);else if(null==t)for(n in i)i[n]=QF(i[n],e.name,null);return this}for(;++s<o;)if((n=(e=r[s]).type)&&(n=ZF(i[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new KF(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),s=0;s<n;++s)r[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=0,n=(i=this._[e]).length;s<n;++s)i[s].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)}};const JF=qF;var eL,tL,nL=0,iL=0,rL=0,sL=0,oL=0,aL=0,lL="object"==typeof performance&&performance.now?performance:Date,uL="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function cL(){return oL||(uL(dL),oL=lL.now()+aL)}function dL(){oL=0}function hL(){this._call=this._time=this._next=null}function pL(e,t,n){var i=new hL;return i.restart(e,t,n),i}function fL(){oL=(sL=lL.now())+aL,nL=iL=0;try{!function(){cL(),++nL;for(var e,t=eL;t;)(e=oL-t._time)>=0&&t._call.call(null,e),t=t._next;--nL}()}finally{nL=0,function(){var e,t,n=eL,i=1/0;for(;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:eL=t);tL=e,gL(i)}(),oL=0}}function mL(){var e=lL.now(),t=e-sL;t>1e3&&(aL-=t,sL=e)}function gL(e){nL||(iL&&(iL=clearTimeout(iL)),e-oL>24?(e<1/0&&(iL=setTimeout(fL,e-lL.now()-aL)),rL&&(rL=clearInterval(rL))):(rL||(sL=lL.now(),rL=setInterval(mL,1e3)),nL=1,uL(fL)))}hL.prototype=pL.prototype={constructor:hL,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?cL():+n)+(null==t?0:+t),this._next||tL===this||(tL?tL._next=this:eL=this,tL=this),this._call=e,this._time=n,gL()},stop:function(){this._call&&(this._call=null,this._time=1/0,gL())}};const yL=4294967296;function _L(e){return e.x}function vL(e){return e.y}var bL=Math.PI*(3-Math.sqrt(5));function TL(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),s=0,o=.6,a=new Map,l=pL(d),u=JF("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%yL)/yL}();function d(){h(),u.call("tick",t),n<i&&(l.stop(),u.call("end",t))}function h(i){var l,u,c=e.length;void 0===i&&(i=1);for(var d=0;d<i;++d)for(n+=(s-n)*r,a.forEach(function(e){e(n)}),l=0;l<c;++l)null==(u=e[l]).fx?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),null==u.fy?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t,n=0,i=e.length;n<i;++n){if((t=e[n]).index=n,null!=t.fx&&(t.x=t.fx),null!=t.fy&&(t.y=t.fy),isNaN(t.x)||isNaN(t.y)){var r=10*Math.sqrt(.5+n),s=n*bL;t.x=r*Math.cos(s),t.y=r*Math.sin(s)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function f(t){return t.initialize&&t.initialize(e,c),t}return null==e&&(e=[]),p(),t={tick:h,restart:function(){return l.restart(d),t},stop:function(){return l.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),a.forEach(f),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(i=+e,t):i},alphaDecay:function(e){return arguments.length?(r=+e,t):+r},alphaTarget:function(e){return arguments.length?(s=+e,t):s},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(c=e,a.forEach(f),t):c},force:function(e,n){return arguments.length>1?(null==n?a.delete(e):a.set(e,f(n)),t):a.get(e)},find:function(t,n,i){var r,s,o,a,l,u=0,c=e.length;for(null==i?i=1/0:i*=i,u=0;u<c;++u)(o=(r=t-(a=e[u]).x)*r+(s=n-a.y)*s)<i&&(l=a,i=o);return l},on:function(e,n){return arguments.length>1?(u.on(e,n),t):u.on(e)}}}function xL(e){return e.index}function EL(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}const wL={center:function(e,t){var n,i=1;function r(){var r,s,o=n.length,a=0,l=0;for(r=0;r<o;++r)a+=(s=n[r]).x,l+=s.y;for(a=(a/o-e)*i,l=(l/o-t)*i,r=0;r<o;++r)(s=n[r]).x-=a,s.y-=l}return null==e&&(e=0),null==t&&(t=0),r.initialize=function(e){n=e},r.x=function(t){return arguments.length?(e=+t,r):e},r.y=function(e){return arguments.length?(t=+e,r):t},r.strength=function(e){return arguments.length?(i=+e,r):i},r},collide:function(e){var t,n,i,r=1,s=1;function o(){for(var e,o,l,u,c,d,h,p=t.length,f=0;f<s;++f)for(o=UF(t,HF,WF).visitAfter(a),e=0;e<p;++e)l=t[e],d=n[l.index],h=d*d,u=l.x+l.vx,c=l.y+l.vy,o.visit(m);function m(e,t,n,s,o){var a=e.data,p=e.r,f=d+p;if(!a)return t>u+f||s<u-f||n>c+f||o<c-f;if(a.index>l.index){var m=u-a.x-a.vx,g=c-a.y-a.vy,y=m*m+g*g;y<f*f&&(0===m&&(y+=(m=GF(i))*m),0===g&&(y+=(g=GF(i))*g),y=(f-(y=Math.sqrt(y)))/y*r,l.vx+=(m*=y)*(f=(p*=p)/(h+p)),l.vy+=(g*=y)*f,a.vx-=m*(f=1-f),a.vy-=g*f)}}}function a(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function l(){if(t){var i,r,s=t.length;for(n=new Array(s),i=0;i<s;++i)r=t[i],n[r.index]=+e(r,i,t)}}return"function"!=typeof e&&(e=YF(null==e?1:+e)),o.initialize=function(e,n){t=e,i=n,l()},o.iterations=function(e){return arguments.length?(s=+e,o):s},o.strength=function(e){return arguments.length?(r=+e,o):r},o.radius=function(t){return arguments.length?(e="function"==typeof t?t:YF(+t),l(),o):e},o},nbody:function(){var e,t,n,i,r,s=YF(-30),o=1,a=1/0,l=.81;function u(n){var r,s=e.length,o=UF(e,_L,vL).visitAfter(d);for(i=n,r=0;r<s;++r)t=e[r],o.visit(h)}function c(){if(e){var t,n,i=e.length;for(r=new Array(i),t=0;t<i;++t)n=e[t],r[n.index]=+s(n,t,e)}}function d(e){var t,n,i,s,o,a=0,l=0;if(e.length){for(i=s=o=0;o<4;++o)(t=e[o])&&(n=Math.abs(t.value))&&(a+=t.value,l+=n,i+=n*t.x,s+=n*t.y);e.x=i/l,e.y=s/l}else{(t=e).x=t.data.x,t.y=t.data.y;do{a+=r[t.data.index]}while(t=t.next)}e.value=a}function h(e,s,u,c){if(!e.value)return!0;var d=e.x-t.x,h=e.y-t.y,p=c-s,f=d*d+h*h;if(p*p/l<f)return f<a&&(0===d&&(f+=(d=GF(n))*d),0===h&&(f+=(h=GF(n))*h),f<o&&(f=Math.sqrt(o*f)),t.vx+=d*e.value*i/f,t.vy+=h*e.value*i/f),!0;if(!(e.length||f>=a)){(e.data!==t||e.next)&&(0===d&&(f+=(d=GF(n))*d),0===h&&(f+=(h=GF(n))*h),f<o&&(f=Math.sqrt(o*f)));do{e.data!==t&&(p=r[e.data.index]*i/f,t.vx+=d*p,t.vy+=h*p)}while(e=e.next)}}return u.initialize=function(t,i){e=t,n=i,c()},u.strength=function(e){return arguments.length?(s="function"==typeof e?e:YF(+e),c(),u):s},u.distanceMin=function(e){return arguments.length?(o=e*e,u):Math.sqrt(o)},u.distanceMax=function(e){return arguments.length?(a=e*e,u):Math.sqrt(a)},u.theta=function(e){return arguments.length?(l=e*e,u):Math.sqrt(l)},u},link:function(e){var t,n,i,r,s,o,a=xL,l=function(e){return 1/Math.min(r[e.source.index],r[e.target.index])},u=YF(30),c=1;function d(i){for(var r=0,a=e.length;r<c;++r)for(var l,u,d,h,p,f,m,g=0;g<a;++g)u=(l=e[g]).source,h=(d=l.target).x+d.vx-u.x-u.vx||GF(o),p=d.y+d.vy-u.y-u.vy||GF(o),h*=f=((f=Math.sqrt(h*h+p*p))-n[g])/f*i*t[g],p*=f,d.vx-=h*(m=s[g]),d.vy-=p*m,u.vx+=h*(m=1-m),u.vy+=p*m}function h(){if(i){var o,l,u=i.length,c=e.length,d=new Map(i.map((e,t)=>[a(e,t,i),e]));for(o=0,r=new Array(u);o<c;++o)(l=e[o]).index=o,"object"!=typeof l.source&&(l.source=EL(d,l.source)),"object"!=typeof l.target&&(l.target=EL(d,l.target)),r[l.source.index]=(r[l.source.index]||0)+1,r[l.target.index]=(r[l.target.index]||0)+1;for(o=0,s=new Array(c);o<c;++o)l=e[o],s[o]=r[l.source.index]/(r[l.source.index]+r[l.target.index]);t=new Array(c),p(),n=new Array(c),f()}}function p(){if(i)for(var n=0,r=e.length;n<r;++n)t[n]=+l(e[n],n,e)}function f(){if(i)for(var t=0,r=e.length;t<r;++t)n[t]=+u(e[t],t,e)}return null==e&&(e=[]),d.initialize=function(e,t){i=e,o=t,h()},d.links=function(t){return arguments.length?(e=t,h(),d):e},d.id=function(e){return arguments.length?(a=e,d):a},d.iterations=function(e){return arguments.length?(c=+e,d):c},d.strength=function(e){return arguments.length?(l="function"==typeof e?e:YF(+e),p(),d):l},d.distance=function(e){return arguments.length?(u="function"==typeof e?e:YF(+e),f(),d):u},d},x:function(e){var t,n,i,r=YF(.1);function s(e){for(var r,s=0,o=t.length;s<o;++s)(r=t[s]).vx+=(i[s]-r.x)*n[s]*e}function o(){if(t){var s,o=t.length;for(n=new Array(o),i=new Array(o),s=0;s<o;++s)n[s]=isNaN(i[s]=+e(t[s],s,t))?0:+r(t[s],s,t)}}return"function"!=typeof e&&(e=YF(null==e?0:+e)),s.initialize=function(e){t=e,o()},s.strength=function(e){return arguments.length?(r="function"==typeof e?e:YF(+e),o(),s):r},s.x=function(t){return arguments.length?(e="function"==typeof t?t:YF(+t),o(),s):e},s},y:function(e){var t,n,i,r=YF(.1);function s(e){for(var r,s=0,o=t.length;s<o;++s)(r=t[s]).vy+=(i[s]-r.y)*n[s]*e}function o(){if(t){var s,o=t.length;for(n=new Array(o),i=new Array(o),s=0;s<o;++s)n[s]=isNaN(i[s]=+e(t[s],s,t))?0:+r(t[s],s,t)}}return"function"!=typeof e&&(e=YF(null==e?0:+e)),s.initialize=function(e){t=e,o()},s.strength=function(e){return arguments.length?(r="function"==typeof e?e:YF(+e),o(),s):r},s.y=function(t){return arguments.length?(e="function"==typeof t?t:YF(+t),o(),s):e},s}},IL="forces",AL=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],SL=["static","iterations"],CL=["x","y","vx","vy"];function OL(e){Ho.call(this,null,e)}function ML(e,t,n,i){var r,s,o,a,l=Xe(t.forces);for(r=0,s=AL.length;r<s;++r)(o=AL[r])!==IL&&t.modified(o)&&e[o](t[o]);for(r=0,s=l.length;r<s;++r)a=IL+r,(o=n||t.modified(IL,r)?kL(l[r]):i&&RL(l[r],i)?e.force(a):null)&&e.force(a,o);for(s=e.numForces||0;r<s;++r)e.force(IL+r,null);return e.numForces=l.length,e}function RL(e,t){var n,i;for(n in e)if(Ke(i=e[n])&&t.modified(ie(i)))return 1;return 0}function kL(e){var t,n;for(n in ut(wL,e.force)||ae("Unrecognized force: "+e.force),t=wL[e.force](),e)Ke(t[n])&&NL(t[n],e[n],e);return t}function NL(e,t,n){e(Ke(t)?e=>t(e,n):t)}function DL(e){var t=0,n=e.children,i=n&&n.length;if(i)for(;--i>=0;)t+=n[i].value;else t=1;e.value=t}function FL(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=PL)):void 0===t&&(t=LL);for(var n,i,r,s,o,a=new UL(e),l=[a];n=l.pop();)if((r=t(n.data))&&(o=(r=Array.from(r)).length))for(n.children=r,s=o-1;s>=0;--s)l.push(i=r[s]=new UL(r[s])),i.parent=n,i.depth=n.depth+1;return a.eachBefore($L)}function LL(e){return e.children}function PL(e){return Array.isArray(e)?e[1]:null}function BL(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function $L(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function UL(e){this.data=e,this.depth=this.height=0,this.parent=null}function zL(e){for(var t,n,i=0,r=(e=function(e){for(var t,n,i=e.length;i;)n=Math.random()*i--|0,t=e[i],e[i]=e[n],e[n]=t;return e}(Array.from(e))).length,s=[];i<r;)t=e[i],n&&YL(n,t)?++i:(n=HL(s=VL(s,t)),i=0);return n}function VL(e,t){var n,i;if(GL(t,e))return[t];for(n=0;n<e.length;++n)if(jL(t,e[n])&&GL(WL(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(i=n+1;i<e.length;++i)if(jL(WL(e[n],e[i]),t)&&jL(WL(e[n],t),e[i])&&jL(WL(e[i],t),e[n])&&GL(XL(e[n],e[i],t),e))return[e[n],e[i],t];throw new Error}function jL(e,t){var n=e.r-t.r,i=t.x-e.x,r=t.y-e.y;return n<0||n*n<i*i+r*r}function YL(e,t){var n=e.r-t.r+1e-9*Math.max(e.r,t.r,1),i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function GL(e,t){for(var n=0;n<t.length;++n)if(!YL(e,t[n]))return!1;return!0}function HL(e){switch(e.length){case 1:return function(e){return{x:e.x,y:e.y,r:e.r}}(e[0]);case 2:return WL(e[0],e[1]);case 3:return XL(e[0],e[1],e[2])}}function WL(e,t){var n=e.x,i=e.y,r=e.r,s=t.x,o=t.y,a=t.r,l=s-n,u=o-i,c=a-r,d=Math.sqrt(l*l+u*u);return{x:(n+s+l/d*c)/2,y:(i+o+u/d*c)/2,r:(d+r+a)/2}}function XL(e,t,n){var i=e.x,r=e.y,s=e.r,o=t.x,a=t.y,l=t.r,u=n.x,c=n.y,d=n.r,h=i-o,p=i-u,f=r-a,m=r-c,g=l-s,y=d-s,_=i*i+r*r-s*s,v=_-o*o-a*a+l*l,b=_-u*u-c*c+d*d,T=p*f-h*m,x=(f*b-m*v)/(2*T)-i,E=(m*g-f*y)/T,w=(p*v-h*b)/(2*T)-r,I=(h*y-p*g)/T,A=E*E+I*I-1,S=2*(s+x*E+w*I),C=x*x+w*w-s*s,O=-(A?(S+Math.sqrt(S*S-4*A*C))/(2*A):C/S);return{x:i+x+E*O,y:r+w+I*O,r:O}}function qL(e,t,n){var i,r,s,o,a=e.x-t.x,l=e.y-t.y,u=a*a+l*l;u?(r=t.r+n.r,r*=r,o=e.r+n.r,r>(o*=o)?(i=(u+o-r)/(2*u),s=Math.sqrt(Math.max(0,o/u-i*i)),n.x=e.x-i*a-s*l,n.y=e.y-i*l+s*a):(i=(u+r-o)/(2*u),s=Math.sqrt(Math.max(0,r/u-i*i)),n.x=t.x+i*a-s*l,n.y=t.y+i*l+s*a)):(n.x=t.x+n.r,n.y=t.y)}function KL(e,t){var n=e.r+t.r-1e-6,i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function ZL(e){var t=e._,n=e.next._,i=t.r+n.r,r=(t.x*n.r+n.x*t.r)/i,s=(t.y*n.r+n.y*t.r)/i;return r*r+s*s}function QL(e){this._=e,this.next=null,this.previous=null}function JL(e){if(!(r=(e=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(e)).length))return 0;var t,n,i,r,s,o,a,l,u,c,d;if((t=e[0]).x=0,t.y=0,!(r>1))return t.r;if(n=e[1],t.x=-n.r,n.x=t.r,n.y=0,!(r>2))return t.r+n.r;qL(n,t,i=e[2]),t=new QL(t),n=new QL(n),i=new QL(i),t.next=i.previous=n,n.next=t.previous=i,i.next=n.previous=t;e:for(a=3;a<r;++a){qL(t._,n._,i=e[a]),i=new QL(i),l=n.next,u=t.previous,c=n._.r,d=t._.r;do{if(c<=d){if(KL(l._,i._)){n=l,t.next=n,n.previous=t,--a;continue e}c+=l._.r,l=l.next}else{if(KL(u._,i._)){(t=u).next=n,n.previous=t,--a;continue e}d+=u._.r,u=u.previous}}while(l!==u.next);for(i.previous=t,i.next=n,t.next=n.previous=n=i,s=ZL(t);(i=i.next)!==n;)(o=ZL(i))<s&&(t=i,s=o);n=t.next}for(t=[n._],i=n;(i=i.next)!==n;)t.push(i._);for(i=zL(t),a=0;a<r;++a)(t=e[a]).x-=i.x,t.y-=i.y;return i.r}function eP(e){if("function"!=typeof e)throw new Error;return e}function tP(){return 0}function nP(e){return function(){return e}}function iP(e){return Math.sqrt(e.value)}function rP(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function sP(e,t){return function(n){if(i=n.children){var i,r,s,o=i.length,a=e(n)*t||0;if(a)for(r=0;r<o;++r)i[r].r+=a;if(s=JL(i),a)for(r=0;r<o;++r)i[r].r-=a;n.r=s+a}}}function oP(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function aP(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function lP(e,t,n,i,r){for(var s,o=e.children,a=-1,l=o.length,u=e.value&&(i-t)/e.value;++a<l;)(s=o[a]).y0=n,s.y1=r,s.x0=t,s.x1=t+=s.value*u}OL.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:CL}]},pt(OL,Ho,{transform(e,t){var n,i,r=this.value,s=t.changed(t.ADD_REM),o=e.modified(AL),a=e.iterations||300;if(r?(s&&(t.modifies("index"),r.nodes(t.source)),(o||t.changed(t.MOD))&&ML(r,e,0,t)):(this.value=r=function(e,t){const n=TL(e),i=n.stop,r=n.restart;let s=!1;return n.stopped=()=>s,n.restart=()=>(s=!1,r()),n.stop=()=>(s=!0,i()),ML(n,t,!0).on("end",()=>s=!0)}(t.source,e),r.on("tick",(n=t.dataflow,i=this,()=>n.touch(i).run())),e.static||(s=!0,r.tick()),t.modifies("index")),o||s||e.modified(SL)||t.changed()&&e.restart)if(r.alpha(Math.max(r.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(r.alphaMin(),1/a)),e.static)for(r.stop();--a>=0;)r.tick();else if(r.stopped()&&r.restart(),!s)return t.StopPropagation;return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let e,t=this._argops,a=0,l=t.length;a<l;++a)if(e=t[a],e.name===IL&&"link"===e.op._argval.force)for(var i,r=e.op._argops,s=0,o=r.length;s<o;++s)if("links"===r[s].name&&(i=r[s].op.source)){n.pulse(i,n.changeset().reflow());break}return t.reflow(e.modified()).modifies(CL)}}),UL.prototype=FL.prototype={constructor:UL,count:function(){return this.eachAfter(DL)},each:function(e,t){let n=-1;for(const i of this)e.call(t,i,++n,this);return this},eachAfter:function(e,t){for(var n,i,r,s=this,o=[s],a=[],l=-1;s=o.pop();)if(a.push(s),n=s.children)for(i=0,r=n.length;i<r;++i)o.push(n[i]);for(;s=a.pop();)e.call(t,s,++l,this);return this},eachBefore:function(e,t){for(var n,i,r=this,s=[r],o=-1;r=s.pop();)if(e.call(t,r,++o,this),n=r.children)for(i=n.length-1;i>=0;--i)s.push(n[i]);return this},find:function(e,t){let n=-1;for(const i of this)if(e.call(t,i,++n,this))return i},sum:function(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,i=t.children,r=i&&i.length;--r>=0;)n+=i[r].value;t.value=n})},sort:function(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),i=t.ancestors(),r=null;e=n.pop(),t=i.pop();for(;e===t;)r=e,e=n.pop(),t=i.pop();return r}(t,e),i=[t];t!==n;)t=t.parent,i.push(t);for(var r=i.length;e!==n;)i.splice(r,0,e),e=e.parent;return i},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e},links:function(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t},copy:function(){return FL(this).eachBefore(BL)},[Symbol.iterator]:function*(){var e,t,n,i,r=this,s=[r];do{for(e=s.reverse(),s=[];r=e.pop();)if(yield r,t=r.children)for(n=0,i=t.length;n<i;++n)s.push(t[n])}while(s.length)}};var uP={depth:-1},cP={};function dP(e){return e.id}function hP(e){return e.parentId}function pP(){var e=dP,t=hP;function n(n){var i,r,s,o,a,l,u,c=Array.from(n),d=c.length,h=new Map;for(r=0;r<d;++r)i=c[r],a=c[r]=new UL(i),null!=(l=e(i,r,n))&&(l+="")&&(u=a.id=l,h.set(u,h.has(u)?cP:a)),null!=(l=t(i,r,n))&&(l+="")&&(a.parent=l);for(r=0;r<d;++r)if(l=(a=c[r]).parent){if(!(o=h.get(l)))throw new Error("missing: "+l);if(o===cP)throw new Error("ambiguous: "+l);o.children?o.children.push(a):o.children=[a],a.parent=o}else{if(s)throw new Error("multiple roots");s=a}if(!s)throw new Error("no root");if(s.parent=uP,s.eachBefore(function(e){e.depth=e.parent.depth+1,--d}).eachBefore($L),s.parent=null,d>0)throw new Error("cycle");return s}return n.id=function(t){return arguments.length?(e=eP(t),n):e},n.parentId=function(e){return arguments.length?(t=eP(e),n):t},n}function fP(e,t){return e.parent===t.parent?1:2}function mP(e){var t=e.children;return t?t[0]:e.t}function gP(e){var t=e.children;return t?t[t.length-1]:e.t}function yP(e,t,n){var i=n/(t.i-e.i);t.c-=i,t.s+=n,e.c+=i,t.z+=n,t.m+=n}function _P(e,t,n){return e.a.parent===t.parent?e.a:n}function vP(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function bP(e,t){return e.parent===t.parent?1:2}function TP(e,t){return e+t.x}function xP(e,t){return Math.max(e,t.y)}function EP(e,t,n,i,r){for(var s,o=e.children,a=-1,l=o.length,u=e.value&&(r-n)/e.value;++a<l;)(s=o[a]).x0=t,s.x1=i,s.y0=n,s.y1=n+=s.value*u}vP.prototype=Object.create(UL.prototype);var wP=(1+Math.sqrt(5))/2;function IP(e,t,n,i,r,s){for(var o,a,l,u,c,d,h,p,f,m,g,y=[],_=t.children,v=0,b=0,T=_.length,x=t.value;v<T;){l=r-n,u=s-i;do{c=_[b++].value}while(!c&&b<T);for(d=h=c,g=c*c*(m=Math.max(u/l,l/u)/(x*e)),f=Math.max(h/g,g/d);b<T;++b){if(c+=a=_[b].value,a<d&&(d=a),a>h&&(h=a),g=c*c*m,(p=Math.max(h/g,g/d))>f){c-=a;break}f=p}y.push(o={value:c,dice:l<u,children:_.slice(v,b)}),o.dice?lP(o,n,i,r,x?i+=u*c/x:s):EP(o,n,i,x?n+=l*c/x:r,s),x-=c,v=b}return y}const AP=function e(t){function n(e,n,i,r,s){IP(t,e,n,i,r,s)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(wP),SP=function e(t){function n(e,n,i,r,s){if((o=e._squarify)&&o.ratio===t)for(var o,a,l,u,c,d=-1,h=o.length,p=e.value;++d<h;){for(l=(a=o[d]).children,u=a.value=0,c=l.length;u<c;++u)a.value+=l[u].value;a.dice?lP(a,n,i,r,p?i+=(s-i)*a.value/p:s):EP(a,n,i,p?n+=(r-n)*a.value/p:r,s),p-=a.value}else e._squarify=o=IP(t,e,n,i,r,s),o.ratio=t}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(wP);function CP(e,t,n){const i={};return e.each(e=>{const r=e.data;n(r)&&(i[t(r)]=e)}),e.lookup=i,e}function OP(e){Ho.call(this,null,e)}OP.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const MP=e=>e.values;function RP(){const e=[],t={entries:e=>i(n(e,0),0),key:n=>(e.push(n),t)};function n(t,i){if(i>=e.length)return t;const r=t.length,s=e[i++],o={},a={};let l,u,c,d=-1;for(;++d<r;)l=s(u=t[d])+"",(c=o[l])?c.push(u):o[l]=[u];for(l in o)a[l]=n(o[l],i);return a}function i(t,n){if(++n>e.length)return t;const r=[];for(const e in t)r.push({key:e,values:i(t[e],n)});return r}return t}function kP(e){Ho.call(this,null,e)}pt(OP,Ho,{transform(e,t){t.source||ae("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),r=t.clone(),s=this.value;return(!s||i||t.changed())&&(s&&s.each(e=>{e.children&&ho(e.data)&&r.rem.push(e.data)}),this.value=s=FL({values:Xe(e.keys).reduce((e,t)=>(e.key(t),e),RP()).entries(r.source)},MP),n&&s.each(e=>{e.children&&(e=mo(e.data),r.add.push(e),r.source.push(e))}),CP(s,po,po)),r.source.root=s,r}});const NP=(e,t)=>e.parent===t.parent?1:2;pt(kP,Ho,{transform(e,t){t.source&&t.source.root||ae(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,s=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(vo(e.sort,e=>e.data)),function(e,t,n){for(let i,r=0,s=t.length;r<s;++r)i=t[r],i in n&&e[i](n[i])}(n,this.params,e),n.separation&&n.separation(!1!==e.separation?NP:pe);try{this.value=n(r)}catch(e){ae(e)}return r.each(e=>function(e,t,n){const i=e.data,r=t.length-1;for(let s=0;s<r;++s)i[n[s]]=e[t[s]];i[n[r]]=e.children?e.children.length:0}(e,i,s)),t.reflow(e.modified()).modifies(s).modifies("leaf")}});const DP=["x","y","r","depth","children"];function FP(e){kP.call(this,e)}FP.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:DP.length,default:DP}]},pt(FP,kP,{layout:function(){var e=null,t=1,n=1,i=tP;function r(r){return r.x=t/2,r.y=n/2,e?r.eachBefore(rP(e)).eachAfter(sP(i,.5)).eachBefore(oP(1)):r.eachBefore(rP(iP)).eachAfter(sP(tP,1)).eachAfter(sP(i,r.r/Math.min(t,n))).eachBefore(oP(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=null==(n=t)?null:eP(n),r):e;var n},r.size=function(e){return arguments.length?(t=+e[0],n=+e[1],r):[t,n]},r.padding=function(e){return arguments.length?(i="function"==typeof e?e:nP(+e),r):i},r},params:["radius","size","padding"],fields:DP});const LP=["x0","y0","x1","y1","depth","children"];function PP(e){kP.call(this,e)}function BP(e){Ho.call(this,null,e)}PP.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:LP.length,default:LP}]},pt(PP,kP,{layout:function(){var e=1,t=1,n=0,i=!1;function r(r){var s=r.height+1;return r.x0=r.y0=n,r.x1=e,r.y1=t/s,r.eachBefore(function(e,t){return function(i){i.children&&lP(i,i.x0,e*(i.depth+1)/t,i.x1,e*(i.depth+2)/t);var r=i.x0,s=i.y0,o=i.x1-n,a=i.y1-n;o<r&&(r=o=(r+o)/2),a<s&&(s=a=(s+a)/2),i.x0=r,i.y0=s,i.x1=o,i.y1=a}}(t,s)),i&&r.eachBefore(aP),r}return r.round=function(e){return arguments.length?(i=!!e,r):i},r.size=function(n){return arguments.length?(e=+n[0],t=+n[1],r):[e,t]},r.padding=function(e){return arguments.length?(n=+e,r):n},r},params:["size","round","padding"],fields:LP}),BP.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},pt(BP,Ho,{transform(e,t){t.source||ae("Stratify transform requires an upstream data source.");let n=this.value;const i=e.modified(),r=t.fork(t.ALL).materialize(t.SOURCE),s=!n||i||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return r.source=r.source.slice(),s&&(n=r.source.length?CP(pP().id(e.key).parentId(e.parentKey)(r.source),e.key,fe):CP(pP()([{}]),e.key,e.key)),r.source.root=this.value=n,r}});const $P={tidy:function(){var e=fP,t=1,n=1,i=null;function r(r){var l=function(e){for(var t,n,i,r,s,o=new vP(e,0),a=[o];t=a.pop();)if(i=t._.children)for(t.children=new Array(s=i.length),r=s-1;r>=0;--r)a.push(n=t.children[r]=new vP(i[r],r)),n.parent=t;return(o.parent=new vP(null,0)).children=[o],o}(r);if(l.eachAfter(s),l.parent.m=-l.z,l.eachBefore(o),i)r.eachBefore(a);else{var u=r,c=r,d=r;r.eachBefore(function(e){e.x<u.x&&(u=e),e.x>c.x&&(c=e),e.depth>d.depth&&(d=e)});var h=u===c?1:e(u,c)/2,p=h-u.x,f=t/(c.x+h+p),m=n/(d.depth||1);r.eachBefore(function(e){e.x=(e.x+p)*f,e.y=e.depth*m})}return r}function s(t){var n=t.children,i=t.parent.children,r=t.i?i[t.i-1]:null;if(n){!function(e){for(var t,n=0,i=0,r=e.children,s=r.length;--s>=0;)(t=r[s]).z+=n,t.m+=n,n+=t.s+(i+=t.c)}(t);var s=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+e(t._,r._),t.m=t.z-s):t.z=s}else r&&(t.z=r.z+e(t._,r._));t.parent.A=function(t,n,i){if(n){for(var r,s=t,o=t,a=n,l=s.parent.children[0],u=s.m,c=o.m,d=a.m,h=l.m;a=gP(a),s=mP(s),a&&s;)l=mP(l),(o=gP(o)).a=t,(r=a.z+d-s.z-u+e(a._,s._))>0&&(yP(_P(a,t,i),t,r),u+=r,c+=r),d+=a.m,u+=s.m,h+=l.m,c+=o.m;a&&!gP(o)&&(o.t=a,o.m+=d-c),s&&!mP(l)&&(l.t=s,l.m+=u-h,i=t)}return i}(t,r,t.parent.A||i[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function a(e){e.x*=t,e.y=e.depth*n}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r},cluster:function(){var e=bP,t=1,n=1,i=!1;function r(r){var s,o=0;r.eachAfter(function(t){var n=t.children;n?(t.x=function(e){return e.reduce(TP,0)/e.length}(n),t.y=function(e){return 1+e.reduce(xP,0)}(n)):(t.x=s?o+=e(t,s):0,t.y=0,s=t)});var a=function(e){for(var t;t=e.children;)e=t[0];return e}(r),l=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(r),u=a.x-e(a,l)/2,c=l.x+e(l,a)/2;return r.eachAfter(i?function(e){e.x=(e.x-r.x)*t,e.y=(r.y-e.y)*n}:function(e){e.x=(e.x-u)/(c-u)*t,e.y=(1-(r.y?e.y/r.y:1))*n})}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r}},UP=["x","y","depth","children"];function zP(e){kP.call(this,e)}function VP(e){Ho.call(this,[],e)}zP.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:UP.length,default:UP}]},pt(zP,kP,{layout(e){const t=e||"tidy";if(ut($P,t))return $P[t]();ae("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:UP}),VP.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},pt(VP,Ho,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),s={};return i||ae("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,e=>s[po(e)]=1),i.each(e=>{const t=e.data,n=e.parent&&e.parent.data;n&&s[po(t)]&&s[po(n)]&&r.add.push(mo({source:n,target:t}))}),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,e=>s[po(e)]=1),n.forEach(e=>{(s[po(e.source)]||s[po(e.target)])&&r.mod.push(e)})),r}});const jP={binary:function(e,t,n,i,r){var s,o,a=e.children,l=a.length,u=new Array(l+1);for(u[0]=o=s=0;s<l;++s)u[s+1]=o+=a[s].value;!function e(t,n,i,r,s,o,l){if(t>=n-1){var c=a[t];return c.x0=r,c.y0=s,c.x1=o,void(c.y1=l)}var d=u[t],h=i/2+d,p=t+1,f=n-1;for(;p<f;){var m=p+f>>>1;u[m]<h?p=m+1:f=m}h-u[p-1]<u[p]-h&&t+1<p&&--p;var g=u[p]-d,y=i-g;if(o-r>l-s){var _=i?(r*y+o*g)/i:o;e(t,p,g,r,s,_,l),e(p,n,y,_,s,o,l)}else{var v=i?(s*y+l*g)/i:l;e(t,p,g,r,s,o,v),e(p,n,y,r,v,o,l)}}(0,l,e.value,t,n,i,r)},dice:lP,slice:EP,slicedice:function(e,t,n,i,r){(1&e.depth?EP:lP)(e,t,n,i,r)},squarify:AP,resquarify:SP},YP=["x0","y0","x1","y1","depth","children"];function GP(e){kP.call(this,e)}function HP(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function WP(e){this._context=e}function XP(){}function qP(e){this._context=e}function KP(e){this._context=e}function ZP(e,t){this._basis=new WP(e),this._beta=t}GP.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:YP.length,default:YP}]},pt(GP,kP,{layout(){const e=function(){var e=AP,t=!1,n=1,i=1,r=[0],s=tP,o=tP,a=tP,l=tP,u=tP;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(d),r=[0],t&&e.eachBefore(aP),e}function d(t){var n=r[t.depth],i=t.x0+n,c=t.y0+n,d=t.x1-n,h=t.y1-n;d<i&&(i=d=(i+d)/2),h<c&&(c=h=(c+h)/2),t.x0=i,t.y0=c,t.x1=d,t.y1=h,t.children&&(n=r[t.depth+1]=s(t)/2,i+=u(t)-n,c+=o(t)-n,(d-=a(t)-n)<i&&(i=d=(i+d)/2),(h-=l(t)-n)<c&&(c=h=(c+h)/2),e(t,i,c,d,h))}return c.round=function(e){return arguments.length?(t=!!e,c):t},c.size=function(e){return arguments.length?(n=+e[0],i=+e[1],c):[n,i]},c.tile=function(t){return arguments.length?(e=eP(t),c):e},c.padding=function(e){return arguments.length?c.paddingInner(e).paddingOuter(e):c.paddingInner()},c.paddingInner=function(e){return arguments.length?(s="function"==typeof e?e:nP(+e),c):s},c.paddingOuter=function(e){return arguments.length?c.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):c.paddingTop()},c.paddingTop=function(e){return arguments.length?(o="function"==typeof e?e:nP(+e),c):o},c.paddingRight=function(e){return arguments.length?(a="function"==typeof e?e:nP(+e),c):a},c.paddingBottom=function(e){return arguments.length?(l="function"==typeof e?e:nP(+e),c):l},c.paddingLeft=function(e){return arguments.length?(u="function"==typeof e?e:nP(+e),c):u},c}();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{ut(jP,t)?e.tile(jP[t]):ae("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:YP}),WP.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:HP(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:HP(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},qP.prototype={areaStart:XP,areaEnd:XP,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:HP(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},KP.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&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,i=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:HP(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},ZP.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var i,r=e[0],s=t[0],o=e[n]-r,a=t[n]-s,l=-1;++l<=n;)i=l/n,this._basis.point(this._beta*e[l]+(1-this._beta)*(r+i*o),this._beta*t[l]+(1-this._beta)*(s+i*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const QP=function e(t){function n(e){return 1===t?new WP(e):new ZP(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function JP(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function eB(e,t){this._context=e,this._k=(1-t)/6}eB.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:JP(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:JP(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const tB=function e(t){function n(e){return new eB(e,t)}return n.tension=function(t){return e(+t)},n}(0);function nB(e,t){this._context=e,this._k=(1-t)/6}nB.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&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:JP(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const iB=function e(t){function n(e){return new nB(e,t)}return n.tension=function(t){return e(+t)},n}(0);function rB(e,t){this._context=e,this._k=(1-t)/6}rB.prototype={areaStart:XP,areaEnd:XP,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:JP(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const sB=function e(t){function n(e){return new rB(e,t)}return n.tension=function(t){return e(+t)},n}(0);var oB=Math.abs,aB=Math.atan2,lB=Math.cos,uB=Math.max,cB=Math.min,dB=Math.sin,hB=Math.sqrt,pB=1e-12,fB=Math.PI,mB=fB/2,gB=2*fB;function yB(e){return e>=1?mB:e<=-1?-mB:Math.asin(e)}function _B(e,t,n){var i=e._x1,r=e._y1,s=e._x2,o=e._y2;if(e._l01_a>pB){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,r=(r*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>pB){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*u+e._x1*e._l23_2a-t*e._l12_2a)/c,o=(o*u+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(i,r,s,o,e._x2,e._y2)}function vB(e,t){this._context=e,this._alpha=t}vB.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&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:_B(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const bB=function e(t){function n(e){return t?new vB(e,t):new eB(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function TB(e,t){this._context=e,this._alpha=t}TB.prototype={areaStart:XP,areaEnd:XP,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:_B(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const xB=function e(t){function n(e){return t?new TB(e,t):new rB(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function EB(e,t){this._context=e,this._alpha=t}EB.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&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,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:_B(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const wB=function e(t){function n(e){return t?new EB(e,t):new nB(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function IB(e){this._context=e}function AB(e){return new IB(e)}function SB(e){this._context=e}function CB(e){return e<0?-1:1}function OB(e,t,n){var i=e._x1-e._x0,r=t-e._x1,s=(e._y1-e._y0)/(i||r<0&&-0),o=(n-e._y1)/(r||i<0&&-0),a=(s*r+o*i)/(i+r);return(CB(s)+CB(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function MB(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function RB(e,t,n){var i=e._x0,r=e._y0,s=e._x1,o=e._y1,a=(s-i)/3;e._context.bezierCurveTo(i+a,r+a*t,s-a,o-a*n,s,o)}function kB(e){this._context=e}function NB(e){this._context=new DB(e)}function DB(e){this._context=e}function FB(e){this._context=e}function LB(e){var t,n,i=e.length-1,r=new Array(i),s=new Array(i),o=new Array(i);for(r[0]=0,s[0]=2,o[0]=e[0]+2*e[1],t=1;t<i-1;++t)r[t]=1,s[t]=4,o[t]=4*e[t]+2*e[t+1];for(r[i-1]=2,s[i-1]=7,o[i-1]=8*e[i-1]+e[i],t=1;t<i;++t)n=r[t]/s[t-1],s[t]-=n,o[t]-=n*o[t-1];for(r[i-1]=o[i-1]/s[i-1],t=i-2;t>=0;--t)r[t]=(o[t]-r[t+1])/s[t];for(s[i-1]=(e[i]+r[i-1])/2,t=0;t<i-1;++t)s[t]=2*e[t+1]-r[t+1];return[r,s]}function PB(e,t){this._context=e,this._t=t}IB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}},SB.prototype={areaStart:XP,areaEnd:XP,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}},kB.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:RB(this,this._t0,MB(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,RB(this,MB(this,n=OB(this,e,t)),n);break;default:RB(this,this._t0,n=OB(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(NB.prototype=Object.create(kB.prototype)).point=function(e,t){kB.prototype.point.call(this,t,e)},DB.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,i,r,s){this._context.bezierCurveTo(t,e,i,n,s,r)}},FB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var i=LB(e),r=LB(t),s=0,o=1;o<n;++s,++o)this._context.bezierCurveTo(i[0][s],r[0][s],i[1][s],r[1][s],e[o],t[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},PB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};const BB=Math.PI,$B=2*BB,UB=1e-6,zB=$B-UB;function VB(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function jB(){return new VB}VB.prototype=jB.prototype={constructor:VB,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,n,i){this._+="Q"+ +e+","+ +t+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(e,t,n,i,r,s){this._+="C"+ +e+","+ +t+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+s)},arcTo:function(e,t,n,i,r){e=+e,t=+t,n=+n,i=+i,r=+r;var s=this._x1,o=this._y1,a=n-e,l=i-t,u=s-e,c=o-t,d=u*u+c*c;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(d>UB)if(Math.abs(c*a-l*u)>UB&&r){var h=n-s,p=i-o,f=a*a+l*l,m=h*h+p*p,g=Math.sqrt(f),y=Math.sqrt(d),_=r*Math.tan((BB-Math.acos((f+d-m)/(2*g*y)))/2),v=_/y,b=_/g;Math.abs(v-1)>UB&&(this._+="L"+(e+v*u)+","+(t+v*c)),this._+="A"+r+","+r+",0,0,"+ +(c*h>u*p)+","+(this._x1=e+b*a)+","+(this._y1=t+b*l)}else this._+="L"+(this._x1=e)+","+(this._y1=t);else;},arc:function(e,t,n,i,r,s){e=+e,t=+t,s=!!s;var o=(n=+n)*Math.cos(i),a=n*Math.sin(i),l=e+o,u=t+a,c=1^s,d=s?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+u:(Math.abs(this._x1-l)>UB||Math.abs(this._y1-u)>UB)&&(this._+="L"+l+","+u),n&&(d<0&&(d=d%$B+$B),d>zB?this._+="A"+n+","+n+",0,1,"+c+","+(e-o)+","+(t-a)+"A"+n+","+n+",0,1,"+c+","+(this._x1=l)+","+(this._y1=u):d>UB&&(this._+="A"+n+","+n+",0,"+ +(d>=BB)+","+c+","+(this._x1=e+n*Math.cos(r))+","+(this._y1=t+n*Math.sin(r))))},rect:function(e,t,n,i){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};const YB=jB;function GB(e){return function(){return e}}function HB(e){return e.innerRadius}function WB(e){return e.outerRadius}function XB(e){return e.startAngle}function qB(e){return e.endAngle}function KB(e){return e&&e.padAngle}function ZB(e,t,n,i,r,s,o){var a=e-n,l=t-i,u=(o?s:-s)/hB(a*a+l*l),c=u*l,d=-u*a,h=e+c,p=t+d,f=n+c,m=i+d,g=(h+f)/2,y=(p+m)/2,_=f-h,v=m-p,b=_*_+v*v,T=r-s,x=h*m-f*p,E=(v<0?-1:1)*hB(uB(0,T*T*b-x*x)),w=(x*v-_*E)/b,I=(-x*_-v*E)/b,A=(x*v+_*E)/b,S=(-x*_+v*E)/b,C=w-g,O=I-y,M=A-g,R=S-y;return C*C+O*O>M*M+R*R&&(w=A,I=S),{cx:w,cy:I,x01:-c,y01:-d,x11:w*(r/T-1),y11:I*(r/T-1)}}Array.prototype.slice;function QB(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function JB(e){return e[0]}function e$(e){return e[1]}function t$(e,t){var n=GB(!0),i=null,r=AB,s=null;function o(o){var a,l,u,c=(o=QB(o)).length,d=!1;for(null==i&&(s=r(u=YB())),a=0;a<=c;++a)!(a<c&&n(l=o[a],a,o))===d&&((d=!d)?s.lineStart():s.lineEnd()),d&&s.point(+e(l,a,o),+t(l,a,o));if(u)return s=null,u+""||null}return e="function"==typeof e?e:void 0===e?JB:GB(e),t="function"==typeof t?t:void 0===t?e$:GB(t),o.x=function(t){return arguments.length?(e="function"==typeof t?t:GB(+t),o):e},o.y=function(e){return arguments.length?(t="function"==typeof e?e:GB(+e),o):t},o.defined=function(e){return arguments.length?(n="function"==typeof e?e:GB(!!e),o):n},o.curve=function(e){return arguments.length?(r=e,null!=i&&(s=r(i)),o):r},o.context=function(e){return arguments.length?(null==e?i=s=null:s=r(i=e),o):i},o}function n$(e,t,n){var i=null,r=GB(!0),s=null,o=AB,a=null;function l(l){var u,c,d,h,p,f=(l=QB(l)).length,m=!1,g=new Array(f),y=new Array(f);for(null==s&&(a=o(p=YB())),u=0;u<=f;++u){if(!(u<f&&r(h=l[u],u,l))===m)if(m=!m)c=u,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),d=u-1;d>=c;--d)a.point(g[d],y[d]);a.lineEnd(),a.areaEnd()}m&&(g[u]=+e(h,u,l),y[u]=+t(h,u,l),a.point(i?+i(h,u,l):g[u],n?+n(h,u,l):y[u]))}if(p)return a=null,p+""||null}function u(){return t$().defined(r).curve(o).context(s)}return e="function"==typeof e?e:void 0===e?JB:GB(+e),t="function"==typeof t?t:GB(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?e$:GB(+n),l.x=function(t){return arguments.length?(e="function"==typeof t?t:GB(+t),i=null,l):e},l.x0=function(t){return arguments.length?(e="function"==typeof t?t:GB(+t),l):e},l.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:GB(+e),l):i},l.y=function(e){return arguments.length?(t="function"==typeof e?e:GB(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t="function"==typeof e?e:GB(+e),l):t},l.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:GB(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(i).y(t)},l.defined=function(e){return arguments.length?(r="function"==typeof e?e:GB(!!e),l):r},l.curve=function(e){return arguments.length?(o=e,null!=s&&(a=o(s)),l):o},l.context=function(e){return arguments.length?(null==e?s=a=null:a=o(s=e),l):s},l}const i$={draw:function(e,t){var n=Math.sqrt(t/fB);e.moveTo(n,0),e.arc(0,0,n,0,gB)}};Math.sqrt(1/3);var r$=Math.sin(fB/10)/Math.sin(7*fB/10);Math.sin(gB/10),Math.cos(gB/10);Math.sqrt(3);Math.sqrt(3),Math.sqrt(12);var s$={},o$={};function a$(e){return new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'}).join(",")+"}")}function l$(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var i in e)i in t||n.push(t[i]=i)}),n}function u$(e,t){var n=e+"",i=n.length;return i<t?new Array(t-i+1).join(0)+n:n}function c$(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),r=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":function(e){return e<0?"-"+u$(-e,6):e>9999?"+"+u$(e,6):u$(e,4)}(e.getUTCFullYear())+"-"+u$(e.getUTCMonth()+1,2)+"-"+u$(e.getUTCDate(),2)+(r?"T"+u$(t,2)+":"+u$(n,2)+":"+u$(i,2)+"."+u$(r,3)+"Z":i?"T"+u$(t,2)+":"+u$(n,2)+":"+u$(i,2)+"Z":n||t?"T"+u$(t,2)+":"+u$(n,2)+"Z":"")}function d$(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function i(e,t){var i,r=[],s=e.length,o=0,a=0,l=s<=0,u=!1;function c(){if(l)return o$;if(u)return u=!1,s$;var t,i,r=o;if(34===e.charCodeAt(r)){for(;o++<s&&34!==e.charCodeAt(o)||34===e.charCodeAt(++o););return(t=o)>=s?l=!0:10===(i=e.charCodeAt(o++))?u=!0:13===i&&(u=!0,10===e.charCodeAt(o)&&++o),e.slice(r+1,t-1).replace(/""/g,'"')}for(;o<s;){if(10===(i=e.charCodeAt(t=o++)))u=!0;else if(13===i)u=!0,10===e.charCodeAt(o)&&++o;else if(i!==n)continue;return e.slice(r,t)}return l=!0,e.slice(r,s)}for(10===e.charCodeAt(s-1)&&--s,13===e.charCodeAt(s-1)&&--s;(i=c())!==o$;){for(var d=[];i!==s$&&i!==o$;)d.push(i),i=c();t&&null==(d=t(d,a++))||r.push(d)}return r}function r(t,n){return t.map(function(t){return n.map(function(e){return o(t[e])}).join(e)})}function s(t){return t.map(o).join(e)}function o(e){return null==e?"":e instanceof Date?c$(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,r,s=i(e,function(e,i){if(n)return n(e,i-1);r=e,n=t?function(e,t){var n=a$(e);return function(i,r){return t(n(i),r,e)}}(e,t):a$(e)});return s.columns=r||[],s},parseRows:i,format:function(t,n){return null==n&&(n=l$(t)),[n.map(o).join(e)].concat(r(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=l$(e)),r(e,t).join("\n")},formatRows:function(e){return e.map(s).join("\n")},formatRow:s,formatValue:o}}var h$,p$=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function f$(e){if(!(t=p$.exec(e)))throw new Error("invalid format: "+e);var t;return new m$({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function m$(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function g$(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function y$(e){return(e=g$(Math.abs(e)))?e[1]:NaN}function _$(e,t){var n=g$(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}f$.prototype=m$.prototype,m$.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const v$={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>_$(100*e,t),r:_$,s:function(e,t){var n=g$(e,t);if(!n)return e+"";var i=n[0],r=n[1],s=r-(h$=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+g$(e,Math.max(0,t+s-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function b$(e){return e}var T$,x$,E$,w$=Array.prototype.map,I$=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function A$(e){var t,n,i=void 0===e.grouping||void 0===e.thousands?b$:(t=w$.call(e.grouping,Number),n=e.thousands+"",function(e,i){for(var r=e.length,s=[],o=0,a=t[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),s.push(e.substring(r-=a,r+a)),!((l+=a+1)>i));)a=t[o=(o+1)%t.length];return s.reverse().join(n)}),r=void 0===e.currency?"":e.currency[0]+"",s=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",a=void 0===e.numerals?b$:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(w$.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=f$(e)).fill,n=e.align,d=e.sign,h=e.symbol,p=e.zero,f=e.width,m=e.comma,g=e.precision,y=e.trim,_=e.type;"n"===_?(m=!0,_="g"):v$[_]||(void 0===g&&(g=12),y=!0,_="g"),(p||"0"===t&&"="===n)&&(p=!0,t="0",n="=");var v="$"===h?r:"#"===h&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",b="$"===h?s:/[%p]/.test(_)?l:"",T=v$[_],x=/[defgprs%]/.test(_);function E(e){var r,s,l,h=v,E=b;if("c"===_)E=T(e)+E,e="";else{var w=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:T(Math.abs(e),g),y&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i<n;++i)switch(e[i]){case".":r=t=i;break;case"0":0===r&&(r=i),t=i;break;default:if(!+e[i])break e;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),w&&0===+e&&"+"!==d&&(w=!1),h=(w?"("===d?d:u:"-"===d||"("===d?"":d)+h,E=("s"===_?I$[8+h$/3]:"")+E+(w&&"("===d?")":""),x)for(r=-1,s=e.length;++r<s;)if(48>(l=e.charCodeAt(r))||l>57){E=(46===l?o+e.slice(r+1):e.slice(r))+E,e=e.slice(0,r);break}}m&&!p&&(e=i(e,1/0));var I=h.length+e.length+E.length,A=I<f?new Array(f-I+1).join(t):"";switch(m&&p&&(e=i(A+e,A.length?f-E.length:1/0),A=""),n){case"<":e=h+e+E+A;break;case"=":e=h+A+e+E;break;case"^":e=A.slice(0,I=A.length>>1)+h+e+E+A.slice(I);break;default:e=A+h+e+E}return a(e)}return g=void 0===g?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),E.toString=function(){return e+""},E}return{format:d,formatPrefix:function(e,t){var n=d(((e=f$(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(y$(t)/3))),r=Math.pow(10,-i),s=I$[8+i/3];return function(e){return n(r*e)+s}}}}function S$(e){const t={};return n=>t[n]||(t[n]=e(n))}function C$(e){const t=S$(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){const n=f$(e||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return function(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let s=function(e,t){let n,i=e.lastIndexOf("e");if(i>0)return i;for(i=e.length;--i>t;)if(n=e.charCodeAt(i),n>=48&&n<=57)return i+1}(i,r);const o=s<i.length?i.slice(s):"";for(;--s>r;)if("0"!==i[s]){++s;break}return i.slice(0,s)+o}}(t(n),t(".1f")(1)[1])}return t(n)},formatSpan(e,i,r,s){s=f$(null==s?",f":s);const o=ru(e,i,r),a=Math.max(Math.abs(e),Math.abs(i));let l;if(null==s.precision)switch(s.type){case"s":return isNaN(l=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(y$(t)/3)))-y$(Math.abs(e)))}(o,a))||(s.precision=l),n(s,a);case"":case"e":case"g":case"p":case"r":isNaN(l=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,y$(t)-y$(e))+1}(o,a))||(s.precision=l-("e"===s.type));break;case"f":case"%":isNaN(l=function(e){return Math.max(0,-y$(Math.abs(e)))}(o))||(s.precision=l-2*("%"===s.type))}return t(s)}}}let O$,M$;function R$(){return O$=C$({format:x$,formatPrefix:E$})}function k$(e){return C$(A$(e))}function N$(e){return arguments.length?O$=k$(e):O$}function D$(e,t,n){we(n=n||{})||ae("Invalid time multi-format specifier: ".concat(n));const i=t(fu),r=t(pu),s=t(hu),o=t(uu),a=t(lu),l=t(au),u=t(ou),c=t(su),d=e(n[mu]||".%L"),h=e(n[fu]||":%S"),p=e(n[pu]||"%I:%M"),f=e(n[hu]||"%I %p"),m=e(n[uu]||n[cu]||"%a %d"),g=e(n[lu]||"%b %d"),y=e(n[au]||"%B"),_=e(n[ou]||"%B"),v=e(n[su]||"%Y");return e=>(i(e)<e?d:r(e)<e?h:s(e)<e?p:o(e)<e?f:l(e)<e?a(e)<e?m:g:c(e)<e?u(e)<e?y:_:v)(e)}function F$(e){const t=S$(e.format),n=S$(e.utcFormat);return{timeFormat:e=>bt(e)?t(e):D$(t,Gu,e),utcFormat:e=>bt(e)?n(e):D$(n,Hu,e),timeParse:S$(e.parse),utcParse:S$(e.utcParse)}}function L$(){return M$=F$({format:lC,parse:uC,utcFormat:cC,utcParse:dC})}function P$(e){return F$(oC(e))}function B$(e){return arguments.length?M$=P$(e):M$}!function(e){T$=A$(e),x$=T$.format,E$=T$.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]}),R$(),L$();const $$=(e,t)=>st({},e,t);function U$(e,t){const n=e?k$(e):N$(),i=t?P$(t):B$();return $$(n,i)}function z$(e,t){const n=arguments.length;return n&&2!==n&&ae("defaultLocale expects either zero or two arguments."),n?$$(N$(e),B$(t)):$$(N$(),B$())}function V$(){return R$(),L$(),z$()}const j$=/^(data:|([A-Za-z]+:)?\/\/)/,Y$=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,G$=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,H$="file://";async function W$(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t)}async function X$(e,t){t=st({},this.options,t);const n=this.fileAccess,i={href:null};let r,s,o;const a=Y$.test(e.replace(G$,""));null!=e&&"string"==typeof e&&a||ae("Sanitize failure, invalid URI: "+Ot(e));const l=j$.test(e);return(o=t.baseURL)&&!l&&(e.startsWith("/")||o.endsWith("/")||(e="/"+e),e=o+e),s=(r=e.startsWith(H$))||"file"===t.mode||"http"!==t.mode&&!l&&n,r?e=e.slice(7):e.startsWith("//")&&("file"===t.defaultProtocol?(e=e.slice(2),s=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!s}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),"image"===t.context&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function q$(e){return e?t=>new Promise((n,i)=>{e.readFile(t,(e,t)=>{e?i(e):n(t)})}):K$}async function K$(){ae("No file system access.")}function Z$(e){return e?async function(t,n){const i=st({},this.options.http,n),r=n&&n.response,s=await e(t,i);return s.ok?Ke(s[r])?s[r]():s.text():ae(s.status+""+s.statusText)}:Q$}async function Q$(){ae("No HTTP fetch method available.")}const J$=e=>null!=e&&e==e,eU=e=>!(Number.isNaN(+e)||e instanceof Date),tU={boolean:Mt,integer:Me,number:Me,date:kt,string:Nt,unknown:de},nU=[e=>"true"===e||"false"===e||!0===e||!1===e,e=>eU(e)&&Number.isInteger(+e),eU,e=>!Number.isNaN(Date.parse(e))],iU=["boolean","integer","number","date"];function rU(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=nU.length,r=nU.map((e,t)=>t+1);for(let s,o,a=0,l=0;a<n;++a)for(o=t?e[a][t]:e[a],s=0;s<i;++s)if(r[s]&&J$(o)&&!nU[s](o)&&(r[s]=0,++l,l===nU.length))return"string";return iU[r.reduce((e,t)=>0===e?t:e,0)-1]}function sU(e,t){return t.reduce((t,n)=>(t[n]=rU(e,n),t),{})}function oU(e){const t=function(t,n){const i={delimiter:e};return aU(t,n?st(n,i):i)};return t.responseType="text",t}function aU(e,t){return t.header&&(e=t.header.map(Ot).join(t.delimiter)+"\n"+e),d$(t.delimiter).parse(e+"")}function lU(e,t){const n=t&&t.property?ue(t.property):de;return!we(e)||(i=e,"function"==typeof Buffer&&Ke(Buffer.isBuffer)&&Buffer.isBuffer(i))?n(JSON.parse(e)):function(e,t){!Ee(e)&&yt(e)&&(e=[...e]);return t&&t.copy?JSON.parse(JSON.stringify(e)):e}(n(e),t);var i}aU.responseType="text",lU.responseType="json";const uU={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function cU(e,t){let n,i,r,s;return e=lU(e,t),t&&t.feature?(n=Tn,r=t.feature):t&&t.mesh?(n=In,r=t.mesh,s=uU[t.filter]):ae("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,s):ae("Invalid TopoJSON object: "+r),i&&i.features||[i]}cU.responseType="json";const dU={dsv:aU,csv:oU(","),tsv:oU("\t"),json:lU,topojson:cU};function hU(e,t){return arguments.length>1?(dU[e]=t,this):ut(dU,e)?dU[e]:null}function pU(e){const t=hU(e);return t&&t.responseType||"text"}function fU(e,t,n,i){const r=hU((t=t||{}).type||"json");return r||ae("Unknown data format type: "+t.type),e=r(e,t),t.parse&&function(e,t,n,i){if(!e.length)return;const r=B$();n=n||r.timeParse,i=i||r.utcParse;let s,o,a,l,u,c,d=e.columns||Object.keys(e[0]);"auto"===t&&(t=sU(e,d));d=Object.keys(t);const h=d.map(e=>{const r=t[e];let s,o;if(r&&(r.startsWith("date:")||r.startsWith("utc:"))){s=r.split(/:(.+)?/,2),o=s[1],("'"===o[0]&&"'"===o[o.length-1]||'"'===o[0]&&'"'===o[o.length-1])&&(o=o.slice(1,-1));return("utc"===s[0]?i:n)(o)}if(!tU[r])throw Error("Illegal format pattern: "+e+":"+r);return tU[r]});for(a=0,u=e.length,c=d.length;a<u;++a)for(s=e[a],l=0;l<c;++l)o=d[l],s[o]=h[l](s[o])}(e,t.parse,n,i),ut(e,"columns")&&delete e.columns,e}const mU=function(e,t){return n=>({options:n||{},sanitize:X$,load:W$,fileAccess:!!t,file:q$(t),http:Z$(e)})}("undefined"!=typeof fetch&&fetch,null);let gU=0;const yU="p_";function _U(e){return e&&e.gradient}function vU(e,t,n){const i=e.gradient;let r=e.id,s="radial"===i?yU:"";return r||(r=e.id="gradient_"+gU++,"radial"===i?(e.x1=bU(e.x1,.5),e.y1=bU(e.y1,.5),e.r1=bU(e.r1,0),e.x2=bU(e.x2,.5),e.y2=bU(e.y2,.5),e.r2=bU(e.r2,.5),s=yU):(e.x1=bU(e.x1,0),e.y1=bU(e.y1,0),e.x2=bU(e.x2,1),e.y2=bU(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+s+r+")"}function bU(e,t){return null!=e?e:t}function TU(e,t){var n,i=[];return n={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:i,stop:function(e,t){return i.push({offset:e,color:t}),n}}}const xU={basis:{curve:function(e){return new WP(e)}},"basis-closed":{curve:function(e){return new qP(e)}},"basis-open":{curve:function(e){return new KP(e)}},bundle:{curve:QP,tension:"beta",value:.85},cardinal:{curve:tB,tension:"tension",value:0},"cardinal-open":{curve:iB,tension:"tension",value:0},"cardinal-closed":{curve:sB,tension:"tension",value:0},"catmull-rom":{curve:bB,tension:"alpha",value:.5},"catmull-rom-closed":{curve:xB,tension:"alpha",value:.5},"catmull-rom-open":{curve:wB,tension:"alpha",value:.5},linear:{curve:AB},"linear-closed":{curve:function(e){return new SB(e)}},monotone:{horizontal:function(e){return new NB(e)},vertical:function(e){return new kB(e)}},natural:{curve:function(e){return new FB(e)}},step:{curve:function(e){return new PB(e,.5)}},"step-after":{curve:function(e){return new PB(e,1)}},"step-before":{curve:function(e){return new PB(e,0)}}};function EU(e,t,n){var i=ut(xU,e)&&xU[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const wU={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},IU=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\.\d+)(\.\d)/g,/(\d)([-+])/g,/\s|,|###/];function AU(e){const t=[];let n,i,r,s,o,a,l,u,c,d;const h=e.slice().replace(IU[0],"###$1").split(IU[1]).slice(1);for(l=0,c=h.length;l<c;++l){for(n=h[l],i=n.slice(1).trim().replace(IU[2],"$1###$2").replace(IU[3],"$1###$2").split(IU[4]),o=n.charAt(0),r=[o],u=0,d=i.length;u<d;++u)(s=+i[u])===s&&r.push(s);if(a=wU[o.toLowerCase()],r.length-1>a){const e=r.length;for(u=1,t.push([o].concat(r.slice(u,u+=a))),o="M"===o?"L":"m"===o?"l":o;u<e;u+=a)t.push([o].concat(r.slice(u,u+a)))}else t.push(r)}return t}const SU=Math.PI/180,CU=Math.PI/2,OU=2*Math.PI,MU=Math.sqrt(3)/2;var RU={},kU={},NU=[].join;function DU(e){const t=NU.call(e);if(kU[t])return kU[t];var n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7];const c=u*o,d=-l*a,h=l*o,p=u*a,f=Math.cos(r),m=Math.sin(r),g=Math.cos(s),y=Math.sin(s),_=.5*(s-r),v=Math.sin(.5*_),b=8/3*v*v/Math.sin(_),T=n+f-b*m,x=i+m+b*f,E=n+g,w=i+y,I=E+b*y,A=w-b*g;return kU[t]=[c*T+d*x,h*T+p*x,c*I+d*A,h*I+p*A,c*E+d*w,h*E+p*w]}const FU=["l",0,0,0,0,0,0,0];function LU(e,t,n){const i=FU[0]=e[0];if("a"===i||"A"===i)FU[1]=t*e[1],FU[2]=n*e[2],FU[3]=e[3],FU[4]=e[4],FU[5]=e[5],FU[6]=t*e[6],FU[7]=n*e[7];else if("h"===i||"H"===i)FU[1]=t*e[1];else if("v"===i||"V"===i)FU[1]=n*e[1];else for(var r=1,s=e.length;r<s;++r)FU[r]=(r%2==1?t:n)*e[r];return FU}function PU(e,t,n,i,r,s){var o,a,l,u,c,d=null,h=0,p=0,f=0,m=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),null==s&&(s=r),e.beginPath&&e.beginPath();for(var g=0,y=t.length;g<y;++g){switch(o=t[g],1===r&&1===s||(o=LU(o,r,s)),o[0]){case"l":h+=o[1],p+=o[2],e.lineTo(h+n,p+i);break;case"L":h=o[1],p=o[2],e.lineTo(h+n,p+i);break;case"h":h+=o[1],e.lineTo(h+n,p+i);break;case"H":h=o[1],e.lineTo(h+n,p+i);break;case"v":p+=o[1],e.lineTo(h+n,p+i);break;case"V":p=o[1],e.lineTo(h+n,p+i);break;case"m":h+=o[1],p+=o[2],e.moveTo(h+n,p+i);break;case"M":h=o[1],p=o[2],e.moveTo(h+n,p+i);break;case"c":a=h+o[5],l=p+o[6],f=h+o[3],m=p+o[4],e.bezierCurveTo(h+o[1]+n,p+o[2]+i,f+n,m+i,a+n,l+i),h=a,p=l;break;case"C":h=o[5],p=o[6],f=o[3],m=o[4],e.bezierCurveTo(o[1]+n,o[2]+i,f+n,m+i,h+n,p+i);break;case"s":a=h+o[3],l=p+o[4],f=2*h-f,m=2*p-m,e.bezierCurveTo(f+n,m+i,h+o[1]+n,p+o[2]+i,a+n,l+i),f=h+o[1],m=p+o[2],h=a,p=l;break;case"S":a=o[3],l=o[4],f=2*h-f,m=2*p-m,e.bezierCurveTo(f+n,m+i,o[1]+n,o[2]+i,a+n,l+i),h=a,p=l,f=o[1],m=o[2];break;case"q":a=h+o[3],l=p+o[4],f=h+o[1],m=p+o[2],e.quadraticCurveTo(f+n,m+i,a+n,l+i),h=a,p=l;break;case"Q":a=o[3],l=o[4],e.quadraticCurveTo(o[1]+n,o[2]+i,a+n,l+i),h=a,p=l,f=o[1],m=o[2];break;case"t":a=h+o[1],l=p+o[2],null===d[0].match(/[QqTt]/)?(f=h,m=p):"t"===d[0]?(f=2*h-u,m=2*p-c):"q"===d[0]&&(f=2*h-f,m=2*p-m),u=f,c=m,e.quadraticCurveTo(f+n,m+i,a+n,l+i),p=l,f=(h=a)+o[1],m=p+o[2];break;case"T":a=o[1],l=o[2],f=2*h-f,m=2*p-m,e.quadraticCurveTo(f+n,m+i,a+n,l+i),h=a,p=l;break;case"a":BU(e,h+n,p+i,[o[1],o[2],o[3],o[4],o[5],o[6]+h+n,o[7]+p+i]),h+=o[6],p+=o[7];break;case"A":BU(e,h+n,p+i,[o[1],o[2],o[3],o[4],o[5],o[6]+n,o[7]+i]),h=o[6],p=o[7];break;case"z":case"Z":e.closePath()}d=o}}function BU(e,t,n,i){const r=function(e,t,n,i,r,s,o,a,l){const u=NU.call(arguments);if(RU[u])return RU[u];const c=o*SU,d=Math.sin(c),h=Math.cos(c),p=h*(a-e)*.5+d*(l-t)*.5,f=h*(l-t)*.5-d*(a-e)*.5;let m=p*p/((n=Math.abs(n))*n)+f*f/((i=Math.abs(i))*i);m>1&&(m=Math.sqrt(m),n*=m,i*=m);const g=h/n,y=d/n,_=-d/i,v=h/i,b=g*a+y*l,T=_*a+v*l,x=g*e+y*t,E=_*e+v*t;let w=1/((x-b)*(x-b)+(E-T)*(E-T))-.25;w<0&&(w=0);let I=Math.sqrt(w);s==r&&(I=-I);const A=.5*(b+x)-I*(E-T),S=.5*(T+E)+I*(x-b),C=Math.atan2(T-S,b-A);let O=Math.atan2(E-S,x-A)-C;O<0&&1===s?O+=OU:O>0&&0===s&&(O-=OU);const M=Math.ceil(Math.abs(O/(CU+.001))),R=[];for(let e=0;e<M;++e){const t=C+e*O/M,r=C+(e+1)*O/M;R[e]=[A,S,t,r,n,i,d,h]}return RU[u]=R}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],t,n);for(let t=0;t<r.length;++t){const n=DU(r[t]);e.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5])}}const $U=.5773502691896257,UU={circle:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,OU)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/2.5;e.moveTo(-n,-i),e.lineTo(-n,i),e.lineTo(-i,i),e.lineTo(-i,n),e.lineTo(i,n),e.lineTo(i,i),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(i,-i),e.lineTo(i,-n),e.lineTo(-i,-n),e.lineTo(-i,-i),e.closePath()}},diamond:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),i=-n/2;e.rect(i,i,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/7,r=n/2.5,s=n/8;e.moveTo(-i,n),e.lineTo(i,n),e.lineTo(i,-s),e.lineTo(r,-s),e.lineTo(0,-n),e.lineTo(-r,-s),e.lineTo(-i,-s),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,i=MU*n,r=i-n*$U,s=n/4;e.moveTo(0,-i-r),e.lineTo(-s,i-r),e.lineTo(s,i-r),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,i=MU*n,r=i-n*$U;e.moveTo(0,-i-r),e.lineTo(-n,i-r),e.lineTo(n,i-r),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,i=MU*n;e.moveTo(0,-i),e.lineTo(-n,i),e.lineTo(n,i),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,i=MU*n;e.moveTo(0,i),e.lineTo(-n,-i),e.lineTo(n,-i),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,i=MU*n;e.moveTo(i,0),e.lineTo(-i,-n),e.lineTo(-i,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,i=MU*n;e.moveTo(-i,0),e.lineTo(i,-n),e.lineTo(i,n),e.closePath()}},stroke:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}};function zU(e){return ut(UU,e)?UU[e]:function(e){if(!ut(VU,e)){const t=AU(e);VU[e]={draw:function(e,n){PU(e,t,0,0,Math.sqrt(n)/2)}}}return VU[e]}(e)}var VU={};const jU=.448084975506;function YU(e){return e.x}function GU(e){return e.y}function HU(e){return e.width}function WU(e){return e.height}function XU(e){return"function"==typeof e?e:()=>+e}function qU(e,t,n){return Math.max(t,Math.min(e,n))}function KU(){var e=YU,t=GU,n=HU,i=WU,r=XU(0),s=r,o=r,a=r,l=null;function u(u,c,d){var h,p=null!=c?c:+e.call(this,u),f=null!=d?d:+t.call(this,u),m=+n.call(this,u),g=+i.call(this,u),y=Math.min(m,g)/2,_=qU(+r.call(this,u),0,y),v=qU(+s.call(this,u),0,y),b=qU(+o.call(this,u),0,y),T=qU(+a.call(this,u),0,y);if(l||(l=h=YB()),_<=0&&v<=0&&b<=0&&T<=0)l.rect(p,f,m,g);else{var x=p+m,E=f+g;l.moveTo(p+_,f),l.lineTo(x-v,f),l.bezierCurveTo(x-jU*v,f,x,f+jU*v,x,f+v),l.lineTo(x,E-T),l.bezierCurveTo(x,E-jU*T,x-jU*T,E,x-T,E),l.lineTo(p+b,E),l.bezierCurveTo(p+jU*b,E,p,E-jU*b,p,E-b),l.lineTo(p,f+_),l.bezierCurveTo(p,f+jU*_,p+jU*_,f,p+_,f),l.closePath()}if(h)return l=null,h+""||null}return u.x=function(t){return arguments.length?(e=XU(t),u):e},u.y=function(e){return arguments.length?(t=XU(e),u):t},u.width=function(e){return arguments.length?(n=XU(e),u):n},u.height=function(e){return arguments.length?(i=XU(e),u):i},u.cornerRadius=function(e,t,n,i){return arguments.length?(r=XU(e),s=null!=t?XU(t):r,a=null!=n?XU(n):r,o=null!=i?XU(i):s,u):r},u.context=function(e){return arguments.length?(l=null==e?null:e,u):l},u}function ZU(){var e,t,n,i,r,s,o,a,l=null;function u(e,t,n){const i=n/2;if(r){var u=o-t,c=e-s;if(u||c){var d=Math.sqrt(u*u+c*c),h=(u/=d)*a,p=(c/=d)*a,f=Math.atan2(c,u);l.moveTo(s-h,o-p),l.lineTo(e-u*i,t-c*i),l.arc(e,t,i,f-Math.PI,f),l.lineTo(s+h,o+p),l.arc(s,o,a,f,f+Math.PI)}else l.arc(e,t,i,0,OU);l.closePath()}else r=1;s=e,o=t,a=i}function c(s){var o,a,c,d=s.length,h=!1;for(null==l&&(l=c=YB()),o=0;o<=d;++o)!(o<d&&i(a=s[o],o,s))===h&&(h=!h)&&(r=0),h&&u(+e(a,o,s),+t(a,o,s),+n(a,o,s));if(c)return l=null,c+""||null}return c.x=function(t){return arguments.length?(e=t,c):e},c.y=function(e){return arguments.length?(t=e,c):t},c.size=function(e){return arguments.length?(n=e,c):n},c.defined=function(e){return arguments.length?(i=e,c):i},c.context=function(e){return arguments.length?(l=null==e?null:e,c):l},c}function QU(e,t){return null!=e?e:t}const JU=e=>e.x||0,ez=e=>e.y||0,tz=e=>!(!1===e.defined),nz=function(){var e=HB,t=WB,n=GB(0),i=null,r=XB,s=qB,o=KB,a=null;function l(){var l,u,c=+e.apply(this,arguments),d=+t.apply(this,arguments),h=r.apply(this,arguments)-mB,p=s.apply(this,arguments)-mB,f=oB(p-h),m=p>h;if(a||(a=l=YB()),d<c&&(u=d,d=c,c=u),d>pB)if(f>gB-pB)a.moveTo(d*lB(h),d*dB(h)),a.arc(0,0,d,h,p,!m),c>pB&&(a.moveTo(c*lB(p),c*dB(p)),a.arc(0,0,c,p,h,m));else{var g,y,_=h,v=p,b=h,T=p,x=f,E=f,w=o.apply(this,arguments)/2,I=w>pB&&(i?+i.apply(this,arguments):hB(c*c+d*d)),A=cB(oB(d-c)/2,+n.apply(this,arguments)),S=A,C=A;if(I>pB){var O=yB(I/c*dB(w)),M=yB(I/d*dB(w));(x-=2*O)>pB?(b+=O*=m?1:-1,T-=O):(x=0,b=T=(h+p)/2),(E-=2*M)>pB?(_+=M*=m?1:-1,v-=M):(E=0,_=v=(h+p)/2)}var R=d*lB(_),k=d*dB(_),N=c*lB(T),D=c*dB(T);if(A>pB){var F,L=d*lB(v),P=d*dB(v),B=c*lB(b),$=c*dB(b);if(f<fB&&(F=function(e,t,n,i,r,s,o,a){var l=n-e,u=i-t,c=o-r,d=a-s,h=d*l-c*u;if(!(h*h<pB))return[e+(h=(c*(t-s)-d*(e-r))/h)*l,t+h*u]}(R,k,B,$,L,P,N,D))){var U=R-F[0],z=k-F[1],V=L-F[0],j=P-F[1],Y=1/dB(function(e){return e>1?0:e<-1?fB:Math.acos(e)}((U*V+z*j)/(hB(U*U+z*z)*hB(V*V+j*j)))/2),G=hB(F[0]*F[0]+F[1]*F[1]);S=cB(A,(c-G)/(Y-1)),C=cB(A,(d-G)/(Y+1))}}E>pB?C>pB?(g=ZB(B,$,R,k,d,C,m),y=ZB(L,P,N,D,d,C,m),a.moveTo(g.cx+g.x01,g.cy+g.y01),C<A?a.arc(g.cx,g.cy,C,aB(g.y01,g.x01),aB(y.y01,y.x01),!m):(a.arc(g.cx,g.cy,C,aB(g.y01,g.x01),aB(g.y11,g.x11),!m),a.arc(0,0,d,aB(g.cy+g.y11,g.cx+g.x11),aB(y.cy+y.y11,y.cx+y.x11),!m),a.arc(y.cx,y.cy,C,aB(y.y11,y.x11),aB(y.y01,y.x01),!m))):(a.moveTo(R,k),a.arc(0,0,d,_,v,!m)):a.moveTo(R,k),c>pB&&x>pB?S>pB?(g=ZB(N,D,L,P,c,-S,m),y=ZB(R,k,B,$,c,-S,m),a.lineTo(g.cx+g.x01,g.cy+g.y01),S<A?a.arc(g.cx,g.cy,S,aB(g.y01,g.x01),aB(y.y01,y.x01),!m):(a.arc(g.cx,g.cy,S,aB(g.y01,g.x01),aB(g.y11,g.x11),!m),a.arc(0,0,c,aB(g.cy+g.y11,g.cx+g.x11),aB(y.cy+y.y11,y.cx+y.x11),m),a.arc(y.cx,y.cy,S,aB(y.y11,y.x11),aB(y.y01,y.x01),!m))):a.arc(0,0,c,T,b,m):a.lineTo(N,D)}else a.moveTo(0,0);if(a.closePath(),l)return a=null,l+""||null}return l.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +s.apply(this,arguments))/2-fB/2;return[lB(i)*n,dB(i)*n]},l.innerRadius=function(t){return arguments.length?(e="function"==typeof t?t:GB(+t),l):e},l.outerRadius=function(e){return arguments.length?(t="function"==typeof e?e:GB(+e),l):t},l.cornerRadius=function(e){return arguments.length?(n="function"==typeof e?e:GB(+e),l):n},l.padRadius=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:GB(+e),l):i},l.startAngle=function(e){return arguments.length?(r="function"==typeof e?e:GB(+e),l):r},l.endAngle=function(e){return arguments.length?(s="function"==typeof e?e:GB(+e),l):s},l.padAngle=function(e){return arguments.length?(o="function"==typeof e?e:GB(+e),l):o},l.context=function(e){return arguments.length?(a=null==e?null:e,l):a},l}().startAngle(e=>e.startAngle||0).endAngle(e=>e.endAngle||0).padAngle(e=>e.padAngle||0).innerRadius(e=>e.innerRadius||0).outerRadius(e=>e.outerRadius||0).cornerRadius(e=>e.cornerRadius||0),iz=n$().x(JU).y1(ez).y0(e=>(e.y||0)+(e.height||0)).defined(tz),rz=n$().y(ez).x1(JU).x0(e=>(e.x||0)+(e.width||0)).defined(tz),sz=t$().x(JU).y(ez).defined(tz),oz=KU().x(JU).y(ez).width(e=>e.width||0).height(e=>e.height||0).cornerRadius(e=>QU(e.cornerRadiusTopLeft,e.cornerRadius)||0,e=>QU(e.cornerRadiusTopRight,e.cornerRadius)||0,e=>QU(e.cornerRadiusBottomRight,e.cornerRadius)||0,e=>QU(e.cornerRadiusBottomLeft,e.cornerRadius)||0),az=function(e,t){var n=null;function i(){var i;if(n||(n=i=YB()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e="function"==typeof e?e:GB(e||i$),t="function"==typeof t?t:GB(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:GB(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:GB(+e),i):t},i.context=function(e){return arguments.length?(n=null==e?null:e,i):n},i}().type(e=>zU(e.shape||"circle")).size(e=>QU(e.size,64)),lz=ZU().x(JU).y(ez).defined(tz).size(e=>e.size||1);function uz(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function cz(e,t,n,i){return oz.context(e)(t,n,i)}var dz=1;function hz(){dz=1}function pz(e,t,n){var i=t.clip,r=e._defs,s=t.clip_id||(t.clip_id="clip"+dz++),o=r.clipping[s]||(r.clipping[s]={id:s});return Ke(i)?o.path=i(null):uz(n)?o.path=cz(null,n,0,0):(o.width=n.width||0,o.height=n.height||0),"url(#"+s+")"}function fz(e){this.clear(),e&&this.union(e)}function mz(e){this.mark=e,this.bounds=this.bounds||new fz}function gz(e){mz.call(this,e),this.items=this.items||[]}function yz(e){this._pending=0,this._loader=e||mU()}function _z(e){e._pending+=1}function vz(e){e._pending-=1}function bz(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){const i=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(i+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,i):0))}return e}fz.prototype={clone(){return new fz(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),i<t?(this.y2=t,this.y1=i):(this.y1=t,this.y2=i),this},add(e,t){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:s,y2:o}=this,a=Math.cos(e),l=Math.sin(e),u=t-t*a+n*l,c=n-t*l-n*a;return[a*i-l*r+u,l*i+a*r+c,a*i-l*o+u,l*i+a*o+c,a*s-l*r+u,l*s+a*r+c,a*s-l*o+u,l*s+a*o+c]},union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this},encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)},contains(e,t){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},pt(gz,mz),yz.prototype={pending(){return this._pending},sanitizeURL(e){const t=this;return _z(t),t._loader.sanitize(e,{context:"href"}).then(e=>(vz(t),e)).catch(()=>(vz(t),null))},loadImage(e){const t=this,n=xp();return _z(t),t._loader.sanitize(e,{context:"image"}).then(e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,s=ut(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=s&&(r.crossOrigin=s),r.onload=()=>vz(t),r.onerror=()=>vz(t),r.src=i,r}).catch(e=>(vz(t),{complete:!1,width:0,height:0,src:e&&e.url||""}))},ready(){const e=this;return new Promise(t=>{!function n(i){e.pending()?setTimeout(()=>{n(!0)},10):t(i)}(!1)})}};const Tz=OU-1e-8;let xz,Ez,wz,Iz,Az,Sz,Cz,Oz;const Mz=(e,t)=>xz.add(e,t),Rz=(e,t)=>Mz(Ez=e,wz=t),kz=e=>Mz(e,xz.y1),Nz=e=>Mz(xz.x1,e),Dz=(e,t)=>Az*e+Cz*t,Fz=(e,t)=>Sz*e+Oz*t,Lz=(e,t)=>Mz(Dz(e,t),Fz(e,t)),Pz=(e,t)=>Rz(Dz(e,t),Fz(e,t));function Bz(e,t){return xz=e,t?(Iz=t*SU,Az=Oz=Math.cos(Iz),Sz=Math.sin(Iz),Cz=-Sz):(Az=Oz=1,Iz=Sz=Cz=0),$z}const $z={beginPath(){},closePath(){},moveTo:Pz,lineTo:Pz,rect(e,t,n,i){Iz?(Lz(e+n,t),Lz(e+n,t+i),Lz(e,t+i),Pz(e,t)):(Mz(e+n,t+i),Rz(e,t))},quadraticCurveTo(e,t,n,i){const r=Dz(e,t),s=Fz(e,t),o=Dz(n,i),a=Fz(n,i);Uz(Ez,r,o,kz),Uz(wz,s,a,Nz),Rz(o,a)},bezierCurveTo(e,t,n,i,r,s){const o=Dz(e,t),a=Fz(e,t),l=Dz(n,i),u=Fz(n,i),c=Dz(r,s),d=Fz(r,s);zz(Ez,o,l,c,kz),zz(wz,a,u,d,Nz),Rz(c,d)},arc(e,t,n,i,r,s){if(i+=Iz,r+=Iz,Ez=n*Math.cos(r)+e,wz=n*Math.sin(r)+t,Math.abs(r-i)>Tz)Mz(e-n,t-n),Mz(e+n,t+n);else{const o=i=>Mz(n*Math.cos(i)+e,n*Math.sin(i)+t);let a,l;if(o(i),o(r),r!==i)if((i%=OU)<0&&(i+=OU),(r%=OU)<0&&(r+=OU),r<i&&(s=!s,a=i,i=r,r=a),s)for(r-=OU,a=i-i%CU,l=0;l<4&&a>r;++l,a-=CU)o(a);else for(a=i-i%CU+CU,l=0;l<4&&a<r;++l,a+=CU)o(a)}}};function Uz(e,t,n,i){const r=(e-t)/(e+n-2*t);0<r&&r<1&&i(e+(t-e)*r)}function zz(e,t,n,i,r){const s=i-e+3*t-3*n,o=e+n-2*t,a=e-t;let l,u=0,c=0;Math.abs(s)>1e-14?(l=o*o+a*s,l>=0&&(l=Math.sqrt(l),u=(-o+l)/s,c=(-o-l)/s)):u=.5*a/o,0<u&&u<1&&r(Vz(u,e,t,n,i)),0<c&&c<1&&r(Vz(c,e,t,n,i))}function Vz(e,t,n,i,r){const s=1-e,o=s*s,a=e*e;return o*s*t+3*o*e*n+3*s*a*i+a*e*r}var jz=(jz=Tp(1,1))?jz.getContext("2d"):null;const Yz=new fz;function Gz(e){return function(t,n){if(!jz)return!0;e(jz,t),Yz.clear().union(t.bounds).intersect(n).round();const{x1:i,y1:r,x2:s,y2:o}=Yz;for(let e=r;e<=o;++e)for(let t=i;t<=s;++t)if(jz.isPointInPath(t,e))return!0;return!1}}function Hz(e,t){return t.contains(e.x||0,e.y||0)}function Wz(e,t){const n=e.x||0,i=e.y||0,r=e.width||0,s=e.height||0;return t.intersects(Yz.set(n,i,n+r,i+s))}function Xz(e,t){const n=e.x||0,i=e.y||0;return qz(t,n,i,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i)}function qz(e,t,n,i,r){const{x1:s,y1:o,x2:a,y2:l}=e,u=i-t,c=r-n;let d,h,p,f,m=0,g=1;for(f=0;f<4;++f){if(0===f&&(d=-u,h=-(s-t)),1===f&&(d=u,h=a-t),2===f&&(d=-c,h=-(o-n)),3===f&&(d=c,h=l-n),Math.abs(d)<1e-10&&h<0)return!1;if(p=h/d,d<0){if(p>g)return!1;p>m&&(m=p)}else if(d>0){if(p<m)return!1;p<g&&(g=p)}}return!0}function Kz(e,t){e.globalCompositeOperation=t.blend||"source-over"}function Zz(e,t){return null==e?t:e}function Qz(e,t){const n=t.length;for(let i=0;i<n;++i)e.addColorStop(t[i].offset,t[i].color);return e}function Jz(e,t,n){return _U(n)?function(e,t,n){const i=n.width(),r=n.height();let s;if("radial"===t.gradient)s=e.createRadialGradient(n.x1+Zz(t.x1,.5)*i,n.y1+Zz(t.y1,.5)*r,Math.max(i,r)*Zz(t.r1,0),n.x1+Zz(t.x2,.5)*i,n.y1+Zz(t.y2,.5)*r,Math.max(i,r)*Zz(t.r2,.5));else{const o=Zz(t.x1,0),a=Zz(t.y1,0),l=Zz(t.x2,1),u=Zz(t.y2,0);if(o!==l&&a!==u&&i!==r){const n=Tp(Math.ceil(i),Math.ceil(r)),s=n.getContext("2d");return s.scale(i,r),s.fillStyle=Qz(s.createLinearGradient(o,a,l,u),t.stops),s.fillRect(0,0,i,r),e.createPattern(n,"no-repeat")}s=e.createLinearGradient(n.x1+o*i,n.y1+a*r,n.x1+l*i,n.y1+u*r)}return Qz(s,t.stops)}(e,n,t.bounds):n}function eV(e,t,n){return(n*=null==t.fillOpacity?1:t.fillOpacity)>0&&(e.globalAlpha=n,e.fillStyle=Jz(e,t,t.fill),!0)}var tV=[];function nV(e,t,n){var i=null!=(i=t.strokeWidth)?i:1;return!(i<=0)&&((n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=Jz(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||tV),e.lineDashOffset=t.strokeDashOffset||0),!0))}function iV(e,t){return e.zindex-t.zindex||e.index-t.index}function rV(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,s=[];for(n=0,i=r.length;n<i;++n)(t=r[n]).index=n,t.zindex&&s.push(t);return e.zdirty=!1,e.zitems=s.sort(iV)}function sV(e,t){var n,i,r=e.items;if(!r||!r.length)return;const s=rV(e);if(s&&s.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||t(r[n]);r=s}for(n=0,i=r.length;n<i;++n)t(r[n])}function oV(e,t){var n,i,r=e.items;if(!r||!r.length)return null;const s=rV(e);for(s&&s.length&&(r=s),i=r.length;--i>=0;)if(n=t(r[i]))return n;if(r===s)for(i=(r=e.items).length;--i>=0;)if(!r[i].zindex&&(n=t(r[i])))return n;return null}function aV(e){return function(t,n,i){sV(n,n=>{i&&!i.intersects(n.bounds)||uV(e,t,n,n)})}}function lV(e){return function(t,n,i){!n.items.length||i&&!i.intersects(n.bounds)||uV(e,t,n.items[0],n.items)}}function uV(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(Kz(t,n),n.fill&&eV(t,n,r)&&t.fill(),n.stroke&&nV(t,n,r)&&t.stroke()))}function cV(e){return e=e||fe,function(t,n,i,r,s,o){return i*=t.pixelRatio,r*=t.pixelRatio,oV(n,n=>{const a=n.bounds;if((!a||a.contains(s,o))&&a)return e(t,n,i,r,s,o)?n:void 0})}}function dV(e,t){return function(n,i,r,s){var o,a,l=Array.isArray(i)?i[0]:i,u=null==t?l.fill:t,c=l.stroke&&n.isPointInStroke;return c&&(o=l.strokeWidth,a=l.strokeCap,n.lineWidth=null!=o?o:1,n.lineCap=null!=a?a:"butt"),!e(n,i)&&(u&&n.isPointInPath(r,s)||c&&n.isPointInStroke(r,s))}}function hV(e){return cV(dV(e))}function pV(e,t){return"translate("+e+","+t+")"}function fV(e){return"rotate("+e+")"}function mV(e){return pV(e.x||0,e.y||0)}function gV(e,t,n){function i(e,n){var i=n.x||0,r=n.y||0,s=n.angle||0;e.translate(i,r),s&&e.rotate(s*=SU),e.beginPath(),t(e,n),s&&e.rotate(-s),e.translate(-i,-r)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",function(e){return pV(e.x||0,e.y||0)+(e.angle?" "+fV(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(Bz(e,n.angle),n),bz(e,n).translate(n.x||0,n.y||0)},draw:aV(i),pick:hV(i),isect:n||Gz(i)}}var yV=gV("arc",function(e,t){return nz.context(e)(t)});function _V(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=dV(i);return{type:e,tag:"path",nested:!0,attr:function(e,n){var i=n.mark.items;i.length&&e("d",t(null,i))},bound:function(e,n){var i=n.items;return 0===i.length?e:(t(Bz(e),i),bz(e,i[0]))},draw:lV(i),pick:function(e,t,n,i,s,o){var a=t.items,l=t.bounds;return!a||!a.length||l&&!l.contains(s,o)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,a,n,i)?a[0]:null)},isect:Hz,tip:n}}var vV=_V("area",function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?rz:iz).curve(EU(i,n.orient,n.tension)).context(e)(t)},function(e,t){for(var n,i,r="horizontal"===e[0].orient?t[1]:t[0],s="horizontal"===e[0].orient?"y":"x",o=e.length,a=1/0;--o>=0;)!1!==e[o].defined&&(i=Math.abs(e[o][s]-r))<a&&(a=i,n=e[o]);return n});function bV(e,t){e.beginPath(),uz(t)?cz(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function TV(e){const t=Zz(e.strokeWidth,1);return null!=e.strokeOffset?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function xV(e,t){const n=TV(t);e("d",cz(null,t,n,n))}function EV(e,t,n,i){const r=TV(t);e.beginPath(),cz(e,t,(n||0)+r,(i||0)+r)}const wV=dV(EV),IV=dV(EV,!1),AV=dV(EV,!0);var SV={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",mV(t))},bound:function(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let t=0;t<i;++t)e.union(n[t].bounds)}return(t.clip||t.width||t.height)&&!t.noBound&&e.add(0,0).add(t.width||0,t.height||0),bz(e,t),e.translate(t.x||0,t.y||0)},draw:function(e,t,n){sV(t,t=>{const i=t.x||0,r=t.y||0,s=t.strokeForeground,o=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&o&&(EV(e,t,i,r),Kz(e,t),t.fill&&eV(e,t,o)&&e.fill(),t.stroke&&!s&&nV(e,t,o)&&e.stroke()),e.save(),e.translate(i,r),t.clip&&bV(e,t),n&&n.translate(-i,-r),sV(t,t=>{this.draw(e,t,n)}),n&&n.translate(i,r),e.restore(),s&&t.stroke&&o&&(EV(e,t,i,r),Kz(e,t),nV(e,t,o)&&e.stroke())})},pick:function(e,t,n,i,r,s){if(t.bounds&&!t.bounds.contains(r,s)||!t.items)return null;const o=n*e.pixelRatio,a=i*e.pixelRatio;return oV(t,l=>{let u,c,d;const h=l.bounds;if(h&&!h.contains(r,s))return;c=l.x||0,d=l.y||0;const p=c+(l.width||0),f=d+(l.height||0),m=l.clip;if(m&&(r<c||r>p||s<d||s>f))return;if(e.save(),e.translate(c,d),c=r-c,d=s-d,m&&uz(l)&&!AV(e,l,o,a))return e.restore(),null;const g=l.strokeForeground,y=!1!==t.interactive;return y&&g&&l.stroke&&IV(e,l,o,a)?(e.restore(),l):(u=oV(l,e=>function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,c,d)?this.pick(e,n,i,c,d):null),!u&&y&&(l.fill||!g&&l.stroke)&&wV(e,l,o,a)&&(u=l),e.restore(),u||null)})},isect:Wz,content:function(e,t,n){e("clip-path",t.clip?pz(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),xV(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?xV(e,t):e("d","")}},CV={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function OV(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(t=>{e.image=t,e.image.url=e.url})),n}function MV(e,t){return null!=e.width?e.width:t&&t.width?!1!==e.aspect&&e.height?e.height*t.width/t.height:t.width:0}function RV(e,t){return null!=e.height?e.height:t&&t.height?!1!==e.aspect&&e.width?e.width*t.height/t.width:t.height:0}function kV(e,t){return"center"===e?t/2:"right"===e?t:0}function NV(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var DV={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=OV(t,n),r=MV(t,i),s=RV(t,i),o=(t.x||0)-kV(t.align,r),a=(t.y||0)-NV(t.baseline,s);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",CV["xmlns:xlink"],"xlink:href"),e("transform",pV(o,a)),e("width",r),e("height",s),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=MV(t,n),r=RV(t,n),s=(t.x||0)-kV(t.align,i),o=(t.y||0)-NV(t.baseline,r);return e.set(s,o,s+i,o+r)},draw:function(e,t,n){sV(t,t=>{if(n&&!n.intersects(t.bounds))return;const i=OV(t,this);let r=MV(t,i),s=RV(t,i);if(0===r||0===s)return;let o,a,l,u,c=(t.x||0)-kV(t.align,r),d=(t.y||0)-NV(t.baseline,s);!1!==t.aspect&&(a=i.width/i.height,l=t.width/t.height,a==a&&l==l&&a!==l&&(l<a?(u=r/a,d+=(s-u)/2,s=u):(u=s*a,c+=(r-u)/2,r=u))),(i.complete||i.toDataURL)&&(Kz(e,t),e.globalAlpha=null!=(o=t.opacity)?o:1,e.imageSmoothingEnabled=!1!==t.smooth,e.drawImage(i,c,d,r,s))})},pick:cV(),isect:fe,get:OV,xOffset:kV,yOffset:NV},FV=_V("line",function(e,t){const n=t[0],i=n.interpolate||"linear";return sz.curve(EU(i,n.orient,n.tension)).context(e)(t)},function(e,t){for(var n,i,r=Math.pow(e[0].strokeWidth||1,2),s=e.length;--s>=0;)if(!1!==e[s].defined&&(n=e[s].x-t[0])*n+(i=e[s].y-t[1])*i<r)return e[s];return null});function LV(e,t){var n=t.path;if(null==n)return!0;var i=t.x||0,r=t.y||0,s=t.scaleX||1,o=t.scaleY||1,a=(t.angle||0)*SU,l=t.pathCache;l&&l.path===n||((t.pathCache=l=AU(n)).path=n),a&&e.rotate&&e.translate?(e.translate(i,r),e.rotate(a),PU(e,l,0,0,s,o),e.rotate(-a),e.translate(-i,-r)):PU(e,l,i,r,s,o)}var PV={type:"path",tag:"path",nested:!1,attr:function(e,t){var n=t.scaleX||1,i=t.scaleY||1;1===n&&1===i||e("vector-effect","non-scaling-stroke"),e("transform",function(e){return pV(e.x||0,e.y||0)+(e.angle?" "+fV(e.angle):"")+(e.scaleX||e.scaleY?" "+function(e,t){return"scale("+e+","+t+")"}(e.scaleX||1,e.scaleY||1):"")}(t)),e("d",t.path)},bound:function(e,t){return LV(Bz(e,t.angle),t)?e.set(0,0,0,0):bz(e,t,!0)},draw:aV(LV),pick:hV(LV),isect:Gz(LV)};function BV(e,t){e.beginPath(),cz(e,t)}var $V={type:"rect",tag:"path",nested:!1,attr:function(e,t){e("d",cz(null,t))},bound:function(e,t){var n,i;return bz(e.set(n=t.x||0,i=t.y||0,n+t.width||0,i+t.height||0),t)},draw:aV(BV),pick:hV(BV),isect:Wz};function UV(e,t,n){var i,r,s,o;return!(!t.stroke||!nV(e,t,n))&&(i=t.x||0,r=t.y||0,s=null!=t.x2?t.x2:i,o=null!=t.y2?t.y2:r,e.beginPath(),e.moveTo(i,r),e.lineTo(s,o),!0)}var zV={type:"rule",tag:"line",nested:!1,attr:function(e,t){e("transform",mV(t)),e("x2",null!=t.x2?t.x2-(t.x||0):0),e("y2",null!=t.y2?t.y2-(t.y||0):0)},bound:function(e,t){var n,i;return bz(e.set(n=t.x||0,i=t.y||0,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i),t)},draw:function(e,t,n){sV(t,t=>{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&UV(e,t,i)&&(Kz(e,t),e.stroke())}})},pick:cV(function(e,t,n,i){return!!e.isPointInStroke&&(UV(e,t,1)&&e.isPointInStroke(n,i))}),isect:Xz},VV=gV("shape",function(e,t){return(t.mark.shape||t.shape).context(e)(t)}),jV=gV("symbol",function(e,t){return az.context(e)(t)},Hz);const YV=wt();var GV={height:ZV,measureWidth:qV,estimateWidth:WV,width:WV,canvas:HV};function HV(e){GV.width=e&&jz?qV:WV}function WV(e,t){return XV(tj(e,t),ZV(e))}function XV(e,t){return~~(.8*e.length*t)}function qV(e,t){return ZV(e)<=0||!(t=tj(e,t))?0:KV(t,ij(e))}function KV(e,t){const n=`(${t}) ${e}`;let i=YV.get(n);return void 0===i&&(jz.font=t,i=jz.measureText(e).width,YV.set(n,i)),i}function ZV(e){return null!=e.fontSize?+e.fontSize||0:11}function QV(e){return null!=e.lineHeight?e.lineHeight:ZV(e)+2}function JV(e){return t=e.lineBreak&&e.text&&!Ee(e.text)?e.text.split(e.lineBreak):e.text,Ee(t)?t.length>1?t:t[0]:t;var t}function ej(e){const t=JV(e);return(Ee(t)?t.length-1:0)*QV(e)}function tj(e,t){const n=null==t?"":(t+"").trim();return e.limit>0&&n.length?function(e,t){var n=+e.limit,i=function(e){if(GV.width===qV){const t=ij(e);return e=>KV(e,t)}{const t=ZV(e);return e=>XV(e,t)}}(e);if(i(t)<n)return t;var r,s=e.ellipsis||"…",o="rtl"===e.dir,a=0,l=t.length;if(n-=i(s),o){for(;a<l;)r=a+l>>>1,i(t.slice(r))>n?a=r+1:l=r;return s+t.slice(a)}for(;a<l;)r=1+(a+l>>>1),i(t.slice(0,r))<n?a=r:l=r-1;return t.slice(0,a)+s}(e,n):n}function nj(e,t){var n=e.font;return(t&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function ij(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+ZV(e)+"px "+nj(e,t)}function rj(e){var t=e.baseline,n=ZV(e);return Math.round("top"===t?.79*n:"middle"===t?.3*n:"bottom"===t?-.21*n:"line-top"===t?.29*n+.5*QV(e):"line-bottom"===t?.29*n-.5*QV(e):0)}HV(!0);const sj={left:"start",center:"middle",right:"end"},oj=new fz;function aj(e){var t,n=e.x||0,i=e.y||0,r=e.radius||0;return r&&(t=(e.theta||0)-CU,n+=r*Math.cos(t),i+=r*Math.sin(t)),oj.x1=n,oj.y1=i,oj}function lj(e,t,n){var i,r=GV.height(t),s=t.align,o=aj(t),a=o.x1,l=o.y1,u=t.dx||0,c=(t.dy||0)+rj(t)-Math.round(.8*r),d=JV(t);if(Ee(d)?(r+=QV(t)*(d.length-1),i=d.reduce((e,n)=>Math.max(e,GV.width(t,n)),0)):i=GV.width(t,d),"center"===s?u-=i/2:"right"===s&&(u-=i),e.set(u+=a,c+=l,u+i,c+r),t.angle&&!n)e.rotate(t.angle*SU,a,l);else if(2===n)return e.rotatedPoints(t.angle*SU,a,l);return e}var uj={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+rj(t),s=aj(t),o=s.x1,a=s.y1,l=t.angle||0;e("text-anchor",sj[t.align]||"start"),l?(n=pV(o,a)+" "+fV(l),(i||r)&&(n+=" "+pV(i,r))):n=pV(o+i,a+r),e("transform",n)},bound:lj,draw:function(e,t,n){sV(t,t=>{var i,r,s,o,a,l,u,c=null==t.opacity?1:t.opacity;if(!(n&&!n.intersects(t.bounds)||0===c||t.fontSize<=0||null==t.text||0===t.text.length)){if(e.font=ij(t),e.textAlign=t.align||"left",r=(i=aj(t)).x1,s=i.y1,t.angle&&(e.save(),e.translate(r,s),e.rotate(t.angle*SU),r=s=0),r+=t.dx||0,s+=(t.dy||0)+rj(t),l=JV(t),Kz(e,t),Ee(l))for(a=QV(t),o=0;o<l.length;++o)u=tj(t,l[o]),t.fill&&eV(e,t,c)&&e.fillText(u,r,s),t.stroke&&nV(e,t,c)&&e.strokeText(u,r,s),s+=a;else u=tj(t,l),t.fill&&eV(e,t,c)&&e.fillText(u,r,s),t.stroke&&nV(e,t,c)&&e.strokeText(u,r,s);t.angle&&e.restore()}})},pick:cV(function(e,t,n,i,r,s){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var o=aj(t),a=o.x1,l=o.y1,u=lj(oj,t,1),c=-t.angle*SU,d=Math.cos(c),h=Math.sin(c),p=d*r-h*s+(a-d*a+h*l),f=h*r+d*s+(l-h*a-d*l);return u.contains(p,f)}),isect:function(e,t){const n=lj(oj,e,2);return qz(t,n[0],n[1],n[2],n[3])||qz(t,n[0],n[1],n[4],n[5])||qz(t,n[4],n[5],n[6],n[7])||qz(t,n[2],n[3],n[6],n[7])}},cj=_V("trail",function(e,t){return lz.context(e)(t)},function(e,t){for(var n,i,r=e.length;--r>=0;)if(!1!==e[r].defined&&(n=e[r].x-t[0])*n+(i=e[r].y-t[1])*i<(n=e[r].size||1)*n)return e[r];return null}),dj={arc:yV,area:vV,group:SV,image:DV,line:FV,path:PV,rect:$V,rule:zV,shape:VV,symbol:jV,text:uj,trail:cj};function hj(e,t,n){var i=dj[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new fz),e,n)}var pj={mark:null};function fj(e,t,n){var i,r,s,o,a=dj[e.marktype],l=a.bound,u=e.items,c=u&&u.length;if(a.nested)return c?s=u[0]:(pj.mark=e,s=pj),o=hj(s,l,n),t=t&&t.union(o)||o;if(t=t||e.bounds&&e.bounds.clear()||new fz,c)for(i=0,r=u.length;i<r;++i)t.union(hj(u[i],l,n));return e.bounds=t}const mj=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function gj(e,t){return JSON.stringify(e,mj,t)}function yj(e){return _j("string"==typeof e?JSON.parse(e):e)}function _j(e){var t,n,i,r=e.marktype,s=e.items;if(s)for(n=0,i=s.length;n<i;++n)t=r?"mark":"group",s[n][t]=e,s[n].zindex&&(s[n][t].zdirty=!0),"group"===(r||t)&&_j(s[n]);return r&&fj(e),e}function vj(e){arguments.length?this.root=yj(e):(this.root=bj({marktype:"group",name:"root",role:"frame"}),this.root.items=[new gz(this.root)])}function bj(e,t){const n={bounds:new fz,clip:!!e.clip,group:t,interactive:!1!==e.interactive,items:[],marktype:e.marktype,name:e.name||void 0,role:e.role||void 0,zindex:e.zindex||0};return null!=e.aria&&(n.aria=e.aria),e.description&&(n.description=e.description),n}function Tj(e,t,n){return!e&&"undefined"!=typeof document&&document.createElement&&(e=document),e?n?e.createElementNS(n,t):e.createElement(t):null}function xj(e,t){t=t.toLowerCase();for(var n=e.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===t)return n[i]}function Ej(e,t,n,i){var r,s=e.childNodes[t];return s&&s.tagName.toLowerCase()===n.toLowerCase()||(r=s||null,s=Tj(e.ownerDocument,n,i),e.insertBefore(s,r)),s}function wj(e,t){for(var n=e.childNodes,i=n.length;i>t;)e.removeChild(n[--i]);return e}function Ij(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Aj(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function Sj(e,t){this._active=null,this._handlers={},this._loader=e||mU(),this._tooltip=t||Cj}function Cj(e,t,n,i){e.element().setAttribute("title",i||"")}function Oj(e){this._el=null,this._bgcolor=null,this._loader=new yz(e)}vj.prototype={toJSON(e){return gj(this.root,e||0)},mark(e,t,n){const i=bj(e,t=t||this.root.items[0]);return t.items[n]=i,i.zindex&&(i.group.zdirty=!0),i}},Sj.prototype={initialize(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()},scene(e){return arguments.length?(this._scene=e,this):this._scene},on(){},off(){},_handlerIndex(e,t,n){for(let i=e?e.length:0;--i>=0;)if(e[i].type===t&&(!n||e[i].handler===n))return i;return-1},handlers(e){const t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(const e in t)n.push(...t[e]);return n},eventName(e){const t=e.indexOf(".");return t<0?e:e.slice(0,t)},handleHref(e,t,n){this._loader.sanitize(n,{context:"href"}).then(t=>{const n=new MouseEvent(e.type,e),i=Tj(null,"a");for(const e in t)i.setAttribute(e,t[e]);i.dispatchEvent(n)}).catch(()=>{})},handleTooltip(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,i){var r,s,o=e&&e.mark;if(o&&(r=dj[o.marktype]).tip){for((s=Aj(t,n))[0]-=i[0],s[1]-=i[1];e=e.mark.group;)s[0]-=e.x||0,s[1]-=e.y||0;e=r.tip(o.items,s)}return e}(t,e,this.canvas(),this._origin);const i=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,i)}},getItemBoundingClientRect(e){const t=this.canvas();if(!t)return;const n=t.getBoundingClientRect(),i=this._origin,r=e.bounds,s=r.width(),o=r.height();let a=r.x1+i[0]+n.left,l=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)a+=e.x||0,l+=e.y||0;return{x:a,y:l,width:s,height:o,left:a,top:l,right:a+s,bottom:l+o}}},Oj.prototype={initialize(e,t,n,i,r){return this._el=e,this.resize(t,n,i,r)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},background(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)},resize(e,t,n,i){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=i||1,this},dirty(){},render(e){const t=this;return t._call=function(){t._render(e)},t._call(),t._call=null,t},_render(){},renderAsync(e){const t=this.render(e);return this._ready?this._ready.then(()=>t):Promise.resolve(t)},_load(e,t){var n=this,i=n._loader[e](t);if(!n._ready){const e=n._call;n._ready=n._loader.ready().then(t=>{t&&e(),n._ready=null})}return i},sanitizeURL(e){return this._load("sanitizeURL",e)},loadImage(e){return this._load("loadImage",e)}};const Mj="dragenter",Rj="dragleave",kj="dragover",Nj="mousedown",Dj="mousemove",Fj="mouseout",Lj="mouseover",Pj="click",Bj="mousewheel",$j="touchstart",Uj="touchmove",zj="touchend",Vj=["keydown","keypress","keyup",Mj,Rj,kj,Nj,"mouseup",Dj,Fj,Lj,Pj,"dblclick","wheel",Bj,$j,Uj,zj],jj=Dj,Yj=Fj,Gj=Pj;function Hj(e,t){Sj.call(this,e,t),this._down=null,this._touch=null,this._first=!0,this._events={}}function Wj(e,t){(e=>e===$j||e===Uj||e===zj?[$j,Uj,zj]:[e])(t).forEach(t=>function(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}(e,t))}function Xj(e,t,n){return function(i){const r=this._active,s=this.pickEvent(i);s===r||(r&&r.exit||this.fire(n,i),this._active=s,this.fire(t,i)),this.fire(e,i)}}function qj(e){return function(t){this.fire(e,t),this._active=null}}pt(Hj,Sj,{initialize(e,t,n){return this._canvas=e&&xj(e,"canvas"),[Pj,Nj,Dj,Fj,Rj].forEach(e=>Wj(this,e)),Sj.prototype.initialize.call(this,e,t,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:Vj,DOMMouseScroll(e){this.fire(Bj,e)},mousemove:Xj(Dj,Lj,Fj),dragover:Xj(kj,Mj,Rj),mouseout:qj(Fj),dragleave:qj(Rj),mousedown(e){this._down=this._active,this.fire(Nj,e)},click(e){this._down===this._active&&(this.fire(Pj,e),this._down=null)},touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire($j,e,!0)},touchmove(e){this.fire(Uj,e,!0)},touchend(e){this.fire(zj,e,!0),this._touch=null},fire(e,t,n){const i=n?this._touch:this._active,r=this._handlers[e];if(t.vegaType=e,e===Gj&&i&&i.href?this.handleHref(t,i,i.href):e!==jj&&e!==Yj||this.handleTooltip(t,i,e!==Yj),r)for(let e=0,n=r.length;e<n;++e)r[e].handler.call(this._obj,t,i)},on(e,t){const n=this.eventName(e),i=this._handlers;return this._handlerIndex(i[n],e,t)<0&&(Wj(this,e),(i[n]||(i[n]=[])).push({type:e,handler:t})),this},off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&i.splice(r,1),this},pickEvent(e){const t=Aj(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])},pick(e,t,n,i,r){const s=this.context();return dj[e.marktype].pick.call(this,s,e,t,n,i,r)}});var Kj="undefined"!=typeof window&&window.devicePixelRatio||1;function Zj(e){Oj.call(this,e),this._options={},this._redraw=!1,this._dirty=new fz,this._tempb=new fz}const Qj=Oj.prototype;function Jj(e,t){Sj.call(this,e,t);const n=this;n._hrefHandler=eY(n,(e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)}),n._tooltipHandler=eY(n,(e,t)=>{n.handleTooltip(e,t,e.type!==Yj)})}pt(Zj,Oj,{initialize(e,t,n,i,r,s){return this._options=s||{},this._canvas=this._options.externalContext?null:Tp(1,1,this._options.type),e&&this._canvas&&(wj(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Qj.initialize.call(this,e,t,n,i,r)},resize(e,t,n,i){if(Qj.resize.call(this,e,t,n,i),this._canvas)!function(e,t,n,i,r,s){const o="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,a=e.getContext("2d"),l=o?Kj:r;e.width=t*l,e.height=n*l;for(const e in s)a[e]=s[e];o&&1!==l&&(e.style.width=t+"px",e.style.height=n+"px"),a.pixelRatio=l,a.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||ae("CanvasRenderer is missing a valid canvas or context"),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},canvas(){return this._canvas},context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},dirty(e){const t=this._tempb.clear().union(e.bounds);let n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)},_render(e){const t=this.context(),n=this._origin,i=this._width,r=this._height,s=this._dirty,o=((e,t,n)=>(new fz).set(0,0,t,n).translate(-e[0],-e[1]))(n,i,r);t.save();const a=this._redraw||s.empty()?(this._redraw=!1,o.expand(1)):function(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(t,o.intersect(s),n);return this.clear(-n[0],-n[1],i,r),this.draw(t,e,a),t.restore(),s.clear(),this},draw(e,t,n){const i=dj[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),Ke(n)?(e.beginPath(),n(e),e.clip()):bV(e,t.group)}(e,t),i.draw.call(this,e,t,n),t.clip&&e.restore()},clear(e,t,n,i){const r=this._options,s=this.context();"pdf"===r.type||r.externalContext||s.clearRect(e,t,n,i),null!=this._bgcolor&&(s.fillStyle=this._bgcolor,s.fillRect(e,t,n,i))}});const eY=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)};pt(Jj,Sj,{initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(Gj,this._hrefHandler),i.removeEventListener(jj,this._tooltipHandler),i.removeEventListener(Yj,this._tooltipHandler)),this._svg=i=e&&xj(e,"svg"),i&&(i.addEventListener(Gj,this._hrefHandler),i.addEventListener(jj,this._tooltipHandler),i.addEventListener(Yj,this._tooltipHandler)),Sj.prototype.initialize.call(this,e,t,n)},canvas(){return this._svg},on(e,t){const n=this.eventName(e),i=this._handlers;if(this._handlerIndex(i[n],e,t)<0){const r={type:e,handler:t,listener:eY(this,t)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this}});const tY="aria-hidden",nY="aria-label",iY="role",rY="aria-roledescription",sY="graphics-object",oY="graphics-symbol",aY=(e,t,n)=>({[iY]:e,[rY]:t,[nY]:n||void 0}),lY=Dt(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),uY={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?fY(e):null,r=e.context,s=r.scales[t.scale].value,o=r.dataflow.locale(),a=s.type,l="left"===n||"right"===n?"Y":"X";return`${l}-axis`+(i?` titled '${i}'`:"")+` for a ${BM(a)?"discrete":a} scale`+` with ${_R(o,s,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?fY(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,s=Object.keys(r),o=e.context,a=o.scales[r[s[0]]].value,l=o.dataflow.locale();return function(e){return e.length?e[0].toUpperCase()+e.slice(1):e}(i)+(n?` titled '${n}'`:"")+` for ${function(e){return e=e.map(e=>e+("fill"===e||"stroke"===e?" color":"")),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+Oe(e)}(s)}`+` with ${_R(l,a,e)}`}},"title-text":{desc:"title",caption:e=>`Title text '${pY(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${pY(e)}'`}},cY={ariaRole:iY,ariaRoleDescription:rY,description:nY};function dY(e,t){const n=!1===t.aria;if(e(tY,n||void 0),n||null==t.description)for(const t in cY)e(cY[t],void 0);else{const n=t.mark.marktype;e(nY,t.description),e(iY,t.ariaRole||("group"===n?sY:oY)),e(rY,t.ariaRoleDescription||`${n} mark`)}}function hY(e){return!1===e.aria?{[tY]:!0}:lY[e.role]?null:uY[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return aY(t.role||oY,t.desc,n.description||i(n))}catch(e){return null}}(e,uY[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some(e=>null!=e.description&&!1!==e.aria);return aY(n?sY:oY,`${t} mark container`,e.description)}(e)}function pY(e){return Xe(e.text).join(" ")}function fY(e){try{return Xe(Oe(e.items).items[0].text).join(" ")}catch(e){return null}}const mY=e=>(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),gY=e=>mY(e).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;");function yY(){let e="",t="",n="";const i=[],r=()=>t=n="",s=(e,n)=>(null!=n&&(t+=` ${e}="${gY(n)}"`),o),o={open(a,...l){(s=>{t&&(e+=`${t}>${n}`,r()),i.push(s)})(a),t="<"+a;for(const e of l)for(const t in e)s(t,e[t]);return o},close(){const s=i.pop();return e+=t?t+(n?`>${n}</${s}>`:"/>"):`</${s}>`,r(),o},attr:s,text:e=>(n+=mY(e),o),toString:()=>e};return o}const _Y=e=>vY(yY(),e)+"";function vY(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let t=0;t<i;++t)e.attr(n[t].name,n[t].value)}if(t.hasChildNodes()){const n=t.childNodes,i=n.length;for(let t=0;t<i;t++){const i=n[t];3===i.nodeType?e.text(i.nodeValue):vY(e,i)}}return e.close()}const bY={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity",blend:"mix-blend-mode"},TY={fill:"none","stroke-miterlimit":10},xY="http://www.w3.org/2000/xmlns/",EY=CV.xmlns;function wY(e){Oj.call(this,e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}const IY=Oj.prototype;function AY(e,t){for(;e&&e.dirty!==t;e=e.mark.group){if(e.dirty=t,!e.mark||e.mark.dirty===t)return;e.mark.dirty=t}}function SY(e,t,n){let i,r,s;if("radial"===t.gradient){let i=Ej(e,n++,"pattern",EY);FY(i,{id:yU+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),i=Ej(i,0,"rect",EY),FY(i,{width:1,height:1,fill:`url(${PY()}#${t.id})`}),FY(e=Ej(e,n++,"radialGradient",EY),{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else FY(e=Ej(e,n++,"linearGradient",EY),{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(i=0,r=t.stops.length;i<r;++i)s=Ej(e,i,"stop",EY),s.setAttribute("offset",t.stops[i].offset),s.setAttribute("stop-color",t.stops[i].color);return wj(e,i),n}function CY(e,t,n){let i;return(e=Ej(e,n,"clipPath",EY)).setAttribute("id",t.id),t.path?(i=Ej(e,0,"path",EY),i.setAttribute("d",t.path)):(i=Ej(e,0,"rect",EY),FY(i,{x:0,y:0,width:t.width,height:t.height})),wj(e,1),n+1}function OY(e,t,n,i,r){let s,o=e._svg;if(!o&&(s=t.ownerDocument,o=Tj(s,i,EY),e._svg=o,e.mark&&(o.__data__=e,o.__values__={fill:"default"},"g"===i))){const t=Tj(s,"path",EY);o.appendChild(t),t.__data__=e;const n=Tj(s,"g",EY);o.appendChild(n),n.__data__=e;const i=Tj(s,"path",EY);o.appendChild(i),i.__data__=e,i.__values__={fill:"default"}}return(o.ownerSVGElement!==r||function(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}(o,n))&&t.insertBefore(o,n?n.nextSibling:t.firstChild),o}pt(wY,Oj,{initialize(e,t,n,i,r){return this._defs={},this._clearDefs(),e&&(this._svg=Ej(e,0,"svg",EY),this._svg.setAttributeNS(xY,"xmlns",EY),this._svg.setAttributeNS(xY,"xmlns:xlink",CV["xmlns:xlink"]),this._svg.setAttribute("version",CV.version),this._svg.setAttribute("class","marks"),wj(e,1),this._root=Ej(this._svg,0,"g",EY),FY(this._root,TY),wj(this._svg,1)),this.background(this._bgcolor),IY.initialize.call(this,e,t,n,i,r)},background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),IY.background.apply(this,arguments)},resize(e,t,n,i){return IY.resize.call(this,e,t,n,i),this._svg&&(FY(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this},canvas(){return this._svg},svg(){const e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute("style"),n=Ej(e,0,"rect",EY),FY(n,{width:this._width,height:this._height,fill:t}));const i=_Y(e);return t&&(e.removeChild(n),this._svg.style.setProperty("background-color",t)),i},_render(e){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e),wj(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},isDirty(e){return this._dirtyAll||!e._svg||e.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;const e=this._dirty;if(!e.length||!this._dirtyID)return!0;const t=++this._dirtyID;let n,i,r,s,o,a,l;for(o=0,a=e.length;o<a;++o)n=e[o],i=n.mark,i.marktype!==r&&(r=i.marktype,s=dj[r]),i.zdirty&&i.dirty!==t&&(this._dirtyAll=!1,AY(n,t),i.items.forEach(e=>{e.dirty=t})),i.zdirty||(n.exit?(s.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(s,l._svg,l)):n._svg&&(l=n._svg.parentNode,l&&l.removeChild(n._svg)),n._svg=null):(n=s.nested?i.items[0]:n,n._update!==t&&(n._svg&&n._svg.ownerSVGElement?this._update(s,n._svg,n):(this._dirtyAll=!1,AY(n,t)),n._update=t)));return!this._dirtyAll},mark(e,t,n){if(!this.isDirty(t))return t._svg;const i=this._svg,r=dj[t.marktype],s=!1===t.interactive?"none":null,o="g"===r.tag;let a=null,l=0;const u=OY(t,e,n,"g",i);u.setAttribute("class",Ij(t));const c=hY(t);for(const e in c)LY(u,e,c[e]);o||LY(u,"pointer-events",s),LY(u,"clip-path",t.clip?pz(this,t,t.group):null);const d=e=>{const t=this.isDirty(e),n=OY(e,u,a,r.tag,i);t&&(this._update(r,n,e),o&&function(e,t,n){t=t.lastChild.previousSibling;let i,r=0;sV(n,n=>{i=e.mark(t,n,i),++r}),wj(t,1+r)}(this,n,e)),a=n,++l};return r.nested?t.items.length&&d(t.items[0]):sV(t,d),wj(u,l),u},_update(e,t,n){MY=t,RY=t.__values__,dY(NY,n),e.attr(NY,n,this);const i=kY[e.type];i&&i.call(this,e,t,n),MY&&this.style(MY,n)},style(e,t){if(null!=t)for(const n in bY){let i="font"===n?nj(t):t[n];if(i===RY[n])continue;const r=bY[n];null==i?e.removeAttribute(r):(_U(i)&&(i=vU(i,this._defs.gradient,PY())),e.setAttribute(r,i+"")),RY[n]=i}},defs(){const e=this._svg,t=this._defs;let n=t.el,i=0;for(const r in t.gradient)n||(t.el=n=Ej(e,1,"defs",EY)),i=SY(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=Ej(e,1,"defs",EY)),i=CY(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):wj(n,i))},_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}});let MY=null,RY=null;const kY={group(e,t,n){const i=MY=t.childNodes[2];RY=i.__values__,e.foreground(NY,n,this),RY=t.__values__,MY=t.childNodes[1],e.content(NY,n,this);const r=MY=t.childNodes[0];e.background(NY,n,this);const s=!1===n.mark.interactive?"none":null;if(s!==RY.events&&(LY(i,"pointer-events",s),LY(r,"pointer-events",s),RY.events=s),n.strokeForeground&&n.stroke){const e=n.fill;LY(i,"display",null),this.style(r,n),LY(r,"stroke",null),e&&(n.fill=null),RY=i.__values__,this.style(i,n),e&&(n.fill=e),MY=null}else LY(i,"display","none")},image(e,t,n){!1===n.smooth?(DY(t,"image-rendering","optimizeSpeed"),DY(t,"image-rendering","pixelated")):DY(t,"image-rendering",null)},text(e,t,n){const i=JV(n);let r,s,o,a;Ee(i)?(s=i.map(e=>tj(n,e)),r=s.join("\n"),r!==RY.text&&(wj(t,0),o=t.ownerDocument,a=QV(n),s.forEach((e,i)=>{const r=Tj(o,"tspan",EY);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",a)),t.appendChild(r)}),RY.text=r)):(s=tj(n,i),s!==RY.text&&(t.textContent=s,RY.text=s)),LY(t,"font-family",nj(n)),LY(t,"font-size",ZV(n)+"px"),LY(t,"font-style",n.fontStyle),LY(t,"font-variant",n.fontVariant),LY(t,"font-weight",n.fontWeight)}};function NY(e,t,n){t!==RY[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(MY,e,t,n):LY(MY,e,t),RY[e]=t)}function DY(e,t,n){n!==RY[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),RY[t]=n)}function FY(e,t){for(const n in t)LY(e,n,t[n])}function LY(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function PY(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function BY(e){Oj.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}pt(BY,Oj,{svg(){return this._text},_render(e){const t=yY();t.open("svg",st({},CV,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&t.open("rect",{width:this._width,height:this._height,fill:n}).close(),t.open("g",TY,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this},mark(e,t){const n=dj[t.marktype],i=n.tag,r=[dY,n.attr];e.open("g",{class:Ij(t),"clip-path":t.clip?pz(this,t,t.group):null},hY(t),{"pointer-events":"g"!==i&&!1===t.interactive?"none":null});const s=s=>{const o=this.href(s);if(o&&e.open("a",o),e.open(i,this.attr(t,s,r,"g"!==i?i:null)),"text"===i){const t=JV(s);if(Ee(t)){const n={x:0,dy:QV(s)};for(let i=0;i<t.length;++i)e.open("tspan",i?n:null).text(tj(s,t[i])).close()}else e.text(tj(s,t))}else if("g"===i){const i=s.strokeForeground,r=s.fill,o=s.stroke;i&&o&&(s.stroke=null),e.open("path",this.attr(t,s,n.background,"bgrect")).close(),e.open("g",this.attr(t,s,n.content)),sV(s,t=>this.mark(e,t)),e.close(),i&&o?(r&&(s.fill=null),s.stroke=o,e.open("path",this.attr(t,s,n.foreground,"bgrect")).close(),r&&(s.fill=r)):e.open("path",this.attr(t,s,n.foreground,"bgfore")).close()}e.close(),o&&e.close()};return n.nested?t.items&&t.items.length&&s(t.items[0]):sV(t,s),e.close()},href(e){const t=e.href;let n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then(e=>{e["xlink:href"]=e.href,e.href=null,(this._hrefs||(this._hrefs={}))[t]=e})}return null},attr(e,t,n,i){const r={},s=(e,t,n,i)=>{r[i||e]=t};return Array.isArray(n)?n.forEach(e=>e(s,t,this)):n(s,t,this),i&&function(e,t,n,i,r){if(null==t)return e;"bgrect"===i&&!1===n.interactive&&(e["pointer-events"]="none");if("bgfore"===i&&(!1===n.interactive&&(e["pointer-events"]="none"),e.display="none",null!==t.fill))return e;"image"===i&&!1===t.smooth&&(e.style="image-rendering: optimizeSpeed; image-rendering: pixelated;");"text"===i&&(e["font-family"]=nj(t),e["font-size"]=ZV(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const n in bY){let i=t[n];const s=bY[n];("transparent"!==i||"fill"!==s&&"stroke"!==s)&&null!=i&&(_U(i)&&(i=vU(i,r.gradient,"")),e[s]=i)}}(r,t,e,i,this._defs),r},defs(e){const t=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(t).length+Object.keys(n).length){e.open("defs");for(const n in t){const i=t[n],r=i.stops;"radial"===i.gradient?(e.open("pattern",{id:yU+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),e.close(),e.open("radialGradient",{id:n,fx:i.x1,fy:i.y1,fr:i.r1,cx:i.x2,cy:i.y2,r:i.r2})):e.open("linearGradient",{id:n,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2});for(let t=0;t<r.length;++t)e.open("stop",{offset:r[t].offset,"stop-color":r[t].color}).close();e.close()}for(const t in n){const i=n[t];e.open("clipPath",{id:t}),i.path?e.open("path",{d:i.path}).close():e.open("rect",{x:0,y:0,width:i.width,height:i.height}).close(),e.close()}e.close()}}});const $Y="canvas",UY="none",zY={Canvas:$Y,PNG:"png",SVG:"svg",None:UY},VY={};function jY(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(VY[e]=t,this):VY[e]}function YY(e,t,n){const i=[],r=(new fz).union(t),s=e.marktype;return s?GY(e,r,n,i):"group"===s?HY(e,r,n,i):ae("Intersect scene must be mark node or group item.")}function GY(e,t,n,i){if(function(e,t,n){return e.bounds&&t.intersects(e.bounds)&&("group"===e.marktype||!1!==e.interactive&&(!n||n(e)))}(e,t,n)){const r=e.items,s=e.marktype,o=r.length;let a=0;if("group"===s)for(;a<o;++a)HY(r[a],t,n,i);else for(const e=dj[s].isect;a<o;++a){const n=r[a];WY(n,t,e)&&i.push(n)}}return i}function HY(e,t,n,i){n&&n(e.mark)&&WY(e,t,dj.group.isect)&&i.push(e);const r=e.items,s=r&&r.length;if(s){const o=e.x||0,a=e.y||0;t.translate(-o,-a);for(let e=0;e<s;++e)GY(r[e],t,n,i);t.translate(o,a)}return i}function WY(e,t,n){const i=e.bounds;return t.encloses(i)||t.intersects(i)&&n(e,t)}VY[$Y]=VY.png={renderer:Zj,headless:Zj,handler:Hj},VY.svg={renderer:wY,headless:BY,handler:Jj},VY[UY]={};const XY=new fz;function qY(e){const t=e.clip;if(Ke(t))t(Bz(XY.clear()));else{if(!t)return;XY.set(0,0,e.group.width,e.group.height)}e.bounds.intersect(XY)}const KY=1e-9;function ZY(e,t,n){return e===t||("path"===n?QY(e,t):e instanceof Date&&t instanceof Date?+e===+t:_t(e)&&_t(t)?Math.abs(e-t)<=KY:e&&t&&(we(e)||we(t))?function(e,t){var n,i,r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(r.sort(),s.sort(),i=r.length-1;i>=0;i--)if(r[i]!=s[i])return!1;for(i=r.length-1;i>=0;i--)if(!ZY(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function QY(e,t){return ZY(AU(e),AU(t))}function JY(){hz(),gU=0}function eG(e,t,n,i){const r=e.width,s=e.height,o=n||i,a=Tp(r,s).getContext("2d");t.forEach(e=>tG(a,e,o));const l=new Uint32Array(a.getImageData(0,0,r,s).data.buffer),u=e.bitmap(),c=o&&e.bitmap();let d,h,p,f,m;for(h=0;h<s;++h)for(d=0;d<r;++d)m=4278190080&l[h*r+d],m&&(p=e(d),f=e(h),i||u.set(p,f),o&&268435456^m&&c.set(p,f));return[u,c]}function tG(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach(t=>{t.items.forEach(t=>tG(e,t.items,n))}):dj[i].draw(e,{items:n?t.map(nG):t})}function nG(e){const t=yo(e,{});return t.stroke&&(t.strokeOpacity=1),t.fill&&(t.fillOpacity=.0625,t.stroke="#000",t.strokeOpacity=1,t.strokeWidth=2),t}const iG=31,rG=new Uint32Array(33),sG=new Uint32Array(33);sG[0]=0,rG[0]=~sG[0];for(let e=1;e<=32;++e)sG[e]=sG[e-1]<<1|1,rG[e]=~sG[e];function oG(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),s=~~((t+2*n+i)/i),o=e=>~~((e+n)/i);return o.invert=e=>e*i-n,o.bitmap=()=>function(e,t){const n=new Uint32Array(~~((e*t+32)/32));function i(e,t){n[e]|=t}function r(e,t){n[e]&=t}return{array:n,get:(t,i)=>{const r=i*e+t;return n[r>>>5]&1<<(r&iG)},set:(t,n)=>{const r=n*e+t;i(r>>>5,1<<(r&iG))},clear:(t,n)=>{const i=n*e+t;r(i>>>5,~(1<<(i&iG)))},getRange:(t,i,r,s)=>{let o,a,l,u,c=s;for(;c>=i;--c)if(o=c*e+t,a=c*e+r,l=o>>>5,u=a>>>5,l===u){if(n[l]&rG[o&iG]&sG[1+(a&iG)])return!0}else{if(n[l]&rG[o&iG])return!0;if(n[u]&sG[1+(a&iG)])return!0;for(let e=l+1;e<u;++e)if(n[e])return!0}return!1},setRange:(t,n,r,s)=>{let o,a,l,u,c;for(;n<=s;++n)if(o=n*e+t,a=n*e+r,l=o>>>5,u=a>>>5,l===u)i(l,rG[o&iG]&sG[1+(a&iG)]);else for(i(l,rG[o&iG]),i(u,sG[1+(a&iG)]),c=l+1;c<u;++c)i(c,4294967295)},clearRange:(t,n,i,s)=>{let o,a,l,u,c;for(;n<=s;++n)if(o=n*e+t,a=n*e+i,l=o>>>5,u=a>>>5,l===u)r(l,sG[o&iG]|rG[1+(a&iG)]);else for(r(l,sG[o&iG]),r(u,rG[1+(a&iG)]),c=l+1;c<u;++c)r(c,0)},outOfBounds:(n,i,r,s)=>n<0||i<0||s>=t||r>=e}}(r,s),o.ratio=i,o.padding=n,o.width=e,o.height=t,o}function aG(e,t,n,i,r,s){let o=n/2;return e-o<0||e+o>r||t-(o=i/2)<0||t+o>s}function lG(e,t,n,i,r,s,o,a){const l=r*s/(2*i),u=e(t-l),c=e(t+l),d=e(n-(s/=2)),h=e(n+s);return o.outOfBounds(u,d,c,h)||o.getRange(u,d,c,h)||a&&a.getRange(u,d,c,h)}const uG=[-1,-1,1,1],cG=[-1,1,-1,1];const dG=["right","center","left"],hG=["bottom","middle","top"];function pG(e,t,n,i,r,s,o,a,l,u,c,d){return!(r.outOfBounds(e,n,t,i)||(d&&s?s.getRange(e,n,t,i)||!function(e,t,n,i,r){return r[0]<=e&&n<=r[2]&&r[3]<=t&&i<=r[5]}(o,l,a,u,c):r.getRange(e,n,t,i)))}const fG={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},mG={naive:function(e,t,n,i){const r=e.width,s=e.height;return function(e){const t=e.datum.datum.items[i].items,n=t.length,o=e.datum.fontSize,a=GV.width(e.datum,e.datum.text);let l,u,c,d,h,p,f,m=0;for(let i=0;i<n;++i)l=t[i].x,c=t[i].y,u=void 0===t[i].x2?l:t[i].x2,d=void 0===t[i].y2?c:t[i].y2,h=(l+u)/2,p=(c+d)/2,f=Math.abs(u-l+d-c),f>=m&&(m=f,e.x=h,e.y=p);return h=a/2,p=o/2,l=e.x-h,u=e.x+h,c=e.y-p,d=e.y+p,e.align="center",l<0&&u<=r?e.align="left":0<=l&&r<u&&(e.align="right"),e.baseline="middle",c<0&&d<=s?e.baseline="top":0<=c&&s<d&&(e.baseline="bottom"),!0}},"reduced-search":function(e,t,n,i){const r=e.width,s=e.height,o=t[0],a=t[1];function l(t,n,i,l,u){const c=e.invert(t),d=e.invert(n);let h,p=i,f=s;if(!aG(c,d,l,u,r,s)&&!lG(e,c,d,u,l,p,o,a)&&!lG(e,c,d,u,l,u,o,null)){for(;f-p>=1;)h=(p+f)/2,lG(e,c,d,u,l,h,o,a)?f=h:p=h;if(p>i)return[c,d,p,!0]}}return function(t){const a=t.datum.datum.items[i].items,u=a.length,c=t.datum.fontSize,d=GV.width(t.datum,t.datum.text);let h,p,f,m,g,y,_,v,b,T,x,E,w,I,A,S,C,O=n?c:0,M=!1,R=!1,k=0;for(let i=0;i<u;++i){for(h=a[i].x,f=a[i].y,p=void 0===a[i].x2?h:a[i].x2,m=void 0===a[i].y2?f:a[i].y2,h>p&&(C=h,h=p,p=C),f>m&&(C=f,f=m,m=C),b=e(h),x=e(p),T=~~((b+x)/2),E=e(f),I=e(m),w=~~((E+I)/2),_=T;_>=b;--_)for(v=w;v>=E;--v)S=l(_,v,O,d,c),S&&([t.x,t.y,O,M]=S);for(_=T;_<=x;++_)for(v=w;v<=I;++v)S=l(_,v,O,d,c),S&&([t.x,t.y,O,M]=S);M||n||(A=Math.abs(p-h+m-f),g=(h+p)/2,y=(f+m)/2,A>=k&&!aG(g,y,d,c,r,s)&&!lG(e,g,y,c,d,c,o,null)&&(k=A,t.x=g,t.y=y,R=!0))}return!(!M&&!R)&&(g=d/2,y=c/2,o.setRange(e(t.x-g),e(t.y-y),e(t.x+g),e(t.y+y)),t.align="center",t.baseline="middle",!0)}},floodfill:function(e,t,n,i){const r=e.width,s=e.height,o=t[0],a=t[1],l=e.bitmap();return function(t){const u=t.datum.datum.items[i].items,c=u.length,d=t.datum.fontSize,h=GV.width(t.datum,t.datum.text),p=[];let f,m,g,y,_,v,b,T,x,E,w,I,A=n?d:0,S=!1,C=!1,O=0;for(let i=0;i<c;++i){for(f=u[i].x,g=u[i].y,m=void 0===u[i].x2?f:u[i].x2,y=void 0===u[i].y2?g:u[i].y2,p.push([e((f+m)/2),e((g+y)/2)]);p.length;)if([b,T]=p.pop(),!(o.get(b,T)||a.get(b,T)||l.get(b,T))){l.set(b,T);for(let e=0;e<4;++e)_=b+uG[e],v=T+cG[e],l.outOfBounds(_,v,_,v)||p.push([_,v]);if(_=e.invert(b),v=e.invert(T),x=A,E=s,!aG(_,v,h,d,r,s)&&!lG(e,_,v,d,h,x,o,a)&&!lG(e,_,v,d,h,d,o,null)){for(;E-x>=1;)w=(x+E)/2,lG(e,_,v,d,h,w,o,a)?E=w:x=w;x>A&&(t.x=_,t.y=v,A=x,S=!0)}}S||n||(I=Math.abs(m-f+y-g),_=(f+m)/2,v=(g+y)/2,I>=O&&!aG(_,v,h,d,r,s)&&!lG(e,_,v,d,h,d,o,null)&&(O=I,t.x=_,t.y=v,C=!0))}return!(!S&&!C)&&(_=h/2,v=d/2,o.setRange(e(t.x-_),e(t.y-v),e(t.x+_),e(t.y+v)),t.align="center",t.baseline="middle",!0)}}};function gG(e,t,n,i,r,s,o,a,l,u,c){if(!e.length)return e;const d=Math.max(i.length,r.length),h=function(e,t){const n=new Float64Array(t),i=e.length;for(let t=0;t<i;++t)n[t]=e[t]||0;for(let e=i;e<t;++e)n[e]=n[i-1];return n}(i,d),p=function(e,t){const n=new Int8Array(t),i=e.length;for(let t=0;t<i;++t)n[t]|=fG[e[t]];for(let e=i;e<t;++e)n[e]=n[i-1];return n}(r,d),f=(b=e[0].datum)&&b.mark&&b.mark.marktype,m="group"===f&&e[0].datum.items[l].marktype,g="area"===m,y=function(e,t,n,i){const r=e=>[e.x,e.x,e.x,e.y,e.y,e.y];return e?"line"===e||"area"===e?e=>r(e.datum):"line"===t?e=>{const t=e.datum.items[i].items;return r(t.length?t["start"===n?0:t.length-1]:{x:NaN,y:NaN})}:e=>{const t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:r}(f,m,a,l),_=oG(t[0],t[1],u),v=g&&"naive"===c;var b;const T=e.map(e=>({datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(e)}));let x;if(!v){n&&T.sort((e,t)=>n(e.datum,t.datum));let t=!1;for(let e=0;e<p.length&&!t;++e)t=5===p[e]||h[e]<0;f&&(o||g)&&(s=[e.map(e=>e.datum)].concat(s)),x=s.length?eG(_,s,t,g):function(e,t){const n=e.bitmap();return(t||[]).forEach(t=>n.set(e(t.boundary[0]),e(t.boundary[3]))),[n,void 0]}(_,o&&T)}const E=g?mG[c](_,x,o,l):function(e,t,n,i){const r=e.width,s=e.height,o=t[0],a=t[1],l=i.length;return function(t){const u=t.boundary,c=t.datum.fontSize;if(u[2]<0||u[5]<0||u[0]>r||u[3]>s)return!1;let d,h,p,f,m,g,y,_,v,b,T,x,E,w,I,A=0;for(let r=0;r<l;++r){if(d=(3&n[r])-1,h=(n[r]>>>2&3)-1,p=0===d&&0===h||i[r]<0,f=d&&h?Math.SQRT1_2:1,m=i[r]<0?-1:1,g=u[1+d]+i[r]*d*f,T=u[4+h]+m*c*h/2+i[r]*h*f,_=T-c/2,v=T+c/2,x=e(g),w=e(_),I=e(v),!A){if(!pG(x,x,w,I,o,a,g,g,_,v,u,p))continue;A=GV.width(t.datum,t.datum.text)}if(b=g+m*A*d/2,g=b-A/2,y=b+A/2,x=e(g),E=e(y),pG(x,E,w,I,o,a,g,y,_,v,u,p))return t.x=d?d*m<0?y:g:b,t.y=h?h*m<0?v:_:T,t.align=dG[d*m+1],t.baseline=hG[h*m+1],o.setRange(x,w,E,I),!0}return!1}}(_,x,p,h);return T.forEach(e=>e.opacity=+E(e)),T}const yG=["x","y","opacity","align","baseline"],_G=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function vG(e){Ho.call(this,null,e)}function bG(e,t){var n,i,r,s,o,a,l=[],u=function(e){return e(s)};if(null==t)l.push(e);else for(n={},i=0,r=e.length;i<r;++i)s=e[i],(a=n[o=t.map(u)])||(n[o]=a=[],a.dims=o,l.push(a)),a.push(s);return l}function TG(e){Ho.call(this,null,e)}vG.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:_G},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:yG.length,default:yG}]},pt(vG,Ho,{transform(e,t){const n=e.modified();if(!(n||t.changed(t.ADD_REM)||function(n){const i=e[n];return Ke(i)&&t.modified(i.fields)}("sort")))return;e.size&&2===e.size.length||ae("Size parameter should be specified as a [width, height] array.");const i=e.as||yG;return gG(t.materialize(t.SOURCE).source,e.size,e.sort,Xe(e.offset||1),Xe(e.anchor||_G),e.avoidMarks||[],!1!==e.avoidBaseMark,e.lineAnchor||"end",e.markIndex||0,e.padding||0,e.method||"naive").forEach(e=>{const t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline}),t.reflow(n).modifies(i)}}),TG.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},pt(TG,Ho,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=bG(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(ne),s=r.length,o=e.as||[ne(e.x),ne(e.y)],a=[];i.forEach(t=>{qa(t,e.x,e.y,e.bandwidth||.3).forEach(e=>{const n={};for(let e=0;e<s;++e)n[r[e]]=t.dims[e];n[o[0]]=e[0],n[o[1]]=e[1],a.push(mo(n))})}),this.value&&(n.rem=this.value),this.value=n.add=n.source=a}return n}});const xG={linear:Ua,log:za,exp:Va,pow:ja,quad:Ya,poly:Ga};function EG(e){Ho.call(this,null,e)}EG.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(xG)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]},pt(EG,Ho,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=bG(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(ne),s=e.method||"linear",o=e.order||3,a=((e,t)=>"poly"===e?t:"quad"===e?2:1)(s,o),l=e.as||[ne(e.x),ne(e.y)],u=xG[s],c=[];let d=e.extent;ut(xG,s)||ae("Invalid regression method: "+s),null!=d&&"log"===s&&d[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),i.forEach(n=>{if(n.length<=a)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const i=u(n,e.x,e.y,o);if(e.params)return void c.push(mo({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const h=d||ot(n,e.x),p=e=>{const t={};for(let e=0;e<r.length;++e)t[r[e]]=n.dims[e];t[l[0]]=e[0],t[l[1]]=e[1],c.push(mo(t))};"linear"===s?h.forEach(e=>p([e,i.predict(e)])):Ja(i.predict,h,25,200).forEach(p)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=c}return n}});const wG=Math.pow(2,-52),IG=new Uint32Array(512);class AG{static from(e,t=DG,n=FG){const i=e.length,r=new Float64Array(2*i);for(let s=0;s<i;s++){const i=e[s];r[2*s]=t(i),r[2*s+1]=n(i)}return new AG(r)}constructor(e){const t=e.length>>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:i,_hullHash:r}=this,s=e.length>>1;let o=1/0,a=1/0,l=-1/0,u=-1/0;for(let t=0;t<s;t++){const n=e[2*t],i=e[2*t+1];n<o&&(o=n),i<a&&(a=i),n>l&&(l=n),i>u&&(u=i),this._ids[t]=t}const c=(o+l)/2,d=(a+u)/2;let h,p,f,m=1/0;for(let t=0;t<s;t++){const n=SG(c,d,e[2*t],e[2*t+1]);n<m&&(h=t,m=n)}const g=e[2*h],y=e[2*h+1];m=1/0;for(let t=0;t<s;t++){if(t===h)continue;const n=SG(g,y,e[2*t],e[2*t+1]);n<m&&n>0&&(p=t,m=n)}let _=e[2*p],v=e[2*p+1],b=1/0;for(let t=0;t<s;t++){if(t===h||t===p)continue;const n=RG(g,y,_,v,e[2*t],e[2*t+1]);n<b&&(f=t,b=n)}let T=e[2*f],x=e[2*f+1];if(b===1/0){for(let t=0;t<s;t++)this._dists[t]=e[2*t]-e[0]||e[2*t+1]-e[1];kG(this._ids,this._dists,0,s-1);const t=new Uint32Array(s);let n=0;for(let e=0,i=-1/0;e<s;e++){const r=this._ids[e];this._dists[r]>i&&(t[n++]=r,i=this._dists[r])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(OG(g,y,_,v,T,x)){const e=p,t=_,n=v;p=f,_=T,v=x,f=e,T=t,x=n}const E=function(e,t,n,i,r,s){const o=n-e,a=i-t,l=r-e,u=s-t,c=o*o+a*a,d=l*l+u*u,h=.5/(o*u-a*l),p=e+(u*c-a*d)*h,f=t+(o*d-l*c)*h;return{x:p,y:f}}(g,y,_,v,T,x);this._cx=E.x,this._cy=E.y;for(let t=0;t<s;t++)this._dists[t]=SG(e[2*t],e[2*t+1],E.x,E.y);kG(this._ids,this._dists,0,s-1),this._hullStart=h;let w=3;n[h]=t[f]=p,n[p]=t[h]=f,n[f]=t[p]=h,i[h]=0,i[p]=1,i[f]=2,r.fill(-1),r[this._hashKey(g,y)]=h,r[this._hashKey(_,v)]=p,r[this._hashKey(T,x)]=f,this.trianglesLen=0,this._addTriangle(h,p,f,-1,-1,-1);for(let s,o,a=0;a<this._ids.length;a++){const l=this._ids[a],u=e[2*l],c=e[2*l+1];if(a>0&&Math.abs(u-s)<=wG&&Math.abs(c-o)<=wG)continue;if(s=u,o=c,l===h||l===p||l===f)continue;let d=0;for(let e=0,t=this._hashKey(u,c);e<this._hashSize&&(d=r[(t+e)%this._hashSize],-1===d||d===n[d]);e++);d=t[d];let m,g=d;for(;m=n[g],!OG(u,c,e[2*g],e[2*g+1],e[2*m],e[2*m+1]);)if(g=m,g===d){g=-1;break}if(-1===g)continue;let y=this._addTriangle(g,l,n[g],-1,-1,i[g]);i[l]=this._legalize(y+2),i[g]=y,w++;let _=n[g];for(;m=n[_],OG(u,c,e[2*_],e[2*_+1],e[2*m],e[2*m+1]);)y=this._addTriangle(_,l,m,i[l],-1,i[_]),i[l]=this._legalize(y+2),n[_]=_,w--,_=m;if(g===d)for(;m=t[g],OG(u,c,e[2*m],e[2*m+1],e[2*g],e[2*g+1]);)y=this._addTriangle(m,l,g,-1,i[g],i[m]),this._legalize(y+2),i[m]=y,n[g]=g,w--,g=m;this._hullStart=t[l]=g,n[g]=t[_]=l,n[l]=_,r[this._hashKey(u,c)]=l,r[this._hashKey(e[2*g],e[2*g+1])]=g}this.hull=new Uint32Array(w);for(let e=0,t=this._hullStart;e<w;e++)this.hull[e]=t,t=n[t];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(function(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:i}=this;let r=0,s=0;for(;;){const o=n[e],a=e-e%3;if(s=a+(e+2)%3,-1===o){if(0===r)break;e=IG[--r];continue}const l=o-o%3,u=a+(e+1)%3,c=l+(o+2)%3,d=t[s],h=t[e],p=t[u],f=t[c];if(MG(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*f],i[2*f+1])){t[e]=f,t[o]=d;const i=n[c];if(-1===i){let t=this._hullStart;do{if(this._hullTri[t]===c){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,i),this._link(o,n[s]),this._link(s,c);const a=l+(o+1)%3;r<IG.length&&(IG[r++]=a)}else{if(0===r)break;e=IG[--r]}}return s}_link(e,t){this._halfedges[e]=t,-1!==t&&(this._halfedges[t]=e)}_addTriangle(e,t,n,i,r,s){const o=this.trianglesLen;return this._triangles[o]=e,this._triangles[o+1]=t,this._triangles[o+2]=n,this._link(o,i),this._link(o+1,r),this._link(o+2,s),this.trianglesLen+=3,o}}function SG(e,t,n,i){const r=e-n,s=t-i;return r*r+s*s}function CG(e,t,n,i,r,s){const o=(i-t)*(r-e),a=(n-e)*(s-t);return Math.abs(o-a)>=33306690738754716e-32*Math.abs(o+a)?o-a:0}function OG(e,t,n,i,r,s){return(CG(r,s,e,t,n,i)||CG(e,t,n,i,r,s)||CG(n,i,r,s,e,t))<0}function MG(e,t,n,i,r,s,o,a){const l=e-o,u=t-a,c=n-o,d=i-a,h=r-o,p=s-a,f=c*c+d*d,m=h*h+p*p;return l*(d*m-f*p)-u*(c*m-f*h)+(l*l+u*u)*(c*p-d*h)<0}function RG(e,t,n,i,r,s){const o=n-e,a=i-t,l=r-e,u=s-t,c=o*o+a*a,d=l*l+u*u,h=.5/(o*u-a*l),p=(u*c-a*d)*h,f=(o*d-l*c)*h;return p*p+f*f}function kG(e,t,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=e[r],s=t[i];let o=r-1;for(;o>=n&&t[e[o]]>s;)e[o+1]=e[o--];e[o+1]=i}else{let r=n+1,s=i;NG(e,n+i>>1,r),t[e[n]]>t[e[i]]&&NG(e,n,i),t[e[r]]>t[e[i]]&&NG(e,r,i),t[e[n]]>t[e[r]]&&NG(e,n,r);const o=e[r],a=t[o];for(;;){do{r++}while(t[e[r]]<a);do{s--}while(t[e[s]]>a);if(s<r)break;NG(e,r,s)}e[n+1]=e[s],e[s]=o,i-r+1>=s-n?(kG(e,t,r,i),kG(e,t,n,s-1)):(kG(e,t,n,s-1),kG(e,t,r,i))}}function NG(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function DG(e){return e[0]}function FG(e){return e[1]}const LG=1e-6;class PG{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){const i=(e=+e)+(n=+n),r=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${i},${r}`:(Math.abs(this._x1-i)>LG||Math.abs(this._y1-r)>LG)&&(this._+="L"+i+","+r),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=i},${this._y1=r}`)}rect(e,t,n,i){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+i}h${-n}Z`}value(){return this._||null}}class BG{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}class $G{constructor(e,[t,n,i,r]=[0,0,960,500]){if(!((i=+i)>=(t=+t)&&(r=+r)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=i,this.xmin=t,this.ymax=r,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:i}=this,r=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let t,i,s=0,o=0,a=n.length;s<a;s+=3,o+=2){const a=2*n[s],l=2*n[s+1],u=2*n[s+2],c=e[a],d=e[a+1],h=e[l],p=e[l+1],f=e[u],m=e[u+1],g=h-c,y=p-d,_=f-c,v=m-d,b=g*g+y*y,T=_*_+v*v,x=2*(g*v-y*_);if(x)if(Math.abs(x)<1e-8)t=(c+f)/2,i=(d+m)/2;else{const e=1/x;t=c+(v*b-y*T)*e,i=d+(g*T-_*b)*e}else t=(c+f)/2-1e8*v,i=(d+m)/2+1e8*_;r[o]=t,r[o+1]=i}let s,o,a,l=t[t.length-1],u=4*l,c=e[2*l],d=e[2*l+1];i.fill(0);for(let n=0;n<t.length;++n)l=t[n],s=u,o=c,a=d,u=4*l,c=e[2*l],d=e[2*l+1],i[s+2]=i[u]=a-d,i[s+3]=i[u+1]=c-o}render(e){const t=null==e?e=new PG:void 0,{delaunay:{halfedges:n,inedges:i,hull:r},circumcenters:s,vectors:o}=this;if(r.length<=1)return null;for(let t=0,i=n.length;t<i;++t){const i=n[t];if(i<t)continue;const r=2*Math.floor(t/3),o=2*Math.floor(i/3),a=s[r],l=s[r+1],u=s[o],c=s[o+1];this._renderSegment(a,l,u,c,e)}let a,l=r[r.length-1];for(let t=0;t<r.length;++t){a=l,l=r[t];const n=2*Math.floor(i[l]/3),u=s[n],c=s[n+1],d=4*a,h=this._project(u,c,o[d+2],o[d+3]);h&&this._renderSegment(u,c,h[0],h[1],e)}return t&&t.value()}renderBounds(e){const t=null==e?e=new PG:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){const n=null==t?t=new PG:void 0,i=this._clip(e);if(null===i||!i.length)return;t.moveTo(i[0],i[1]);let r=i.length;for(;i[0]===i[r-2]&&i[1]===i[r-1]&&r>1;)r-=2;for(let e=2;e<r;e+=2)i[e]===i[e-2]&&i[e+1]===i[e-1]||t.lineTo(i[e],i[e+1]);return t.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){const e=this.cellPolygon(t);e&&(e.index=t,yield e)}}cellPolygon(e){const t=new BG;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,i,r){let s;const o=this._regioncode(e,t),a=this._regioncode(n,i);0===o&&0===a?(r.moveTo(e,t),r.lineTo(n,i)):(s=this._clipSegment(e,t,n,i,o,a))&&(r.moveTo(s[0],s[1]),r.lineTo(s[2],s[3]))}contains(e,t,n){return(t=+t)==t&&(n=+n)==n&&this.delaunay._step(e,t,n)===e}*neighbors(e){const t=this._clip(e);if(t)for(const n of this.delaunay.neighbors(e)){const e=this._clip(n);if(e)e:for(let i=0,r=t.length;i<r;i+=2)for(let s=0,o=e.length;s<o;s+=2)if(t[i]==e[s]&&t[i+1]==e[s+1]&&t[(i+2)%r]==e[(s+o-2)%o]&&t[(i+3)%r]==e[(s+o-1)%o]){yield n;break e}}}_cell(e){const{circumcenters:t,delaunay:{inedges:n,halfedges:i,triangles:r}}=this,s=n[e];if(-1===s)return null;const o=[];let a=s;do{const n=Math.floor(a/3);if(o.push(t[2*n],t[2*n+1]),a=a%3==2?a-2:a+1,r[a]!==e)break;a=i[a]}while(a!==s&&-1!==a);return o}_clip(e){if(0===e&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const t=this._cell(e);if(null===t)return null;const{vectors:n}=this,i=4*e;return n[i]||n[i+1]?this._clipInfinite(e,t,n[i],n[i+1],n[i+2],n[i+3]):this._clipFinite(e,t)}_clipFinite(e,t){const n=t.length;let i,r,s,o,a,l=null,u=t[n-2],c=t[n-1],d=this._regioncode(u,c);for(let h=0;h<n;h+=2)if(i=u,r=c,u=t[h],c=t[h+1],s=d,d=this._regioncode(u,c),0===s&&0===d)o=a,a=0,l?l.push(u,c):l=[u,c];else{let t,n,h,p,f;if(0===s){if(null===(t=this._clipSegment(i,r,u,c,s,d)))continue;[n,h,p,f]=t}else{if(null===(t=this._clipSegment(u,c,i,r,d,s)))continue;[p,f,n,h]=t,o=a,a=this._edgecode(n,h),o&&a&&this._edge(e,o,a,l,l.length),l?l.push(n,h):l=[n,h]}o=a,a=this._edgecode(p,f),o&&a&&this._edge(e,o,a,l,l.length),l?l.push(p,f):l=[p,f]}if(l)o=a,a=this._edgecode(l[0],l[1]),o&&a&&this._edge(e,o,a,l,l.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return l}_clipSegment(e,t,n,i,r,s){for(;;){if(0===r&&0===s)return[e,t,n,i];if(r&s)return null;let o,a,l=r||s;8&l?(o=e+(n-e)*(this.ymax-t)/(i-t),a=this.ymax):4&l?(o=e+(n-e)*(this.ymin-t)/(i-t),a=this.ymin):2&l?(a=t+(i-t)*(this.xmax-e)/(n-e),o=this.xmax):(a=t+(i-t)*(this.xmin-e)/(n-e),o=this.xmin),r?(e=o,t=a,r=this._regioncode(e,t)):(n=o,i=a,s=this._regioncode(n,i))}}_clipInfinite(e,t,n,i,r,s){let o,a=Array.from(t);if((o=this._project(a[0],a[1],n,i))&&a.unshift(o[0],o[1]),(o=this._project(a[a.length-2],a[a.length-1],r,s))&&a.push(o[0],o[1]),a=this._clipFinite(e,a))for(let t,n=0,i=a.length,r=this._edgecode(a[i-2],a[i-1]);n<i;n+=2)t=r,r=this._edgecode(a[n],a[n+1]),t&&r&&(n=this._edge(e,t,r,a,n),i=a.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(e,t,n,i,r){for(;t!==n;){let n,s;switch(t){case 5:t=4;continue;case 4:t=6,n=this.xmax,s=this.ymin;break;case 6:t=2;continue;case 2:t=10,n=this.xmax,s=this.ymax;break;case 10:t=8;continue;case 8:t=9,n=this.xmin,s=this.ymax;break;case 9:t=1;continue;case 1:t=5,n=this.xmin,s=this.ymin}i[r]===n&&i[r+1]===s||!this.contains(e,n,s)||(i.splice(r,0,n,s),r+=2)}if(i.length>4)for(let e=0;e<i.length;e+=2){const t=(e+2)%i.length,n=(e+4)%i.length;(i[e]===i[t]&&i[t]===i[n]||i[e+1]===i[t+1]&&i[t+1]===i[n+1])&&(i.splice(t,2),e-=2)}return r}_project(e,t,n,i){let r,s,o,a=1/0;if(i<0){if(t<=this.ymin)return null;(r=(this.ymin-t)/i)<a&&(o=this.ymin,s=e+(a=r)*n)}else if(i>0){if(t>=this.ymax)return null;(r=(this.ymax-t)/i)<a&&(o=this.ymax,s=e+(a=r)*n)}if(n>0){if(e>=this.xmax)return null;(r=(this.xmax-e)/n)<a&&(s=this.xmax,o=t+(a=r)*i)}else if(n<0){if(e<=this.xmin)return null;(r=(this.xmin-e)/n)<a&&(s=this.xmin,o=t+(a=r)*i)}return[s,o]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}}const UG=2*Math.PI,zG=Math.pow;function VG(e){return e[0]}function jG(e){return e[1]}function YG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class GG{static from(e,t=VG,n=jG,i){return new GG("length"in e?function(e,t,n,i){const r=e.length,s=new Float64Array(2*r);for(let o=0;o<r;++o){const r=e[o];s[2*o]=t.call(i,r,o,e),s[2*o+1]=n.call(i,r,o,e)}return s}(e,t,n,i):Float64Array.from(function*(e,t,n,i){let r=0;for(const s of e)yield t.call(i,s,r,e),yield n.call(i,s,r,e),++r}(e,t,n,i)))}constructor(e){this._delaunator=new AG(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&function(e){const{triangles:t,coords:n}=e;for(let e=0;e<t.length;e+=3){const i=2*t[e],r=2*t[e+1],s=2*t[e+2];if((n[s]-n[i])*(n[r+1]-n[i+1])-(n[r]-n[i])*(n[s+1]-n[i+1])>1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},(e,t)=>t).sort((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]);const e=this.collinear[0],n=this.collinear[this.collinear.length-1],i=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],r=1e-8*Math.hypot(i[3]-i[1],i[2]-i[0]);for(let e=0,n=t.length/2;e<n;++e){const n=YG(t[2*e],t[2*e+1],r);t[2*e]=n[0],t[2*e+1]=n[1]}this._delaunator=new AG(t)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,r=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),o=this._hullIndex.fill(-1);for(let e=0,t=n.length;e<t;++e){const t=r[e%3==2?e-2:e+1];-1!==n[e]&&-1!==s[t]||(s[t]=e)}for(let e=0,t=i.length;e<t;++e)o[i[e]]=e;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],this.triangles[1]=i[1],this.triangles[2]=i[1],s[i[0]]=1,2===i.length&&(s[i[1]]=0))}voronoi(e){return new $G(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:i,halfedges:r,triangles:s,collinear:o}=this;if(o){const t=o.indexOf(e);return t>0&&(yield o[t-1]),void(t<o.length-1&&(yield o[t+1]))}const a=t[e];if(-1===a)return;let l=a,u=-1;do{if(yield u=s[l],l=l%3==2?l-2:l+1,s[l]!==e)return;if(l=r[l],-1===l){const t=n[(i[e]+1)%n.length];return void(t!==u&&(yield t))}}while(l!==a)}find(e,t,n=0){if((e=+e)!=e||(t=+t)!=t)return-1;const i=n;let r;for(;(r=this._step(n,e,t))>=0&&r!==n&&r!==i;)n=r;return r}_step(e,t,n){const{inedges:i,hull:r,_hullIndex:s,halfedges:o,triangles:a,points:l}=this;if(-1===i[e]||!l.length)return(e+1)%(l.length>>1);let u=e,c=zG(t-l[2*e],2)+zG(n-l[2*e+1],2);const d=i[e];let h=d;do{let i=a[h];const d=zG(t-l[2*i],2)+zG(n-l[2*i+1],2);if(d<c&&(c=d,u=i),h=h%3==2?h-2:h+1,a[h]!==e)break;if(h=o[h],-1===h){if(h=r[(s[e]+1)%r.length],h!==i&&zG(t-l[2*h],2)+zG(n-l[2*h+1],2)<c)return h;break}}while(h!==d);return u}render(e){const t=null==e?e=new PG:void 0,{points:n,halfedges:i,triangles:r}=this;for(let t=0,s=i.length;t<s;++t){const s=i[t];if(s<t)continue;const o=2*r[t],a=2*r[s];e.moveTo(n[o],n[o+1]),e.lineTo(n[a],n[a+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t=2){const n=null==e?e=new PG:void 0,{points:i}=this;for(let n=0,r=i.length;n<r;n+=2){const r=i[n],s=i[n+1];e.moveTo(r+t,s),e.arc(r,s,t,0,UG)}return n&&n.value()}renderHull(e){const t=null==e?e=new PG:void 0,{hull:n,points:i}=this,r=2*n[0],s=n.length;e.moveTo(i[r],i[r+1]);for(let t=1;t<s;++t){const r=2*n[t];e.lineTo(i[r],i[r+1])}return e.closePath(),t&&t.value()}hullPolygon(){const e=new BG;return this.renderHull(e),e.value()}renderTriangle(e,t){const n=null==t?t=new PG:void 0,{points:i,triangles:r}=this,s=2*r[e*=3],o=2*r[e+1],a=2*r[e+2];return t.moveTo(i[s],i[s+1]),t.lineTo(i[o],i[o+1]),t.lineTo(i[a],i[a+1]),t.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){const t=new BG;return this.renderTriangle(e,t),t.value()}}function HG(e){Ho.call(this,null,e)}HG.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const WG=[-1e5,-1e5,1e5,1e5];function XG(e){const t=e[0][0],n=e[0][1];let i=e.length-1;for(;e[i][0]===t&&e[i][1]===n;--i);return"M"+e.slice(0,i+1).join("L")+"Z"}function qG(e,t,n){return e.fields=t||[],e.fname=n,e}function KG(e){return 1===e.length?ZG(e[0]):QG(e)}pt(HG,Ho,{transform(e,t){const n=e.as||"path",i=t.source;if(!i||!i.length)return t;let r=e.size;r=r?[0,0,r[0],r[1]]:(r=e.extent)?[r[0][0],r[0][1],r[1][0],r[1][1]]:WG;const s=this.value=GG.from(i,e.x,e.y).voronoi(r);for(let e=0,t=i.length;e<t;++e){const t=s.cellPolygon(e);i[e][n]=t?XG(t):null}return t.reflow(e.modified()).modifies(n)}});const ZG=e=>function(t){return t[e]},QG=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function JG(e){throw Error(e)}function eH(e){const t=[],n=e.length;let i,r,s,o=null,a=0,l="";function u(){t.push(l+e.substring(i,r)),l="",i=r+1}for(e+="",i=r=0;r<n;++r)if(s=e[r],"\\"===s)l+=e.substring(i,r++),i=r;else if(s===o)u(),o=null,a=-1;else{if(o)continue;i===a&&'"'===s||i===a&&"'"===s?(i=r+1,o=s):"."!==s||a?"["===s?(r>i&&u(),a=i=r+1):"]"===s&&(a||JG("Access path missing open bracket: "+e),a>0&&u(),a=0,i=r+1):r>i?u():i=r+1}return a&&JG("Access path missing closing bracket: "+e),o&&JG("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function tH(e,t,n){const i=eH(e);return e=1===i.length?i[0]:e,qG((n&&n.get||KG)(i),[e],t||e)}tH("id"),qG(e=>e,[],"identity"),qG(()=>0,[],"zero"),qG(()=>1,[],"one"),qG(()=>!0,[],"true"),qG(()=>!1,[],"false");var nH=Array.isArray;function iH(e){return e[e.length-1]}function rH(e){return null==e||""===e?null:+e}function sH(e){return null!=e?nH(e)?e:[e]:[]}function oH(e){return"function"==typeof e}function aH(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function lH(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function uH(e){let t,n,i;function r(e,i,r=0,s=e.length){if(r<s){if(0!==t(i,i))return s;do{const t=r+s>>>1;n(e[t],i)<0?r=t+1:s=t}while(r<s)}return r}return 2!==e.length?(t=aH,n=(t,n)=>aH(e(t),n),i=(t,n)=>e(t)-n):(t=e===aH||e===lH?e:cH,n=e,i=e),{left:r,center:function(e,t,n=0,s=e.length){const o=r(e,t,n,s-1);return o>n&&i(e[o-1],t)>-i(e[o],t)?o-1:o},right:function(e,i,r=0,s=e.length){if(r<s){if(0!==t(i,i))return s;do{const t=r+s>>>1;n(e[t],i)<=0?r=t+1:s=t}while(r<s)}return r}}}function cH(){return 0}function dH(e){return null===e?NaN:+e}const hH=uH(aH),pH=hH.right,fH=(hH.left,uH(dH).center,pH),mH=Math.sqrt(50),gH=Math.sqrt(10),yH=Math.sqrt(2);function _H(e,t,n){const i=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),o=s>=mH?10:s>=gH?5:s>=yH?2:1;let a,l,u;return r<0?(u=Math.pow(10,-r)/o,a=Math.round(e*u),l=Math.round(t*u),a/u<e&&++a,l/u>t&&--l,u=-u):(u=Math.pow(10,r)*o,a=Math.round(e/u),l=Math.round(t/u),a*u<e&&++a,l*u>t&&--l),l<a&&.5<=n&&n<2?_H(e,t,2*n):[a,l,u]}function vH(e,t,n){if(!((n=+n)>0))return[];if((e=+e)===(t=+t))return[e];const i=t<e,[r,s,o]=i?_H(t,e,n):_H(e,t,n);if(!(s>=r))return[];const a=s-r+1,l=new Array(a);if(i)if(o<0)for(let e=0;e<a;++e)l[e]=(s-e)/-o;else for(let e=0;e<a;++e)l[e]=(s-e)*o;else if(o<0)for(let e=0;e<a;++e)l[e]=(r+e)/-o;else for(let e=0;e<a;++e)l[e]=(r+e)*o;return l}function bH(e,t,n){return _H(e=+e,t=+t,n=+n)[2]}function TH(e,t,n){n=+n;const i=(t=+t)<(e=+e),r=i?bH(t,e,n):bH(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}function xH(e,t,n,i,r){var s=e*e,o=s*e;return((1-3*e+3*s-o)*t+(4-6*s+3*o)*n+(1+3*e+3*s-3*o)*i+o*r)/6}function EH(e){var t=e.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[i],s=e[i+1],o=i>0?e[i-1]:2*r-s,a=i<t-1?e[i+2]:2*s-r;return xH((n-i/t)*t,o,r,s,a)}}function wH(e){var t=e.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*t),r=e[(i+t-1)%t],s=e[i%t],o=e[(i+1)%t],a=e[(i+2)%t];return xH((n-i/t)*t,r,s,o,a)}}const IH=e=>()=>e;function AH(e,t){return function(n){return e+n*t}}function SH(e,t){var n=t-e;return n?AH(e,n>180||n<-180?n-360*Math.round(n/360):n):IH(isNaN(e)?t:e)}function CH(e){return 1===(e=+e)?OH:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}(t,n,e):IH(isNaN(t)?n:t)}}function OH(e,t){var n=t-e;return n?AH(e,n):IH(isNaN(e)?t:e)}const MH=function e(t){var n=CH(t);function i(e,t){var i=n((e=Ry(e)).r,(t=Ry(t)).r),r=n(e.g,t.g),s=n(e.b,t.b),o=OH(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=r(t),e.b=s(t),e.opacity=o(t),e+""}}return i.gamma=e,i}(1);function RH(e){return function(t){var n,i,r=t.length,s=new Array(r),o=new Array(r),a=new Array(r);for(n=0;n<r;++n)i=Ry(t[n]),s[n]=i.r||0,o[n]=i.g||0,a[n]=i.b||0;return s=e(s),o=e(o),a=e(a),i.opacity=1,function(e){return i.r=s(e),i.g=o(e),i.b=a(e),i+""}}}var kH=RH(EH),NH=RH(wH);function DH(e,t){t||(t=[]);var n,i=e?Math.min(t.length,e.length):0,r=t.slice();return function(s){for(n=0;n<i;++n)r[n]=e[n]*(1-s)+t[n]*s;return r}}function FH(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function LH(e,t){return(FH(t)?DH:PH)(e,t)}function PH(e,t){var n,i=t?t.length:0,r=e?Math.min(i,e.length):0,s=new Array(r),o=new Array(i);for(n=0;n<r;++n)s[n]=YH(e[n],t[n]);for(;n<i;++n)o[n]=t[n];return function(e){for(n=0;n<r;++n)o[n]=s[n](e);return o}}function BH(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function $H(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function UH(e,t){var n,i={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?i[n]=YH(e[n],t[n]):r[n]=t[n];return function(e){for(n in i)r[n]=i[n](e);return r}}var zH=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,VH=new RegExp(zH.source,"g");function jH(e,t){var n,i,r,s=zH.lastIndex=VH.lastIndex=0,o=-1,a=[],l=[];for(e+="",t+="";(n=zH.exec(e))&&(i=VH.exec(t));)(r=i.index)>s&&(r=t.slice(s,r),a[o]?a[o]+=r:a[++o]=r),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:$H(n,i)})),s=VH.lastIndex;return s<t.length&&(r=t.slice(s),a[o]?a[o]+=r:a[++o]=r),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,i=0;i<t;++i)a[(n=l[i]).i]=n.x(e);return a.join("")})}function YH(e,t){var n,i=typeof t;return null==t||"boolean"===i?IH(t):("number"===i?$H:"string"===i?(n=Sy(t))?(t=n,MH):jH:t instanceof Sy?MH:t instanceof Date?BH:FH(t)?DH:Array.isArray(t)?PH:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?UH:$H)(e,t)}function GH(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function HH(e){return+e}var WH=[0,1];function XH(e){return e}function qH(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function KH(e,t,n){var i=e[0],r=e[1],s=t[0],o=t[1];return r<i?(i=qH(r,i),s=n(o,s)):(i=qH(i,r),s=n(s,o)),function(e){return s(i(e))}}function ZH(e,t,n){var i=Math.min(e.length,t.length)-1,r=new Array(i),s=new Array(i),o=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<i;)r[o]=qH(e[o],e[o+1]),s[o]=n(t[o],t[o+1]);return function(t){var n=fH(e,t,1,i)-1;return s[n](r[n](t))}}function QH(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function JH(){var e,t,n,i,r,s,o=WH,a=WH,l=YH,u=XH;function c(){var e=Math.min(o.length,a.length);return u!==XH&&(u=function(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(o[0],o[e-1])),i=e>2?ZH:KH,r=s=null,d}function d(t){return null==t||isNaN(t=+t)?n:(r||(r=i(o.map(e),a,l)))(e(u(t)))}return d.invert=function(n){return u(t((s||(s=i(a,o.map(e),$H)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,HH),c()):o.slice()},d.range=function(e){return arguments.length?(a=Array.from(e),c()):a.slice()},d.rangeRound=function(e){return a=Array.from(e),l=GH,c()},d.clamp=function(e){return arguments.length?(u=!!e||XH,c()):u!==XH},d.interpolate=function(e){return arguments.length?(l=e,c()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,i){return e=n,t=i,c()}}function eW(){return JH()(XH,XH)}function tW(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function nW(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}function iW(e,t,n,i){var r,s=TH(e,t,n);switch((i=(0,eS.formatSpecifier)(null==i?",f":i)).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=i.precision||isNaN(r=(0,eS.precisionPrefix)(s,o))||(i.precision=r),(0,eS.formatPrefix)(i,o);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=(0,eS.precisionRound)(s,Math.max(Math.abs(e),Math.abs(t))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=(0,eS.precisionFixed)(s))||(i.precision=r-2*("%"===i.type))}return(0,eS.format)(i)}function rW(e){var t=e.domain;return e.ticks=function(e){var n=t();return vH(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var i=t();return iW(i[0],i[i.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var i,r,s=t(),o=0,a=s.length-1,l=s[o],u=s[a],c=10;for(u<l&&(r=l,l=u,u=r,r=o,o=a,a=r);c-- >0;){if((r=bH(l,u,n))===i)return s[o]=l,s[a]=u,t(s);if(r>0)l=Math.floor(l/r)*r,u=Math.ceil(u/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,u=Math.floor(u*r)/r}i=r}return e},e}function sW(e,t){var n,i=0,r=(e=e.slice()).length-1,s=e[i],o=e[r];return o<s&&(n=i,i=r,r=n,n=s,s=o,o=n),e[i]=t.floor(s),e[r]=t.ceil(o),e}function oW(e){return Math.log(e)}function aW(e){return Math.exp(e)}function lW(e){return-Math.log(-e)}function uW(e){return-Math.exp(-e)}function cW(e){return isFinite(e)?+("1e"+e):e<0?0:e}function dW(e){return(t,n)=>-e(-t,n)}function hW(e){const t=e(oW,aW),n=t.domain;let i,r,s=10;function o(){return i=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(s),r=function(e){return 10===e?cW:e===Math.E?Math.exp:t=>Math.pow(e,t)}(s),n()[0]<0?(i=dW(i),r=dW(r),e(lW,uW)):e(oW,aW),t}return t.base=function(e){return arguments.length?(s=+e,o()):s},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{const t=n();let o=t[0],a=t[t.length-1];const l=a<o;l&&([o,a]=[a,o]);let u,c,d=i(o),h=i(a);const p=null==e?10:+e;let f=[];if(!(s%1)&&h-d<p){if(d=Math.floor(d),h=Math.ceil(h),o>0){for(;d<=h;++d)for(u=1;u<s;++u)if(c=d<0?u/r(-d):u*r(d),!(c<o)){if(c>a)break;f.push(c)}}else for(;d<=h;++d)for(u=s-1;u>=1;--u)if(c=d>0?u/r(-d):u*r(d),!(c<o)){if(c>a)break;f.push(c)}2*f.length<p&&(f=vH(o,a,p))}else f=vH(d,h,Math.min(h-d,p)).map(r);return l?f.reverse():f},t.tickFormat=(e,n)=>{if(null==e&&(e=10),null==n&&(n=10===s?"s":","),"function"!=typeof n&&(s%1||null!=(n=(0,eS.formatSpecifier)(n)).precision||(n.trim=!0),n=(0,eS.format)(n)),e===1/0)return n;const o=Math.max(1,s*e/t.ticks().length);return e=>{let t=e/r(Math.round(i(e)));return t*s<s-.5&&(t*=s),t<=o?n(e):""}},t.nice=()=>n(sW(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function pW(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function fW(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function mW(e){return e<0?-e*e:e*e}function gW(e){var t=e(XH,XH),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e(XH,XH):.5===n?e(fW,mW):e(pW(n),pW(1/n)):n},rW(t)}function yW(){var e=gW(JH());return e.copy=function(){return QH(e,yW()).exponent(e.exponent())},tW.apply(e,arguments),e}function _W(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function vW(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function bW(e){var t=1,n=e(_W(t),vW(t));return n.constant=function(n){return arguments.length?e(_W(t=+n),vW(t)):t},rW(n)}const TW=1e3,xW=6e4,EW=36e5,wW=864e5,IW=6048e5,AW=2592e6,SW=31536e6,CW=new Date,OW=new Date;function MW(e,t,n,i){function r(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return r.floor=t=>(e(t=new Date(+t)),t),r.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),r.round=e=>{const t=r(e),n=r.ceil(e);return e-t<n-e?t:n},r.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),r.range=(n,i,s)=>{const o=[];if(n=r.ceil(n),s=null==s?1:Math.floor(s),!(n<i&&s>0))return o;let a;do{o.push(a=new Date(+n)),t(n,s),e(n)}while(a<n&&n<i);return o},r.filter=n=>MW(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,i)=>{if(e>=e)if(i<0)for(;++i<=0;)for(;t(e,-1),!n(e););else for(;--i>=0;)for(;t(e,1),!n(e););}),n&&(r.count=(t,i)=>(CW.setTime(+t),OW.setTime(+i),e(CW),e(OW),Math.floor(n(CW,OW))),r.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?r.filter(i?t=>i(t)%e===0:t=>r.count(0,t)%e===0):r:null)),r}const RW=MW(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);RW.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?MW(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):RW:null);RW.range;const kW=MW(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*TW)},(e,t)=>(t-e)/TW,e=>e.getUTCSeconds()),NW=(kW.range,MW(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*TW)},(e,t)=>{e.setTime(+e+t*xW)},(e,t)=>(t-e)/xW,e=>e.getMinutes())),DW=(NW.range,MW(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*xW)},(e,t)=>(t-e)/xW,e=>e.getUTCMinutes())),FW=(DW.range,MW(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*TW-e.getMinutes()*xW)},(e,t)=>{e.setTime(+e+t*EW)},(e,t)=>(t-e)/EW,e=>e.getHours())),LW=(FW.range,MW(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*EW)},(e,t)=>(t-e)/EW,e=>e.getUTCHours())),PW=(LW.range,MW(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*xW)/wW,e=>e.getDate()-1)),BW=(PW.range,MW(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/wW,e=>e.getUTCDate()-1)),$W=(BW.range,MW(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/wW,e=>Math.floor(e/wW)));$W.range;function UW(e){return MW(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*xW)/IW)}const zW=UW(0),VW=UW(1),jW=UW(2),YW=UW(3),GW=UW(4),HW=UW(5),WW=UW(6);zW.range,VW.range,jW.range,YW.range,GW.range,HW.range,WW.range;function XW(e){return MW(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/IW)}const qW=XW(0),KW=XW(1),ZW=XW(2),QW=XW(3),JW=XW(4),eX=XW(5),tX=XW(6),nX=(qW.range,KW.range,ZW.range,QW.range,JW.range,eX.range,tX.range,MW(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear()),e=>e.getMonth())),iX=(nX.range,MW(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear()),e=>e.getUTCMonth())),rX=(iX.range,MW(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear()));rX.every=e=>isFinite(e=Math.floor(e))&&e>0?MW(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null;rX.range;const sX=MW(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());sX.every=e=>isFinite(e=Math.floor(e))&&e>0?MW(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null;sX.range;function oX(e,t,n,i,r,s){const o=[[kW,1,TW],[kW,5,5e3],[kW,15,15e3],[kW,30,3e4],[s,1,xW],[s,5,3e5],[s,15,9e5],[s,30,18e5],[r,1,EW],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,wW],[i,2,1728e5],[n,1,IW],[t,1,AW],[t,3,7776e6],[e,1,SW]];function a(t,n,i){const r=Math.abs(n-t)/i,s=uH(([,,e])=>e).right(o,r);if(s===o.length)return e.every(TH(t/SW,n/SW,i));if(0===s)return RW.every(Math.max(TH(t,n,i),1));const[a,l]=o[r/o[s-1][2]<o[s][2]/r?s-1:s];return a.every(l)}return[function(e,t,n){const i=t<e;i&&([e,t]=[t,e]);const r=n&&"function"==typeof n.range?n:a(e,t,n),s=r?r.range(e,+t+1):[];return i?s.reverse():s},a]}const[aX,lX]=oX(sX,iX,qW,$W,LW,DW),[uX,cX]=oX(rX,nX,zW,PW,FW,NW);function dX(e){return new Date(e)}function hX(e){return e instanceof Date?+e:+new Date(+e)}function pX(e,t,n,i,r,s,o,a,l,u){var c=eW(),d=c.invert,h=c.domain,p=u(".%L"),f=u(":%S"),m=u("%I:%M"),g=u("%I %p"),y=u("%a %d"),_=u("%b %d"),v=u("%B"),b=u("%Y");function T(e){return(l(e)<e?p:a(e)<e?f:o(e)<e?m:s(e)<e?g:i(e)<e?r(e)<e?y:_:n(e)<e?v:b)(e)}return c.invert=function(e){return new Date(d(e))},c.domain=function(e){return arguments.length?h(Array.from(e,hX)):h().map(dX)},c.ticks=function(t){var n=h();return e(n[0],n[n.length-1],null==t?10:t)},c.tickFormat=function(e,t){return null==t?T:u(t)},c.nice=function(e){var n=h();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?h(sW(n,e)):c},c.copy=function(){return QH(c,pX(e,t,n,i,r,s,o,a,l,u))},c}function fX(){var e,t,n,i,r,s=0,o=1,a=XH,l=!1;function u(t){return null==t||isNaN(t=+t)?r:a(0===n?.5:(t=(i(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function c(e){return function(t){var n,i;return arguments.length?([n,i]=t,a=e(n,i),u):[a(0),a(1)]}}return u.domain=function(r){return arguments.length?([s,o]=r,e=i(s=+s),t=i(o=+o),n=e===t?0:1/(t-e),u):[s,o]},u.clamp=function(e){return arguments.length?(l=!!e,u):l},u.interpolator=function(e){return arguments.length?(a=e,u):a},u.range=c(YH),u.rangeRound=c(GH),u.unknown=function(e){return arguments.length?(r=e,u):r},function(r){return i=r,e=r(s),t=r(o),n=e===t?0:1/(t-e),u}}function mX(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function gX(){var e=rW(fX()(XH));return e.copy=function(){return mX(e,gX())},nW.apply(e,arguments)}function yX(){var e=gW(fX());return e.copy=function(){return mX(e,yX()).exponent(e.exponent())},nW.apply(e,arguments)}function _X(e,t){void 0===t&&(t=e,e=YH);for(var n=0,i=t.length-1,r=t[0],s=new Array(i<0?0:i);n<i;)s[n]=e(r,r=t[++n]);return function(e){var t=Math.max(0,Math.min(i-1,Math.floor(e*=i)));return s[t](e-t)}}function vX(){var e,t,n,i,r,s,o,a=0,l=.5,u=1,c=1,d=XH,h=!1;function p(e){return isNaN(e=+e)?o:(e=.5+((e=+s(e))-t)*(c*e<c*t?i:r),d(h?Math.max(0,Math.min(1,e)):e))}function f(e){return function(t){var n,i,r;return arguments.length?([n,i,r]=t,d=_X(e,[n,i,r]),p):[d(0),d(.5),d(1)]}}return p.domain=function(o){return arguments.length?([a,l,u]=o,e=s(a=+a),t=s(l=+l),n=s(u=+u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,p):[a,l,u]},p.clamp=function(e){return arguments.length?(h=!!e,p):h},p.interpolator=function(e){return arguments.length?(d=e,p):d},p.range=f(YH),p.rangeRound=f(GH),p.unknown=function(e){return arguments.length?(o=e,p):o},function(o){return s=o,e=o(a),t=o(l),n=o(u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,p}}function bX(){var e=gW(vX());return e.copy=function(){return mX(e,bX()).exponent(e.exponent())},nW.apply(e,arguments)}function TX(e,t,n=dH){if((i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,s=Math.floor(r),o=+n(e[s],s,e);return o+(+n(e[s+1],s+1,e)-o)*(r-s)}}const xX=Symbol("implicit");function EX(){var e=new nv,t=[],n=[],i=xX;function r(r){let s=e.get(r);if(void 0===s){if(i!==xX)return i;e.set(r,s=t.push(r)-1)}return n[s%n.length]}return r.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new nv;for(const i of n)e.has(i)||e.set(i,t.push(i)-1);return r},r.range=function(e){return arguments.length?(n=Array.from(e),r):n.slice()},r.unknown=function(e){return arguments.length?(i=e,r):i},r.copy=function(){return EX(t,n).unknown(i)},tW.apply(r,arguments),r}function wX(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}function IX(e,t){var n=SH(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}}var AX,SX=180/Math.PI,CX={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function OX(e,t,n,i,r,s){var o,a,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*i)&&(n-=e*l,i-=t*l),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,l/=a),e*i<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*SX,skewX:Math.atan(l)*SX,scaleX:o,scaleY:a}}function MX(e,t,n,i){function r(e){return e.length?e.pop()+" ":""}return function(s,o){var a=[],l=[];return s=e(s),o=e(o),function(e,i,r,s,o,a){if(e!==r||i!==s){var l=o.push("translate(",null,t,null,n);a.push({i:l-4,x:$H(e,r)},{i:l-2,x:$H(i,s)})}else(r||s)&&o.push("translate("+r+t+s+n)}(s.translateX,s.translateY,o.translateX,o.translateY,a,l),function(e,t,n,s){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),s.push({i:n.push(r(n)+"rotate(",null,i)-2,x:$H(e,t)})):t&&n.push(r(n)+"rotate("+t+i)}(s.rotate,o.rotate,a,l),function(e,t,n,s){e!==t?s.push({i:n.push(r(n)+"skewX(",null,i)-2,x:$H(e,t)}):t&&n.push(r(n)+"skewX("+t+i)}(s.skewX,o.skewX,a,l),function(e,t,n,i,s,o){if(e!==n||t!==i){var a=s.push(r(s)+"scale(",null,",",null,")");o.push({i:a-4,x:$H(e,n)},{i:a-2,x:$H(t,i)})}else 1===n&&1===i||s.push(r(s)+"scale("+n+","+i+")")}(s.scaleX,s.scaleY,o.scaleX,o.scaleY,a,l),s=o=null,function(e){for(var t,n=-1,i=l.length;++n<i;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var RX=MX(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?CX:OX(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),kX=MX(function(e){return null==e?CX:(AX||(AX=document.createElementNS("http://www.w3.org/2000/svg","g")),AX.setAttribute("transform",e),(e=AX.transform.baseVal.consolidate())?OX((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):CX)},", ",")",")");function NX(e){return((e=Math.exp(e))+1/e)/2}const DX=function e(t,n,i){function r(e,r){var s,o,a=e[0],l=e[1],u=e[2],c=r[0],d=r[1],h=r[2],p=c-a,f=d-l,m=p*p+f*f;if(m<1e-12)o=Math.log(h/u)/t,s=function(e){return[a+e*p,l+e*f,u*Math.exp(t*e*o)]};else{var g=Math.sqrt(m),y=(h*h-u*u+i*m)/(2*u*n*g),_=(h*h-u*u-i*m)/(2*h*n*g),v=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(_*_+1)-_);o=(b-v)/t,s=function(e){var i=e*o,r=NX(v),s=u/(n*g)*(r*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*i+v)-function(e){return((e=Math.exp(e))-1/e)/2}(v));return[a+s*p,l+s*f,u*r/NX(t*i+v)]}}return s.duration=1e3*o*t/Math.SQRT2,s}return r.rho=function(t){var n=Math.max(.001,+t),i=n*n;return e(n,i,i*i)},r}(Math.SQRT2,2,4);function FX(e){return function(t,n){var i=e((t=By(t)).h,(n=By(n)).h),r=OH(t.s,n.s),s=OH(t.l,n.l),o=OH(t.opacity,n.opacity);return function(e){return t.h=i(e),t.s=r(e),t.l=s(e),t.opacity=o(e),t+""}}}const LX=FX(SH);var PX=FX(OH);function BX(e,t){var n=OH((e=Dv(e)).l,(t=Dv(t)).l),i=OH(e.a,t.a),r=OH(e.b,t.b),s=OH(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=i(t),e.b=r(t),e.opacity=s(t),e+""}}function $X(e){return function(t,n){var i=e((t=zv(t)).h,(n=zv(n)).h),r=OH(t.c,n.c),s=OH(t.l,n.l),o=OH(t.opacity,n.opacity);return function(e){return t.h=i(e),t.c=r(e),t.l=s(e),t.opacity=o(e),t+""}}}const UX=$X(SH);var zX=$X(OH);function VX(e){return function t(n){function i(t,i){var r=e((t=nb(t)).h,(i=nb(i)).h),s=OH(t.s,i.s),o=OH(t.l,i.l),a=OH(t.opacity,i.opacity);return function(e){return t.h=r(e),t.s=s(e),t.l=o(Math.pow(e,n)),t.opacity=a(e),t+""}}return n=+n,i.gamma=t,i}(1)}const jX=VX(SH);var YX=VX(OH);function GX(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}const HX="year",WX="quarter",XX="month",qX="week",KX="date",ZX="day",QX="dayofyear",JX="hours",eq="minutes",tq="seconds",nq="milliseconds";[HX,WX,XX,qX,KX,ZX,QX,JX,eq,tq,nq].reduce((e,t,n)=>(e[t]=1+n,e),{});new Date;nX.every(3),iX.every(3);const iq=[HX,XX,KX,JX,eq,tq,nq],rq=iq.slice(0,-1),sq=rq.slice(0,-1),oq=sq.slice(0,-1);oq.slice(0,-1);const aq="linear",lq="log",uq="pow",cq="sqrt",dq="symlog",hq="time",pq="utc",fq="sequential",mq="diverging",gq="quantile",yq="quantize",_q="threshold",vq="continuous",bq="discrete",Tq="discretizing",xq="interpolating",Eq="temporal";function wq(){const e=EX().unknown(void 0),t=e.domain,n=e.range;let i,r,s=[0,1],o=!1,a=0,l=0,u=.5;function c(){const e=t().length,c=s[1]<s[0],d=s[1-c],h=function(e,t,n){const i=e-t+2*n;return e?i>0?i:1:0}(e,a,l);let p=s[c-0];i=(d-p)/(h||1),o&&(i=Math.floor(i)),p+=(d-p-i*(e-a))*u,r=i*(1-a),o&&(p=Math.round(p),r=Math.round(r));const f=function(e,t,n){e=+e,t=+t,n=(r=arguments.length)<2?(t=e,e=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((t-e)/n)),s=new Array(r);++i<r;)s[i]=e+i*n;return s}(e).map(e=>p+i*e);return n(c?f.reverse():f)}return delete e.unknown,e.domain=function(e){return arguments.length?(t(e),c()):t()},e.range=function(e){return arguments.length?(s=[+e[0],+e[1]],c()):s.slice()},e.rangeRound=function(e){return s=[+e[0],+e[1]],o=!0,c()},e.bandwidth=function(){return r},e.step=function(){return i},e.round=function(e){return arguments.length?(o=!!e,c()):o},e.padding=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),a=l,c()):a},e.paddingInner=function(e){return arguments.length?(a=Math.max(0,Math.min(1,e)),c()):a},e.paddingOuter=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),c()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=s[1]<s[0],o=i?n().reverse():n(),a=o.length-1;let l,u,c,d=+e[0],h=+e[1];return d!=d||h!=h||(h<d&&(c=d,d=h,h=c),h<o[0]||d>s[1-i])?void 0:(l=Math.max(0,pH(o,d)-1),u=d===h?l:pH(o,h)-1,d-o[l]>r+1e-10&&++l,i&&(c=l,l=a-u,u=a-c),l>u?void 0:t().slice(l,u+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return wq().domain(t()).range(s).round(o).paddingInner(a).paddingOuter(l).align(u)},c()}function Iq(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Iq(t())},e}var Aq=Array.prototype.map;const Sq=Array.prototype.slice;const Cq=new Map,Oq=Symbol("vega_scale");function Mq(e,t,n){const i=function(){const n=t();return n.invertRange||(n.invertRange=n.invert?function(e){return function(t){let n,i=t[0],r=t[1];return r<i&&(n=i,i=r,r=n),[e.invert(i),e.invert(r)]}}(n):n.invertExtent?function(e){return function(t){const n=e.range();let i,r,s,o,a=t[0],l=t[1],u=-1;for(l<a&&(r=a,a=l,l=r),s=0,o=n.length;s<o;++s)n[s]>=a&&n[s]<=l&&(u<0&&(u=s),i=s);if(!(u<0))return a=e.invertExtent(n[u]),l=e.invertExtent(n[i]),[void 0===a[0]?a[1]:a[0],void 0===l[1]?l[0]:l[1]]}}(n):void 0),n.type=e,function(e){return e[Oq]=!0,e}(n)};return i.metadata=function(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]]=!0;return t}(sH(n)),i}function Rq(e,t,n){return arguments.length>1?(Cq.set(e,Mq(e,t,n)),this):function(e){return Cq.has(e)}(e)?Cq.get(e):void 0}Rq("identity",function e(t){var n;function i(e){return null==e||isNaN(e=+e)?n:e}return i.invert=i,i.domain=i.range=function(e){return arguments.length?(t=Array.from(e,HH),i):t.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,HH):[0,1],rW(i)}),Rq(aq,function e(){var t=eW();return t.copy=function(){return QH(t,e())},tW.apply(t,arguments),rW(t)},vq),Rq(lq,function e(){const t=hW(JH()).domain([1,10]);return t.copy=()=>QH(t,e()).base(t.base()),tW.apply(t,arguments),t},[vq,lq]),Rq(uq,yW,vq),Rq(cq,function(){return yW.apply(null,arguments).exponent(.5)},vq),Rq(dq,function e(){var t=bW(JH());return t.copy=function(){return QH(t,e()).constant(t.constant())},tW.apply(t,arguments)},vq),Rq(hq,function(){return tW.apply(pX(uX,cX,rX,nX,zW,PW,FW,NW,kW,lC).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},[vq,Eq]),Rq(pq,function(){return tW.apply(pX(aX,lX,sX,iX,qW,BW,LW,DW,kW,cC).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},[vq,Eq]),Rq(fq,gX,[vq,xq]),Rq(`${fq}-${aq}`,gX,[vq,xq]),Rq(`${fq}-${lq}`,function e(){var t=hW(fX()).domain([1,10]);return t.copy=function(){return mX(t,e()).base(t.base())},nW.apply(t,arguments)},[vq,xq,lq]),Rq(`${fq}-${uq}`,yX,[vq,xq]),Rq(`${fq}-${cq}`,function(){return yX.apply(null,arguments).exponent(.5)},[vq,xq]),Rq(`${fq}-${dq}`,function e(){var t=bW(fX());return t.copy=function(){return mX(t,e()).constant(t.constant())},nW.apply(t,arguments)},[vq,xq]),Rq(`${mq}-${aq}`,function e(){var t=rW(vX()(XH));return t.copy=function(){return mX(t,e())},nW.apply(t,arguments)},[vq,xq]),Rq(`${mq}-${lq}`,function e(){var t=hW(vX()).domain([.1,1,10]);return t.copy=function(){return mX(t,e()).base(t.base())},nW.apply(t,arguments)},[vq,xq,lq]),Rq(`${mq}-${uq}`,bX,[vq,xq]),Rq(`${mq}-${cq}`,function(){return bX.apply(null,arguments).exponent(.5)},[vq,xq]),Rq(`${mq}-${dq}`,function e(){var t=bW(vX());return t.copy=function(){return mX(t,e()).constant(t.constant())},nW.apply(t,arguments)},[vq,xq]),Rq(gq,function e(){var t,n=[],i=[],r=[];function s(){var e=0,t=Math.max(1,i.length);for(r=new Array(t-1);++e<t;)r[e-1]=TX(n,e/t);return o}function o(e){return null==e||isNaN(e=+e)?t:i[fH(r,e)]}return o.invertExtent=function(e){var t=i.indexOf(e);return t<0?[NaN,NaN]:[t>0?r[t-1]:n[0],t<r.length?r[t]:n[n.length-1]]},o.domain=function(e){if(!arguments.length)return n.slice();n=[];for(let t of e)null==t||isNaN(t=+t)||n.push(t);return n.sort(aH),s()},o.range=function(e){return arguments.length?(i=Array.from(e),s()):i.slice()},o.unknown=function(e){return arguments.length?(t=e,o):t},o.quantiles=function(){return r.slice()},o.copy=function(){return e().domain(n).range(i).unknown(t)},tW.apply(o,arguments)},[Tq,gq]),Rq(yq,function e(){var t,n=0,i=1,r=1,s=[.5],o=[0,1];function a(e){return null!=e&&e<=e?o[fH(s,e,0,r)]:t}function l(){var e=-1;for(s=new Array(r);++e<r;)s[e]=((e+1)*i-(e-r)*n)/(r+1);return a}return a.domain=function(e){return arguments.length?([n,i]=e,n=+n,i=+i,l()):[n,i]},a.range=function(e){return arguments.length?(r=(o=Array.from(e)).length-1,l()):o.slice()},a.invertExtent=function(e){var t=o.indexOf(e);return t<0?[NaN,NaN]:t<1?[n,s[0]]:t>=r?[s[r-1],i]:[s[t-1],s[t]]},a.unknown=function(e){return arguments.length?(t=e,a):a},a.thresholds=function(){return s.slice()},a.copy=function(){return e().domain([n,i]).range(o).unknown(t)},tW.apply(rW(a),arguments)},Tq),Rq(_q,function e(){var t,n=[.5],i=[0,1],r=1;function s(e){return null!=e&&e<=e?i[fH(n,e,0,r)]:t}return s.domain=function(e){return arguments.length?(n=Array.from(e),r=Math.min(n.length,i.length-1),s):n.slice()},s.range=function(e){return arguments.length?(i=Array.from(e),r=Math.min(n.length,i.length-1),s):i.slice()},s.invertExtent=function(e){var t=i.indexOf(e);return[n[t-1],n[t]]},s.unknown=function(e){return arguments.length?(t=e,s):t},s.copy=function(){return e().domain(n).range(i).unknown(t)},tW.apply(s,arguments)},Tq),Rq("bin-ordinal",function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[(fH(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return Aq.call(e,rH)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=Sq.call(e),i):n.slice()},i.tickFormat=function(e,n){return iW(t[0],iH(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i},[bq,Tq]),Rq("ordinal",EX,bq),Rq("band",wq,bq),Rq("point",function(){return Iq(wq().paddingInner(1))},bq);function kq(e,t,n){return _X(function(e,t){const n=g[function(e){return"interpolate"+e.toLowerCase().split("-").map(e=>e[0].toUpperCase()+e.slice(1)).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}(t||"rgb",n),e)}function Nq(e){if(nH(e))return e;const t=e.length/6|0,n=new Array(t);for(let i=0;i<t;)n[i]="#"+e.slice(6*i,6*++i);return n}function Dq(e,t){for(const n in e)Lq(n,t(e[n]))}const Fq={};function Lq(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(Fq[e]=t,this):Fq[e]}Dq({accent:ub,category10:cb,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:db,observable10:hb,paired:pb,pastel1:fb,pastel2:mb,set1:gb,set2:yb,set3:_b,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},Nq),Dq({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},e=>kq(Nq(e)));var Pq=Math.random;Math.sqrt(2*Math.PI),Math.SQRT2;Math.PI;var Bq=Math.PI/180,$q=64,Uq=2048;function zq(){var e,t,n,i,r,s,o,a=[256,256],l=Hq,u=[],c=Math.random,d={};function h(e,t,n){for(var i,r,s,o=t.x,u=t.y,d=Math.hypot(a[0],a[1]),h=l(a),p=c()<.5?1:-1,f=-p;(i=h(f+=p))&&(r=~~i[0],s=~~i[1],!(Math.min(Math.abs(r),Math.abs(s))>=d));)if(t.x=o+r,t.y=u+s,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>a[0]||t.y+t.y1>a[1])&&(!n||!jq(t,e,a[0]))&&(!n||Gq(t,n))){for(var m,g=t.sprite,y=t.width>>5,_=a[0]>>5,v=t.x-(y<<4),b=127&v,T=32-b,x=t.y1-t.y0,E=(t.y+t.y0)*_+(v>>5),w=0;w<x;w++){m=0;for(var I=0;I<=y;I++)e[E+I]|=m<<T|(I<y?(m=g[w*y+I])>>>b:0);E+=_}return t.sprite=null,!0}return!1}return d.layout=function(){for(var l=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=($q<<5)/t,e.height=Uq/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(Tp()),d=function(e){var t=[],n=-1;for(;++n<e;)t[n]=0;return t}((a[0]>>5)*a[1]),p=null,f=u.length,m=-1,g=[],y=u.map(a=>({text:e(a),font:t(a),style:i(a),weight:r(a),rotate:s(a),size:~~(n(a)+1e-14),padding:o(a),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:a})).sort((e,t)=>t.size-e.size);++m<f;){var _=y[m];_.x=a[0]*(c()+.5)>>1,_.y=a[1]*(c()+.5)>>1,Vq(l,_,y,m),_.hasText&&h(d,_,p)&&(g.push(_),p?Yq(p,_):p=[{x:_.x+_.x0,y:_.y+_.y0},{x:_.x+_.x1,y:_.y+_.y1}],_.x-=a[0]>>1,_.y-=a[1]>>1)}return g},d.words=function(e){return arguments.length?(u=e,d):u},d.size=function(e){return arguments.length?(a=[+e[0],+e[1]],d):a},d.font=function(e){return arguments.length?(t=Wq(e),d):t},d.fontStyle=function(e){return arguments.length?(i=Wq(e),d):i},d.fontWeight=function(e){return arguments.length?(r=Wq(e),d):r},d.rotate=function(e){return arguments.length?(s=Wq(e),d):s},d.text=function(t){return arguments.length?(e=Wq(t),d):e},d.spiral=function(e){return arguments.length?(l=Xq[e]||e,d):l},d.fontSize=function(e){return arguments.length?(n=Wq(e),d):n},d.padding=function(e){return arguments.length?(o=Wq(e),d):o},d.random=function(e){return arguments.length?(c=e,d):c},d}function Vq(e,t,n,i){if(!t.sprite){var r=e.context,s=e.ratio;r.clearRect(0,0,($q<<5)/s,Uq/s);var o,a,l,u,c,d=0,h=0,p=0,f=n.length;for(--i;++i<f;){if(t=n[i],r.save(),r.font=t.style+" "+t.weight+" "+~~((t.size+1)/s)+"px "+t.font,o=r.measureText(t.text+"m").width*s,l=t.size<<1,t.rotate){var m=Math.sin(t.rotate*Bq),g=Math.cos(t.rotate*Bq),y=o*g,_=o*m,v=l*g,b=l*m;o=Math.max(Math.abs(y+b),Math.abs(y-b))+31>>5<<5,l=~~Math.max(Math.abs(_+v),Math.abs(_-v))}else o=o+31>>5<<5;if(l>p&&(p=l),d+o>=$q<<5&&(d=0,h+=p,p=0),h+l>=Uq)break;r.translate((d+(o>>1))/s,(h+(l>>1))/s),t.rotate&&r.rotate(t.rotate*Bq),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=o,t.height=l,t.xoff=d,t.yoff=h,t.x1=o>>1,t.y1=l>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,d+=o}for(var T=r.getImageData(0,0,($q<<5)/s,Uq/s).data,x=[];--i>=0;)if((t=n[i]).hasText){for(a=(o=t.width)>>5,l=t.y1-t.y0,u=0;u<l*a;u++)x[u]=0;if(null==(d=t.xoff))return;h=t.yoff;var E=0,w=-1;for(c=0;c<l;c++){for(u=0;u<o;u++){var I=a*c+(u>>5),A=T[(h+c)*($q<<5)+(d+u)<<2]?1<<31-u%32:0;x[I]|=A,E|=A}E?w=c:(t.y0++,l--,c--,h++)}t.y1=t.y0+w,t.sprite=x.slice(0,(t.y1-t.y0)*a)}}}function jq(e,t,n){n>>=5;for(var i,r=e.sprite,s=e.width>>5,o=e.x-(s<<4),a=127&o,l=32-a,u=e.y1-e.y0,c=(e.y+e.y0)*n+(o>>5),d=0;d<u;d++){i=0;for(var h=0;h<=s;h++)if((i<<l|(h<s?(i=r[d*s+h])>>>a:0))&t[c+h])return!0;c+=n}return!1}function Yq(e,t){var n=e[0],i=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function Gq(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0<t[1].x&&e.y+e.y1>t[0].y&&e.y+e.y0<t[1].y}function Hq(e){var t=e[0]/e[1];return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}function Wq(e){return"function"==typeof e?e:function(){return e}}var Xq={archimedean:Hq,rectangular:function(e){var t=4*e[0]/e[1],n=0,i=0;return function(e){var r=e<0?-1:1;switch(Math.sqrt(1+4*r*e)-r&3){case 0:n+=t;break;case 1:i+=4;break;case 2:n-=t;break;default:i-=4}return[n,i]}}};const qq=["x","y","font","fontSize","fontStyle","fontWeight","angle"],Kq=["text","font","rotate","fontSize","fontStyle","fontWeight"];function Zq(e){Ho.call(this,zq(),e)}Zq.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:qq}]},function(e,t,n){const i=e.prototype=Object.create(t.prototype);Object.defineProperty(i,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),function(e){for(let t,n,i=1,r=arguments.length;i<r;++i)for(n in t=arguments[i],t)e[n]=t[n]}(i,n)}(Zq,Ho,{transform(e,t){!e.size||e.size[0]&&e.size[1]||JG("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||Kq.some(function(n){const i=e[n];return oH(i)&&t.modified(i.fields)})))return;const i=t.materialize(t.SOURCE).source,r=this.value,s=e.as||qq;let o,a=e.fontSize||14;if(oH(a)?o=e.fontSizeRange:a=function(e){return oH(e)?e:()=>e}(a),o){const e=a,t=Rq("sqrt")().domain(function(e,t){let n,i,r,s,o=0;if(e&&(n=e.length))if(null==t){for(i=e[o];o<n&&(null==i||i!=i);i=e[++o]);for(r=s=i;o<n;++o)i=e[o],null!=i&&(i<r&&(r=i),i>s&&(s=i))}else{for(i=t(e[o]);o<n&&(null==i||i!=i);i=t(e[++o]));for(r=s=i;o<n;++o)i=t(e[o]),null!=i&&(i<r&&(r=i),i>s&&(s=i))}return[r,s]}(i,e)).range(o);a=n=>t(e(n))}i.forEach(e=>{e[s[0]]=NaN,e[s[1]]=NaN,e[s[3]]=0});const l=r.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(a).random(Pq).layout(),u=r.size(),c=u[0]>>1,d=u[1]>>1,h=l.length;for(let e,t,n=0;n<h;++n)e=l[n],t=e.datum,t[s[0]]=e.x+c,t[s[1]]=e.y+d,t[s[2]]=e.font,t[s[3]]=e.size,t[s[4]]=e.style,t[s[5]]=e.weight,t[s[6]]=e.rotate;return t.reflow(n).modifies(s)}});const Qq=e=>new Uint8Array(e),Jq=e=>new Uint16Array(e),eK=e=>new Uint32Array(e);function tK(e,t,n){const i=(t<257?Qq:t<65537?Jq:eK)(e);return n&&i.set(n),i}function nK(e,t,n){const i=1<<t;return{one:i,zero:~i,range:n.slice(),bisect:e.bisect,index:e.index,size:e.size,onAdd(e,t){const n=this,r=n.bisect(n.range,e.value),s=e.index,o=r[0],a=r[1],l=s.length;let u;for(u=0;u<o;++u)t[s[u]]|=i;for(u=a;u<l;++u)t[s[u]]|=i;return n}}}function iK(){let e=eK(0),t=[],n=0;return{insert:function(i,r,s){if(!r.length)return[];const o=n,a=r.length,l=eK(a);let u,c,d,h=Array(a);for(d=0;d<a;++d)h[d]=i(r[d]),l[d]=d;if(h=function(e,t){return e.sort.call(t,(t,n)=>{const i=e[t],r=e[n];return i<r?-1:i>r?1:0}),function(e,t){return Array.from(t,t=>e[t])}(e,t)}(h,l),o)u=t,c=e,t=Array(o+a),e=eK(o+a),function(e,t,n,i,r,s,o,a,l){let u,c=0,d=0;for(u=0;c<i&&d<o;++u)t[c]<r[d]?(a[u]=t[c],l[u]=n[c++]):(a[u]=r[d],l[u]=s[d++]+e);for(;c<i;++c,++u)a[u]=t[c],l[u]=n[c];for(;d<o;++d,++u)a[u]=r[d],l[u]=s[d]+e}(s,u,c,o,h,l,a,t,e);else{if(s>0)for(d=0;d<a;++d)l[d]+=s;t=h,e=l}return n=o+a,{index:l,value:h}},remove:function(i,r){const s=n;let o,a,l;for(a=0;!r[e[a]]&&a<s;++a);for(l=a;a<s;++a)r[o=e[a]]||(e[l]=o,t[l]=t[a],++l);n=s-i},bisect:function(e,i){let r;return i?r=i.length:(i=t,r=n),[XA(i,e[0],0,r),WA(i,e[1],0,r)]},reindex:function(t){for(let i=0,r=n;i<r;++i)e[i]=t[e[i]]},index:()=>e,size:()=>n}}function rK(e){Ho.call(this,function(){let e=8,t=[],n=eK(0),i=tK(0,e),r=tK(0,e);return{data:()=>t,seen:()=>n=function(e,t,n){return e.length>=t?e:((n=n||new e.constructor(t)).set(e),n)}(n,t.length),add(e){for(let n,i=0,r=t.length,s=e.length;i<s;++i)n=e[i],n._index=r++,t.push(n)},remove(e,n){const s=t.length,o=Array(s-e),a=t;let l,u,c;for(u=0;!n[u]&&u<s;++u)o[u]=t[u],a[u]=u;for(c=u;u<s;++u)l=t[u],n[u]?a[u]=-1:(a[u]=c,i[c]=i[u],r[c]=r[u],o[c]=l,l._index=c++),i[u]=0;return t=o,a},size:()=>t.length,curr:()=>i,prev:()=>r,reset:e=>r[e]=i[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){i[e]|=t},clear(e,t){i[e]&=~t},resize(t,n){(t>i.length||n>e)&&(e=Math.max(n,e),i=tK(t,e,i),r=tK(t,e))}}}(),e),this._indices=null,this._dims=null}function sK(e){Ho.call(this,null,e)}function oK(e,t,n){return e.fields=t||[],e.fname=n,e}function aK(e){return 1===e.length?lK(e[0]):uK(e)}rK.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},pt(rK,Ho,{transform(e,t){return this._dims?e.modified("fields")||e.fields.some(e=>t.modified(e.fields))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){const n=e.fields,i=e.query,r=this._indices={},s=this._dims=[],o=i.length;let a,l,u=0;for(;u<o;++u)a=n[u].fname,l=r[a]||(r[a]=iK()),s.push(nK(l,u,i[u]));return this.eval(e,t)},reinit(e,t){const n=t.materialize().fork(),i=e.fields,r=e.query,s=this._indices,o=this._dims,a=this.value,l=a.curr(),u=a.prev(),c=a.all(),d=n.rem=n.add,h=n.mod,p=r.length,f={};let m,g,y,_,v,b,T,x,E;if(u.set(l),t.rem.length&&(v=this.remove(e,t,n)),t.add.length&&a.add(t.add),t.mod.length)for(b={},_=t.mod,T=0,x=_.length;T<x;++T)b[_[T]._index]=1;for(T=0;T<p;++T)E=i[T],(!o[T]||e.modified("fields",T)||t.modified(E.fields))&&(y=E.fname,(m=f[y])||(s[y]=g=iK(),f[y]=m=g.insert(E,t.source,0)),o[T]=nK(g,T,r[T]).onAdd(m,l));for(T=0,x=a.data().length;T<x;++T)v[T]||(u[T]!==l[T]?d.push(T):b[T]&&l[T]!==c&&h.push(T));return a.mask=(1<<p)-1,n},eval(e,t){const n=t.materialize().fork(),i=this._dims.length;let r=0;return t.rem.length&&(this.remove(e,t,n),r|=(1<<i)-1),e.modified("query")&&!e.modified("fields")&&(r|=this.update(e,t,n)),t.add.length&&(this.insert(e,t,n),r|=(1<<i)-1),t.mod.length&&(this.modify(t,n),r|=(1<<i)-1),this.value.mask=r,n},insert(e,t,n){const i=t.add,r=this.value,s=this._dims,o=this._indices,a=e.fields,l={},u=n.add,c=r.size()+i.length,d=s.length;let h,p,f,m=r.size();r.resize(c,d),r.add(i);const g=r.curr(),y=r.prev(),_=r.all();for(h=0;h<d;++h)p=a[h].fname,f=l[p]||(l[p]=o[p].insert(a[h],i,m)),s[h].onAdd(f,g);for(;m<c;++m)y[m]=_,g[m]!==_&&u.push(m)},modify(e,t){const n=t.mod,i=this.value,r=i.curr(),s=i.all(),o=e.mod;let a,l,u;for(a=0,l=o.length;a<l;++a)u=o[a]._index,r[u]!==s&&n.push(u)},remove(e,t,n){const i=this._indices,r=this.value,s=r.curr(),o=r.prev(),a=r.all(),l={},u=n.rem,c=t.rem;let d,h,p,f;for(d=0,h=c.length;d<h;++d)p=c[d]._index,l[p]=1,o[p]=f=s[p],s[p]=a,f!==a&&u.push(p);for(p in i)i[p].remove(h,l);return this.reindex(t,h,l),l},reindex(e,t,n){const i=this._indices,r=this.value;e.runAfter(()=>{const e=r.remove(t,n);for(const t in i)i[t].reindex(e)})},update(e,t,n){const i=this._dims,r=e.query,s=t.stamp,o=i.length;let a,l,u=0;for(n.filters=0,l=0;l<o;++l)e.modified("query",l)&&(a=l,++u);if(1===u)u=i[a].one,this.incrementOne(i[a],r[a],n.add,n.rem);else for(l=0,u=0;l<o;++l)e.modified("query",l)&&(u|=i[l].one,this.incrementAll(i[l],r[l],s,n.add),n.rem=n.add);return u},incrementAll(e,t,n,i){const r=this.value,s=r.seen(),o=r.curr(),a=r.prev(),l=e.index(),u=e.bisect(e.range),c=e.bisect(t),d=c[0],h=c[1],p=u[0],f=u[1],m=e.one;let g,y,_;if(d<p)for(g=d,y=Math.min(p,h);g<y;++g)_=l[g],s[_]!==n&&(a[_]=o[_],s[_]=n,i.push(_)),o[_]^=m;else if(d>p)for(g=p,y=Math.min(d,f);g<y;++g)_=l[g],s[_]!==n&&(a[_]=o[_],s[_]=n,i.push(_)),o[_]^=m;if(h>f)for(g=Math.max(d,f),y=h;g<y;++g)_=l[g],s[_]!==n&&(a[_]=o[_],s[_]=n,i.push(_)),o[_]^=m;else if(h<f)for(g=Math.max(p,h),y=f;g<y;++g)_=l[g],s[_]!==n&&(a[_]=o[_],s[_]=n,i.push(_)),o[_]^=m;e.range=t.slice()},incrementOne(e,t,n,i){const r=this.value.curr(),s=e.index(),o=e.bisect(e.range),a=e.bisect(t),l=a[0],u=a[1],c=o[0],d=o[1],h=e.one;let p,f,m;if(l<c)for(p=l,f=Math.min(c,u);p<f;++p)m=s[p],r[m]^=h,n.push(m);else if(l>c)for(p=c,f=Math.min(l,d);p<f;++p)m=s[p],r[m]^=h,i.push(m);if(u>d)for(p=Math.max(l,d),f=u;p<f;++p)m=s[p],r[m]^=h,n.push(m);else if(u<d)for(p=Math.max(c,u),f=d;p<f;++p)m=s[p],r[m]^=h,i.push(m);e.range=t.slice()}}),sK.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},pt(sK,Ho,{transform(e,t){const n=~(e.ignore||0),i=e.filter,r=i.mask;if(0===(r&n))return t.StopPropagation;const s=t.fork(t.ALL),o=i.data(),a=i.curr(),l=i.prev(),u=e=>a[e]&n?null:o[e];return s.filter(s.MOD,u),r&r-1?(s.filter(s.ADD,e=>{const t=a[e]&n;return!t&&t^l[e]&n?o[e]:null}),s.filter(s.REM,e=>{const t=a[e]&n;return t&&!(t^t^l[e]&n)?o[e]:null})):(s.filter(s.ADD,u),s.filter(s.REM,e=>(a[e]&n)===r?o[e]:null)),s.filter(s.SOURCE,e=>u(e._index))}});const lK=e=>function(t){return t[e]},uK=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function cK(e){throw Error(e)}function dK(e){const t=[],n=e.length;let i,r,s,o=null,a=0,l="";function u(){t.push(l+e.substring(i,r)),l="",i=r+1}for(e+="",i=r=0;r<n;++r)if(s=e[r],"\\"===s)l+=e.substring(i,r++),i=r;else if(s===o)u(),o=null,a=-1;else{if(o)continue;i===a&&'"'===s||i===a&&"'"===s?(i=r+1,o=s):"."!==s||a?"["===s?(r>i&&u(),a=i=r+1):"]"===s&&(a||cK("Access path missing open bracket: "+e),a>0&&u(),a=0,i=r+1):r>i?u():i=r+1}return a&&cK("Access path missing closing bracket: "+e),o&&cK("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function hK(e,t,n){const i=dK(e);return e=1===i.length?i[0]:e,oK((n&&n.get||aK)(i),[e],t||e)}hK("id");const pK=oK(e=>e,[],"identity"),fK=(oK(()=>0,[],"zero"),oK(()=>1,[],"one"),oK(()=>!0,[],"true"));oK(()=>!1,[],"false");var mK=Array.isArray;function gK(e){return e===Object(e)}function yK(e){return e[e.length-1]}function _K(e){return null==e||""===e?null:+e}const vK=e=>t=>e*Math.exp(t),bK=e=>t=>Math.log(e*t),TK=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),xK=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,EK=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function wK(e,t,n,i){const r=n(e[0]),s=n(yK(e)),o=(s-r)*t;return[i(r-o),i(s-o)]}function IK(e,t,n,i,r){const s=i(e[0]),o=i(yK(e)),a=null!=t?i(t):(s+o)/2;return[r(a+(s-a)*n),r(a+(o-a)*n)]}function AK(e){return null!=e?mK(e)?e:[e]:[]}function SK(e){return"function"==typeof e}function CK(e){for(let t,n,i=1,r=arguments.length;i<r;++i)for(n in t=arguments[i],t)e[n]=t[n];return e}function OK(e,t){return Object.hasOwn(e,t)}function MK(e){return"[object Date]"===Object.prototype.toString.call(e)}function RK(e){return"number"==typeof e}function kK(e){return"string"==typeof e}function NK(e,t){let n="";for(;--t>=0;)n+=e;return n}function DK(e){return mK(e)?"["+e.map(DK)+"]":gK(e)||kK(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}const FK=e=>RK(e)||MK(e)?e:Date.parse(e);function LK(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]]=!0;return t}const PK="Literal",BK="Property",$K="ArrayExpression",UK="BinaryExpression",zK="CallExpression",VK="ConditionalExpression",jK="LogicalExpression",YK="MemberExpression",GK="ObjectExpression",HK="UnaryExpression";function WK(e){this.type=e}var XK,qK,KK,ZK,QK;WK.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case $K:return e.elements;case UK:case jK:return[e.left,e.right];case zK:return[e.callee].concat(e.arguments);case VK:return[e.test,e.consequent,e.alternate];case YK:return[e.object,e.property];case GK:return e.properties;case BK:return[e.key,e.value];case HK:return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};var JK=1,eZ=2,tZ=3,nZ=4,iZ=5,rZ=6,sZ=7,oZ=8;(XK={})[JK]="Boolean",XK[eZ]="<end>",XK[tZ]="Identifier",XK[nZ]="Keyword",XK[iZ]="Null",XK[rZ]="Numeric",XK[sZ]="Punctuator",XK[oZ]="String",XK[9]="RegularExpression";var aZ="ArrayExpression",lZ="BinaryExpression",uZ="CallExpression",cZ="ConditionalExpression",dZ="Identifier",hZ="Literal",pZ="LogicalExpression",fZ="MemberExpression",mZ="ObjectExpression",gZ="Property",yZ="UnaryExpression",_Z="Unexpected token %0",vZ="Unexpected number",bZ="Unexpected string",TZ="Unexpected identifier",xZ="Unexpected reserved word",EZ="Unexpected end of input",wZ="Invalid regular expression",IZ="Invalid regular expression: missing /",AZ="Octal literals are not allowed in strict mode.",SZ="Duplicate data property in object literal not allowed in strict mode",CZ="ILLEGAL",OZ="Disabled.",MZ=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),RZ=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function kZ(e,t){if(!e)throw new Error("ASSERT: "+t)}function NZ(e){return e>=48&&e<=57}function DZ(e){return"0123456789abcdefABCDEF".includes(e)}function FZ(e){return"01234567".includes(e)}function LZ(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function PZ(e){return 10===e||13===e||8232===e||8233===e}function BZ(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&MZ.test(String.fromCharCode(e))}function $Z(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&RZ.test(String.fromCharCode(e))}const UZ={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function zZ(){for(;KK<ZK;){const e=qK.charCodeAt(KK);if(!LZ(e)&&!PZ(e))break;++KK}}function VZ(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)KK<ZK&&DZ(qK[KK])?(i=qK[KK++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):rQ({},_Z,CZ);return String.fromCharCode(r)}function jZ(){var e,t,n,i;for(t=0,"}"===(e=qK[KK])&&rQ({},_Z,CZ);KK<ZK&&DZ(e=qK[KK++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&rQ({},_Z,CZ),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function YZ(){var e,t;for(e=qK.charCodeAt(KK++),t=String.fromCharCode(e),92===e&&(117!==qK.charCodeAt(KK)&&rQ({},_Z,CZ),++KK,(e=VZ("u"))&&"\\"!==e&&BZ(e.charCodeAt(0))||rQ({},_Z,CZ),t=e);KK<ZK&&$Z(e=qK.charCodeAt(KK));)++KK,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==qK.charCodeAt(KK)&&rQ({},_Z,CZ),++KK,(e=VZ("u"))&&"\\"!==e&&$Z(e.charCodeAt(0))||rQ({},_Z,CZ),t+=e);return t}function GZ(){var e,t;return e=KK,t=92===qK.charCodeAt(KK)?YZ():function(){var e,t;for(e=KK++;KK<ZK;){if(92===(t=qK.charCodeAt(KK)))return KK=e,YZ();if(!$Z(t))break;++KK}return qK.slice(e,KK)}(),{type:1===t.length?tZ:UZ.hasOwnProperty(t)?nZ:"null"===t?iZ:"true"===t||"false"===t?JK:tZ,value:t,start:e,end:KK}}function HZ(){var e,t,n,i,r=KK,s=qK.charCodeAt(KK),o=qK[KK];switch(s){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++KK,{type:sZ,value:String.fromCharCode(s),start:r,end:KK};default:if(61===(e=qK.charCodeAt(KK+1)))switch(s){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return KK+=2,{type:sZ,value:String.fromCharCode(s)+String.fromCharCode(e),start:r,end:KK};case 33:case 61:return KK+=2,61===qK.charCodeAt(KK)&&++KK,{type:sZ,value:qK.slice(r,KK),start:r,end:KK}}}return">>>="===(i=qK.substr(KK,4))?{type:sZ,value:i,start:r,end:KK+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:sZ,value:n,start:r,end:KK+=3}:o===(t=n.substr(0,2))[1]&&"+-<>&|".includes(o)||"=>"===t?{type:sZ,value:t,start:r,end:KK+=2}:("//"===t&&rQ({},_Z,CZ),"<>=!+-*%&|^/".includes(o)?(++KK,{type:sZ,value:o,start:r,end:KK}):void rQ({},_Z,CZ))}function WZ(){var e,t,n;if(kZ(NZ((n=qK[KK]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=KK,e="","."!==n){if(e=qK[KK++],n=qK[KK],"0"===e){if("x"===n||"X"===n)return++KK,function(e){let t="";for(;KK<ZK&&DZ(qK[KK]);)t+=qK[KK++];return 0===t.length&&rQ({},_Z,CZ),BZ(qK.charCodeAt(KK))&&rQ({},_Z,CZ),{type:rZ,value:parseInt("0x"+t,16),start:e,end:KK}}(t);if(FZ(n))return function(e){let t="0"+qK[KK++];for(;KK<ZK&&FZ(qK[KK]);)t+=qK[KK++];return(BZ(qK.charCodeAt(KK))||NZ(qK.charCodeAt(KK)))&&rQ({},_Z,CZ),{type:rZ,value:parseInt(t,8),octal:!0,start:e,end:KK}}(t);n&&NZ(n.charCodeAt(0))&&rQ({},_Z,CZ)}for(;NZ(qK.charCodeAt(KK));)e+=qK[KK++];n=qK[KK]}if("."===n){for(e+=qK[KK++];NZ(qK.charCodeAt(KK));)e+=qK[KK++];n=qK[KK]}if("e"===n||"E"===n)if(e+=qK[KK++],"+"!==(n=qK[KK])&&"-"!==n||(e+=qK[KK++]),NZ(qK.charCodeAt(KK)))for(;NZ(qK.charCodeAt(KK));)e+=qK[KK++];else rQ({},_Z,CZ);return BZ(qK.charCodeAt(KK))&&rQ({},_Z,CZ),{type:rZ,value:parseFloat(e),start:t,end:KK}}function XZ(){var e,t,n,i;return QK=null,zZ(),e=KK,t=function(){var e,t,n,i;for(kZ("/"===(e=qK[KK]),"Regular expression literal must start with a slash"),t=qK[KK++],n=!1,i=!1;KK<ZK;)if(t+=e=qK[KK++],"\\"===e)PZ((e=qK[KK++]).charCodeAt(0))&&rQ({},IZ),t+=e;else if(PZ(e.charCodeAt(0)))rQ({},IZ);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||rQ({},IZ),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";KK<ZK&&$Z((e=qK[KK]).charCodeAt(0));)++KK,"\\"===e&&KK<ZK?rQ({},_Z,CZ):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&rQ({},wZ,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(e,t)=>{if(parseInt(t,16)<=1114111)return"x";rQ({},wZ)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){rQ({},wZ)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:KK}}function qZ(){if(zZ(),KK>=ZK)return{type:eZ,start:KK,end:KK};const e=qK.charCodeAt(KK);return BZ(e)?GZ():40===e||41===e||59===e?HZ():39===e||34===e?function(){var e,t,n,i,r="",s=!1;for(kZ("'"===(e=qK[KK])||'"'===e,"String literal must starts with a quote"),t=KK,++KK;KK<ZK;){if((n=qK[KK++])===e){e="";break}if("\\"===n)if((n=qK[KK++])&&PZ(n.charCodeAt(0)))"\r"===n&&"\n"===qK[KK]&&++KK;else switch(n){case"u":case"x":"{"===qK[KK]?(++KK,r+=jZ()):r+=VZ(n);break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:FZ(n)?(0!==(i="01234567".indexOf(n))&&(s=!0),KK<ZK&&FZ(qK[KK])&&(s=!0,i=8*i+"01234567".indexOf(qK[KK++]),"0123".includes(n)&&KK<ZK&&FZ(qK[KK])&&(i=8*i+"01234567".indexOf(qK[KK++]))),r+=String.fromCharCode(i)):r+=n}else{if(PZ(n.charCodeAt(0)))break;r+=n}}return""!==e&&rQ({},_Z,CZ),{type:oZ,value:r,octal:s,start:t,end:KK}}():46===e?NZ(qK.charCodeAt(KK+1))?WZ():HZ():NZ(e)?WZ():HZ()}function KZ(){const e=QK;return KK=e.end,QK=qZ(),KK=e.end,e}function ZZ(){const e=KK;QK=qZ(),KK=e}function QZ(e,t,n){const i=new WK("||"===e||"&&"===e?pZ:lZ);return i.operator=e,i.left=t,i.right=n,i}function JZ(e,t){const n=new WK(uZ);return n.callee=e,n.arguments=t,n}function eQ(e){const t=new WK(dZ);return t.name=e,t}function tQ(e){const t=new WK(hZ);return t.value=e.value,t.raw=qK.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function nQ(e,t,n){const i=new WK(fZ);return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function iQ(e,t,n){const i=new WK(gZ);return i.key=t,i.value=n,i.kind=e,i}function rQ(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,(e,t)=>(kZ(t<i.length,"Message reference must be in range"),i[t]));throw(n=new Error(r)).index=KK,n.description=r,n}function sQ(e){e.type===eZ&&rQ(e,EZ),e.type===rZ&&rQ(e,vZ),e.type===oZ&&rQ(e,bZ),e.type===tZ&&rQ(e,TZ),e.type===nZ&&rQ(e,xZ),rQ(e,_Z,e.value)}function oQ(e){const t=KZ();t.type===sZ&&t.value===e||sQ(t)}function aQ(e){return QK.type===sZ&&QK.value===e}function lQ(e){return QK.type===nZ&&QK.value===e}function uQ(){const e=[];for(KK=QK.start,oQ("[");!aQ("]");)aQ(",")?(KZ(),e.push(null)):(e.push(xQ()),aQ("]")||oQ(","));return KZ(),function(e){const t=new WK(aZ);return t.elements=e,t}(e)}function cQ(){KK=QK.start;const e=KZ();return e.type===oZ||e.type===rZ?(e.octal&&rQ(e,AZ),tQ(e)):eQ(e.value)}function dQ(){var e,t,n;return KK=QK.start,(e=QK).type===tZ?(n=cQ(),oQ(":"),iQ("init",n,xQ())):e.type!==eZ&&e.type!==sZ?(t=cQ(),oQ(":"),iQ("init",t,xQ())):void sQ(e)}function hQ(){var e,t,n=[],i={},r=String;for(KK=QK.start,oQ("{");!aQ("}");)t="$"+((e=dQ()).key.type===dZ?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?rQ({},SZ):i[t]=!0,n.push(e),aQ("}")||oQ(",");return oQ("}"),function(e){const t=new WK(mZ);return t.properties=e,t}(n)}const pQ={if:1};function fQ(){var e,t,n;if(aQ("("))return function(){oQ("(");const e=EQ();return oQ(")"),e}();if(aQ("["))return uQ();if(aQ("{"))return hQ();if(e=QK.type,KK=QK.start,e===tZ||pQ[QK.value])n=eQ(KZ().value);else if(e===oZ||e===rZ)QK.octal&&rQ(QK,AZ),n=tQ(KZ());else{if(e===nZ)throw new Error(OZ);e===JK?((t=KZ()).value="true"===t.value,n=tQ(t)):e===iZ?((t=KZ()).value=null,n=tQ(t)):aQ("/")||aQ("/=")?(n=tQ(XZ()),ZZ()):sQ(KZ())}return n}function mQ(){const e=[];if(oQ("("),!aQ(")"))for(;KK<ZK&&(e.push(xQ()),!aQ(")"));)oQ(",");return oQ(")"),e}function gQ(){KK=QK.start;const e=KZ();return function(e){return e.type===tZ||e.type===nZ||e.type===JK||e.type===iZ}(e)||sQ(e),eQ(e.value)}function yQ(){return oQ("."),gQ()}function _Q(){oQ("[");const e=EQ();return oQ("]"),e}function vQ(){const e=function(){var e;for(e=fQ();;)if(aQ("."))e=nQ(".",e,yQ());else if(aQ("("))e=JZ(e,mQ());else{if(!aQ("["))break;e=nQ("[",e,_Q())}return e}();if(QK.type===sZ&&(aQ("++")||aQ("--")))throw new Error(OZ);return e}function bQ(){var e,t;if(QK.type!==sZ&&QK.type!==nZ)t=vQ();else{if(aQ("++")||aQ("--"))throw new Error(OZ);if(aQ("+")||aQ("-")||aQ("~")||aQ("!"))e=KZ(),t=bQ(),t=function(e,t){const n=new WK(yZ);return n.operator=e,n.argument=t,n.prefix=!0,n}(e.value,t);else{if(lQ("delete")||lQ("void")||lQ("typeof"))throw new Error(OZ);t=vQ()}}return t}function TQ(e){let t=0;if(e.type!==sZ&&e.type!==nZ)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function xQ(){var e,t;return e=function(){var e,t,n,i,r,s,o,a,l,u;if(e=QK,l=bQ(),0===(r=TQ(i=QK)))return l;for(i.prec=r,KZ(),t=[e,QK],s=[l,i,o=bQ()];(r=TQ(QK))>0;){for(;s.length>2&&r<=s[s.length-2].prec;)o=s.pop(),a=s.pop().value,l=s.pop(),t.pop(),n=QZ(a,l,o),s.push(n);(i=KZ()).prec=r,s.push(i),t.push(QK),n=bQ(),s.push(n)}for(n=s[u=s.length-1],t.pop();u>1;)t.pop(),n=QZ(s[u-1].value,s[u-2],n),u-=2;return n}(),aQ("?")&&(KZ(),t=xQ(),oQ(":"),e=function(e,t,n){const i=new WK(cZ);return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,xQ())),e}function EQ(){const e=xQ();if(aQ(","))throw new Error(OZ);return e}var wQ={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function IQ(e){function t(t,n,i){return r=>function(t,n,i,r){let s=e(n[0]);return i&&(s=i+"("+s+")",0===i.lastIndexOf("new ",0)&&(s="("+s+")")),s+"."+t+(r<0?"":0===r?"()":"("+n.slice(1).map(e).join(",")+")")}(t,r,n,i)}const n="new Date",i="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(t){t.length<3&&cK("Missing arguments to clamp function."),t.length>3&&cK("Too many arguments to clamp function.");const n=t.map(e);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",i,0),lower:t("toLowerCase",i,0),substring:t("substring",i),split:t("split",i),trim:t("trim",i,0),btoa:"btoa",atob:"atob",regexp:r,test:t("test",r),if:function(t){t.length<3&&cK("Missing arguments to if function."),t.length>3&&cK("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}var AQ,SQ,CQ,OQ,MQ,RQ,kQ,NQ,DQ,FQ,LQ,PQ,BQ,$Q,UQ,zQ,VQ=new ik,jQ=new ik,YQ={point:Sk,lineStart:Sk,lineEnd:Sk,polygonStart:function(){VQ=new ik,YQ.lineStart=GQ,YQ.lineEnd=HQ},polygonEnd:function(){var e=+VQ;jQ.add(e<0?uk+e:e),this.lineStart=this.lineEnd=this.point=Sk},sphere:function(){jQ.add(uk)}};function GQ(){YQ.point=WQ}function HQ(){XQ(AQ,SQ)}function WQ(e,t){YQ.point=XQ,AQ=e,SQ=t,CQ=e*=dk,OQ=mk(t=(t*=dk)/2+lk),MQ=Tk(t)}function XQ(e,t){var n=(e*=dk)-CQ,i=n>=0?1:-1,r=i*n,s=mk(t=(t*=dk)/2+lk),o=Tk(t),a=MQ*o,l=OQ*s+a*mk(r),u=a*i*Tk(r);VQ.add(fk(u,l)),CQ=e,OQ=s,MQ=o}var qQ,KQ,ZQ,QQ,JQ,eJ,tJ,nJ,iJ,rJ,sJ,oJ,aJ,lJ,uJ,cJ,dJ={point:hJ,lineStart:fJ,lineEnd:mJ,polygonStart:function(){dJ.point=gJ,dJ.lineStart=yJ,dJ.lineEnd=_J,$Q=new ik,YQ.polygonStart()},polygonEnd:function(){YQ.polygonEnd(),dJ.point=hJ,dJ.lineStart=fJ,dJ.lineEnd=mJ,VQ<0?(RQ=-(NQ=180),kQ=-(DQ=90)):$Q>rk?DQ=90:$Q<-rk&&(kQ=-90),zQ[0]=RQ,zQ[1]=NQ},sphere:function(){RQ=-(NQ=180),kQ=-(DQ=90)}};function hJ(e,t){UQ.push(zQ=[RQ=e,NQ=e]),t<kQ&&(kQ=t),t>DQ&&(DQ=t)}function pJ(e,t){var n=LN([e*dk,t*dk]);if(BQ){var i=BN(BQ,n),r=BN([i[1],-i[0],0],i);zN(r),r=FN(r);var s,o=e-FQ,a=o>0?1:-1,l=r[0]*ck*a,u=hk(o)>180;u^(a*FQ<l&&l<a*e)?(s=r[1]*ck)>DQ&&(DQ=s):u^(a*FQ<(l=(l+360)%360-180)&&l<a*e)?(s=-r[1]*ck)<kQ&&(kQ=s):(t<kQ&&(kQ=t),t>DQ&&(DQ=t)),u?e<FQ?vJ(RQ,e)>vJ(RQ,NQ)&&(NQ=e):vJ(e,NQ)>vJ(RQ,NQ)&&(RQ=e):NQ>=RQ?(e<RQ&&(RQ=e),e>NQ&&(NQ=e)):e>FQ?vJ(RQ,e)>vJ(RQ,NQ)&&(NQ=e):vJ(e,NQ)>vJ(RQ,NQ)&&(RQ=e)}else UQ.push(zQ=[RQ=e,NQ=e]);t<kQ&&(kQ=t),t>DQ&&(DQ=t),BQ=n,FQ=e}function fJ(){dJ.point=pJ}function mJ(){zQ[0]=RQ,zQ[1]=NQ,dJ.point=hJ,BQ=null}function gJ(e,t){if(BQ){var n=e-FQ;$Q.add(hk(n)>180?n+(n>0?360:-360):n)}else LQ=e,PQ=t;YQ.point(e,t),pJ(e,t)}function yJ(){YQ.lineStart()}function _J(){gJ(LQ,PQ),YQ.lineEnd(),hk($Q)>rk&&(RQ=-(NQ=180)),zQ[0]=RQ,zQ[1]=NQ,BQ=null}function vJ(e,t){return(t-=e)<0?t+360:t}function bJ(e,t){return e[0]-t[0]}function TJ(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var xJ={sphere:Sk,point:EJ,lineStart:IJ,lineEnd:CJ,polygonStart:function(){xJ.lineStart=OJ,xJ.lineEnd=MJ},polygonEnd:function(){xJ.lineStart=IJ,xJ.lineEnd=CJ}};function EJ(e,t){e*=dk;var n=mk(t*=dk);wJ(n*mk(e),n*Tk(e),Tk(t))}function wJ(e,t,n){++qQ,ZQ+=(e-ZQ)/qQ,QQ+=(t-QQ)/qQ,JQ+=(n-JQ)/qQ}function IJ(){xJ.point=AJ}function AJ(e,t){e*=dk;var n=mk(t*=dk);lJ=n*mk(e),uJ=n*Tk(e),cJ=Tk(t),xJ.point=SJ,wJ(lJ,uJ,cJ)}function SJ(e,t){e*=dk;var n=mk(t*=dk),i=n*mk(e),r=n*Tk(e),s=Tk(t),o=fk(Ek((o=uJ*s-cJ*r)*o+(o=cJ*i-lJ*s)*o+(o=lJ*r-uJ*i)*o),lJ*i+uJ*r+cJ*s);KQ+=o,eJ+=o*(lJ+(lJ=i)),tJ+=o*(uJ+(uJ=r)),nJ+=o*(cJ+(cJ=s)),wJ(lJ,uJ,cJ)}function CJ(){xJ.point=EJ}function OJ(){xJ.point=RJ}function MJ(){kJ(oJ,aJ),xJ.point=EJ}function RJ(e,t){oJ=e,aJ=t,e*=dk,t*=dk,xJ.point=kJ;var n=mk(t);lJ=n*mk(e),uJ=n*Tk(e),cJ=Tk(t),wJ(lJ,uJ,cJ)}function kJ(e,t){e*=dk;var n=mk(t*=dk),i=n*mk(e),r=n*Tk(e),s=Tk(t),o=uJ*s-cJ*r,a=cJ*i-lJ*s,l=lJ*r-uJ*i,u=_k(o,a,l),c=Ak(u),d=u&&-c/u;iJ.add(d*o),rJ.add(d*a),sJ.add(d*l),KQ+=c,eJ+=c*(lJ+(lJ=i)),tJ+=c*(uJ+(uJ=r)),nJ+=c*(cJ+(cJ=s)),wJ(lJ,uJ,cJ)}function NJ(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function DJ(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function FJ(){return 0}function LJ(e){return e instanceof iv?e:new iv(e)}function PJ(e,t,n){return e.fields=t||[],e.fname=n,e}function BJ(e){return 1===e.length?$J(e[0]):UJ(e)}const $J=e=>function(t){return t[e]},UJ=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function zJ(e){throw Error(e)}function VJ(e){const t=[],n=e.length;let i,r,s,o=null,a=0,l="";function u(){t.push(l+e.substring(i,r)),l="",i=r+1}for(e+="",i=r=0;r<n;++r)if(s=e[r],"\\"===s)l+=e.substring(i,r++),i=r;else if(s===o)u(),o=null,a=-1;else{if(o)continue;i===a&&'"'===s||i===a&&"'"===s?(i=r+1,o=s):"."!==s||a?"["===s?(r>i&&u(),a=i=r+1):"]"===s&&(a||zJ("Access path missing open bracket: "+e),a>0&&u(),a=0,i=r+1):r>i?u():i=r+1}return a&&zJ("Access path missing closing bracket: "+e),o&&zJ("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function jJ(e,t,n){const i=VJ(e);return e=1===i.length?i[0]:e,PJ((n&&n.get||BJ)(i),[e],t||e)}jJ("id"),PJ(e=>e,[],"identity"),PJ(()=>0,[],"zero"),PJ(()=>1,[],"one"),PJ(()=>!0,[],"true"),PJ(()=>!1,[],"false");var YJ=Array.isArray;function GJ(e){return e[e.length-1]}function HJ(e){return null==e||""===e?null:+e}function WJ(e){return null!=e?YJ(e)?e:[e]:[]}function XJ(e){for(let t,n,i=1,r=arguments.length;i<r;++i)for(n in t=arguments[i],t)e[n]=t[n];return e}function qJ(e,t){return Object.hasOwn(e,t)}function KJ(e,t,n,i){let r,s=t[0],o=t[t.length-1];return s>o&&(r=s,s=o,o=r),i=void 0===i||i,((n=void 0===n||n)?s<=e:s<e)&&(i?e<=o:e<o)}function ZJ(e){return"[object Date]"===Object.prototype.toString.call(e)}const QJ="Literal",JJ="Property",e0="ArrayExpression",t0="BinaryExpression",n0="CallExpression",i0="ConditionalExpression",r0="LogicalExpression",s0="MemberExpression",o0="ObjectExpression",a0="UnaryExpression";function l0(e){this.type=e}var u0;l0.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case e0:return e.elements;case t0:case r0:return[e.left,e.right];case n0:return[e.callee].concat(e.arguments);case i0:return[e.test,e.consequent,e.alternate];case s0:return[e.object,e.property];case o0:return e.properties;case JJ:return[e.key,e.value];case a0:return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};(u0={})[1]="Boolean",u0[2]="<end>",u0[3]="Identifier",u0[4]="Keyword",u0[5]="Null",u0[6]="Numeric",u0[7]="Punctuator",u0[8]="String",u0[9]="RegularExpression";const c0=Symbol("vega_selection_getter");function d0(e){return e.getter&&e.getter[c0]||(e.getter=jJ(e.field),e.getter[c0]=!0),e.getter}const h0="intersect",p0="union",f0="or",m0="and",g0="_vgsid_",y0=jJ(g0),_0="index:unit";function v0(e,t){for(var n,i,r=t.fields,s=t.values,o=r.length,a=0;a<o;++a)if(ZJ(n=d0(i=r[a])(e))&&(n=HJ(n)),ZJ(s[a])&&(s[a]=HJ(s[a])),YJ(s[a])&&ZJ(s[a][0])&&(s[a]=s[a].map(HJ)),"E"===i.type){if(YJ(s[a])?!s[a].includes(n):n!==s[a])return!1}else if("R"===i.type){if(!KJ(n,s[a]))return!1}else if("R-RE"===i.type){if(!KJ(n,s[a],!0,!1))return!1}else if("R-E"===i.type){if(!KJ(n,s[a],!1,!1))return!1}else if("R-LE"===i.type){if(!KJ(n,s[a],!1,!0))return!1}else if("E-LT"===i.type){if(n>=s[a])return!1}else if("E-LTE"===i.type){if(n>s[a])return!1}else if("E-GT"===i.type){if(n<=s[a])return!1}else if("E-GTE"===i.type){if(n<s[a])return!1}else if("E-VALID"===i.type){if(null===n||isNaN(n))return!1}else if("E-ONE"===i.type&&-1===s[a].indexOf(n))return!1;return!0}const b0=function(e){let t,n,i;function r(e,i,r=0,s=e.length){if(r<s){if(0!==t(i,i))return s;do{const t=r+s>>>1;n(e[t],i)<0?r=t+1:s=t}while(r<s)}return r}return 2!==e.length?(t=NJ,n=(t,n)=>NJ(e(t),n),i=(t,n)=>e(t)-n):(t=e===NJ||e===DJ?e:FJ,n=e,i=e),{left:r,center:function(e,t,n=0,s=e.length){const o=r(e,t,n,s-1);return o>n&&i(e[o-1],t)>-i(e[o],t)?o-1:o},right:function(e,i,r=0,s=e.length){if(r<s){if(0!==t(i,i))return s;do{const t=r+s>>>1;n(e[t],i)<=0?r=t+1:s=t}while(r<s)}return r}}}(y0),T0=b0.left,x0=b0.right;var E0={[`${g0}_union`]:function(...e){const t=new iv;for(const n of e)for(const e of n)t.add(e);return t},[`${g0}_intersect`]:function(e,...t){e=new iv(e),t=t.map(LJ);e:for(const n of e)for(const i of t)if(!i.has(n)){e.delete(n);continue e}return e},E_union:function(e,t){if(!e.length)return t;for(var n=0,i=t.length;n<i;++n)e.includes(t[n])||e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter(e=>t.includes(e)):t},R_union:function(e,t){var n=HJ(t[0]),i=HJ(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<i&&(e[1]=i),e):[n,i]},R_intersect:function(e,t){var n=HJ(t[0]),i=HJ(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?i<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>i&&(e[1]=i),e):[n,i]}};function w0(e,t,n,i){t[0].type!==QJ&&zJ("First argument to selection functions must be a string literal.");const r=t[0].value,s="unit",o="@"+s,a=":"+r;(t.length>=2&&GJ(t).value)!==h0||qJ(i,o)||(i[o]=n.getData(r).indataRef(n,s)),qJ(i,a)||(i[a]=n.getData(r).tuplesRef())}function I0(e){const t=this.context.data[e];return t?t.values.value:[]}const A0=e=>function(t,n){return this.context.dataflow.locale()[e](n)(t)},S0=A0("format"),C0=A0("timeFormat"),O0=A0("utcFormat"),M0=A0("timeParse"),R0=A0("utcParse"),k0=new Date(2e3,0,1);function N0(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(k0.setYear(2e3),k0.setMonth(e),k0.setDate(t),C0.call(this,k0,n)):""}const D0="$";function F0(e,t,n,i){t[0].type!==PK&&cK("First argument to data functions must be a string literal.");const r=t[0].value,s=":"+r;if(!OK(s,i))try{i[s]=n.getData(r).tuplesRef()}catch(e){}}function L0(e,t,n,i){if(t[0].type===PK)P0(n,i,t[0].value);else for(e in n.scales)P0(n,i,e)}function P0(e,t,n){const i="%"+n;if(!OK(t,i))try{t[i]=e.scaleRef(n)}catch(e){}}function B0(e,t){let n;return SK(e)?e:kK(e)?(n=t.scales[e])&&n.value:void 0}function $0(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=L0,n._range=L0,n._scale=L0;const i=t=>"_["+(t.type===PK?DK("%"+t.value):DK("%")+"+"+e(t))+"]";return{_bandwidth:e=>`this.__bandwidth(${i(e[0])})`,_range:e=>`${i(e[0])}.range()`,_scale:t=>`${i(t[0])}(${e(t[1])})`}}function U0(e,t){return function(n,i,r){if(n){const t=B0(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const z0=U0("area",function(e){return jQ=new ik,nk(e,YQ),2*jQ}),V0=U0("bounds",function(e){var t,n,i,r,s,o,a;if(DQ=NQ=-(RQ=kQ=1/0),UQ=[],nk(e,dJ),n=UQ.length){for(UQ.sort(bJ),t=1,s=[i=UQ[0]];t<n;++t)TJ(i,(r=UQ[t])[0])||TJ(i,r[1])?(vJ(i[0],r[1])>vJ(i[0],i[1])&&(i[1]=r[1]),vJ(r[0],i[1])>vJ(i[0],i[1])&&(i[0]=r[0])):s.push(i=r);for(o=-1/0,t=0,i=s[n=s.length-1];t<=n;i=r,++t)r=s[t],(a=vJ(i[1],r[0]))>o&&(o=a,RQ=r[0],NQ=i[1])}return UQ=zQ=null,RQ===1/0||kQ===1/0?[[NaN,NaN],[NaN,NaN]]:[[RQ,kQ],[NQ,DQ]]}),j0=U0("centroid",function(e){qQ=KQ=ZQ=QQ=JQ=eJ=tJ=nJ=0,iJ=new ik,rJ=new ik,sJ=new ik,nk(e,xJ);var t=+iJ,n=+rJ,i=+sJ,r=_k(t,n,i);return r<sk&&(t=eJ,n=tJ,i=nJ,KQ<rk&&(t=ZQ,n=QQ,i=JQ),(r=_k(t,n,i))<sk)?[NaN,NaN]:[fk(n,t)*ck,Ak(i/r)*ck]});function Y0(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function G0(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function H0(e){const t=Ry(e);return.2126*G0(t.r)+.7152*G0(t.g)+.0722*G0(t.b)}function W0(e,t){return e===t||e!=e&&t!=t||(mK(e)?!(!mK(t)||e.length!==t.length)&&function(e,t){for(let n=0,i=e.length;n<i;++n)if(!W0(e[n],t[n]))return!1;return!0}(e,t):!(!gK(e)||!gK(t))&&X0(e,t))}function X0(e,t){for(const n in e)if(!W0(e[n],t[n]))return!1;return!0}function q0(e){return t=>X0(e,t)}const K0={};function Z0(e){return mK(e)||ArrayBuffer.isView(e)?e:null}function Q0(e){return Z0(e)||(kK(e)?e:null)}const J0=e=>e.data;function e1(e,t){const n=I0.call(t,e);return n.root&&n.root.lookup||{}}const t1=()=>"undefined"!=typeof window&&window||null;const n1={random:()=>ca(),cumulativeNormal:Ta,cumulativeLogNormal:Sa,cumulativeUniform:Na,densityNormal:ba,densityLogNormal:Aa,densityUniform:ka,quantileNormal:xa,quantileLogNormal:Ca,quantileUniform:Da,sampleNormal:va,sampleLogNormal:Ia,sampleUniform:Ra,isArray:mK,isBoolean:function(e){return"boolean"==typeof e},isDate:MK,isDefined:e=>void 0!==e,isNumber:RK,isObject:gK,isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isString:kK,isTuple:ho,isValid:e=>null!=e&&e==e,toBoolean:function(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e)&&!!e},toDate:function(e,t){return t=t||FK,null==e||""===e?null:t(e)},toNumber:_K,toString:function(e){return null==e||""===e?null:e+""},indexof:function(e,...t){return Q0(e).indexOf(...t)},join:function(e,...t){return Z0(e).join(...t)},lastindexof:function(e,...t){return Q0(e).lastIndexOf(...t)},replace:function(e,t,n){return SK(n)&&cK("Function argument passed to replace."),String(e).replace(t,n)},reverse:function(e){return Z0(e).slice().reverse()},slice:function(e,...t){return Q0(e).slice(...t)},flush:function(e,t,n,i,r,s){if(!n&&0!==n)return s;const o=+n;let a,l=e[0],u=yK(e);u<l&&(a=l,l=u,u=a),a=Math.abs(t-l);const c=Math.abs(u-t);return a<c&&a<=o?i:c<=o?r:s},lerp:function(e,t){const n=e[0],i=yK(e),r=+t;return r?1===r?i:n+r*(i-n):n},merge:function(){const e=[].slice.call(arguments);return e.unshift({}),CK(...e)},pad:function(e,t,n,i){const r=n||" ",s=e+"",o=t-s.length;return o<=0?s:"left"===i?NK(r,o)+s:"center"===i?NK(r,~~(o/2))+s+NK(r,Math.ceil(o/2)):s+NK(r,o)},peek:yK,pluck:function(e,t){const n=K0[t]||(K0[t]=hK(t));return mK(e)?e.map(n):n(e)},span:function(e){return e&&yK(e)-e[0]||0},inrange:function(e,t,n,i){let r,s=t[0],o=t[t.length-1];return s>o&&(r=s,s=o,o=r),i=void 0===i||i,((n=void 0===n||n)?s<=e:s<e)&&(i?e<=o:e<o)},truncate:function(e,t,n,i){const r=null!=i?i:"…",s=e+"",o=s.length,a=Math.max(0,t-r.length);return o<=t?s:"left"===n?r+s.slice(o-a):"center"===n?s.slice(0,Math.ceil(a/2))+r+s.slice(o-~~(a/2)):s.slice(0,a)+r},rgb:Ry,lab:Dv,hcl:zv,hsl:By,luminance:H0,contrast:function(e,t){const n=H0(e),i=H0(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)},sequence:tl,format:S0,utcFormat:O0,utcParse:R0,utcOffset:qu,utcSequence:Qu,timeFormat:C0,timeParse:M0,timeOffset:Xu,timeSequence:Zu,timeUnitSpecifier:bu,monthFormat:function(e){return N0.call(this,e,1,"%B")},monthAbbrevFormat:function(e){return N0.call(this,e,1,"%b")},dayFormat:function(e){return N0.call(this,0,2+e,"%A")},dayAbbrevFormat:function(e){return N0.call(this,0,2+e,"%a")},quarter:function(e){return 1+~~(new Date(e).getMonth()/3)},utcquarter:function(e){return 1+~~(new Date(e).getUTCMonth()/3)},week:wu,utcweek:Mu,dayofyear:Eu,utcdayofyear:Ou,warn:function(){return Y0(this.context.dataflow,"warn",arguments)},info:function(){return Y0(this.context.dataflow,"info",arguments)},debug:function(){return Y0(this.context.dataflow,"debug",arguments)},extent:function(e,t){let n,i,r,s,o=0;if(e&&(n=e.length))if(null==t){for(i=e[o];o<n&&(null==i||i!=i);i=e[++o]);for(r=s=i;o<n;++o)i=e[o],null!=i&&(i<r&&(r=i),i>s&&(s=i))}else{for(i=t(e[o]);o<n&&(null==i||i!=i);i=t(e[++o]));for(r=s=i;o<n;++o)i=t(e[o]),null!=i&&(i<r&&(r=i),i>s&&(s=i))}return[r,s]},inScope:function(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:function(e,t,n){if(!e)return[];const[i,r]=e,s=(new fz).set(i[0],i[1],r[0],r[1]);return YY(n||this.context.dataflow.scenegraph().root,s,function(e){let t=null;if(e){const n=AK(e.marktype),i=AK(e.markname);t=e=>(!n.length||n.some(t=>e.marktype===t))&&(!i.length||i.some(t=>e.name===t))}return t}(t))},clampRange:function(e,t,n){let i,r=e[0],s=e[1];return s<r&&(i=s,s=r,r=i),i=s-r,i>=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-i),r+i]},pinchDistance:function(e){const t=e.touches,n=t[0].clientX-t[1].clientX,i=t[0].clientY-t[1].clientY;return Math.sqrt(n*n+i*i)},pinchAngle:function(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){const e=t1();return e?e.screen:{}},containerSize:function(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){const e=t1();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return aM(e||0,t||0,n||0)},setdata:function(e,t){const n=this.context.dataflow,i=this.context.data[e].input;return n.pulse(i,n.changeset().remove(fK).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?PU(n,t=t||AU(e)):e}},panLinear:function(e,t){return wK(e,t,_K,pK)},panLog:function(e,t){var n=Math.sign(e[0]);return wK(e,t,bK(n),vK(n))},panPow:function(e,t,n){return wK(e,t,EK(n),EK(1/n))},panSymlog:function(e,t,n){return wK(e,t,TK(n),xK(n))},zoomLinear:function(e,t,n){return IK(e,t,n,_K,pK)},zoomLog:function(e,t,n){const i=Math.sign(e[0]);return IK(e,t,n,bK(i),vK(i))},zoomPow:function(e,t,n,i){return IK(e,t,n,EK(i),EK(1/i))},zoomSymlog:function(e,t,n,i){return IK(e,t,n,TK(i),xK(i))},encode:function(e,t,n){if(e){const n=this.context.dataflow,i=e.mark.source;n.pulse(i,n.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,i,r,s){const o=this.context.dataflow,a=this.context.data[e],l=a.input,u=o.stamp();let c,d,h=a.changes;if(!1===o._trigger||!(l.value.length||t||i))return 0;if((!h||h.stamp<u)&&(a.changes=h=o.changeset(),h.stamp=u,o.runAfter(()=>{a.modified=!0,o.pulse(l,h).run()},!0,1)),n&&(c=!0===n?fK:mK(n)||ho(n)?n:q0(n),h.remove(c)),t&&h.insert(t),i&&(c=q0(i),l.value.some(c)?h.remove(c):h.insert(i)),r)for(d in s)h.modify(r,d,s[d]);return 1}},i1=["view","item","group","xy","x","y"],r1="this.",s1={},o1={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${DK(D0+e)}]`,functions:function(e){const t=IQ(e);i1.forEach(e=>t[e]="event.vega."+e);for(const e in n1)t[e]=r1+e;return CK(t,$0(e,n1,s1)),t},constants:wQ,visitors:s1},a1=function(e){const t=(e=e||{}).allowed?LK(e.allowed):{},n=e.forbidden?LK(e.forbidden):{},i=e.constants||wQ,r=(e.functions||IQ)(d),s=e.globalvar,o=e.fieldvar,a=SK(s)?s:e=>`${s}["${e}"]`;let l={},u={},c=0;function d(e){if(kK(e))return e;const t=h[e.type];return null==t&&cK("Unsupported type: "+e.type),t(e)}const h={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return c>0?r:OK(n,r)?cK("Illegal identifier: "+r):OK(i,r)?i[r]:OK(t,r)?r:(l[r]=1,a(r))},MemberExpression:e=>{const t=!e.computed,n=d(e.object);t&&(c+=1);const i=d(e.property);return n===o&&(u[function(e){const t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(i)]=1),t&&(c-=1),n+(t?"."+i:"["+i+"]")},CallExpression:e=>{"Identifier"!==e.callee.type&&cK("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=OK(r,t)&&r[t];return i||cK("Unrecognized function: "+t),SK(i)?i(n):i+"("+n.map(d).join(",")+")"},ArrayExpression:e=>"["+e.elements.map(d).join(",")+"]",BinaryExpression:e=>"("+d(e.left)+" "+e.operator+" "+d(e.right)+")",UnaryExpression:e=>"("+e.operator+d(e.argument)+")",ConditionalExpression:e=>"("+d(e.test)+"?"+d(e.consequent)+":"+d(e.alternate)+")",LogicalExpression:e=>"("+d(e.left)+e.operator+d(e.right)+")",ObjectExpression:e=>"{"+e.properties.map(d).join(",")+"}",Property:e=>{c+=1;const t=d(e.key);return c-=1,t+":"+d(e.value)}};function p(e){const t={code:d(e),globals:Object.keys(l),fields:Object.keys(u)};return l={},u={},t}return p.functions=r,p.constants=i,p}(o1);function l1(e,t,n){return 1===arguments.length?n1[e]:(n1[e]=t,n&&(s1[e]=n),a1&&(a1.functions[e]=r1+e),this)}function u1(e,t){const n={};let i;try{i=function(e){KK=0,ZK=(qK=e).length,QK=null,ZZ();const t=EQ();if(QK.type!==eZ)throw new Error("Unexpect token after expression.");return t}(e=kK(e)?e:DK(e)+"")}catch(t){cK("Expression parse error: "+e)}i.visit(e=>{if(e.type!==zK)return;const i=e.callee.name,r=o1.visitors[i];r&&r(i,e.arguments,t,n)});const r=a1(i);return r.globals.forEach(e=>{const i=D0+e;!OK(n,i)&&t.getSignal(e)&&(n[i]=t.signalRef(e))}),{$expr:CK({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}function c1(e,t,n){return e.fields=t||[],e.fname=n,e}function d1(e){return 1===e.length?h1(e[0]):p1(e)}l1("bandwidth",function(e,t){const n=B0(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0},L0),l1("copy",function(e,t){const n=B0(e,(t||this).context);return n?n.copy():void 0},L0),l1("domain",function(e,t){const n=B0(e,(t||this).context);return n?n.domain():[]},L0),l1("range",function(e,t){const n=B0(e,(t||this).context);return n&&n.range?n.range():[]},L0),l1("invert",function(e,t,n){const i=B0(e,(n||this).context);return i?mK(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0},L0),l1("scale",function(e,t,n){const i=B0(e,(n||this).context);return i?i(t):void 0},L0),l1("gradient",function(e,t,n,i,r){e=B0(e,(r||this).context);const s=TU(t,n);let o=e.domain(),a=o[0],l=yK(o),u=pK;return l-a?u=WM(e,a,l):e=(e.interpolator?DM("sequential")().interpolator(e.interpolator()):DM("linear")().interpolate(e.interpolate()).range(e.range())).domain([a=0,l=1]),e.ticks&&(o=e.ticks(+i||15),a!==o[0]&&o.unshift(a),l!==yK(o)&&o.push(l)),o.forEach(t=>s.stop(u(t),e(t))),s},L0),l1("geoArea",z0,L0),l1("geoBounds",V0,L0),l1("geoCentroid",j0,L0),l1("geoShape",function(e,t,n){const i=B0(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}},L0),l1("indata",function(e,t,n){const i=this.context.data[e]["index:"+t],r=i?i.value.get(n):void 0;return r?r.count:r},function(e,t,n,i){t[0].type!==PK&&cK("First argument to indata must be a string literal."),t[1].type!==PK&&cK("Second argument to indata must be a string literal.");const r=t[0].value,s=t[1].value,o="@"+s;OK(o,i)||(i[o]=n.getData(r).indataRef(n,s))}),l1("data",I0,F0),l1("treePath",function(e,t,n){const i=e1(e,this),r=i[t],s=i[n];return r&&s?r.path(s).map(J0):void 0},F0),l1("treeAncestors",function(e,t){const n=e1(e,this)[t];return n?n.ancestors().map(J0):void 0},F0),l1("vlSelectionTest",function(e,t,n){for(var i,r,s,o,a,l=this.context.data[e],u=l?l.values.value:[],c=l?l[_0]&&l[_0].value:void 0,d=n===h0,h=u.length,p=0;p<h;++p)if(i=u[p],c&&d){if(-1===(s=(r=r||{})[o=i.unit]||0))continue;if(a=v0(t,i),r[o]=a?-1:++s,a&&1===c.size)return!0;if(!a&&s===c.get(o).count)return!1}else if(d^(a=v0(t,i)))return a;return h&&d},w0),l1("vlSelectionIdTest",function(e,t,n){const i=this.context.data[e],r=i?i.values.value:[],s=i?i[_0]&&i[_0].value:void 0,o=n===h0,a=y0(t),l=T0(r,a);if(l===r.length)return!1;if(y0(r[l])!==a)return!1;if(s&&o){if(1===s.size)return!0;if(x0(r,a)-l<s.size)return!1}return!0},w0),l1("vlSelectionResolve",function(e,t,n,i){for(var r,s,o,a,l,u,c,d,h,p,f,m,g=this.context.data[e],y=g?g.values.value:[],_={},v={},b={},T=y.length,x=0;x<T;++x)if(a=(r=y[x]).unit,s=r.fields,o=r.values,s&&o){for(f=0,m=s.length;f<m;++f)l=s[f],d=(c=_[l.field]||(_[l.field]={}))[a]||(c[a]=[]),b[l.field]=h=l.type.charAt(0),p=E0[`${h}_union`],c[a]=p(d,WJ(o[f]));n&&(d=v[a]||(v[a]=[])).push(WJ(o).reduce((e,t,n)=>(e[s[n].field]=t,e),{}))}else l=g0,u=y0(r),(d=(c=_[l]||(_[l]={}))[a]||(c[a]=[])).push(u),n&&(d=v[a]||(v[a]=[])).push({[g0]:u});if(t=t||p0,_[g0]?_[g0]=E0[`${g0}_${t}`](...Object.values(_[g0])):Object.keys(_).forEach(e=>{_[e]=Object.keys(_[e]).map(t=>_[e][t]).reduce((n,i)=>void 0===n?i:E0[`${b[e]}_${t}`](n,i))}),y=Object.keys(v),n&&y.length){_[i?"vlPoint":"vlMulti"]=t===p0?{[f0]:y.reduce((e,t)=>(e.push(...v[t]),e),[])}:{[m0]:y.map(e=>({[f0]:v[e]}))}}return _},w0),l1("vlSelectionTuples",function(e,t){return e.map(e=>XJ(t.fields?{values:t.fields.map(t=>d0(t)(e.datum))}:{[g0]:y0(e.datum)},t))});const h1=e=>function(t){return t[e]},p1=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function f1(e){throw Error(e)}function m1(e){const t=[],n=e.length;let i,r,s,o=null,a=0,l="";function u(){t.push(l+e.substring(i,r)),l="",i=r+1}for(e+="",i=r=0;r<n;++r)if(s=e[r],"\\"===s)l+=e.substring(i,r++),i=r;else if(s===o)u(),o=null,a=-1;else{if(o)continue;i===a&&'"'===s||i===a&&"'"===s?(i=r+1,o=s):"."!==s||a?"["===s?(r>i&&u(),a=i=r+1):"]"===s&&(a||f1("Access path missing open bracket: "+e),a>0&&u(),a=0,i=r+1):r>i?u():i=r+1}return a&&f1("Access path missing closing bracket: "+e),o&&f1("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function g1(e,t,n){const i=m1(e);return e=1===i.length?i[0]:e,c1((n&&n.get||d1)(i),[e],t||e)}g1("id"),c1(e=>e,[],"identity"),c1(()=>0,[],"zero"),c1(()=>1,[],"one");const y1=c1(()=>!0,[],"true");c1(()=>!1,[],"false");var _1=Array.isArray;function v1(e){return e===Object(e)}function b1(e){return null!=e?_1(e)?e:[e]:[]}function T1(e){return"function"==typeof e}const x1=(e,t)=>(e<t||null==e)&&null!=t?-1:(e>t||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0),E1=(e,t)=>1===e.length?w1(e[0],t[0]):I1(e,t,e.length),w1=(e,t)=>function(n,i){return x1(e(n),e(i))*t},I1=(e,t,n)=>(t.push(0),function(i,r){let s,o=0,a=-1;for(;0===o&&++a<n;)s=e[a],o=x1(s(i),s(r));return o*t[a]});function A1(e,t){return Object.hasOwn(e,t)}function S1(e){return _1(e)?"["+e.map(S1)+"]":v1(e)||"string"==typeof e?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function C1(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]]=!0;return t}const O1=C1(["rule"]),M1=C1(["group","image","rect"]);function R1(e){return(e+"").toLowerCase()}function k1(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var N1={operator:(e,t)=>k1(e,["_"],t.code),parameter:(e,t)=>k1(e,["datum","_"],t.code),event:(e,t)=>k1(e,["event"],t.code),handler:(e,t)=>k1(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{const{marktype:n,channels:i}=t;let r="var o=item,datum=o.datum,m=0,$;";for(const e in i){const t="o["+S1(e)+"]";r+=`$=${i[e].code};if(${t}!==$)${t}=$,m=1;`}return r+=function(e,t){let n="";return O1[t]||(e.x2&&(e.x?(M1[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(M1[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(i,n),r+="return m;",k1(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(S1).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const i=Function("a","b","var u, v; return "+e.map((e,i)=>{const r=t[i];let s,o;return e.path?(s=`a${e.path}`,o=`b${e.path}`):((n=n||{})["f"+i]=e,s=`this.f${i}(a)`,o=`this.f${i}(b)`),function(e,t,n,i){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${i}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${i} : `}(s,o,-r,r)}).join("")+"0;");return n?i.bind(n):i}}};function D1(e,t,n){if(!e||!v1(e))return e;for(let i,r=0,s=F1.length;r<s;++r)if(i=F1[r],A1(e,i.key))return i.parse(e,t,n);return e}var F1=[{key:"$ref",parse:function(e,t){return t.get(e.$ref)||f1("Operator not defined: "+e.$ref)}},{key:"$key",parse:function(e,t){const n="k:"+e.$key+"_"+!!e.$flat;return t.fn[n]||(t.fn[n]=function(e,t,n){e&&(e=t?b1(e).map(e=>e.replace(/\\(.)/g,"$1")):b1(e));const i=e&&e.length,r=n&&n.get||d1,s=e=>r(t?[e]:m1(e));let o;if(i)if(1===i){const t=s(e[0]);o=function(e){return""+t(e)}}else{const t=e.map(s);o=function(e){let n=""+t[0](e),r=0;for(;++r<i;)n+="|"+t[r](e);return n}}else o=function(){return""};return c1(o,e,"key")}(e.$key,e.$flat,t.expr.codegen))}},{key:"$expr",parse:function(e,t,n){e.$params&&t.parseParameters(e.$params,n);const i="e:"+e.$expr.code;return t.fn[i]||(t.fn[i]=c1(t.parameterExpression(e.$expr),e.$fields))}},{key:"$field",parse:function(e,t){if(!e.$field)return null;const n="f:"+e.$field+"_"+e.$name;return t.fn[n]||(t.fn[n]=g1(e.$field,e.$name,t.expr.codegen))}},{key:"$encode",parse:function(e,t){const n=e.$encode,i={};for(const e in n){const r=n[e];i[e]=c1(t.encodeExpression(r.$expr),r.$fields),i[e].output=r.$output}return i}},{key:"$compare",parse:function(e,t){const n="c:"+e.$compare+"_"+e.$order,i=b1(e.$compare).map(e=>e&&e.$tupleid?po:e);return t.fn[n]||(t.fn[n]=function(e,t,n){n=n||{},t=b1(t)||[];const i=[],r=[],s={},o=n.comparator||E1;return b1(e).forEach((e,o)=>{var a;null!=e&&(i.push("descending"===t[o]?-1:1),r.push(e=T1(e)?e:g1(e,null,n)),(a=e,(null==a?null:a.fields)||[]).forEach(e=>s[e]=1))}),0===r.length?null:c1(o(r,i),Object.keys(s))}(i,e.$order,t.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const n=e.$subflow;return function(e,i,r){const s=t.fork().parse(n),o=s.get(n.operators[0].id),a=s.signals.parent;return a&&a.set(r),o.detachSubflow=()=>t.detach(s),o}}},{key:"$tupleid",parse:function(){return po}}];const L1={skip:!0};function P1(e,t,n,i){return new B1(e,t,n,i)}function B1(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||N1,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function $1(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}function U1(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}B1.prototype=$1.prototype={fork(){const e=new $1(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter(t=>t!==e);const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,i=n.dataflow,r=e.value;if(n.set(e.id,t),function(e){return"collect"===R1(e)}(e.type)&&r&&(r.$ingest?i.ingest(t,r.$ingest,r.$format):r.$request?i.preload(t,r.$request,r.$format):i.pulse(t,i.changeset().insert(r))),e.root&&(n.root=t),e.parent){let r=n.get(e.parent.$ref);r?(i.connect(r,[t]),t.targets().add(r)):(n.unresolved=n.unresolved||[]).push(()=>{r=n.get(e.parent.$ref),i.connect(r,[t]),t.targets().add(r)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const i in e.data){const r=n.data[i]||(n.data[i]={});e.data[i].forEach(e=>r[e]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[R1(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,i,r){this.dataflow.on(t,n,i,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(e=>t.parseOperator(e)),n.forEach(e=>t.parseOperatorParameters(e)),(e.streams||[]).forEach(e=>t.parseStream(e)),(e.updates||[]).forEach(e=>t.parseUpdate(e)),t.resolve()},parseOperator:function(e){const t=this;!function(e){return"operator"===R1(e)}(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const t=this;if(e.params){const n=t.get(e.id);n||f1("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,t){t=t||{};const n=this;for(const i in e){const r=e[i];t[i]=_1(r)?r.map(e=>D1(e,n,t)):D1(r,n,t)}return t},parseStream:function(e){var t,n=this,i=null!=e.filter?n.eventExpression(e.filter):void 0,r=null!=e.stream?n.get(e.stream):void 0;e.source?r=n.events(e.source,e.type,i):e.merge&&(r=(t=e.merge.map(e=>n.get(e)))[0].merge.apply(t[0],t.slice(1))),e.between&&(t=e.between.map(e=>n.get(e)),r=r.between(t[0],t[1])),e.filter&&(r=r.filter(i)),null!=e.throttle&&(r=r.throttle(+e.throttle)),null!=e.debounce&&(r=r.debounce(+e.debounce)),null==r&&f1("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,i=v1(i=e.source)?i.$ref:i,r=n.get(i),s=e.update,o=void 0;r||f1("Source not defined: "+e.source),t=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),s&&s.$expr&&(s.$params&&(o=n.parseParameters(s.$params)),s=n.handlerExpression(s.$expr)),n.update(e,r,t,s,o)},getState:function(e){var t=this,n={};if(e.signals){var i=n.signals={};Object.keys(t.signals).forEach(n=>{const r=t.signals[n];e.signals(n,r)&&(i[n]=r.value)})}if(e.data){var r=n.data={};Object.keys(t.data).forEach(n=>{const i=t.data[n];e.data(n,i)&&(r[n]=i.input.value)})}return t.subcontext&&!1!==e.recurse&&(n.subcontext=t.subcontext.map(t=>t.getState(e))),n},setState:function(e){var t=this,n=t.dataflow,i=e.data,r=e.signals;Object.keys(r||{}).forEach(e=>{n.update(t.signals[e],r[e],L1)}),Object.keys(i||{}).forEach(e=>{n.pulse(t.data[e].input,n.changeset().remove(y1).insert(i[e]))}),(e.subcontext||[]).forEach((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)})}};const z1="default";function V1(e,t){const n=e.globalCursor()?"undefined"!=typeof document&&document.body:e.container();if(n)return null==t?n.style.removeProperty("cursor"):n.style.cursor=t}function j1(e,t){var n=e._runtime.data;return ut(n,t)||ae("Unrecognized data set: "+t),n[t]}function Y1(e,t){bo(t)||ae("Second argument to changes must be a changeset.");const n=j1(this,e);return n.modified=!0,this.pulse(n.input,t)}function G1(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function H1(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function W1(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function X1(e,t,n){var i,r,s=e._renderer,o=s&&s.canvas();return o&&(r=W1(e),(i=Aj(t.changedTouches?t.changedTouches[0]:t,o))[0]-=r[0],i[1]-=r[1]),t.dataflow=e,t.item=n,t.vega=function(e,t,n){const i=t?"group"===t.mark.marktype?t:t.mark.group:null;function r(e){var n,r=i;if(e)for(n=t;n;n=n.mark.group)if(n.mark.name===e){r=n;break}return r&&r.mark&&r.mark.interactive?r:{}}function s(e){if(!e)return n;bt(e)&&(e=r(e));const t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:it(e),item:it(t||{}),group:r,xy:s,x:e=>s(e)[0],y:e=>s(e)[1]}}(e,n,i),t}const q1="view",K1={trap:!1};function Z1(e,t,n,i){e._eventListeners.push({type:n,sources:Xe(t),handler:i})}function Q1(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||we(i)&&!i[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function J1(e){return e.item}function e2(e){return e.item.mark.source}function t2(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function n2(e,t,n){const i=document.createElement(e);for(const e in t)i.setAttribute(e,t[e]);return null!=n&&(i.textContent=n),i}function i2(e,t,n,i){const r=n.event||"input",s=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,s),Z1(i,t,r,s),e.set=e=>{t.value=e,t.dispatchEvent(function(e){return"undefined"!=typeof Event?new Event(e):{type:e}}(r))}}function r2(e,t,n,i){const r=i.signal(n.signal),s=n2("div",{class:"vega-bind"}),o="radio"===n.input?s:s.appendChild(n2("label"));o.appendChild(n2("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(s);let a=s2;switch(n.input){case"checkbox":a=o2;break;case"select":a=a2;break;case"radio":a=l2;break;case"range":a=u2}a(e,o,n,r)}function s2(e,t,n,i){const r=n2("input");for(const e in n)"signal"!==e&&"element"!==e&&r.setAttribute("input"===e?"type":e,n[e]);r.setAttribute("name",n.signal),r.value=i,t.appendChild(r),r.addEventListener("input",()=>e.update(r.value)),e.elements=[r],e.set=e=>r.value=e}function o2(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const s=n2("input",r);t.appendChild(s),s.addEventListener("change",()=>e.update(s.checked)),e.elements=[s],e.set=e=>s.checked=!!e||null}function a2(e,t,n,i){const r=n2("select",{name:n.signal}),s=n.labels||[];n.options.forEach((e,t)=>{const n={value:e};c2(e,i)&&(n.selected=!0),r.appendChild(n2("option",n,(s[t]||e)+""))}),t.appendChild(r),r.addEventListener("change",()=>{e.update(n.options[r.selectedIndex])}),e.elements=[r],e.set=e=>{for(let t=0,i=n.options.length;t<i;++t)if(c2(n.options[t],e))return void(r.selectedIndex=t)}}function l2(e,t,n,i){const r=n2("span",{class:"vega-bind-radio"}),s=n.labels||[];t.appendChild(r),e.elements=n.options.map((t,o)=>{const a={type:"radio",name:n.signal,value:t};c2(t,i)&&(a.checked=!0);const l=n2("input",a);l.addEventListener("change",()=>e.update(t));const u=n2("label",{},(s[o]||t)+"");return u.prepend(l),r.appendChild(u),l}),e.set=t=>{const n=e.elements,i=n.length;for(let e=0;e<i;++e)c2(n[e].value,t)&&(n[e].checked=!0)}}function u2(e,t,n,i){i=void 0!==i?i:(+n.max+ +n.min)/2;const r=null!=n.max?n.max:Math.max(100,+i)||100,s=n.min||Math.min(0,r,+i)||0,o=n.step||ru(s,r,100),a=n2("input",{type:"range",name:n.signal,min:s,max:r,step:o});a.value=i;const l=n2("span",{},+i);t.appendChild(a),t.appendChild(l);const u=()=>{l.textContent=a.value,e.update(+a.value)};a.addEventListener("input",u),a.addEventListener("change",u),e.elements=[a],e.set=e=>{a.value=e,l.textContent=e}}function c2(e,t){return e===t||e+""==t+""}function d2(e,t,n,i,r,s){return(t=t||new i(e.loader())).initialize(n,G1(e),H1(e),W1(e),r,s).background(e.background())}function h2(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function p2(e,t,n){if("string"==typeof t){if("undefined"==typeof document)return e.error("DOM document instance not found."),null;if(!(t=document.querySelector(t)))return e.error("Signal bind element not found: "+t),null}if(t&&n)try{t.innerHTML=""}catch(n){t=null,e.error(n)}return t}const f2=e=>+e||0;function m2(e){return we(e)?{top:f2(e.top),bottom:f2(e.bottom),left:f2(e.left),right:f2(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(f2(e))}async function g2(e,t,n,i){const r=jY(t),s=r&&r.headless;return s||ae("Unrecognized renderer type: "+t),await e.runAsync(),d2(e,null,null,s,n,i).renderAsync(e._scenegraph.root)}var y2="width",_2="height",v2="padding",b2={skip:!0};function T2(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===v2?i.left+i.right:0)}function x2(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===v2?i.top+i.bottom:0)}function E2(e,t){return t.modified&&Ee(t.input.value)&&e.indexOf("_:vega:_")}function w2(e,t){return!("parent"===e||t instanceof Wo.proxy)}function I2(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":Ee(e)?A2(e):we(e)&&!gt(e)?(t=e,Object.keys(t).map(e=>{const n=t[e];return e+": "+(Ee(n)?A2(n):S2(n))}).join("\n")):e+"";var t}(i))}function A2(e){return"["+e.map(S2).join(", ")+"]"}function S2(e){return Ee(e)?"[…]":we(e)&&!gt(e)?"{…}":e}function C2(e,t){const n=this;if(t=t||{},Yo.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),null!=t.logLevel&&n.logLevel(t.logLevel),t.locale||e.locale){const i=st({},e.locale,t.locale);n.locale(U$(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||zY.Canvas,n._scenegraph=new vj;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||I2,n._redraw=!0,n._handler=(new Hj).scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=st({defaults:{}},e),n=(e,t)=>{t.forEach(t=>{Ee(e[t])&&(e[t]=Dt(e[t]))})};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const r=function(e,t,n){return P1(e,Wo,n1,n).parse(t)}(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map(e=>({state:null,param:st({},e)})),r.root&&r.root.set(i),i.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(i.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=T2(n,n._width),n._viewHeight=x2(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[y2],i=t[_2],r=t[v2];function s(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,t=>{e._width=t.size,e._viewWidth=T2(e,t.size),s()},{size:n}),e._resizeHeight=e.add(null,t=>{e._height=t.size,e._viewHeight=x2(e,t.size),s()},{size:i});const o=e.add(null,s,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,o.rank=r.rank+1}(n),function(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}(n),function(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:z1,item:null}));e.on(e.events("view","mousemove"),t,(e,n)=>{const i=t.value,r=i?bt(i)?i:i.user:z1,s=n.item&&n.item.cursor||null;return i&&r===i.user&&s==i.item?i:{user:r,item:s}}),e.add(null,function(t){let n=t.cursor,i=this.value;return bt(n)||(i=n.item,n=n.user),V1(e,n&&n!==z1?n:i||n),i},{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind)}function O2(e,t){return ut(e._signals,t)?e._signals[t]:ae("Unrecognized signal name: "+Ot(t))}function M2(e,t){const n=(e._targets||[]).filter(e=>e._update&&e._update.handler===t);return n.length?n[0]:null}function R2(e,t,n,i){let r=M2(n,i);return r||(r=h2(e,()=>i(t,n.value)),r.handler=i,e.on(n,null,r)),e}function k2(e,t,n){const i=M2(t,n);return i&&t._targets.remove(i),e}pt(C2,Yo,{async evaluate(e,t,n){if(await Yo.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(e){var t=W1(e),n=G1(e),i=H1(e);e._renderer.background(e.background()),e._renderer.resize(n,i,t),e._handler.origin(t),e._resizeListeners.forEach(t=>{try{t(n,i)}catch(t){e.error(t)}})}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}return n&&lo(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=null!=e?e+"":null;return t!==this._desc&&U1(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const i=O2(this,e);return 1===arguments.length?i.value:this.update(i,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",m2(e)):m2(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(jY(e)||ae("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(Yo.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(O2(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,n,i,r,s){this.runAfter(o=>{let a=0;o._autosize=0,o.width()!==n&&(a=1,o.signal(y2,n,b2),o._resizeWidth.skip(!0)),o.height()!==i&&(a=1,o.signal(_2,i,b2),o._resizeHeight.skip(!0)),o._viewWidth!==e&&(o._resize=1,o._viewWidth=e),o._viewHeight!==t&&(o._resize=1,o._viewHeight=t),o._origin[0]===r[0]&&o._origin[1]===r[1]||(o._resize=1,o._origin=r),a&&o.run("enter"),s&&o.runAfter(e=>e.resize())},!1,1)},addEventListener(e,t,n){let i=t;return n&&!1===n.trap||(i=h2(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n,i,r=this._handler.handlers(e),s=r.length;--s>=0;)if(i=r[s].type,n=r[s].handler,e===i&&(t===n||t===n.raw)){this._handler.off(i,n);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.indexOf(e)<0&&t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return R2(this,e,O2(this,e),t)},removeSignalListener(e,t){return k2(this,O2(this,e),t)},addDataListener(e,t){return R2(this,e,j1(this,e).values,t)},removeDataListener(e,t){return k2(this,j1(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=V1(this,null);this._globalCursor=!!e,t&&V1(this,t)}return this}return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:function(e,t){this._timers.push(function(e,t,n){var i=new hL,r=t;return null==t?(i.restart(e,t,n),i):(i._restart=i.restart,i.restart=function(e,t,n){t=+t,n=null==n?cL():+n,i._restart(function s(o){o+=r,i._restart(s,r+=t,n),e(o)},t,n)},i.restart(e,t,n),i)}(function(t){e({timestamp:Date.now(),elapsed:t})},t))},events:function(e,t,n){var i,r=this,s=new Oo(n),o=function(n,i){r.runAsync(null,()=>{e===q1&&function(e,t){var n=e._eventConfig.defaults,i=n.prevent,r=n.allow;return!1!==i&&!0!==r&&(!0===i||!1===r||(i?i[t]:r?!r[t]:e.preventDefault()))}(r,t)&&n.preventDefault(),s.receive(X1(r,n,i))})};if("timer"===e)Q1(r,"timer",t)&&r.timer(o,t);else if(e===q1)Q1(r,"view",t)&&r.addEventListener(t,o,K1);else if("window"===e?Q1(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&Q1(r,"selector",t)&&(i=document.querySelectorAll(e)),i){for(var a=0,l=i.length;a<l;++a)i[a].addEventListener(t,o);Z1(r,i,t,o)}else r.warn("Can not resolve event source: "+e);return s},finalize:function(){var e,t,n,i=this._tooltip,r=this._timers,s=this._eventListeners;for(e=r.length;--e>=0;)r[e].stop();for(e=s.length;--e>=0;)for(t=(n=s[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);return i&&i.call(this,this._handler,null,null,null),this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",J1),e2,t2(e)),this.on(this.events("view","mouseout",J1),e2,t2(t)),this},data:function(e,t){return arguments.length<2?j1(this,e).values.value:Y1.call(this,e,To().remove(fe).insert(t))},change:Y1,insert:function(e,t){return Y1.call(this,e,To().insert(t))},remove:function(e,t){return Y1.call(this,e,To().remove(t))},scale:function(e){var t=this._runtime.scales;return ut(t,e)||ae("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,s=jY(i);e=n._el=e?p2(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),U1(t,e.description()))}(n),s||n.error("Unrecognized renderer type: "+i);const o=s.handler||Hj,a=e?s.renderer:s.headless;return n._renderer=a?d2(n,n._renderer,e,a):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),h2(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,W1(e),e);return t&&t.handlers().forEach(e=>{r.on(e.type,e.handler)}),r}(n,n._handler,e,o),n._redraw=!0,e&&"none"!==r&&(t=t?n._elBind=p2(n,t,!0):e.appendChild(n2("form",{class:"vega-bindings"})),n._bind.forEach(e=>{e.param.element&&"container"!==r&&(e.element=p2(n,e.param.element,!!e.param.input))}),n._bind.forEach(e=>{!function(e,t,n){if(!t)return;const i=n.param;let r=n.state;r||(r=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(i.signal)&&e.runAsync(null,()=>{r.source=!0,e.signal(i.signal,t)})}},i.debounce&&(r.update=rt(i.debounce,r.update))),(null==i.input&&i.element?i2:r2)(r,t,i,e),r.active||(e.on(e._signals[i.signal],null,()=>{r.source?r.source=!1:r.set(e.signal(i.signal))}),r.active=!0)}(n,e.element||t,e)})),n},toImageURL:async function(e,t){e!==zY.Canvas&&e!==zY.SVG&&e!==zY.PNG&&ae("Unrecognized image type: "+e);const n=await g2(this,e,t);return e===zY.SVG?function(e,t){const n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await g2(this,zY.Canvas,e,t)).canvas()},toSVG:async function(e){return(await g2(this,zY.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:E2,signals:w2,recurse:!0})},setState:function(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},e=>{e._trigger=!0}),this}});const N2="view",D2="[",F2="]",L2="{",P2="}",B2=":",$2=",",U2="@",z2=">",V2=/[[\]{}]/,j2={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let Y2,G2;function H2(e,t,n,i,r){const s=e.length;let o,a=0;for(;t<s;++t){if(o=e[t],!a&&o===n)return t;r&&r.indexOf(o)>=0?--a:i&&i.indexOf(o)>=0&&++a}return t}function W2(e){const t=[],n=e.length;let i=0,r=0;for(;r<n;)r=H2(e,r,$2,D2+L2,F2+P2),t.push(e.substring(i,r).trim()),i=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function X2(e){return"["===e[0]?function(e){const t=e.length;let n,i=1;if(i=H2(e,i,F2,D2,F2),i===t)throw"Empty between selector: "+e;if(n=W2(e.substring(1,i)),2!==n.length)throw"Between selector must have two elements: "+e;if(e=e.slice(i+1).trim(),e[0]!==z2)throw"Expected '>' after between selector: "+e;n=n.map(X2);const r=X2(e.slice(1).trim());if(r.between)return{between:n,stream:r};r.between=n;return r}(e):function(e){const t={source:Y2},n=[];let i,r,s=[0,0],o=0,a=0,l=e.length,u=0;if(e[l-1]===P2){if(u=e.lastIndexOf(L2),!(u>=0))throw"Unmatched right brace: "+e;try{s=function(e){const t=e.split($2);if(!e.length||t.length>2)throw e;return t.map(t=>{const n=+t;if(n!=n)throw e;return n})}(e.substring(u+1,l-1))}catch(t){throw"Invalid throttle specification: "+e}l=(e=e.slice(0,u).trim()).length,u=0}if(!l)throw e;e[0]===U2&&(o=++u);i=H2(e,u,B2),i<l&&(n.push(e.substring(a,i).trim()),a=u=++i);if(u=H2(e,u,D2),u===l)n.push(e.substring(a,l).trim());else if(n.push(e.substring(a,u).trim()),r=[],a=++u,a===l)throw"Unmatched left bracket: "+e;for(;u<l;){if(u=H2(e,u,F2),u===l)throw"Unmatched left bracket: "+e;if(r.push(e.substring(a,u).trim()),u<l-1&&e[++u]!==D2)throw"Expected left bracket: "+e;a=++u}if(!(l=n.length)||V2.test(n[l-1]))throw"Invalid event selector: "+e;l>1?(t.type=n[1],o?t.markname=n[0].slice(1):!function(e){return G2[e]}(n[0])?t.source=n[0]:t.marktype=n[0]):t.type=n[0];"!"===t.type.slice(-1)&&(t.consume=!0,t.type=t.type.slice(0,-1));null!=r&&(t.filter=r);s[0]&&(t.throttle=s[0]);s[1]&&(t.debounce=s[1]);return t}(e)}function q2(e){return we(e)?e:{type:e||"pad"}}const K2=e=>+e||0,Z2=e=>({top:e,bottom:e,left:e,right:e});function Q2(e){return we(e)?e.signal?e:{top:K2(e.top),bottom:K2(e.bottom),left:K2(e.left),right:K2(e.right)}:Z2(K2(e))}const J2=e=>we(e)&&!Ee(e)?st({},e):{value:e};function e3(e,t,n,i){if(null!=n){return we(n)&&!Ee(n)||Ee(n)&&n.length&&we(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1}return 0}function t3(e,t,n){for(const n in t)e3(e,n,t[n]);for(const t in n)e3(e,t,n[t],"update")}function n3(e,t,n){for(const i in t)n&&ut(n,i)||(e[i]=st(e[i]||{},t[i]));return e}function i3(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const r3="mark",s3="frame",o3="scope",a3="axis",l3="axis-domain",u3="axis-grid",c3="axis-label",d3="axis-tick",h3="axis-title",p3="legend",f3="legend-band",m3="legend-entry",g3="legend-gradient",y3="legend-label",_3="legend-symbol",v3="legend-title",b3="title",T3="title-text",x3="title-subtitle";function E3(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const w3=e=>bt(e)?Ot(e):e.signal?`(${e.signal})`:C3(e);function I3(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map(e=>null==e?null:Ot(e));for(;t.length&&null==Oe(t);)t.pop();return t.unshift(w3(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?A3("hcl",e.h,e.c,e.l):e.h||e.s?A3("hsl",e.h,e.s,e.l):e.l||e.a?A3("lab",e.l,e.a,e.b):e.r||e.g||e.b?A3("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?C3(e.field):void 0!==e.value?Ot(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=w3(e.scale);null!=e.range?t=`lerp(_range(${n}), ${+e.range})`:(void 0!==t&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(1===+e.band?"":"*"+S3(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0"));return t}(e,t)),void 0===t&&(t=null),null!=e.exponent&&(t=`pow(${t},${S3(e.exponent)})`),null!=e.mult&&(t+=`*${S3(e.mult)}`),null!=e.offset&&(t+=`+${S3(e.offset)}`),e.round&&(t=`round(${t})`),t}const A3=(e,t,n,i)=>`(${e}(${[t,n,i].map(I3).join(",")})+'')`;function S3(e){return we(e)?"("+I3(e)+")":e}function C3(e){return O3(we(e)?e:{datum:e})}function O3(e){let t,n,i;if(e.signal)t="datum",i=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(i=e.parent,t+=".datum"):i=e.group}else e.datum?(t="datum",i=e.datum):ae("Invalid field reference: "+Ot(e));return e.signal||(i=bt(i)?le(i).map(Ot).join("]["):O3(i)),t+"["+i+"]"}function M3(e,t,n,i,r,s){const o={};(s=s||{}).encoders={$encode:o},e=function(e,t,n,i,r){const s={},o={};let a,l,u,c;for(l in l="lineBreak","text"!==t||null==r[l]||i3(l,e)||E3(s,l,r[l]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===s3?r.group:n===r3?st({},r.mark,r[t]):null,c)u=i3(l,e)||("fill"===l||"stroke"===l)&&(i3("fill",e)||i3("stroke",e)),u||E3(s,l,c[l]);for(l in Xe(i).forEach(t=>{const n=r.style&&r.style[t];for(const t in n)i3(t,e)||E3(s,t,n[t])}),e=st({},e),s)c=s[l],c.signal?(a=a||{})[l]=c:o[l]=c;return e.enter=st(o,e.enter),a&&(e.update=st(a,e.update)),e}(e,t,n,i,r.config);for(const n in e)o[n]=R3(e[n],t,s,r);return s}function R3(e,t,n,i){const r={},s={};for(const t in e)null!=e[t]&&(r[t]=N3(k3(e[t]),i,n,s));return{$expr:{marktype:t,channels:r},$fields:Object.keys(s),$output:Object.keys(e)}}function k3(e){return Ee(e)?function(e){let t="";return e.forEach(e=>{const n=I3(e);t+=e.test?`(${e.test})?${n}:`:n}),":"===Oe(t)&&(t+="null"),t}(e):I3(e)}function N3(e,t,n,i){const r=u1(e,t);return r.$fields.forEach(e=>i[e]=1),st(n,r.$params),r.$expr}const D3="outer",F3=["value","update","init","react","bind"];function L3(e,t){ae(e+' for "outer" push: '+Ot(t))}function P3(e,t){const n=e.name;if(e.push===D3)t.signals[n]||L3("No prior signal definition",n),F3.forEach(t=>{void 0!==e[t]&&L3("Invalid property ",t)});else{const i=t.addSignal(n,e.value);!1===e.react&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function B3(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function $3(e,t,n,i){return new B3(e,t,n,i)}function U3(e,t){return $3("operator",e,t)}function z3(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function V3(e,t){return t?{$field:e,$name:t}:{$field:e}}const j3=V3("key");function Y3(e,t){return{$compare:e,$order:t}}function G3(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const H3="scope",W3="view";function X3(e){return e&&e.signal}function q3(e){if(X3(e))return!0;if(we(e))for(const t in e)if(q3(e[t]))return!0;return!1}function K3(e,t){return null!=e?e:t}function Z3(e){return e&&e.signal||e}const Q3="timer";function J3(e,t){return(e.merge?e4:e.stream?t4:e.type?n4:ae("Invalid stream specification: "+Ot(e)))(e,t)}function e4(e,t){const n=e.merge.map(e=>J3(e,t)),i=i4({merge:n},e,t);return t.addStream(i).id}function t4(e,t){const n=i4({stream:J3(e.stream,t)},e,t);return t.addStream(n).id}function n4(e,t){let n;e.type===Q3?(n=t.event(Q3,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(function(e){return e===H3?W3:e||W3}(e.source),e.type);const i=i4({stream:n},e,t);return 1===Object.keys(i).length?n:t.addStream(i).id}function i4(e,t,n){let i=t.between;return i&&(2!==i.length&&ae('Stream "between" parameter must have 2 entries: '+Ot(t)),e.between=[J3(i[0],n),J3(i[1],n)]),i=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&i.push(function(e,t,n){const i="event.item";return i+(e&&"*"!==e?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}(t.marktype,t.markname,t.markrole)),t.source===H3&&i.push("inScope(event.item)"),i.length&&(e.filter=u1("("+i.join(")&&(")+")",n).$expr),null!=(i=t.throttle)&&(e.throttle=+i),null!=(i=t.debounce)&&(e.debounce=+i),t.consume&&(e.consume=!0),e}const r4={code:"_.$value",ast:{type:"Identifier",value:"value"}};function s4(e,t,n){const i=e.encode,r={target:n};let s=e.events,o=e.update,a=[];s||ae("Signal update missing events specification."),bt(s)&&(s=function(e,t,n){return Y2=t||N2,G2=n||j2,W2(e.trim()).map(X2)}(s,t.isSubscope()?H3:W3)),s=Xe(s).filter(e=>e.signal||e.scale?(a.push(e),0):1),a.length>1&&(a=[o4(a)]),s.length&&a.push(s.length>1?{merge:s}:s[0]),null!=i&&(o&&ae("Signal encode and update are mutually exclusive."),o="encode(item(),"+Ot(i)+")"),r.update=bt(o)?u1(o,t):null!=o.expr?u1(o.expr,t):null!=o.value?o.value:null!=o.signal?{$expr:r4,$params:{$value:t.signalRef(o.signal)}}:ae("Invalid signal update specification."),e.force&&(r.options={force:!0}),a.forEach(e=>t.addUpdate(st(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):J3(e,t)}}(e,t),r)))}function o4(e){return{signal:"["+e.map(e=>e.scale?'scale("'+e.scale+'")':e.signal)+"]"}}const a4=e=>(t,n,i)=>$3(e,n,t||void 0,i),l4=a4("aggregate"),u4=a4("axisticks"),c4=a4("bound"),d4=a4("collect"),h4=a4("compare"),p4=a4("datajoin"),f4=a4("encode"),m4=a4("expression"),g4=a4("facet"),y4=a4("field"),_4=a4("key"),v4=a4("legendentries"),b4=a4("load"),T4=a4("mark"),x4=a4("multiextent"),E4=a4("multivalues"),w4=a4("overlap"),I4=a4("params"),A4=a4("prefacet"),S4=a4("projection"),C4=a4("proxy"),O4=a4("relay"),M4=a4("render"),R4=a4("scale"),k4=a4("sieve"),N4=a4("sortitems"),D4=a4("viewlayout"),F4=a4("values");let L4=0;const P4={min:"min",max:"max",count:"sum"};function B4(e,t){const n=t.getScale(e.name).params;let i;for(i in n.domain=V4(e.domain,e,t),null!=e.range&&(n.range=K4(e,t,n)),null!=e.interpolate&&function(e,t){t.interpolate=$4(e.type||e),null!=e.gamma&&(t.interpolateGamma=$4(e.gamma))}(e.interpolate,n),null!=e.nice&&(n.nice=function(e){return we(e)?{interval:$4(e.interval),step:$4(e.step)}:$4(e)}(e.nice)),null!=e.bins&&(n.bins=function(e,t){return e.signal||Ee(e)?U4(e,t):t.objectProperty(e)}(e.bins,t)),e)ut(n,i)||"name"===i||(n[i]=$4(e[i],t))}function $4(e,t){return we(e)?e.signal?t.signalRef(e.signal):ae("Unsupported object: "+Ot(e)):e}function U4(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>$4(e,t))}function z4(e){ae("Can not find data set: "+Ot(e))}function V4(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(Ee(e)?j4:e.fields?G4:Y4)(e,t,n);null==t.domainMin&&null==t.domainMax||ae("No scale domain defined for domainMin/domainMax to override.")}function j4(e,t,n){return e.map(e=>$4(e,n))}function Y4(e,t,n){const i=n.getData(e.data);return i||z4(e.data),BM(t.type)?i.valuesRef(n,e.field,W4(e.sort,!1)):VM(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function G4(e,t,n){const i=e.data,r=e.fields.reduce((e,t)=>(t=bt(t)?{data:i,field:t}:Ee(t)||t.signal?function(e,t){const n="_:vega:_"+L4++,i=d4({});if(Ee(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+Ot(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,k4({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e),[]);return(BM(t.type)?H4:VM(t.type)?X4:q4)(e,n,r)}function H4(e,t,n){const i=W4(e.sort,!0);let r,s;const o=n.map(e=>{const n=t.getData(e.data);return n||z4(e.data),n.countsRef(t,e.field,i)}),a={groupby:j3,pulse:o};i&&(r=i.op||"count",s=i.field?G3(r,i.field):"count",a.ops=[P4[r]],a.fields=[t.fieldRef(s)],a.as=[s]),r=t.add(l4(a));const l=t.add(d4({pulse:z3(r)}));return s=t.add(F4({field:j3,sort:t.sortRef(i),pulse:z3(l)})),z3(s)}function W4(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!P4[e.op]&&ae("Multiple domain scales can not be sorted using "+e.op):ae("No field provided for sort aggregate op: "+e.op):we(e)?e.field="key":e={field:"key"}),e}function X4(e,t,n){const i=n.map(e=>{const n=t.getData(e.data);return n||z4(e.data),n.domainRef(t,e.field)});return z3(t.add(E4({values:i})))}function q4(e,t,n){const i=n.map(e=>{const n=t.getData(e.data);return n||z4(e.data),n.extentRef(t,e.field)});return z3(t.add(x4({extents:i})))}function K4(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(bt(r)){if(i&&ut(i,r))return K4(e=st({},e,{range:i[r]}),t,n);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=BM(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:ae("Unrecognized scale range value: "+Ot(r))}else{if(r.scheme)return n.scheme=Ee(r.scheme)?U4(r.scheme,t):$4(r.scheme,t),r.extent&&(n.schemeExtent=U4(r.extent,t)),void(r.count&&(n.schemeCount=$4(r.count,t)));if(r.step)return void(n.rangeStep=$4(r.step,t));if(BM(e.type)&&!Ee(r))return V4(r,e,t);Ee(r)||ae("Unsupported range type: "+Ot(r))}return r.map(e=>(Ee(e)?U4:$4)(e,t))}function Z4(e,t,n){return Ee(e)?e.map(e=>Z4(e,t,n)):we(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:ae("Unsupported parameter object: "+Ot(e)):e}const Q4="top",J4="left",e5="right",t5="bottom",n5="center",i5="vertical",r5="start",s5="end",o5="index",a5="label",l5="offset",u5="perc",c5="perc2",d5="value",h5="guide-label",p5="guide-title",f5="group-title",m5="group-subtitle",g5="symbol",y5="gradient",_5="discrete",v5="size",b5=[v5,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],T5={name:1,style:1,interactive:1},x5={value:0},E5={value:1},w5="group",I5="rect",A5="rule",S5="symbol",C5="text";function O5(e){return e.type=w5,e.interactive=e.interactive||!1,e}function M5(e,t){const n=(n,i)=>K3(e[n],K3(t[n],i));return n.isVertical=n=>i5===K3(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>K3(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>K3(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>K3(e.columns,K3(t.columns,+n.isVertical(!0))),n}function R5(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function k5(e,t,n){return`item.anchor === '${r5}' ? ${e} : item.anchor === '${s5}' ? ${t} : ${n}`}const N5=k5(Ot(J4),Ot(e5),Ot(n5));function D5(e,t){return t?e?we(e)?Object.assign({},e,{offset:D5(e.offset,t)}):{value:e,offset:t}:t:e}function F5(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=n3(e.encode,t,T5)):e.interactive=!1,e}function L5(e,t,n,i){const r=M5(e,n),s=r.isVertical(),o=r.gradientThickness(),a=r.gradientLength();let l,u,c,d,h;s?(u=[0,1],c=[0,0],d=o,h=a):(u=[0,0],c=[1,0],d=a,h=o);const p={enter:l={opacity:x5,x:x5,y:x5,width:J2(d),height:J2(h)},update:st({},l,{opacity:E5,fill:{gradient:t,start:u,stop:c}}),exit:{opacity:x5}};return t3(p,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),F5({type:I5,role:g3,encode:p},i)}function P5(e,t,n,i,r){const s=M5(e,n),o=s.isVertical(),a=s.gradientThickness(),l=s.gradientLength();let u,c,d,h,p="";o?(u="y",d="y2",c="x",h="width",p="1-"):(u="x",d="x2",c="y",h="height");const f={opacity:x5,fill:{scale:t,field:d5}};f[u]={signal:p+"datum."+u5,mult:l},f[c]=x5,f[d]={signal:p+"datum."+c5,mult:l},f[h]=J2(a);const m={enter:f,update:st({},f,{opacity:E5}),exit:{opacity:x5}};return t3(m,{stroke:s("gradientStrokeColor"),strokeWidth:s("gradientStrokeWidth")},{opacity:s("gradientOpacity")}),F5({type:I5,role:f3,key:d5,from:r,encode:m},i)}const B5=`datum.${u5}<=0?"${J4}":datum.${u5}>=1?"${e5}":"${n5}"`,$5=`datum.${u5}<=0?"${t5}":datum.${u5}>=1?"${Q4}":"middle"`;function U5(e,t,n,i){const r=M5(e,t),s=r.isVertical(),o=J2(r.gradientThickness()),a=r.gradientLength();let l,u,c,d,h=r("labelOverlap"),p="";const f={enter:l={opacity:x5},update:u={opacity:E5,text:{field:a5}},exit:{opacity:x5}};return t3(f,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:K3(e.labelLimit,t.gradientLabelLimit)}),s?(l.align={value:"left"},l.baseline=u.baseline={signal:$5},c="y",d="x",p="1-"):(l.align=u.align={signal:B5},l.baseline={value:"top"},c="x",d="y"),l[c]=u[c]={signal:p+"datum."+u5,mult:a},l[d]=u[d]=o,o.offset=K3(e.labelOffset,t.gradientLabelOffset)||0,h=h?{separation:r("labelSeparation"),method:h,order:"datum."+o5}:void 0,F5({type:C5,role:y3,style:h5,key:d5,from:i,encode:f,overlap:h},n)}function z5(e,t,n,i,r){const s=M5(e,t),o=n.entries,a=!(!o||!o.interactive),l=o?o.name:void 0,u=s("clipHeight"),c=s("symbolOffset"),d={data:"value"},h=`(${r}) ? datum.${l5} : datum.${v5}`,p=u?J2(u):{field:v5},f=`datum.${o5}`,m=`max(1, ${r})`;let g,y,_,v,b;p.mult=.5,g={enter:y={opacity:x5,x:{signal:h,mult:.5,offset:c},y:p},update:_={opacity:E5,x:y.x,y:y.y},exit:{opacity:x5}};let T=null,x=null;e.fill||(T=t.symbolBaseFillColor,x=t.symbolBaseStrokeColor),t3(g,{fill:s("symbolFillColor",T),shape:s("symbolType"),size:s("symbolSize"),stroke:s("symbolStrokeColor",x),strokeDash:s("symbolDash"),strokeDashOffset:s("symbolDashOffset"),strokeWidth:s("symbolStrokeWidth")},{opacity:s("symbolOpacity")}),b5.forEach(t=>{e[t]&&(_[t]=y[t]={scale:e[t],field:d5})});const E=F5({type:S5,role:_3,key:d5,from:d,clip:!!u||void 0,encode:g},n.symbols),w=J2(c);w.offset=s("labelOffset"),g={enter:y={opacity:x5,x:{signal:h,offset:w},y:p},update:_={opacity:E5,text:{field:a5},x:y.x,y:y.y},exit:{opacity:x5}},t3(g,{align:s("labelAlign"),baseline:s("labelBaseline"),fill:s("labelColor"),fillOpacity:s("labelOpacity"),font:s("labelFont"),fontSize:s("labelFontSize"),fontStyle:s("labelFontStyle"),fontWeight:s("labelFontWeight"),limit:s("labelLimit")});const I=F5({type:C5,role:y3,style:h5,key:d5,from:d,encode:g},n.labels);return g={enter:{noBound:{value:!u},width:x5,height:u?J2(u):x5,opacity:x5},exit:{opacity:x5},update:_={opacity:E5,row:{signal:null},column:{signal:null}}},s.isVertical(!0)?(v=`ceil(item.mark.items.length / ${m})`,_.row.signal=`${f}%${v}`,_.column.signal=`floor(${f} / ${v})`,b={field:["row",f]}):(_.row.signal=`floor(${f} / ${m})`,_.column.signal=`${f} % ${m}`,b={field:f}),_.column.signal=`(${r})?${_.column.signal}:${f}`,O5({role:o3,from:i={facet:{data:i,name:"value",groupby:o5}},encode:n3(g,o,T5),marks:[E,I],name:l,interactive:a,sort:b})}const V5='item.orient === "left"',j5='item.orient === "right"',Y5=`(${V5} || ${j5})`,G5=`datum.vgrad && ${Y5}`,H5=k5('"top"','"bottom"','"middle"'),W5=`datum.vgrad && ${j5} ? (${k5('"right"','"left"','"center"')}) : (${Y5} && !(datum.vgrad && ${V5})) ? "left" : ${N5}`,X5=`item._anchor || (${Y5} ? "middle" : "start")`,q5=`${G5} ? (${V5} ? -90 : 90) : 0`,K5=`${Y5} ? (datum.vgrad ? (${j5} ? "bottom" : "top") : ${H5}) : "top"`;function Z5(e,t){let n;return we(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+Q5(e.path)+")":e.sphere&&(n="geoShape("+Q5(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function Q5(e){return we(e)&&e.signal?e.signal:Ot(e)}function J5(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===w5?o3:t||r3:t}function e6(e){return{marktype:e.type,name:e.name||void 0,role:e.role||J5(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function t6(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function n6(e,t){const n=Xo(e.type);n||ae("Unrecognized transform type: "+Ot(e.type));const i=$3(n.type.toLowerCase(),null,i6(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function i6(e,t,n){const i={},r=e.params.length;for(let s=0;s<r;++s){const r=e.params[s];i[r.name]=r6(r,t,n)}return i}function r6(e,t,n){const i=e.type,r=t[e.name];return"index"===i?function(e,t,n){bt(t.from)||ae('Lookup "from" parameter must be a string literal.');return n.getData(t.from).lookupRef(n,t.key)}(0,t,n):void 0!==r?"param"===i?function(e,t,n){const i=t[e.name];return e.array?(Ee(i)||ae("Expected an array of sub-parameters. Instead: "+Ot(i)),i.map(t=>o6(e,t,n))):o6(e,i,n)}(e,t,n):"projection"===i?n.projectionRef(t[e.name]):e.array&&!X3(r)?r.map(t=>s6(e,t,n)):s6(e,r,n):void(e.required&&ae("Missing required "+Ot(t.type)+" parameter: "+Ot(e.name)))}function s6(e,t,n){const i=e.type;if(X3(t))return c6(i)?ae("Expression references can not be signals."):d6(i)?n.fieldRef(t):h6(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||d6(i);return r&&a6(t)?n.exprRef(t.expr,t.as):r&&l6(t)?V3(t.field,t.as):c6(i)?u1(t,n):u6(i)?z3(n.getData(t).values):d6(i)?V3(t):h6(i)?n.compareRef(t):t}}function o6(e,t,n){const i=e.params.length;let r;for(let n=0;n<i;++n){r=e.params[n];for(const e in r.key)if(r.key[e]!==t[e]){r=null;break}if(r)break}r||ae("Unsupported parameter: "+Ot(t));const s=st(i6(r,t,n),r.key);return z3(n.add(I4(s)))}const a6=e=>e&&e.expr,l6=e=>e&&e.field,u6=e=>"data"===e,c6=e=>"expr"===e,d6=e=>"field"===e,h6=e=>"compare"===e;function p6(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:z3(t.getData(e.data).output)}function f6(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function m6(e){return bt(e)?e:null}function g6(e,t,n){const i=G3(n.op,n.field);let r;if(t.ops){for(let e=0,n=t.as.length;e<n;++e)if(t.as[e]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((r=n.op.signal)?e.signalRef(r):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function y6(e,t,n,i,r,s,o){const a=t[n]||(t[n]={}),l=function(e){return we(e)?("descending"===e.order?"-":"+")+G3(e.op,e.field):""}(s);let u,c,d=m6(r);if(null!=d&&(e=t.scope,d+=l?"|"+l:"",u=a[d]),!u){const n=s?{field:j3,pulse:t.countsRef(e,r,s)}:{field:e.fieldRef(r),pulse:z3(t.output)};l&&(n.sort=e.sortRef(s)),c=e.add($3(i,void 0,n)),o&&(t.index[r]=c),u=z3(c),null!=d&&(a[d]=u)}return u}function _6(e,t,n){const i=e.remove,r=e.insert,s=e.toggle,o=e.modify,a=e.values,l=t.add(U3()),u=u1("if("+e.trigger+',modify("'+n+'",'+[r,i,s,o,a].map(e=>null==e?"null":e).join(",")+"),0)",t);l.update=u.$expr,l.params=u.$params}function v6(e,t){const n=J5(e),i=e.type===w5,r=e.from&&e.from.facet,s=e.overlap;let o,a,l,u,c,d,h,p=e.layout||n===o3||n===s3;const f=n===r3||p||r,m=function(e,t,n){let i,r,s,o,a;return e?(i=e.facet)&&(t||ae("Only group marks can be faceted."),null!=i.field?o=a=p6(i,n):(e.data?a=z3(n.getData(e.data).aggregate):(s=n6(st({type:"aggregate",groupby:Xe(i.groupby)},i.aggregate),n),s.params.key=n.keyRef(i.groupby),s.params.pulse=p6(i,n),o=a=z3(n.add(s))),r=n.keyRef(i.groupby,!0))):o=z3(n.add(d4(null,[{}]))),o||(o=p6(e,n)),{key:r,pulse:o,parent:a}}(e.from,i,t);a=t.add(p4({key:m.key||(e.key?V3(e.key):void 0),pulse:m.pulse,clean:!i}));const g=z3(a);a=l=t.add(d4({pulse:g})),a=t.add(T4({markdef:e6(e),interactive:t6(e.interactive,t),clip:Z5(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:z3(a)}));const y=z3(a);a=u=t.add(f4(M3(e.encode,e.type,n,e.style,t,{mod:!1,pulse:y}))),a.params.parent=t.encode(),e.transform&&e.transform.forEach(e=>{const n=n6(e,t),i=n.metadata;(i.generates||i.changes)&&ae("Mark transforms should not generate new data."),i.nomod||(u.params.mod=!0),n.params.pulse=z3(a),t.add(a=n)}),e.sort&&(a=t.add(N4({sort:t.compareRef(e.sort),pulse:z3(a)})));const _=z3(a);(r||p)&&(p=t.add(D4({layout:t.objectProperty(e.layout),legends:t.legends,mark:y,pulse:_})),d=z3(p));const v=t.add(c4({mark:y,pulse:d||_}));h=z3(v),i&&(f&&(o=t.operators,o.pop(),p&&o.pop()),t.pushState(_,d||h,g),r?function(e,t,n){const i=e.from.facet,r=i.name,s=p6(i,t);let o;i.name||ae("Facet must have a name: "+Ot(i)),i.data||ae("Facet must reference a data set: "+Ot(i)),i.field?o=t.add(A4({field:t.fieldRef(i.field),pulse:s})):i.groupby?o=t.add(g4({key:t.keyRef(i.groupby),group:z3(t.proxy(n.parent)),pulse:s})):ae("Facet must specify groupby or field: "+Ot(i));const a=t.fork(),l=a.add(d4()),u=a.add(k4({pulse:z3(l)}));a.addData(r,new f6(a,l,l,u)),a.addSignal("parent",null),o.params.subflow={$subflow:a.parse(e).toRuntime()}}(e,t,m):f?function(e,t,n){const i=t.add(A4({pulse:n.pulse})),r=t.fork();r.add(k4()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}(e,t,m):t.parse(e),t.popState(),f&&(p&&o.push(p),o.push(v))),s&&(h=function(e,t,n){const i=e.method,r=e.bound,s=e.separation,o={separation:X3(s)?n.signalRef(s.signal):s,method:X3(i)?n.signalRef(i.signal):i,pulse:t};e.order&&(o.sort=n.compareRef({field:e.order}));if(r){const e=r.tolerance;o.boundTolerance=X3(e)?n.signalRef(e.signal):+e,o.boundScale=n.scaleRef(r.scale),o.boundOrient=r.orient}return z3(n.add(w4(o)))}(s,h,t));const b=t.add(M4({pulse:h})),T=t.add(k4({pulse:z3(b)},void 0,t.parent()));null!=e.name&&(c=e.name,t.addData(c,new f6(t,l,b,T)),e.on&&e.on.forEach(e=>{(e.insert||e.remove||e.toggle)&&ae("Marks only support modify triggers."),_6(e,t,c)}))}function b6(e,t){const n=t.config.legend,i=e.encode||{},r=M5(e,n),s=i.legend||{},o=s.name||void 0,a=s.interactive,l=s.style,u={};let c,d,h,p=0;b5.forEach(t=>e[t]?(u[t]=e[t],p=p||e[t]):0),p||ae("Missing valid scale for legend.");const f=function(e,t){let n=e.type||g5;e.type||1!==function(e){return b5.reduce((t,n)=>t+(e[n]?1:0),0)}(e)||!e.fill&&!e.stroke||(n=PM(t)?y5:$M(t)?_5:g5);return n!==y5?n:$M(t)?_5:y5}(e,t.scaleType(p)),m={title:null!=e.title,scales:u,type:f,vgrad:"symbol"!==f&&r.isVertical()},g=z3(t.add(d4(null,[m]))),y=z3(t.add(v4(d={type:f,scale:t.scaleRef(p),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return f===y5?(h=[L5(e,p,n,i.gradient),U5(e,n,i.labels,y)],d.count=d.count||t.signalRef(`max(2,2*floor((${Z3(r.gradientLength())})/100))`)):f===_5?h=[P5(e,p,n,i.gradient,y),U5(e,n,i.labels,y)]:(c=function(e,t){const n=M5(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),h=[z5(e,n,i,y,Z3(c.columns))],d.size=function(e,t,n){const i=Z3(x6("size",e,n)),r=Z3(x6("strokeWidth",e,n)),s=Z3(function(e,t,n){return R5("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i[e]}("fontSize",t,n)}(n[1].encode,t,h5));return u1(`max(ceil(sqrt(${i})+${r}),${s})`,t)}(e,t,h[0].marks)),h=[O5({role:m3,from:g,encode:{enter:{x:{value:0},y:{value:0}}},marks:h,layout:c,interactive:a})],m.title&&h.push(function(e,t,n,i){const r=M5(e,t),s={enter:{opacity:x5},update:{opacity:E5,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:x5}};return t3(s,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:X5},angle:{signal:q5},align:{signal:W5},baseline:{signal:K5},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),F5({type:C5,role:v3,style:p5,from:i,encode:s},n)}(e,n,i.title,g)),v6(O5({role:p3,from:g,encode:n3(T6(r,e,n),s,T5),marks:h,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:o,interactive:a,style:l}),t)}function T6(e,t,n){const i={enter:{},update:{}};return t3(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function x6(e,t,n){return t[e]?`scale("${t[e]}",datum)`:R5(e,n[0].encode)}f6.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let s=t[0],o=null,a=1;for(s&&"load"===s.type&&(s=t[1]),e.add(t[0]);a<n;++a)t[a].params.pulse=z3(t[a-1]),e.add(t[a]),"aggregate"===t[a].type&&(o=t[a]);return new f6(e,s,r,i,o)},f6.prototype={countsRef(e,t,n){const i=this,r=i.counts||(i.counts={}),s=m6(t);let o,a,l;return null!=s&&(e=i.scope,o=r[s]),o?n&&n.field&&g6(e,o.agg.params,n):(l={groupby:e.fieldRef(t,"key"),pulse:z3(i.output)},n&&n.field&&g6(e,l,n),a=e.add(l4(l)),o=e.add(d4({pulse:z3(a)})),o={agg:a,ref:z3(o)},null!=s&&(r[s]=o)),o.ref},tuplesRef(){return z3(this.values)},extentRef(e,t){return y6(e,this,"extent","extent",t,!1)},domainRef(e,t){return y6(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return y6(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return y6(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return y6(e,this,"indata","tupleindex",t,!0,!0)}};const E6=`item.orient==="${J4}"?-90:item.orient==="${e5}"?90:0`;function w6(e,t){const n=M5(e=bt(e)?{text:e}:e,t.config.title),i=e.encode||{},r=i.group||{},s=r.name||void 0,o=r.interactive,a=r.style,l=[],u=z3(t.add(d4(null,[{}])));return l.push(function(e,t,n,i){const r={value:0},s=e.text,o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return t3(o,{text:s,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),F5({type:C5,role:T3,style:f5,from:i,encode:o},n)}(e,n,function(e){const t=e.encode;return t&&t.title||st({name:e.name,interactive:e.interactive,style:e.style},t)}(e),u)),e.subtitle&&l.push(function(e,t,n,i){const r={value:0},s=e.subtitle,o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return t3(o,{text:s,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),F5({type:C5,role:x3,style:m5,from:i,encode:o},n)}(e,n,i.subtitle,u)),v6(O5({role:b3,from:u,encode:I6(n,r),marks:l,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:s,interactive:o,style:a}),t)}function I6(e,t){const n={enter:{},update:{}};return t3(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:N5},angle:{signal:E6},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),n3(n,t,T5)}function A6(e,t){const n=[];e.transform&&e.transform.forEach(e=>{n.push(n6(e,t))}),e.on&&e.on.forEach(n=>{_6(n,t,e.name)}),t.addDataPipeline(e.name,function(e,t,n){const i=[];let r,s,o,a,l,u=null,c=!1,d=!1;e.values?X3(e.values)||q3(e.format)?(i.push(C6(t,e)),i.push(u=S6())):i.push(u=S6({$ingest:e.values,$format:e.format})):e.url?q3(e.url)||q3(e.format)?(i.push(C6(t,e)),i.push(u=S6())):i.push(u=S6({$request:e.url,$format:e.format})):e.source&&(u=r=Xe(e.source).map(e=>z3(t.getData(e).output)),i.push(null));for(s=0,o=n.length;s<o;++s)a=n[s],l=a.metadata,u||l.source||i.push(u=S6()),i.push(a),l.generates&&(d=!0),l.modifies&&!d&&(c=!0),l.source?u=a:l.changes&&(u=null);r&&(o=r.length-1,i[0]=O4({derive:c,pulse:o?r:r[0]}),(c||o)&&i.splice(1,0,S6()));u||i.push(S6());return i.push(k4({})),i}(e,t,n))}function S6(e){const t=d4({},e);return t.metadata={source:!0},t}function C6(e,t){return b4({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}const O6=e=>e===t5||e===Q4,M6=(e,t,n)=>X3(e)?P6(e.signal,t,n):e===J4||e===Q4?t:n,R6=(e,t,n)=>X3(e)?F6(e.signal,t,n):O6(e)?t:n,k6=(e,t,n)=>X3(e)?L6(e.signal,t,n):O6(e)?n:t,N6=(e,t,n)=>X3(e)?B6(e.signal,t,n):e===Q4?{value:t}:{value:n},D6=(e,t,n)=>X3(e)?$6(e.signal,t,n):e===e5?{value:t}:{value:n},F6=(e,t,n)=>U6(`${e} === '${Q4}' || ${e} === '${t5}'`,t,n),L6=(e,t,n)=>U6(`${e} !== '${Q4}' && ${e} !== '${t5}'`,t,n),P6=(e,t,n)=>V6(`${e} === '${J4}' || ${e} === '${Q4}'`,t,n),B6=(e,t,n)=>V6(`${e} === '${Q4}'`,t,n),$6=(e,t,n)=>V6(`${e} === '${e5}'`,t,n),U6=(e,t,n)=>(t=null!=t?J2(t):t,n=null!=n?J2(n):n,z6(t)&&z6(n)?{signal:`${e} ? (${t=t?t.signal||Ot(t.value):null}) : (${n=n?n.signal||Ot(n.value):null})`}:[st({test:e},t)].concat(n||[])),z6=e=>null==e||1===Object.keys(e).length,V6=(e,t,n)=>({signal:`${e} ? (${Y6(t)}) : (${Y6(n)})`}),j6=(e,t,n,i,r)=>({signal:(null!=i?`${e} === '${J4}' ? (${Y6(i)}) : `:"")+(null!=n?`${e} === '${t5}' ? (${Y6(n)}) : `:"")+(null!=r?`${e} === '${e5}' ? (${Y6(r)}) : `:"")+(null!=t?`${e} === '${Q4}' ? (${Y6(t)}) : `:"")+"(null)"}),Y6=e=>X3(e)?e.signal:null==e?null:Ot(e),G6=(e,t)=>0===t?0:X3(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},H6=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function W6(e,t,n,i){let r;if(t&&ut(t,e))return t[e];if(ut(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return i[p5][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i[h5][r]}return null}function X6(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function q6(e,t){return{scale:e.scale,range:t}}function K6(e,t,n,i,r){const s=M5(e,t),o=e.orient,a=e.gridScale,l=M6(o,1,-1),u=function(e,t){if(1===t);else if(we(e)){let n=e=st({},e);for(;null!=n.mult;){if(!we(n.mult))return n.mult=X3(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=st({},n.mult)}n.mult=t}else e=X3(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,l);let c,d,h;const p={enter:c={opacity:x5},update:h={opacity:E5},exit:d={opacity:x5}};t3(p,{stroke:s("gridColor"),strokeCap:s("gridCap"),strokeDash:s("gridDash"),strokeDashOffset:s("gridDashOffset"),strokeOpacity:s("gridOpacity"),strokeWidth:s("gridWidth")});const f={scale:e.scale,field:d5,band:r.band,extra:r.extra,offset:r.offset,round:s("tickRound")},m=R6(o,{signal:"height"},{signal:"width"}),g=a?{scale:a,range:0,mult:l,offset:u}:{value:0,offset:u},y=a?{scale:a,range:1,mult:l,offset:u}:st(m,{mult:l,offset:u});return c.x=h.x=R6(o,f,g),c.y=h.y=k6(o,f,g),c.x2=h.x2=k6(o,y),c.y2=h.y2=R6(o,y),d.x=R6(o,f),d.y=k6(o,f),F5({type:A5,role:u3,key:d5,from:i,encode:p},n)}function Z6(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function Q6(e,t,n,i){const r=M5(e,t),s=e.orient,o=M6(s,-1,1);let a,l;const u={enter:a={opacity:x5,anchor:J2(r("titleAnchor",null)),align:{signal:N5}},update:l=st({},a,{opacity:E5,text:J2(e.title)}),exit:{opacity:x5}},c={signal:`lerp(range("${e.scale}"), ${k5(0,1,.5)})`};return l.x=R6(s,c),l.y=k6(s,c),a.angle=R6(s,x5,G6(o,90)),a.baseline=R6(s,N6(s,t5,Q4),{value:t5}),l.angle=a.angle,l.baseline=a.baseline,t3(u,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),function(e,t,n,i){const r=(e,t)=>null!=e?(n.update[t]=H6(J2(e),n.update[t]),!1):!i3(t,i),s=r(e("titleX"),"x"),o=r(e("titleY"),"y");n.enter.auto=o===s?J2(o):R6(t,J2(o),J2(s))}(r,s,u,n),u.update.align=H6(u.update.align,a.align),u.update.angle=H6(u.update.angle,a.angle),u.update.baseline=H6(u.update.baseline,a.baseline),F5({type:C5,role:h3,style:p5,from:i,encode:u},n)}function J6(e,t){const n=function(e,t){var n,i,r,s=t.config,o=s.style,a=s.axis,l="band"===t.scaleType(e.scale)&&s.axisBand,u=e.orient;if(X3(u)){const e=X6([s.axisX,s.axisY]),t=X6([s.axisTop,s.axisBottom,s.axisLeft,s.axisRight]);for(r of(n={},e))n[r]=R6(u,W6(r,s.axisX,a,o),W6(r,s.axisY,a,o));for(r of(i={},t))i[r]=j6(u.signal,W6(r,s.axisTop,a,o),W6(r,s.axisBottom,a,o),W6(r,s.axisLeft,a,o),W6(r,s.axisRight,a,o))}else n=u===Q4||u===t5?s.axisX:s.axisY,i=s["axis"+u[0].toUpperCase()+u.slice(1)];return n||i||l?st({},a,n,i,l):a}(e,t),i=e.encode||{},r=i.axis||{},s=r.name||void 0,o=r.interactive,a=r.style,l=M5(e,n),u=function(e){const t=e("tickBand");let n,i,r=e("tickOffset");return t?t.signal?(n={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},we(r)||(r={signal:`(${t.signal}) === 'extent' ? 0 : ${r}`})):"extent"===t?(n=1,i=!0,r=0):(n=.5,i=!1):(n=e("bandPosition"),i=e("tickExtra")),{extra:i,band:n,offset:r}}(l),c={scale:e.scale,ticks:!!l("ticks"),labels:!!l("labels"),grid:!!l("grid"),domain:!!l("domain"),title:null!=e.title},d=z3(t.add(d4({},[c]))),h=z3(t.add(u4({scale:t.scaleRef(e.scale),extra:t.property(u.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),p=[];let f;return c.grid&&p.push(K6(e,n,i.grid,h,u)),c.ticks&&(f=l("tickSize"),p.push(function(e,t,n,i,r,s){const o=M5(e,t),a=e.orient,l=M6(a,-1,1);let u,c,d;const h={enter:u={opacity:x5},update:d={opacity:E5},exit:c={opacity:x5}};t3(h,{stroke:o("tickColor"),strokeCap:o("tickCap"),strokeDash:o("tickDash"),strokeDashOffset:o("tickDashOffset"),strokeOpacity:o("tickOpacity"),strokeWidth:o("tickWidth")});const p=J2(r);p.mult=l;const f={scale:e.scale,field:d5,band:s.band,extra:s.extra,offset:s.offset,round:o("tickRound")};return d.y=u.y=R6(a,x5,f),d.y2=u.y2=R6(a,p),c.x=R6(a,f),d.x=u.x=k6(a,x5,f),d.x2=u.x2=k6(a,p),c.y=k6(a,f),F5({type:A5,role:d3,key:d5,from:i,encode:h},n)}(e,n,i.ticks,h,f,u))),c.labels&&(f=c.ticks?f:0,p.push(function(e,t,n,i,r,s){const o=M5(e,t),a=e.orient,l=e.scale,u=M6(a,-1,1),c=Z3(o("labelFlush")),d=Z3(o("labelFlushOffset")),h=o("labelAlign"),p=o("labelBaseline");let f,m=0===c||!!c;const g=J2(r);g.mult=u,g.offset=J2(o("labelPadding")||0),g.offset.mult=u;const y={scale:l,field:d5,band:.5,offset:D5(s.offset,o("labelOffset"))},_=R6(a,m?Z6(l,c,'"left"','"right"','"center"'):{value:"center"},D6(a,"left","right")),v=R6(a,N6(a,"bottom","top"),m?Z6(l,c,'"top"','"bottom"','"middle"'):{value:"middle"}),b=Z6(l,c,`-(${d})`,d,0);m=m&&d;const T={opacity:x5,x:R6(a,y,g),y:k6(a,y,g)},x={enter:T,update:f={opacity:E5,text:{field:a5},x:T.x,y:T.y,align:_,baseline:v},exit:{opacity:x5,x:T.x,y:T.y}};t3(x,{dx:!h&&m?R6(a,b):null,dy:!p&&m?k6(a,b):null}),t3(x,{angle:o("labelAngle"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontWeight:o("labelFontWeight"),fontStyle:o("labelFontStyle"),limit:o("labelLimit"),lineHeight:o("labelLineHeight")},{align:h,baseline:p});const E=o("labelBound");let w=o("labelOverlap");return w=w||E?{separation:o("labelSeparation"),method:w,order:"datum.index",bound:E?{scale:l,orient:a,tolerance:E}:null}:void 0,f.align!==_&&(f.align=H6(f.align,_)),f.baseline!==v&&(f.baseline=H6(f.baseline,v)),F5({type:C5,role:c3,style:h5,key:d5,from:i,encode:x,overlap:w},n)}(e,n,i.labels,h,f,u))),c.domain&&p.push(function(e,t,n,i){const r=M5(e,t),s=e.orient;let o,a;const l={enter:o={opacity:x5},update:a={opacity:E5},exit:{opacity:x5}};t3(l,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const u=q6(e,0),c=q6(e,1);return o.x=a.x=R6(s,u,x5),o.x2=a.x2=R6(s,c),o.y=a.y=k6(s,u,x5),o.y2=a.y2=k6(s,c),F5({type:A5,role:l3,from:i,encode:l},n)}(e,n,i.domain,d)),c.title&&p.push(Q6(e,n,i.title,d)),v6(O5({role:a3,from:d,encode:n3(e8(l,e),r,T5),marks:p,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:s,interactive:o,style:a}),t)}function e8(e,t){const n={enter:{},update:{}};return t3(n,{orient:e("orient"),offset:e("offset")||0,position:K3(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function t8(e,t,n){const i=Xe(e.signals),r=Xe(e.scales);return n||i.forEach(e=>P3(e,t)),Xe(e.projections).forEach(e=>function(e,t){const n=t.config.projection||{},i={};for(const n in e)"name"!==n&&(i[n]=Z4(e[n],n,t));for(const e in n)null==i[e]&&(i[e]=Z4(n[e],e,t));t.addProjection(e.name,i)}(e,t)),r.forEach(e=>function(e,t){const n=e.type||"linear";FM(n)||ae("Unrecognized scale type: "+Ot(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t)),Xe(e.data).forEach(e=>A6(e,t)),r.forEach(e=>B4(e,t)),(n||i).forEach(e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?ae("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=u1(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach(e=>s4(e,t,n.id))}(e,t)),Xe(e.axes).forEach(e=>J6(e,t)),Xe(e.marks).forEach(e=>v6(e,t)),Xe(e.legends).forEach(e=>b6(e,t)),e.title&&w6(e.title,t),t.parseLambdas(),t}const n8=e=>n3({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function i8(e,t){const n=t.config,i=z3(t.root=t.add(U3())),r=function(e,t){const n=n=>K3(e[n],t[n]),i=[r8("background",n("background")),r8("autosize",q2(n("autosize"))),r8("padding",Q2(n("padding"))),r8("width",n("width")||0),r8("height",n("height")||0)],r=i.reduce((e,t)=>(e[t.name]=t,e),{}),s={};return Xe(e.signals).forEach(e=>{ut(r,e.name)?e=st(r[e.name],e):i.push(e),s[e.name]=e}),Xe(t.signals).forEach(e=>{ut(s,e.name)||ut(r,e.name)||i.push(e)}),i}(e,n);r.forEach(e=>P3(e,t)),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const s=t.add(d4()),o=t.add(f4(M3(n8(e.encode),w5,s3,e.style,t,{pulse:z3(s)}))),a=t.add(D4({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:z3(o)}));t.operators.pop(),t.pushState(z3(o),z3(a),null),t8(e,t,r),t.operators.push(a);let l=t.add(c4({mark:i,pulse:z3(a)}));return l=t.add(M4({pulse:z3(l)})),l=t.add(k4({pulse:z3(l)})),t.addData("root",new f6(t,s,s,l)),t}function r8(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function s8(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function o8(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function a8(e){return(Ee(e)?l8:u8)(e)}function l8(e){const t=e.length;let n="[";for(let i=0;i<t;++i){const t=e[i];n+=(i>0?",":"")+(we(t)?t.signal||a8(t):Ot(t))}return n+"]"}function u8(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+Ot(t)+":"+(we(n)?n.signal||a8(n):Ot(n));return i+"}"}function c8(e,t,n){return we(e)||ae("Input Vega specification must be an object."),t=Ae(function(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",r="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:r}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:i,grid:!1,gridWidth:1,gridColor:r,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:i,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:r,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:i,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}(),t,e.config),i8(e,new s8(t,n)).toRuntime()}s8.prototype=o8.prototype={parse(e){return t8(e,this)},fork(){return new o8(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(t=>{t.$ref=e.id}),e.refs=null),e},proxy(e){const t=e instanceof B3?z3(e):e;return this.add(C4({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let i,r;e&&(i=e.data||(e.data={}),r=i[t]||(i[t]=[]),r.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(z3(this.add(k4({pulse:e})))),this._parent.push(t),this._lookup.push(n?z3(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return Oe(this._parent)},encode(){return Oe(this._encode)},lookup(){return Oe(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(bt(e))return V3(e,t);e.signal||ae("Unsupported field reference: "+Ot(e));const n=e.signal;let i=this.field[n];if(!i){const e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=i=z3(this.add(y4(e)))}return i},compareRef(e){let t=!1;const n=e=>X3(e)?(t=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(t=!0,this.exprRef(e.expr)):e,i=Xe(e.field).map(n),r=Xe(e.order).map(n);return t?z3(this.add(h4({fields:i,orders:r}))):Y3(i,r)},keyRef(e,t){let n=!1;const i=this.signals;return e=Xe(e).map(e=>X3(e)?(n=!0,z3(i[e.signal])):e),n?z3(this.add(_4({fields:e,flat:t}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,t)},sortRef(e){if(!e)return e;const t=G3(e.op,e.field),n=e.order||"ascending";return n.signal?z3(this.add(h4({fields:t,orders:this.signalRef(n.signal)}))):Y3(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return ut(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&ae("Duplicate signal name: "+Ot(e));const n=t instanceof B3?t:this.add(U3(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||ae("Unrecognized signal name: "+Ot(e)),this.signals[e]},signalRef(e){return this.signals[e]?z3(this.signals[e]):(ut(this.lambdas,e)||(this.lambdas[e]=this.add(U3(null))),z3(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t<n;++t){const n=e[t],i=u1(n,this),r=this.lambdas[n];r.params=i.$params,r.update=i.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&we(e)?this.signalRef(e.signal||a8(e)):e},exprRef(e,t){const n={expr:u1(e,this)};return t&&(n.expr.$name=t),z3(this.add(m4(n)))},addBinding(e,t){this.bindings||ae("Nested signals do not support binding: "+Ot(e)),this.bindings.push(st({signal:e},t))},addScaleProj(e,t){ut(this.scales,e)&&ae("Duplicate scale or projection name: "+Ot(e)),this.scales[e]=this.add(t)},addScale(e,t){this.addScaleProj(e,R4(t))},addProjection(e,t){this.addScaleProj(e,S4(t))},getScale(e){return this.scales[e]||ae("Unrecognized scale name: "+Ot(e)),this.scales[e]},scaleRef(e){return z3(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,t){return ut(this.data,e)&&ae("Duplicate data set name: "+Ot(e)),this.data[e]=t},getData(e){return this.data[e]||ae("Undefined data set name: "+Ot(e)),this.data[e]},addDataPipeline(e,t){return ut(this.data,e)&&ae("Duplicate data set name: "+Ot(e)),this.addData(e,f6.fromEntries(this,t))}};const d8="Property",h8="ArrayExpression",p8="BinaryExpression",f8="CallExpression",m8="ConditionalExpression",g8="LogicalExpression",y8="MemberExpression",_8="ObjectExpression",v8="UnaryExpression";function b8(e){this.type=e}var T8,x8,E8,w8,I8;b8.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case h8:return e.elements;case p8:case g8:return[e.left,e.right];case f8:return[e.callee].concat(e.arguments);case m8:return[e.test,e.consequent,e.alternate];case y8:return[e.object,e.property];case _8:return e.properties;case d8:return[e.key,e.value];case v8:return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};var A8=1,S8=2,C8=3,O8=4,M8=5,R8=6,k8=7,N8=8;(T8={})[A8]="Boolean",T8[S8]="<end>",T8[C8]="Identifier",T8[O8]="Keyword",T8[M8]="Null",T8[R8]="Numeric",T8[k8]="Punctuator",T8[N8]="String",T8[9]="RegularExpression";var D8="ArrayExpression",F8="BinaryExpression",L8="CallExpression",P8="ConditionalExpression",B8="Identifier",$8="Literal",U8="LogicalExpression",z8="MemberExpression",V8="ObjectExpression",j8="Property",Y8="UnaryExpression",G8="Unexpected token %0",H8="Unexpected number",W8="Unexpected string",X8="Unexpected identifier",q8="Unexpected reserved word",K8="Unexpected end of input",Z8="Invalid regular expression",Q8="Invalid regular expression: missing /",J8="Octal literals are not allowed in strict mode.",e9="Duplicate data property in object literal not allowed in strict mode",t9="ILLEGAL",n9="Disabled.",i9=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),r9=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function s9(e,t){if(!e)throw new Error("ASSERT: "+t)}function o9(e){return e>=48&&e<=57}function a9(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function l9(e){return"01234567".indexOf(e)>=0}function u9(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function c9(e){return 10===e||13===e||8232===e||8233===e}function d9(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&i9.test(String.fromCharCode(e))}function h9(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&r9.test(String.fromCharCode(e))}const p9={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function f9(){for(;E8<w8;){const e=x8.charCodeAt(E8);if(!u9(e)&&!c9(e))break;++E8}}function m9(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)E8<w8&&a9(x8[E8])?(i=x8[E8++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):R9({},G8,t9);return String.fromCharCode(r)}function g9(){var e,t,n,i;for(t=0,"}"===(e=x8[E8])&&R9({},G8,t9);E8<w8&&a9(e=x8[E8++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&R9({},G8,t9),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function y9(){var e,t;for(e=x8.charCodeAt(E8++),t=String.fromCharCode(e),92===e&&(117!==x8.charCodeAt(E8)&&R9({},G8,t9),++E8,(e=m9("u"))&&"\\"!==e&&d9(e.charCodeAt(0))||R9({},G8,t9),t=e);E8<w8&&h9(e=x8.charCodeAt(E8));)++E8,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==x8.charCodeAt(E8)&&R9({},G8,t9),++E8,(e=m9("u"))&&"\\"!==e&&h9(e.charCodeAt(0))||R9({},G8,t9),t+=e);return t}function _9(){var e,t;return e=E8,t=92===x8.charCodeAt(E8)?y9():function(){var e,t;for(e=E8++;E8<w8;){if(92===(t=x8.charCodeAt(E8)))return E8=e,y9();if(!h9(t))break;++E8}return x8.slice(e,E8)}(),{type:1===t.length?C8:p9.hasOwnProperty(t)?O8:"null"===t?M8:"true"===t||"false"===t?A8:C8,value:t,start:e,end:E8}}function v9(){var e,t,n,i,r=E8,s=x8.charCodeAt(E8),o=x8[E8];switch(s){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++E8,{type:k8,value:String.fromCharCode(s),start:r,end:E8};default:if(61===(e=x8.charCodeAt(E8+1)))switch(s){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return E8+=2,{type:k8,value:String.fromCharCode(s)+String.fromCharCode(e),start:r,end:E8};case 33:case 61:return E8+=2,61===x8.charCodeAt(E8)&&++E8,{type:k8,value:x8.slice(r,E8),start:r,end:E8}}}return">>>="===(i=x8.substr(E8,4))?{type:k8,value:i,start:r,end:E8+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:k8,value:n,start:r,end:E8+=3}:o===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(o)>=0||"=>"===t?{type:k8,value:t,start:r,end:E8+=2}:("//"===t&&R9({},G8,t9),"<>=!+-*%&|^/".indexOf(o)>=0?(++E8,{type:k8,value:o,start:r,end:E8}):void R9({},G8,t9))}function b9(){var e,t,n;if(s9(o9((n=x8[E8]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=E8,e="","."!==n){if(e=x8[E8++],n=x8[E8],"0"===e){if("x"===n||"X"===n)return++E8,function(e){let t="";for(;E8<w8&&a9(x8[E8]);)t+=x8[E8++];return 0===t.length&&R9({},G8,t9),d9(x8.charCodeAt(E8))&&R9({},G8,t9),{type:R8,value:parseInt("0x"+t,16),start:e,end:E8}}(t);if(l9(n))return function(e){let t="0"+x8[E8++];for(;E8<w8&&l9(x8[E8]);)t+=x8[E8++];return(d9(x8.charCodeAt(E8))||o9(x8.charCodeAt(E8)))&&R9({},G8,t9),{type:R8,value:parseInt(t,8),octal:!0,start:e,end:E8}}(t);n&&o9(n.charCodeAt(0))&&R9({},G8,t9)}for(;o9(x8.charCodeAt(E8));)e+=x8[E8++];n=x8[E8]}if("."===n){for(e+=x8[E8++];o9(x8.charCodeAt(E8));)e+=x8[E8++];n=x8[E8]}if("e"===n||"E"===n)if(e+=x8[E8++],"+"!==(n=x8[E8])&&"-"!==n||(e+=x8[E8++]),o9(x8.charCodeAt(E8)))for(;o9(x8.charCodeAt(E8));)e+=x8[E8++];else R9({},G8,t9);return d9(x8.charCodeAt(E8))&&R9({},G8,t9),{type:R8,value:parseFloat(e),start:t,end:E8}}function T9(){var e,t,n,i;return I8=null,f9(),e=E8,t=function(){var e,t,n,i;for(s9("/"===(e=x8[E8]),"Regular expression literal must start with a slash"),t=x8[E8++],n=!1,i=!1;E8<w8;)if(t+=e=x8[E8++],"\\"===e)c9((e=x8[E8++]).charCodeAt(0))&&R9({},Q8),t+=e;else if(c9(e.charCodeAt(0)))R9({},Q8);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||R9({},Q8),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";E8<w8&&h9((e=x8[E8]).charCodeAt(0));)++E8,"\\"===e&&E8<w8?R9({},G8,t9):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&R9({},Z8,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(e,t)=>{if(parseInt(t,16)<=1114111)return"x";R9({},Z8)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){R9({},Z8)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:E8}}function x9(){if(f9(),E8>=w8)return{type:S8,start:E8,end:E8};const e=x8.charCodeAt(E8);return d9(e)?_9():40===e||41===e||59===e?v9():39===e||34===e?function(){var e,t,n,i,r="",s=!1;for(s9("'"===(e=x8[E8])||'"'===e,"String literal must starts with a quote"),t=E8,++E8;E8<w8;){if((n=x8[E8++])===e){e="";break}if("\\"===n)if((n=x8[E8++])&&c9(n.charCodeAt(0)))"\r"===n&&"\n"===x8[E8]&&++E8;else switch(n){case"u":case"x":"{"===x8[E8]?(++E8,r+=g9()):r+=m9(n);break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:l9(n)?(0!==(i="01234567".indexOf(n))&&(s=!0),E8<w8&&l9(x8[E8])&&(s=!0,i=8*i+"01234567".indexOf(x8[E8++]),"0123".indexOf(n)>=0&&E8<w8&&l9(x8[E8])&&(i=8*i+"01234567".indexOf(x8[E8++]))),r+=String.fromCharCode(i)):r+=n}else{if(c9(n.charCodeAt(0)))break;r+=n}}return""!==e&&R9({},G8,t9),{type:N8,value:r,octal:s,start:t,end:E8}}():46===e?o9(x8.charCodeAt(E8+1))?b9():v9():o9(e)?b9():v9()}function E9(){const e=I8;return E8=e.end,I8=x9(),E8=e.end,e}function w9(){const e=E8;I8=x9(),E8=e}function I9(e,t,n){const i=new b8("||"===e||"&&"===e?U8:F8);return i.operator=e,i.left=t,i.right=n,i}function A9(e,t){const n=new b8(L8);return n.callee=e,n.arguments=t,n}function S9(e){const t=new b8(B8);return t.name=e,t}function C9(e){const t=new b8($8);return t.value=e.value,t.raw=x8.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function O9(e,t,n){const i=new b8(z8);return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function M9(e,t,n){const i=new b8(j8);return i.key=t,i.value=n,i.kind=e,i}function R9(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,(e,t)=>(s9(t<i.length,"Message reference must be in range"),i[t]));throw(n=new Error(r)).index=E8,n.description=r,n}function k9(e){e.type===S8&&R9(e,K8),e.type===R8&&R9(e,H8),e.type===N8&&R9(e,W8),e.type===C8&&R9(e,X8),e.type===O8&&R9(e,q8),R9(e,G8,e.value)}function N9(e){const t=E9();t.type===k8&&t.value===e||k9(t)}function D9(e){return I8.type===k8&&I8.value===e}function F9(e){return I8.type===O8&&I8.value===e}function L9(){const e=[];for(E8=I8.start,N9("[");!D9("]");)D9(",")?(E9(),e.push(null)):(e.push(q9()),D9("]")||N9(","));return E9(),function(e){const t=new b8(D8);return t.elements=e,t}(e)}function P9(){E8=I8.start;const e=E9();return e.type===N8||e.type===R8?(e.octal&&R9(e,J8),C9(e)):S9(e.value)}function B9(){var e,t,n;return E8=I8.start,(e=I8).type===C8?(n=P9(),N9(":"),M9("init",n,q9())):e.type!==S8&&e.type!==k8?(t=P9(),N9(":"),M9("init",t,q9())):void k9(e)}function $9(){var e,t,n=[],i={},r=String;for(E8=I8.start,N9("{");!D9("}");)t="$"+((e=B9()).key.type===B8?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?R9({},e9):i[t]=!0,n.push(e),D9("}")||N9(",");return N9("}"),function(e){const t=new b8(V8);return t.properties=e,t}(n)}const U9={if:1};function z9(){var e,t,n;if(D9("("))return function(){N9("(");const e=K9();return N9(")"),e}();if(D9("["))return L9();if(D9("{"))return $9();if(e=I8.type,E8=I8.start,e===C8||U9[I8.value])n=S9(E9().value);else if(e===N8||e===R8)I8.octal&&R9(I8,J8),n=C9(E9());else{if(e===O8)throw new Error(n9);e===A8?((t=E9()).value="true"===t.value,n=C9(t)):e===M8?((t=E9()).value=null,n=C9(t)):D9("/")||D9("/=")?(n=C9(T9()),w9()):k9(E9())}return n}function V9(){const e=[];if(N9("("),!D9(")"))for(;E8<w8&&(e.push(q9()),!D9(")"));)N9(",");return N9(")"),e}function j9(){E8=I8.start;const e=E9();return function(e){return e.type===C8||e.type===O8||e.type===A8||e.type===M8}(e)||k9(e),S9(e.value)}function Y9(){return N9("."),j9()}function G9(){N9("[");const e=K9();return N9("]"),e}function H9(){const e=function(){var e;for(e=z9();;)if(D9("."))e=O9(".",e,Y9());else if(D9("("))e=A9(e,V9());else{if(!D9("["))break;e=O9("[",e,G9())}return e}();if(I8.type===k8&&(D9("++")||D9("--")))throw new Error(n9);return e}function W9(){var e,t;if(I8.type!==k8&&I8.type!==O8)t=H9();else{if(D9("++")||D9("--"))throw new Error(n9);if(D9("+")||D9("-")||D9("~")||D9("!"))e=E9(),t=W9(),t=function(e,t){const n=new b8(Y8);return n.operator=e,n.argument=t,n.prefix=!0,n}(e.value,t);else{if(F9("delete")||F9("void")||F9("typeof"))throw new Error(n9);t=H9()}}return t}function X9(e){let t=0;if(e.type!==k8&&e.type!==O8)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function q9(){var e,t;return e=function(){var e,t,n,i,r,s,o,a,l,u;if(e=I8,l=W9(),0===(r=X9(i=I8)))return l;for(i.prec=r,E9(),t=[e,I8],s=[l,i,o=W9()];(r=X9(I8))>0;){for(;s.length>2&&r<=s[s.length-2].prec;)o=s.pop(),a=s.pop().value,l=s.pop(),t.pop(),n=I9(a,l,o),s.push(n);(i=E9()).prec=r,s.push(i),t.push(I8),n=W9(),s.push(n)}for(n=s[u=s.length-1],t.pop();u>1;)t.pop(),n=I9(s[u-1].value,s[u-2],n),u-=2;return n}(),D9("?")&&(E9(),t=q9(),N9(":"),e=function(e,t,n){const i=new b8(P8);return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,q9())),e}function K9(){const e=q9();if(D9(","))throw new Error(n9);return e}function Z9(e){E8=0,w8=(x8=e).length,I8=null,w9();const t=K9();if(I8.type!==S8)throw new Error("Unexpect token after expression.");return t}var Q9={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function J9(e){function t(t,n,i){return r=>function(t,n,i,r){let s=e(n[0]);return i&&(s=i+"("+s+")",0===i.lastIndexOf("new ",0)&&(s="("+s+")")),s+"."+t+(r<0?"":0===r?"()":"("+n.slice(1).map(e).join(",")+")")}(t,r,n,i)}const n="new Date",i="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(t){t.length<3&&ae("Missing arguments to clamp function."),t.length>3&&ae("Too many arguments to clamp function.");const n=t.map(e);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",i,0),lower:t("toLowerCase",i,0),substring:t("substring",i),split:t("split",i),trim:t("trim",i,0),regexp:r,test:t("test",r),if:function(t){t.length<3&&ae("Missing arguments to if function."),t.length>3&&ae("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function e7(e){const t=(e=e||{}).allowed?Dt(e.allowed):{},n=e.forbidden?Dt(e.forbidden):{},i=e.constants||Q9,r=(e.functions||J9)(d),s=e.globalvar,o=e.fieldvar,a=Ke(s)?s:e=>"".concat(s,'["').concat(e,'"]');let l={},u={},c=0;function d(e){if(bt(e))return e;const t=h[e.type];return null==t&&ae("Unsupported type: "+e.type),t(e)}const h={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return c>0?r:ut(n,r)?ae("Illegal identifier: "+r):ut(i,r)?i[r]:ut(t,r)?r:(l[r]=1,a(r))},MemberExpression:e=>{const t=!e.computed,n=d(e.object);t&&(c+=1);const i=d(e.property);return n===o&&(u[function(e){const t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(i)]=1),t&&(c-=1),n+(t?"."+i:"["+i+"]")},CallExpression:e=>{"Identifier"!==e.callee.type&&ae("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=ut(r,t)&&r[t];return i||ae("Unrecognized function: "+t),Ke(i)?i(n):i+"("+n.map(d).join(",")+")"},ArrayExpression:e=>"["+e.elements.map(d).join(",")+"]",BinaryExpression:e=>"("+d(e.left)+" "+e.operator+" "+d(e.right)+")",UnaryExpression:e=>"("+e.operator+d(e.argument)+")",ConditionalExpression:e=>"("+d(e.test)+"?"+d(e.consequent)+":"+d(e.alternate)+")",LogicalExpression:e=>"("+d(e.left)+e.operator+d(e.right)+")",ObjectExpression:e=>"{"+e.properties.map(d).join(",")+"}",Property:e=>{c+=1;const t=d(e.key);return c-=1,t+":"+d(e.value)}};function p(e){const t={code:d(e),globals:Object.keys(l),fields:Object.keys(u)};return l={},u={},t}return p.functions=r,p.constants=i,p}const t7="view",n7="[",i7="]",r7="{",s7="}",o7=":",a7=",",l7="@",u7=">",c7=/[[\]{}]/,d7={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let h7,p7;function f7(e,t,n){return h7=t||t7,p7=n||d7,g7(e.trim()).map(y7)}function m7(e,t,n,i,r){const s=e.length;let o,a=0;for(;t<s;++t){if(o=e[t],!a&&o===n)return t;r&&r.indexOf(o)>=0?--a:i&&i.indexOf(o)>=0&&++a}return t}function g7(e){const t=[],n=e.length;let i=0,r=0;for(;r<n;)r=m7(e,r,a7,n7+r7,i7+s7),t.push(e.substring(i,r).trim()),i=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function y7(e){return"["===e[0]?function(e){const t=e.length;let n,i=1;if(i=m7(e,i,i7,n7,i7),i===t)throw"Empty between selector: "+e;if(n=g7(e.substring(1,i)),2!==n.length)throw"Between selector must have two elements: "+e;if(e=e.slice(i+1).trim(),e[0]!==u7)throw"Expected '>' after between selector: "+e;n=n.map(y7);const r=y7(e.slice(1).trim());if(r.between)return{between:n,stream:r};r.between=n;return r}(e):function(e){const t={source:h7},n=[];let i,r,s=[0,0],o=0,a=0,l=e.length,u=0;if(e[l-1]===s7){if(u=e.lastIndexOf(r7),!(u>=0))throw"Unmatched right brace: "+e;try{s=function(e){const t=e.split(a7);if(!e.length||t.length>2)throw e;return t.map(t=>{const n=+t;if(n!=n)throw e;return n})}(e.substring(u+1,l-1))}catch(t){throw"Invalid throttle specification: "+e}l=(e=e.slice(0,u).trim()).length,u=0}if(!l)throw e;e[0]===l7&&(o=++u);i=m7(e,u,o7),i<l&&(n.push(e.substring(a,i).trim()),a=u=++i);if(u=m7(e,u,n7),u===l)n.push(e.substring(a,l).trim());else if(n.push(e.substring(a,u).trim()),r=[],a=++u,a===l)throw"Unmatched left bracket: "+e;for(;u<l;){if(u=m7(e,u,i7),u===l)throw"Unmatched left bracket: "+e;if(r.push(e.substring(a,u).trim()),u<l-1&&e[++u]!==n7)throw"Expected left bracket: "+e;a=++u}if(!(l=n.length)||c7.test(n[l-1]))throw"Invalid event selector: "+e;l>1?(t.type=n[1],o?t.markname=n[0].slice(1):!function(e){return p7[e]}(n[0])?t.source=n[0]:t.marktype=n[0]):t.type=n[0];"!"===t.type.slice(-1)&&(t.consume=!0,t.type=t.type.slice(0,-1));null!=r&&(t.filter=r);s[0]&&(t.throttle=s[0]);s[1]&&(t.debounce=s[1]);return t}(e)}var _7="5.20.0";st(Wo,s,a,u,c,d,p,h,f,m,y,_);const v7=_7;function b7(e,t,n){return e.fields=t||[],e.fname=n,e}function T7(e){return 1===e.length?x7(e[0]):E7(e)}const x7=e=>function(t){return t[e]},E7=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function w7(e){throw Error(e)}function I7(e){var t,n,i,r=[],s=null,o=0,a=e.length,l="";function u(){r.push(l+e.substring(t,n)),l="",t=n+1}for(e+="",t=n=0;n<a;++n)if("\\"===(i=e[n]))l+=e.substring(t,n),l+=e.substring(++n,++n),t=n;else if(i===s)u(),s=null,o=-1;else{if(s)continue;t===o&&'"'===i||t===o&&"'"===i?(t=n+1,s=i):"."!==i||o?"["===i?(n>t&&u(),o=t=n+1):"]"===i&&(o||w7("Access path missing open bracket: "+e),o>0&&u(),o=0,t=n+1):n>t?u():t=n+1}return o&&w7("Access path missing closing bracket: "+e),s&&w7("Access path missing closing quote: "+e),n>t&&(n++,u()),r}var A7=[],S7=(function(e,t,n){const i=I7(e);e=1===i.length?i[0]:e,b7((n&&n.get||T7)(i),[e],t||e)}("id"),b7(function(e){return e},A7,"identity"));b7(function(){return 0},A7,"zero"),b7(function(){return 1},A7,"one"),b7(function(){return!0},A7,"true"),b7(function(){return!1},A7,"false");function C7(e,t,n){var i=[t].concat([].slice.call(n));console[e].apply(console,i)}const O7=Array.isArray;function M7(e){return e===Object(e)}const R7=e=>"__proto__"!==e;function k7(...e){return e.reduce((e,t)=>{for(var n in t)if("signals"===n)e.signals=D7(e.signals,t.signals);else{var i="legend"===n?{layout:1}:"style"===n||null;N7(e,n,t[n],i)}return e},{})}function N7(e,t,n,i){var r,s;if(R7(t))if(M7(n)&&!O7(n))for(r in s=M7(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?N7(s,r,n[r]):R7(r)&&(s[r]=n[r]);else e[t]=n}function D7(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function F7(e){return null!=e?O7(e)?e:[e]:[]}const L7=Object.prototype.hasOwnProperty;function P7(e,t){return L7.call(e,t)}function B7(e){return"boolean"==typeof e}function $7(e){return"number"==typeof e}function U7(e){return"string"==typeof e}function z7(e){return O7(e)?"["+e.map(z7)+"]":M7(e)||U7(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function V7(e){for(var t={},n=0,i=e.length;n<i;++n)t[e[n]]=!0;return t}function j7(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}Object.create;Object.create;Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function e(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,function(n,i){return Array.isArray(i)?n.push.apply(n,e.call(i,t-1)):n.push(i),n},[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,"flatMap",{configurable:!0,value:function(e){return Array.prototype.map.apply(this,arguments).flat()},writable:!0});var Y7=n(1779),G7=n.n(Y7),H7=n(32017),W7=n.n(H7),X7=n(72492),q7=n.n(X7);function K7(e){return!!e.or}function Z7(e){return!!e.and}function Q7(e){return!!e.not}function J7(e,t){if(Q7(e))J7(e.not,t);else if(Z7(e))for(const n of e.and)J7(n,t);else if(K7(e))for(const n of e.or)J7(n,t);else t(e)}function eee(e,t){return Q7(e)?{not:eee(e.not,t)}:Z7(e)?{and:e.and.map(e=>eee(e,t))}:K7(e)?{or:e.or.map(e=>eee(e,t))}:t(e)}const tee=W7(),nee=G7();function iee(e,t){const n={};for(const i of t)P7(e,i)&&(n[i]=e[i]);return n}function ree(e,t){const n=Object.assign({},e);for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>q7()(e)).join(",")})`};const see=q7();function oee(e){if($7(e))return e;const t=U7(e)?e:q7()(e);if(t.length<250)return t;let n=0;for(let e=0;e<t.length;e++){n=(n<<5)-n+t.charCodeAt(e),n&=n}return n}function aee(e){return!1===e||null===e}function lee(e,t){return e.indexOf(t)>-1}function uee(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function cee(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function dee(e,t){for(const n of yee(t))N7(e,n,t[n],!0)}function hee(e,t){const n=[],i={};let r;for(const s of e)r=t(s),r in i||(i[r]=1,n.push(s));return n}function pee(e,t){for(const n of e)if(t.has(n))return!0;return!1}function fee(e){const t=new Set;for(const n of e){const e=I7(n).map((e,t)=>0===t?e:`[${e}]`),i=e.map((t,n)=>e.slice(0,n+1).join(""));for(const e of i)t.add(e)}return t}function mee(e,t){return void 0===e||void 0===t||pee(fee(e),fee(t))}function gee(e){return 0===yee(e).length}const yee=Object.keys,_ee=Object.values;function vee(e){const t=[];for(const n in e)P7(e,n)&&t.push({key:n,value:e[n]});return t}function bee(e){return!0===e||!1===e}function Tee(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function xee(e,t){return Q7(e)?"!("+xee(e.not,t)+")":Z7(e)?"("+e.and.map(e=>xee(e,t)).join(") && (")+")":K7(e)?"("+e.or.map(e=>xee(e,t)).join(") || (")+")":t(e)}function Eee(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&Eee(e[n],t)&&delete e[n],gee(e)}function wee(e){return e.charAt(0).toUpperCase()+e.substr(1)}function Iee(e,t="datum"){const n=I7(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map(z7).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function Aee(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function See(e){return`${I7(e).map(Aee).join("\\.")}`}function Cee(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function Oee(e){return`${I7(e).join(".")}`}function Mee(e){return e?I7(e).length:0}function Ree(...e){for(const t of e)if(void 0!==t)return t}let kee=42;function Nee(e){if(void 0!==e)return(e%360+360)%360}function Dee(e){return!!$7(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const Fee={domainColor:{part:"domain",vgProp:"stroke"},labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDash"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDash"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"},titleColor:{part:"title",vgProp:"fill"},title:null};function Lee(e){return e&&e.condition}const Pee=["domain","grid","labels","ticks","title"],Bee={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"main",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},$ee={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},Uee=Object.assign(Object.assign({},$ee),{style:1,labelExpr:1,encoding:1});function zee(e){return!!Uee[e]}yee(Uee);const Vee={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},jee=Vee.arc,Yee=Vee.area,Gee=Vee.bar,Hee=Vee.image,Wee=Vee.line,Xee=Vee.point,qee=Vee.rect,Kee=Vee.rule,Zee=Vee.text,Qee=Vee.tick,Jee=Vee.trail,ete=Vee.circle,tte=Vee.square,nte=Vee.geoshape;function ite(e){return lee(["line","area","trail"],e)}function rte(e){return lee(["rect","bar","image","arc"],e)}const ste=yee(Vee);function ote(e){return e.type}V7(ste);const ate=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],lte=yee({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBand:1,timeUnitBandPosition:1}),ute={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},cte={binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},dte={binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5};function hte(e){return"mark"in e}class pte{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!hte(e)&&function(e){return ote(e)?e.type:e}(e.mark)===this.name}}const fte={argmax:1,argmin:1,average:1,count:1,distinct:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},mte={count:1,min:1,max:1};function gte(e){return!!e&&!!e.argmin}function yte(e){return!!e&&!!e.argmax}yee(fte);function _te(e){return U7(e)&&!!fte[e]}const vte=["count","valid","missing","distinct"];function bte(e){return U7(e)&&lee(vte,e)}const Tte=["count","sum","distinct","valid","missing"],xte=V7(["mean","average","median","q1","q3","min","max"]),Ete="row",wte="column",Ite="facet",Ate="x",Ste="y",Cte="x2",Ote="y2",Mte="radius",Rte="radius2",kte="theta",Nte="theta2",Dte="latitude",Fte="longitude",Lte="latitude2",Pte="longitude2",Bte="color",$te="fill",Ute="stroke",zte="shape",Vte="size",jte="angle",Yte="opacity",Gte="fillOpacity",Hte="strokeOpacity",Wte="strokeWidth",Xte="strokeDash",qte="text",Kte="order",Zte="detail",Qte="key",Jte="tooltip",ene="href",tne="url",nne="description",ine={theta:1,theta2:1,radius:1,radius2:1};function rne(e){return e in ine}const sne={longitude:1,longitude2:1,latitude:1,latitude2:1};const one=yee(sne),ane=Object.assign(Object.assign(Object.assign(Object.assign({},{x:1,y:1,x2:1,y2:1}),ine),sne),{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1});function lne(e){return e===Bte||e===$te||e===Ute}const une={row:1,column:1,facet:1},cne=yee(une),dne=Object.assign(Object.assign({},ane),une),hne=yee(dne),{order:pne,detail:fne,tooltip:mne}=dne,gne=j7(dne,["order","detail","tooltip"]),{row:yne,column:_ne,facet:vne}=gne,bne=j7(gne,["row","column","facet"]);yee(gne),yee(bne);function Tne(e){return!!bne[e]}function xne(e){return!!dne[e]}const Ene=[Cte,Ote,Lte,Pte,Nte,Rte];function wne(e){return Ine(e)!==e}function Ine(e){switch(e){case Cte:return Ate;case Ote:return Ste;case Lte:return Dte;case Pte:return Fte;case Nte:return kte;case Rte:return Mte}return e}function Ane(e){if(rne(e))switch(e){case kte:return"startAngle";case Nte:return"endAngle";case Mte:return"outerRadius";case Rte:return"innerRadius"}return e}function Sne(e){switch(e){case Ate:return Cte;case Ste:return Ote;case Dte:return Lte;case Fte:return Pte;case kte:return Nte;case Mte:return Rte}}function Cne(e){switch(e){case Ate:case Cte:return"width";case Ste:case Ote:return"height"}}yee(ane);const{x:One,y:Mne,x2:Rne,y2:kne,latitude:Nne,longitude:Dne,latitude2:Fne,longitude2:Lne,theta:Pne,theta2:Bne,radius:$ne,radius2:Une}=ane,zne=j7(ane,["x","y","x2","y2","latitude","longitude","latitude2","longitude2","theta","theta2","radius","radius2"]),Vne=yee(zne),jne={x:1,y:1},Yne=yee(jne);function Gne(e){return e in jne}const Hne={theta:1,radius:1},Wne=yee(Hne);function Xne(e){return"width"===e?Ate:Ste}const{text:qne,tooltip:Kne,href:Zne,url:Qne,description:Jne,detail:eie,key:tie,order:nie}=zne,iie=j7(zne,["text","tooltip","href","url","description","detail","key","order"]),rie=yee(iie);const sie=Object.assign(Object.assign(Object.assign({},jne),Hne),iie),oie=yee(sie);function aie(e){return!!sie[e]}function lie(e,t){return function(e){switch(e){case Bte:case $te:case Ute:case nne:case Zte:case Qte:case Jte:case ene:case Kte:case Yte:case Gte:case Hte:case Wte:case Ite:case Ete:case wte:return uie;case Ate:case Ste:case Dte:case Fte:return die;case Cte:case Ote:case Lte:case Pte:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Vte:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Xte:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case zte:return{point:"always",geoshape:"always"};case qte:return{text:"always"};case jte:return{point:"always",square:"always",text:"always"};case tne:return{image:"always"};case kte:case Mte:return{text:"always",arc:"always"};case Nte:case Rte:return{arc:"always"}}}(e)[t]}const uie={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:cie}=uie,die=j7(uie,["geoshape"]);function hie(e){switch(e){case Ate:case Ste:case kte:case Mte:case Vte:case jte:case Wte:case Yte:case Gte:case Hte:case Cte:case Ote:case Nte:case Rte:return;case Ite:case Ete:case wte:case zte:case Xte:case qte:case Jte:case ene:case tne:case nne:return"discrete";case Bte:case $te:case Ute:return"flexible";case Dte:case Fte:case Lte:case Pte:case Zte:case Qte:case Kte:return}}function pie(e){return B7(e)&&(e=Roe(e,void 0)),"bin"+yee(e).map(t=>yie(e[t])?Tee(`_${t}_${Object.entries(e[t])}`):Tee(`_${t}_${e[t]}`)).join("")}function fie(e){return!0===e||gie(e)&&!e.binned}function mie(e){return"binned"===e||gie(e)&&!0===e.binned}function gie(e){return M7(e)}function yie(e){return null==e?void 0:e.selection}function _ie(e){switch(e){case Ete:case wte:case Vte:case Bte:case $te:case Ute:case Wte:case Yte:case Gte:case Hte:case zte:return 6;case Xte:return 4;default:return 10}}function vie(e){return`Invalid specification ${JSON.stringify(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const bie='Autosize "fit" only works for single views and layered views.';function Tie(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function xie(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function Eie(e){return e?`Dropping "fit-${e}" because spec has discrete ${Cne(e)}.`:'Dropping "fit" because spec has discrete size.'}function wie(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function Iie(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function Aie(e){return`Selection not supported for ${e} yet.`}function Sie(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function Cie(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function Oie(e){return`Ignoring an invalid transform: ${see(e)}.`}function Mie(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function Rie(e){return`Invalid field type "${e}".`}function kie(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function Nie(e,t){return`Dropping ${see(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function Die(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function Fie(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function Lie(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function Pie(e){return`Using unaggregated domain with raw field has no effect (${see(e)}).`}function Bie(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function $ie(e){return`Unaggregated domain is currently unsupported for log scale (${see(e)}).`}function Uie(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function zie(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const Vie="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function jie(e,t){return`Invalid ${e}: ${see(t)}.`}function Yie(e){return`1D error band does not support ${e}.`}function Gie(e){return`Channel ${e} is required for "binned" bin.`}const Hie=function(e,t){var n=e||0;return{level:function(e){return arguments.length?(n=+e,this):n},error:function(){return n>=1&&C7(t||"error","ERROR",arguments),this},warn:function(){return n>=2&&C7(t||"warn","WARN",arguments),this},info:function(){return n>=3&&C7(t||"log","INFO",arguments),this},debug:function(){return n>=4&&C7(t||"log","DEBUG",arguments),this}}}(2);let Wie=Hie;function Xie(){return Wie=Hie,Wie}function qie(...e){Wie.warn(...e)}function Kie(e){if(e&&M7(e))for(const t of rre)if(t in e)return!0;return!1}const Zie=["january","february","march","april","may","june","july","august","september","october","november","december"],Qie=Zie.map(e=>e.substr(0,3)),Jie=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],ere=Jie.map(e=>e.substr(0,3));function tre(e,t){const n=[];if(t&&void 0!==e.day&&yee(e).length>1&&(qie(function(e){return`Dropping day from datetime ${see(e)} as day cannot be combined with other units.`}(e)),delete(e=nee(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(Dee(e)&&(e=+e),$7(e))return e-1;{const t=e.toLowerCase(),n=Zie.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Qie.indexOf(i);if(-1!==r)return r;throw new Error(jie("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(Dee(e)&&(e=+e),$7(e))return e>4&&qie(jie("quarter",e)),e-1;throw new Error(jie("quarter",e))}(e.quarter):e.quarter;n.push($7(i)?3*i:i+"*3")}else n.push(0);if(void 0!==e.date)n.push(e.date);else if(void 0!==e.day){const i=t?function(e){if(Dee(e)&&(e=+e),$7(e))return e%7;{const t=e.toLowerCase(),n=Jie.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=ere.indexOf(i);if(-1!==r)return r;throw new Error(jie("day",e))}}(e.day):e.day;n.push($7(i)?i+1:i+"+1")}else n.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const i=e[t];n.push(void 0===i?0:i)}return n}function nre(e){const t=tre(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const ire={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},rre=yee(ire);function sre(e){return e.startsWith("utc")}const ore={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function are(e){const t=[];for(const n of rre)lre(e,n)&&t.push(n);return t}function lre(e,t){const n=e.indexOf(t);return!(n<0)&&(!(n>0&&"seconds"===t&&"i"===e.charAt(n-1))&&(!(e.length>n+3&&"day"===t&&"o"===e.charAt(n+3))&&!(n>0&&"year"===t&&"f"===e.charAt(n-1))))}function ure(e,t,{end:n}={end:!1}){const i=Iee(t),r=sre(e)?"utc":"";function s(e){return"quarter"===e?`(${r}quarter(${i})-1)`:`${r}${e}(${i})`}let o;const a={};for(const t of rre)lre(e,t)&&(a[t]=s(t),o=t);return n&&(a[o]+="+1"),function(e){const t=tre(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}function cre(e){if(!e)return;const t=are(e);return`timeUnitSpecifier(${q7()(t)}, ${q7()(ore)})`}function dre(e){if(!e)return;let t;return U7(e)?t={unit:e}:M7(e)&&(t=Object.assign(Object.assign({},e),e.unit?{unit:e.unit}:{})),sre(t.unit)&&(t.utc=!0,t.unit=t.unit.substr(3)),t}function hre(e){return e&&!!e.signal}function pre(e){return!!e.step}function fre(e){return!O7(e)&&("field"in e&&"data"in e)}const mre=yee({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1}),gre={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},yre=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function _re(e){return e&&!!e.field&&void 0!==e.equal}function vre(e){return e&&!!e.field&&void 0!==e.lt}function bre(e){return e&&!!e.field&&void 0!==e.lte}function Tre(e){return e&&!!e.field&&void 0!==e.gt}function xre(e){return e&&!!e.field&&void 0!==e.gte}function Ere(e){if(e&&e.field){if(O7(e.range)&&2===e.range.length)return!0;if(hre(e.range))return!0}return!1}function wre(e){return e&&!!e.field&&(O7(e.oneOf)||O7(e.in))}function Ire(e){return wre(e)||_re(e)||Ere(e)||vre(e)||Tre(e)||bre(e)||xre(e)}function Are(e,t){return Doe(e,{timeUnit:t,wrapTime:!0})}function Sre(e,t=!0){var n;const{field:i}=e,r=null===(n=dre(e.timeUnit))||void 0===n?void 0:n.unit,s=r?"time("+ure(r,i)+")":goe(e,{expr:"datum"});if(_re(e))return s+"==="+Are(e.equal,r);if(vre(e)){return`${s}<${Are(e.lt,r)}`}if(Tre(e)){return`${s}>${Are(e.gt,r)}`}if(bre(e)){return`${s}<=${Are(e.lte,r)}`}if(xre(e)){return`${s}>=${Are(e.gte,r)}`}if(wre(e))return`indexof([${function(e,t){return e.map(e=>Are(e,t))}(e.oneOf,r).join(",")}], ${s}) !== -1`;if(function(e){return e&&!!e.field&&void 0!==e.valid}(e))return Cre(s,e.valid);if(Ere(e)){const{range:n}=e,i=hre(n)?{signal:`${n.signal}[0]`}:n[0],o=hre(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==o&&t)return"inrange("+s+", ["+Are(i,r)+", "+Are(o,r)+"])";const a=[];return null!==i&&a.push(`${s} >= ${Are(i,r)}`),null!==o&&a.push(`${s} <= ${Are(o,r)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${JSON.stringify(e)}`)}function Cre(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function Ore(e){var t;return Ire(e)&&e.timeUnit?Object.assign(Object.assign({},e),{timeUnit:null===(t=dre(e.timeUnit))||void 0===t?void 0:t.unit}):e}const Mre={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};const Rre=Mre.quantitative,kre=Mre.ordinal,Nre=Mre.temporal,Dre=Mre.nominal,Fre=Mre.geojson,Lre=yee(Mre);const Pre="linear",Bre="log",$re="pow",Ure="sqrt",zre="symlog",Vre="time",jre="utc",Yre="quantile",Gre="quantize",Hre="threshold",Wre="point",Xre="band",qre={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"},Kre=yee(qre);function Zre(e,t){const n=qre[e],i=qre[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const Qre={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function Jre(e){return Qre[e]}const ese=["linear","log","pow","sqrt","symlog","time","utc"],tse=V7(ese),nse=V7(["linear","log","pow","sqrt","symlog"]);const ise=V7(["quantile","quantize","threshold"]),rse=V7(ese.concat(["quantile","quantize","threshold","sequential","identity"])),sse=V7(["ordinal","bin-ordinal","point","band"]);function ose(e){return e in sse}function ase(e){return e in rse}function lse(e){return e in tse}function use(e){return e in ise}function cse(e){return null==e?void 0:e.selection}const dse={type:1,domain:1,domainMid:1,align:1,range:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},{type:hse,domain:pse,range:fse,scheme:mse}=(yee(dse),dse),gse=j7(dse,["type","domain","range","scheme"]),yse=yee(gse);!function(){var e;const t={};for(const n of hne)for(const i of Lre)for(const r of Kre){const s=xse(n,i);Tse(n,r)&&bse(r,i)&&(t[s]=null!==(e=t[s])&&void 0!==e?e:[],t[s].push(r))}}();function _se(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!lee(["point","band","identity"],e);case"bins":return!lee(["point","band","identity","ordinal"],e);case"round":return lse(e)||"band"===e||"point"===e;case"padding":return lse(e)||lee(["point","band"],e);case"paddingOuter":case"align":return lee(["point","band"],e);case"paddingInner":return"band"===e;case"domainMid":case"clamp":return lse(e);case"nice":return lse(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return ase(e)&&!lee(["log","time","utc","threshold","quantile"],e)}}function vse(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return lne(e)?void 0:`Cannot use the scale property "${e}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"reverse":case"round":case"clamp":case"zero":return}}function bse(e,t){return lee([kre,Dre],t)?void 0===e||ose(e):t===Nre?lee([Vre,jre,void 0],e):t!==Rre||lee([Bre,$re,Ure,zre,Yre,Gre,Hre,Pre,void 0],e)}function Tse(e,t){if(!aie(e))return!1;switch(e){case Ate:case Ste:case kte:case Mte:return lse(t)||lee(["band","point"],t);case Vte:case Wte:case Yte:case Gte:case Hte:case jte:return lse(t)||use(t)||lee(["band","point","ordinal"],t);case Bte:case $te:case Ute:return"band"!==t;case Xte:return"ordinal"===t||use(t);case zte:return"ordinal"===t}}function xse(e,t){return e+"_"+t}function Ese(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:s}=e,o=Ose(e);return roe(n)&&!bte(n.aggregate)&&r&&lse(r.get("type"))&&!1===r.get("zero")?wse({fieldDef:n,channel:t,markDef:i,ref:o,config:s}):o}function wse({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(ite(n.type))return i;return null===joe("invalid",n,r)?i:[Ise(e,t),i]}function Ise(e,t){const n=Ase(e,!0),i="y"===Ine(t)?{field:{group:"height"}}:{value:0};return Object.assign({test:n},i)}function Ase(e,t=!0){return Cre(U7(e)?e:goe(e,{expr:"datum"}),!t)}function Sse(e,t,n,i){const r={};if(t&&(r.scale=t),ooe(e)){const{datum:t}=e;Kie(t)?r.signal=nre(t):hre(t)?r.signal=t.signal:r.value=t}else r.field=goe(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function Cse({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,band:s=.5}){const o=0<s&&s<1?"datum":void 0,a=goe(t,{expr:o,suffix:r}),l=void 0!==n?goe(n,{expr:o}):goe(t,{suffix:"end",expr:o}),u={};if(0===s||1===s){u.scale=e;const t=0===s?a:l;u.field=t}else{const t=`${s} * ${a} + ${1-s} * ${l}`;u.signal=`scale("${e}", ${t})`}return i&&(u.offset=i),u}function Ose({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:s,scale:o,stack:a,offset:l,defaultRef:u,band:c}){var d;if(t){if(uoe(t)){if(coe(t)){c=null!=c?c:Jse({channel:e,fieldDef:t,fieldDef2:n,markDef:i,stack:a,config:r,isMidPoint:!0});const{bin:o,timeUnit:u,type:d}=t;if(fie(o)||c&&u&&d===Nre)return a&&a.impute?Sse(t,s,{binSuffix:"mid"},{offset:l}):c?Cse({scaleName:s,fieldOrDatumDef:t,band:c,offset:l}):Sse(t,s,Loe(t,e)?{binSuffix:"range"}:{},{offset:l});if(mie(o)){if(roe(n))return Cse({scaleName:s,fieldOrDatumDef:t,fieldOrDatumDef2:n,band:c,offset:l});qie(Gie(e===Ate?Cte:Ote))}}const u=null==o?void 0:o.get("type");return Sse(t,s,ose(u)?{binSuffix:"range"}:{},{offset:l,band:"band"===u?null!==(d=null!=c?c:t.band)&&void 0!==d?d:.5:void 0})}if(doe(t)){const n=t.value,i=l?{offset:l}:{};return Object.assign(Object.assign({},Mse(e,n)),i)}}return"function"==typeof u&&(u=u()),u?Object.assign(Object.assign({},u),l?{offset:l}:{}):u}function Mse(e,t){return lee(["x","x2"],e)&&"width"===t?{field:{group:"width"}}:lee(["y","y2"],e)&&"height"===t?{field:{group:"height"}}:$oe(t)}function Rse(e){return e&&"number"!==e&&"time"!==e}function kse(e,t,n){return`${e}(${t}${n?`, ${JSON.stringify(n)}`:""})`}function Nse({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:s}){var o,a;if(Rse(n))return Fse({fieldOrDatumDef:e,format:t,formatType:n,expr:i,config:s});const l=Dse(e,i,r);if(Noe(e)){const n=function(e,t,n,i,r){return!t||n?`${r?"utc":"time"}Format(${e}, '${n=U7(n)?n:i}')`:function(e,t,n){if(!e)return;const i=cre(e);return`${n||sre(e)?"utc":"time"}Format(${t}, ${i})`}(t,e,r)}(l,roe(e)?null===(o=dre(e.timeUnit))||void 0===o?void 0:o.unit:void 0,t,s.timeFormat,hoe(e)&&(null===(a=e.scale)||void 0===a?void 0:a.type)===jre);return n?{signal:n}:void 0}if(t=Bse(soe(e),t,s),roe(e)&&fie(e.bin)){return{signal:zse(l,goe(e,{expr:i,binSuffix:"end"}),t,n,s)}}return t||"quantitative"===soe(e)?{signal:`${$se(l,t)}`}:{signal:`isValid(${l}) ? ${l} : ""+${l}`}}function Dse(e,t,n){return roe(e)?n?`${goe(e,{expr:t,suffix:"end"})}-${goe(e,{expr:t,suffix:"start"})}`:goe(e,{expr:t}):function(e){const{datum:t}=e;return Kie(t)?nre(t):`${JSON.stringify(t)}`}(e)}function Fse({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:s,field:o}){if(o=null!=o?o:Dse(e,i,r),roe(e)&&fie(e.bin)){return{signal:zse(o,goe(e,{expr:i,binSuffix:"end"}),t,n,s)}}return{signal:kse(n,o,t)}}function Lse(e,t,n,i,r,s){var o;if(!Rse(i)){if(Noe(e)){return function(e,t,n,i){if(e)return e;if(t)return{signal:cre(t)};return i?void 0:n.timeFormat}(n,roe(e)?null===(o=dre(e.timeUnit))||void 0===o?void 0:o.unit:void 0,r,s)}return Bse(t,n,r)}}function Pse(e,t,n){return e&&(hre(e)||"number"===e||"time"===e)?e:Noe(t)&&"time"!==n&&"utc"!==n?"time":void 0}function Bse(e,t,n){return U7(t)?t:e===Rre?n.numberFormat:void 0}function $se(e,t){return`format(${e}, "${t||""}")`}function Use(e,t,n,i){var r;return Rse(n)?kse(n,e,t):$se(e,null!==(r=U7(t)?t:void 0)&&void 0!==r?r:i.numberFormat)}function zse(e,t,n,i,r){const s=Use(e,n,i,r),o=Use(t,n,i,r);return`${Cre(e,!1)} ? "null" : ${s} + " " + ${o}`}const Vse="min",jse={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function Yse(e){return e in jse}function Gse(e){return!!e&&!!e.encoding}function Hse(e){return!(!e||"count"!==e.op&&!e.field)}function Wse(e){return!!e&&O7(e)}function Xse(e){return"row"in e||"column"in e}function qse(e){return!!e&&"header"in e}function Kse(e){return"facet"in e}function Zse(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return Object.assign(Object.assign(Object.assign(Object.assign({},n?{timeUnit:n}:{}),i?{bin:i}:{}),r?{aggregate:r}:{}),{field:t})}function Qse(e){return coe(e)&&"sort"in e}function Jse({channel:e,fieldDef:t,fieldDef2:n,markDef:i,stack:r,config:s,isMidPoint:o}){if(uoe(t)&&void 0!==t.band)return t.band;if(roe(t)){const{timeUnit:e,bin:r}=t;if(e&&!n)return o?Yoe("timeUnitBandPosition",i,s):rte(i.type)?Yoe("timeUnitBand",i,s):0;if(fie(r))return rte(i.type)&&!o?1:.5}return(null==r?void 0:r.fieldChannel)===e&&o?.5:void 0}function eoe(e,t,n,i,r,s){return!!(fie(t.bin)||t.timeUnit&&coe(t)&&"temporal"===t.type)&&!!Jse({channel:e,fieldDef:t,fieldDef2:n,stack:i,markDef:r,config:s})}function toe(e){return!!e&&"condition"in e}function noe(e){const t=e&&e.condition;return!!t&&!O7(t)&&roe(t)}function ioe(e){const t=e&&e.condition;return!!t&&!O7(t)&&uoe(t)}function roe(e){return!(!e||!e.field&&"count"!==e.aggregate)}function soe(e){return e&&e.type}function ooe(e){return!!e&&"datum"in e}function aoe(e){return coe(e)&&_oe(e)||loe(e)}function loe(e){return ooe(e)&&$7(e.datum)}function uoe(e){return roe(e)||ooe(e)}function coe(e){return!!e&&("field"in e&&"type"in e||"count"===e.aggregate)}function doe(e){return e&&"value"in e&&"value"in e}function hoe(e){return!!e&&("scale"in e||"sort"in e)}function poe(e){return e&&("axis"in e||"stack"in e||"impute"in e)}function foe(e){return!!e&&"legend"in e}function moe(e){return!!e&&("format"in e||"formatType"in e)}function goe(e,t={}){var n,i,r;let s=e.field;const o=t.prefix;let a=t.suffix,l="";if(function(e){return"count"===e.aggregate}(e))s=function(e){return 0===e.indexOf("__")}(u="count")?u:`__${u}`;else{let o;if(!t.nofn)if(function(e){return"op"in e}(e))o=e.op;else{const{bin:u,aggregate:c,timeUnit:d}=e;fie(u)?(o=pie(u),a=(null!==(n=t.binSuffix)&&void 0!==n?n:"")+(null!==(i=t.suffix)&&void 0!==i?i:"")):c?yte(c)?(l=`["${s}"]`,s=`argmax_${c.argmax}`):gte(c)?(l=`["${s}"]`,s=`argmin_${c.argmin}`):o=String(c):d&&(o=function(e){const t=dre(e),{utc:n}=t,i=j7(t,["utc"]);return i.unit?(n?"utc":"")+yee(i).map(e=>Tee(`${"unit"===e?"":`_${e}_`}${i[e]}`)).join(""):(n?"utc":"")+"timeunit"+yee(i).map(e=>Tee(`_${e}_${i[e]}`)).join("")}(d),a=(!lee(["range","mid"],t.binSuffix)&&t.binSuffix||"")+(null!==(r=t.suffix)&&void 0!==r?r:""))}o&&(s=s?`${o}_${s}`:o)}var u;return a&&(s=`${s}_${a}`),o&&(s=`${o}_${s}`),t.forAs?Oee(s):t.expr?function(e,t="datum"){return`${t}[${z7(I7(e).join("."))}]`}(s,t.expr)+l:See(s)+l}function yoe(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return roe(e)&&!!e.bin;case"temporal":return!1}throw new Error(Rie(e.type))}function _oe(e){return!yoe(e)}const voe=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(yte(t))return`${r} for argmax(${t.argmax})`;if(gte(t))return`${r} for argmin(${t.argmin})`;const s=dre(i),o=t||(null==s?void 0:s.unit)||(null==s?void 0:s.maxbins)&&"timeunit"||fie(n)&&"bin";return o?o.toUpperCase()+"("+r+")":r}(e);default:return function(e,t){var n;const{field:i,bin:r,timeUnit:s,aggregate:o}=e;if("count"===o)return t.countTitle;if(fie(r))return`${i} (binned)`;if(s){const e=null===(n=dre(s))||void 0===n?void 0:n.unit;if(e)return`${i} (${are(e).join("-")})`}else if(o)return yte(o)?`${i} for max ${o.argmax}`:gte(o)?`${i} for min ${o.argmin}`:`${wee(o)} of ${i}`;return i}(e,t)}};let boe=voe;function Toe(e){boe=e}function xoe(e,t,{allowDisabling:n,includeDefault:i=!0}){var r,s;const o=(null!==(r=Eoe(e))&&void 0!==r?r:{}).title;if(!roe(e))return o;const a=e,l=i?woe(a,t):void 0;return n?Ree(o,a.title,l):null!==(s=null!=o?o:a.title)&&void 0!==s?s:l}function Eoe(e){return poe(e)&&e.axis?e.axis:foe(e)&&e.legend?e.legend:qse(e)&&e.header?e.header:void 0}function woe(e,t){return boe(e,t)}function Ioe(e){var t;if(moe(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const n=null!==(t=Eoe(e))&&void 0!==t?t:{},{format:i,formatType:r}=n;return{format:i,formatType:r}}}function Aoe(e){return roe(e)?e:noe(e)?e.condition:void 0}function Soe(e){return uoe(e)?e:ioe(e)?e.condition:void 0}function Coe(e,t,n){if(U7(e)||$7(e)||B7(e)){return qie(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${see(n)}}.`}(t,U7(e)?"string":$7(e)?"number":"boolean",e)),{value:e}}return uoe(e)?Ooe(e,t,n):ioe(e)?Object.assign(Object.assign({},e),{condition:Ooe(e.condition,t,n)}):e}function Ooe(e,t,n){if(moe(e)){const{format:i,formatType:r}=e,s=j7(e,["format","formatType"]);if(Rse(r)&&!n.customFormatTypes)return qie(Mie(t)),Ooe(s,t,n)}else{const i=poe(e)?"axis":foe(e)?"legend":qse(e)?"header":null;if(i&&e[i]){const r=e[i],{format:s,formatType:o}=r,a=j7(r,["format","formatType"]);if(Rse(o)&&!n.customFormatTypes)return qie(Mie(t)),Ooe(Object.assign(Object.assign({},e),{[i]:a}),t,n)}}return roe(e)?Moe(e,t):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=$7(n)?"quantitative":U7(n)?"nominal":Kie(n)?"temporal":void 0,Object.assign(Object.assign({},e),{type:t})}(e)}function Moe(e,t){const{aggregate:n,timeUnit:i,bin:r,field:s}=e,o=Object.assign({},e);if(!n||_te(n)||yte(n)||gte(n)||(qie(function(e){return`Invalid aggregation operator "${e}".`}(n)),delete o.aggregate),i&&(o.timeUnit=dre(i)),s&&(o.field=`${s}`),fie(r)&&(o.bin=Roe(r,t)),mie(r)&&!Gne(t)&&qie(`Channel ${t} should not be used with "binned" bin.`),coe(o)){const{type:e}=o,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case Rre:return"quantitative";case"t":case Nre:return"temporal";case"o":case kre:return"ordinal";case"n":case Dre:return"nominal";case Fre:return"geojson"}}(e);e!==t&&(o.type=t),"quantitative"!==e&&bte(n)&&(qie(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,n)),o.type="quantitative")}else if(!wne(t)){const e=function(e,t){if(e.timeUnit)return"temporal";if(fie(e.bin))return"quantitative";switch(hie(t)){case"continuous":default:return"quantitative";case"discrete":case"flexible":return"nominal"}}(o,t);qie(function(e,t){return`Missing type for channel "${e}", using "${t}" instead.`}(t,e)),o.type=e}if(coe(o)){const{compatible:e,warning:n}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case Ete:case wte:case Ite:return _oe(e)?{compatible:!1,warning:Fie(t)}:koe;case Ate:case Ste:case Bte:case $te:case Ute:case qte:case Zte:case Qte:case Jte:case ene:case tne:case jte:case kte:case Mte:case nne:return koe;case Fte:case Pte:case Dte:case Lte:return n!==Rre?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:koe;case Yte:case Gte:case Hte:case Wte:case Vte:case Nte:case Rte:case Cte:case Ote:return"nominal"!==n||e.sort?koe:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case Xte:return lee(["ordinal","nominal"],e.type)?koe:{compatible:!1,warning:"StrokeDash channel should be used with only discrete data."};case zte:return lee(["ordinal","nominal","geojson"],e.type)?koe:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case Kte:return"nominal"!==e.type||"sort"in e?koe:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(o,t);e||qie(n)}if(Qse(o)&&U7(o.sort)){const{sort:e}=o;if(Yse(e))return Object.assign(Object.assign({},o),{sort:{encoding:e}});const t=e.substr(1);if("-"===e.charAt(0)&&Yse(t))return Object.assign(Object.assign({},o),{sort:{encoding:t,order:"descending"}})}if(qse(o)){const{header:e}=o,{orient:t}=e,n=j7(e,["orient"]);if(t)return Object.assign(Object.assign({},o),{header:Object.assign(Object.assign({},n),{labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t})})}return o}function Roe(e,t){return B7(e)?{maxbins:_ie(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:Object.assign(Object.assign({},e),{maxbins:_ie(t)})}const koe={compatible:!0};function Noe(e){const{formatType:t}=Ioe(e);return"time"===t||!t&&function(e){return e&&("temporal"===e.type||roe(e)&&!!e.timeUnit)}(e)}function Doe(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){var s;const o=t&&(null===(s=dre(t))||void 0===s?void 0:s.unit);let a,l=o||"temporal"===n;return hre(e)?a=e.signal:Kie(e)?(l=!0,a=nre(e)):(U7(e)||$7(e))&&l&&(a=`datetime(${JSON.stringify(e)})`,function(e){return!!ire[e]}(o)&&($7(e)&&e<1e4||U7(e)&&isNaN(Date.parse(e)))&&(a=nre({[o]:e}))),a?i&&l?`time(${a})`:a:r?void 0:JSON.stringify(e)}function Foe(e,t){const{type:n}=e;return t.map(t=>{const i=Doe(t,{timeUnit:roe(e)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t})}function Loe(e,t){return fie(e.bin)?aie(t)&&lee(["ordinal","nominal"],e.type):(console.warn("Only call this method for binned field defs."),!1)}function Poe(e){const{anchor:t,frame:n,offset:i,orient:r,color:s,subtitleColor:o,subtitleFont:a,subtitleFontSize:l,subtitleFontStyle:u,subtitleFontWeight:c,subtitleLineHeight:d,subtitlePadding:h}=e,p=j7(e,["anchor","frame","offset","orient","color","subtitleColor","subtitleFont","subtitleFontSize","subtitleFontStyle","subtitleFontWeight","subtitleLineHeight","subtitlePadding"]),f=Object.assign(Object.assign({},p),s?{fill:s}:{}),m=Object.assign(Object.assign(Object.assign(Object.assign({},t?{anchor:t}:{}),n?{frame:n}:{}),i?{offset:i}:{}),r?{orient:r}:{}),g=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o?{subtitleColor:o}:{}),a?{subtitleFont:a}:{}),l?{subtitleFontSize:l}:{}),u?{subtitleFontStyle:u}:{}),c?{subtitleFontWeight:c}:{}),d?{subtitleLineHeight:d}:{}),h?{subtitlePadding:h}:{});return{titleMarkConfig:f,subtitleMarkConfig:iee(f,["align","baseline","dx","dy","limit"]),nonMark:m,subtitle:g}}function Boe(e){return U7(e)||O7(e)&&U7(e[0])}function $oe(e){return hre(e)?e:void 0!==e?{value:e}:void 0}function Uoe(e){return hre(e)?e.signal:z7(e.value)}function zoe(e){return hre(e)?e.signal:null==e?null:z7(e)}function Voe(e){var t;return[].concat(e.type,null!==(t=e.style)&&void 0!==t?t:[])}function joe(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:s}=i;return r&&void 0!==t[r]?t[r]:void 0!==t[e]?t[e]:!s||r&&r!==e?Yoe(e,t,n,i):void 0}function Yoe(e,t,n,{vgChannel:i}={}){return Ree(i?Goe(e,t,n.style):void 0,Goe(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function Goe(e,t,n){return Hoe(e,Voe(t),n)}function Hoe(e,t,n){let i;t=F7(t);for(const r of t){const t=n[r];t&&void 0!==t[e]&&(i=t[e])}return i}function Woe(e,t){return F7(e).reduce((e,n)=>{var i;return e.field.push(goe(n,t)),e.order.push(null!==(i=n.sort)&&void 0!==i?i:"ascending"),e},{field:[],order:[]})}function Xoe(e,t){const n=[...e];return t.forEach(e=>{for(const t of n)if(tee(t,e))return;n.push(e)}),n}function qoe(e,t){return tee(e,t)||!t?e:e?[...F7(e),...F7(t)].join(", "):t}function Koe(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((Boe(n)||hre(n))&&(Boe(i)||hre(i)))return{explicit:e.explicit,value:qoe(n,i)};if(Boe(n)||hre(n))return{explicit:e.explicit,value:n};if(Boe(i)||hre(i))return{explicit:e.explicit,value:i};if(!(Boe(n)||hre(n)||Boe(i)||hre(i)))return{explicit:e.explicit,value:Xoe(n,i)};throw new Error("It should never reach here")}function Zoe(e,t){const n=e&&e[t];return!!n&&(O7(n)?uee(n,e=>!!e.field):roe(n)||noe(n))}function Qoe(e){return uee(hne,t=>{if(Zoe(e,t)){const n=e[t];if(O7(n))return uee(n,e=>!!e.aggregate);{const e=Aoe(n);return e&&!!e.aggregate}}return!1})}function Joe(e,t){const n=[],i=[],r=[],s=[],o={};return nae(e,(a,l)=>{if(roe(a)){const{field:u,aggregate:c,bin:d,timeUnit:h}=a,p=j7(a,["field","aggregate","bin","timeUnit"]);if(c||h||d){const e=Eoe(a),f=e&&e.title;let m=goe(a,{forAs:!0});const g=Object.assign(Object.assign(Object.assign({},f?[]:{title:xoe(a,t,{allowDisabling:!0})}),p),{field:m});if(c){let e;if(yte(c)?(e="argmax",m=goe({op:"argmax",field:c.argmax},{forAs:!0}),g.field=`${m}.${u}`):gte(c)?(e="argmin",m=goe({op:"argmin",field:c.argmin},{forAs:!0}),g.field=`${m}.${u}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:m};u&&(t.field=u),s.push(t)}}else if(n.push(m),coe(a)&&fie(d)){if(i.push({bin:d,field:u,as:m}),n.push(goe(a,{binSuffix:"end"})),Loe(a,l)&&n.push(goe(a,{binSuffix:"range"})),Gne(l)){const e={field:m+"_end"};o[l+"2"]=e}g.bin="binned",wne(l)||(g.type=Rre)}else if(h){r.push({timeUnit:h,field:u,as:m});const e=coe(a)&&a.type!==Nre&&"time";e&&(l===qte||l===Jte?g.formatType=e:!function(e){return!!zne[e]}(l)?Gne(l)&&(g.axis=Object.assign({formatType:e},g.axis)):g.legend=Object.assign({formatType:e},g.legend))}o[l]=g}else n.push(u),o[l]=e[l]}else o[l]=e[l]}),{bins:i,timeUnits:r,aggregate:s,groupby:n,encoding:o}}function eae(e,t,n){const i=t.type;return yee(e).reduce((r,s)=>{if(!xne(s))return qie(function(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}(s)),r;const o=e[s];if("angle"!==s||"arc"!==i||e.theta||(qie("Arc marks uses theta channel rather than angle, replacing angle with theta."),s=kte),!function(e,t,n){const i=lie(t,n);if(!i)return!1;if("binned"===i){const n=e[t===Cte?Ate:Ste];return!!(roe(n)&&roe(e[t])&&mie(n.bin))}return!0}(e,s,i))return qie(Die(s,i)),r;if(s===Vte&&"line"===i){const t=Aoe(e[s]);if(null==t?void 0:t.aggregate)return qie("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead."),r}if(s===Bte&&(t.filled?"fill"in e:"stroke"in e))return qie(kie("encoding",{fill:"fill"in e,stroke:"stroke"in e})),r;if(s===Zte||s===Kte&&!O7(o)&&!doe(o)||s===Jte&&O7(o))o&&(r[s]=F7(o).reduce((e,t)=>(roe(t)?e.push(Moe(t,s)):qie(Nie(t,s)),e),[]));else{if(s===Jte&&null===o)r[s]=null;else if(!(roe(o)||ooe(o)||doe(o)||toe(o)||hre(o)))return qie(Nie(o,s)),r;r[s]=Coe(o,s,n)}return r},{})}function tae(e){const t=[];for(const n of yee(e))if(Zoe(e,n)){const i=F7(e[n]);for(const e of i)roe(e)?t.push(e):noe(e)&&t.push(e.condition)}return t}function nae(e,t,n){if(e)for(const i of yee(e)){const r=e[i];if(O7(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function iae(e,t,n,i){return e?yee(e).reduce((n,r)=>{const s=e[r];return O7(s)?s.reduce((e,n)=>t.call(i,e,n,r),n):t.call(i,n,s,r)},n):n}function rae(e,t){return yee(t).reduce((n,i)=>{switch(i){case Ate:case Ste:case ene:case nne:case tne:case Cte:case Ote:case kte:case Nte:case Mte:case Rte:case Dte:case Fte:case Lte:case Pte:case qte:case zte:case jte:case Jte:return n;case Kte:if("line"===e||"trail"===e)return n;case Zte:case Qte:{const e=t[i];if(O7(e)||roe(e))for(const t of F7(e))t.aggregate||n.push(goe(t,{}));return n}case Vte:if("trail"===e)return n;case Bte:case $te:case Ute:case Yte:case Gte:case Hte:case Xte:case Wte:{const e=Aoe(t[i]);return e&&!e.aggregate&&n.push(goe(e,{})),n}}},[])}function sae(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};return{tooltip:[...e.map(({fieldPrefix:e,titlePrefix:n})=>{const r=i?` of ${t.field}`:"";return{field:e+t.field,type:t.type,title:hre(n)?{signal:n+`"${escape(r)}"`}:n+r}}),...tae(n)]}}function oae(e){const{axis:t,title:n,field:i}=e;return t&&void 0!==t.title?void 0:Ree(n,i)}function aae(e,t,n,i,r){const{scale:s,axis:o}=n;return({partName:a,mark:l,positionPrefix:u,endPositionPrefix:c,aria:d,extraEncoding:h={}})=>{const p=oae(n);return lae(e,a,r,d,{mark:l,encoding:Object.assign(Object.assign(Object.assign({[t]:Object.assign(Object.assign(Object.assign({field:u+"_"+n.field,type:n.type},void 0!==p?{title:p}:{}),void 0!==s?{scale:s}:{}),void 0!==o?{axis:o}:{})},U7(c)?{[t+"2"]:{field:c+"_"+n.field}}:{}),i),h)})}}function lae(e,t,n,i,r){const{clip:s,color:o,opacity:a}=e,l=e.type;return e[t]||void 0===e[t]&&n[t]?[Object.assign(Object.assign({},r),{mark:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n[t]),s?{clip:s}:{}),o?{color:o}:{}),a?{opacity:a}:{}),ote(r.mark)?r.mark:{type:r.mark}),{style:`${l}-${t}`}),B7(e[t])?{}:e[t]),!1===i?{aria:i}:{})})]:[]}function uae(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",s=i[r],o=i[r+"2"],a=i[r+"Error"],l=i[r+"Error2"];return{continuousAxisChannelDef:cae(s,n),continuousAxisChannelDef2:cae(o,n),continuousAxisChannelDefError:cae(a,n),continuousAxisChannelDefError2:cae(l,n),continuousAxis:r}}function cae(e,t){if(e&&e.aggregate){const{aggregate:n}=e,i=j7(e,["aggregate"]);return n!==t&&qie(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function dae(e,t){const{mark:n,encoding:i}=e,{x:r,y:s}=i;if(aoe(r)){if(aoe(s)){const e=roe(r)&&r.aggregate,i=roe(s)&&s.aggregate;if(e||i!==t){if(i||e!==t){if(e===t&&i===t)throw new Error("Both x and y cannot have aggregate");return ote(n)&&n.orient?n.orient:"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(aoe(s))return"vertical";throw new Error("Need a valid continuous axis for "+t+"s")}const hae="boxplot",pae=new pte(hae,mae);function fae(e){return $7(e)?"tukey":e}function mae(e,{config:t}){var n,i;const{mark:r,encoding:s,selection:o,projection:a}=e,l=j7(e,["mark","encoding","selection","projection"]),u=ote(r)?r:{type:r};o&&qie(Aie("boxplot"));const c=null!==(n=u.extent)&&void 0!==n?n:t.boxplot.extent,d=joe("size",u,t),h=fae(c),{transform:p,continuousAxisChannelDef:f,continuousAxis:m,groupby:g,aggregate:y,encodingWithoutContinuousAxis:_,ticksOrient:v,boxOrient:b,customTooltipWithoutAggregatedField:T}=function(e,t,n){const i=dae(e,hae),{continuousAxisChannelDef:r,continuousAxis:s}=uae(e,i,hae),o=r.field,a=fae(t),l=[...gae(o),{op:"median",field:o,as:"mid_box_"+o},{op:"min",field:o,as:("min-max"===a?"lower_whisker_":"min_")+o},{op:"max",field:o,as:("min-max"===a?"upper_whisker_":"max_")+o}],u="min-max"===a||"tukey"===a?[]:[{calculate:`datum["upper_box_${o}"] - datum["lower_box_${o}"]`,as:"iqr_"+o},{calculate:`min(datum["upper_box_${o}"] + datum["iqr_${o}"] * ${t}, datum["max_${o}"])`,as:"upper_whisker_"+o},{calculate:`max(datum["lower_box_${o}"] - datum["iqr_${o}"] * ${t}, datum["min_${o}"])`,as:"lower_whisker_"+o}],c=e.encoding,d=s,h=(c[d],j7(c,["symbol"==typeof d?d:d+""])),{customTooltipWithoutAggregatedField:p,filteredEncoding:f}=function(e){const{tooltip:t}=e,n=j7(e,["tooltip"]);if(!t)return{filteredEncoding:e};let i,r;if(O7(t)){for(const e of t)e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return O7(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(h),{bins:m,timeUnits:g,aggregate:y,groupby:_,encoding:v}=Joe(f,n),b="vertical"===i?"horizontal":"vertical",T=i,x=[...m,...g,{aggregate:[...y,...l],groupby:_},...u];return{transform:x,groupby:_,aggregate:y,continuousAxisChannelDef:r,continuousAxis:s,encodingWithoutContinuousAxis:v,ticksOrient:b,boxOrient:T,customTooltipWithoutAggregatedField:p}}(e,c,t),{color:x,size:E}=_,w=j7(_,["color","size"]),I=e=>aae(u,m,f,e,t.boxplot),A=I(w),S=I(_),C=I(Object.assign(Object.assign({},w),E?{size:E}:{})),O=sae([{fieldPrefix:"min-max"===h?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===h?"lower_whisker_":"min_",titlePrefix:"Min"}],f,_),M={type:"tick",color:"black",opacity:1,orient:v,invalid:null},R="min-max"===h?O:sae([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],f,_),k=[...A({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",aria:!1,extraEncoding:R}),...A({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",aria:!1,extraEncoding:R}),...A({partName:"ticks",mark:M,positionPrefix:"lower_whisker",aria:!1,extraEncoding:R}),...A({partName:"ticks",mark:M,positionPrefix:"upper_whisker",aria:!1,extraEncoding:R})],N=[..."tukey"!==h?k:[],...S({partName:"box",mark:Object.assign(Object.assign({type:"bar"},d?{size:d}:{}),{orient:b,invalid:null}),positionPrefix:"lower_box",endPositionPrefix:"upper_box",aria:!1,extraEncoding:O}),...C({partName:"median",mark:Object.assign(Object.assign(Object.assign({type:"tick",invalid:null},M7(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{}),d?{size:d}:{}),{orient:v,ariaRoleDescription:"box"}),positionPrefix:"mid_box",extraEncoding:O})];let D;if("min-max"!==h){const e=`datum["lower_box_${f.field}"]`,n=`datum["upper_box_${f.field}"]`,i=`(${n} - ${e})`,r=`${e} - ${c} * ${i}`,s=`${n} + ${c} * ${i}`,o=`datum["${f.field}"]`,a={joinaggregate:gae(f.field),groupby:g};let l;"tukey"===h&&(l={transform:[{filter:`(${r} <= ${o}) && (${o} <= ${s})`},{aggregate:[{op:"min",field:f.field,as:"lower_whisker_"+f.field},{op:"max",field:f.field,as:"upper_whisker_"+f.field},{op:"min",field:"lower_box_"+f.field,as:"lower_box_"+f.field},{op:"max",field:"upper_box_"+f.field,as:"upper_box_"+f.field},...y],groupby:g}],layer:k});const{tooltip:d}=w,p=j7(w,["tooltip"]),{scale:_,axis:v}=f,b=oae(f),x=lae(u,"outliers",t.boxplot,!0,{transform:[{filter:`(${o} < ${r}) || (${o} > ${s})`}],mark:"point",encoding:Object.assign(Object.assign({[m]:Object.assign(Object.assign(Object.assign({field:f.field,type:f.type},void 0!==b?{title:b}:{}),void 0!==_?{scale:_}:{}),void 0!==v?{axis:v}:{})},p),T?{tooltip:T}:{})})[0];x&&l?D={transform:[a],layer:[x,l]}:x?(D=x,D.transform.unshift(a)):l&&(D=l,D.transform.unshift(a))}return D?Object.assign(Object.assign({},l),{layer:[D,{transform:p,layer:N}]}):Object.assign(Object.assign({},l),{transform:(null!==(i=l.transform)&&void 0!==i?i:[]).concat(p),layer:N})}function gae(e){return[{op:"q1",field:e,as:"lower_box_"+e},{op:"q3",field:e,as:"upper_box_"+e}]}const yae="errorbar",_ae=new pte(yae,vae);function vae(e,{config:t}){const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:s,ticksOrient:o,markDef:a,outerSpec:l,tooltipEncoding:u}=Tae(e,yae,t),c=aae(a,r,i,s,t.errorbar),d={type:"tick",orient:o},h=[...c({partName:"ticks",mark:d,positionPrefix:"lower",aria:!1,extraEncoding:u}),...c({partName:"ticks",mark:d,positionPrefix:"upper",aria:!1,extraEncoding:u}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar"},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return Object.assign(Object.assign(Object.assign({},l),{transform:n}),h.length>1?{layer:h}:Object.assign({},h[0]))}function bae(e,t){const{encoding:n}=e;if(function(e){return(uoe(e.x)||uoe(e.y))&&!uoe(e.x2)&&!uoe(e.y2)&&!uoe(e.xError)&&!uoe(e.xError2)&&!uoe(e.yError)&&!uoe(e.yError2)}(n))return{orient:dae(e,t),inputType:"raw"};const i=function(e){return uoe(e.x2)||uoe(e.y2)}(n),r=function(e){return uoe(e.xError)||uoe(e.xError2)||uoe(e.yError)||uoe(e.yError2)}(n),s=n.x,o=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const e=n.x2,i=n.y2;if(uoe(e)&&uoe(i))throw new Error(`${t} cannot have both x2 and y2`);if(uoe(e)){if(aoe(s))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(uoe(i)){if(aoe(o))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,a=n.yError2;if(uoe(i)&&!uoe(e))throw new Error(`${t} cannot have xError2 without xError`);if(uoe(a)&&!uoe(r))throw new Error(`${t} cannot have yError2 without yError`);if(uoe(e)&&uoe(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(uoe(e)){if(aoe(s))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(uoe(r)){if(aoe(o))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function Tae(e,t,n){var i;const{mark:r,encoding:s,selection:o,projection:a}=e,l=j7(e,["mark","encoding","selection","projection"]),u=ote(r)?r:{type:r};o&&qie(Aie(t));const{orient:c,inputType:d}=bae(e,t),{continuousAxisChannelDef:h,continuousAxisChannelDef2:p,continuousAxisChannelDefError:f,continuousAxisChannelDefError2:m,continuousAxis:g}=uae(e,c,t),{errorBarSpecificAggregate:y,postAggregateCalculates:_,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,s,o,a){let l=[],u=[];const c=t.field;let d,h=!1;if("raw"===s){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":a.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&qie(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,o)),"stderr"===n||"stdev"===n)l=[{op:n,field:c,as:"extent_"+c},{op:t,field:c,as:"center_"+c}],u=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:"upper_"+c},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:"lower_"+c}],d=[{fieldPrefix:"center_",titlePrefix:wee(t)},{fieldPrefix:"upper_",titlePrefix:xae(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:xae(t,n,"-")}],h=!0;else{let t,i,r;e.center&&e.extent&&qie(function(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`}(e.extent,o)),"ci"===n?(t="mean",i="ci0",r="ci1"):(t="median",i="q1",r="q3"),l=[{op:i,field:c,as:"lower_"+c},{op:r,field:c,as:"upper_"+c},{op:t,field:c,as:"center_"+c}],d=[{fieldPrefix:"upper_",titlePrefix:xoe({field:c,aggregate:r,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:xoe({field:c,aggregate:i,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:xoe({field:c,aggregate:t,type:"quantitative"},a,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&qie(function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}(e.center,e.extent)),"aggregated-upper-lower"===s?(d=[],u=[{calculate:`datum["${n.field}"]`,as:"upper_"+c},{calculate:`datum["${c}"]`,as:"lower_"+c}]):"aggregated-error"===s&&(d=[{fieldPrefix:"",titlePrefix:c}],u=[{calculate:`datum["${c}"] + datum["${i.field}"]`,as:"upper_"+c}],r?u.push({calculate:`datum["${c}"] + datum["${r.field}"]`,as:"lower_"+c}):u.push({calculate:`datum["${c}"] - datum["${i.field}"]`,as:"lower_"+c}));for(const e of u)d.push({fieldPrefix:e.as.substring(0,6),titlePrefix:Cee(Cee(e.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:u,errorBarSpecificAggregate:l,tooltipSummary:d,tooltipTitleWithFieldName:h}}(u,h,p,f,m,d,t,n),T=s,x=g,E=(T[x],"x"===g?"x2":"y2"),w=(T[E],"x"===g?"xError":"yError"),I=(T[w],"x"===g?"xError2":"yError2"),A=(T[I],j7(T,["symbol"==typeof x?x:x+"","symbol"==typeof E?E:E+"","symbol"==typeof w?w:w+"","symbol"==typeof I?I:I+""])),{bins:S,timeUnits:C,aggregate:O,groupby:M,encoding:R}=Joe(A,n),k=[...O,...y],N="raw"!==d?[]:M,D=sae(v,h,R,b);return{transform:[...null!==(i=l.transform)&&void 0!==i?i:[],...S,...C,...0===k.length?[]:[{aggregate:k,groupby:N}],..._],groupby:N,continuousAxisChannelDef:h,continuousAxis:g,encodingWithoutContinuousAxis:R,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:u,outerSpec:l,tooltipEncoding:D}}function xae(e,t,n){return wee(e)+" "+n+" "+t}const Eae="errorband",wae=new pte(Eae,Iae);function Iae(e,{config:t}){const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:s,markDef:o,outerSpec:a,tooltipEncoding:l}=Tae(e,Eae,t),u=o,c=aae(u,r,i,s,t.errorband),d=void 0!==e.encoding.x&&void 0!==e.encoding.y;let h={type:d?"area":"rect"},p={type:d?"line":"rule"};const f=Object.assign(Object.assign({},u.interpolate?{interpolate:u.interpolate}:{}),u.tension&&u.interpolate?{tension:u.tension}:{});return d?(h=Object.assign(Object.assign(Object.assign({},h),f),{ariaRoleDescription:"errorband"}),p=Object.assign(Object.assign({},p),f)):u.interpolate?qie(Yie("interpolate")):u.tension&&qie(Yie("tension")),Object.assign(Object.assign({},a),{transform:n,layer:[...c({partName:"band",mark:h,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l}),...c({partName:"borders",mark:p,positionPrefix:"lower",aria:!1,extraEncoding:l}),...c({partName:"borders",mark:p,positionPrefix:"upper",aria:!1,extraEncoding:l})]})}const Aae={};function Sae(e,t,n){const i=new pte(e,t);Aae[e]={normalizer:i,parts:n}}Sae(hae,mae,["box","median","outliers","rule","ticks"]),Sae(yae,vae,["ticks","rule"]),Sae(Eae,Iae,["band","borders"]);const Cae=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],Oae=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],Mae={fillColor:{part:"legend",vgProp:"fill"},gradientStrokeColor:{part:"gradient",vgProp:"stroke"},labelColor:{part:"labels",vgProp:"fill"},strokeColor:{part:"legend",vgProp:"stroke"},symbolFillColor:{part:"symbols",vgProp:"fill"},symbolStrokeColor:{part:"symbols",vgProp:"stroke"},titleColor:{part:"title",vgProp:"fill"}},Rae={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},kae=(yee(Rae),"_vgsid_"),Nae={single:{on:"click",fields:[kae],resolve:"global",empty:"all",clear:"dblclick"},multi:{on:"click",fields:[kae],toggle:"event.shiftKey",resolve:"global",empty:"all",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Dae(e){return!(!e||"legend"!==e&&!e.legend)}function Fae(e){return Dae(e)&&M7(e)}function Lae(e){return"concat"in e}function Pae(e){return"vconcat"in e}function Bae(e){return"hconcat"in e}function $ae(e){return M7(e)&&void 0!==e.step}function Uae(e){return e.view||e.width||e.height}const zae=yee({align:1,bounds:1,center:1,columns:1,spacing:1});function Vae(e,t){var n;return null!==(n=e[t])&&void 0!==n?n:e["width"===t?"continuousWidth":"continuousHeight"]}function jae(e,t){const n=Yae(e,t);return $ae(n)?n.step:Gae}function Yae(e,t){var n;return Ree(null!==(n=e[t])&&void 0!==n?n:e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const Gae=20;const Hae={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:Gae},mark:{color:"#4c78a8",invalid:"filter",timeUnitBand:1},arc:{},area:{},bar:cte,circle:{},geoshape:{},image:{},line:{},point:{},rect:dte,rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:Nae,style:{},title:{},facet:{spacing:20},concat:{spacing:20}},Wae=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],Xae={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},qae={blue:Wae[0],orange:Wae[1],red:Wae[2],teal:Wae[3],green:Wae[4],yellow:Wae[5],purple:Wae[6],pink:Wae[7],brown:Wae[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function Kae(e={}){const{color:t,font:n,fontSize:i}=e,r=j7(e,["color","font","fontSize"]);return k7({},Hae,n?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(n):{},t?function(e={}){return{signals:[{name:"color",value:M7(e)?Object.assign(Object.assign({},qae),e):qae}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(t):{},i?function(e){return{signals:[{name:"fontSize",value:M7(e)?Object.assign(Object.assign({},Xae),e):Xae}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(i):{},r||{})}const Zae=["view",...ste],Qae=["color","fontSize","background","padding","facet","concat","numberFormat","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],Jae=Object.assign({view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"]},{area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]});function ele(e){e=nee(e);for(const t of Qae)delete e[t];if(e.axis)for(const t in e.axis)Lee(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of Cae)delete e.legend[t];if(e.mark){for(const t of lte)delete e.mark[t];e.mark.tooltip&&M7(e.mark.tooltip)&&delete e.mark.tooltip}for(const t of Zae){for(const n of lte)delete e[t][n];const n=Jae[t];if(n)for(const i of n)delete e[t][i];tle(e,t)}for(const t of yee(Aae))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=Poe(e.title);gee(t)||(e.style["group-title"]=Object.assign(Object.assign({},e.style["group-title"]),t));gee(n)||(e.style["group-subtitle"]=Object.assign(Object.assign({},e.style["group-subtitle"]),n));gee(i)?delete e.title:e.title=i}(e);for(const t in e)M7(e[t])&&gee(e[t])&&delete e[t];return gee(e)?void 0:e}function tle(e,t,n,i){const r=i?e[t][i]:e[t];"view"===t&&(n="cell");const s=Object.assign(Object.assign({},r),e.style[null!=n?n:t]);gee(s)||(e.style[null!=n?n:t]=s),i||delete e[t]}function nle(e){return"layer"in e}class ile{map(e,t){return Kse(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):Bae(e)?this.mapHConcat(e,t):Pae(e)?this.mapVConcat(e,t):Lae(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(nle(e))return this.mapLayer(e,t);if(hte(e))return this.mapUnit(e,t);throw new Error(vie(e))}mapLayer(e,t){return Object.assign(Object.assign({},e),{layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))})}mapHConcat(e,t){return Object.assign(Object.assign({},e),{hconcat:e.hconcat.map(e=>this.map(e,t))})}mapVConcat(e,t){return Object.assign(Object.assign({},e),{vconcat:e.vconcat.map(e=>this.map(e,t))})}mapConcat(e,t){const{concat:n}=e,i=j7(e,["concat"]);return Object.assign(Object.assign({},i),{concat:n.map(e=>this.map(e,t))})}mapFacet(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapRepeat(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}}const rle={zero:1,center:1,normalize:1};const sle=new Set([jee,Gee,Yee,Kee,Xee,ete,tte,Wee,Zee,Qee]),ole=new Set([Gee,Yee,jee]);function ale(e,t){var n,i;const r="x"===t?"y":"radius",s=e[t],o=e[r];if(roe(s)&&roe(o))if("quantitative"===soe(s)&&"quantitative"===soe(o)){if(s.stack)return t;if(o.stack)return r;const e=roe(s)&&!!s.aggregate;if(e!==(roe(o)&&!!o.aggregate))return e?t:r;{const e=null===(n=s.scale)||void 0===n?void 0:n.type,a=null===(i=o.scale)||void 0===i?void 0:i.type;if(e&&"linear"!==e)return r;if(a&&"linear"!==a)return t}}else{if("quantitative"===soe(s))return t;if("quantitative"===soe(o))return r}else{if("quantitative"===soe(s))return t;if("quantitative"===soe(o))return r}}function lle(e,t,n={}){const i=ote(e)?e.type:e;if(!sle.has(i))return null;const r=ale(t,"x")||ale(t,"theta");if(!r)return null;const s=t[r],o=roe(s)?goe(s,{}):void 0;let a=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(r),l=t[a],u=roe(l)?goe(l,{}):void 0;u===o&&(u=void 0,l=void 0,a=void 0);const c=Vne.reduce((e,n)=>{if("tooltip"!==n&&Zoe(t,n)){const i=t[n];for(const t of F7(i)){const i=Aoe(t);if(i.aggregate)continue;const r=goe(i,{});r&&r===u||e.push({channel:n,fieldDef:i})}}return e},[]);let d;if(void 0!==s.stack?d=B7(s.stack)?s.stack?"zero":null:s.stack:c.length>0&&ole.has(i)&&(d="zero"),!d||!function(e){return e in rle}(d))return null;if(Qoe(t)&&0===c.length)return null;if(s.scale&&s.scale.type&&s.scale.type!==Pre){if(n.disallowNonLinearStack)return null;qie(function(e){return`Cannot stack non-linear scale (${e}).`}(s.scale.type))}return uoe(t[Sne(r)])?(void 0!==s.stack&&qie(`Cannot stack "${h=r}" if there is already "${h}2".`),null):(roe(s)&&s.aggregate&&!lee(Tte,s.aggregate)&&qie(`Stacking is applied even though the aggregate function is non-summative ("${s.aggregate}").`),{groupbyChannel:l?a:void 0,groupbyField:u,fieldChannel:r,impute:null!==s.impute&&ite(i),stackBy:c,offset:d});var h}function ule(e){const{point:t,line:n}=e,i=j7(e,["point","line"]);return yee(i).length>1?i:i.type}function cle(e){for(const t of["line","area","rule","trail"])e[t]&&(e=Object.assign(Object.assign({},e),{[t]:ree(e[t],["point","line"])}));return e}function dle(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?M7(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?M7(t.point)?t.point:{}:void 0}function hle(e,t={}){return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class ple{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(hte(e)){const{mark:n,encoding:i}=e,r=ote(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!dle(r,t[r.type],i);case"area":return!!dle(r,t[r.type],i)||!!hle(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{selection:r,projection:s,encoding:o,mark:a}=e,l=j7(e,["selection","projection","encoding","mark"]),u=ote(a)?a:{type:a},c=dle(u,i[u.type],o),d="area"===u.type&&hle(u,i[u.type]),h=[Object.assign(Object.assign({},r?{selection:r}:{}),{mark:ule(Object.assign(Object.assign({},"area"===u.type&&void 0===u.opacity&&void 0===u.fillOpacity?{opacity:.7}:{}),u)),encoding:ree(o,["shape"])})],p=lle(u,o);let f=o;if(p){const{fieldChannel:e,offset:t}=p;f=Object.assign(Object.assign({},o),{[e]:Object.assign(Object.assign({},o[e]),t?{stack:t}:{})})}return d&&h.push(Object.assign(Object.assign({},s?{projection:s}:{}),{mark:Object.assign(Object.assign({type:"line"},iee(u,["clip","interpolate","tension","tooltip"])),d),encoding:f})),c&&h.push(Object.assign(Object.assign({},s?{projection:s}:{}),{mark:Object.assign(Object.assign({type:"point",opacity:1,filled:!0},iee(u,["clip","tooltip"])),c),encoding:f})),n(Object.assign(Object.assign({},l),{layer:h}),Object.assign(Object.assign({},t),{config:cle(i)}))}}class fle{constructor(){this.name="RangeStep"}hasMatchingType(e){var t;if(hte(e)&&e.encoding)for(const n of Yne){const i=e.encoding[n];if(i&&uoe(i)&&(null===(t=null==i?void 0:i.scale)||void 0===t?void 0:t.rangeStep))return!0}return!1}run(e){var t;const n={};let i=Object.assign({},e.encoding);for(const e of Yne){const r=Cne(e),s=i[e];if(s&&uoe(s)&&(null===(t=null==s?void 0:s.scale)||void 0===t?void 0:t.rangeStep)){const{scale:t}=s,o=j7(s,["scale"]),a=t,{rangeStep:l}=a,u=j7(a,["rangeStep"]);n[r]={step:t.rangeStep},qie('Scale\'s "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.'),i=Object.assign(Object.assign({},i),{[e]:Object.assign(Object.assign({},o),gee(u)?{}:{scale:u})})}}return Object.assign(Object.assign(Object.assign({},n),e),{encoding:i})}}function mle(e,t){return t?Xse(e)?Tle(e,t):_le(e,t):e}function gle(e,t){return t?Tle(e,t):e}function yle(e,t,n){const i=t[e];return function(e){return e&&!U7(e)&&"repeat"in e}(i)?i.repeat in n?Object.assign(Object.assign({},t),{[e]:n[i.repeat]}):void qie(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t}function _le(e,t){if(void 0!==(e=yle("field",e,t))){if(null===e)return null;if(Qse(e)&&Hse(e.sort)){const n=yle("field",e.sort,t);e=Object.assign(Object.assign({},e),n?{sort:n}:{})}return e}}function vle(e,t){if(roe(e))return _le(e,t);{const n=yle("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function ble(e,t){if(!uoe(e)){if(ioe(e)){const n=vle(e.condition,t);if(n)return Object.assign(Object.assign({},e),{condition:n});{const{condition:t}=e;return j7(e,["condition"])}}return e}{const n=vle(e,t);if(n)return n;if(toe(e))return{condition:e.condition}}}function Tle(e,t){const n={};for(const i in e)if(P7(e,i)){const r=e[i];if(O7(r))n[i]=r.map(e=>ble(e,t)).filter(e=>e);else{const e=ble(r,t);void 0!==e&&(n[i]=e)}}return n}class xle{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(hte(e)){const{encoding:t,mark:n}=e;if("line"===n)for(const e of Ene){const n=t[Ine(e)];if(t[e]&&(roe(n)&&!mie(n.bin)||ooe(n)))return!0}}return!1}run(e,t,n){const{encoding:i}=e;var r,s;return qie((r=!!i.x2,s=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${r&&s?"x2 and y2":r?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),n(Object.assign(Object.assign({},e),{mark:"rule"}),t)}}function Ele(e){const{parentEncoding:t,encoding:n}=e;if(t&&n){const e=yee(t).reduce((e,t)=>(n[t]&&e.push(t),e),[]);e.length>0&&qie(`Layer's shared ${(i=e).join(",")} channel ${1===i.length?"is":"are"} overriden.`)}var i;const r=Object.assign(Object.assign({},null!=t?t:{}),null!=n?n:{});return gee(r)?void 0:r}function wle(e){const{parentProjection:t,projection:n}=e;return t&&n&&qie(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${see(t)} is overridden by a child projection ${see(n)}.`}({parentProjection:t,projection:n})),null!=n?n:t}function Ile(e,t){void 0===t&&(t=Kae(e.config));const n=function(e,t={}){return Ale.map(e,{config:t})}(e,t),{width:i,height:r}=e,s=function(e,t,n){let{width:i,height:r}=t;const s=hte(e)||nle(e),o={};s?"container"==i&&"container"==r?(o.type="fit",o.contains="padding"):"container"==i?(o.type="fit-x",o.contains="padding"):"container"==r&&(o.type="fit-y",o.contains="padding"):("container"==i&&(qie(Tie("width")),i=void 0),"container"==r&&(qie(Tie("height")),r=void 0));const a=Object.assign(Object.assign(Object.assign({type:"pad"},o),n?Sle(n.autosize):{}),Sle(e.autosize));"fit"!==a.type||s||(qie(bie),a.type="pad");"container"==i&&"fit"!=a.type&&"fit-x"!=a.type&&qie(xie("width"));"container"==r&&"fit"!=a.type&&"fit-y"!=a.type&&qie(xie("height"));if(tee(a,{type:"pad"}))return;return a}(n,{width:i,height:r,autosize:e.autosize},t);return Object.assign(Object.assign({},n),s?{autosize:s}:{})}const Ale=new class extends ile{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[pae,_ae,wae,new ple,new xle,new fle]}map(e,t){if(hte(e)){const n=Zoe(e.encoding,Ete),i=Zoe(e.encoding,wte),r=Zoe(e.encoding,Ite);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=Object.assign(Object.assign({},e),{encoding:gle(e.encoding,t.repeater)});if(n||i)return this.mapUnitWithParentEncodingOrProjection(r,t);const s=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(r,t.config))return e.run(r,t,s);return r}mapRepeat(e,t){return function(e){return!O7(e.repeat)&&e.repeat.layer}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:n,spec:i}=e,r=j7(e,["repeat","spec"]),{row:s,column:o,layer:a}=n,{repeater:l={},repeaterPrefix:u=""}=t;return s||o?this.mapRepeat(Object.assign(Object.assign({},e),{repeat:Object.assign(Object.assign({},s?{row:s}:{}),o?{column:o}:{}),spec:{repeat:{layer:a},spec:i}}),t):Object.assign(Object.assign({},r),{layer:a.map(e=>{const n=Object.assign(Object.assign({},l),{layer:e}),r=(i.name||"")+u+`child__layer_${Tee(e)}`,s=this.mapLayerOrUnit(i,Object.assign(Object.assign({},t),{repeater:n,repeaterPrefix:r}));return s.name=r,s})})}mapNonLayerRepeat(e,t){var n;const{repeat:i,spec:r,data:s}=e,o=j7(e,["repeat","spec","data"]);!O7(i)&&e.columns&&(e=ree(e,["columns"]),qie(Sie("repeat")));const a=[],{repeater:l={},repeaterPrefix:u=""}=t,c=!O7(i)&&i.row||[l?l.row:null],d=!O7(i)&&i.column||[l?l.column:null],h=O7(i)&&i||[l?l.repeat:null];for(const e of h)for(const n of c)for(const s of d){const o={repeat:e,row:n,column:s,layer:l.layer},c=(r.name||"")+u+"child__"+(O7(i)?`${Tee(e)}`:(i.row?`row_${Tee(n)}`:"")+(i.column?`column_${Tee(s)}`:"")),d=this.map(r,Object.assign(Object.assign({},t),{repeater:o,repeaterPrefix:c}));d.name=c,a.push(ree(d,["data"]))}const p=O7(i)?e.columns:i.column?i.column.length:1;return Object.assign(Object.assign({data:null!==(n=r.data)&&void 0!==n?n:s,align:"all"},o),{columns:p,concat:a})}mapFacet(e,t){const{facet:n}=e;return Xse(n)&&e.columns&&(e=ree(e,["columns"]),qie(Sie("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:s,config:o}=t,a=wle({parentProjection:s,projection:i}),l=Ele({parentEncoding:r,encoding:gle(n,t.repeater)});return this.mapUnit(Object.assign(Object.assign(Object.assign({},e),a?{projection:a}:{}),l?{encoding:l}:{}),{config:o})}mapFacetedUnit(e,t){const n=e.encoding,{row:i,column:r,facet:s}=n,o=j7(n,["row","column","facet"]),{mark:a,width:l,projection:u,height:c,view:d,selection:h,encoding:p}=e,f=j7(e,["mark","width","projection","height","view","selection","encoding"]),{facetMapping:m,layout:g}=this.getFacetMappingAndLayout({row:i,column:r,facet:s},t),y=gle(o,t.repeater);return this.mapFacet(Object.assign(Object.assign(Object.assign({},f),g),{facet:m,spec:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l?{width:l}:{}),c?{height:c}:{}),d?{view:d}:{}),u?{projection:u}:{}),{mark:a,encoding:y}),h?{selection:h}:{})}),t)}getFacetMappingAndLayout(e,t){var n;const{row:i,column:r,facet:s}=e;if(i||r){s&&qie(`Facet encoding dropped as ${(o=[...i?[Ete]:[],...r?[wte]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const i of[Ete,wte]){const r=e[i];if(r){const{align:e,center:s,spacing:o,columns:l}=r,u=j7(r,["align","center","spacing","columns"]);t[i]=u;for(const e of["align","center","spacing"])void 0!==r[e]&&(a[e]=null!==(n=a[e])&&void 0!==n?n:{},a[e][i]=r[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:r}=s;return{facetMapping:mle(j7(s,["align","center","spacing","columns"]),t.repeater),layout:Object.assign(Object.assign(Object.assign(Object.assign({},e?{align:e}:{}),n?{center:n}:{}),i?{spacing:i}:{}),r?{columns:r}:{})}}var o}mapLayer(e,t){var{parentEncoding:n,parentProjection:i}=t,r=j7(t,["parentEncoding","parentProjection"]);const{encoding:s,projection:o}=e,a=j7(e,["encoding","projection"]),l=Object.assign(Object.assign({},r),{parentEncoding:Ele({parentEncoding:n,encoding:s}),parentProjection:wle({parentProjection:i,projection:o})});return super.mapLayer(a,l)}};function Sle(e){return U7(e)?{type:e}:null!=e?e:{}}const Cle=["background","padding"];function Ole(e){return Cle.reduce((t,n)=>(e&&void 0!==e[n]&&(t[n]=e[n]),t),{})}class Mle{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new Mle(nee(this.explicit),nee(this.implicit))}combine(){return Object.assign(Object.assign({},this.explicit),this.implicit)}get(e){return Ree(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,t){void 0!==t.value&&this.set(e,t.value,t.explicit)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,t){void 0!==t.explicit[e]?this.set(e,t.explicit[e],!0):void 0!==t.implicit[e]&&this.set(e,t.implicit[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of yee(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function Rle(e){return{explicit:!0,value:e}}function kle(e){return{explicit:!1,value:e}}function Nle(e){return(t,n,i,r)=>{const s=e(t.value,n.value);return s>0?t:s<0?n:Dle(t,n,i,r)}}function Dle(e,t,n,i){return e.explicit&&t.explicit&&qie(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${see(n)} and ${see(i)}). Using ${see(n)}.`}(n,i,e.value,t.value)),e}function Fle(e,t,n,i,r=Dle){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:tee(e.value,t.value)?e:r(e,t,n,i)}class Lle extends Mle{constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function Ple(e){return"url"in e}function Ble(e){return"values"in e}function $le(e){return"name"in e&&!Ple(e)&&!Ble(e)&&!Ule(e)}function Ule(e){return e&&(zle(e)||Vle(e)||jle(e))}function zle(e){return"sequence"in e}function Vle(e){return"sphere"in e}function jle(e){return"graticule"in e}const Yle="main",Gle="raw";function Hle(e){return"filter"in e}function Wle(e){return"lookup"in e}function Xle(e){return"pivot"in e}function qle(e){return"density"in e}function Kle(e){return"quantile"in e}function Zle(e){return"regression"in e}function Qle(e){return"loess"in e}function Jle(e){return"sample"in e}function eue(e){return"window"in e}function tue(e){return"joinaggregate"in e}function nue(e){return"flatten"in e}function iue(e){return"calculate"in e}function rue(e){return"bin"in e}function sue(e){return"impute"in e}function oue(e){return"timeUnit"in e}function aue(e){return"aggregate"in e}function lue(e){return"stack"in e}function uue(e){return"fold"in e}function cue(e,t,n,i){const r=toe(t)&&t.condition,s=i(t);if(r){const t=F7(r).map(t=>{const n=i(t),r=function(e){return e.selection}(t)?nhe(e,t.selection):rhe(e,t.test);return Object.assign({test:r},n)});return{[n]:[...t,...void 0!==s?[s]:[]]}}return void 0!==s?{[n]:s}:{}}function due(e,t="text"){const n=e.encoding[t];return cue(e,n,t,t=>hue(t,e.config))}function hue(e,t,n="datum"){if(e){if(doe(e))return $oe(e.value);if(uoe(e)){const{format:i,formatType:r}=Ioe(e);return Nse({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function pue(e,t={}){const{encoding:n,markDef:i,config:r,stack:s}=e,o=n.tooltip;if(O7(o))return{tooltip:mue({tooltip:o},s,r,t)};{const a=t.reactiveGeom?"datum.datum":"datum";return cue(e,o,"tooltip",e=>{const o=hue(e,r,a);if(o)return o;if(null===e)return;let l=joe("tooltip",i,r);return!0===l&&(l={content:"encoding"}),U7(l)?{value:l}:M7(l)?"encoding"===l.content?mue(n,s,r,t):{signal:a}:void 0})}}function fue(e,t,n,{reactiveGeom:i}={}){const r={},s=i?"datum.datum":"datum",o=[];function a(i,a){const l=Ine(a),u=coe(i)?i:Object.assign(Object.assign({},i),{type:e[l].type}),c=F7(xoe(u,n,{allowDisabling:!1})).join(", ");let d;if(Gne(a)){const i="x"===a?"x2":"y2",o=Aoe(e[i]);if(mie(u.bin)&&o){const e=goe(u,{expr:s}),t=goe(o,{expr:s}),{format:a,formatType:l}=Ioe(u);d=zse(e,t,a,l,n),r[i]=!0}else if(t&&t.fieldChannel===a&&"normalize"===t.offset){const{format:e,formatType:t}=Ioe(u);d=Nse({fieldOrDatumDef:u,format:e,formatType:t,expr:s,config:n,normalizeStack:!0}).signal}}d=null!=d?d:hue(u,n,s).signal,o.push({channel:a,key:c,value:d})}nae(e,(e,t)=>{roe(e)?a(e,t):noe(e)&&a(e.condition,t)});const l={};for(const{channel:e,key:t,value:n}of o)r[e]||l[t]||(l[z7(t)]=n);return l}function mue(e,t,n,{reactiveGeom:i}={}){const r=vee(fue(e,t,n,{reactiveGeom:i})).map(({key:e,value:t})=>`${e}: ${t}`);return r.length>0?{signal:`{${r.join(", ")}}`}:void 0}function gue(e){const{markDef:t,config:n}=e,i=joe("aria",t,n);return!1===i?{}:Object.assign(Object.assign(Object.assign({},i?{aria:i}:{}),function(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=joe("ariaRoleDescription",n,i);if(null!=r)return{ariaRoleDescription:{value:r}};return t in gre?{}:{ariaRoleDescription:{value:t}}}(e)),function(e){const{encoding:t,markDef:n,config:i,stack:r}=e,s=t.description;if(s)return cue(e,s,"description",t=>hue(t,e.config));const o=joe("description",n,i);if(null!=o)return{description:$oe(o)};if(!1===i.aria)return{};const a=fue(t,r,i);if(gee(a))return;return{description:{signal:vee(a).map(({key:e,value:t})=>`${e} + ": " + (${t})`).join(' + "; " + ')}}}(e))}function yue(e,t,n={}){const{markDef:i,encoding:r,config:s}=t,{vgChannel:o}=n;let{defaultRef:a,defaultValue:l}=n;void 0===a&&(l=null!=l?l:joe(e,i,s,{vgChannel:o,ignoreVgConfig:!0}),void 0!==l&&(a=$oe(l)));const u=r[e];return cue(t,u,null!=o?o:e,n=>Ose({channel:e,channelDef:n,markDef:i,config:s,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:a}))}function _ue(e,t={filled:void 0}){var n,i,r,s;const{markDef:o,encoding:a,config:l}=e,{type:u}=o,c=null!==(n=t.filled)&&void 0!==n?n:joe("filled",o,l),d=lee(["bar","point","circle","square","geoshape"],u)?"transparent":void 0,h=null!==(r=null!==(i=joe(!0===c?"color":void 0,o,l,{vgChannel:"fill"}))&&void 0!==i?i:l.mark[!0===c&&"color"])&&void 0!==r?r:d,p=null!==(s=joe(!1===c?"color":void 0,o,l,{vgChannel:"stroke"}))&&void 0!==s?s:l.mark[!1===c&&"color"],f=c?"fill":"stroke",m=Object.assign(Object.assign({},h?{fill:$oe(h)}:{}),p?{stroke:$oe(p)}:{});return o.color&&(c?o.fill:o.stroke)&&qie(kie("property",{fill:"fill"in o,stroke:"stroke"in o})),Object.assign(Object.assign(Object.assign(Object.assign({},m),yue("color",e,{vgChannel:f,defaultValue:c?h:p})),yue("fill",e,{defaultValue:a.fill?h:void 0})),yue("stroke",e,{defaultValue:a.stroke?p:void 0}))}function vue(e,t){const n=function(e){switch(e){case Ate:return"xOffset";case Ste:return"yOffset";case Cte:return"x2Offset";case Ote:return"y2Offset";case kte:return"thetaOffset";case Mte:return"radiusOffset";case Nte:return"theta2Offset";case Rte:return"radius2Offset"}}(e),i=t[n];if(i)return i}function bue(e,t,{defaultPos:n,vgChannel:i,isMidPoint:r}){const{encoding:s,markDef:o,config:a,stack:l}=t,u=s[e],c=s[Sne(e)],d=t.scaleName(e),h=t.getScaleComponent(e),p=vue(e,o),f=Tue({model:t,defaultPos:n,channel:e,scaleName:d,scale:h}),m=!u&&Gne(e)&&(s.latitude||s.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,isMidPoint:i,scaleName:r,stack:s,offset:o,markDef:a,config:l}=e;if(uoe(n)&&s&&t===s.fieldChannel){if(roe(n)){const e=Jse({channel:t,fieldDef:n,isMidPoint:i,markDef:a,stack:s,config:l});if(void 0!==e)return Cse({scaleName:r,fieldOrDatumDef:n,startSuffix:"start",band:e,offset:o})}return Sse(n,r,{suffix:"end"},{offset:o})}return Ese(e)}({channel:e,channelDef:u,channel2Def:c,markDef:o,config:a,isMidPoint:r,scaleName:d,scale:h,stack:l,offset:p,defaultRef:f});return m?{[i||e]:m}:void 0}function Tue({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:s,config:o}=e;return()=>{const a=Ine(n),l=Ane(n),u=joe(n,s,o,{vgChannel:l});if(void 0!==u)return Mse(n,u);switch(t){case"zeroOrMin":case"zeroOrMax":if(i){const e=r.get("type");if(lee([Bre,Vre,jre],e));else if(r.domainDefinitelyIncludesZero())return{scale:i,value:0}}if("zeroOrMin"===t)return"y"===a?{field:{group:"height"}}:{value:0};switch(a){case"radius":return{signal:`min(${e.width.signal},${e.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":{const t=e[Cne(n)];return Object.assign(Object.assign({},t),{mult:.5})}}}}const xue={left:"x",center:"xc",right:"x2"},Eue={top:"y",middle:"yc",bottom:"y2"};function wue(e,t,n,i="middle"){if("radius"===e||"theta"===e)return Ane(e);const r=joe("x"===e?"align":"baseline",t,n);return"x"===e?xue[r||("top"===i?"left":"center")]:Eue[r||i]}function Iue(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?Aue(e,t,{defaultPos:n,defaultPos2:i}):bue(e,t,{defaultPos:n})}function Aue(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:s}=t,o=Sne(e),a=Cne(e),l=function(e,t,n){const{encoding:i,mark:r,markDef:s,stack:o,config:a}=e,l=Ine(n),u=Cne(n),c=Ane(n),d=i[l],h=e.scaleName(l),p=e.getScaleComponent(l),f=vue(n in i||n in s?n:l,e.markDef);if(!d&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude))return{[c]:{field:e.getName(n)}};const m=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:s,scale:o,stack:a,offset:l,defaultRef:u}){if(uoe(t)&&a&&e.charAt(0)===a.fieldChannel.charAt(0))return Sse(t,s,{suffix:"start"},{offset:l});return Ese({channel:e,channelDef:n,scaleName:s,scale:o,stack:a,markDef:i,config:r,offset:l,defaultRef:u})}({channel:n,channelDef:d,channel2Def:i[n],markDef:s,config:a,scaleName:h,scale:p,stack:o,offset:f,defaultRef:void 0});if(void 0!==m)return{[c]:m};return Sue(n,s)||Sue(n,{[n]:Goe(n,s,a.style),[u]:Goe(u,s,a.style)})||Sue(n,a[r])||Sue(n,a.mark)||{[c]:Tue({model:e,defaultPos:t,channel:n,scaleName:h,scale:p})()}}(t,i,o),u=l[a]?wue(e,r,s):Ane(e);return Object.assign(Object.assign({},bue(e,t,{defaultPos:n,vgChannel:u})),l)}function Sue(e,t){const n=Cne(e),i=Ane(e);return void 0!==t[i]?{[i]:Mse(e,t[i])}:void 0!==t[e]?{[i]:Mse(e,t[e])}:t[n]?{[n]:Mse(e,t[n])}:void 0}function Cue(e,t,n){var i,r,s,o;const{config:a,encoding:l,markDef:u,stack:c}=e,d=Sne(t),h=Cne(t),p=l[t],f=l[d],m=e.getScaleComponent(t),g=m?m.get("type"):void 0,y=e.scaleName(t),_=u.orient,v=null!==(r=null!==(i=l[h])&&void 0!==i?i:l.size)&&void 0!==r?r:joe("size",u,a,{vgChannel:h}),b="bar"===n&&("x"===t?"vertical"===_:"horizontal"===_);if(roe(p)&&(fie(p.bin)||mie(p.bin)||p.timeUnit&&!f)&&!v&&!ose(g)){const n=Jse({channel:t,fieldDef:p,stack:c,markDef:u,config:a}),i=null===(s=e.component.axes[t])||void 0===s?void 0:s[0];return function({fieldDef:e,fieldDef2:t,channel:n,band:i,scaleName:r,markDef:s,spacing:o=0,axisTranslate:a,reverse:l,config:u}){const c=Sne(n),d=Ane(n),h=Ane(c),p=vue(n,s);if(fie(e.bin)||e.timeUnit)return{[h]:Rue({channel:n,fieldDef:e,scaleName:r,markDef:s,band:(1-i)/2,offset:Mue(c,o,l,a,p),config:u}),[d]:Rue({channel:n,fieldDef:e,scaleName:r,markDef:s,band:1-(1-i)/2,offset:Mue(n,o,l,a,p),config:u})};if(mie(e.bin)){const i=Sse(e,r,{},{offset:Mue(c,o,l,a,p)});if(roe(t))return{[h]:i,[d]:Sse(t,r,{},{offset:Mue(n,o,l,a,p)})};if(gie(e.bin)&&e.bin.step)return{[h]:i,[d]:{signal:`scale("${r}", ${goe(e,{expr:"datum"})} + ${e.bin.step})`,offset:Mue(n,o,l,a,p)}}}return void qie(Gie(c))}({fieldDef:p,fieldDef2:f,channel:t,markDef:u,scaleName:y,band:n,axisTranslate:null!==(o=null==i?void 0:i.get("translate"))&&void 0!==o?o:.5,spacing:Gne(t)?joe("binSpacing",u,a):void 0,reverse:m.get("reverse"),config:a})}return(uoe(p)&&ose(g)||b)&&!f?function(e,t,n,i){var r;const{markDef:s,encoding:o,config:a,stack:l}=i,u=s.orient,c=i.scaleName(n),d=i.getScaleComponent(n),h=Cne(n),p=Sne(n),f="horizontal"===u&&"y"===n||"vertical"===u&&"x"===n,m=joe(f?"size":h,s,a,{vgChannel:h});let g;(o.size||void 0!==m)&&(f?g=yue("size",i,{vgChannel:h,defaultValue:m}):qie(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(s.type)));const y=null!==(r=uoe(t)?Jse({channel:n,fieldDef:t,markDef:s,stack:l,config:a}):void 0)&&void 0!==r?r:1;g=g||{[h]:Oue(e,h,c,d,a,y)};const _="band"!==(null==d?void 0:d.get("type"))||!("band"in g[h]),v=wue(n,s,a,_?"middle":"top"),b=vue(n,s),T=Ese({channel:n,channelDef:t,markDef:s,config:a,scaleName:c,scale:d,stack:l,offset:b,defaultRef:Tue({model:i,defaultPos:"mid",channel:n,scaleName:c,scale:d}),band:_?.5:(1-y)/2});if(h)return Object.assign({[v]:T},g);{const e=Ane(p),t=g[h],n=b?Object.assign(Object.assign({},t),{offset:b}):t;return{[v]:T,[e]:O7(T)?[T[0],Object.assign(Object.assign({},T[1]),{offset:n})]:Object.assign(Object.assign({},T),{offset:n})}}}(n,p,t,e):Aue(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function Oue(e,t,n,i,r,s){if(i){const t=i.get("type");if("point"===t||"band"===t){if(void 0!==r[e].discreteBandSize)return{value:r[e].discreteBandSize};if(t===Wre){const e=i.get("range");return pre(e)&&$7(e.step)?{value:e.step-2}:{value:Gae-2}}return{scale:n,band:s}}return{value:r[e].continuousBandSize}}const o=jae(r.view,t),a=Ree(r[e].discreteBandSize,o-2);return void 0!==a?{value:a}:void 0}function Mue(e,t,n,i,r){if(rne(e))return 0;const s="x"===e||"y2"===e?-t/2:t/2;if(hre(n)){const e=zoe(r);return{signal:`${n.signal} ? ${i-s}${e?"-"+e:""} : ${i+s}${e?"+"+e:""}`}}if(hre(r)){const e=i+(n?-s:s);return{signal:`${e||""}${n?" - ":e?" + ":""}${r.signal}`}}return r=r||0,i+(n?-r-s:+r+s)}function Rue({channel:e,fieldDef:t,scaleName:n,markDef:i,band:r,offset:s,config:o}){return wse({fieldDef:t,channel:e,markDef:i,ref:Cse({scaleName:n,fieldOrDatumDef:t,band:r,offset:s}),config:o})}const kue=new Set(["aria"]);function Nue(e,t){const{fill:n,stroke:i}="include"===t.color?_ue(e):{};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},function(e,t){return mre.reduce((n,i)=>(kue.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=$oe(e[i])),n),{})}(e.markDef,t)),Due(e,"fill",n)),Due(e,"stroke",i)),yue("opacity",e)),yue("fillOpacity",e)),yue("strokeOpacity",e)),yue("strokeWidth",e)),yue("strokeDash",e)),pue(e)),due(e,"href")),gue(e))}function Due(e,t,n){const{config:i,mark:r,markDef:s}=e;if("hide"===joe("invalid",s,i)&&n&&!ite(r)){const i=function(e,{invalid:t=!1,channels:n}){const i=n.reduce((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),s=e.vgField(n,{expr:"datum"});s&&ase(r)&&(t[s]=!0)}return t},{}),r=yee(i);if(r.length>0){const e=t?"||":"&&";return r.map(e=>Ase(e,t)).join(` ${e} `)}return}(e,{invalid:!0,channels:oie});if(i)return{[t]:[{test:i,value:null},...F7(n)]}}return n?{[t]:n}:{}}function Fue(e){const{config:t,markDef:n}=e;if(joe("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const i=n.reduce((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),s=e.vgField(n,{expr:"datum"});s&&ase(r)&&(t[s]=!0)}return t},{}),r=yee(i);if(r.length>0){const e=t?"||":"&&";return r.map(e=>Ase(e,t)).join(` ${e} `)}return}(e,{channels:Yne});if(t)return{defined:{signal:t}}}return{}}function Lue(e,t){if(void 0!==t)return{[e]:$oe(t)}}const Pue="voronoi",Bue={has:e=>"interval"!==e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(Pue)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,s=e.mark;if(ite(s))return qie(`The "nearest" transform is not supported for ${s} marks.`),n;const o={name:e.getName(Pue),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:Object.assign({fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0}},pue(e,{reactiveGeom:!0}))},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let a=0,l=!1;return n.forEach((t,n)=>{var i;const r=null!==(i=t.name)&&void 0!==i?i:"";r===e.component.mark[0].name?a=n:r.indexOf(Pue)>=0&&(l=!0)}),l||n.splice(a+1,0,o),n}},$ue=Bue;class Uue{constructor(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.indexOf(e)>-1?console.warn("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this),e.parent.removeChild(e),this.parent=t,e.parent=this}}class zue extends Uue{constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}clone(){const e=new this.constructor;return e.debugName="clone_"+this.debugName,e._source=this._source,e._name="clone_"+this._name,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${function(e){const t=++kee;return e?String(e)+t:t}()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class Vue extends Uue{constructor(e,t){super(e),this.formula=t}clone(){return new Vue(null,nee(this.formula))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{const{field:r,timeUnit:s}=n,o=Ffe(t)?t.encoding[Sne(i)]:void 0,a=Ffe(t)&&eoe(i,n,o,t.stack,t.markDef,t.config);if(s){const t=goe(n,{forAs:!0});e[oee({as:t,field:r,timeUnit:s})]=Object.assign({as:t,field:r,timeUnit:s},a?{band:!0}:{})}return e},{});return gee(n)?null:new Vue(e,n)}static makeFromTransform(e,t){const n=Object.assign({},t),{timeUnit:i}=n,r=j7(n,["timeUnit"]),s=dre(i),o=Object.assign(Object.assign({},r),{timeUnit:s});return new Vue(e,{[oee(o)]:o})}merge(e){this.formula=Object.assign({},this.formula);for(const t in e.formula)this.formula[t]&&!e.formula[t].band||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(_ee(this.formula).map(e=>e.as))}dependentFields(){return new Set(_ee(this.formula).map(e=>e.field))}hash(){return`TimeUnit ${oee(this.formula)}`}assemble(){const e=[];for(const t of _ee(this.formula)){const{field:n,as:i,timeUnit:r}=t,s=dre(r),{unit:o,utc:a}=s,l=j7(s,["unit","utc"]);e.push(Object.assign(Object.assign(Object.assign(Object.assign({field:See(n),type:"timeunit"},o?{units:are(o)}:{}),a?{timezone:"utc"}:{}),l),{as:[i,`${i}_end`]}))}return e}}const jue="_tuple_fields";class Yue{constructor(...e){this.items=e,this.hasChannel={},this.hasField={}}}const Gue={has:()=>!0,parse:(e,t,n)=>{var i,r,s;const o=t.name,a=null!==(i=t.project)&&void 0!==i?i:t.project=new Yue,l={},u={},c=new Set,d=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=Tee(`${o}_${n}`);for(let e=1;c.has(i);e++)i=Tee(`${o}_${n}_${e}`);return c.add(i),{[t]:i}};if(!n.fields&&!n.encodings){const t=e.config.selection[n.type];if(n.init)for(const e of F7(n.init))for(const i of yee(e))Tne(i)?(n.encodings||(n.encodings=[])).push(i):"interval"===n.type?(qie('Interval selections should be initialized using "x" and/or "y" keys.'),n.encodings=t.encodings):(n.fields||(n.fields=[])).push(i);else n.encodings=t.encodings,n.fields=t.fields}for(const e of null!==(r=n.fields)&&void 0!==r?r:[]){const t={type:"E",field:e};t.signals=Object.assign({},d(t,"data")),a.items.push(t),a.hasField[e]=t}for(const i of null!==(s=n.encodings)&&void 0!==s?s:[]){const n=e.fieldDef(i);if(n){let r=n.field;if(n.aggregate){qie(Iie(i,n.aggregate));continue}if(!r){qie(wie(i));continue}if(n.timeUnit){r=e.vgField(i);const t={timeUnit:n.timeUnit,as:r,field:n.field};u[oee(t)]=t}if(!l[r]){let s="E";if("interval"===t.type){ase(e.getScaleComponent(i).get("type"))&&(s="R")}else n.bin&&(s="R-RE");const o={field:r,channel:i,type:s};o.signals=Object.assign(Object.assign({},d(o,"data")),d(o,"visual")),a.items.push(l[r]=o),a.hasField[r]=a.hasChannel[i]=l[r]}}else qie(wie(i))}if(n.init){const e=e=>a.items.map(t=>void 0!==e[t.channel]?e[t.channel]:e[t.field]);if("interval"===n.type)t.init=e(n.init);else{const i=F7(n.init);t.init=i.map(e)}}gee(u)||(a.timeUnit=new Vue(null,u))},signals:(e,t,n)=>{const i=t.name+jue,r=n.filter(e=>e.name===i);return r.length>0?n:n.concat({name:i,value:t.project.items.map(e=>{const{signals:t,hasLegend:n}=e,i=j7(e,["signals","hasLegend"]);return i.field=See(i.field),i})})}},Hue={has:e=>"single"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!Dae(e.bind),parse:(e,t,n,i)=>{i.on||delete t.events,i.clear||delete t.clear},topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,s=t.bind,o=t.init&&t.init[0],a=$ue.has(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach((e,r)=>{var l,u;const c=Tee(`${i}_${e.field}`),d=n.filter(e=>e.name===c);d.length||n.unshift(Object.assign(Object.assign({name:c},o?{init:hce(o[r])}:{value:null}),{on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${a}[${z7(e.field)}] : null`}]:[],bind:null!==(u=null!==(l=s[e.field])&&void 0!==l?l:s[e.channel])&&void 0!==u?u:s}))}),n},signals:(e,t,n)=>{const i=t.name,r=t.project,s=n.filter(e=>e.name===i+Ece)[0],o=i+jue,a=r.items.map(e=>Tee(`${i}_${e.field}`)),l=a.map(e=>`${e} !== null`).join(" && ");return a.length&&(s.update=`${l} ? {fields: ${o}, values: [${a.join(", ")}]} : null`),delete s.value,delete s.on,n}},Wue=Hue,Xue="_toggle",que={has:e=>"multi"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+Xue,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Ece,i=t.name+Xue;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${Cce(e)}}, `)+`${i} ? ${n} : null`}},Kue={has:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t,n)=>{n.clear&&(t.clear=U7(n.clear)?f7(n.clear,"scope"):n.clear)},topLevelSignals:(e,t,n)=>{if(Wue.has(t))for(const e of t.project.items){const i=n.findIndex(n=>n.name===Tee(`${t.name}_${e.field}`));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)for(const e of t.project.items){const t=n.findIndex(t=>t.name===e.signals.visual);if(i(t,"[0, 0]"),-1===t){i(n.findIndex(t=>t.name===e.signals.data),"null")}}else{let e=n.findIndex(e=>e.name===t.name+Ece);i(e,"null"),que.has(t)&&(e=n.findIndex(e=>e.name===t.name+Xue),i(e,"false"))}return n}},Zue={has:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!aie(r))continue;const s=e.getScaleComponent(r),o=s?s.get("type"):void 0;if(!s||!ase(o)){qie("Scale bindings are currently only supported for scales with unbinned, continuous domains.");continue}const a={selection:t.name,field:i.field};s.set("selectionExtent",a,!0),n.push(i)}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter(e=>0===n.filter(t=>t.name===e.signals.data).length);if(!e.parent||ece(e)||0===i.length)return n;const r=n.filter(e=>e.name===t.name)[0];let s=r.update;if(s.indexOf(Ice)>=0)r.update=`{${i.map(e=>`${z7(e.field)}: ${e.signals.data}`).join(", ")}}`;else{for(const e of i){const t=`${z7(e.field)}: ${e.signals.data}`;s.indexOf(t)<0&&(s=`${s.substring(0,s.length-1)}, ${t}}`)}r.update=s}return n.concat(i.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!ece(e))for(const e of t.scales){const t=n.filter(t=>t.name===e.signals.data)[0];t.push="outer",delete t.value,delete t.update}return n}},Que=Zue;function Jue(e,t){return`domain(${z7(e.scaleName(t))})`}function ece(e){var t;return e.parent&&Bfe(e.parent)&&(null!==(t=!e.parent.parent)&&void 0!==t?t:ece(e.parent.parent))}const tce={has:e=>{const t="global"===e.resolve&&e.bind&&Dae(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==kae;return t&&!n&&qie("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n,i)=>{var r;if(i.on||delete t.events,i.clear||delete t.clear,i.on||i.clear){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=F7(null!==(r=n.filter)&&void 0!==r?r:[]),n.filter.indexOf(e)<0&&n.filter.push(e)}const s=Fae(t.bind)?t.bind.legend:"click",o=U7(s)?f7(s,"view"):F7(s);t.bind={legend:{merge:o}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=Fae(t.bind)&&t.bind.legend,s=e=>t=>{const n=nee(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const o=`${Tee(e.field)}_legend`,a=`${i}_${o}`,l=n.filter(e=>e.name===a);if(0===l.length){const e=r.merge.map(s(`${o}_symbols`)).concat(r.merge.map(s(`${o}_labels`))).concat(r.merge.map(s(`${o}_entries`)));n.unshift(Object.assign(Object.assign({name:a},t.init?{}:{value:null}),{on:[{events:e,update:"datum.value || item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${a}`,force:!0}]}))}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,s=n.find(e=>e.name===i+Ece),o=i+jue,a=r.items.filter(e=>e.hasLegend).map(e=>Tee(`${i}_${Tee(e.field)}_legend`)),l=`${a.map(e=>`${e} !== null`).join(" && ")} ? {fields: ${o}, values: [${a.join(", ")}]} : null`;t.events&&a.length>0?s.on.push({events:a.map(e=>({signal:e})),update:l}):a.length>0&&(s.update=l,delete s.value,delete s.on);const u=n.find(e=>e.name===i+Xue),c=Fae(t.bind)&&t.bind.legend;return u&&(t.events?u.on.push(Object.assign(Object.assign({},u.on[0]),{events:c})):u.on[0].events=c),n}};const nce="_translate_anchor",ice="_translate_delta",rce={has:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Que.has(t),s=i+nce,{x:o,y:a}=t.project.hasChannel;let l=f7(t.translate,"scope");return r||(l=l.map(e=>(e.between[0].markname=i+mce,e))),n.push({name:s,value:{},on:[{events:l.map(e=>e.between[0]),update:"{x: x(unit), y: y(unit)"+(void 0!==o?", extent_x: "+(r?Jue(e,Ate):`slice(${o.signals.visual})`):"")+(void 0!==a?", extent_y: "+(r?Jue(e,Ste):`slice(${a.signals.visual})`):"")+"}"}]},{name:i+ice,value:{},on:[{events:l,update:`{x: ${s}.x - x(unit), y: ${s}.y - y(unit)}`}]}),void 0!==o&&sce(e,t,o,"width",n),void 0!==a&&sce(e,t,a,"height",n),n}};function sce(e,t,n,i,r){var s;const o=t.name,a=o+nce,l=o+ice,u=n.channel,c=Que.has(t),d=r.filter(e=>e.name===n.signals[c?"data":"visual"])[0],h=e.getSizeSignalRef(i).signal,p=e.getScaleComponent(u),f=p.get("type"),m=`${a}.extent_${u}`,g=`${c?"log"===f?"panLog":"pow"===f?"panPow":"panLinear":"panLinear"}(${m}, ${`${c&&u===Ate?"-":""}${l}.${u} / `+(c?`${h}`:`span(${m})`)}`+(c&&"pow"===f?`, ${null!==(s=p.get("exponent"))&&void 0!==s?s:1}`:"")+")";d.on.push({events:{signal:l},update:c?g:`clampRange(${g}, 0, ${h})`})}const oce="_zoom_anchor",ace="_zoom_delta",lce={has:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Que.has(t),s=i+ace,{x:o,y:a}=t.project.hasChannel,l=z7(e.scaleName(Ate)),u=z7(e.scaleName(Ste));let c=f7(t.zoom,"scope");return r||(c=c.map(e=>(e.markname=i+mce,e))),n.push({name:i+oce,on:[{events:c,update:r?"{"+[l?`x: invert(${l}, x(unit))`:"",u?`y: invert(${u}, y(unit))`:""].filter(e=>!!e).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:s,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==o&&uce(e,t,o,"width",n),void 0!==a&&uce(e,t,a,"height",n),n}};function uce(e,t,n,i,r){var s;const o=t.name,a=n.channel,l=Que.has(t),u=r.filter(e=>e.name===n.signals[l?"data":"visual"])[0],c=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(a),h=d.get("type"),p=l?Jue(e,a):u.name,f=o+ace,m=`${l?"log"===h?"zoomLog":"pow"===h?"zoomPow":"zoomLinear":"zoomLinear"}(${p}, ${`${o}${oce}.${a}`}, ${f}`+(l&&"pow"===h?`, ${null!==(s=d.get("exponent"))&&void 0!==s?s:1}`:"")+")";u.on.push({events:{signal:f},update:l?m:`clampRange(${m}, 0, ${c})`})}const cce=[Gue,que,Que,tce,rce,lce,Wue,$ue,Kue];function dce(e,t){for(const n of cce)n.has(e)&&t(n)}function hce(e,t=!0,n=S7){if(O7(e)){const i=e.map(e=>hce(e,t,n));return t?`[${i.join(", ")}]`:i}return Kie(e)?n(t?nre(e):function(e){const t=tre(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(JSON.stringify(e)):e}function pce(e,t){return Sce(e,(n,i)=>{t=i.marks?i.marks(e,n,t):t,dce(n,i=>{i.marks&&(t=i.marks(e,n,t))})}),t}function fce(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}const mce="_brush",gce="_scale_trigger",yce={signals:(e,t)=>{const n=t.name,i=n+jue,r=Que.has(t),s=[],o=[],a=[];if(t.translate&&!r){const e=`!event.item || event.item.mark.name !== ${z7(n+mce)}`;_ce(t,(t,n)=>{var i;const r=F7(null!==(i=n.between[0].filter)&&void 0!==i?i:n.between[0].filter=[]);return r.indexOf(e)<0&&r.push(e),t})}t.project.items.forEach((n,i)=>{const r=n.channel;if(r!==Ate&&r!==Ste)return void qie("Interval selections only support x and y encoding channels.");const l=t.init?t.init[i]:null,u=function(e,t,n,i){const r=n.channel,s=n.signals.visual,o=n.signals.data,a=Que.has(t),l=z7(e.scaleName(r)),u=e.getScaleComponent(r),c=u?u.get("type"):void 0,d=e=>`scale(${l}, ${e})`,h=e.getSizeSignalRef(r===Ate?"width":"height").signal,p=`${r}(unit)`,f=_ce(t,(e,t)=>[...e,{events:t.between[0],update:`[${p}, ${p}]`},{events:t,update:`[${s}[0], clamp(${p}, 0, ${h})]`}]);return f.push({events:{signal:t.name+gce},update:ase(c)?`[${d(`${o}[0]`)}, ${d(`${o}[1]`)}]`:"[0, 0]"}),a?[{name:o,on:[]}]:[Object.assign(Object.assign({name:s},i?{init:hce(i,!0,d)}:{value:[]}),{on:f}),Object.assign(Object.assign({name:o},i?{init:hce(i)}:{}),{on:[{events:{signal:s},update:`${s}[0] === ${s}[1] ? null : invert(${l}, ${s})`}]})]}(e,t,n,l),c=n.signals.data,d=n.signals.visual,h=z7(e.scaleName(r)),p=ase(e.getScaleComponent(r).get("type"))?"+":"";s.push(...u),o.push(c),a.push({scaleName:e.scaleName(r),expr:`(!isArray(${c}) || (${p}invert(${h}, ${d})[0] === ${p}${c}[0] && ${p}invert(${h}, ${d})[1] === ${p}${c}[1]))`})}),r||s.push({name:n+gce,value:{},on:[{events:a.map(e=>({scale:e.scaleName})),update:a.map(e=>e.expr).join(" && ")+` ? ${n+gce} : {}`}]});const l=t.init,u=`unit: ${Cce(e)}, fields: ${i}, values`;return s.concat(Object.assign(Object.assign({name:n+Ece},l?{init:`{${u}: ${hce(l)}}`}:{}),{on:[{events:[{signal:o.join(" || ")}],update:o.join(" && ")+` ? {${u}: [${o}]} : null`}]}))},modifyExpr:(e,t)=>t.name+Ece+", "+("global"===t.resolve?"true":`{unit: ${Cce(e)}}`),marks:(e,t,n)=>{const i=t.name,{x:r,y:s}=t.project.hasChannel,o=r&&r.signals.visual,a=s&&s.signals.visual,l=`data(${z7(t.name+xce)})`;if(Que.has(t))return n;const u={x:void 0!==r?{signal:`${o}[0]`}:{value:0},y:void 0!==s?{signal:`${a}[0]`}:{value:0},x2:void 0!==r?{signal:`${o}[1]`}:{field:{group:"width"}},y2:void 0!==s?{signal:`${a}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const t of yee(u))u[t]=[Object.assign({test:`${l}.length && ${l}[0].unit === ${Cce(e)}`},u[t]),{value:0}];const c=t.mark,{fill:d,fillOpacity:h,cursor:p}=c,f=j7(c,["fill","fillOpacity","cursor"]),m=yee(f).reduce((e,t)=>(e[t]=[{test:[void 0!==r&&`${o}[0] !== ${o}[1]`,void 0!==s&&`${a}[0] !== ${a}[1]`].filter(e=>e).join(" && "),value:f[t]},{value:null}],e),{});return[{name:i+mce+"_bg",type:"rect",clip:!0,encode:{enter:{fill:{value:d},fillOpacity:{value:h}},update:u}},...n,{name:i+mce,type:"rect",clip:!0,encode:{enter:Object.assign(Object.assign({},p?{cursor:{value:p}}:{}),{fill:{value:"transparent"}}),update:Object.assign(Object.assign({},u),m)}}]}};function _ce(e,t){return e.events.reduce((e,n)=>n.between?t(e,n):(qie(`${n} is not an ordered event stream for interval selections.`),e),[])}function vce(e,t){const n=t.name,i=n+jue,r=t.project,s="(item().isVoronoi ? datum.datum : datum)",o=r.items.map(t=>{const n=e.fieldDef(t.channel);return n&&n.bin?`[${s}[${z7(e.vgField(t.channel,{}))}], ${s}[${z7(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${s}[${z7(t.field)}]`}).join(", "),a=`unit: ${Cce(e)}, fields: ${i}, values`,l=t.events;return[{name:n+Ece,on:l?[{events:l,update:`datum && item().mark.marktype !== 'group' ? {${a}: [${o}]} : null`,force:!0}]:[]}]}const bce={signals:vce,modifyExpr:(e,t)=>t.name+Ece+", "+("global"===t.resolve?"null":`{unit: ${Cce(e)}}`)},Tce={signals:vce,modifyExpr:(e,t)=>t.name+Ece+", "+("global"===t.resolve?"true":`{unit: ${Cce(e)}}`)},xce="_store",Ece="_tuple",wce="_modify",Ice="vlSelectionResolve",Ace={single:Tce,multi:bce,interval:yce};function Sce(e,t){const n=e.component.selection;if(n)for(const e of _ee(n)){if(!0===t(e,Ace[e.type]))break}}function Cce(e,{escape:t}={escape:!0}){let n=t?z7(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!Lfe(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of cne)e[t]&&(n+=` + '__facet_${t}_' + (facet[${z7(i.vgField(t))}])`)}return n}function Oce(e){let t=!1;return Sce(e,e=>{t=t||e.project.items.some(e=>e.field===kae)}),t}const Mce="Property",Rce="ArrayExpression",kce="BinaryExpression",Nce="CallExpression",Dce="ConditionalExpression",Fce="LogicalExpression",Lce="MemberExpression",Pce="ObjectExpression",Bce="UnaryExpression";function $ce(e){this.type=e}var Uce,zce,Vce,jce,Yce;$ce.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case Rce:return e.elements;case kce:case Fce:return[e.left,e.right];case Nce:return[e.callee].concat(e.arguments);case Dce:return[e.test,e.consequent,e.alternate];case Lce:return[e.object,e.property];case Pce:return e.properties;case Mce:return[e.key,e.value];case Bce:return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};(Uce={})[1]="Boolean",Uce[2]="<end>",Uce[3]="Identifier",Uce[4]="Keyword",Uce[5]="Null",Uce[6]="Numeric",Uce[7]="Punctuator",Uce[8]="String",Uce[9]="RegularExpression";var Gce="Identifier",Hce="Unexpected token %0",Wce="Invalid regular expression",Xce="Invalid regular expression: missing /",qce="Octal literals are not allowed in strict mode.",Kce="ILLEGAL",Zce="Disabled.",Qce=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),Jce=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function ede(e,t){if(!e)throw new Error("ASSERT: "+t)}function tde(e){return e>=48&&e<=57}function nde(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function ide(e){return"01234567".indexOf(e)>=0}function rde(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function sde(e){return 10===e||13===e||8232===e||8233===e}function ode(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&Qce.test(String.fromCharCode(e))}function ade(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&Jce.test(String.fromCharCode(e))}var lde={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function ude(){for(var e;Vce<jce&&(rde(e=zce.charCodeAt(Vce))||sde(e));)++Vce}function cde(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)Vce<jce&&nde(zce[Vce])?(i=zce[Vce++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):Ade({},Hce,Kce);return String.fromCharCode(r)}function dde(){var e,t,n,i;for(t=0,"}"===(e=zce[Vce])&&Ade({},Hce,Kce);Vce<jce&&nde(e=zce[Vce++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&Ade({},Hce,Kce),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function hde(){var e,t;for(e=zce.charCodeAt(Vce++),t=String.fromCharCode(e),92===e&&(117!==zce.charCodeAt(Vce)&&Ade({},Hce,Kce),++Vce,(e=cde("u"))&&"\\"!==e&&ode(e.charCodeAt(0))||Ade({},Hce,Kce),t=e);Vce<jce&&ade(e=zce.charCodeAt(Vce));)++Vce,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==zce.charCodeAt(Vce)&&Ade({},Hce,Kce),++Vce,(e=cde("u"))&&"\\"!==e&&ade(e.charCodeAt(0))||Ade({},Hce,Kce),t+=e);return t}function pde(){var e,t;return e=Vce,t=92===zce.charCodeAt(Vce)?hde():function(){var e,t;for(e=Vce++;Vce<jce;){if(92===(t=zce.charCodeAt(Vce)))return Vce=e,hde();if(!ade(t))break;++Vce}return zce.slice(e,Vce)}(),{type:1===t.length?3:lde.hasOwnProperty(t)?4:"null"===t?5:"true"===t||"false"===t?1:3,value:t,start:e,end:Vce}}function fde(){var e,t,n,i,r=Vce,s=zce.charCodeAt(Vce),o=zce[Vce];switch(s){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++Vce,{type:7,value:String.fromCharCode(s),start:r,end:Vce};default:if(61===(e=zce.charCodeAt(Vce+1)))switch(s){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return Vce+=2,{type:7,value:String.fromCharCode(s)+String.fromCharCode(e),start:r,end:Vce};case 33:case 61:return Vce+=2,61===zce.charCodeAt(Vce)&&++Vce,{type:7,value:zce.slice(r,Vce),start:r,end:Vce}}}return">>>="===(i=zce.substr(Vce,4))?{type:7,value:i,start:r,end:Vce+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:Vce+=3}:o===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(o)>=0||"=>"===t?{type:7,value:t,start:r,end:Vce+=2}:"<>=!+-*%&|^/".indexOf(o)>=0?{type:7,value:o,start:r,end:++Vce}:void Ade({},Hce,Kce)}function mde(){var e,t,n;if(ede(tde((n=zce[Vce]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=Vce,e="","."!==n){if(e=zce[Vce++],n=zce[Vce],"0"===e){if("x"===n||"X"===n)return++Vce,function(e){for(var t="";Vce<jce&&nde(zce[Vce]);)t+=zce[Vce++];return 0===t.length&&Ade({},Hce,Kce),ode(zce.charCodeAt(Vce))&&Ade({},Hce,Kce),{type:6,value:parseInt("0x"+t,16),start:e,end:Vce}}(t);if(ide(n))return function(e){for(var t="0"+zce[Vce++];Vce<jce&&ide(zce[Vce]);)t+=zce[Vce++];return(ode(zce.charCodeAt(Vce))||tde(zce.charCodeAt(Vce)))&&Ade({},Hce,Kce),{type:6,value:parseInt(t,8),octal:!0,start:e,end:Vce}}(t);n&&tde(n.charCodeAt(0))&&Ade({},Hce,Kce)}for(;tde(zce.charCodeAt(Vce));)e+=zce[Vce++];n=zce[Vce]}if("."===n){for(e+=zce[Vce++];tde(zce.charCodeAt(Vce));)e+=zce[Vce++];n=zce[Vce]}if("e"===n||"E"===n)if(e+=zce[Vce++],"+"!==(n=zce[Vce])&&"-"!==n||(e+=zce[Vce++]),tde(zce.charCodeAt(Vce)))for(;tde(zce.charCodeAt(Vce));)e+=zce[Vce++];else Ade({},Hce,Kce);return ode(zce.charCodeAt(Vce))&&Ade({},Hce,Kce),{type:6,value:parseFloat(e),start:t,end:Vce}}function gde(){var e,t,n,i;return Yce=null,ude(),e=Vce,t=function(){var e,t,n,i;for(ede("/"===(e=zce[Vce]),"Regular expression literal must start with a slash"),t=zce[Vce++],n=!1,i=!1;Vce<jce;)if(t+=e=zce[Vce++],"\\"===e)sde((e=zce[Vce++]).charCodeAt(0))&&Ade({},Xce),t+=e;else if(sde(e.charCodeAt(0)))Ade({},Xce);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||Ade({},Xce),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";Vce<jce&&ade((e=zce[Vce]).charCodeAt(0));)++Vce,"\\"===e&&Vce<jce?Ade({},Hce,Kce):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&Ade({},Wce,n),{value:n,literal:t}}(),i=function(e,t){var n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(e,t){if(parseInt(t,16)<=1114111)return"x";Ade({},Wce)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){Ade({},Wce)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:Vce}}function yde(){var e;return ude(),Vce>=jce?{type:2,start:Vce,end:Vce}:ode(e=zce.charCodeAt(Vce))?pde():40===e||41===e||59===e?fde():39===e||34===e?function(){var e,t,n,i,r="",s=!1;for(ede("'"===(e=zce[Vce])||'"'===e,"String literal must starts with a quote"),t=Vce,++Vce;Vce<jce;){if((n=zce[Vce++])===e){e="";break}if("\\"===n)if((n=zce[Vce++])&&sde(n.charCodeAt(0)))"\r"===n&&"\n"===zce[Vce]&&++Vce;else switch(n){case"u":case"x":"{"===zce[Vce]?(++Vce,r+=dde()):r+=cde(n);break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:ide(n)?(0!==(i="01234567".indexOf(n))&&(s=!0),Vce<jce&&ide(zce[Vce])&&(s=!0,i=8*i+"01234567".indexOf(zce[Vce++]),"0123".indexOf(n)>=0&&Vce<jce&&ide(zce[Vce])&&(i=8*i+"01234567".indexOf(zce[Vce++]))),r+=String.fromCharCode(i)):r+=n}else{if(sde(n.charCodeAt(0)))break;r+=n}}return""!==e&&Ade({},Hce,Kce),{type:8,value:r,octal:s,start:t,end:Vce}}():46===e?tde(zce.charCodeAt(Vce+1))?mde():fde():tde(e)?mde():fde()}function _de(){var e;return Vce=(e=Yce).end,Yce=yde(),Vce=e.end,e}function vde(){var e;e=Vce,Yce=yde(),Vce=e}function bde(e,t,n){var i=new $ce("||"===e||"&&"===e?"LogicalExpression":"BinaryExpression");return i.operator=e,i.left=t,i.right=n,i}function Tde(e,t){var n=new $ce("CallExpression");return n.callee=e,n.arguments=t,n}function xde(e){var t=new $ce(Gce);return t.name=e,t}function Ede(e){var t=new $ce("Literal");return t.value=e.value,t.raw=zce.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function wde(e,t,n){var i=new $ce("MemberExpression");return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function Ide(e,t,n){var i=new $ce("Property");return i.key=t,i.value=n,i.kind=e,i}function Ade(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,function(e,t){return ede(t<i.length,"Message reference must be in range"),i[t]});throw(n=new Error(r)).index=Vce,n.description=r,n}function Sde(e){2===e.type&&Ade(e,"Unexpected end of input"),6===e.type&&Ade(e,"Unexpected number"),8===e.type&&Ade(e,"Unexpected string"),3===e.type&&Ade(e,"Unexpected identifier"),4===e.type&&Ade(e,"Unexpected reserved word"),Ade(e,Hce,e.value)}function Cde(e){var t=_de();7===t.type&&t.value===e||Sde(t)}function Ode(e){return 7===Yce.type&&Yce.value===e}function Mde(e){return 4===Yce.type&&Yce.value===e}function Rde(){var e=[];for(Vce=Yce.start,Cde("[");!Ode("]");)Ode(",")?(_de(),e.push(null)):(e.push(jde()),Ode("]")||Cde(","));return _de(),function(e){var t=new $ce("ArrayExpression");return t.elements=e,t}(e)}function kde(){var e;return Vce=Yce.start,8===(e=_de()).type||6===e.type?(e.octal&&Ade(e,qce),Ede(e)):xde(e.value)}function Nde(){var e,t,n;return Vce=Yce.start,3===(e=Yce).type?(n=kde(),Cde(":"),Ide("init",n,jde())):2!==e.type&&7!==e.type?(t=kde(),Cde(":"),Ide("init",t,jde())):void Sde(e)}function Dde(){var e,t,n=[],i={},r=String;for(Vce=Yce.start,Cde("{");!Ode("}");)t="$"+((e=Nde()).key.type===Gce?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?Ade({},"Duplicate data property in object literal not allowed in strict mode"):i[t]=!0,n.push(e),Ode("}")||Cde(",");return Cde("}"),function(e){var t=new $ce("ObjectExpression");return t.properties=e,t}(n)}var Fde={if:1};function Lde(){var e,t,n;if(Ode("("))return function(){var e;return Cde("("),e=Yde(),Cde(")"),e}();if(Ode("["))return Rde();if(Ode("{"))return Dde();if(e=Yce.type,Vce=Yce.start,3===e||Fde[Yce.value])n=xde(_de().value);else if(8===e||6===e)Yce.octal&&Ade(Yce,qce),n=Ede(_de());else{if(4===e)throw new Error(Zce);1===e?((t=_de()).value="true"===t.value,n=Ede(t)):5===e?((t=_de()).value=null,n=Ede(t)):Ode("/")||Ode("/=")?(n=Ede(gde()),vde()):Sde(_de())}return n}function Pde(){var e=[];if(Cde("("),!Ode(")"))for(;Vce<jce&&(e.push(jde()),!Ode(")"));)Cde(",");return Cde(")"),e}function Bde(){return Cde("."),Vce=Yce.start,function(e){return 3===e.type||4===e.type||1===e.type||5===e.type}(e=_de())||Sde(e),xde(e.value);var e}function $de(){var e;return Cde("["),e=Yde(),Cde("]"),e}function Ude(){var e=function(){var e;for(e=Lde();;)if(Ode("."))e=wde(".",e,Bde());else if(Ode("("))e=Tde(e,Pde());else{if(!Ode("["))break;e=wde("[",e,$de())}return e}();if(7===Yce.type&&(Ode("++")||Ode("--")))throw new Error(Zce);return e}function zde(){var e,t;if(7!==Yce.type&&4!==Yce.type)t=Ude();else{if(Ode("++")||Ode("--"))throw new Error(Zce);if(Ode("+")||Ode("-")||Ode("~")||Ode("!"))e=_de(),t=zde(),t=function(e,t){var n=new $ce("UnaryExpression");return n.operator=e,n.argument=t,n.prefix=!0,n}(e.value,t);else{if(Mde("delete")||Mde("void")||Mde("typeof"))throw new Error(Zce);t=Ude()}}return t}function Vde(e){var t=0;if(7!==e.type&&4!==e.type)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function jde(){var e,t;return e=function(){var e,t,n,i,r,s,o,a,l,u;if(e=Yce,l=zde(),0===(r=Vde(i=Yce)))return l;for(i.prec=r,_de(),t=[e,Yce],s=[l,i,o=zde()];(r=Vde(Yce))>0;){for(;s.length>2&&r<=s[s.length-2].prec;)o=s.pop(),a=s.pop().value,l=s.pop(),t.pop(),n=bde(a,l,o),s.push(n);(i=_de()).prec=r,s.push(i),t.push(Yce),n=zde(),s.push(n)}for(n=s[u=s.length-1],t.pop();u>1;)t.pop(),n=bde(s[u-1].value,s[u-2],n),u-=2;return n}(),Ode("?")&&(_de(),t=jde(),Cde(":"),e=function(e,t,n){var i=new $ce("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,jde())),e}function Yde(){var e=jde();if(Ode(","))throw new Error(Zce);return e}function Gde(e,t,n){return e.fields=t||[],e.fname=n,e}function Hde(e){return 1===e.length?Wde(e[0]):Xde(e)}const Wde=e=>function(t){return t[e]},Xde=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function qde(e){throw Error(e)}function Kde(e){const t=[],n=e.length;let i,r,s,o=null,a=0,l="";function u(){t.push(l+e.substring(i,r)),l="",i=r+1}for(e+="",i=r=0;r<n;++r)if(s=e[r],"\\"===s)l+=e.substring(i,r++),i=r;else if(s===o)u(),o=null,a=-1;else{if(o)continue;i===a&&'"'===s||i===a&&"'"===s?(i=r+1,o=s):"."!==s||a?"["===s?(r>i&&u(),a=i=r+1):"]"===s&&(a||qde("Access path missing open bracket: "+e),a>0&&u(),a=0,i=r+1):r>i?u():i=r+1}return a&&qde("Access path missing closing bracket: "+e),o&&qde("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function Zde(e,t,n){const i=Kde(e);return e=1===i.length?i[0]:e,Gde((n&&n.get||Hde)(i),[e],t||e)}Zde("id"),Gde(e=>e,[],"identity"),Gde(()=>0,[],"zero"),Gde(()=>1,[],"one"),Gde(()=>!0,[],"true"),Gde(()=>!1,[],"false");Array.isArray;function Qde(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...Qde(e.object)),t.push(...Qde(e.property))),t)}function Jde(e){return"MemberExpression"===e.object.type?Jde(e.object):"datum"===e.object.name}function ehe(e){const t=function(e){Vce=0,jce=(zce=e).length,Yce=null,vde();var t=Yde();if(2!==Yce.type)throw new Error("Unexpect token after expression.");return t}(e),n=new Set;return t.visit(e=>{"MemberExpression"===e.type&&Jde(e)&&n.add(Qde(e).slice(1).join("."))}),n}class the extends Uue{constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=rhe(this.model,this.filter,this),this._dependentFields=ehe(this.expr)}clone(){return new the(null,this.model,nee(this.filter))}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function nhe(e,t,n,i="datum"){const r=[];const s=xee(t,function(t){const s=Tee(t),o=e.getSelectionComponent(s,t),a=z7(s+xce);if(o.project.timeUnit){const t=null!=n?n:e.component.data.raw,i=o.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}return"none"!==o.empty&&r.push(a),`vlSelectionTest(${a}, ${i}`+("global"===o.resolve?")":`, ${z7(o.resolve)})`)});return(r.length?"!("+r.map(e=>`length(data(${e}))`).join(" || ")+") || ":"")+`(${s})`}function ihe(e,t){const n=t.encoding;let i=t.field;if(n||i){if(n&&!i){const r=e.project.items.filter(e=>e.channel===n);!r.length||r.length>1?(i=e.project.items[0].field,qie((r.length?"Multiple ":"No ")+`matching ${z7(n)} encoding found for selection ${z7(t.selection)}. `+`Using "field": ${z7(i)}.`)):i=r[0].field}}else i=e.project.items[0].field,e.project.items.length>1&&qie(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${z7(i)}.`);return`${e.name}[${z7(i)}]`}function rhe(e,t,n){return xee(t,t=>U7(t)?t:function(e){return null==e?void 0:e.selection}(t)?nhe(e,t.selection,n):Sre(t))}function she(e,t,n,i){var r,s,o;e.encode=null!==(r=e.encode)&&void 0!==r?r:{},e.encode[t]=null!==(s=e.encode[t])&&void 0!==s?s:{},e.encode[t].update=null!==(o=e.encode[t].update)&&void 0!==o?o:{},e.encode[t].update[n]=i}function ohe(e,t,n,i={header:!1}){var r,s;const o=e.combine(),{disable:a,orient:l,scale:u,labelExpr:c,title:d,zindex:h}=o,p=j7(o,["disable","orient","scale","labelExpr","title","zindex"]);if(!a){for(const e in p){const n=Bee[e],i=p[e];if(n&&n!==t&&"both"!==n)delete p[e];else if(Lee(i)){const{condition:t}=i,n=j7(i,["condition"]),r=F7(t),s=Fee[e];if(s){const{vgProp:t,part:i}=s,o=[...r.map(e=>{const{test:t}=e,n=j7(e,["test"]);return Object.assign({test:rhe(null,t)},n)}),n];she(p,i,t,o),delete p[e]}else if(null===s){const t={signal:r.map(e=>{const{test:t}=e,n=j7(e,["test"]);return`${rhe(null,t)} ? ${Uoe(n)} : `}).join("")+Uoe(n)};p[e]=t}}else if(hre(i)){const t=Fee[e];if(t){const{vgProp:n,part:r}=t;she(p,r,n,i),delete p[e]}}}if("grid"===t){if(!p.grid)return;if(p.encode){const{grid:e}=p.encode;p.encode=Object.assign({},e?{grid:e}:{}),gee(p.encode)&&delete p.encode}return Object.assign(Object.assign({scale:u,orient:l},p),{domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:Ree(h,0)})}{if(!i.header&&e.mainExtracted)return;if(void 0!==c){let e=c;(null===(s=null===(r=p.encode)||void 0===r?void 0:r.labels)||void 0===s?void 0:s.update)&&hre(p.encode.labels.update.text)&&(e=Cee(c,"datum.label",p.encode.labels.update.text.signal)),she(p,"labels","text",{signal:e})}if(null===p.labelAlign&&delete p.labelAlign,p.encode){for(const t of Pee)e.hasAxisPart(t)||delete p.encode[t];gee(p.encode)&&delete p.encode}const t=function(e,t){if(e)return O7(e)&&!Boe(e)?e.map(e=>woe(e,t)).join(", "):e}(d,n);return Object.assign(Object.assign(Object.assign(Object.assign({scale:u,orient:l,grid:!1},t?{title:t}:{}),p),!1===n.aria?{aria:!1}:{}),{zindex:Ree(h,0)})}}}function ahe(e){const{axes:t}=e.component,n=[];for(const i of Yne)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}const lhe={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},uhe={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},che=yee(lhe),dhe=yee(uhe);function hhe(e,t,n,i){return Object.assign.apply(null,[{},...e.map(e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},s=t["x"===n?"axisTop":"axisRight"]||{},o=new Set([...yee(r),...yee(s)]),a={};for(const t of o.values())a[t]={signal:`${i.signal} === "${e}" ? ${zoe(r[t])} : ${zoe(s[t])}`};return a}return t[e]})])}function phe(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:function(e){return e in nse}(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],s="x"===e?"axisX":"axisY",o=hre(n)?"axisOrient":"axis"+wee(n),a=[...r,...r.map(e=>s+e.substr(4))],l=["axis",o,s];return{vlOnlyAxisConfig:hhe(a,i,e,n),vgAxisConfig:hhe(l,i,e,n),axisConfigStyle:fhe([...l,...a],i)}}function fhe(e,t){var n;const i=[{}];for(const r of e){let e=null===(n=t[r])||void 0===n?void 0:n.style;if(e){e=F7(e);for(const n of e)i.push(t.style[n])}}return Object.assign.apply(null,i)}function mhe(e,t,n,i={}){var r;const s=Hoe(e,n,t.style);if(void 0!==s)return{configFrom:"style",configValue:s};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==(null===(r=i[t])||void 0===r?void 0:r[e]))return{configFrom:t,configValue:i[t][e]};return{}}const ghe={scale:({model:e,channel:t})=>e.scaleName(t),format:({fieldOrDatumDef:e,config:t,axis:n})=>{const{format:i,formatType:r}=n;return Lse(e,e.type,i,r,t,!0)},formatType:({axis:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return Pse(i,t,n)},grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>{var i;return(!roe(e)||!mie(e.bin))&&(null!==(i=t.grid)&&void 0!==i?i:function(e,t){return!ose(e)&&roe(t)&&!fie(null==t?void 0:t.bin)}(n,e))},gridScale:({model:e,channel:t})=>function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n);return}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||vhe(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||_he(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>{var i;return null!==(i=e.labelFlush)&&void 0!==i?i:function(e,t){if("x"===t&&lee(["quantitative","temporal"],e))return!0;return}(t.type,n)},labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>{var i;return null!==(i=e.labelOverlap)&&void 0!==i?i:function(e,t){if("nominal"!==e)return"log"!==t||"greedy";return}(t.type,n)},orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{var s;const o="x"===e?"width":"y"===e?"height":void 0,a=o?t.getSizeSignalRef(o):void 0;return null!==(s=n.tickCount)&&void 0!==s?s:function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){var r;if(!i&&!ose(t)&&"log"!==t){if(roe(e)){if(fie(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&lee(["month","hours","day","quarter"],null===(r=dre(e.timeUnit))||void 0===r?void 0:r.unit))return}return{signal:`ceil(${n.signal}/40)`}}return}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=bhe(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),s="x"===n?"x2":"y2",o=t.fieldDef(s);return Xoe(r?[Zse(r)]:[],roe(o)?[Zse(o)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;if(O7(n))return Foe(t,n);if(hre(n))return n;return}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>{var i;return null!==(i=e.zindex)&&void 0!==i?i:function(e,t){if("rect"===e&&yoe(t))return 1;return 0}(n,t)}};function yhe(e){return`(((${e.signal} % 360) + 360) % 360)`}function _he(e,t,n,i){if(void 0!==e){if("x"===n){if(hre(e)){const n=yhe(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${hre(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(hre(t)){const n=e<=45||315<=e?"===":"!==";return{signal:`${t.signal} ${n} "top" ? "bottom" : "top"`}}return(e<=45||315<=e)==("top"===t)?"bottom":"top"}if(hre(e)){const n=yhe(e);return{signal:`${n} <= 45 || 315 <= ${n} || (135 <= ${n} && ${n} <= 225) ? ${i?'"middle"':"null"} : (45 <= ${n} && ${n} <= 135) === ${hre(t)?`(${t.signal} === "left")`:"left"===t} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return i?"middle":null;if(hre(t)){const n=45<=e&&e<=135?"===":"!==";return{signal:`${t.signal} ${n} "left" ? "top" : "bottom"`}}return(45<=e&&e<=135)==("left"===t)?"top":"bottom"}}function vhe(e,t,n){if(void 0===e)return;const i="x"===n,r=i?0:90,s=i?"bottom":"left";if(hre(e)){const n=yhe(e);return{signal:`(${r?"("+n+" + 90)":n} % 180 === 0) ? ${i?null:'"center"'} :(${r} < ${n} && ${n} < ${180+r}) === ${hre(t)?`(${t.signal} === "${s}")`:t===s} ? "left" : "right"`}}if((e+r)%180==0)return i?null:"center";if(hre(t)){const n=r<e&&e<180+r?"===":"!==";return{signal:`${`${t.signal} ${n} "${s}"`} ? "left" : "right"`}}return(r<e&&e<180+r)==(t===s)?"left":"right"}function bhe(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),s=i?i.title:void 0,o=r?r.title:void 0;return s&&o?qoe(s,o):s||(o||(void 0!==s?s:void 0!==o?o:void 0))}class The extends Uue{constructor(e,t){super(e),this.transform=t,this._dependentFields=ehe(this.transform.calculate)}clone(){return new The(null,nee(this.transform))}static parseAllForSortIndex(e,t){return t.forEachFieldDef((t,n)=>{if(hoe(t)&&Wse(t.sort)){const{field:i,timeUnit:r}=t,s=t.sort,o=s.map((e,t)=>`${Sre({field:i,timeUnit:r,equal:e})} ? ${t} : `).join("")+s.length;e=new The(e,{calculate:o,as:xhe(t,n,{forAs:!0})})}}),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${oee(this.transform)}`}}function xhe(e,t,n){return goe(e,Object.assign({prefix:t,suffix:"sort_index"},null!=n?n:{}))}function Ehe(e,t){return lee(["top","bottom"],t)?"column":lee(["left","right"],t)||"row"===e?"row":"column"}function whe(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return Ree(((null==t?void 0:t.header)||{})[e],r[e],n.header[e])}function Ihe(e,t,n,i){const r={};for(const s of e){const e=whe(s,t,n,i);void 0!==e&&(r[s]=e)}return r}const Ahe=["row","column"],She=["header","footer"];function Che(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:s,titleAngle:o,titleOrient:a}=Ihe(["titleAnchor","titleAngle","titleOrient"],r,i,t),l=Ehe(t,a),u=Nee(o);return{name:`${t}-title`,type:"group",role:`${l}-title`,title:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:n},"row"===t?{orient:"left"}:{}),{style:"guide-title"}),Mhe(u,l)),Ohe(l,u,s)),Phe(i,r,t,che,lhe))}}function Ohe(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=vhe(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function Mhe(e,t){const n=_he(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function Rhe(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of She)if(n[r])for(const s of n[r]){const o=Dhe(e,t,r,n,s);null!=o&&i.push(o)}return i}function khe(e,t){var n;const{sort:i}=e;return Hse(i)?{field:goe(i,{expr:"datum"}),order:null!==(n=i.order)&&void 0!==n?n:"ascending"}:O7(i)?{field:xhe(e,t,{expr:"datum"}),order:"ascending"}:{field:goe(e,{expr:"datum"}),order:null!=i?i:"ascending"}}function Nhe(e,t,n){const{format:i,formatType:r,labelAngle:s,labelAnchor:o,labelOrient:a,labelExpr:l}=Ihe(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e,n,t),u=Nse({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=Ehe(t,a);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:{signal:l?Cee(Cee(l,"datum.label",u),"datum.value",goe(e,{expr:"parent"})):u}},"row"===t?{orient:"left"}:{}),{style:"guide-label",frame:"group"}),Mhe(s,c)),Ohe(c,s,o)),Phe(n,e,t,dhe,uhe))}function Dhe(e,t,n,i,r){if(r){let s=null;const{facetFieldDef:o}=i,a=e.config?e.config:void 0;if(o&&r.labels){const{labelOrient:e}=Ihe(["labelOrient"],o,a,t);("row"===t&&!lee(["top","bottom"],e)||"column"===t&&!lee(["left","right"],e))&&(s=Nhe(o,t,a))}const l=Lfe(e)&&!Xse(e.facet),u=r.axes,c=(null==u?void 0:u.length)>0;if(s||c){const a="row"===t?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`},i.facetFieldDef?{from:{data:e.getName(t+"_domain")},sort:khe(o,t)}:{}),c&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{}),s?{title:s}:{}),r.sizeSignal?{encode:{update:{[a]:r.sizeSignal}}}:{}),c?{axes:u}:{})}}return null}const Fhe={column:{start:0,end:1},row:{start:1,end:0}};function Lhe(e,t){return Fhe[t][e]}function Phe(e,t,n,i,r){const s={};for(const o of i){if(!r[o])continue;const i=whe(o,t,e,n);void 0!==i&&(s[r[o]]=i)}return s}function Bhe(e){return[...$he(e,"width"),...$he(e,"height"),...$he(e,"childWidth"),...$he(e,"childHeight")]}function $he(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),s=t.get("range");if(ose(i)&&pre(s)){const i=e.scaleName(n);if(Lfe(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[Uhe(i,s)]}return[Uhe(i,s),{name:r,update:zhe(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${Vae(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function Uhe(e,t){return{name:e+"_step",value:t.step}}function zhe(e,t,n){const i=t.get("type"),r=t.get("padding"),s=Ree(t.get("paddingOuter"),r);let o=t.get("paddingInner");return o="band"===i?void 0!==o?o:r:1,`bandspace(${n}, ${o}, ${s}) * ${e}_step`}function Vhe(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function jhe(e,t){return yee(e).reduce((n,i)=>{const r=e[i];return Object.assign(Object.assign({},n),cue(t,r,i,e=>hre(e)?e:{value:e.value}))},{})}function Yhe(e,t){if(Bfe(t)||Lfe(t))return"shared";if(Pfe(t))return Gne(e)?"independent":"shared";throw new Error("invalid model type for resolve")}function Ghe(e,t){const n=e.scale[t],i=Gne(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&qie(function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}(t)),"independent"):e[i][t]||"shared"}const Hhe=Object.assign(Object.assign({},Rae),{disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),Whe=yee(Hhe);class Xhe extends Mle{}const qhe={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:s}){var o,a,l,u,c;if("symbol"!==s)return;const{markDef:d,encoding:h,config:p,mark:f}=n,m=d.filled&&"trail"!==f;let g=Object.assign(Object.assign({},function(e,t,n){for(const i of n){const n=Yoe(i,t.markDef,t.config);void 0!==n&&(e[i]=$oe(n))}return e}({},n,ate)),_ue(n,{filled:m}));const y=null!==(o=Khe(h.opacity))&&void 0!==o?o:d.opacity;if(g.fill)if("fill"===i||m&&i===Bte)delete g.fill;else if(g.fill.field)r.get("symbolFillColor")?delete g.fill:(g.fill=$oe(null!==(a=p.legend.symbolBaseFillColor)&&void 0!==a?a:"black"),g.fillOpacity=$oe(null!=y?y:1));else if(O7(g.fill)){const e=null!==(c=null!==(u=Zhe(null!==(l=h.fill)&&void 0!==l?l:h.color))&&void 0!==u?u:d.fill)&&void 0!==c?c:m&&d.color;e&&(g.fill=$oe(e))}if(g.stroke)if("stroke"===i||!m&&i===Bte)delete g.stroke;else if(g.stroke.field)delete g.stroke;else if(O7(g.stroke)){const e=Ree(Zhe(h.stroke||h.color),d.stroke,m?d.color:void 0);e&&(g.stroke={value:e})}if(i!==Yte){const e=roe(t)&&Jhe(n,r,t);e?g.opacity=[Object.assign({test:e},$oe(null!=y?y:1)),$oe(p.legend.unselectedOpacity)]:y&&(g.opacity=$oe(y))}return g=Object.assign(Object.assign({},g),e),gee(g)?void 0:g},gradient:function(e,{model:t,legendType:n}){if("gradient"!==n)return;let i={};const r=Khe(t.encoding.opacity)||t.markDef.opacity;r&&(i.opacity=$oe(r));return i=Object.assign(Object.assign({},i),e),gee(i)?void 0:i},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const s=n.legend(i)||{},o=n.config,a=roe(t)?Jhe(n,r,t):void 0,l=a?[{test:a,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:u,formatType:c}=s,d=Rse(c)?Fse({fieldOrDatumDef:t,field:"datum.value",format:u,formatType:c,config:o}):void 0,h=Object.assign(Object.assign(Object.assign({},l?{opacity:l}:{}),d?{text:d}:{}),e);return gee(h)?void 0:h},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return(null==n?void 0:n.length)?Object.assign(Object.assign({},e),{fill:{value:"transparent"}}):e}};function Khe(e){return Qhe(e,(e,t)=>Math.max(e,t.value))}function Zhe(e){return Qhe(e,(e,t)=>Ree(e,t.value))}function Qhe(e,t){return function(e){const t=e&&e.condition;return!!t&&(O7(t)||doe(t))}(e)?F7(e.condition).reduce(t,e.value):doe(e)?e.value:void 0}function Jhe(e,t,n){const i=t.get("selections");if(!(null==i?void 0:i.length))return;const r=z7(n.field);return i.map(e=>`(!length(data(${z7(Tee(e)+xce)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`).join(" || ")}const epe={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return Lse(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return Pse(i,t,n)},gradientLength:e=>{var t,n;const{legend:i,legendConfig:r}=e;return null!==(n=null!==(t=i.gradientLength)&&void 0!==t?t:r.gradientLength)&&void 0!==n?n:function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:s,gradientHorizontalMinLength:o,gradientVerticalMaxLength:a,gradientVerticalMinLength:l}=e;if(lse(r))return"horizontal"===n?"top"===i||"bottom"===i?ipe(t,"width",o,s):o:ipe(t,"height",l,a);return}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>{var i,r;return null!==(r=null!==(i=e.labelOverlap)&&void 0!==i?i:t.labelOverlap)&&void 0!==r?r:function(e){if(lee(["quantile","threshold","log"],e))return"greedy";return}(n)},symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>{var r;return null!==(r=e.symbolType)&&void 0!==r?r:function(e,t,n,i){var r;if("shape"!==t){const e=null!==(r=Zhe(n))&&void 0!==r?r:i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,n,i.shape,t.shape)},title:({fieldOrDatumDef:e,config:t})=>xoe(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(lne(n)&&lse(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;if(O7(n))return Foe(t,n);if(hre(n))return n;return}(t,e)};function tpe(e){const{legend:t}=e;return Ree(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(lne(e)){if(lee(["quarter","month","day"],t))return"symbol";if(lse(n))return"gradient"}return"symbol"}(e))}function npe({legendConfig:e,legendType:t,orient:n,legend:i}){var r,s;return null!==(s=null!==(r=i.direction)&&void 0!==r?r:e[t?"gradientDirection":"symbolDirection"])&&void 0!==s?s:function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(n,t)}function ipe(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function rpe(e){const t=Ffe(e)?function(e){const{encoding:t}=e,n={};for(const i of[Bte,...Oae]){const r=Soe(t[i]);r&&e.getScaleComponent(i)&&(i===zte&&roe(r)&&r.type===Fre||(n[i]=ope(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){rpe(i);for(const r of yee(i.component.legends))n.legend[r]=Ghe(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=ape(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of yee(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function spe(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!(null==n?void 0:n.values);case"title":if("title"===t&&e===(null==i?void 0:i.title))return!0}return e===(n||{})[t]}function ope(e,t){var n,i,r;let s=e.legend(t);const{markDef:o,encoding:a,config:l}=e,u=l.legend,c=new Xhe({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){var i;const r=null===(i=e.fieldDef(t))||void 0===i?void 0:i.field;Sce(e,e=>{var i,s;const o=null!==(i=e.project.hasField[r])&&void 0!==i?i:e.project.hasChannel[t];if(o&&tce.has(e)){const t=null!==(s=n.get("selections"))&&void 0!==s?s:[];t.push(e.name),n.set("selections",t,!1),o.hasLegend=!0}})}(e,t,c);const d=void 0!==s?!s:u.disable;if(c.set("disable",d,void 0!==s),d)return c;s=s||{};const h=e.getScaleComponent(t).get("type"),p=Soe(a[t]),f=roe(p)?null===(n=dre(p.timeUnit))||void 0===n?void 0:n.unit:void 0,m=s.orient||l.legend.orient||"right",g=tpe({legend:s,channel:t,timeUnit:f,scaleType:h}),y={legend:s,channel:t,model:e,markDef:o,encoding:a,fieldOrDatumDef:p,legendConfig:u,config:l,scaleType:h,orient:m,legendType:g,direction:npe({legend:s,legendType:g,orient:m,legendConfig:u})};for(const n of Whe){const i=n in epe?epe[n](y):s[n];if(void 0!==i){const r=spe(i,n,s,e.fieldDef(t));(r||void 0===l.legend[n])&&c.set(n,i,r)}}const _=null!==(i=null==s?void 0:s.encoding)&&void 0!==i?i:{},v=c.get("selections"),b={},T={fieldOrDatumDef:p,model:e,channel:t,legendCmpt:c,legendType:g};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=jhe(null!==(r=_[t])&&void 0!==r?r:{},e),i=t in qhe?qhe[t](n,T):n;void 0===i||gee(i)||(b[t]=Object.assign(Object.assign(Object.assign({},(null==v?void 0:v.length)&&roe(p)?{name:`${Tee(p.field)}_legend_${t}`}:{}),(null==v?void 0:v.length)?{interactive:!!v}:{}),{update:i}))}return gee(b)||c.set("encode",b,!!(null==s?void 0:s.encoding)),c}function ape(e,t){var n,i,r,s;if(!e)return t.clone();const o=e.getWithExplicit("orient"),a=t.getWithExplicit("orient");if(o.explicit&&a.explicit&&o.value!==a.value)return;let l=!1;for(const n of Whe){const i=Fle(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",(e,t)=>{switch(n){case"symbolType":return lpe(e,t);case"title":return Koe(e,t);case"type":return l=!0,kle("symbol")}return Dle(e,t,n,"legend")});e.setWithExplicit(n,i)}return l&&((null===(i=null===(n=e.implicit)||void 0===n?void 0:n.encode)||void 0===i?void 0:i.gradient)&&Eee(e.implicit,["encode","gradient"]),(null===(s=null===(r=e.explicit)||void 0===r?void 0:r.encode)||void 0===s?void 0:s.gradient)&&Eee(e.explicit,["encode","gradient"])),e}function lpe(e,t){return"circle"===t.value?t:e}function upe(e,t,n,i){var r,s,o;e.encode=null!==(r=e.encode)&&void 0!==r?r:{},e.encode[t]=null!==(s=e.encode[t])&&void 0!==s?s:{},e.encode[t].update=null!==(o=e.encode[t].update)&&void 0!==o?o:{},e.encode[t].update[n]=i}function cpe(e){const t=e.component.legends,n={};for(const i of yee(t)){const r=e.getScaleComponent(i),s=see(r.get("domains"));if(n[s])for(const e of n[s]){ape(e,t[i])||n[s].push(t[i])}else n[s]=[t[i].clone()]}const i=_ee(n).flat().map(t=>function(e,t){var n,i,r;const s=e.combine(),{disable:o,labelExpr:a,selections:l}=s,u=j7(s,["disable","labelExpr","selections"]);if(o)return;!1===t.aria&&null==u.aria&&(u.aria=!1);if(null===(n=u.encode)||void 0===n?void 0:n.symbols){const e=u.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||u.stroke||(e.stroke={value:"transparent"});for(const t of Oae)u[t]&&delete e[t]}u.title||delete u.title;if(void 0!==a){let e=a;(null===(r=null===(i=u.encode)||void 0===i?void 0:i.labels)||void 0===r?void 0:r.update)&&hre(u.encode.labels.update.text)&&(e=Cee(a,"datum.label",u.encode.labels.update.text.signal)),upe(u,"labels","text",{signal:e})}for(const e in u){const t=u[e];if(hre(t)){const n=Mae[e];if(n){const{vgProp:i,part:r}=n;upe(u,r,i,t),delete u[e]}}}return u}(t,e.config)).filter(e=>void 0!==e);return i}function dpe(e){return Bfe(e)||Pfe(e)?function(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),hpe(e))}(e):hpe(e)}function hpe(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map(e=>e.signal).join(", ")}]`},s=t.data.reduce((t,n)=>{const i=hre(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return lee(t,i)||t.push(i),t},[]);if(s.length<=0)throw new Error("Projection's fit didn't find any data sources");return[Object.assign({name:i,size:r,fit:{signal:s.length>1?`[${s.join(", ")}]`:s[0]}},n)]}return[Object.assign(Object.assign({name:i},{translate:{signal:"[width / 2, height / 2]"}}),n)]}const ppe=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class fpe extends Mle{constructor(e,t,n,i){super(Object.assign({},t),{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function mpe(e){e.component.projection=Ffe(e)?function(e){var t;if(e.hasProjection){const n=e.specifiedProjection,i=!(n&&(null!=n.scale||null!=n.translate)),r=i?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,s=i?function(e){const t=[],{encoding:n}=e;for(const i of[[Fte,Dte],[Pte,Lte]])(Soe(n[i[0]])||Soe(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(zte)&&e.typedFieldDef(zte).type===Fre&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(Yle));return t}(e):void 0;return new fpe(e.projectionName(!0),Object.assign(Object.assign({},null!==(t=e.config.projection)&&void 0!==t?t:{}),null!=n?n:{}),r,s)}return}(e):function(e){if(0===e.children.length)return;let t;for(const t of e.children)mpe(t);const n=cee(e.children,e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=cee(ppe,n=>!P7(e.explicit,n)&&!P7(t.explicit,n)||!(!P7(e.explicit,n)||!P7(t.explicit,n)||see(e.get(n))!==see(t.get(n)))),i=see(e.size)===see(t.size);if(i){if(n)return e;if(see(e.explicit)===see({}))return t;if(see(t.explicit)===see({}))return e}return null}(t,n);return e&&(t=e),!!e}return t=n,!0}return!0});if(t&&n){const n=e.projectionName(!0),i=new fpe(n,t.specifiedProjection,t.size,nee(t.data));for(const t of e.children){const e=t.component.projection;e&&(e.isFit&&i.data.push(...t.component.projection.data),t.renameProjection(e.get("name"),n),e.merged=!0)}return i}return}(e)}function gpe(e,t){return`${pie(e)}_${t}`}function ype(e,t,n){var i;const r=gpe(null!==(i=Roe(n,void 0))&&void 0!==i?i:{},t);return e.getName(`${r}_bins`)}function _pe(e,t,n){let i,r;i=function(e){return"as"in e}(e)?U7(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[goe(e,{forAs:!0}),goe(e,{binSuffix:"end",forAs:!0})];const s=Object.assign({},Roe(t,void 0)),o=gpe(s,e.field),{signal:a,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,o);if(yie(s.extent)){const e=s.extent,t=e.selection;r=ihe(n.getSelectionComponent(Tee(t),t),e),delete s.extent}return{key:o,binComponent:Object.assign(Object.assign(Object.assign({bin:s,field:e.field,as:[i]},a?{signal:a}:{}),l?{extentSignal:l}:{}),r?{span:r}:{})}}class vpe extends Uue{constructor(e,t){super(e),this.bins=t}clone(){return new vpe(null,nee(this.bins))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{if(coe(n)&&fie(n.bin)){const{key:r,binComponent:s}=_pe(n,n.bin,t);e[r]=Object.assign(Object.assign(Object.assign({},s),e[r]),function(e,t,n,i){var r,s;if(Loe(t,n)){const o=Ffe(e)&&null!==(s=null!==(r=e.axis(n))&&void 0!==r?r:e.legend(n))&&void 0!==s?s:{},a=goe(t,{expr:"datum"}),l=goe(t,{expr:"datum",binSuffix:"end"});return{formulaAs:goe(t,{binSuffix:"range",forAs:!0}),formula:zse(a,l,o.format,o.formatType,i)}}return{}}(t,n,i,t.config))}return e},{});return gee(n)?null:new vpe(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=_pe(t,t.bin,n);return new vpe(e,{[i]:r})}merge(e,t){for(const n of yee(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=hee([...this.bins[n].as,...e.bins[n].as],oee)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(_ee(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(_ee(this.bins).map(e=>e.field))}hash(){return`Bin ${oee(this.bins)}`}assemble(){return _ee(this.bins).flatMap(e=>{const t=[],[n,...i]=e.as,r=e.bin,{extent:s}=r,o=j7(r,["extent"]),a=Object.assign(Object.assign(Object.assign({type:"bin",field:See(e.field),as:n,signal:e.signal},yie(s)?{extent:null}:{extent:s}),e.span?{span:{signal:`span(${e.span})`}}:{}),o);!s&&e.extentSignal&&(t.push({type:"extent",field:See(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:goe({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t})}}class bpe extends Uue{constructor(e){let t;if(super(null),Ule(e=null!=e?e:{name:"source"})||(t=e.format?Object.assign({},ree(e.format,["parse"])):{}),Ble(e))this._data={values:e.values};else if(Ple(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];lee(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else Vle(e)?this._data={values:[{type:"Sphere"}]}:($le(e)||Ule(e))&&(this._data={});this._generator=Ule(e),e.name&&(this._name=e.name),t&&!gee(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return Object.assign(Object.assign({name:this._name},this._data),{transform:[]})}}function Tpe(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return console.error("Dataflow graph is inconsistent.",t,e),!1;if(!Tpe(t.children))return!1}return!0}class xpe extends Uue{constructor(e,t){super(e),this.params=t}clone(){return new xpe(null,this.params)}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${oee(this.params)}`}assemble(){return Object.assign({type:"graticule"},!0===this.params?{}:this.params)}}class Epe extends Uue{constructor(e,t){super(e),this.params=t}clone(){return new Epe(null,this.params)}dependentFields(){return new Set}producedFields(){var e;return new Set([null!==(e=this.params.as)&&void 0!==e?e:"data"])}hash(){return`Hash ${oee(this.params)}`}assemble(){return Object.assign({type:"sequence"},this.params)}}function wpe(e){return e instanceof bpe||e instanceof xpe||e instanceof Epe}class Ipe{constructor(){this._mutated=!1}setMutated(){this._mutated=!0}get mutatedFlag(){return this._mutated}}class Ape extends Ipe{constructor(){super(),this._continue=!1}setContinue(){this._continue=!0}get continueFlag(){return this._continue}get flags(){return{continueFlag:this.continueFlag,mutatedFlag:this.mutatedFlag}}set flags({continueFlag:e,mutatedFlag:t}){e&&this.setContinue(),t&&this.setMutated()}reset(){}optimizeNextFromLeaves(e){if(wpe(e))return!1;const t=e.parent,{continueFlag:n}=this.run(e);return n&&this.optimizeNextFromLeaves(t),this.mutatedFlag}}class Spe extends Ipe{}function Cpe(e,t,n,i){const r=Ffe(i)?i.encoding[Sne(t)]:void 0;if(coe(n)&&Ffe(i)&&eoe(t,n,r,i.stack,i.markDef,i.config))e.add(goe(n,{})),e.add(goe(n,{suffix:"end"})),n.bin&&Loe(n,t)&&e.add(goe(n,{binSuffix:"range"}));else if(function(e){return e in sne}(t)){const n=function(e){switch(e){case Dte:return"y";case Lte:return"y2";case Fte:return"x";case Pte:return"x2"}}(t);e.add(i.getName(n))}else e.add(goe(n));return e}class Ope extends Uue{constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}clone(){return new Ope(null,new Set(this.dimensions),nee(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef(e=>{e.aggregate&&(n=!0)});const i={},r=new Set;return n?(t.forEachFieldDef((e,n)=>{var s,o,a,l;const{aggregate:u,field:c}=e;if(u)if("count"===u)i["*"]=null!==(s=i["*"])&&void 0!==s?s:{},i["*"].count=new Set([goe(e,{forAs:!0})]);else{if(gte(u)||yte(u)){const e=gte(u)?"argmin":"argmax",t=u[e];i[t]=null!==(o=i[t])&&void 0!==o?o:{},i[t][e]=new Set([goe({op:e,field:t},{forAs:!0})])}else i[c]=null!==(a=i[c])&&void 0!==a?a:{},i[c][u]=new Set([goe(e,{forAs:!0})]);aie(n)&&"unaggregated"===t.scaleDomain(n)&&(i[c]=null!==(l=i[c])&&void 0!==l?l:{},i[c].min=new Set([goe({field:c,aggregate:"min"},{forAs:!0})]),i[c].max=new Set([goe({field:c,aggregate:"max"},{forAs:!0})]))}else Cpe(r,n,e,t)}),r.size+yee(i).length===0?null:new Ope(e,r,i)):null}static makeFromTransform(e,t){var n,i,r;const s=new Set,o={};for(const e of t.aggregate){const{op:t,field:r,as:s}=e;t&&("count"===t?(o["*"]=null!==(n=o["*"])&&void 0!==n?n:{},o["*"].count=new Set([s||goe(e,{forAs:!0})])):(o[r]=null!==(i=o[r])&&void 0!==i?i:{},o[r][t]=new Set([s||goe(e,{forAs:!0})])))}for(const e of null!==(r=t.groupby)&&void 0!==r?r:[])s.add(e);return s.size+yee(o).length===0?null:new Ope(e,s,o)}merge(e){return function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(this.dimensions,e.dimensions)?(function(e,t){var n;for(const i of yee(t)){const r=t[i];for(const t of yee(r))i in e?e[i][t]=new Set([...null!==(n=e[i][t])&&void 0!==n?n:[],...r[t]]):e[i]={[t]:r[t]}}}(this.measures,e.measures),!0):(function(...e){Wie.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...yee(this.measures)])}producedFields(){const e=new Set;for(const t of yee(this.measures))for(const n of yee(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${oee({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of yee(this.measures))for(const r of yee(this.measures[i]))for(const s of this.measures[i][r])n.push(s),e.push(r),t.push("*"===i?null:See(i));return{type:"aggregate",groupby:[...this.dimensions].map(See),ops:e,fields:t,as:n}}}class Mpe extends Uue{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of cne){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]=Object.assign({name:t.getName(`${e}_domain`),fields:[goe(n),...fie(i)?[goe(n,{binSuffix:"end"})]:[]]},Hse(r)?{sortField:r}:O7(r)?{sortIndexField:xhe(n,e)}:{})}}this.childModel=t.child}hash(){let e="Facet";for(const t of cne)this[t]&&(e+=` ${t.charAt(0)}:${oee(this[t])}`);return e}get fields(){var e;const t=[];for(const n of cne)(null===(e=this[n])||void 0===e?void 0:e.fields)&&t.push(...this[n].fields);return t}dependentFields(){const e=new Set(this.fields);for(const t of cne)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of Yne){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(ose(i)&&pre(r)){const n=ffe(mfe(this.childModel,t));n?e[t]=n:qie(`Unknown field for ${t}. Cannot calculate view size.`)}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x"}[e],r=[],s=[],o=[];n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),s.push("max")):(r.push(n[i]),s.push("distinct")),o.push(`distinct_${n[i]}`));const{sortField:a,sortIndexField:l}=this[e];if(a){const{op:e=Vse,field:t}=a;r.push(t),s.push(e),o.push(goe(a,{forAs:!0}))}else l&&(r.push(l),s.push("max"),o.push(l));return{name:this[e].name,source:null!=t?t:this.data,transform:[Object.assign({type:"aggregate",groupby:this[e].fields},r.length?{fields:r,ops:s,as:o}:{})]}}assembleFacetHeaderData(e){var t,n;const{columns:i}=this.model.layout,{layoutHeaders:r}=this.model.component,s=[],o={};for(const e of Ahe){for(const i of She){const s=null!==(t=r[e]&&r[e][i])&&void 0!==t?t:[];for(const t of s)if((null===(n=t.axes)||void 0===n?void 0:n.length)>0){o[e]=!0;break}}if(o[e]){const t=`length(data("${this.facet.name}"))`,n="row"===e?i?{signal:`ceil(${t} / ${i})`}:1:i?{signal:`min(${t}, ${i})`}:{signal:t};s.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:n}]})}}const{row:a,column:l}=o;return(a||l)&&s.unshift(this.assembleRowColumnHeaderData("facet",null,e)),s}assemble(){var e,t;const n=[];let i=null;const r=this.getChildIndependentFieldsWithStep(),{column:s,row:o,facet:a}=this;if(s&&o&&(r.x||r.y)){i=`cross_${this.column.name}_${this.row.name}`;const s=[].concat(null!==(e=r.x)&&void 0!==e?e:[],null!==(t=r.y)&&void 0!==t?t:[]),o=s.map(()=>"distinct");n.push({name:i,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:s,ops:o}]})}for(const e of[wte,Ete])this[e]&&n.push(this.assembleRowColumnHeaderData(e,i,r));if(a){const e=this.assembleFacetHeaderData(r);e&&n.push(...e)}return n}}function Rpe(e){return"'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]?e.slice(1,-1):e}function kpe(e){const t={};return J7(e.filter,e=>{var n;if(Ire(e)){let i=null;_re(e)?i=e.equal:Ere(e)?i=e.range[0]:wre(e)&&(i=(null!==(n=e.oneOf)&&void 0!==n?n:e.in)[0]),i&&(Kie(i)?t[e.field]="date":$7(i)?t[e.field]="number":U7(i)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}}),t}function Npe(e){const t={};function n(e){var n;Noe(e)?t[e.field]="date":"quantitative"===e.type&&(U7(n=e.aggregate)&&lee(["min","max"],n))?t[e.field]="number":Mee(e.field)>1?e.field in t||(t[e.field]="flatten"):hoe(e)&&Hse(e.sort)&&Mee(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((Ffe(e)||Lfe(e))&&e.forEachFieldDef((t,i)=>{if(coe(t))n(t);else{const r=Ine(i),s=e.fieldDef(r);n(Object.assign(Object.assign({},t),{type:s.type}))}}),Ffe(e)){const{mark:n,markDef:i,encoding:r}=e;if(ite(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];roe(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}class Dpe extends Uue{constructor(e,t){super(e),this._parse=t}clone(){return new Dpe(null,nee(this._parse))}hash(){return`Parse ${oee(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!Ule(r)&&r&&r.format&&r.format.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of yee(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:qie(Cie(e,n[e],t.value)))}for(const e of yee(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:qie(Cie(e,t[e],n)))}const r=new Mle(t,n);i.copyAll(r);const s={};for(const e of yee(r.combine())){const t=r.get(e);null!==t&&(s[e]=t)}return 0===yee(s).length||i.parseNothing?null:new Dpe(e,s)}get parse(){return this._parse}merge(e){this._parse=Object.assign(Object.assign({},this._parse),e.parse),e.remove()}assembleFormatParse(){const e={};for(const t of yee(this._parse)){const n=this._parse[t];1===Mee(t)&&(e[t]=n)}return e}producedFields(){return new Set(yee(this._parse))}dependentFields(){return new Set(yee(this._parse))}assembleTransforms(e=!1){return yee(this._parse).filter(t=>!e||Mee(t)>1).map(e=>{const t=function(e,t){const n=Iee(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(0===t.indexOf("date:"))return`timeParse(${n},'${Rpe(t.slice(5,t.length))}')`;if(0===t.indexOf("utc:"))return`utcParse(${n},'${Rpe(t.slice(4,t.length))}')`;return qie(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:Oee(e)}}).filter(e=>null!==e)}}class Fpe extends Uue{clone(){return new Fpe(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([kae])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:kae}}}class Lpe extends Uue{constructor(e,t){super(e),this.transform=t}clone(){return new Lpe(null,nee(this.transform))}addDimensions(e){this.transform.groupby=hee(this.transform.groupby.concat(e),e=>e)}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map(e=>e.field).filter(e=>void 0!==e).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){var t;return null!==(t=e.as)&&void 0!==t?t:goe(e)}hash(){return`JoinAggregateTransform ${oee(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return Object.assign({type:"joinaggregate",as:n,ops:t,fields:e},void 0!==i?{groupby:i}:{})}}class Ppe extends Uue{constructor(e,t){super(e),this._stack=t}clone(){return new Ppe(null,nee(this._stack))}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:s="zero"}=t,o=[],a=[];if(void 0!==t.sort)for(const e of t.sort)o.push(e.field),a.push(Ree(e.order,"ascending"));const l={field:o,order:a};let u;return u=function(e){return O7(e)&&e.every(e=>U7(e))&&e.length>1}(r)?r:U7(r)?[r,r+"_end"]:[t.stack+"_start",t.stack+"_end"],new Ppe(e,{stackField:n,groupby:i,offset:s,sort:l,facetby:[],as:u})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;const{groupbyChannel:r,fieldChannel:s,offset:o,impute:a}=n;let l;if(r){l=Aoe(i[r])}const u=function(e){return e.stack.stackBy.reduce((e,t)=>{const n=goe(t.fieldDef);return n&&e.push(n),e},[])}(t),c=t.encoding.order;let d;return d=O7(c)||roe(c)?Woe(c):u.reduce((e,t)=>(e.field.push(t),e.order.push("y"===s?"descending":"ascending"),e),{field:[],order:[]}),new Ppe(e,{dimensionFieldDef:l,stackField:t.vgField(s),facetby:[],stackby:u,sort:d,offset:o,impute:a,as:[t.vgField(s,{suffix:"start",forAs:!0}),t.vgField(s,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${oee(this._stack)}`}getGroupbyFields(){const{dimensionFieldDef:e,impute:t,groupby:n}=this._stack;return e?e.bin?t?[goe(e,{binSuffix:"mid"})]:[goe(e,{}),goe(e,{binSuffix:"end"})]:[goe(e)]:null!=n?n:[]}assemble(){const e=[],{facetby:t,dimensionFieldDef:n,stackField:i,stackby:r,sort:s,offset:o,impute:a,as:l}=this._stack;if(a&&n){const{band:s=.5,bin:o}=n;o&&e.push({type:"formula",expr:`${s}*`+goe(n,{expr:"datum"})+`+${1-s}*`+goe(n,{expr:"datum",binSuffix:"end"}),as:goe(n,{binSuffix:"mid",forAs:!0})}),e.push({type:"impute",field:i,groupby:[...r,...t],key:goe(n,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:s,as:l,offset:o}),e}}class Bpe extends Uue{constructor(e,t){super(e),this.transform=t}clone(){return new Bpe(null,nee(this.transform))}addDimensions(e){this.transform.groupby=hee(this.transform.groupby.concat(e),e=>e)}dependentFields(){var e,t;const n=new Set;return(null!==(e=this.transform.groupby)&&void 0!==e?e:[]).forEach(n.add,n),(null!==(t=this.transform.sort)&&void 0!==t?t:[]).forEach(e=>n.add(e.field)),this.transform.window.map(e=>e.field).filter(e=>void 0!==e).forEach(n.add,n),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){var t;return null!==(t=e.as)&&void 0!==t?t:goe(e)}hash(){return`WindowTransform ${oee(this.transform)}`}assemble(){var e;const t=[],n=[],i=[],r=[];for(const e of this.transform.window)n.push(e.op),i.push(this.getDefaultName(e)),r.push(void 0===e.param?null:e.param),t.push(void 0===e.field?null:e.field);const s=this.transform.frame,o=this.transform.groupby;if(s&&null===s[0]&&null===s[1]&&n.every(e=>_te(e)))return Object.assign({type:"joinaggregate",as:i,ops:n,fields:t},void 0!==o?{groupby:o}:{});const a=[],l=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)a.push(t.field),l.push(null!==(e=t.order)&&void 0!==e?e:"ascending");const u={field:a,order:l},c=this.transform.ignorePeers;return Object.assign(Object.assign(Object.assign({type:"window",params:r,as:i,ops:n,fields:t,sort:u},void 0!==c?{ignorePeers:c}:{}),void 0!==o?{groupby:o}:{}),void 0!==s?{frame:s}:{})}}class $pe extends Ape{run(e){const t=e.parent;if(e instanceof Dpe){if(wpe(t))return this.flags;if(t.numChildren()>1)return this.setContinue(),this.flags;if(t instanceof Dpe)this.setMutated(),t.merge(e);else{if(mee(t.producedFields(),e.dependentFields()))return this.setContinue(),this.flags;this.setMutated(),e.swapWithParent()}}return this.setContinue(),this.flags}}class Upe extends Spe{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map(e=>e.hash()),n={};for(let i=0;i<t.length;i++)void 0===n[t[i]]?n[t[i]]=[e.children[i]]:n[t[i]].push(e.children[i]);for(const t of yee(n))n[t].length>1&&(this.setMutated(),this.mergeNodes(e,n[t]));for(const t of e.children)this.run(t);return this.mutatedFlag}}class zpe extends Ape{run(e){return e instanceof zue||e.numChildren()>0||e instanceof Mpe||(this.setMutated(),e.remove()),this.flags}}class Vpe extends Ape{constructor(){super(...arguments),this.fields=new Set,this.prev=null}run(e){if(this.setContinue(),e instanceof Vue){const t=e.producedFields();pee(t,this.fields)?(this.setMutated(),this.prev.remove()):this.fields=new Set([...this.fields,...t]),this.prev=e}return this.flags}reset(){this.fields.clear()}}class jpe extends Ape{run(e){this.setContinue();const t=e.parent.children.filter(e=>e instanceof Vue),n=t.pop();for(const e of t)this.setMutated(),n.merge(e);return this.flags}}function Ype(e){if(e instanceof Mpe)if(1!==e.numChildren()||e.children[0]instanceof zue){const n=e.model.component.data.main;Gpe(n);const i=(t=e,function e(n){if(!(n instanceof Mpe)){const i=n.clone();if(i instanceof zue){const e=Qpe+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof Ope||i instanceof Ppe||i instanceof Bpe||i instanceof Lpe)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof Ope||t instanceof Ppe||t instanceof Bpe||t instanceof Lpe)&&t.addDimensions(e.fields),t.swapWithParent(),Ype(e)}else e.children.map(Ype);var t}function Gpe(e){if(e instanceof zue&&e.type===Yle&&1===e.numChildren()){const t=e.children[0];t instanceof Mpe||(t.swapWithParent(),Gpe(e))}}class Hpe extends Spe{constructor(){super()}run(e){e instanceof zue&&!e.isRequired()&&(this.setMutated(),e.remove());for(const t of e.children)this.run(t);return this.mutatedFlag}}class Wpe extends Spe{constructor(e){super(),this.requiresSelectionId=e&&Oce(e)}run(e){e instanceof Fpe&&(this.requiresSelectionId&&(wpe(e.parent)||e.parent instanceof Ope||e.parent instanceof Dpe)||(this.setMutated(),e.remove()));for(const t of e.children)this.run(t);return this.mutatedFlag}}class Xpe extends Ape{run(e){const t=e.parent,n=[...t.children],i=t.children.filter(e=>e instanceof Dpe);if(t.numChildren()>1&&i.length>=1){const e={},r=new Set;for(const t of i){const n=t.parse;for(const t of yee(n))t in e?e[t]!==n[t]&&r.add(t):e[t]=n[t]}for(const t of r)delete e[t];if(!gee(e)){this.setMutated();const i=new Dpe(t,e);for(const r of n){if(r instanceof Dpe)for(const t of yee(e))delete r.parse[t];t.removeChild(r),r.parent=i,r instanceof Dpe&&0===yee(r.parse).length&&r.remove()}}}return this.setContinue(),this.flags}}class qpe extends Ape{run(e){const t=e.parent,n=t.children.filter(e=>e instanceof Ope),i={};for(const e of n){const t=oee(e.groupBy);t in i||(i[t]=[]),i[t].push(e)}for(const e of yee(i)){const n=i[e];if(n.length>1){const e=n.pop();for(const i of n)e.merge(i)&&(t.removeChild(i),i.parent=e,i.remove(),this.setMutated())}}return this.setContinue(),this.flags}}class Kpe extends Ape{constructor(e){super(),this.model=e}run(e){const t=e.parent,n=!(wpe(t)||t instanceof the||t instanceof Dpe||t instanceof Fpe),i=[],r=[];for(const e of t.children)e instanceof vpe&&(n&&!mee(t.producedFields(),e.dependentFields())?i.push(e):r.push(e));if(i.length>0){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated(),t instanceof vpe?t.merge(e,this.model.renameSignal.bind(this.model)):e.swapWithParent()}if(r.length>1){const e=r.pop();for(const t of r)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated()}return this.setContinue(),this.flags}}class Zpe extends Ape{run(e){const t=e.parent,n=[...t.children];if(!uee(n,e=>e instanceof zue)||t.numChildren()<=1)return this.setContinue(),this.flags;const i=[];let r;for(const e of n)if(e instanceof zue){let n=e;for(;1===n.numChildren();){const e=n.children[0];if(!(e instanceof zue))break;n=e}i.push(...n.children),r?(t.removeChild(e),e.parent=r.parent,r.parent.removeChild(r),r.parent=n,this.setMutated()):r=n}else i.push(e);if(i.length){this.setMutated();for(const e of i)e.parent.removeChild(e),e.parent=r}return this.setContinue(),this.flags}}const Qpe="scale_",Jpe=5;function efe(e){const t=[];function n(e){if(0===e.numChildren())t.push(e);else for(const t of e.children)n(t)}for(const t of e)n(t);return t}function tfe(e){return e}function nfe(e,t){return t.map(t=>{if(e instanceof Ape){const n=e.optimizeNextFromLeaves(t);return e.reset(),n}return e.run(t)}).some(tfe)}function ife(e,t){let n=e.sources;const i=new Set;return i.add(nfe(new Hpe,n)),i.add(nfe(new Wpe(t),n)),n=n.filter(e=>e.numChildren()>0),i.add(nfe(new zpe,efe(n))),n=n.filter(e=>e.numChildren()>0),i.add(nfe(new $pe,efe(n))),i.add(nfe(new Kpe(t),efe(n))),i.add(nfe(new Vpe,efe(n))),i.add(nfe(new Xpe,efe(n))),i.add(nfe(new qpe,efe(n))),i.add(nfe(new jpe,efe(n))),i.add(nfe(new Upe,n)),i.add(nfe(new Zpe,efe(n))),e.sources=n,i.has(!0)}class rfe{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new rfe(()=>e(t))}}function sfe(e){Ffe(e)?function(e){const t=e.component.scales;for(const n of yee(t)){const i=ofe(e,n);if(t[n].setWithExplicit("domains",i),cfe(e,n),e.component.data.isFaceted){let t=e;for(;!Lfe(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)fre(e)&&(e.data=Qpe+e.data.replace(Qpe,""))}}}(e):function(e){for(const t of e.children)sfe(t);const t=e.component.scales;for(const n of yee(t)){let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):Fle(i,e.getWithExplicit("domains"),"domains","scale",hfe);const t=e.get("selectionExtent");r&&t&&r.selection!==t.selection&&qie("The same selection must be used to override scale domains in a layered view."),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function ofe(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=dfe(t,n);if(!e)return void qie(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=dfe(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]=Object.assign(Object.assign({},e.specifiedScales[t]),{domain:r})),"x"===t&&Soe(i.x2)?Soe(i.x)?Fle(lfe(n,r,e,"x"),lfe(n,r,e,"x2"),"domain","scale",hfe):lfe(n,r,e,"x2"):"y"===t&&Soe(i.y2)?Soe(i.y)?Fle(lfe(n,r,e,"y"),lfe(n,r,e,"y2"),"domain","scale",hfe):lfe(n,r,e,"y2"):lfe(n,r,e,t)}function afe(e,t,n){var i;const r=null===(i=dre(n))||void 0===i?void 0:i.unit;return"temporal"===t||r?function(e,t,n){return e.map(e=>({signal:`{data: ${Doe(e,{timeUnit:n,type:t})}}`}))}(e,t,r):[e]}function lfe(e,t,n,i){const{encoding:r}=n,s=Soe(r[i]),{type:o}=s,a=s.timeUnit;if(function(e){return e&&e.unionWith}(t)){const r=lfe(e,void 0,n,i),s=afe(t.unionWith,o,a);return Rle([...r.value,...s])}if(hre(t))return Rle([t]);if(t&&"unaggregated"!==t&&!cse(t))return Rle(afe(t,o,a));const l=n.stack;if(l&&i===l.fieldChannel){if("normalize"===l.offset)return kle([[0,1]]);const e=n.requestDataName(Yle);return kle([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const u=aie(i)&&roe(s)?function(e,t,n){if(!ose(n))return;const i=e.fieldDef(t),r=i.sort;if(Wse(r))return{op:"min",field:xhe(i,t),order:"ascending"};const{stack:s}=e,o=s?[...s.groupbyField?[s.groupbyField]:[],...s.stackBy.map(e=>e.fieldDef.field)]:void 0;if(Hse(r)){return ufe(r,s&&!lee(o,r.field))}if(Gse(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:a,field:l}=i,u=s&&!lee(o,l);if(gte(a)||yte(a))return ufe({field:goe(i),order:n},u);if(_te(a)||!a)return ufe({op:a,field:l,order:n},u)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(lee(["ascending",void 0],r))return!0}return}(n,i,e):void 0;if(ooe(s)){return kle(afe([s.datum],o,a))}const c=s;if("unaggregated"===t){const e=n.requestDataName(Yle),{field:t}=s;return kle([{data:e,field:goe({field:t,aggregate:"min"})},{data:e,field:goe({field:t,aggregate:"max"})}])}if(fie(c.bin)){if(ose(e))return kle("bin-ordinal"===e?[]:[{data:bee(u)?n.requestDataName(Yle):n.requestDataName(Gle),field:n.vgField(i,Loe(c,i)?{binSuffix:"range"}:{}),sort:!0!==u&&M7(u)?u:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=c;if(fie(e)){const t=ype(n,c.field,e);return kle([new rfe(()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}return kle([{data:n.requestDataName(Yle),field:n.vgField(i,{})}])}}if(c.timeUnit&&lee(["time","utc"],e)&&eoe(i,c,Ffe(n)?n.encoding[Sne(i)]:void 0,n.stack,n.markDef,n.config)){const e=n.requestDataName(Yle);return kle([{data:e,field:n.vgField(i)},{data:e,field:n.vgField(i,{suffix:"end"})}])}return kle(u?[{data:bee(u)?n.requestDataName(Yle):n.requestDataName(Gle),field:n.vgField(i),sort:u}]:[{data:n.requestDataName(Yle),field:n.vgField(i)}])}function ufe(e,t){const{op:n,field:i,order:r}=e;return Object.assign(Object.assign({op:null!=n?n:t?"sum":Vse},i?{field:See(i)}:{}),r?{order:r}:{})}function cfe(e,t){var n;const i=e.component.scales[t],r=e.specifiedScales[t].domain,s=null===(n=e.fieldDef(t))||void 0===n?void 0:n.bin,o=cse(r)&&r,a=gie(s)&&yie(s.extent)&&s.extent;(o||a)&&i.set("selectionExtent",null!=o?o:a,!0)}function dfe(e,t){const{aggregate:n,type:i}=e;return n?U7(n)&&!xte[n]?{valid:!1,reason:Bie(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:$ie(e)}:{valid:!0}:{valid:!1,reason:Pie(e)}}function hfe(e,t,n,i){return e.explicit&&t.explicit&&qie(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${see(n)} and ${see(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function pfe(e){const t=hee(e.map(e=>{if(fre(e)){const{sort:t}=e;return j7(e,["sort"])}return e}),oee),n=hee(e.map(e=>{if(fre(e)){const t=e.sort;return void 0===t||bee(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}}).filter(e=>void 0!==e),oee);if(0===t.length)return;if(1===t.length){const t=e[0];if(fre(t)&&n.length>0){let e=n[0];if(n.length>1)qie(Vie),e=!0;else if(M7(e)&&"field"in e){const n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return Object.assign(Object.assign({},t),{sort:e})}return t}const i=hee(n.map(e=>bee(e)||!("op"in e)||e.op in mte?e:(qie(function(e){return`Dropping sort property ${see(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0)),oee);let r;1===i.length?r=i[0]:i.length>1&&(qie(Vie),r=!0);const s=hee(e.map(e=>fre(e)?e.data:null),e=>e);if(1===s.length&&null!==s[0]){return Object.assign({data:s[0],fields:t.map(e=>e.field)},r?{sort:r}:{})}return Object.assign({fields:t},r?{sort:r}:{})}function ffe(e){if(fre(e)&&U7(e.field))return e.field;if(function(e){return!O7(e)&&"fields"in e&&!("data"in e)}(e)){let t;for(const n of e.fields)if(fre(n)&&U7(n.field))if(t){if(t!==n.field)return qie("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),t}else t=n.field;return qie("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),t}if(function(e){return!O7(e)&&"fields"in e&&"data"in e}(e)){qie("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const t=e.fields[0];return U7(t)?t:void 0}}function mfe(e,t){const n=e.component.scales[t].get("domains").map(t=>(fre(t)&&(t.data=e.lookupDataSource(t.data)),t));return pfe(n)}function gfe(e){return Bfe(e)||Pfe(e)?e.children.reduce((e,t)=>e.concat(gfe(t)),yfe(e)):yfe(e)}function yfe(e){return yee(e.component.scales).reduce((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:s,type:o,selectionExtent:a,domains:l,range:u,reverse:c}=r,d=j7(r,["name","type","selectionExtent","domains","range","reverse"]),h=function(e,t,n){if(Gne(n)&&pre(e))return{step:{signal:t+"_step"}};return e}(r.range,s,n);let p;a&&(p=function(e,t){const n=t.selection;return{signal:ihe(e.getSelectionComponent(n,Tee(n)),t)}}(e,a));const f=mfe(e,n);return t.push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:s,type:o},f?{domain:f}:{}),p?{domainRaw:p}:{}),{range:h}),void 0!==c?{reverse:c}:{}),d)),t},[])}class _fe extends Mle{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||uee(this.get("domains"),e=>O7(e)&&2===e.length&&e[0]<=0&&e[1]>=0)}}const vfe=["range","scheme"];function bfe(e){return"x"===e?"width":"y"===e?"height":void 0}function Tfe(e,t){const n=e.fieldDef(t);if(n&&n.bin&&fie(n.bin)){const i=ype(e,n.field,n.bin),r=bfe(t),s=e.getName(r);return new rfe(()=>{const t=e.getSignalName(i),n=`(${t}.stop - ${t}.start) / ${t}.step`;return`${e.getSignalName(s)} / (${n})`})}}function xfe(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const i of vfe)if(void 0!==n[i]){const s=_se(r,i),o=vse(e,i);if(s)if(o)qie(o);else switch(i){case"range":return O7(n.range)&&Gne(e)?Rle(n.range.map(e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return rfe.fromName(i,n)}return e})):Rle(n.range);case"scheme":return Rle(Efe(n[i]))}else qie(Uie(r,i,e))}if(e===Ate||e===Ste){const t=e===Ate?"width":"height",n=i[t];if($ae(n)){if(ose(r))return Rle({step:n.step});qie(zie(t))}}return kle(function(e,t){const{size:n,config:i,mark:r,encoding:s}=t,o=t.getSignalName.bind(t),{type:a}=Soe(s[e]),l=t.getScaleComponent(e),u=l.get("type"),{domain:c,domainMid:d}=t.specifiedScales[e];switch(e){case Ate:case Ste:{if(lee(["point","band"],u))if(e!==Ate||n.width){if(e===Ste&&!n.height){const e=Yae(i.view,"height");if($ae(e))return e}}else{const e=Yae(i.view,"width");if($ae(e))return e}const r=bfe(e),s=t.getName(r);return e===Ste&&ase(u)?[rfe.fromName(o,s),0]:[0,rfe.fromName(o,s)]}case Vte:{const s=wfe(r,t.component.scales[e].get("zero"),i),o=function(e,t,n,i){const r={x:Tfe(n,"x"),y:Tfe(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=Afe(t,r,i.view);return $7(e)?e-1:new rfe(()=>`${e.signal} - 1`)}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const e=Afe(t,r,i.view);return $7(e)?Math.pow(Ife*e,2):new rfe(()=>`pow(${Ife} * ${e.signal}, 2)`)}}throw new Error(Die("size",e))}(r,n,t,i);return use(u)?function(e,t,n){const i=()=>{const i=zoe(t),r=zoe(e),s=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${s}, ${s})`};return hre(t)?new rfe(i):{signal:i()}}(s,o,function(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&O7(n)?n.length+1:(qie(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(u,i,c,e)):[s,o]}case kte:return[0,2*Math.PI];case jte:return[0,360];case Mte:return[0,new rfe(()=>`min(${t.getSignalName("width")},${t.getSignalName("height")})/2`)];case Wte:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case Xte:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case zte:return"symbol";case Bte:case $te:case Ute:return"ordinal"===u?"nominal"===a?"category":"ordinal":void 0!==d?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case Yte:case Gte:case Hte:return[i.scale.minOpacity,i.scale.maxOpacity]}throw new Error(`Scale range undefined for channel ${e}`)}(e,t))}function Efe(e){return function(e){return!U7(e)&&!!e.name}(e)?Object.assign({scheme:e.name},ree(e,["name"])):{scheme:e}}function wfe(e,t,n){if(t)return hre(t)?{signal:`${t.signal} ? 0 : ${wfe(e,!1,n)}`}:0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(Die("size",e))}const Ife=.95;function Afe(e,t,n){const i=$ae(e.width)?e.width.step:jae(n,"width"),r=$ae(e.height)?e.height.step:jae(n,"height");return t.x||t.y?new rfe(()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`):Math.min(i,r)}function Sfe(e,t){Ffe(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:s,specifiedScales:o}=e;for(const a of yee(n)){const l=o[a],u=n[a],c=e.getScaleComponent(a),d=Soe(r[a]),h=l[t],p=c.get("type"),f=c.get("padding"),m=c.get("paddingInner"),g=_se(p,t),y=vse(a,t);if(void 0!==h&&(g?y&&qie(y):qie(Uie(p,t,a))),g&&void 0===y)if(void 0!==h)u.copyKeyFromObject(t,l);else{const n=t in Cfe?Cfe[t]({model:e,channel:a,fieldOrDatumDef:d,scaleType:p,scalePadding:f,scalePaddingInner:m,domain:l.domain,markDef:s,config:i}):i.scale[t];void 0!==n&&u.set(t,n,!1)}}}(e,t):Mfe(e,t)}const Cfe={bins:({model:e,fieldOrDatumDef:t})=>roe(t)?function(e,t){const n=t.bin;if(fie(n)){const i=ype(e,t.field,n);return new rfe(()=>e.getSignalName(i))}if(mie(n)&&gie(n)&&void 0!==n.step)return{step:n.step};return}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(lee([Bte,$te,Ute],e)&&"nominal"!==t)return"hcl";return}(e,t.type),nice:({scaleType:e,channel:t,fieldOrDatumDef:n})=>function(e,t,n){var i;if((null===(i=Aoe(n))||void 0===i?void 0:i.bin)||lee([Vre,jre],e))return;return t in jne||void 0}(e,t,n),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,s){if(e in jne){if(lse(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:o}=r;if("bar"===t&&(!roe(i)||!i.bin&&!i.timeUnit)&&("vertical"===o&&"x"===e||"horizontal"===o&&"y"===e))return s.continuousBandSize}if(t===Wre)return n.pointPadding}return}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,config:i})=>function(e,t,n,i){if(void 0!==e)return;if(t in jne){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:r}=i;return Ree(e,"bar"===n?t:r)}return}(e,t,n.type,i.scale),paddingOuter:({scalePadding:e,channel:t,scaleType:n,markDef:i,scalePaddingInner:r,config:s})=>function(e,t,n,i,r,s){if(void 0!==e)return;if(t in jne&&n===Xre){const{bandPaddingOuter:e}=s;return Ree(e,hre(r)?{signal:`${r.signal}/2`}:r/2)}return}(e,t,n,i.type,r,s.scale),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return ase(e)&&"descending"===t?hre(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(ase(e)&&"descending"===t)return!0;return}(t,roe(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r})=>function(e,t,n,i,r){if(n&&"unaggregated"!==n&&ase(r)){if(O7(n)){const e=n[0],t=n[n.length-1];if(e<=0&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!use(r))return!0;if((!roe(t)||!t.bin)&&lee([...Yne,...Wne],e)){const{orient:t,type:n}=i;return!lee(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e)}return!1}(e,t,n,i,r)};function Ofe(e){Ffe(e)?function(e){const t=e.component.scales;for(const n of oie){const i=t[n];if(!i)continue;const r=xfe(n,e);i.setWithExplicit("range",r)}}(e):Mfe(e,"range")}function Mfe(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?Ofe(n):Sfe(n,t);for(const i of yee(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=Fle(r,e.getWithExplicit(t),t,"scale",Nle((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0))}}n[i].setWithExplicit(t,r)}}function Rfe(e,t,n,i){const r=function(e,t,n){var i;switch(t.type){case"nominal":case"ordinal":if(lne(e)||"discrete"===hie(e))return"shape"===e&&"ordinal"===t.type&&qie(Lie(e,"ordinal")),"ordinal";if(e in jne){if(lee(["rect","bar","image","rule"],n))return"band"}else if("arc"===n&&e in Hne)return"band";return void 0!==t.band||poe(t)&&(null===(i=t.axis)||void 0===i?void 0:i.tickBand)?"band":"point";case"temporal":return lne(e)?"time":"discrete"===hie(e)?(qie(Lie(e,"temporal")),"ordinal"):roe(t)&&t.timeUnit&&dre(t.timeUnit).utc?"utc":"time";case"quantitative":return lne(e)?roe(t)&&fie(t.bin)?"bin-ordinal":"linear":"discrete"===hie(e)?(qie(Lie(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(Rie(t.type))}(t,n,i),{type:s}=e;return aie(t)?void 0!==s?Tse(t,s)?roe(n)&&!bse(s,n.type)?(qie(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(s,r)),r):s:(qie(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,s,r)),r):r:null}function kfe(e){Ffe(e)?e.component.scales=function(e){const{encoding:t,mark:n}=e;return oie.reduce((i,r)=>{const s=Soe(t[r]);if(s&&n===nte&&r===zte&&s.type===Fre)return i;let o=s&&s.scale;if(s&&null!==o&&!1!==o){o=null!=o?o:{};const t=Rfe(o,r,s,n);i[r]=new _fe(e.scaleName(r+"",!0),{value:t,explicit:o.type===t})}return i},{})}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const n of e.children){kfe(n);for(const s of yee(n.component.scales))if(r.scale[s]=null!==(t=r.scale[s])&&void 0!==t?t:Yhe(s,e),"shared"===r.scale[s]){const e=i[s],t=n.component.scales[s].getWithExplicit("type");e?Zre(e.value,t.value)?i[s]=Fle(e,t,"type","scale",Nfe):(r.scale[s]="independent",delete i[s]):i[s]=t}}for(const t of yee(i)){const r=e.scaleName(t,!0),s=i[t];n[t]=new _fe(r,s);for(const n of e.children){const e=n.component.scales[t];e&&(n.renameScale(e.get("name"),r),e.merged=!0)}}return n}(e)}const Nfe=Nle((e,t)=>Jre(e)-Jre(t));class Dfe{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function Ffe(e){return"unit"===(null==e?void 0:e.type)}function Lfe(e){return"facet"===(null==e?void 0:e.type)}function Pfe(e){return"concat"===(null==e?void 0:e.type)}function Bfe(e){return"layer"===(null==e?void 0:e.type)}class $fe{constructor(e,t,n,i,r,s,o){var a,l;this.type=t,this.parent=n,this.config=r,this.view=o,this.children=[],this.correctDataNames=e=>(e.from&&e.from.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from&&e.from.facet&&e.from.facet.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=r,this.name=null!==(a=e.name)&&void 0!==a?a:i,this.title=Boe(e.title)?{text:e.title}:e.title,this.scaleNameMap=n?n.scaleNameMap:new Dfe,this.projectionNameMap=n?n.projectionNameMap:new Dfe,this.signalNameMap=n?n.signalNameMap:new Dfe,this.data=e.data,this.description=e.description,this.transforms=function(e){return e.map(e=>Hle(e)?{filter:eee(e.filter,Ore)}:e)}(null!==(l=e.transform)&&void 0!==l?l:[]),this.layout="layer"===t||"unit"===t?{}:function(e,t,n){var i,r;const s=n[t],o={},{spacing:a,columns:l}=s;void 0!==a&&(o.spacing=a),void 0!==l&&(Kse(e)&&!Xse(e.facet)||Lae(e))&&(o.columns=l),Pae(e)&&(o.columns=1);for(const t of zae)if(void 0!==e[t])if("spacing"===t){const n=e[t];o[t]=$7(n)?n:{row:null!==(i=n.row)&&void 0!==i?i:a,column:null!==(r=n.column)&&void 0!==r?r:a}}else o[t]=e[t];return o}(e,t,r),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:Kse(e)||n&&n.component.data.isFaceted&&void 0===e.data},layoutSize:new Mle,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:Object.assign({scale:{},axis:{},legend:{}},s?nee(s):{}),selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e,{ignoreRange:t}={}){kfe(e),sfe(e);for(const t of yse)Sfe(e,t);t||Ofe(e)}(this)}parseProjection(){mpe(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){rpe(this)}assembleGroupStyle(){var e,t;if("unit"===this.type||"layer"===this.type)return null!==(t=null===(e=this.view)||void 0===e?void 0:e.style)&&void 0!==t?t:"cell"}assembleEncodeFromView(e){const{style:t}=e,n=j7(e,["style"]),i={};for(const e of yee(n)){const t=n[e];void 0!==t&&(i[e]=$oe(t))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=$oe(this.description)),"unit"!==this.type&&"layer"!==this.type)?gee(t)?void 0:t:Object.assign({width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")},null!=t?t:{})}assembleLayout(){if(!this.layout)return;const e=this.layout,{spacing:t}=e,n=j7(e,["spacing"]),{component:i,config:r}=this,s=function(e,t){const n={};for(const i of cne){const r=e[i];if(null==r?void 0:r.facetFieldDef){const{titleAnchor:e,titleOrient:s}=Ihe(["titleAnchor","titleOrient"],r.facetFieldDef,t,i),o=Ehe(i,s),a=Lhe(e,o);void 0!==a&&(n[o]=a)}}return gee(n)?void 0:n}(i.layoutHeaders,r);return Object.assign(Object.assign(Object.assign({padding:t},this.assembleDefaultLayout()),n),s?{titleBand:s}:{})}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of cne)e[n].title&&t.push(Che(this,n));for(const e of Ahe)t=t.concat(Rhe(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map(e=>ohe(e,"grid",t)),...i.map(e=>ohe(e,"grid",t)),...n.map(e=>ohe(e,"main",t)),...i.map(e=>ohe(e,"main",t))].filter(e=>e)}(this.component.axes,this.config)}assembleLegends(){return cpe(this)}assembleProjections(){return dpe(this)}assembleTitle(){var e,t,n;const i=null!==(e=this.title)&&void 0!==e?e:{},{encoding:r}=i,s=j7(i,["encoding"]),o=Object.assign(Object.assign(Object.assign({},Poe(this.config.title).nonMark),s),r?{encode:{update:r}}:{});if(o.text)return lee(["unit","layer"],this.type)?lee(["middle",void 0],o.anchor)&&(o.frame=null!==(t=o.frame)&&void 0!==t?t:"group"):o.anchor=null!==(n=o.anchor)&&void 0!==n?n:"start",gee(o)?void 0:o}assembleGroup(e=[]){const t={};(e=e.concat(this.assembleSignals())).length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||Lfe(this.parent)?gfe(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const s=this.assembleLegends();return s.length>0&&(t.legends=s),t}getName(e){return Tee((this.name?this.name+"_":"")+e)}requestDataName(e){var t;const n=this.getName(e),i=this.component.data.outputNodeRefCounts;return i[n]=(null!==(t=i[n])&&void 0!==t?t:0)+1,n}getSizeSignalRef(e){if(Lfe(this.parent)){const t=Xne(Vhe(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(ose(e)&&pre(i)){const e=n.get("name"),i=ffe(mfe(this,t));if(i){return{signal:zhe(e,n,goe({aggregate:"distinct",field:i},{expr:"datum"}))}}return qie(`Unknown field for ${t}. Cannot calculate view size.`),null}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):xne(e)&&aie(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(`Cannot find a selection named "${t}".`);return n}hasAxisOrientSignalRef(){var e,t;return(null===(e=this.component.axes.x)||void 0===e?void 0:e.some(e=>e.hasOrientSignalRef()))||(null===(t=this.component.axes.y)||void 0===t?void 0:t.some(e=>e.hasOrientSignalRef()))}}class Ufe extends $fe{vgField(e,t={}){const n=this.fieldDef(e);if(n)return goe(n,t)}reduceFieldDef(e,t){return iae(this.getMapping(),(t,n,i)=>{const r=Aoe(n);return r?e(t,r,i):t},t)}forEachFieldDef(e,t){nae(this.getMapping(),(t,n)=>{const i=Aoe(t);i&&e(i,n)},t)}}class zfe extends Uue{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=nee(t);const s=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=s[0])&&void 0!==i?i:"value",null!==(r=s[1])&&void 0!==r?r:"density"]}clone(){return new zfe(null,nee(this.transform))}dependentFields(){var e;return new Set([this.transform.density,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${oee(this.transform)}`}assemble(){const e=this.transform,{density:t}=e,n=j7(e,["density"]);return Object.assign({type:"kde",field:t},n)}}class Vfe extends Uue{constructor(e,t){super(e),this.filter=t}clone(){return new Vfe(null,Object.assign({},this.filter))}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==joe("invalid",r,n))return null;const s=t.reduceFieldDef((e,n,r)=>{const s=aie(r)&&t.getScaleComponent(r);if(s){ase(s.get("type"))&&"count"!==n.aggregate&&!ite(i)&&(e[n.field]=n)}return e},{});return yee(s).length?new Vfe(e,s):null}dependentFields(){return new Set(yee(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${oee(this.filter)}`}assemble(){const e=yee(this.filter).reduce((e,t)=>{const n=this.filter[t],i=goe(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e},[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class jfe extends Uue{constructor(e,t){super(e),this.transform=t,this.transform=nee(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map((e,t)=>{var n;return null!==(n=i[t])&&void 0!==n?n:e})}clone(){return new jfe(this.parent,nee(this.transform))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${oee(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Yfe extends Uue{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=nee(t);const s=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=s[0])&&void 0!==i?i:"key",null!==(r=s[1])&&void 0!==r?r:"value"]}clone(){return new Yfe(null,nee(this.transform))}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${oee(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Gfe extends Uue{constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}clone(){return new Gfe(null,nee(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[Fte,Dte],[Pte,Lte]]){const r=i.map(e=>{const n=Soe(t.encoding[e]);return roe(n)?n.field:ooe(n)?{expr:`${n.datum}`}:doe(n)?{expr:`${n.value}`}:void 0});(r[0]||r[1])&&(e=new Gfe(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(zte)){const i=t.typedFieldDef(zte);i.type===Fre&&(e=new Gfe(e,null,i.field,t.getName("geojson_"+n++)))}return e}dependentFields(){var e;const t=(null!==(e=this.fields)&&void 0!==e?e:[]).filter(U7);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${oee(this.fields)}`}assemble(){return Object.assign(Object.assign(Object.assign({type:"geojson"},this.fields?{fields:this.fields}:{}),this.geojson?{geojson:this.geojson}:{}),{signal:this.signal})}}class Hfe extends Uue{constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}clone(){return new Hfe(null,this.projection,nee(this.fields),nee(this.as))}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[Fte,Dte],[Pte,Lte]]){const i=n.map(e=>{const n=Soe(t.encoding[e]);return roe(n)?n.field:ooe(n)?{expr:`${n.datum}`}:doe(n)?{expr:`${n.value}`}:void 0}),r=n[0]===Pte?"2":"";(i[0]||i[1])&&(e=new Hfe(e,t.projectionName(),i,[t.getName("x"+r),t.getName("y"+r)]))}return e}dependentFields(){return new Set(this.fields.filter(U7))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${oee(this.fields)} ${oee(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Wfe extends Uue{constructor(e,t){super(e),this.transform=t}clone(){return new Wfe(null,nee(this.transform))}dependentFields(){var e;return new Set([this.transform.impute,this.transform.key,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new Wfe(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(roe(i)&&roe(r)){const s=i.impute?i:r.impute?r:void 0;if(void 0===s)return;const o=i.impute?r:r.impute?i:void 0,{method:a,value:l,frame:u,keyvals:c}=s.impute,d=rae(t.mark,n);return new Wfe(e,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({impute:s.field,key:o.field},a?{method:a}:{}),void 0!==l?{value:l}:{}),u?{frame:u}:{}),void 0!==c?{keyvals:c}:{}),d.length?{groupby:d}:{}))}return null}hash(){return`Impute ${oee(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:s,frame:o=[null,null]}=this.transform,a=Object.assign(Object.assign(Object.assign(Object.assign({type:"impute",field:e,key:t},n?{keyvals:(l=n,void 0!==(null==l?void 0:l.stop)?this.processSequence(n):n)}:{}),{method:"value"}),r?{groupby:r}:{}),{value:i&&"value"!==i?null:s});var l;if(i&&"value"!==i){return[a,Object.assign({type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:o,ignorePeers:!1},r?{groupby:r}:{}),{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[a]}}class Xfe extends Uue{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=nee(t);const s=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=s[0])&&void 0!==i?i:t.on,null!==(r=s[1])&&void 0!==r?r:t.loess]}clone(){return new Xfe(null,nee(this.transform))}dependentFields(){var e;return new Set([this.transform.loess,this.transform.on,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${oee(this.transform)}`}assemble(){const e=this.transform,{loess:t,on:n}=e,i=j7(e,["loess","on"]);return Object.assign({type:"loess",x:n,y:t},i)}}class qfe extends Uue{constructor(e,t,n){super(e),this.transform=t,this.secondary=n}clone(){return new qfe(null,nee(this.transform),this.secondary)}static make(e,t,n,i){const r=t.component.data.sources,{from:s}=n;let o=null;if(function(e){return"data"in e}(s)){let e=dme(s.data,r);e||(e=new bpe(s.data),r.push(e));const n=t.getName(`lookup_${i}`);o=new zue(e,n,"lookup",t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=o}else if(function(e){return"selection"in e}(s)){const e=s.selection;if(n=Object.assign({as:e},n),o=t.getSelectionComponent(Tee(e),e).materialized,!o)throw new Error(`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new qfe(e,n,o.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?F7(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${oee({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e=Object.assign({values:this.transform.from.fields},this.transform.as?{as:F7(this.transform.as)}:{});else{let t=this.transform.as;U7(t)||(qie('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),t="_lookup"),e={as:[t]}}return Object.assign(Object.assign({type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup]},e),this.transform.default?{default:this.transform.default}:{})}}class Kfe extends Uue{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=nee(t);const s=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=s[0])&&void 0!==i?i:"prob",null!==(r=s[1])&&void 0!==r?r:"value"]}clone(){return new Kfe(null,nee(this.transform))}dependentFields(){var e;return new Set([this.transform.quantile,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${oee(this.transform)}`}assemble(){const e=this.transform,{quantile:t}=e,n=j7(e,["quantile"]);return Object.assign({type:"quantile",field:t},n)}}class Zfe extends Uue{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=nee(t);const s=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=s[0])&&void 0!==i?i:t.on,null!==(r=s[1])&&void 0!==r?r:t.regression]}clone(){return new Zfe(null,nee(this.transform))}dependentFields(){var e;return new Set([this.transform.regression,this.transform.on,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${oee(this.transform)}`}assemble(){const e=this.transform,{regression:t,on:n}=e,i=j7(e,["regression","on"]);return Object.assign({type:"regression",x:n,y:t},i)}}class Qfe extends Uue{constructor(e,t){super(e),this.transform=t}clone(){return new Qfe(null,nee(this.transform))}addDimensions(e){var t;this.transform.groupby=hee((null!==(t=this.transform.groupby)&&void 0!==t?t:[]).concat(e),e=>e)}producedFields(){}dependentFields(){var e;return new Set([this.transform.pivot,this.transform.value,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}hash(){return`PivotTransform ${oee(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return Object.assign(Object.assign(Object.assign({type:"pivot",field:e,value:t},void 0!==i?{limit:i}:{}),void 0!==r?{op:r}:{}),void 0!==n?{groupby:n}:{})}}class Jfe extends Uue{constructor(e,t){super(e),this.transform=t}clone(){return new Jfe(null,nee(this.transform))}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${oee(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function eme(e){let t=0;return function n(i,r){var s;if(i instanceof bpe&&!i.isGenerator&&!Ple(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}if(i instanceof Dpe&&(i.parent instanceof bpe&&!r.source?(r.format=Object.assign(Object.assign({},null!==(s=r.format)&&void 0!==s?s:{}),{parse:i.assembleFormatParse()}),r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof Mpe){r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source;for(const t of i.assemble())e.push(t)}else{if((i instanceof xpe||i instanceof Epe||i instanceof Vfe||i instanceof the||i instanceof The||i instanceof Hfe||i instanceof Gfe||i instanceof Ope||i instanceof qfe||i instanceof Bpe||i instanceof Lpe||i instanceof Yfe||i instanceof jfe||i instanceof zfe||i instanceof Xfe||i instanceof Kfe||i instanceof Zfe||i instanceof Fpe||i instanceof Jfe||i instanceof Qfe)&&r.transform.push(i.assemble()),(i instanceof vpe||i instanceof Vue||i instanceof Wfe||i instanceof Ppe)&&r.transform.push(...i.assemble()),i instanceof zue)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof zue)i.setSource(r.name);else if(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()){e.push(r);r={name:null,source:r.name,transform:[]}}switch(i.numChildren()){case 0:i instanceof zue&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let s=r.name;!r.source||r.transform.length>0?e.push(r):s=r.source;for(const e of i.children){n(e,{name:null,source:s,transform:[]})}break}}}}}function tme(e){return"top"===e||"left"===e||hre(e)?"header":"footer"}function nme(e,t){var n;const{facet:i,config:r,child:s,component:o}=e;if(e.channelHasField(t)){const a=i[t],l=whe("title",null,r,t);let u=xoe(a,r,{allowDisabling:!0,includeDefault:void 0===l||!!l});s.component.layoutHeaders[t].title&&(u=O7(u)?u.join(", "):u,u+=" / "+s.component.layoutHeaders[t].title,s.component.layoutHeaders[t].title=null);const c=whe("labelOrient",a,r,t),d=Ree((null!==(n=a.header)&&void 0!==n?n:{}).labels,r.header.labels,!0),h=lee(["bottom","right"],c)?"footer":"header";o.layoutHeaders[t]={title:u,facetFieldDef:a,[h]:"facet"===t?[]:[ime(e,t,d)]}}}function ime(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function rme(e,t){var n;const{child:i}=e;if(i.component.axes[t]){const{layoutHeaders:r,resolve:s}=e.component;if(s.axis[t]=Ghe(s,t),"shared"===s.axis[t]){const s="x"===t?"column":"row",o=r[s];for(const r of i.component.axes[t]){const t=tme(r.get("orient"));o[t]=null!==(n=o[t])&&void 0!==n?n:[ime(e,s,!1)];const i=ohe(r,"main",e.config,{header:!0});i&&o[t][0].axes.push(i),r.mainExtracted=!0}}}}function sme(e){ome(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";ame(e,t),ame(e,n)}function ome(e){for(const t of e.children)t.parseLayoutSize()}function ame(e,t){const n=Vhe(t),i=Xne(n),r=e.component.resolve,s=e.component.layoutSize;let o;for(const t of e.children){const e=t.component.layoutSize.getWithExplicit(n),s=r.scale[i];if("independent"===s&&"step"===e.value){o=void 0;break}if(o){if("independent"===s&&o.value!==e.value){o=void 0;break}o=Fle(o,e,n,"")}else o=e}if(o){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);s.setWithExplicit(t,o)}else s.setWithExplicit(t,{explicit:!1,value:void 0})}function lme(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(ose(e)){const e=Yae(i.view,t);return pre(n)||$ae(e)?"step":e}return Vae(i.view,t)}if(e.hasProjection||"arc"===e.mark)return Vae(i.view,t);{const e=Yae(i.view,t);return $ae(e)?e.step:e}}function ume(e,t,n){return goe(t,Object.assign({suffix:`by_${goe(e)}`},null!=n?n:{}))}class cme extends Ufe{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=Pme(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet,i)}initFacet(e,t){return Xse(e)?iae(e,(e,n,i)=>lee([Ete,wte],i)?void 0===n.field?(qie(Nie(n,i)),e):(e[i]=Coe(n,i,t),e):(qie(Die(i,"facet")),e),{}):{facet:Coe(e,"facet",t)}}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=pme(this),this.child.parseData()}parseLayoutSize(){ome(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of cne)nme(e,t);rme(e,"x"),rme(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){var e,t,n;const i={};for(const r of cne)for(const s of She){const o=this.component.layoutHeaders[r],a=o[s],{facetFieldDef:l}=o;if(l){const t=whe("titleOrient",l,this.config,r);if(lee(["right","bottom"],t)){const n=Ehe(r,t);i.titleAnchor=null!==(e=i.titleAnchor)&&void 0!==e?e:{},i.titleAnchor[n]="end"}}if(null==a?void 0:a[0]){const e="row"===r?"height":"width",a="header"===s?"headerBand":"footerBand";"facet"===r||this.child.component.layoutSize.get(e)||(i[a]=null!==(t=i[a])&&void 0!==t?t:{},i[a][r]=.5),o.title&&(i.offset=null!==(n=i.offset)&&void 0!==n?n:{},i.offset["row"===r?"rowTitle":"columnTitle"]=10)}}return i}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),Object.assign(Object.assign(Object.assign({},this.getHeaderLayoutMixins()),n?{columns:n}:{}),{bounds:"full",align:i})}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof cme)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroup(e){return this.parent&&this.parent instanceof cme?Object.assign(Object.assign({},this.channelHasField("column")?{encode:{update:{columns:{field:goe(this.facet.column,{prefix:"distinct"})}}}}:{}),super.assembleGroup(e)):super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof cme){if(this.child.channelHasField("column")){const i=goe(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of Yne){const r=this.child.component.scales[i];if(r&&!r.merged){const s=r.get("type"),o=r.get("range");if(ose(s)&&pre(o)){const r=ffe(mfe(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):qie(`Unknown field for ${i}. Cannot calculate view size.`)}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:i}=this.facet,{fields:r,ops:s,as:o}=this.getCardinalityAggregateForChild(),a=[];for(const e of cne){const t=this.facet[e];if(t){a.push(goe(t));const{bin:l,sort:u}=t;if(fie(l)&&a.push(goe(t,{binSuffix:"end"})),Hse(u)){const{field:e,op:a=Vse}=u,l=ume(t,u);n&&i?(r.push(l),s.push("max"),o.push(l)):(r.push(e),s.push(a),o.push(l))}else if(O7(u)){const n=xhe(t,e);r.push(n),s.push("max"),o.push(n)}}}const l=!!n&&!!i;return Object.assign({name:e,data:t,groupby:a},l||r.length>0?{aggregate:Object.assign(Object.assign({},l?{cross:l}:{}),r.length?{fields:r,ops:s,as:o}:{})}:{})}facetSortFields(e){const{facet:t}=this,n=t[e];return n?Hse(n.sort)?[ume(n,n.sort,{expr:"datum"})]:O7(n.sort)?[xhe(n,e,{expr:"datum"})]:[goe(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(Hse(e)?e.order:!O7(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return Nhe(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of Ahe)if(e[i]){const r=whe("labelOrient",e[i],t,i);if(lee(n[i],r))return Nhe(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=eme(t);for(const t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle(),s=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:this.getName("cell"),type:"group"},i?{title:i}:{}),r?{style:r}:{}),{from:{facet:this.assembleFacet()},sort:{field:cne.map(e=>this.facetSortFields(e)).flat(),order:cne.map(e=>this.facetSortOrder(e)).flat()}}),t.length>0?{data:t}:{}),n?{encode:{update:n}}:{}),e.assembleGroup(function(e,t){if(e.component.selection&&yee(e.component.selection).length){const n=z7(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:f7("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return fce(t)}(this,[])));return[s]}getMapping(){return this.facet}}function dme(e,t){var n,i,r,s,o,a,l,u,c,d;for(const h of t){const t=h.data;if((!e.name||!h.hasName()||e.name===h.dataName)&&!((null===(n=e.format)||void 0===n?void 0:n.mesh)&&(null===(i=t.format)||void 0===i?void 0:i.feature)||((null===(r=e.format)||void 0===r?void 0:r.feature)||(null===(s=t.format)||void 0===s?void 0:s.feature))&&(null===(o=e.format)||void 0===o?void 0:o.feature)!==(null===(a=t.format)||void 0===a?void 0:a.feature)||((null===(l=e.format)||void 0===l?void 0:l.mesh)||(null===(u=t.format)||void 0===u?void 0:u.mesh))&&(null===(c=e.format)||void 0===c?void 0:c.mesh)!==(null===(d=t.format)||void 0===d?void 0:d.mesh)))if(Ble(e)&&Ble(t)){if(tee(e.values,t.values))return h}else if(Ple(e)&&Ple(t)){if(e.url===t.url)return h}else if($le(e)&&e.name===h.dataName)return h}return null}function hme(e,t){if(e.data||!e.parent){if(null===e.data){const e=new bpe({values:[]});return t.push(e),e}const n=dme(e.data,t);if(n)return Ule(e.data)||(n.data.format=function(e,...t){for(const n of t)dee(e,null!=n?n:{});return e}({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new bpe(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function pme(e){var t,n,i,r,s,o,a,l,u,c;let d=hme(e,e.component.data.sources);const{outputNodes:h,outputNodeRefCounts:p}=e.component.data,f=e.parent?e.parent.component.data.ancestorParse.clone():new Lle,m=e.data;Ule(m)?(zle(m)?d=new Epe(d,m.sequence):jle(m)&&(d=new xpe(d,m.graticule)),f.parseNothing=!0):null===(null===(t=null==m?void 0:m.format)||void 0===t?void 0:t.parse)&&(f.parseNothing=!0),d=null!==(n=Dpe.makeExplicit(d,e,f))&&void 0!==n?n:d,d=new Fpe(d);const g=e.parent&&Bfe(e.parent);(Ffe(e)||Lfe(e))&&g&&(d=null!==(i=vpe.makeFromEncoding(d,e))&&void 0!==i?i:d),e.transforms.length>0&&(d=function(e,t,n){var i,r;let s=0;for(const o of t.transforms){let a,l;if(iue(o))l=e=new The(e,o),a="derived";else if(Hle(o)){const r=kpe(o);l=e=null!==(i=Dpe.makeWithAncestors(e,{},r,n))&&void 0!==i?i:e,e=new the(e,t,o.filter)}else if(rue(o))l=e=vpe.makeFromTransform(e,o,t),a="number";else if(oue(o))a="date",void 0===n.getWithExplicit(o.field).value&&(e=new Dpe(e,{[o.field]:a}),n.set(o.field,a,!1)),l=e=Vue.makeFromTransform(e,o);else if(aue(o))l=e=Ope.makeFromTransform(e,o),a="number",Oce(t)&&(e=new Fpe(e));else if(Wle(o))l=e=qfe.make(e,t,o,s++),a="derived";else if(eue(o))l=e=new Bpe(e,o),a="number";else if(tue(o))l=e=new Lpe(e,o),a="number";else if(lue(o))l=e=Ppe.makeFromTransform(e,o),a="derived";else if(uue(o))l=e=new Yfe(e,o),a="derived";else if(nue(o))l=e=new jfe(e,o),a="derived";else if(Xle(o))l=e=new Qfe(e,o),a="derived";else if(Jle(o))e=new Jfe(e,o);else if(sue(o))l=e=Wfe.makeFromTransform(e,o),a="derived";else if(qle(o))l=e=new zfe(e,o),a="derived";else if(Kle(o))l=e=new Kfe(e,o),a="derived";else if(Zle(o))l=e=new Zfe(e,o),a="derived";else{if(!Qle(o)){qie(Oie(o));continue}l=e=new Xfe(e,o),a="derived"}if(l&&void 0!==a)for(const e of null!==(r=l.producedFields())&&void 0!==r?r:[])n.set(e,a,!1)}return e}(d,e,f));const y=function(e){const t={};if(Ffe(e)&&e.component.selection)for(const n of yee(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&Mee(e.field)>1&&(t[e.field]="flatten")}return t}(e),_=Npe(e);d=null!==(r=Dpe.makeWithAncestors(d,{},Object.assign(Object.assign({},y),_),f))&&void 0!==r?r:d,Ffe(e)&&(d=Gfe.parseAll(d,e),d=Hfe.parseAll(d,e)),(Ffe(e)||Lfe(e))&&(g||(d=null!==(s=vpe.makeFromEncoding(d,e))&&void 0!==s?s:d),d=null!==(o=Vue.makeFromEncoding(d,e))&&void 0!==o?o:d,d=The.parseAllForSortIndex(d,e));const v=e.getName(Gle),b=new zue(d,v,Gle,p);if(h[v]=b,d=b,Ffe(e)){const t=Ope.makeFromEncoding(d,e);t&&(d=t,Oce(e)&&(d=new Fpe(d))),d=null!==(a=Wfe.makeFromEncoding(d,e))&&void 0!==a?a:d,d=null!==(l=Ppe.makeFromEncoding(d,e))&&void 0!==l?l:d}Ffe(e)&&(d=null!==(u=Vfe.make(d,e))&&void 0!==u?u:d);const T=e.getName(Yle),x=new zue(d,T,Yle,p);h[T]=x,d=x,Ffe(e)&&function(e,t){Sce(e,n=>{const i=n.name,r=e.getName(`lookup_${i}`);e.component.data.outputNodes[r]=n.materialized=new zue(new the(t,e,{selection:i}),r,"lookup",e.component.data.outputNodeRefCounts)})}(e,x);let E=null;if(Lfe(e)){const t=e.getName("facet");d=null!==(c=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(Hse(r.sort)){const{field:n,op:i=Vse}=r.sort;e=t=new Lpe(e,{joinaggregate:[{op:i,field:n,as:ume(r,r.sort,{forAs:!0})}],groupby:[goe(r)]})}return t}return null}(d,e.facet))&&void 0!==c?c:d,E=new Mpe(d,e,t,x.getSource()),h[t]=E}return Object.assign(Object.assign({},e.component.data),{outputNodes:h,outputNodeRefCounts:p,raw:b,main:x,facetRoot:E,ancestorParse:f})}class fme extends $fe{constructor(e,t,n,i){var r,s,o,a;super(e,"concat",t,n,i,e.resolve),"shared"!==(null===(s=null===(r=e.resolve)||void 0===r?void 0:r.axis)||void 0===s?void 0:s.x)&&"shared"!==(null===(a=null===(o=e.resolve)||void 0===o?void 0:o.axis)||void 0===a?void 0:a.y)||qie("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map((e,t)=>Pme(e,this,this.getName("concat_"+t),void 0,i))}parseData(){this.component.data=pme(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of yee(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return Pae(e)?e.vconcat:Bae(e)?e.hconcat:e.concat}parseLayoutSize(){sme(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){const e=Bhe(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleMarks(){return this.children.map(e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return Object.assign(Object.assign(Object.assign(Object.assign({type:"group",name:e.getName("group")},t?{title:t}:{}),n?{style:n}:{}),i?{encode:{update:i}}:{}),e.assembleGroup())})}assembleDefaultLayout(){const e=this.layout.columns;return Object.assign(Object.assign({},null!=e?{columns:e}:{}),{bounds:"full",align:"each"})}}const mme=Object.assign(Object.assign({disable:1,gridScale:1,scale:1},$ee),{labelExpr:1,encode:1}),gme=yee(mme);class yme extends Mle{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new yme(nee(this.explicit),nee(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}hasOrientSignalRef(){return hre(this.explicit.orient)}}const _me={bottom:"top",top:"bottom",left:"right",right:"left"};function vme(e,t){if(!e)return t.map(e=>e.clone());{if(e.length!==t.length)return;const n=e.length;for(let i=0;i<n;i++){const n=e[i],r=t[i];if(!!n!=!!r)return;if(n&&r){const t=n.getWithExplicit("orient"),s=r.getWithExplicit("orient");if(t.explicit&&s.explicit&&t.value!==s.value)return;e[i]=bme(n,r)}}}return e}function bme(e,t){for(const n of gme){const i=Fle(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",(e,t)=>{switch(n){case"title":return Koe(e,t);case"gridScale":return{explicit:e.explicit,value:Ree(e.value,t.value)}}return Dle(e,t,n,"axis")});e.setWithExplicit(n,i)}return e}function Tme(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(hre(n.labelAngle)?n.labelAngle:Nee(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===bhe(i,r))return!0}return e===n[t]}const xme=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function Eme(e,t){var n,i,r;let s=t.axis(e);const o=new yme,a=Soe(t.encoding[e]),{mark:l,config:u}=t,c=(null==s?void 0:s.orient)||(null===(n=u["x"===e?"axisX":"axisY"])||void 0===n?void 0:n.orient)||(null===(i=u.axis)||void 0===i?void 0:i.orient)||function(e){return"x"===e?"bottom":"left"}(e),d=t.getScaleComponent(e).get("type"),h=phe(e,d,c,t.config),p=void 0!==s?!s:mhe("disable",u,null==s?void 0:s.style,h).configValue;if(o.set("disable",p,void 0!==s),p)return o;s=s||{};const f=function(e,t,n,i,r){const s=null==t?void 0:t.labelAngle;if(void 0!==s)return hre(s)?s:Nee(s);{const{configValue:s}=mhe("labelAngle",e.config,null==t?void 0:t.style,r);return void 0!==s?Nee(s):n===Ate&&lee([Dre,kre],i.type)?270:void 0}}(t,s,e,a,h),m={fieldOrDatumDef:a,axis:s,channel:e,model:t,scaleType:d,orient:c,labelAngle:f,mark:l,config:u};for(const n of gme){const i=n in ghe?ghe[n](m):zee(n)?s[n]:void 0,r=void 0!==i,a=Tme(i,n,s,t,e);if(r&&a)o.set(n,i,a);else{const{configValue:e,configFrom:l}=zee(n)&&"values"!==n?mhe(n,t.config,s.style,h):{},u=void 0!==e;r&&!u?o.set(n,i,a):("vgAxisConfig"!==l||xme.has(n)&&u||Lee(e)||hre(e))&&o.set(n,e,!1)}}const g=null!==(r=s.encoding)&&void 0!==r?r:{},y=Pee.reduce((n,i)=>{var r;if(!o.hasAxisPart(i))return n;const s=jhe(null!==(r=g[i])&&void 0!==r?r:{},t),a="labels"===i?function(e,t,n){var i;const{encoding:r,config:s}=e,o=null!==(i=Soe(r[t]))&&void 0!==i?i:Soe(r[Sne(t)]),a=e.axis(t)||{},{format:l,formatType:u}=a;return Rse(u)?Object.assign({text:Fse({fieldOrDatumDef:o,field:"datum.value",format:l,formatType:u,config:s})},n):n}(t,e,s):s;return void 0===a||gee(a)||(n[i]={update:a}),n},{});return gee(y)||o.set("encode",y,!!s.encoding||void 0!==s.labelAngle),o}function wme(e,t,n,{graticule:i}){const r=ote(e)?Object.assign({},e):{type:e},s=joe("orient",r,n);if(r.orient=function(e,t,n){switch(e){case Xee:case ete:case tte:case Zee:case qee:case Hee:return}const{x:i,y:r,x2:s,y2:o}=t;switch(e){case Gee:if(roe(i)&&(mie(i.bin)||roe(r)&&r.aggregate&&!i.aggregate))return"vertical";if(roe(r)&&(mie(r.bin)||roe(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(o||s){if(n)return n;if(!s&&(roe(i)&&i.type===Rre&&!fie(i.bin)||loe(i)))return"horizontal";if(!o&&(roe(r)&&r.type===Rre&&!fie(r.bin)||loe(r)))return"vertical"}case Kee:if(s&&(!roe(i)||!mie(i.bin))&&o&&(!roe(r)||!mie(r.bin)))return;case Yee:if(o)return roe(r)&&mie(r.bin)?"horizontal":"vertical";if(s)return roe(i)&&mie(i.bin)?"vertical":"horizontal";if(e===Kee){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case Wee:case Qee:{const t=aoe(i),s=aoe(r);if(t&&!s)return"tick"!==e?"horizontal":"vertical";if(!t&&s)return"tick"!==e?"vertical":"horizontal";if(t&&s){const t=i,s=r,o=t.type===Nre,a=s.type===Nre;return o&&!a?"tick"!==e?"vertical":"horizontal":!o&&a?"tick"!==e?"horizontal":"vertical":!t.aggregate&&s.aggregate?"tick"!==e?"vertical":"horizontal":t.aggregate&&!s.aggregate?"tick"!==e?"horizontal":"vertical":n||"vertical"}return n||void 0}}return"vertical"}(r.type,t,s),void 0!==s&&s!==r.orient&&qie(`Specified orient "${r.orient}" overridden with "${s}".`),"bar"===r.type&&r.orient){const e=joe("cornerRadiusEnd",r,n);if(void 0!==e){const n="horizontal"===r.orient&&t.x2||"vertical"===r.orient&&t.y2?["cornerRadius"]:ute[r.orient];for(const t of n)r[t]=e;void 0!==r.cornerRadiusEnd&&delete r.cornerRadiusEnd}}void 0===joe("opacity",r,n)&&(r.opacity=function(e,t){if(lee([Xee,Qee,ete,tte],e)&&!Qoe(t))return.7;return}(r.type,t));void 0===r.filled&&(r.filled=!i&&function(e,t){const n=Yoe("filled",e,t),i=e.type;return Ree(n,i!==Xee&&i!==Wee&&i!==Kee)}(r,n));return void 0===joe("cursor",r,n)&&(r.cursor=function(e,t,n){if(t.href||e.href||joe("href",e,n))return"pointer";return e.cursor}(r,t,n)),r}function Ime(e,t){const{config:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"})),bue("x",e,{defaultPos:"mid"})),bue("y",e,{defaultPos:"mid"})),yue("size",e)),yue("angle",e)),function(e,t,n){if(n)return{shape:{value:n}};return yue("shape",e)}(e,0,t))}const Ame={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?Object.assign(Object.assign(Object.assign(Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),Iue("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n})),Iue("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n})),yue("size",e,{vgChannel:"strokeWidth"})):{}}},Sme={vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Nue(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"})),bue("x",e,{defaultPos:"mid"})),bue("y",e,{defaultPos:"mid"})),due(e)),yue("size",e,{vgChannel:"fontSize"})),yue("angle",e)),Lue("align",function(e,t,n){const i=joe("align",e,n);if(void 0===i)return"center";return}(e.markDef,0,t))),Lue("baseline",function(e,t,n){const i=joe("baseline",e,n);if(void 0===i)return"middle";return}(e.markDef,0,t))),bue("radius",e,{defaultPos:null,isMidPoint:!0})),bue("theta",e,{defaultPos:null,isMidPoint:!0}))}};const Cme={vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",s="horizontal"===i?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),bue("x",e,{defaultPos:"mid",vgChannel:"xc"})),bue("y",e,{defaultPos:"mid",vgChannel:"yc"})),yue("size",e,{defaultValue:Ome(e),vgChannel:r})),{[s]:$oe(joe("thickness",n,t))})}};function Ome(e){var t;const{config:n,markDef:i}=e,{orient:r}=i,s="horizontal"===r?"width":"height",o=e.getScaleComponent("horizontal"===r?"x":"y"),a=null!==(t=joe("size",i,n,{vgChannel:s}))&&void 0!==t?t:n.tick.bandSize;if(void 0!==a)return a;{const e=o?o.get("range"):void 0;if(e&&pre(e)&&$7(e.step))return 3*e.step/4;return 3*jae(n.view,s)/4}}const Mme={arc:{vgMark:"arc",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),bue("x",e,{defaultPos:"mid"})),bue("y",e,{defaultPos:"mid"})),Cue(e,"radius","arc")),Cue(e,"theta","arc"))},area:{vgMark:"area",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"})),Iue("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient})),Iue("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient})),Fue(e))},bar:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),Cue(e,"x","bar")),Cue(e,"y","bar"))},circle:{vgMark:"symbol",encodeEntry:e=>Ime(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[Object.assign({type:"geoshape",projection:e.projectionName()},n&&roe(n)&&n.type===Fre?{field:goe(n,{expr:"datum"})}:{})]}},image:{vgMark:"image",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"})),Cue(e,"x","image")),Cue(e,"y","image")),due(e,"url"))},line:{vgMark:"line",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),bue("x",e,{defaultPos:"mid"})),bue("y",e,{defaultPos:"mid"})),yue("size",e,{vgChannel:"strokeWidth"})),Fue(e))},point:{vgMark:"symbol",encodeEntry:e=>Ime(e)},rect:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),Cue(e,"x","rect")),Cue(e,"y","rect"))},rule:Ame,square:{vgMark:"symbol",encodeEntry:e=>Ime(e,"square")},text:Sme,tick:Cme,trail:{vgMark:"trail",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Nue(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"})),bue("x",e,{defaultPos:"mid"})),bue("y",e,{defaultPos:"mid"})),yue("size",e)),Fue(e))}};function Rme(e){return lee([Wee,Yee,Jee],e.mark)?function(e){const t=rae(e.mark,e.encoding),n=Dme(e,{fromPrefix:t.length>0?kme:""});return t.length>0?[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:kme+e.requestDataName(Yle),data:e.requestDataName(Yle),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:n}]:n}(e):lee([Gee],e.mark)?function(e){const t=yre.some(t=>joe(t,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&t){const[t]=Dme(e,{fromPrefix:Nme}),n=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),r=(e,t)=>`${e}(${[i({prefix:"min",suffix:"start",expr:t}),i({prefix:"max",suffix:"start",expr:t}),i({prefix:"min",suffix:"end",expr:t}),i({prefix:"max",suffix:"end",expr:t})].map(e=>`scale('${n}',${e})`).join(",")})`;let s,o;"x"===e.stack.fieldChannel?(s=Object.assign(Object.assign({},iee(t.encode.update,["y","yc","y2","height",...yre])),{x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}}),o={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update=Object.assign(Object.assign({},ree(t.encode.update,["y","yc","y2"])),{height:{field:{group:"height"}}})):(s=Object.assign(Object.assign({},iee(t.encode.update,["x","xc","x2","width"])),{y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}}),o={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update=Object.assign(Object.assign({},ree(t.encode.update,["x","xc","x2"])),{width:{field:{group:"width"}}}));for(const n of yre){const i=Yoe(n,e.markDef,e.config);t.encode.update[n]?(s[n]=t.encode.update[n],delete t.encode.update[n]):i&&(s[n]=$oe(i)),i&&(t.encode.update[n]={value:0})}const a=e.fieldDef(e.stack.groupbyChannel),l=goe(a)?[goe(a)]:[];((null==a?void 0:a.bin)||(null==a?void 0:a.timeUnit))&&l.push(goe(a,{binSuffix:"end"}));return s=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((n,i)=>{if(t.encode.update[i])return Object.assign(Object.assign({},n),{[i]:t.encode.update[i]});{const t=Yoe(i,e.markDef,e.config);return void 0!==t?Object.assign(Object.assign({},n),{[i]:$oe(t)}):n}},s),s.stroke&&(s.strokeForeground={value:!0},s.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Yle),name:Nme+e.requestDataName(Yle),groupby:l,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:s},marks:[{type:"group",encode:{update:o},marks:[t]}]}]}return Dme(e)}(e):Dme(e)}const kme="faceted_path_";const Nme="stack_group_";function Dme(e,t={fromPrefix:""}){const{mark:n,markDef:i,config:r}=e,s=Ree(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!!(t&&t.get("selectionExtent")||n&&n.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),o=Voe(i),a=e.encoding.key,l=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:s}=e,o=t.order;if(!(!O7(o)&&doe(o)&&aee(o.value)||!o&&aee(joe("order",r,s)))){if((O7(o)||roe(o))&&!n)return Woe(o,{expr:"datum"});if(ite(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(roe(i)){const t=i.sort;return O7(t)?{field:goe(i,{prefix:n,suffix:"sort_index",expr:"datum"})}:Hse(t)?{field:goe({aggregate:Qoe(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})}:Gse(t)?{field:goe(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}:null===t?void 0:{field:goe(i,{binSuffix:e.stack&&e.stack.impute?"mid":void 0,expr:"datum"})}}return}}}(e),u=function(e){if(!e.component.selection)return null;const t=yee(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=yee(i.component.selection).length,i=i.parent;return n?{interactive:t>0}:null}(e),c=joe("aria",i,r),d=Mme[n].postEncodingTransform?Mme[n].postEncodingTransform(e):null;return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName("marks"),type:Mme[n].vgMark},s?{clip:!0}:{}),o?{style:o}:{}),a?{key:a.field}:{}),l?{sort:l}:{}),u||{}),!1===c?{aria:c}:{}),{from:{data:t.fromPrefix+e.requestDataName(Yle)},encode:{update:Mme[n].encodeEntry(e)}}),d?{transform:d}:{})]}class Fme extends Ufe{constructor(e,t,n,i={},r){var s,o;super(e,"unit",t,n,r,void 0,Uae(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection={},this.children=[];const a=ote(e.mark)?e.mark.type:e.mark;this.markDef=wme(e.mark,null!==(s=e.encoding)&&void 0!==s?s:{},r,{graticule:e.data&&jle(e.data)});const l=this.encoding=eae(null!==(o=e.encoding)&&void 0!==o?o:{},this.markDef,r);this.size=function({encoding:e,size:t}){for(const n of Yne){const i=Cne(n);$ae(t[i])&&aoe(e[n])&&(delete t[i],qie(zie(i)))}return t}({encoding:l,size:Uae(e)?Object.assign(Object.assign(Object.assign({},i),e.width?{width:e.width}:{}),e.height?{height:e.height}:{}):i}),this.stack=lle(a,l),this.specifiedScales=this.initScales(a,l),this.specifiedAxes=this.initAxes(l),this.specifiedLegends=this.initLegend(l),this.specifiedProjection=e.projection,this.selection=e.selection}get hasProjection(){const{encoding:e}=this,t=this.mark===nte,n=e&&one.some(t=>uoe(e[t]));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return oie.reduce((e,n)=>{var i;const r=Soe(t[n]);return r&&(e[n]=null!==(i=r.scale)&&void 0!==i?i:{}),e},{})}initAxes(e){return Yne.reduce((t,n)=>{const i=e[n];if(uoe(i)||n===Ate&&uoe(e.x2)||n===Ste&&uoe(e.y2)){const e=uoe(i)?i.axis:void 0;t[n]=e?Object.assign({},e):e}return t},{})}initLegend(e){return rie.reduce((t,n)=>{const i=Soe(e[n]);if(i&&function(e){switch(e){case Bte:case $te:case Ute:case Vte:case zte:case Yte:case Wte:case Xte:return!0;case Gte:case Hte:case jte:return!1}}(n)){const e=i.legend;t[n]=e?Object.assign({},e):e}return t},{})}parseData(){this.component.data=pme(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of Yne){const r=Cne(i);if(t[r]){const e=t[r];n.layoutSize.set(r,$ae(e)?"step":e,!0)}else{const t=lme(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){var n;const i={},r=e.config.selection;for(const s of yee(null!=t?t:{})){const o=nee(t[s]),a=r[o.type],{fields:l,encodings:u}=a,c=j7(a,["fields","encodings"]);for(const e in c)"encodings"===e&&o.fields||"fields"===e&&o.encodings||("mark"===e&&(o[e]=Object.assign(Object.assign({},c[e]),o[e])),void 0!==o[e]&&!0!==o[e]||(o[e]=null!==(n=c[e])&&void 0!==n?n:o[e]));const d=Tee(s),h=i[d]=Object.assign(Object.assign({},o),{name:d,events:U7(o.on)?f7(o.on,"scope"):nee(o.on)});dce(h,n=>{n.has(h)&&n.parse&&n.parse(e,h,o,t[s])})}return i}(this,this.selection)}parseMarkGroup(){this.component.mark=Rme(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,Yne.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[Eme(n,e)]),t),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;if(Sce(e,(i,r)=>{const s=i.name,o=z7(s+xce),a=t.filter(e=>e.name===s);if(0===a.length){const e="global"===i.resolve?"union":i.resolve,n="multi"===i.type?", true)":")";t.push({name:i.name,update:`${Ice}(${o}, ${z7(e)}${n}`})}n=!0,r.topLevelSignals&&(t=r.topLevelSignals(e,i,t)),dce(i,n=>{n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))})}),n){const e=t.filter(e=>"unit"===e.name);0===e.length&&t.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})}return fce(t)}(this,e)}assembleSignals(){return[...ahe(this),...(e=this,t=[],Sce(e,(n,i)=>{const r=n.name;let s=i.modifyExpr(e,n);t.push(...i.signals(e,n)),dce(n,i=>{i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(s=i.modifyExpr(e,n,s))}),t.push({name:r+wce,on:[{events:{signal:n.name+Ece},update:`modify(${z7(n.name+xce)}, ${s})`}]})}),fce(t))];var e,t}assembleSelectionData(e){return function(e,t){const n=[...t];return Sce(e,t=>{const i={name:t.name+xce};if(t.init){const n=t.project.items.map(e=>{const{signals:t}=e;return j7(e,["signals"])}),r=t.init.map(e=>hce(e,!1));i.values="interval"===t.type?[{unit:Cce(e,{escape:!1}),fields:n,values:r}]:r.map(t=>({unit:Cce(e,{escape:!1}),fields:n,values:t}))}n.filter(e=>e.name===t.name+xce).length||n.push(i)}),n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return Bhe(this)}assembleMarks(){var e;let t=null!==(e=this.component.mark)&&void 0!==e?e:[];return this.parent&&Bfe(this.parent)||(t=pce(this,t)),t.map(this.correctDataNames)}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return Zoe(this.encoding,e)}fieldDef(e){return Aoe(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return coe(t)?t:null}}class Lme extends $fe{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const s=Object.assign(Object.assign(Object.assign({},i),e.width?{width:e.width}:{}),e.height?{height:e.height}:{});this.children=e.layer.map((e,t)=>{if(nle(e))return new Lme(e,this,this.getName("layer_"+t),s,r);if(hte(e))return new Fme(e,this,this.getName("layer_"+t),s,r);throw new Error(vie(e))})}parseData(){this.component.data=pme(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;ome(e=this),ame(e,"width"),ame(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of yee(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){var t;const{axes:n,resolve:i}=e.component,r={top:0,bottom:0,right:0,left:0};for(const t of e.children){t.parseAxesAndHeaders();for(const r of yee(t.component.axes))i.axis[r]=Ghe(e.component.resolve,r),"shared"===i.axis[r]&&(n[r]=vme(n[r],t.component.axes[r]),n[r]||(i.axis[r]="independent",delete n[r]))}for(const s of Yne){for(const o of e.children)if(o.component.axes[s]){if("independent"===i.axis[s]){n[s]=(null!==(t=n[s])&&void 0!==t?t:[]).concat(o.component.axes[s]);for(const e of o.component.axes[s]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!hre(t)){if(r[t]>0&&!n){const n=_me[t];r[t]>r[n]&&e.set("orient",n,!1)}r[t]++}}}delete o.component.axes[s]}if("independent"===i.axis[s]&&n[s]&&n[s].length>1)for(const e of n[s])e.get("grid")&&!e.explicit.grid&&(e.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleSignals()),ahe(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),Bhe(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)Ffe(n)&&(t=pce(n,t));return t}(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),cpe(this))}}function Pme(e,t,n,i,r){if(Kse(e))return new cme(e,t,n,r);if(nle(e))return new Lme(e,t,n,i,r);if(hte(e))return new Fme(e,t,n,i,r);if(function(e){return Pae(e)||Bae(e)||Lae(e)}(e))return new fme(e,t,n,r);throw new Error(vie(e))}function Bme(e,t={}){var n;t.logger&&(n=t.logger,Wie=n),t.fieldTitle&&Toe(t.fieldTitle);try{const n=Kae(k7(t.config,e.config)),i=Ile(e,n),r=Pme(i,null,"",void 0,n);r.parse(),function(e,t){Tpe(e.sources);let n=0,i=0;for(let i=0;i<Jpe&&ife(e,t);i++)n++;e.sources.map(Ype);for(let n=0;n<Jpe&&ife(e,t);n++)i++;Tpe(e.sources),Math.max(n,i)===Jpe&&qie(`Maximum optimization runs(${Jpe}) reached.`)}(r.component.data,r);const s=function(e,t,n={},i){const r=e.config?ele(e.config):void 0,s=[].concat(e.assembleSelectionData([]),function(e,t){var n,i;const r=[],s=eme(r);let o=0;for(const t of e.sources){t.hasName()||(t.dataName="source_"+o++);const e=t.assemble();s(t,e)}for(const e of r)0===e.transform.length&&delete e.transform;let a=0;for(const[e,t]of r.entries())0!==(null!==(n=t.transform)&&void 0!==n?n:[]).length||t.source||r.splice(a++,0,r.splice(e,1)[0]);for(const t of r)for(const n of null!==(i=t.transform)&&void 0!==i?i:[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of r)e.name in t&&(e.values=t[e.name]);return r}(e.component.data,n)),o=e.assembleProjections(),a=e.assembleTitle(),l=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0);let c=e.assembleLayoutSignals();return c=c.filter(e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({$schema:"https://vega.github.io/schema/vega/v5.json"},e.description?{description:e.description}:{}),t),a?{title:a}:{}),l?{style:l}:{}),u?{encode:{update:u}}:{}),{data:s}),o.length>0?{projections:o}:{}),e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([])])),r?{config:r}:{}),i?{usermeta:i}:{})}(r,function(e,t,n,i){const r=i.component.layoutSize.get("width"),s=i.component.layoutSize.get("height");void 0===t?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):U7(t)&&(t={type:t});if(r&&s&&(o=t.type,"fit"===o||"fit-x"===o||"fit-y"===o))if("step"===r&&"step"===s)qie(Eie()),t.type="pad";else if("step"===r||"step"===s){const e="step"===r?"width":"height";qie(Eie(Xne(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${Xne(e)}`:"fit"}(n)}var o;return Object.assign(Object.assign(Object.assign({},1===yee(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t}),Ole(n)),Ole(e))}(e,i.autosize,n,r),e.datasets,e.usermeta);return{spec:s,normalized:i}}finally{t.logger&&Xie(),t.fieldTitle&&Toe(voe)}}const $me=new class extends ile{mapUnit(e,{config:t}){if(e.encoding){const{encoding:n,transform:i}=e,{bins:r,timeUnits:s,aggregate:o,groupby:a,encoding:l}=Joe(n,t),u=[...i||[],...r,...s,...0===o.length?[]:[{aggregate:o,groupby:a}]];return Object.assign(Object.assign(Object.assign({},e),u.length>0?{transform:u}:{}),{encoding:l})}return e}};function Ume(e,t){return $me.map(e,{config:t})}const zme="4.13.1";const Vme=function(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}};var jme="2.15.0";const Yme="#fff",Gme="#888",Hme={background:"#333",view:{stroke:Gme},title:{color:Yme,subtitleColor:Yme},style:{"guide-label":{fill:Yme},"guide-title":{fill:Yme}},axis:{domainColor:Yme,gridColor:Gme,tickColor:Yme}},Wme="#4572a7",Xme={background:"#fff",arc:{fill:Wme},area:{fill:Wme},line:{stroke:Wme,strokeWidth:2},path:{stroke:Wme},rect:{fill:Wme},shape:{stroke:Wme},symbol:{fill:Wme,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},qme="#30a2da",Kme="#cbcbcb",Zme="#f0f0f0",Qme="#333",Jme={arc:{fill:qme},area:{fill:qme},axis:{domainColor:Kme,grid:!0,gridColor:Kme,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:Kme,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:Zme,group:{fill:Zme},legend:{labelColor:Qme,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:Qme,titleFontSize:14,titlePadding:10},line:{stroke:qme,strokeWidth:2},path:{stroke:qme,strokeWidth:.5},rect:{fill:qme},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:qme},bar:{binSpacing:2,fill:qme,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},ege="#000",tge={group:{fill:"#e5e5e5"},arc:{fill:ege},area:{fill:ege},line:{stroke:ege},path:{stroke:ege},rect:{fill:ege},shape:{stroke:ege},symbol:{fill:ege,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},nge="Benton Gothic, sans-serif",ige="#82c6df",rge="Benton Gothic Bold, sans-serif",sge="normal",oge={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},age={background:"#ffffff",title:{anchor:"start",color:"#000000",font:rge,fontSize:22,fontWeight:"normal"},arc:{fill:ige},area:{fill:ige},line:{stroke:ige,strokeWidth:2},path:{stroke:ige},rect:{fill:ige},shape:{stroke:ige},symbol:{fill:ige,size:30},axis:{labelFont:nge,labelFontSize:11.5,labelFontWeight:"normal",titleFont:rge,titleFontSize:13,titleFontWeight:sge},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:nge,labelFontSize:11.5,symbolType:"square",titleFont:rge,titleFontSize:13,titleFontWeight:sge},range:{category:oge["category-6"],diverging:oge["fireandice-6"],heatmap:oge["fire-7"],ordinal:oge["fire-7"],ramp:oge["fire-7"]}},lge="#ab5787",uge="#979797",cge={background:"#f9f9f9",arc:{fill:lge},area:{fill:lge},line:{stroke:lge},path:{stroke:lge},rect:{fill:lge},shape:{stroke:lge},symbol:{fill:lge,size:30},axis:{domainColor:uge,domainWidth:.5,gridWidth:.2,labelColor:uge,tickColor:uge,tickWidth:.2,titleColor:uge},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},dge="#3e5c69",hge={background:"#fff",arc:{fill:dge},area:{fill:dge},line:{stroke:dge},path:{stroke:dge},rect:{fill:dge},shape:{stroke:dge},symbol:{fill:dge},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},pge="#1696d2",fge="#000000",mge="Lato",gge="Lato",yge={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},_ge={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:mge},axisX:{domain:!0,domainColor:fge,domainWidth:1,grid:!1,labelFontSize:12,labelFont:gge,labelAngle:0,tickColor:fge,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:mge},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:gge,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:mge,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:gge,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:mge,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:yge["six-groups-cat-1"],diverging:yge["diverging-colors"],heatmap:yge["diverging-colors"],ordinal:yge["six-groups-seq"],ramp:yge["shades-blue"]},area:{fill:pge},rect:{fill:pge},line:{color:pge,stroke:pge,strokeWidth:5},trail:{color:pge,stroke:pge,strokeWidth:0,size:1},path:{stroke:pge,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:pge,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:pge,stroke:null}},arc:{fill:pge},shape:{stroke:pge},symbol:{fill:pge,size:30}},vge="#3366CC",bge="#ccc",Tge="Arial, sans-serif",xge={arc:{fill:vge},area:{fill:vge},path:{stroke:vge},rect:{fill:vge},shape:{stroke:vge},symbol:{stroke:vge},circle:{fill:vge},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:Tge,fontSize:12},"guide-title":{font:Tge,fontSize:12},"group-title":{font:Tge,fontSize:12}},title:{font:Tge,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:bge,tickColor:bge,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},Ege=e=>e*(1/3+1),wge=Ege(9),Ige=Ege(10),Age=Ege(12),Sge="Segoe UI",Cge="wf_standard-font, helvetica, arial, sans-serif",Oge="#252423",Mge="#605E5C",Rge="transparent",kge="#118DFF",Nge="#DEEFFF",Dge=[Nge,kge],Fge={view:{stroke:Rge},background:Rge,font:Sge,header:{titleFont:Cge,titleFontSize:Age,titleColor:Oge,labelFont:Sge,labelFontSize:Ige,labelColor:Mge},axis:{ticks:!1,grid:!1,domain:!1,labelColor:Mge,labelFontSize:wge,titleFont:Cge,titleColor:Oge,titleFontSize:Age,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:kge},line:{stroke:kge,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:Sge,fontSize:wge,fill:Mge},arc:{fill:kge},area:{fill:kge,line:!0,opacity:.6},path:{stroke:kge},rect:{fill:kge},point:{fill:kge,filled:!0,size:75},shape:{stroke:kge},symbol:{fill:kge,strokeWidth:1.5,size:50},legend:{titleFont:Sge,titleFontWeight:"bold",titleColor:Mge,labelFont:Sge,labelFontSize:Ige,labelColor:Mge,symbolType:"circle",symbolSize:75},range:{category:[kge,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:Dge,heatmap:Dge,ordinal:[Nge,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",kge]}},Lge='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',Pge={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},Bge=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],$ge=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function Uge({theme:e,background:t}){const n=["white","g10"].includes(e)?"light":"dark",i=Pge.gridBg[e],r=Pge.textPrimary[e],s=Pge.textSecondary[e],o="dark"===n?Bge:$ge,a="dark"===n?"#d4bbff":"#6929c4";return{background:t,arc:{fill:a},area:{fill:a},path:{stroke:a},rect:{fill:a},shape:{stroke:a},symbol:{stroke:a},circle:{fill:a},view:{fill:i,stroke:i},group:{fill:i},title:{color:r,anchor:"start",dy:-15,fontSize:16,font:Lge,fontWeight:600},axis:{labelColor:s,labelFontSize:12,labelFont:'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',labelFontWeight:400,titleColor:r,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:Pge.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:Lge,fill:s,fontWeight:400},"guide-title":{font:Lge,fill:s,fontWeight:400}},range:{category:o,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const zge=Uge({theme:"white",background:"#ffffff"}),Vge=Uge({theme:"g10",background:"#f4f4f4"}),jge=Uge({theme:"g90",background:"#262626"}),Yge=Uge({theme:"g100",background:"#161616"}),Gge=jme;var Hge="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black; }\n #vg-tooltip-element.visible {\n visibility: visible; }\n #vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px; }\n #vg-tooltip-element img {\n max-width: 200px;\n max-height: 200px; }\n #vg-tooltip-element table {\n border-spacing: 0; }\n #vg-tooltip-element table tr {\n border: none; }\n #vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px; }\n #vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px; }\n #vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left; }\n #vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white; }\n #vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf; }\n";const Wge="vg-tooltip-element",Xge={offsetX:10,offsetY:10,id:Wge,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2};function qge(e,t,n){if(Ee(e))return`[${e.map(e=>t(bt(e)?e:Kge(e,n))).join(", ")}]`;if(we(e)){let i="";const r=e,{title:s,image:o}=r,a=
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(r,["title","image"]);s&&(i+=`<h2>${t(s)}</h2>`),o&&(i+=`<img src="${t(o)}">`);const l=Object.keys(a);if(l.length>0){i+="<table>";for(const e of l){let r=a[e];void 0!==r&&(we(r)&&(r=Kge(r,n)),i+=`<tr><td class="key">${t(e)}:</td><td class="value">${t(r)}</td></tr>`)}i+="</table>"}return i||"{}"}return t(e)}function Kge(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,i){if("object"!=typeof i||null===i)return i;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(i)>=0?"[Circular]":(t.push(i),i)}}(t))}class Zge{constructor(e){this.options=Object.assign(Object.assign({},Xge),e);const t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return Hge.toString().replace(Wge,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,i){this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),document.body.appendChild(this.el));if((null!=document.fullscreenElement?document.fullscreenElement:document.body).appendChild(this.el),null==i||""===i)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=qge(i,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:r,y:s}=function(e,t,n,i){let r=e.clientX+n;r+t.width>window.innerWidth&&(r=+e.clientX-n-t.width);let s=e.clientY+i;return s+t.height>window.innerHeight&&(s=+e.clientY-i-t.height),{x:r,y:s}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.setAttribute("style",`top: ${s}px; left: ${r}px`)}}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function Qge(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(o,a)}l((i=i.apply(e,t||[])).next())})}var Jge,eye='.vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box; }\n .vega-embed.has-actions {\n padding-right: 38px; }\n .vega-embed details:not([open]) > :not(summary) {\n display: none !important; }\n .vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n outline: none;\n cursor: pointer;\n line-height: 0px; }\n .vega-embed summary::-webkit-details-marker {\n display: none; }\n .vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset; }\n .vega-embed summary svg {\n width: 14px;\n height: 14px; }\n .vega-embed details[open] summary {\n opacity: 0.7; }\n .vega-embed:hover summary,\n .vega-embed:focus summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease; }\n .vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left; }\n .vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none; }\n .vega-embed .vega-actions a:hover {\n background-color: #f7f7f9;\n color: black; }\n .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute; }\n .vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid #0000;\n border-bottom-color: #d9d9d9; }\n .vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid #0000;\n border-bottom-color: #fff; }\n .vega-embed .chart-wrapper {\n width: 100%;\n height: 100%; }\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px; }\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6); }\n to {\n opacity: 1;\n transform: scale(1); } }\n';function tye(e,...t){for(const n of t)nye(e,n);return e}function nye(e,t){for(const n of Object.keys(t))Se(e,n,t[n],!0)}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return this.substr(!t||t<0?0:+t,e.length)===e});const iye=v;let rye=b;const sye="undefined"!=typeof window?window:void 0;void 0===rye&&(null===(Jge=null==sye?void 0:sye.vl)||void 0===Jge?void 0:Jge.compile)&&(rye=sye.vl);const oye={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},aye={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},lye={vega:"Vega","vega-lite":"Vega-Lite"},uye={vega:iye.version,"vega-lite":rye?rye.version:"not available"},cye={vega:e=>e,"vega-lite":(e,t)=>rye.compile(e,{config:t}).spec},dye='\n<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">\n <circle r="2" cy="8" cx="2"></circle>\n <circle r="2" cy="8" cx="8"></circle>\n <circle r="2" cy="8" cx="14"></circle>\n</svg>',hye="chart-wrapper";function pye(e,t,n,i){const r=`<html><head>${t}</head><body><pre><code class="json">`,s=`</code></pre>${n}</body></html>`,o=window.open("");o.document.write(r+e+s),o.document.title=`${lye[i]} JSON Source`}function fye(e,t){var n;if(e.$schema){const i=Vme(e.$schema);t&&t!==i.library&&console.warn(`The given visualization spec is written in ${lye[i.library]}, but mode argument sets ${null!==(n=lye[t])&&void 0!==n?n:t}.`);const r=i.library;return(0,ee.satisfies)(uye[r],`^${i.version.slice(1)}`)||console.warn(`The input spec uses ${lye[r]} ${i.version}, but the current version of ${lye[r]} is v${uye[r]}.`),r}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":null!=t?t:"vega"}function mye(e){return(t=e)&&"load"in t?e:iye.loader(e);var t}function gye(e){var t;return null!==(t=e.usermeta&&e.usermeta.embedOptions)&&void 0!==t?t:{}}function yye(e,t){var n;return Qge(this,void 0,void 0,function*(){const i=bt(e.config)?JSON.parse(yield t.load(e.config)):null!==(n=e.config)&&void 0!==n?n:{},r=bt(e.patch)?JSON.parse(yield t.load(e.patch)):e.patch;return Object.assign(Object.assign(Object.assign({},e),r?{patch:r}:{}),i?{config:i}:{})})}const _ye=function(e,t,n={}){var i,r,s;return Qge(this,void 0,void 0,function*(){let o,a;bt(t)?(a=mye(n.loader),o=JSON.parse(yield a.load(t))):o=t;const l=gye(o).loader;a&&!l||(a=mye(null!==(i=n.loader)&&void 0!==i?i:l));const u=yield yye(gye(o),a),c=yield yye(n,a),d=Object.assign(Object.assign({},tye(c,u)),{config:Ae(null!==(r=c.config)&&void 0!==r?r:{},null!==(s=u.config)&&void 0!==s?s:{})});return yield function(e,t,n={},i){var r,s,o,a,l,u;return Qge(this,void 0,void 0,function*(){const c=n.theme?Ae(T[n.theme],null!==(r=n.config)&&void 0!==r?r:{}):n.config,d=mt(n.actions)?n.actions:tye({},oye,null!==(s=n.actions)&&void 0!==s?s:{}),h=Object.assign(Object.assign({},aye),n.i18n),p=null!==(o=n.renderer)&&void 0!==o?o:"canvas",f=null!==(a=n.logLevel)&&void 0!==a?a:iye.Warn,m=null!==(l=n.downloadFileName)&&void 0!==l?l:"visualization",g="string"==typeof e?document.querySelector(e):e;if(!g)throw new Error(`${e} does not exist`);if(!1!==n.defaultStyle){const e="vega-embed-style",{root:t,rootContainer:i}=function(e){var t;const n=e.getRootNode?e.getRootNode():document;return n instanceof ShadowRoot?{root:n,rootContainer:n}:{root:document,rootContainer:null!==(t=document.head)&&void 0!==t?t:document.body}}(g);if(!t.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerText=void 0===n.defaultStyle||!0===n.defaultStyle?eye.toString():n.defaultStyle,i.appendChild(t)}}const y=fye(t,n.mode);let _=cye[y](t,c);if("vega-lite"===y&&_.$schema){const e=Vme(_.$schema);(0,ee.satisfies)(uye.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${uye.vega}.`)}g.classList.add("vega-embed"),d&&g.classList.add("has-actions"),g.innerHTML="";let v=g;if(d){const e=document.createElement("div");e.classList.add(hye),g.appendChild(e),v=e}const b=n.patch;b&&(_=b instanceof Function?b(_):$(_,b,!0,!1).newDocument),n.formatLocale&&iye.formatLocale(n.formatLocale),n.timeFormatLocale&&iye.timeFormatLocale(n.timeFormatLocale);const{ast:x}=n,E=iye.parse(_,"vega-lite"===y?{}:c,{ast:x}),w=new(n.viewClass||iye.View)(E,Object.assign({loader:i,logLevel:f,renderer:p},x?{expr:iye.expressionInterpreter}:{}));if(!1!==n.tooltip){let e;e=function(e){return"function"==typeof e}(n.tooltip)?n.tooltip:new Zge(!0===n.tooltip?{}:n.tooltip).call,w.tooltip(e)}let I,{hover:A}=n;if(void 0===A&&(A="vega"===y),A){const{hoverSet:e,updateSet:t}="boolean"==typeof A?{}:A;w.hover(e,t)}if(n&&(null!=n.width&&w.width(n.width),null!=n.height&&w.height(n.height),null!=n.padding&&w.padding(n.padding)),yield w.initialize(v,n.bind).runAsync(),!1!==d){let e=g;if(!1!==n.defaultStyle){const t=document.createElement("details");t.title=h.CLICK_TO_VIEW_ACTIONS,g.append(t),e=t;const n=document.createElement("summary");n.innerHTML=dye,t.append(n),I=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",I)}const i=document.createElement("div");if(e.append(i),i.classList.add("vega-actions"),!0===d||!1!==d.export)for(const e of["svg","png"])if(!0===d||!0===d.export||d.export[e]){const t=h[`${e.toUpperCase()}_ACTION`],r=document.createElement("a");r.text=t,r.href="#",r.target="_blank",r.download=`${m}.${e}`,r.addEventListener("mousedown",function(t){return Qge(this,void 0,void 0,function*(){t.preventDefault();const i=yield w.toImageURL(e,n.scaleFactor);this.href=i})}),i.append(r)}if(!0===d||!1!==d.source){const e=document.createElement("a");e.text=h.SOURCE_ACTION,e.href="#",e.addEventListener("click",function(e){var i,r;pye(J()(t),null!==(i=n.sourceHeader)&&void 0!==i?i:"",null!==(r=n.sourceFooter)&&void 0!==r?r:"",y),e.preventDefault()}),i.append(e)}if("vega-lite"===y&&(!0===d||!1!==d.compiled)){const e=document.createElement("a");e.text=h.COMPILED_ACTION,e.href="#",e.addEventListener("click",function(e){var t,i;pye(J()(_),null!==(t=n.sourceHeader)&&void 0!==t?t:"",null!==(i=n.sourceFooter)&&void 0!==i?i:"","vega"),e.preventDefault()}),i.append(e)}if(!0===d||!1!==d.editor){const e=null!==(u=n.editorUrl)&&void 0!==u?u:"https://vega.github.io/editor/",r=document.createElement("a");r.text=h.EDITOR_ACTION,r.href="#",r.addEventListener("click",function(n){!function(e,t,n){const i=e.open(t),{origin:r}=new URL(t);let s=40;e.addEventListener("message",function t(n){n.source===i&&(s=0,e.removeEventListener("message",t,!1))},!1),setTimeout(function e(){s<=0||(i.postMessage(n,r),setTimeout(e,250),s-=1)},250)}(window,e,{config:c,mode:y,renderer:p,spec:J()(t)}),n.preventDefault()}),i.append(r)}}function S(){I&&document.removeEventListener("click",I),w.finalize()}return{view:w,spec:t,vgSpec:_,finalize:S}})}(e,o,d,a)})}},66262:(e,t)=>{"use strict";t.A=(e,t)=>{const n=e.__vccOpts||e;for(const[e,i]of t)n[e]=i;return n}},53378:(e,t,n)=>{"use strict";n.a(e,async(e,t)=>{try{var i=n(18869),r=n(41103),s=(n(30696),n(13383));let o;function a(){document.getElementById("modalOverlay").style.display="none"}async function l(e){try{await r.io.removeModel(`indexeddb://${e}`);const t=document.querySelector(`.model-item[data-model-name="${e}"]`);t&&t.remove()}catch(e){console.error("删除模型失败:",e),alert("删除模型失败: "+e.message)}}function u(e){const t=document.getElementById("imported-models");if([...t.children].some(t=>t.dataset.modelName===e))return;const n=document.createElement("div");n.className="model-item",n.dataset.modelName=e,n.innerHTML=`\n <div style="display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid #eee;">\n <span style="font-size: 1em; color: #333;">${e}</span>\n <button class="delete-model" style="\n background: #f44336;\n color: white;\n border: none;\n padding: 4px 10px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 0.9em;\n transition: background-color 0.2s;\n ">删除</button>\n </div>\n `,n.querySelector(".delete-model").addEventListener("click",()=>{l(e)}),t.appendChild(n)}async function c(){try{const e=await r.io.listModels(),t=Object.keys(e).map(e=>e.replace("indexeddb://","")).map(e=>r.io.removeModel(`indexeddb://${e}`));await Promise.all(t),document.getElementById("imported-models").innerHTML=""}catch(e){console.error("清空模型失败:",e),alert("清空模型失败: "+e.message)}}async function d(){try{const e=await r.io.listModels();document.getElementById("imported-models").innerHTML="";for(const[t]of Object.entries(e)){u(t.replace("indexeddb://",""))}}catch(e){console.error("加载模型列表失败:",e)}}async function h(){const e=document.createElement("div");e.id="modalOverlay",Object.assign(e.style,{display:"none",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.5)",zIndex:"20011216",pointerEvents:"auto"});const t=document.createElement("div");Object.assign(t.style,{backgroundColor:"white",width:"60%",maxHeight:"80%",margin:"12vh auto",padding:"20px 30px",borderRadius:"12px"}),t.innerHTML='\n <h2 style="margin-bottom: 20px;">选择本地模型</h2>\n <div style="margin-bottom: 25px; position: relative; min-height: 200px;"> \x3c!-- 新增 min-height 和 position --\x3e\n <input type="file" id="model-upload" accept=".json,.bin" multiple style="display: none;">\n <label for="model-upload" style="\n background: #1216ab;\n color: white;\n padding: 10px 20px;\n border-radius: 4px;\n cursor: pointer;\n ">选择模型文件</label>\n <div style="display: flex; gap: 10px; margin-top: 15px; align-items: center;">\n <span style="line-height: 36px;">导入模型名称:</span>\n <input type="text" id="model-name" placeholder="模型名称" value="my-model" style="\n padding: 8px 12px;\n border: 1px solid #ddd;\n border-radius: 4px;\n font-size: 14px;\n flex: 1;\n max-width: 200px;\n ">\n <button id="model-handle" style="\n background: #1216ab;\n color: white;\n padding: 10px 20px;\n border-radius: 4px;\n cursor: pointer;\n ">保存模型</button>\n </div>\n <div style="margin-top: 15px; display: flex; gap: 20px;">\n <div id="json-status" style="\n background: #f5f5f5;\n padding: 10px;\n border-radius: 4px;\n flex: 1;\n ">\n <span>❌ 模型结构描述文件model.json</span>\n\n <div style="color: #666; font-size: 0.9em; margin-top: 5px;">未选择</div>\n </div>\n <div id="weights-status" style="\n background: #f5f5f5;\n padding: 10px;\n border-radius: 4px;\n flex: 1;\n ">\n <span>❌ 权重文件model.weights.bin</span>\n <div style="color: #666; font-size: 0.9em; margin-top: 5px;">0 个已选择</div>\n </div>\n </div>\n <div id="output" style="margin-bottom: 15px; min-height: 40px;"></div>\n <div style="margin-top: 20px;">\n <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">\n <h3>已导入模型</h3>\n <div style="display: flex; gap: 10px;">\n <button id="refresh-models" style="\n background: #4CAF50;\n color: white;\n padding: 5px 10px;\n border-radius: 4px;\n cursor: pointer;\n border: none;\n ">刷新</button>\n <button id="clear-models" style="\n background: #f44336;\n color: white;\n padding: 5px 10px;\n border-radius: 4px;\n cursor: pointer;\n border: none;\n ">清空</button>\n </div>\n </div>\n <div id="imported-models" style="\n background: #f5f5f5;\n padding: 10px;\n border-radius: 4px;\n height: 200px;\n overflow-y: auto;\n ">\n <div style="color: #666; font-style: italic;">加载中...</div>\n </div>\n </div>\n <div style="display: flex; justify-content: flex-end; margin-top: 15px;">\n <button class="close-btn" style="\n background: #e0e0e0;\n border: none;\n padding: 8px 20px;\n border-radius: 4px;\n cursor: pointer;\n ">关闭</button>\n </div>\n </div>\n ',e.appendChild(t),document.body.appendChild(e),t.querySelector(".close-btn").addEventListener("click",a),e.addEventListener("click",t=>{t.target===e&&a()});const n=document.getElementById("model-upload"),i=document.getElementById("model-handle"),s=document.getElementById("output");let o=null,l=[];n.addEventListener("change",async e=>{const t=e.target.files,n=document.getElementById("json-status"),i=document.getElementById("weights-status");n.querySelector("span").textContent="❌ 模型结构描述文件model.json",n.querySelector("div").textContent="未选择",i.querySelector("span").textContent="❌ 权重文件model.weights.bin",i.querySelector("div").textContent="0 个已选择",l=[];for(let e=0;e<t.length;e++)t[e].name.endsWith(".json")?o=t[e]:l.push(t[e]);if(o){if(s.innerHTML="正在处理上传的模型文件...",o){n.querySelector("span").textContent="✅ 模型结构描述文件model.json",n.querySelector("div").textContent="已选择";const e=o.name.replace(".json","");document.getElementById("model-name").value=e}l.length>0&&(i.querySelector("span").textContent="✅ 权重文件model.weights.bin",i.querySelector("div").textContent=`${l.length} 个已选择`)}else alert("未找到 model.json 文件")}),i.addEventListener("click",async()=>{try{const e=document.getElementById("model-name").value||"mixly-model",t=await r.loadLayersModel(r.io.browserFiles([o,...l]));await t.save(`indexeddb://${e}`),d(),s.innerHTML=`模型已成功保存为 ${e}`}catch(e){s.innerHTML=`保存模型出错: ${e.message}`,console.error(e)}}),t.querySelector("#refresh-models").addEventListener("click",d),t.querySelector("#clear-models").addEventListener("click",async()=>{confirm("确定要删除所有模型吗?此操作不可恢复!")&&await c()})}i.A.init(),window.tf=r,h(),await d();async function p(e){let t=null;window.featureExtractor?t=window.featureExtractor:(t=await r.loadGraphModel("../common/media/tfmodel/model.json"),window.featureExtractor=t);const n=e.resizeBilinear([224,224]).toFloat().div(r.scalar(127.5)).sub(r.scalar(1)).expandDims(0);return o.predict(n)}s.getMainWorkspace().registerButtonCallback("handleModels",function(){d(),document.getElementById("modalOverlay").style.display="block"}),window.prepare_qmyixtxi=p,t()}catch(f){t(f)}},1)},18869:(e,t,n)=>{"use strict";n.d(t,{A:()=>ND});var i={};n.r(i),n.d(i,{BaseTransition:()=>Pi,BaseTransitionPropsValidators:()=>Di,Comment:()=>$o,DeprecationTypes:()=>el,EffectScope:()=>Ce,ErrorCodes:()=>Nn,ErrorTypeStrings:()=>Xa,Fragment:()=>Po,KeepAlive:()=>_r,ReactiveEffect:()=>Ne,Static:()=>Uo,Suspense:()=>Ro,Teleport:()=>Si,Text:()=>Bo,TrackOpTypes:()=>vn,Transition:()=>hl,TransitionGroup:()=>uu,TriggerOpTypes:()=>bn,VueElement:()=>eu,assertNumber:()=>kn,callWithAsyncErrorHandling:()=>Ln,callWithErrorHandling:()=>Fn,camelize:()=>V,capitalize:()=>G,cloneVNode:()=>oa,compatUtils:()=>Ja,computed:()=>za,createApp:()=>Uu,createBlock:()=>Ko,createCommentVNode:()=>ua,createElementBlock:()=>qo,createElementVNode:()=>na,createHydrationRenderer:()=>eo,createPropsRestProxy:()=>ms,createRenderer:()=>Js,createSSRApp:()=>zu,createSlots:()=>Wr,createStaticVNode:()=>la,createTextVNode:()=>aa,createVNode:()=>ia,customRef:()=>hn,defineAsyncComponent:()=>fr,defineComponent:()=>Yi,defineCustomElement:()=>Zl,defineEmits:()=>is,defineExpose:()=>rs,defineModel:()=>as,defineOptions:()=>ss,defineProps:()=>ns,defineSSRCustomElement:()=>Ql,defineSlots:()=>os,devtools:()=>qa,effect:()=>He,effectScope:()=>Oe,getCurrentInstance:()=>va,getCurrentScope:()=>Me,getCurrentWatcher:()=>wn,getTransitionRawChildren:()=>ji,guardReactiveProps:()=>sa,h:()=>Va,handleError:()=>Pn,hasInjectionContext:()=>Fs,hydrate:()=>$u,hydrateOnIdle:()=>ur,hydrateOnInteraction:()=>hr,hydrateOnMediaQuery:()=>dr,hydrateOnVisible:()=>cr,initCustomFormatter:()=>ja,initDirectivesForSSR:()=>Gu,inject:()=>Ds,isMemoSame:()=>Ga,isProxy:()=>qt,isReactive:()=>Ht,isReadonly:()=>Wt,isRef:()=>en,isRuntimeOnly:()=>Ra,isShallow:()=>Xt,isVNode:()=>Zo,markRaw:()=>Zt,mergeDefaults:()=>ps,mergeModels:()=>fs,mergeProps:()=>pa,nextTick:()=>Gn,normalizeClass:()=>oe,normalizeProps:()=>ae,normalizeStyle:()=>te,onActivated:()=>br,onBeforeMount:()=>Cr,onBeforeUnmount:()=>kr,onBeforeUpdate:()=>Mr,onDeactivated:()=>Tr,onErrorCaptured:()=>Pr,onMounted:()=>Or,onRenderTracked:()=>Lr,onRenderTriggered:()=>Fr,onScopeDispose:()=>Re,onServerPrefetch:()=>Dr,onUnmounted:()=>Nr,onUpdated:()=>Rr,onWatcherCleanup:()=>In,openBlock:()=>jo,popScopeId:()=>pi,provide:()=>Ns,proxyRefs:()=>cn,pushScopeId:()=>hi,queuePostFlushCb:()=>Xn,reactive:()=>zt,readonly:()=>jt,ref:()=>tn,registerRuntimeCompiler:()=>Ma,render:()=>Bu,renderList:()=>Hr,renderSlot:()=>Xr,resolveComponent:()=>Ur,resolveDirective:()=>jr,resolveDynamicComponent:()=>Vr,resolveFilter:()=>Qa,resolveTransitionHooks:()=>$i,setBlockTracking:()=>Wo,setDevtoolsHook:()=>Ka,setTransitionHooks:()=>Vi,shallowReactive:()=>Vt,shallowReadonly:()=>Yt,shallowRef:()=>nn,ssrContextKey:()=>lo,ssrUtils:()=>Za,stop:()=>We,toDisplayString:()=>Ee,toHandlerKey:()=>H,toHandlers:()=>Kr,toRaw:()=>Kt,toRef:()=>gn,toRefs:()=>pn,toValue:()=>ln,transformVNodeArgs:()=>Jo,triggerRef:()=>on,unref:()=>an,useAttrs:()=>cs,useCssModule:()=>iu,useCssVars:()=>Rl,useHost:()=>tu,useId:()=>Gi,useModel:()=>_o,useSSRContext:()=>uo,useShadowRoot:()=>nu,useSlots:()=>us,useTemplateRef:()=>Wi,useTransitionState:()=>ki,vModelCheckbox:()=>_u,vModelDynamic:()=>Iu,vModelRadio:()=>bu,vModelSelect:()=>Tu,vModelText:()=>yu,vShow:()=>Cl,version:()=>Ha,warn:()=>Wa,watch:()=>fo,watchEffect:()=>co,watchPostEffect:()=>ho,watchSyncEffect:()=>po,withAsyncContext:()=>gs,withCtx:()=>mi,withDefaults:()=>ls,withDirectives:()=>gi,withKeys:()=>ku,withMemo:()=>Ya,withModifiers:()=>Mu,withScopeId:()=>fi});var r={};n.r(r),n.d(r,{COPYFILE_EXCL:()=>xf,COPYFILE_FICLONE:()=>Ef,COPYFILE_FICLONE_FORCE:()=>wf,F_OK:()=>_f,O_APPEND:()=>kf,O_CREAT:()=>Cf,O_DIRECT:()=>$f,O_DIRECTORY:()=>Nf,O_DSYNC:()=>Pf,O_EXCL:()=>Of,O_NOATIME:()=>Df,O_NOCTTY:()=>Mf,O_NOFOLLOW:()=>Ff,O_NONBLOCK:()=>Uf,O_RDONLY:()=>If,O_RDWR:()=>Sf,O_SYMLINK:()=>Bf,O_SYNC:()=>Lf,O_TRUNC:()=>Rf,O_WRONLY:()=>Af,R_OK:()=>vf,S_IFBLK:()=>Gf,S_IFCHR:()=>Wf,S_IFDIR:()=>Hf,S_IFIFO:()=>Xf,S_IFLNK:()=>jf,S_IFMT:()=>zf,S_IFREG:()=>Yf,S_IFSOCK:()=>Vf,S_IRGRP:()=>im,S_IROTH:()=>am,S_IRUSR:()=>Jf,S_IRWXG:()=>nm,S_IRWXO:()=>om,S_IRWXU:()=>Qf,S_ISGID:()=>Kf,S_ISUID:()=>qf,S_ISVTX:()=>Zf,S_IWGRP:()=>rm,S_IWOTH:()=>lm,S_IWUSR:()=>em,S_IXGRP:()=>sm,S_IXOTH:()=>um,S_IXUSR:()=>tm,UV_FS_O_FILEMAP:()=>cm,W_OK:()=>bf,X_OK:()=>Tf,size_max:()=>dm});var s={};n.r(s),n.d(s,{FileHandle:()=>Dy,access:()=>o_,appendFile:()=>Gy,chmod:()=>e_,chown:()=>Qy,constants:()=>r,copyFile:()=>u_,cp:()=>d_,exists:()=>Ly,lchmod:()=>t_,lchown:()=>Jy,link:()=>qy,lstat:()=>By,lutimes:()=>i_,mkdir:()=>Wy,mkdtemp:()=>l_,open:()=>Vy,opendir:()=>c_,readFile:()=>jy,readdir:()=>Xy,readlink:()=>Zy,realpath:()=>r_,rename:()=>Fy,rm:()=>a_,rmdir:()=>Hy,stat:()=>Py,statfs:()=>h_,symlink:()=>Ky,truncate:()=>$y,unlink:()=>Uy,utimes:()=>n_,watch:()=>s_,writeFile:()=>Yy});var o={};n.r(o),n.d(o,{BigIntStatsFs:()=>_m,Dir:()=>Cy,Dirent:()=>Sy,ReadStream:()=>My,Stats:()=>mm,StatsFs:()=>ym,WriteStream:()=>Ry,_synced:()=>Eg,access:()=>W_,accessSync:()=>_y,appendFile:()=>E_,appendFileSync:()=>Xg,chmod:()=>V_,chmodSync:()=>py,chown:()=>U_,chownSync:()=>dy,chroot:()=>Cg,close:()=>I_,closeSync:()=>Kg,constants:()=>r,copyFile:()=>nv,copyFileSync:()=>Ty,cp:()=>ov,cpSync:()=>Iy,createReadStream:()=>Q_,createWriteStream:()=>J_,exists:()=>m_,existsSync:()=>Pg,fchmod:()=>k_,fchmodSync:()=>iy,fchown:()=>R_,fchownSync:()=>ny,fdatasync:()=>C_,fdatasyncSync:()=>Jg,fstat:()=>w_,fstatSync:()=>qg,fsync:()=>S_,fsyncSync:()=>Qg,ftruncate:()=>A_,ftruncateSync:()=>Zg,futimes:()=>N_,futimesSync:()=>ry,lchmod:()=>j_,lchmodSync:()=>fy,lchown:()=>z_,lchownSync:()=>hy,link:()=>P_,linkSync:()=>ly,lopenSync:()=>Yg,lstat:()=>y_,lstatSync:()=>$g,lutimes:()=>G_,lutimesSync:()=>gy,mkdir:()=>F_,mkdirSync:()=>oy,mkdtemp:()=>tv,mkdtempSync:()=>by,mount:()=>bg,mountObject:()=>Ag,mounts:()=>vg,open:()=>b_,openAsBlob:()=>lv,openSync:()=>jg,opendir:()=>sv,opendirSync:()=>wy,promises:()=>s,read:()=>M_,readFile:()=>T_,readFileSync:()=>Hg,readSync:()=>ty,readdir:()=>L_,readdirSync:()=>ay,readlink:()=>$_,readlinkSync:()=>cy,readv:()=>iv,readvSync:()=>xy,realpath:()=>H_,realpathSync:()=>yy,rename:()=>f_,renameSync:()=>Lg,rm:()=>ev,rmSync:()=>vy,rmdir:()=>D_,rmdirSync:()=>sy,stat:()=>g_,statSync:()=>Bg,statfs:()=>av,statfsSync:()=>Ay,symlink:()=>B_,symlinkSync:()=>uy,truncate:()=>__,truncateSync:()=>Ug,umount:()=>Tg,unlink:()=>v_,unlinkSync:()=>zg,unwatchFile:()=>K_,utimes:()=>Y_,utimesSync:()=>my,watch:()=>Z_,watchFile:()=>q_,write:()=>O_,writeFile:()=>x_,writeFileSync:()=>Wg,writeSync:()=>ey,writev:()=>rv,writevSync:()=>Ey});var a=n(64548),l=n(13383),u=n(26944);const c=$;var d=n.n(c);
/**
* @vue/shared v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
/*! #__NO_SIDE_EFFECTS__ */
function h(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return e=>e in t}const p={},f=[],m=()=>{},g=()=>!1,y=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),_=e=>e.startsWith("onUpdate:"),v=Object.assign,b=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},T=Object.prototype.hasOwnProperty,x=(e,t)=>T.call(e,t),E=Array.isArray,w=e=>"[object Map]"===N(e),I=e=>"[object Set]"===N(e),A=e=>"[object Date]"===N(e),S=e=>"function"==typeof e,C=e=>"string"==typeof e,O=e=>"symbol"==typeof e,M=e=>null!==e&&"object"==typeof e,R=e=>(M(e)||S(e))&&S(e.then)&&S(e.catch),k=Object.prototype.toString,N=e=>k.call(e),D=e=>N(e).slice(8,-1),F=e=>"[object Object]"===N(e),L=e=>C(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,P=h(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),B=h("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),U=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},z=/-(\w)/g,V=U(e=>e.replace(z,(e,t)=>t?t.toUpperCase():"")),j=/\B([A-Z])/g,Y=U(e=>e.replace(j,"-$1").toLowerCase()),G=U(e=>e.charAt(0).toUpperCase()+e.slice(1)),H=U(e=>e?`on${G(e)}`:""),W=(e,t)=>!Object.is(e,t),X=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},q=(e,t,n,i=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:i,value:n})},K=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Z=e=>{const t=C(e)?Number(e):NaN;return isNaN(t)?e:t};let Q;const J=()=>Q||(Q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{});const ee=h("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol");function te(e){if(E(e)){const t={};for(let n=0;n<e.length;n++){const i=e[n],r=C(i)?se(i):te(i);if(r)for(const e in r)t[e]=r[e]}return t}if(C(e)||M(e))return e}const ne=/;(?![^(]*\))/g,ie=/:([^]+)/,re=/\/\*[^]*?\*\//g;function se(e){const t={};return e.replace(re,"").split(ne).forEach(e=>{if(e){const n=e.split(ie);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function oe(e){let t="";if(C(e))t=e;else if(E(e))for(let n=0;n<e.length;n++){const i=oe(e[n]);i&&(t+=i+" ")}else if(M(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function ae(e){if(!e)return null;let{class:t,style:n}=e;return t&&!C(t)&&(e.class=oe(t)),n&&(e.style=te(n)),e}const le=h("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"),ue=h("svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"),ce=h("annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"),de=h("area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"),he="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",pe=h(he),fe=h(he+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");function me(e){return!!e||""===e}const ge=h("accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap"),ye=h("xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan");const _e=/[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;function ve(e,t){return e.replace(_e,e=>t?'"'===e?'\\\\\\"':`\\\\${e}`:`\\${e}`)}function be(e,t){if(e===t)return!0;let n=A(e),i=A(t);if(n||i)return!(!n||!i)&&e.getTime()===t.getTime();if(n=O(e),i=O(t),n||i)return e===t;if(n=E(e),i=E(t),n||i)return!(!n||!i)&&function(e,t){if(e.length!==t.length)return!1;let n=!0;for(let i=0;n&&i<e.length;i++)n=be(e[i],t[i]);return n}(e,t);if(n=M(e),i=M(t),n||i){if(!n||!i)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e){const i=e.hasOwnProperty(n),r=t.hasOwnProperty(n);if(i&&!r||!i&&r||!be(e[n],t[n]))return!1}}return String(e)===String(t)}function Te(e,t){return e.findIndex(e=>be(e,t))}const xe=e=>!(!e||!0!==e.__v_isRef),Ee=e=>C(e)?e:null==e?"":E(e)||M(e)&&(e.toString===k||!S(e.toString))?xe(e)?Ee(e.value):JSON.stringify(e,we,2):String(e),we=(e,t)=>xe(t)?we(e,t.value):w(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],i)=>(e[Ie(t,i)+" =>"]=n,e),{})}:I(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ie(e))}:O(t)?Ie(t):!M(t)||E(t)||F(t)?t:String(t),Ie=(e,t="")=>{var n;return O(e)?`Symbol(${null!=(n=e.description)?n:t})`:e};let Ae,Se;class Ce{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Ae,!e&&Ae&&(this.index=(Ae.scopes||(Ae.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){let e,t;if(this._isPaused=!0,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){let e,t;if(this._isPaused=!1,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=Ae;try{return Ae=this,e()}finally{Ae=t}}else 0}on(){Ae=this}off(){Ae=this.parent}stop(e){if(this._active){let t,n;for(this._active=!1,t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}}function Oe(e){return new Ce(e)}function Me(){return Ae}function Re(e,t=!1){Ae&&Ae.cleanups.push(e)}const ke=new WeakSet;class Ne{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Ae&&Ae.active&&Ae.effects.push(this)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,ke.has(this)&&(ke.delete(this),this.trigger()))}notify(){2&this.flags&&!(32&this.flags)||8&this.flags||Pe(this)}run(){if(!(1&this.flags))return this.fn();this.flags|=2,Qe(this),Ue(this);const e=Se,t=Xe;Se=this,Xe=!0;try{return this.fn()}finally{0,ze(this),Se=e,Xe=t,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)Ye(e);this.deps=this.depsTail=void 0,Qe(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?ke.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ve(this)&&this.run()}get dirty(){return Ve(this)}}let De,Fe,Le=0;function Pe(e,t=!1){if(e.flags|=8,t)return e.next=Fe,void(Fe=e);e.next=De,De=e}function Be(){Le++}function $e(){if(--Le>0)return;if(Fe){let e=Fe;for(Fe=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;De;){let t=De;for(De=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,1&t.flags)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function Ue(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function ze(e){let t,n=e.depsTail,i=n;for(;i;){const e=i.prevDep;-1===i.version?(i===n&&(n=e),Ye(i),Ge(i)):t=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=e}e.deps=t,e.depsTail=n}function Ve(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(je(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function je(e){if(4&e.flags&&!(16&e.flags))return;if(e.flags&=-17,e.globalVersion===Je)return;e.globalVersion=Je;const t=e.dep;if(e.flags|=2,t.version>0&&!e.isSSR&&e.deps&&!Ve(e))return void(e.flags&=-3);const n=Se,i=Xe;Se=e,Xe=!0;try{Ue(e);const n=e.fn(e._value);(0===t.version||W(n,e._value))&&(e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Se=n,Xe=i,ze(e),e.flags&=-3}}function Ye(e,t=!1){const{dep:n,prevSub:i,nextSub:r}=e;if(i&&(i.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=i,e.nextSub=void 0),n.subs===e&&(n.subs=i,!i&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Ye(e,!0)}t||--n.sc||!n.map||n.map.delete(n.key)}function Ge(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function He(e,t){e.effect instanceof Ne&&(e=e.effect.fn);const n=new Ne(e);t&&v(n,t);try{n.run()}catch(e){throw n.stop(),e}const i=n.run.bind(n);return i.effect=n,i}function We(e){e.effect.stop()}let Xe=!0;const qe=[];function Ke(){qe.push(Xe),Xe=!1}function Ze(){const e=qe.pop();Xe=void 0===e||e}function Qe(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const e=Se;Se=void 0;try{t()}finally{Se=e}}}let Je=0;class et{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class tt{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0}track(e){if(!Se||!Xe||Se===this.computed)return;let t=this.activeLink;if(void 0===t||t.sub!==Se)t=this.activeLink=new et(Se,this),Se.deps?(t.prevDep=Se.depsTail,Se.depsTail.nextDep=t,Se.depsTail=t):Se.deps=Se.depsTail=t,nt(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){const e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Se.depsTail,t.nextDep=void 0,Se.depsTail.nextDep=t,Se.depsTail=t,Se.deps===t&&(Se.deps=e)}return t}trigger(e){this.version++,Je++,this.notify(e)}notify(e){Be();try{0;for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{$e()}}}function nt(e){if(e.dep.sc++,4&e.sub.flags){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)nt(e)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const it=new WeakMap,rt=Symbol(""),st=Symbol(""),ot=Symbol("");function at(e,t,n){if(Xe&&Se){let t=it.get(e);t||it.set(e,t=new Map);let i=t.get(n);i||(t.set(n,i=new tt),i.map=t,i.key=n),i.track()}}function lt(e,t,n,i,r,s){const o=it.get(e);if(!o)return void Je++;const a=e=>{e&&e.trigger()};if(Be(),"clear"===t)o.forEach(a);else{const r=E(e),s=r&&L(n);if(r&&"length"===n){const e=Number(i);o.forEach((t,n)=>{("length"===n||n===ot||!O(n)&&n>=e)&&a(t)})}else switch((void 0!==n||o.has(void 0))&&a(o.get(n)),s&&a(o.get(ot)),t){case"add":r?s&&a(o.get("length")):(a(o.get(rt)),w(e)&&a(o.get(st)));break;case"delete":r||(a(o.get(rt)),w(e)&&a(o.get(st)));break;case"set":w(e)&&a(o.get(rt))}}$e()}function ut(e){const t=Kt(e);return t===e?t:(at(t,0,ot),Xt(e)?t:t.map(Qt))}function ct(e){return at(e=Kt(e),0,ot),e}const dt={__proto__:null,[Symbol.iterator](){return ht(this,Symbol.iterator,Qt)},concat(...e){return ut(this).concat(...e.map(e=>E(e)?ut(e):e))},entries(){return ht(this,"entries",e=>(e[1]=Qt(e[1]),e))},every(e,t){return ft(this,"every",e,t,void 0,arguments)},filter(e,t){return ft(this,"filter",e,t,e=>e.map(Qt),arguments)},find(e,t){return ft(this,"find",e,t,Qt,arguments)},findIndex(e,t){return ft(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ft(this,"findLast",e,t,Qt,arguments)},findLastIndex(e,t){return ft(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ft(this,"forEach",e,t,void 0,arguments)},includes(...e){return gt(this,"includes",e)},indexOf(...e){return gt(this,"indexOf",e)},join(e){return ut(this).join(e)},lastIndexOf(...e){return gt(this,"lastIndexOf",e)},map(e,t){return ft(this,"map",e,t,void 0,arguments)},pop(){return yt(this,"pop")},push(...e){return yt(this,"push",e)},reduce(e,...t){return mt(this,"reduce",e,t)},reduceRight(e,...t){return mt(this,"reduceRight",e,t)},shift(){return yt(this,"shift")},some(e,t){return ft(this,"some",e,t,void 0,arguments)},splice(...e){return yt(this,"splice",e)},toReversed(){return ut(this).toReversed()},toSorted(e){return ut(this).toSorted(e)},toSpliced(...e){return ut(this).toSpliced(...e)},unshift(...e){return yt(this,"unshift",e)},values(){return ht(this,"values",Qt)}};function ht(e,t,n){const i=ct(e),r=i[t]();return i===e||Xt(e)||(r._next=r.next,r.next=()=>{const e=r._next();return e.value&&(e.value=n(e.value)),e}),r}const pt=Array.prototype;function ft(e,t,n,i,r,s){const o=ct(e),a=o!==e&&!Xt(e),l=o[t];if(l!==pt[t]){const t=l.apply(e,s);return a?Qt(t):t}let u=n;o!==e&&(a?u=function(t,i){return n.call(this,Qt(t),i,e)}:n.length>2&&(u=function(t,i){return n.call(this,t,i,e)}));const c=l.call(o,u,i);return a&&r?r(c):c}function mt(e,t,n,i){const r=ct(e);let s=n;return r!==e&&(Xt(e)?n.length>3&&(s=function(t,i,r){return n.call(this,t,i,r,e)}):s=function(t,i,r){return n.call(this,t,Qt(i),r,e)}),r[t](s,...i)}function gt(e,t,n){const i=Kt(e);at(i,0,ot);const r=i[t](...n);return-1!==r&&!1!==r||!qt(n[0])?r:(n[0]=Kt(n[0]),i[t](...n))}function yt(e,t,n=[]){Ke(),Be();const i=Kt(e)[t].apply(e,n);return $e(),Ze(),i}const _t=h("__proto__,__v_isRef,__isVue"),vt=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(O));function bt(e){O(e)||(e=String(e));const t=Kt(this);return at(t,0,e),t.hasOwnProperty(e)}class Tt{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if("__v_skip"===t)return e.__v_skip;const i=this._isReadonly,r=this._isShallow;if("__v_isReactive"===t)return!i;if("__v_isReadonly"===t)return i;if("__v_isShallow"===t)return r;if("__v_raw"===t)return n===(i?r?Ut:$t:r?Bt:Pt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const s=E(e);if(!i){let e;if(s&&(e=dt[t]))return e;if("hasOwnProperty"===t)return bt}const o=Reflect.get(e,t,en(e)?e:n);return(O(t)?vt.has(t):_t(t))?o:(i||at(e,0,t),r?o:en(o)?s&&L(t)?o:o.value:M(o)?i?jt(o):zt(o):o)}}class xt extends Tt{constructor(e=!1){super(!1,e)}set(e,t,n,i){let r=e[t];if(!this._isShallow){const t=Wt(r);if(Xt(n)||Wt(n)||(r=Kt(r),n=Kt(n)),!E(e)&&en(r)&&!en(n))return!t&&(r.value=n,!0)}const s=E(e)&&L(t)?Number(t)<e.length:x(e,t),o=Reflect.set(e,t,n,en(e)?e:i);return e===Kt(i)&&(s?W(n,r)&&lt(e,"set",t,n):lt(e,"add",t,n)),o}deleteProperty(e,t){const n=x(e,t),i=(e[t],Reflect.deleteProperty(e,t));return i&&n&&lt(e,"delete",t,void 0),i}has(e,t){const n=Reflect.has(e,t);return O(t)&&vt.has(t)||at(e,0,t),n}ownKeys(e){return at(e,0,E(e)?"length":rt),Reflect.ownKeys(e)}}class Et extends Tt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const wt=new xt,It=new Et,At=new xt(!0),St=new Et(!0),Ct=e=>e,Ot=e=>Reflect.getPrototypeOf(e);function Mt(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}function Rt(e,t){const n={get(n){const i=this.__v_raw,r=Kt(i),s=Kt(n);e||(W(n,s)&&at(r,0,n),at(r,0,s));const{has:o}=Ot(r),a=t?Ct:e?Jt:Qt;return o.call(r,n)?a(i.get(n)):o.call(r,s)?a(i.get(s)):void(i!==r&&i.get(n))},get size(){const t=this.__v_raw;return!e&&at(Kt(t),0,rt),Reflect.get(t,"size",t)},has(t){const n=this.__v_raw,i=Kt(n),r=Kt(t);return e||(W(t,r)&&at(i,0,t),at(i,0,r)),t===r?n.has(t):n.has(t)||n.has(r)},forEach(n,i){const r=this,s=r.__v_raw,o=Kt(s),a=t?Ct:e?Jt:Qt;return!e&&at(o,0,rt),s.forEach((e,t)=>n.call(i,a(e),a(t),r))}};v(n,e?{add:Mt("add"),set:Mt("set"),delete:Mt("delete"),clear:Mt("clear")}:{add(e){t||Xt(e)||Wt(e)||(e=Kt(e));const n=Kt(this);return Ot(n).has.call(n,e)||(n.add(e),lt(n,"add",e,e)),this},set(e,n){t||Xt(n)||Wt(n)||(n=Kt(n));const i=Kt(this),{has:r,get:s}=Ot(i);let o=r.call(i,e);o||(e=Kt(e),o=r.call(i,e));const a=s.call(i,e);return i.set(e,n),o?W(n,a)&&lt(i,"set",e,n):lt(i,"add",e,n),this},delete(e){const t=Kt(this),{has:n,get:i}=Ot(t);let r=n.call(t,e);r||(e=Kt(e),r=n.call(t,e));i&&i.call(t,e);const s=t.delete(e);return r&&lt(t,"delete",e,void 0),s},clear(){const e=Kt(this),t=0!==e.size,n=e.clear();return t&&lt(e,"clear",void 0,void 0),n}});return["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=function(e,t,n){return function(...i){const r=this.__v_raw,s=Kt(r),o=w(s),a="entries"===e||e===Symbol.iterator&&o,l="keys"===e&&o,u=r[e](...i),c=n?Ct:t?Jt:Qt;return!t&&at(s,0,l?st:rt),{next(){const{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:a?[c(e[0]),c(e[1])]:c(e),done:t}},[Symbol.iterator](){return this}}}}(i,e,t)}),n}function kt(e,t){const n=Rt(e,t);return(t,i,r)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(x(n,i)&&i in t?n:t,i,r)}const Nt={get:kt(!1,!1)},Dt={get:kt(!1,!0)},Ft={get:kt(!0,!1)},Lt={get:kt(!0,!0)};const Pt=new WeakMap,Bt=new WeakMap,$t=new WeakMap,Ut=new WeakMap;function zt(e){return Wt(e)?e:Gt(e,!1,wt,Nt,Pt)}function Vt(e){return Gt(e,!1,At,Dt,Bt)}function jt(e){return Gt(e,!0,It,Ft,$t)}function Yt(e){return Gt(e,!0,St,Lt,Ut)}function Gt(e,t,n,i,r){if(!M(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const s=r.get(e);if(s)return s;const o=(a=e).__v_skip||!Object.isExtensible(a)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(D(a));var a;if(0===o)return e;const l=new Proxy(e,2===o?i:n);return r.set(e,l),l}function Ht(e){return Wt(e)?Ht(e.__v_raw):!(!e||!e.__v_isReactive)}function Wt(e){return!(!e||!e.__v_isReadonly)}function Xt(e){return!(!e||!e.__v_isShallow)}function qt(e){return!!e&&!!e.__v_raw}function Kt(e){const t=e&&e.__v_raw;return t?Kt(t):e}function Zt(e){return!x(e,"__v_skip")&&Object.isExtensible(e)&&q(e,"__v_skip",!0),e}const Qt=e=>M(e)?zt(e):e,Jt=e=>M(e)?jt(e):e;function en(e){return!!e&&!0===e.__v_isRef}function tn(e){return rn(e,!1)}function nn(e){return rn(e,!0)}function rn(e,t){return en(e)?e:new sn(e,t)}class sn{constructor(e,t){this.dep=new tt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Kt(e),this._value=t?e:Qt(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||Xt(e)||Wt(e);e=n?e:Kt(e),W(e,t)&&(this._rawValue=e,this._value=n?e:Qt(e),this.dep.trigger())}}function on(e){e.dep&&e.dep.trigger()}function an(e){return en(e)?e.value:e}function ln(e){return S(e)?e():an(e)}const un={get:(e,t,n)=>"__v_raw"===t?e:an(Reflect.get(e,t,n)),set:(e,t,n,i)=>{const r=e[t];return en(r)&&!en(n)?(r.value=n,!0):Reflect.set(e,t,n,i)}};function cn(e){return Ht(e)?e:new Proxy(e,un)}class dn{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new tt,{get:n,set:i}=e(t.track.bind(t),t.trigger.bind(t));this._get=n,this._set=i}get value(){return this._value=this._get()}set value(e){this._set(e)}}function hn(e){return new dn(e)}function pn(e){const t=E(e)?new Array(e.length):{};for(const n in e)t[n]=yn(e,n);return t}class fn{constructor(e,t,n){this._object=e,this._key=t,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return function(e,t){const n=it.get(e);return n&&n.get(t)}(Kt(this._object),this._key)}}class mn{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function gn(e,t,n){return en(e)?e:S(e)?new mn(e):M(e)&&arguments.length>1?yn(e,t,n):tn(e)}function yn(e,t,n){const i=e[t];return en(i)?i:new fn(e,t,n)}class _n{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new tt(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Je-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(8&this.flags||Se===this))return Pe(this,!0),!0}get value(){const e=this.dep.track();return je(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}const vn={GET:"get",HAS:"has",ITERATE:"iterate"},bn={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},Tn={},xn=new WeakMap;let En;function wn(){return En}function In(e,t=!1,n=En){if(n){let t=xn.get(n);t||xn.set(n,t=[]),t.push(e)}else 0}function An(e,t=1/0,n){if(t<=0||!M(e)||e.__v_skip)return e;if((n=n||new Set).has(e))return e;if(n.add(e),t--,en(e))An(e.value,t,n);else if(E(e))for(let i=0;i<e.length;i++)An(e[i],t,n);else if(I(e)||w(e))e.forEach(e=>{An(e,t,n)});else if(F(e)){for(const i in e)An(e[i],t,n);for(const i of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,i)&&An(e[i],t,n)}return e}
/**
* @vue/runtime-core v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
const Sn=[];let Cn=!1;function On(e,...t){if(Cn)return;Cn=!0,Ke();const n=Sn.length?Sn[Sn.length-1].component:null,i=n&&n.appContext.config.warnHandler,r=function(){let e=Sn[Sn.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const i=e.component&&e.component.parent;e=i&&i.vnode}return t}();if(i)Fn(i,n,11,[e+t.map(e=>{var t,n;return null!=(n=null==(t=e.toString)?void 0:t.call(e))?n:JSON.stringify(e)}).join(""),n&&n.proxy,r.map(({vnode:e})=>`at <${$a(n,e.type)}>`).join("\n"),r]);else{const n=[`[Vue warn]: ${e}`,...t];r.length&&n.push("\n",...function(e){const t=[];return e.forEach((e,n)=>{t.push(...0===n?[]:["\n"],...function({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",i=!!e.component&&null==e.component.parent,r=` at <${$a(e.component,e.type,i)}`,s=">"+n;return e.props?[r,...Mn(e.props),s]:[r+s]}(e))}),t}(r)),console.warn(...n)}Ze(),Cn=!1}function Mn(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(n=>{t.push(...Rn(n,e[n]))}),n.length>3&&t.push(" ..."),t}function Rn(e,t,n){return C(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):"number"==typeof t||"boolean"==typeof t||null==t?n?t:[`${e}=${t}`]:en(t)?(t=Rn(e,Kt(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):S(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=Kt(t),n?t:[`${e}=`,t])}function kn(e,t){}const Nn={SETUP_FUNCTION:0,0:"SETUP_FUNCTION",RENDER_FUNCTION:1,1:"RENDER_FUNCTION",NATIVE_EVENT_HANDLER:5,5:"NATIVE_EVENT_HANDLER",COMPONENT_EVENT_HANDLER:6,6:"COMPONENT_EVENT_HANDLER",VNODE_HOOK:7,7:"VNODE_HOOK",DIRECTIVE_HOOK:8,8:"DIRECTIVE_HOOK",TRANSITION_HOOK:9,9:"TRANSITION_HOOK",APP_ERROR_HANDLER:10,10:"APP_ERROR_HANDLER",APP_WARN_HANDLER:11,11:"APP_WARN_HANDLER",FUNCTION_REF:12,12:"FUNCTION_REF",ASYNC_COMPONENT_LOADER:13,13:"ASYNC_COMPONENT_LOADER",SCHEDULER:14,14:"SCHEDULER",COMPONENT_UPDATE:15,15:"COMPONENT_UPDATE",APP_UNMOUNT_CLEANUP:16,16:"APP_UNMOUNT_CLEANUP"},Dn={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function Fn(e,t,n,i){try{return i?e(...i):e()}catch(e){Pn(e,t,n)}}function Ln(e,t,n,i){if(S(e)){const r=Fn(e,t,n,i);return r&&R(r)&&r.catch(e=>{Pn(e,t,n)}),r}if(E(e)){const r=[];for(let s=0;s<e.length;s++)r.push(Ln(e[s],t,n,i));return r}}function Pn(e,t,n,i=!0){t&&t.vnode;const{errorHandler:r,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||p;if(t){let i=t.parent;const s=t.proxy,o=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const t=i.ec;if(t)for(let n=0;n<t.length;n++)if(!1===t[n](e,s,o))return;i=i.parent}if(r)return Ke(),Fn(r,null,10,[e,s,o]),void Ze()}!function(e,t,n,i=!0,r=!1){if(r)throw e;console.error(e)}(e,0,0,i,s)}const Bn=[];let $n=-1;const Un=[];let zn=null,Vn=0;const jn=Promise.resolve();let Yn=null;function Gn(e){const t=Yn||jn;return e?t.then(this?e.bind(this):e):t}function Hn(e){if(!(1&e.flags)){const t=Zn(e),n=Bn[Bn.length-1];!n||!(2&e.flags)&&t>=Zn(n)?Bn.push(e):Bn.splice(function(e){let t=$n+1,n=Bn.length;for(;t<n;){const i=t+n>>>1,r=Bn[i],s=Zn(r);s<e||s===e&&2&r.flags?t=i+1:n=i}return t}(t),0,e),e.flags|=1,Wn()}}function Wn(){Yn||(Yn=jn.then(Qn))}function Xn(e){E(e)?Un.push(...e):zn&&-1===e.id?zn.splice(Vn+1,0,e):1&e.flags||(Un.push(e),e.flags|=1),Wn()}function qn(e,t,n=$n+1){for(0;n<Bn.length;n++){const t=Bn[n];if(t&&2&t.flags){if(e&&t.id!==e.uid)continue;0,Bn.splice(n,1),n--,4&t.flags&&(t.flags&=-2),t(),4&t.flags||(t.flags&=-2)}}}function Kn(e){if(Un.length){const e=[...new Set(Un)].sort((e,t)=>Zn(e)-Zn(t));if(Un.length=0,zn)return void zn.push(...e);for(zn=e,Vn=0;Vn<zn.length;Vn++){const e=zn[Vn];0,4&e.flags&&(e.flags&=-2),8&e.flags||e(),e.flags&=-2}zn=null,Vn=0}}const Zn=e=>null==e.id?2&e.flags?-1:1/0:e.id;function Qn(e){try{for($n=0;$n<Bn.length;$n++){const e=Bn[$n];!e||8&e.flags||(4&e.flags&&(e.flags&=-2),Fn(e,e.i,e.i?15:14),4&e.flags||(e.flags&=-2))}}finally{for(;$n<Bn.length;$n++){const e=Bn[$n];e&&(e.flags&=-2)}$n=-1,Bn.length=0,Kn(),Yn=null,(Bn.length||Un.length)&&Qn(e)}}let Jn,ei=[],ti=!1;function ni(e,...t){Jn?Jn.emit(e,...t):ti||ei.push({event:e,args:t})}function ii(e,t){var n,i;if(Jn=e,Jn)Jn.enabled=!0,ei.forEach(({event:e,args:t})=>Jn.emit(e,...t)),ei=[];else if("undefined"!=typeof window&&window.HTMLElement&&!(null==(i=null==(n=window.navigator)?void 0:n.userAgent)?void 0:i.includes("jsdom"))){(t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(e=>{ii(e,t)}),setTimeout(()=>{Jn||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,ti=!0,ei=[])},3e3)}else ti=!0,ei=[]}const ri=li("component:added"),si=li("component:updated"),oi=li("component:removed"),ai=e=>{Jn&&"function"==typeof Jn.cleanupBuffer&&!Jn.cleanupBuffer(e)&&oi(e)};
/*! #__NO_SIDE_EFFECTS__ */
function li(e){return t=>{ni(e,t.appContext.app,t.uid,t.parent?t.parent.uid:void 0,t)}}let ui=null,ci=null;function di(e){const t=ui;return ui=e,ci=e&&e.type.__scopeId||null,t}function hi(e){ci=e}function pi(){ci=null}const fi=e=>mi;function mi(e,t=ui,n){if(!t)return e;if(e._n)return e;const i=(...n)=>{i._d&&Wo(-1);const r=di(t);let s;try{s=e(...n)}finally{di(r),i._d&&Wo(1)}return __VUE_PROD_DEVTOOLS__&&si(t),s};return i._n=!0,i._c=!0,i._d=!0,i}function gi(e,t){if(null===ui)return e;const n=Fa(ui),i=e.dirs||(e.dirs=[]);for(let e=0;e<t.length;e++){let[r,s,o,a=p]=t[e];r&&(S(r)&&(r={mounted:r,updated:r}),r.deep&&An(s),i.push({dir:r,instance:n,value:s,oldValue:void 0,arg:o,modifiers:a}))}return e}function yi(e,t,n,i){const r=e.dirs,s=t&&t.dirs;for(let o=0;o<r.length;o++){const a=r[o];s&&(a.oldValue=s[o].value);let l=a.dir[i];l&&(Ke(),Ln(l,n,8,[e.el,a,e,t]),Ze())}}const _i=Symbol("_vte"),vi=e=>e.__isTeleport,bi=e=>e&&(e.disabled||""===e.disabled),Ti=e=>e&&(e.defer||""===e.defer),xi=e=>"undefined"!=typeof SVGElement&&e instanceof SVGElement,Ei=e=>"function"==typeof MathMLElement&&e instanceof MathMLElement,wi=(e,t)=>{const n=e&&e.to;if(C(n)){if(t){return t(n)}return null}return n},Ii={name:"Teleport",__isTeleport:!0,process(e,t,n,i,r,s,o,a,l,u){const{mc:c,pc:d,pbc:h,o:{insert:p,querySelector:f,createText:m,createComment:g}}=u,y=bi(t.props);let{shapeFlag:_,children:v,dynamicChildren:b}=t;if(null==e){const e=t.el=m(""),u=t.anchor=m("");p(e,n,i),p(u,n,i);const d=(e,t)=>{16&_&&(r&&r.isCE&&(r.ce._teleportTarget=e),c(v,e,t,r,s,o,a,l))},h=()=>{const e=t.target=wi(t.props,f),n=Oi(e,t,m,p);e&&("svg"!==o&&xi(e)?o="svg":"mathml"!==o&&Ei(e)&&(o="mathml"),y||(d(e,n),Ci(t,!1)))};y&&(d(n,u),Ci(t,!0)),Ti(t.props)?Qs(()=>{h(),t.el.__isMounted=!0},s):h()}else{if(Ti(t.props)&&!e.el.__isMounted)return void Qs(()=>{Ii.process(e,t,n,i,r,s,o,a,l,u),delete e.el.__isMounted},s);t.el=e.el,t.targetStart=e.targetStart;const c=t.anchor=e.anchor,p=t.target=e.target,m=t.targetAnchor=e.targetAnchor,g=bi(e.props),_=g?n:p,v=g?c:m;if("svg"===o||xi(p)?o="svg":("mathml"===o||Ei(p))&&(o="mathml"),b?(h(e.dynamicChildren,b,_,r,s,o,a),so(e,t,!0)):l||d(e,t,_,v,r,s,o,a,!1),y)g?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Ai(t,n,c,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const e=t.target=wi(t.props,f);e&&Ai(t,e,null,u,0)}else g&&Ai(t,p,m,u,1);Ci(t,y)}},remove(e,t,n,{um:i,o:{remove:r}},s){const{shapeFlag:o,children:a,anchor:l,targetStart:u,targetAnchor:c,target:d,props:h}=e;if(d&&(r(u),r(c)),s&&r(l),16&o){const e=s||!bi(h);for(let r=0;r<a.length;r++){const s=a[r];i(s,t,n,e,!!s.dynamicChildren)}}},move:Ai,hydrate:function(e,t,n,i,r,s,{o:{nextSibling:o,parentNode:a,querySelector:l,insert:u,createText:c}},d){const h=t.target=wi(t.props,l);if(h){const l=bi(t.props),p=h._lpa||h.firstChild;if(16&t.shapeFlag)if(l)t.anchor=d(o(e),t,a(e),n,i,r,s),t.targetStart=p,t.targetAnchor=p&&o(p);else{t.anchor=o(e);let a=p;for(;a;){if(a&&8===a.nodeType)if("teleport start anchor"===a.data)t.targetStart=a;else if("teleport anchor"===a.data){t.targetAnchor=a,h._lpa=t.targetAnchor&&o(t.targetAnchor);break}a=o(a)}t.targetAnchor||Oi(h,t,c,u),d(p&&o(p),t,h,n,i,r,s)}Ci(t,l)}return t.anchor&&o(t.anchor)}};function Ai(e,t,n,{o:{insert:i},m:r},s=2){0===s&&i(e.targetAnchor,t,n);const{el:o,anchor:a,shapeFlag:l,children:u,props:c}=e,d=2===s;if(d&&i(o,t,n),(!d||bi(c))&&16&l)for(let e=0;e<u.length;e++)r(u[e],t,n,2);d&&i(a,t,n)}const Si=Ii;function Ci(e,t){const n=e.ctx;if(n&&n.ut){let i,r;for(t?(i=e.el,r=e.anchor):(i=e.targetStart,r=e.targetAnchor);i&&i!==r;)1===i.nodeType&&i.setAttribute("data-v-owner",n.uid),i=i.nextSibling;n.ut()}}function Oi(e,t,n,i){const r=t.targetStart=n(""),s=t.targetAnchor=n("");return r[_i]=s,e&&(i(r,e),i(s,e)),s}const Mi=Symbol("_leaveCb"),Ri=Symbol("_enterCb");function ki(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Or(()=>{e.isMounted=!0}),kr(()=>{e.isUnmounting=!0}),e}const Ni=[Function,Array],Di={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Ni,onEnter:Ni,onAfterEnter:Ni,onEnterCancelled:Ni,onBeforeLeave:Ni,onLeave:Ni,onAfterLeave:Ni,onLeaveCancelled:Ni,onBeforeAppear:Ni,onAppear:Ni,onAfterAppear:Ni,onAppearCancelled:Ni},Fi=e=>{const t=e.subTree;return t.component?Fi(t.component):t};function Li(e){let t=e[0];if(e.length>1){let n=!1;for(const i of e)if(i.type!==$o){0,t=i,n=!0;break}}return t}const Pi={name:"BaseTransition",props:Di,setup(e,{slots:t}){const n=va(),i=ki();return()=>{const r=t.default&&ji(t.default(),!0);if(!r||!r.length)return;const s=Li(r),o=Kt(e),{mode:a}=o;if(i.isLeaving)return Ui(s);const l=zi(s);if(!l)return Ui(s);let u=$i(l,o,i,n,e=>u=e);l.type!==$o&&Vi(l,u);let c=n.subTree&&zi(n.subTree);if(c&&c.type!==$o&&!Qo(l,c)&&Fi(n).type!==$o){let e=$i(c,o,i,n);if(Vi(c,e),"out-in"===a&&l.type!==$o)return i.isLeaving=!0,e.afterLeave=()=>{i.isLeaving=!1,8&n.job.flags||n.update(),delete e.afterLeave,c=void 0},Ui(s);"in-out"===a&&l.type!==$o?e.delayLeave=(e,t,n)=>{Bi(i,c)[String(c.key)]=c,e[Mi]=()=>{t(),e[Mi]=void 0,delete u.delayedLeave,c=void 0},u.delayedLeave=()=>{n(),delete u.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return s}}};function Bi(e,t){const{leavingVNodes:n}=e;let i=n.get(t.type);return i||(i=Object.create(null),n.set(t.type,i)),i}function $i(e,t,n,i,r){const{appear:s,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:c,onEnterCancelled:d,onBeforeLeave:h,onLeave:p,onAfterLeave:f,onLeaveCancelled:m,onBeforeAppear:g,onAppear:y,onAfterAppear:_,onAppearCancelled:v}=t,b=String(e.key),T=Bi(n,e),x=(e,t)=>{e&&Ln(e,i,9,t)},w=(e,t)=>{const n=t[1];x(e,t),E(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},I={mode:o,persisted:a,beforeEnter(t){let i=l;if(!n.isMounted){if(!s)return;i=g||l}t[Mi]&&t[Mi](!0);const r=T[b];r&&Qo(e,r)&&r.el[Mi]&&r.el[Mi](),x(i,[t])},enter(e){let t=u,i=c,r=d;if(!n.isMounted){if(!s)return;t=y||u,i=_||c,r=v||d}let o=!1;const a=e[Ri]=t=>{o||(o=!0,x(t?r:i,[e]),I.delayedLeave&&I.delayedLeave(),e[Ri]=void 0)};t?w(t,[e,a]):a()},leave(t,i){const r=String(e.key);if(t[Ri]&&t[Ri](!0),n.isUnmounting)return i();x(h,[t]);let s=!1;const o=t[Mi]=n=>{s||(s=!0,i(),x(n?m:f,[t]),t[Mi]=void 0,T[r]===e&&delete T[r])};T[r]=e,p?w(p,[t,o]):o()},clone(e){const s=$i(e,t,n,i,r);return r&&r(s),s}};return I}function Ui(e){if(gr(e))return(e=oa(e)).children=null,e}function zi(e){if(!gr(e))return vi(e.type)&&e.children?Li(e.children):e;const{shapeFlag:t,children:n}=e;if(n){if(16&t)return n[0];if(32&t&&S(n.default))return n.default()}}function Vi(e,t){6&e.shapeFlag&&e.component?(e.transition=t,Vi(e.component.subTree,t)):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function ji(e,t=!1,n){let i=[],r=0;for(let s=0;s<e.length;s++){let o=e[s];const a=null==n?o.key:String(n)+String(null!=o.key?o.key:s);o.type===Po?(128&o.patchFlag&&r++,i=i.concat(ji(o.children,t,a))):(t||o.type!==$o)&&i.push(null!=a?oa(o,{key:a}):o)}if(r>1)for(let e=0;e<i.length;e++)i[e].patchFlag=-2;return i}
/*! #__NO_SIDE_EFFECTS__ */function Yi(e,t){return S(e)?(()=>v({name:e.name},t,{setup:e}))():e}function Gi(){const e=va();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function Hi(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Wi(e){const t=va(),n=nn(null);if(t){const i=t.refs===p?t.refs={}:t.refs;Object.defineProperty(i,e,{enumerable:!0,get:()=>n.value,set:e=>n.value=e})}else 0;return n}function Xi(e,t,n,i,r=!1){if(E(e))return void e.forEach((e,s)=>Xi(e,t&&(E(t)?t[s]:t),n,i,r));if(pr(i)&&!r)return void(512&i.shapeFlag&&i.type.__asyncResolved&&i.component.subTree.component&&Xi(e,t,n,i.component.subTree));const s=4&i.shapeFlag?Fa(i.component):i.el,o=r?null:s,{i:a,r:l}=e;const u=t&&t.r,c=a.refs===p?a.refs={}:a.refs,d=a.setupState,h=Kt(d),f=d===p?()=>!1:e=>x(h,e);if(null!=u&&u!==l&&(C(u)?(c[u]=null,f(u)&&(d[u]=null)):en(u)&&(u.value=null)),S(l))Fn(l,a,12,[o,c]);else{const t=C(l),i=en(l);if(t||i){const a=()=>{if(e.f){const n=t?f(l)?d[l]:c[l]:l.value;r?E(n)&&b(n,s):E(n)?n.includes(s)||n.push(s):t?(c[l]=[s],f(l)&&(d[l]=c[l])):(l.value=[s],e.k&&(c[e.k]=l.value))}else t?(c[l]=o,f(l)&&(d[l]=o)):i&&(l.value=o,e.k&&(c[e.k]=o))};o?(a.id=-1,Qs(a,n)):a()}else 0}}let qi=!1;const Ki=()=>{qi||(console.error("Hydration completed but contains mismatches."),qi=!0)},Zi=e=>{if(1===e.nodeType)return(e=>e.namespaceURI.includes("svg")&&"foreignObject"!==e.tagName)(e)?"svg":(e=>e.namespaceURI.includes("MathML"))(e)?"mathml":void 0},Qi=e=>8===e.nodeType;function Ji(e){const{mt:t,p:n,o:{patchProp:i,createText:r,nextSibling:s,parentNode:o,remove:a,insert:l,createComment:u}}=e,c=(n,i,a,u,y,v=!1)=>{v=v||!!i.dynamicChildren;const b=Qi(n)&&"["===n.data,T=()=>f(n,i,a,u,y,b),{type:x,ref:E,shapeFlag:w,patchFlag:I}=i;let A=n.nodeType;i.el=n,__VUE_PROD_DEVTOOLS__&&(q(n,"__vnode",i,!0),q(n,"__vueParentComponent",a,!0)),-2===I&&(v=!1,i.dynamicChildren=null);let S=null;switch(x){case Bo:3!==A?""===i.children?(l(i.el=r(""),o(n),n),S=n):S=T():(n.data!==i.children&&(__VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&On("Hydration text mismatch in",n.parentNode,`\n - rendered on server: ${JSON.stringify(n.data)}\n - expected on client: ${JSON.stringify(i.children)}`),Ki(),n.data=i.children),S=s(n));break;case $o:_(n)?(S=s(n),g(i.el=n.content.firstChild,n,a)):S=8!==A||b?T():s(n);break;case Uo:if(b&&(A=(n=s(n)).nodeType),1===A||3===A){S=n;const e=!i.children.length;for(let t=0;t<i.staticCount;t++)e&&(i.children+=1===S.nodeType?S.outerHTML:S.data),t===i.staticCount-1&&(i.anchor=S),S=s(S);return b?s(S):S}T();break;case Po:S=b?p(n,i,a,u,y,v):T();break;default:if(1&w)S=1===A&&i.type.toLowerCase()===n.tagName.toLowerCase()||_(n)?d(n,i,a,u,y,v):T();else if(6&w){i.slotScopeIds=y;const e=o(n);if(S=b?m(n):Qi(n)&&"teleport start"===n.data?m(n,n.data,"teleport end"):s(n),t(i,e,null,a,u,Zi(e),v),pr(i)&&!i.type.__asyncResolved){let t;b?(t=ia(Po),t.anchor=S?S.previousSibling:e.lastChild):t=3===n.nodeType?aa(""):ia("div"),t.el=n,i.component.subTree=t}}else 64&w?S=8!==A?T():i.type.hydrate(n,i,a,u,y,v,e,h):128&w?S=i.type.hydrate(n,i,a,u,Zi(o(n)),y,v,e,c):__VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&On("Invalid HostVNode type:",x,`(${typeof x})`)}return null!=E&&Xi(E,null,u,i),S},d=(e,t,n,r,s,o)=>{o=o||!!t.dynamicChildren;const{type:l,props:u,patchFlag:c,shapeFlag:d,dirs:p,transition:f}=t,m="input"===l||"option"===l;if(m||-1!==c){p&&yi(t,null,n,"created");let l,v=!1;if(_(e)){v=ro(null,f)&&n&&n.vnode.props&&n.vnode.props.appear;const i=e.content.firstChild;v&&f.beforeEnter(i),g(i,e,n),t.el=e=i}if(16&d&&(!u||!u.innerHTML&&!u.textContent)){let i=h(e.firstChild,t,e,n,r,s,o),l=!1;for(;i;){or(e,1)||(__VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&!l&&(On("Hydration children mismatch on",e,"\nServer rendered element contains more child nodes than client vdom."),l=!0),Ki());const t=i;i=i.nextSibling,a(t)}}else if(8&d){let n=t.children;"\n"!==n[0]||"PRE"!==e.tagName&&"TEXTAREA"!==e.tagName||(n=n.slice(1)),e.textContent!==n&&(or(e,0)||(__VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&On("Hydration text content mismatch on",e,`\n - rendered on server: ${e.textContent}\n - expected on client: ${t.children}`),Ki()),e.textContent=t.children)}if(u)if(__VUE_PROD_HYDRATION_MISMATCH_DETAILS__||m||!o||48&c){const r=e.tagName.includes("-");for(const s in u)!__VUE_PROD_HYDRATION_MISMATCH_DETAILS__||p&&p.some(e=>e.dir.created)||!er(e,s,u[s],t,n)||Ki(),(m&&(s.endsWith("value")||"indeterminate"===s)||y(s)&&!P(s)||"."===s[0]||r)&&i(e,s,null,u[s],void 0,n)}else if(u.onClick)i(e,"onClick",null,u.onClick,void 0,n);else if(4&c&&Ht(u.style))for(const e in u.style)u.style[e];(l=u&&u.onVnodeBeforeMount)&&fa(l,n,t),p&&yi(t,null,n,"beforeMount"),((l=u&&u.onVnodeMounted)||p||v)&&Fo(()=>{l&&fa(l,n,t),v&&f.enter(e),p&&yi(t,null,n,"mounted")},r)}return e.nextSibling},h=(e,t,i,o,a,u,d)=>{d=d||!!t.dynamicChildren;const h=t.children,p=h.length;let f=!1;for(let t=0;t<p;t++){const m=d?h[t]:h[t]=ca(h[t]),g=m.type===Bo;e?(g&&!d&&t+1<p&&ca(h[t+1]).type===Bo&&(l(r(e.data.slice(m.children.length)),i,s(e)),e.data=m.children),e=c(e,m,o,a,u,d)):g&&!m.children?l(m.el=r(""),i):(or(i,1)||(__VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&!f&&(On("Hydration children mismatch on",i,"\nServer rendered element contains fewer child nodes than client vdom."),f=!0),Ki()),n(null,m,i,null,o,a,Zi(i),u))}return e},p=(e,t,n,i,r,a)=>{const{slotScopeIds:c}=t;c&&(r=r?r.concat(c):c);const d=o(e),p=h(s(e),t,d,n,i,r,a);return p&&Qi(p)&&"]"===p.data?s(t.anchor=p):(Ki(),l(t.anchor=u("]"),d,p),p)},f=(e,t,i,r,l,u)=>{if(or(e.parentElement,1)||(__VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&On("Hydration node mismatch:\n- rendered on server:",e,3===e.nodeType?"(text)":Qi(e)&&"["===e.data?"(start of fragment)":"","\n- expected on client:",t.type),Ki()),t.el=null,u){const t=m(e);for(;;){const n=s(e);if(!n||n===t)break;a(n)}}const c=s(e),d=o(e);return a(e),n(null,t,d,c,i,r,Zi(d),l),i&&(i.vnode.el=t.el,Co(i,t.el)),c},m=(e,t="[",n="]")=>{let i=0;for(;e;)if((e=s(e))&&Qi(e)&&(e.data===t&&i++,e.data===n)){if(0===i)return s(e);i--}return e},g=(e,t,n)=>{const i=t.parentNode;i&&i.replaceChild(e,t);let r=n;for(;r;)r.vnode.el===t&&(r.vnode.el=r.subTree.el=e),r=r.parent},_=e=>1===e.nodeType&&"TEMPLATE"===e.tagName;return[(e,t)=>{if(!t.hasChildNodes())return __VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&On("Attempting to hydrate existing markup but container is empty. Performing full mount instead."),n(null,e,t),Kn(),void(t._vnode=e);c(t.firstChild,e,null,null,null),Kn(),t._vnode=e},c]}function er(e,t,n,i,r){let s,o,a,l;if("class"===t)a=e.getAttribute("class"),l=oe(n),function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(tr(a||""),tr(l))||(s=2,o="class");else if("style"===t){a=e.getAttribute("style")||"",l=C(n)?n:function(e){if(!e)return"";if(C(e))return e;let t="";for(const n in e){const i=e[n];(C(i)||"number"==typeof i)&&(t+=`${n.startsWith("--")?n:Y(n)}:${i};`)}return t}(te(n));const t=nr(a),u=nr(l);if(i.dirs)for(const{dir:e,value:t}of i.dirs)"show"!==e.name||t||u.set("display","none");r&&ir(r,i,u),function(e,t){if(e.size!==t.size)return!1;for(const[n,i]of e)if(i!==t.get(n))return!1;return!0}(t,u)||(s=3,o="style")}else(e instanceof SVGElement&&ye(t)||e instanceof HTMLElement&&(fe(t)||ge(t)))&&(fe(t)?(a=e.hasAttribute(t),l=me(n)):null==n?(a=e.hasAttribute(t),l=!1):(a=e.hasAttribute(t)?e.getAttribute(t):"value"===t&&"TEXTAREA"===e.tagName&&e.value,l=!!function(e){if(null==e)return!1;const t=typeof e;return"string"===t||"number"===t||"boolean"===t}(n)&&String(n)),a!==l&&(s=4,o=t));if(null!=s&&!or(e,s)){const t=e=>!1===e?"(not rendered)":`${o}="${e}"`;return On(`Hydration ${sr[s]} mismatch on`,e,`\n - rendered on server: ${t(a)}\n - expected on client: ${t(l)}\n Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.\n You should fix the source of the mismatch.`),!0}return!1}function tr(e){return new Set(e.trim().split(/\s+/))}function nr(e){const t=new Map;for(const n of e.split(";")){let[e,i]=n.split(":");e=e.trim(),i=i&&i.trim(),e&&i&&t.set(e,i)}return t}function ir(e,t,n){const i=e.subTree;if(e.getCssVars&&(t===i||i&&i.type===Po&&i.children.includes(t))){const t=e.getCssVars();for(const e in t)n.set(`--${ve(e,!1)}`,String(t[e]))}t===i&&e.parent&&ir(e.parent,e.vnode,n)}const rr="data-allow-mismatch",sr={0:"text",1:"children",2:"class",3:"style",4:"attribute"};function or(e,t){if(0===t||1===t)for(;e&&!e.hasAttribute(rr);)e=e.parentElement;const n=e&&e.getAttribute(rr);if(null==n)return!1;if(""===n)return!0;{const e=n.split(",");return!(0!==t||!e.includes("children"))||n.split(",").includes(sr[t])}}const ar=J().requestIdleCallback||(e=>setTimeout(e,1)),lr=J().cancelIdleCallback||(e=>clearTimeout(e)),ur=(e=1e4)=>t=>{const n=ar(t,{timeout:e});return()=>lr(n)};const cr=e=>(t,n)=>{const i=new IntersectionObserver(e=>{for(const n of e)if(n.isIntersecting){i.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element)return function(e){const{top:t,left:n,bottom:i,right:r}=e.getBoundingClientRect(),{innerHeight:s,innerWidth:o}=window;return(t>0&&t<s||i>0&&i<s)&&(n>0&&n<o||r>0&&r<o)}(e)?(t(),i.disconnect(),!1):void i.observe(e)}),()=>i.disconnect()},dr=e=>t=>{if(e){const n=matchMedia(e);if(!n.matches)return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t);t()}},hr=(e=[])=>(t,n)=>{C(e)&&(e=[e]);let i=!1;const r=e=>{i||(i=!0,s(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},s=()=>{n(t=>{for(const n of e)t.removeEventListener(n,r)})};return n(t=>{for(const n of e)t.addEventListener(n,r,{once:!0})}),s};const pr=e=>!!e.type.__asyncLoader;
/*! #__NO_SIDE_EFFECTS__ */function fr(e){S(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:i,delay:r=200,hydrate:s,timeout:o,suspensible:a=!0,onError:l}=e;let u,c=null,d=0;const h=()=>{let e;return c||(e=c=t().catch(e=>{if(e=e instanceof Error?e:new Error(String(e)),l)return new Promise((t,n)=>{l(e,()=>t((d++,c=null,h())),()=>n(e),d+1)});throw e}).then(t=>e!==c&&c?c:(t&&(t.__esModule||"Module"===t[Symbol.toStringTag])&&(t=t.default),u=t,t)))};return Yi({name:"AsyncComponentWrapper",__asyncLoader:h,__asyncHydrate(e,t,n){const i=s?()=>{const i=s(n,t=>function(e,t){if(Qi(e)&&"["===e.data){let n=1,i=e.nextSibling;for(;i;){if(1===i.nodeType){if(!1===t(i))break}else if(Qi(i))if("]"===i.data){if(0===--n)break}else"["===i.data&&n++;i=i.nextSibling}}else t(e)}(e,t));i&&(t.bum||(t.bum=[])).push(i)}:n;u?i():h().then(()=>!t.isUnmounted&&i())},get __asyncResolved(){return u},setup(){const e=_a;if(Hi(e),u)return()=>mr(u,e);const t=t=>{c=null,Pn(t,e,13,!i)};if(a&&e.suspense||Sa)return h().then(t=>()=>mr(t,e)).catch(e=>(t(e),()=>i?ia(i,{error:e}):null));const s=tn(!1),l=tn(),d=tn(!!r);return r&&setTimeout(()=>{d.value=!1},r),null!=o&&setTimeout(()=>{if(!s.value&&!l.value){const e=new Error(`Async component timed out after ${o}ms.`);t(e),l.value=e}},o),h().then(()=>{s.value=!0,e.parent&&gr(e.parent.vnode)&&e.parent.update()}).catch(e=>{t(e),l.value=e}),()=>s.value&&u?mr(u,e):l.value&&i?ia(i,{error:l.value}):n&&!d.value?ia(n):void 0}})}function mr(e,t){const{ref:n,props:i,children:r,ce:s}=t.vnode,o=ia(e,i,r);return o.ref=n,o.ce=s,delete t.vnode.ce,o}const gr=e=>e.type.__isKeepAlive,yr={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=va(),i=n.ctx;if(!i.renderer)return()=>{const e=t.default&&t.default();return e&&1===e.length?e[0]:e};const r=new Map,s=new Set;let o=null;__VUE_PROD_DEVTOOLS__&&(n.__v_cache=r);const a=n.suspense,{renderer:{p:l,m:u,um:c,o:{createElement:d}}}=i,h=d("div");function p(e){wr(e),c(e,n,a,!0)}function f(e){r.forEach((t,n)=>{const i=Ba(t.type);i&&!e(i)&&m(n)})}function m(e){const t=r.get(e);!t||o&&Qo(t,o)?o&&wr(o):p(t),r.delete(e),s.delete(e)}i.activate=(e,t,n,i,r)=>{const s=e.component;u(e,t,n,0,a),l(s.vnode,e,t,n,s,a,i,e.slotScopeIds,r),Qs(()=>{s.isDeactivated=!1,s.a&&X(s.a);const t=e.props&&e.props.onVnodeMounted;t&&fa(t,s.parent,e)},a),__VUE_PROD_DEVTOOLS__&&ri(s)},i.deactivate=e=>{const t=e.component;ao(t.m),ao(t.a),u(e,h,null,1,a),Qs(()=>{t.da&&X(t.da);const n=e.props&&e.props.onVnodeUnmounted;n&&fa(n,t.parent,e),t.isDeactivated=!0},a),__VUE_PROD_DEVTOOLS__&&ri(t)},fo(()=>[e.include,e.exclude],([e,t])=>{e&&f(t=>vr(e,t)),t&&f(e=>!vr(t,e))},{flush:"post",deep:!0});let g=null;const y=()=>{null!=g&&(Oo(n.subTree.type)?Qs(()=>{r.set(g,Ir(n.subTree))},n.subTree.suspense):r.set(g,Ir(n.subTree)))};return Or(y),Rr(y),kr(()=>{r.forEach(e=>{const{subTree:t,suspense:i}=n,r=Ir(t);if(e.type===r.type&&e.key===r.key){wr(r);const e=r.component.da;return void(e&&Qs(e,i))}p(e)})}),()=>{if(g=null,!t.default)return o=null;const n=t.default(),i=n[0];if(n.length>1)return o=null,n;if(!(Zo(i)&&(4&i.shapeFlag||128&i.shapeFlag)))return o=null,i;let a=Ir(i);if(a.type===$o)return o=null,a;const l=a.type,u=Ba(pr(a)?a.type.__asyncResolved||{}:l),{include:c,exclude:d,max:h}=e;if(c&&(!u||!vr(c,u))||d&&u&&vr(d,u))return a.shapeFlag&=-257,o=a,i;const p=null==a.key?l:a.key,f=r.get(p);return a.el&&(a=oa(a),128&i.shapeFlag&&(i.ssContent=a)),g=p,f?(a.el=f.el,a.component=f.component,a.transition&&Vi(a,a.transition),a.shapeFlag|=512,s.delete(p),s.add(p)):(s.add(p),h&&s.size>parseInt(h,10)&&m(s.values().next().value)),a.shapeFlag|=256,o=a,Oo(i.type)?i:a}}},_r=yr;function vr(e,t){return E(e)?e.some(e=>vr(e,t)):C(e)?e.split(",").includes(t):"[object RegExp]"===N(e)&&(e.lastIndex=0,e.test(t))}function br(e,t){xr(e,"a",t)}function Tr(e,t){xr(e,"da",t)}function xr(e,t,n=_a){const i=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(Ar(t,i,n),n){let e=n.parent;for(;e&&e.parent;)gr(e.parent.vnode)&&Er(i,t,n,e),e=e.parent}}function Er(e,t,n,i){const r=Ar(t,e,i,!0);Nr(()=>{b(i[t],r)},n)}function wr(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function Ir(e){return 128&e.shapeFlag?e.ssContent:e}function Ar(e,t,n=_a,i=!1){if(n){const r=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...i)=>{Ke();const r=xa(n),s=Ln(t,n,e,i);return r(),Ze(),s});return i?r.unshift(s):r.push(s),s}}const Sr=e=>(t,n=_a)=>{Sa&&"sp"!==e||Ar(e,(...e)=>t(...e),n)},Cr=Sr("bm"),Or=Sr("m"),Mr=Sr("bu"),Rr=Sr("u"),kr=Sr("bum"),Nr=Sr("um"),Dr=Sr("sp"),Fr=Sr("rtg"),Lr=Sr("rtc");function Pr(e,t=_a){Ar("ec",e,t)}const Br="components",$r="directives";function Ur(e,t){return Yr(Br,e,!0,t)||e}const zr=Symbol.for("v-ndc");function Vr(e){return C(e)?Yr(Br,e,!1)||e:e||zr}function jr(e){return Yr($r,e)}function Yr(e,t,n=!0,i=!1){const r=ui||_a;if(r){const n=r.type;if(e===Br){const e=Ba(n,!1);if(e&&(e===t||e===V(t)||e===G(V(t))))return n}const s=Gr(r[e]||n[e],t)||Gr(r.appContext[e],t);return!s&&i?n:s}}function Gr(e,t){return e&&(e[t]||e[V(t)]||e[G(V(t))])}function Hr(e,t,n,i){let r;const s=n&&n[i],o=E(e);if(o||C(e)){let n=!1;o&&Ht(e)&&(n=!Xt(e),e=ct(e)),r=new Array(e.length);for(let i=0,o=e.length;i<o;i++)r[i]=t(n?Qt(e[i]):e[i],i,void 0,s&&s[i])}else if("number"==typeof e){0,r=new Array(e);for(let n=0;n<e;n++)r[n]=t(n+1,n,void 0,s&&s[n])}else if(M(e))if(e[Symbol.iterator])r=Array.from(e,(e,n)=>t(e,n,void 0,s&&s[n]));else{const n=Object.keys(e);r=new Array(n.length);for(let i=0,o=n.length;i<o;i++){const o=n[i];r[i]=t(e[o],o,i,s&&s[i])}}else r=[];return n&&(n[i]=r),r}function Wr(e,t){for(let n=0;n<t.length;n++){const i=t[n];if(E(i))for(let t=0;t<i.length;t++)e[i[t].name]=i[t].fn;else i&&(e[i.name]=i.key?(...e)=>{const t=i.fn(...e);return t&&(t.key=i.key),t}:i.fn)}return e}function Xr(e,t,n={},i,r){if(ui.ce||ui.parent&&pr(ui.parent)&&ui.parent.ce)return"default"!==t&&(n.name=t),jo(),Ko(Po,null,[ia("slot",n,i&&i())],64);let s=e[t];s&&s._c&&(s._d=!1),jo();const o=s&&qr(s(n)),a=n.key||o&&o.key,l=Ko(Po,{key:(a&&!O(a)?a:`_${t}`)+(!o&&i?"_fb":"")},o||(i?i():[]),o&&1===e._?64:-2);return!r&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),s&&s._c&&(s._d=!0),l}function qr(e){return e.some(e=>!Zo(e)||e.type!==$o&&!(e.type===Po&&!qr(e.children)))?e:null}function Kr(e,t){const n={};for(const i in e)n[t&&/[A-Z]/.test(i)?`on:${i}`:H(i)]=e[i];return n}const Zr=e=>e?wa(e)?Fa(e):Zr(e.parent):null,Qr=v(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Zr(e.parent),$root:e=>Zr(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>__VUE_OPTIONS_API__?Ts(e):e.type,$forceUpdate:e=>e.f||(e.f=()=>{Hn(e.update)}),$nextTick:e=>e.n||(e.n=Gn.bind(e.proxy)),$watch:e=>__VUE_OPTIONS_API__?go.bind(e):m}),Jr=(e,t)=>e!==p&&!e.__isScriptSetup&&x(e,t),es={get({_:e},t){if("__v_skip"===t)return!0;const{ctx:n,setupState:i,data:r,props:s,accessCache:o,type:a,appContext:l}=e;let u;if("$"!==t[0]){const a=o[t];if(void 0!==a)switch(a){case 1:return i[t];case 2:return r[t];case 4:return n[t];case 3:return s[t]}else{if(Jr(i,t))return o[t]=1,i[t];if(r!==p&&x(r,t))return o[t]=2,r[t];if((u=e.propsOptions[0])&&x(u,t))return o[t]=3,s[t];if(n!==p&&x(n,t))return o[t]=4,n[t];__VUE_OPTIONS_API__&&!ys||(o[t]=0)}}const c=Qr[t];let d,h;return c?("$attrs"===t&&at(e.attrs,0,""),c(e)):(d=a.__cssModules)&&(d=d[t])?d:n!==p&&x(n,t)?(o[t]=4,n[t]):(h=l.config.globalProperties,x(h,t)?h[t]:void 0)},set({_:e},t,n){const{data:i,setupState:r,ctx:s}=e;return Jr(r,t)?(r[t]=n,!0):i!==p&&x(i,t)?(i[t]=n,!0):!x(e.props,t)&&(("$"!==t[0]||!(t.slice(1)in e))&&(s[t]=n,!0))},has({_:{data:e,setupState:t,accessCache:n,ctx:i,appContext:r,propsOptions:s}},o){let a;return!!n[o]||e!==p&&x(e,o)||Jr(t,o)||(a=s[0])&&x(a,o)||x(i,o)||x(Qr,o)||x(r.config.globalProperties,o)},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:x(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};const ts=v({},es,{get(e,t){if(t!==Symbol.unscopables)return es.get(e,t,e)},has:(e,t)=>"_"!==t[0]&&!ee(t)});function ns(){return null}function is(){return null}function rs(e){0}function ss(e){0}function os(){return null}function as(){0}function ls(e,t){return null}function us(){return ds().slots}function cs(){return ds().attrs}function ds(){const e=va();return e.setupContext||(e.setupContext=Da(e))}function hs(e){return E(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}function ps(e,t){const n=hs(e);for(const e in t){if(e.startsWith("__skip"))continue;let i=n[e];i?E(i)||S(i)?i=n[e]={type:i,default:t[e]}:i.default=t[e]:null===i&&(i=n[e]={default:t[e]}),i&&t[`__skip_${e}`]&&(i.skipFactory=!0)}return n}function fs(e,t){return e&&t?E(e)&&E(t)?e.concat(t):v({},hs(e),hs(t)):e||t}function ms(e,t){const n={};for(const i in e)t.includes(i)||Object.defineProperty(n,i,{enumerable:!0,get:()=>e[i]});return n}function gs(e){const t=va();let n=e();return Ea(),R(n)&&(n=n.catch(e=>{throw xa(t),e})),[n,()=>xa(t)]}let ys=!0;function _s(e){const t=Ts(e),n=e.proxy,i=e.ctx;ys=!1,t.beforeCreate&&vs(t.beforeCreate,e,"bc");const{data:r,computed:s,methods:o,watch:a,provide:l,inject:u,created:c,beforeMount:d,mounted:h,beforeUpdate:p,updated:f,activated:g,deactivated:y,beforeDestroy:_,beforeUnmount:v,destroyed:b,unmounted:T,render:x,renderTracked:w,renderTriggered:I,errorCaptured:A,serverPrefetch:C,expose:O,inheritAttrs:R,components:k,directives:N,filters:D}=t;if(u&&function(e,t){E(e)&&(e=Is(e));for(const n in e){const i=e[n];let r;r=M(i)?"default"in i?Ds(i.from||n,i.default,!0):Ds(i.from||n):Ds(i),en(r)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:e=>r.value=e}):t[n]=r}}(u,i,null),o)for(const e in o){const t=o[e];S(t)&&(i[e]=t.bind(n))}if(r){0;const t=r.call(n,n);0,M(t)&&(e.data=zt(t))}if(ys=!0,s)for(const e in s){const t=s[e],r=S(t)?t.bind(n,n):S(t.get)?t.get.bind(n,n):m;0;const o=!S(t)&&S(t.set)?t.set.bind(n):m,a=za({get:r,set:o});Object.defineProperty(i,e,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e})}if(a)for(const e in a)bs(a[e],i,n,e);if(l){const e=S(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{Ns(t,e[t])})}function F(e,t){E(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(c&&vs(c,e,"c"),F(Cr,d),F(Or,h),F(Mr,p),F(Rr,f),F(br,g),F(Tr,y),F(Pr,A),F(Lr,w),F(Fr,I),F(kr,v),F(Nr,T),F(Dr,C),E(O))if(O.length){const t=e.exposed||(e.exposed={});O.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t})})}else e.exposed||(e.exposed={});x&&e.render===m&&(e.render=x),null!=R&&(e.inheritAttrs=R),k&&(e.components=k),N&&(e.directives=N),C&&Hi(e)}function vs(e,t,n){Ln(E(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function bs(e,t,n,i){let r=i.includes(".")?yo(n,i):()=>n[i];if(C(e)){const n=t[e];S(n)&&fo(r,n)}else if(S(e))fo(r,e.bind(n));else if(M(e))if(E(e))e.forEach(e=>bs(e,t,n,i));else{const i=S(e.handler)?e.handler.bind(n):t[e.handler];S(i)&&fo(r,i,e)}else 0}function Ts(e){const t=e.type,{mixins:n,extends:i}=t,{mixins:r,optionsCache:s,config:{optionMergeStrategies:o}}=e.appContext,a=s.get(t);let l;return a?l=a:r.length||n||i?(l={},r.length&&r.forEach(e=>xs(l,e,o,!0)),xs(l,t,o)):l=t,M(t)&&s.set(t,l),l}function xs(e,t,n,i=!1){const{mixins:r,extends:s}=t;s&&xs(e,s,n,!0),r&&r.forEach(t=>xs(e,t,n,!0));for(const r in t)if(i&&"expose"===r);else{const i=Es[r]||n&&n[r];e[r]=i?i(e[r],t[r]):t[r]}return e}const Es={data:ws,props:Cs,emits:Cs,methods:Ss,computed:Ss,beforeCreate:As,created:As,beforeMount:As,mounted:As,beforeUpdate:As,updated:As,beforeDestroy:As,beforeUnmount:As,destroyed:As,unmounted:As,activated:As,deactivated:As,errorCaptured:As,serverPrefetch:As,components:Ss,directives:Ss,watch:function(e,t){if(!e)return t;if(!t)return e;const n=v(Object.create(null),e);for(const i in t)n[i]=As(e[i],t[i]);return n},provide:ws,inject:function(e,t){return Ss(Is(e),Is(t))}};function ws(e,t){return t?e?function(){return v(S(e)?e.call(this,this):e,S(t)?t.call(this,this):t)}:t:e}function Is(e){if(E(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function As(e,t){return e?[...new Set([].concat(e,t))]:t}function Ss(e,t){return e?v(Object.create(null),e,t):t}function Cs(e,t){return e?E(e)&&E(t)?[...new Set([...e,...t])]:v(Object.create(null),hs(e),hs(null!=t?t:{})):t}function Os(){return{app:null,config:{isNativeTag:g,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Ms=0;function Rs(e,t){return function(n,i=null){S(n)||(n=v({},n)),null==i||M(i)||(i=null);const r=Os(),s=new WeakSet,o=[];let a=!1;const l=r.app={_uid:Ms++,_component:n,_props:i,_container:null,_context:r,_instance:null,version:Ha,get config(){return r.config},set config(e){0},use:(e,...t)=>(s.has(e)||(e&&S(e.install)?(s.add(e),e.install(l,...t)):S(e)&&(s.add(e),e(l,...t))),l),mixin:e=>(__VUE_OPTIONS_API__&&(r.mixins.includes(e)||r.mixins.push(e)),l),component:(e,t)=>t?(r.components[e]=t,l):r.components[e],directive:(e,t)=>t?(r.directives[e]=t,l):r.directives[e],mount(s,o,u){if(!a){0;const c=l._ceVNode||ia(n,i);return c.appContext=r,!0===u?u="svg":!1===u&&(u=void 0),o&&t?t(c,s):e(c,s,u),a=!0,l._container=s,s.__vue_app__=l,__VUE_PROD_DEVTOOLS__&&(l._instance=c.component,function(e,t){ni("app:init",e,t,{Fragment:Po,Text:Bo,Comment:$o,Static:Uo})}(l,Ha)),Fa(c.component)}},onUnmount(e){o.push(e)},unmount(){a&&(Ln(o,l._instance,16),e(null,l._container),__VUE_PROD_DEVTOOLS__&&(l._instance=null,function(e){ni("app:unmount",e)}(l)),delete l._container.__vue_app__)},provide:(e,t)=>(r.provides[e]=t,l),runWithContext(e){const t=ks;ks=l;try{return e()}finally{ks=t}}};return l}}let ks=null;function Ns(e,t){if(_a){let n=_a.provides;const i=_a.parent&&_a.parent.provides;i===n&&(n=_a.provides=Object.create(i)),n[e]=t}else 0}function Ds(e,t,n=!1){const i=_a||ui;if(i||ks){const r=ks?ks._context.provides:i?null==i.parent?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return n&&S(t)?t.call(i&&i.proxy):t}else 0}function Fs(){return!!(_a||ui||ks)}const Ls={},Ps=()=>Object.create(Ls),Bs=e=>Object.getPrototypeOf(e)===Ls;function $s(e,t,n,i){const[r,s]=e.propsOptions;let o,a=!1;if(t)for(let l in t){if(P(l))continue;const u=t[l];let c;r&&x(r,c=V(l))?s&&s.includes(c)?(o||(o={}))[c]=u:n[c]=u:xo(e.emitsOptions,l)||l in i&&u===i[l]||(i[l]=u,a=!0)}if(s){const t=Kt(n),i=o||p;for(let o=0;o<s.length;o++){const a=s[o];n[a]=Us(r,t,a,i[a],e,!x(i,a))}}return a}function Us(e,t,n,i,r,s){const o=e[n];if(null!=o){const e=x(o,"default");if(e&&void 0===i){const e=o.default;if(o.type!==Function&&!o.skipFactory&&S(e)){const{propsDefaults:s}=r;if(n in s)i=s[n];else{const o=xa(r);i=s[n]=e.call(null,t),o()}}else i=e;r.ce&&r.ce._setProp(n,i)}o[0]&&(s&&!e?i=!1:!o[1]||""!==i&&i!==Y(n)||(i=!0))}return i}const zs=new WeakMap;function Vs(e,t,n=!1){const i=__VUE_OPTIONS_API__&&n?zs:t.propsCache,r=i.get(e);if(r)return r;const s=e.props,o={},a=[];let l=!1;if(__VUE_OPTIONS_API__&&!S(e)){const i=e=>{l=!0;const[n,i]=Vs(e,t,!0);v(o,n),i&&a.push(...i)};!n&&t.mixins.length&&t.mixins.forEach(i),e.extends&&i(e.extends),e.mixins&&e.mixins.forEach(i)}if(!s&&!l)return M(e)&&i.set(e,f),f;if(E(s))for(let e=0;e<s.length;e++){0;const t=V(s[e]);js(t)&&(o[t]=p)}else if(s){0;for(const e in s){const t=V(e);if(js(t)){const n=s[e],i=o[t]=E(n)||S(n)?{type:n}:v({},n),r=i.type;let l=!1,u=!0;if(E(r))for(let e=0;e<r.length;++e){const t=r[e],n=S(t)&&t.name;if("Boolean"===n){l=!0;break}"String"===n&&(u=!1)}else l=S(r)&&"Boolean"===r.name;i[0]=l,i[1]=u,(l||x(i,"default"))&&a.push(t)}}}const u=[o,a];return M(e)&&i.set(e,u),u}function js(e){return"$"!==e[0]&&!P(e)}const Ys=e=>"_"===e[0]||"$stable"===e,Gs=e=>E(e)?e.map(ca):[ca(e)],Hs=(e,t,n)=>{if(t._n)return t;const i=mi((...e)=>Gs(t(...e)),n);return i._c=!1,i},Ws=(e,t,n)=>{const i=e._ctx;for(const n in e){if(Ys(n))continue;const r=e[n];if(S(r))t[n]=Hs(0,r,i);else if(null!=r){0;const e=Gs(r);t[n]=()=>e}}},Xs=(e,t)=>{const n=Gs(t);e.slots.default=()=>n},qs=(e,t,n)=>{for(const i in t)(n||"_"!==i)&&(e[i]=t[i])},Ks=(e,t,n)=>{const i=e.slots=Ps();if(32&e.vnode.shapeFlag){const e=t._;e?(qs(i,t,n),n&&q(i,"_",e,!0)):Ws(t,i)}else t&&Xs(e,t)},Zs=(e,t,n)=>{const{vnode:i,slots:r}=e;let s=!0,o=p;if(32&i.shapeFlag){const e=t._;e?n&&1===e?s=!1:qs(r,t,n):(s=!t.$stable,Ws(t,r)),o=t}else t&&(Xs(e,t),o={default:1});if(s)for(const e in r)Ys(e)||null!=o[e]||delete r[e]};const Qs=Fo;function Js(e){return to(e)}function eo(e){return to(e,Ji)}function to(e,t){"boolean"!=typeof __VUE_OPTIONS_API__&&(J().__VUE_OPTIONS_API__=!0),"boolean"!=typeof __VUE_PROD_DEVTOOLS__&&(J().__VUE_PROD_DEVTOOLS__=!1),"boolean"!=typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&(J().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=!1);const n=J();n.__VUE__=!0,__VUE_PROD_DEVTOOLS__&&ii(n.__VUE_DEVTOOLS_GLOBAL_HOOK__,n);const{insert:i,remove:r,patchProp:s,createElement:o,createText:a,createComment:l,setText:u,setElementText:c,parentNode:d,nextSibling:h,setScopeId:g=m,insertStaticContent:y}=e,_=(e,t,n,i=null,r=null,s=null,o=void 0,a=null,l=!!t.dynamicChildren)=>{if(e===t)return;e&&!Qo(e,t)&&(i=Z(e),j(e,r,s,!0),e=null),-2===t.patchFlag&&(l=!1,t.dynamicChildren=null);const{type:u,ref:c,shapeFlag:d}=t;switch(u){case Bo:v(e,t,n,i);break;case $o:b(e,t,n,i);break;case Uo:null==e&&T(t,n,i,o);break;case Po:R(e,t,n,i,r,s,o,a,l);break;default:1&d?w(e,t,n,i,r,s,o,a,l):6&d?k(e,t,n,i,r,s,o,a,l):(64&d||128&d)&&u.process(e,t,n,i,r,s,o,a,l,te)}null!=c&&r&&Xi(c,e&&e.ref,s,t||e,!t)},v=(e,t,n,r)=>{if(null==e)i(t.el=a(t.children),n,r);else{const n=t.el=e.el;t.children!==e.children&&u(n,t.children)}},b=(e,t,n,r)=>{null==e?i(t.el=l(t.children||""),n,r):t.el=e.el},T=(e,t,n,i)=>{[e.el,e.anchor]=y(e.children,t,n,i,e.el,e.anchor)},E=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),r(e),e=n;r(t)},w=(e,t,n,i,r,s,o,a,l)=>{"svg"===t.type?o="svg":"math"===t.type&&(o="mathml"),null==e?I(t,n,i,r,s,o,a,l):C(e,t,r,s,o,a,l)},I=(e,t,n,r,a,l,u,d)=>{let h,p;const{props:f,shapeFlag:m,transition:g,dirs:y}=e;if(h=e.el=o(e.type,l,f&&f.is,f),8&m?c(h,e.children):16&m&&S(e.children,h,null,r,a,no(e,l),u,d),y&&yi(e,null,r,"created"),A(h,e,e.scopeId,u,r),f){for(const e in f)"value"===e||P(e)||s(h,e,null,f[e],l,r);"value"in f&&s(h,"value",null,f.value,l),(p=f.onVnodeBeforeMount)&&fa(p,r,e)}__VUE_PROD_DEVTOOLS__&&(q(h,"__vnode",e,!0),q(h,"__vueParentComponent",r,!0)),y&&yi(e,null,r,"beforeMount");const _=ro(a,g);_&&g.beforeEnter(h),i(h,t,n),((p=f&&f.onVnodeMounted)||_||y)&&Qs(()=>{p&&fa(p,r,e),_&&g.enter(h),y&&yi(e,null,r,"mounted")},a)},A=(e,t,n,i,r)=>{if(n&&g(e,n),i)for(let t=0;t<i.length;t++)g(e,i[t]);if(r){let n=r.subTree;if(t===n||Oo(n.type)&&(n.ssContent===t||n.ssFallback===t)){const t=r.vnode;A(e,t,t.scopeId,t.slotScopeIds,r.parent)}}},S=(e,t,n,i,r,s,o,a,l=0)=>{for(let u=l;u<e.length;u++){const l=e[u]=a?da(e[u]):ca(e[u]);_(null,l,t,n,i,r,s,o,a)}},C=(e,t,n,i,r,o,a)=>{const l=t.el=e.el;__VUE_PROD_DEVTOOLS__&&(l.__vnode=t);let{patchFlag:u,dynamicChildren:d,dirs:h}=t;u|=16&e.patchFlag;const f=e.props||p,m=t.props||p;let g;if(n&&io(n,!1),(g=m.onVnodeBeforeUpdate)&&fa(g,n,t,e),h&&yi(t,e,n,"beforeUpdate"),n&&io(n,!0),(f.innerHTML&&null==m.innerHTML||f.textContent&&null==m.textContent)&&c(l,""),d?O(e.dynamicChildren,d,l,n,i,no(t,r),o):a||B(e,t,l,null,n,i,no(t,r),o,!1),u>0){if(16&u)M(l,f,m,n,r);else if(2&u&&f.class!==m.class&&s(l,"class",null,m.class,r),4&u&&s(l,"style",f.style,m.style,r),8&u){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const i=e[t],o=f[i],a=m[i];a===o&&"value"!==i||s(l,i,o,a,r,n)}}1&u&&e.children!==t.children&&c(l,t.children)}else a||null!=d||M(l,f,m,n,r);((g=m.onVnodeUpdated)||h)&&Qs(()=>{g&&fa(g,n,t,e),h&&yi(t,e,n,"updated")},i)},O=(e,t,n,i,r,s,o)=>{for(let a=0;a<t.length;a++){const l=e[a],u=t[a],c=l.el&&(l.type===Po||!Qo(l,u)||70&l.shapeFlag)?d(l.el):n;_(l,u,c,null,i,r,s,o,!0)}},M=(e,t,n,i,r)=>{if(t!==n){if(t!==p)for(const o in t)P(o)||o in n||s(e,o,t[o],null,r,i);for(const o in n){if(P(o))continue;const a=n[o],l=t[o];a!==l&&"value"!==o&&s(e,o,l,a,r,i)}"value"in n&&s(e,"value",t.value,n.value,r)}},R=(e,t,n,r,s,o,l,u,c)=>{const d=t.el=e?e.el:a(""),h=t.anchor=e?e.anchor:a("");let{patchFlag:p,dynamicChildren:f,slotScopeIds:m}=t;m&&(u=u?u.concat(m):m),null==e?(i(d,n,r),i(h,n,r),S(t.children||[],n,h,s,o,l,u,c)):p>0&&64&p&&f&&e.dynamicChildren?(O(e.dynamicChildren,f,n,s,o,l,u),(null!=t.key||s&&t===s.subTree)&&so(e,t,!0)):B(e,t,n,h,s,o,l,u,c)},k=(e,t,n,i,r,s,o,a,l)=>{t.slotScopeIds=a,null==e?512&t.shapeFlag?r.ctx.activate(t,n,i,o,l):N(t,n,i,r,s,o,l):D(e,t,l)},N=(e,t,n,i,r,s,o)=>{const a=e.component=ya(e,i,r);if(gr(e)&&(a.ctx.renderer=te),Ca(a,!1,o),a.asyncDep){if(r&&r.registerDep(a,F,o),!e.el){const e=a.subTree=ia($o);b(null,e,t,n)}}else F(a,e,t,n,r,s,o)},D=(e,t,n)=>{const i=t.component=e.component;if(function(e,t,n){const{props:i,children:r,component:s}=e,{props:o,children:a,patchFlag:l}=t,u=s.emitsOptions;0;if(t.dirs||t.transition)return!0;if(!(n&&l>=0))return!(!r&&!a||a&&a.$stable)||i!==o&&(i?!o||So(i,o,u):!!o);if(1024&l)return!0;if(16&l)return i?So(i,o,u):!!o;if(8&l){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const n=e[t];if(o[n]!==i[n]&&!xo(u,n))return!0}}return!1}(e,t,n)){if(i.asyncDep&&!i.asyncResolved)return void L(i,t,n);i.next=t,i.update()}else t.el=e.el,i.vnode=t},F=(e,t,n,i,r,s,o)=>{const a=()=>{if(e.isMounted){let{next:t,bu:n,u:i,parent:l,vnode:u}=e;{const n=oo(e);if(n)return t&&(t.el=u.el,L(e,t,o)),void n.asyncDep.then(()=>{e.isUnmounted||a()})}let c,h=t;0,io(e,!1),t?(t.el=u.el,L(e,t,o)):t=u,n&&X(n),(c=t.props&&t.props.onVnodeBeforeUpdate)&&fa(c,l,t,u),io(e,!0);const p=Eo(e);0;const f=e.subTree;e.subTree=p,_(f,p,d(f.el),Z(f),e,r,s),t.el=p.el,null===h&&Co(e,p.el),i&&Qs(i,r),(c=t.props&&t.props.onVnodeUpdated)&&Qs(()=>fa(c,l,t,u),r),__VUE_PROD_DEVTOOLS__&&si(e)}else{let o;const{el:a,props:l}=t,{bm:u,m:c,parent:d,root:h,type:p}=e,f=pr(t);if(io(e,!1),u&&X(u),!f&&(o=l&&l.onVnodeBeforeMount)&&fa(o,d,t),io(e,!0),a&&ie){const t=()=>{e.subTree=Eo(e),ie(a,e.subTree,e,r,null)};f&&p.__asyncHydrate?p.__asyncHydrate(a,e,t):t()}else{h.ce&&h.ce._injectChildStyle(p);const o=e.subTree=Eo(e);0,_(null,o,n,i,e,r,s),t.el=o.el}if(c&&Qs(c,r),!f&&(o=l&&l.onVnodeMounted)){const e=t;Qs(()=>fa(o,d,e),r)}(256&t.shapeFlag||d&&pr(d.vnode)&&256&d.vnode.shapeFlag)&&e.a&&Qs(e.a,r),e.isMounted=!0,__VUE_PROD_DEVTOOLS__&&ri(e),t=n=i=null}};e.scope.on();const l=e.effect=new Ne(a);e.scope.off();const u=e.update=l.run.bind(l),c=e.job=l.runIfDirty.bind(l);c.i=e,c.id=e.uid,l.scheduler=()=>Hn(c),io(e,!0),u()},L=(e,t,n)=>{t.component=e;const i=e.vnode.props;e.vnode=t,e.next=null,function(e,t,n,i){const{props:r,attrs:s,vnode:{patchFlag:o}}=e,a=Kt(r),[l]=e.propsOptions;let u=!1;if(!(i||o>0)||16&o){let i;$s(e,t,r,s)&&(u=!0);for(const s in a)t&&(x(t,s)||(i=Y(s))!==s&&x(t,i))||(l?!n||void 0===n[s]&&void 0===n[i]||(r[s]=Us(l,a,s,void 0,e,!0)):delete r[s]);if(s!==a)for(const e in s)t&&x(t,e)||(delete s[e],u=!0)}else if(8&o){const n=e.vnode.dynamicProps;for(let i=0;i<n.length;i++){let o=n[i];if(xo(e.emitsOptions,o))continue;const c=t[o];if(l)if(x(s,o))c!==s[o]&&(s[o]=c,u=!0);else{const t=V(o);r[t]=Us(l,a,t,c,e,!1)}else c!==s[o]&&(s[o]=c,u=!0)}}u&&lt(e.attrs,"set","")}(e,t.props,i,n),Zs(e,t.children,n),Ke(),qn(e),Ze()},B=(e,t,n,i,r,s,o,a,l=!1)=>{const u=e&&e.children,d=e?e.shapeFlag:0,h=t.children,{patchFlag:p,shapeFlag:f}=t;if(p>0){if(128&p)return void U(u,h,n,i,r,s,o,a,l);if(256&p)return void $(u,h,n,i,r,s,o,a,l)}8&f?(16&d&&K(u,r,s),h!==u&&c(n,h)):16&d?16&f?U(u,h,n,i,r,s,o,a,l):K(u,r,s,!0):(8&d&&c(n,""),16&f&&S(h,n,i,r,s,o,a,l))},$=(e,t,n,i,r,s,o,a,l)=>{t=t||f;const u=(e=e||f).length,c=t.length,d=Math.min(u,c);let h;for(h=0;h<d;h++){const i=t[h]=l?da(t[h]):ca(t[h]);_(e[h],i,n,null,r,s,o,a,l)}u>c?K(e,r,s,!0,!1,d):S(t,n,i,r,s,o,a,l,d)},U=(e,t,n,i,r,s,o,a,l)=>{let u=0;const c=t.length;let d=e.length-1,h=c-1;for(;u<=d&&u<=h;){const i=e[u],c=t[u]=l?da(t[u]):ca(t[u]);if(!Qo(i,c))break;_(i,c,n,null,r,s,o,a,l),u++}for(;u<=d&&u<=h;){const i=e[d],u=t[h]=l?da(t[h]):ca(t[h]);if(!Qo(i,u))break;_(i,u,n,null,r,s,o,a,l),d--,h--}if(u>d){if(u<=h){const e=h+1,d=e<c?t[e].el:i;for(;u<=h;)_(null,t[u]=l?da(t[u]):ca(t[u]),n,d,r,s,o,a,l),u++}}else if(u>h)for(;u<=d;)j(e[u],r,s,!0),u++;else{const p=u,m=u,g=new Map;for(u=m;u<=h;u++){const e=t[u]=l?da(t[u]):ca(t[u]);null!=e.key&&g.set(e.key,u)}let y,v=0;const b=h-m+1;let T=!1,x=0;const E=new Array(b);for(u=0;u<b;u++)E[u]=0;for(u=p;u<=d;u++){const i=e[u];if(v>=b){j(i,r,s,!0);continue}let c;if(null!=i.key)c=g.get(i.key);else for(y=m;y<=h;y++)if(0===E[y-m]&&Qo(i,t[y])){c=y;break}void 0===c?j(i,r,s,!0):(E[c-m]=u+1,c>=x?x=c:T=!0,_(i,t[c],n,null,r,s,o,a,l),v++)}const w=T?function(e){const t=e.slice(),n=[0];let i,r,s,o,a;const l=e.length;for(i=0;i<l;i++){const l=e[i];if(0!==l){if(r=n[n.length-1],e[r]<l){t[i]=r,n.push(i);continue}for(s=0,o=n.length-1;s<o;)a=s+o>>1,e[n[a]]<l?s=a+1:o=a;l<e[n[s]]&&(s>0&&(t[i]=n[s-1]),n[s]=i)}}s=n.length,o=n[s-1];for(;s-- >0;)n[s]=o,o=t[o];return n}(E):f;for(y=w.length-1,u=b-1;u>=0;u--){const e=m+u,d=t[e],h=e+1<c?t[e+1].el:i;0===E[u]?_(null,d,n,h,r,s,o,a,l):T&&(y<0||u!==w[y]?z(d,n,h,2):y--)}}},z=(e,t,n,r,s=null)=>{const{el:o,type:a,transition:l,children:u,shapeFlag:c}=e;if(6&c)return void z(e.component.subTree,t,n,r);if(128&c)return void e.suspense.move(t,n,r);if(64&c)return void a.move(e,t,n,te);if(a===Po){i(o,t,n);for(let e=0;e<u.length;e++)z(u[e],t,n,r);return void i(e.anchor,t,n)}if(a===Uo)return void(({el:e,anchor:t},n,r)=>{let s;for(;e&&e!==t;)s=h(e),i(e,n,r),e=s;i(t,n,r)})(e,t,n);if(2!==r&&1&c&&l)if(0===r)l.beforeEnter(o),i(o,t,n),Qs(()=>l.enter(o),s);else{const{leave:e,delayLeave:r,afterLeave:s}=l,a=()=>i(o,t,n),u=()=>{e(o,()=>{a(),s&&s()})};r?r(o,a,u):u()}else i(o,t,n)},j=(e,t,n,i=!1,r=!1)=>{const{type:s,props:o,ref:a,children:l,dynamicChildren:u,shapeFlag:c,patchFlag:d,dirs:h,cacheIndex:p}=e;if(-2===d&&(r=!1),null!=a&&Xi(a,null,n,e,!0),null!=p&&(t.renderCache[p]=void 0),256&c)return void t.ctx.deactivate(e);const f=1&c&&h,m=!pr(e);let g;if(m&&(g=o&&o.onVnodeBeforeUnmount)&&fa(g,t,e),6&c)W(e.component,n,i);else{if(128&c)return void e.suspense.unmount(n,i);f&&yi(e,null,t,"beforeUnmount"),64&c?e.type.remove(e,t,n,te,i):u&&!u.hasOnce&&(s!==Po||d>0&&64&d)?K(u,t,n,!1,!0):(s===Po&&384&d||!r&&16&c)&&K(l,t,n),i&&G(e)}(m&&(g=o&&o.onVnodeUnmounted)||f)&&Qs(()=>{g&&fa(g,t,e),f&&yi(e,null,t,"unmounted")},n)},G=e=>{const{type:t,el:n,anchor:i,transition:s}=e;if(t===Po)return void H(n,i);if(t===Uo)return void E(e);const o=()=>{r(n),s&&!s.persisted&&s.afterLeave&&s.afterLeave()};if(1&e.shapeFlag&&s&&!s.persisted){const{leave:t,delayLeave:i}=s,r=()=>t(n,o);i?i(e.el,o,r):r()}else o()},H=(e,t)=>{let n;for(;e!==t;)n=h(e),r(e),e=n;r(t)},W=(e,t,n)=>{const{bum:i,scope:r,job:s,subTree:o,um:a,m:l,a:u}=e;ao(l),ao(u),i&&X(i),r.stop(),s&&(s.flags|=8,j(o,e,t,n)),a&&Qs(a,t),Qs(()=>{e.isUnmounted=!0},t),t&&t.pendingBranch&&!t.isUnmounted&&e.asyncDep&&!e.asyncResolved&&e.suspenseId===t.pendingId&&(t.deps--,0===t.deps&&t.resolve()),__VUE_PROD_DEVTOOLS__&&ai(e)},K=(e,t,n,i=!1,r=!1,s=0)=>{for(let o=s;o<e.length;o++)j(e[o],t,n,i,r)},Z=e=>{if(6&e.shapeFlag)return Z(e.component.subTree);if(128&e.shapeFlag)return e.suspense.next();const t=h(e.anchor||e.el),n=t&&t[_i];return n?h(n):t};let Q=!1;const ee=(e,t,n)=>{null==e?t._vnode&&j(t._vnode,null,null,!0):_(t._vnode||null,e,t,null,null,null,n),t._vnode=e,Q||(Q=!0,qn(),Kn(),Q=!1)},te={p:_,um:j,m:z,r:G,mt:N,mc:S,pc:B,pbc:O,n:Z,o:e};let ne,ie;return t&&([ne,ie]=t(te)),{render:ee,hydrate:ne,createApp:Rs(ee,ne)}}function no({type:e,props:t},n){return"svg"===n&&"foreignObject"===e||"mathml"===n&&"annotation-xml"===e&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function io({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function ro(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function so(e,t,n=!1){const i=e.children,r=t.children;if(E(i)&&E(r))for(let e=0;e<i.length;e++){const t=i[e];let s=r[e];1&s.shapeFlag&&!s.dynamicChildren&&((s.patchFlag<=0||32===s.patchFlag)&&(s=r[e]=da(r[e]),s.el=t.el),n||-2===s.patchFlag||so(t,s)),s.type===Bo&&(s.el=t.el)}}function oo(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:oo(t)}function ao(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}const lo=Symbol.for("v-scx"),uo=()=>{{const e=Ds(lo);return e}};function co(e,t){return mo(e,null,t)}function ho(e,t){return mo(e,null,{flush:"post"})}function po(e,t){return mo(e,null,{flush:"sync"})}function fo(e,t,n){return mo(e,t,n)}function mo(e,t,n=p){const{immediate:i,deep:r,flush:s,once:o}=n;const a=v({},n);const l=t&&i||!t&&"post"!==s;let u;if(Sa)if("sync"===s){const e=uo();u=e.__watcherHandles||(e.__watcherHandles=[])}else if(!l){const e=()=>{};return e.stop=m,e.resume=m,e.pause=m,e}const c=_a;a.call=(e,t,n)=>Ln(e,c,t,n);let d=!1;"post"===s?a.scheduler=e=>{Qs(e,c&&c.suspense)}:"sync"!==s&&(d=!0,a.scheduler=(e,t)=>{t?e():Hn(e)}),a.augmentJob=e=>{t&&(e.flags|=4),d&&(e.flags|=2,c&&(e.id=c.uid,e.i=c))};const h=function(e,t,n=p){const{immediate:i,deep:r,once:s,scheduler:o,augmentJob:a,call:l}=n,u=e=>r?e:Xt(e)||!1===r||0===r?An(e,1):An(e);let c,d,h,f,g=!1,y=!1;if(en(e)?(d=()=>e.value,g=Xt(e)):Ht(e)?(d=()=>u(e),g=!0):E(e)?(y=!0,g=e.some(e=>Ht(e)||Xt(e)),d=()=>e.map(e=>en(e)?e.value:Ht(e)?u(e):S(e)?l?l(e,2):e():void 0)):d=S(e)?t?l?()=>l(e,2):e:()=>{if(h){Ke();try{h()}finally{Ze()}}const t=En;En=c;try{return l?l(e,3,[f]):e(f)}finally{En=t}}:m,t&&r){const e=d,t=!0===r?1/0:r;d=()=>An(e(),t)}const _=Me(),v=()=>{c.stop(),_&&_.active&&b(_.effects,c)};if(s&&t){const e=t;t=(...t)=>{e(...t),v()}}let T=y?new Array(e.length).fill(Tn):Tn;const x=e=>{if(1&c.flags&&(c.dirty||e))if(t){const e=c.run();if(r||g||(y?e.some((e,t)=>W(e,T[t])):W(e,T))){h&&h();const n=En;En=c;try{const n=[e,T===Tn?void 0:y&&T[0]===Tn?[]:T,f];l?l(t,3,n):t(...n),T=e}finally{En=n}}}else c.run()};return a&&a(x),c=new Ne(d),c.scheduler=o?()=>o(x,!1):x,f=e=>In(e,!1,c),h=c.onStop=()=>{const e=xn.get(c);if(e){if(l)l(e,4);else for(const t of e)t();xn.delete(c)}},t?i?x(!0):T=c.run():o?o(x.bind(null,!0),!0):c.run(),v.pause=c.pause.bind(c),v.resume=c.resume.bind(c),v.stop=v,v}(e,t,a);return Sa&&(u?u.push(h):l&&h()),h}function go(e,t,n){const i=this.proxy,r=C(e)?e.includes(".")?yo(i,e):()=>i[e]:e.bind(i,i);let s;S(t)?s=t:(s=t.handler,n=t);const o=xa(this),a=mo(r,s.bind(i),n);return o(),a}function yo(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}function _o(e,t,n=p){const i=va();const r=V(t);const s=Y(t),o=vo(e,r),a=hn((o,a)=>{let l,u,c=p;return po(()=>{const t=e[r];W(l,t)&&(l=t,a())}),{get:()=>(o(),n.get?n.get(l):l),set(e){const o=n.set?n.set(e):e;if(!(W(o,l)||c!==p&&W(e,c)))return;const d=i.vnode.props;d&&(t in d||r in d||s in d)&&(`onUpdate:${t}`in d||`onUpdate:${r}`in d||`onUpdate:${s}`in d)||(l=e,a()),i.emit(`update:${t}`,o),W(e,o)&&W(e,c)&&!W(o,u)&&a(),c=e,u=o}}});return a[Symbol.iterator]=()=>{let e=0;return{next:()=>e<2?{value:e++?o||p:a,done:!1}:{done:!0}}},a}const vo=(e,t)=>"modelValue"===t||"model-value"===t?e.modelModifiers:e[`${t}Modifiers`]||e[`${V(t)}Modifiers`]||e[`${Y(t)}Modifiers`];function bo(e,t,...n){if(e.isUnmounted)return;const i=e.vnode.props||p;let r=n;const s=t.startsWith("update:"),o=s&&vo(i,t.slice(7));let a;o&&(o.trim&&(r=n.map(e=>C(e)?e.trim():e)),o.number&&(r=n.map(K))),__VUE_PROD_DEVTOOLS__&&function(e,t,n){ni("component:emit",e.appContext.app,e,t,n)}(e,t,r);let l=i[a=H(t)]||i[a=H(V(t))];!l&&s&&(l=i[a=H(Y(t))]),l&&Ln(l,e,6,r);const u=i[a+"Once"];if(u){if(e.emitted){if(e.emitted[a])return}else e.emitted={};e.emitted[a]=!0,Ln(u,e,6,r)}}function To(e,t,n=!1){const i=t.emitsCache,r=i.get(e);if(void 0!==r)return r;const s=e.emits;let o={},a=!1;if(__VUE_OPTIONS_API__&&!S(e)){const i=e=>{const n=To(e,t,!0);n&&(a=!0,v(o,n))};!n&&t.mixins.length&&t.mixins.forEach(i),e.extends&&i(e.extends),e.mixins&&e.mixins.forEach(i)}return s||a?(E(s)?s.forEach(e=>o[e]=null):v(o,s),M(e)&&i.set(e,o),o):(M(e)&&i.set(e,null),null)}function xo(e,t){return!(!e||!y(t))&&(t=t.slice(2).replace(/Once$/,""),x(e,t[0].toLowerCase()+t.slice(1))||x(e,Y(t))||x(e,t))}function Eo(e){const{type:t,vnode:n,proxy:i,withProxy:r,propsOptions:[s],slots:o,attrs:a,emit:l,render:u,renderCache:c,props:d,data:h,setupState:p,ctx:f,inheritAttrs:m}=e,g=di(e);let y,v;try{if(4&n.shapeFlag){const e=r||i,t=e;y=ca(u.call(t,e,c,d,p,h,f)),v=a}else{const e=t;0,y=ca(e.length>1?e(d,{attrs:a,slots:o,emit:l}):e(d,null)),v=t.props?a:Io(a)}}catch(t){zo.length=0,Pn(t,e,1),y=ia($o)}let b=y;if(v&&!1!==m){const e=Object.keys(v),{shapeFlag:t}=b;e.length&&7&t&&(s&&e.some(_)&&(v=Ao(v,s)),b=oa(b,v,!1,!0))}return n.dirs&&(b=oa(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&Vi(b,n.transition),y=b,di(g),y}function wo(e,t=!0){let n;for(let t=0;t<e.length;t++){const i=e[t];if(!Zo(i))return;if(i.type!==$o||"v-if"===i.children){if(n)return;n=i}}return n}const Io=e=>{let t;for(const n in e)("class"===n||"style"===n||y(n))&&((t||(t={}))[n]=e[n]);return t},Ao=(e,t)=>{const n={};for(const i in e)_(i)&&i.slice(9)in t||(n[i]=e[i]);return n};function So(e,t,n){const i=Object.keys(t);if(i.length!==Object.keys(e).length)return!0;for(let r=0;r<i.length;r++){const s=i[r];if(t[s]!==e[s]&&!xo(n,s))return!0}return!1}function Co({vnode:e,parent:t},n){for(;t;){const i=t.subTree;if(i.suspense&&i.suspense.activeBranch===e&&(i.el=e.el),i!==e)break;(e=t.vnode).el=n,t=t.parent}}const Oo=e=>e.__isSuspense;let Mo=0;const Ro={name:"Suspense",__isSuspense:!0,process(e,t,n,i,r,s,o,a,l,u){if(null==e)!function(e,t,n,i,r,s,o,a,l){const{p:u,o:{createElement:c}}=l,d=c("div"),h=e.suspense=No(e,r,i,t,d,n,s,o,a,l);u(null,h.pendingBranch=e.ssContent,d,null,i,h,s,o),h.deps>0?(ko(e,"onPending"),ko(e,"onFallback"),u(null,e.ssFallback,t,n,i,null,s,o),Lo(h,e.ssFallback)):h.resolve(!1,!0)}(t,n,i,r,s,o,a,l,u);else{if(s&&s.deps>0&&!e.suspense.isInFallback)return t.suspense=e.suspense,t.suspense.vnode=t,void(t.el=e.el);!function(e,t,n,i,r,s,o,a,{p:l,um:u,o:{createElement:c}}){const d=t.suspense=e.suspense;d.vnode=t,t.el=e.el;const h=t.ssContent,p=t.ssFallback,{activeBranch:f,pendingBranch:m,isInFallback:g,isHydrating:y}=d;if(m)d.pendingBranch=h,Qo(h,m)?(l(m,h,d.hiddenContainer,null,r,d,s,o,a),d.deps<=0?d.resolve():g&&(y||(l(f,p,n,i,r,null,s,o,a),Lo(d,p)))):(d.pendingId=Mo++,y?(d.isHydrating=!1,d.activeBranch=m):u(m,r,d),d.deps=0,d.effects.length=0,d.hiddenContainer=c("div"),g?(l(null,h,d.hiddenContainer,null,r,d,s,o,a),d.deps<=0?d.resolve():(l(f,p,n,i,r,null,s,o,a),Lo(d,p))):f&&Qo(h,f)?(l(f,h,n,i,r,d,s,o,a),d.resolve(!0)):(l(null,h,d.hiddenContainer,null,r,d,s,o,a),d.deps<=0&&d.resolve()));else if(f&&Qo(h,f))l(f,h,n,i,r,d,s,o,a),Lo(d,h);else if(ko(t,"onPending"),d.pendingBranch=h,512&h.shapeFlag?d.pendingId=h.component.suspenseId:d.pendingId=Mo++,l(null,h,d.hiddenContainer,null,r,d,s,o,a),d.deps<=0)d.resolve();else{const{timeout:e,pendingId:t}=d;e>0?setTimeout(()=>{d.pendingId===t&&d.fallback(p)},e):0===e&&d.fallback(p)}}(e,t,n,i,r,o,a,l,u)}},hydrate:function(e,t,n,i,r,s,o,a,l){const u=t.suspense=No(t,i,n,e.parentNode,document.createElement("div"),null,r,s,o,a,!0),c=l(e,u.pendingBranch=t.ssContent,n,u,s,o);0===u.deps&&u.resolve(!1,!0);return c},normalize:function(e){const{shapeFlag:t,children:n}=e,i=32&t;e.ssContent=Do(i?n.default:n),e.ssFallback=i?Do(n.fallback):ia($o)}};function ko(e,t){const n=e.props&&e.props[t];S(n)&&n()}function No(e,t,n,i,r,s,o,a,l,u,c=!1){const{p:d,m:h,um:p,n:f,o:{parentNode:m,remove:g}}=u;let y;const _=function(e){const t=e.props&&e.props.suspensible;return null!=t&&!1!==t}(e);_&&t&&t.pendingBranch&&(y=t.pendingId,t.deps++);const v=e.props?Z(e.props.timeout):void 0;const b=s,T={vnode:e,parent:t,parentComponent:n,namespace:o,container:i,hiddenContainer:r,deps:0,pendingId:Mo++,timeout:"number"==typeof v?v:-1,activeBranch:null,pendingBranch:null,isInFallback:!c,isHydrating:c,isUnmounted:!1,effects:[],resolve(e=!1,n=!1){const{vnode:i,activeBranch:r,pendingBranch:o,pendingId:a,effects:l,parentComponent:u,container:c}=T;let d=!1;T.isHydrating?T.isHydrating=!1:e||(d=r&&o.transition&&"out-in"===o.transition.mode,d&&(r.transition.afterLeave=()=>{a===T.pendingId&&(h(o,c,s===b?f(r):s,0),Xn(l))}),r&&(m(r.el)===c&&(s=f(r)),p(r,u,T,!0)),d||h(o,c,s,0)),Lo(T,o),T.pendingBranch=null,T.isInFallback=!1;let g=T.parent,v=!1;for(;g;){if(g.pendingBranch){g.effects.push(...l),v=!0;break}g=g.parent}v||d||Xn(l),T.effects=[],_&&t&&t.pendingBranch&&y===t.pendingId&&(t.deps--,0!==t.deps||n||t.resolve()),ko(i,"onResolve")},fallback(e){if(!T.pendingBranch)return;const{vnode:t,activeBranch:n,parentComponent:i,container:r,namespace:s}=T;ko(t,"onFallback");const o=f(n),u=()=>{T.isInFallback&&(d(null,e,r,o,i,null,s,a,l),Lo(T,e))},c=e.transition&&"out-in"===e.transition.mode;c&&(n.transition.afterLeave=u),T.isInFallback=!0,p(n,i,null,!0),c||u()},move(e,t,n){T.activeBranch&&h(T.activeBranch,e,t,n),T.container=e},next:()=>T.activeBranch&&f(T.activeBranch),registerDep(e,t,n){const i=!!T.pendingBranch;i&&T.deps++;const r=e.vnode.el;e.asyncDep.catch(t=>{Pn(t,e,0)}).then(s=>{if(e.isUnmounted||T.isUnmounted||T.pendingId!==e.suspenseId)return;e.asyncResolved=!0;const{vnode:a}=e;Oa(e,s,!1),r&&(a.el=r);const l=!r&&e.subTree.el;t(e,a,m(r||e.subTree.el),r?null:f(e.subTree),T,o,n),l&&g(l),Co(e,a.el),i&&0===--T.deps&&T.resolve()})},unmount(e,t){T.isUnmounted=!0,T.activeBranch&&p(T.activeBranch,n,e,t),T.pendingBranch&&p(T.pendingBranch,n,e,t)}};return T}function Do(e){let t;if(S(e)){const n=Ho&&e._c;n&&(e._d=!1,jo()),e=e(),n&&(e._d=!0,t=Vo,Yo())}if(E(e)){const t=wo(e);0,e=t}return e=ca(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(t=>t!==e)),e}function Fo(e,t){t&&t.pendingBranch?E(e)?t.effects.push(...e):t.effects.push(e):Xn(e)}function Lo(e,t){e.activeBranch=t;const{vnode:n,parentComponent:i}=e;let r=t.el;for(;!r&&t.component;)r=(t=t.component.subTree).el;n.el=r,i&&i.subTree===n&&(i.vnode.el=r,Co(i,r))}const Po=Symbol.for("v-fgt"),Bo=Symbol.for("v-txt"),$o=Symbol.for("v-cmt"),Uo=Symbol.for("v-stc"),zo=[];let Vo=null;function jo(e=!1){zo.push(Vo=e?null:[])}function Yo(){zo.pop(),Vo=zo[zo.length-1]||null}let Go,Ho=1;function Wo(e,t=!1){Ho+=e,e<0&&Vo&&t&&(Vo.hasOnce=!0)}function Xo(e){return e.dynamicChildren=Ho>0?Vo||f:null,Yo(),Ho>0&&Vo&&Vo.push(e),e}function qo(e,t,n,i,r,s){return Xo(na(e,t,n,i,r,s,!0))}function Ko(e,t,n,i,r){return Xo(ia(e,t,n,i,r,!0))}function Zo(e){return!!e&&!0===e.__v_isVNode}function Qo(e,t){return e.type===t.type&&e.key===t.key}function Jo(e){Go=e}const ea=({key:e})=>null!=e?e:null,ta=({ref:e,ref_key:t,ref_for:n})=>("number"==typeof e&&(e=""+e),null!=e?C(e)||en(e)||S(e)?{i:ui,r:e,k:t,f:!!n}:e:null);function na(e,t=null,n=null,i=0,r=null,s=(e===Po?0:1),o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ea(t),ref:t&&ta(t),scopeId:ci,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:i,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:ui};return a?(ha(l,n),128&s&&e.normalize(l)):n&&(l.shapeFlag|=C(n)?8:16),Ho>0&&!o&&Vo&&(l.patchFlag>0||6&s)&&32!==l.patchFlag&&Vo.push(l),l}const ia=ra;function ra(e,t=null,n=null,i=0,r=null,s=!1){if(e&&e!==zr||(e=$o),Zo(e)){const i=oa(e,t,!0);return n&&ha(i,n),Ho>0&&!s&&Vo&&(6&i.shapeFlag?Vo[Vo.indexOf(e)]=i:Vo.push(i)),i.patchFlag=-2,i}if(Ua(e)&&(e=e.__vccOpts),t){t=sa(t);let{class:e,style:n}=t;e&&!C(e)&&(t.class=oe(e)),M(n)&&(qt(n)&&!E(n)&&(n=v({},n)),t.style=te(n))}return na(e,t,n,i,r,C(e)?1:Oo(e)?128:vi(e)?64:M(e)?4:S(e)?2:0,s,!0)}function sa(e){return e?qt(e)||Bs(e)?v({},e):e:null}function oa(e,t,n=!1,i=!1){const{props:r,ref:s,patchFlag:o,children:a,transition:l}=e,u=t?pa(r||{},t):r,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&ea(u),ref:t&&t.ref?n&&s?E(s)?s.concat(ta(t)):[s,ta(t)]:ta(t):s,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Po?-1===o?16:16|o:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&oa(e.ssContent),ssFallback:e.ssFallback&&oa(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&i&&Vi(c,l.clone(c)),c}function aa(e=" ",t=0){return ia(Bo,null,e,t)}function la(e,t){const n=ia(Uo,null,e);return n.staticCount=t,n}function ua(e="",t=!1){return t?(jo(),Ko($o,null,e)):ia($o,null,e)}function ca(e){return null==e||"boolean"==typeof e?ia($o):E(e)?ia(Po,null,e.slice()):Zo(e)?da(e):ia(Bo,null,String(e))}function da(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:oa(e)}function ha(e,t){let n=0;const{shapeFlag:i}=e;if(null==t)t=null;else if(E(t))n=16;else if("object"==typeof t){if(65&i){const n=t.default;return void(n&&(n._c&&(n._d=!1),ha(e,n()),n._c&&(n._d=!0)))}{n=32;const i=t._;i||Bs(t)?3===i&&ui&&(1===ui.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=ui}}else S(t)?(t={default:t,_ctx:ui},n=32):(t=String(t),64&i?(n=16,t=[aa(t)]):n=8);e.children=t,e.shapeFlag|=n}function pa(...e){const t={};for(let n=0;n<e.length;n++){const i=e[n];for(const e in i)if("class"===e)t.class!==i.class&&(t.class=oe([t.class,i.class]));else if("style"===e)t.style=te([t.style,i.style]);else if(y(e)){const n=t[e],r=i[e];!r||n===r||E(n)&&n.includes(r)||(t[e]=n?[].concat(n,r):r)}else""!==e&&(t[e]=i[e])}return t}function fa(e,t,n,i=null){Ln(e,t,7,[n,i])}const ma=Os();let ga=0;function ya(e,t,n){const i=e.type,r=(t?t.appContext:e.appContext)||ma,s={uid:ga++,vnode:e,type:i,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Ce(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Vs(i,r),emitsOptions:To(i,r),emit:null,emitted:null,propsDefaults:p,inheritAttrs:i.inheritAttrs,ctx:p,data:p,props:p,attrs:p,slots:p,refs:p,setupState:p,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=t?t.root:s,s.emit=bo.bind(null,s),e.ce&&e.ce(s),s}let _a=null;const va=()=>_a||ui;let ba,Ta;{const e=J(),t=(t,n)=>{let i;return(i=e[t])||(i=e[t]=[]),i.push(n),e=>{i.length>1?i.forEach(t=>t(e)):i[0](e)}};ba=t("__VUE_INSTANCE_SETTERS__",e=>_a=e),Ta=t("__VUE_SSR_SETTERS__",e=>Sa=e)}const xa=e=>{const t=_a;return ba(e),e.scope.on(),()=>{e.scope.off(),ba(t)}},Ea=()=>{_a&&_a.scope.off(),ba(null)};function wa(e){return 4&e.vnode.shapeFlag}let Ia,Aa,Sa=!1;function Ca(e,t=!1,n=!1){t&&Ta(t);const{props:i,children:r}=e.vnode,s=wa(e);!function(e,t,n,i=!1){const r={},s=Ps();e.propsDefaults=Object.create(null),$s(e,t,r,s);for(const t in e.propsOptions[0])t in r||(r[t]=void 0);n?e.props=i?r:Vt(r):e.type.props?e.props=r:e.props=s,e.attrs=s}(e,i,s,t),Ks(e,r,n);const o=s?function(e,t){const n=e.type;0;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,es),!1;const{setup:i}=n;if(i){Ke();const n=e.setupContext=i.length>1?Da(e):null,r=xa(e),s=Fn(i,e,0,[e.props,n]),o=R(s);if(Ze(),r(),!o&&!e.sp||pr(e)||Hi(e),o){if(s.then(Ea,Ea),t)return s.then(n=>{Oa(e,n,t)}).catch(t=>{Pn(t,e,0)});e.asyncDep=s}else Oa(e,s,t)}else ka(e,t)}(e,t):void 0;return t&&Ta(!1),o}function Oa(e,t,n){S(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:M(t)&&(__VUE_PROD_DEVTOOLS__&&(e.devtoolsRawSetupState=t),e.setupState=cn(t)),ka(e,n)}function Ma(e){Ia=e,Aa=e=>{e.render._rc&&(e.withProxy=new Proxy(e.ctx,ts))}}const Ra=()=>!Ia;function ka(e,t,n){const i=e.type;if(!e.render){if(!t&&Ia&&!i.render){const t=i.template||__VUE_OPTIONS_API__&&Ts(e).template;if(t){0;const{isCustomElement:n,compilerOptions:r}=e.appContext.config,{delimiters:s,compilerOptions:o}=i,a=v(v({isCustomElement:n,delimiters:s},r),o);i.render=Ia(t,a)}}e.render=i.render||m,Aa&&Aa(e)}if(__VUE_OPTIONS_API__){const t=xa(e);Ke();try{_s(e)}finally{Ze(),t()}}}const Na={get:(e,t)=>(at(e,0,""),e[t])};function Da(e){const t=t=>{e.exposed=t||{}};return{attrs:new Proxy(e.attrs,Na),slots:e.slots,emit:e.emit,expose:t}}function Fa(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(cn(Zt(e.exposed)),{get:(t,n)=>n in t?t[n]:n in Qr?Qr[n](e):void 0,has:(e,t)=>t in e||t in Qr})):e.proxy}const La=/(?:^|[-_])(\w)/g,Pa=e=>e.replace(La,e=>e.toUpperCase()).replace(/[-_]/g,"");function Ba(e,t=!0){return S(e)?e.displayName||e.name:e.name||t&&e.__name}function $a(e,t,n=!1){let i=Ba(t);if(!i&&t.__file){const e=t.__file.match(/([^/\\]+)\.\w+$/);e&&(i=e[1])}if(!i&&e&&e.parent){const n=e=>{for(const n in e)if(e[n]===t)return n};i=n(e.components||e.parent.type.components)||n(e.appContext.components)}return i?Pa(i):n?"App":"Anonymous"}function Ua(e){return S(e)&&"__vccOpts"in e}const za=(e,t)=>{const n=function(e,t,n=!1){let i,r;return S(e)?i=e:(i=e.get,r=e.set),new _n(i,r,n)}(e,0,Sa);return n};function Va(e,t,n){const i=arguments.length;return 2===i?M(t)&&!E(t)?Zo(t)?ia(e,null,[t]):ia(e,t):ia(e,null,t):(i>3?n=Array.prototype.slice.call(arguments,2):3===i&&Zo(n)&&(n=[n]),ia(e,t,n))}function ja(){return void 0}function Ya(e,t,n,i){const r=n[i];if(r&&Ga(r,e))return r;const s=t();return s.memo=e.slice(),s.cacheIndex=i,n[i]=s}function Ga(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(W(n[e],t[e]))return!1;return Ho>0&&Vo&&Vo.push(e),!0}const Ha="3.5.13",Wa=m,Xa=Dn,qa=Jn,Ka=ii,Za={createComponentInstance:ya,setupComponent:Ca,renderComponentRoot:Eo,setCurrentRenderingInstance:di,isVNode:Zo,normalizeVNode:ca,getComponentPublicInstance:Fa,ensureValidVNode:qr,pushWarningContext:function(e){Sn.push(e)},popWarningContext:function(){Sn.pop()}},Qa=null,Ja=null,el=null;
/**
* @vue/runtime-dom v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
let tl;const nl="undefined"!=typeof window&&window.trustedTypes;if(nl)try{tl=nl.createPolicy("vue",{createHTML:e=>e})}catch(e){}const il=tl?e=>tl.createHTML(e):e=>e,rl="undefined"!=typeof document?document:null,sl=rl&&rl.createElement("template"),ol={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,i)=>{const r="svg"===t?rl.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?rl.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?rl.createElement(e,{is:n}):rl.createElement(e);return"select"===e&&i&&null!=i.multiple&&r.setAttribute("multiple",i.multiple),r},createText:e=>rl.createTextNode(e),createComment:e=>rl.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>rl.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,i,r,s){const o=n?n.previousSibling:t.lastChild;if(r&&(r===s||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),r!==s&&(r=r.nextSibling););else{sl.innerHTML=il("svg"===i?`<svg>${e}</svg>`:"mathml"===i?`<math>${e}</math>`:e);const r=sl.content;if("svg"===i||"mathml"===i){const e=r.firstChild;for(;e.firstChild;)r.appendChild(e.firstChild);r.removeChild(e)}t.insertBefore(r,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},al="transition",ll="animation",ul=Symbol("_vtc"),cl={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},dl=v({},Di,cl),hl=(e=>(e.displayName="Transition",e.props=dl,e))((e,{slots:t})=>Va(Pi,ml(e),t)),pl=(e,t=[])=>{E(e)?e.forEach(e=>e(...t)):e&&e(...t)},fl=e=>!!e&&(E(e)?e.some(e=>e.length>1):e.length>1);function ml(e){const t={};for(const n in e)n in cl||(t[n]=e[n]);if(!1===e.css)return t;const{name:n="v",type:i,duration:r,enterFromClass:s=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=s,appearActiveClass:u=o,appearToClass:c=a,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,f=function(e){if(null==e)return null;if(M(e))return[gl(e.enter),gl(e.leave)];{const t=gl(e);return[t,t]}}(r),m=f&&f[0],g=f&&f[1],{onBeforeEnter:y,onEnter:_,onEnterCancelled:b,onLeave:T,onLeaveCancelled:x,onBeforeAppear:E=y,onAppear:w=_,onAppearCancelled:I=b}=t,A=(e,t,n,i)=>{e._enterCancelled=i,_l(e,t?c:a),_l(e,t?u:o),n&&n()},S=(e,t)=>{e._isLeaving=!1,_l(e,d),_l(e,p),_l(e,h),t&&t()},C=e=>(t,n)=>{const r=e?w:_,o=()=>A(t,e,n);pl(r,[t,o]),vl(()=>{_l(t,e?l:s),yl(t,e?c:a),fl(r)||Tl(t,i,m,o)})};return v(t,{onBeforeEnter(e){pl(y,[e]),yl(e,s),yl(e,o)},onBeforeAppear(e){pl(E,[e]),yl(e,l),yl(e,u)},onEnter:C(!1),onAppear:C(!0),onLeave(e,t){e._isLeaving=!0;const n=()=>S(e,t);yl(e,d),e._enterCancelled?(yl(e,h),Il()):(Il(),yl(e,h)),vl(()=>{e._isLeaving&&(_l(e,d),yl(e,p),fl(T)||Tl(e,i,g,n))}),pl(T,[e,n])},onEnterCancelled(e){A(e,!1,void 0,!0),pl(b,[e])},onAppearCancelled(e){A(e,!0,void 0,!0),pl(I,[e])},onLeaveCancelled(e){S(e),pl(x,[e])}})}function gl(e){return Z(e)}function yl(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[ul]||(e[ul]=new Set)).add(t)}function _l(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));const n=e[ul];n&&(n.delete(t),n.size||(e[ul]=void 0))}function vl(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let bl=0;function Tl(e,t,n,i){const r=e._endId=++bl,s=()=>{r===e._endId&&i()};if(null!=n)return setTimeout(s,n);const{type:o,timeout:a,propCount:l}=xl(e,t);if(!o)return i();const u=o+"end";let c=0;const d=()=>{e.removeEventListener(u,h),s()},h=t=>{t.target===e&&++c>=l&&d()};setTimeout(()=>{c<l&&d()},a+1),e.addEventListener(u,h)}function xl(e,t){const n=window.getComputedStyle(e),i=e=>(n[e]||"").split(", "),r=i(`${al}Delay`),s=i(`${al}Duration`),o=El(r,s),a=i(`${ll}Delay`),l=i(`${ll}Duration`),u=El(a,l);let c=null,d=0,h=0;t===al?o>0&&(c=al,d=o,h=s.length):t===ll?u>0&&(c=ll,d=u,h=l.length):(d=Math.max(o,u),c=d>0?o>u?al:ll:null,h=c?c===al?s.length:l.length:0);return{type:c,timeout:d,propCount:h,hasTransform:c===al&&/\b(transform|all)(,|$)/.test(i(`${al}Property`).toString())}}function El(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>wl(t)+wl(e[n])))}function wl(e){return"auto"===e?0:1e3*Number(e.slice(0,-1).replace(",","."))}function Il(){return document.body.offsetHeight}const Al=Symbol("_vod"),Sl=Symbol("_vsh"),Cl={beforeMount(e,{value:t},{transition:n}){e[Al]="none"===e.style.display?"":e.style.display,n&&t?n.beforeEnter(e):Ol(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:i}){!t!=!n&&(i?t?(i.beforeEnter(e),Ol(e,!0),i.enter(e)):i.leave(e,()=>{Ol(e,!1)}):Ol(e,t))},beforeUnmount(e,{value:t}){Ol(e,t)}};function Ol(e,t){e.style.display=t?e[Al]:"none",e[Sl]=!t}const Ml=Symbol("");function Rl(e){const t=va();if(!t)return;const n=t.ut=(n=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(e=>Nl(e,n))};const i=()=>{const i=e(t.proxy);t.ce?Nl(t.ce,i):kl(t.subTree,i),n(i)};Mr(()=>{Xn(i)}),Or(()=>{fo(i,m,{flush:"post"});const e=new MutationObserver(i);e.observe(t.subTree.el.parentNode,{childList:!0}),Nr(()=>e.disconnect())})}function kl(e,t){if(128&e.shapeFlag){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{kl(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(1&e.shapeFlag&&e.el)Nl(e.el,t);else if(e.type===Po)e.children.forEach(e=>kl(e,t));else if(e.type===Uo){let{el:n,anchor:i}=e;for(;n&&(Nl(n,t),n!==i);)n=n.nextSibling}}function Nl(e,t){if(1===e.nodeType){const n=e.style;let i="";for(const e in t)n.setProperty(`--${e}`,t[e]),i+=`--${e}: ${t[e]};`;n[Ml]=i}}const Dl=/(^|;)\s*display\s*:/;const Fl=/\s*!important$/;function Ll(e,t,n){if(E(n))n.forEach(n=>Ll(e,t,n));else if(null==n&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const i=function(e,t){const n=Bl[t];if(n)return n;let i=V(t);if("filter"!==i&&i in e)return Bl[t]=i;i=G(i);for(let n=0;n<Pl.length;n++){const r=Pl[n]+i;if(r in e)return Bl[t]=r}return t}(e,t);Fl.test(n)?e.setProperty(Y(i),n.replace(Fl,""),"important"):e[i]=n}}const Pl=["Webkit","Moz","ms"],Bl={};const $l="http://www.w3.org/1999/xlink";function Ul(e,t,n,i,r,s=pe(t)){i&&t.startsWith("xlink:")?null==n?e.removeAttributeNS($l,t.slice(6,t.length)):e.setAttributeNS($l,t,n):null==n||s&&!me(n)?e.removeAttribute(t):e.setAttribute(t,s?"":O(n)?String(n):n)}function zl(e,t,n,i,r){if("innerHTML"===t||"textContent"===t)return void(null!=n&&(e[t]="innerHTML"===t?il(n):n));const s=e.tagName;if("value"===t&&"PROGRESS"!==s&&!s.includes("-")){const i="OPTION"===s?e.getAttribute("value")||"":e.value,r=null==n?"checkbox"===e.type?"on":"":String(n);return i===r&&"_value"in e||(e.value=r),null==n&&e.removeAttribute(t),void(e._value=n)}let o=!1;if(""===n||null==n){const i=typeof e[t];"boolean"===i?n=me(n):null==n&&"string"===i?(n="",o=!0):"number"===i&&(n=0,o=!0)}try{e[t]=n}catch(e){0}o&&e.removeAttribute(r||t)}function Vl(e,t,n,i){e.addEventListener(t,n,i)}const jl=Symbol("_vei");function Yl(e,t,n,i,r=null){const s=e[jl]||(e[jl]={}),o=s[t];if(i&&o)o.value=i;else{const[n,a]=function(e){let t;if(Gl.test(e)){let n;for(t={};n=e.match(Gl);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}const n=":"===e[2]?e.slice(3):Y(e.slice(2));return[n,t]}(t);if(i){const o=s[t]=function(e,t){const n=e=>{if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();Ln(function(e,t){if(E(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}return t}(e,n.value),t,5,[e])};return n.value=e,n.attached=Xl(),n}(i,r);Vl(e,n,o,a)}else o&&(!function(e,t,n,i){e.removeEventListener(t,n,i)}(e,n,o,a),s[t]=void 0)}}const Gl=/(?:Once|Passive|Capture)$/;let Hl=0;const Wl=Promise.resolve(),Xl=()=>Hl||(Wl.then(()=>Hl=0),Hl=Date.now());const ql=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123;const Kl={};
/*! #__NO_SIDE_EFFECTS__ */function Zl(e,t,n){const i=Yi(e,t);F(i)&&v(i,t);class r extends eu{constructor(e){super(i,e,n)}}return r.def=i,r}
/*! #__NO_SIDE_EFFECTS__ */const Ql=(e,t)=>Zl(e,t,zu),Jl="undefined"!=typeof HTMLElement?HTMLElement:class{};class eu extends Jl{constructor(e,t={},n=Uu){super(),this._def=e,this._props=t,this._createApp=n,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._ob=null,this.shadowRoot&&n!==Uu?this._root=this.shadowRoot:!1!==e.shadowRoot?(this.attachShadow({mode:"open"}),this._root=this.shadowRoot):this._root=this,this._def.__asyncLoader||this._resolveProps(this._def)}connectedCallback(){if(!this.isConnected)return;this.shadowRoot||this._parseSlots(),this._connected=!0;let e=this;for(;e=e&&(e.parentNode||e.host);)if(e instanceof eu){this._parent=e;break}this._instance||(this._resolved?(this._setParent(),this._update()):e&&e._pendingResolve?this._pendingResolve=e._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(e=this._parent){e&&(this._instance.parent=e._instance,this._instance.provides=e._instance.provides)}disconnectedCallback(){this._connected=!1,Gn(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null)})}_resolveDef(){if(this._pendingResolve)return;for(let e=0;e<this.attributes.length;e++)this._setAttr(this.attributes[e].name);this._ob=new MutationObserver(e=>{for(const t of e)this._setAttr(t.attributeName)}),this._ob.observe(this,{attributes:!0});const e=(e,t=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:n,styles:i}=e;let r;if(n&&!E(n))for(const e in n){const t=n[e];(t===Number||t&&t.type===Number)&&(e in this._props&&(this._props[e]=Z(this._props[e])),(r||(r=Object.create(null)))[V(e)]=!0)}this._numberProps=r,t&&this._resolveProps(e),this.shadowRoot&&this._applyStyles(i),this._mount(e)},t=this._def.__asyncLoader;t?this._pendingResolve=t().then(t=>e(this._def=t,!0)):e(this._def)}_mount(e){__VUE_PROD_DEVTOOLS__&&!e.name&&(e.name="VueElement"),this._app=this._createApp(e),e.configureApp&&e.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const t=this._instance&&this._instance.exposed;if(t)for(const e in t)x(this,e)||Object.defineProperty(this,e,{get:()=>an(t[e])})}_resolveProps(e){const{props:t}=e,n=E(t)?t:Object.keys(t||{});for(const e of Object.keys(this))"_"!==e[0]&&n.includes(e)&&this._setProp(e,this[e]);for(const e of n.map(V))Object.defineProperty(this,e,{get(){return this._getProp(e)},set(t){this._setProp(e,t,!0,!0)}})}_setAttr(e){if(e.startsWith("data-v-"))return;const t=this.hasAttribute(e);let n=t?this.getAttribute(e):Kl;const i=V(e);t&&this._numberProps&&this._numberProps[i]&&(n=Z(n)),this._setProp(i,n,!1,!0)}_getProp(e){return this._props[e]}_setProp(e,t,n=!0,i=!1){if(t!==this._props[e]&&(t===Kl?delete this._props[e]:(this._props[e]=t,"key"===e&&this._app&&(this._app._ceVNode.key=t)),i&&this._instance&&this._update(),n)){const n=this._ob;n&&n.disconnect(),!0===t?this.setAttribute(Y(e),""):"string"==typeof t||"number"==typeof t?this.setAttribute(Y(e),t+""):t||this.removeAttribute(Y(e)),n&&n.observe(this,{attributes:!0})}}_update(){Bu(this._createVNode(),this._root)}_createVNode(){const e={};this.shadowRoot||(e.onVnodeMounted=e.onVnodeUpdated=this._renderSlots.bind(this));const t=ia(this._def,v(e,this._props));return this._instance||(t.ce=e=>{this._instance=e,e.ce=this,e.isCE=!0;const t=(e,t)=>{this.dispatchEvent(new CustomEvent(e,F(t[0])?v({detail:t},t[0]):{detail:t}))};e.emit=(e,...n)=>{t(e,n),Y(e)!==e&&t(Y(e),n)},this._setParent()}),t}_applyStyles(e,t){if(!e)return;if(t){if(t===this._def||this._styleChildren.has(t))return;this._styleChildren.add(t)}const n=this._nonce;for(let t=e.length-1;t>=0;t--){const i=document.createElement("style");n&&i.setAttribute("nonce",n),i.textContent=e[t],this.shadowRoot.prepend(i)}}_parseSlots(){const e=this._slots={};let t;for(;t=this.firstChild;){const n=1===t.nodeType&&t.getAttribute("slot")||"default";(e[n]||(e[n]=[])).push(t),this.removeChild(t)}}_renderSlots(){const e=(this._teleportTarget||this).querySelectorAll("slot"),t=this._instance.type.__scopeId;for(let n=0;n<e.length;n++){const i=e[n],r=i.getAttribute("name")||"default",s=this._slots[r],o=i.parentNode;if(s)for(const e of s){if(t&&1===e.nodeType){const n=t+"-s",i=document.createTreeWalker(e,1);let r;for(e.setAttribute(n,"");r=i.nextNode();)r.setAttribute(n,"")}o.insertBefore(e,i)}else for(;i.firstChild;)o.insertBefore(i.firstChild,i);o.removeChild(i)}}_injectChildStyle(e){this._applyStyles(e.styles,e)}_removeChildStyle(e){0}}function tu(e){const t=va(),n=t&&t.ce;return n||null}function nu(){const e=tu();return e&&e.shadowRoot}function iu(e="$style"){{const t=va();if(!t)return p;const n=t.type.__cssModules;if(!n)return p;const i=n[e];return i||p}}const ru=new WeakMap,su=new WeakMap,ou=Symbol("_moveCb"),au=Symbol("_enterCb"),lu=(e=>(delete e.props.mode,e))({name:"TransitionGroup",props:v({},dl,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=va(),i=ki();let r,s;return Rr(()=>{if(!r.length)return;const t=e.moveClass||`${e.name||"v"}-move`;if(!function(e,t,n){const i=e.cloneNode(),r=e[ul];r&&r.forEach(e=>{e.split(/\s+/).forEach(e=>e&&i.classList.remove(e))});n.split(/\s+/).forEach(e=>e&&i.classList.add(e)),i.style.display="none";const s=1===t.nodeType?t:t.parentNode;s.appendChild(i);const{hasTransform:o}=xl(i);return s.removeChild(i),o}(r[0].el,n.vnode.el,t))return;r.forEach(cu),r.forEach(du);const i=r.filter(hu);Il(),i.forEach(e=>{const n=e.el,i=n.style;yl(n,t),i.transform=i.webkitTransform=i.transitionDuration="";const r=n[ou]=e=>{e&&e.target!==n||e&&!/transform$/.test(e.propertyName)||(n.removeEventListener("transitionend",r),n[ou]=null,_l(n,t))};n.addEventListener("transitionend",r)})}),()=>{const o=Kt(e),a=ml(o);let l=o.tag||Po;if(r=[],s)for(let e=0;e<s.length;e++){const t=s[e];t.el&&t.el instanceof Element&&(r.push(t),Vi(t,$i(t,a,i,n)),ru.set(t,t.el.getBoundingClientRect()))}s=t.default?ji(t.default()):[];for(let e=0;e<s.length;e++){const t=s[e];null!=t.key&&Vi(t,$i(t,a,i,n))}return ia(l,null,s)}}}),uu=lu;function cu(e){const t=e.el;t[ou]&&t[ou](),t[au]&&t[au]()}function du(e){su.set(e,e.el.getBoundingClientRect())}function hu(e){const t=ru.get(e),n=su.get(e),i=t.left-n.left,r=t.top-n.top;if(i||r){const t=e.el.style;return t.transform=t.webkitTransform=`translate(${i}px,${r}px)`,t.transitionDuration="0s",e}}const pu=e=>{const t=e.props["onUpdate:modelValue"]||!1;return E(t)?e=>X(t,e):t};function fu(e){e.target.composing=!0}function mu(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const gu=Symbol("_assign"),yu={created(e,{modifiers:{lazy:t,trim:n,number:i}},r){e[gu]=pu(r);const s=i||r.props&&"number"===r.props.type;Vl(e,t?"change":"input",t=>{if(t.target.composing)return;let i=e.value;n&&(i=i.trim()),s&&(i=K(i)),e[gu](i)}),n&&Vl(e,"change",()=>{e.value=e.value.trim()}),t||(Vl(e,"compositionstart",fu),Vl(e,"compositionend",mu),Vl(e,"change",mu))},mounted(e,{value:t}){e.value=null==t?"":t},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:i,trim:r,number:s}},o){if(e[gu]=pu(o),e.composing)return;const a=null==t?"":t;if((!s&&"number"!==e.type||/^0\d/.test(e.value)?e.value:K(e.value))!==a){if(document.activeElement===e&&"range"!==e.type){if(i&&t===n)return;if(r&&e.value.trim()===a)return}e.value=a}}},_u={deep:!0,created(e,t,n){e[gu]=pu(n),Vl(e,"change",()=>{const t=e._modelValue,n=Eu(e),i=e.checked,r=e[gu];if(E(t)){const e=Te(t,n),s=-1!==e;if(i&&!s)r(t.concat(n));else if(!i&&s){const n=[...t];n.splice(e,1),r(n)}}else if(I(t)){const e=new Set(t);i?e.add(n):e.delete(n),r(e)}else r(wu(e,i))})},mounted:vu,beforeUpdate(e,t,n){e[gu]=pu(n),vu(e,t,n)}};function vu(e,{value:t,oldValue:n},i){let r;if(e._modelValue=t,E(t))r=Te(t,i.props.value)>-1;else if(I(t))r=t.has(i.props.value);else{if(t===n)return;r=be(t,wu(e,!0))}e.checked!==r&&(e.checked=r)}const bu={created(e,{value:t},n){e.checked=be(t,n.props.value),e[gu]=pu(n),Vl(e,"change",()=>{e[gu](Eu(e))})},beforeUpdate(e,{value:t,oldValue:n},i){e[gu]=pu(i),t!==n&&(e.checked=be(t,i.props.value))}},Tu={deep:!0,created(e,{value:t,modifiers:{number:n}},i){const r=I(t);Vl(e,"change",()=>{const t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?K(Eu(e)):Eu(e));e[gu](e.multiple?r?new Set(t):t:t[0]),e._assigning=!0,Gn(()=>{e._assigning=!1})}),e[gu]=pu(i)},mounted(e,{value:t}){xu(e,t)},beforeUpdate(e,t,n){e[gu]=pu(n)},updated(e,{value:t}){e._assigning||xu(e,t)}};function xu(e,t){const n=e.multiple,i=E(t);if(!n||i||I(t)){for(let r=0,s=e.options.length;r<s;r++){const s=e.options[r],o=Eu(s);if(n)if(i){const e=typeof o;s.selected="string"===e||"number"===e?t.some(e=>String(e)===String(o)):Te(t,o)>-1}else s.selected=t.has(o);else if(be(Eu(s),t))return void(e.selectedIndex!==r&&(e.selectedIndex=r))}n||-1===e.selectedIndex||(e.selectedIndex=-1)}}function Eu(e){return"_value"in e?e._value:e.value}function wu(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Iu={created(e,t,n){Su(e,t,n,null,"created")},mounted(e,t,n){Su(e,t,n,null,"mounted")},beforeUpdate(e,t,n,i){Su(e,t,n,i,"beforeUpdate")},updated(e,t,n,i){Su(e,t,n,i,"updated")}};function Au(e,t){switch(e){case"SELECT":return Tu;case"TEXTAREA":return yu;default:switch(t){case"checkbox":return _u;case"radio":return bu;default:return yu}}}function Su(e,t,n,i,r){const s=Au(e.tagName,n.props&&n.props.type)[r];s&&s(e,t,n,i)}const Cu=["ctrl","shift","alt","meta"],Ou={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&0!==e.button,middle:e=>"button"in e&&1!==e.button,right:e=>"button"in e&&2!==e.button,exact:(e,t)=>Cu.some(n=>e[`${n}Key`]&&!t.includes(n))},Mu=(e,t)=>{const n=e._withMods||(e._withMods={}),i=t.join(".");return n[i]||(n[i]=(n,...i)=>{for(let e=0;e<t.length;e++){const i=Ou[t[e]];if(i&&i(n,t))return}return e(n,...i)})},Ru={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},ku=(e,t)=>{const n=e._withKeys||(e._withKeys={}),i=t.join(".");return n[i]||(n[i]=n=>{if(!("key"in n))return;const i=Y(n.key);return t.some(e=>e===i||Ru[e]===i)?e(n):void 0})},Nu=v({patchProp:(e,t,n,i,r,s)=>{const o="svg"===r;"class"===t?function(e,t,n){const i=e[ul];i&&(t=(t?[t,...i]:[...i]).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}(e,i,o):"style"===t?function(e,t,n){const i=e.style,r=C(n);let s=!1;if(n&&!r){if(t)if(C(t))for(const e of t.split(";")){const t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&Ll(i,t,"")}else for(const e in t)null==n[e]&&Ll(i,e,"");for(const e in n)"display"===e&&(s=!0),Ll(i,e,n[e])}else if(r){if(t!==n){const e=i[Ml];e&&(n+=";"+e),i.cssText=n,s=Dl.test(n)}}else t&&e.removeAttribute("style");Al in e&&(e[Al]=s?i.display:"",e[Sl]&&(i.display="none"))}(e,n,i):y(t)?_(t)||Yl(e,t,0,i,s):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,n,i){if(i)return"innerHTML"===t||"textContent"===t||!!(t in e&&ql(t)&&S(n));if("spellcheck"===t||"draggable"===t||"translate"===t)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){const t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}if(ql(t)&&C(n))return!1;return t in e}(e,t,i,o))?(zl(e,t,i),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||Ul(e,t,i,o,0,"value"!==t)):!e._isVueCE||!/[A-Z]/.test(t)&&C(i)?("true-value"===t?e._trueValue=i:"false-value"===t&&(e._falseValue=i),Ul(e,t,i,o)):zl(e,V(t),i,0,t)}},ol);let Du,Fu=!1;function Lu(){return Du||(Du=Js(Nu))}function Pu(){return Du=Fu?Du:eo(Nu),Fu=!0,Du}const Bu=(...e)=>{Lu().render(...e)},$u=(...e)=>{Pu().hydrate(...e)},Uu=(...e)=>{const t=Lu().createApp(...e);const{mount:n}=t;return t.mount=e=>{const i=ju(e);if(!i)return;const r=t._component;S(r)||r.render||r.template||(r.template=i.innerHTML),1===i.nodeType&&(i.textContent="");const s=n(i,!1,Vu(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),s},t},zu=(...e)=>{const t=Pu().createApp(...e);const{mount:n}=t;return t.mount=e=>{const t=ju(e);if(t)return n(t,!0,Vu(t))},t};function Vu(e){return e instanceof SVGElement?"svg":"function"==typeof MathMLElement&&e instanceof MathMLElement?"mathml":void 0}function ju(e){if(C(e)){return document.querySelector(e)}return e}let Yu=!1;const Gu=()=>{Yu||(Yu=!0,yu.getSSRProps=({value:e})=>({value:e}),bu.getSSRProps=({value:e},t)=>{if(t.props&&be(t.props.value,e))return{checked:!0}},_u.getSSRProps=({value:e},t)=>{if(E(e)){if(t.props&&Te(e,t.props.value)>-1)return{checked:!0}}else if(I(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Iu.getSSRProps=(e,t)=>{if("string"!=typeof t.type)return;const n=Au(t.type.toUpperCase(),t.props&&t.props.type);return n.getSSRProps?n.getSSRProps(e,t):void 0},Cl.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}})},Hu=Symbol(""),Wu=Symbol(""),Xu=Symbol(""),qu=Symbol(""),Ku=Symbol(""),Zu=Symbol(""),Qu=Symbol(""),Ju=Symbol(""),ec=Symbol(""),tc=Symbol(""),nc=Symbol(""),ic=Symbol(""),rc=Symbol(""),sc=Symbol(""),oc=Symbol(""),ac=Symbol(""),lc=Symbol(""),uc=Symbol(""),cc=Symbol(""),dc=Symbol(""),hc=Symbol(""),pc=Symbol(""),fc=Symbol(""),mc=Symbol(""),gc=Symbol(""),yc=Symbol(""),_c=Symbol(""),vc=Symbol(""),bc=Symbol(""),Tc=Symbol(""),xc=Symbol(""),Ec=Symbol(""),wc=Symbol(""),Ic=Symbol(""),Ac=Symbol(""),Sc=Symbol(""),Cc=Symbol(""),Oc=Symbol(""),Mc=Symbol(""),Rc={[Hu]:"Fragment",[Wu]:"Teleport",[Xu]:"Suspense",[qu]:"KeepAlive",[Ku]:"BaseTransition",[Zu]:"openBlock",[Qu]:"createBlock",[Ju]:"createElementBlock",[ec]:"createVNode",[tc]:"createElementVNode",[nc]:"createCommentVNode",[ic]:"createTextVNode",[rc]:"createStaticVNode",[sc]:"resolveComponent",[oc]:"resolveDynamicComponent",[ac]:"resolveDirective",[lc]:"resolveFilter",[uc]:"withDirectives",[cc]:"renderList",[dc]:"renderSlot",[hc]:"createSlots",[pc]:"toDisplayString",[fc]:"mergeProps",[mc]:"normalizeClass",[gc]:"normalizeStyle",[yc]:"normalizeProps",[_c]:"guardReactiveProps",[vc]:"toHandlers",[bc]:"camelize",[Tc]:"capitalize",[xc]:"toHandlerKey",[Ec]:"setBlockTracking",[wc]:"pushScopeId",[Ic]:"popScopeId",[Ac]:"withCtx",[Sc]:"unref",[Cc]:"isRef",[Oc]:"withMemo",[Mc]:"isMemoSame"};const kc={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0},source:""};function Nc(e,t,n,i,r,s,o,a=!1,l=!1,u=!1,c=kc){return e&&(a?(e.helper(Zu),e.helper(jc(e.inSSR,u))):e.helper(Vc(e.inSSR,u)),o&&e.helper(uc)),{type:13,tag:t,props:n,children:i,patchFlag:r,dynamicProps:s,directives:o,isBlock:a,disableTracking:l,isComponent:u,loc:c}}function Dc(e,t=kc){return{type:17,loc:t,elements:e}}function Fc(e,t=kc){return{type:15,loc:t,properties:e}}function Lc(e,t){return{type:16,loc:kc,key:C(e)?Pc(e,!0):e,value:t}}function Pc(e,t=!1,n=kc,i=0){return{type:4,loc:n,content:e,isStatic:t,constType:t?3:i}}function Bc(e,t=kc){return{type:8,loc:t,children:e}}function $c(e,t=[],n=kc){return{type:14,loc:n,callee:e,arguments:t}}function Uc(e,t=void 0,n=!1,i=!1,r=kc){return{type:18,params:e,returns:t,newline:n,isSlot:i,loc:r}}function zc(e,t,n,i=!0){return{type:19,test:e,consequent:t,alternate:n,newline:i,loc:kc}}function Vc(e,t){return e||t?ec:tc}function jc(e,t){return e||t?Qu:Ju}function Yc(e,{helper:t,removeHelper:n,inSSR:i}){e.isBlock||(e.isBlock=!0,n(Vc(i,e.isComponent)),t(Zu),t(jc(i,e.isComponent)))}const Gc=new Uint8Array([123,123]),Hc=new Uint8Array([125,125]);function Wc(e){return e>=97&&e<=122||e>=65&&e<=90}function Xc(e){return 32===e||10===e||9===e||12===e||13===e}function qc(e){return 47===e||62===e||Xc(e)}function Kc(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}const Zc={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};function Qc(e,{compatConfig:t}){const n=t&&t[e];return"MODE"===e?n||3:n}function Jc(e,t){const n=Qc("MODE",t),i=Qc(e,t);return 3===n?!0===i:!1!==i}function ed(e,t,n,...i){return Jc(e,t)}function td(e){throw e}function nd(e){}function id(e,t,n,i){const r=new SyntaxError(String(`https://vuejs.org/error-reference/#compiler-${e}`));return r.code=e,r.loc=t,r}const rd=e=>4===e.type&&e.isStatic;function sd(e){switch(e){case"Teleport":case"teleport":return Wu;case"Suspense":case"suspense":return Xu;case"KeepAlive":case"keep-alive":return qu;case"BaseTransition":case"base-transition":return Ku}}const od=/^\d|[^\$\w\xA0-\uFFFF]/,ad=e=>!od.test(e),ld=/[A-Za-z_$\xA0-\uFFFF]/,ud=/[\.\?\w$\xA0-\uFFFF]/,cd=/\s+[.[]\s*|\s*[.[]\s+/g,dd=e=>4===e.type?e.content:e.loc.source,hd=e=>{const t=dd(e).trim().replace(cd,e=>e.trim());let n=0,i=[],r=0,s=0,o=null;for(let e=0;e<t.length;e++){const a=t.charAt(e);switch(n){case 0:if("["===a)i.push(n),n=1,r++;else if("("===a)i.push(n),n=2,s++;else if(!(0===e?ld:ud).test(a))return!1;break;case 1:"'"===a||'"'===a||"`"===a?(i.push(n),n=3,o=a):"["===a?r++:"]"===a&&(--r||(n=i.pop()));break;case 2:if("'"===a||'"'===a||"`"===a)i.push(n),n=3,o=a;else if("("===a)s++;else if(")"===a){if(e===t.length-1)return!1;--s||(n=i.pop())}break;case 3:a===o&&(n=i.pop(),o=null)}}return!r&&!s},pd=/^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/,fd=e=>pd.test(dd(e));function md(e,t,n=!1){for(let i=0;i<e.props.length;i++){const r=e.props[i];if(7===r.type&&(n||r.exp)&&(C(t)?r.name===t:t.test(r.name)))return r}}function gd(e,t,n=!1,i=!1){for(let r=0;r<e.props.length;r++){const s=e.props[r];if(6===s.type){if(n)continue;if(s.name===t&&(s.value||i))return s}else if("bind"===s.name&&(s.exp||i)&&yd(s.arg,t))return s}}function yd(e,t){return!(!e||!rd(e)||e.content!==t)}function _d(e){return 5===e.type||2===e.type}function vd(e){return 7===e.type&&"slot"===e.name}function bd(e){return 1===e.type&&3===e.tagType}function Td(e){return 1===e.type&&2===e.tagType}const xd=new Set([yc,_c]);function Ed(e,t=[]){if(e&&!C(e)&&14===e.type){const n=e.callee;if(!C(n)&&xd.has(n))return Ed(e.arguments[0],t.concat(e))}return[e,t]}function wd(e,t,n){let i,r,s=13===e.type?e.props:e.arguments[2],o=[];if(s&&!C(s)&&14===s.type){const e=Ed(s);s=e[0],o=e[1],r=o[o.length-1]}if(null==s||C(s))i=Fc([t]);else if(14===s.type){const e=s.arguments[0];C(e)||15!==e.type?s.callee===vc?i=$c(n.helper(fc),[Fc([t]),s]):s.arguments.unshift(Fc([t])):Id(t,e)||e.properties.unshift(t),!i&&(i=s)}else 15===s.type?(Id(t,s)||s.properties.unshift(t),i=s):(i=$c(n.helper(fc),[Fc([t]),s]),r&&r.callee===_c&&(r=o[o.length-2]));13===e.type?r?r.arguments[0]=i:e.props=i:r?r.arguments[0]=i:e.arguments[2]=i}function Id(e,t){let n=!1;if(4===e.key.type){const i=e.key.content;n=t.properties.some(e=>4===e.key.type&&e.key.content===i)}return n}function Ad(e,t){return`_${t}_${e.replace(/[^\w]/g,(t,n)=>"-"===t?"_":e.charCodeAt(n).toString())}`}const Sd=/([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/,Cd={parseMode:"base",ns:0,delimiters:["{{","}}"],getNamespace:()=>0,isVoidTag:g,isPreTag:g,isIgnoreNewlineTag:g,isCustomElement:g,onError:td,onWarn:nd,comments:!1,prefixIdentifiers:!1};let Od=Cd,Md=null,Rd="",kd=null,Nd=null,Dd="",Fd=-1,Ld=-1,Pd=0,Bd=!1,$d=null;const Ud=[],zd=new class{constructor(e,t){this.stack=e,this.cbs=t,this.state=1,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=1,this.inRCDATA=!1,this.inXML=!1,this.inVPre=!1,this.newlines=[],this.mode=0,this.delimiterOpen=Gc,this.delimiterClose=Hc,this.delimiterIndex=-1,this.currentSequence=void 0,this.sequenceIndex=0}get inSFCRoot(){return 2===this.mode&&0===this.stack.length}reset(){this.state=1,this.mode=0,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=1,this.inRCDATA=!1,this.currentSequence=void 0,this.newlines.length=0,this.delimiterOpen=Gc,this.delimiterClose=Hc}getPos(e){let t=1,n=e+1;for(let i=this.newlines.length-1;i>=0;i--){const r=this.newlines[i];if(e>r){t=i+2,n=e-r;break}}return{column:n,line:t,offset:e}}peek(){return this.buffer.charCodeAt(this.index+1)}stateText(e){60===e?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=5,this.sectionStart=this.index):this.inVPre||e!==this.delimiterOpen[0]||(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(e))}stateInterpolationOpen(e){if(e===this.delimiterOpen[this.delimiterIndex])if(this.delimiterIndex===this.delimiterOpen.length-1){const e=this.index+1-this.delimiterOpen.length;e>this.sectionStart&&this.cbs.ontext(this.sectionStart,e),this.state=3,this.sectionStart=e}else this.delimiterIndex++;else this.inRCDATA?(this.state=32,this.stateInRCDATA(e)):(this.state=1,this.stateText(e))}stateInterpolation(e){e===this.delimiterClose[0]&&(this.state=4,this.delimiterIndex=0,this.stateInterpolationClose(e))}stateInterpolationClose(e){e===this.delimiterClose[this.delimiterIndex]?this.delimiterIndex===this.delimiterClose.length-1?(this.cbs.oninterpolation(this.sectionStart,this.index+1),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):this.delimiterIndex++:(this.state=3,this.stateInterpolation(e))}stateSpecialStartSequence(e){const t=this.sequenceIndex===this.currentSequence.length;if(t?qc(e):(32|e)===this.currentSequence[this.sequenceIndex]){if(!t)return void this.sequenceIndex++}else this.inRCDATA=!1;this.sequenceIndex=0,this.state=6,this.stateInTagName(e)}stateInRCDATA(e){if(this.sequenceIndex===this.currentSequence.length){if(62===e||Xc(e)){const t=this.index-this.currentSequence.length;if(this.sectionStart<t){const e=this.index;this.index=t,this.cbs.ontext(this.sectionStart,t),this.index=e}return this.sectionStart=t+2,this.stateInClosingTagName(e),void(this.inRCDATA=!1)}this.sequenceIndex=0}(32|e)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:0===this.sequenceIndex?this.currentSequence===Zc.TitleEnd||this.currentSequence===Zc.TextareaEnd&&!this.inSFCRoot?this.inVPre||e!==this.delimiterOpen[0]||(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(e)):this.fastForwardTo(60)&&(this.sequenceIndex=1):this.sequenceIndex=Number(60===e)}stateCDATASequence(e){e===Zc.Cdata[this.sequenceIndex]?++this.sequenceIndex===Zc.Cdata.length&&(this.state=28,this.currentSequence=Zc.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=23,this.stateInDeclaration(e))}fastForwardTo(e){for(;++this.index<this.buffer.length;){const t=this.buffer.charCodeAt(this.index);if(10===t&&this.newlines.push(this.index),t===e)return!0}return this.index=this.buffer.length-1,!1}stateInCommentLike(e){e===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===Zc.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index-2):this.cbs.oncomment(this.sectionStart,this.index-2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=1):0===this.sequenceIndex?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):e!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}startSpecial(e,t){this.enterRCDATA(e,t),this.state=31}enterRCDATA(e,t){this.inRCDATA=!0,this.currentSequence=e,this.sequenceIndex=t}stateBeforeTagName(e){33===e?(this.state=22,this.sectionStart=this.index+1):63===e?(this.state=24,this.sectionStart=this.index+1):Wc(e)?(this.sectionStart=this.index,0===this.mode?this.state=6:this.inSFCRoot?this.state=34:this.inXML?this.state=6:this.state=116===e?30:115===e?29:6):47===e?this.state=8:(this.state=1,this.stateText(e))}stateInTagName(e){qc(e)&&this.handleTagName(e)}stateInSFCRootTagName(e){if(qc(e)){const t=this.buffer.slice(this.sectionStart,this.index);"template"!==t&&this.enterRCDATA(Kc("</"+t),0),this.handleTagName(e)}}handleTagName(e){this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(e)}stateBeforeClosingTagName(e){Xc(e)||(62===e?(this.state=1,this.sectionStart=this.index+1):(this.state=Wc(e)?9:27,this.sectionStart=this.index))}stateInClosingTagName(e){(62===e||Xc(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=10,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){62===e&&(this.state=1,this.sectionStart=this.index+1)}stateBeforeAttrName(e){62===e?(this.cbs.onopentagend(this.index),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):47===e?this.state=7:60===e&&47===this.peek()?(this.cbs.onopentagend(this.index),this.state=5,this.sectionStart=this.index):Xc(e)||this.handleAttrStart(e)}handleAttrStart(e){118===e&&45===this.peek()?(this.state=13,this.sectionStart=this.index):46===e||58===e||64===e||35===e?(this.cbs.ondirname(this.index,this.index+1),this.state=14,this.sectionStart=this.index+1):(this.state=12,this.sectionStart=this.index)}stateInSelfClosingTag(e){62===e?(this.cbs.onselfclosingtag(this.index),this.state=1,this.sectionStart=this.index+1,this.inRCDATA=!1):Xc(e)||(this.state=11,this.stateBeforeAttrName(e))}stateInAttrName(e){(61===e||qc(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.handleAttrNameEnd(e))}stateInDirName(e){61===e||qc(e)?(this.cbs.ondirname(this.sectionStart,this.index),this.handleAttrNameEnd(e)):58===e?(this.cbs.ondirname(this.sectionStart,this.index),this.state=14,this.sectionStart=this.index+1):46===e&&(this.cbs.ondirname(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDirArg(e){61===e||qc(e)?(this.cbs.ondirarg(this.sectionStart,this.index),this.handleAttrNameEnd(e)):91===e?this.state=15:46===e&&(this.cbs.ondirarg(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDynamicDirArg(e){93===e?this.state=14:(61===e||qc(e))&&(this.cbs.ondirarg(this.sectionStart,this.index+1),this.handleAttrNameEnd(e))}stateInDirModifier(e){61===e||qc(e)?(this.cbs.ondirmodifier(this.sectionStart,this.index),this.handleAttrNameEnd(e)):46===e&&(this.cbs.ondirmodifier(this.sectionStart,this.index),this.sectionStart=this.index+1)}handleAttrNameEnd(e){this.sectionStart=this.index,this.state=17,this.cbs.onattribnameend(this.index),this.stateAfterAttrName(e)}stateAfterAttrName(e){61===e?this.state=18:47===e||62===e?(this.cbs.onattribend(0,this.sectionStart),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(e)):Xc(e)||(this.cbs.onattribend(0,this.sectionStart),this.handleAttrStart(e))}stateBeforeAttrValue(e){34===e?(this.state=19,this.sectionStart=this.index+1):39===e?(this.state=20,this.sectionStart=this.index+1):Xc(e)||(this.sectionStart=this.index,this.state=21,this.stateInAttrValueNoQuotes(e))}handleInAttrValue(e,t){(e===t||this.fastForwardTo(t))&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(34===t?3:2,this.index+1),this.state=11)}stateInAttrValueDoubleQuotes(e){this.handleInAttrValue(e,34)}stateInAttrValueSingleQuotes(e){this.handleInAttrValue(e,39)}stateInAttrValueNoQuotes(e){Xc(e)||62===e?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(1,this.index),this.state=11,this.stateBeforeAttrName(e)):39!==e&&60!==e&&61!==e&&96!==e||this.cbs.onerr(18,this.index)}stateBeforeDeclaration(e){91===e?(this.state=26,this.sequenceIndex=0):this.state=45===e?25:23}stateInDeclaration(e){(62===e||this.fastForwardTo(62))&&(this.state=1,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(62===e||this.fastForwardTo(62))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeComment(e){45===e?(this.state=28,this.currentSequence=Zc.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=23}stateInSpecialComment(e){(62===e||this.fastForwardTo(62))&&(this.cbs.oncomment(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){e===Zc.ScriptEnd[3]?this.startSpecial(Zc.ScriptEnd,4):e===Zc.StyleEnd[3]?this.startSpecial(Zc.StyleEnd,4):(this.state=6,this.stateInTagName(e))}stateBeforeSpecialT(e){e===Zc.TitleEnd[3]?this.startSpecial(Zc.TitleEnd,4):e===Zc.TextareaEnd[3]?this.startSpecial(Zc.TextareaEnd,4):(this.state=6,this.stateInTagName(e))}startEntity(){}stateInEntity(){}parse(e){for(this.buffer=e;this.index<this.buffer.length;){const e=this.buffer.charCodeAt(this.index);switch(10===e&&this.newlines.push(this.index),this.state){case 1:this.stateText(e);break;case 2:this.stateInterpolationOpen(e);break;case 3:this.stateInterpolation(e);break;case 4:this.stateInterpolationClose(e);break;case 31:this.stateSpecialStartSequence(e);break;case 32:this.stateInRCDATA(e);break;case 26:this.stateCDATASequence(e);break;case 19:this.stateInAttrValueDoubleQuotes(e);break;case 12:this.stateInAttrName(e);break;case 13:this.stateInDirName(e);break;case 14:this.stateInDirArg(e);break;case 15:this.stateInDynamicDirArg(e);break;case 16:this.stateInDirModifier(e);break;case 28:this.stateInCommentLike(e);break;case 27:this.stateInSpecialComment(e);break;case 11:this.stateBeforeAttrName(e);break;case 6:this.stateInTagName(e);break;case 34:this.stateInSFCRootTagName(e);break;case 9:this.stateInClosingTagName(e);break;case 5:this.stateBeforeTagName(e);break;case 17:this.stateAfterAttrName(e);break;case 20:this.stateInAttrValueSingleQuotes(e);break;case 18:this.stateBeforeAttrValue(e);break;case 8:this.stateBeforeClosingTagName(e);break;case 10:this.stateAfterClosingTagName(e);break;case 29:this.stateBeforeSpecialS(e);break;case 30:this.stateBeforeSpecialT(e);break;case 21:this.stateInAttrValueNoQuotes(e);break;case 7:this.stateInSelfClosingTag(e);break;case 23:this.stateInDeclaration(e);break;case 22:this.stateBeforeDeclaration(e);break;case 25:this.stateBeforeComment(e);break;case 24:this.stateInProcessingInstruction(e);break;case 33:this.stateInEntity()}this.index++}this.cleanup(),this.finish()}cleanup(){this.sectionStart!==this.index&&(1===this.state||32===this.state&&0===this.sequenceIndex?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):19!==this.state&&20!==this.state&&21!==this.state||(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}finish(){this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const e=this.buffer.length;this.sectionStart>=e||(28===this.state?this.currentSequence===Zc.CdataEnd?this.cbs.oncdata(this.sectionStart,e):this.cbs.oncomment(this.sectionStart,e):6===this.state||11===this.state||18===this.state||17===this.state||12===this.state||13===this.state||14===this.state||15===this.state||16===this.state||20===this.state||19===this.state||21===this.state||9===this.state||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,t){}}(Ud,{onerr:lh,ontext(e,t){Hd(Yd(e,t),e,t)},ontextentity(e,t,n){Hd(e,t,n)},oninterpolation(e,t){if(Bd)return Hd(Yd(e,t),e,t);let n=e+zd.delimiterOpen.length,i=t-zd.delimiterClose.length;for(;Xc(Rd.charCodeAt(n));)n++;for(;Xc(Rd.charCodeAt(i-1));)i--;let r=Yd(n,i);r.includes("&")&&(r=Od.decodeEntities(r,!1)),nh({type:5,content:ah(r,!1,ih(n,i)),loc:ih(e,t)})},onopentagname(e,t){const n=Yd(e,t);kd={type:1,tag:n,ns:Od.getNamespace(n,Ud[0],Od.ns),tagType:0,props:[],children:[],loc:ih(e-1,t),codegenNode:void 0}},onopentagend(e){Gd(e)},onclosetag(e,t){const n=Yd(e,t);if(!Od.isVoidTag(n)){let i=!1;for(let e=0;e<Ud.length;e++){if(Ud[e].tag.toLowerCase()===n.toLowerCase()){i=!0,e>0&&lh(24,Ud[0].loc.start.offset);for(let n=0;n<=e;n++){Wd(Ud.shift(),t,n<e)}break}}i||lh(23,Xd(e,60))}},onselfclosingtag(e){const t=kd.tag;kd.isSelfClosing=!0,Gd(e),Ud[0]&&Ud[0].tag===t&&Wd(Ud.shift(),e)},onattribname(e,t){Nd={type:6,name:Yd(e,t),nameLoc:ih(e,t),value:void 0,loc:ih(e)}},ondirname(e,t){const n=Yd(e,t),i="."===n||":"===n?"bind":"@"===n?"on":"#"===n?"slot":n.slice(2);if(Bd||""!==i||lh(26,e),Bd||""===i)Nd={type:6,name:n,nameLoc:ih(e,t),value:void 0,loc:ih(e)};else if(Nd={type:7,name:i,rawName:n,exp:void 0,arg:void 0,modifiers:"."===n?[Pc("prop")]:[],loc:ih(e)},"pre"===i){Bd=zd.inVPre=!0,$d=kd;const e=kd.props;for(let t=0;t<e.length;t++)7===e[t].type&&(e[t]=oh(e[t]))}},ondirarg(e,t){if(e===t)return;const n=Yd(e,t);if(Bd)Nd.name+=n,sh(Nd.nameLoc,t);else{const i="["!==n[0];Nd.arg=ah(i?n:n.slice(1,-1),i,ih(e,t),i?3:0)}},ondirmodifier(e,t){const n=Yd(e,t);if(Bd)Nd.name+="."+n,sh(Nd.nameLoc,t);else if("slot"===Nd.name){const e=Nd.arg;e&&(e.content+="."+n,sh(e.loc,t))}else{const i=Pc(n,!0,ih(e,t));Nd.modifiers.push(i)}},onattribdata(e,t){Dd+=Yd(e,t),Fd<0&&(Fd=e),Ld=t},onattribentity(e,t,n){Dd+=e,Fd<0&&(Fd=t),Ld=n},onattribnameend(e){const t=Nd.loc.start.offset,n=Yd(t,e);7===Nd.type&&(Nd.rawName=n),kd.props.some(e=>(7===e.type?e.rawName:e.name)===n)&&lh(2,t)},onattribend(e,t){if(kd&&Nd){if(sh(Nd.loc,t),0!==e)if(Dd.includes("&")&&(Dd=Od.decodeEntities(Dd,!0)),6===Nd.type)"class"===Nd.name&&(Dd=th(Dd).trim()),1!==e||Dd||lh(13,t),Nd.value={type:2,content:Dd,loc:1===e?ih(Fd,Ld):ih(Fd-1,Ld+1)},zd.inSFCRoot&&"template"===kd.tag&&"lang"===Nd.name&&Dd&&"html"!==Dd&&zd.enterRCDATA(Kc("</template"),0);else{let e=0;Nd.exp=ah(Dd,!1,ih(Fd,Ld),0,e),"for"===Nd.name&&(Nd.forParseResult=function(e){const t=e.loc,n=e.content,i=n.match(Sd);if(!i)return;const[,r,s]=i,o=(e,n,i=!1)=>{const r=t.start.offset+n;return ah(e,!1,ih(r,r+e.length),0,i?1:0)},a={source:o(s.trim(),n.indexOf(s,r.length)),value:void 0,key:void 0,index:void 0,finalized:!1};let l=r.trim().replace(jd,"").trim();const u=r.indexOf(l),c=l.match(Vd);if(c){l=l.replace(Vd,"").trim();const e=c[1].trim();let t;if(e&&(t=n.indexOf(e,u+l.length),a.key=o(e,t,!0)),c[2]){const i=c[2].trim();i&&(a.index=o(i,n.indexOf(i,a.key?t+e.length:u+l.length),!0))}}l&&(a.value=o(l,u,!0));return a}(Nd.exp));let t=-1;"bind"===Nd.name&&(t=Nd.modifiers.findIndex(e=>"sync"===e.content))>-1&&ed("COMPILER_V_BIND_SYNC",Od,Nd.loc,Nd.rawName)&&(Nd.name="model",Nd.modifiers.splice(t,1))}7===Nd.type&&"pre"===Nd.name||kd.props.push(Nd)}Dd="",Fd=Ld=-1},oncomment(e,t){Od.comments&&nh({type:3,content:Yd(e,t),loc:ih(e-4,t+3)})},onend(){const e=Rd.length;for(let t=0;t<Ud.length;t++)Wd(Ud[t],e-1),lh(24,Ud[t].loc.start.offset)},oncdata(e,t){0!==Ud[0].ns?Hd(Yd(e,t),e,t):lh(1,e-9)},onprocessinginstruction(e){0===(Ud[0]?Ud[0].ns:Od.ns)&&lh(21,e-1)}}),Vd=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,jd=/^\(|\)$/g;function Yd(e,t){return Rd.slice(e,t)}function Gd(e){zd.inSFCRoot&&(kd.innerLoc=ih(e+1,e+1)),nh(kd);const{tag:t,ns:n}=kd;0===n&&Od.isPreTag(t)&&Pd++,Od.isVoidTag(t)?Wd(kd,e):(Ud.unshift(kd),1!==n&&2!==n||(zd.inXML=!0)),kd=null}function Hd(e,t,n){{const t=Ud[0]&&Ud[0].tag;"script"!==t&&"style"!==t&&e.includes("&")&&(e=Od.decodeEntities(e,!1))}const i=Ud[0]||Md,r=i.children[i.children.length-1];r&&2===r.type?(r.content+=e,sh(r.loc,n)):i.children.push({type:2,content:e,loc:ih(t,n)})}function Wd(e,t,n=!1){sh(e.loc,n?Xd(t,60):function(e,t){let n=e;for(;Rd.charCodeAt(n)!==t&&n<Rd.length-1;)n++;return n}(t,62)+1),zd.inSFCRoot&&(e.children.length?e.innerLoc.end=v({},e.children[e.children.length-1].loc.end):e.innerLoc.end=v({},e.innerLoc.start),e.innerLoc.source=Yd(e.innerLoc.start.offset,e.innerLoc.end.offset));const{tag:i,ns:r,children:s}=e;if(Bd||("slot"===i?e.tagType=2:Kd(e)?e.tagType=3:function({tag:e,props:t}){if(Od.isCustomElement(e))return!1;if("component"===e||(n=e.charCodeAt(0),n>64&&n<91)||sd(e)||Od.isBuiltInComponent&&Od.isBuiltInComponent(e)||Od.isNativeTag&&!Od.isNativeTag(e))return!0;var n;for(let e=0;e<t.length;e++){const n=t[e];if(6===n.type){if("is"===n.name&&n.value){if(n.value.content.startsWith("vue:"))return!0;if(ed("COMPILER_IS_ON_ELEMENT",Od,n.loc))return!0}}else if("bind"===n.name&&yd(n.arg,"is")&&ed("COMPILER_IS_ON_ELEMENT",Od,n.loc))return!0}return!1}(e)&&(e.tagType=1)),zd.inRCDATA||(e.children=Qd(s)),0===r&&Od.isIgnoreNewlineTag(i)){const e=s[0];e&&2===e.type&&(e.content=e.content.replace(/^\r?\n/,""))}0===r&&Od.isPreTag(i)&&Pd--,$d===e&&(Bd=zd.inVPre=!1,$d=null),zd.inXML&&0===(Ud[0]?Ud[0].ns:Od.ns)&&(zd.inXML=!1);{const t=e.props;if(!zd.inSFCRoot&&Jc("COMPILER_NATIVE_TEMPLATE",Od)&&"template"===e.tag&&!Kd(e)){const t=Ud[0]||Md,n=t.children.indexOf(e);t.children.splice(n,1,...e.children)}const n=t.find(e=>6===e.type&&"inline-template"===e.name);n&&ed("COMPILER_INLINE_TEMPLATE",Od,n.loc)&&e.children.length&&(n.value={type:2,content:Yd(e.children[0].loc.start.offset,e.children[e.children.length-1].loc.end.offset),loc:n.loc})}}function Xd(e,t){let n=e;for(;Rd.charCodeAt(n)!==t&&n>=0;)n--;return n}const qd=new Set(["if","else","else-if","for","slot"]);function Kd({tag:e,props:t}){if("template"===e)for(let e=0;e<t.length;e++)if(7===t[e].type&&qd.has(t[e].name))return!0;return!1}const Zd=/\r\n/g;function Qd(e,t){const n="preserve"!==Od.whitespace;let i=!1;for(let t=0;t<e.length;t++){const r=e[t];if(2===r.type)if(Pd)r.content=r.content.replace(Zd,"\n");else if(Jd(r.content)){const s=e[t-1]&&e[t-1].type,o=e[t+1]&&e[t+1].type;!s||!o||n&&(3===s&&(3===o||1===o)||1===s&&(3===o||1===o&&eh(r.content)))?(i=!0,e[t]=null):r.content=" "}else n&&(r.content=th(r.content))}return i?e.filter(Boolean):e}function Jd(e){for(let t=0;t<e.length;t++)if(!Xc(e.charCodeAt(t)))return!1;return!0}function eh(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(10===n||13===n)return!0}return!1}function th(e){let t="",n=!1;for(let i=0;i<e.length;i++)Xc(e.charCodeAt(i))?n||(t+=" ",n=!0):(t+=e[i],n=!1);return t}function nh(e){(Ud[0]||Md).children.push(e)}function ih(e,t){return{start:zd.getPos(e),end:null==t?t:zd.getPos(t),source:null==t?t:Yd(e,t)}}function rh(e){return ih(e.start.offset,e.end.offset)}function sh(e,t){e.end=zd.getPos(t),e.source=Yd(e.start.offset,t)}function oh(e){const t={type:6,name:e.rawName,nameLoc:ih(e.loc.start.offset,e.loc.start.offset+e.rawName.length),value:void 0,loc:e.loc};if(e.exp){const n=e.exp.loc;n.end.offset<e.loc.end.offset&&(n.start.offset--,n.start.column--,n.end.offset++,n.end.column++),t.value={type:2,content:e.exp.content,loc:n}}return t}function ah(e,t=!1,n,i=0,r=0){return Pc(e,t,n,i)}function lh(e,t,n){Od.onError(id(e,ih(t,t)))}function uh(e,t){if(zd.reset(),kd=null,Nd=null,Dd="",Fd=-1,Ld=-1,Ud.length=0,Rd=e,Od=v({},Cd),t){let e;for(e in t)null!=t[e]&&(Od[e]=t[e])}zd.mode="html"===Od.parseMode?1:"sfc"===Od.parseMode?2:0,zd.inXML=1===Od.ns||2===Od.ns;const n=t&&t.delimiters;n&&(zd.delimiterOpen=Kc(n[0]),zd.delimiterClose=Kc(n[1]));const i=Md=function(e,t=""){return{type:0,source:t,children:e,helpers:new Set,components:[],directives:[],hoists:[],imports:[],cached:[],temps:0,codegenNode:void 0,loc:kc}}([],e);return zd.parse(Rd),i.loc=ih(0,e.length),i.children=Qd(i.children),Md=null,i}function ch(e,t){hh(e,void 0,t,dh(e,e.children[0]))}function dh(e,t){const{children:n}=e;return 1===n.length&&1===t.type&&!Td(t)}function hh(e,t,n,i=!1,r=!1){const{children:s}=e,o=[];for(let t=0;t<s.length;t++){const a=s[t];if(1===a.type&&0===a.tagType){const e=i?0:ph(a,n);if(e>0){if(e>=2){a.codegenNode.patchFlag=-1,o.push(a);continue}}else{const e=a.codegenNode;if(13===e.type){const t=e.patchFlag;if((void 0===t||512===t||1===t)&&gh(a,n)>=2){const t=yh(a);t&&(e.props=n.hoist(t))}e.dynamicProps&&(e.dynamicProps=n.hoist(e.dynamicProps))}}}else if(12===a.type){if((i?0:ph(a,n))>=2){o.push(a);continue}}if(1===a.type){const t=1===a.tagType;t&&n.scopes.vSlot++,hh(a,e,n,!1,r),t&&n.scopes.vSlot--}else if(11===a.type)hh(a,e,n,1===a.children.length,!0);else if(9===a.type)for(let t=0;t<a.branches.length;t++)hh(a.branches[t],e,n,1===a.branches[t].children.length,r)}let a=!1;if(o.length===s.length&&1===e.type)if(0===e.tagType&&e.codegenNode&&13===e.codegenNode.type&&E(e.codegenNode.children))e.codegenNode.children=l(Dc(e.codegenNode.children)),a=!0;else if(1===e.tagType&&e.codegenNode&&13===e.codegenNode.type&&e.codegenNode.children&&!E(e.codegenNode.children)&&15===e.codegenNode.children.type){const t=u(e.codegenNode,"default");t&&(t.returns=l(Dc(t.returns)),a=!0)}else if(3===e.tagType&&t&&1===t.type&&1===t.tagType&&t.codegenNode&&13===t.codegenNode.type&&t.codegenNode.children&&!E(t.codegenNode.children)&&15===t.codegenNode.children.type){const n=md(e,"slot",!0),i=n&&n.arg&&u(t.codegenNode,n.arg);i&&(i.returns=l(Dc(i.returns)),a=!0)}if(!a)for(const e of o)e.codegenNode=n.cache(e.codegenNode);function l(e){const t=n.cache(e);return r&&n.hmr&&(t.needArraySpread=!0),t}function u(e,t){if(e.children&&!E(e.children)&&15===e.children.type){const n=e.children.properties.find(e=>e.key===t||e.key.content===t);return n&&n.value}}o.length&&n.transformHoist&&n.transformHoist(s,n,e)}function ph(e,t){const{constantCache:n}=t;switch(e.type){case 1:if(0!==e.tagType)return 0;const i=n.get(e);if(void 0!==i)return i;const r=e.codegenNode;if(13!==r.type)return 0;if(r.isBlock&&"svg"!==e.tag&&"foreignObject"!==e.tag&&"math"!==e.tag)return 0;if(void 0===r.patchFlag){let i=3;const s=gh(e,t);if(0===s)return n.set(e,0),0;s<i&&(i=s);for(let r=0;r<e.children.length;r++){const s=ph(e.children[r],t);if(0===s)return n.set(e,0),0;s<i&&(i=s)}if(i>1)for(let r=0;r<e.props.length;r++){const s=e.props[r];if(7===s.type&&"bind"===s.name&&s.exp){const r=ph(s.exp,t);if(0===r)return n.set(e,0),0;r<i&&(i=r)}}if(r.isBlock){for(let t=0;t<e.props.length;t++){if(7===e.props[t].type)return n.set(e,0),0}t.removeHelper(Zu),t.removeHelper(jc(t.inSSR,r.isComponent)),r.isBlock=!1,t.helper(Vc(t.inSSR,r.isComponent))}return n.set(e,i),i}return n.set(e,0),0;case 2:case 3:return 3;case 9:case 11:case 10:default:return 0;case 5:case 12:return ph(e.content,t);case 4:return e.constType;case 8:let s=3;for(let n=0;n<e.children.length;n++){const i=e.children[n];if(C(i)||O(i))continue;const r=ph(i,t);if(0===r)return 0;r<s&&(s=r)}return s;case 20:return 2}}const fh=new Set([mc,gc,yc,_c]);function mh(e,t){if(14===e.type&&!C(e.callee)&&fh.has(e.callee)){const n=e.arguments[0];if(4===n.type)return ph(n,t);if(14===n.type)return mh(n,t)}return 0}function gh(e,t){let n=3;const i=yh(e);if(i&&15===i.type){const{properties:e}=i;for(let i=0;i<e.length;i++){const{key:r,value:s}=e[i],o=ph(r,t);if(0===o)return o;let a;if(o<n&&(n=o),a=4===s.type?ph(s,t):14===s.type?mh(s,t):0,0===a)return a;a<n&&(n=a)}}return n}function yh(e){const t=e.codegenNode;if(13===t.type)return t.props}function _h(e,{filename:t="",prefixIdentifiers:n=!1,hoistStatic:i=!1,hmr:r=!1,cacheHandlers:s=!1,nodeTransforms:o=[],directiveTransforms:a={},transformHoist:l=null,isBuiltInComponent:u=m,isCustomElement:c=m,expressionPlugins:d=[],scopeId:h=null,slotted:f=!0,ssr:g=!1,inSSR:y=!1,ssrCssVars:_="",bindingMetadata:v=p,inline:b=!1,isTS:T=!1,onError:x=td,onWarn:E=nd,compatConfig:w}){const I=t.replace(/\?.*$/,"").match(/([^/\\]+)\.\w+$/),A={filename:t,selfName:I&&G(V(I[1])),prefixIdentifiers:n,hoistStatic:i,hmr:r,cacheHandlers:s,nodeTransforms:o,directiveTransforms:a,transformHoist:l,isBuiltInComponent:u,isCustomElement:c,expressionPlugins:d,scopeId:h,slotted:f,ssr:g,inSSR:y,ssrCssVars:_,bindingMetadata:v,inline:b,isTS:T,onError:x,onWarn:E,compatConfig:w,root:e,helpers:new Map,components:new Set,directives:new Set,hoists:[],imports:[],cached:[],constantCache:new WeakMap,temps:0,identifiers:Object.create(null),scopes:{vFor:0,vSlot:0,vPre:0,vOnce:0},parent:null,grandParent:null,currentNode:e,childIndex:0,inVOnce:!1,helper(e){const t=A.helpers.get(e)||0;return A.helpers.set(e,t+1),e},removeHelper(e){const t=A.helpers.get(e);if(t){const n=t-1;n?A.helpers.set(e,n):A.helpers.delete(e)}},helperString:e=>`_${Rc[A.helper(e)]}`,replaceNode(e){A.parent.children[A.childIndex]=A.currentNode=e},removeNode(e){const t=A.parent.children,n=e?t.indexOf(e):A.currentNode?A.childIndex:-1;e&&e!==A.currentNode?A.childIndex>n&&(A.childIndex--,A.onNodeRemoved()):(A.currentNode=null,A.onNodeRemoved()),A.parent.children.splice(n,1)},onNodeRemoved:m,addIdentifiers(e){},removeIdentifiers(e){},hoist(e){C(e)&&(e=Pc(e)),A.hoists.push(e);const t=Pc(`_hoisted_${A.hoists.length}`,!1,e.loc,2);return t.hoisted=e,t},cache(e,t=!1,n=!1){const i=function(e,t,n=!1,i=!1){return{type:20,index:e,value:t,needPauseTracking:n,inVOnce:i,needArraySpread:!1,loc:kc}}(A.cached.length,e,t,n);return A.cached.push(i),i}};return A.filters=new Set,A}function vh(e,t){const n=_h(e,t);bh(e,n),t.hoistStatic&&ch(e,n),t.ssr||function(e,t){const{helper:n}=t,{children:i}=e;if(1===i.length){const n=i[0];if(dh(e,n)&&n.codegenNode){const i=n.codegenNode;13===i.type&&Yc(i,t),e.codegenNode=i}else e.codegenNode=n}else if(i.length>1){let i=64;0,e.codegenNode=Nc(t,n(Hu),void 0,e.children,i,void 0,void 0,!0,void 0,!1)}}(e,n),e.helpers=new Set([...n.helpers.keys()]),e.components=[...n.components],e.directives=[...n.directives],e.imports=n.imports,e.hoists=n.hoists,e.temps=n.temps,e.cached=n.cached,e.transformed=!0,e.filters=[...n.filters]}function bh(e,t){t.currentNode=e;const{nodeTransforms:n}=t,i=[];for(let r=0;r<n.length;r++){const s=n[r](e,t);if(s&&(E(s)?i.push(...s):i.push(s)),!t.currentNode)return;e=t.currentNode}switch(e.type){case 3:t.ssr||t.helper(nc);break;case 5:t.ssr||t.helper(pc);break;case 9:for(let n=0;n<e.branches.length;n++)bh(e.branches[n],t);break;case 10:case 11:case 1:case 0:!function(e,t){let n=0;const i=()=>{n--};for(;n<e.children.length;n++){const r=e.children[n];C(r)||(t.grandParent=t.parent,t.parent=e,t.childIndex=n,t.onNodeRemoved=i,bh(r,t))}}(e,t)}t.currentNode=e;let r=i.length;for(;r--;)i[r]()}function Th(e,t){const n=C(e)?t=>t===e:t=>e.test(t);return(e,i)=>{if(1===e.type){const{props:r}=e;if(3===e.tagType&&r.some(vd))return;const s=[];for(let o=0;o<r.length;o++){const a=r[o];if(7===a.type&&n(a.name)){r.splice(o,1),o--;const n=t(e,a,i);n&&s.push(n)}}return s}}}const xh="/*@__PURE__*/",Eh=e=>`${Rc[e]}: _${Rc[e]}`;function wh(e,t={}){const n=function(e,{mode:t="function",prefixIdentifiers:n="module"===t,sourceMap:i=!1,filename:r="template.vue.html",scopeId:s=null,optimizeImports:o=!1,runtimeGlobalName:a="Vue",runtimeModuleName:l="vue",ssrRuntimeModuleName:u="vue/server-renderer",ssr:c=!1,isTS:d=!1,inSSR:h=!1}){const p={mode:t,prefixIdentifiers:n,sourceMap:i,filename:r,scopeId:s,optimizeImports:o,runtimeGlobalName:a,runtimeModuleName:l,ssrRuntimeModuleName:u,ssr:c,isTS:d,inSSR:h,source:e.source,code:"",column:1,line:1,offset:0,indentLevel:0,pure:!1,map:void 0,helper:e=>`_${Rc[e]}`,push(e,t=-2,n){p.code+=e},indent(){f(++p.indentLevel)},deindent(e=!1){e?--p.indentLevel:f(--p.indentLevel)},newline(){f(p.indentLevel)}};function f(e){p.push("\n"+" ".repeat(e),0)}return p}(e,t);t.onContextCreated&&t.onContextCreated(n);const{mode:i,push:r,prefixIdentifiers:s,indent:o,deindent:a,newline:l,scopeId:u,ssr:c}=n,d=Array.from(e.helpers),h=d.length>0,p=!s&&"module"!==i;!function(e,t){const{ssr:n,prefixIdentifiers:i,push:r,newline:s,runtimeModuleName:o,runtimeGlobalName:a,ssrRuntimeModuleName:l}=t,u=a,c=Array.from(e.helpers);if(c.length>0&&(r(`const _Vue = ${u}\n`,-1),e.hoists.length)){r(`const { ${[ec,tc,nc,ic,rc].filter(e=>c.includes(e)).map(Eh).join(", ")} } = _Vue\n`,-1)}(function(e,t){if(!e.length)return;t.pure=!0;const{push:n,newline:i}=t;i();for(let r=0;r<e.length;r++){const s=e[r];s&&(n(`const _hoisted_${r+1} = `),Ch(s,t),i())}t.pure=!1})(e.hoists,t),s(),r("return ")}(e,n);if(r(`function ${c?"ssrRender":"render"}(${(c?["_ctx","_push","_parent","_attrs"]:["_ctx","_cache"]).join(", ")}) {`),o(),p&&(r("with (_ctx) {"),o(),h&&(r(`const { ${d.map(Eh).join(", ")} } = _Vue\n`,-1),l())),e.components.length&&(Ih(e.components,"component",n),(e.directives.length||e.temps>0)&&l()),e.directives.length&&(Ih(e.directives,"directive",n),e.temps>0&&l()),e.filters&&e.filters.length&&(l(),Ih(e.filters,"filter",n),l()),e.temps>0){r("let ");for(let t=0;t<e.temps;t++)r(`${t>0?", ":""}_temp${t}`)}return(e.components.length||e.directives.length||e.temps)&&(r("\n",0),l()),c||r("return "),e.codegenNode?Ch(e.codegenNode,n):r("null"),p&&(a(),r("}")),a(),r("}"),{ast:e,code:n.code,preamble:"",map:n.map?n.map.toJSON():void 0}}function Ih(e,t,{helper:n,push:i,newline:r,isTS:s}){const o=n("filter"===t?lc:"component"===t?sc:ac);for(let n=0;n<e.length;n++){let a=e[n];const l=a.endsWith("__self");l&&(a=a.slice(0,-6)),i(`const ${Ad(a,t)} = ${o}(${JSON.stringify(a)}${l?", true":""})${s?"!":""}`),n<e.length-1&&r()}}function Ah(e,t){const n=e.length>3||!1;t.push("["),n&&t.indent(),Sh(e,t,n),n&&t.deindent(),t.push("]")}function Sh(e,t,n=!1,i=!0){const{push:r,newline:s}=t;for(let o=0;o<e.length;o++){const a=e[o];C(a)?r(a,-3):E(a)?Ah(a,t):Ch(a,t),o<e.length-1&&(n?(i&&r(","),s()):i&&r(", "))}}function Ch(e,t){if(C(e))t.push(e,-3);else if(O(e))t.push(t.helper(e));else switch(e.type){case 1:case 9:case 11:case 12:Ch(e.codegenNode,t);break;case 2:!function(e,t){t.push(JSON.stringify(e.content),-3,e)}(e,t);break;case 4:Oh(e,t);break;case 5:!function(e,t){const{push:n,helper:i,pure:r}=t;r&&n(xh);n(`${i(pc)}(`),Ch(e.content,t),n(")")}(e,t);break;case 8:Mh(e,t);break;case 3:!function(e,t){const{push:n,helper:i,pure:r}=t;r&&n(xh);n(`${i(nc)}(${JSON.stringify(e.content)})`,-3,e)}(e,t);break;case 13:!function(e,t){const{push:n,helper:i,pure:r}=t,{tag:s,props:o,children:a,patchFlag:l,dynamicProps:u,directives:c,isBlock:d,disableTracking:h,isComponent:p}=e;let f;l&&(f=String(l));c&&n(i(uc)+"(");d&&n(`(${i(Zu)}(${h?"true":""}), `);r&&n(xh);const m=d?jc(t.inSSR,p):Vc(t.inSSR,p);n(i(m)+"(",-2,e),Sh(function(e){let t=e.length;for(;t--&&null==e[t];);return e.slice(0,t+1).map(e=>e||"null")}([s,o,a,f,u]),t),n(")"),d&&n(")");c&&(n(", "),Ch(c,t),n(")"))}(e,t);break;case 14:!function(e,t){const{push:n,helper:i,pure:r}=t,s=C(e.callee)?e.callee:i(e.callee);r&&n(xh);n(s+"(",-2,e),Sh(e.arguments,t),n(")")}(e,t);break;case 15:!function(e,t){const{push:n,indent:i,deindent:r,newline:s}=t,{properties:o}=e;if(!o.length)return void n("{}",-2,e);const a=o.length>1||!1;n(a?"{":"{ "),a&&i();for(let e=0;e<o.length;e++){const{key:i,value:r}=o[e];Rh(i,t),n(": "),Ch(r,t),e<o.length-1&&(n(","),s())}a&&r(),n(a?"}":" }")}(e,t);break;case 17:!function(e,t){Ah(e.elements,t)}(e,t);break;case 18:!function(e,t){const{push:n,indent:i,deindent:r}=t,{params:s,returns:o,body:a,newline:l,isSlot:u}=e;u&&n(`_${Rc[Ac]}(`);n("(",-2,e),E(s)?Sh(s,t):s&&Ch(s,t);n(") => "),(l||a)&&(n("{"),i());o?(l&&n("return "),E(o)?Ah(o,t):Ch(o,t)):a&&Ch(a,t);(l||a)&&(r(),n("}"));u&&(e.isNonScopedSlot&&n(", undefined, true"),n(")"))}(e,t);break;case 19:!function(e,t){const{test:n,consequent:i,alternate:r,newline:s}=e,{push:o,indent:a,deindent:l,newline:u}=t;if(4===n.type){const e=!ad(n.content);e&&o("("),Oh(n,t),e&&o(")")}else o("("),Ch(n,t),o(")");s&&a(),t.indentLevel++,s||o(" "),o("? "),Ch(i,t),t.indentLevel--,s&&u(),s||o(" "),o(": ");const c=19===r.type;c||t.indentLevel++;Ch(r,t),c||t.indentLevel--;s&&l(!0)}(e,t);break;case 20:!function(e,t){const{push:n,helper:i,indent:r,deindent:s,newline:o}=t,{needPauseTracking:a,needArraySpread:l}=e;l&&n("[...(");n(`_cache[${e.index}] || (`),a&&(r(),n(`${i(Ec)}(-1`),e.inVOnce&&n(", true"),n("),"),o(),n("("));n(`_cache[${e.index}] = `),Ch(e.value,t),a&&(n(`).cacheIndex = ${e.index},`),o(),n(`${i(Ec)}(1),`),o(),n(`_cache[${e.index}]`),s());n(")"),l&&n(")]")}(e,t);break;case 21:Sh(e.body,t,!0,!1)}}function Oh(e,t){const{content:n,isStatic:i}=e;t.push(i?JSON.stringify(n):n,-3,e)}function Mh(e,t){for(let n=0;n<e.children.length;n++){const i=e.children[n];C(i)?t.push(i,-3):Ch(i,t)}}function Rh(e,t){const{push:n}=t;if(8===e.type)n("["),Mh(e,t),n("]");else if(e.isStatic){n(ad(e.content)?e.content:JSON.stringify(e.content),-2,e)}else n(`[${e.content}]`,-3,e)}new RegExp("\\b"+"arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b")+"\\b");const kh=Th(/^(if|else|else-if)$/,(e,t,n)=>function(e,t,n,i){if(!("else"===t.name||t.exp&&t.exp.content.trim())){const i=t.exp?t.exp.loc:e.loc;n.onError(id(28,t.loc)),t.exp=Pc("true",!1,i)}0;if("if"===t.name){const r=Nh(e,t),s={type:9,loc:rh(e.loc),branches:[r]};if(n.replaceNode(s),i)return i(s,r,!0)}else{const r=n.parent.children;let s=r.indexOf(e);for(;s-- >=-1;){const o=r[s];if(o&&3===o.type)n.removeNode(o);else{if(!o||2!==o.type||o.content.trim().length){if(o&&9===o.type){"else-if"===t.name&&void 0===o.branches[o.branches.length-1].condition&&n.onError(id(30,e.loc)),n.removeNode();const r=Nh(e,t);0,o.branches.push(r);const s=i&&i(o,r,!1);bh(r,n),s&&s(),n.currentNode=null}else n.onError(id(30,e.loc));break}n.removeNode(o)}}}}(e,t,n,(e,t,i)=>{const r=n.parent.children;let s=r.indexOf(e),o=0;for(;s-- >=0;){const e=r[s];e&&9===e.type&&(o+=e.branches.length)}return()=>{if(i)e.codegenNode=Dh(t,o,n);else{const i=function(e){for(;;)if(19===e.type){if(19!==e.alternate.type)return e;e=e.alternate}else 20===e.type&&(e=e.value)}(e.codegenNode);i.alternate=Dh(t,o+e.branches.length-1,n)}}}));function Nh(e,t){const n=3===e.tagType;return{type:10,loc:e.loc,condition:"else"===t.name?void 0:t.exp,children:n&&!md(e,"for")?e.children:[e],userKey:gd(e,"key"),isTemplateIf:n}}function Dh(e,t,n){return e.condition?zc(e.condition,Fh(e,t,n),$c(n.helper(nc),['""',"true"])):Fh(e,t,n)}function Fh(e,t,n){const{helper:i}=n,r=Lc("key",Pc(`${t}`,!1,kc,2)),{children:s}=e,o=s[0];if(1!==s.length||1!==o.type){if(1===s.length&&11===o.type){const e=o.codegenNode;return wd(e,r,n),e}{let t=64;return Nc(n,i(Hu),Fc([r]),s,t,void 0,void 0,!0,!1,!1,e.loc)}}{const e=o.codegenNode,t=14===(a=e).type&&a.callee===Oc?a.arguments[1].returns:a;return 13===t.type&&Yc(t,n),wd(t,r,n),e}var a}const Lh=(e,t,n)=>{const{modifiers:i,loc:r}=e,s=e.arg;let{exp:o}=e;if(o&&4===o.type&&!o.content.trim()&&(o=void 0),!o){if(4!==s.type||!s.isStatic)return n.onError(id(52,s.loc)),{props:[Lc(s,Pc("",!0,r))]};Ph(e),o=e.exp}return 4!==s.type?(s.children.unshift("("),s.children.push(') || ""')):s.isStatic||(s.content=`${s.content} || ""`),i.some(e=>"camel"===e.content)&&(4===s.type?s.isStatic?s.content=V(s.content):s.content=`${n.helperString(bc)}(${s.content})`:(s.children.unshift(`${n.helperString(bc)}(`),s.children.push(")"))),n.inSSR||(i.some(e=>"prop"===e.content)&&Bh(s,"."),i.some(e=>"attr"===e.content)&&Bh(s,"^")),{props:[Lc(s,o)]}},Ph=(e,t)=>{const n=e.arg,i=V(n.content);e.exp=Pc(i,!1,n.loc)},Bh=(e,t)=>{4===e.type?e.isStatic?e.content=t+e.content:e.content=`\`${t}\${${e.content}}\``:(e.children.unshift(`'${t}' + (`),e.children.push(")"))},$h=Th("for",(e,t,n)=>{const{helper:i,removeHelper:r}=n;return function(e,t,n,i){if(!t.exp)return void n.onError(id(31,t.loc));const r=t.forParseResult;if(!r)return void n.onError(id(32,t.loc));Uh(r,n);const{addIdentifiers:s,removeIdentifiers:o,scopes:a}=n,{source:l,value:u,key:c,index:d}=r,h={type:11,loc:t.loc,source:l,valueAlias:u,keyAlias:c,objectIndexAlias:d,parseResult:r,children:bd(e)?e.children:[e]};n.replaceNode(h),a.vFor++;const p=i&&i(h);return()=>{a.vFor--,p&&p()}}(e,t,n,t=>{const s=$c(i(cc),[t.source]),o=bd(e),a=md(e,"memo"),l=gd(e,"key",!1,!0);l&&7===l.type&&!l.exp&&Ph(l);let u=l&&(6===l.type?l.value?Pc(l.value.content,!0):void 0:l.exp);const c=l&&u?Lc("key",u):null,d=4===t.source.type&&t.source.constType>0,h=d?64:l?128:256;return t.codegenNode=Nc(n,i(Hu),void 0,s,h,void 0,void 0,!0,!d,!1,e.loc),()=>{let l;const{children:h}=t;const p=1!==h.length||1!==h[0].type,f=Td(e)?e:o&&1===e.children.length&&Td(e.children[0])?e.children[0]:null;if(f?(l=f.codegenNode,o&&c&&wd(l,c,n)):p?l=Nc(n,i(Hu),c?Fc([c]):void 0,e.children,64,void 0,void 0,!0,void 0,!1):(l=h[0].codegenNode,o&&c&&wd(l,c,n),l.isBlock!==!d&&(l.isBlock?(r(Zu),r(jc(n.inSSR,l.isComponent))):r(Vc(n.inSSR,l.isComponent))),l.isBlock=!d,l.isBlock?(i(Zu),i(jc(n.inSSR,l.isComponent))):i(Vc(n.inSSR,l.isComponent))),a){const e=Uc(zh(t.parseResult,[Pc("_cached")]));e.body={type:21,body:[Bc(["const _memo = (",a.exp,")"]),Bc(["if (_cached",...u?[" && _cached.key === ",u]:[],` && ${n.helperString(Mc)}(_cached, _memo)) return _cached`]),Bc(["const _item = ",l]),Pc("_item.memo = _memo"),Pc("return _item")],loc:kc},s.arguments.push(e,Pc("_cache"),Pc(String(n.cached.length))),n.cached.push(null)}else s.arguments.push(Uc(zh(t.parseResult),l,!0))}})});function Uh(e,t){e.finalized||(e.finalized=!0)}function zh({value:e,key:t,index:n},i=[]){return function(e){let t=e.length;for(;t--&&!e[t];);return e.slice(0,t+1).map((e,t)=>e||Pc("_".repeat(t+1),!1))}([e,t,n,...i])}const Vh=Pc("undefined",!1),jh=(e,t)=>{if(1===e.type&&(1===e.tagType||3===e.tagType)){const n=md(e,"slot");if(n)return n.exp,t.scopes.vSlot++,()=>{t.scopes.vSlot--}}},Yh=(e,t,n,i)=>Uc(e,n,!1,!0,n.length?n[0].loc:i);function Gh(e,t,n=Yh){t.helper(Ac);const{children:i,loc:r}=e,s=[],o=[];let a=t.scopes.vSlot>0||t.scopes.vFor>0;const l=md(e,"slot",!0);if(l){const{arg:e,exp:t}=l;e&&!rd(e)&&(a=!0),s.push(Lc(e||Pc("default",!0),n(t,void 0,i,r)))}let u=!1,c=!1;const d=[],h=new Set;let p=0;for(let e=0;e<i.length;e++){const r=i[e];let f;if(!bd(r)||!(f=md(r,"slot",!0))){3!==r.type&&d.push(r);continue}if(l){t.onError(id(37,f.loc));break}u=!0;const{children:m,loc:g}=r,{arg:y=Pc("default",!0),exp:_,loc:v}=f;let b;rd(y)?b=y?y.content:"default":a=!0;const T=md(r,"for"),x=n(_,T,m,g);let E,w;if(E=md(r,"if"))a=!0,o.push(zc(E.exp,Hh(y,x,p++),Vh));else if(w=md(r,/^else(-if)?$/,!0)){let n,r=e;for(;r--&&(n=i[r],3===n.type););if(n&&bd(n)&&md(n,/^(else-)?if$/)){let e=o[o.length-1];for(;19===e.alternate.type;)e=e.alternate;e.alternate=w.exp?zc(w.exp,Hh(y,x,p++),Vh):Hh(y,x,p++)}else t.onError(id(30,w.loc))}else if(T){a=!0;const e=T.forParseResult;e?(Uh(e),o.push($c(t.helper(cc),[e.source,Uc(zh(e),Hh(y,x),!0)]))):t.onError(id(32,T.loc))}else{if(b){if(h.has(b)){t.onError(id(38,v));continue}h.add(b),"default"===b&&(c=!0)}s.push(Lc(y,x))}}if(!l){const e=(e,i)=>{const s=n(e,void 0,i,r);return t.compatConfig&&(s.isNonScopedSlot=!0),Lc("default",s)};u?d.length&&d.some(e=>Xh(e))&&(c?t.onError(id(39,d[0].loc)):s.push(e(void 0,d))):s.push(e(void 0,i))}const f=a?2:Wh(e.children)?3:1;let m=Fc(s.concat(Lc("_",Pc(f+"",!1))),r);return o.length&&(m=$c(t.helper(hc),[m,Dc(o)])),{slots:m,hasDynamicSlots:a}}function Hh(e,t,n){const i=[Lc("name",e),Lc("fn",t)];return null!=n&&i.push(Lc("key",Pc(String(n),!0))),Fc(i)}function Wh(e){for(let t=0;t<e.length;t++){const n=e[t];switch(n.type){case 1:if(2===n.tagType||Wh(n.children))return!0;break;case 9:if(Wh(n.branches))return!0;break;case 10:case 11:if(Wh(n.children))return!0}}return!1}function Xh(e){return 2!==e.type&&12!==e.type||(2===e.type?!!e.content.trim():Xh(e.content))}const qh=new WeakMap,Kh=(e,t)=>function(){if(1!==(e=t.currentNode).type||0!==e.tagType&&1!==e.tagType)return;const{tag:n,props:i}=e,r=1===e.tagType;let s=r?function(e,t,n=!1){let{tag:i}=e;const r=ep(i),s=gd(e,"is",!1,!0);if(s)if(r||Jc("COMPILER_IS_ON_ELEMENT",t)){let e;if(6===s.type?e=s.value&&Pc(s.value.content,!0):(e=s.exp,e||(e=Pc("is",!1,s.arg.loc))),e)return $c(t.helper(oc),[e])}else 6===s.type&&s.value.content.startsWith("vue:")&&(i=s.value.content.slice(4));const o=sd(i)||t.isBuiltInComponent(i);if(o)return n||t.helper(o),o;return t.helper(sc),t.components.add(i),Ad(i,"component")}(e,t):`"${n}"`;const o=M(s)&&s.callee===oc;let a,l,u,c,d,h=0,p=o||s===Wu||s===Xu||!r&&("svg"===n||"foreignObject"===n||"math"===n);if(i.length>0){const n=Zh(e,t,void 0,r,o);a=n.props,h=n.patchFlag,c=n.dynamicPropNames;const i=n.directives;d=i&&i.length?Dc(i.map(e=>function(e,t){const n=[],i=qh.get(e);i?n.push(t.helperString(i)):(t.helper(ac),t.directives.add(e.name),n.push(Ad(e.name,"directive")));const{loc:r}=e;e.exp&&n.push(e.exp);e.arg&&(e.exp||n.push("void 0"),n.push(e.arg));if(Object.keys(e.modifiers).length){e.arg||(e.exp||n.push("void 0"),n.push("void 0"));const t=Pc("true",!1,r);n.push(Fc(e.modifiers.map(e=>Lc(e,t)),r))}return Dc(n,e.loc)}(e,t))):void 0,n.shouldUseBlock&&(p=!0)}if(e.children.length>0){s===qu&&(p=!0,h|=1024);if(r&&s!==Wu&&s!==qu){const{slots:n,hasDynamicSlots:i}=Gh(e,t);l=n,i&&(h|=1024)}else if(1===e.children.length&&s!==Wu){const n=e.children[0],i=n.type,r=5===i||8===i;r&&0===ph(n,t)&&(h|=1),l=r||2===i?n:e.children}else l=e.children}c&&c.length&&(u=function(e){let t="[";for(let n=0,i=e.length;n<i;n++)t+=JSON.stringify(e[n]),n<i-1&&(t+=", ");return t+"]"}(c)),e.codegenNode=Nc(t,s,a,l,0===h?void 0:h,u,d,!!p,!1,r,e.loc)};function Zh(e,t,n=e.props,i,r,s=!1){const{tag:o,loc:a,children:l}=e;let u=[];const c=[],d=[],h=l.length>0;let p=!1,f=0,m=!1,g=!1,_=!1,v=!1,b=!1,T=!1;const x=[],E=e=>{u.length&&(c.push(Fc(Qh(u),a)),u=[]),e&&c.push(e)},w=()=>{t.scopes.vFor>0&&u.push(Lc(Pc("ref_for",!0),Pc("true")))},I=({key:e,value:n})=>{if(rd(e)){const s=e.content,o=y(s);if(!o||i&&!r||"onclick"===s.toLowerCase()||"onUpdate:modelValue"===s||P(s)||(v=!0),o&&P(s)&&(T=!0),o&&14===n.type&&(n=n.arguments[0]),20===n.type||(4===n.type||8===n.type)&&ph(n,t)>0)return;"ref"===s?m=!0:"class"===s?g=!0:"style"===s?_=!0:"key"===s||x.includes(s)||x.push(s),!i||"class"!==s&&"style"!==s||x.includes(s)||x.push(s)}else b=!0};for(let r=0;r<n.length;r++){const l=n[r];if(6===l.type){const{loc:e,name:n,nameLoc:i,value:r}=l;let s=!0;if("ref"===n&&(m=!0,w()),"is"===n&&(ep(o)||r&&r.content.startsWith("vue:")||Jc("COMPILER_IS_ON_ELEMENT",t)))continue;u.push(Lc(Pc(n,!0,i),Pc(r?r.content:"",s,r?r.loc:e)))}else{const{name:n,arg:r,exp:m,loc:g,modifiers:y}=l,_="bind"===n,v="on"===n;if("slot"===n){i||t.onError(id(40,g));continue}if("once"===n||"memo"===n)continue;if("is"===n||_&&yd(r,"is")&&(ep(o)||Jc("COMPILER_IS_ON_ELEMENT",t)))continue;if(v&&s)continue;if((_&&yd(r,"key")||v&&h&&yd(r,"vue:before-update"))&&(p=!0),_&&yd(r,"ref")&&w(),!r&&(_||v)){if(b=!0,m)if(_){if(w(),E(),Jc("COMPILER_V_BIND_OBJECT_ORDER",t)){c.unshift(m);continue}c.push(m)}else E({type:14,loc:g,callee:t.helper(vc),arguments:i?[m]:[m,"true"]});else t.onError(id(_?34:35,g));continue}_&&y.some(e=>"prop"===e.content)&&(f|=32);const T=t.directiveTransforms[n];if(T){const{props:n,needRuntime:i}=T(l,e,t);!s&&n.forEach(I),v&&r&&!rd(r)?E(Fc(n,a)):u.push(...n),i&&(d.push(l),O(i)&&qh.set(l,i))}else B(n)||(d.push(l),h&&(p=!0))}}let A;if(c.length?(E(),A=c.length>1?$c(t.helper(fc),c,a):c[0]):u.length&&(A=Fc(Qh(u),a)),b?f|=16:(g&&!i&&(f|=2),_&&!i&&(f|=4),x.length&&(f|=8),v&&(f|=32)),p||0!==f&&32!==f||!(m||T||d.length>0)||(f|=512),!t.inSSR&&A)switch(A.type){case 15:let e=-1,n=-1,i=!1;for(let t=0;t<A.properties.length;t++){const r=A.properties[t].key;rd(r)?"class"===r.content?e=t:"style"===r.content&&(n=t):r.isHandlerKey||(i=!0)}const r=A.properties[e],s=A.properties[n];i?A=$c(t.helper(yc),[A]):(r&&!rd(r.value)&&(r.value=$c(t.helper(mc),[r.value])),s&&(_||4===s.value.type&&"["===s.value.content.trim()[0]||17===s.value.type)&&(s.value=$c(t.helper(gc),[s.value])));break;case 14:break;default:A=$c(t.helper(yc),[$c(t.helper(_c),[A])])}return{props:A,directives:d,patchFlag:f,dynamicPropNames:x,shouldUseBlock:p}}function Qh(e){const t=new Map,n=[];for(let i=0;i<e.length;i++){const r=e[i];if(8===r.key.type||!r.key.isStatic){n.push(r);continue}const s=r.key.content,o=t.get(s);o?("style"===s||"class"===s||y(s))&&Jh(o,r):(t.set(s,r),n.push(r))}return n}function Jh(e,t){17===e.value.type?e.value.elements.push(t.value):e.value=Dc([e.value,t.value],e.loc)}function ep(e){return"component"===e||"Component"===e}const tp=(e,t)=>{if(Td(e)){const{children:n,loc:i}=e,{slotName:r,slotProps:s}=function(e,t){let n,i='"default"';const r=[];for(let t=0;t<e.props.length;t++){const n=e.props[t];if(6===n.type)n.value&&("name"===n.name?i=JSON.stringify(n.value.content):(n.name=V(n.name),r.push(n)));else if("bind"===n.name&&yd(n.arg,"name")){if(n.exp)i=n.exp;else if(n.arg&&4===n.arg.type){const e=V(n.arg.content);i=n.exp=Pc(e,!1,n.arg.loc)}}else"bind"===n.name&&n.arg&&rd(n.arg)&&(n.arg.content=V(n.arg.content)),r.push(n)}if(r.length>0){const{props:i,directives:s}=Zh(e,t,r,!1,!1);n=i,s.length&&t.onError(id(36,s[0].loc))}return{slotName:i,slotProps:n}}(e,t),o=[t.prefixIdentifiers?"_ctx.$slots":"$slots",r,"{}","undefined","true"];let a=2;s&&(o[2]=s,a=3),n.length&&(o[3]=Uc([],n,!1,!1,i),a=4),t.scopeId&&!t.slotted&&(a=5),o.splice(a),e.codegenNode=$c(t.helper(dc),o,i)}};const np=(e,t,n,i)=>{const{loc:r,modifiers:s,arg:o}=e;let a;if(e.exp||s.length||n.onError(id(35,r)),4===o.type)if(o.isStatic){let e=o.content;0,e.startsWith("vue:")&&(e=`vnode-${e.slice(4)}`);a=Pc(0!==t.tagType||e.startsWith("vnode")||!/[A-Z]/.test(e)?H(V(e)):`on:${e}`,!0,o.loc)}else a=Bc([`${n.helperString(xc)}(`,o,")"]);else a=o,a.children.unshift(`${n.helperString(xc)}(`),a.children.push(")");let l=e.exp;l&&!l.content.trim()&&(l=void 0);let u=n.cacheHandlers&&!l&&!n.inVOnce;if(l){const e=hd(l),t=!(e||fd(l)),n=l.content.includes(";");0,(t||u&&e)&&(l=Bc([`${t?"$event":"(...args)"} => ${n?"{":"("}`,l,n?"}":")"]))}let c={props:[Lc(a,l||Pc("() => {}",!1,r))]};return i&&(c=i(c)),u&&(c.props[0].value=n.cache(c.props[0].value)),c.props.forEach(e=>e.key.isHandlerKey=!0),c},ip=(e,t)=>{if(0===e.type||1===e.type||11===e.type||10===e.type)return()=>{const n=e.children;let i,r=!1;for(let e=0;e<n.length;e++){const t=n[e];if(_d(t)){r=!0;for(let r=e+1;r<n.length;r++){const s=n[r];if(!_d(s)){i=void 0;break}i||(i=n[e]=Bc([t],t.loc)),i.children.push(" + ",s),n.splice(r,1),r--}}}if(r&&(1!==n.length||0!==e.type&&(1!==e.type||0!==e.tagType||e.props.find(e=>7===e.type&&!t.directiveTransforms[e.name])||"template"===e.tag)))for(let e=0;e<n.length;e++){const i=n[e];if(_d(i)||8===i.type){const r=[];2===i.type&&" "===i.content||r.push(i),t.ssr||0!==ph(i,t)||r.push("1"),n[e]={type:12,content:i,loc:i.loc,codegenNode:$c(t.helper(ic),r)}}}}},rp=new WeakSet,sp=(e,t)=>{if(1===e.type&&md(e,"once",!0)){if(rp.has(e)||t.inVOnce||t.inSSR)return;return rp.add(e),t.inVOnce=!0,t.helper(Ec),()=>{t.inVOnce=!1;const e=t.currentNode;e.codegenNode&&(e.codegenNode=t.cache(e.codegenNode,!0,!0))}}},op=(e,t,n)=>{const{exp:i,arg:r}=e;if(!i)return n.onError(id(41,e.loc)),ap();const s=i.loc.source.trim(),o=4===i.type?i.content:s,a=n.bindingMetadata[s];if("props"===a||"props-aliased"===a)return n.onError(id(44,i.loc)),ap();if(!o.trim()||!hd(i))return n.onError(id(42,i.loc)),ap();const l=r||Pc("modelValue",!0),u=r?rd(r)?`onUpdate:${V(r.content)}`:Bc(['"onUpdate:" + ',r]):"onUpdate:modelValue";let c;c=Bc([`${n.isTS?"($event: any)":"$event"} => ((`,i,") = $event)"]);const d=[Lc(l,e.exp),Lc(u,c)];if(e.modifiers.length&&1===t.tagType){const t=e.modifiers.map(e=>e.content).map(e=>(ad(e)?e:JSON.stringify(e))+": true").join(", "),n=r?rd(r)?`${r.content}Modifiers`:Bc([r,' + "Modifiers"']):"modelModifiers";d.push(Lc(n,Pc(`{ ${t} }`,!1,e.loc,2)))}return ap(d)};function ap(e=[]){return{props:e}}const lp=/[\w).+\-_$\]]/,up=(e,t)=>{Jc("COMPILER_FILTERS",t)&&(5===e.type?cp(e.content,t):1===e.type&&e.props.forEach(e=>{7===e.type&&"for"!==e.name&&e.exp&&cp(e.exp,t)}))};function cp(e,t){if(4===e.type)dp(e,t);else for(let n=0;n<e.children.length;n++){const i=e.children[n];"object"==typeof i&&(4===i.type?dp(i,t):8===i.type?cp(e,t):5===i.type&&cp(i.content,t))}}function dp(e,t){const n=e.content;let i,r,s,o,a=!1,l=!1,u=!1,c=!1,d=0,h=0,p=0,f=0,m=[];for(s=0;s<n.length;s++)if(r=i,i=n.charCodeAt(s),a)39===i&&92!==r&&(a=!1);else if(l)34===i&&92!==r&&(l=!1);else if(u)96===i&&92!==r&&(u=!1);else if(c)47===i&&92!==r&&(c=!1);else if(124!==i||124===n.charCodeAt(s+1)||124===n.charCodeAt(s-1)||d||h||p){switch(i){case 34:l=!0;break;case 39:a=!0;break;case 96:u=!0;break;case 40:p++;break;case 41:p--;break;case 91:h++;break;case 93:h--;break;case 123:d++;break;case 125:d--}if(47===i){let e,t=s-1;for(;t>=0&&(e=n.charAt(t)," "===e);t--);e&&lp.test(e)||(c=!0)}}else void 0===o?(f=s+1,o=n.slice(0,s).trim()):g();function g(){m.push(n.slice(f,s).trim()),f=s+1}if(void 0===o?o=n.slice(0,s).trim():0!==f&&g(),m.length){for(s=0;s<m.length;s++)o=hp(o,m[s],t);e.content=o,e.ast=void 0}}function hp(e,t,n){n.helper(lc);const i=t.indexOf("(");if(i<0)return n.filters.add(t),`${Ad(t,"filter")}(${e})`;{const r=t.slice(0,i),s=t.slice(i+1);return n.filters.add(r),`${Ad(r,"filter")}(${e}${")"!==s?","+s:s}`}}const pp=new WeakSet,fp=(e,t)=>{if(1===e.type){const n=md(e,"memo");if(!n||pp.has(e))return;return pp.add(e),()=>{const i=e.codegenNode||t.currentNode.codegenNode;i&&13===i.type&&(1!==e.tagType&&Yc(i,t),e.codegenNode=$c(t.helper(Oc),[n.exp,Uc(void 0,i),"_cache",String(t.cached.length)]),t.cached.push(null))}}};function mp(e,t={}){const n=t.onError||td,i="module"===t.mode;!0===t.prefixIdentifiers?n(id(47)):i&&n(id(48));t.cacheHandlers&&n(id(49)),t.scopeId&&!i&&n(id(50));const r=v({},t,{prefixIdentifiers:!1}),s=C(e)?uh(e,r):e,[o,a]=[[sp,kh,fp,$h,up,tp,Kh,jh,ip],{on:np,bind:Lh,model:op}];return vh(s,v({},r,{nodeTransforms:[...o,...t.nodeTransforms||[]],directiveTransforms:v({},a,t.directiveTransforms||{})})),wh(s,r)}const gp=Symbol(""),yp=Symbol(""),_p=Symbol(""),vp=Symbol(""),bp=Symbol(""),Tp=Symbol(""),xp=Symbol(""),Ep=Symbol(""),wp=Symbol(""),Ip=Symbol("");var Ap;let Sp;Ap={[gp]:"vModelRadio",[yp]:"vModelCheckbox",[_p]:"vModelText",[vp]:"vModelSelect",[bp]:"vModelDynamic",[Tp]:"withModifiers",[xp]:"withKeys",[Ep]:"vShow",[wp]:"Transition",[Ip]:"TransitionGroup"},Object.getOwnPropertySymbols(Ap).forEach(e=>{Rc[e]=Ap[e]});const Cp={parseMode:"html",isVoidTag:de,isNativeTag:e=>le(e)||ue(e)||ce(e),isPreTag:e=>"pre"===e,isIgnoreNewlineTag:e=>"pre"===e||"textarea"===e,decodeEntities:function(e,t=!1){return Sp||(Sp=document.createElement("div")),t?(Sp.innerHTML=`<div foo="${e.replace(/"/g,"&quot;")}">`,Sp.children[0].getAttribute("foo")):(Sp.innerHTML=e,Sp.textContent)},isBuiltInComponent:e=>"Transition"===e||"transition"===e?wp:"TransitionGroup"===e||"transition-group"===e?Ip:void 0,getNamespace(e,t,n){let i=t?t.ns:n;if(t&&2===i)if("annotation-xml"===t.tag){if("svg"===e)return 1;t.props.some(e=>6===e.type&&"encoding"===e.name&&null!=e.value&&("text/html"===e.value.content||"application/xhtml+xml"===e.value.content))&&(i=0)}else/^m(?:[ions]|text)$/.test(t.tag)&&"mglyph"!==e&&"malignmark"!==e&&(i=0);else t&&1===i&&("foreignObject"!==t.tag&&"desc"!==t.tag&&"title"!==t.tag||(i=0));if(0===i){if("svg"===e)return 1;if("math"===e)return 2}return i}},Op=(e,t)=>{const n=se(e);return Pc(JSON.stringify(n),!1,t,3)};function Mp(e,t){return id(e,t)}const Rp=h("passive,once,capture"),kp=h("stop,prevent,self,ctrl,shift,alt,meta,exact,middle"),Np=h("left,right"),Dp=h("onkeyup,onkeydown,onkeypress"),Fp=(e,t)=>rd(e)&&"onclick"===e.content.toLowerCase()?Pc(t,!0):4!==e.type?Bc(["(",e,`) === "onClick" ? "${t}" : (`,e,")"]):e;const Lp=(e,t)=>{1!==e.type||0!==e.tagType||"script"!==e.tag&&"style"!==e.tag||t.removeNode()};const Pp=[e=>{1===e.type&&e.props.forEach((t,n)=>{6===t.type&&"style"===t.name&&t.value&&(e.props[n]={type:7,name:"bind",arg:Pc("style",!0,t.loc),exp:Op(t.value.content,t.loc),modifiers:[],loc:t.loc})})}],Bp={cloak:()=>({props:[]}),html:(e,t,n)=>{const{exp:i,loc:r}=e;return i||n.onError(Mp(53,r)),t.children.length&&(n.onError(Mp(54,r)),t.children.length=0),{props:[Lc(Pc("innerHTML",!0,r),i||Pc("",!0))]}},text:(e,t,n)=>{const{exp:i,loc:r}=e;return i||n.onError(Mp(55,r)),t.children.length&&(n.onError(Mp(56,r)),t.children.length=0),{props:[Lc(Pc("textContent",!0),i?ph(i,n)>0?i:$c(n.helperString(pc),[i],r):Pc("",!0))]}},model:(e,t,n)=>{const i=op(e,t,n);if(!i.props.length||1===t.tagType)return i;e.arg&&n.onError(Mp(58,e.arg.loc));const{tag:r}=t,s=n.isCustomElement(r);if("input"===r||"textarea"===r||"select"===r||s){let o=_p,a=!1;if("input"===r||s){const i=gd(t,"type");if(i){if(7===i.type)o=bp;else if(i.value)switch(i.value.content){case"radio":o=gp;break;case"checkbox":o=yp;break;case"file":a=!0,n.onError(Mp(59,e.loc))}}else(function(e){return e.props.some(e=>!(7!==e.type||"bind"!==e.name||e.arg&&4===e.arg.type&&e.arg.isStatic))})(t)&&(o=bp)}else"select"===r&&(o=vp);a||(i.needRuntime=n.helper(o))}else n.onError(Mp(57,e.loc));return i.props=i.props.filter(e=>!(4===e.key.type&&"modelValue"===e.key.content)),i},on:(e,t,n)=>np(e,t,n,t=>{const{modifiers:i}=e;if(!i.length)return t;let{key:r,value:s}=t.props[0];const{keyModifiers:o,nonKeyModifiers:a,eventOptionModifiers:l}=((e,t,n)=>{const i=[],r=[],s=[];for(let o=0;o<t.length;o++){const a=t[o].content;"native"===a&&ed("COMPILER_V_ON_NATIVE",n)||Rp(a)?s.push(a):Np(a)?rd(e)?Dp(e.content.toLowerCase())?i.push(a):r.push(a):(i.push(a),r.push(a)):kp(a)?r.push(a):i.push(a)}return{keyModifiers:i,nonKeyModifiers:r,eventOptionModifiers:s}})(r,i,n,e.loc);if(a.includes("right")&&(r=Fp(r,"onContextmenu")),a.includes("middle")&&(r=Fp(r,"onMouseup")),a.length&&(s=$c(n.helper(Tp),[s,JSON.stringify(a)])),!o.length||rd(r)&&!Dp(r.content.toLowerCase())||(s=$c(n.helper(xp),[s,JSON.stringify(o)])),l.length){const e=l.map(G).join("");r=rd(r)?Pc(`${r.content}${e}`,!0):Bc(["(",r,`) + "${e}"`])}return{props:[Lc(r,s)]}}),show:(e,t,n)=>{const{exp:i,loc:r}=e;return i||n.onError(Mp(61,r)),{props:[],needRuntime:n.helper(Ep)}}};const $p=Object.create(null);Ma(function(e,t){if(!C(e)){if(!e.nodeType)return m;e=e.innerHTML}const n=function(e,t){return e+JSON.stringify(t,(e,t)=>"function"==typeof t?t.toString():t)}(e,t),r=$p[n];if(r)return r;if("#"===e[0]){const t=document.querySelector(e);0,e=t?t.innerHTML:""}const s=v({hoistStatic:!0,onError:void 0,onWarn:m},t);s.isCustomElement||"undefined"==typeof customElements||(s.isCustomElement=e=>!!customElements.get(e));const{code:o}=function(e,t={}){return mp(e,v({},Cp,t,{nodeTransforms:[Lp,...Pp,...t.nodeTransforms||[]],directiveTransforms:v({},Bp,t.directiveTransforms||{}),transformHoist:null}))}(e,s),a=new Function("Vue",o)(i);return a._rc=!0,$p[n]=a});var Up=n(66619),zp=n.n(Up);const Vp={stage:new(zp().Container),pointer:{x:0,y:0},backgroundSprite:null,sprites:{},texts:{},counter:0,keys:{},state:!1,running:!1,repeatPlay:()=>{},displayTag:!1,processingDisplayEvent:null,successDisplayEvents:[],successProcessingDisplayEvents:[],startTime:performance.now(),timer:0,lastFrameTime:null,lastSecond:null,targetFPS:60,frameCount:0,currentFPS:60,canvasHeight:450,canvasWidth:800,gameLoop:()=>{1==Vp.state&&(Vp.repeatPlay(),Vp.gameLoopDisplay()),Vp.timer=performance.now()-Vp.startTime},animate:e=>{e-Vp.lastFrameTime>=1e3/Vp.targetFPS&&(Vp.frameCount++,Vp.gameLoop(),Vp.renderer.render(Vp.stage),Vp.lastFrameTime=e),e-Vp.lastSecond>=1e3&&(Vp.currentFPS=Vp.frameCount,Vp.frameCount=0,Vp.lastSecond=e),requestAnimationFrame(Vp.animate)}};Vp.createBackground=(e,t=0)=>{var n;return 0==t&&(n=new(zp().Sprite.fromImage)(`../common/media/spriteimg/${e}.png`)),n.name="background",n.anchor.set(.5),n.x=Vp.canvasWidth/2,n.y=Vp.canvasHeight/2,n.width=Vp.canvasWidth,n.height=Vp.canvasHeight,n.interactive=!0,n.buttonMode=!0,n.isDown=!1,n.isUp=!0,n.on("mousedown",function(){this.isDown=!0,this.isUp=!1,Vp.state&&this.runningMouseDown()}).on("mouseup",function(){this.isDown=!1,this.isUp=!0}).on("mouseupoutside",function(){this.isDown=!1,this.isUp=!0}),n.runningMouseDown=new Function(""),Vp.backgroundSprite&&Vp.backgroundSprite.parent&&Vp.stage.removeChild(Vp.backgroundSprite),Vp.backgroundSprite=n,Vp.stage.addChildAt(Vp.backgroundSprite,0),0},Vp.createASprite=(e,t=Vp.canvasWidth/2,n=Vp.canvasHeight/2,i="",r=0)=>{var s;return""==i&&(i="sprite"+ ++Vp.counter),0==r&&(s=new(zp().Sprite.fromImage)(`../common/media/spriteimg/${e}.png`)),Vp.sprites[i]||Vp.texts[i]||(s.name=i,s.anchor.set(.5),s.x=t,s.y=n,s.interactive=!0,s.buttonMode=!0,s.isDown=!1,s.isUp=!0,s.on("mousedown",function(e){this.isDown=!0,this.isUp=!1,Vp.state?this.runningMouseDown():(this.data=e.data,this.alpha=.5,this.dragging=!0)}).on("mouseup",function(){this.isDown=!1,this.isUp=!0,Vp.state||(this.alpha=1,this.dragging=!1,this.data=null)}).on("mouseupoutside",function(){this.isDown=!1,this.isUp=!0,Vp.state||(this.alpha=1,this.dragging=!1,this.data=null)}).on("mousemove",function(){if(!Vp.state&&this.dragging){var e=this.data.getLocalPosition(this.parent);this.position.x=e.x,this.position.y=e.y}}),s.runningMouseDown=new Function(""),s.show=function(){this.visible=!0},s.hide=function(){this.visible=!1},s.enlarge=function(e){const t=this.height/this.width;var n=Math.sqrt(this.height*this.width);n+=e,this.width=Math.sqrt(n*n/t),this.height=this.width*t},s.enlargeTo=function(e){var t=this.height/this.width;this.width=Math.sqrt(e*e/t),this.height=this.width*t},s.expandTo=async function(e,t=1){if(Vp.running){Vp.displayTag=!0,Vp.processingDisplayEvent={sprite:this,targetS:e,totalTime:1e3*t,startTime:performance.now(),displayType:"expand"};var n=new Promise(e=>{if(!1===Vp.displayTag)e();else{const t=setInterval(()=>{!1===Vp.displayTag&&(clearInterval(t),e())},10)}});return await n}return Vp.successProcessingDisplayEvents.push({sprite:this,targetS:e,totalTime:1e3*t,startTime:performance.now(),displayType:"expand"}),0},s.move=function(e){this.x+=e*Math.cos(this.rotation),this.y+=e*Math.sin(this.rotation)},s.moveTo=function(e,t){this.x=e,this.y=t},s.slideTo=async function(e,t,n=1){if(Vp.running){Vp.displayTag=!0,Vp.processingDisplayEvent={sprite:this,targetX:e,targetY:t,totalTime:1e3*n,startTime:performance.now(),displayType:"slide"};var i=new Promise(e=>{const t=setInterval(()=>{!1===Vp.displayTag&&(clearInterval(t),e())},10)});return await i}return Vp.successProcessingDisplayEvents.push({sprite:this,targetX:e,targetY:t,totalTime:1e3*n,startTime:performance.now(),displayType:"slide"}),0},s.addX=function(e){this.x+=e},s.addY=function(e){this.y+=e},s.rotate=function(e){this.rotation+=Math.PI/180*e},s.rotateTo=function(e){this.rotation=Math.PI/180*e},s.circleTo=async function(e,t=1){if(Vp.running){Vp.displayTag=!0,Vp.processingDisplayEvent={sprite:this,targetDegree:e,totalTime:1e3*t,startTime:performance.now(),displayType:"circle"};var n=new Promise(e=>{if(!1===Vp.displayTag)e();else{const t=setInterval(()=>{!1===Vp.displayTag&&(clearInterval(t),e())},10)}});return await n}return Vp.successProcessingDisplayEvents.push({sprite:this,targetDegree:e,totalTime:1e3*t,startTime:performance.now(),displayType:"circle"}),0},s.hit=function(e){return Vp.hitTestRectangle(this,e)},s.outOfScreen=function(){return this.y>=Vp.renderer.height||this.y<=0||this.x<=0||this.x>=Vp.renderer.width},s.mouseAction=function(e){this.runningMouseDown=e},s.setScale=function(e=0,t=0){0==e&&(e=this.height),0==t&&(t=this.width),this.height=e,this.width=t},s.filterGray=function(){const e=new(zp().filters.ColorMatrixFilter);e.blackAndWhite(),this.filters=[e]},s.filterBrighter=function(){const e=new(zp().filters.ColorMatrixFilter);e.brightness(1.25),this.filters=[e]},s.filterOrigin=function(){this.filters=null},Vp.stage.addChild(s),Vp.sprites[i]=s),i},Vp.clearAllSprites=()=>{Vp.backgroundSprite&&Vp.backgroundSprite.parent&&Vp.backgroundSprite.parent.removeChild(Vp.backgroundSprite);for(const e in Vp.sprites)Vp.sprites[e].parent.removeChild(Vp.sprites[e]),delete Vp.sprites[e];for(const e in Vp.texts)Vp.texts[e].parent.removeChild(Vp.texts[e]),delete Vp.texts[e];return Vp.counter=0,Vp.clearTimer(),0},Vp.createText=(e,t=Vp.canvasWidth/2,n=Vp.canvasHeight/2,i="")=>{if(""==i&&(i="text"+ ++Vp.counter),!Vp.sprites[i]&&!Vp.texts[i]){var r=new(zp().Text)(e);r.name=i,r.x=t,r.y=n,r.interactive=!0,r.buttonMode=!0,r.on("mousedown",function(e){this.isDown=!0,this.isUp=!1,Vp.state?this.runningMouseDown():(this.data=e.data,this.alpha=.5,this.dragging=!0)}).on("mouseup",function(){this.isDown=!1,this.isUp=!0,Vp.state||(this.alpha=1,this.dragging=!1,this.data=null)}).on("mouseupoutside",function(){this.isDown=!1,this.isUp=!0,Vp.state||(this.alpha=1,this.dragging=!1,this.data=null)}).on("mousemove",function(){if(!Vp.state&&this.dragging){var e=this.data.getLocalPosition(this.parent);this.position.x=e.x,this.position.y=e.y}}),r.runningMouseDown=new Function(""),r.changeText=function(e){this.text=e},r.show=function(){this.visible=!0},r.hide=function(){this.visible=!1},Vp.stage.addChild(r),Vp.texts[i]=r}return i},Vp.hitTestRectangle=(e,t)=>{let n,i,r,s,o;return n=!1,e.centerX=e.x+e.width/2,e.centerY=e.y+e.height/2,t.centerX=t.x+t.width/2,t.centerY=t.y+t.height/2,e.halfWidth=e.width/2,e.halfHeight=e.height/2,t.halfWidth=t.width/2,t.halfHeight=t.height/2,s=e.centerX-t.centerX,o=e.centerY-t.centerY,i=e.halfWidth+t.halfWidth,r=e.halfHeight+t.halfHeight,n=Math.abs(s)<i&&Math.abs(o)<r,n},Vp.repeat=e=>{Vp.repeatPlay=e},Vp.isKeyboardHit=e=>{if(!Vp.keys[e]){let t=Vp.keyboard(e);Vp.keys[e]=t}return Vp.keys[e].isDown},Vp.keyboardListener=(e,t)=>{if(Vp.keys[e])Vp.keys[e].press=function(){Vp.state&&t()};else{let n=Vp.keyboard(e);n.press=function(){Vp.state&&t()},Vp.keys[e]=n}},Vp.keyboard=e=>{let t={};t.value=e,t.isDown=!1,t.isUp=!0,t.press=void 0,t.release=void 0,t.downHandler=e=>{e.key===t.value&&(t.isUp&&t.press&&t.press(),t.isDown=!0,t.isUp=!1,e.preventDefault())},t.upHandler=e=>{e.key===t.value&&(t.isDown&&t.release&&t.release(),t.isDown=!1,t.isUp=!0,e.preventDefault())};const n=t.downHandler.bind(t),i=t.upHandler.bind(t);return window.addEventListener("keydown",n,!1),window.addEventListener("keyup",i,!1),t.unsubscribe=()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",i)},t},Vp.clearTimer=()=>{Vp.startTime=performance.now()},Vp.gameLoopDisplay=()=>{if(Vp.processingDisplayEvent){const e=Vp.processingDisplayEvent;switch(e.displayType){case"slide":if(performance.now()>=e.totalTime+e.startTime)e.sprite.moveTo(e.targetX,e.targetY),Vp.displayTag=!1,Vp.processingDisplayEvent=null;else(t=Vp.currentFPS*(e.totalTime+e.startTime-performance.now())/1e3)>=1&&(e.sprite.addX((e.targetX-e.sprite.x)/t),e.sprite.addY((e.targetY-e.sprite.y)/t));break;case"expand":if(performance.now()>=e.totalTime+e.startTime)e.sprite.enlargeTo(e.targetS),Vp.displayTag=!1,Vp.processingDisplayEvent=null;else(t=Vp.currentFPS*(e.totalTime+e.startTime-performance.now())/1e3)>=1&&e.sprite.enlarge((e.targetS-Math.sqrt(e.sprite.height*e.sprite.width))/t);break;case"circle":if(performance.now()>=e.totalTime+e.startTime)e.sprite.rotateTo(e.targetDegree),Vp.displayTag=!1,Vp.processingDisplayEvent=null;else(t=Vp.currentFPS*(e.totalTime+e.startTime-performance.now())/1e3)>=1&&e.sprite.rotate((e.targetDegree-180*e.sprite.rotation/Math.PI)/t)}}if(!Vp.running&&Vp.successProcessingDisplayEvents.length)for(var e=Vp.successProcessingDisplayEvents.length-1;e>=0;e--){const n=Vp.successProcessingDisplayEvents[e];switch(n.displayType){case"slide":if(performance.now()>=n.totalTime+n.startTime)n.sprite.moveTo(n.targetX,n.targetY),Vp.successProcessingDisplayEvents.splice(e,1);else(t=Vp.currentFPS*(n.totalTime+n.startTime-performance.now())/1e3)>=1&&(n.sprite.addX((n.targetX-n.sprite.x)/t),n.sprite.addY((n.targetY-n.sprite.y)/t));break;case"expand":if(performance.now()>=n.totalTime+n.startTime)n.sprite.enlargeTo(n.targetS),Vp.successProcessingDisplayEvents.splice(e,1);else(t=Vp.currentFPS*(n.totalTime+n.startTime-performance.now())/1e3)>=1&&n.sprite.enlarge((n.targetS-Math.sqrt(n.sprite.height*n.sprite.width))/t);break;case"circle":var t;if(performance.now()>=n.totalTime+n.startTime)n.sprite.rotateTo(n.targetDegree),Vp.successProcessingDisplayEvents.splice(e,1);else(t=Vp.currentFPS*(n.totalTime+n.startTime-performance.now())/1e3)>=1&&n.sprite.rotate((n.targetDegree-180*n.sprite.rotation/Math.PI)/t)}}},Vp.changeWidth=e=>{const t=d()(Vp.renderer.view),n=t.width(),i=t.height();t.width(e),t.height(e/n*i)},Vp.kill=()=>{Vp.state=!1,Vp.repeatPlay=new Function;for(let e in Vp.keys)Vp.keys[e].unsubscribe(),delete Vp.keys[e];Vp.processingDisplayEvent=null,Vp.displayTag=!1,Vp.running=!1,Vp.clearTimer()},Vp.runit=e=>{const t=d()(e);t.empty(),zp().SCALE_MODES.DEFAULT=zp().SCALE_MODES.NEAREST,Vp.renderer=zp().autoDetectRenderer(Vp.canvasWidth,Vp.canvasHeight,{backgroundColor:16777215}),t.append(Vp.renderer.view),Vp.pointer={x:0,y:0},Vp.stage.sortableChildren=!0,Vp.stage.interactive=!0,Vp.stage.on("mousemove",(e=zp().InteractionEvent)=>{Vp.pointer.x=e.data.global.x,Vp.pointer.y=e.data.global.y}),Vp.lastFrameTime=0,Vp.running=!0,Vp.lastFrameTime||(Vp.lastFrameTime=performance.now(),Vp.lastSecond=performance.now()),Vp.animate(performance.now()),Vp.repeatPlay=new Function;for(let e in Vp.keys)Vp.keys[e].unsubscribe(),delete Vp.keys[e];Vp.backgroundSprite&&(Vp.backgroundSprite.runningMouseDown=new Function);for(let e in Vp.sprites)Vp.sprites[e].runningMouseDown=new Function;for(let e in Vp.texts)Vp.texts[e].runningMouseDown=new Function;Vp.processingDisplayEvent=null,Vp.displayTag=!1,Vp.clearTimer(),Vp.changeWidth(d()("body").width()/2),Vp.state=!0},window.mixlySprite=Vp;const jp=Vp;var Yp=n(69610);class Gp{constructor(e,t){this._pageLoad=new Yp.D,this._kernelAvailable=new Yp.D,this._loaderId="basthon-loader",this._doNotHideLoader=!0;const i=e.language;if(null!=t&&(this._loaderId=t),"loading"===document.readyState){const e=()=>{document.removeEventListener("DOMContentLoaded",e),this._pageLoad.resolve()};document.addEventListener("DOMContentLoaded",e)}else this._pageLoad.resolve();(async()=>{switch(i){case"python":case"python3":case"python3.11":const{KernelPython3:t}=await n.e(211).then(n.bind(n,20211));this._kernel=new t(e);break;case"python3-old":case"python3.8":const{KernelPython3Old:r}=await n.e(195).then(n.bind(n,95195));this._kernel=new r(e);break;case"js":case"javascript":const{KernelJavaScript:s}=await n.e(97).then(n.bind(n,4097));this._kernel=new s(e);break;case"sql":const{KernelSQL:o}=await Promise.all([n.e(960),n.e(837)]).then(n.bind(n,90592));this._kernel=new o(e);break;case"ocaml":const{KernelOCaml:a}=await n.e(38).then(n.bind(n,50038));this._kernel=new a(e);break;default:return window.console.error(`Kernel '${i}' not supported.`),void this._kernelAvailable.reject()}window.Basthon=this._kernel,this._kernelAvailable.resolve(this._kernel)})()}async pageLoad(){await this._pageLoad.promise}async kernelAvailable(){return await this._kernelAvailable.promise}async kernelLoaded(){const e=await this.kernelAvailable();return await e.loaded(),e}get kernel(){return this._kernel}get kernelSafe(){var e;return(null===(e=this.kernel)||void 0===e?void 0:e.ready)?this.kernel:null}async showLoader(e,t=!1,i=!0){this.kernelAvailable().then(()=>{var e;return null===(e=this.kernel)||void 0===e?void 0:e.init()}),n.e(317).then(n.bind(n,1317));const r="basthon-loader-"+(t?"full":"foot"),s=document.createElement("div");s.id=this._loaderId,s.classList.add("darklighted"),s.classList.add("basthon-loader-root"),s.classList.add(r);const o=document.createElement("div");o.classList.add("basthon-loader-container"),o.classList.add(r),s.appendChild(o);const a=document.createElement("div");a.classList.add("basthon-loader-spinner"),a.classList.add(r),a.innerHTML="<span><span></span><span></span></span>",o.appendChild(a);const l=document.createElement("div");l.classList.add("basthon-loader-break"),l.classList.add(r),o.appendChild(l);const u=document.createElement("div");u.classList.add("basthon-loader-text"),u.classList.add(r),u.innerHTML=e,o.appendChild(u),this._loaderTextElem=u;const c=document.createElement("div");c.classList.add("basthon-loader-text"),c.classList.add(r),c.style.display="none",o.appendChild(c),this._loaderTextError=c,await this.pageLoad(),document.body.appendChild(s),this._rootLoader=s;try{await this.kernelLoaded()}catch(e){const t=this.browser();this.setErrorText(`Erreur de chargement de Basthon !!!<br>Vérifiez que votre navigateur est à jour.<br>Version détectée : ${t.name} ${t.version}.`);for(const e of document.body.querySelectorAll(".basthon-loader-foot"))e.classList.remove("basthon-loader-foot"),e.classList.add("basthon-loader-full");return a.classList.remove("basthon-loader-spinner"),a.classList.add("basthon-loader-error"),void(this._doNotHideLoader=!0)}this._doNotHideLoader=!1,i&&this.hideLoader()}setLoaderText(e){null!=this._loaderTextElem&&(this._loaderTextElem.innerHTML=e)}setErrorText(e){null!=this._loaderTextElem&&(this._loaderTextElem.style.display="none"),null!=this._loaderTextError&&(this._loaderTextError.style.display="",this._loaderTextError.innerHTML=e)}hideLoader(){if(this._doNotHideLoader)return;const e=this._rootLoader;null!=e&&(e.classList.add("basthon-loader-hide"),window.setTimeout(()=>{this._rootLoader=void 0,e.remove()},1100))}browser(){var e,t=navigator.userAgent,n=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(n[1])?{name:"IE",version:(e=/\brv[ :]+(\d+)/g.exec(t)||[])[1]||""}:"Chrome"===n[1]&&null!=(e=t.match(/\bOPR|Edge\/(\d+)/))?{name:"Opera",version:e[1]}:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&n.splice(1,1,e[1]),{name:n[0],version:n[1]})}}n(82879);class Hp extends a.PageBase{static{a.HTMLTemplate.add("html/statusbar/statusbar-image.html",new a.HTMLTemplate('<style>\r\n div[m-id="{{d.mId}}"] {\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: center;\r\n align-items: center;\r\n flex-wrap: wrap;\r\n align-content: flex-start;\r\n overflow: auto;\r\n }\r\n\r\n html[data-bs-theme=light] div[m-id="{{d.mId}}"] {\r\n background-color: #ffffff;\r\n }\r\n\r\n html[data-bs-theme=dark] div[m-id="{{d.mId}}"] {\r\n background-color: #1e1e1e;\r\n }\r\n</style>\r\n<div m-id="{{d.mId}}" class="page-item"></div>')),this.init=function(){a.StatusBarsManager.typesRegistry.register(["images"],Hp);const e=a.Workspace.getMain().getStatusBarsManager();return e.add({type:"images",id:"images",name:l.Msg.PYTHON_PYODIDE_IMAGE,title:l.Msg.PYTHON_PYODIDE_IMAGE}),e.changeTo("output"),e.get("images")}}constructor(){super();const e=d()(a.HTMLTemplate.get("html/statusbar/statusbar-image.html").render());this.setContent(e)}init(){super.init(),this.hideCloseBtn()}clean(){this.getContent().empty()}display(e){const t=this.getContent(),n=function(e){e.style.width="auto",e.style.height="auto",e.style.maxWidth="100%",e.style.maxHeight="100%"};this.clean();let i=e.content,r=null,s=null;switch(e.display_type){case"p5":i.style.width="100%",i.style.height="100%",i.style.display="flex",i.style.justifyContent="center",i.style.alignItems="center",new MutationObserver(function(e){e.forEach(e=>e.addedNodes.forEach(e=>{const t=e;null!=t.tagName&&["canvas","video"].includes(t.tagName.toLowerCase())&&n(t)}))}).observe(i,{childList:!0}),i.querySelectorAll("canvas,video").forEach(n),t.append(i);break;case"matplotlib":r=i.querySelector("canvas"),r&&(i=r),i.style.width="",i.style.height="",i.style.maxWidth="100%",i.style.maxHeight="100%",t.append(i);break;case"ocaml-canvas":i.style.width="",i.style.height="",i.style.maxWidth="100%",i.style.maxHeight="100%",t.append(i);break;case"turtle":i.setAttribute("width","100%"),i.setAttribute("height","100%"),t.append(i.outerHTML);break;case"sympy":t.append(e.content),void 0===window.MathJax?(console.log("Loading MathJax (Sympy expression needs it)."),function(){let e=document.createElement("script");e.type="text/javascript",e.src="https://cdn.jsdelivr.net/npm/mathjax@3.0.5/es5/tex-mml-chtml.js",document.getElementsByTagName("head")[0].appendChild(e)}()):window.MathJax.typeset();break;case"multiple":for(let n of["image/svg+xml","image/png","text/html","text/plain"])if(n in e.content){let i=e.content[n];"image/png"===n&&(i='<img src="data:image/png;base64,'+i+'" style="max-width: 100%; max-height: 100%;">'),t.append(i);break}break;case"tutor":if(t.append(d()(e.content.replace("overflow-y%3A%20hidden%3B",""))),s=this.getContent()[0].getElementsByTagName("iframe")[0],null==s)return;s.style.maxHeight=s.style.minHeight="100%",new IntersectionObserver((e,t)=>{const n=e[0];n&&!n.isIntersecting||(s.contentWindow?.postMessage({type:"redraw"},"*"),t.disconnect())}).observe(s);break;default:console.error(`Not supported node type '${e.display_type}' in eval.display result processing.`)}}}const Wp=layui;var Xp;!function(e){e[e.EPERM=1]="EPERM",e[e.ENOENT=2]="ENOENT",e[e.EINTR=4]="EINTR",e[e.EIO=5]="EIO",e[e.ENXIO=6]="ENXIO",e[e.EBADF=9]="EBADF",e[e.EAGAIN=11]="EAGAIN",e[e.ENOMEM=12]="ENOMEM",e[e.EACCES=13]="EACCES",e[e.EFAULT=14]="EFAULT",e[e.ENOTBLK=15]="ENOTBLK",e[e.EBUSY=16]="EBUSY",e[e.EEXIST=17]="EEXIST",e[e.EXDEV=18]="EXDEV",e[e.ENODEV=19]="ENODEV",e[e.ENOTDIR=20]="ENOTDIR",e[e.EISDIR=21]="EISDIR",e[e.EINVAL=22]="EINVAL",e[e.ENFILE=23]="ENFILE",e[e.EMFILE=24]="EMFILE",e[e.ETXTBSY=26]="ETXTBSY",e[e.EFBIG=27]="EFBIG",e[e.ENOSPC=28]="ENOSPC",e[e.ESPIPE=29]="ESPIPE",e[e.EROFS=30]="EROFS",e[e.EMLINK=31]="EMLINK",e[e.EPIPE=32]="EPIPE",e[e.EDOM=33]="EDOM",e[e.ERANGE=34]="ERANGE",e[e.EDEADLK=35]="EDEADLK",e[e.ENAMETOOLONG=36]="ENAMETOOLONG",e[e.ENOLCK=37]="ENOLCK",e[e.ENOSYS=38]="ENOSYS",e[e.ENOTEMPTY=39]="ENOTEMPTY",e[e.ELOOP=40]="ELOOP",e[e.ENOMSG=42]="ENOMSG",e[e.EBADE=52]="EBADE",e[e.EBADR=53]="EBADR",e[e.EXFULL=54]="EXFULL",e[e.ENOANO=55]="ENOANO",e[e.EBADRQC=56]="EBADRQC",e[e.ENOSTR=60]="ENOSTR",e[e.ENODATA=61]="ENODATA",e[e.ETIME=62]="ETIME",e[e.ENOSR=63]="ENOSR",e[e.ENONET=64]="ENONET",e[e.EREMOTE=66]="EREMOTE",e[e.ENOLINK=67]="ENOLINK",e[e.ECOMM=70]="ECOMM",e[e.EPROTO=71]="EPROTO",e[e.EBADMSG=74]="EBADMSG",e[e.EOVERFLOW=75]="EOVERFLOW",e[e.EBADFD=77]="EBADFD",e[e.ESTRPIPE=86]="ESTRPIPE",e[e.ENOTSOCK=88]="ENOTSOCK",e[e.EDESTADDRREQ=89]="EDESTADDRREQ",e[e.EMSGSIZE=90]="EMSGSIZE",e[e.EPROTOTYPE=91]="EPROTOTYPE",e[e.ENOPROTOOPT=92]="ENOPROTOOPT",e[e.EPROTONOSUPPORT=93]="EPROTONOSUPPORT",e[e.ESOCKTNOSUPPORT=94]="ESOCKTNOSUPPORT",e[e.ENOTSUP=95]="ENOTSUP",e[e.ENETDOWN=100]="ENETDOWN",e[e.ENETUNREACH=101]="ENETUNREACH",e[e.ENETRESET=102]="ENETRESET",e[e.ETIMEDOUT=110]="ETIMEDOUT",e[e.ECONNREFUSED=111]="ECONNREFUSED",e[e.EHOSTDOWN=112]="EHOSTDOWN",e[e.EHOSTUNREACH=113]="EHOSTUNREACH",e[e.EALREADY=114]="EALREADY",e[e.EINPROGRESS=115]="EINPROGRESS",e[e.ESTALE=116]="ESTALE",e[e.EREMOTEIO=121]="EREMOTEIO",e[e.EDQUOT=122]="EDQUOT"}(Xp||(Xp={}));const qp={[Xp.EPERM]:"Operation not permitted",[Xp.ENOENT]:"No such file or directory",[Xp.EINTR]:"Interrupted system call",[Xp.EIO]:"Input/output error",[Xp.ENXIO]:"No such device or address",[Xp.EBADF]:"Bad file descriptor",[Xp.EAGAIN]:"Resource temporarily unavailable",[Xp.ENOMEM]:"Cannot allocate memory",[Xp.EACCES]:"Permission denied",[Xp.EFAULT]:"Bad address",[Xp.ENOTBLK]:"Block device required",[Xp.EBUSY]:"Resource busy or locked",[Xp.EEXIST]:"File exists",[Xp.EXDEV]:"Invalid cross-device link",[Xp.ENODEV]:"No such device",[Xp.ENOTDIR]:"File is not a directory",[Xp.EISDIR]:"File is a directory",[Xp.EINVAL]:"Invalid argument",[Xp.ENFILE]:"Too many open files in system",[Xp.EMFILE]:"Too many open files",[Xp.ETXTBSY]:"Text file busy",[Xp.EFBIG]:"File is too big",[Xp.ENOSPC]:"No space left on disk",[Xp.ESPIPE]:"Illegal seek",[Xp.EROFS]:"Cannot modify a read-only file system",[Xp.EMLINK]:"Too many links",[Xp.EPIPE]:"Broken pipe",[Xp.EDOM]:"Numerical argument out of domain",[Xp.ERANGE]:"Numerical result out of range",[Xp.EDEADLK]:"Resource deadlock would occur",[Xp.ENAMETOOLONG]:"File name too long",[Xp.ENOLCK]:"No locks available",[Xp.ENOSYS]:"Function not implemented",[Xp.ENOTEMPTY]:"Directory is not empty",[Xp.ELOOP]:"Too many levels of symbolic links",[Xp.ENOMSG]:"No message of desired type",[Xp.EBADE]:"Invalid exchange",[Xp.EBADR]:"Invalid request descriptor",[Xp.EXFULL]:"Exchange full",[Xp.ENOANO]:"No anode",[Xp.EBADRQC]:"Invalid request code",[Xp.ENOSTR]:"Device not a stream",[Xp.ENODATA]:"No data available",[Xp.ETIME]:"Timer expired",[Xp.ENOSR]:"Out of streams resources",[Xp.ENONET]:"Machine is not on the network",[Xp.EREMOTE]:"Object is remote",[Xp.ENOLINK]:"Link has been severed",[Xp.ECOMM]:"Communication error on send",[Xp.EPROTO]:"Protocol error",[Xp.EBADMSG]:"Bad message",[Xp.EOVERFLOW]:"Value too large for defined data type",[Xp.EBADFD]:"File descriptor in bad state",[Xp.ESTRPIPE]:"Streams pipe error",[Xp.ENOTSOCK]:"Socket operation on non-socket",[Xp.EDESTADDRREQ]:"Destination address required",[Xp.EMSGSIZE]:"Message too long",[Xp.EPROTOTYPE]:"Protocol wrong type for socket",[Xp.ENOPROTOOPT]:"Protocol not available",[Xp.EPROTONOSUPPORT]:"Protocol not supported",[Xp.ESOCKTNOSUPPORT]:"Socket type not supported",[Xp.ENOTSUP]:"Operation is not supported",[Xp.ENETDOWN]:"Network is down",[Xp.ENETUNREACH]:"Network is unreachable",[Xp.ENETRESET]:"Network dropped connection on reset",[Xp.ETIMEDOUT]:"Connection timed out",[Xp.ECONNREFUSED]:"Connection refused",[Xp.EHOSTDOWN]:"Host is down",[Xp.EHOSTUNREACH]:"No route to host",[Xp.EALREADY]:"Operation already in progress",[Xp.EINPROGRESS]:"Operation now in progress",[Xp.ESTALE]:"Stale file handle",[Xp.EREMOTEIO]:"Remote I/O error",[Xp.EDQUOT]:"Disk quota exceeded"};class Kp extends Error{static fromJSON(e){const t=new Kp(e.errno,e.message,e.path,e.syscall);return t.code=e.code,t.stack=e.stack,t}static With(e,t,n){return new Kp(Xp[e],qp[Xp[e]],t,n)}constructor(e,t=qp[e],n,i=""){super(t),this.errno=e,this.path=n,this.syscall=i,this.code=Xp[e],this.message=this.code+": "+t+(this.path?`, '${this.path}'`:"")}toString(){return this.message}toJSON(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message,syscall:this.syscall}}bufferSize(){return 4+JSON.stringify(this.toJSON()).length}}let Zp="/";function Qp(e,t){let n="",i=0,r=-1,s=0,o="\0";for(let a=0;a<=e.length;++a){if(a<e.length)o=e[a];else{if("/"==o)break;o="/"}if("/"==o){if(r===a-1||1===s);else if(2===s){if(n.length<2||2!==i||"."!==n.at(-1)||"."!==n.at(-2)){if(n.length>2){const e=n.lastIndexOf("/");-1===e?(n="",i=0):(n=n.slice(0,e),i=n.length-1-n.lastIndexOf("/")),r=a,s=0;continue}if(0!==n.length){n="",i=0,r=a,s=0;continue}}t&&(n+=n.length>0?"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(r+1,a):n=e.slice(r+1,a),i=a-r-1;r=a,s=0}else"."===o&&-1!==s?++s:s=-1}return n}function Jp(...e){let t="";for(const n of[...e.reverse(),Zp])if(n.length&&(t=`${n}/${t}`,n.startsWith("/")))break;const n=t.startsWith("/");return t=Qp(t,!n),n?`/${t}`:t.length?t:"/"}function ef(...e){if(!e.length)return".";const t=e.join("/");return t?.length?function(e){if(!e.length)return".";const t=e.startsWith("/"),n=e.endsWith("/");return(e=Qp(e,!t)).length?(n&&(e+="/"),t?`/${e}`:e):t?"/":n?"./":"."}(t):"."}function tf(e){if(0===e.length)return".";const t="/"===e[0];let n=-1,i=!0;for(let t=e.length-1;t>=1;--t)if("/"===e[t]){if(!i){n=t;break}}else i=!1;return-1===n?t?"/":".":t&&1===n?"//":e.slice(0,n)}function nf(e,t){let n=0,i=-1,r=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t===e)return"";let s=t.length-1,o=-1;for(let a=e.length-1;a>=0;--a)if("/"===e[a]){if(!r){n=a+1;break}}else-1===o&&(r=!1,o=a+1),s>=0&&(e[a]===t[s]?-1===--s&&(i=a):(s=-1,i=o));return n===i?i=o:-1===i&&(i=e.length),e.slice(n,i)}for(let t=e.length-1;t>=0;--t)if("/"===e[t]){if(!r){n=t+1;break}}else-1===i&&(r=!1,i=t+1);return-1===i?"":e.slice(n,i)}function rf(e){const t=e.startsWith("/"),n={root:t?"/":"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;const i=t?1:0;let r=-1,s=0,o=-1,a=!0,l=e.length-1,u=0;for(;l>=i;--l)if("/"!==e[l])-1===o&&(a=!1,o=l+1),"."===e[l]?-1===r?r=l:1!==u&&(u=1):-1!==r&&(u=-1);else if(!a){s=l+1;break}if(-1!==o){const i=0===s&&t?1:s;-1===r||0===u||1===u&&r===o-1&&r===s+1?n.base=n.name=e.slice(i,o):(n.name=e.slice(i,r),n.base=e.slice(i,o),n.ext=e.slice(r,o))}return s>0?n.dir=e.slice(0,s-1):t&&(n.dir="/"),n}const sf=new TextEncoder;function of(e){if("string"!=typeof e)throw new Kp(Xp.EINVAL,"Can not encode a non-string");return sf.encode(e)}const af=new TextDecoder;function lf(e){if(!(e instanceof Uint8Array))throw new Kp(Xp.EINVAL,"Can not decode a non-Uint8Array");return af.decode(e)}function uf(e){return JSON.parse(lf(e),(e,t)=>""==e?t:BigInt(t))}function cf(e){return of(JSON.stringify(e,(e,t)=>""==e?t:t.toString()))}function df(e,t){if("number"==typeof e)return e;if("string"==typeof e){const t=parseInt(e,8);if(!isNaN(t))return t}if("number"==typeof t)return t;throw new Kp(Xp.EINVAL,"Invalid mode: "+e?.toString())}function hf(e){if(e instanceof Date)return e;try{return new Date(e)}catch{throw new Kp(Xp.EINVAL,"Invalid time.")}}function pf(e){if((e=e.toString()).includes("\0"))throw new Kp(Xp.EINVAL,"Path can not contain null character");if(0==e.length)throw new Kp(Xp.EINVAL,"Path can not be empty");return Jp(e.replaceAll(/[/\\]+/g,"/"))}function ff(e,t="utf8",n,i=0){return"object"!=typeof e||null===e?{encoding:"string"==typeof e?e:t??null,flag:n,mode:i}:{encoding:"string"==typeof e?.encoding?e.encoding:t??null,flag:"string"==typeof e?.flag?e.flag:n,mode:df("mode"in e?e?.mode:null,i)}}function mf(){return crypto.getRandomValues(new BigUint64Array(1))[0]}const gf={uid:0,gid:0,suid:0,sgid:0,euid:0,egid:0,groups:[]};function yf(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}const _f=0,vf=4,bf=2,Tf=1,xf=1,Ef=2,wf=4,If=0,Af=1,Sf=2,Cf=64,Of=128,Mf=256,Rf=512,kf=1024,Nf=65536,Df=262144,Ff=131072,Lf=1052672,Pf=4096,Bf=32768,$f=16384,Uf=2048,zf=61440,Vf=49152,jf=40960,Yf=32768,Gf=24576,Hf=16384,Wf=8192,Xf=4096,qf=2048,Kf=1024,Zf=512,Qf=448,Jf=256,em=128,tm=64,nm=56,im=32,rm=16,sm=8,om=7,am=4,lm=2,um=1,cm=0,dm=2**32-1,hm={checkAccess:!0,updateOnRead:!0,syncImmediately:!0,unsafeBufferReplace:!1};Promise.withResolvers??(Promise.withResolvers=function(){let e,t;const n=new Promise((n,i)=>{e=n,t=i});return{promise:n,resolve:e,reject:t}}),Symbol.dispose??(Symbol.dispose=Symbol("Symbol.dispose")),Symbol.asyncDispose??(Symbol.asyncDispose=Symbol("Symbol.asyncDispose"));class pm{_convert(e){return this._isBigint?BigInt(e):Number(e)}get blocks(){return this._convert(Math.ceil(Number(this.size)/512))}get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}constructor({atimeMs:e,mtimeMs:t,ctimeMs:n,birthtimeMs:i,uid:r,gid:s,size:o,mode:a,ino:l}={}){this.dev=this._convert(0),this.ino=this._convert(0),this.rdev=this._convert(0),this.nlink=this._convert(1),this.blksize=this._convert(4096),this.uid=this._convert(0),this.gid=this._convert(0);const u=Date.now();this.atimeMs=this._convert(e??u),this.mtimeMs=this._convert(t??u),this.ctimeMs=this._convert(n??u),this.birthtimeMs=this._convert(i??u),this.uid=this._convert(r??0),this.gid=this._convert(s??0),this.size=this._convert(o??0),this.ino=this._convert(l??0),this.mode=this._convert(a??420&Yf),0==(this.mode&zf)&&(this.mode=this.mode|this._convert(Yf))}isFile(){return(this.mode&zf)===Yf}isDirectory(){return(this.mode&zf)===Hf}isSymbolicLink(){return(this.mode&zf)===jf}isSocket(){return(this.mode&zf)===Vf}isBlockDevice(){return(this.mode&zf)===Gf}isCharacterDevice(){return(this.mode&zf)===Wf}isFIFO(){return(this.mode&zf)===Xf}hasAccess(e,t){const n=t?.credentials||gf;if(this.isSymbolicLink()||0===n.euid||0===n.egid)return!0;let i=0;return n.uid===this.uid&&(this.mode&Jf&&(i|=vf),this.mode&em&&(i|=bf),this.mode&tm&&(i|=Tf)),(n.gid===this.gid||n.groups.includes(Number(this.gid)))&&(this.mode&im&&(i|=vf),this.mode&rm&&(i|=bf),this.mode&sm&&(i|=Tf)),this.mode&am&&(i|=vf),this.mode&lm&&(i|=bf),this.mode&um&&(i|=Tf),(i&e)===e}chmod(e){this.mode=this._convert(this.mode&zf|e)}chown(e,t){e=Number(e),t=Number(t),!isNaN(e)&&0<=e&&e<2**32&&(this.uid=this._convert(e)),!isNaN(t)&&0<=t&&t<2**32&&(this.gid=this._convert(t))}get atimeNs(){return 1000n*BigInt(this.atimeMs)}get mtimeNs(){return 1000n*BigInt(this.mtimeMs)}get ctimeNs(){return 1000n*BigInt(this.ctimeMs)}get birthtimeNs(){return 1000n*BigInt(this.birthtimeMs)}}function fm(e,t,n){!isNaN(t)&&0<=t&&t<2**32&&(e.uid=t),!isNaN(n)&&0<=n&&n<2**32&&(e.gid=n)}class mm extends pm{constructor(){super(...arguments),this._isBigint=!1}}class gm extends pm{constructor(){super(...arguments),this._isBigint=!0}}class ym{constructor(){this.type=525687744115,this.bsize=4096,this.blocks=0,this.bfree=0,this.bavail=0,this.files=dm,this.ffree=dm}}class _m{constructor(){this.type=0x7a656e6673n,this.bsize=4096n,this.blocks=0n,this.bfree=0n,this.bavail=0n,this.files=BigInt(dm),this.ffree=BigInt(dm)}}const vm=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"];function bm(e){if("number"==typeof e)return function(e){switch(e){case If:return"r";case If|Lf:return"rs";case Sf:return"r+";case Sf|Lf:return"rs+";case Rf|Cf|Af:return"w";case Rf|Cf|Af|Of:return"wx";case Rf|Cf|Sf:return"w+";case Rf|Cf|Sf|Of:return"wx+";case kf|Cf|Af:return"a";case kf|Cf|Af|Of:return"ax";case kf|Cf|Sf:return"a+";case kf|Cf|Sf|Of:return"ax+";default:throw new Error("Invalid flag number: "+e)}}(e);if(!vm.includes(e))throw new Error("Invalid flag string: "+e);return e}function Tm(e){let t=0;return t<<=1,t+=+xm(e),t<<=1,t+=+Em(e),t<<=1,t}function xm(e){return-1!==e.indexOf("r")||-1!==e.indexOf("+")}function Em(e){return-1!==e.indexOf("w")||-1!==e.indexOf("a")||-1!==e.indexOf("+")}function wm(e){return-1!==e.indexOf("w")}function Im(e){return-1!==e.indexOf("a")}function Am(e){return-1!==e.indexOf("x")}class Sm{constructor(e,t){this.fs=e,this.path=t}async[Symbol.asyncDispose](){await this.close()}[Symbol.dispose](){this.closeSync()}datasync(){return this.sync()}datasyncSync(){return this.syncSync()}}class Cm extends Sm{constructor(e,t,n,i,r=new Uint8Array(new ArrayBuffer(0,e.metadata().noResizableBuffers?{}:{maxByteLength:dm}))){if(super(e,t),this.flag=n,this.stats=i,this._buffer=r,this._position=0,this.dirty=!1,this.closed=!1,this.stats.size!=r.byteLength){if(xm(this.flag))throw new Error(`Size mismatch: buffer length ${r.byteLength}, stats size ${this.stats.size}`);this.dirty=!0}}get buffer(){return this._buffer}get position(){return Im(this.flag)?this.stats.size:this._position}set position(e){this._position=e}async sync(){if(this.closed)throw Kp.With("EBADF",this.path,"File.sync");this.dirty&&(await this.fs.sync(this.path,this._buffer,this.stats),this.dirty=!1)}syncSync(){if(this.closed)throw Kp.With("EBADF",this.path,"File.sync");this.dirty&&(this.fs.syncSync(this.path,this._buffer,this.stats),this.dirty=!1)}async close(){if(this.closed)throw Kp.With("EBADF",this.path,"File.close");await this.sync(),this.dispose()}closeSync(){if(this.closed)throw Kp.With("EBADF",this.path,"File.close");this.syncSync(),this.dispose()}dispose(e){if(this.closed)throw Kp.With("EBADF",this.path,"File.dispose");if(this.dirty&&!e)throw Kp.With("EBUSY",this.path,"File.dispose");delete this._buffer,delete this.stats,this.closed=!0}stat(){if(this.closed)throw Kp.With("EBADF",this.path,"File.stat");return Promise.resolve(new mm(this.stats))}statSync(){if(this.closed)throw Kp.With("EBADF",this.path,"File.stat");return new mm(this.stats)}_truncate(e){if(this.closed)throw Kp.With("EBADF",this.path,"File.truncate");if(this.dirty=!0,!Em(this.flag))throw new Kp(Xp.EPERM,"File not opened with a writeable mode.");if(this.stats.mtimeMs=Date.now(),e>this._buffer.length){const t=new Uint8Array(e-this._buffer.length);return void this._write(t,0,t.length,this._buffer.length)}this.stats.size=e,this._buffer=e?this._buffer.slice(0,e):new Uint8Array}async truncate(e){this._truncate(e),hm.syncImmediately&&await this.sync()}truncateSync(e){this._truncate(e),hm.syncImmediately&&this.syncSync()}_write(e,t=0,n=this.stats.size,i=this.position){if(this.closed)throw Kp.With("EBADF",this.path,"File.write");if(!Em(this.flag))throw new Kp(Xp.EPERM,"File not opened with a writeable mode.");this.dirty=!0;const r=i+n,s=e.slice(t,t+n);if(r>this.stats.size&&(this.stats.size=r,r>this._buffer.byteLength))if(this._buffer.buffer.resizable&&this._buffer.buffer.maxByteLength<=r)this._buffer.buffer.resize(r);else if(hm.unsafeBufferReplace)this._buffer=s;else{const e=new Uint8Array(new ArrayBuffer(r,this.fs.metadata().noResizableBuffers?{}:{maxByteLength:dm}));e.set(this._buffer),this._buffer=e}return this._buffer.set(s,i),this.stats.mtimeMs=Date.now(),this.position=i+s.byteLength,s.byteLength}async write(e,t,n,i){const r=this._write(e,t,n,i);return hm.syncImmediately&&await this.sync(),r}writeSync(e,t=0,n=this.stats.size,i=this.position){const r=this._write(e,t,n,i);return hm.syncImmediately&&this.syncSync(),r}_read(e,t=0,n=this.stats.size,i){if(this.closed)throw Kp.With("EBADF",this.path,"File.read");if(!xm(this.flag))throw new Kp(Xp.EPERM,"File not opened with a readable mode.");hm.updateOnRead&&(this.dirty=!0),this.stats.atimeMs=Date.now(),i??(i=this.position);let r=i+n;r>this.stats.size&&(r=i+Math.max(this.stats.size-i,0)),this._position=r;const s=r-i;return 0==s||new Uint8Array(e.buffer,t,n).set(this._buffer.slice(i,r)),s}async read(e,t,n,i){const r=this._read(e,t,n,i);return hm.syncImmediately&&await this.sync(),{bytesRead:r,buffer:e}}readSync(e,t,n,i){const r=this._read(e,t,n,i);return hm.syncImmediately&&this.syncSync(),r}async chmod(e){if(this.closed)throw Kp.With("EBADF",this.path,"File.chmod");this.dirty=!0,this.stats.mode=this.stats.mode&(e>zf?~zf:zf)|e,(hm.syncImmediately||e>zf)&&await this.sync()}chmodSync(e){if(this.closed)throw Kp.With("EBADF",this.path,"File.chmod");this.dirty=!0,this.stats.mode=this.stats.mode&(e>zf?~zf:zf)|e,(hm.syncImmediately||e>zf)&&this.syncSync()}async chown(e,t){if(this.closed)throw Kp.With("EBADF",this.path,"File.chown");this.dirty=!0,fm(this.stats,e,t),hm.syncImmediately&&await this.sync()}chownSync(e,t){if(this.closed)throw Kp.With("EBADF",this.path,"File.chown");this.dirty=!0,fm(this.stats,e,t),hm.syncImmediately&&this.syncSync()}async utimes(e,t){if(this.closed)throw Kp.With("EBADF",this.path,"File.utimes");this.dirty=!0,this.stats.atime=e,this.stats.mtime=t,hm.syncImmediately&&await this.sync()}utimesSync(e,t){if(this.closed)throw Kp.With("EBADF",this.path,"File.utimes");this.dirty=!0,this.stats.atime=e,this.stats.mtime=t,hm.syncImmediately&&this.syncSync()}}class Om{metadata(){return{name:this.constructor.name.toLowerCase(),readonly:!1,totalSpace:0,freeSpace:0,noResizableBuffers:!1,noAsyncCache:this._disableSync??!1,type:525687744115}}constructor(...e){}async ready(){}async exists(e){try{return await this.stat(e),!0}catch(e){return"ENOENT"!=e.code}}existsSync(e){try{return this.statSync(e),!0}catch(e){return"ENOENT"!=e.code}}}var Mm=n(30228);Symbol.toStringTag,Symbol.iterator;const Rm=Intl.NumberFormat("en",{notation:"compact"});Rm.format.bind(Rm);function km(e){return e.at(0).toUpperCase()+e.slice(1)}const Nm=["int8","uint8","int16","uint16","int32","uint32","int64","uint64","float32","float64"],Dm=[...Nm,...Nm.map(e=>km(e)),"char"],Fm=/^(u?int|float)(8|16|32|64)$/i;function Lm(e){return"char"==e?"uint8":e.toLowerCase()}function Pm(e){return Fm.test(e.toString())}function Bm(e){return"char"==e||Fm.test(e.toString().toLowerCase())}Symbol.struct_init||=Symbol("struct_init"),Symbol.struct_metadata||=Symbol("struct_metadata");Symbol.struct_init,Symbol.struct_metadata;function $m(e){const t=Symbol.metadata||Object.getOwnPropertySymbols(e).find(e=>"Symbol.metadata"==e.description);var n;if(n=e,Symbol?.metadata&&(Symbol.metadata in n||Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:Object.create(null)})),!t)throw new ReferenceError("Could not get a reference to Symbol.metadata");return t}function Um(e){return"function"==typeof e&&$m(e)in e&&function(e){return null!=e&&"object"==typeof e&&Symbol.struct_metadata in e}(e[$m(e)])}function zm(e){return null!=e&&"object"==typeof e&&Um(e.constructor)}function Vm(e){if(!zm(e))throw new TypeError(("function"==typeof e?e.name:"object"==typeof e&&e?e.constructor.name:e)+" is not a struct instance")}function jm(e){if(!function(e){return zm(e)||Um(e)}(e))throw new TypeError(("function"==typeof e?e.name:"object"==typeof e&&e?e.constructor.name:e)+" is not a struct")}function Ym(e){if("string"==typeof e)return function(e){if(!Bm(e))throw new TypeError("Not a valid primitive type: "+e)}(e),+Lm(e).match(Fm)[2]/8;jm(e);const t=Um(e)?e:e.constructor;return t[$m(t)][Symbol.struct_metadata].size}function Gm(e,t){return Math.ceil(e/t)*t}function Hm(e={}){return function(t,n){n.metadata??={},n.metadata[Symbol.struct_init]||=[];let i=0;const r=new Map;for(const t of n.metadata[Symbol.struct_init]){const{name:n,type:s,length:o}=t;if(!Bm(s)&&!Um(s))throw new TypeError("Not a valid type: "+s);r.set(n,{offset:i,type:Bm(s)?Lm(s):s,length:o}),i+=Ym(s)*(o||1),i=Gm(i,e.align||1)}return n.metadata[Symbol.struct_metadata]={options:e,members:r,size:i},t}}function Wm(e,t){return function(n,i){let r=i.name;if("symbol"==typeof r&&(console.warn("Symbol used for struct member name will be coerced to string: "+r.toString()),r=r.toString()),!r)throw new ReferenceError("Invalid name for struct member");return i.metadata??={},i.metadata[Symbol.struct_init]||=[],i.metadata[Symbol.struct_init].push({name:r,type:e,length:t}),n}}function Xm(e){Vm(e);const{options:t,members:n}=e.constructor[$m(e.constructor)][Symbol.struct_metadata],i=new Uint8Array(Ym(e)),r=new DataView(i.buffer);for(const[s,{type:o,length:a,offset:l}]of n)for(let n=0;n<(a||1);n++){const u=l+Ym(o)*n;let c=a>0?e[s][n]:e[s];if("string"==typeof c&&(c=c.charCodeAt(0)),!Pm(o)){i.set(c?Xm(c):new Uint8Array(Ym(o)),u);continue}const d="set"+km(o);"setInt64"!=d?"setUint64"!=d?r[d](u,Number(c),!t.bigEndian):r.setBigUint64(u,BigInt(c),!t.bigEndian):r.setBigInt64(u,BigInt(c),!t.bigEndian)}return i}function qm(e,t){Vm(e);const{options:n,members:i}=e.constructor[$m(e.constructor)][Symbol.struct_metadata],r=t instanceof Uint8Array?t:new Uint8Array("buffer"in t?t.buffer:t),s=new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength));for(const[t,{type:o,offset:a,length:l}]of i)for(let i=0;i<(l||1);i++){let u=l>0?e[t]:e;const c=l>0?i:t,d=a+Ym(o)*i;if("string"==typeof e[t]){e[t]=e[t].slice(0,i)+String.fromCharCode(s.getUint8(d))+e[t].slice(i+1);continue}if(!Pm(o)){if(null===u[c]||void 0===u[c])continue;qm(u[c],new Uint8Array(r.slice(d,d+Ym(o))));continue}l>0&&(u||=[]);const h="get"+km(o);"getInt64"!=h?u[c]="getUint64"!=h?s[h](d,!n.bigEndian):s.getBigUint64(d,!n.bigEndian):u[c]=s.getBigInt64(d,!n.bigEndian)}}Symbol.metadata??=Symbol.for("Symbol.metadata");const Km=Object.fromEntries(Dm.map(e=>{return[e,(t=e,function(e,n){return"number"==typeof e?Wm(t,e):Wm(t)(e,n)})];var t}));var Zm=function(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,u="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,d=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=n.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var g=(0,n[p])("accessor"===l?{get:d.get,set:d.set}:d[u],f);if("accessor"===l){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=o(g.get))&&(d.get=a),(a=o(g.set))&&(d.set=a),(a=o(g.init))&&r.unshift(a)}else(a=o(g))&&("field"===l?r.unshift(a):d[u]=a)}c&&Object.defineProperty(c,i.name,d),h=!0},Qm=function(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0},Jm=function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})};let eg=(()=>{var e,t,n,i,r,s,o,a,l,u,c;let d,h,p,f,m,g,y,_,v,b,T,x,E,w=[Hm()],I=[],A=[],S=[],C=[],O=[],M=[],R=[],k=[],N=[],D=[],F=[],L=[],P=[],B=[],$=[],U=[],z=[],V=[],j=[],Y=[],G=[],H=[],W=[];var X=h=class{constructor(e){if(this.data=Qm(this,A,void 0),this.size=(Qm(this,S),Qm(this,C,void 0)),this.mode=(Qm(this,O),Qm(this,M,void 0)),this.nlink=(Qm(this,R),Qm(this,k,void 0)),this.uid=(Qm(this,N),Qm(this,D,void 0)),this.gid=(Qm(this,F),Qm(this,L,void 0)),this.atimeMs=(Qm(this,P),Qm(this,B,void 0)),this.birthtimeMs=(Qm(this,$),Qm(this,U,void 0)),this.mtimeMs=(Qm(this,z),Qm(this,V,void 0)),this.ctimeMs=(Qm(this,j),Qm(this,Y,void 0)),this.ino=(Qm(this,G),Qm(this,H,void 0)),Qm(this,W),e){const t=Ym(X),n=t-Ym("uint64");if(e.byteLength<n)throw new RangeError(`Can not create an inode from a buffer less than ${n} bytes`);if(e.byteLength<t){const n=new Uint8Array(t);n.set(new Uint8Array(ArrayBuffer.isView(e)?e.buffer:e));const i=crypto.getRandomValues(new Uint32Array(2));n.set(i,t-2),e=n}return void qm(this,e)}this.ino=mf(),this.data=mf(),this.nlink=1,this.size=4096;const t=Date.now();this.atimeMs=t,this.mtimeMs=t,this.ctimeMs=t,this.birthtimeMs=t}toStats(){return new mm(this)}update(e){let t=!1;return this.size!==e.size&&(this.size=e.size,t=!0),this.mode!==e.mode&&(this.mode=e.mode,t=!0),this.nlink!==e.nlink&&(this.nlink=e.nlink,t=!0),this.uid!==e.uid&&(this.uid=e.uid,t=!0),this.gid!==e.gid&&(this.gid=e.gid,t=!0),this.atimeMs!==e.atimeMs&&(this.atimeMs=e.atimeMs,t=!0),this.mtimeMs!==e.mtimeMs&&(this.mtimeMs=e.mtimeMs,t=!0),this.ctimeMs!==e.ctimeMs&&(this.ctimeMs=e.ctimeMs,t=!0),t}};return Jm(h,"Inode"),(()=>{const q="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;p=[(e=Km).uint64.bind(e)],f=[(t=Km).uint32.bind(t)],m=[(n=Km).uint16.bind(n)],g=[(i=Km).uint32.bind(i)],y=[(r=Km).uint32.bind(r)],_=[(s=Km).uint32.bind(s)],v=[(o=Km).float64.bind(o)],b=[(a=Km).float64.bind(a)],T=[(l=Km).float64.bind(l)],x=[(u=Km).float64.bind(u)],E=[(c=Km).uint64.bind(c)],Zm(null,null,p,{kind:"field",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:q},A,S),Zm(null,null,f,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:q},C,O),Zm(null,null,m,{kind:"field",name:"mode",static:!1,private:!1,access:{has:e=>"mode"in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:q},M,R),Zm(null,null,g,{kind:"field",name:"nlink",static:!1,private:!1,access:{has:e=>"nlink"in e,get:e=>e.nlink,set:(e,t)=>{e.nlink=t}},metadata:q},k,N),Zm(null,null,y,{kind:"field",name:"uid",static:!1,private:!1,access:{has:e=>"uid"in e,get:e=>e.uid,set:(e,t)=>{e.uid=t}},metadata:q},D,F),Zm(null,null,_,{kind:"field",name:"gid",static:!1,private:!1,access:{has:e=>"gid"in e,get:e=>e.gid,set:(e,t)=>{e.gid=t}},metadata:q},L,P),Zm(null,null,v,{kind:"field",name:"atimeMs",static:!1,private:!1,access:{has:e=>"atimeMs"in e,get:e=>e.atimeMs,set:(e,t)=>{e.atimeMs=t}},metadata:q},B,$),Zm(null,null,b,{kind:"field",name:"birthtimeMs",static:!1,private:!1,access:{has:e=>"birthtimeMs"in e,get:e=>e.birthtimeMs,set:(e,t)=>{e.birthtimeMs=t}},metadata:q},U,z),Zm(null,null,T,{kind:"field",name:"mtimeMs",static:!1,private:!1,access:{has:e=>"mtimeMs"in e,get:e=>e.mtimeMs,set:(e,t)=>{e.mtimeMs=t}},metadata:q},V,j),Zm(null,null,x,{kind:"field",name:"ctimeMs",static:!1,private:!1,access:{has:e=>"ctimeMs"in e,get:e=>e.ctimeMs,set:(e,t)=>{e.ctimeMs=t}},metadata:q},Y,G),Zm(null,null,E,{kind:"field",name:"ino",static:!1,private:!1,access:{has:e=>"ino"in e,get:e=>e.ino,set:(e,t)=>{e.ino=t}},metadata:q},H,W),Zm(null,d={value:h},w,{kind:"class",name:h.name,metadata:q},null,I),X=h=d.value,q&&Object.defineProperty(h,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:q}),Qm(h,I)})(),X=h})();var tg=function(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],n&&(r=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");r&&(i=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t},ng=function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}return function e(){for(;t.stack.length;){var i=t.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(e,function(t){return n(t),e()})}catch(e){n(e)}}if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});class ig extends Om{async ready(){this._initialized||(await this.checkRoot(),this._initialized=!0)}constructor(e){super(),this.store=e,this._initialized=!1}metadata(){return{...super.metadata(),name:this.store.name}}async empty(){await this.store.clear(),await this.checkRoot()}emptySync(){this.store.clearSync(),this.checkRootSync()}async rename(e,t){const n={stack:[],error:void 0,hasError:!1};try{const i=tg(n,this.store.transaction(),!0),r=rf(e),s=rf(t),o=await this.findInode(i,r.dir,"rename"),a=uf(await this.get(i,o.data,r.dir,"rename"));if(!a[r.base])throw Kp.With("ENOENT",e,"rename");const l=a[r.base];if(delete a[r.base],0===(s.dir+"/").indexOf(e+"/"))throw new Kp(Xp.EBUSY,r.dir);const u=s.dir==r.dir,c=u?o:await this.findInode(i,s.dir,"rename"),d=u?a:uf(await this.get(i,c.data,s.dir,"rename"));if(d[s.base]){const e=new eg(await this.get(i,d[s.base],t,"rename"));if(!e.toStats().isFile())throw Kp.With("EPERM",t,"rename");await i.remove(e.data),await i.remove(d[s.base])}d[s.base]=l,await i.set(o.data,cf(a)),await i.set(c.data,cf(d)),await i.commit()}catch(e){n.error=e,n.hasError=!0}finally{const e=ng(n);e&&await e}}renameSync(e,t){const n={stack:[],error:void 0,hasError:!1};try{const i=tg(n,this.store.transaction(),!1),r=rf(e),s=rf(t),o=this.findInodeSync(i,r.dir,"rename"),a=uf(this.getSync(i,o.data,r.dir,"rename"));if(!a[r.base])throw Kp.With("ENOENT",e,"rename");const l=a[r.base];if(delete a[r.base],0==(s.dir+"/").indexOf(e+"/"))throw new Kp(Xp.EBUSY,r.dir);const u=s.dir===r.dir,c=u?o:this.findInodeSync(i,s.dir,"rename"),d=u?a:uf(this.getSync(i,c.data,s.dir,"rename"));if(d[s.base]){const e=new eg(this.getSync(i,d[s.base],t,"rename"));if(!e.toStats().isFile())throw Kp.With("EPERM",t,"rename");i.removeSync(e.data),i.removeSync(d[s.base])}d[s.base]=l,i.setSync(o.data,cf(a)),i.setSync(c.data,cf(d)),i.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{ng(n)}}async stat(e){const t={stack:[],error:void 0,hasError:!1};try{const n=tg(t,this.store.transaction(),!0);return(await this.findInode(n,e,"stat")).toStats()}catch(e){t.error=e,t.hasError=!0}finally{const e=ng(t);e&&await e}}statSync(e){const t={stack:[],error:void 0,hasError:!1};try{const n=tg(t,this.store.transaction(),!1);return this.findInodeSync(n,e,"stat").toStats()}catch(e){t.error=e,t.hasError=!0}finally{ng(t)}}async createFile(e,t,n){const i=await this.commitNew(e,Yf,n,new Uint8Array,"createFile");return new Cm(this,e,t,i.toStats(),new Uint8Array)}createFileSync(e,t,n){const i=this.commitNewSync(e,Yf,n,new Uint8Array,"createFile");return new Cm(this,e,t,i.toStats(),new Uint8Array)}async openFile(e,t){const n={stack:[],error:void 0,hasError:!1};try{const i=tg(n,this.store.transaction(),!0),r=await this.findInode(i,e,"openFile"),s=await this.get(i,r.data,e,"openFile");return new Cm(this,e,t,r.toStats(),s)}catch(e){n.error=e,n.hasError=!0}finally{const e=ng(n);e&&await e}}openFileSync(e,t){const n={stack:[],error:void 0,hasError:!1};try{const i=tg(n,this.store.transaction(),!1),r=this.findInodeSync(i,e,"openFile"),s=this.getSync(i,r.data,e,"openFile");return new Cm(this,e,t,r.toStats(),s)}catch(e){n.error=e,n.hasError=!0}finally{ng(n)}}async unlink(e){return this.remove(e,!1,"unlink")}unlinkSync(e){this.removeSync(e,!1,"unlink")}async rmdir(e){if((await this.readdir(e)).length)throw Kp.With("ENOTEMPTY",e,"rmdir");await this.remove(e,!0,"rmdir")}rmdirSync(e){if(this.readdirSync(e).length)throw Kp.With("ENOTEMPTY",e,"rmdir");this.removeSync(e,!0,"rmdir")}async mkdir(e,t){await this.commitNew(e,Hf,t,of("{}"),"mkdir")}mkdirSync(e,t){this.commitNewSync(e,Hf,t,of("{}"),"mkdir")}async readdir(e){const t={stack:[],error:void 0,hasError:!1};try{const n=tg(t,this.store.transaction(),!0),i=await this.findInode(n,e,"readdir");return Object.keys(uf(await this.get(n,i.data,e,"readdir")))}catch(e){t.error=e,t.hasError=!0}finally{const e=ng(t);e&&await e}}readdirSync(e){const t={stack:[],error:void 0,hasError:!1};try{const n=tg(t,this.store.transaction(),!1),i=this.findInodeSync(n,e,"readdir");return Object.keys(uf(this.getSync(n,i.data,e,"readdir")))}catch(e){t.error=e,t.hasError=!0}finally{ng(t)}}async sync(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=tg(i,this.store.transaction(),!0),s=await this._findInode(r,e,"sync"),o=new eg(await this.get(r,s,e,"sync")),a=o.update(n);await r.set(o.data,t),a&&await r.set(s,Xm(o)),await r.commit()}catch(e){i.error=e,i.hasError=!0}finally{const e=ng(i);e&&await e}}syncSync(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=tg(i,this.store.transaction(),!1),s=this._findInodeSync(r,e,"sync"),o=new eg(this.getSync(r,s,e,"sync")),a=o.update(n);r.setSync(o.data,t),a&&r.setSync(s,Xm(o)),r.commitSync()}catch(e){i.error=e,i.hasError=!0}finally{ng(i)}}async link(e,t){const n={stack:[],error:void 0,hasError:!1};try{const i=tg(n,this.store.transaction(),!0),r=tf(t),s=await this.findInode(i,r,"link"),o=uf(await this.get(i,s.data,r,"link")),a=await this._findInode(i,e,"link"),l=new eg(await this.get(i,a,e,"link"));l.nlink++,o[nf(t)]=a,i.setSync(a,Xm(l)),i.setSync(s.data,cf(o)),i.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{const e=ng(n);e&&await e}}linkSync(e,t){const n={stack:[],error:void 0,hasError:!1};try{const i=tg(n,this.store.transaction(),!1),r=tf(t),s=this.findInodeSync(i,r,"link"),o=uf(this.getSync(i,s.data,r,"link")),a=this._findInodeSync(i,e,"link"),l=new eg(this.getSync(i,a,e,"link"));l.nlink++,o[nf(t)]=a,i.setSync(a,Xm(l)),i.setSync(s.data,cf(o)),i.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{ng(n)}}async checkRoot(){const e={stack:[],error:void 0,hasError:!1};try{const t=tg(e,this.store.transaction(),!0);if(await t.get(0n))return;const n=new eg;n.ino=0n,n.mode=511|Hf,await t.set(n.data,of("{}")),await t.set(0n,Xm(n)),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{const t=ng(e);t&&await t}}checkRootSync(){const e={stack:[],error:void 0,hasError:!1};try{const t=tg(e,this.store.transaction(),!1);if(t.getSync(0n))return;const n=new eg;n.ino=0n,n.mode=511|Hf,t.setSync(n.data,of("{}")),t.setSync(0n,Xm(n)),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{ng(e)}}async _findInode(e,t,n,i=new Set){if(i.has(t))throw new Kp(Xp.EIO,"Infinite loop detected while finding inode",t);if(i.add(t),"/"==t)return 0n;const{dir:r,base:s}=rf(t),o="/"==r?new eg(await this.get(e,0n,r,n)):await this.findInode(e,r,n,i),a=uf(await this.get(e,o.data,r,n));if(!(s in a))throw Kp.With("ENOENT",Jp(r,s),n);return a[s]}_findInodeSync(e,t,n,i=new Set){if(i.has(t))throw new Kp(Xp.EIO,"Infinite loop detected while finding inode",t);if(i.add(t),"/"==t)return 0n;const{dir:r,base:s}=rf(t),o="/"==r?new eg(this.getSync(e,0n,r,n)):this.findInodeSync(e,r,n,i),a=uf(this.getSync(e,o.data,r,n));if(!(s in a))throw Kp.With("ENOENT",Jp(r,s),n);return a[s]}async findInode(e,t,n,i=new Set){const r=await this._findInode(e,t,n,i);return new eg(await this.get(e,r,t,n))}findInodeSync(e,t,n,i=new Set){const r=this._findInodeSync(e,t,n,i);return new eg(this.getSync(e,r,t,n))}async get(e,t,n,i){const r=await e.get(t);if(!r)throw Kp.With("ENOENT",n,i);return r}getSync(e,t,n,i){const r=e.getSync(t);if(!r)throw Kp.With("ENOENT",n,i);return r}async allocNew(e,t,n){for(let t=0;t<5;t++){const t=mf();if(!await e.get(t))return t}throw new Kp(Xp.ENOSPC,"No IDs available",t,n)}allocNewSync(e,t,n){for(let t=0;t<5;t++){const t=mf();if(!e.getSync(t))return t}throw new Kp(Xp.ENOSPC,"No IDs available",t,n)}async commitNew(e,t,n,i,r){const s={stack:[],error:void 0,hasError:!1};try{if("/"==e)throw Kp.With("EEXIST",e,r);const o=tg(s,this.store.transaction(),!0),{dir:a,base:l}=rf(e),u=await this.findInode(o,a,r),c=uf(await this.get(o,u.data,a,r));if(c[l])throw Kp.With("EEXIST",e,r);const d=new eg;return d.ino=await this.allocNew(o,e,r),d.data=await this.allocNew(o,e,r),d.mode=n|t,d.uid=u.mode&qf?u.uid:gf.uid,d.gid=u.mode&Kf?u.gid:gf.gid,d.size=i.length,await o.set(d.ino,Xm(d)),await o.set(d.data,i),c[l]=d.ino,await o.set(u.data,cf(c)),await o.commit(),d}catch(e){s.error=e,s.hasError=!0}finally{const e=ng(s);e&&await e}}commitNewSync(e,t,n,i,r){const s={stack:[],error:void 0,hasError:!1};try{if("/"==e)throw Kp.With("EEXIST",e,r);const o=tg(s,this.store.transaction(),!1),{dir:a,base:l}=rf(e),u=this.findInodeSync(o,a,r),c=uf(this.getSync(o,u.data,a,r));if(c[l])throw Kp.With("EEXIST",e,r);const d=new eg;return d.ino=this.allocNewSync(o,e,r),d.data=this.allocNewSync(o,e,r),d.size=i.length,d.mode=n|t,d.uid=u.mode&qf?u.uid:gf.uid,d.gid=u.mode&Kf?u.gid:gf.gid,o.setSync(d.ino,Xm(d)),o.setSync(d.data,i),c[l]=d.ino,o.setSync(u.data,cf(c)),o.commitSync(),d}catch(e){s.error=e,s.hasError=!0}finally{ng(s)}}async remove(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=tg(i,this.store.transaction(),!0),{dir:s,base:o}=rf(e),a=await this.findInode(r,s,n),l=uf(await this.get(r,a.data,s,n));if(!l[o])throw Kp.With("ENOENT",e,"remove");const u=l[o],c=new eg(await this.get(r,u,e,n));if(delete l[o],!t&&c.toStats().isDirectory())throw Kp.With("EISDIR",e,"remove");await r.set(a.data,cf(l)),--c.nlink<1&&(await r.remove(c.data),await r.remove(u)),await r.commit()}catch(e){i.error=e,i.hasError=!0}finally{const e=ng(i);e&&await e}}removeSync(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=tg(i,this.store.transaction(),!1),{dir:s,base:o}=rf(e),a=this.findInodeSync(r,s,n),l=uf(this.getSync(r,a.data,s,n)),u=l[o];if(!u)throw Kp.With("ENOENT",e,"remove");const c=new eg(this.getSync(r,u,e,n));if(delete l[o],!t&&c.toStats().isDirectory())throw Kp.With("EISDIR",e,"remove");r.setSync(a.data,cf(l)),--c.nlink<1&&(r.removeSync(c.data),r.removeSync(u)),r.commitSync()}catch(e){i.error=e,i.hasError=!0}finally{ng(i)}}}class rg{constructor(e){this.store=e,this.done=!1}async[Symbol.asyncDispose](){this.done||await this.abort()}[Symbol.dispose](){this.done||this.abortSync()}}class sg extends rg{async keys(){return this.keysSync()}async get(e){return this.getSync(e)}async set(e,t){return this.setSync(e,t)}async remove(e){return this.removeSync(e)}async commit(){return this.commitSync()}async abort(){return this.abortSync()}}class og extends sg{constructor(){super(...arguments),this.originalData=new Map,this.modifiedKeys=new Set}keysSync(){return this.store.keys()}getSync(e){const t=this.store.get(e);return this.stashOldValue(e,t),t}setSync(e,t){return this.markModified(e),this.store.set(e,t)}removeSync(e){this.markModified(e),this.store.delete(e)}commitSync(){this.done=!0}abortSync(){if(this.done){for(const e of this.modifiedKeys){const t=this.originalData.get(e);t?this.store.set(e,t):this.store.delete(e)}this.done=!0}}stashOldValue(e,t){this.originalData.has(e)||this.originalData.set(e,t)}markModified(e){this.modifiedKeys.add(e),this.originalData.has(e)||this.originalData.set(e,this.store.get(e))}}class ag extends Map{constructor(e="tmp"){super(),this.name=e}async sync(){}clearSync(){this.clear()}transaction(){return new og(this)}}const lg={name:"InMemory",isAvailable:()=>!0,options:{name:{type:"string",required:!1}},create({name:e}){const t=new ig(new ag(e));return t.checkRootSync(),t}},ug=lg;"function"==typeof SuppressedError&&SuppressedError;class cg{constructor(){this.isEnabled=!1,this.sync=new Map,this.async=new Map}has(e){return this.isEnabled&&this.sync.has(e)}get(e){if(this.isEnabled)return this.sync.get(e)}set(e,t){this.isEnabled&&(this.sync.set(e,t),this.async.set(e,Promise.resolve(t)))}hasAsync(e){return this.isEnabled&&this.async.has(e)}getAsync(e){if(this.isEnabled)return this.async.get(e)}setAsync(e,t){this.isEnabled&&(this.async.set(e,t),t.then(t=>this.sync.set(e,t)))}clear(){this.isEnabled&&(this.sync.clear(),this.async.clear())}}const dg=new cg,hg=new cg;var pg=n(48287);function fg(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,"function"==typeof n?n.bind(t):n]))}const mg=new Map;let gg=100;function yg(e){const t=gg++;return mg.set(t,e),t}function _g(e){if(!mg.has(e))throw new Kp(Xp.EBADF);return mg.get(e)}const vg=new Map;function bg(e,t){if("/"!==e[0]&&(e="/"+e),e=Jp(e),vg.has(e))throw new Kp(Xp.EINVAL,"Mount point "+e+" is already in use.");vg.set(e,t),hg.clear()}function Tg(e){if("/"!==e[0]&&(e="/"+e),e=Jp(e),!vg.has(e))throw new Kp(Xp.EINVAL,"Mount point "+e+" is already unmounted.");vg.delete(e),hg.clear()}function xg(e,t){const n=t?.root||"/";e=pf(ef(n,e));const i=[...vg].sort((e,t)=>e[0].length>t[0].length?-1:1);for(const[t,r]of i)if(t.length<=e.length&&e.startsWith(t))return""===(e=e.slice(t.length>1?t.length:0))&&(e=n),{fs:r,path:e,mountPoint:t,root:n};throw new Kp(Xp.EIO,"No file system")}async function Eg(){await Promise.all([...vg.values()].map(e=>e.ready()))}function wg(e,t){for(const[n,i]of Object.entries(t))e=e?.replaceAll(n,i);return e}function Ig(e,t){"string"==typeof e.stack&&(e.stack=wg(e.stack,t));try{e.message=wg(e.message,t)}catch{}return e.path&&(e.path=wg(e.path,t)),e}function Ag(e){"/"in e&&Tg("/");for(const[t,n]of Object.entries(e))bg(t,n)}function Sg(e,t){const n=e.metadata(),i=n.blockSize||4096;return{type:(t?BigInt:Number)(n.type),bsize:(t?BigInt:Number)(i),ffree:(t?BigInt:Number)(n.freeNodes||dm),files:(t?BigInt:Number)(n.totalNodes||dm),bavail:(t?BigInt:Number)(n.freeSpace/i),bfree:(t?BigInt:Number)(n.freeSpace/i),blocks:(t?BigInt:Number)(n.totalSpace/i)}}function Cg(e,t){const n=this?.credentials;if(n?.uid&&n?.gid&&n?.euid&&n?.egid)throw new Kp(Xp.EPERM,"Can not chroot() as non-root user");return t&&this?(this.root+=e,this):function(e,t=structuredClone(gf)){const n={root:e,credentials:yf(t)},i=fg(o,n),r=fg(s,n);return{...n,...i,promises:r}}(ef(this?.root||"/",e),n)}bg("/",ug.create({name:"root"}));class Og extends Mm{off(e,t,n,i){return super.off(e,t,n,i)}removeListener(e,t,n,i){return super.removeListener(e,t,n,i)}constructor(e){super(),this.path=e}setMaxListeners(){throw Kp.With("ENOSYS",this.path,"Watcher.setMaxListeners")}getMaxListeners(){throw Kp.With("ENOSYS",this.path,"Watcher.getMaxListeners")}prependListener(){throw Kp.With("ENOSYS",this.path,"Watcher.prependListener")}prependOnceListener(){throw Kp.With("ENOSYS",this.path,"Watcher.prependOnceListener")}rawListeners(){throw Kp.With("ENOSYS",this.path,"Watcher.rawListeners")}ref(){return this}unref(){return this}}class Mg extends Og{constructor(e,t){super(e),this.options=t,function(e,t){const n=pf(e);kg.has(n)||kg.set(n,new Set);kg.get(n).add(t)}(e.toString(),this)}close(){super.emit("close"),function(e,t){const n=pf(e);kg.has(n)&&(kg.get(n).delete(t),0===kg.get(n).size&&kg.delete(n))}(this.path.toString(),this)}[Symbol.dispose](){this.close()}}class Rg extends Og{constructor(e,t){super(e),this.options=t,this.start()}onInterval(){try{const n=Bg(this.path);e=this.previous,t=n,(e.size!=t.size||+e.atime!=+t.atime||+e.mtime!=+t.mtime||+e.ctime!=+t.ctime||e.mode!=t.mode)&&(this.emit("change",n,this.previous),this.previous=n)}catch(e){this.emit("error",e)}var e,t}start(){const e=this.options.interval||5e3;try{this.previous=Bg(this.path)}catch(e){return void this.emit("error",e)}this.intervalId=setInterval(this.onInterval.bind(this),e),this.options.persistent||"object"!=typeof this.intervalId||this.intervalId.unref()}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.removeAllListeners()}}const kg=new Map;function Ng(e,t){if(t=pf(t),kg.has(t))for(const n of kg.get(t))n.emit("change",e,nf(t));let n,i=t;for(;i!==n;)if(n=i,i=tf(i),kg.has(i))for(const n of kg.get(i))n.emit("change",e,t.slice(i.length+("/"==i?0:1)))}var Dg=function(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],n&&(r=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");r&&(i=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t},Fg=function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}return function e(){for(;t.stack.length;){var i=t.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(e,function(t){return n(t),e()})}catch(e){n(e)}}if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});function Lg(e,t){e=pf(e),t=pf(t);const n=xg(e,this),i=xg(t,this);if(hm.checkAccess&&!Bg.call(this,tf(e)).hasAccess(bf,this))throw Kp.With("EACCES",e,"rename");try{if(n===i)return n.fs.renameSync(n.path,i.path),Ng("rename",e.toString()),void Ng("change",t.toString());Wg.call(this,t,Hg(e)),zg.call(this,e),Ng("rename",e.toString())}catch(r){throw Ig(r,{[n.path]:e,[i.path]:t})}}function Pg(e){e=pf(e);try{const{fs:t,path:n}=xg(yy.call(this,e),this);return t.existsSync(n)}catch(e){if(e.errno==Xp.ENOENT)return!1;throw e}}function Bg(e,t){e=pf(e);const{fs:n,path:i}=xg(yy.call(this,e),this);try{const e=n.statSync(i);if(hm.checkAccess&&!e.hasAccess(vf,this))throw Kp.With("EACCES",i,"stat");return t?.bigint?new gm(e):e}catch(t){throw Ig(t,{[i]:e})}}function $g(e,t){e=pf(e);const{fs:n,path:i}=xg(e,this);try{const e=n.statSync(i);return t?.bigint?new gm(e):e}catch(t){throw Ig(t,{[i]:e})}}function Ug(e,t=0){const n={stack:[],error:void 0,hasError:!1};try{const i=Dg(n,Vg.call(this,e,"r+"),!1);if(t||(t=0),t<0)throw new Kp(Xp.EINVAL);i.truncateSync(t)}catch(e){n.error=e,n.hasError=!0}finally{Fg(n)}}function zg(e){e=pf(e);const{fs:t,path:n}=xg(e,this);try{if(hm.checkAccess&&!(dg.get(e)||t.statSync(n)).hasAccess(bf,this))throw Kp.With("EACCES",n,"unlink");t.unlinkSync(n),Ng("rename",e.toString())}catch(t){throw Ig(t,{[n]:e})}}function Vg(e,t,n,i=!0){e=pf(e);const r=df(n,420),s=bm(t);e=i?yy.call(this,e):e;const{fs:o,path:a}=xg(e,this);let l;try{l=o.statSync(a)}catch{}if(!l){if(!Em(s)&&!Im(s)||"r+"==s)throw Kp.With("ENOENT",e,"_open");const t=o.statSync(tf(a));if(hm.checkAccess&&!t.hasAccess(bf,this))throw Kp.With("EACCES",tf(e),"_open");if(!t.isDirectory())throw Kp.With("ENOTDIR",tf(e),"_open");return o.createFileSync(a,s,r)}if(hm.checkAccess&&(!l.hasAccess(r,this)||!l.hasAccess(Tm(s),this)))throw Kp.With("EACCES",e,"_open");if(Am(s))throw Kp.With("EEXIST",e,"_open");const u=o.openFileSync(a,s);return wm(s)&&u.truncateSync(0),u}function jg(e,t,n=_f){return yg(Vg.call(this,e,t,n,!0))}function Yg(e,t,n){return yg(Vg.call(this,e,t,n,!1))}function Gg(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=Dg(i,Vg.call(this,e,t,420,n),!1),s=r.statSync(),o=new Uint8Array(s.size);return r.readSync(o,0,s.size,0),o}catch(e){i.error=e,i.hasError=!0}finally{Fg(i)}}function Hg(e,t={}){const n=ff(t,null,"r",420);if(!xm(bm(n.flag)))throw new Kp(Xp.EINVAL,"Flag passed to readFile must allow for reading.");const i=pg.Buffer.from(Gg.call(this,"number"==typeof e?_g(e).path:e.toString(),n.flag,!0));return n.encoding?i.toString(n.encoding):i}function Wg(e,t,n={}){const i={stack:[],error:void 0,hasError:!1};try{const r=ff(n,"utf8","w+",420),s=bm(r.flag);if(!Em(s))throw new Kp(Xp.EINVAL,"Flag passed to writeFile must allow for writing.");if("string"!=typeof t&&!r.encoding)throw new Kp(Xp.EINVAL,"Encoding not specified");const o="string"==typeof t?pg.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new Kp(Xp.EINVAL,"Data not specified");Dg(i,Vg.call(this,"number"==typeof e?_g(e).path:e.toString(),s,r.mode,!0),!1).writeSync(o,0,o.byteLength,0),Ng("change",e.toString())}catch(e){i.error=e,i.hasError=!0}finally{Fg(i)}}function Xg(e,t,n={}){const i={stack:[],error:void 0,hasError:!1};try{const r=ff(n,"utf8","a+",420),s=bm(r.flag);if(!Im(s))throw new Kp(Xp.EINVAL,"Flag passed to appendFile must allow for appending.");if("string"!=typeof t&&!r.encoding)throw new Kp(Xp.EINVAL,"Encoding not specified");const o="string"==typeof t?pg.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);Dg(i,Vg.call(this,"number"==typeof e?_g(e).path:e.toString(),s,r.mode,!0),!1).writeSync(o,0,o.byteLength)}catch(e){i.error=e,i.hasError=!0}finally{Fg(i)}}function qg(e,t){const n=_g(e).statSync();return t?.bigint?new gm(n):n}function Kg(e){_g(e).closeSync(),mg.delete(e)}function Zg(e,t=0){if(t||(t=0),t<0)throw new Kp(Xp.EINVAL);_g(e).truncateSync(t)}function Qg(e){_g(e).syncSync()}function Jg(e){_g(e).datasyncSync()}function ey(e,t,n,i,r){let s,o,a,l;if("string"==typeof t){l="number"==typeof n?n:null;const e="string"==typeof i?i:"utf8";o=0,s=pg.Buffer.from(t,e),a=s.byteLength}else s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=n,a=i,l="number"==typeof r?r:null;const u=_g(e);l??(l=u.position);const c=u.writeSync(s,o,a,l);return Ng("change",u.path),c}function ty(e,t,n,i,r){const s=_g(e),o="object"==typeof n?n.offset:n;return"object"==typeof n&&(i=n.length,r=n.position),r=Number(r),isNaN(r)&&(r=s.position),s.readSync(t,o,i,r)}function ny(e,t,n){_g(e).chownSync(t,n)}function iy(e,t){const n=df(t,-1);if(n<0)throw new Kp(Xp.EINVAL,"Invalid mode.");_g(e).chmodSync(n)}function ry(e,t,n){_g(e).utimesSync(hf(t),hf(n))}function sy(e){e=pf(e);const{fs:t,path:n}=xg(yy.call(this,e),this);try{const i=dg.get(e)||t.statSync(n);if(!i.isDirectory())throw Kp.With("ENOTDIR",n,"rmdir");if(hm.checkAccess&&!i.hasAccess(bf,this))throw Kp.With("EACCES",n,"rmdir");t.rmdirSync(n),Ng("rename",e.toString())}catch(t){throw Ig(t,{[n]:e})}}function oy(e,t){t="object"==typeof t?t:{mode:t};const n=df(t?.mode,511);e=yy.call(this,e);const{fs:i,path:r,root:s}=xg(e,this),o={[r]:e};try{if(!t?.recursive){if(hm.checkAccess&&!i.statSync(tf(r)).hasAccess(bf,this))throw Kp.With("EACCES",tf(r),"mkdir");return i.mkdirSync(r,n)}const a=[];for(let t=r,n=e;!i.existsSync(t);t=tf(t),n=tf(n))a.unshift(t),o[t]=n;for(const e of a){if(hm.checkAccess&&!i.statSync(tf(e)).hasAccess(bf,this))throw Kp.With("EACCES",tf(e),"mkdir");i.mkdirSync(e,n),Ng("rename",e)}return 1==s.length?a[0]:a[0]?.slice(s.length)}catch(e){throw Ig(e,o)}}function ay(e,t){t="object"==typeof t?t:{encoding:t},e=pf(e);const{fs:n,path:i}=xg(yy.call(this,e),this);let r;try{const t=dg.get(e)||n.statSync(i);if(dg.set(e,t),hm.checkAccess&&!t.hasAccess(vf,this))throw Kp.With("EACCES",i,"readdir");if(!t.isDirectory())throw Kp.With("ENOTDIR",i,"readdir");r=n.readdirSync(i)}catch(t){throw Ig(t,{[i]:e})}const s=[];for(const o of r){const r=dg.get(ef(e,o))||n.statSync(ef(i,o));if(dg.set(ef(e,o),r),t?.withFileTypes?s.push(new Sy(o,r)):"buffer"==t?.encoding?s.push(pg.Buffer.from(o)):s.push(o),r.isDirectory()&&t?.recursive)for(const n of ay.call(this,ef(e,o),{...t,_isIndirect:!0}))n instanceof Sy?(n.path=ef(o,n.path),s.push(n)):pg.Buffer.isBuffer(n)?s.push(pg.Buffer.from(ef(o,lf(n)))):s.push(ef(o,n))}return t?._isIndirect||dg.clear(),s}function ly(e,t){if(e=pf(e),hm.checkAccess&&!Bg(tf(e)).hasAccess(vf,this))throw Kp.With("EACCES",tf(e),"link");if(t=pf(t),hm.checkAccess&&!Bg(tf(t)).hasAccess(bf,this))throw Kp.With("EACCES",tf(t),"link");const{fs:n,path:i}=xg(e,this),r=xg(t,this);if(n!=r.fs)throw Kp.With("EXDEV",t,"link");try{if(hm.checkAccess&&!n.statSync(i).hasAccess(vf,this))throw Kp.With("EACCES",i,"link");return n.linkSync(i,t)}catch(n){throw Ig(n,{[i]:e,[r.path]:t})}}function uy(e,t,n="file"){if(!["file","dir","junction"].includes(n))throw new Kp(Xp.EINVAL,"Invalid type: "+n);if(Pg.call(this,t))throw Kp.With("EEXIST",t.toString(),"symlink");Wg.call(this,t,e.toString());Vg.call(this,t,"r+",420,!1).chmodSync(jf)}function cy(e,t){const n=pg.Buffer.from(Gg.call(this,e.toString(),"r",!1)),i="object"==typeof t?t?.encoding:t;return"buffer"==i?n:n.toString(i)}function dy(e,t,n){const i=jg.call(this,e,"r+");ny(i,t,n),Kg(i)}function hy(e,t,n){const i=Yg.call(this,e,"r+");ny(i,t,n),Kg(i)}function py(e,t){const n=jg.call(this,e,"r+");iy(n,t),Kg(n)}function fy(e,t){const n=Yg.call(this,e,"r+");iy(n,t),Kg(n)}function my(e,t,n){const i=jg.call(this,e,"r+");ry(i,t,n),Kg(i)}function gy(e,t,n){const i=Yg.call(this,e,"r+");ry(i,t,n),Kg(i)}function yy(e,t){e=pf(e);const n=(this?.root||"")+e;if(hg.has(n))return hg.get(n);const{base:i,dir:r}=rf(e),s="/"==r?"/":hg.get((this?.root||"")+r)||yy.call(this,r),o=ef(s,i),{fs:a,path:l}=xg(o,this);try{const i=dg.get(o)||a.statSync(l);if(dg.set(o,i),!i.isSymbolicLink())return hg.set(e,o),o;const r=Jp(s,cy.call(this,o,t).toString()),u=hg.get((this?.root||"")+r)||yy.call(this,r);return hg.set(n,u),u}catch(t){if("ENOENT"==t.code)return e;throw Ig(t,{[l]:o})}}function _y(e,t=384){if(hm.checkAccess&&!Bg.call(this,e).hasAccess(t,this))throw new Kp(Xp.EACCES)}function vy(e,t){let n;e=pf(e);try{n=dg.get(e)||$g.bind(this)(e)}catch(e){if("ENOENT"!=e.code||!t?.force)throw e}if(n){switch(dg.set(e,n),n.mode&zf){case Hf:if(t?.recursive)for(const n of ay.call(this,e,{_isIndirect:!0}))vy.call(this,ef(e,n),{...t,_isIndirect:!0});sy.call(this,e);break;case Yf:case jf:case Gf:case Wf:zg.call(this,e);break;default:throw dg.clear(),new Kp(Xp.EPERM,"File type not supported",e,"rm")}t?._isIndirect||dg.clear()}}function by(e,t){const n="object"==typeof t?t?.encoding:t||"utf8",i="/tmp/"+`${e}${Date.now()}-${Math.random().toString(36).slice(2)}`;return oy.call(this,i),"buffer"==n?pg.Buffer.from(i):i}function Ty(e,t,n){if(e=pf(e),t=pf(t),n&&n&xf&&Pg(t))throw new Kp(Xp.EEXIST,"Destination file already exists.",t,"copyFile");Wg.call(this,t,Hg(e)),Ng("rename",t.toString())}function xy(e,t,n){const i=_g(e);let r=0;for(const e of t)r+=i.readSync(e,0,e.byteLength,n+r);return r}function Ey(e,t,n){const i=_g(e);let r=0;for(const e of t)r+=i.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+r);return r}function wy(e,t){return e=pf(e),new Cy(e,this)}function Iy(e,t,n){e=pf(e),t=pf(t);const i=$g.call(this,e);if(n?.errorOnExist&&Pg.call(this,t))throw new Kp(Xp.EEXIST,"Destination file or directory already exists.",t,"cp");switch(i.mode&zf){case Hf:if(!n?.recursive)throw new Kp(Xp.EISDIR,e+" is a directory (not copied)",e,"cp");oy.call(this,t,{recursive:!0});for(const i of ay.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(ef(e,i.name),ef(t,i.name))||Iy.call(this,ef(e,i.name),ef(t,i.name),n);break;case Yf:case jf:Ty.call(this,e,t);break;default:throw new Kp(Xp.EPERM,"File type not supported",e,"rm")}n?.preserveTimestamps&&my.call(this,t,i.atime,i.mtime)}function Ay(e,t){e=pf(e);const{fs:n}=xg(e,this);return Sg(n,t?.bigint)}class Sy{get name(){return nf(this.path)}constructor(e,t){this.path=e,this.stats=t}get parentPath(){return this.path}isFile(){return this.stats.isFile()}isDirectory(){return this.stats.isDirectory()}isBlockDevice(){return this.stats.isBlockDevice()}isCharacterDevice(){return this.stats.isCharacterDevice()}isSymbolicLink(){return this.stats.isSymbolicLink()}isFIFO(){return this.stats.isFIFO()}isSocket(){return this.stats.isSocket()}}class Cy{checkClosed(){if(this.closed)throw new Kp(Xp.EBADF,"Can not use closed Dir")}constructor(e,t){this.path=e,this.context=t,this.closed=!1}close(e){if(this.closed=!0,!e)return Promise.resolve();e()}closeSync(){this.closed=!0}async _read(){return this.checkClosed(),this._entries??(this._entries=await Xy.call(this.context,this.path,{withFileTypes:!0})),this._entries.length?this._entries.shift()??null:null}read(e){if(!e)return this._read();this._read().then(t=>e(void 0,t))}readSync(){return this.checkClosed(),this._entries??(this._entries=ay.call(this.context,this.path,{withFileTypes:!0})),this._entries.length?this._entries.shift()??null:null}async next(){const e=await this._read();return e?{done:!1,value:e}:(await this.close(),{done:!0,value:void 0})}[Symbol.asyncIterator](){return this}}var Oy=n(86248);class My extends Oy.Readable{close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(t){e(new Kp(Xp.EIO,t.toString()))}}}class Ry extends Oy.Writable{close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(t){e(new Kp(Xp.EIO,t.toString()))}}}var ky=function(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],n&&(r=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");r&&(i=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t},Ny=function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}return function e(){for(;t.stack.length;){var i=t.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(e,function(t){return n(t),e()})}catch(e){n(e)}}if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});class Dy{constructor(e,t){this.context=t;const n="number"!=typeof e;this.fd=n?yg(e):e,this.file=n?e:_g(e)}async chown(e,t){await this.file.chown(e,t),Ng("change",this.file.path)}async chmod(e){const t=df(e,-1);if(t<0)throw new Kp(Xp.EINVAL,"Invalid mode.");await this.file.chmod(t),Ng("change",this.file.path)}datasync(){return this.file.datasync()}sync(){return this.file.sync()}async truncate(e){if(e||(e=0),e<0)throw new Kp(Xp.EINVAL);await this.file.truncate(e),Ng("change",this.file.path)}async utimes(e,t){await this.file.utimes(hf(e),hf(t)),Ng("change",this.file.path)}async appendFile(e,t={}){const n=ff(t,"utf8","a",420);if(!Im(bm(n.flag)))throw new Kp(Xp.EINVAL,"Flag passed to appendFile must allow for appending.");if("string"!=typeof e&&!n.encoding)throw new Kp(Xp.EINVAL,"Encoding not specified");const i="string"==typeof e?pg.Buffer.from(e,n.encoding):e;await this.file.write(i,0,i.length),Ng("change",this.file.path)}read(e,t,n,i){return isNaN(+i)&&(i=this.file.position),this.file.read(e,t,n,i)}async readFile(e){const t=ff(e,null,"r",292);if(!xm(bm(t.flag)))throw new Kp(Xp.EINVAL,"Flag passed must allow for reading.");const{size:n}=await this.stat(),{buffer:i}=await this.file.read(new Uint8Array(n),0,n,0),r=pg.Buffer.from(i);return t.encoding?r.toString(t.encoding):r}readableWebStream(e={}){const t=globalThis;if(!("ReadableStream"in t))throw new Kp(Xp.ENOSYS,"ReadableStream is missing on globalThis");return new t.ReadableStream({start:async e=>{try{const t=65536,n=1e7;let i=0,r=0,s=NaN;for(;s>0;){const o=await this.read(new Uint8Array(t),0,t,r);if(!o.bytesRead)return void e.close();if(e.enqueue(o.buffer.slice(0,o.bytesRead)),r+=o.bytesRead,++i>=n)throw new Kp(Xp.EFBIG,"Too many iterations on readable stream",this.file.path,"FileHandle.readableWebStream");s=o.bytesRead}}catch(t){e.error(t)}},type:e.type})}readLines(e){throw Kp.With("ENOSYS",this.file.path,"FileHandle.readLines")}[Symbol.asyncDispose](){return this.close()}async stat(e){const t=await this.file.stat();if(hm.checkAccess&&!t.hasAccess(vf,this.context))throw Kp.With("EACCES",this.file.path,"stat");return e?.bigint?new gm(t):t}async write(e,t,n,i){let r,s,o;if("string"==typeof e){i="number"==typeof t?t:null;const a="string"==typeof n?n:"utf8";s=0,r=pg.Buffer.from(e,a),o=r.length}else r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=t,o=n,i="number"==typeof i?i:null;i??(i=this.file.position);const a=await this.file.write(r,s,o,i);return Ng("change",this.file.path),{buffer:r,bytesWritten:a}}async writeFile(e,t={}){const n=ff(t,"utf8","w",420);if(!Em(bm(n.flag)))throw new Kp(Xp.EINVAL,"Flag passed must allow for writing.");if("string"!=typeof e&&!n.encoding)throw new Kp(Xp.EINVAL,"Encoding not specified");const i="string"==typeof e?pg.Buffer.from(e,n.encoding):e;await this.file.write(i,0,i.length,0),Ng("change",this.file.path)}async close(){await this.file.close(),mg.delete(this.fd)}async writev(e,t){let n=0;for(const i of e)n+=(await this.write(i,0,i.length,t+n)).bytesWritten;return{bytesWritten:n,buffers:e}}async readv(e,t){let n=0;for(const i of e)n+=(await this.read(i,0,i.byteLength,t+n)).bytesRead;return{bytesRead:n,buffers:e}}createReadStream(e){const t=new My({highWaterMark:e?.highWaterMark||65536,encoding:e.encoding,read:async e=>{try{const n=await this.read(new Uint8Array(e),0,e,this.file.position);t.push(n.bytesRead?n.buffer.slice(0,n.bytesRead):null),this.file.position+=n.bytesRead}catch(e){t.destroy(e)}}});return t.path=this.file.path,t}createWriteStream(e){const t=new Ry({highWaterMark:e?.highWaterMark,encoding:e?.encoding,write:async(e,t,n)=>{try{const{bytesWritten:i}=await this.write(e,null,t);n(i==e.length?null:new Error("Failed to write full chunk"))}catch(e){n(e)}}});return t.path=this.file.path,t}}async function Fy(e,t){e=pf(e),t=pf(t);const n=xg(e,this),i=xg(t,this);if(hm.checkAccess&&!(await Py.call(this,tf(e))).hasAccess(bf,this))throw Kp.With("EACCES",e,"rename");try{if(n.mountPoint==i.mountPoint)return await n.fs.rename(n.path,i.path),Ng("rename",e.toString()),void Ng("change",t.toString());await Yy.call(this,t,await jy(e)),await Uy.call(this,e),Ng("rename",e.toString())}catch(r){throw Ig(r,{[n.path]:e,[i.path]:t})}}async function Ly(e){try{const{fs:t,path:n}=xg(await r_.call(this,e),this);return await t.exists(n)}catch(e){if(e instanceof Kp&&"ENOENT"==e.code)return!1;throw e}}async function Py(e,t){e=pf(e);const{fs:n,path:i}=xg(await r_.call(this,e),this);try{const e=await n.stat(i);if(hm.checkAccess&&!e.hasAccess(vf,this))throw Kp.With("EACCES",i,"stat");return t?.bigint?new gm(e):e}catch(t){throw Ig(t,{[i]:e})}}async function By(e,t){e=pf(e);const{fs:n,path:i}=xg(e,this);try{const e=await n.stat(i);return t?.bigint?new gm(e):e}catch(t){throw Ig(t,{[i]:e})}}async function $y(e,t=0){const n={stack:[],error:void 0,hasError:!1};try{const i=ky(n,await Vy.call(this,e,"r+"),!0);await i.truncate(t)}catch(e){n.error=e,n.hasError=!0}finally{const e=Ny(n);e&&await e}}async function Uy(e){e=pf(e);const{fs:t,path:n}=xg(e,this);try{if(hm.checkAccess&&!(await(dg.getAsync(e)||t.stat(n))).hasAccess(bf,this))throw Kp.With("EACCES",n,"unlink");await t.unlink(n),Ng("rename",e.toString())}catch(t){throw Ig(t,{[n]:e})}}async function zy(e,t,n=420,i){e=pf(e);const r=df(n,420),s=bm(t);e=i?await r_.call(this,e):e;const{fs:o,path:a}=xg(e,this),l=await o.stat(a).catch(()=>null);if(!l){if(!Em(s)&&!Im(s)||"r+"==s)throw Kp.With("ENOENT",e,"_open");const t=await o.stat(tf(a));if(hm.checkAccess&&!t.hasAccess(bf,this))throw Kp.With("EACCES",tf(e),"_open");if(!t.isDirectory())throw Kp.With("ENOTDIR",tf(e),"_open");return new Dy(await o.createFile(a,s,r),this)}if(hm.checkAccess&&!l.hasAccess(Tm(s),this))throw Kp.With("EACCES",e,"_open");if(Am(s))throw Kp.With("EEXIST",e,"_open");const u=new Dy(await o.openFile(a,s),this);return wm(s)&&await u.truncate(0),u}async function Vy(e,t="r",n=420){return await zy.call(this,e,t,n,!0)}async function jy(e,t){const n={stack:[],error:void 0,hasError:!1};try{const i=ff(t,null,"r",420),r=ky(n,"object"==typeof e&&"fd"in e?e:await Vy.call(this,e,i.flag,i.mode),!0);return await r.readFile(i)}catch(e){n.error=e,n.hasError=!0}finally{const e=Ny(n);e&&await e}}async function Yy(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=ff(n,"utf8","w+",420),s=ky(i,e instanceof Dy?e:await Vy.call(this,e.toString(),r.flag,r.mode),!0),o=t;if("string"!=typeof o&&!(o instanceof Uint8Array))throw new Kp(Xp.EINVAL,"Iterables and streams not supported",s.file.path,"writeFile");await s.writeFile(o,r)}catch(e){i.error=e,i.hasError=!0}finally{const e=Ny(i);e&&await e}}async function Gy(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=ff(n,"utf8","a",420);if(!Im(bm(r.flag)))throw new Kp(Xp.EINVAL,"Flag passed to appendFile must allow for appending.");if("string"!=typeof t&&!r.encoding)throw new Kp(Xp.EINVAL,"Encoding not specified");const s="string"==typeof t?pg.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=ky(i,"object"==typeof e&&"fd"in e?e:await Vy.call(this,e,r.flag,r.mode),!0);await o.appendFile(s,r)}catch(e){i.error=e,i.hasError=!0}finally{const e=Ny(i);e&&await e}}async function Hy(e){e=await r_.call(this,e);const{fs:t,path:n}=xg(e,this);try{const i=await(dg.getAsync(e)||t.stat(n));if(!i)throw Kp.With("ENOENT",e,"rmdir");if(!i.isDirectory())throw Kp.With("ENOTDIR",n,"rmdir");if(hm.checkAccess&&!i.hasAccess(bf,this))throw Kp.With("EACCES",n,"rmdir");await t.rmdir(n),Ng("rename",e.toString())}catch(t){throw Ig(t,{[n]:e})}}async function Wy(e,t){t="object"==typeof t?t:{mode:t};const n=df(t?.mode,511);e=await r_.call(this,e);const{fs:i,path:r,root:s}=xg(e,this),o={[r]:e};try{if(!t?.recursive){if(hm.checkAccess&&!(await i.stat(tf(r))).hasAccess(bf,this))throw Kp.With("EACCES",tf(r),"mkdir");return await i.mkdir(r,n),void Ng("rename",e.toString())}const a=[];for(let t=r,n=e;!await i.exists(t);t=tf(t),n=tf(n))a.unshift(t),o[t]=n;for(const e of a){if(hm.checkAccess&&!(await i.stat(tf(e))).hasAccess(bf,this))throw Kp.With("EACCES",tf(e),"mkdir");await i.mkdir(e,n),Ng("rename",e)}return 1==s.length?a[0]:a[0]?.slice(s.length)}catch(e){throw Ig(e,o)}}async function Xy(e,t){t="object"==typeof t?t:{encoding:t},e=await r_.call(this,e);const n=t=>{throw Ig(t,{[r]:e})},{fs:i,path:r}=xg(e,this),s=dg.getAsync(e)||i.stat(r).catch(n);dg.setAsync(e,s);const o=await s;if(!o)throw Kp.With("ENOENT",e,"readdir");if(hm.checkAccess&&!o.hasAccess(vf,this))throw Kp.With("EACCES",e,"readdir");if(!o.isDirectory())throw Kp.With("ENOTDIR",e,"readdir");const a=await i.readdir(r).catch(n),l=[];return await Promise.all(a.map(async s=>{let o;if(t?.recursive||t?.withFileTypes){const t=dg.getAsync(ef(e,s))||i.stat(ef(r,s)).catch(n);dg.setAsync(ef(e,s),t),o=await t}if(t?.withFileTypes?l.push(new Sy(s,o)):"buffer"==t?.encoding?l.push(pg.Buffer.from(s)):l.push(s),t?.recursive&&o?.isDirectory())for(const n of await Xy.call(this,ef(e,s),{...t,_isIndirect:!0}))n instanceof Sy?(n.path=ef(s,n.path),l.push(n)):pg.Buffer.isBuffer(n)?l.push(pg.Buffer.from(ef(s,lf(n)))):l.push(ef(s,n))})),t?._isIndirect||dg.clear(),l}async function qy(e,t){e=pf(e),t=pf(t);const{fs:n,path:i}=xg(e,this),r=xg(t,this);if(n!=r.fs)throw Kp.With("EXDEV",t,"link");try{if(hm.checkAccess&&!(await n.stat(tf(e))).hasAccess(vf,this))throw Kp.With("EACCES",tf(i),"link");if(hm.checkAccess&&!(await Py.call(this,tf(t))).hasAccess(bf,this))throw Kp.With("EACCES",tf(t),"link");if(hm.checkAccess&&!(await n.stat(i)).hasAccess(vf,this))throw Kp.With("EACCES",i,"link");return await n.link(i,r.path)}catch(n){throw Ig(n,{[r.path]:t,[i]:e})}}async function Ky(e,t,n="file"){const i={stack:[],error:void 0,hasError:!1};try{if(!["file","dir","junction"].includes(n))throw new Kp(Xp.EINVAL,"Invalid symlink type: "+n);if(await Ly.call(this,t))throw Kp.With("EEXIST",t.toString(),"symlink");const r=ky(i,await zy.call(this,t,"w+",420,!1),!0);await r.writeFile(e.toString()),await r.file.chmod(jf)}catch(e){i.error=e,i.hasError=!0}finally{const e=Ny(i);e&&await e}}async function Zy(e,t){const n={stack:[],error:void 0,hasError:!1};try{const i=ky(n,await zy.call(this,pf(e),"r",420,!1),!0),r=await i.readFile(),s="object"==typeof t?t?.encoding:t;return"buffer"==s?r:r.toString(s)}catch(e){n.error=e,n.hasError=!0}finally{const e=Ny(n);e&&await e}}async function Qy(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=ky(i,await Vy.call(this,e,"r+"),!0);await r.chown(t,n)}catch(e){i.error=e,i.hasError=!0}finally{const e=Ny(i);e&&await e}}async function Jy(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=ky(i,await zy.call(this,e,"r+",420,!1),!0);await r.chown(t,n)}catch(e){i.error=e,i.hasError=!0}finally{const e=Ny(i);e&&await e}}async function e_(e,t){const n={stack:[],error:void 0,hasError:!1};try{const i=ky(n,await Vy.call(this,e,"r+"),!0);await i.chmod(t)}catch(e){n.error=e,n.hasError=!0}finally{const e=Ny(n);e&&await e}}async function t_(e,t){const n={stack:[],error:void 0,hasError:!1};try{const i=ky(n,await zy.call(this,e,"r+",420,!1),!0);await i.chmod(t)}catch(e){n.error=e,n.hasError=!0}finally{const e=Ny(n);e&&await e}}async function n_(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=ky(i,await Vy.call(this,e,"r+"),!0);await r.utimes(t,n)}catch(e){i.error=e,i.hasError=!0}finally{const e=Ny(i);e&&await e}}async function i_(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{const r=ky(i,await zy.call(this,e,"r+",420,!1),!0);await r.utimes(new Date(t),new Date(n))}catch(e){i.error=e,i.hasError=!0}finally{const e=Ny(i);e&&await e}}async function r_(e,t){e=pf(e);const n=(this?.root||"")+e;if(hg.hasAsync(n))return hg.getAsync(n);const{base:i,dir:r}=rf(e),s="/"==r?"/":await(hg.getAsync((this?.root||"")+r)||r_.call(this,r)),o=ef(s,i),{fs:a,path:l}=xg(o,this);try{const t=dg.getAsync(o)||a.stat(l);if(dg.setAsync(o,t),!(await t).isSymbolicLink())return hg.set(e,o),o;const i=Jp(s,(await Zy.call(this,o)).toString()),r=hg.getAsync((this?.root||"")+i)||r_.call(this,i);return hg.setAsync(n,r),await r}catch(t){if("ENOENT"==t.code)return e;throw Ig(t,{[l]:o})}}function s_(e,t={}){return{[Symbol.asyncIterator](){const n=new Mg(e.toString(),"string"!=typeof t?t:{encoding:t}),i=[];function r(){n.close();for(const e of i)e({value:null,done:!0});return i.length=0,Promise.resolve({value:null,done:!0})}return n.on("change",(e,t)=>{i.shift()?.({value:{eventType:e,filename:t},done:!1})}),{async next(){const{promise:e,resolve:t}=Promise.withResolvers();return i.push(t),e},return:r,throw:r}}}}async function o_(e,t=_f){if(!hm.checkAccess)return;if(!(await Py.call(this,e)).hasAccess(t,this))throw new Kp(Xp.EACCES)}async function a_(e,t){e=pf(e);const n=await(dg.getAsync(e)||By.call(this,e).catch(e=>{if("ENOENT"!=e.code||!t?.force)throw e}));if(n){switch(dg.set(e,n),n.mode&zf){case Hf:if(t?.recursive)for(const n of await Xy.call(this,e,{_isIndirect:!0}))await a_.call(this,ef(e,n),{...t,_isIndirect:!0});await Hy.call(this,e);break;case Yf:case jf:case Gf:case Wf:await Uy.call(this,e);break;default:throw dg.clear(),new Kp(Xp.EPERM,"File type not supported",e,"rm")}t?._isIndirect||dg.clear()}}async function l_(e,t){const n="object"==typeof t?t?.encoding:t||"utf8",i="/tmp/"+`${e}${Date.now()}-${Math.random().toString(36).slice(2)}`;return await Wy.call(this,i),"buffer"==n?pg.Buffer.from(i):i}async function u_(e,t,n){if(e=pf(e),t=pf(t),n&&n&xf&&await Ly.call(this,t))throw new Kp(Xp.EEXIST,"Destination file already exists.",t,"copyFile");await Yy.call(this,t,await jy.call(this,e)),Ng("rename",t.toString())}function c_(e,t){return e=pf(e),Promise.resolve(new Cy(e,this))}async function d_(e,t,n){e=pf(e),t=pf(t);const i=await By.call(this,e);if(n?.errorOnExist&&await Ly.call(this,t))throw new Kp(Xp.EEXIST,"Destination file or directory already exists.",t,"cp");switch(i.mode&zf){case Hf:{if(!n?.recursive)throw new Kp(Xp.EISDIR,e+" is a directory (not copied)",e,"cp");const[i]=await Promise.all([Xy.call(this,e,{withFileTypes:!0}),Wy.call(this,t,{recursive:!0})]),r=async i=>{n.filter&&!n.filter(ef(e,i.name),ef(t,i.name))||await d_.call(this,ef(e,i.name),ef(t,i.name),n)};await Promise.all(i.map(r));break}case Yf:case jf:await u_.call(this,e,t);break;default:throw new Kp(Xp.EPERM,"File type not supported",e,"rm")}n?.preserveTimestamps&&await n_.call(this,t,i.atime,i.mtime)}async function h_(e,t){e=pf(e);const{fs:n}=xg(e,this);return Promise.resolve(Sg(n,t?.bigint))}const p_=()=>{};function f_(e,t,n=p_){Fy.call(this,e,t).then(()=>n()).catch(n)}function m_(e,t=p_){Ly.call(this,e).then(t).catch(()=>t(!1))}function g_(e,t,n=p_){n="function"==typeof t?t:n,Py.call(this,e,"function"!=typeof t?t:{}).then(e=>n(void 0,e)).catch(n)}function y_(e,t,n=p_){n="function"==typeof t?t:n,By.call(this,e,"function"!=typeof t?t:{}).then(e=>n(void 0,e)).catch(n)}function __(e,t=0,n=p_){n="function"==typeof t?t:n;const i="number"==typeof t?t:0;$y.call(this,e,i).then(()=>n()).catch(n)}function v_(e,t=p_){Uy.call(this,e).then(()=>t()).catch(t)}function b_(e,t,n,i=p_){const r=df(n,420);i="function"==typeof n?n:i,Vy.call(this,e,t,r).then(e=>i(void 0,e.fd)).catch(i)}function T_(e,t,n=p_){n="function"==typeof t?t:n,jy.call(this,e,"function"==typeof t?null:t).then(e=>n(void 0,e)).catch(n)}function x_(e,t,n,i=p_){i="function"==typeof n?n:i,Yy.call(this,e,t,"function"!=typeof n?n:null).then(()=>i(void 0)).catch(i)}function E_(e,t,n,i=p_){const r="function"!=typeof n?n:void 0;i="function"==typeof n?n:i,Gy.call(this,e,t,r).then(()=>i()).catch(i)}function w_(e,t,n=p_){n="function"==typeof t?t:n,_g(e).stat().then(e=>n(void 0,"object"==typeof t&&t?.bigint?new gm(e):e)).catch(n)}function I_(e,t=p_){const n=_g(e).close();mg.delete(e),n.then(()=>t()).catch(t)}function A_(e,t,n=p_){const i="number"==typeof t?t:0;n="function"==typeof t?t:n;const r=_g(e);if(i<0)throw new Kp(Xp.EINVAL);r.truncate(i).then(()=>n()).catch(n)}function S_(e,t=p_){_g(e).sync().then(()=>t()).catch(t)}function C_(e,t=p_){_g(e).datasync().then(()=>t()).catch(t)}function O_(e,t,n,i,r,s=p_){let o,a,l,u,c;const d=new Dy(e,this);if("string"==typeof t){switch(c="utf8",typeof n){case"function":s=n;break;case"number":u=n,c="string"==typeof i?i:"utf8",s="function"==typeof r?r:s;break;default:return void(s="function"==typeof i?i:"function"==typeof r?r:s)(new Kp(Xp.EINVAL,"Invalid arguments."))}o=pg.Buffer.from(t),a=0,l=o.length;const e=s;d.write(o,a,l,u).then(({bytesWritten:t})=>e(void 0,t,o.toString(c))).catch(e)}else{o=pg.Buffer.from(t.buffer),a=n,l=i,u="number"==typeof r?r:null;const e="function"==typeof r?r:s;d.write(o,a,l,u).then(({bytesWritten:t})=>e(void 0,t,o)).catch(e)}}function M_(e,t,n,i,r,s=p_){new Dy(e,this).read(t,n,i,r).then(({bytesRead:e,buffer:t})=>s(void 0,e,t)).catch(s)}function R_(e,t,n,i=p_){new Dy(e,this).chown(t,n).then(()=>i()).catch(i)}function k_(e,t,n){new Dy(e,this).chmod(t).then(()=>n()).catch(n)}function N_(e,t,n,i=p_){new Dy(e,this).utimes(t,n).then(()=>i()).catch(i)}function D_(e,t=p_){Hy.call(this,e).then(()=>t()).catch(t)}function F_(e,t,n=p_){Wy.call(this,e,t).then(()=>n()).catch(n)}function L_(e,t,n=p_){n="function"==typeof t?t:n;const i="function"!=typeof t?t:{};Xy.call(this,e,i).then(e=>n(void 0,e)).catch(n)}function P_(e,t,n=p_){qy.call(this,e,t).then(()=>n()).catch(n)}function B_(e,t,n,i=p_){const r="string"==typeof n?n:"file";i="function"==typeof n?n:i,Ky.call(this,e,t,r).then(()=>i()).catch(i)}function $_(e,t,n=p_){n="function"==typeof t?t:n,Zy.call(this,e).then(e=>n(void 0,e)).catch(n)}function U_(e,t,n,i=p_){Qy.call(this,e,t,n).then(()=>i()).catch(i)}function z_(e,t,n,i=p_){Jy.call(this,e,t,n).then(()=>i()).catch(i)}function V_(e,t,n=p_){e_.call(this,e,t).then(()=>n()).catch(n)}function j_(e,t,n=p_){t_.call(this,e,t).then(()=>n()).catch(n)}function Y_(e,t,n,i=p_){n_.call(this,e,t,n).then(()=>i()).catch(i)}function G_(e,t,n,i=p_){i_.call(this,e,t,n).then(()=>i()).catch(i)}function H_(e,t,n=p_){n="function"==typeof t?t:n,r_.call(this,e,"function"==typeof t?null:t).then(e=>n(void 0,e)).catch(n)}function W_(e,t,n=p_){const i="number"==typeof t?t:vf;n="function"==typeof t?t:n,o_.call(this,e,i).then(()=>n()).catch(n)}const X_=new Map;function q_(e,t,n){const i=pf(e.toString()),r="function"!=typeof t?t:{};if("function"==typeof t&&(n=t),!n)throw new Kp(Xp.EINVAL,"No listener specified",e.toString(),"watchFile");if(X_.has(i)){const e=X_.get(i);return void(e&&e.listeners.add(n))}const s=new Rg(i,r);s.on("change",(e,t)=>{const n=X_.get(i);if(n)for(const i of n.listeners)i(e,t)}),X_.set(i,{watcher:s,listeners:new Set})}function K_(e,t=p_){const n=pf(e.toString()),i=X_.get(n);i&&(t&&t!==p_?i.listeners.delete(t):i.listeners.clear(),0===i.listeners.size&&(i.watcher.stop(),X_.delete(n)))}function Z_(e,t,n){const i=new Mg(pf(e),"object"==typeof t?t:{});return n="function"==typeof t?t:n,i.on("change",n||p_),i}function Q_(e,t){const n=this;let i;const r=new My({highWaterMark:(t="object"==typeof t?t:{encoding:t}).highWaterMark||65536,encoding:t.encoding||"utf8",async read(s){try{i||(i=await Vy.call(n,e,"r",t?.mode));const o=await i.read(new Uint8Array(s),0,s,i.file.position);r.push(o.bytesRead?o.buffer.slice(0,o.bytesRead):null),i.file.position+=o.bytesRead,o.bytesRead||await i.close()}catch(e){await(i?.close()),r.destroy(e)}},destroy(e,t){i?.close().then(()=>t(e)).catch(p_)}});return r.path=e.toString(),r}function J_(e,t){const n=this;let i;t="object"==typeof t?t:{encoding:t};const r=new Ry({highWaterMark:t?.highWaterMark,async write(r,s,o){try{i||(i=await Vy.call(n,e,"w",t?.mode||438)),await i.write(r,0,s),o(void 0)}catch(e){await(i?.close()),o(e)}},destroy(e,t){t(e),i?.close().then(()=>t(e)).catch(t)},final(e){i?.close().then(()=>e()).catch(e)}});return r.path=e.toString(),r}function ev(e,t,n=p_){n="function"==typeof t?t:n,a_.call(this,e,"function"==typeof t?void 0:t).then(()=>n(void 0)).catch(n)}function tv(e,t,n=p_){n="function"==typeof t?t:n,l_.call(this,e,"function"!=typeof t?t:null).then(e=>n(void 0,e)).catch(n)}function nv(e,t,n,i=p_){i="function"==typeof n?n:i,u_.call(this,e,t,"function"==typeof n?void 0:n).then(()=>i(void 0)).catch(i)}function iv(e,t,n,i=p_){i="function"==typeof n?n:i,new Dy(e,this).readv(t,"function"==typeof n?void 0:n).then(({buffers:e,bytesRead:t})=>i(void 0,t,e)).catch(i)}function rv(e,t,n,i=p_){i="function"==typeof n?n:i,new Dy(e,this).writev(t,"function"==typeof n?void 0:n).then(({buffers:e,bytesWritten:t})=>i(void 0,t,e)).catch(i)}function sv(e,t,n=p_){n="function"==typeof t?t:n,c_.call(this,e,"function"==typeof t?void 0:t).then(e=>n(void 0,e)).catch(n)}function ov(e,t,n,i=p_){i="function"==typeof n?n:i,d_.call(this,e,t,"function"==typeof n?void 0:n).then(()=>i(void 0)).catch(i)}function av(e,t,n=p_){n="function"==typeof t?t:n,h_.call(this,e,"function"==typeof t?void 0:t).then(e=>n(void 0,e)).catch(n)}async function lv(e,t){const n=await Vy.call(this,e.toString(),"r"),i=await n.readFile();return await n.close(),new Blob([i],t)}var uv=function(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],n&&(r=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");r&&(i=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t},cv=function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}return function e(){for(;t.stack.length;){var i=t.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(e,function(t){return n(t),e()})}catch(e){n(e)}}if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});function dv(e){return class extends e{constructor(){super(...arguments),this._queue=[],this._isInitialized=!1}get _queueRunning(){return!!this._queue.length}queueDone(){return new Promise(e=>{const t=()=>this._queueRunning?setTimeout(t):e();t()})}async ready(){if(await super.ready(),await this.queueDone(),!this._isInitialized&&!this._disableSync){if(this.checkSync(),await this._sync.ready(),this._sync instanceof ig&&this instanceof ig){const e=this._sync.store.transaction(),t=this.store.transaction(),n=[];for(const i of await t.keys())n.push(t.get(i).then(t=>e.setSync(i,t)));return await Promise.all(n),void(this._isInitialized=!0)}try{await this.crossCopy("/"),this._isInitialized=!0}catch(e){throw this._isInitialized=!1,e}}}checkSync(e,t){if(this._disableSync)throw new Kp(Xp.ENOTSUP,"Sync caching has been disabled for this async file system",e,t);if(!this._sync)throw new Kp(Xp.ENOTSUP,"No sync cache is attached to this async file system",e,t)}renameSync(e,t){this.checkSync(e,"rename"),this._sync.renameSync(e,t),this.queue("rename",e,t)}statSync(e){return this.checkSync(e,"stat"),this._sync.statSync(e)}createFileSync(e,t,n){return this.checkSync(e,"createFile"),this._sync.createFileSync(e,t,n),this.queue("createFile",e,t,n),this.openFileSync(e,t)}openFileSync(e,t){this.checkSync(e,"openFile");const n=this._sync.openFileSync(e,t+"+"),i=n.statSync(),r=new Uint8Array(i.size);return n.readSync(r),new Cm(this,e,t,i,r)}unlinkSync(e){this.checkSync(e,"unlinkSync"),this._sync.unlinkSync(e),this.queue("unlink",e)}rmdirSync(e){this.checkSync(e,"rmdir"),this._sync.rmdirSync(e),this.queue("rmdir",e)}mkdirSync(e,t){this.checkSync(e,"mkdir"),this._sync.mkdirSync(e,t),this.queue("mkdir",e,t)}readdirSync(e){return this.checkSync(e,"readdir"),this._sync.readdirSync(e)}linkSync(e,t){this.checkSync(e,"link"),this._sync.linkSync(e,t),this.queue("link",e,t)}syncSync(e,t,n){this.checkSync(e,"sync"),this._sync.syncSync(e,t,n),this.queue("sync",e,t,n)}existsSync(e){return this.checkSync(e,"exists"),this._sync.existsSync(e)}async crossCopy(e){this.checkSync(e,"crossCopy");const t=await this.stat(e);if(!t.isDirectory()){const n={stack:[],error:void 0,hasError:!1};try{const i=uv(n,await this.openFile(e,bm("r")),!0),r=uv(n,this._sync.createFileSync(e,bm("w"),t.mode),!1),s=new Uint8Array(t.size);return await i.read(s),void r.writeSync(s,0,t.size)}catch(e){n.error=e,n.hasError=!0}finally{const e=cv(n);e&&await e}}if("/"!==e){const t=await this.stat(e);this._sync.mkdirSync(e,t.mode)}const n=[];for(const t of await this.readdir(e))n.push(this.crossCopy(ef(e,t)));await Promise.all(n)}async _next(){if(!this._queueRunning)return;const[e,...t]=this._queue.shift();await this[e](...t),await this._next()}queue(...e){this._queue.push(e),this._next()}}}new Map;dv(Om);new Map;Map;hv=Om;var hv;var pv=function(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],n&&(r=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");r&&(i=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t},fv=function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}return function e(){for(;t.stack.length;){var i=t.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(e,function(t){return n(t),e()})}catch(e){n(e)}}if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});class mv{get isLocked(){return this._isLocked}constructor(e){this.previous=e,this.current=Promise.withResolvers(),this._isLocked=!0}async done(){await(this.previous?.done()),await this.current.promise}unlock(){this.current.resolve(),this._isLocked=!1}[Symbol.dispose](){this.unlock()}}class gv{async ready(){return await this._fs.ready()}metadata(){return this._fs.metadata()}addLock(){const e=new mv(this.currentLock);return this.currentLock=e,e}async lock(e,t){const n=this.currentLock,i=this.addLock(),r=(new Error).stack;return setTimeout(()=>{if(i.isLocked){const n=Kp.With("EDEADLK",e,t);throw n.stack+=r?.slice(5),n}},5e3),await(n?.done()),i}lockSync(e,t){if(this.currentLock?.isLocked)throw Kp.With("EBUSY",e,t);return this.addLock()}get isLocked(){return!!this.currentLock?.isLocked}async rename(e,t){const n={stack:[],error:void 0,hasError:!1};try{pv(n,await this.lock(e,"rename"),!1);await this._fs.rename(e,t)}catch(e){n.error=e,n.hasError=!0}finally{fv(n)}}renameSync(e,t){const n={stack:[],error:void 0,hasError:!1};try{pv(n,this.lockSync(e,"rename"),!1);return this._fs.renameSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{fv(n)}}async stat(e){const t={stack:[],error:void 0,hasError:!1};try{pv(t,await this.lock(e,"stat"),!1);return await this._fs.stat(e)}catch(e){t.error=e,t.hasError=!0}finally{fv(t)}}statSync(e){const t={stack:[],error:void 0,hasError:!1};try{pv(t,this.lockSync(e,"stat"),!1);return this._fs.statSync(e)}catch(e){t.error=e,t.hasError=!0}finally{fv(t)}}async openFile(e,t){const n={stack:[],error:void 0,hasError:!1};try{pv(n,await this.lock(e,"openFile"),!1);const i=await this._fs.openFile(e,t);return i.fs=this,i}catch(e){n.error=e,n.hasError=!0}finally{fv(n)}}openFileSync(e,t){const n={stack:[],error:void 0,hasError:!1};try{pv(n,this.lockSync(e,"openFile"),!1);const i=this._fs.openFileSync(e,t);return i.fs=this,i}catch(e){n.error=e,n.hasError=!0}finally{fv(n)}}async createFile(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{pv(i,await this.lock(e,"createFile"),!1);const r=await this._fs.createFile(e,t,n);return r.fs=this,r}catch(e){i.error=e,i.hasError=!0}finally{fv(i)}}createFileSync(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{pv(i,this.lockSync(e,"createFile"),!1);const r=this._fs.createFileSync(e,t,n);return r.fs=this,r}catch(e){i.error=e,i.hasError=!0}finally{fv(i)}}async unlink(e){const t={stack:[],error:void 0,hasError:!1};try{pv(t,await this.lock(e,"unlink"),!1);await this._fs.unlink(e)}catch(e){t.error=e,t.hasError=!0}finally{fv(t)}}unlinkSync(e){const t={stack:[],error:void 0,hasError:!1};try{pv(t,this.lockSync(e,"unlink"),!1);return this._fs.unlinkSync(e)}catch(e){t.error=e,t.hasError=!0}finally{fv(t)}}async rmdir(e){const t={stack:[],error:void 0,hasError:!1};try{pv(t,await this.lock(e,"rmdir"),!1);await this._fs.rmdir(e)}catch(e){t.error=e,t.hasError=!0}finally{fv(t)}}rmdirSync(e){const t={stack:[],error:void 0,hasError:!1};try{pv(t,this.lockSync(e,"rmdir"),!1);return this._fs.rmdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{fv(t)}}async mkdir(e,t){const n={stack:[],error:void 0,hasError:!1};try{pv(n,await this.lock(e,"mkdir"),!1);await this._fs.mkdir(e,t)}catch(e){n.error=e,n.hasError=!0}finally{fv(n)}}mkdirSync(e,t){const n={stack:[],error:void 0,hasError:!1};try{pv(n,this.lockSync(e,"mkdir"),!1);return this._fs.mkdirSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{fv(n)}}async readdir(e){const t={stack:[],error:void 0,hasError:!1};try{pv(t,await this.lock(e,"readdir"),!1);return await this._fs.readdir(e)}catch(e){t.error=e,t.hasError=!0}finally{fv(t)}}readdirSync(e){const t={stack:[],error:void 0,hasError:!1};try{pv(t,this.lockSync(e,"readdir"),!1);return this._fs.readdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{fv(t)}}async exists(e){const t={stack:[],error:void 0,hasError:!1};try{pv(t,await this.lock(e,"exists"),!1);return await this._fs.exists(e)}catch(e){t.error=e,t.hasError=!0}finally{fv(t)}}existsSync(e){const t={stack:[],error:void 0,hasError:!1};try{pv(t,this.lockSync(e,"exists"),!1);return this._fs.existsSync(e)}catch(e){t.error=e,t.hasError=!0}finally{fv(t)}}async link(e,t){const n={stack:[],error:void 0,hasError:!1};try{pv(n,await this.lock(e,"link"),!1);await this._fs.link(e,t)}catch(e){n.error=e,n.hasError=!0}finally{fv(n)}}linkSync(e,t){const n={stack:[],error:void 0,hasError:!1};try{pv(n,this.lockSync(e,"link"),!1);return this._fs.linkSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{fv(n)}}async sync(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{pv(i,await this.lock(e,"sync"),!1);await this._fs.sync(e,t,n)}catch(e){i.error=e,i.hasError=!0}finally{fv(i)}}syncSync(e,t,n){const i={stack:[],error:void 0,hasError:!1};try{pv(i,this.lockSync(e,"sync"),!1);return this._fs.syncSync(e,t,n)}catch(e){i.error=e,i.hasError=!0}finally{fv(i)}}}var yv=function(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],n&&(r=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");r&&(i=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t},_v=function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}return function e(){for(;t.stack.length;){var i=t.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(e,function(t){return n(t),e()})}catch(e){n(e)}}if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});const vv="/.deleted";class bv extends Om{async ready(){await this.readable.ready(),await this.writable.ready(),await this._ready}constructor({writable:e,readable:t}){if(super(),this._isInitialized=!1,this._deletedFiles=new Set,this._deleteLog="",this._deleteLogUpdatePending=!1,this._deleteLogUpdateNeeded=!1,this.writable=e,this.readable=t,this.writable.metadata().readonly)throw new Kp(Xp.EINVAL,"Writable file system must be writable.");this._ready=this._initialize()}metadata(){return{...super.metadata(),name:Tv.name}}async sync(e,t,n){await this.copyForWrite(e),await this.writable.exists(e)||await this.writable.createFile(e,"w",420),await this.writable.sync(e,t,n)}syncSync(e,t,n){this.copyForWriteSync(e),this.writable.syncSync(e,t,n)}async _initialize(){if(!this._isInitialized){try{const e=await this.writable.openFile(vv,bm("r")),{size:t}=await e.stat(),{buffer:n}=await e.read(new Uint8Array(t));this._deleteLog=lf(n)}catch(e){if(e.errno!==Xp.ENOENT)throw e}this._isInitialized=!0,this._reparseDeletionLog()}}getDeletionLog(){return this._deleteLog}async restoreDeletionLog(e){this._deleteLog=e,this._reparseDeletionLog(),await this.updateLog("")}async rename(e,t){this.checkInitialized(),this.checkPath(e),this.checkPath(t),await this.copyForWrite(e);try{await this.writable.rename(e,t)}catch{if(this._deletedFiles.has(e))throw Kp.With("ENOENT",e,"rename")}}renameSync(e,t){this.checkInitialized(),this.checkPath(e),this.checkPath(t),this.copyForWriteSync(e);try{this.writable.renameSync(e,t)}catch{if(this._deletedFiles.has(e))throw Kp.With("ENOENT",e,"rename")}}async stat(e){this.checkInitialized();try{return await this.writable.stat(e)}catch{if(this._deletedFiles.has(e))throw Kp.With("ENOENT",e,"stat");const t=await this.readable.stat(e);return t.mode|=146,t}}statSync(e){this.checkInitialized();try{return this.writable.statSync(e)}catch{if(this._deletedFiles.has(e))throw Kp.With("ENOENT",e,"stat");const t=this.readable.statSync(e);return t.mode|=146,t}}async openFile(e,t){if(await this.writable.exists(e))return this.writable.openFile(e,t);const n=await this.readable.openFile(e,bm("r")),i=await n.stat(),{buffer:r}=await n.read(new Uint8Array(i.size));return new Cm(this,e,t,i,r)}openFileSync(e,t){if(this.writable.existsSync(e))return this.writable.openFileSync(e,t);const n=this.readable.openFileSync(e,bm("r")),i=n.statSync(),r=new Uint8Array(i.size);return n.readSync(r),new Cm(this,e,t,i,r)}async createFile(e,t,n){return this.checkInitialized(),await this.writable.createFile(e,t,n),this.openFile(e,t)}createFileSync(e,t,n){return this.checkInitialized(),this.writable.createFileSync(e,t,n),this.openFileSync(e,t)}async link(e,t){this.checkInitialized(),await this.copyForWrite(e),await this.writable.link(e,t)}linkSync(e,t){this.checkInitialized(),this.copyForWriteSync(e),this.writable.linkSync(e,t)}async unlink(e){if(this.checkInitialized(),this.checkPath(e),!await this.exists(e))throw Kp.With("ENOENT",e,"unlink");await this.writable.exists(e)&&await this.writable.unlink(e),await this.exists(e)&&await this.deletePath(e)}unlinkSync(e){if(this.checkInitialized(),this.checkPath(e),!this.existsSync(e))throw Kp.With("ENOENT",e,"unlink");this.writable.existsSync(e)&&this.writable.unlinkSync(e),this.existsSync(e)&&this.deletePath(e)}async rmdir(e){if(this.checkInitialized(),!await this.exists(e))throw Kp.With("ENOENT",e,"rmdir");if(await this.writable.exists(e)&&await this.writable.rmdir(e),await this.exists(e)){if((await this.readdir(e)).length)throw Kp.With("ENOTEMPTY",e,"rmdir");await this.deletePath(e)}}rmdirSync(e){if(this.checkInitialized(),!this.existsSync(e))throw Kp.With("ENOENT",e,"rmdir");if(this.writable.existsSync(e)&&this.writable.rmdirSync(e),this.existsSync(e)){if(this.readdirSync(e).length)throw Kp.With("ENOTEMPTY",e,"rmdir");this.deletePath(e)}}async mkdir(e,t){if(this.checkInitialized(),await this.exists(e))throw Kp.With("EEXIST",e,"mkdir");await this.createParentDirectories(e),await this.writable.mkdir(e,t)}mkdirSync(e,t){if(this.checkInitialized(),this.existsSync(e))throw Kp.With("EEXIST",e,"mkdir");this.createParentDirectoriesSync(e),this.writable.mkdirSync(e,t)}async readdir(e){this.checkInitialized();const t=[];try{t.push(...await this.writable.readdir(e))}catch{}try{t.push(...(await this.readable.readdir(e)).filter(t=>!this._deletedFiles.has(`${e}/${t}`)))}catch{}const n={};return t.filter(e=>{const t=!n[e];return n[e]=!0,t})}readdirSync(e){this.checkInitialized();let t=[];try{t=t.concat(this.writable.readdirSync(e))}catch{}try{t=t.concat(this.readable.readdirSync(e).filter(t=>!this._deletedFiles.has(`${e}/${t}`)))}catch{}const n={};return t.filter(e=>{const t=!n[e];return n[e]=!0,t})}async deletePath(e){this._deletedFiles.add(e),await this.updateLog(`d${e}\n`)}async updateLog(e){if(this._deleteLog+=e,this._deleteLogUpdatePending)return void(this._deleteLogUpdateNeeded=!0);this._deleteLogUpdatePending=!0;const t=await this.writable.openFile(vv,bm("w"));try{await t.write(of(this._deleteLog)),this._deleteLogUpdateNeeded&&(this._deleteLogUpdateNeeded=!1,await this.updateLog(""))}catch(e){this._deleteLogError=e}finally{this._deleteLogUpdatePending=!1}}_reparseDeletionLog(){this._deletedFiles.clear();for(const e of this._deleteLog.split("\n"))e.startsWith("d")&&this._deletedFiles.add(e.slice(1))}checkInitialized(){if(!this._isInitialized)throw new Kp(Xp.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.");if(!this._deleteLogError)return;const e=this._deleteLogError;throw delete this._deleteLogError,e}checkPath(e){if(e==vv)throw Kp.With("EPERM",e,"checkPath")}createParentDirectoriesSync(e){let t=tf(e);const n=[];for(;!this.writable.existsSync(t);)n.push(t),t=tf(t);for(const e of n.reverse())this.writable.mkdirSync(e,this.statSync(e).mode)}async createParentDirectories(e){let t=tf(e);const n=[];for(;!await this.writable.exists(t);)n.push(t),t=tf(t);for(const e of n.reverse()){const t=await this.stat(e);await this.writable.mkdir(e,t.mode)}}copyForWriteSync(e){if(!this.existsSync(e))throw Kp.With("ENOENT",e,"copyForWrite");this.writable.existsSync(tf(e))||this.createParentDirectoriesSync(e),this.writable.existsSync(e)||this.copyToWritableSync(e)}async copyForWrite(e){if(!await this.exists(e))throw Kp.With("ENOENT",e,"copyForWrite");if(await this.writable.exists(tf(e))||await this.createParentDirectories(e),!await this.writable.exists(e))return this.copyToWritable(e)}copyToWritableSync(e){const t={stack:[],error:void 0,hasError:!1};try{const n=this.statSync(e);if(n.isDirectory())return void this.writable.mkdirSync(e,n.mode);const i=new Uint8Array(n.size);yv(t,this.readable.openFileSync(e,"r"),!1).readSync(i);yv(t,this.writable.createFileSync(e,"w",146|n.mode),!1).writeSync(i)}catch(e){t.error=e,t.hasError=!0}finally{_v(t)}}async copyToWritable(e){const t={stack:[],error:void 0,hasError:!1};try{const n=await this.stat(e);if(n.isDirectory())return void await this.writable.mkdir(e,n.mode);const i=new Uint8Array(n.size),r=yv(t,await this.readable.openFile(e,"r"),!0);await r.read(i);const s=yv(t,await this.writable.createFile(e,"w",146|n.mode),!0);await s.write(i)}catch(e){t.error=e,t.hasError=!0}finally{const e=_v(t);e&&await e}}}class Tv extends(function(e){return class extends gv{constructor(...t){super(),this._fs=new e(...t)}}}(bv)){}function xv(e,t,n){if(e instanceof Kp)return e;const i=e instanceof DOMException?Xp[function(e){switch(e.name){case"IndexSizeError":case"HierarchyRequestError":case"InvalidCharacterError":case"InvalidStateError":case"SyntaxError":case"NamespaceError":case"TypeMismatchError":case"ConstraintError":case"VersionError":case"URLMismatchError":case"InvalidNodeTypeError":return"EINVAL";case"WrongDocumentError":return"EXDEV";case"NoModificationAllowedError":case"InvalidModificationError":case"InvalidAccessError":case"SecurityError":case"NotAllowedError":return"EACCES";case"NotFoundError":return"ENOENT";case"NotSupportedError":return"ENOTSUP";case"InUseAttributeError":return"EBUSY";case"NetworkError":return"ENETDOWN";case"AbortError":return"EINTR";case"QuotaExceededError":return"ENOSPC";case"TimeoutError":return"ETIMEDOUT";case"ReadOnlyError":return"EROFS";default:return"EIO"}}(e)]:Xp.EIO,r=new Kp(i,e.message,t,n);return r.stack=e.stack,r.cause=e.cause,r}globalThis.__zenfs__=o;class Ev extends(dv(Om)){constructor(e){super(),this._handles=new Map,this._sync=ug.create({name:"accessfs-cache"}),this._handles.set("/",e)}metadata(){return{...super.metadata(),name:"WebAccess",noResizableBuffers:!0}}async sync(e,t){await this.writeFile(e,t)}async rename(e,t){const n=await this.getHandle(e);if(n instanceof FileSystemDirectoryHandle){const n=await this.readdir(e);if(await this.mkdir(t),!n.length)return void await this.unlink(e);for(const i of n)await this.rename(ef(e,i),ef(t,i)),await this.unlink(e);return}if(!(n instanceof FileSystemFileHandle))throw new Kp(Xp.ENOTSUP,"Not a file or directory handle",e,"rename");const i=await n.getFile().catch(t=>{throw xv(t,e,"rename")}),r=await this.getHandle(tf(t));if(!(r instanceof FileSystemDirectoryHandle))return;const s=await r.getFileHandle(nf(t),{create:!0}).catch(e=>{throw xv(e,t,"rename")}),o=await s.createWritable();await o.write(await i.arrayBuffer()),await o.close(),await this.unlink(e)}async writeFile(e,t){if(t.buffer.resizable)throw new Kp(Xp.EINVAL,"Resizable buffers can not be written",e,"write");const n=await this.getHandle(tf(e));if(!(n instanceof FileSystemDirectoryHandle))return;const i=await n.getFileHandle(nf(e),{create:!0}),r=await i.createWritable();await r.write(t),await r.close()}async createFile(e,t){return await this.writeFile(e,new Uint8Array),this.openFile(e,t)}async stat(e){const t=await this.getHandle(e);if(!t)throw Kp.With("ENOENT",e,"stat");if(t instanceof FileSystemDirectoryHandle)return new mm({mode:511|Hf,size:4096});if(t instanceof FileSystemFileHandle){const{lastModified:e,size:n}=await t.getFile();return new mm({mode:511|Yf,size:n,mtimeMs:e})}throw new Kp(Xp.EBADE,"Handle is not a directory or file",e,"stat")}async openFile(e,t){const n=await this.getHandle(e);if(!(n instanceof FileSystemFileHandle))throw Kp.With("EISDIR",e,"openFile");const i=await n.getFile().catch(t=>{throw xv(t,e,"openFile")}),r=new Uint8Array(await i.arrayBuffer()),s=new mm({mode:511|Yf,size:i.size,mtimeMs:i.lastModified});return new Cm(this,e,t,s,r)}async unlink(e){const t=await this.getHandle(tf(e));if(!(t instanceof FileSystemDirectoryHandle))throw Kp.With("ENOTDIR",tf(e),"unlink");await t.removeEntry(nf(e),{recursive:!0}).catch(t=>{throw xv(t,e,"unlink")})}async link(e){}async rmdir(e){return this.unlink(e)}async mkdir(e){if(await this.getHandle(e).catch(e=>{if("ENOENT"!=e.code)throw e}))throw Kp.With("EEXIST",e,"mkdir");const t=await this.getHandle(tf(e));if(!(t instanceof FileSystemDirectoryHandle))throw Kp.With("ENOTDIR",e,"mkdir");await t.getDirectoryHandle(nf(e),{create:!0})}async readdir(e){const t=await this.getHandle(e);if(!(t instanceof FileSystemDirectoryHandle))throw Kp.With("ENOTDIR",e,"readdir");const n=[];for await(const e of t.keys())n.push(e);return n}async getHandle(e){if(this._handles.has(e))return this._handles.get(e);let t="/";for(const n of e.split("/").slice(1)){const e=this._handles.get(t);if(!(e instanceof FileSystemDirectoryHandle))throw Kp.With("ENOTDIR",t,"getHandle");t=ef(t,n);const i=await e.getDirectoryHandle(n).catch(i=>{switch(i.name){case"TypeMismatchError":return e.getFileHandle(n).catch(e=>{});case"TypeError":throw new Kp(Xp.ENOENT,i.message,t,"getHandle");default:throw xv(i,t,"getHandle")}});i&&this._handles.set(t,i)}return this._handles.get(e)}}function wv(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}let Iv;function Av(){return Iv||(Iv=function(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const i=wv(n);return(e,n)=>i.then(i=>n(i.transaction(t,e).objectStore(t)))}("keyval-store","keyval")),Iv}class Sv extends Ev{constructor(e){super(e)}async readFile(e){const t=await this.getHandle(e);if(t instanceof window.FileSystemFileHandle){const e=await t.getFile();return await e.text()}return""}}class Cv extends a.FS{#e=null;#t=new TextEncoder;constructor(){super()}async showDirectoryPicker(){const e=await window.showDirectoryPicker({mode:"readwrite"});if("granted"!==await e.requestPermission({mode:"readwrite"}))throw new Error("readwrite access to directory not granted");return await this.setFSCache(e),this.#e=new Sv(e),e}async loadFS(){let e=await this.getFSCache();if(!e)return null;if("granted"!==await e.requestPermission({mode:"readwrite"}))throw new Error("readwrite access to directory not granted");return this.#e=new Sv(e),e}async getFSCache(){return function(e,t=Av()){return t("readonly",t=>wv(t.get(e)))}("mixly-pyodide-fs")}async setFSCache(e){await function(e,t,n=Av()){return n("readwrite",n=>(n.put(t,e),wv(n.transaction)))}("mixly-pyodide-fs",e)}async createFile(e){return this.#e.createFile(e,"")}async readFile(e){return this.#e.readFile(e)}async writeFile(e,t){const n=this.#t.encode(t);return this.#e.writeFile(e,n)}async isFile(e){const t=await this.#e.stat(e);return!(!t||33279!==t.mode)}async renameFile(e,t){return await this.#e.rename(e,t)}async moveFile(e,t){return this.renameFile(e,t)}async deleteFile(e){return this.#e.unlink(e)}async createDirectory(e){return this.#e.mkdir(e,511)}async readDirectory(e){return await this.#e.readdir(e)}async isDirectory(e){const t=await this.#e.stat(e);return!(!t||16895!==t.mode)}async isDirectoryEmpty(e){const t=await this.readDirectory(e);return!t?.length}async renameDirectory(e,t){return this.#e.rename(e,t)}async moveDirectory(e,t){return this.#e.rename(e,t)}async deleteDirectory(e){return this.#e.rmdir(e)}}class Ov extends a.FileTree{constructor(){super(new Cv)}async readFolder(e){let t=[];try{const n=this.getFS();if(!await n.isDirectory(e))return t;const i=await n.readDirectory(e);for(let r of i){const i=u.join(e,r);if(await n.isDirectory(i)){const e=await n.isDirectoryEmpty(i);t.push({type:"folder",id:i,children:!e,title:`/${this.getRootFolderName()}${i}`})}else t.push({type:"file",id:i,children:!1,title:`/${this.getRootFolderName()}${i}`})}}catch(e){a.Debug.error(e)}return t}}class Mv extends a.PageBase{static{a.HTMLTemplate.add("html/statusbar/statusbar-filesystem.html",new a.HTMLTemplate('<style>\r\n div[m-id="{{d.mId}}"] {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] > .file-tree {\r\n width: 15%;\r\n height: 100%;\r\n border-right-width: 1px;\r\n border-right-style: solid;\r\n }\r\n\r\n html[data-bs-theme=light] div[m-id="{{d.mId}}"] > .file-tree {\r\n border-right-color: #c9c9c9;\r\n }\r\n\r\n html[data-bs-theme=dark] div[m-id="{{d.mId}}"] > .file-tree {\r\n border-right-color: rgba(128, 128, 128, 0.35);\r\n }\r\n\r\n div[m-id="{{d.mId}}"] > .editor {\r\n width: 85%;\r\n height: 100%;\r\n }\r\n</style>\r\n<div m-id="{{d.mId}}" class="page-item">\r\n <div class="file-tree"></div>\r\n <div class="editor"></div>\r\n</div>')),a.HTMLTemplate.add("html/statusbar/statusbar-filesystem-open-fs.html",new a.HTMLTemplate('<style>\r\n div[m-id="{{d.mId}}"] {\r\n width: 100%;\r\n height: 100%;\r\n position: relative;\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: center;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] > button {\r\n margin: 15px;\r\n max-width: 200px;\r\n width: 100%;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n color: #fff !important;\r\n height: 25px;\r\n border-radius: 3px;\r\n }\r\n</style>\r\n<div m-id="{{d.mId}}">\r\n <button class="layui-btn layui-btn-xs m-btn self-adaption-btn">{{ d.msg.loadFS }}</button>\r\n</div>')),a.HTMLTemplate.add("html/statusbar/statusbar-filesystem-editor-empty.html",new a.HTMLTemplate('<style>\r\n div[m-id="{{d.mId}}"] {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] > div {\r\n width: 150px;\r\n height: 150px;\r\n }\r\n\r\n html[data-bs-theme=light] div[m-id="{{d.mId}}"] > div {\r\n background: url(\'../common/css/svg/empty/empty-light.svg\');\r\n background-size: 100% auto;\r\n }\r\n\r\n html[data-bs-theme=dark] div[m-id="{{d.mId}}"] > div {\r\n background: url(\'../common/css/svg/empty/empty-dark.svg\');\r\n background-size: 100% auto;\r\n }\r\n</style>\r\n<div m-id="{{d.mId}}" class="page-item">\r\n <div></div>\r\n</div>')),this.init=function(){a.StatusBarsManager.typesRegistry.register(["file-system"],Mv);const e=a.Workspace.getMain().getStatusBarsManager();return e.add({type:"file-system",id:"file-system",name:l.Msg.PYTHON_PYODIDE_FILE_SYSTEM,title:l.Msg.PYTHON_PYODIDE_FILE_SYSTEM}),e.changeTo("output"),e.get("file-system")}}#n=null;#i=null;#r=null;#s=null;#o=null;#a=null;#l=null;#u=null;#c=!1;#d=!1;#h=!1;#p=null;constructor(){super();const e=d()(a.HTMLTemplate.get("html/statusbar/statusbar-filesystem.html").render());this.setContent(e),this.#l=new Ov,this.#i=e.children(".file-tree"),this.#s=d()(a.HTMLTemplate.get("html/statusbar/statusbar-filesystem-open-fs.html").render({msg:{loadFS:l.Msg.PYTHON_PYODIDE_LOAD_FILE_SYSTEM}})),this.#i.append(this.#s),this.#a=new a.StatusBar,this.#r=e.children(".editor"),this.#o=d()(a.HTMLTemplate.get("html/statusbar/statusbar-filesystem-editor-empty.html").render()),this.#r.append(this.#o)}#f(){this.#u=new a.DragV(this.getContent()[0],{min:"150px",startSize:"15%",full:[!1,!1]}),this.#u.bind("sizeChanged",()=>{this.resize()}),this.#s.children("button").click(()=>{this.selectFS().catch(a.Debug.error)}),this.#l.bind("beforeSelectLeaf",e=>{const t=e[0].id,n=this.#a.getFileMode(u.extname(t));return n?(this.#a.setMode(n),!0):(Wp.layer.msg(a.Msg.Lang["statusbar.ampy.cannotEdit"],{time:1e3}),!1)}),this.#l.bind("afterSelectLeaf",async e=>{const t=e[0].id;this.#l.showProgress();const n=this.#l.getFS();try{const e=await n.readFile(t);this.showEditor(),this.#a.setValue(e),this.#a.scrollToTop(),this.#a.focus(),this.setStatus(!1)}catch(e){a.Debug.error(e),this.hideEditor(),this.#l.deselectAll()}this.#l.hideProgress()}),this.#l.bind("afterCreateNode",e=>{this.#l.refreshFolder(e)}),this.#l.bind("afterDeleteNode",e=>{this.#l.refreshFolder(e)}),this.#l.bind("afterRenameNode",e=>{this.#l.refreshFolder(e)}),this.#l.bind("afterRefreshNode",()=>{this.#l.getSelectedNodeId()||this.hideEditor()});const e=this.#l.getContextMenu().getItem("menu");e.add({weight:7,id:"copy_path",data:{isHtmlName:!0,name:a.Menu.getItem(a.Msg.Lang["fileTree.copyPath"]),callback:(e,{$trigger:t})=>{let n=null;n="root"===t.attr("type")?this.#l.getRootFolderTitle():t.attr("title"),navigator.clipboard.writeText(n).catch(a.Debug.error)}}}),e.add({weight:14,id:"sep5",preconditionFn:e=>{const t=this.#l.getSelectedNodeId();let n=e.attr("type"),i=e.attr("id");return"file"!==n||t===i},data:"---------"}),e.add({weight:15,id:"refresh",preconditionFn:e=>{const t=this.#l.getSelectedNodeId();let n=e.attr("type"),i=e.attr("id");return"file"!==n||t===i},data:{isHtmlName:!0,name:a.Menu.getItem(a.Msg.Lang["statusbar.ampy.refresh"]),callback:(e,{$trigger:t})=>{let n=t.attr("type");if("root"===n)this.#l.openRootFolder(),this.#l.refreshFolder("/");else if("folder"===n){let e=t.attr("id");this.#l.openNode(e),this.#l.refreshFolder(e)}else{const e=this.#l.getSelectedNodes();this.#l.runEvent("afterSelectLeaf",e)}}}}),e.add({weight:16,id:"sep6",preconditionFn:e=>{let t=e.attr("type");return["root"].includes(t)},data:"---------"}),e.add({weight:17,id:"exit",preconditionFn:e=>{let t=e.attr("type");return["root"].includes(t)},data:{isHtmlName:!0,name:a.Menu.getItem(a.Msg.Lang["statusbar.ampy.exit"]),callback:()=>{this.closeFS()}}}),e.remove("copy"),e.remove("cut"),e.remove("paste"),e.remove("sep2");const t=this.#a.getContextMenu().getItem("code");t.empty(),t.add({weight:0,id:"cut",data:{isHtmlName:!0,name:a.Menu.getItem(a.Msg.Lang["editor.contextMenu.cut"],"Ctrl+X"),callback:()=>this.#a.cut()}}),t.add({weight:1,id:"copy",data:{isHtmlName:!0,name:a.Menu.getItem(a.Msg.Lang["editor.contextMenu.copy"],"Ctrl+C"),callback:()=>this.#a.copy()}}),t.add({weight:2,id:"paste",data:{isHtmlName:!0,name:a.Menu.getItem(a.Msg.Lang["editor.contextMenu.paste"],"Ctrl+V"),callback:()=>this.#a.paste()}}),t.add({weight:3,id:"sep1",data:"---------"}),t.add({weight:4,id:"togglecomment",data:{isHtmlName:!0,name:a.Menu.getItem(a.Msg.Lang["editor.contextMenu.togglecomment"],"Ctrl+/"),callback:()=>this.#a.commentLine()}}),t.add({weight:6,id:"sep2",preconditionFn:()=>this.#h,data:"---------"}),t.add({weight:7,id:"save",preconditionFn:()=>this.#h,data:{isHtmlName:!0,name:a.Menu.getItem(a.Msg.Lang["file.save"],"Ctrl+S"),callback:async()=>{await this.put()}}});const{commands:n}=this.#a.getEditor();n.addCommand({name:"save",bindKey:"Ctrl-S",exec:async()=>{this.#h&&await this.put()}})}async put(){this.#l.showProgress();const e=this.#l.getSelectedNodeId(),t=this.#l.getFS();try{await t.writeFile(e,this.#a.getValue()),this.setStatus(!1)}catch(e){a.Debug.error(e)}finally{this.#l.hideProgress()}}showFileTree(){this.#c||(this.#s.detach(),this.#i.empty(),this.#i.append(this.#l.getContent()),this.#c=!0)}hideFileTree(){this.#c&&(this.#l.getContent().detach(),this.#i.empty(),this.#i.append(this.#s),this.#c=!1)}showEditor(){this.#d||(this.#o.detach(),this.#r.empty(),this.#r.append(this.#a.getContent()),this.#d=!0)}hideEditor(){this.#d&&(this.#a.getContent().detach(),this.#r.empty(),this.#r.append(this.#o),this.#d=!1,this.setStatus(!1))}getDrag(){return this.#u}init(){super.init(),this.hideCloseBtn(),this.#a.init(),this.#f();const e=this.#a.getEditor();e.setReadOnly(!1),e.renderer.setShowGutter(!0),e.setOptions({enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0,newLineMode:"unix"}),e.on("change",()=>{this.setStatus(!0)}),this.loadFS().catch(a.Debug.error)}async loadFS(){const e=this.#l.getFS(),t=await e.loadFS();await this.openFS(t)}async selectFS(){const e=this.#l.getFS(),t=await e.showDirectoryPicker();await this.openFS(t)}async openFS(e){if(!e?.name)return;const t="/"+e.name;this.#l.setFolderPath("/"),this.#l.setRootFolderTitle(t),this.#l.setRootFolderName(e.name),this.#l.openRootFolder(),this.showFileTree(),this.#p=await window.pyodide.mountNativeFS(t,e)}closeFS(){const e=this.#l.getRootFolderTitle();if(Object.keys(window.pyodide.FS.root.contents).includes(u.basename(e))){const t=window.pyodide.FS.lookupPath(e,{follow_mount:!1});window.pyodide.FS.isMountpoint(t.node)&&window.pyodide.FS.unmount(e)}this.#l.getFS().setFSCache(null),this.#l.deselectAll(),this.hideFileTree(),this.hideEditor(),this.setStatus(!1)}onMounted(){super.onMounted(),this.#a.onMounted(),this.#l.onMounted()}onUnmounted(){super.onUnmounted(),this.#a.onUnmounted(),this.#l.onUnmounted()}resize(){super.resize(),this.#a.resize(),this.#l.resize()}setStatus(e){this.#h!==e&&(this.#h=e)}getNativeFS(){return this.#p}dispose(){this.#a.dispose(),this.#a=null,this.#l.dispose(),this.#l=null,super.dispose()}}class Rv extends a.PageBase{static{a.HTMLTemplate.add("html/statusbar/statusbar-tool.html",new a.HTMLTemplate('<style>\r\n div[m-id="{{d.mId}}"] {\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: center;\r\n align-items: center;\r\n flex-wrap: wrap;\r\n align-content: center;\r\n overflow: auto;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] > text {\r\n font-family: \'ravie\';\r\n font-size: 60px;\r\n }\r\n\r\n html[data-bs-theme=light] div[m-id="{{d.mId}}"] {\r\n background-color: #ffffff;\r\n }\r\n\r\n html[data-bs-theme=dark] div[m-id="{{d.mId}}"] {\r\n background-color: #1e1e1e;\r\n }\r\n</style>\r\n<div m-id="{{d.mId}}" class="page-item">\r\n <text>Teachable Machine</text>\r\n</div>')),this.init=function(){a.StatusBarsManager.typesRegistry.register(["tool"],Rv);const e=a.Workspace.getMain().getStatusBarsManager();return e.add({type:"tool",id:"tool",name:l.Msg.PYTHON_PYODIDE_TOOL,title:l.Msg.PYTHON_PYODIDE_TOOL}),e.changeTo("output"),e.get("tool")}}constructor(){super();const e=d()(a.HTMLTemplate.get("html/statusbar/statusbar-tool.html").render());this.setContent(e)}init(){super.init(),this.hideCloseBtn()}onMounted(){}onUnmounted(){}resize(){}}class kv extends a.PageBase{static{a.HTMLTemplate.add("html/statusbar/statusbar-game.html",new a.HTMLTemplate('<style>\r\n div[m-id="{{d.mId}}"] {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n flex-wrap: nowrap;\r\n overflow: auto;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .game-info {\r\n margin-bottom: 20px;\r\n color: #666;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .grid {\r\n display: grid;\r\n grid-template-columns: repeat(10, 30px);\r\n grid-template-rows: repeat(10, 30px);\r\n gap: 1px;\r\n margin: 20px auto;\r\n width: fit-content;\r\n background-color: #ddd;\r\n border: 2px solid #333;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .cell {\r\n width: 30px;\r\n height: 30px;\r\n background-color: white;\r\n border: 1px solid #ccc;\r\n cursor: pointer;\r\n transition: background-color 0.2s;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .cell.alive {\r\n background-color: #4CAF50;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .cell:hover {\r\n background-color: #e0e0e0;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .cell.alive:hover {\r\n background-color: #45a049;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .controls {\r\n margin: 20px 0;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] button {\r\n padding: 10px 20px;\r\n margin: 0 5px;\r\n border: none;\r\n border-radius: 5px;\r\n cursor: pointer;\r\n font-size: 14px;\r\n transition: background-color 0.3s;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .start-btn {\r\n background-color: #4CAF50;\r\n color: white;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .pause-btn {\r\n background-color: #ff9800;\r\n color: white;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .reset-btn {\r\n background-color: #f44336;\r\n color: white;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .random-btn {\r\n background-color: #9C27B0;\r\n color: white;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] button:hover {\r\n opacity: 0.8;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] button:disabled {\r\n background-color: #cccccc;\r\n cursor: not-allowed;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] .generation-counter {\r\n font-size: 18px;\r\n font-weight: bold;\r\n margin: 10px 0;\r\n padding-top: 10px;\r\n color: #333;\r\n }\r\n</style>\r\n<div m-id="{{d.mId}}" class="page-item">\r\n <div class="generation-counter">{{d.epoch}}: <span class="generation">0</span></div>\r\n <div class="grid"></div>\r\n <div class="controls">\r\n <button class="start-btn">{{d.start}}</button>\r\n <button class="pause-btn" disabled>{{d.pause}}</button>\r\n <button class="random-btn">{{d.random}}</button>\r\n <button class="reset-btn">{{d.reset}}</button>\r\n </div>\r\n</div>')),this.init=function(){a.StatusBarsManager.typesRegistry.register(["game"],kv);const e=a.Workspace.getMain().getStatusBarsManager();return e.add({type:"game",id:"game",name:l.Msg.PYTHON_PYODIDE_GAME,title:l.Msg.PYTHON_PYODIDE_GAME}),e.changeTo("output"),e.get("game")}}#m=null;#g=null;#y=null;#_=null;#v=null;#b=null;#T=10;#x=500;#E=[];#w=!1;#I=0;#A=null;constructor(){super();const e=d()(a.HTMLTemplate.get("html/statusbar/statusbar-game.html").render({epoch:l.Msg.PYTHON_PYODIDE_GAME_EPOCH,start:l.Msg.PYTHON_PYODIDE_GAME_START,pause:l.Msg.PYTHON_PYODIDE_GAME_PAUSE,random:l.Msg.PYTHON_PYODIDE_GAME_RANDOM,reset:l.Msg.PYTHON_PYODIDE_GAME_RESET}));this.setContent(e),this.#m=e.find(".start-btn"),this.#g=e.find(".pause-btn"),this.#y=e.find(".random-btn"),this.#_=e.find(".reset-btn"),this.#v=e.find(".generation"),this.#b=e.find(".grid"),this.#S()}#S(){this.#m.click(()=>this.startGame()),this.#g.click(()=>this.pauseGame()),this.#y.click(()=>this.randomInitialize()),this.#_.click(()=>this.resetGame())}initializeGrid(){this.#b.empty(),this.#E=[];for(let e=0;e<this.#T;e++){this.#E[e]=[];for(let t=0;t<this.#T;t++){this.#E[e][t]=0;const n=document.createElement("div");n.className="cell",n.dataset.row=e,n.dataset.col=t,n.addEventListener("click",()=>this.toggleCell(e,t)),this.#b.append(n)}}this.updateGridDisplay()}toggleCell(e,t){this.#w||(this.#E[e][t]=0===this.#E[e][t]?1:0,this.updateGridDisplay())}updateGridDisplay(){const e=this.#b.children(".cell");for(let t=0;t<e.length;t++){const n=e[t],i=parseInt(n.dataset.row),r=parseInt(n.dataset.col);1===this.#E[i][r]?n.classList.add("alive"):n.classList.remove("alive")}}nextGeneration(){const e=[];for(let t=0;t<this.#T;t++){e[t]=[];for(let n=0;n<this.#T;n++){const i=this.countNeighbors(t,n);1===this.#E[t][n]?e[t][n]=2===i||3===i?1:0:e[t][n]=3===i?1:0}}this.#E=e,this.#I++,this.#v.text(this.#I),this.updateGridDisplay()}countNeighbors(e,t){let n=0;for(let i=-1;i<=1;i++)for(let r=-1;r<=1;r++){if(0===i&&0===r)continue;const s=e+i,o=t+r;s>=0&&s<this.#T&&o>=0&&o<this.#T&&(n+=this.#E[s][o])}return n}startGame(){this.#w||(this.#w=!0,this.#I=0,this.#v.text(this.#I),this.#A=setInterval(()=>this.nextGeneration(),this.#x),this.updateButtons())}pauseGame(){this.#w&&(this.#w=!1,clearInterval(this.#A),this.updateButtons())}randomInitialize(){if(!this.#w){for(let e=0;e<this.#T;e++)for(let t=0;t<this.#T;t++)this.#E[e][t]=Math.random()<.25?1:0;this.updateGridDisplay()}}resetGame(){this.#w=!1,clearInterval(this.#A),this.#I=0,this.#v.text(this.#I),this.initializeGrid(),this.updateButtons()}updateButtons(){this.#m.attr("disabled",this.#w),this.#g.attr("disabled",!this.#w),this.#y.attr("disabled",this.#w),this.#_.attr("disabled",!1)}init(){super.init(),this.hideCloseBtn(),this.initializeGrid(),this.updateButtons()}onMounted(){}onUnmounted(){}resize(){}}const Nv=Symbol(),Dv="el",Fv=(e,t,n,i,r)=>{let s=`${e}-${t}`;return n&&(s+=`-${n}`),i&&(s+=`__${i}`),r&&(s+=`--${r}`),s},Lv=Symbol("namespaceContextKey"),Pv=e=>{const t=e||(va()?Ds(Lv,tn(Dv)):tn(Dv));return za(()=>an(t)||Dv)},Bv=(e,t)=>{const n=Pv(t);return{namespace:n,b:(t="")=>Fv(n.value,e,t,"",""),e:t=>t?Fv(n.value,e,"",t,""):"",m:t=>t?Fv(n.value,e,"","",t):"",be:(t,i)=>t&&i?Fv(n.value,e,t,i,""):"",em:(t,i)=>t&&i?Fv(n.value,e,"",t,i):"",bm:(t,i)=>t&&i?Fv(n.value,e,t,"",i):"",bem:(t,i,r)=>t&&i&&r?Fv(n.value,e,t,i,r):"",is:(e,...t)=>{const n=!(t.length>=1)||t[0];return e&&n?`is-${e}`:""},cssVar:e=>{const t={};for(const i in e)e[i]&&(t[`--${n.value}-${i}`]=e[i]);return t},cssVarName:e=>`--${n.value}-${e}`,cssVarBlock:t=>{const i={};for(const r in t)t[r]&&(i[`--${n.value}-${e}-${r}`]=t[r]);return i},cssVarBlockName:t=>`--${n.value}-${e}-${t}`}},$v=e=>void 0===e,Uv=e=>"boolean"==typeof e,zv=e=>"number"==typeof e,Vv=e=>"undefined"!=typeof Element&&e instanceof Element;var jv,Yv=Object.defineProperty,Gv=Object.defineProperties,Hv=Object.getOwnPropertyDescriptors,Wv=Object.getOwnPropertySymbols,Xv=Object.prototype.hasOwnProperty,qv=Object.prototype.propertyIsEnumerable,Kv=(e,t,n)=>t in e?Yv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Zv(e,t){var n;const i=nn();var r,s;return co(()=>{i.value=e()},(r=((e,t)=>{for(var n in t||(t={}))Xv.call(t,n)&&Kv(e,n,t[n]);if(Wv)for(var n of Wv(t))qv.call(t,n)&&Kv(e,n,t[n]);return e})({},t),s={flush:null!=(n=null==t?void 0:t.flush)?n:"sync"},Gv(r,Hv(s)))),jt(i)}const Qv="undefined"!=typeof window,Jv=(Object.prototype.toString,e=>"function"==typeof e),eb=()=>{},tb=Qv&&(null==(jv=null==window?void 0:window.navigator)?void 0:jv.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function nb(e){return"function"==typeof e?e():an(e)}function ib(e,t){return function(...n){return new Promise((i,r)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(i).catch(r)})}}function rb(e,t=!0,n=!0,i=!1){let r,s,o=0,a=!0,l=eb;const u=()=>{r&&(clearTimeout(r),r=void 0,l(),l=eb)};return c=>{const d=nb(e),h=Date.now()-o,p=()=>s=c();return u(),d<=0?(o=Date.now(),p()):(h>d&&(n||!a)?(o=Date.now(),p()):t&&(s=new Promise((e,t)=>{l=i?t:e,r=setTimeout(()=>{o=Date.now(),a=!0,e(p()),u()},Math.max(0,d-h))})),n||r||(r=setTimeout(()=>a=!0,d)),a=!1,s)}}function sb(e){return!!Me()&&(Re(e),!0)}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function ob(e,t=200,n=!1,i=!0,r=!1){return ib(rb(t,n,i,r),e)}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function ab(e,t,n={}){const{immediate:i=!0}=n,r=tn(!1);let s=null;function o(){s&&(clearTimeout(s),s=null)}function a(){r.value=!1,o()}function l(...n){o(),r.value=!0,s=setTimeout(()=>{r.value=!1,s=null,e(...n)},nb(t))}return i&&(r.value=!0,Qv&&l()),sb(a),{isPending:jt(r),start:l,stop:a}}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;const lb={current:0},ub=tn(0),cb=Symbol("elZIndexContextKey"),db=Symbol("zIndexContextKey"),hb=e=>{const t=va()?Ds(cb,lb):lb,n=e||(va()?Ds(db,void 0):void 0),i=za(()=>{const e=an(n);return zv(e)?e:2e3}),r=za(()=>i.value+ub.value);return!Qv&&Ds(cb),{initialZIndex:i,currentZIndex:r,nextZIndex:()=>(t.current++,ub.value=t.current,r.value)}};const pb=Array.isArray;const fb="object"==typeof global&&global&&global.Object===Object&&global;var mb="object"==typeof self&&self&&self.Object===Object&&self;const gb=fb||mb||Function("return this")();const yb=gb.Symbol;var _b=Object.prototype,vb=_b.hasOwnProperty,bb=_b.toString,Tb=yb?yb.toStringTag:void 0;const xb=function(e){var t=vb.call(e,Tb),n=e[Tb];try{e[Tb]=void 0;var i=!0}catch(e){}var r=bb.call(e);return i&&(t?e[Tb]=n:delete e[Tb]),r};var Eb=Object.prototype.toString;const wb=function(e){return Eb.call(e)};var Ib=yb?yb.toStringTag:void 0;const Ab=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ib&&Ib in Object(e)?xb(e):wb(e)};const Sb=function(e){return null!=e&&"object"==typeof e};const Cb=function(e){return"symbol"==typeof e||Sb(e)&&"[object Symbol]"==Ab(e)};var Ob=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mb=/^\w*$/;const Rb=function(e,t){if(pb(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Cb(e))||(Mb.test(e)||!Ob.test(e)||null!=t&&e in Object(t))};const kb=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const Nb=function(e){if(!kb(e))return!1;var t=Ab(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const Db=gb["__core-js_shared__"];var Fb=function(){var e=/[^.]+$/.exec(Db&&Db.keys&&Db.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();const Lb=function(e){return!!Fb&&Fb in e};var Pb=Function.prototype.toString;const Bb=function(e){if(null!=e){try{return Pb.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var $b=/^\[object .+?Constructor\]$/,Ub=Function.prototype,zb=Object.prototype,Vb=Ub.toString,jb=zb.hasOwnProperty,Yb=RegExp("^"+Vb.call(jb).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Gb=function(e){return!(!kb(e)||Lb(e))&&(Nb(e)?Yb:$b).test(Bb(e))};const Hb=function(e,t){return null==e?void 0:e[t]};const Wb=function(e,t){var n=Hb(e,t);return Gb(n)?n:void 0};const Xb=Wb(Object,"create");const qb=function(){this.__data__=Xb?Xb(null):{},this.size=0};const Kb=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var Zb=Object.prototype.hasOwnProperty;const Qb=function(e){var t=this.__data__;if(Xb){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Zb.call(t,e)?t[e]:void 0};var Jb=Object.prototype.hasOwnProperty;const eT=function(e){var t=this.__data__;return Xb?void 0!==t[e]:Jb.call(t,e)};const tT=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Xb&&void 0===t?"__lodash_hash_undefined__":t,this};function nT(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}nT.prototype.clear=qb,nT.prototype.delete=Kb,nT.prototype.get=Qb,nT.prototype.has=eT,nT.prototype.set=tT;const iT=nT;const rT=function(){this.__data__=[],this.size=0};const sT=function(e,t){return e===t||e!=e&&t!=t};const oT=function(e,t){for(var n=e.length;n--;)if(sT(e[n][0],t))return n;return-1};var aT=Array.prototype.splice;const lT=function(e){var t=this.__data__,n=oT(t,e);return!(n<0)&&(n==t.length-1?t.pop():aT.call(t,n,1),--this.size,!0)};const uT=function(e){var t=this.__data__,n=oT(t,e);return n<0?void 0:t[n][1]};const cT=function(e){return oT(this.__data__,e)>-1};const dT=function(e,t){var n=this.__data__,i=oT(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function hT(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}hT.prototype.clear=rT,hT.prototype.delete=lT,hT.prototype.get=uT,hT.prototype.has=cT,hT.prototype.set=dT;const pT=hT;const fT=Wb(gb,"Map");const mT=function(){this.size=0,this.__data__={hash:new iT,map:new(fT||pT),string:new iT}};const gT=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};const yT=function(e,t){var n=e.__data__;return gT(t)?n["string"==typeof t?"string":"hash"]:n.map};const _T=function(e){var t=yT(this,e).delete(e);return this.size-=t?1:0,t};const vT=function(e){return yT(this,e).get(e)};const bT=function(e){return yT(this,e).has(e)};const TT=function(e,t){var n=yT(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function xT(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}xT.prototype.clear=mT,xT.prototype.delete=_T,xT.prototype.get=vT,xT.prototype.has=bT,xT.prototype.set=TT;const ET=xT;function wT(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,r=t?t.apply(this,i):i[0],s=n.cache;if(s.has(r))return s.get(r);var o=e.apply(this,i);return n.cache=s.set(r,o)||s,o};return n.cache=new(wT.Cache||ET),n}wT.Cache=ET;const IT=wT;var AT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ST=/\\(\\)?/g;const CT=function(e){var t=IT(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(AT,function(e,n,i,r){t.push(i?r.replace(ST,"$1"):n||e)}),t});const OT=function(e,t){for(var n=-1,i=null==e?0:e.length,r=Array(i);++n<i;)r[n]=t(e[n],n,e);return r};var MT=yb?yb.prototype:void 0,RT=MT?MT.toString:void 0;const kT=function e(t){if("string"==typeof t)return t;if(pb(t))return OT(t,e)+"";if(Cb(t))return RT?RT.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};const NT=function(e){return null==e?"":kT(e)};const DT=function(e,t){return pb(e)?e:Rb(e,t)?[e]:CT(NT(e))};const FT=function(e){if("string"==typeof e||Cb(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};const LT=function(e,t){for(var n=0,i=(t=DT(t,e)).length;null!=e&&n<i;)e=e[FT(t[n++])];return n&&n==i?e:void 0};const PT=function(e,t,n){var i=null==e?void 0:LT(e,t);return void 0===i?n:i};var BT={name:"en",el:{breadcrumb:{label:"Breadcrumb"},colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color.",alphaLabel:"pick alpha value"},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},mention:{loading:"Loading"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},tour:{next:"Next",previous:"Previous",finish:"Finish",close:"Close this dialog"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"},carousel:{leftArrow:"Carousel arrow left",rightArrow:"Carousel arrow right",indicator:"Carousel switch to index {index}"}}};const $T=e=>(t,n)=>UT(t,n,an(e)),UT=(e,t,n)=>PT(n,e,e).replace(/\{(\w+)\}/g,(e,n)=>{var i;return`${null!=(i=null==t?void 0:t[n])?i:`{${n}}`}`}),zT=Symbol("localeContextKey"),VT=e=>{const t=e||Ds(zT,tn());return(e=>({lang:za(()=>an(e).name),locale:en(e)?e:tn(e),t:$T(e)}))(za(()=>t.value||BT))};const jT=function(e){for(var t=-1,n=null==e?0:e.length,i={};++t<n;){var r=e[t];i[r[0]]=r[1]}return i},YT="__epPropKey",GT=(e,t)=>{if(!M(e)||M(n=e)&&n[YT])return e;var n;const{values:i,required:r,default:s,type:o,validator:a}=e,l=i||a?n=>{let r=!1,o=[];if(i&&(o=Array.from(i),x(e,"default")&&o.push(s),r||(r=o.includes(n))),a&&(r||(r=a(n))),!r&&o.length>0){const e=[...new Set(o)].map(e=>JSON.stringify(e)).join(", ");Wa(`Invalid prop: validation failed${t?` for prop "${t}"`:""}. Expected one of [${e}], got value ${JSON.stringify(n)}.`)}return r}:void 0,u={type:o,required:!!r,validator:l,[YT]:!0};return x(e,"default")&&(u.default=s),u},HT=e=>jT(Object.entries(e).map(([e,t])=>[e,GT(t,e)])),WT=["","default","small","large"],XT=GT({type:String,values:WT,required:!1}),qT=Symbol("size"),KT=Symbol("emptyValuesContextKey"),ZT=HT({emptyValues:Array,valueOnClear:{type:[String,Number,Boolean,Function],default:void 0,validator:e=>(e=S(e)?e():e,E(e)?e.every(e=>!e):!e)}}),QT=e=>Object.keys(e),JT=tn();function ex(e,t=void 0){const n=va()?Ds(Nv,JT):JT;return e?za(()=>{var i,r;return null!=(r=null==(i=n.value)?void 0:i[e])?r:t}):n}const tx=(e,t,n=!1)=>{var i;const r=!!va(),s=r?ex():void 0,o=null!=(i=null==t?void 0:t.provide)?i:r?Ns:void 0;if(!o)return;const a=za(()=>{const t=an(e);return(null==s?void 0:s.value)?nx(s.value,t):t});return o(Nv,a),o(zT,za(()=>a.value.locale)),o(Lv,za(()=>a.value.namespace)),o(db,za(()=>a.value.zIndex)),o(qT,{size:za(()=>a.value.size||"")}),o(KT,za(()=>({emptyValues:a.value.emptyValues,valueOnClear:a.value.valueOnClear}))),!n&&JT.value||(JT.value=a.value),a},nx=(e,t)=>{const n=[...new Set([...QT(e),...QT(t)])],i={};for(const r of n)i[r]=void 0!==t[r]?t[r]:e[r];return i},ix=HT({a11y:{type:Boolean,default:!0},locale:{type:Object},size:XT,button:{type:Object},card:{type:Object},dialog:{type:Object},link:{type:Object},experimentalFeatures:{type:Object},keyboardNavigation:{type:Boolean,default:!0},message:{type:Object},zIndex:Number,namespace:{type:String,default:"el"},...ZT}),rx={placement:"top"},sx=Yi({name:"ElConfigProvider",props:ix,setup(e,{slots:t}){const n=tx(e);return fo(()=>e.message,e=>{var t,i;Object.assign(rx,null!=(i=null==(t=null==n?void 0:n.value)?void 0:t.message)?i:{},null!=e?e:{})},{immediate:!0,deep:!0}),()=>Xr(t,"default",{config:null==n?void 0:n.value})}}),ox=(e,t)=>{if(e.install=n=>{for(const i of[e,...Object.values(null!=t?t:{})])n.component(i.name,i)},t)for(const[n,i]of Object.entries(t))e[n]=i;return e},ax=e=>(e.install=m,e),lx=ox(sx);
/*! Element Plus Icons Vue v2.3.2 */
var ux=Yi({name:"ArrowDown",__name:"arrow-down",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"})]))}),cx=ux,dx=Yi({name:"ArrowLeft",__name:"arrow-left",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.59 30.59 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.59 30.59 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0"})]))}),hx=dx,px=Yi({name:"ArrowRight",__name:"arrow-right",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"})]))}),fx=px,mx=Yi({name:"ArrowUp",__name:"arrow-up",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"})]))}),gx=mx,yx=Yi({name:"Camera",__name:"camera",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M896 256H128v576h768zm-199.424-64-32.064-64h-304.96l-32 64zM96 192h160l46.336-92.608A64 64 0 0 1 359.552 64h304.96a64 64 0 0 1 57.216 35.328L768.192 192H928a32 32 0 0 1 32 32v640a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V224a32 32 0 0 1 32-32m416 512a160 160 0 1 0 0-320 160 160 0 0 0 0 320m0 64a224 224 0 1 1 0-448 224 224 0 0 1 0 448"})]))}),_x=yx,vx=Yi({name:"Check",__name:"check",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"})]))}),bx=vx,Tx=Yi({name:"CircleCheck",__name:"circle-check",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),na("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752z"})]))}),xx=Tx,Ex=Yi({name:"CircleCloseFilled",__name:"circle-close-filled",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"})]))}),wx=Ex,Ix=Yi({name:"CircleClose",__name:"circle-close",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"}),na("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"})]))}),Ax=Ix,Sx=Yi({name:"CirclePlusFilled",__name:"circle-plus-filled",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-38.4 409.6H326.4a38.4 38.4 0 1 0 0 76.8h147.2v147.2a38.4 38.4 0 0 0 76.8 0V550.4h147.2a38.4 38.4 0 0 0 0-76.8H550.4V326.4a38.4 38.4 0 1 0-76.8 0z"})]))}),Cx=Sx,Ox=Yi({name:"CirclePlus",__name:"circle-plus",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M352 480h320a32 32 0 1 1 0 64H352a32 32 0 0 1 0-64"}),na("path",{fill:"currentColor",d:"M480 672V352a32 32 0 1 1 64 0v320a32 32 0 0 1-64 0"}),na("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"})]))}),Mx=Ox,Rx=Yi({name:"Close",__name:"close",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}),kx=Rx,Nx=Yi({name:"Delete",__name:"delete",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}),Dx=Nx,Fx=Yi({name:"Document",__name:"document",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"})]))}),Lx=Fx,Px=Yi({name:"EditPen",__name:"edit-pen",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"m199.04 672.64 193.984 112 224-387.968-193.92-112-224 388.032zm-23.872 60.16 32.896 148.288 144.896-45.696zM455.04 229.248l193.92 112 56.704-98.112-193.984-112zM104.32 708.8l384-665.024 304.768 175.936L409.152 884.8h.064l-248.448 78.336zm384 254.272v-64h448v64z"})]))}),Bx=Px,$x=Yi({name:"FullScreen",__name:"full-screen",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"})]))}),Ux=$x,zx=Yi({name:"Hide",__name:"hide",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4s-12.8-9.6-22.4-9.6-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176S0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4s3.2 16 9.6 22.4 12.8 9.6 22.4 9.6 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4m-646.4 528Q115.2 579.2 76.8 512q43.2-72 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4m140.8-96Q352 555.2 352 512c0-44.8 16-83.2 48-112s67.2-48 112-48c28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6q-43.2 72-153.6 172.8c-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176S1024 528 1024 512s-48.001-73.6-134.401-176"}),na("path",{fill:"currentColor",d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112s-67.2 48-112 48"})]))}),Vx=zx,jx=Yi({name:"InfoFilled",__name:"info-filled",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"})]))}),Yx=jx,Gx=Yi({name:"Loading",__name:"loading",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"})]))}),Hx=Gx,Wx=Yi({name:"More",__name:"more",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M176 416a112 112 0 1 0 0 224 112 112 0 0 0 0-224m0 64a48 48 0 1 1 0 96 48 48 0 0 1 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96"})]))}),Xx=Wx,qx=Yi({name:"RefreshLeft",__name:"refresh-left",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"})]))}),Kx=Yi({name:"RefreshRight",__name:"refresh-right",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88"})]))}),Zx=Yi({name:"ScaleToOriginal",__name:"scale-to-original",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.12 30.12 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.12 30.12 0 0 0-30.118-30.118m-361.412 0a30.12 30.12 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.12 30.12 0 0 0-30.118-30.118M512 361.412a30.12 30.12 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.12 30.12 0 0 0 512 361.412M512 512a30.12 30.12 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.12 30.12 0 0 0 512 512"})]))}),Qx=Yi({name:"SuccessFilled",__name:"success-filled",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"})]))}),Jx=Yi({name:"View",__name:"view",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}),eE=Yi({name:"WarningFilled",__name:"warning-filled",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"})]))}),tE=Yi({name:"Warning",__name:"warning",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768m48-176a48 48 0 1 1-96 0 48 48 0 0 1 96 0m-48-464a32 32 0 0 1 32 32v288a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"})]))}),nE=Yi({name:"ZoomIn",__name:"zoom-in",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"})]))}),iE=Yi({name:"ZoomOut",__name:"zoom-out",setup:e=>(e,t)=>(jo(),qo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[na("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"})]))});function rE(e){var t;const n=nb(e);return null!=(t=null==n?void 0:n.$el)?t:n}const sE=Qv?window:void 0;Qv&&window.document,Qv&&window.navigator,Qv&&window.location;function oE(...e){let t,n,i,r;if("string"==typeof e[0]||Array.isArray(e[0])?([n,i,r]=e,t=sE):[t,n,i,r]=e,!t)return eb;Array.isArray(n)||(n=[n]),Array.isArray(i)||(i=[i]);const s=[],o=()=>{s.forEach(e=>e()),s.length=0},a=fo(()=>[rE(t),nb(r)],([e,t])=>{o(),e&&s.push(...n.flatMap(n=>i.map(i=>((e,t,n,i)=>(e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)))(e,n,i,t))))},{immediate:!0,flush:"post"}),l=()=>{a(),o()};return sb(l),l}let aE=!1;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function lE(e,t=!1){const n=tn(),i=()=>n.value=Boolean(e());return i(),function(e,t=!0){va()?Or(e):t?e():Gn(e)}(i,t),n}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function uE(e){return JSON.parse(JSON.stringify(e))}const cE="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},dE="__vueuse_ssr_handlers__";cE[dE]=cE[dE]||{};cE[dE];Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var hE=Object.getOwnPropertySymbols,pE=Object.prototype.hasOwnProperty,fE=Object.prototype.propertyIsEnumerable;function mE(e,t,n={}){const i=n,{window:r=sE}=i,s=((e,t)=>{var n={};for(var i in e)pE.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&hE)for(var i of hE(e))t.indexOf(i)<0&&fE.call(e,i)&&(n[i]=e[i]);return n})(i,["window"]);let o;const a=lE(()=>r&&"ResizeObserver"in r),l=()=>{o&&(o.disconnect(),o=void 0)},u=fo(()=>rE(e),e=>{l(),a.value&&r&&e&&(o=new ResizeObserver(t),o.observe(e,s))},{immediate:!0,flush:"post"}),c=()=>{l(),u()};return sb(c),{isSupported:a,stop:c}}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function gE(e,t={width:0,height:0},n={}){const{window:i=sE,box:r="content-box"}=n,s=za(()=>{var t,n;return null==(n=null==(t=rE(e))?void 0:t.namespaceURI)?void 0:n.includes("svg")}),o=tn(t.width),a=tn(t.height);return mE(e,([t])=>{const n="border-box"===r?t.borderBoxSize:"content-box"===r?t.contentBoxSize:t.devicePixelContentBoxSize;if(i&&s.value){const t=rE(e);if(t){const e=i.getComputedStyle(t);o.value=parseFloat(e.width),a.value=parseFloat(e.height)}}else if(n){const e=Array.isArray(n)?n:[n];o.value=e.reduce((e,{inlineSize:t})=>e+t,0),a.value=e.reduce((e,{blockSize:t})=>e+t,0)}else o.value=t.contentRect.width,a.value=t.contentRect.height},n),fo(()=>rE(e),e=>{o.value=e?t.width:0,a.value=e?t.height:0}),{width:o,height:a}}new Map;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var yE,_E;(_E=yE||(yE={})).UP="UP",_E.RIGHT="RIGHT",_E.DOWN="DOWN",_E.LEFT="LEFT",_E.NONE="NONE";Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var vE=Object.defineProperty,bE=Object.getOwnPropertySymbols,TE=Object.prototype.hasOwnProperty,xE=Object.prototype.propertyIsEnumerable,EE=(e,t,n)=>t in e?vE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;((e,t)=>{for(var n in t||(t={}))TE.call(t,n)&&EE(e,n,t[n]);if(bE)for(var n of bE(t))xE.call(t,n)&&EE(e,n,t[n])})({linear:function(e){return e}},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});function wE(e,t,n,i={}){var r,s,o;const{clone:a=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:d}=i,h=va(),p=n||(null==h?void 0:h.emit)||(null==(r=null==h?void 0:h.$emit)?void 0:r.bind(h))||(null==(o=null==(s=null==h?void 0:h.proxy)?void 0:s.$emit)?void 0:o.bind(null==h?void 0:h.proxy));let f=u;t||(t="modelValue"),f=u||f||`update:${t.toString()}`;const m=e=>a?Jv(a)?a(e):uE(e):e,g=()=>void 0!==e[t]?m(e[t]):d;if(l){const n=tn(g());return fo(()=>e[t],e=>n.value=m(e)),fo(n,n=>{(n!==e[t]||c)&&p(f,n)},{deep:c}),n}return za({get:()=>g(),set(e){p(f,e)}})}const IE=HT({value:{type:[String,Number],default:""},max:{type:Number,default:99},isDot:Boolean,hidden:Boolean,type:{type:String,values:["primary","success","warning","info","danger"],default:"danger"},showZero:{type:Boolean,default:!0},color:String,badgeStyle:{type:[String,Object,Array]},offset:{type:Array,default:[0,0]},badgeClass:{type:String}});var AE=(e,t)=>{const n=e.__vccOpts||e;for(const[e,i]of t)n[e]=i;return n};function SE(e,t="px"){return e?zv(e)||C(n=e)&&!Number.isNaN(Number(n))?`${e}${t}`:C(e)?e:void 0:"";var n}const CE=Yi({name:"ElBadge"}),OE=Yi({...CE,props:IE,setup(e,{expose:t}){const n=e,i=Bv("badge"),r=za(()=>n.isDot?"":zv(n.value)&&zv(n.max)&&n.max<n.value?`${n.max}+`:`${n.value}`),s=za(()=>{var e,t,i,r,s;return[{backgroundColor:n.color,marginRight:SE(-(null!=(t=null==(e=n.offset)?void 0:e[0])?t:0)),marginTop:SE(null!=(r=null==(i=n.offset)?void 0:i[1])?r:0)},null!=(s=n.badgeStyle)?s:{}]});return t({content:r}),(e,t)=>(jo(),qo("div",{class:oe(an(i).b())},[Xr(e.$slots,"default"),ia(hl,{name:`${an(i).namespace.value}-zoom-in-center`,persisted:""},{default:mi(()=>[gi(na("sup",{class:oe([an(i).e("content"),an(i).em("content",e.type),an(i).is("fixed",!!e.$slots.default),an(i).is("dot",e.isDot),an(i).is("hide-zero",!e.showZero&&0===n.value),e.badgeClass]),style:te(an(s))},[Xr(e.$slots,"content",{value:an(r)},()=>[aa(Ee(an(r)),1)])],6),[[Cl,!e.hidden&&(an(r)||e.isDot||e.$slots.content)]])]),_:3},8,["name"])],2))}});const ME=ox(AE(OE,[["__file","badge.vue"]])),RE=HT({size:{type:[Number,String]},color:{type:String}}),kE=Yi({name:"ElIcon",inheritAttrs:!1});const NE=ox(AE(Yi({...kE,props:RE,setup(e){const t=e,n=Bv("icon"),i=za(()=>{const{size:e,color:n}=t;return e||n?{fontSize:$v(e)?void 0:SE(e),"--color":n}:{}});return(e,t)=>(jo(),qo("i",pa({class:an(n).b(),style:an(i)},e.$attrs),[Xr(e.$slots,"default")],16))}}),[["__file","icon.vue"]])),DE=[String,Object,Function],FE={Close:kx,SuccessFilled:Qx,InfoFilled:Yx,WarningFilled:eE,CircleCloseFilled:wx},LE={primary:Yx,success:Qx,warning:eE,error:wx,info:Yx},PE={validating:Hx,success:xx,error:Ax},BE=["primary","success","info","warning","error"],$E=["top","top-left","top-right","bottom","bottom-left","bottom-right"],UE="top",zE={customClass:"",dangerouslyUseHTMLString:!1,duration:3e3,icon:void 0,id:"",message:"",onClose:void 0,showClose:!1,type:"info",plain:!1,offset:16,placement:void 0,zIndex:0,grouping:!1,repeatNum:1,appendTo:Qv?document.body:void 0},VE=HT({customClass:{type:String,default:zE.customClass},dangerouslyUseHTMLString:{type:Boolean,default:zE.dangerouslyUseHTMLString},duration:{type:Number,default:zE.duration},icon:{type:DE,default:zE.icon},id:{type:String,default:zE.id},message:{type:[String,Object,Function],default:zE.message},onClose:{type:Function,default:zE.onClose},showClose:{type:Boolean,default:zE.showClose},type:{type:String,values:BE,default:zE.type},plain:{type:Boolean,default:zE.plain},offset:{type:Number,default:zE.offset},placement:{type:String,values:$E,default:zE.placement},zIndex:{type:Number,default:zE.zIndex},grouping:{type:Boolean,default:zE.grouping},repeatNum:{type:Number,default:zE.repeatNum}}),jE=Vt({}),YE=(e,t)=>{const{prev:n}=((e,t)=>{const n=jE[t]||[],i=n.findIndex(t=>t.id===e),r=n[i];let s;return i>0&&(s=n[i-1]),{current:r,prev:s}})(e,t);return n?n.vm.exposed.bottom.value:0},GE={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},HE=Yi({name:"ElMessage"}),WE=Yi({...HE,props:VE,emits:{destroy:()=>!0},setup(e,{expose:t,emit:n}){const i=e,{Close:r}=FE,s=tn(!1),{ns:o,zIndex:a}=function(e,t){const n=ex(),i=Bv(e,za(()=>{var e;return(null==(e=n.value)?void 0:e.namespace)||Dv})),r=VT(za(()=>{var e;return null==(e=n.value)?void 0:e.locale})),s=hb(za(()=>{var e;return(null==(e=n.value)?void 0:e.zIndex)||2e3})),o=za(()=>{var e;return an(t)||(null==(e=n.value)?void 0:e.size)||""});return tx(za(()=>an(n)||{})),{ns:i,locale:r,zIndex:s,size:o}}("message"),{currentZIndex:l,nextZIndex:u}=a,c=tn(),d=tn(!1),h=tn(0);let p;const f=za(()=>i.type?"error"===i.type?"danger":i.type:"info"),m=za(()=>{const e=i.type;return{[o.bm("icon",e)]:e&&LE[e]}}),g=za(()=>i.icon||LE[i.type]||""),y=za(()=>i.placement||UE),_=za(()=>YE(i.id,y.value)),v=za(()=>((e,t,n)=>(jE[n]||[]).findIndex(t=>t.id===e)>0?16:t)(i.id,i.offset,y.value)+_.value),b=za(()=>h.value+v.value),T=za(()=>y.value.includes("left")?o.is("left"):y.value.includes("right")?o.is("right"):o.is("center")),x=za(()=>y.value.startsWith("top")?"top":"bottom"),E=za(()=>({[x.value]:`${v.value}px`,zIndex:l.value}));function w(){0!==i.duration&&({stop:p}=ab(()=>{A()},i.duration))}function I(){null==p||p()}function A(){d.value=!1,Gn(()=>{var e;s.value||(null==(e=i.onClose)||e.call(i),n("destroy"))})}return Or(()=>{w(),u(),d.value=!0}),fo(()=>i.repeatNum,()=>{I(),w()}),oE(document,"keydown",function({code:e}){e===GE.esc&&A()}),mE(c,()=>{h.value=c.value.getBoundingClientRect().height}),t({visible:d,bottom:b,close:A}),(e,t)=>(jo(),Ko(hl,{name:an(o).b("fade"),onBeforeEnter:e=>s.value=!0,onBeforeLeave:e.onClose,onAfterLeave:t=>e.$emit("destroy"),persisted:""},{default:mi(()=>[gi(na("div",{id:e.id,ref_key:"messageRef",ref:c,class:oe([an(o).b(),{[an(o).m(e.type)]:e.type},an(o).is("closable",e.showClose),an(o).is("plain",e.plain),an(o).is("bottom","bottom"===an(x)),an(T),e.customClass]),style:te(an(E)),role:"alert",onMouseenter:I,onMouseleave:w},[e.repeatNum>1?(jo(),Ko(an(ME),{key:0,value:e.repeatNum,type:an(f),class:oe(an(o).e("badge"))},null,8,["value","type","class"])):ua("v-if",!0),an(g)?(jo(),Ko(an(NE),{key:1,class:oe([an(o).e("icon"),an(m)])},{default:mi(()=>[(jo(),Ko(Vr(an(g))))]),_:1},8,["class"])):ua("v-if",!0),Xr(e.$slots,"default",{},()=>[e.dangerouslyUseHTMLString?(jo(),qo(Po,{key:1},[ua(" Caution here, message could've been compromised, never use user's input as message "),na("p",{class:oe(an(o).e("content")),innerHTML:e.message},null,10,["innerHTML"])],2112)):(jo(),qo("p",{key:0,class:oe(an(o).e("content"))},Ee(e.message),3))]),e.showClose?(jo(),Ko(an(NE),{key:2,class:oe(an(o).e("closeBtn")),onClick:Mu(A,["stop"])},{default:mi(()=>[ia(an(r))]),_:1},8,["class","onClick"])):ua("v-if",!0)],46,["id"]),[[Cl,d.value]])]),_:3},8,["name","onBeforeEnter","onBeforeLeave","onAfterLeave"]))}});var XE=AE(WE,[["__file","message.vue"]]);class qE extends Error{constructor(e){super(e),this.name="ElementPlusError"}}function KE(e,t){throw new qE(`[${e}] ${t}`)}let ZE=1;const QE=e=>{const t=!e||C(e)||Zo(e)||S(e)?{message:e}:e,n={...zE,...t};return(e=>{if(e.appendTo){if(C(e.appendTo)){let t=document.querySelector(e.appendTo);Vv(t)||(t=document.body),e.appendTo=t}}else e.appendTo=document.body})(n),(e=>{!e.placement&&C(rx.placement)&&rx.placement&&(e.placement=rx.placement),e.placement||(e.placement=UE),$E.includes(e.placement)||(e.placement,e.placement=UE)})(n),Uv(rx.grouping)&&!n.grouping&&(n.grouping=rx.grouping),zv(rx.duration)&&3e3===n.duration&&(n.duration=rx.duration),zv(rx.offset)&&16===n.offset&&(n.offset=rx.offset),Uv(rx.showClose)&&!n.showClose&&(n.showClose=rx.showClose),Uv(rx.plain)&&!n.plain&&(n.plain=rx.plain),n},JE=({appendTo:e,...t},n)=>{const i="message_"+ZE++,r=t.onClose,s=document.createElement("div"),o={...t,id:i,onClose:()=>{null==r||r(),(e=>{const t=e.props.placement||UE,n=jE[t],i=n.indexOf(e);if(-1===i)return;n.splice(i,1);const{handler:r}=e;r.close()})(c)},onDestroy:()=>{Bu(null,s)}},a=ia(XE,o,S(o.message)||Zo(o.message)?{default:S(o.message)?o.message:()=>o.message}:null);a.appContext=n||ew._context,Bu(a,s),e.appendChild(s.firstElementChild);const l=a.component,u={close:()=>{l.exposed.close()}},c={id:i,vnode:a,vm:l,handler:u,props:a.component.props};return c},ew=(e={},t)=>{if(!Qv)return{close:()=>{}};const n=QE(e),i=(r=n.placement||UE,jE[r]||(jE[r]=Vt([])),jE[r]);var r;if(n.grouping&&i.length){const e=i.find(({vnode:e})=>{var t;return(null==(t=e.props)?void 0:t.message)===n.message});if(e)return e.props.repeatNum+=1,e.props.type=n.type,e.handler}if(zv(rx.max)&&i.length>=rx.max)return{close:()=>{}};const s=JE(n,t);return i.push(s),s.handler};BE.forEach(e=>{ew[e]=(t={},n)=>{const i=QE(t);return ew({...i,type:e},n)}}),ew.closeAll=function(e){for(const t in jE)if(x(jE,t)){const n=[...jE[t]];for(const t of n)e&&e!==t.props.type||t.handler.close()}},ew.closeAllByPlacement=function(e){if(!jE[e])return;[...jE[e]].forEach(e=>e.handler.close())},ew._context=null;const tw=((e,t)=>(e.install=n=>{e._context=n._context,n.config.globalProperties[t]=e},e))(ew,"$message"),nw=HT({layout:{type:String,default:"horizontal",values:["horizontal","vertical"]},lazy:Boolean}),iw=Symbol("splitterRootContextKey");function rw(e){return Number(e.slice(0,-1))/100}function sw(e){return Number(e.slice(0,-2))}function ow(e){return C(e)&&e.endsWith("%")}function aw(e){return C(e)&&e.endsWith("px")}function lw(e,t,n,i){function r(e,n){return ow(e)?rw(e)*t.value||0:aw(e)?sw(e):null!=e?e:n}const s=tn(0),o=tn(null);let a=[],l=m;const u=za(()=>e.value.map(e=>[e.min,e.max]));fo(i,()=>{if(s.value){const e=new MouseEvent("mouseup",{bubbles:!0});window.dispatchEvent(e)}});const c=[];return{lazyOffset:s,onMoveStart:e=>{s.value=0,o.value={index:e,confirmed:!1},a=n.value},onMoving:(n,c)=>{var d,h;let p=null;if(!(o.value&&o.value.confirmed||0===c))if(c>0)p=n,o.value={index:n,confirmed:!0};else for(let e=n;e>=0;e-=1)if(a[e]>0){p=e,o.value={index:e,confirmed:!0};break}const f=null!=(h=null!=p?p:null==(d=o.value)?void 0:d.index)?h:n,g=[...a],y=f+1,_=r(u.value[f][0],0),v=r(u.value[y][0],0),b=r(u.value[f][1],t.value||0),T=r(u.value[y][1],t.value||0);let x=c;g[f]+x<_&&(x=_-g[f]),g[y]-x<v&&(x=g[y]-v),g[f]+x>b&&(x=b-g[f]),g[y]-x>T&&(x=g[y]-T),g[f]+=x,g[y]-=x,s.value=x,l=()=>{e.value.forEach((e,t)=>{e.size=g[t]}),l=m},i.value||l()},onMoveEnd:()=>{i.value&&l(),s.value=0,o.value=null,a=[]},movingIndex:o,onCollapse:(t,i)=>{c.length||c.push(...n.value);const r=n.value,s="start"===i?t:t+1,o="start"===i?t+1:t,a=r[s],l=r[o];if(0!==a&&0!==l)r[s]=0,r[o]+=a,c[t]=a;else{const e=a+l,n=c[t],i=e-n;r[o]=n,r[s]=i}e.value.forEach((e,t)=>{e.size=r[t]})}}}const uw=e=>{const t=E(e)?e:[e],n=[];return t.forEach(e=>{var t;E(e)?n.push(...uw(e)):Zo(e)&&(null==(t=e.component)?void 0:t.subTree)?n.push(e,...uw(e.component.subTree)):Zo(e)&&E(e.children)?n.push(...uw(e.children)):Zo(e)&&2===e.shapeFlag?n.push(...uw(e.type())):n.push(e)}),n},cw=(e,t)=>{const n=nn({}),i=nn([]),r=new WeakMap,s=()=>{i.value=((e,t,n)=>{const i=uw(e.subTree).filter(e=>{var n;return Zo(e)&&(null==(n=e.type)?void 0:n.name)===t&&!!e.component});return i.map(e=>e.component.uid).map(e=>n[e]).filter(e=>!!e)})(e,t,n.value)},o=e=>e.render(),a=Yi({setup:(e,{slots:t})=>()=>(s(),t.default?Va(o,{render:t.default}):null)});return{children:i,addChild:e=>{n.value[e.uid]=e,on(n),Or(()=>{const t=e.getVnode().el,i=t.parentNode;if(!r.has(i)){r.set(i,[]);const e=i.insertBefore.bind(i);i.insertBefore=(t,s)=>(r.get(i).some(e=>t===e||s===e)&&on(n),e(t,s))}r.get(i).push(t)})},removeChild:e=>{delete n.value[e.uid],on(n);const t=e.getVnode().el,i=t.parentNode,s=r.get(i),o=s.indexOf(t);s.splice(o,1)},ChildrenSorter:a}},dw=Yi({name:"ElSplitter"}),hw=Yi({...dw,props:nw,emits:["resizeStart","resize","resizeEnd","collapse"],setup(e,{emit:t}){const n=e,i=Bv("splitter"),r=gn(n,"layout"),s=gn(n,"lazy"),{containerEl:o,containerSize:a}=function(e){const t=tn(),{width:n,height:i}=gE(t);return{containerEl:t,containerSize:za(()=>"horizontal"===e.value?n.value:i.value)}}(r),{removeChild:l,children:u,addChild:c,ChildrenSorter:d}=cw(va(),"ElSplitterPanel");fo(u,()=>{u.value.forEach((e,t)=>{e.setIndex(t)})});const{percentSizes:h,pxSizes:p}=function(e,t){const n=za(()=>e.value.map(e=>e.size)),i=za(()=>e.value.length),r=tn([]);fo([n,i,t],()=>{var n;let s=[],o=0;for(let r=0;r<i.value;r+=1){const i=null==(n=e.value[r])?void 0:n.size;if(ow(i))s[r]=rw(i);else if(aw(i))s[r]=sw(i)/t.value;else if(i||0===i){const e=Number(i);Number.isNaN(e)||(s[r]=e/t.value)}else o+=1,s[r]=void 0}const a=s.reduce((e,t)=>e+(t||0),0);if(a>1||!o){const e=1/a;s=s.map(t=>void 0===t?0:t*e)}else{const e=(1-a)/o;s=s.map(t=>void 0===t?e:t)}r.value=s});const s=e=>e*t.value,o=za(()=>r.value.map(s));return{percentSizes:r,pxSizes:o}}(u,a),{lazyOffset:f,movingIndex:m,onMoveStart:g,onMoving:y,onMoveEnd:_,onCollapse:v}=lw(u,a,p,s),b=za(()=>({[`--${i.b()}-bar-offset`]:s.value?`${f.value}px`:void 0}));return Ns(iw,zt({panels:u,percentSizes:h,pxSizes:p,layout:r,lazy:s,movingIndex:m,containerSize:a,onMoveStart:e=>{g(e),t("resizeStart",e,p.value)},onMoving:(e,n)=>{y(e,n),s.value||t("resize",e,p.value)},onMoveEnd:async e=>{_(),await Gn(),t("resizeEnd",e,p.value)},onCollapse:(e,n)=>{v(e,n),t("collapse",e,n,p.value)},registerPanel:c,unregisterPanel:l})),(e,t)=>(jo(),qo("div",{ref_key:"containerEl",ref:o,class:oe([an(i).b(),an(i).e(an(r))]),style:te(an(b))},[Xr(e.$slots,"default"),ia(an(d)),ua(" Prevent iframe touch events from breaking "),an(m)?(jo(),qo("div",{key:0,class:oe([an(i).e("mask"),an(i).e(`mask-${an(r)}`)])},null,2)):ua("v-if",!0)],6))}});var pw=AE(hw,[["__file","splitter.vue"]]);function fw(e,t,n,i){return!!((null==e?void 0:e.collapsible.end)&&t>0)||!!((null==n?void 0:n.collapsible.start)&&0===i&&t>0)}const mw=Yi({name:"ElSplitterBar"}),gw=Yi({...mw,props:{index:{type:Number,required:!0},layout:{type:String,values:["horizontal","vertical"],default:"horizontal"},resizable:{type:Boolean,default:!0},lazy:Boolean,startCollapsible:Boolean,endCollapsible:Boolean},emits:["moveStart","moving","moveEnd","collapse"],setup(e,{emit:t}){const n=e,i=Bv("splitter-bar"),r=za(()=>"horizontal"===n.layout),s=za(()=>r.value?{width:0}:{height:0}),o=za(()=>({width:r.value?"16px":"100%",height:r.value?"100%":"16px",cursor:n.resizable?r.value?"ew-resize":"ns-resize":"auto",touchAction:"none"})),a=za(()=>{const e=i.e("dragger");return{[`${e}-horizontal`]:r.value,[`${e}-vertical`]:!r.value,[`${e}-active`]:!!l.value}}),l=tn(null),u=e=>{n.resizable&&(l.value=[e.pageX,e.pageY],t("moveStart",n.index),window.addEventListener("mouseup",p),window.addEventListener("mousemove",d))},c=e=>{if(n.resizable&&1===e.touches.length){e.preventDefault();const i=e.touches[0];l.value=[i.pageX,i.pageY],t("moveStart",n.index),window.addEventListener("touchend",f),window.addEventListener("touchmove",h)}},d=e=>{const{pageX:i,pageY:s}=e,o=i-l.value[0],a=s-l.value[1],u=r.value?o:a;t("moving",n.index,u)},h=e=>{if(1===e.touches.length){e.preventDefault();const i=e.touches[0],s=i.pageX-l.value[0],o=i.pageY-l.value[1],a=r.value?s:o;t("moving",n.index,a)}},p=()=>{l.value=null,window.removeEventListener("mouseup",p),window.removeEventListener("mousemove",d),t("moveEnd",n.index)},f=()=>{l.value=null,window.removeEventListener("touchend",f),window.removeEventListener("touchmove",h),t("moveEnd",n.index)},m=za(()=>r.value?hx:gx),g=za(()=>r.value?fx:cx);return(n,r)=>(jo(),qo("div",{class:oe([an(i).b()]),style:te(an(s))},[e.startCollapsible?(jo(),qo("div",{key:0,class:oe([an(i).e("collapse-icon"),an(i).e(`${e.layout}-collapse-icon-start`)]),onClick:n=>t("collapse",e.index,"start")},[Xr(n.$slots,"start-collapsible",{},()=>[(jo(),Ko(Vr(an(m)),{style:{width:"12px",height:"12px"}}))])],10,["onClick"])):ua("v-if",!0),na("div",{class:oe([an(i).e("dragger"),an(a),an(i).is("disabled",!e.resizable),an(i).is("lazy",e.resizable&&e.lazy)]),style:te(an(o)),onMousedown:u,onTouchstart:c},null,38),e.endCollapsible?(jo(),qo("div",{key:1,class:oe([an(i).e("collapse-icon"),an(i).e(`${e.layout}-collapse-icon-end`)]),onClick:n=>t("collapse",e.index,"end")},[Xr(n.$slots,"end-collapsible",{},()=>[(jo(),Ko(Vr(an(g)),{style:{width:"12px",height:"12px"}}))])],10,["onClick"])):ua("v-if",!0)],6))}});var yw=AE(gw,[["__file","split-bar.vue"]]);const _w=HT({min:{type:[String,Number]},max:{type:[String,Number]},size:{type:[String,Number]},resizable:{type:Boolean,default:!0},collapsible:Boolean}),vw="ElSplitterPanel",bw=Yi({name:vw}),Tw=Yi({...bw,props:_w,emits:["update:size"],setup(e,{emit:t}){const n=e,i=Bv("splitter-panel"),r=Ds(iw);r||KE(vw,"usage: <el-splitter><el-splitter-panel /></el-splitter/>");const{panels:s,layout:o,lazy:a,containerSize:l,pxSizes:u}=pn(r),{registerPanel:c,unregisterPanel:d,onCollapse:h,onMoveEnd:p,onMoveStart:f,onMoving:m}=r,g=tn(),y=va(),_=y.uid,v=tn(0),b=za(()=>s.value[v.value]),T=za(()=>{var e;return b.value&&null!=(e=u.value[v.value])?e:0}),x=za(()=>{var e;return b.value&&null!=(e=u.value[v.value+1])?e:0}),E=za(()=>b.value?s.value[v.value+1]:null),w=za(()=>{var e;return!!E.value&&(n.resizable&&(null==(e=E.value)?void 0:e.resizable)&&(0!==T.value||!n.min)&&(0!==x.value||!E.value.min))}),I=za(()=>!!b.value&&v.value!==s.value.length-1),A=za(()=>fw(b.value,T.value,E.value,x.value)),S=za(()=>fw(E.value,x.value,b.value,T.value));function C(e){return ow(e)?rw(e)*l.value||0:aw(e)?sw(e):null!=e?e:0}let O=!1;fo(()=>n.size,()=>{if(!O&&b.value){if(!l.value)return void(b.value.size=n.size);const e=C(n.size),i=C(n.max),r=C(n.min),s=Math.min(Math.max(e,r||0),i||e);s!==e&&t("update:size",s),b.value.size=s}}),fo(()=>{var e;return null==(e=b.value)?void 0:e.size},e=>{e!==n.size&&(O=!0,t("update:size",e),Gn(()=>O=!1))}),fo(()=>n.resizable,e=>{b.value&&(b.value.resizable=e)});const R=zt({el:g.value,uid:_,getVnode:()=>y.vnode,setIndex:e=>{v.value=e},...n,collapsible:za(()=>{return(e=n.collapsible)&&M(e)?e:{start:!!e,end:!!e};var e})});return c(R),kr(()=>d(R)),(e,t)=>(jo(),qo(Po,null,[na("div",pa({ref_key:"panelEl",ref:g,class:[an(i).b()],style:{flexBasis:`${an(T)}px`}},e.$attrs),[Xr(e.$slots,"default")],16),an(I)?(jo(),Ko(yw,{key:0,index:v.value,layout:an(o),lazy:an(a),resizable:an(w),"start-collapsible":an(A),"end-collapsible":an(S),onMoveStart:an(f),onMoving:an(m),onMoveEnd:an(p),onCollapse:an(h)},{"start-collapsible":mi(()=>[Xr(e.$slots,"start-collapsible")]),"end-collapsible":mi(()=>[Xr(e.$slots,"end-collapsible")]),_:3},8,["index","layout","lazy","resizable","start-collapsible","end-collapsible","onMoveStart","onMoving","onMoveEnd","onCollapse"])):ua("v-if",!0)],64))}});var xw=AE(Tw,[["__file","split-panel.vue"]]);const Ew=ox(pw,{SplitPanel:xw}),ww=ax(xw),Iw=Symbol("buttonGroupContextKey"),Aw={prefix:Math.floor(1e4*Math.random()),current:0},Sw=Symbol("elIdInjection"),Cw=()=>va()?Ds(Sw,Aw):Aw,Ow=e=>{const t=Cw(),n=Pv();return Zv(()=>an(e)||`${n.value}-id-${t.prefix}-${t.current++}`)},Mw=Symbol("formContextKey"),Rw=Symbol("formItemContextKey"),kw=()=>({form:Ds(Mw,void 0),formItem:Ds(Rw,void 0)}),Nw=(e,{formItemContext:t,disableIdGeneration:n,disableIdManagement:i})=>{n||(n=tn(!1)),i||(i=tn(!1));const r=va(),s=tn();let o;const a=za(()=>{var n;return!!(!e.label&&!e.ariaLabel&&t&&t.inputIds&&(null==(n=t.inputIds)?void 0:n.length)<=1)});return Or(()=>{o=fo([gn(e,"id"),n],([e,n])=>{const o=null!=e?e:n?void 0:Ow().value;o!==s.value&&((null==t?void 0:t.removeInputId)&&!(()=>{let e=null==r?void 0:r.parent;for(;e;){if("ElFormItem"===e.type.name)return!1;if("ElLabelWrap"===e.type.name)return!0;e=e.parent}return!1})()&&(s.value&&t.removeInputId(s.value),(null==i?void 0:i.value)||n||!o||t.addInputId(o)),s.value=o)},{immediate:!0})}),Nr(()=>{o&&o(),(null==t?void 0:t.removeInputId)&&s.value&&t.removeInputId(s.value)}),{isLabeledByFormItem:a,inputId:s}},Dw=e=>{const t=va();return za(()=>{var n,i;return null==(i=null==(n=null==t?void 0:t.proxy)?void 0:n.$props)?void 0:i[e]})},Fw=(e,t={})=>{const n=tn(void 0),i=t.prop?n:Dw("size"),r=t.global?n:(()=>{const e=Ds(qT,{});return za(()=>an(e.size)||"")})(),s=t.form?{size:void 0}:Ds(Mw,void 0),o=t.formItem?{size:void 0}:Ds(Rw,void 0);return za(()=>i.value||an(e)||(null==o?void 0:o.size)||(null==s?void 0:s.size)||r.value||"")},Lw=e=>{const t=Dw("disabled"),n=Ds(Mw,void 0);return za(()=>t.value||an(e)||(null==n?void 0:n.disabled)||!1)},Pw=(e,t)=>{(({from:e,replacement:t,scope:n,version:i,ref:r,type:s="API"},o)=>{fo(()=>an(o),e=>{},{immediate:!0})})({from:"type.text",replacement:"link",version:"3.0.0",scope:"props",ref:"https://element-plus.org/en-US/component/button.html#button-attributes"},za(()=>"text"===e.type));const n=Ds(Iw,void 0),i=ex("button"),{form:r}=kw(),s=Fw(za(()=>null==n?void 0:n.size)),o=Lw(),a=tn(),l=us(),u=za(()=>{var t;return e.type||(null==n?void 0:n.type)||(null==(t=i.value)?void 0:t.type)||""}),c=za(()=>{var t,n,r;return null!=(r=null!=(n=e.autoInsertSpace)?n:null==(t=i.value)?void 0:t.autoInsertSpace)&&r}),d=za(()=>{var t,n,r;return null!=(r=null!=(n=e.plain)?n:null==(t=i.value)?void 0:t.plain)&&r}),h=za(()=>{var t,n,r;return null!=(r=null!=(n=e.round)?n:null==(t=i.value)?void 0:t.round)&&r}),p=za(()=>{var t,n,r;return null!=(r=null!=(n=e.text)?n:null==(t=i.value)?void 0:t.text)&&r}),f=za(()=>"button"===e.tag?{ariaDisabled:o.value||e.loading,disabled:o.value||e.loading,autofocus:e.autofocus,type:e.nativeType}:{}),m=za(()=>{var e;const t=null==(e=l.default)?void 0:e.call(l);if(c.value&&1===(null==t?void 0:t.length)){const e=t[0];if((null==e?void 0:e.type)===Bo){const t=e.children;return/^\p{Unified_Ideograph}{2}$/u.test(t.trim())}}return!1});return{_disabled:o,_size:s,_type:u,_ref:a,_props:f,_plain:d,_round:h,_text:p,shouldAddSpace:m,handleClick:n=>{o.value||e.loading?n.stopPropagation():("reset"===e.nativeType&&(null==r||r.resetFields()),t("click",n))}}},Bw=HT({size:XT,disabled:Boolean,type:{type:String,values:["default","primary","success","warning","info","danger","text",""],default:""},icon:{type:DE},nativeType:{type:String,values:["button","submit","reset"],default:"button"},loading:Boolean,loadingIcon:{type:DE,default:()=>Hx},plain:{type:Boolean,default:void 0},text:{type:Boolean,default:void 0},link:Boolean,bg:Boolean,autofocus:Boolean,round:{type:Boolean,default:void 0},circle:Boolean,color:String,dark:Boolean,autoInsertSpace:{type:Boolean,default:void 0},tag:{type:[String,Object],default:"button"}}),$w={click:e=>e instanceof MouseEvent};function Uw(e,t){(function(e){return"string"==typeof e&&-1!==e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var n=function(e){return"string"==typeof e&&-1!==e.indexOf("%")}(e);return e=360===t?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:e=360===t?(e<0?e%t+t:e%t)/parseFloat(String(t)):e%t/parseFloat(String(t))}function zw(e){return Math.min(1,Math.max(0,e))}function Vw(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function jw(e){return e<=1?"".concat(100*Number(e),"%"):e}function Yw(e){return 1===e.length?"0"+e:String(e)}function Gw(e,t,n){e=Uw(e,255),t=Uw(t,255),n=Uw(n,255);var i=Math.max(e,t,n),r=Math.min(e,t,n),s=0,o=0,a=(i+r)/2;if(i===r)o=0,s=0;else{var l=i-r;switch(o=a>.5?l/(2-i-r):l/(i+r),i){case e:s=(t-n)/l+(t<n?6:0);break;case t:s=(n-e)/l+2;break;case n:s=(e-t)/l+4}s/=6}return{h:s,s:o,l:a}}function Hw(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*n*(t-e):n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Ww(e,t,n){e=Uw(e,255),t=Uw(t,255),n=Uw(n,255);var i=Math.max(e,t,n),r=Math.min(e,t,n),s=0,o=i,a=i-r,l=0===i?0:a/i;if(i===r)s=0;else{switch(i){case e:s=(t-n)/a+(t<n?6:0);break;case t:s=(n-e)/a+2;break;case n:s=(e-t)/a+4}s/=6}return{h:s,s:l,v:o}}function Xw(e,t,n,i){var r=[Yw(Math.round(e).toString(16)),Yw(Math.round(t).toString(16)),Yw(Math.round(n).toString(16))];return i&&r[0].startsWith(r[0].charAt(1))&&r[1].startsWith(r[1].charAt(1))&&r[2].startsWith(r[2].charAt(1))?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function qw(e){return Math.round(255*parseFloat(e)).toString(16)}function Kw(e){return Zw(e)/255}function Zw(e){return parseInt(e,16)}var Qw={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Jw(e){var t,n,i,r={r:0,g:0,b:0},s=1,o=null,a=null,l=null,u=!1,c=!1;return"string"==typeof e&&(e=function(e){if(e=e.trim().toLowerCase(),0===e.length)return!1;var t=!1;if(Qw[e])e=Qw[e],t=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};var n=iI.rgb.exec(e);if(n)return{r:n[1],g:n[2],b:n[3]};if(n=iI.rgba.exec(e),n)return{r:n[1],g:n[2],b:n[3],a:n[4]};if(n=iI.hsl.exec(e),n)return{h:n[1],s:n[2],l:n[3]};if(n=iI.hsla.exec(e),n)return{h:n[1],s:n[2],l:n[3],a:n[4]};if(n=iI.hsv.exec(e),n)return{h:n[1],s:n[2],v:n[3]};if(n=iI.hsva.exec(e),n)return{h:n[1],s:n[2],v:n[3],a:n[4]};if(n=iI.hex8.exec(e),n)return{r:Zw(n[1]),g:Zw(n[2]),b:Zw(n[3]),a:Kw(n[4]),format:t?"name":"hex8"};if(n=iI.hex6.exec(e),n)return{r:Zw(n[1]),g:Zw(n[2]),b:Zw(n[3]),format:t?"name":"hex"};if(n=iI.hex4.exec(e),n)return{r:Zw(n[1]+n[1]),g:Zw(n[2]+n[2]),b:Zw(n[3]+n[3]),a:Kw(n[4]+n[4]),format:t?"name":"hex8"};if(n=iI.hex3.exec(e),n)return{r:Zw(n[1]+n[1]),g:Zw(n[2]+n[2]),b:Zw(n[3]+n[3]),format:t?"name":"hex"};return!1}(e)),"object"==typeof e&&(rI(e.r)&&rI(e.g)&&rI(e.b)?(t=e.r,n=e.g,i=e.b,r={r:255*Uw(t,255),g:255*Uw(n,255),b:255*Uw(i,255)},u=!0,c="%"===String(e.r).substr(-1)?"prgb":"rgb"):rI(e.h)&&rI(e.s)&&rI(e.v)?(o=jw(e.s),a=jw(e.v),r=function(e,t,n){e=6*Uw(e,360),t=Uw(t,100),n=Uw(n,100);var i=Math.floor(e),r=e-i,s=n*(1-t),o=n*(1-r*t),a=n*(1-(1-r)*t),l=i%6;return{r:255*[n,o,s,s,a,n][l],g:255*[a,n,n,o,s,s][l],b:255*[s,s,a,n,n,o][l]}}(e.h,o,a),u=!0,c="hsv"):rI(e.h)&&rI(e.s)&&rI(e.l)&&(o=jw(e.s),l=jw(e.l),r=function(e,t,n){var i,r,s;if(e=Uw(e,360),t=Uw(t,100),n=Uw(n,100),0===t)r=n,s=n,i=n;else{var o=n<.5?n*(1+t):n+t-n*t,a=2*n-o;i=Hw(a,o,e+1/3),r=Hw(a,o,e),s=Hw(a,o,e-1/3)}return{r:255*i,g:255*r,b:255*s}}(e.h,o,l),u=!0,c="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(s=e.a)),s=Vw(s),{ok:u,format:e.format||c,r:Math.min(255,Math.max(r.r,0)),g:Math.min(255,Math.max(r.g,0)),b:Math.min(255,Math.max(r.b,0)),a:s}}var eI="(?:".concat("[-\\+]?\\d*\\.\\d+%?",")|(?:").concat("[-\\+]?\\d+%?",")"),tI="[\\s|\\(]+(".concat(eI,")[,|\\s]+(").concat(eI,")[,|\\s]+(").concat(eI,")\\s*\\)?"),nI="[\\s|\\(]+(".concat(eI,")[,|\\s]+(").concat(eI,")[,|\\s]+(").concat(eI,")[,|\\s]+(").concat(eI,")\\s*\\)?"),iI={CSS_UNIT:new RegExp(eI),rgb:new RegExp("rgb"+tI),rgba:new RegExp("rgba"+nI),hsl:new RegExp("hsl"+tI),hsla:new RegExp("hsla"+nI),hsv:new RegExp("hsv"+tI),hsva:new RegExp("hsva"+nI),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function rI(e){return Boolean(iI.CSS_UNIT.exec(String(e)))}var sI=function(){function e(t,n){var i;if(void 0===t&&(t=""),void 0===n&&(n={}),t instanceof e)return t;"number"==typeof t&&(t=function(e){return{r:e>>16,g:(65280&e)>>8,b:255&e}}(t)),this.originalInput=t;var r=Jw(t);this.originalInput=t,this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this.roundA=Math.round(100*this.a)/100,this.format=null!==(i=n.format)&&void 0!==i?i:r.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=r.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,i=e.b/255;return.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=Vw(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){return 0===this.toHsl().s},e.prototype.toHsv=function(){var e=Ww(this.r,this.g,this.b);return{h:360*e.h,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=Ww(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),i=Math.round(100*e.v);return 1===this.a?"hsv(".concat(t,", ").concat(n,"%, ").concat(i,"%)"):"hsva(".concat(t,", ").concat(n,"%, ").concat(i,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var e=Gw(this.r,this.g,this.b);return{h:360*e.h,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=Gw(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),i=Math.round(100*e.l);return 1===this.a?"hsl(".concat(t,", ").concat(n,"%, ").concat(i,"%)"):"hsla(".concat(t,", ").concat(n,"%, ").concat(i,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(e){return void 0===e&&(e=!1),Xw(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return void 0===e&&(e=!1),"#"+this.toHex(e)},e.prototype.toHex8=function(e){return void 0===e&&(e=!1),function(e,t,n,i,r){var s=[Yw(Math.round(e).toString(16)),Yw(Math.round(t).toString(16)),Yw(Math.round(n).toString(16)),Yw(qw(i))];return r&&s[0].startsWith(s[0].charAt(1))&&s[1].startsWith(s[1].charAt(1))&&s[2].startsWith(s[2].charAt(1))&&s[3].startsWith(s[3].charAt(1))?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return void 0===e&&(e=!1),"#"+this.toHex8(e)},e.prototype.toHexShortString=function(e){return void 0===e&&(e=!1),1===this.a?this.toHexString(e):this.toHex8String(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),t=Math.round(this.g),n=Math.round(this.b);return 1===this.a?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"rgba(".concat(e,", ").concat(t,", ").concat(n,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var e=function(e){return"".concat(Math.round(100*Uw(e,255)),"%")};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(100*Uw(e,255))};return 1===this.a?"rgb(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%)"):"rgba(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+Xw(this.r,this.g,this.b,!1),t=0,n=Object.entries(Qw);t<n.length;t++){var i=n[t],r=i[0];if(e===i[1])return r}return!1},e.prototype.toString=function(e){var t=Boolean(e);e=null!=e?e:this.format;var n=!1,i=this.a<1&&this.a>=0;return t||!i||!e.startsWith("hex")&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString()):"name"===e&&0===this.a?this.toName():this.toRgbString()},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=zw(n.l),new e(n)},e.prototype.brighten=function(t){void 0===t&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(-t/100*255))),n.g=Math.max(0,Math.min(255,n.g-Math.round(-t/100*255))),n.b=Math.max(0,Math.min(255,n.b-Math.round(-t/100*255))),new e(n)},e.prototype.darken=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=zw(n.l),new e(n)},e.prototype.tint=function(e){return void 0===e&&(e=10),this.mix("white",e)},e.prototype.shade=function(e){return void 0===e&&(e=10),this.mix("black",e)},e.prototype.desaturate=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=zw(n.s),new e(n)},e.prototype.saturate=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=zw(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),i=(n.h+t)%360;return n.h=i<0?360+i:i,new e(n)},e.prototype.mix=function(t,n){void 0===n&&(n=50);var i=this.toRgb(),r=new e(t).toRgb(),s=n/100;return new e({r:(r.r-i.r)*s+i.r,g:(r.g-i.g)*s+i.g,b:(r.b-i.b)*s+i.b,a:(r.a-i.a)*s+i.a})},e.prototype.analogous=function(t,n){void 0===t&&(t=6),void 0===n&&(n=30);var i=this.toHsl(),r=360/n,s=[this];for(i.h=(i.h-(r*t>>1)+720)%360;--t;)i.h=(i.h+r)%360,s.push(new e(i));return s},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){void 0===t&&(t=6);for(var n=this.toHsv(),i=n.h,r=n.s,s=n.v,o=[],a=1/t;t--;)o.push(new e({h:i,s:r,v:s})),s=(s+a)%1;return o},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),i=new e(t).toRgb(),r=n.a+i.a*(1-n.a);return new e({r:(n.r*n.a+i.r*i.a*(1-n.a))/r,g:(n.g*n.a+i.g*i.a*(1-n.a))/r,b:(n.b*n.a+i.b*i.a*(1-n.a))/r,a:r})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),i=n.h,r=[this],s=360/t,o=1;o<t;o++)r.push(new e({h:(i+o*s)%360,s:n.s,l:n.l}));return r},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();function oI(e,t=20){return e.mix("#141414",t).toString()}const aI=Yi({name:"ElButton"}),lI=Yi({...aI,props:Bw,emits:$w,setup(e,{expose:t,emit:n}){const i=e,r=function(e){const t=Lw(),n=Bv("button");return za(()=>{let i={},r=e.color;if(r){const s=r.match(/var\((.*?)\)/);s&&(r=window.getComputedStyle(window.document.documentElement).getPropertyValue(s[1]));const o=new sI(r),a=e.dark?o.tint(20).toString():oI(o,20);if(e.plain)i=n.cssVarBlock({"bg-color":e.dark?oI(o,90):o.tint(90).toString(),"text-color":r,"border-color":e.dark?oI(o,50):o.tint(50).toString(),"hover-text-color":`var(${n.cssVarName("color-white")})`,"hover-bg-color":r,"hover-border-color":r,"active-bg-color":a,"active-text-color":`var(${n.cssVarName("color-white")})`,"active-border-color":a}),t.value&&(i[n.cssVarBlockName("disabled-bg-color")]=e.dark?oI(o,90):o.tint(90).toString(),i[n.cssVarBlockName("disabled-text-color")]=e.dark?oI(o,50):o.tint(50).toString(),i[n.cssVarBlockName("disabled-border-color")]=e.dark?oI(o,80):o.tint(80).toString());else{const s=e.dark?oI(o,30):o.tint(30).toString(),l=o.isDark()?`var(${n.cssVarName("color-white")})`:`var(${n.cssVarName("color-black")})`;if(i=n.cssVarBlock({"bg-color":r,"text-color":l,"border-color":r,"hover-bg-color":s,"hover-text-color":l,"hover-border-color":s,"active-bg-color":a,"active-border-color":a}),t.value){const t=e.dark?oI(o,50):o.tint(50).toString();i[n.cssVarBlockName("disabled-bg-color")]=t,i[n.cssVarBlockName("disabled-text-color")]=e.dark?"rgba(255, 255, 255, 0.5)":`var(${n.cssVarName("color-white")})`,i[n.cssVarBlockName("disabled-border-color")]=t}}}return i})}(i),s=Bv("button"),{_ref:o,_size:a,_type:l,_disabled:u,_props:c,_plain:d,_round:h,_text:p,shouldAddSpace:f,handleClick:m}=Pw(i,n),g=za(()=>[s.b(),s.m(l.value),s.m(a.value),s.is("disabled",u.value),s.is("loading",i.loading),s.is("plain",d.value),s.is("round",h.value),s.is("circle",i.circle),s.is("text",p.value),s.is("link",i.link),s.is("has-bg",i.bg)]);return t({ref:o,size:a,type:l,disabled:u,shouldAddSpace:f}),(e,t)=>(jo(),Ko(Vr(e.tag),pa({ref_key:"_ref",ref:o},an(c),{class:an(g),style:an(r),onClick:an(m)}),{default:mi(()=>[e.loading?(jo(),qo(Po,{key:0},[e.$slots.loading?Xr(e.$slots,"loading",{key:0}):(jo(),Ko(an(NE),{key:1,class:oe(an(s).is("loading"))},{default:mi(()=>[(jo(),Ko(Vr(e.loadingIcon)))]),_:1},8,["class"]))],64)):e.icon||e.$slots.icon?(jo(),Ko(an(NE),{key:1},{default:mi(()=>[e.icon?(jo(),Ko(Vr(e.icon),{key:0})):Xr(e.$slots,"icon",{key:1})]),_:3})):ua("v-if",!0),e.$slots.default?(jo(),qo("span",{key:2,class:oe({[an(s).em("text","expand")]:an(f)})},[Xr(e.$slots,"default")],2)):ua("v-if",!0)]),_:3},16,["class","style","onClick"]))}});var uI=AE(lI,[["__file","button.vue"]]);const cI={size:Bw.size,type:Bw.type},dI=Yi({name:"ElButtonGroup"});var hI=AE(Yi({...dI,props:cI,setup(e){const t=e;Ns(Iw,zt({size:gn(t,"size"),type:gn(t,"type")}));const n=Bv("button");return(e,t)=>(jo(),qo("div",{class:oe(an(n).b("group"))},[Xr(e.$slots,"default")],2))}}),[["__file","button-group.vue"]]);const pI=ox(uI,{ButtonGroup:hI}),fI=(ax(hI),HT({header:{type:String,default:""},footer:{type:String,default:""},bodyStyle:{type:[String,Object,Array],default:""},headerClass:String,bodyClass:String,footerClass:String,shadow:{type:String,values:["always","hover","never"],default:void 0}})),mI=(Symbol("cardContextKey"),Yi({name:"ElCard"})),gI=Yi({...mI,props:fI,setup(e){const t=ex("card"),n=Bv("card");return(e,i)=>{var r;return jo(),qo("div",{class:oe([an(n).b(),an(n).is(`${e.shadow||(null==(r=an(t))?void 0:r.shadow)||"always"}-shadow`)])},[e.$slots.header||e.header?(jo(),qo("div",{key:0,class:oe([an(n).e("header"),e.headerClass])},[Xr(e.$slots,"header",{},()=>[aa(Ee(e.header),1)])],2)):ua("v-if",!0),na("div",{class:oe([an(n).e("body"),e.bodyClass]),style:te(e.bodyStyle)},[Xr(e.$slots,"default")],6),e.$slots.footer||e.footer?(jo(),qo("div",{key:1,class:oe([an(n).e("footer"),e.footerClass])},[Xr(e.$slots,"footer",{},()=>[aa(Ee(e.footer),1)])],2)):ua("v-if",!0)],2)}}});const yI=ox(AE(gI,[["__file","card.vue"]]));var _I=n(4213),vI=n(71710),bI=n.n(vI);const TI=function(e){return null==e};let xI;const EI={height:"0",visibility:"hidden",overflow:Qv&&/firefox/i.test(window.navigator.userAgent)?"":"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},wI=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"];function II(e,t=1,n){var i,r;xI||(xI=document.createElement("textarea"),(null!=(i=e.parentNode)?i:document.body).appendChild(xI));const{paddingSize:s,borderSize:o,boxSizing:a,contextStyle:l}=function(e){const t=window.getComputedStyle(e),n=t.getPropertyValue("box-sizing"),i=Number.parseFloat(t.getPropertyValue("padding-bottom"))+Number.parseFloat(t.getPropertyValue("padding-top")),r=Number.parseFloat(t.getPropertyValue("border-bottom-width"))+Number.parseFloat(t.getPropertyValue("border-top-width"));return{contextStyle:wI.map(e=>[e,t.getPropertyValue(e)]),paddingSize:i,borderSize:r,boxSizing:n}}(e);l.forEach(([e,t])=>null==xI?void 0:xI.style.setProperty(e,t)),Object.entries(EI).forEach(([e,t])=>null==xI?void 0:xI.style.setProperty(e,t,"important")),xI.value=e.value||e.placeholder||"";let u=xI.scrollHeight;const c={};"border-box"===a?u+=o:"content-box"===a&&(u-=s),xI.value="";const d=xI.scrollHeight-s;if(zv(t)){let e=d*t;"border-box"===a&&(e=e+s+o),u=Math.max(e,u),c.minHeight=`${e}px`}if(zv(n)){let e=d*n;"border-box"===a&&(e=e+s+o),u=Math.min(e,u)}return c.height=`${u}px`,null==(r=xI.parentNode)||r.removeChild(xI),xI=void 0,c}const AI=function(){try{var e=Wb(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();const SI=function(e,t,n){"__proto__"==t&&AI?AI(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n};var CI=Object.prototype.hasOwnProperty;const OI=function(e,t,n){var i=e[t];CI.call(e,t)&&sT(i,n)&&(void 0!==n||t in e)||SI(e,t,n)};var MI=/^(?:0|[1-9]\d*)$/;const RI=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&MI.test(e))&&e>-1&&e%1==0&&e<t};const kI=function(e,t,n,i){if(!kb(e))return e;for(var r=-1,s=(t=DT(t,e)).length,o=s-1,a=e;null!=a&&++r<s;){var l=FT(t[r]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(r!=o){var c=a[l];void 0===(u=i?i(c,l,a):void 0)&&(u=kb(c)?c:RI(t[r+1])?[]:{})}OI(a,l,u),a=a[l]}return e};const NI=function(e,t,n){for(var i=-1,r=t.length,s={};++i<r;){var o=t[i],a=LT(e,o);n(a,o)&&kI(s,DT(o,e),a)}return s};const DI=function(e,t){return null!=e&&t in Object(e)};const FI=function(e){return Sb(e)&&"[object Arguments]"==Ab(e)};var LI=Object.prototype,PI=LI.hasOwnProperty,BI=LI.propertyIsEnumerable;const $I=FI(function(){return arguments}())?FI:function(e){return Sb(e)&&PI.call(e,"callee")&&!BI.call(e,"callee")};const UI=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};const zI=function(e,t,n){for(var i=-1,r=(t=DT(t,e)).length,s=!1;++i<r;){var o=FT(t[i]);if(!(s=null!=e&&n(e,o)))break;e=e[o]}return s||++i!=r?s:!!(r=null==e?0:e.length)&&UI(r)&&RI(o,r)&&(pb(e)||$I(e))};const VI=function(e,t){return null!=e&&zI(e,t,DI)};const jI=function(e,t){return NI(e,t,function(t,n){return VI(e,n)})};const YI=function(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e};var GI=yb?yb.isConcatSpreadable:void 0;const HI=function(e){return pb(e)||$I(e)||!!(GI&&e&&e[GI])};const WI=function e(t,n,i,r,s){var o=-1,a=t.length;for(i||(i=HI),s||(s=[]);++o<a;){var l=t[o];n>0&&i(l)?n>1?e(l,n-1,i,r,s):YI(s,l):r||(s[s.length]=l)}return s};const XI=function(e){return(null==e?0:e.length)?WI(e,1):[]};const qI=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)};var KI=Math.max;const ZI=function(e,t,n){return t=KI(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,s=KI(i.length-t,0),o=Array(s);++r<s;)o[r]=i[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=i[r];return a[t]=n(o),qI(e,this,a)}};const QI=function(e){return function(){return e}};const JI=AI?function(e,t){return AI(e,"toString",{configurable:!0,enumerable:!1,value:QI(t),writable:!0})}:function(e){return e};var eA=Date.now;const tA=function(e){var t=0,n=0;return function(){var i=eA(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(JI);var nA=function(e){return tA(ZI(e,void 0,XI),e+"")}(function(e,t){return null==e?{}:jI(e,t)});const iA=nA,rA=HT({ariaLabel:String,ariaOrientation:{type:String,values:["horizontal","vertical","undefined"]},ariaControls:String}),sA=e=>iA(rA,e),oA="update:modelValue",aA="change",lA="input",uA=HT({id:{type:String,default:void 0},size:XT,disabled:Boolean,modelValue:{type:[String,Number,Object],default:""},maxlength:{type:[String,Number]},minlength:{type:[String,Number]},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:[Boolean,Object],default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:String},form:{type:String},readonly:Boolean,clearable:Boolean,clearIcon:{type:DE,default:Ax},showPassword:Boolean,showWordLimit:Boolean,suffixIcon:{type:DE},prefixIcon:{type:DE},containerRole:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:[Object,Array,String],default:()=>({})},autofocus:Boolean,rows:{type:Number,default:2},...sA(["ariaLabel"]),inputmode:{type:String,default:void 0},name:String}),cA={[oA]:e=>C(e),input:e=>C(e),change:e=>C(e),focus:e=>e instanceof FocusEvent,blur:e=>e instanceof FocusEvent,clear:()=>!0,mouseleave:e=>e instanceof MouseEvent,mouseenter:e=>e instanceof MouseEvent,keydown:e=>e instanceof Event,compositionstart:e=>e instanceof CompositionEvent,compositionupdate:e=>e instanceof CompositionEvent,compositionend:e=>e instanceof CompositionEvent},dA=["class","style"],hA=/^on[A-Z]/,pA=(e={})=>{const{excludeListeners:t=!1,excludeKeys:n}=e,i=za(()=>((null==n?void 0:n.value)||[]).concat(dA)),r=va();return za(r?()=>{var e;return jT(Object.entries(null==(e=r.proxy)?void 0:e.$attrs).filter(([e])=>!(i.value.includes(e)||t&&hA.test(e))))}:()=>({}))},fA=e=>"undefined"!=typeof Element&&e instanceof Element,mA=e=>{if(e.tabIndex>0||0===e.tabIndex&&null!==e.getAttribute("tabIndex"))return!0;if(e.tabIndex<0||e.hasAttribute("disabled")||"true"===e.getAttribute("aria-disabled"))return!1;switch(e.nodeName){case"A":return!!e.href&&"ignore"!==e.rel;case"INPUT":return!("hidden"===e.type||"file"===e.type);case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}},gA=(e,t)=>{if(!e||!e.focus)return;let n=!1;!fA(e)||mA(e)||e.getAttribute("tabindex")||(e.setAttribute("tabindex","-1"),n=!0),e.focus(t),fA(e)&&n&&e.removeAttribute("tabindex")};const yA=Yi({name:"ElInput",inheritAttrs:!1}),_A=Yi({...yA,props:uA,emits:cA,setup(e,{expose:t,emit:n}){const i=e,r=cs(),s=pA(),o=us(),a=za(()=>["textarea"===i.type?g.b():f.b(),f.m(h.value),f.is("disabled",p.value),f.is("exceed",z.value),{[f.b("group")]:o.prepend||o.append,[f.m("prefix")]:o.prefix||i.prefixIcon,[f.m("suffix")]:o.suffix||i.suffixIcon||i.clearable||i.showPassword,[f.bm("suffix","password-clear")]:P.value&&B.value,[f.b("hidden")]:"hidden"===i.type},r.class]),l=za(()=>[f.e("wrapper"),f.is("focus",I.value)]),{form:u,formItem:c}=kw(),{inputId:d}=Nw(i,{formItemContext:c}),h=Fw(),p=Lw(),f=Bv("input"),g=Bv("textarea"),y=nn(),_=nn(),v=tn(!1),b=tn(!1),T=tn(),x=nn(i.inputStyle),E=za(()=>y.value||_.value),{wrapperRef:w,isFocused:I,handleFocus:A,handleBlur:C}=function(e,{disabled:t,beforeFocus:n,afterFocus:i,beforeBlur:r,afterBlur:s}={}){const o=va(),{emit:a}=o,l=nn(),u=tn(!1),c=e=>{const r=!!S(n)&&n(e);an(t)||u.value||r||(u.value=!0,a("focus",e),null==i||i())},d=e=>{var n;const i=!!S(r)&&r(e);an(t)||e.relatedTarget&&(null==(n=l.value)?void 0:n.contains(e.relatedTarget))||i||(u.value=!1,a("blur",e),null==s||s())};return fo([l,()=>an(t)],([e,t])=>{e&&(t?e.removeAttribute("tabindex"):e.setAttribute("tabindex","-1"))}),oE(l,"focus",c,!0),oE(l,"blur",d,!0),oE(l,"click",n=>{var i,r;an(t)||mA(n.target)||(null==(i=l.value)?void 0:i.contains(document.activeElement))&&l.value!==document.activeElement||null==(r=e.value)||r.focus()},!0),{isFocused:u,wrapperRef:l,handleFocus:c,handleBlur:d}}(E,{disabled:p,afterBlur(){var e;i.validateEvent&&(null==(e=null==c?void 0:c.validate)||e.call(c,"blur").catch(e=>{}))}}),O=za(()=>{var e;return null!=(e=null==u?void 0:u.statusIcon)&&e}),R=za(()=>(null==c?void 0:c.validateState)||""),k=za(()=>R.value&&PE[R.value]),N=za(()=>b.value?Jx:Vx),D=za(()=>[r.style]),F=za(()=>[i.inputStyle,x.value,{resize:i.resize}]),L=za(()=>TI(i.modelValue)?"":String(i.modelValue)),P=za(()=>i.clearable&&!p.value&&!i.readonly&&!!L.value&&(I.value||v.value)),B=za(()=>i.showPassword&&!p.value&&!!L.value),$=za(()=>i.showWordLimit&&!!i.maxlength&&("text"===i.type||"textarea"===i.type)&&!p.value&&!i.readonly&&!i.showPassword),U=za(()=>L.value.length),z=za(()=>!!$.value&&U.value>Number(i.maxlength)),V=za(()=>!!o.suffix||!!i.suffixIcon||P.value||i.showPassword||$.value||!!R.value&&O.value),[j,Y]=function(e){let t;return[function(){if(null==e.value)return;const{selectionStart:n,selectionEnd:i,value:r}=e.value;if(null==n||null==i)return;const s=r.slice(0,Math.max(0,n)),o=r.slice(Math.max(0,i));t={selectionStart:n,selectionEnd:i,value:r,beforeTxt:s,afterTxt:o}},function(){if(null==e.value||null==t)return;const{value:n}=e.value,{beforeTxt:i,afterTxt:r,selectionStart:s}=t;if(null==i||null==r||null==s)return;let o=n.length;if(n.endsWith(r))o=n.length-r.length;else if(n.startsWith(i))o=i.length;else{const e=i[s-1],t=n.indexOf(e,s-1);-1!==t&&(o=t+1)}e.value.setSelectionRange(o,o)}]}(y);mE(_,e=>{if(H(),!$.value||"both"!==i.resize)return;const t=e[0],{width:n}=t.contentRect;T.value={right:`calc(100% - ${n+15+6}px)`}});const G=()=>{const{type:e,autosize:t}=i;if(Qv&&"textarea"===e&&_.value)if(t){const e=M(t)?t.minRows:void 0,n=M(t)?t.maxRows:void 0,i=II(_.value,e,n);x.value={overflowY:"hidden",...i},Gn(()=>{_.value.offsetHeight,x.value=i})}else x.value={minHeight:II(_.value).minHeight}},H=(e=>{let t=!1;return()=>{var n;if(t||!i.autosize)return;null===(null==(n=_.value)?void 0:n.offsetParent)||(setTimeout(e),t=!0)}})(G),W=()=>{const e=E.value,t=i.formatter?i.formatter(L.value):L.value;e&&e.value!==t&&(e.value=t)},X=async e=>{j();let{value:t}=e.target;i.formatter&&i.parser&&(t=i.parser(t)),K.value||(t!==L.value?(n(oA,t),n(lA,t),await Gn(),W(),Y()):W())},q=e=>{let{value:t}=e.target;i.formatter&&i.parser&&(t=i.parser(t)),n(aA,t)},{isComposing:K,handleCompositionStart:Z,handleCompositionUpdate:Q,handleCompositionEnd:J}=function({afterComposition:e,emit:t}){const n=tn(!1),i=e=>{var i;null==t||t("compositionupdate",e);const r=null==(i=e.target)?void 0:i.value,s=r[r.length-1]||"";n.value=!(e=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(e))(s)},r=i=>{null==t||t("compositionend",i),n.value&&(n.value=!1,Gn(()=>e(i)))};return{isComposing:n,handleComposition:e=>{"compositionend"===e.type?r(e):i(e)},handleCompositionStart:e=>{null==t||t("compositionstart",e),n.value=!0},handleCompositionUpdate:i,handleCompositionEnd:r}}({emit:n,afterComposition:X}),ee=()=>{j(),b.value=!b.value,setTimeout(Y)},ne=e=>{v.value=!1,n("mouseleave",e)},ie=e=>{v.value=!0,n("mouseenter",e)},re=e=>{n("keydown",e)},se=()=>{n(oA,""),n(aA,""),n("clear"),n(lA,"")};return fo(()=>i.modelValue,()=>{var e;Gn(()=>G()),i.validateEvent&&(null==(e=null==c?void 0:c.validate)||e.call(c,"change").catch(e=>{}))}),fo(L,()=>W()),fo(()=>i.type,async()=>{await Gn(),W(),G()}),Or(()=>{!i.formatter&&i.parser,W(),Gn(G)}),t({input:y,textarea:_,ref:E,textareaStyle:F,autosize:gn(i,"autosize"),isComposing:K,focus:()=>{var e;return null==(e=E.value)?void 0:e.focus()},blur:()=>{var e;return null==(e=E.value)?void 0:e.blur()},select:()=>{var e;null==(e=E.value)||e.select()},clear:se,resizeTextarea:G}),(e,t)=>(jo(),qo("div",{class:oe([an(a),{[an(f).bm("group","append")]:e.$slots.append,[an(f).bm("group","prepend")]:e.$slots.prepend}]),style:te(an(D)),onMouseenter:ie,onMouseleave:ne},[ua(" input "),"textarea"!==e.type?(jo(),qo(Po,{key:0},[ua(" prepend slot "),e.$slots.prepend?(jo(),qo("div",{key:0,class:oe(an(f).be("group","prepend"))},[Xr(e.$slots,"prepend")],2)):ua("v-if",!0),na("div",{ref_key:"wrapperRef",ref:w,class:oe(an(l))},[ua(" prefix slot "),e.$slots.prefix||e.prefixIcon?(jo(),qo("span",{key:0,class:oe(an(f).e("prefix"))},[na("span",{class:oe(an(f).e("prefix-inner"))},[Xr(e.$slots,"prefix"),e.prefixIcon?(jo(),Ko(an(NE),{key:0,class:oe(an(f).e("icon"))},{default:mi(()=>[(jo(),Ko(Vr(e.prefixIcon)))]),_:1},8,["class"])):ua("v-if",!0)],2)],2)):ua("v-if",!0),na("input",pa({id:an(d),ref_key:"input",ref:y,class:an(f).e("inner")},an(s),{name:e.name,minlength:e.minlength,maxlength:e.maxlength,type:e.showPassword?b.value?"text":"password":e.type,disabled:an(p),readonly:e.readonly,autocomplete:e.autocomplete,tabindex:e.tabindex,"aria-label":e.ariaLabel,placeholder:e.placeholder,style:e.inputStyle,form:e.form,autofocus:e.autofocus,role:e.containerRole,inputmode:e.inputmode,onCompositionstart:an(Z),onCompositionupdate:an(Q),onCompositionend:an(J),onInput:X,onChange:q,onKeydown:re}),null,16,["id","name","minlength","maxlength","type","disabled","readonly","autocomplete","tabindex","aria-label","placeholder","form","autofocus","role","inputmode","onCompositionstart","onCompositionupdate","onCompositionend"]),ua(" suffix slot "),an(V)?(jo(),qo("span",{key:1,class:oe(an(f).e("suffix"))},[na("span",{class:oe(an(f).e("suffix-inner"))},[an(P)&&an(B)&&an($)?ua("v-if",!0):(jo(),qo(Po,{key:0},[Xr(e.$slots,"suffix"),e.suffixIcon?(jo(),Ko(an(NE),{key:0,class:oe(an(f).e("icon"))},{default:mi(()=>[(jo(),Ko(Vr(e.suffixIcon)))]),_:1},8,["class"])):ua("v-if",!0)],64)),an(P)?(jo(),Ko(an(NE),{key:1,class:oe([an(f).e("icon"),an(f).e("clear")]),onMousedown:Mu(an(m),["prevent"]),onClick:se},{default:mi(()=>[(jo(),Ko(Vr(e.clearIcon)))]),_:1},8,["class","onMousedown"])):ua("v-if",!0),an(B)?(jo(),Ko(an(NE),{key:2,class:oe([an(f).e("icon"),an(f).e("password")]),onClick:ee},{default:mi(()=>[(jo(),Ko(Vr(an(N))))]),_:1},8,["class"])):ua("v-if",!0),an($)?(jo(),qo("span",{key:3,class:oe(an(f).e("count"))},[na("span",{class:oe(an(f).e("count-inner"))},Ee(an(U))+" / "+Ee(e.maxlength),3)],2)):ua("v-if",!0),an(R)&&an(k)&&an(O)?(jo(),Ko(an(NE),{key:4,class:oe([an(f).e("icon"),an(f).e("validateIcon"),an(f).is("loading","validating"===an(R))])},{default:mi(()=>[(jo(),Ko(Vr(an(k))))]),_:1},8,["class"])):ua("v-if",!0)],2)],2)):ua("v-if",!0)],2),ua(" append slot "),e.$slots.append?(jo(),qo("div",{key:1,class:oe(an(f).be("group","append"))},[Xr(e.$slots,"append")],2)):ua("v-if",!0)],64)):(jo(),qo(Po,{key:1},[ua(" textarea "),na("textarea",pa({id:an(d),ref_key:"textarea",ref:_,class:[an(g).e("inner"),an(f).is("focus",an(I))]},an(s),{minlength:e.minlength,maxlength:e.maxlength,tabindex:e.tabindex,disabled:an(p),readonly:e.readonly,autocomplete:e.autocomplete,style:an(F),"aria-label":e.ariaLabel,placeholder:e.placeholder,form:e.form,autofocus:e.autofocus,rows:e.rows,role:e.containerRole,onCompositionstart:an(Z),onCompositionupdate:an(Q),onCompositionend:an(J),onInput:X,onFocus:an(A),onBlur:an(C),onChange:q,onKeydown:re}),null,16,["id","minlength","maxlength","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form","autofocus","rows","role","onCompositionstart","onCompositionupdate","onCompositionend","onFocus","onBlur"]),an($)?(jo(),qo("span",{key:0,style:te(T.value),class:oe(an(f).e("count"))},Ee(an(U))+" / "+Ee(e.maxlength),7)):ua("v-if",!0)],64))],38))}});const vA=ox(AE(_A,[["__file","input.vue"]])),bA=Symbol("popper"),TA=Symbol("popperContent"),xA=["dialog","grid","group","listbox","menu","navigation","tooltip","tree"],EA=HT({role:{type:String,values:xA,default:"tooltip"}}),wA=Yi({name:"ElPopper",inheritAttrs:!1});const IA=ox(AE(Yi({...wA,props:EA,setup(e,{expose:t}){const n=e,i={triggerRef:tn(),popperInstanceRef:tn(),contentRef:tn(),referenceRef:tn(),role:za(()=>n.role)};return t(i),Ns(bA,i),(e,t)=>Xr(e.$slots,"default")}}),[["__file","popper.vue"]])),AA=Symbol("elTooltip");var SA="top",CA="bottom",OA="right",MA="left",RA="auto",kA=[SA,CA,OA,MA],NA="start",DA="end",FA="viewport",LA="popper",PA=kA.reduce(function(e,t){return e.concat([t+"-"+NA,t+"-"+DA])},[]),BA=[].concat(kA,[RA]).reduce(function(e,t){return e.concat([t,t+"-"+NA,t+"-"+DA])},[]),$A=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function UA(e){return e?(e.nodeName||"").toLowerCase():null}function zA(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function VA(e){return e instanceof zA(e).Element||e instanceof Element}function jA(e){return e instanceof zA(e).HTMLElement||e instanceof HTMLElement}function YA(e){return"undefined"!=typeof ShadowRoot&&(e instanceof zA(e).ShadowRoot||e instanceof ShadowRoot)}var GA={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},i=t.attributes[e]||{},r=t.elements[e];!jA(r)||!UA(r)||(Object.assign(r.style,n),Object.keys(i).forEach(function(e){var t=i[e];!1===t?r.removeAttribute(e):r.setAttribute(e,!0===t?"":t)}))})},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var i=t.elements[e],r=t.attributes[e]||{},s=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]="",e},{});!jA(i)||!UA(i)||(Object.assign(i.style,s),Object.keys(r).forEach(function(e){i.removeAttribute(e)}))})}},requires:["computeStyles"]};function HA(e){return e.split("-")[0]}var WA=Math.max,XA=Math.min,qA=Math.round;function KA(e,t){void 0===t&&(t=!1);var n=e.getBoundingClientRect(),i=1,r=1;if(jA(e)&&t){var s=e.offsetHeight,o=e.offsetWidth;o>0&&(i=qA(n.width)/o||1),s>0&&(r=qA(n.height)/s||1)}return{width:n.width/i,height:n.height/r,top:n.top/r,right:n.right/i,bottom:n.bottom/r,left:n.left/i,x:n.left/i,y:n.top/r}}function ZA(e){var t=KA(e),n=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:i}}function QA(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&YA(n)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function JA(e){return zA(e).getComputedStyle(e)}function eS(e){return["table","td","th"].indexOf(UA(e))>=0}function tS(e){return((VA(e)?e.ownerDocument:e.document)||window.document).documentElement}function nS(e){return"html"===UA(e)?e:e.assignedSlot||e.parentNode||(YA(e)?e.host:null)||tS(e)}function iS(e){return jA(e)&&"fixed"!==JA(e).position?e.offsetParent:null}function rS(e){for(var t=zA(e),n=iS(e);n&&eS(n)&&"static"===JA(n).position;)n=iS(n);return n&&("html"===UA(n)||"body"===UA(n)&&"static"===JA(n).position)?t:n||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&jA(e)&&"fixed"===JA(e).position)return null;var n=nS(e);for(YA(n)&&(n=n.host);jA(n)&&["html","body"].indexOf(UA(n))<0;){var i=JA(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||t}function sS(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function oS(e,t,n){return WA(e,XA(t,n))}function aS(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function lS(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var uS={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,i=e.name,r=e.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=HA(n.placement),l=sS(a),u=[MA,OA].indexOf(a)>=0?"height":"width";if(s&&o){var c=function(e,t){return aS("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:lS(e,kA))}(r.padding,n),d=ZA(s),h="y"===l?SA:MA,p="y"===l?CA:OA,f=n.rects.reference[u]+n.rects.reference[l]-o[l]-n.rects.popper[u],m=o[l]-n.rects.reference[l],g=rS(s),y=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,_=f/2-m/2,v=c[h],b=y-d[u]-c[p],T=y/2-d[u]/2+_,x=oS(v,T,b),E=l;n.modifiersData[i]=((t={})[E]=x,t.centerOffset=x-T,t)}},effect:function(e){var t=e.state,n=e.options.element,i=void 0===n?"[data-popper-arrow]":n;null!=i&&("string"==typeof i&&!(i=t.elements.popper.querySelector(i))||!QA(t.elements.popper,i)||(t.elements.arrow=i))},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function cS(e){return e.split("-")[1]}var dS={top:"auto",right:"auto",bottom:"auto",left:"auto"};function hS(e){var t,n=e.popper,i=e.popperRect,r=e.placement,s=e.variation,o=e.offsets,a=e.position,l=e.gpuAcceleration,u=e.adaptive,c=e.roundOffsets,d=e.isFixed,h=o.x,p=void 0===h?0:h,f=o.y,m=void 0===f?0:f,g="function"==typeof c?c({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var y=o.hasOwnProperty("x"),_=o.hasOwnProperty("y"),v=MA,b=SA,T=window;if(u){var x=rS(n),E="clientHeight",w="clientWidth";if(x===zA(n)&&("static"!==JA(x=tS(n)).position&&"absolute"===a&&(E="scrollHeight",w="scrollWidth")),r===SA||(r===MA||r===OA)&&s===DA)b=CA,m-=(d&&x===T&&T.visualViewport?T.visualViewport.height:x[E])-i.height,m*=l?1:-1;if(r===MA||(r===SA||r===CA)&&s===DA)v=OA,p-=(d&&x===T&&T.visualViewport?T.visualViewport.width:x[w])-i.width,p*=l?1:-1}var I,A=Object.assign({position:a},u&&dS),S=!0===c?function(e){var t=e.x,n=e.y,i=window.devicePixelRatio||1;return{x:qA(t*i)/i||0,y:qA(n*i)/i||0}}({x:p,y:m}):{x:p,y:m};return p=S.x,m=S.y,l?Object.assign({},A,((I={})[b]=_?"0":"",I[v]=y?"0":"",I.transform=(T.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",I)):Object.assign({},A,((t={})[b]=_?m+"px":"",t[v]=y?p+"px":"",t.transform="",t))}var pS={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,i=n.gpuAcceleration,r=void 0===i||i,s=n.adaptive,o=void 0===s||s,a=n.roundOffsets,l=void 0===a||a,u={placement:HA(t.placement),variation:cS(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,hS(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,hS(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},fS={passive:!0};var mS={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,i=e.options,r=i.scroll,s=void 0===r||r,o=i.resize,a=void 0===o||o,l=zA(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&u.forEach(function(e){e.addEventListener("scroll",n.update,fS)}),a&&l.addEventListener("resize",n.update,fS),function(){s&&u.forEach(function(e){e.removeEventListener("scroll",n.update,fS)}),a&&l.removeEventListener("resize",n.update,fS)}},data:{}},gS={left:"right",right:"left",bottom:"top",top:"bottom"};function yS(e){return e.replace(/left|right|bottom|top/g,function(e){return gS[e]})}var _S={start:"end",end:"start"};function vS(e){return e.replace(/start|end/g,function(e){return _S[e]})}function bS(e){var t=zA(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function TS(e){return KA(tS(e)).left+bS(e).scrollLeft}function xS(e){var t=JA(e),n=t.overflow,i=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+i)}function ES(e){return["html","body","#document"].indexOf(UA(e))>=0?e.ownerDocument.body:jA(e)&&xS(e)?e:ES(nS(e))}function wS(e,t){var n;void 0===t&&(t=[]);var i=ES(e),r=i===(null==(n=e.ownerDocument)?void 0:n.body),s=zA(i),o=r?[s].concat(s.visualViewport||[],xS(i)?i:[]):i,a=t.concat(o);return r?a:a.concat(wS(nS(o)))}function IS(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function AS(e,t){return t===FA?IS(function(e){var t=zA(e),n=tS(e),i=t.visualViewport,r=n.clientWidth,s=n.clientHeight,o=0,a=0;return i&&(r=i.width,s=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(o=i.offsetLeft,a=i.offsetTop)),{width:r,height:s,x:o+TS(e),y:a}}(e)):VA(t)?function(e){var t=KA(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):IS(function(e){var t,n=tS(e),i=bS(e),r=null==(t=e.ownerDocument)?void 0:t.body,s=WA(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=WA(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+TS(e),l=-i.scrollTop;return"rtl"===JA(r||n).direction&&(a+=WA(n.clientWidth,r?r.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}(tS(e)))}function SS(e,t,n){var i="clippingParents"===t?function(e){var t=wS(nS(e)),n=["absolute","fixed"].indexOf(JA(e).position)>=0&&jA(e)?rS(e):e;return VA(n)?t.filter(function(e){return VA(e)&&QA(e,n)&&"body"!==UA(e)}):[]}(e):[].concat(t),r=[].concat(i,[n]),s=r[0],o=r.reduce(function(t,n){var i=AS(e,n);return t.top=WA(i.top,t.top),t.right=XA(i.right,t.right),t.bottom=XA(i.bottom,t.bottom),t.left=WA(i.left,t.left),t},AS(e,s));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function CS(e){var t,n=e.reference,i=e.element,r=e.placement,s=r?HA(r):null,o=r?cS(r):null,a=n.x+n.width/2-i.width/2,l=n.y+n.height/2-i.height/2;switch(s){case SA:t={x:a,y:n.y-i.height};break;case CA:t={x:a,y:n.y+n.height};break;case OA:t={x:n.x+n.width,y:l};break;case MA:t={x:n.x-i.width,y:l};break;default:t={x:n.x,y:n.y}}var u=s?sS(s):null;if(null!=u){var c="y"===u?"height":"width";switch(o){case NA:t[u]=t[u]-(n[c]/2-i[c]/2);break;case DA:t[u]=t[u]+(n[c]/2-i[c]/2)}}return t}function OS(e,t){void 0===t&&(t={});var n=t,i=n.placement,r=void 0===i?e.placement:i,s=n.boundary,o=void 0===s?"clippingParents":s,a=n.rootBoundary,l=void 0===a?FA:a,u=n.elementContext,c=void 0===u?LA:u,d=n.altBoundary,h=void 0!==d&&d,p=n.padding,f=void 0===p?0:p,m=aS("number"!=typeof f?f:lS(f,kA)),g=c===LA?"reference":LA,y=e.rects.popper,_=e.elements[h?g:c],v=SS(VA(_)?_:_.contextElement||tS(e.elements.popper),o,l),b=KA(e.elements.reference),T=CS({reference:b,element:y,strategy:"absolute",placement:r}),x=IS(Object.assign({},y,T)),E=c===LA?x:b,w={top:v.top-E.top+m.top,bottom:E.bottom-v.bottom+m.bottom,left:v.left-E.left+m.left,right:E.right-v.right+m.right},I=e.modifiersData.offset;if(c===LA&&I){var A=I[r];Object.keys(w).forEach(function(e){var t=[OA,CA].indexOf(e)>=0?1:-1,n=[SA,CA].indexOf(e)>=0?"y":"x";w[e]+=A[n]*t})}return w}var MS={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var r=n.mainAxis,s=void 0===r||r,o=n.altAxis,a=void 0===o||o,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,f=void 0===p||p,m=n.allowedAutoPlacements,g=t.options.placement,y=HA(g),_=l||(y===g||!f?[yS(g)]:function(e){if(HA(e)===RA)return[];var t=yS(e);return[vS(e),t,vS(t)]}(g)),v=[g].concat(_).reduce(function(e,n){return e.concat(HA(n)===RA?function(e,t){void 0===t&&(t={});var n=t,i=n.placement,r=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=void 0===l?BA:l,c=cS(i),d=c?a?PA:PA.filter(function(e){return cS(e)===c}):kA,h=d.filter(function(e){return u.indexOf(e)>=0});0===h.length&&(h=d);var p=h.reduce(function(t,n){return t[n]=OS(e,{placement:n,boundary:r,rootBoundary:s,padding:o})[HA(n)],t},{});return Object.keys(p).sort(function(e,t){return p[e]-p[t]})}(t,{placement:n,boundary:c,rootBoundary:d,padding:u,flipVariations:f,allowedAutoPlacements:m}):n)},[]),b=t.rects.reference,T=t.rects.popper,x=new Map,E=!0,w=v[0],I=0;I<v.length;I++){var A=v[I],S=HA(A),C=cS(A)===NA,O=[SA,CA].indexOf(S)>=0,M=O?"width":"height",R=OS(t,{placement:A,boundary:c,rootBoundary:d,altBoundary:h,padding:u}),k=O?C?OA:MA:C?CA:SA;b[M]>T[M]&&(k=yS(k));var N=yS(k),D=[];if(s&&D.push(R[S]<=0),a&&D.push(R[k]<=0,R[N]<=0),D.every(function(e){return e})){w=A,E=!1;break}x.set(A,D)}if(E)for(var F=function(e){var t=v.find(function(t){var n=x.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return w=t,"break"},L=f?3:1;L>0;L--){if("break"===F(L))break}t.placement!==w&&(t.modifiersData[i]._skip=!0,t.placement=w,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function RS(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function kS(e){return[SA,OA,CA,MA].some(function(t){return e[t]>=0})}var NS={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,i=t.rects.reference,r=t.rects.popper,s=t.modifiersData.preventOverflow,o=OS(t,{elementContext:"reference"}),a=OS(t,{altBoundary:!0}),l=RS(o,i),u=RS(a,r,s),c=kS(l),d=kS(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}};var DS={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,i=e.name,r=n.offset,s=void 0===r?[0,0]:r,o=BA.reduce(function(e,n){return e[n]=function(e,t,n){var i=HA(e),r=[MA,SA].indexOf(i)>=0?-1:1,s="function"==typeof n?n(Object.assign({},t,{placement:e})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*r,[MA,OA].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}(n,t.rects,s),e},{}),a=o[t.placement],l=a.x,u=a.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[i]=o}};var FS={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=CS({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}};var LS={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,i=e.name,r=n.mainAxis,s=void 0===r||r,o=n.altAxis,a=void 0!==o&&o,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,h=n.tether,p=void 0===h||h,f=n.tetherOffset,m=void 0===f?0:f,g=OS(t,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),y=HA(t.placement),_=cS(t.placement),v=!_,b=sS(y),T=function(e){return"x"===e?"y":"x"}(b),x=t.modifiersData.popperOffsets,E=t.rects.reference,w=t.rects.popper,I="function"==typeof m?m(Object.assign({},t.rects,{placement:t.placement})):m,A="number"==typeof I?{mainAxis:I,altAxis:I}:Object.assign({mainAxis:0,altAxis:0},I),S=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,C={x:0,y:0};if(x){if(s){var O,M="y"===b?SA:MA,R="y"===b?CA:OA,k="y"===b?"height":"width",N=x[b],D=N+g[M],F=N-g[R],L=p?-w[k]/2:0,P=_===NA?E[k]:w[k],B=_===NA?-w[k]:-E[k],$=t.elements.arrow,U=p&&$?ZA($):{width:0,height:0},z=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},V=z[M],j=z[R],Y=oS(0,E[k],U[k]),G=v?E[k]/2-L-Y-V-A.mainAxis:P-Y-V-A.mainAxis,H=v?-E[k]/2+L+Y+j+A.mainAxis:B+Y+j+A.mainAxis,W=t.elements.arrow&&rS(t.elements.arrow),X=W?"y"===b?W.clientTop||0:W.clientLeft||0:0,q=null!=(O=null==S?void 0:S[b])?O:0,K=N+H-q,Z=oS(p?XA(D,N+G-q-X):D,N,p?WA(F,K):F);x[b]=Z,C[b]=Z-N}if(a){var Q,J="x"===b?SA:MA,ee="x"===b?CA:OA,te=x[T],ne="y"===T?"height":"width",ie=te+g[J],re=te-g[ee],se=-1!==[SA,MA].indexOf(y),oe=null!=(Q=null==S?void 0:S[T])?Q:0,ae=se?ie:te-E[ne]-w[ne]-oe+A.altAxis,le=se?te+E[ne]+w[ne]-oe-A.altAxis:re,ue=p&&se?function(e,t,n){var i=oS(e,t,n);return i>n?n:i}(ae,te,le):oS(p?ae:ie,te,p?le:re);x[T]=ue,C[T]=ue-te}t.modifiersData[i]=C}},requiresIfExists:["offset"]};function PS(e,t,n){void 0===n&&(n=!1);var i=jA(t),r=jA(t)&&function(e){var t=e.getBoundingClientRect(),n=qA(t.width)/e.offsetWidth||1,i=qA(t.height)/e.offsetHeight||1;return 1!==n||1!==i}(t),s=tS(t),o=KA(e,r),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!n)&&(("body"!==UA(t)||xS(s))&&(a=function(e){return e!==zA(e)&&jA(e)?function(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}(e):bS(e)}(t)),jA(t)?((l=KA(t,!0)).x+=t.clientLeft,l.y+=t.clientTop):s&&(l.x=TS(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function BS(e){var t=new Map,n=new Set,i=[];function r(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var i=t.get(e);i&&r(i)}}),i.push(e)}return e.forEach(function(e){t.set(e.name,e)}),e.forEach(function(e){n.has(e.name)||r(e)}),i}function $S(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}var US={placement:"bottom",modifiers:[],strategy:"absolute"};function zS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&"function"==typeof e.getBoundingClientRect)})}function VS(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,i=void 0===n?[]:n,r=t.defaultOptions,s=void 0===r?US:r;return function(e,t,n){void 0===n&&(n=s);var r={placement:"bottom",orderedModifiers:[],options:Object.assign({},US,s),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},o=[],a=!1,l={state:r,setOptions:function(n){var a="function"==typeof n?n(r.options):n;u(),r.options=Object.assign({},s,r.options,a),r.scrollParents={reference:VA(e)?wS(e):e.contextElement?wS(e.contextElement):[],popper:wS(t)};var c=function(e){var t=BS(e);return $A.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}(function(e){var t=e.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}([].concat(i,r.options.modifiers)));return r.orderedModifiers=c.filter(function(e){return e.enabled}),r.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,i=void 0===n?{}:n,s=e.effect;if("function"==typeof s){var a=s({state:r,name:t,instance:l,options:i}),u=function(){};o.push(a||u)}}),l.update()},forceUpdate:function(){if(!a){var e=r.elements,t=e.reference,n=e.popper;if(zS(t,n)){r.rects={reference:PS(t,rS(n),"fixed"===r.options.strategy),popper:ZA(n)},r.reset=!1,r.placement=r.options.placement,r.orderedModifiers.forEach(function(e){return r.modifiersData[e.name]=Object.assign({},e.data)});for(var i=0;i<r.orderedModifiers.length;i++)if(!0!==r.reset){var s=r.orderedModifiers[i],o=s.fn,u=s.options,c=void 0===u?{}:u,d=s.name;"function"==typeof o&&(r=o({state:r,options:c,name:d,instance:l})||r)}else r.reset=!1,i=-1}}},update:$S(function(){return new Promise(function(e){l.forceUpdate(),e(r)})}),destroy:function(){u(),a=!0}};if(!zS(e,t))return l;function u(){o.forEach(function(e){return e()}),o=[]}return l.setOptions(n).then(function(e){!a&&n.onFirstUpdate&&n.onFirstUpdate(e)}),l}}VS(),VS({defaultModifiers:[mS,FS,pS,GA]});var jS=VS({defaultModifiers:[mS,FS,pS,GA,DS,MS,LS,uS,NS]});const YS=HT({arrowOffset:{type:Number,default:5}}),GS=HT({boundariesPadding:{type:Number,default:0},fallbackPlacements:{type:Array,default:void 0},gpuAcceleration:{type:Boolean,default:!0},offset:{type:Number,default:12},placement:{type:String,values:BA,default:"bottom"},popperOptions:{type:Object,default:()=>({})},strategy:{type:String,values:["fixed","absolute"],default:"absolute"}}),HS=HT({...GS,...YS,id:String,style:{type:[String,Array,Object]},className:{type:[String,Array,Object]},effect:{type:String,default:"dark"},visible:Boolean,enterable:{type:Boolean,default:!0},pure:Boolean,focusOnShow:Boolean,trapping:Boolean,popperClass:{type:[String,Array,Object]},popperStyle:{type:[String,Array,Object]},referenceEl:{type:Object},triggerTargetEl:{type:Object},stopPopperMouseEvent:{type:Boolean,default:!0},virtualTriggering:Boolean,zIndex:Number,...sA(["ariaLabel"])}),WS={mouseenter:e=>e instanceof MouseEvent,mouseleave:e=>e instanceof MouseEvent,focus:()=>!0,blur:()=>!0,close:()=>!0},XS=HT({to:{type:[String,Object],required:!0},disabled:Boolean});function qS(){let e;const t=()=>window.clearTimeout(e);return sb(()=>t()),{registerTimeout:(n,i)=>{t(),e=window.setTimeout(n,i)},cancelTimeout:t}}const KS=HT({showAfter:{type:Number,default:0},hideAfter:{type:Number,default:200},autoClose:{type:Number,default:0}}),ZS=HT({...KS,...HS,appendTo:{type:XS.to.type},content:{type:String,default:""},rawContent:Boolean,persistent:Boolean,visible:{type:Boolean,default:null},transition:String,teleported:{type:Boolean,default:!0},disabled:Boolean,...sA(["ariaLabel"])}),QS=HT({virtualRef:{type:Object},virtualTriggering:Boolean,onMouseenter:{type:Function},onMouseleave:{type:Function},onClick:{type:Function},onKeydown:{type:Function},onFocus:{type:Function},onBlur:{type:Function},onContextmenu:{type:Function},id:String,open:Boolean}),JS=HT({...QS,disabled:Boolean,trigger:{type:[String,Array],default:"hover"},triggerKeys:{type:Array,default:()=>[GE.enter,GE.numpadEnter,GE.space]},focusOnTarget:Boolean}),eC=GT({type:Boolean,default:null}),tC=GT({type:Function}),nC=e=>{const t=`update:${e}`,n=`onUpdate:${e}`,i=[t];return{useModelToggle:({indicator:i,toggleReason:r,shouldHideWhenRouteChanges:s,shouldProceed:o,onShow:a,onHide:l})=>{const u=va(),{emit:c}=u,d=u.props,h=za(()=>S(d[n])),p=za(()=>null===d[e]),f=e=>{!0!==i.value&&(i.value=!0,r&&(r.value=e),S(a)&&a(e))},m=e=>{!1!==i.value&&(i.value=!1,r&&(r.value=e),S(l)&&l(e))},g=e=>{if(!0===d.disabled||S(o)&&!o())return;const n=h.value&&Qv;n&&c(t,!0),!p.value&&n||f(e)},y=e=>{if(!0===d.disabled||!Qv)return;const n=h.value&&Qv;n&&c(t,!1),!p.value&&n||m(e)},_=e=>{Uv(e)&&(d.disabled&&e?h.value&&c(t,!1):i.value!==e&&(e?f():m()))};return fo(()=>d[e],_),s&&void 0!==u.appContext.config.globalProperties.$route&&fo(()=>({...u.proxy.$route}),()=>{s.value&&i.value&&y()}),Or(()=>{_(d[e])}),{hide:y,show:g,toggle:()=>{i.value?y():g()},hasUpdateHandler:h}},useModelToggleProps:{[e]:eC,[n]:tC},useModelToggleEmits:i}},{useModelToggle:iC,useModelToggleProps:rC,useModelToggleEmits:sC}=nC("modelValue"),{useModelToggleProps:oC,useModelToggleEmits:aC,useModelToggle:lC}=nC("visible"),uC=HT({...EA,...oC,...ZS,...JS,...YS,showArrow:{type:Boolean,default:!0}}),cC=[...aC,"before-show","before-hide","show","hide","open","close"],dC=(e,t,n)=>i=>{((e,t)=>E(e)?e.includes(t):e===t)(an(e),t)&&n(i)},hC=Symbol("elForwardRef"),pC=Yi({name:"ElOnlyChild",setup(e,{slots:t,attrs:n}){var i;const r=Ds(hC),s=(o=null!=(i=null==r?void 0:r.setForwardRef)?i:m,{mounted(e){o(e)},updated(e){o(e)},unmounted(){o(null)}});var o;return()=>{var e;const i=null==(e=t.default)?void 0:e.call(t,n);if(!i)return null;const[r,o]=fC(i);return r?gi(oa(r,n),[[s]]):null}}});function fC(e){if(!e)return[null,0];const t=e,n=t.filter(e=>e.type!==$o).length;for(const e of t){if(M(e))switch(e.type){case $o:continue;case Bo:case"svg":return[mC(e),n];case Po:return fC(e.children);default:return[e,n]}return[mC(e),n]}return[null,0]}function mC(e){const t=Bv("only-child");return ia("span",{class:t.e("content")},[e])}const gC=Yi({name:"ElPopperTrigger",inheritAttrs:!1}),yC=Yi({...gC,props:QS,setup(e,{expose:t}){const n=e,{role:i,triggerRef:r}=Ds(bA,void 0);var s;s=r,Ns(hC,{setForwardRef:e=>{s.value=e}});const o=za(()=>l.value?n.id:void 0),a=za(()=>{if(i&&"tooltip"===i.value)return n.open&&n.id?n.id:void 0}),l=za(()=>{if(i&&"tooltip"!==i.value)return i.value}),u=za(()=>l.value?`${n.open}`:void 0);let c;const d=["onMouseenter","onMouseleave","onClick","onKeydown","onFocus","onBlur","onContextmenu"];return Or(()=>{fo(()=>n.virtualRef,e=>{e&&(r.value=rE(e))},{immediate:!0}),fo(r,(e,t)=>{null==c||c(),c=void 0,Vv(e)&&(d.forEach(i=>{var r;const s=n[i];s&&(e.addEventListener(i.slice(2).toLowerCase(),s,["onFocus","onBlur"].includes(i)),null==(r=null==t?void 0:t.removeEventListener)||r.call(t,i.slice(2).toLowerCase(),s,["onFocus","onBlur"].includes(i)))}),mA(e)&&(c=fo([o,a,l,u],t=>{["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach((n,i)=>{TI(t[i])?e.removeAttribute(n):e.setAttribute(n,t[i])})},{immediate:!0}))),Vv(t)&&mA(t)&&["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach(e=>t.removeAttribute(e))},{immediate:!0})}),kr(()=>{if(null==c||c(),c=void 0,r.value&&Vv(r.value)){const e=r.value;d.forEach(t=>{const i=n[t];i&&e.removeEventListener(t.slice(2).toLowerCase(),i,["onFocus","onBlur"].includes(t))}),r.value=void 0}}),t({triggerRef:r}),(e,t)=>e.virtualTriggering?ua("v-if",!0):(jo(),Ko(an(pC),pa({key:0},e.$attrs,{"aria-controls":an(o),"aria-describedby":an(a),"aria-expanded":an(u),"aria-haspopup":an(l)}),{default:mi(()=>[Xr(e.$slots,"default")]),_:3},16,["aria-controls","aria-describedby","aria-expanded","aria-haspopup"]))}});var _C=AE(yC,[["__file","trigger.vue"]]);const vC=(e,t,{checkForDefaultPrevented:n=!0}={})=>i=>{const r=null==e?void 0:e(i);if(!1===n||!r)return null==t?void 0:t(i)},bC=e=>t=>"mouse"===t.pointerType?e(t):void 0,TC=Yi({name:"ElTooltipTrigger"}),xC=Yi({...TC,props:JS,setup(e,{expose:t}){const n=e,i=Bv("tooltip"),{controlled:r,id:s,open:o,onOpen:a,onClose:l,onToggle:u}=Ds(AA,void 0),c=tn(null),d=()=>{if(an(r)||n.disabled)return!0},h=gn(n,"trigger"),p=vC(d,dC(h,"hover",e=>{a(e),n.focusOnTarget&&e.target&&Gn(()=>{gA(e.target,{preventScroll:!0})})})),f=vC(d,dC(h,"hover",l)),m=vC(d,dC(h,"click",e=>{0===e.button&&u(e)})),g=vC(d,dC(h,"focus",a)),y=vC(d,dC(h,"focus",l)),_=vC(d,dC(h,"contextmenu",e=>{e.preventDefault(),u(e)})),v=vC(d,e=>{const{code:t}=e;n.triggerKeys.includes(t)&&(e.preventDefault(),u(e))});return t({triggerRef:c}),(e,t)=>(jo(),Ko(an(_C),{id:an(s),"virtual-ref":e.virtualRef,open:an(o),"virtual-triggering":e.virtualTriggering,class:oe(an(i).e("trigger")),onBlur:an(y),onClick:an(m),onContextmenu:an(_),onFocus:an(g),onMouseenter:an(p),onMouseleave:an(f),onKeydown:an(v)},{default:mi(()=>[Xr(e.$slots,"default")]),_:3},8,["id","virtual-ref","open","virtual-triggering","class","onBlur","onClick","onContextmenu","onFocus","onMouseenter","onMouseleave","onKeydown"]))}});var EC=AE(xC,[["__file","trigger.vue"]]);const wC=ox(AE(Yi({__name:"teleport",props:XS,setup:e=>(e,t)=>e.disabled?Xr(e.$slots,"default",{key:0}):(jo(),Ko(Si,{key:1,to:e.to},[Xr(e.$slots,"default")],8,["to"]))}),[["__file","teleport.vue"]])),IC=()=>{const e=Pv(),t=Cw(),n=za(()=>`${e.value}-popper-container-${t.prefix}`),i=za(()=>`#${n.value}`);return{id:n,selector:i}},AC=()=>{const{id:e,selector:t}=IC();return Cr(()=>{Qv&&(document.body.querySelector(t.value)||(e=>{const t=document.createElement("div");t.id=e,document.body.appendChild(t)})(e.value))}),{id:e,selector:t}},SC="focus-trap.focus-after-trapped",CC="focus-trap.focus-after-released",OC={cancelable:!0,bubbles:!1},MC={cancelable:!0,bubbles:!1},RC="focusAfterTrapped",kC="focusAfterReleased",NC=Symbol("elFocusTrap"),DC=tn(),FC=tn(0),LC=tn(0);let PC=0;const BC=e=>{const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0||e===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t},$C=(e,t)=>{for(const n of e)if(!UC(n,t))return n},UC=(e,t)=>{if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1},zC=(e,t)=>{if(e){const n=document.activeElement;gA(e,{preventScroll:!0}),LC.value=window.performance.now(),e!==n&&(e=>e instanceof HTMLInputElement&&"select"in e)(e)&&t&&e.select()}};function VC(e,t){const n=[...e],i=e.indexOf(t);return-1!==i&&n.splice(i,1),n}const jC=(()=>{let e=[];return{push:t=>{const n=e[0];n&&t!==n&&n.pause(),e=VC(e,t),e.unshift(t)},remove:t=>{var n,i;e=VC(e,t),null==(i=null==(n=e[0])?void 0:n.resume)||i.call(n)}}})(),YC=()=>{DC.value="pointer",FC.value=window.performance.now()},GC=()=>{DC.value="keyboard",FC.value=window.performance.now()},HC=()=>(Or(()=>{0===PC&&(document.addEventListener("mousedown",YC),document.addEventListener("touchstart",YC),document.addEventListener("keydown",GC)),PC++}),kr(()=>{PC--,PC<=0&&(document.removeEventListener("mousedown",YC),document.removeEventListener("touchstart",YC),document.removeEventListener("keydown",GC))}),{focusReason:DC,lastUserFocusTimestamp:FC,lastAutomatedFocusTimestamp:LC}),WC=e=>new CustomEvent("focus-trap.focusout-prevented",{...MC,detail:e});let XC=[];const qC=e=>{e.code===GE.esc&&XC.forEach(t=>t(e))},KC=Yi({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[RC,kC,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:t}){const n=tn();let i,r;const{focusReason:s}=HC();var o;o=n=>{e.trapped&&!a.paused&&t("release-requested",n)},Or(()=>{0===XC.length&&document.addEventListener("keydown",qC),Qv&&XC.push(o)}),kr(()=>{XC=XC.filter(e=>e!==o),0===XC.length&&Qv&&document.removeEventListener("keydown",qC)});const a={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},l=n=>{if(!e.loop&&!e.trapped)return;if(a.paused)return;const{code:i,altKey:r,ctrlKey:o,metaKey:l,currentTarget:u,shiftKey:c}=n,{loop:d}=e,h=i===GE.tab&&!r&&!o&&!l,p=document.activeElement;if(h&&p){const e=u,[i,r]=(e=>{const t=BC(e);return[$C(t,e),$C(t.reverse(),e)]})(e);if(i&&r)if(c||p!==r){if(c&&[i,e].includes(p)){const e=WC({focusReason:s.value});t("focusout-prevented",e),e.defaultPrevented||(n.preventDefault(),d&&zC(r,!0))}}else{const e=WC({focusReason:s.value});t("focusout-prevented",e),e.defaultPrevented||(n.preventDefault(),d&&zC(i,!0))}else if(p===e){const e=WC({focusReason:s.value});t("focusout-prevented",e),e.defaultPrevented||n.preventDefault()}}};Ns(NC,{focusTrapRef:n,onKeydown:l}),fo(()=>e.focusTrapEl,e=>{e&&(n.value=e)},{immediate:!0}),fo([n],([e],[t])=>{e&&(e.addEventListener("keydown",l),e.addEventListener("focusin",d),e.addEventListener("focusout",h)),t&&(t.removeEventListener("keydown",l),t.removeEventListener("focusin",d),t.removeEventListener("focusout",h))});const u=e=>{t(RC,e)},c=e=>t(kC,e),d=s=>{const o=an(n);if(!o)return;const l=s.target,u=s.relatedTarget,c=l&&o.contains(l);if(!e.trapped){u&&o.contains(u)||(i=u)}c&&t("focusin",s),a.paused||e.trapped&&(c?r=l:zC(r,!0))},h=i=>{const o=an(n);if(!a.paused&&o)if(e.trapped){const n=i.relatedTarget;TI(n)||o.contains(n)||setTimeout(()=>{if(!a.paused&&e.trapped){const e=WC({focusReason:s.value});t("focusout-prevented",e),e.defaultPrevented||zC(r,!0)}},0)}else{const e=i.target;e&&o.contains(e)||t("focusout",i)}};async function p(){await Gn();const t=an(n);if(t){jC.push(a);const n=t.contains(document.activeElement)?i:document.activeElement;i=n;if(!t.contains(n)){const i=new Event(SC,OC);t.addEventListener(SC,u),t.dispatchEvent(i),i.defaultPrevented||Gn(()=>{let i=e.focusStartEl;C(i)||(zC(i),document.activeElement!==i&&(i="first")),"first"===i&&((e,t=!1)=>{const n=document.activeElement;for(const i of e)if(zC(i,t),document.activeElement!==n)return})(BC(t),!0),document.activeElement!==n&&"container"!==i||zC(t)})}}}function f(){const e=an(n);if(e){e.removeEventListener(SC,u);const t=new CustomEvent(CC,{...OC,detail:{focusReason:s.value}});e.addEventListener(CC,c),e.dispatchEvent(t),t.defaultPrevented||"keyboard"!=s.value&&FC.value>LC.value&&!e.contains(document.activeElement)||zC(null!=i?i:document.body),e.removeEventListener(CC,c),jC.remove(a),i=null,r=null}}return Or(()=>{e.trapped&&p(),fo(()=>e.trapped,e=>{e?p():f()})}),kr(()=>{e.trapped&&f(),n.value&&(n.value.removeEventListener("keydown",l),n.value.removeEventListener("focusin",d),n.value.removeEventListener("focusout",h),n.value=void 0)}),{onKeydown:l}}});var ZC=AE(KC,[["render",function(e,t,n,i,r,s){return Xr(e.$slots,"default",{handleKeydown:e.onKeydown})}],["__file","focus-trap.vue"]]);const QC=function(e){return void 0===e},JC=(e,t=[])=>{const{placement:n,strategy:i,popperOptions:r}=e,s={placement:n,strategy:i,...r,modifiers:[...eO(e),...t]};return function(e,t){t&&(e.modifiers=[...e.modifiers,...null!=t?t:[]])}(s,null==r?void 0:r.modifiers),s};function eO(e){const{offset:t,gpuAcceleration:n,fallbackPlacements:i}=e;return[{name:"offset",options:{offset:[0,null!=t?t:12]}},{name:"preventOverflow",options:{padding:{top:0,bottom:0,left:0,right:0}}},{name:"flip",options:{padding:5,fallbackPlacements:i}},{name:"computeStyles",options:{gpuAcceleration:n}}]}const tO=(e,t,n={})=>{const i={name:"updateState",enabled:!0,phase:"write",fn:({state:e})=>{const t=function(e){const t=Object.keys(e.elements),n=jT(t.map(t=>[t,e.styles[t]||{}])),i=jT(t.map(t=>[t,e.attributes[t]]));return{styles:n,attributes:i}}(e);Object.assign(o.value,t)},requires:["computeStyles"]},r=za(()=>{const{onFirstUpdate:e,placement:t,strategy:r,modifiers:s}=an(n);return{onFirstUpdate:e,placement:t||"bottom",strategy:r||"absolute",modifiers:[...s||[],i,{name:"applyStyles",enabled:!1}]}}),s=nn(),o=tn({styles:{popper:{position:an(r).strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),a=()=>{s.value&&(s.value.destroy(),s.value=void 0)};return fo(r,e=>{const t=an(s);t&&t.setOptions(e)},{deep:!0}),fo([e,t],([e,t])=>{a(),e&&t&&(s.value=jS(e,t,an(r)))}),kr(()=>{a()}),{state:za(()=>{var e;return{...(null==(e=an(s))?void 0:e.state)||{}}}),styles:za(()=>an(o).styles),attributes:za(()=>an(o).attributes),update:()=>{var e;return null==(e=an(s))?void 0:e.update()},forceUpdate:()=>{var e;return null==(e=an(s))?void 0:e.forceUpdate()},instanceRef:za(()=>an(s))}};const nO=e=>{const{popperInstanceRef:t,contentRef:n,triggerRef:i,role:r}=Ds(bA,void 0),s=tn(),o=za(()=>e.arrowOffset),a=za(()=>({name:"eventListeners",enabled:!!e.visible})),l=za(()=>{var e;const t=an(s),n=null!=(e=an(o))?e:0;return{name:"arrow",enabled:!QC(t),options:{element:t,padding:n}}}),u=za(()=>({onFirstUpdate:()=>{f()},...JC(e,[an(l),an(a)])})),c=za(()=>(e=>{if(Qv)return rE(e)})(e.referenceEl)||an(i)),{attributes:d,state:h,styles:p,update:f,forceUpdate:m,instanceRef:g}=tO(c,n,u);return fo(g,e=>t.value=e,{flush:"sync"}),Or(()=>{fo(()=>{var e,t;return null==(t=null==(e=an(c))?void 0:e.getBoundingClientRect)?void 0:t.call(e)},()=>{f()})}),{attributes:d,arrowRef:s,contentRef:n,instanceRef:g,state:h,styles:p,role:r,forceUpdate:m,update:f}},iO=Yi({name:"ElPopperContent"}),rO=Yi({...iO,props:HS,emits:WS,setup(e,{expose:t,emit:n}){const i=e,{focusStartRef:r,trapped:s,onFocusAfterReleased:o,onFocusAfterTrapped:a,onFocusInTrap:l,onFocusoutPrevented:u,onReleaseRequested:c}=((e,t)=>{const n=tn(!1),i=tn();return{focusStartRef:i,trapped:n,onFocusAfterReleased:e=>{var n;"pointer"!==(null==(n=e.detail)?void 0:n.focusReason)&&(i.value="first",t("blur"))},onFocusAfterTrapped:()=>{t("focus")},onFocusInTrap:t=>{e.visible&&!n.value&&(t.target&&(i.value=t.target),n.value=!0)},onFocusoutPrevented:t=>{e.trapping||("pointer"===t.detail.focusReason&&t.preventDefault(),n.value=!1)},onReleaseRequested:()=>{n.value=!1,t("close")}}})(i,n),{attributes:d,arrowRef:h,contentRef:p,styles:f,instanceRef:g,role:y,update:_}=nO(i),{ariaModal:v,arrowStyle:b,contentAttrs:T,contentClass:x,contentStyle:E,updateZIndex:w}=((e,{attributes:t,styles:n,role:i})=>{const{nextZIndex:r}=hb(),s=Bv("popper"),o=za(()=>an(t).popper),a=tn(zv(e.zIndex)?e.zIndex:r()),l=za(()=>[s.b(),s.is("pure",e.pure),s.is(e.effect),e.popperClass]),u=za(()=>[{zIndex:an(a)},an(n).popper,e.popperStyle||{}]);return{ariaModal:za(()=>"dialog"===i.value?"false":void 0),arrowStyle:za(()=>an(n).arrow||{}),contentAttrs:o,contentClass:l,contentStyle:u,contentZIndex:a,updateZIndex:()=>{a.value=zv(e.zIndex)?e.zIndex:r()}}})(i,{styles:f,attributes:d,role:y}),I=Ds(Rw,void 0);let A;Ns(TA,{arrowStyle:b,arrowRef:h}),I&&Ns(Rw,{...I,addInputId:m,removeInputId:m});const S=(e=!0)=>{_(),e&&w()},C=()=>{S(!1),i.visible&&i.focusOnShow?s.value=!0:!1===i.visible&&(s.value=!1)};return Or(()=>{fo(()=>i.triggerTargetEl,(e,t)=>{null==A||A(),A=void 0;const n=an(e||p.value),r=an(t||p.value);Vv(n)&&(A=fo([y,()=>i.ariaLabel,v,()=>i.id],e=>{["role","aria-label","aria-modal","id"].forEach((t,i)=>{TI(e[i])?n.removeAttribute(t):n.setAttribute(t,e[i])})},{immediate:!0})),r!==n&&Vv(r)&&["role","aria-label","aria-modal","id"].forEach(e=>{r.removeAttribute(e)})},{immediate:!0}),fo(()=>i.visible,C,{immediate:!0})}),kr(()=>{null==A||A(),A=void 0}),t({popperContentRef:p,popperInstanceRef:g,updatePopper:S,contentStyle:E}),(e,t)=>(jo(),qo("div",pa({ref_key:"contentRef",ref:p},an(T),{style:an(E),class:an(x),tabindex:"-1",onMouseenter:t=>e.$emit("mouseenter",t),onMouseleave:t=>e.$emit("mouseleave",t)}),[ia(an(ZC),{trapped:an(s),"trap-on-focus-in":!0,"focus-trap-el":an(p),"focus-start-el":an(r),onFocusAfterTrapped:an(a),onFocusAfterReleased:an(o),onFocusin:an(l),onFocusoutPrevented:an(u),onReleaseRequested:an(c)},{default:mi(()=>[Xr(e.$slots,"default")]),_:3},8,["trapped","focus-trap-el","focus-start-el","onFocusAfterTrapped","onFocusAfterReleased","onFocusin","onFocusoutPrevented","onReleaseRequested"])],16,["onMouseenter","onMouseleave"]))}});var sO=AE(rO,[["__file","content.vue"]]);const oO=Yi({name:"ElTooltipContent",inheritAttrs:!1}),aO=Yi({...oO,props:ZS,setup(e,{expose:t}){const n=e,{selector:i}=IC(),r=Bv("tooltip"),s=tn(),o=Zv(()=>{var e;return null==(e=s.value)?void 0:e.popperContentRef});let a;const{controlled:l,id:u,open:c,trigger:d,onClose:h,onOpen:p,onShow:f,onHide:m,onBeforeShow:g,onBeforeHide:y}=Ds(AA,void 0),_=za(()=>n.transition||`${r.namespace.value}-fade-in-linear`),v=za(()=>n.persistent);kr(()=>{null==a||a()});const b=za(()=>!!an(v)||an(c)),T=za(()=>!n.disabled&&an(c)),x=za(()=>n.appendTo||i.value),w=za(()=>{var e;return null!=(e=n.style)?e:{}}),I=tn(!0),A=()=>{m(),D()&&gA(document.body,{preventScroll:!0}),I.value=!0},S=()=>{if(an(l))return!0},C=vC(S,()=>{n.enterable&&"hover"===an(d)&&p()}),O=vC(S,()=>{"hover"===an(d)&&h()}),M=()=>{var e,t;null==(t=null==(e=s.value)?void 0:e.updatePopper)||t.call(e),null==g||g()},R=()=>{null==y||y()},k=()=>{f()},N=()=>{n.virtualTriggering||h()},D=e=>{var t;const n=null==(t=s.value)?void 0:t.popperContentRef,i=(null==e?void 0:e.relatedTarget)||document.activeElement;return null==n?void 0:n.contains(i)};return fo(()=>an(c),e=>{e?(I.value=!1,a=function(e,t,n={}){const{window:i=sE,ignore:r=[],capture:s=!0,detectIframe:o=!1}=n;if(!i)return;tb&&!aE&&(aE=!0,Array.from(i.document.body.children).forEach(e=>e.addEventListener("click",eb)));let a=!0;const l=e=>r.some(t=>{if("string"==typeof t)return Array.from(i.document.querySelectorAll(t)).some(t=>t===e.target||e.composedPath().includes(t));{const n=rE(t);return n&&(e.target===n||e.composedPath().includes(n))}}),u=[oE(i,"click",n=>{const i=rE(e);i&&i!==n.target&&!n.composedPath().includes(i)&&(0===n.detail&&(a=!l(n)),a?t(n):a=!0)},{passive:!0,capture:s}),oE(i,"pointerdown",t=>{const n=rE(e);n&&(a=!t.composedPath().includes(n)&&!l(t))},{passive:!0}),o&&oE(i,"blur",n=>{var r;const s=rE(e);"IFRAME"!==(null==(r=i.document.activeElement)?void 0:r.tagName)||(null==s?void 0:s.contains(i.document.activeElement))||t(n)})].filter(Boolean);return()=>u.forEach(e=>e())}(o,()=>{if(an(l))return;var e;(e=an(d),e||0===e?E(e)?e:[e]:[]).every(e=>"hover"!==e&&"focus"!==e)&&h()})):null==a||a()},{flush:"post"}),fo(()=>n.content,()=>{var e,t;null==(t=null==(e=s.value)?void 0:e.updatePopper)||t.call(e)}),t({contentRef:s,isFocusInsideContent:D}),(e,t)=>(jo(),Ko(an(wC),{disabled:!e.teleported,to:an(x)},{default:mi(()=>[an(b)||!I.value?(jo(),Ko(hl,{key:0,name:an(_),appear:!an(v),onAfterLeave:A,onBeforeEnter:M,onAfterEnter:k,onBeforeLeave:R,persisted:""},{default:mi(()=>[gi(ia(an(sO),pa({id:an(u),ref_key:"contentRef",ref:s},e.$attrs,{"aria-label":e.ariaLabel,"aria-hidden":I.value,"boundaries-padding":e.boundariesPadding,"fallback-placements":e.fallbackPlacements,"gpu-acceleration":e.gpuAcceleration,offset:e.offset,placement:e.placement,"popper-options":e.popperOptions,"arrow-offset":e.arrowOffset,strategy:e.strategy,effect:e.effect,enterable:e.enterable,pure:e.pure,"popper-class":e.popperClass,"popper-style":[e.popperStyle,an(w)],"reference-el":e.referenceEl,"trigger-target-el":e.triggerTargetEl,visible:an(T),"z-index":e.zIndex,onMouseenter:an(C),onMouseleave:an(O),onBlur:N,onClose:an(h)}),{default:mi(()=>[Xr(e.$slots,"default")]),_:3},16,["id","aria-label","aria-hidden","boundaries-padding","fallback-placements","gpu-acceleration","offset","placement","popper-options","arrow-offset","strategy","effect","enterable","pure","popper-class","popper-style","reference-el","trigger-target-el","visible","z-index","onMouseenter","onMouseleave","onClose"]),[[Cl,an(T)]])]),_:3},8,["name","appear"])):ua("v-if",!0)]),_:3},8,["disabled","to"]))}});var lO=AE(aO,[["__file","content.vue"]]);const uO=Yi({name:"ElPopperArrow",inheritAttrs:!1});var cO=AE(Yi({...uO,setup(e,{expose:t}){const n=Bv("popper"),{arrowRef:i,arrowStyle:r}=Ds(TA,void 0);return kr(()=>{i.value=void 0}),t({arrowRef:i}),(e,t)=>(jo(),qo("span",{ref_key:"arrowRef",ref:i,class:oe(an(n).e("arrow")),style:te(an(r)),"data-popper-arrow":""},null,6))}}),[["__file","arrow.vue"]]);const dO=Yi({name:"ElTooltip"}),hO=Yi({...dO,props:uC,emits:cC,setup(e,{expose:t,emit:n}){const i=e;AC();const r=Bv("tooltip"),s=Ow(),o=tn(),a=tn(),l=()=>{var e;const t=an(o);t&&(null==(e=t.popperInstanceRef)||e.update())},u=tn(!1),c=tn(),{show:d,hide:h,hasUpdateHandler:p}=lC({indicator:u,toggleReason:c}),{onOpen:f,onClose:m}=(({showAfter:e,hideAfter:t,autoClose:n,open:i,close:r})=>{const{registerTimeout:s}=qS(),{registerTimeout:o,cancelTimeout:a}=qS();return{onOpen:(t,a=an(e))=>{s(()=>{i(t);const e=an(n);zv(e)&&e>0&&o(()=>{r(t)},e)},a)},onClose:(e,n=an(t))=>{a(),s(()=>{r(e)},n)}}})({showAfter:gn(i,"showAfter"),hideAfter:gn(i,"hideAfter"),autoClose:gn(i,"autoClose"),open:d,close:h}),g=za(()=>Uv(i.visible)&&!p.value),y=za(()=>[r.b(),i.popperClass]);Ns(AA,{controlled:g,id:s,open:jt(u),trigger:gn(i,"trigger"),onOpen:f,onClose:m,onToggle:e=>{an(u)?m(e):f(e)},onShow:()=>{n("show",c.value)},onHide:()=>{n("hide",c.value)},onBeforeShow:()=>{n("before-show",c.value)},onBeforeHide:()=>{n("before-hide",c.value)},updatePopper:l}),fo(()=>i.disabled,e=>{e&&u.value&&(u.value=!1)});return Tr(()=>u.value&&h()),t({popperRef:o,contentRef:a,isFocusInsideContent:e=>{var t;return null==(t=a.value)?void 0:t.isFocusInsideContent(e)},updatePopper:l,onOpen:f,onClose:m,hide:h}),(e,t)=>(jo(),Ko(an(IA),{ref_key:"popperRef",ref:o,role:e.role},{default:mi(()=>[ia(EC,{disabled:e.disabled,trigger:e.trigger,"trigger-keys":e.triggerKeys,"virtual-ref":e.virtualRef,"virtual-triggering":e.virtualTriggering,"focus-on-target":e.focusOnTarget},{default:mi(()=>[e.$slots.default?Xr(e.$slots,"default",{key:0}):ua("v-if",!0)]),_:3},8,["disabled","trigger","trigger-keys","virtual-ref","virtual-triggering","focus-on-target"]),ia(lO,{ref_key:"contentRef",ref:a,"aria-label":e.ariaLabel,"boundaries-padding":e.boundariesPadding,content:e.content,disabled:e.disabled,effect:e.effect,enterable:e.enterable,"fallback-placements":e.fallbackPlacements,"hide-after":e.hideAfter,"gpu-acceleration":e.gpuAcceleration,offset:e.offset,persistent:e.persistent,"popper-class":an(y),"popper-style":e.popperStyle,placement:e.placement,"popper-options":e.popperOptions,"arrow-offset":e.arrowOffset,pure:e.pure,"raw-content":e.rawContent,"reference-el":e.referenceEl,"trigger-target-el":e.triggerTargetEl,"show-after":e.showAfter,strategy:e.strategy,teleported:e.teleported,transition:e.transition,"virtual-triggering":e.virtualTriggering,"z-index":e.zIndex,"append-to":e.appendTo},{default:mi(()=>[Xr(e.$slots,"content",{},()=>[e.rawContent?(jo(),qo("span",{key:0,innerHTML:e.content},null,8,["innerHTML"])):(jo(),qo("span",{key:1},Ee(e.content),1))]),e.showArrow?(jo(),Ko(an(cO),{key:0})):ua("v-if",!0)]),_:3},8,["aria-label","boundaries-padding","content","disabled","effect","enterable","fallback-placements","hide-after","gpu-acceleration","offset","persistent","popper-class","popper-style","placement","popper-options","arrow-offset","pure","raw-content","reference-el","trigger-target-el","show-after","strategy","teleported","transition","virtual-triggering","z-index","append-to"])]),_:3},8,["role"]))}});const pO=ox(AE(hO,[["__file","tooltip.vue"]])),fO={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},mO=Symbol("scrollbarContextKey"),gO=HT({vertical:Boolean,size:String,move:Number,ratio:{type:Number,required:!0},always:Boolean}),yO=Yi({__name:"thumb",props:gO,setup(e){const t=e,n=Ds(mO),i=Bv("scrollbar");n||KE("Thumb","can not inject scrollbar context");const r=tn(),s=tn(),o=tn({}),a=tn(!1);let l=!1,u=!1,c=0,d=0,h=Qv?document.onselectstart:null;const p=za(()=>fO[t.vertical?"vertical":"horizontal"]),f=za(()=>(({move:e,size:t,bar:n})=>({[n.size]:t,transform:`translate${n.axis}(${e}%)`}))({size:t.size,move:t.move,bar:p.value})),m=za(()=>r.value[p.value.offset]**2/n.wrapElement[p.value.scrollSize]/t.ratio/s.value[p.value.offset]),g=e=>{var t;if(e.stopPropagation(),e.ctrlKey||[1,2].includes(e.button))return;null==(t=window.getSelection())||t.removeAllRanges(),_(e);const n=e.currentTarget;n&&(o.value[p.value.axis]=n[p.value.offset]-(e[p.value.client]-n.getBoundingClientRect()[p.value.direction]))},y=e=>{if(!s.value||!r.value||!n.wrapElement)return;const t=100*(Math.abs(e.target.getBoundingClientRect()[p.value.direction]-e[p.value.client])-s.value[p.value.offset]/2)*m.value/r.value[p.value.offset];n.wrapElement[p.value.scroll]=t*n.wrapElement[p.value.scrollSize]/100},_=e=>{e.stopImmediatePropagation(),l=!0,c=n.wrapElement.scrollHeight,d=n.wrapElement.scrollWidth,document.addEventListener("mousemove",v),document.addEventListener("mouseup",b),h=document.onselectstart,document.onselectstart=()=>!1},v=e=>{if(!r.value||!s.value)return;if(!1===l)return;const t=o.value[p.value.axis];if(!t)return;const i=100*(-1*(r.value.getBoundingClientRect()[p.value.direction]-e[p.value.client])-(s.value[p.value.offset]-t))*m.value/r.value[p.value.offset];"scrollLeft"===p.value.scroll?n.wrapElement[p.value.scroll]=i*d/100:n.wrapElement[p.value.scroll]=i*c/100},b=()=>{l=!1,o.value[p.value.axis]=0,document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",b),T(),u&&(a.value=!1)};kr(()=>{T(),document.removeEventListener("mouseup",b)});const T=()=>{document.onselectstart!==h&&(document.onselectstart=h)};return oE(gn(n,"scrollbarElement"),"mousemove",()=>{u=!1,a.value=!!t.size}),oE(gn(n,"scrollbarElement"),"mouseleave",()=>{u=!0,a.value=l}),(e,t)=>(jo(),Ko(hl,{name:an(i).b("fade"),persisted:""},{default:mi(()=>[gi(na("div",{ref_key:"instance",ref:r,class:oe([an(i).e("bar"),an(i).is(an(p).key)]),onMousedown:y,onClick:Mu(()=>{},["stop"])},[na("div",{ref_key:"thumb",ref:s,class:oe(an(i).e("thumb")),style:te(an(f)),onMousedown:g},null,38)],42,["onClick"]),[[Cl,e.always||a.value]])]),_:1},8,["name"]))}});var _O=AE(yO,[["__file","thumb.vue"]]);const vO=Yi({__name:"bar",props:HT({always:{type:Boolean,default:!0},minSize:{type:Number,required:!0}}),setup(e,{expose:t}){const n=e,i=Ds(mO),r=tn(0),s=tn(0),o=tn(""),a=tn(""),l=tn(1),u=tn(1);return t({handleScroll:e=>{if(e){const t=e.offsetHeight-4,n=e.offsetWidth-4;s.value=100*e.scrollTop/t*l.value,r.value=100*e.scrollLeft/n*u.value}},update:()=>{const e=null==i?void 0:i.wrapElement;if(!e)return;const t=e.offsetHeight-4,r=e.offsetWidth-4,s=t**2/e.scrollHeight,c=r**2/e.scrollWidth,d=Math.max(s,n.minSize),h=Math.max(c,n.minSize);l.value=s/(t-s)/(d/(t-d)),u.value=c/(r-c)/(h/(r-h)),a.value=d+4<t?`${d}px`:"",o.value=h+4<r?`${h}px`:""}}),(e,t)=>(jo(),qo(Po,null,[ia(_O,{move:r.value,ratio:u.value,size:o.value,always:e.always},null,8,["move","ratio","size","always"]),ia(_O,{move:s.value,ratio:l.value,size:a.value,vertical:"",always:e.always},null,8,["move","ratio","size","always"])],64))}});var bO=AE(vO,[["__file","bar.vue"]]);const TO=HT({distance:{type:Number,default:0},height:{type:[String,Number],default:""},maxHeight:{type:[String,Number],default:""},native:Boolean,wrapStyle:{type:[String,Object,Array],default:""},wrapClass:{type:[String,Array],default:""},viewClass:{type:[String,Array],default:""},viewStyle:{type:[String,Array,Object],default:""},noresize:Boolean,tag:{type:String,default:"div"},always:Boolean,minSize:{type:Number,default:20},tabindex:{type:[String,Number],default:void 0},id:String,role:String,...sA(["ariaLabel","ariaOrientation"])}),xO={"end-reached":e=>["left","right","top","bottom"].includes(e),scroll:({scrollTop:e,scrollLeft:t})=>[e,t].every(zv)},EO=Yi({name:"ElScrollbar"}),wO=Yi({...EO,props:TO,emits:xO,setup(e,{expose:t,emit:n}){const i=e,r=Bv("scrollbar");let s,o,a,l=0,u=0,c="";const d={bottom:!1,top:!1,right:!1,left:!1},h=tn(),p=tn(),f=tn(),m=tn(),g=za(()=>{const e={};return i.height&&(e.height=SE(i.height)),i.maxHeight&&(e.maxHeight=SE(i.maxHeight)),[i.wrapStyle,e]}),y=za(()=>[i.wrapClass,r.e("wrap"),{[r.em("wrap","hidden-default")]:!i.native}]),_=za(()=>[r.e("view"),i.viewClass]),v={top:"bottom",bottom:"top",left:"right",right:"left"},b=()=>{var e;if(p.value){null==(e=m.value)||e.handleScroll(p.value);const t=l,r=u;l=p.value.scrollTop,u=p.value.scrollLeft;const s={bottom:l+p.value.clientHeight>=p.value.scrollHeight-i.distance,top:l<=i.distance&&0!==t,right:u+p.value.clientWidth>=p.value.scrollWidth-i.distance&&r!==u,left:u<=i.distance&&0!==r};if(n("scroll",{scrollTop:l,scrollLeft:u}),t!==l&&(c=l>t?"bottom":"top"),r!==u&&(c=u>r?"right":"left"),i.distance>0){if((e=>{var t;return null!=(t=d[e])&&t})(c))return;(e=>{const t=v[c];if(!t)return;const n=e[c],i=e[t];n&&!d[c]&&(d[c]=!0),!i&&d[t]&&(d[t]=!1)})(s)}s[c]&&n("end-reached",c)}};const T=()=>{var e;null==(e=m.value)||e.update(),d[c]=!1};return fo(()=>i.noresize,e=>{e?(null==s||s(),null==o||o(),null==a||a()):(({stop:s}=mE(f,T)),({stop:o}=mE(p,T)),a=oE("resize",T))},{immediate:!0}),fo(()=>[i.maxHeight,i.height],()=>{i.native||Gn(()=>{var e;T(),p.value&&(null==(e=m.value)||e.handleScroll(p.value))})}),Ns(mO,zt({scrollbarElement:h,wrapElement:p})),br(()=>{p.value&&(p.value.scrollTop=l,p.value.scrollLeft=u)}),Or(()=>{i.native||Gn(()=>{T()})}),Rr(()=>T()),t({wrapRef:p,update:T,scrollTo:function(e,t){M(e)?p.value.scrollTo(e):zv(e)&&zv(t)&&p.value.scrollTo(e,t)},setScrollTop:e=>{zv(e)&&(p.value.scrollTop=e)},setScrollLeft:e=>{zv(e)&&(p.value.scrollLeft=e)},handleScroll:b}),(e,t)=>(jo(),qo("div",{ref_key:"scrollbarRef",ref:h,class:oe(an(r).b())},[na("div",{ref_key:"wrapRef",ref:p,class:oe(an(y)),style:te(an(g)),tabindex:e.tabindex,onScroll:b},[(jo(),Ko(Vr(e.tag),{id:e.id,ref_key:"resizeRef",ref:f,class:oe(an(_)),style:te(e.viewStyle),role:e.role,"aria-label":e.ariaLabel,"aria-orientation":e.ariaOrientation},{default:mi(()=>[Xr(e.$slots,"default")]),_:3},8,["id","class","style","role","aria-label","aria-orientation"]))],46,["tabindex"]),e.native?ua("v-if",!0):(jo(),Ko(bO,{key:0,ref_key:"barRef",ref:m,always:e.always,"min-size":e.minSize},null,8,["always","min-size"]))],2))}});const IO=ox(AE(wO,[["__file","scrollbar.vue"]]));var AO=AE(Yi({inheritAttrs:!1}),[["render",function(e,t,n,i,r,s){return Xr(e.$slots,"default")}],["__file","collection.vue"]]);var SO=AE(Yi({name:"ElCollectionItem",inheritAttrs:!1}),[["render",function(e,t,n,i,r,s){return Xr(e.$slots,"default")}],["__file","collection-item.vue"]]);const CO="data-el-collection-item",OO=e=>{const t=`El${e}Collection`,n=`${t}Item`,i=Symbol(t),r=Symbol(n),s={...AO,name:t,setup(){const e=tn(),t=new Map;Ns(i,{itemMap:t,getItems:()=>{const n=an(e);if(!n)return[];const i=Array.from(n.querySelectorAll(`[${CO}]`));return[...t.values()].sort((e,t)=>i.indexOf(e.ref)-i.indexOf(t.ref))},collectionRef:e})}},o={...SO,name:n,setup(e,{attrs:t}){const n=tn(),s=Ds(i,void 0);Ns(r,{collectionItemRef:n}),Or(()=>{const e=an(n);e&&s.itemMap.set(e,{ref:e,...t})}),kr(()=>{const e=an(n);s.itemMap.delete(e)})}};return{COLLECTION_INJECTION_KEY:i,COLLECTION_ITEM_INJECTION_KEY:r,ElCollection:s,ElCollectionItem:o}},MO=HT({style:{type:[String,Array,Object]},currentTabId:{type:String},defaultCurrentTabId:String,loop:Boolean,dir:{type:String,values:["ltr","rtl"],default:"ltr"},orientation:{type:String},onBlur:Function,onFocus:Function,onMousedown:Function}),{ElCollection:RO,ElCollectionItem:kO,COLLECTION_INJECTION_KEY:NO,COLLECTION_ITEM_INJECTION_KEY:DO}=OO("RovingFocusGroup"),FO=Symbol("elRovingFocusGroup"),LO=Symbol("elRovingFocusGroupItem"),PO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"},BO=(e,t,n)=>{const i=((e,t)=>{if("rtl"!==t)return e;switch(e){case GE.right:return GE.left;case GE.left:return GE.right;default:return e}})(e.code,n);if(!("vertical"===t&&[GE.left,GE.right].includes(i)||"horizontal"===t&&[GE.up,GE.down].includes(i)))return PO[i]},$O=e=>{const{activeElement:t}=document;for(const n of e){if(n===t)return;if(n.focus(),t!==document.activeElement)return}},UO="currentTabIdChange",zO="rovingFocusGroup.entryFocus",VO={bubbles:!1,cancelable:!0},jO=Yi({name:"ElRovingFocusGroupImpl",inheritAttrs:!1,props:MO,emits:[UO,"entryFocus"],setup(e,{emit:t}){var n;const i=tn(null!=(n=e.currentTabId||e.defaultCurrentTabId)?n:null),r=tn(!1),s=tn(!1),o=tn(),{getItems:a}=Ds(NO,void 0),l=za(()=>[{outline:"none"},e.style]),u=vC(t=>{var n;null==(n=e.onMousedown)||n.call(e,t)},()=>{s.value=!0}),c=vC(t=>{var n;null==(n=e.onFocus)||n.call(e,t)},e=>{const t=!an(s),{target:n,currentTarget:o}=e;if(n===o&&t&&!an(r)){const e=new Event(zO,VO);if(null==o||o.dispatchEvent(e),!e.defaultPrevented){const e=a().filter(e=>e.focusable),t=[e.find(e=>e.active),e.find(e=>e.id===an(i)),...e].filter(Boolean).map(e=>e.ref);$O(t)}}s.value=!1}),d=vC(t=>{var n;null==(n=e.onBlur)||n.call(e,t)},()=>{r.value=!1});Ns(FO,{currentTabbedId:jt(i),loop:gn(e,"loop"),tabIndex:za(()=>an(r)?-1:0),rovingFocusGroupRef:o,rovingFocusGroupRootStyle:l,orientation:gn(e,"orientation"),dir:gn(e,"dir"),onItemFocus:e=>{t(UO,e)},onItemShiftTab:()=>{r.value=!0},onBlur:d,onFocus:c,onMousedown:u}),fo(()=>e.currentTabId,e=>{i.value=null!=e?e:null}),oE(o,zO,(...e)=>{t("entryFocus",...e)})}});var YO=AE(Yi({name:"ElRovingFocusGroup",components:{ElFocusGroupCollection:RO,ElRovingFocusGroupImpl:AE(jO,[["render",function(e,t,n,i,r,s){return Xr(e.$slots,"default")}],["__file","roving-focus-group-impl.vue"]])}}),[["render",function(e,t,n,i,r,s){const o=Ur("el-roving-focus-group-impl"),a=Ur("el-focus-group-collection");return jo(),Ko(a,null,{default:mi(()=>[ia(o,ae(sa(e.$attrs)),{default:mi(()=>[Xr(e.$slots,"default")]),_:3},16)]),_:3})}],["__file","roving-focus-group.vue"]]);const GO=HT({trigger:JS.trigger,triggerKeys:{type:Array,default:()=>[GE.enter,GE.numpadEnter,GE.space,GE.down]},virtualTriggering:JS.virtualTriggering,virtualRef:JS.virtualRef,effect:{...ZS.effect,default:"light"},type:{type:String},placement:{type:String,default:"bottom"},popperOptions:{type:Object,default:()=>({})},id:String,size:{type:String,default:""},splitButton:Boolean,hideOnClick:{type:Boolean,default:!0},loop:{type:Boolean,default:!0},showArrow:{type:Boolean,default:!0},showTimeout:{type:Number,default:150},hideTimeout:{type:Number,default:150},tabindex:{type:[Number,String],default:0},maxHeight:{type:[Number,String],default:""},popperClass:{type:String,default:""},disabled:Boolean,role:{type:String,values:xA,default:"menu"},buttonProps:{type:Object},teleported:ZS.teleported,persistent:{type:Boolean,default:!0}}),HO=HT({command:{type:[Object,String,Number],default:()=>({})},disabled:Boolean,divided:Boolean,textValue:String,icon:{type:DE}}),WO=HT({onKeydown:{type:Function}}),XO=[GE.down,GE.pageDown,GE.home],qO=[GE.up,GE.pageUp,GE.end],KO=[...XO,...qO],{ElCollection:ZO,ElCollectionItem:QO,COLLECTION_INJECTION_KEY:JO,COLLECTION_ITEM_INJECTION_KEY:eM}=OO("Dropdown"),tM=Symbol("elDropdown"),nM="elDropdown";const iM=function(){if(!arguments.length)return[];var e=arguments[0];return pb(e)?e:[e]},{ButtonGroup:rM}=pI,sM=Yi({name:"ElDropdown",components:{ElButton:pI,ElButtonGroup:rM,ElScrollbar:IO,ElDropdownCollection:ZO,ElTooltip:pO,ElRovingFocusGroup:YO,ElOnlyChild:pC,ElIcon:NE,ArrowDown:cx},props:GO,emits:["visible-change","click","command"],setup(e,{emit:t}){const n=va(),i=Bv("dropdown"),{t:r}=VT(),s=tn(),o=tn(),a=tn(),l=tn(),u=tn(null),c=tn(null),d=tn(!1),h=za(()=>({maxHeight:SE(e.maxHeight)})),p=za(()=>[i.m(y.value)]),f=za(()=>iM(e.trigger)),m=Ow().value,g=za(()=>e.id||m);const y=Fw();Ns(tM,{contentRef:l,role:za(()=>e.role),triggerId:g,isUsingKeyboard:d,onItemEnter:function(){},onItemLeave:function(){const e=an(l);f.value.includes("hover")&&(null==e||e.focus({preventScroll:!0})),c.value=null}}),Ns(nM,{instance:n,dropdownSize:y,handleClick:function(){var e;null==(e=a.value)||e.onClose(void 0,0)},commandHandler:function(...e){t("command",...e)},trigger:gn(e,"trigger"),hideOnClick:gn(e,"hideOnClick")});return{t:r,ns:i,scrollbar:u,wrapStyle:h,dropdownTriggerKls:p,dropdownSize:y,triggerId:g,currentTabId:c,handleCurrentTabIdChange:function(e){c.value=e},handlerMainButtonClick:e=>{t("click",e)},handleEntryFocus:function(e){d.value||(e.preventDefault(),e.stopImmediatePropagation())},handleClose:function(){var e;null==(e=a.value)||e.onClose()},handleOpen:function(){var e;null==(e=a.value)||e.onOpen()},handleBeforeShowTooltip:function(){t("visible-change",!0)},handleShowTooltip:function(e){var t;"keydown"===(null==e?void 0:e.type)&&(null==(t=l.value)||t.focus())},handleBeforeHideTooltip:function(){t("visible-change",!1)},onFocusAfterTrapped:e=>{var t,n;e.preventDefault(),null==(n=null==(t=l.value)?void 0:t.focus)||n.call(t,{preventScroll:!0})},popperRef:a,contentRef:l,triggeringElementRef:s,referenceElementRef:o}}});var oM=AE(sM,[["render",function(e,t,n,i,r,s){var o,a;const l=Ur("el-dropdown-collection"),u=Ur("el-roving-focus-group"),c=Ur("el-scrollbar"),d=Ur("el-only-child"),h=Ur("el-tooltip"),p=Ur("el-button"),f=Ur("arrow-down"),m=Ur("el-icon"),g=Ur("el-button-group");return jo(),qo("div",{class:oe([e.ns.b(),e.ns.is("disabled",e.disabled)])},[ia(h,{ref:"popperRef",role:e.role,effect:e.effect,"fallback-placements":["bottom","top"],"popper-options":e.popperOptions,"gpu-acceleration":!1,"manual-mode":!0,placement:e.placement,"popper-class":[e.ns.e("popper"),e.popperClass],"reference-element":null==(o=e.referenceElementRef)?void 0:o.$el,trigger:e.trigger,"trigger-keys":e.triggerKeys,"trigger-target-el":e.contentRef,"show-arrow":e.showArrow,"show-after":"hover"===e.trigger?e.showTimeout:0,"hide-after":"hover"===e.trigger?e.hideTimeout:0,"stop-popper-mouse-event":!1,"virtual-ref":null!=(a=e.virtualRef)?a:e.triggeringElementRef,"virtual-triggering":e.virtualTriggering||e.splitButton,disabled:e.disabled,transition:`${e.ns.namespace.value}-zoom-in-top`,teleported:e.teleported,pure:"","focus-on-target":"",persistent:e.persistent,onBeforeShow:e.handleBeforeShowTooltip,onShow:e.handleShowTooltip,onBeforeHide:e.handleBeforeHideTooltip},Wr({content:mi(()=>[ia(c,{ref:"scrollbar","wrap-style":e.wrapStyle,tag:"div","view-class":e.ns.e("list")},{default:mi(()=>[ia(u,{loop:e.loop,"current-tab-id":e.currentTabId,orientation:"horizontal",onCurrentTabIdChange:e.handleCurrentTabIdChange,onEntryFocus:e.handleEntryFocus},{default:mi(()=>[ia(l,null,{default:mi(()=>[Xr(e.$slots,"dropdown")]),_:3})]),_:3},8,["loop","current-tab-id","onCurrentTabIdChange","onEntryFocus"])]),_:3},8,["wrap-style","view-class"])]),_:2},[e.splitButton?void 0:{name:"default",fn:mi(()=>[ia(d,{id:e.triggerId,ref:"triggeringElementRef",role:"button",tabindex:e.tabindex},{default:mi(()=>[Xr(e.$slots,"default")]),_:3},8,["id","tabindex"])])}]),1032,["role","effect","popper-options","placement","popper-class","reference-element","trigger","trigger-keys","trigger-target-el","show-arrow","show-after","hide-after","virtual-ref","virtual-triggering","disabled","transition","teleported","persistent","onBeforeShow","onShow","onBeforeHide"]),e.splitButton?(jo(),Ko(g,{key:0},{default:mi(()=>[ia(p,pa({ref:"referenceElementRef"},e.buttonProps,{size:e.dropdownSize,type:e.type,disabled:e.disabled,tabindex:e.tabindex,onClick:e.handlerMainButtonClick}),{default:mi(()=>[Xr(e.$slots,"default")]),_:3},16,["size","type","disabled","tabindex","onClick"]),ia(p,pa({id:e.triggerId,ref:"triggeringElementRef"},e.buttonProps,{role:"button",size:e.dropdownSize,type:e.type,class:e.ns.e("caret-button"),disabled:e.disabled,tabindex:e.tabindex,"aria-label":e.t("el.dropdown.toggleDropdown")}),{default:mi(()=>[ia(m,{class:oe(e.ns.e("icon"))},{default:mi(()=>[ia(f)]),_:1},8,["class"])]),_:1},16,["id","size","type","class","disabled","tabindex","aria-label"])]),_:3})):ua("v-if",!0)],2)}],["__file","dropdown.vue"]]);const aM=Yi({components:{ElRovingFocusCollectionItem:kO},props:{focusable:{type:Boolean,default:!0},active:Boolean},emits:["mousedown","focus","keydown"],setup(e,{emit:t}){const{currentTabbedId:n,loop:i,onItemFocus:r,onItemShiftTab:s}=Ds(FO,void 0),{getItems:o}=Ds(NO,void 0),a=Ow(),l=tn(),u=vC(e=>{t("mousedown",e)},t=>{e.focusable?r(an(a)):t.preventDefault()}),c=vC(e=>{t("focus",e)},()=>{r(an(a))}),d=vC(e=>{t("keydown",e)},e=>{const{code:t,shiftKey:n,target:r,currentTarget:a}=e;if(t===GE.tab&&n)return void s();if(r!==a)return;const l=BO(e);if(l){e.preventDefault();let t=o().filter(e=>e.focusable).map(e=>e.ref);switch(l){case"last":t.reverse();break;case"prev":case"next":{"prev"===l&&t.reverse();const e=t.indexOf(a);t=i.value?((e,t)=>e.map((n,i)=>e[(i+t)%e.length]))(t,e+1):t.slice(e+1);break}}Gn(()=>{$O(t)})}}),h=za(()=>n.value===an(a));return Ns(LO,{rovingFocusGroupItemRef:l,tabIndex:za(()=>an(h)?0:-1),handleMousedown:u,handleFocus:c,handleKeydown:d}),{id:a,handleKeydown:d,handleFocus:c,handleMousedown:u}}});var lM=AE(aM,[["render",function(e,t,n,i,r,s){const o=Ur("el-roving-focus-collection-item");return jo(),Ko(o,{id:e.id,focusable:e.focusable,active:e.active},{default:mi(()=>[Xr(e.$slots,"default")]),_:3},8,["id","focusable","active"])}],["__file","roving-focus-item.vue"]]);const uM=(...e)=>t=>{e.forEach(e=>{S(e)?e(t):e.value=t})},cM=Yi({name:"DropdownItemImpl",components:{ElIcon:NE},props:HO,emits:["pointermove","pointerleave","click","clickimpl"],setup(e,{emit:t}){const n=Bv("dropdown"),{role:i}=Ds(tM,void 0),{collectionItemRef:r}=Ds(eM,void 0),{collectionItemRef:s}=Ds(DO,void 0),{rovingFocusGroupItemRef:o,tabIndex:a,handleFocus:l,handleKeydown:u,handleMousedown:c}=Ds(LO,void 0),d=uM(r,s,o),h=za(()=>"menu"===i.value?"menuitem":"navigation"===i.value?"link":"button"),p=vC(e=>{if([GE.enter,GE.numpadEnter,GE.space].includes(e.code))return e.preventDefault(),e.stopImmediatePropagation(),t("clickimpl",e),!0},u);return{ns:n,itemRef:d,dataset:{[CO]:""},role:h,tabIndex:a,handleFocus:l,handleKeydown:p,handleMousedown:c}}});const dM=()=>{const e=Ds(nM,{}),t=za(()=>null==e?void 0:e.dropdownSize);return{elDropdown:e,_elDropdownSize:t}},hM=Yi({name:"ElDropdownItem",components:{ElDropdownCollectionItem:QO,ElRovingFocusItem:lM,ElDropdownItemImpl:AE(cM,[["render",function(e,t,n,i,r,s){const o=Ur("el-icon");return jo(),qo(Po,null,[e.divided?(jo(),qo("li",{key:0,role:"separator",class:oe(e.ns.bem("menu","item","divided"))},null,2)):ua("v-if",!0),na("li",pa({ref:e.itemRef},{...e.dataset,...e.$attrs},{"aria-disabled":e.disabled,class:[e.ns.be("menu","item"),e.ns.is("disabled",e.disabled)],tabindex:e.tabIndex,role:e.role,onClick:t=>e.$emit("clickimpl",t),onFocus:e.handleFocus,onKeydown:Mu(e.handleKeydown,["self"]),onMousedown:e.handleMousedown,onPointermove:t=>e.$emit("pointermove",t),onPointerleave:t=>e.$emit("pointerleave",t)}),[e.icon?(jo(),Ko(o,{key:0},{default:mi(()=>[(jo(),Ko(Vr(e.icon)))]),_:1})):ua("v-if",!0),Xr(e.$slots,"default")],16,["aria-disabled","tabindex","role","onClick","onFocus","onKeydown","onMousedown","onPointermove","onPointerleave"])],64)}],["__file","dropdown-item-impl.vue"]])},inheritAttrs:!1,props:HO,emits:["pointermove","pointerleave","click"],setup(e,{emit:t,attrs:n}){const{elDropdown:i}=dM(),r=va(),s=tn(null),o=za(()=>{var e,t;return null!=(t=null==(e=an(s))?void 0:e.textContent)?t:""}),{onItemEnter:a,onItemLeave:l}=Ds(tM,void 0),u=vC(e=>(t("pointermove",e),e.defaultPrevented),bC(t=>{if(e.disabled)return void l(t);const n=t.currentTarget;n===document.activeElement||n.contains(document.activeElement)||(a(t),t.defaultPrevented||null==n||n.focus({preventScroll:!0}))})),c=vC(e=>(t("pointerleave",e),e.defaultPrevented),bC(l)),d=vC(n=>{if(!e.disabled)return t("click",n),"keydown"!==n.type&&n.defaultPrevented},t=>{var n,s,o;e.disabled?t.stopImmediatePropagation():((null==(n=null==i?void 0:i.hideOnClick)?void 0:n.value)&&(null==(s=i.handleClick)||s.call(i)),null==(o=i.commandHandler)||o.call(i,e.command,r,t))});return{handleClick:d,handlePointerMove:u,handlePointerLeave:c,textContent:o,propsAndAttrs:za(()=>({...e,...n}))}}});var pM=AE(hM,[["render",function(e,t,n,i,r,s){var o;const a=Ur("el-dropdown-item-impl"),l=Ur("el-roving-focus-item"),u=Ur("el-dropdown-collection-item");return jo(),Ko(u,{disabled:e.disabled,"text-value":null!=(o=e.textValue)?o:e.textContent},{default:mi(()=>[ia(l,{focusable:!e.disabled},{default:mi(()=>[ia(a,pa(e.propsAndAttrs,{onPointerleave:e.handlePointerLeave,onPointermove:e.handlePointerMove,onClickimpl:e.handleClick}),{default:mi(()=>[Xr(e.$slots,"default")]),_:3},16,["onPointerleave","onPointermove","onClickimpl"])]),_:3},8,["focusable"])]),_:3},8,["disabled","text-value"])}],["__file","dropdown-item.vue"]]);const fM=Yi({name:"ElDropdownMenu",props:WO,setup(e){const t=Bv("dropdown"),{_elDropdownSize:n}=dM(),i=n.value,{focusTrapRef:r,onKeydown:s}=Ds(NC,void 0),{contentRef:o,role:a,triggerId:l}=Ds(tM,void 0),{collectionRef:u,getItems:c}=Ds(JO,void 0),{rovingFocusGroupRef:d,rovingFocusGroupRootStyle:h,tabIndex:p,onBlur:f,onFocus:m,onMousedown:g}=Ds(FO,void 0),{collectionRef:y}=Ds(NO,void 0),_=za(()=>[t.b("menu"),t.bm("menu",null==i?void 0:i.value)]),v=uM(o,u,r,d,y),b=vC(t=>{var n;null==(n=e.onKeydown)||n.call(e,t)},e=>{const{currentTarget:t,code:n,target:i}=e;if(t.contains(i),GE.tab===n&&e.stopImmediatePropagation(),e.preventDefault(),i!==an(o)||!KO.includes(n))return;const r=c().filter(e=>!e.disabled).map(e=>e.ref);qO.includes(n)&&r.reverse(),$O(r)});return{size:i,rovingFocusGroupRootStyle:h,tabIndex:p,dropdownKls:_,role:a,triggerId:l,dropdownListWrapperRef:v,handleKeydown:e=>{b(e),s(e)},onBlur:f,onFocus:m,onMousedown:g}}});var mM=AE(fM,[["render",function(e,t,n,i,r,s){return jo(),qo("ul",{ref:e.dropdownListWrapperRef,class:oe(e.dropdownKls),style:te(e.rovingFocusGroupRootStyle),tabindex:-1,role:e.role,"aria-labelledby":e.triggerId,onBlur:e.onBlur,onFocus:e.onFocus,onKeydown:Mu(e.handleKeydown,["self"]),onMousedown:Mu(e.onMousedown,["self"])},[Xr(e.$slots,"default")],46,["role","aria-labelledby","onBlur","onFocus","onKeydown","onMousedown"])}],["__file","dropdown-menu.vue"]]);const gM=ox(oM,{DropdownItem:pM,DropdownMenu:mM}),yM=ax(pM),_M=ax(mM),vM=Symbol("uploadContextKey"),bM=HT({type:{type:String,default:"line",values:["line","circle","dashboard"]},percentage:{type:Number,default:0,validator:e=>e>=0&&e<=100},status:{type:String,default:"",values:["","success","exception","warning"]},indeterminate:Boolean,duration:{type:Number,default:3},strokeWidth:{type:Number,default:6},strokeLinecap:{type:String,default:"round"},textInside:Boolean,width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:[String,Array,Function],default:""},striped:Boolean,stripedFlow:Boolean,format:{type:Function,default:e=>`${e}%`}}),TM=Yi({name:"ElProgress"}),xM=Yi({...TM,props:bM,setup(e){const t=e,n={success:"#13ce66",exception:"#ff4949",warning:"#e6a23c",default:"#20a0ff"},i=Bv("progress"),r=za(()=>{const e={width:`${t.percentage}%`,animationDuration:`${t.duration}s`},n=y(t.percentage);return n.includes("gradient")?e.background=n:e.backgroundColor=n,e}),s=za(()=>(t.strokeWidth/t.width*100).toFixed(1)),o=za(()=>["circle","dashboard"].includes(t.type)?Number.parseInt(""+(50-Number.parseFloat(s.value)/2),10):0),a=za(()=>{const e=o.value,n="dashboard"===t.type;return`\n M 50 50\n m 0 ${n?"":"-"}${e}\n a ${e} ${e} 0 1 1 0 ${n?"-":""}${2*e}\n a ${e} ${e} 0 1 1 0 ${n?"":"-"}${2*e}\n `}),l=za(()=>2*Math.PI*o.value),u=za(()=>"dashboard"===t.type?.75:1),c=za(()=>`${-1*l.value*(1-u.value)/2}px`),d=za(()=>({strokeDasharray:`${l.value*u.value}px, ${l.value}px`,strokeDashoffset:c.value})),h=za(()=>({strokeDasharray:`${l.value*u.value*(t.percentage/100)}px, ${l.value}px`,strokeDashoffset:c.value,transition:"stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"})),p=za(()=>{let e;return e=t.color?y(t.percentage):n[t.status]||n.default,e}),f=za(()=>"warning"===t.status?eE:"line"===t.type?"success"===t.status?xx:Ax:"success"===t.status?bx:kx),m=za(()=>"line"===t.type?12+.4*t.strokeWidth:.111111*t.width+2),g=za(()=>t.format(t.percentage));const y=e=>{var n;const{color:i}=t;if(S(i))return i(e);if(C(i))return i;{const t=function(e){const t=100/e.length;return e.map((e,n)=>C(e)?{color:e,percentage:(n+1)*t}:e).sort((e,t)=>e.percentage-t.percentage)}(i);for(const n of t)if(n.percentage>e)return n.color;return null==(n=t[t.length-1])?void 0:n.color}};return(e,t)=>(jo(),qo("div",{class:oe([an(i).b(),an(i).m(e.type),an(i).is(e.status),{[an(i).m("without-text")]:!e.showText,[an(i).m("text-inside")]:e.textInside}]),role:"progressbar","aria-valuenow":e.percentage,"aria-valuemin":"0","aria-valuemax":"100"},["line"===e.type?(jo(),qo("div",{key:0,class:oe(an(i).b("bar"))},[na("div",{class:oe(an(i).be("bar","outer")),style:te({height:`${e.strokeWidth}px`})},[na("div",{class:oe([an(i).be("bar","inner"),{[an(i).bem("bar","inner","indeterminate")]:e.indeterminate},{[an(i).bem("bar","inner","striped")]:e.striped},{[an(i).bem("bar","inner","striped-flow")]:e.stripedFlow}]),style:te(an(r))},[(e.showText||e.$slots.default)&&e.textInside?(jo(),qo("div",{key:0,class:oe(an(i).be("bar","innerText"))},[Xr(e.$slots,"default",{percentage:e.percentage},()=>[na("span",null,Ee(an(g)),1)])],2)):ua("v-if",!0)],6)],6)],2)):(jo(),qo("div",{key:1,class:oe(an(i).b("circle")),style:te({height:`${e.width}px`,width:`${e.width}px`})},[(jo(),qo("svg",{viewBox:"0 0 100 100"},[na("path",{class:oe(an(i).be("circle","track")),d:an(a),stroke:`var(${an(i).cssVarName("fill-color-light")}, #e5e9f2)`,"stroke-linecap":e.strokeLinecap,"stroke-width":an(s),fill:"none",style:te(an(d))},null,14,["d","stroke","stroke-linecap","stroke-width"]),na("path",{class:oe(an(i).be("circle","path")),d:an(a),stroke:an(p),fill:"none",opacity:e.percentage?1:0,"stroke-linecap":e.strokeLinecap,"stroke-width":an(s),style:te(an(h))},null,14,["d","stroke","opacity","stroke-linecap","stroke-width"])]))],6)),!e.showText&&!e.$slots.default||e.textInside?ua("v-if",!0):(jo(),qo("div",{key:2,class:oe(an(i).e("text")),style:te({fontSize:`${an(m)}px`})},[Xr(e.$slots,"default",{percentage:e.percentage},()=>[e.status?(jo(),Ko(an(NE),{key:1},{default:mi(()=>[(jo(),Ko(Vr(an(f))))]),_:1})):(jo(),qo("span",{key:0},Ee(an(g)),1))])],6))],10,["aria-valuenow"]))}});const EM=ox(AE(xM,[["__file","progress.vue"]]));class wM extends Error{constructor(e,t,n,i){super(e),this.name="UploadAjaxError",this.status=t,this.method=n,this.url=i}}function IM(e,t,n){let i;return i=n.response?`${n.response.error||n.response}`:n.responseText?`${n.responseText}`:`fail to ${t.method} ${e} ${n.status}`,new wM(i,n.status,t.method,e)}const AM=["text","picture","picture-card"];let SM=1;const CM=()=>Date.now()+SM++,OM=HT({action:{type:String,default:"#"},headers:{type:Object},method:{type:String,default:"post"},data:{type:[Object,Function,Promise],default:()=>({})},multiple:Boolean,name:{type:String,default:"file"},drag:Boolean,withCredentials:Boolean,showFileList:{type:Boolean,default:!0},accept:{type:String,default:""},fileList:{type:Array,default:()=>[]},autoUpload:{type:Boolean,default:!0},listType:{type:String,values:AM,default:"text"},httpRequest:{type:Function,default:e=>{"undefined"==typeof XMLHttpRequest&&KE("ElUpload","XMLHttpRequest is undefined");const t=new XMLHttpRequest,n=e.action;t.upload&&t.upload.addEventListener("progress",t=>{const n=t;n.percent=t.total>0?t.loaded/t.total*100:0,e.onProgress(n)});const i=new FormData;if(e.data)for(const[t,n]of Object.entries(e.data))E(n)&&n.length?i.append(t,...n):i.append(t,n);i.append(e.filename,e.file,e.file.name),t.addEventListener("error",()=>{e.onError(IM(n,e,t))}),t.addEventListener("load",()=>{if(t.status<200||t.status>=300)return e.onError(IM(n,e,t));e.onSuccess(function(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}(t))}),t.open(e.method,n,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const r=e.headers||{};if(r instanceof Headers)r.forEach((e,n)=>t.setRequestHeader(n,e));else for(const[e,n]of Object.entries(r))TI(n)||t.setRequestHeader(e,String(n));return t.send(i),t}},disabled:Boolean,limit:Number}),MM=HT({...OM,beforeUpload:{type:Function,default:m},beforeRemove:{type:Function},onRemove:{type:Function,default:m},onChange:{type:Function,default:m},onPreview:{type:Function,default:m},onSuccess:{type:Function,default:m},onProgress:{type:Function,default:m},onError:{type:Function,default:m},onExceed:{type:Function,default:m},crossorigin:{type:String}}),RM=HT({files:{type:Array,default:()=>[]},disabled:Boolean,handlePreview:{type:Function,default:m},listType:{type:String,values:AM,default:"text"},crossorigin:{type:String}}),kM=Yi({name:"ElUploadList"}),NM=Yi({...kM,props:RM,emits:{remove:e=>!!e},setup(e,{emit:t}){const n=e,{t:i}=VT(),r=Bv("upload"),s=Bv("icon"),o=Bv("list"),a=Lw(),l=tn(!1),u=za(()=>[r.b("list"),r.bm("list",n.listType),r.is("disabled",n.disabled)]),c=e=>{t("remove",e)};return(e,t)=>(jo(),Ko(uu,{tag:"ul",class:oe(an(u)),name:an(o).b()},{default:mi(()=>[(jo(!0),qo(Po,null,Hr(e.files,(t,n)=>(jo(),qo("li",{key:t.uid||t.name,class:oe([an(r).be("list","item"),an(r).is(t.status),{focusing:l.value}]),tabindex:"0",onKeydown:ku(e=>!an(a)&&c(t),["delete"]),onFocus:e=>l.value=!0,onBlur:e=>l.value=!1,onClick:e=>l.value=!1},[Xr(e.$slots,"default",{file:t,index:n},()=>["picture"===e.listType||"uploading"!==t.status&&"picture-card"===e.listType?(jo(),qo("img",{key:0,class:oe(an(r).be("list","item-thumbnail")),src:t.url,crossorigin:e.crossorigin,alt:""},null,10,["src","crossorigin"])):ua("v-if",!0),"uploading"===t.status||"picture-card"!==e.listType?(jo(),qo("div",{key:1,class:oe(an(r).be("list","item-info"))},[na("a",{class:oe(an(r).be("list","item-name")),onClick:Mu(n=>e.handlePreview(t),["prevent"])},[ia(an(NE),{class:oe(an(s).m("document"))},{default:mi(()=>[ia(an(Lx))]),_:1},8,["class"]),na("span",{class:oe(an(r).be("list","item-file-name")),title:t.name},Ee(t.name),11,["title"])],10,["onClick"]),"uploading"===t.status?(jo(),Ko(an(EM),{key:0,type:"picture-card"===e.listType?"circle":"line","stroke-width":"picture-card"===e.listType?6:2,percentage:Number(t.percentage),style:te("picture-card"===e.listType?"":"margin-top: 0.5rem")},null,8,["type","stroke-width","percentage","style"])):ua("v-if",!0)],2)):ua("v-if",!0),na("label",{class:oe(an(r).be("list","item-status-label"))},["text"===e.listType?(jo(),Ko(an(NE),{key:0,class:oe([an(s).m("upload-success"),an(s).m("circle-check")])},{default:mi(()=>[ia(an(xx))]),_:1},8,["class"])):["picture-card","picture"].includes(e.listType)?(jo(),Ko(an(NE),{key:1,class:oe([an(s).m("upload-success"),an(s).m("check")])},{default:mi(()=>[ia(an(bx))]),_:1},8,["class"])):ua("v-if",!0)],2),an(a)?ua("v-if",!0):(jo(),Ko(an(NE),{key:2,class:oe(an(s).m("close")),onClick:e=>c(t)},{default:mi(()=>[ia(an(kx))]),_:2},1032,["class","onClick"])),ua(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),ua(" This is a bug which needs to be fixed "),ua(" TODO: Fix the incorrect navigation interaction "),an(a)?ua("v-if",!0):(jo(),qo("i",{key:3,class:oe(an(s).m("close-tip"))},Ee(an(i)("el.upload.deleteTip")),3)),"picture-card"===e.listType?(jo(),qo("span",{key:4,class:oe(an(r).be("list","item-actions"))},[na("span",{class:oe(an(r).be("list","item-preview")),onClick:n=>e.handlePreview(t)},[ia(an(NE),{class:oe(an(s).m("zoom-in"))},{default:mi(()=>[ia(an(nE))]),_:1},8,["class"])],10,["onClick"]),an(a)?ua("v-if",!0):(jo(),qo("span",{key:0,class:oe(an(r).be("list","item-delete")),onClick:e=>c(t)},[ia(an(NE),{class:oe(an(s).m("delete"))},{default:mi(()=>[ia(an(Dx))]),_:1},8,["class"])],10,["onClick"]))],2)):ua("v-if",!0)])],42,["onKeydown","onFocus","onBlur","onClick"]))),128)),Xr(e.$slots,"append")]),_:3},8,["class","name"]))}});var DM=AE(NM,[["__file","upload-list.vue"]]);const FM=function(){this.__data__=new pT,this.size=0};const LM=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};const PM=function(e){return this.__data__.get(e)};const BM=function(e){return this.__data__.has(e)};const $M=function(e,t){var n=this.__data__;if(n instanceof pT){var i=n.__data__;if(!fT||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new ET(i)}return n.set(e,t),this.size=n.size,this};function UM(e){var t=this.__data__=new pT(e);this.size=t.size}UM.prototype.clear=FM,UM.prototype.delete=LM,UM.prototype.get=PM,UM.prototype.has=BM,UM.prototype.set=$M;const zM=UM;const VM=function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););return e};const jM=function(e,t,n,i){var r=!n;n||(n={});for(var s=-1,o=t.length;++s<o;){var a=t[s],l=i?i(n[a],e[a],a,n,e):void 0;void 0===l&&(l=e[a]),r?SI(n,a,l):OI(n,a,l)}return n};const YM=function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i};const GM=function(){return!1};var HM="object"==typeof exports&&exports&&!exports.nodeType&&exports,WM=HM&&"object"==typeof module&&module&&!module.nodeType&&module,XM=WM&&WM.exports===HM?gb.Buffer:void 0;const qM=(XM?XM.isBuffer:void 0)||GM;var KM={};KM["[object Float32Array]"]=KM["[object Float64Array]"]=KM["[object Int8Array]"]=KM["[object Int16Array]"]=KM["[object Int32Array]"]=KM["[object Uint8Array]"]=KM["[object Uint8ClampedArray]"]=KM["[object Uint16Array]"]=KM["[object Uint32Array]"]=!0,KM["[object Arguments]"]=KM["[object Array]"]=KM["[object ArrayBuffer]"]=KM["[object Boolean]"]=KM["[object DataView]"]=KM["[object Date]"]=KM["[object Error]"]=KM["[object Function]"]=KM["[object Map]"]=KM["[object Number]"]=KM["[object Object]"]=KM["[object RegExp]"]=KM["[object Set]"]=KM["[object String]"]=KM["[object WeakMap]"]=!1;const ZM=function(e){return Sb(e)&&UI(e.length)&&!!KM[Ab(e)]};const QM=function(e){return function(t){return e(t)}};var JM="object"==typeof exports&&exports&&!exports.nodeType&&exports,eR=JM&&"object"==typeof module&&module&&!module.nodeType&&module,tR=eR&&eR.exports===JM&&fb.process,nR=function(){try{var e=eR&&eR.require&&eR.require("util").types;return e||tR&&tR.binding&&tR.binding("util")}catch(e){}}();const iR=nR;var rR=iR&&iR.isTypedArray;const sR=rR?QM(rR):ZM;var oR=Object.prototype.hasOwnProperty;const aR=function(e,t){var n=pb(e),i=!n&&$I(e),r=!n&&!i&&qM(e),s=!n&&!i&&!r&&sR(e),o=n||i||r||s,a=o?YM(e.length,String):[],l=a.length;for(var u in e)!t&&!oR.call(e,u)||o&&("length"==u||r&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||RI(u,l))||a.push(u);return a};var lR=Object.prototype;const uR=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||lR)};const cR=function(e,t){return function(n){return e(t(n))}};const dR=cR(Object.keys,Object);var hR=Object.prototype.hasOwnProperty;const pR=function(e){if(!uR(e))return dR(e);var t=[];for(var n in Object(e))hR.call(e,n)&&"constructor"!=n&&t.push(n);return t};const fR=function(e){return null!=e&&UI(e.length)&&!Nb(e)};const mR=function(e){return fR(e)?aR(e):pR(e)};const gR=function(e,t){return e&&jM(t,mR(t),e)};const yR=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t};var _R=Object.prototype.hasOwnProperty;const vR=function(e){if(!kb(e))return yR(e);var t=uR(e),n=[];for(var i in e)("constructor"!=i||!t&&_R.call(e,i))&&n.push(i);return n};const bR=function(e){return fR(e)?aR(e,!0):vR(e)};const TR=function(e,t){return e&&jM(t,bR(t),e)};var xR="object"==typeof exports&&exports&&!exports.nodeType&&exports,ER=xR&&"object"==typeof module&&module&&!module.nodeType&&module,wR=ER&&ER.exports===xR?gb.Buffer:void 0,IR=wR?wR.allocUnsafe:void 0;const AR=function(e,t){if(t)return e.slice();var n=e.length,i=IR?IR(n):new e.constructor(n);return e.copy(i),i};const SR=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t};const CR=function(e,t){for(var n=-1,i=null==e?0:e.length,r=0,s=[];++n<i;){var o=e[n];t(o,n,e)&&(s[r++]=o)}return s};const OR=function(){return[]};var MR=Object.prototype.propertyIsEnumerable,RR=Object.getOwnPropertySymbols;const kR=RR?function(e){return null==e?[]:(e=Object(e),CR(RR(e),function(t){return MR.call(e,t)}))}:OR;const NR=function(e,t){return jM(e,kR(e),t)};const DR=cR(Object.getPrototypeOf,Object);const FR=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)YI(t,kR(e)),e=DR(e);return t}:OR;const LR=function(e,t){return jM(e,FR(e),t)};const PR=function(e,t,n){var i=t(e);return pb(e)?i:YI(i,n(e))};const BR=function(e){return PR(e,mR,kR)};const $R=function(e){return PR(e,bR,FR)};const UR=Wb(gb,"DataView");const zR=Wb(gb,"Promise");const VR=Wb(gb,"Set");const jR=Wb(gb,"WeakMap");var YR="[object Map]",GR="[object Promise]",HR="[object Set]",WR="[object WeakMap]",XR="[object DataView]",qR=Bb(UR),KR=Bb(fT),ZR=Bb(zR),QR=Bb(VR),JR=Bb(jR),ek=Ab;(UR&&ek(new UR(new ArrayBuffer(1)))!=XR||fT&&ek(new fT)!=YR||zR&&ek(zR.resolve())!=GR||VR&&ek(new VR)!=HR||jR&&ek(new jR)!=WR)&&(ek=function(e){var t=Ab(e),n="[object Object]"==t?e.constructor:void 0,i=n?Bb(n):"";if(i)switch(i){case qR:return XR;case KR:return YR;case ZR:return GR;case QR:return HR;case JR:return WR}return t});const tk=ek;var nk=Object.prototype.hasOwnProperty;const ik=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&nk.call(e,"index")&&(n.index=e.index,n.input=e.input),n};const rk=gb.Uint8Array;const sk=function(e){var t=new e.constructor(e.byteLength);return new rk(t).set(new rk(e)),t};const ok=function(e,t){var n=t?sk(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)};var ak=/\w*$/;const lk=function(e){var t=new e.constructor(e.source,ak.exec(e));return t.lastIndex=e.lastIndex,t};var uk=yb?yb.prototype:void 0,ck=uk?uk.valueOf:void 0;const dk=function(e){return ck?Object(ck.call(e)):{}};const hk=function(e,t){var n=t?sk(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};const pk=function(e,t,n){var i=e.constructor;switch(t){case"[object ArrayBuffer]":return sk(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return ok(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return hk(e,n);case"[object Map]":case"[object Set]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return lk(e);case"[object Symbol]":return dk(e)}};var fk=Object.create;const mk=function(){function e(){}return function(t){if(!kb(t))return{};if(fk)return fk(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();const gk=function(e){return"function"!=typeof e.constructor||uR(e)?{}:mk(DR(e))};const yk=function(e){return Sb(e)&&"[object Map]"==tk(e)};var _k=iR&&iR.isMap;const vk=_k?QM(_k):yk;const bk=function(e){return Sb(e)&&"[object Set]"==tk(e)};var Tk=iR&&iR.isSet;const xk=Tk?QM(Tk):bk;var Ek="[object Arguments]",wk="[object Function]",Ik="[object Object]",Ak={};Ak[Ek]=Ak["[object Array]"]=Ak["[object ArrayBuffer]"]=Ak["[object DataView]"]=Ak["[object Boolean]"]=Ak["[object Date]"]=Ak["[object Float32Array]"]=Ak["[object Float64Array]"]=Ak["[object Int8Array]"]=Ak["[object Int16Array]"]=Ak["[object Int32Array]"]=Ak["[object Map]"]=Ak["[object Number]"]=Ak[Ik]=Ak["[object RegExp]"]=Ak["[object Set]"]=Ak["[object String]"]=Ak["[object Symbol]"]=Ak["[object Uint8Array]"]=Ak["[object Uint8ClampedArray]"]=Ak["[object Uint16Array]"]=Ak["[object Uint32Array]"]=!0,Ak["[object Error]"]=Ak[wk]=Ak["[object WeakMap]"]=!1;const Sk=function e(t,n,i,r,s,o){var a,l=1&n,u=2&n,c=4&n;if(i&&(a=s?i(t,r,s,o):i(t)),void 0!==a)return a;if(!kb(t))return t;var d=pb(t);if(d){if(a=ik(t),!l)return SR(t,a)}else{var h=tk(t),p=h==wk||"[object GeneratorFunction]"==h;if(qM(t))return AR(t,l);if(h==Ik||h==Ek||p&&!s){if(a=u||p?{}:gk(t),!l)return u?LR(t,TR(a,t)):NR(t,gR(a,t))}else{if(!Ak[h])return s?t:{};a=pk(t,h,l)}}o||(o=new zM);var f=o.get(t);if(f)return f;o.set(t,a),xk(t)?t.forEach(function(r){a.add(e(r,n,i,r,t,o))}):vk(t)&&t.forEach(function(r,s){a.set(s,e(r,n,i,s,t,o))});var m=d?void 0:(c?u?$R:BR:u?bR:mR)(t);return VM(m||t,function(r,s){m&&(r=t[s=r]),OI(a,s,e(r,n,i,s,t,o))}),a};const Ck=function(e){return Sk(e,5)};const Ok=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const Mk=function(e){return this.__data__.has(e)};function Rk(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ET;++t<n;)this.add(e[t])}Rk.prototype.add=Rk.prototype.push=Ok,Rk.prototype.has=Mk;const kk=Rk;const Nk=function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1};const Dk=function(e,t){return e.has(t)};const Fk=function(e,t,n,i,r,s){var o=1&n,a=e.length,l=t.length;if(a!=l&&!(o&&l>a))return!1;var u=s.get(e),c=s.get(t);if(u&&c)return u==t&&c==e;var d=-1,h=!0,p=2&n?new kk:void 0;for(s.set(e,t),s.set(t,e);++d<a;){var f=e[d],m=t[d];if(i)var g=o?i(m,f,d,t,e,s):i(f,m,d,e,t,s);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!Nk(t,function(e,t){if(!Dk(p,t)&&(f===e||r(f,e,n,i,s)))return p.push(t)})){h=!1;break}}else if(f!==m&&!r(f,m,n,i,s)){h=!1;break}}return s.delete(e),s.delete(t),h};const Lk=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,i){n[++t]=[i,e]}),n};const Pk=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n};var Bk=yb?yb.prototype:void 0,$k=Bk?Bk.valueOf:void 0;const Uk=function(e,t,n,i,r,s,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new rk(e),new rk(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return sT(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Lk;case"[object Set]":var l=1&i;if(a||(a=Pk),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;i|=2,o.set(e,t);var c=Fk(a(e),a(t),i,r,s,o);return o.delete(e),c;case"[object Symbol]":if($k)return $k.call(e)==$k.call(t)}return!1};var zk=Object.prototype.hasOwnProperty;const Vk=function(e,t,n,i,r,s){var o=1&n,a=BR(e),l=a.length;if(l!=BR(t).length&&!o)return!1;for(var u=l;u--;){var c=a[u];if(!(o?c in t:zk.call(t,c)))return!1}var d=s.get(e),h=s.get(t);if(d&&h)return d==t&&h==e;var p=!0;s.set(e,t),s.set(t,e);for(var f=o;++u<l;){var m=e[c=a[u]],g=t[c];if(i)var y=o?i(g,m,c,t,e,s):i(m,g,c,e,t,s);if(!(void 0===y?m===g||r(m,g,n,i,s):y)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){var _=e.constructor,v=t.constructor;_==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof v&&v instanceof v||(p=!1)}return s.delete(e),s.delete(t),p};var jk="[object Arguments]",Yk="[object Array]",Gk="[object Object]",Hk=Object.prototype.hasOwnProperty;const Wk=function(e,t,n,i,r,s){var o=pb(e),a=pb(t),l=o?Yk:tk(e),u=a?Yk:tk(t),c=(l=l==jk?Gk:l)==Gk,d=(u=u==jk?Gk:u)==Gk,h=l==u;if(h&&qM(e)){if(!qM(t))return!1;o=!0,c=!1}if(h&&!c)return s||(s=new zM),o||sR(e)?Fk(e,t,n,i,r,s):Uk(e,t,l,n,i,r,s);if(!(1&n)){var p=c&&Hk.call(e,"__wrapped__"),f=d&&Hk.call(t,"__wrapped__");if(p||f){var m=p?e.value():e,g=f?t.value():t;return s||(s=new zM),r(m,g,n,i,s)}}return!!h&&(s||(s=new zM),Vk(e,t,n,i,r,s))};const Xk=function e(t,n,i,r,s){return t===n||(null==t||null==n||!Sb(t)&&!Sb(n)?t!=t&&n!=n:Wk(t,n,i,r,e,s))};const qk=function(e,t){return Xk(e,t)},Kk=HT({disabled:Boolean}),Zk={file:e=>E(e)},Qk="ElUploadDrag",Jk=Yi({name:Qk}),eN=Yi({...Jk,props:Kk,emits:Zk,setup(e,{emit:t}){Ds(vM)||KE(Qk,"usage: <el-upload><el-upload-dragger /></el-upload>");const n=Bv("upload"),i=tn(!1),r=Lw(),s=e=>{if(r.value)return;i.value=!1,e.stopPropagation();const n=Array.from(e.dataTransfer.files),s=e.dataTransfer.items||[];n.forEach((e,t)=>{var n;const i=s[t],r=null==(n=null==i?void 0:i.webkitGetAsEntry)?void 0:n.call(i);r&&(e.isDirectory=r.isDirectory)}),t("file",n)},o=()=>{r.value||(i.value=!0)},a=e=>{e.currentTarget.contains(e.relatedTarget)||(i.value=!1)};return(e,t)=>(jo(),qo("div",{class:oe([an(n).b("dragger"),an(n).is("dragover",i.value)]),onDrop:Mu(s,["prevent"]),onDragover:Mu(o,["prevent"]),onDragleave:Mu(a,["prevent"])},[Xr(e.$slots,"default")],42,["onDrop","onDragover","onDragleave"]))}});var tN=AE(eN,[["__file","upload-dragger.vue"]]);const nN=HT({...OM,beforeUpload:{type:Function,default:m},onRemove:{type:Function,default:m},onStart:{type:Function,default:m},onSuccess:{type:Function,default:m},onProgress:{type:Function,default:m},onError:{type:Function,default:m},onExceed:{type:Function,default:m}}),iN=Yi({name:"ElUploadContent",inheritAttrs:!1}),rN=Yi({...iN,props:nN,setup(e,{expose:t}){const n=e,i=Bv("upload"),r=Lw(),s=nn({}),o=nn(),a=e=>{if(0===e.length)return;const{autoUpload:t,limit:i,fileList:r,multiple:s,onStart:o,onExceed:a}=n;if(i&&r.length+e.length>i)a(e,r);else{s||(e=e.slice(0,1));for(const n of e){const e=n;e.uid=CM(),o(e),t&&l(e)}}},l=async e=>{if(o.value.value="",!n.beforeUpload)return u(e);let t,i={};try{const r=n.data,s=n.beforeUpload(e);i=F(n.data)?Ck(n.data):n.data,t=await s,F(n.data)&&qk(r,i)&&(i=Ck(n.data))}catch(e){t=!1}if(!1===t)return void n.onRemove(e);let r=e;t instanceof Blob&&(r=t instanceof File?t:new File([t],e.name,{type:e.type})),u(Object.assign(r,{uid:e.uid}),i)},u=async(e,t)=>{const{headers:i,data:r,method:o,withCredentials:a,name:l,action:u,onProgress:c,onSuccess:d,onError:h,httpRequest:p}=n;try{t=await(async(e,t)=>S(e)?e(t):e)(null!=t?t:r,e)}catch(t){return void n.onRemove(e)}const{uid:f}=e,m={headers:i||{},withCredentials:a,file:e,data:t,method:o,filename:l,action:u,onProgress:t=>{c(t,e)},onSuccess:t=>{d(t,e),delete s.value[f]},onError:t=>{h(t,e),delete s.value[f]}},g=p(m);s.value[f]=g,g instanceof Promise&&g.then(m.onSuccess,m.onError)},c=e=>{const t=e.target.files;t&&a(Array.from(t))},d=()=>{r.value||(o.value.value="",o.value.click())},h=()=>{d()};return t({abort:e=>{const t=(n=s.value,Object.entries(n)).filter(e?([t])=>String(e.uid)===t:()=>!0);var n;t.forEach(([e,t])=>{t instanceof XMLHttpRequest&&t.abort(),delete s.value[e]})},upload:l}),(e,t)=>(jo(),qo("div",{class:oe([an(i).b(),an(i).m(e.listType),an(i).is("drag",e.drag),an(i).is("disabled",an(r))]),tabindex:an(r)?"-1":"0",onClick:d,onKeydown:ku(Mu(h,["self"]),["enter","space"])},[e.drag?(jo(),Ko(tN,{key:0,disabled:an(r),onFile:a},{default:mi(()=>[Xr(e.$slots,"default")]),_:3},8,["disabled"])):Xr(e.$slots,"default",{key:1}),na("input",{ref_key:"inputRef",ref:o,class:oe(an(i).e("input")),name:e.name,disabled:an(r),multiple:e.multiple,accept:e.accept,type:"file",onChange:c,onClick:Mu(()=>{},["stop"])},null,42,["name","disabled","multiple","accept","onClick"])],42,["tabindex","onKeydown"]))}});var sN=AE(rN,[["__file","upload-content.vue"]]);const oN="ElUpload",aN=e=>{var t;(null==(t=e.url)?void 0:t.startsWith("blob:"))&&URL.revokeObjectURL(e.url)},lN=(e,t)=>{const n=wE(e,"fileList",void 0,{passive:!0}),i=e=>n.value.find(t=>t.uid===e.uid);function r(e){var n;null==(n=t.value)||n.abort(e)}function s(e){n.value=n.value.filter(t=>t.uid!==e.uid)}return fo(()=>e.listType,t=>{"picture-card"!==t&&"picture"!==t||(n.value=n.value.map(t=>{const{raw:i,url:r}=t;if(!r&&i)try{t.url=URL.createObjectURL(i)}catch(i){e.onError(i,t,n.value)}return t}))}),fo(n,e=>{for(const t of e)t.uid||(t.uid=CM()),t.status||(t.status="success")},{immediate:!0,deep:!0}),{uploadFiles:n,abort:r,clearFiles:function(e=["ready","uploading","success","fail"]){n.value=n.value.filter(t=>!e.includes(t.status))},handleError:(t,r)=>{const o=i(r);o&&(console.error(t),o.status="fail",s(o),e.onError(t,o,n.value),e.onChange(o,n.value))},handleProgress:(t,r)=>{const s=i(r);s&&(e.onProgress(t,s,n.value),s.status="uploading",s.percentage=Math.round(t.percent))},handleStart:t=>{TI(t.uid)&&(t.uid=CM());const i={name:t.name,percentage:0,status:"ready",size:t.size,raw:t,uid:t.uid};if("picture-card"===e.listType||"picture"===e.listType)try{i.url=URL.createObjectURL(t)}catch(t){t.message,e.onError(t,i,n.value)}n.value=[...n.value,i],e.onChange(i,n.value)},handleSuccess:(t,r)=>{const s=i(r);s&&(s.status="success",s.response=t,e.onSuccess(t,s,n.value),e.onChange(s,n.value))},handleRemove:async t=>{const o=t instanceof File?i(t):t;o||KE(oN,"file to be removed not found");const a=t=>{r(t),s(t),e.onRemove(t,n.value),aN(t)};if(e.beforeRemove){!1!==await e.beforeRemove(o,n.value)&&a(o)}else a(o)},submit:function(){n.value.filter(({status:e})=>"ready"===e).forEach(({raw:e})=>{var n;return e&&(null==(n=t.value)?void 0:n.upload(e))})},revokeFileObjectURL:aN}},uN=Yi({name:"ElUpload"}),cN=Yi({...uN,props:MM,setup(e,{expose:t}){const n=e,i=Lw(),r=nn(),{abort:s,submit:o,clearFiles:a,uploadFiles:l,handleStart:u,handleError:c,handleRemove:d,handleSuccess:h,handleProgress:p,revokeFileObjectURL:f}=lN(n,r),m=za(()=>"picture-card"===n.listType),g=za(()=>({...n,fileList:l.value,onStart:u,onProgress:p,onSuccess:h,onError:c,onRemove:d}));return kr(()=>{l.value.forEach(f)}),Ns(vM,{accept:gn(n,"accept")}),t({abort:s,submit:o,clearFiles:a,handleStart:u,handleRemove:d}),(e,t)=>(jo(),qo("div",null,[an(m)&&e.showFileList?(jo(),Ko(DM,{key:0,disabled:an(i),"list-type":e.listType,files:an(l),crossorigin:e.crossorigin,"handle-preview":e.onPreview,onRemove:an(d)},Wr({append:mi(()=>[ia(sN,pa({ref_key:"uploadRef",ref:r},an(g)),{default:mi(()=>[e.$slots.trigger?Xr(e.$slots,"trigger",{key:0}):ua("v-if",!0),!e.$slots.trigger&&e.$slots.default?Xr(e.$slots,"default",{key:1}):ua("v-if",!0)]),_:3},16)]),_:2},[e.$slots.file?{name:"default",fn:mi(({file:t,index:n})=>[Xr(e.$slots,"file",{file:t,index:n})])}:void 0]),1032,["disabled","list-type","files","crossorigin","handle-preview","onRemove"])):ua("v-if",!0),!an(m)||an(m)&&!e.showFileList?(jo(),Ko(sN,pa({key:1,ref_key:"uploadRef",ref:r},an(g)),{default:mi(()=>[e.$slots.trigger?Xr(e.$slots,"trigger",{key:0}):ua("v-if",!0),!e.$slots.trigger&&e.$slots.default?Xr(e.$slots,"default",{key:1}):ua("v-if",!0)]),_:3},16)):ua("v-if",!0),e.$slots.trigger?Xr(e.$slots,"default",{key:2}):ua("v-if",!0),Xr(e.$slots,"tip"),!an(m)&&e.showFileList?(jo(),Ko(DM,{key:3,disabled:an(i),"list-type":e.listType,files:an(l),crossorigin:e.crossorigin,"handle-preview":e.onPreview,onRemove:an(d)},Wr({_:2},[e.$slots.file?{name:"default",fn:mi(({file:t,index:n})=>[Xr(e.$slots,"file",{file:t,index:n})])}:void 0]),1032,["disabled","list-type","files","crossorigin","handle-preview","onRemove"])):ua("v-if",!0)]))}});const dN=ox(AE(cN,[["__file","upload.vue"]]));const hN=function(){return gb.Date.now()};var pN=/\s/;const fN=function(e){for(var t=e.length;t--&&pN.test(e.charAt(t)););return t};var mN=/^\s+/;const gN=function(e){return e?e.slice(0,fN(e)+1).replace(mN,""):e};var yN=/^[-+]0x[0-9a-f]+$/i,_N=/^0b[01]+$/i,vN=/^0o[0-7]+$/i,bN=parseInt;const TN=function(e){if("number"==typeof e)return e;if(Cb(e))return NaN;if(kb(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=kb(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=gN(e);var n=_N.test(e);return n||vN.test(e)?bN(e.slice(2),n?2:8):yN.test(e)?NaN:+e};var xN=Math.max,EN=Math.min;const wN=function(e,t,n){var i,r,s,o,a,l,u=0,c=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var n=i,s=r;return i=r=void 0,u=t,o=e.apply(s,n)}function f(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-u>=s}function m(){var e=hN();if(f(e))return g(e);a=setTimeout(m,function(e){var n=t-(e-l);return d?EN(n,s-(e-u)):n}(e))}function g(e){return a=void 0,h&&i?p(e):(i=r=void 0,o)}function y(){var e=hN(),n=f(e);if(i=arguments,r=this,l=e,n){if(void 0===a)return function(e){return u=e,a=setTimeout(m,t),c?p(e):o}(l);if(d)return clearTimeout(a),a=setTimeout(m,t),p(l)}return void 0===a&&(a=setTimeout(m,t)),o}return t=TN(t)||0,kb(n)&&(c=!!n.leading,s=(d="maxWait"in n)?xN(TN(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==a&&clearTimeout(a),u=0,i=l=r=a=void 0},y.flush=function(){return void 0===a?o:g(hN())},y};const IN=function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return kb(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),wN(e,t,{leading:i,maxWait:t,trailing:r})},AN=HT({urlList:{type:Array,default:()=>[]},zIndex:{type:Number},initialIndex:{type:Number,default:0},infinite:{type:Boolean,default:!0},hideOnClickModal:Boolean,teleported:Boolean,closeOnPressEscape:{type:Boolean,default:!0},zoomRate:{type:Number,default:1.2},scale:{type:Number,default:1},minScale:{type:Number,default:.2},maxScale:{type:Number,default:7},showProgress:Boolean,crossorigin:{type:String}}),SN={close:()=>!0,error:e=>e instanceof Event,switch:e=>zv(e),rotate:e=>zv(e)},CN=Yi({name:"ElImageViewer"}),ON=Yi({...CN,props:AN,emits:SN,setup(e,{expose:t,emit:n}){var i;const r=e,s={CONTAIN:{name:"contain",icon:Zt(Ux)},ORIGINAL:{name:"original",icon:Zt(Zx)}};let o,a="";const{t:l}=VT(),u=Bv("image-viewer"),{nextZIndex:c}=hb(),d=tn(),h=tn(),p=Oe(),f=za(()=>{const{scale:e,minScale:t,maxScale:n}=r;return((e,t,n)=>Math.min(n,Math.max(t,e)))(e,t,n)}),m=tn(!0),g=tn(!1),y=tn(r.initialIndex),_=nn(s.CONTAIN),v=tn({scale:f.value,deg:0,offsetX:0,offsetY:0,enableTransition:!1}),b=tn(null!=(i=r.zIndex)?i:c()),T=za(()=>{const{urlList:e}=r;return e.length<=1}),x=za(()=>0===y.value),E=za(()=>y.value===r.urlList.length-1),w=za(()=>r.urlList[y.value]),I=za(()=>[u.e("btn"),u.e("prev"),u.is("disabled",!r.infinite&&x.value)]),A=za(()=>[u.e("btn"),u.e("next"),u.is("disabled",!r.infinite&&E.value)]),S=za(()=>{const{scale:e,deg:t,offsetX:n,offsetY:i,enableTransition:r}=v.value;let o=n/e,a=i/e;const l=t*Math.PI/180,u=Math.cos(l),c=Math.sin(l);o=o*u+a*c,a=a*u-n/e*c;const d={transform:`scale(${e}) rotate(${t}deg) translate(${o}px, ${a}px)`,transition:r?"transform .3s":""};return _.value.name===s.CONTAIN.name&&(d.maxWidth=d.maxHeight="100%"),d}),C=za(()=>`${y.value+1} / ${r.urlList.length}`);function O(){p.stop(),null==o||o(),document.body.style.overflow=a,n("close")}function M(){m.value=!1}function R(e){g.value=!0,m.value=!1,n("error",e),e.target.alt=l("el.image.error")}function k(e){if(m.value||0!==e.button||!d.value)return;v.value.enableTransition=!1;const{offsetX:t,offsetY:n}=v.value,i=e.pageX,r=e.pageY,s=IN(e=>{v.value={...v.value,offsetX:t+e.pageX-i,offsetY:n+e.pageY-r}}),o=oE(document,"mousemove",s);oE(document,"mouseup",()=>{o()}),e.preventDefault()}function N(){v.value={scale:f.value,deg:0,offsetX:0,offsetY:0,enableTransition:!1}}function D(){if(m.value||g.value)return;const e=QT(s),t=Object.values(s),n=_.value.name,i=(t.findIndex(e=>e.name===n)+1)%e.length;_.value=s[e[i]],N()}function F(e){g.value=!1;const t=r.urlList.length;y.value=(e+t)%t}function L(){x.value&&!r.infinite||F(y.value-1)}function P(){E.value&&!r.infinite||F(y.value+1)}function B(e,t={}){if(m.value||g.value)return;const{minScale:i,maxScale:s}=r,{zoomRate:o,rotateDeg:a,enableTransition:l}={zoomRate:r.zoomRate,rotateDeg:90,enableTransition:!0,...t};switch(e){case"zoomOut":v.value.scale>i&&(v.value.scale=Number.parseFloat((v.value.scale/o).toFixed(3)));break;case"zoomIn":v.value.scale<s&&(v.value.scale=Number.parseFloat((v.value.scale*o).toFixed(3)));break;case"clockwise":v.value.deg+=a,n("rotate",v.value.deg);break;case"anticlockwise":v.value.deg-=a,n("rotate",v.value.deg)}v.value.enableTransition=l}function $(e){var t;"pointer"===(null==(t=e.detail)?void 0:t.focusReason)&&e.preventDefault()}function U(){r.closeOnPressEscape&&O()}function z(e){if(e.ctrlKey)return e.deltaY<0||e.deltaY>0?(e.preventDefault(),!1):void 0}return fo(()=>f.value,e=>{v.value.scale=e}),fo(w,()=>{Gn(()=>{const e=h.value;(null==e?void 0:e.complete)||(m.value=!0)})}),fo(y,e=>{N(),n("switch",e)}),Or(()=>{!function(){const e=IN(e=>{switch(e.code){case GE.esc:r.closeOnPressEscape&&O();break;case GE.space:D();break;case GE.left:L();break;case GE.up:B("zoomIn");break;case GE.right:P();break;case GE.down:B("zoomOut")}}),t=IN(e=>{B((e.deltaY||e.deltaX)<0?"zoomIn":"zoomOut",{zoomRate:r.zoomRate,enableTransition:!1})});p.run(()=>{oE(document,"keydown",e),oE(document,"wheel",t)})}(),o=oE("wheel",z,{passive:!1}),a=document.body.style.overflow,document.body.style.overflow="hidden"}),t({setActiveItem:F}),(e,t)=>(jo(),Ko(an(wC),{to:"body",disabled:!e.teleported},{default:mi(()=>[ia(hl,{name:"viewer-fade",appear:""},{default:mi(()=>[na("div",{ref_key:"wrapper",ref:d,tabindex:-1,class:oe(an(u).e("wrapper")),style:te({zIndex:b.value})},[ia(an(ZC),{loop:"",trapped:"","focus-trap-el":d.value,"focus-start-el":"container",onFocusoutPrevented:$,onReleaseRequested:U},{default:mi(()=>[na("div",{class:oe(an(u).e("mask")),onClick:Mu(t=>e.hideOnClickModal&&O(),["self"])},null,10,["onClick"]),ua(" CLOSE "),na("span",{class:oe([an(u).e("btn"),an(u).e("close")]),onClick:O},[ia(an(NE),null,{default:mi(()=>[ia(an(kx))]),_:1})],2),ua(" ARROW "),an(T)?ua("v-if",!0):(jo(),qo(Po,{key:0},[na("span",{class:oe(an(I)),onClick:L},[ia(an(NE),null,{default:mi(()=>[ia(an(hx))]),_:1})],2),na("span",{class:oe(an(A)),onClick:P},[ia(an(NE),null,{default:mi(()=>[ia(an(fx))]),_:1})],2)],64)),e.$slots.progress||e.showProgress?(jo(),qo("div",{key:1,class:oe([an(u).e("btn"),an(u).e("progress")])},[Xr(e.$slots,"progress",{activeIndex:y.value,total:e.urlList.length},()=>[aa(Ee(an(C)),1)])],2)):ua("v-if",!0),ua(" ACTIONS "),na("div",{class:oe([an(u).e("btn"),an(u).e("actions")])},[na("div",{class:oe(an(u).e("actions__inner"))},[Xr(e.$slots,"toolbar",{actions:B,prev:L,next:P,reset:D,activeIndex:y.value,setActiveItem:F},()=>[ia(an(NE),{onClick:e=>B("zoomOut")},{default:mi(()=>[ia(an(iE))]),_:1},8,["onClick"]),ia(an(NE),{onClick:e=>B("zoomIn")},{default:mi(()=>[ia(an(nE))]),_:1},8,["onClick"]),na("i",{class:oe(an(u).e("actions__divider"))},null,2),ia(an(NE),{onClick:D},{default:mi(()=>[(jo(),Ko(Vr(an(_).icon)))]),_:1}),na("i",{class:oe(an(u).e("actions__divider"))},null,2),ia(an(NE),{onClick:e=>B("anticlockwise")},{default:mi(()=>[ia(an(qx))]),_:1},8,["onClick"]),ia(an(NE),{onClick:e=>B("clockwise")},{default:mi(()=>[ia(an(Kx))]),_:1},8,["onClick"])])],2)],2),ua(" CANVAS "),na("div",{class:oe(an(u).e("canvas"))},[g.value&&e.$slots["viewer-error"]?Xr(e.$slots,"viewer-error",{key:0,activeIndex:y.value,src:an(w)}):(jo(),qo("img",{ref_key:"imgRef",ref:h,key:an(w),src:an(w),style:te(an(S)),class:oe(an(u).e("img")),crossorigin:e.crossorigin,onLoad:M,onError:R,onMousedown:k},null,46,["src","crossorigin"]))],2),Xr(e.$slots,"default")]),_:3},8,["focus-trap-el"])],6)]),_:3})]),_:3},8,["disabled"]))}});const MN=ox(AE(ON,[["__file","image-viewer.vue"]])),RN=HT({hideOnClickModal:Boolean,src:{type:String,default:""},fit:{type:String,values:["","contain","cover","fill","none","scale-down"],default:""},loading:{type:String,values:["eager","lazy"]},lazy:Boolean,scrollContainer:{type:[String,Object]},previewSrcList:{type:Array,default:()=>[]},previewTeleported:Boolean,zIndex:{type:Number},initialIndex:{type:Number,default:0},infinite:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},zoomRate:{type:Number,default:1.2},scale:{type:Number,default:1},minScale:{type:Number,default:.2},maxScale:{type:Number,default:7},showProgress:Boolean,crossorigin:{type:String}}),kN={load:e=>e instanceof Event,error:e=>e instanceof Event,switch:e=>zv(e),close:()=>!0,show:()=>!0},NN=(e,t)=>{if(!Qv)return!1;const n=((e,t)=>{var n;if(!Qv||!e||!t)return"";let i=V(t);"float"===i&&(i="cssFloat");try{const t=e.style[i];if(t)return t;const r=null==(n=document.defaultView)?void 0:n.getComputedStyle(e,"");return r?r[i]:""}catch(t){return e.style[i]}})(e,{undefined:"overflow",true:"overflow-y",false:"overflow-x"}[String(t)]);return["scroll","auto","overlay"].some(e=>n.includes(e))};const DN=Yi({name:"ElImage",inheritAttrs:!1}),FN=Yi({...DN,props:RN,emits:kN,setup(e,{expose:t,emit:n}){const i=e,{t:r}=VT(),s=Bv("image"),o=cs(),a=za(()=>jT(Object.entries(o).filter(([e])=>/^(data-|on[A-Z])/i.test(e)||["id","style"].includes(e)))),l=pA({excludeListeners:!0,excludeKeys:za(()=>Object.keys(a.value))}),u=tn(),c=tn(!1),d=tn(!0),h=tn(!1),p=tn(),f=tn(),m=Qv&&"loading"in HTMLImageElement.prototype;let g;const y=za(()=>[s.e("inner"),v.value&&s.e("preview"),d.value&&s.is("loading")]),_=za(()=>{const{fit:e}=i;return Qv&&e?{objectFit:e}:{}}),v=za(()=>{const{previewSrcList:e}=i;return E(e)&&e.length>0}),b=za(()=>{const{previewSrcList:e,initialIndex:t}=i;let n=t;return t>e.length-1&&(n=0),n}),T=za(()=>"eager"!==i.loading&&(!m&&"lazy"===i.loading||i.lazy)),x=()=>{Qv&&(d.value=!0,c.value=!1,u.value=i.src)};function w(e){d.value=!1,c.value=!1,n("load",e)}function I(e){d.value=!1,c.value=!0,n("error",e)}const A=ob(function(e){e&&(x(),O())},200,!0);async function S(){var e;if(!Qv)return;await Gn();const{scrollContainer:t}=i;if(Vv(t))f.value=t;else if(C(t)&&""!==t)f.value=null!=(e=document.querySelector(t))?e:void 0;else if(p.value){const e=((e,t)=>{if(!Qv)return;let n=e;for(;n;){if([window,document,document.documentElement].includes(n))return window;if(NN(n,t))return n;n=n.parentNode}return n})(p.value);f.value=e===window?void 0:e}const{stop:n}=function(e,t,n={}){const{root:i,rootMargin:r="0px",threshold:s=.1,window:o=sE}=n,a=lE(()=>o&&"IntersectionObserver"in o);let l=eb;const u=a.value?fo(()=>({el:rE(e),root:rE(i)}),({el:e,root:n})=>{if(l(),!e)return;const i=new IntersectionObserver(t,{root:n,rootMargin:r,threshold:s});i.observe(e),l=()=>{i.disconnect(),l=eb}},{immediate:!0,flush:"post"}):eb,c=()=>{l(),u()};return sb(c),{isSupported:a,stop:c}}(p,([e])=>{A(e.isIntersecting)},{root:f});g=n}function O(){Qv&&A&&(null==g||g(),f.value=void 0,g=void 0)}function M(){v.value&&(h.value=!0,n("show"))}function R(){h.value=!1,n("close")}function k(e){n("switch",e)}return fo(()=>i.src,()=>{T.value?(d.value=!0,c.value=!1,O(),S()):x()}),Or(()=>{T.value?S():x()}),t({showPreview:M}),(e,t)=>(jo(),qo("div",pa({ref_key:"container",ref:p},an(a),{class:[an(s).b(),e.$attrs.class]}),[c.value?Xr(e.$slots,"error",{key:0},()=>[na("div",{class:oe(an(s).e("error"))},Ee(an(r)("el.image.error")),3)]):(jo(),qo(Po,{key:1},[void 0!==u.value?(jo(),qo("img",pa({key:0},an(l),{src:u.value,loading:e.loading,style:an(_),class:an(y),crossorigin:e.crossorigin,onClick:M,onLoad:w,onError:I}),null,16,["src","loading","crossorigin"])):ua("v-if",!0),d.value?(jo(),qo("div",{key:1,class:oe(an(s).e("wrapper"))},[Xr(e.$slots,"placeholder",{},()=>[na("div",{class:oe(an(s).e("placeholder"))},null,2)])],2)):ua("v-if",!0)],64)),an(v)?(jo(),qo(Po,{key:2},[h.value?(jo(),Ko(an(MN),{key:0,"z-index":e.zIndex,"initial-index":an(b),infinite:e.infinite,"zoom-rate":e.zoomRate,"min-scale":e.minScale,"max-scale":e.maxScale,"show-progress":e.showProgress,"url-list":e.previewSrcList,scale:e.scale,crossorigin:e.crossorigin,"hide-on-click-modal":e.hideOnClickModal,teleported:e.previewTeleported,"close-on-press-escape":e.closeOnPressEscape,onClose:R,onSwitch:k},Wr({toolbar:mi(t=>[Xr(e.$slots,"toolbar",ae(sa(t)))]),default:mi(()=>[e.$slots.viewer?(jo(),qo("div",{key:0},[Xr(e.$slots,"viewer")])):ua("v-if",!0)]),_:2},[e.$slots.progress?{name:"progress",fn:mi(t=>[Xr(e.$slots,"progress",ae(sa(t)))])}:void 0,e.$slots["viewer-error"]?{name:"viewer-error",fn:mi(t=>[Xr(e.$slots,"viewer-error",ae(sa(t)))])}:void 0]),1032,["z-index","initial-index","infinite","zoom-rate","min-scale","max-scale","show-progress","url-list","scale","crossorigin","hide-on-click-modal","teleported","close-on-press-escape"])):ua("v-if",!0)],64)):ua("v-if",!0)],16))}});const LN=ox(AE(FN,[["__file","image.vue"]])),PN={class:"card-header"},BN={key:0,class:"disabled-tag",style:{color:"#f56c6c","margin-left":"8px","font-size":"13px"}},$N={class:"el-dropdown-link"},UN={class:"card-content",style:{"flex-direction":"column",display:"flex"}},zN={class:"card-content-info"},VN={style:{display:"flex",gap:"4px"}},jN={__name:"ClassBox",props:{title:{type:String,default:"类别"},picList:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1}},emits:["add-sample","delete-sample","rename-class","delete-class","disable-class","clear-samples"],setup(e,{emit:t}){const n=e,i=t,r=tn(n.title),s=tn(!1),o=tn(r.value),a=tn(null),l=tn(null);function u(){s.value||(s.value=!0,o.value=r.value,Gn(()=>{a.value&&a.value.input&&a.value.input.select()}))}function c(){o.value.trim()&&(r.value=o.value.trim(),i("rename-class",r.value)),s.value=!1}function d(){i("add-sample")}function h(){d(),l.value=setInterval(()=>{d()},200)}function p(){l.value&&(clearInterval(l.value),l.value=null)}function f(){i("delete-class")}function m(){i("disable-class")}function g(){i("clear-samples")}function y(){const e=new(bI());n.picList.forEach((t,n)=>{const i=t.split(",")[1];e.file(`sample_${n+1}.png`,i,{base64:!0})}),e.generateAsync({type:"blob"}).then(e=>{(0,_I.saveAs)(e,"samples.zip")})}function _(e){return new Promise((t,n)=>{if("application/zip"===e.type||e.name.endsWith(".zip")){const r=new(bI());r.loadAsync(e).then(e=>{const n=Object.values(e.files).filter(e=>!e.dir&&e.name.match(/\.(png|jpg|jpeg|gif|bmp)$/i));Promise.all(n.map(e=>r.file(e.name).async("blob").then(t=>{const n=new File([t],e.name,{type:t.type}),i=new FileReader;return i.readAsDataURL(n),new Promise(e=>i.onload=e)}))).then(e=>{e.forEach(e=>i("add-sample",e.target.result)),t(!1)})}).catch(n)}else{const r=new FileReader;r.onload=e=>{i("add-sample",e.target.result),t(!1)},r.onerror=n,r.readAsDataURL(e)}})}return fo(()=>n.title,e=>{r.value=e}),(e,t)=>(jo(),Ko(an(yI),{class:"class-box"},{header:mi(()=>[na("div",PN,[na("span",{class:"card-header-title",style:{cursor:"pointer"},onClick:u},[s.value?(jo(),Ko(an(vA),{key:1,ref_key:"inputRef",ref:a,modelValue:o.value,"onUpdate:modelValue":t[0]||(t[0]=e=>o.value=e),style:{width:"120px"},onKeyup:ku(c,["enter"]),onBlur:c},null,8,["modelValue"])):(jo(),qo(Po,{key:0},[aa(Ee(r.value)+" ",1),ia(an(NE),{onClick:Mu(u,["stop"])},{default:mi(()=>[ia(an(Bx))]),_:1}),n.disabled?(jo(),qo("span",BN," 禁用 ")):ua("v-if",!0)],64))]),ia(an(gM),{class:"card-header-title"},{dropdown:mi(()=>[ia(an(_M),{class:"class-box-dropdown"},{default:mi(()=>[ia(an(yM),{class:"class-box-dropdown-item",onClick:f},{default:mi(()=>t[1]||(t[1]=[na("span",{style:{color:"#f56c6c"}},"删除类别",-1)])),_:1}),ia(an(yM),{class:"class-box-dropdown-item",onClick:m},{default:mi(()=>[aa(Ee(n.disabled?"启用":"禁用")+"类别 ",1)]),_:1}),ia(an(yM),{class:"class-box-dropdown-item",disabled:0===n.picList.length,onClick:g},{default:mi(()=>t[2]||(t[2]=[aa(" 清空样本 ")])),_:1},8,["disabled"]),ia(an(yM),{class:"class-box-dropdown-item",disabled:0===n.picList.length,onClick:y},{default:mi(()=>t[3]||(t[3]=[aa(" 导出样本 ")])),_:1},8,["disabled"])]),_:1})]),default:mi(()=>[na("span",$N,[ia(an(NE),null,{default:mi(()=>[ia(an(Xx))]),_:1})])]),_:1})])]),default:mi(()=>[na("div",UN,[na("div",zN,[aa(" 图像样本 "+Ee(n.picList.length)+" ",1),na("div",VN,[ia(an(pI),{type:"primary",size:"small",disabled:n.disabled,onMousedown:h,onMouseup:p,onMouseleave:p},{default:mi(()=>[t[4]||(t[4]=aa(" 拍摄样本 ")),ia(an(NE),null,{default:mi(()=>[ia(an(_x))]),_:1})]),_:1},8,["disabled"]),ia(an(dN),{"show-file-list":!1,"before-upload":_,accept:"image/*,.zip",disabled:n.disabled},{default:mi(()=>[ia(an(pI),{plain:"",type:"primary",size:"small",disabled:n.disabled},{default:mi(()=>[t[5]||(t[5]=aa(" 上传样本 ")),ia(an(NE),null,{default:mi(()=>[ia(an(Mx))]),_:1})]),_:1},8,["disabled"])]),_:1},8,["disabled"])])]),ia(uu,{name:"fade",tag:"div",class:"card-content-img"},{default:mi(()=>[(jo(!0),qo(Po,null,Hr(n.picList.slice().reverse(),e=>(jo(),qo("div",{key:e,class:"card-content-img-wrapper",style:{position:"relative",display:"inline-block"}},[ia(an(LN),{src:e,class:oe(["card-content-img-item",{"img-disabled":n.disabled}])},null,8,["src","class"]),ia(an(NE),{class:"delete-icon",onClick:t=>function(e){i("delete-sample",e)}(e)},{default:mi(()=>[ia(an(Dx))]),_:2},1032,["onClick"])]))),128))]),_:1})])]),_:1}))}},YN=jN,GN={class:"camera-box"},HN={__name:"CameraBox",setup(e,{expose:t}){const n=tn(null),i=Ds("shotList");return Or(()=>{navigator.mediaDevices.getUserMedia({video:!0}).then(e=>{n.value&&(n.value.srcObject=e)}).catch(e=>{console.error("无法访问摄像头:",e)})}),t({captureShot:function(){const e=n.value;if(!e)return;const t=e.videoWidth,r=e.videoHeight;let s=0,o=0,a=t,l=r;t>r?(s=(t-r)/2,a=r):r>t&&(o=(r-t)/2,l=t);const u=Math.min(a,l),c=document.createElement("canvas");return c.width=u,c.height=u,c.getContext("2d").drawImage(e,s,o,u,u,0,0,u,u),i.value.push(c.toDataURL("image/png")),c.toDataURL("image/png")}}),(e,t)=>(jo(),qo("div",GN,[na("video",{id:"webcam",ref_key:"videoRef",ref:n,class:"video-crop",autoplay:"",playsinline:"",muted:"",height:"100%",width:"100%"},null,512)]))}};var WN=n(66262);const XN=(0,WN.A)(HN,[["__scopeId","data-v-da91b390"]]);var qN=n(41103),KN=n(99778);const ZN=Symbol("rowContextKey"),QN=HT({tag:{type:String,default:"div"},gutter:{type:Number,default:0},justify:{type:String,values:["start","center","end","space-around","space-between","space-evenly"],default:"start"},align:{type:String,values:["top","middle","bottom"]}}),JN=Yi({name:"ElRow"});const eD=ox(AE(Yi({...JN,props:QN,setup(e){const t=e,n=Bv("row"),i=za(()=>t.gutter);Ns(ZN,{gutter:i});const r=za(()=>{const e={};return t.gutter?(e.marginRight=e.marginLeft=`-${t.gutter/2}px`,e):e}),s=za(()=>[n.b(),n.is(`justify-${t.justify}`,"start"!==t.justify),n.is(`align-${t.align}`,!!t.align)]);return(e,t)=>(jo(),Ko(Vr(e.tag),{class:oe(an(s)),style:te(an(r))},{default:mi(()=>[Xr(e.$slots,"default")]),_:3},8,["class","style"]))}}),[["__file","row.vue"]])),tD=HT({tag:{type:String,default:"div"},span:{type:Number,default:24},offset:{type:Number,default:0},pull:{type:Number,default:0},push:{type:Number,default:0},xs:{type:[Number,Object],default:()=>({})},sm:{type:[Number,Object],default:()=>({})},md:{type:[Number,Object],default:()=>({})},lg:{type:[Number,Object],default:()=>({})},xl:{type:[Number,Object],default:()=>({})}}),nD=Yi({name:"ElCol"});const iD=ox(AE(Yi({...nD,props:tD,setup(e){const t=e,{gutter:n}=Ds(ZN,{gutter:za(()=>0)}),i=Bv("col"),r=za(()=>{const e={};return n.value&&(e.paddingLeft=e.paddingRight=n.value/2+"px"),e}),s=za(()=>{const e=[];["span","offset","pull","push"].forEach(n=>{const r=t[n];zv(r)&&("span"===n?e.push(i.b(`${t[n]}`)):r>0&&e.push(i.b(`${n}-${t[n]}`)))});return["xs","sm","md","lg","xl"].forEach(n=>{zv(t[n])?e.push(i.b(`${n}-${t[n]}`)):M(t[n])&&Object.entries(t[n]).forEach(([t,r])=>{e.push("span"!==t?i.b(`${n}-${t}-${r}`):i.b(`${n}-${r}`))})}),n.value&&e.push(i.is("guttered")),[i.b(),e]});return(e,t)=>(jo(),Ko(Vr(e.tag),{class:oe(an(s)),style:te(an(r))},{default:mi(()=>[Xr(e.$slots,"default")]),_:3},8,["class","style"]))}}),[["__file","col.vue"]])),rD={class:"vis-left-panel-inner-wrapper"},sD={class:"card-header"},oD={key:0,style:{margin:"auto"}},aD={key:1,style:{margin:"auto"}},lD=["src"],uD={__name:"ModelArea",emits:["shot"],setup(e,{expose:t,emit:n}){const i=n,r=Ds("picList"),s=Ds("shotList"),o=Ds("states"),l=tn(r.value.map((e,t)=>({name:e.title,progress:0}))),c=["#FF6F61","#42A5F5","#66BB6A","#FFA726","#AB47BC"];let d,h,p=[];setInterval(async()=>{if(2!==o.value.isTraining)return;if(""!==m.value)return;i("shot");const e=s.value[s.value.length-1];if(!e||"data:,"===e)return void tw.error("未获取到有效样本");const t=new Image;t.src=e,await new Promise(e=>{t.onload=e});const n=qN.browser.fromPixels(t);let r=qN.image.resizeBilinear(n,[224,224]).expandDims(0).div(255),a=d.predict(r);const u=h.predict(a),c=await u.data();l.value=[...l.value.map((e,t)=>({...e,progress:Number((100*c[t]).toFixed(2))}))],n.dispose(),a.dispose(),u.dispose()},200);const f=tn(!1),m=tn(""),g=tn(""),y=tn("20%"),_=tn("20%");async function v(){if(h)try{await h.save(`downloads://${""==O.value?"my-model":O.value}`),tw.success("模型导出成功")}catch(e){tw.error(`模型导出失败: ${e.message}`)}else tw.error("模型尚未训练完成")}async function b(e){const t=new FileReader;return t.onload=async e=>{if(m.value=e.target.result,!d||!h)return tw.error("请先完成模型训练"),!1;const t=new window.Image;t.src=m.value,await new Promise(e=>t.onload=e);const n=qN.browser.fromPixels(t);let i=qN.image.resizeBilinear(n,[224,224]).expandDims(0).div(255),r=d.predict(i);const s=h.predict(r),o=await s.data();l.value=[...l.value.map((e,t)=>({...e,progress:Number((100*o[t]).toFixed(2))}))];const a=o.indexOf(Math.max(...o));g.value=l.value[a]?.name||"未知",n.dispose(),r.dispose(),s.dispose()},t.readAsDataURL(e),!1}function T(){m.value=""}let x=0,E=0,w=0,I=0;function A(e){if(0!==e.button)return;x=e.clientX,E=e.clientY;const t=document.getElementById("vis-left-panel-wrapper").style.top,n=document.getElementById("vis-left-panel-wrapper").style.right;w=t.endsWith("%")?window.innerHeight*Number.parseFloat(t)/100:Number.parseFloat(t),I=n.endsWith("%")?window.innerWidth*Number.parseFloat(n)/100:Number.parseFloat(n),document.addEventListener("mousemove",S),document.addEventListener("mouseup",C)}function S(e){const t=e.clientX-x,n=e.clientY-E;let i=w+n,r=I-t;i=Math.max(0,Math.min(window.innerHeight-100,i)),r=Math.max(0,Math.min(window.innerWidth-200,r)),y.value=`${i}px`,_.value=`${r}px`}function C(){document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",C)}t({train:async function(){const e=document.getElementById("vis-left-panel");e&&(e.innerHTML="训练准备中……"),f.value=!0,console.log("正在加载Mobilenet……"),d=await qN.loadGraphModel(u.join(a.Env.boardDirPath,"teachableModel/model.json")),console.log("Mobilenet加载完成。"),e&&(e.innerHTML="");const t=r.value.length;let n=null,i=null;h=qN.sequential(),h.add(qN.layers.dense({inputShape:[1280],units:128,activation:"relu"})),h.add(qN.layers.dense({units:t,activation:"softmax"})),h.compile({optimizer:qN.train.adam(.001),loss:"categoricalCrossentropy",metrics:["accuracy"]});for(let e=0;e<r.value.length;e++){if(r.value[e].disabled)continue;const s=r.value[e].list;for(let r=0;r<s.length;r++){const o=new Image;o.src=s[r],await new Promise(e=>{o.onload=e});const a=qN.browser.fromPixels(o),l=a.resizeBilinear([224,224]).toFloat().div(qN.scalar(127.5)).sub(qN.scalar(1)).expandDims(0);let u=d.predict(l);const c=qN.oneHot(qN.tensor1d([e]).toInt(),t);if(null==n)n=u.clone(),i=c.clone();else{const e=n;n=e.concat(u,0),e.dispose();const t=i;i=t.concat(c,0),t.dispose()}c.dispose(),a.dispose()}}p=[];const s=document.getElementById("vis-left-panel")||{name:"训练过程",tab:"训练"};await h.fit(n,i,{epochs:20,batchSize:16,shuffle:!0,validationSplit:.2,callbacks:KN.show.fitCallbacks(s,["loss","acc","val_loss","val_acc","accuracy","val_accuracy"],{callbacks:["onEpochEnd"]})}),console.log("训练完成"),l.value=r.value.filter(e=>!0!==e.disabled).map((e,t)=>({name:e.title,progress:0})),console.log(l.value),o.value.isTraining=2}});const O=tn("");async function M(){if(h)try{await h.save(`indexeddb://${""==O.value?"my-model":O.value}`),tw.success("模型保存成功")}catch(e){tw.error(`模型保存失败: ${e.message}`)}else tw.error("模型尚未训练完成")}return(e,t)=>(jo(),qo("div",null,[gi(na("div",{id:"vis-left-panel-wrapper",class:"vis-left-panel-wrapper",style:te(`right: ${_.value}; top: ${y.value};`)},[na("div",rD,[na("div",{class:"vis-left-panel-title",style:{},onMousedown:A},[t[4]||(t[4]=na("span",null," 训练过程可视化 ",-1)),ia(an(pI),{size:"small",plain:"",onClick:t[0]||(t[0]=e=>f.value=!1)},{default:mi(()=>t[3]||(t[3]=[aa(" 隐藏 ")])),_:1})],32),t[5]||(t[5]=na("div",{id:"vis-left-panel",class:"vis-left-panel"},"训练准备中……",-1))])],4),[[Cl,f.value]]),2===an(o).isTraining?(jo(),Ko(an(yI),{key:0,class:"model-area"},{header:mi(()=>[na("div",sD,[t[8]||(t[8]=aa(" 模型 ")),f.value?ua("v-if",!0):(jo(),Ko(an(pI),{key:0,size:"small",style:{"margin-left":"10px"},type:"primary",plain:"",onClick:t[1]||(t[1]=e=>f.value=!0)},{default:mi(()=>t[6]||(t[6]=[aa(" 显示训练过程 ")])),_:1})),2===an(o).isTraining?(jo(),Ko(an(pI),{key:1,size:"small",style:{"margin-left":"10px"},type:"success",plain:"",onClick:v},{default:mi(()=>t[7]||(t[7]=[aa(" 模型导出至本地 ")])),_:1})):ua("v-if",!0)])]),default:mi(()=>[ia(an(eD),{class:"model-item",style:{"flex-direction":"column","align-items":"flex-center"}},{default:mi(()=>[ia(an(eD),null,{default:mi(()=>[ia(an(iD),{span:6,style:{display:"flex","align-items":"center","text-align":"right"}},{default:mi(()=>t[9]||(t[9]=[aa(" 名称: ")])),_:1}),ia(an(iD),{span:12},{default:mi(()=>[ia(an(vA),{modelValue:O.value,"onUpdate:modelValue":t[2]||(t[2]=e=>O.value=e),placeholder:"请输入模型名称"},null,8,["modelValue"])]),_:1}),ia(an(iD),{span:4,style:{display:"flex","align-items":"center"}},{default:mi(()=>[ia(an(pI),{style:{margin:"auto 5px"},type:"primary",plain:"",size:"small",onClick:M},{default:mi(()=>t[10]||(t[10]=[aa(" 保存 ")])),_:1})]),_:1})]),_:1})]),_:1}),ia(an(eD),{class:"model-item"},{default:mi(()=>t[11]||(t[11]=[na("b",null,"输入",-1)])),_:1}),ia(an(eD),{class:"model-item"},{default:mi(()=>[m.value?(jo(),qo("div",aD,[t[16]||(t[16]=aa(" 下方上传图片 ")),t[17]||(t[17]=na("br",null,null,-1)),ia(an(pI),{size:"small",type:"success",plain:"",onClick:T},{default:mi(()=>t[14]||(t[14]=[aa(" 切换为上方拍摄内容 ")])),_:1}),ia(an(dN),{"show-file-list":!1,accept:"image/*","before-upload":b},{default:mi(()=>[ia(an(pI),{size:"small",type:"success"},{default:mi(()=>t[15]||(t[15]=[aa(" 重新上传一张 ")])),_:1})]),_:1}),na("img",{src:m.value,alt:"用户上传图片",style:{"max-width":"100%","max-height":"150px","border-radius":"10px"}},null,8,lD)])):(jo(),qo("div",oD,[t[13]||(t[13]=aa(" 上方拍摄内容 ")),ia(an(dN),{"show-file-list":!1,accept:"image/*","before-upload":b},{default:mi(()=>[ia(an(pI),{size:"small",type:"success"},{default:mi(()=>t[12]||(t[12]=[aa(" 切换为上传图片 ")])),_:1})]),_:1})]))]),_:1}),ia(an(eD),{class:"model-item"},{default:mi(()=>t[18]||(t[18]=[na("b",null,"输出",-1)])),_:1}),(jo(!0),qo(Po,null,Hr(l.value,(e,t)=>(jo(),Ko(an(eD),{key:`${e.name}-${t}`,class:"model-item"},{default:mi(()=>[ia(an(iD),{span:6},{default:mi(()=>[aa(Ee(e.name),1)]),_:2},1024),ia(an(iD),{span:18},{default:mi(()=>[ia(an(EM),{class:"progress","text-inside":!0,"stroke-width":20,percentage:e.progress,color:c[t%c.length],striped:"",format:e=>`${e}%`},null,8,["percentage","color","format"])]),_:2},1024)]),_:2},1024))),128))]),_:1})):ua("v-if",!0)]))}},cD=(0,WN.A)(uD,[["__scopeId","data-v-5abb0202"]]),dD=HT({trigger:JS.trigger,triggerKeys:JS.triggerKeys,placement:GO.placement,disabled:JS.disabled,visible:ZS.visible,transition:ZS.transition,popperOptions:GO.popperOptions,tabindex:GO.tabindex,content:ZS.content,popperStyle:ZS.popperStyle,popperClass:ZS.popperClass,enterable:{...ZS.enterable,default:!0},effect:{...ZS.effect,default:"light"},teleported:ZS.teleported,appendTo:ZS.appendTo,title:String,width:{type:[String,Number],default:150},offset:{type:Number,default:void 0},showAfter:{type:Number,default:0},hideAfter:{type:Number,default:200},autoClose:{type:Number,default:0},showArrow:{type:Boolean,default:!0},persistent:{type:Boolean,default:!0},"onUpdate:visible":{type:Function}}),hD={"update:visible":e=>Uv(e),"before-enter":()=>!0,"before-leave":()=>!0,"after-enter":()=>!0,"after-leave":()=>!0},pD=Yi({name:"ElPopover"}),fD=Yi({...pD,props:dD,emits:hD,setup(e,{expose:t,emit:n}){const i=e,r=za(()=>i["onUpdate:visible"]),s=Bv("popover"),o=tn(),a=za(()=>{var e;return null==(e=an(o))?void 0:e.popperRef}),l=za(()=>[{width:SE(i.width)},i.popperStyle]),u=za(()=>[s.b(),i.popperClass,{[s.m("plain")]:!!i.content}]),c=za(()=>i.transition===`${s.namespace.value}-fade-in-linear`),d=()=>{n("before-enter")},h=()=>{n("before-leave")},p=()=>{n("after-enter")},f=()=>{n("update:visible",!1),n("after-leave")};return t({popperRef:a,hide:()=>{var e;null==(e=o.value)||e.hide()}}),(e,t)=>(jo(),Ko(an(pO),pa({ref_key:"tooltipRef",ref:o},e.$attrs,{trigger:e.trigger,"trigger-keys":e.triggerKeys,placement:e.placement,disabled:e.disabled,visible:e.visible,transition:e.transition,"popper-options":e.popperOptions,tabindex:e.tabindex,content:e.content,offset:e.offset,"show-after":e.showAfter,"hide-after":e.hideAfter,"auto-close":e.autoClose,"show-arrow":e.showArrow,"aria-label":e.title,effect:e.effect,enterable:e.enterable,"popper-class":an(u),"popper-style":an(l),teleported:e.teleported,"append-to":e.appendTo,persistent:e.persistent,"gpu-acceleration":an(c),"onUpdate:visible":an(r),onBeforeShow:d,onBeforeHide:h,onShow:p,onHide:f}),{content:mi(()=>[e.title?(jo(),qo("div",{key:0,class:oe(an(s).e("title")),role:"title"},Ee(e.title),3)):ua("v-if",!0),Xr(e.$slots,"default",{},()=>[aa(Ee(e.content),1)])]),default:mi(()=>[e.$slots.reference?Xr(e.$slots,"reference",{key:0}):ua("v-if",!0)]),_:3},16,["trigger","trigger-keys","placement","disabled","visible","transition","popper-options","tabindex","content","offset","show-after","hide-after","auto-close","show-arrow","aria-label","effect","enterable","popper-class","popper-style","teleported","append-to","persistent","gpu-acceleration","onUpdate:visible"]))}});const mD=(e,t)=>{const n=t.arg||t.value,i=null==n?void 0:n.popperRef;i&&(i.triggerRef=e)};var gD,yD;const _D=ox(AE(fD,[["__file","popover.vue"]]),{directive:(yD="popover",(gD={mounted(e,t){mD(e,t)},updated(e,t){mD(e,t)}}).install=e=>{e.directive(yD,gD)},gD)}),vD=HT({type:{type:String,values:["primary","success","info","warning","danger",""],default:""},size:{type:String,values:WT,default:""},truncated:Boolean,lineClamp:{type:[String,Number]},tag:{type:String,default:"span"}}),bD=Yi({name:"ElText"}),TD=Yi({...bD,props:vD,setup(e){const t=e,n=tn(),i=Fw(),r=Bv("text"),s=za(()=>[r.b(),r.m(t.type),r.m(i.value),r.is("truncated",t.truncated),r.is("line-clamp",!$v(t.lineClamp))]),o=()=>{var e,i,r,s,o,a,l;if(cs().title)return;let u=!1;const c=(null==(e=n.value)?void 0:e.textContent)||"";if(t.truncated){const e=null==(i=n.value)?void 0:i.offsetWidth,t=null==(r=n.value)?void 0:r.scrollWidth;e&&t&&t>e&&(u=!0)}else if(!$v(t.lineClamp)){const e=null==(s=n.value)?void 0:s.offsetHeight,t=null==(o=n.value)?void 0:o.scrollHeight;e&&t&&t>e&&(u=!0)}u?null==(a=n.value)||a.setAttribute("title",c):null==(l=n.value)||l.removeAttribute("title")};return Or(o),Rr(o),(e,t)=>(jo(),Ko(Vr(e.tag),{ref_key:"textRef",ref:n,class:oe(an(s)),style:te({"-webkit-line-clamp":e.lineClamp})},{default:mi(()=>[Xr(e.$slots,"default")]),_:3},8,["class","style"]))}});const xD=ox(AE(TD,[["__file","text.vue"]])),ED={__name:"TrainArea",emits:["train"],setup(e,{emit:t}){const n=t,i=Ds("picList"),r=Ds("states"),s=tn(!1),o=tn("待训练……");function a(){s.value&&(n("train"),r.value.isTraining=1)}return fo([i.value,()=>r.value.isTraining],()=>{s.value=function(){const e=Array.isArray(i.value)?i.value.filter(e=>!1===e.disabled):[];return 1!==r.value.isTraining&&e.length>1&&e.every(e=>Array.isArray(e.list)&&e.list.length>0)}(),0===r.value.isTraining?o.value="待训练……":1===r.value.isTraining?o.value="训练中……":2===r.value.isTraining&&(o.value="训练完成")},{immediate:!0}),(e,t)=>(jo(),Ko(an(yI),{class:"train-area"},{header:mi(()=>t[0]||(t[0]=[na("div",{class:"card-header"}," 训练 ",-1)])),default:mi(()=>[ia(an(_D),{class:"box-item",placement:"bottom",disabled:s.value},{reference:mi(()=>[ia(an(pI),{disabled:!s.value,type:"primary",style:{"max-width":"100%"},onClick:a},{default:mi(()=>t[1]||(t[1]=[aa(" 训练模型 ")])),_:1},8,["disabled"])]),default:mi(()=>[ia(an(NE),null,{default:mi(()=>[ia(an(tE))]),_:1}),t[2]||(t[2]=aa(" 至少有两个类别,且每个类别都需有图像样本。 "))]),_:1},8,["disabled"]),t[3]||(t[3]=na("br",null,null,-1)),ia(an(xD),null,{default:mi(()=>[aa(Ee(o.value),1)]),_:1})]),_:1}))}},wD=(0,WN.A)(ED,[["__scopeId","data-v-1deba862"]]),ID={class:"main-splitter"},AD={class:"class-area"},SD={class:"add-class-content"},CD={__name:"teachableModel",setup(e){const t=tn([]);Ns("shotList",t);const n=tn([{title:"类别 1",list:[],disabled:!1},{title:"类别 2",list:[],disabled:!1}]);Ns("picList",n);async function i(e,i){n.value[e].disabled?tw.error("该类别已被禁用"):i?n.value[e].list.push(i):(await a(),t.value[t.value.length-1]&&"data:,"!==t.value[t.value.length-1]?n.value[e].list.push(t.value[t.value.length-1]):tw.error("未获取到有效样本"))}function r(){n.value.push({title:`类别 ${n.value.length+1}`,list:[],disabled:!1})}Ns("states",tn({isTraining:0}));const s=tn(!0),o=tn(null);async function a(){await(o.value?.captureShot())}const l=tn(null);async function u(){await l.value.train()}return(e,t)=>(jo(),qo("div",ID,[ia(an(Ew),null,{default:mi(()=>[ia(an(ww),{size:"70%",min:200},{default:mi(()=>[na("div",AD,[(jo(!0),qo(Po,null,Hr(n.value,(e,r)=>(jo(),Ko(YN,{key:r,title:e.title,"pic-list":e.list,disabled:e.disabled,onAddSample:e=>i(r,e),onDeleteSample:e=>n.value[r].list=n.value[r].list.filter(t=>t!==e),onDeleteClass:e=>function(e){n.value.splice(e,1)}(r),onDisableClass:e=>function(e){n.value[e].disabled=!n.value[e].disabled}(r),onRenameClass:e=>function(e,t){n.value[e].title=t}(r,e),onClearSamples:e=>function(e){n.value[e].list=[]}(r)},{default:mi(()=>[ia(an(pI),{type:"primary",size:"mini",onClick:e=>i(r)},{default:mi(()=>t[0]||(t[0]=[aa(" 添加样本 ")])),_:2},1032,["onClick"])]),_:2},1032,["title","pic-list","disabled","onAddSample","onDeleteSample","onDeleteClass","onDisableClass","onRenameClass","onClearSamples"]))),128)),ia(an(yI),{class:"add-class-card",onClick:r},{default:mi(()=>[na("div",SD,[t[1]||(t[1]=aa(" 添加一个类别 ")),ia(an(NE),null,{default:mi(()=>[ia(an(Cx))]),_:1})])]),_:1})])]),_:1}),ia(an(ww),{min:200},{default:mi(()=>[ia(XN,{ref_key:"cameraBoxRef",ref:o},null,512),ia(hl,{name:"fade-scale"},{default:mi(()=>[s.value?(jo(),Ko(cD,{key:0,ref_key:"modelAreaRef",ref:l,onShot:a},null,512)):ua("v-if",!0)]),_:1}),ia(wD,{onTrain:u})]),_:1})]),_:1})]))}},OD=(0,WN.A)(CD,[["__scopeId","data-v-02bafc86"]]),MD={__name:"App",setup:e=>(e,t)=>(jo(),Ko(an(lx),null,{default:mi(()=>[ia(OD)]),_:1}))};class RD{static{a.HTMLTemplate.add("html/statusbar/loader.html",new a.HTMLTemplate('<style>\r\n div[m-id="{{d.mId}}"] {\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: center;\r\n align-items: center;\r\n position: absolute;\r\n background-color: transparent !important;\r\n font-size: 12px;\r\n line-height: 12px;\r\n color: #fff;\r\n bottom: 0;\r\n height: var(--footer-height);\r\n width: 100%;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] > p {\r\n margin-left: 5px;\r\n }\r\n</style>\r\n<div m-id="{{d.mId}}">\r\n <div class="ui mini active inline slow loader"></div>\r\n <p>{{d.msg.loading}}</p>\r\n</div>')),this.pythonShell=null,this.kernelLoaded=!1,this.$loader=d()(a.HTMLTemplate.get("html/statusbar/loader.html").render({msg:{loading:l.Msg.PYTHON_PYODIDE_LOADING}})),this.statusBarImage=null,this.statusBarFileSystem=null,this.init=async function(){a.app.getFooterBar().getContent().after(this.$loader);const e=u.relative(a.Env.indexDirPath,a.Env.boardDirPath),t=new Gp({rootPath:u.join(e,"deps"),language:"python3"}),n=await t.kernelAvailable();if(!n)return;await n.init(),await n.loaded(),this.loader=t,this.kernel=n,this.statusBarImage=Hp.init(),this.statusBarFileSystem=Mv.init(),this.statusBarTool=Rv.init();Uu(MD).mount(this.statusBarTool.getContent()[0]),this.statusBarGame=kv.init(),this.pythonShell=new RD,this.pyodide=window.pyodide,this.interruptBuffer=new Uint8Array(new ArrayBuffer(1)),this.pyodide.setInterruptBuffer(this.interruptBuffer),this.kernelLoaded=!0,this.$loader.remove(),this.$loader=null},this.run=async function(){if(!this.kernelLoaded)return;const e=a.Workspace.getMain().getEditorsManager().getActive().getCode();return this.pythonShell.run(e)},this.stop=async function(){if(this.kernelLoaded)return this.pythonShell.stop()}}#C=null;#O=null;#M=null;#R={row:0,column:0};#k="";#N=null;#D=null;#F=!1;#L=!1;#P=null;#B=()=>this.#$();#U=[{name:"REPL-Enter",bindKey:"Enter",exec:e=>{if(e.getSession().selection.getCursor().row===this.#R.row){const e=this.#C.getEndPos();let t=this.#C.getValueRange(this.#R,e);t=t.replace(this.#k,""),this.#N?.(t),this.#N=null,this.#D=null,this.#C.addValue("\n"),this.#z()}return!1}},{name:"REPL-ChangeEditor",bindKey:"Delete|Ctrl-X|Backspace",exec:e=>{const t=e.getSession().selection.getCursor();return t.row<this.#R.row||t.column<=this.#R.column}}];constructor(){const e=a.Workspace.getMain();this.#M=e.getStatusBarsManager(),this.#C=this.#M.getStatusBarById("output"),this.#O=this.#M.getStatusBarById("images"),this.#P=RD.kernel,this.#f()}#f(){this.#P.addEventListener("eval.finished",()=>{this.#L=!1,this.#C.addValue(`\n==${a.Msg.Lang["shell.finish"]}==`),this.syncfs(!1).catch(a.Debug.error)}),this.#P.addEventListener("eval.output",e=>{this.#C.addValue(e.content)}),this.#P.addEventListener("eval.error",()=>{this.#L=!1,this.#C.addValue(`\n==${a.Msg.Lang["shell.finish"]}==`)}),this.#P.addEventListener("eval.input",e=>{const t=String(e?.content?.prompt);this.#C.addValue(t),this.#k=t,this.#N=e.resolve,this.#D=e.reject,this.#V()}),this.#P.addEventListener("eval.display",e=>{this.#M.changeTo("images"),this.#O.display(e)})}#$(){const e=this.#C.getEditor(),t=e.getSession().selection.getCursor();e.setReadOnly(t.row<this.#R.row||t.column<this.#R.column)}#V(){if(!this.#L)return;this.#F=!0,this.#R=this.#C.getEndPos();const e=this.#C.getEditor();e.setReadOnly(!1),e.focus();e.getSession().selection.on("changeCursor",this.#B),e.commands.addCommands(this.#U)}#z(){this.#F=!1;const e=this.#C.getEditor();e.getSession().selection.off("changeCursor",this.#B),e.commands.removeCommands(this.#U),this.#k="",this.#N?.(""),this.cursor_={row:0,column:0},e.setReadOnly(!0)}async run(e){await this.stop(),await this.syncfs(!0),-1!==e.indexOf("import turtle")&&(e+="\nturtle.done()\n"),-1!==e.indexOf("import matplotlib.pyplot")&&(e+="\nplt.clf()\n"),jp.runit(this.#O.getContent()[0]),-1!==e.indexOf("import sprite")||-1!==e.indexOf("from sprite import")?this.#M.changeTo("images"):this.#M.changeTo("output"),this.#M.show(),this.#C.setValue(`${a.Msg.Lang["shell.running"]}...\n`),this.#L=!0,this.#P.dispatchEvent("eval.request",{code:e,interactive:!1})}async stop(){if(this.#F&&this.#z(),this.#L){const e=5;RD.interruptBuffer[0]=2;const t=Number(new Date);for(;Number(new Date)-t<1e3*e&&this.#L;)RD.interruptBuffer[0]=2,await this.sleep(100);this.#L=!1}}async syncfs(e=!1){return new Promise(t=>{window.pyodide.FS.syncfs(e,t)})}sleep(e){return new Promise(t=>setTimeout(t,e))}}const kD={init:async function(){const e=a.app.getNav();e.register({icon:"icon-play-circled",title:"",id:"python-run-btn",displayText:l.Msg.MSG.run,preconditionFn:()=>!0,callback:()=>{RD.run().catch(a.Debug.error)},scopeType:a.Nav.Scope.LEFT,weight:4}),e.register({icon:"icon-cancel",title:"",id:"python-stop-btn",displayText:l.Msg.MSG.stop,preconditionFn:()=>!0,callback:()=>{RD.stop().catch(a.Debug.error)},scopeType:a.Nav.Scope.LEFT,weight:5}),await RD.init()}},ND=kD},30696:(e,t,n)=>{"use strict";var i=n(64548),r=n(41103);const s=new i.Registry,o=function(e){let t={ok:!1,buffer:null,json:function(){const e=new TextDecoder("utf-8").decode(this.buffer);return JSON.parse(e)},arrayBuffer:function(){return this.buffer}};return s.hasKey(e)?(t.ok=!0,t.buffer=s.getItem(e),t):t},a={modelsValue:{},loadGraphModel:async function(e){return await r.loadGraphModel(e,{fromTFHub:!1,fetchFunc:(...e)=>o(e[0])})},loadLayersModel:async function(e){return await r.loadLayersModel(e,{fromTFHub:!1,fetchFunc:(...e)=>o(e[0])})},setModelsValue:function(e,t){s.hasKey(e)&&s.unregister(e),s.register(e,t),a.modelsValue[e]=t}};window.tensorflow=a},13383:e=>{"use strict";e.exports=Blockly},64548:e=>{"use strict";e.exports=Mixly},26944:e=>{"use strict";e.exports=path},85817:()=>{},18590:()=>{},4530:()=>{},8108:()=>{},80551:()=>{},67425:()=>{},9496:()=>{},26786:()=>{},48884:()=>{},98001:()=>{},71613:()=>{},15312:()=>{},89032:()=>{},60574:()=>{},2672:()=>{},58215:()=>{},1417:()=>{},49391:()=>{},83220:()=>{},73985:()=>{},80032:()=>{},75650:()=>{},56644:()=>{},41234:()=>{},48487:e=>{"use strict";var t=/("(?:[^\\"]|\\.)*")|[:,]/g;e.exports=function(e,n){var i,r,s;return n=n||{},i=JSON.stringify([1],void 0,void 0===n.indent?2:n.indent).slice(2,-3),r=""===i?1/0:void 0===n.maxLength?80:n.maxLength,s=n.replacer,function e(n,o,a){var l,u,c,d,h,p,f,m,g,y,_,v;if(n&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===(_=JSON.stringify(n,s)))return _;if(f=r-o.length-a,_.length<=f&&(g=_.replace(t,function(e,t){return t||e+" "})).length<=f)return g;if(null!=s&&(n=JSON.parse(_),s=void 0),"object"==typeof n&&null!==n){if(m=o+i,c=[],u=0,Array.isArray(n))for(y="[",l="]",f=n.length;u<f;u++)c.push(e(n[u],m,u===f-1?0:1)||"null");else for(y="{",l="}",f=(p=Object.keys(n)).length;u<f;u++)d=p[u],h=JSON.stringify(d)+": ",void 0!==(v=e(n[d],m,h.length+(u===f-1?0:1)))&&c.push(h+v);if(c.length>0)return[y,i+c.join(",\n"+m),l].join("\n"+o)}return _}(e,"",0)}},21045:e=>{"use strict";e.exports={rE:"3.0.8"}}},__webpack_module_cache__={},webpackQueues,webpackExports,webpackError,resolveQueue,leafPrototypes,getProto,inProgress,dataWebpackPrefix;function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.loaded=!0,n.exports}__webpack_require__.m=__webpack_modules__,__webpack_require__.amdD=function(){throw new Error("define cannot be used indirect")},__webpack_require__.amdO={},webpackQueues="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",webpackExports="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",webpackError="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",resolveQueue=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))},__webpack_require__.a=(e,t,n)=>{var i;n&&((i=[]).d=-1);var r,s,o,a=new Set,l=e.exports,u=new Promise((e,t)=>{o=t,s=e});u[webpackExports]=l,u[webpackQueues]=e=>(i&&e(i),a.forEach(e),u.catch(e=>{})),e.exports=u,t(e=>{var t;r=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[webpackQueues])return e;if(e.then){var t=[];t.d=0,e.then(e=>{n[webpackExports]=e,resolveQueue(t)},e=>{n[webpackError]=e,resolveQueue(t)});var n={};return n[webpackQueues]=e=>e(t),n}}var i={};return i[webpackQueues]=e=>{},i[webpackExports]=e,i}))(e);var n=()=>r.map(e=>{if(e[webpackError])throw e[webpackError];return e[webpackExports]}),s=new Promise(e=>{(t=()=>e(n)).r=0;var s=e=>e!==i&&!a.has(e)&&(a.add(e),e&&!e.d&&(t.r++,e.push(t)));r.map(e=>e[webpackQueues](s))});return t.r?s:n()},e=>(e?o(u[webpackError]=e):s(l),resolveQueue(i))),i&&i.d<0&&(i.d=0)},__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},getProto=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,__webpack_require__.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var n=Object.create(null);__webpack_require__.r(n);var i={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var r=2&t&&e;"object"==typeof r&&!~leafPrototypes.indexOf(r);r=getProto(r))Object.getOwnPropertyNames(r).forEach(t=>i[t]=()=>e[t]);return i.default=()=>e,__webpack_require__.d(n,i),n},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.f={},__webpack_require__.e=e=>Promise.all(Object.keys(__webpack_require__.f).reduce((t,n)=>(__webpack_require__.f[n](e,t),t),[])),__webpack_require__.u=e=>e+".bundle."+{38:"56383ce7",97:"b0fed7fa",195:"9941f7ca",211:"45847679",317:"a52389ac",837:"3c99d169",950:"b01fc844",960:"d893bd17",974:"66119c82"}[e]+".js",__webpack_require__.miniCssF=e=>"styles/"+e+".45554be0.css",__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),inProgress={},dataWebpackPrefix="@mixly/python-pyodide:",__webpack_require__.l=(e,t,n,i)=>{if(inProgress[e])inProgress[e].push(t);else{var r,s;if(void 0!==n)for(var o=document.getElementsByTagName("script"),a=0;a<o.length;a++){var l=o[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==dataWebpackPrefix+n){r=l;break}}r||(s=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,__webpack_require__.nc&&r.setAttribute("nonce",__webpack_require__.nc),r.setAttribute("data-webpack",dataWebpackPrefix+n),r.src=e),inProgress[e]=[t];var u=(t,n)=>{r.onerror=r.onload=null,clearTimeout(c);var i=inProgress[e];if(delete inProgress[e],r.parentNode&&r.parentNode.removeChild(r),i&&i.forEach(e=>e(n)),t)return t(n)},c=setTimeout(u.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=u.bind(null,r.onerror),r.onload=u.bind(null,r.onload),s&&document.head.appendChild(r)}},__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;__webpack_require__.g.importScripts&&(e=__webpack_require__.g.location+"");var t=__webpack_require__.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var i=n.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=n[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),__webpack_require__.p=e})(),(()=>{if("undefined"!=typeof document){var e=e=>new Promise((t,n)=>{var i=__webpack_require__.miniCssF(e),r=__webpack_require__.p+i;if(((e,t)=>{for(var n=document.getElementsByTagName("link"),i=0;i<n.length;i++){var r=(o=n[i]).getAttribute("data-href")||o.getAttribute("href");if("stylesheet"===o.rel&&(r===e||r===t))return o}var s=document.getElementsByTagName("style");for(i=0;i<s.length;i++){var o;if((r=(o=s[i]).getAttribute("data-href"))===e||r===t)return o}})(i,r))return t();((e,t,n,i,r)=>{var s=document.createElement("link");s.rel="stylesheet",s.type="text/css",__webpack_require__.nc&&(s.nonce=__webpack_require__.nc),s.onerror=s.onload=n=>{if(s.onerror=s.onload=null,"load"===n.type)i();else{var o=n&&n.type,a=n&&n.target&&n.target.href||t,l=new Error("Loading CSS chunk "+e+" failed.\n("+o+": "+a+")");l.name="ChunkLoadError",l.code="CSS_CHUNK_LOAD_FAILED",l.type=o,l.request=a,s.parentNode&&s.parentNode.removeChild(s),r(l)}},s.href=t,n?n.parentNode.insertBefore(s,n.nextSibling):document.head.appendChild(s)})(e,r,null,t,n)}),t={792:0};__webpack_require__.f.miniCss=(n,i)=>{t[n]?i.push(t[n]):0!==t[n]&&{317:1}[n]&&i.push(t[n]=e(n).then(()=>{t[n]=0},e=>{throw delete t[n],e}))}}})(),(()=>{var e={792:0};__webpack_require__.f.j=(t,n)=>{var i=__webpack_require__.o(e,t)?e[t]:void 0;if(0!==i)if(i)n.push(i[2]);else{var r=new Promise((n,r)=>i=e[t]=[n,r]);n.push(i[2]=r);var s=__webpack_require__.p+__webpack_require__.u(t),o=new Error;__webpack_require__.l(s,n=>{if(__webpack_require__.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var r=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;o.message="Loading chunk "+t+" failed.\n("+r+": "+s+")",o.name="ChunkLoadError",o.type=r,o.request=s,i[1](o)}},"chunk-"+t,t)}};var t=(t,n)=>{var i,r,[s,o,a]=n,l=0;if(s.some(t=>0!==e[t])){for(i in o)__webpack_require__.o(o,i)&&(__webpack_require__.m[i]=o[i]);if(a)a(__webpack_require__)}for(t&&t(n);l<s.length;l++)r=s[l],__webpack_require__.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=self.webpackChunk_mixly_python_pyodide=self.webpackChunk_mixly_python_pyodide||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var __webpack_exports__=__webpack_require__(35237)})();