Files
2026-08-01 15:00:14 +00:00

2 lines
1.3 MiB
Plaintext
Raw Permalink 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.
(self.webpackChunkWebComponents=self.webpackChunkWebComponents||[]).push([[250,877],{12477:(e,t,n)=>{"use strict";n.d(t,{K:()=>b,c:()=>k});var i=n(78673),r=n(54250),s=n(34089);class o extends i.A{constructor(e,t,n,i){super(),this.audio_tour=null,this.audio_code=null,this.windowcode=null,this.first_audio=null,this.prev_audio=null,this.pause_audio=null,this.next_audio=null,this.last_audio=null,this.status=null,this.stop_button=null,this.tourButtons=[],this.elem=null,this.currIndex=null,this.len=null,this.buttonCount=null,this.aname=null,this.ahash=null,this.theDivid=null,this.afile=null,this.playing=!1,this.tourName="";var r=(t=(t=(t=(t=(t=t.replaceAll("*doubleq*",'"')).replaceAll("*singleq*","'")).replaceAll("*open*","(")).replaceAll("*close*",")")).replaceAll("*nline*","<br/>")).split("\n"),s=[],o=[],a=i.replaceAll("*doubleq*",'"').split("*atype*");for(let e=0;e<a.length-1;e++){s[e]=a[e];var l=a[e].split(";");o.push(l[0])}var u="<pre><div id='"+e+"_l1'>1. "+r[0]+"</div>",c=r.length;for(let t=1;t<c;t++)u=t<9?u+"<div id='"+e+"_l"+(t+1)+"'>"+(t+1)+". "+r[t]+"</div>":t<99?u+"<div id='"+e+"_l"+(t+1)+"'>"+(t+1)+". "+r[t]+"</div>":u+"<div id='"+e+"_l"+(t+1)+"'>"+(t+1)+". "+r[t]+"</div>";u+="</pre>";for(var d=0,f=0;f<a.length-1;f++){var h=document.createElement("button");h.className="btn btn-success",h.innerHTML=o[f].replace(/\"/g,""),this.tourButtons.push(h),d++}this.audio_tour=document.createElement("div"),this.audio_tour.align="center",this.audio_code=document.createElement("p"),this.windowcode=document.createElement("div"),this.windowcode.align="left",this.windowcode.innerHTML=u,this.first_audio=document.createElement("button"),this.prev_audio=document.createElement("button"),this.pause_audio=document.createElement("button"),this.next_audio=document.createElement("button"),this.last_audio=document.createElement("button"),this.first_audio.className="btn-default glyphicon glyphicon-fast-backward",this.prev_audio.className="btn-default glyphicon glyphicon-step-backward",this.pause_audio.className="btn-default glyphicon glyphicon-pause",this.next_audio.className="btn-default glyphicon glyphicon-step-forward",this.last_audio.className="btn-default glyphicon glyphicon-fast-forward",this.first_audio.setAttribute("style","height: 22px; width: 25px; border-radius: 4px; margin-right:2px;"),this.prev_audio.setAttribute("style","height: 22px; width: 25px; border-radius: 4px; margin-right:2px;"),this.pause_audio.setAttribute("style","height: 22px; width: 25px; border-radius: 4px; margin-right:2px;"),this.next_audio.setAttribute("style","height: 22px; width: 25px; border-radius: 4px; margin-right:2px;"),this.last_audio.setAttribute("style","height: 22px; width: 25px; border-radius: 4px; margin-right:2px;"),this.first_audio.name="first_audio",this.prev_audio.name="prev_audio",this.pause_audio.name="pause_audio",this.next_audio.name="next_audio",this.last_audio.name="last_audio",this.first_audio.title="Play first audio in tour",this.prev_audio.title="Play previous audio in tour",this.pause_audio.title="Pause current audio",this.next_audio.title="Play next audio in tour",this.last_audio.title="Play last audio in tour",this.first_audio.setAttribute("aria-label","Play first audio in tour"),this.prev_audio.setAttribute("aria-label","Play previous audio in tour"),this.pause_audio.setAttribute("aria-label","Pause audio"),this.next_audio.setAttribute("aria-label","Play next audio in tour"),this.last_audio.setAttribute("aria-label","Play last audio in tour"),this.first_audio.disabled=!0,this.prev_audio.disabled=!0,this.pause_audio.disabled=!0,this.next_audio.disabled=!0,this.last_audio.disabled=!0,this.status=document.createElement("div"),this.status.className="alert alert-info",this.status.setAttribute("style","display: none;"),this.stop_button=document.createElement("button"),this.stop_button.className="btn btn-default",this.stop_button.innerHTML="Stop tour",this.audio_tour.append(this.audio_code,this.windowcode,document.createElement("br"),this.first_audio,this.prev_audio,this.pause_audio,this.next_audio,this.last_audio,document.createElement("br"),this.status,document.createElement("br"),...this.tourButtons,this.stop_button);let p=document.getElementById(e),m=p.querySelector(".ac_code_div"),_=p.querySelector(".CodeMirror.ac-resizable"),b=p.querySelector(".ac_opt.btn.btn-default:last-child");m.appendChild(this.audio_tour),m.style.width="100%",_&&(_.style.display="none"),b&&(b.style.display="none"),this.stop_button.addEventListener("click",function(){this.playing&&this.elem.pause(),this.logBookEvent({event:"Audio",act:"closeWindow",div_id:e}),this.audio_tour.remove(),_&&(_.style.display=""),b&&(b.style.display=""),m.style.width=""}.bind(this));for(let t=0;t<5;t++)this.tourButtons[t]&&this.tourButtons[t].addEventListener("click",function(){this.tour(e,s[t],d)}.bind(this));this.first_audio.addEventListener("click",function(){this.firstAudio()}.bind(this)),this.prev_audio.addEventListener("click",function(){this.prevAudio()}.bind(this)),this.pause_audio.addEventListener("click",function(){this.pauseAndPlayAudio(e)}.bind(this)),this.next_audio.addEventListener("click",function(){this.nextAudio()}.bind(this)),this.last_audio.addEventListener("click",function(){this.lastAudio()}.bind(this)),this.first_audio.style.opacity=.25,this.prev_audio.style.opacity=.25,this.pause_audio.style.opacity=.25,this.next_audio.style.opacity=.25,this.last_audio.style.opacity=.25}tour(e,t,n){this.buttonCount=n,this.theDivid=e,this.status.setAttribute("style","display: inline-block; margin-top: 7px; margin-bottom: 3px;"),this.first_audio.disabled=!1,this.prev_audio.disabled=!1,this.pause_audio.disabled=!1,this.next_audio.disabled=!1,this.last_audio.disabled=!1,this.first_audio.style.opacity=1,this.prev_audio.style.opacity=1,this.pause_audio.style.opacity=1,this.next_audio.style.opacity=1,this.last_audio.style.opacity=1;for(var i=0;i<n;i++)this.tourButtons[i].disabled=!0;var s=t.split(";"),o=s[0].replaceAll('"'," ");this.tourName=o,this.status.innerHTML=(0,r.t)("msg_activecode_starting",o),this.logBookEvent({event:"Audio",act:o,div_id:e});var a=s.length,l="";for(this.ahash=[],this.aname=[],i=1;i<a-1;i++){var u=s[i].split(":"),c=u[0],d=u[1],f=d.substring(1,d.length),h=c.substring(1,c.length),p="../_static/audio/";l+="<audio id="+f+" preload='auto' >",l+="<source src='"+p+f+".wav' type='audio/wav'>",l+="<source src='"+p+f+".mp3' type='audio/mpeg'>",l+="<source src='"+p+f+".wav' type='audio/wav'>",l+="<source src='"+p+f+".mp3' type='audio/mpeg'>",l+="<br />Your browser does not support the audio tag</audio>",this.ahash[f]=h,this.aname.push(f)}this.audio_code.innerHTML=l,this.len=this.aname.length,this.currIndex=0,this.playCurrIndexAudio()}handlePlaying(){this.elem.pause(),this.elem.onended=null,this.unhighlightLines(this.theDivid,this.ahash[this.aname[this.currIndex]])}firstAudio(){this.handlePlaying(),this.logBookEvent({event:"Audio",act:"first",div_id:this.theDivid}),this.currIndex=0,this.playCurrIndexAudio()}prevAudio(){this.currIndex>0&&(this.handlePlaying(),this.logBookEvent({event:"Audio",act:"prev",div_id:this.theDivid}),this.currIndex=this.currIndex-1,this.playCurrIndexAudio())}nextAudio(){this.handlePlaying(),this.logBookEvent({event:"Audio",act:"next",div_id:this.theDivid}),this.currIndex<this.len-1?(this.currIndex=this.currIndex+1,this.playCurrIndexAudio()):this.currIndex==this.len-1&&this.handleTourEnd()}lastAudio(){this.handlePlaying(),this.logBookEvent({event:"Audio",act:"last",div_id:this.theDivid}),this.currIndex=this.len-1,this.playCurrIndexAudio()}playCurrIndexAudio(){this.playing=!1,this.playaudio(this.currIndex,this.aname,this.theDivid,this.ahash)}handleTourEnd(){this.status.innerHTML="The "+this.tourName+" has ended.",this.pause_audio.className="btn-default glyphicon glyphicon-pause",this.pause_audio.title="Pause audio",this.pause_audio.setAttribute("aria-label","Pause audio"),this.first_audio.disabled=!0,this.prev_audio.disabled=!0,this.pause_audio.disabled=!0,this.next_audio.disabled=!0,this.last_audio.disabled=!0,this.first_audio.style.opacity=.25,this.prev_audio.style.opacity=.25,this.pause_audio.style.opacity=.25,this.next_audio.style.opacity=.25,this.last_audio.style.opacity=.25;for(var e=0;e<this.buttonCount;e++)this.tourButtons[e].disabled=!1}outerAudio(){this.elem&&(this.elem.onended=null),this.playing=!1,this.unhighlightLines(this.theDivid,this.ahash[this.aname[this.currIndex]]),this.currIndex++,this.currIndex==this.len?this.handleTourEnd():this.playCurrIndexAudio()}playWhenReady(e,t,n){this.elem.oncanplaythrough=null,this.elem.currentTime=0,this.playing=!0,this.highlightLines(t,n[e]),this.elem.onended=function(){this.outerAudio()}.bind(this),"btn-default glyphicon glyphicon-pause"===this.pause_audio.className&&(this.status.innerHTML=(0,r.t)("msg_activecode_playing",this.tourName),this.elem.play())}playaudio(e,t,n,i){this.afile=t[e],this.elem=document.getElementById(this.afile),isNaN(this.elem.duration)||0==this.elem.duration?(this.status.innerHTML=(0,r.t)("msg_activecode_loading_audio"),this.elem.oncanplaythrough=function(){this.playWhenReady(this.afile,n,i)}.bind(this)):this.playWhenReady(this.afile,n,i)}pauseAndPlayAudio(e){this.pause_audio,this.elem.paused?(this.elem.duration,this.elem.currentTime,this.elem.play(),this.pause_audio.className="btn-default glyphicon glyphicon-pause",this.pause_audio.title=(0,r.t)("msg_activecode_pause_current_audio"),this.pause_audio.setAttribute("aria-label",(0,r.t)("msg_activecode_pause_audio")),this.status.innerHTML=(0,r.t)("msg_activecode_playing",this.tourName),this.logBookEvent({event:"Audio",act:"play",div_id:this.theDivid})):this.playing&&(this.elem.pause(),this.pause_audio.className="btn-default glyphicon glyphicon-play",this.pause_audio.title=(0,r.t)("msg_activecode_play_paused_audio"),this.pause_audio.setAttribute("aria-label",(0,r.t)("msg_activecode_play_paused_audio")),this.status.innerHTML=(0,r.t)("msg_activecode_audio_paused",this.tourName),this.logBookEvent({event:"Audio",act:"pause",div_id:this.theDivid}))}processLines(e,t,n){var i=t.split(",");if(i.length>1)for(let t=0;t<i.length;t++)this.setBackgroundForLines(e,i[t],n);else this.setBackgroundForLines(e,t,n)}unhighlightLines(e,t){this.processLines(e,t,"transparent")}highlightLines(e,t){this.processLines(e,t,"#ffff99")}setBackgroundForLines(e,t,n){var i=t.split("-");if(i.length>1)for(var r=parseInt(i[0]),s=parseInt(i[1])+1,o=r;o<s;o++){let t=document.getElementById(e+"_l"+o);t&&""!=t.textContent&&(t.style.backgroundColor=n)}else{let i=document.getElementById(e+"_l"+t);i&&(i.style.backgroundColor=n)}}}(0,r.Hh)({en:{msg_activecode_load_history:"Load History",msg_activecode_audio_tour:"Audio Tour",msg_activecode_loaded_code:"Loaded your saved code.",msg_activecode_no_saved_code:"No saved code.",msg_activecode_run_code:"Run",msg_activecode_input_submit:"Submit",msg_activecode_input_label:"Program input",msg_activecode_show_feedback:"Show Feedback",msg_activecode_show_code:"Show Code",msg_activecode_hide_code:"Hide Code",msg_activecode_show_codelens:"Show CodeLens",msg_activecode_show_in_codelens:"Show in CodeLens",msg_activecode_hide_codelens:"Hide Codelens",msg_activecode_reformat:"Reformat",msg_activecode_parse_error:"A parse error means that Python does not understand the syntax on the line the error message points out. Common examples are forgetting commas beteween arguments or forgetting a : on a for statement",msg_activecode_parse_error_fix:"To fix a parse error you just need to look carefully at the line with the error and possibly the line before it. Make sure it conforms to all of Python's rules.",msg_activecode_type_error:"Type errors most often occur when an expression tries to combine two objects with types that should not be combined. Like raising a string to a power",msg_activecode_type_error_fix:"To fix a type error you will most likely need to trace through your code and make sure the variables have the types you expect them to have. It may be helpful to print out each variable along the way to be sure its value is what you think it should be.",msg_activecode_name_error:"A name error almost always means that you have used a variable before it has a value. Often this may be a simple typo, so check the spelling carefully.",msg_activecode_name_error_fix:"Check the right hand side of assignment statements and your function calls, this is the most likely place for a NameError to be found.",msg_activecode_value_error:"A ValueError most often occurs when you pass a parameter to a function and the function is expecting one type and you pass another.",msg_activecode_value_error_fix:"The error message gives you a pretty good hint about the name of the function as well as the value that is incorrect. Look at the error message closely and then trace back to the variable containing the problematic value.",msg_activecode_attribute_error:"This error message is telling you that the object on the left hand side of the dot, does not have the attribute or method on the right hand side.",msg_activecode_attribute_error_fix:"The most common variant of this message is that the object undefined does not have attribute X. This tells you that the object on the left hand side of the dot is not what you think. Trace the variable back and print it out in various places until you discover where it becomes undefined. Otherwise check the attribute on the right hand side of the dot for a typo.",msg_activecode_token_error:"Most of the time this error indicates that you have forgotten a right parenthesis or have forgotten to close a pair of quotes.",msg_activecode_token_error_fix:"Check each line of your program and make sure that your parenthesis are balanced.",msg_activecode_time_limit_error:"Your program is running too long. Most programs in this book should run in less than 10 seconds easily. This probably indicates your program is in an infinite loop.",msg_activecode_time_limit_error_fix:"Add some print statements to figure out if your program is in an infinte loop. If it is not you can increase the run time with sys.setExecutionLimit(msecs)",msg_activecode_general_error:"Your program is running for too long. Most programs in this book should run in less than 30 seconds easily. This probably indicates your program is in an infinite loop.",msg_activecode_general_error_fix:"Add some print statements to figure out if your program is in an infinte loop. If it is not you can increase the run time with sys.setExecutionLimit(msecs)",msg_activecode_syntax_error:"This message indicates that Python can't figure out the syntax of a particular statement. Some examples are assigning to a literal, or a function call",msg_activecode_syntax_error_fix:"Check your assignment statements and make sure that the left hand side of the assignment is a variable, not a literal or a function.",msg_activecode_key_error:"This message indicates that you are trying to access an element of a dictionary, but the dictionary does not have that the key you are using.",msg_activecode_key_error_fix:"You may have a typo in the name of your key. It is also good practice to check if the key exists using a statement like if key in mydict. You can also use mydict.get(key,defaultvalue) so that if the key is not in the dictionary you get the default value instead of an error.",msg_activecode_index_error:"This message means that you are trying to index past the end of a string or a list. For example if your list has 3 things in it and you try to access the item at position 3 or more.",msg_activecode_index_error_fix:"Remember that the first item in a list or string is at index position 0, quite often this message comes about because you are off by one. Remember in a list of length 3 the last legal index is 2",msg_activecode_uri_error:"",msg_activecode_uri_error_fix:"",msg_activecode_import_error:"This error message indicates that you are trying to import a module that does not exist",msg_activecode_import_error_fix:"One problem may simply be that you have a typo. It may also be that you are trying to import a module that exists in 'real' Python, but does not exist in this book. If this is the case, please submit a feature request to have the module added.",msg_activecode_reference_error:"This is most likely an internal error, particularly if the message references the console.",msg_activecode_reference_error_fix:"Try refreshing the webpage, and if the error continues, submit a bug report along with your code",msg_activecode_zero_division_error:"This tells you that you are trying to divide by 0. Typically this is because the value of the variable in the denominator of a division expression has the value 0",msg_activecode_zero_division_error_fix:"You may need to protect against dividing by 0 with an if statment, or you may need to rexamine your assumptions about the legal values of variables, it could be an earlier statment that is unexpectedly assigning a value of zero to the variable in question.",msg_activecode_range_error:"This message almost always shows up in the form of Maximum call stack size exceeded.",msg_activecode_range_error_fix:"This always occurs when a function calls itself. Its pretty likely that you are not doing this on purpose. Except in the chapter on recursion. If you are in that chapter then its likely you haven't identified a good base case.",msg_activecode_internal_error:"An Internal error may mean that you've triggered a bug in our Python",msg_activecode_internal_error_fix:"Report this error, along with your code as a bug.",msg_activecode_indentation_error:"This error occurs when you have not indented your code properly. This is most likely to happen as part of an if, for, while or def statement.",msg_activecode_indentation_error_fix:"Check your if, def, for, and while statements to be sure the lines are properly indented beneath them. Another source of this error comes from copying and pasting code where you have accidentally left some bits of code lying around that don't belong there anymore.",msg_activecode_not_implemented_error:"This error occurs when you try to use a builtin function of Python that has not been implemented in this in-browser version of Python.",msg_activecode_not_implemented_error_fix:"For now the only way to fix this is to not use the function. There may be workarounds. If you really need this builtin function then file a bug report and tell us how you are trying to use the function.",msg_activecode_file_not_found:"File not found: '$1'",msg_activecode_no_file_or_dir:"[Errno 2] No such file or directory: '$1'",msg_activecode_starting:"Click the play button to begin the $1",msg_activecode_playing:"Playing the $1",msg_activecode_loading_audio:"Loading audio. Please wait. If the tour doesn't start soon click on the leftmost control button (Play first audio in tour)",msg_activecode_pause_current_audio:"Pause current audio",msg_activecode_pause_audio:"Pause audio",msg_activecode_play_paused_audio:"Play paused audio",msg_activecode_audio_paused:"The $1 has been paused. Click on the play button to resume the tour.",msg_activecode_input_prg:"Input for Program",msg_activecode_were_compiling_err:"There were errors compiling your code. See below.",msg_activecode_compile_only:"Code successfully compiled. No executable built.",msg_activecode_time_limit_exc:"Time Limit Exceeded on your program",msg_activecode_server_err:"A server error occurred",msg_activecode_compiling_running:"Compiling and Running your Code Now...",msg_activecode_server_comm_err:"Error communicating with the server.",msg_activecode_save_run:"Save & Run",msg_activecode_run_button_title:"Save & Run (ctrl-s)",msg_activecode_render:"Save & Render",msg_activecode_assertion_error:"An assertion error happens when python encounters an assertion statement. Python evaluates the expression to the right of the word assert; if that expression is True everything is fine and the program continues. If the expression is False Python raises an error and stops.",msg_activecode_assertion_error_fix:"Check the expression to the right of assert. The expression is False and you will need to determine why that is. You may want to simply print out the individual parts of the expression to understand why it is evaluating to False.",msg_activecode_load_db:"Loading DB...",msg_activecode_code_coach:"Code Coach",msg_activecode_passed:"Passed",msg_activecode_failed:"Failed",msg_activecode_unit_test_results:"Unit Test Results",msg_activecode_test_run_error:"Runtime error",msg_activecode_test_compile_error:"Compiler error",msg_activecode_iotest_results:"IO tests completed. See table for results.",msg_activecode_assertions_checked:"Assertions checked:"}}),(0,r.Hh)({"pt-br":{msg_activecode_load_history:"Carregar histórico",msg_activecode_audio_tour:"Tour de áudio",msg_activecode_loaded_code:"Código salvo carregado.",msg_activecode_no_saved_code:"Não há código salvo.",msg_activecode_run_code:"Executar",msg_activecode_show_feedback:"Exibir Feedbacks",msg_activecode_show_code:"Mostrar Código",msg_activecode_hide_code:"Ocultar Código",msg_activecode_show_codelens:"Mostrar CodeLens",msg_activecode_show_in_codelens:"Mostrar em CodeLens",msg_activecode_hide_codelens:"Ocultar Codelens",msg_activecode_reformat:"Reformatar",msg_activecode_parse_error:"Um erro de Parse significa que Python não entende a sintaxe da linha que a mensagem de erro aponta. Exemplos comuns são esquecer vírgulas entre argumentos ou esquecer ':' em um comando for.",msg_activecode_parse_error_fix:"Para corrigir um erro de Parse, você só precisa olhar cuidadosamente a linha com o erro e possivelmente a linha antes dela. Tenha certeza que estão de acordo com todas as regras de Python.",msg_activecode_type_error:"Erros de tipagem ocorrem mais frequentemente quando uma expressão tenta combinar dois objetos com tipos que não deveriam ser combinados. Como elevar uma String a uma potência.",msg_activecode_type_error_fix:"Para corrigir um erro de tipagem você provavelmente precisará percorrer seu código e ter certeza de que as variáveis possuem os tipos que você espera que elas tenham. Pode ser útil imprimir cada variável ao longo do caminho para checar se elas possuem o valor que você acha que deveriam ter.",msg_activecode_name_error:"Um erro de nome quase sempre significa que você usou uma variável antes dela ter um valor. Frequentemente isso pode ser um erro de digitação, então cheque a ortografia cuidadosamente.",msg_activecode_name_error_fix:"Cheque o lado direito das atribuições e suas chamadas de funções, são os lugares mais prováveis de encontrar um erro de nome.",msg_activecode_value_error:"Um erro de valor ocorre mais frequentemente quando uma função está esperando um tipo mas você passa um parâmetro de outro tipo.",msg_activecode_value_error_fix:"A mensagem de erro te dá uma boa dica sobre o nome da função e o valor incorreto. Leia atentamente a mensagem de erro e volte à variável que contém o valor problemático.",msg_activecode_attribute_error:"Essa mensagem de erro está te dizendo que o objeto do lado esquerdo do ponto não tem o atributo ou método do seu lado direito.",msg_activecode_attribute_error_fix:"A variante mais comum dessa mensagem é que o objeto indefinido não tem o atributo X. Isso diz que o objeto do lado esquerdo do ponto não é o que você pensa. Rastreie essa variável e imprima-a em vários lugares até descobrir onde ela se torna indefinida. Caso contrário, cheque se há erro de digitação no atributo do lado direito do ponto.",msg_activecode_token_error:"Na maioria das vezes este erro indica que você esqueceu de fechar um parênteses ou aspas.",msg_activecode_token_error_fix:"Cheque cada linha do seu programa e certifique-se de que todos os parênteses estão fechados.",msg_activecode_time_limit_error:"Seu programa está demorando muito. Os programas deste livro deveriam rodar em menos de 10 segundos. Isso provavelmente indica que seu programa está em um loop infinito.",msg_activecode_time_limit_error_fix:"Imprima mensagens em algumas linhas para descobrir se seu programa está em um loop infinito. Caso não esteja, você pode aumentar o tempo limite de execução com o comando sys.setExecutionLimit(ms)",msg_activecode_general_error:"Seu programa está demorando muito. Os programas deste livro deveriam rodar em menos de 30 segundos. Isso provavelmente indica que seu programa está em um loop infinito.",msg_activecode_general_error_fix:"Imprima mensagens em algumas linhas para descobrir se seu programa está em um loop infinito. Caso não esteja, você pode aumentar o tempo limite de execução com o comando sys.setExecutionLimit(ms)",msg_activecode_syntax_error:"Esta mensagem indica que Python não entendeu a sintaxe de um comando. Alguns exemplos são atribuição de um literal, ou uma chamada de função",msg_activecode_syntax_error_fix:"Cheque as atribuições de seu programa e certifique-se de que o lado esquerdo é uma variável, e não um literal ou função.",msg_activecode_key_error:"Esta mensagem indica que você está tentando acessar um elemento cuja chave não existe no dicionário.",msg_activecode_key_error_fix:"Você pode ter um erro de digitação no nome da sua chave. É uma boa prática checar se a chave existe usando um comando 'if (chave) in meu_dicionario'. Você também pode usar o comando 'meu_dicionario.get(chave, valorPadrão)' para obter o valor padrão ao invés de um erro caso a chave não exista.",msg_activecode_index_error:"Você está tentando acessar um índice além do final de uma string ou lista. Por exemplo, se sua lista possui 3 elementos nela e você tenta acessar o item na posição 3 ou mais.",msg_activecode_index_error_fix:"Lembre-se que o primeiro elemento de uma lista ou string está no índice 0, normalmente esta mensagem é exibida porque você errou o índice por 1. Em uma lista de tamanho 3, o último índice válido é 2",msg_activecode_uri_error:"",msg_activecode_uri_error_fix:"",msg_activecode_import_error:"Esta mensagem indica que você está tentando importar um módulo que não existe",msg_activecode_import_error_fix:"Um problema pode ser apenas um erro de digitação. Também pode ser que você está tentando importar um módulo que existe em Python 'real', mas não existe neste livro. Se este é o caso, por favor envie um pedido para ter esse módulo adicionado.",msg_activecode_reference_error:"Isso parece ser um erro interno, especialmente se a mensagem faz referência ao console.",msg_activecode_reference_error_fix:"Tente atualizar a página. Se o erro persistir, envie um relatório de bug junto com seu código",msg_activecode_zero_division_error:"Isso diz que você está tentando dividir por 0. Normalmente é porque o valor da variável no denominador de uma divisão tem o valor 0",msg_activecode_zero_division_error_fix:"Você pode proteger contra dividir por 0 com um comando 'if', ou você pode precisar reavaliar suas suposições sobre os valores das variáveis, pois um comando anterior pode ter inesperadamente atribuído o valor 0 a essa variável.",msg_activecode_range_error:"Esta mensagem quase sempre aparece na forma de 'Tamanho máximo da pilha de chamadas excedido'.",msg_activecode_range_error_fix:"Isso sempre ocorre quando uma função chama ela mesma. Provavelmente você não está fazendo isso de propósito, exceto no capítulo sobre recursão. Se você está nesse capítulo, então provavelmente ainda não identificou um bom caso base.",msg_activecode_internal_error:"Um erro interno pode significar que você desencadeou um bug no nosso Python",msg_activecode_internal_error_fix:"Reporte este erro como um bug, juntamente com seu código",msg_activecode_indentation_error:"Este erro ocorre quando você não indentou seu código devidamente. Isso é mais provável de ocorrer como parte de um comando if, for, while ou def.",msg_activecode_indentation_error_fix:"Cheque seus comandos if, def, for e while para ter certeza de que as linhas estão devidamente indentadas abaixo delas. Outra fonte deste erro é copiar e colar código em que você acidentalmente deixou restos de código que não pertencem mais ali.",msg_activecode_not_implemented_error:"Este erro ocorre quando você tenta usar uma função embutida de Python que não foi implementada nesta versão browser de Python.",msg_activecode_not_implemented_error_fix:"Por enquanto a única maneira de consertar isso é não usando a função. Podem haver soluções alternativas. Se você realmente precisa desta função embutida, envie-nos um relatório de bug e digac omo está tentando usar a função.",msg_activecode_file_not_found:"Arquivo não encontrado: '$1'",msg_activecode_no_file_or_dir:"[Erro nº 2] Arquivo ou diretório inexistente: '$1'",msg_activecode_starting:"Clique no botão de execução para começar $1",msg_activecode_playing:"Executando $1",msg_activecode_loading_audio:"Carregando áudio. Por favor, espere. Se o tour não começar logo, clique em 'Stop Tour' e tente novamente.",msg_activecode_pause_current_audio:"Pausar áudio atual",msg_activecode_pause_audio:"Pausar áudio",msg_activecode_play_paused_audio:"Reproduzir áudio pausado",msg_activecode_audio_paused:"$1 foi pausado. Clique no botão de execução para retomar o tour.",msg_activecode_input_prg:"Entrada para o programa",msg_activecode_were_compiling_err:"Houveram erros ao compilar seu código. Veja abaixo.",msg_activecode_time_limit_exc:"Limite de tempo excedido no seu programa",msg_activecode_server_err:"Um erro de servidor ocorreu",msg_activecode_compiling_running:"Compilando e executando seu código...",msg_activecode_server_comm_err:"Erro ao comunicar com o servidor.",msg_activecode_save_run:"Salvar & Executar",msg_activecode_render:"Salvar & Renderizar",msg_activecode_assertion_error:"Um erro de asserção ocorre quando python encontra um comando 'assert'. Python avalia a expressão do lado direito; se é verdadeira, o programa continua normalmente. Se é falsa, python gera um erro e para a execução.",msg_activecode_assertion_error_fix:"Cheque a expressão do lado direito de 'assert'. Essa expressão é falsa e é preciso verificar o motivo. Você pode querer imprimir cada parte da expressão e entender porque é falsa.",msg_activecode_load_db:"Carregando banco de dados..."}}),(0,r.Hh)({"sr-Cyrl":{msg_activecode_load_history:"Учитај историју",msg_activecode_audio_tour:"Аудио тура",msg_activecode_loaded_code:"Ваш изворни код је учитан.",msg_activecode_no_saved_code:"Не постоји снимљен код.",msg_activecode_run_code:"Покрени програм",msg_activecode_show_feedback:"Прикажи резултат",msg_activecode_show_code:"Прикажи код",msg_activecode_hide_code:"Затвори код",msg_activecode_show_codelens:"Корак по корак",msg_activecode_show_in_codelens:"Корак по корак",msg_activecode_hide_codelens:"Затвори корак по корак",msg_activecode_reformat:"Реформат",msg_sctivecode_parse_error:"Синтаксна грешка (parse error) значи да Пајтон не разуме синтаксу у линији кога на коју порука о грешци указује. Типични примери овакве грешке су заборавлјена двотачка код 'if' или 'for' исказа или заборављена запета између аргумената код позива функције",msg_sctivecode_parse_error_fix:"Да бисте исправили синтаксну грешку треба пажњиво да погледате линију изворног кода на коју указује поруга о грешци и можда претходну линину изворног кода. Проверите да ли су поштована сва синтаксна правила Пајтона."}});var a=n(15237),l=n.n(a),u=(n(74806),n(68656),n(12520),n(40576),n(16792),n(29532),n(48712),n(80330),n(57829),n(9751),n(79102),n(16564),n(97923),n(98098));n(49494),n(27377),(0,r.Hh)({en:{msd_pyflakes_coach_line:"Line"}});class c{async check(e){return new Promise((function(t,n){fetch("/ns/coach/python_check",{method:"POST",body:e}).then((e=>e.json())).then((n=>{if(""!==n.trim()){let i="",s=n.split("\n"),o=e.split("\n");for(let e of s)if(-1!=e.indexOf(".py:")){const t=/[^.]*.py:(\d+):(\d+):? (.*)/i;let n=e.match(t);n[3].includes("defined from star imports")||n[3].includes("*' used; unable to detect undefined names")||(i+=(0,r.t)("msd_pyflakes_coach_line")+n[1]+": "+n[3]+"\n",i+=o[n[1]-1]+"\n",i+=" ".repeat(n[2]-1)+"^\n")}else i+=e+"\n";i=i.slice(0,-1),t(i)}t(null)})).catch((e=>{n("Error in Pyflakes Coach: "+e)}))}))}}var d=n(57129);window.vegaEmbed=d.Ay;var f,h,p,m=!1;document.onmousedown=function(){},document.onmouseup=function(){},window.componentMap={};var _="chat.codes";l().commands.autocomplete=function(e){e.showHint({hint:l().hint.anyword})};class b extends i.A{constructor(e){super(e);var t=e.orig.querySelector("textarea");this.containerDiv=e.orig,this.useRunestoneServices=e.useRunestoneServices,this.python3=!0,this.origElem=t,this.origText=this.origElem.textContent,this.codeCoachList=[],this.divid=e.orig.id,this.problem_description=e.orig.querySelector(".ac_question")?.textContent||"",this.code=t.textContent||"\n\n\n\n\n",this.parsonspersonalize=(0,s.Qt)(t,"parsonspersonalize"),this.parsonsexample=(0,s.Qt)(t,"parsonsexample"),this.parsonsPersonalized=!1!==(0,s.Qt)(t,"parsons-personalized")&&"false"!==(0,s.Qt)(t,"parsons-personalized"),this.puzzleScaffoldingDivid=`help_puzzle_${this.parsonspersonalize}_${this.divid}`,this.language=(0,s.Qt)(t,"lang"),this.timelimit=(0,s.Qt)(t,"timelimit"),this.highlightLines=(0,s.Qt)(t,"highlight-lines"),this.includes=(0,s.Qt)(t,"include"),this.hidecode=(0,s.Qt)(t,"hidecode"),this.chatcodes=(0,s.Qt)(t,"chatcodes"),this.hidehistory=(0,s.Qt)(t,"hidehistory"),this.question=e.orig.querySelector(`[id="${this.divid}_question"]`),this.tie=(0,s.Qt)(t,"tie"),this.dburl=(0,s.Qt)(t,"dburl"),this.runButton=null,this.enabledownload=this.parseBooleanAttribute(t,"data-enabledownload"),this.downloadButton=null,this.saveButton=null,this.loadButton=null,this.outerDiv=null,this.partner="",this.runCount=0,this.firstAfterRun=!0,this.logResults=!0,!eBookConfig.allow_pairs||this.parseBooleanAttribute(t,"data-nopair")?this.enablePartner=!1:this.enablePartner=!0,this.output=null,this.inputRow=null,this.inputCount=0,this.graphics=null,this.codecoach=null,this.codelens=null,this.controlDiv=null,this.historyScrubber=null,this.timestamps=["Original"],this.autorun=this.parseBooleanAttribute(t,"data-autorun"),this.outputLineCount=0,this.outputLines=[],this.chatcodes&&eBookConfig.enable_chatcodes&&(f||(f=new WebSocket("wss://"+_)),h||(h=new window.sharedb.Connection(f)),p||(p=h.get("chatcodes","channels"))),(this.graderactive||this.isTimed)&&(this.hidecode=!1),this.includes&&(this.includes=this.includes.split(/\s+/));let n=this.code.indexOf("===iotests===");if(n>-1){let e=this.code.substring(n+13);this.iotests=JSON.parse(e),this.code=this.code.substring(0,n)}let i=this.code.match(/\^\^\^\^\^*/);if(i){let e=i.index,t=i[0].length;this.prefix=this.code.substring(0,e);let n="\n"==this.code[e+t]?t+1:t;this.code=this.code.substring(e+n)}let r=this.code.indexOf("^^^!");if(r>-1){this.visiblePrefixEnd=r;let e="\n"==this.code[r+4]?5:4;this.visiblePrefix=this.code.substring(0,r),this.code=this.visiblePrefix+this.code.substring(r+e)}let o=this.code.match(/=====*/);if(o){let e=o.index,t=o[0].length,n="\n"==this.code[e+t]?t+1:t;this.suffix=this.code.substring(e+n),""===this.suffix.trim()&&(this.suffix=null),this.code=this.code.substring(0,e)}let a=this.code.indexOf("===!");if(a>-1){let e="\n"==this.code[a+4]?5:4;this.visibleSuffixLength=this.code.length-a-e,this.visibleSuffix=this.code.substring(a+e),this.code=this.code.substring(0,a)+this.visibleSuffix}let l=this.trimLockedCode(this.code);if(this.history=[l],this.highlightedLines=[],this.lockedLines=[],this.lockTextMarkers=[],this.lockGutterLines=[],this.createEditor(),this.createOutput(),this.createControls(),(0,s.Qt)(t,"caption")?this.caption=(0,s.Qt)(t,"caption"):this.caption="ActiveCode",this.addCaption("runestone"),"python"!=this.language&&"python3"!=this.language||this.codeCoachList.push(new c),setTimeout(function(){this.editor.refresh()}.bind(this),1e3),this.decorateStatus(),this.autorun){const e=this.runButtonHandler.bind(this);"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):setTimeout(e,0)}this.indicate_component_ready(),"undefined"!=typeof Prism&&Prism.highlightAllUnder(this.containerDiv),this.helpLoaded=!1,this.prevHelpedCode=null}createEditor(e){this.outerDiv=document.createElement("div");var t=document.createElement("div");t.id=this.divid.replace(/_/g,"-").toLowerCase();var n=document.createElement("div");n.classList.add("ac_code_div"),n.setAttribute("aria-label","CodeMirror Editor"),this.codeDiv=n,this.origElem.replaceWith(this.outerDiv),t.id!==this.divid&&this.outerDiv.appendChild(t),this.outerDiv.appendChild(n);var i=this.language;"sql"===i?i="text/x-sql":"java"===i||"kotlin"===i?i="text/x-java":"cpp"===i?i="text/x-c++src":"c"===i?i="text/x-csrc":"python3"===i?i="python":"octave"===i||"MATLAB"===i?i="text/x-octave":"html"!==i&&"htmlmixed"!==i||(i="htmlmixed");let r=[];(this.visiblePrefixEnd||this.visibleSuffixLength)&&(r=[{className:"CodeMirror-lock-markers",style:"width: 16px"}]);var s=l()(n,{value:this.code,lineNumbers:!0,mode:i,indentUnit:Number(window.getComputedStyle(document.body).getPropertyValue("--code-editor-indentation")||4),matchBrackets:!0,autoMatchParens:!0,gutters:r,screenReaderLabel:"ActiveCode Editor",extraKeys:{Tab:"indentMore","Shift-Tab":"indentLess","Ctrl-Space":"autocomplete"}});l().on(s,"refresh",(e=>{window.requestAnimationFrame((()=>{s.display.scrollbars.vert.style.bottom="16px"}))}));let o=s.getWrapperElement();o.classList.add("ac-resizable"),"undefined"!=typeof ResizeObserver&&new ResizeObserver((()=>{s.refresh()})).observe(o),s.on("keydown",((e,t)=>{s.getWrapperElement().style.borderTopColor="#b43232",s.getWrapperElement().style.borderBottomColor="#b43232"})),s.on("change",function(e){if(0==s.acEditEvent||void 0===s.acEditEvent){if(this.origText===s.getValue()||this.addingScrubber)return void console.log("Fake change event, skipping the log");this.isAnswered=!0,this.logBookEvent({event:"activecode",act:"edit",div_id:this.divid}),s.acEditEvent=!0}this.firstAfterRun&&(this.firstAfterRun=!1,this.startEditTimeStamp=new Date),window.requestAnimationFrame((()=>{this.editor.display.scrollbars.vert.style.bottom="16px"}))}.bind(this)),this.isTimed&&(s.on("paste",(function(e,t){t.preventDefault()})),document.addEventListener("copy",(function(e){e.preventDefault()})),document.addEventListener("cut",(function(e){e.preventDefault()})),document.addEventListener("paste",(function(e){e.preventDefault()})));let a=this;document.addEventListener("keydown",(function(e){"Tab"===e.key&&(s.tabDown=!0)})),document.addEventListener("keyup",(function(e){"Tab"===e.key&&(s.tabDown=!1)})),s.getInputField().addEventListener("focus",(function(e){s.tabDown?s.setOption("extraKeys",{Tab:!1,"Shift-Tab":!1}):s.setOption("extraKeys",{Tab:"indentMore","Shift-Tab":"indentLess"})})),this.containerDiv.addEventListener("keydown",(function(e){if("KeyS"===e.code&&(e.ctrlKey||e.metaKey)){if(a.runButton.disabled)return;a.runButton.click(),e.preventDefault()}"Slash"===e.code&&(e.ctrlKey||e.metaKey)&&("function"==typeof s.toggleComment&&s.toggleComment(),e.preventDefault())})),this.editor=s,window.requestAnimationFrame((()=>{this.editor.display.scrollbars.vert.style.bottom="16px"})),this.setLockedRegions(),this.setHighlightLines(),this.hidecode&&(this.codeDiv.style.display="none")}async setHighlightLines(){this.editor.operation((()=>{this.highlightedLines.forEach((e=>{this.editor.removeLineClass(e,"wrap","CodeMirror__highlight-line")})),this.highlightedLines=[],this.highlightLines&&("number"==typeof this.highlightLines&&(this.highlightLines=this.highlightLines.toString()),this.highlightLines.split(",").forEach((e=>{let t=(e=e.trim()).split("-");if(t.length>1){let e=parseInt(t[0])-1,n=parseInt(t[1])-1;for(let t=e;t<=n;t++)t>=0&&t<=this.editor.doc.lastLine()&&(this.editor.addLineClass(t,"wrap","CodeMirror__highlight-line"),this.highlightedLines.push(t))}else{let e=parseInt(t[0])-1;e>=0&&e<=this.editor.doc.lastLine()&&(this.editor.addLineClass(e,"wrap","CodeMirror__highlight-line"),this.highlightedLines.push(e))}})))}))}async setLockedRegions(){this.editor.operation((()=>{function e(e){var t=document.createElement("div");t.className="CodeMirror__gutter-locked-marker",this.editor.setGutterMarker(e,"CodeMirror-lock-markers",t),this.lockGutterLines.push(e)}if(this.lockedLines.forEach((e=>{this.editor.removeLineClass(e,"wrap","CodeMirror__locked-line")})),this.lockedLines=[],this.lockGutterLines.forEach((e=>{this.editor.setGutterMarker(e,"CodeMirror-lock-markers",null)})),this.lockGutterLines=[],this.lockTextMarkers.forEach((e=>e.clear())),this.lockTextMarkers=[],this.visiblePrefixEnd){let t=this.editor.posFromIndex(this.visiblePrefixEnd-1).line;e.call(this,Math.floor((0+t)/2));for(let e=0;e<=t;e++)this.editor.addLineClass(e,"wrap","CodeMirror__locked-line"),this.lockedLines.push(e);let n=this.editor.posFromIndex(this.visiblePrefixEnd);this.lockTextMarkers.push(this.editor.markText({line:0,ch:0},{line:n.line,ch:n.ch},{readOnly:!0,atomic:!1,inclusiveLeft:!0,inclusiveRight:!1}))}if(this.visibleSuffixLength){let t=this.editor.doc.getValue().length-this.visibleSuffixLength,n=this.editor.posFromIndex(t),i=this.editor.doc.lastLine();e.call(this,Math.floor((n.line+i)/2));for(let e=n.line;e<=i;e++)this.editor.addLineClass(e,"wrap","CodeMirror__locked-line"),this.lockedLines.push(e);let r=this.editor.posFromIndex(t-1);this.lockTextMarkers.push(this.editor.markText({line:r.line,ch:r.ch},{line:this.editor.doc.lastLine()+1},{readOnly:!0,atomic:!1,inclusiveLeft:!1,inclusiveRight:!0}))}}))}async runButtonHandler(){this.runButton.disabled=!0,this.editor.getWrapperElement().style.borderTopColor=null,this.editor.getWrapperElement().style.borderBottomColor=null;try{await this.runProg()}catch(e){console.log(`there was an error ${e} running the code`)}this.logResults&&this.logCurrentAnswer(),this.runCoaches(),this.renderFeedback(),this.runButton.disabled=!1,this.runCount+=1,this.toggleAlert()}async getParsonsCodeTailor(){let e=this.language,t=this.editor.getValue(),n=this.divid,i="movable"===this.parsonspersonalize?"Solution":"partial"===this.parsonspersonalize?"Multiple":"unknown",r=this.parsonsexample,s=this.problem_description.split("\n").map((e=>e.trim())).filter((e=>""!==e)).join("\n"),o=function(t){if(null!==t&&""!==t){if("python"===e.toLowerCase()||"python3"===e.toLowerCase())return t.replace(/from unittest\.gui import TestCaseGui\s*\n/,"import unittest\n").replace(/class myTests\(TestCaseGui\):/,"class myTests(unittest.TestCase):").replace(/^\s*myTests\(\)\.main\(\)\s*$/m,"");if("java"===e.toLowerCase())return function(e){const t=e.match(/class\s+TestHelper\s*\{[\s\S]*?\}\s*/);return(t?t[0]:"")+"\n\npublic class BackendTest {\n public static void main(String[] args) {\n try {\n TestHelper.runAllTests();\n System.exit(0);\n } catch (Exception e) {\n System.exit(1);\n }\n }\n }"}(t)}}(this.suffix),a={language:e,student_code:t,problem_id:n,personalization_level:i,parsonsexample:r,problem_description:s,internal_test_case:o,parsons_personalized:this.parsonsPersonalized};return console.log("body:",a),new Promise(((e,t)=>{const n=new AbortController,i="Sorry, we are not able to generate Parsons blocks for you at this time.",r=setTimeout((()=>{n.abort(),t(i)}),18e4);fetch(`/ns/coach/parsons_scaffolding?course=${eBookConfig.course}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a),signal:n.signal}).then((e=>(clearTimeout(r),e.ok?e.json():e.text().then((t=>{throw new Error(`HTTP ${e.status} - ${t}`)}))))).then((t=>e(t))).catch((e=>{clearTimeout(r),console.log("Error or timeout waiting for Parsons scaffolding response",e,this.divid);const n=document.getElementById("scaffolding-loading-prompt-"+this.divid);if(n){n.querySelector("#loading-spinner")?.remove();const e=n.querySelector("#encouragement-text");e&&(e.textContent="⚠️ "+i);const t=n.querySelector("#countdown-text");t&&(t.textContent="🫶 Please contact the teaching staff for help!")}t("Error in Parsons Scaffolding: "+e)}))}))}async reopenHelpBtnHandler(e){function t(e,t){const n=[];let i=0;const r=t-100;for(;i<e.length;){let t=i+r;if(t<e.length){const n=e.lastIndexOf("\n",t);n>i&&(t=n+1)}n.push(e.substring(i,t)),i=t}return n}if(!0!==e&&(e=!1),window.latestParsonsHelpID==this.divid){document.getElementById(`scaffolding-container-${this.divid}`)?.classList.remove("hidden");let e={type:"receive_help",reopen:!0};return void this.logBookEvent({event:"gptparsons_base_reopen",act:JSON.stringify(e),div_id:this.divid})}window.latestParsonsHelpID=this.divid;const n=this.helpText.split("||split||"),i=n[0],r=n[1],s=n[2],o=n[3];this.codeAnswer=i;const a=r;let l={type:"receive_help",reopen:!e,code_answer:this.codeAnswer,generation_type:s,solution_type:o};"movable"===this.parsonspersonalize||"partial"===this.parsonspersonalize?l.puzzle=function(e){if(!e||"string"!=typeof e)return"No valid Parsons content available";let t=e.replace(/<pre[^>]*>/g,"").replace(/<\/pre>/g,"");t=t.replace(/<br\s*\/?>/g,"\n");let n=document.createElement("div");return n.innerHTML=t,t=n.innerText||n.textContent,t.trim()}(a):(console.warn("No personalization level is set. Puzzle will not be assigned."),l.puzzle="No puzzle type selected"),(n=>{const i={type:n.type,reopen:n.reopen,generation_type:n.generation_type,solution_type:n.solution_type};if(this.logBookEvent({event:"gptparsons_base",act:JSON.stringify(i),div_id:this.divid}),n.code_answer){let i=1;const r=t(n.code_answer,512);r.forEach((s=>{this.logBookEvent({event:`gptparsons_code_${i}`,act:JSON.stringify({reopen:!e,type:"code",content:s,chunkIndex:i,totalChunks:r.length+(n.puzzle?t(n.puzzle,512).length:0)}),div_id:this.divid}),i++}))}if(n.puzzle){const i=t(n.puzzle,512);let r=1;i.forEach((t=>{this.logBookEvent({event:`gptparsons_puzzle_${r}`,act:JSON.stringify({reopen:!e,type:"puzzle",content:t,chunkIndex:r,totalChunks:i.length}),div_id:this.divid}),r++}))}})(l);let c=this.outerDiv.querySelectorAll(".ac_question"),d=c.length?c[c.length-1].innerHTML:void 0;if("correctCode"!==a&&"emptyHelpParsons"!==a)var f=`\n <div class="runestone parsons-container ">\n <div data-component="parsons" id="${this.puzzleScaffoldingDivid}" class="parsons" >\n <div class="parsons_question parsons-text exercise-statement" >`+d+"</div>"+a+"</div></div>";else f="";if(document.getElementById(`parsons-scaffolding-${this.divid}`))document.getElementById(`scaffolding-container-${this.divid}`)?.classList.remove("hidden");else{console.log("Creating new scaffolding container for",this.divid);let e=document.createElement("div");e.id=`scaffolding-container-${this.divid}`,e.classList.add("scaffolding-container"),this.outerDiv.insertBefore(e,this.outerDiv.firstChild);let t=document.createElement("button");t.classList.add("btn","btn-success"),t.innerText="Close Help",t.onclick=e=>{let t="unknown",n=e.currentTarget.closest(`#scaffolding-container-${this.divid}`);if(n){let e=n.querySelector(`#parsons-scaffolding-${this.divid}`);if(e){let n=e.querySelector(".runestone.parsons-container");if(n){let e=n.querySelector('[id^="help_"]');e?t=e.id:console.error('Inner div with id starting with "help_parsons_" not found')}else console.error("parsons-container not found")}else console.error("parsons-scaffolding not found")}else console.error("Scaffolding container not found");this.logBookEvent({event:"gptparsons_close",act:JSON.stringify({type:"close_help"}),div_id:t}),document.getElementById(`scaffolding-container-${this.divid}`)?.classList.add("hidden")},e.appendChild(t);let n=document.createElement("button");n.id=`copy-answer-button-${this.puzzleScaffoldingDivid}`,n.classList.add("btn","btn-success","copy-button-hide"),n.innerText="Copy Answer to Clipboard",n.onclick=()=>{this.copyScaffoldingSolutionToClipboard()},e.appendChild(n);let i=document.createElement("div");i.id=`parsons-scaffolding-${this.divid}`,i.classList.add("parsons-scaffolding"),e.appendChild(i)}"movable"===this.parsonspersonalize||"partial"===this.parsonspersonalize?"correctCode"!==a&&"emptyHelpParsons"!==a?await(0,u.JK)(f,`parsons-scaffolding-${this.divid}`):"emptyHelpParsons"===a?document.getElementById(`parsons-scaffolding-${this.divid}`).innerHTML="<div class='alert alert-warning'>Oops! Your code stumped our puzzle machine. Call in your instructor for a power-up!</div>":"correctCode"===a&&(document.getElementById(`parsons-scaffolding-${this.divid}`).innerHTML="<div class='alert alert-info'>Your code is already correct! No Parsons puzzle needed.</div>"):document.getElementById(`parsons-scaffolding-${this.divid}`).innerHTML="<div class='alert alert-warning'>No Parsons puzzle available.</div>"}copyScaffoldingSolutionToClipboard(){var e=document.createElement("textarea");e.id="temp-textarea",document.querySelector(`#scaffolding-container-${this.divid}`).appendChild(e),"movable"===this.parsonspersonalize||"partial"===this.parsonspersonalize?e.value=this.codeAnswer:e.value="No solution available",console.log(this.codeAnswer),e.select(),e.setSelectionRange(0,99999);try{document.execCommand("copy"),e.remove();let t={type:"copy_help"};this.logBookEvent({event:"gptparsons_copy",act:JSON.stringify({...t}),div_id:this.divid});let n=document.getElementById(`copy-answer-button-${this.puzzleScaffoldingDivid}`);n&&(n.textContent="Copied!",n.disabled=!0),setTimeout((()=>{n&&(n.textContent="Copy Answer to Clipboard",n.disabled=!1)}),2e3)}catch(e){alert("Oops! There was an issue copying to the clipboard. Please type the solution manually.")}}async parsonsBtnHandler(){function e(e,t){const n=[];let i=0;const r=t-100;for(;i<e.length;){let t=i+r;if(t<e.length){const n=e.lastIndexOf("\n",t);n>i&&(t=n+1)}n.push(e.substring(i,t)),i=t}return n}if(this.parsonsBtn&&!this.parsonsBtn.disabled&&(this.parsonsBtn.disabled=!0),null!=this.prevHelpedCode&&this.prevHelpedCode.trim()==this.editor.getValue().trim())return void alert('Your code has not changed, please click "See Help Again"');let t=document.querySelector("#temp-textarea");t&&t.remove(),this.prevHelpedCode=this.editor.getValue(),this.outerDiv.querySelector(`[id="scaffolding-loading-prompt-${this.divid}"]`)?.remove();let n=document.createElement("div");n.id="scaffolding-loading-prompt-"+this.divid,n.classList.add("scaffolding-loading-prompt");let i=document.createElement("div");i.id="loading-spinner",this.outerDiv.insertBefore(n,this.outerDiv.firstChild);let r=document.createElement("div");r.id="encouragement-text",n.appendChild(r),n.appendChild(i);let s=document.createElement("div");s.id="countdown-text",n.appendChild(s),n.classList.add("loading"),n.scrollIntoView(),r.innerText="Appreciate your effort! Please wait while we generate the help for you.",s.innerText="Working hard on displaying all blocks at once for you...";let o={type:"request_help",code:this.editor.getValue()};if(this.logBookEvent({event:"gptparsons_request_base",act:this.parsonspersonalize,div_id:this.divid}),o.code){let t=1;e(o.code,512).forEach((n=>{this.logBookEvent({event:`gptparsons_request_code_${t}`,act:JSON.stringify({type:"code",content:n,requestChunkIndex:t,totalChunks:t.length+e(o.code,512).length}),div_id:this.divid}),t++}))}this.helpText=await this.getParsonsCodeTailor(),this.outerDiv.querySelector(`[id="scaffolding-loading-prompt-${this.divid}"]`)?.classList.remove("loading"),window.latestParsonsHelpID="",this.reopenHelpBtnHandler(!0),this.helpLoaded||(this.helpLoaded=!0,this.outerDiv.querySelectorAll(".reopen-help-btn").forEach((e=>e.classList.remove("hide"))),"movable"!==this.parsonspersonalize&&"partial"!==this.parsonspersonalize||this.outerDiv.querySelectorAll(".parsons-scaffolding-btn").forEach((e=>{e.textContent="Regenerate Help"})))}createControls(){var e,t=document.createElement("div");if(t.classList.add("ac_actions"),(e=document.createElement("button")).title=(0,r.t)("msg_activecode_run_button_title"),e.textContent=(0,r.t)("msg_activecode_run_code"),e.classList.add("btn","btn-success","run-button"),t.appendChild(e),this.runButton=e,this.runButton.onclick=this.runButtonHandler.bind(this),e.setAttribute("type","button"),(this.enabledownload||eBookConfig.downloadsEnabled)&&this.addDownloadButton(t),this.hidecode||this.hidehistory||this.addHistoryScrubber(!0),this.parseBooleanAttribute(this.origElem,"data-gradebutton")&&!this.graderactive&&this.addFeedbackButton(t),this.hidecode&&this.enableHideShow(t),this.parseBooleanAttribute(this.origElem,"data-codelens")&&!this.graderactive&&this.enableCodeLens(t),"movable"===this.parsonspersonalize||"partial"===this.parsonspersonalize){let e=document.createElement("button");e.innerText="Get Help",e.classList.add("btn","parsons-scaffolding-btn"),e.onclick=this.parsonsBtnHandler.bind(this),t.appendChild(e);let n=document.createElement("button");n.innerText="See Help Again",n.classList.add("btn","reopen-help-btn","hide"),n.onclick=this.reopenHelpBtnHandler.bind(this),t.appendChild(n)}S.has(this.language)&&this.enableReformat(t),(0,s.Qt)(this.origElem,"audio")&&this.enableAudioTours(t),eBookConfig.isInstructor&&this.enableInstructorSharing(t),this.enablePartner&&this.setupPartner(t),this.chatcodes&&eBookConfig.enable_chatcodes&&this.enableChatCodes(t),this.outerDiv.prepend(t),this.question&&(this.question.innerHTML.match(/^\s+$/)?this.question.remove():this.outerDiv.prepend(this.question)),this.controlDiv=t}addFeedbackButton(e){let t=document.createElement("button");t.classList.add("ac_opt","btn","btn-default"),t.textContent=(0,r.t)("msg_activecode_show_feedback"),t.style.marginLeft="10px",t.setAttribute("type","button"),this.gradeButton=t,e.appendChild(t),t.addEventListener("click",this.createGradeSummary.bind(this))}addDownloadButton(e){let t=document.createElement("button");t.textContent="Download",t.classList.add("btn","save-button"),e.appendChild(t),this.downloadButton=t,t.addEventListener("click",this.downloadFile.bind(this,this.language)),t.setAttribute("type","button")}enableHideShow(e){this.runButton.disabled=!0;let t=document.createElement("button");t.classList.add("ac_opt","btn","btn-default"),t.textContent=(0,r.t)("msg_activecode_show_code"),t.style.marginLeft="10px",t.setAttribute("type","button"),this.showHideButt=t,e.appendChild(t),t.addEventListener("click",function(){(0,s.BM)(this.codeDiv),null==this.historyScrubber?this.addHistoryScrubber(!0):(0,s.BM)(this.historyScrubber.parentElement),this.showHideButt.textContent==(0,r.t)("msg_activecode_show_code")?this.showHideButt.textContent=(0,r.t)("msg_activecode_hide_code"):this.showHideButt.textContent=(0,r.t)("msg_activecode_show_code"),this.runButton.disabled=!this.runButton.disabled}.bind(this))}enableCodeLens(e){let t=document.createElement("button");t.classList.add("ac_opt","btn","btn-default"),t.textContent=(0,r.t)("msg_activecode_show_codelens"),t.style.marginLeft="10px",this.clButton=t,e.appendChild(t),t.addEventListener("click",this.showCodelens.bind(this))}enableReformat(e){let t=document.createElement("button");t.classList.add("ac_opt","btn","btn-default"),t.textContent=(0,r.t)("msg_activecode_reformat"),t.style.marginLeft="10px",this.reformatButton=t,e.appendChild(t),t.addEventListener("click",this.reformat.bind(this))}enableAudioTours(e){let t=document.createElement("button");t.classList.add("ac_opt","btn","btn-default"),t.textContent=(0,r.t)("msg_activecode_audio_tour"),t.style.marginLeft="10px",this.atButton=t,e.appendChild(t),t.addEventListener("click",function(){new o(this.divid,this.code,1,(0,s.Qt)(this.origElem,"audio"))}.bind(this))}enableInstructorSharing(e){let t=document.createElement("button");t.classList.add("btn","btn-info"),t.textContent="Share Code",t.style.marginLeft="10px",this.shareButt=t,e.appendChild(t),t.addEventListener("click",async function(){if(!confirm("You are about to share this code with ALL of your students. Are you sure you want to continue?"))return;let e={divid:this.divid,code:this.editor.getValue(),lang:this.language},t=new Request("/assignment/instructor/broadcast_code",{method:"POST",headers:this.jsonHeaders,body:JSON.stringify(e)}),n=await fetch(t);if(!n.ok)return void(303===n.status||404===n.status?alert("You must be logged in to share code"):alert("Sharing Failed return status: ${post_promise.status}"));let i=await n.json();"success"===i.mess?alert(`Shared Code with ${i.share_count} students`):alert("Sharing Failed")}.bind(this))}setupPartner(e){var t=document.createElement("input");t.type="checkbox",t.id=`${this.divid}_part`,e.appendChild(t);var n=document.createElement("label");n.for=`${this.divid}_part`,n.textContent="Pair?",e.appendChild(n),t.addEventListener("click",function(){if(this.partner)this.partner=!1,i.style.display="none",this.partner="",i.value="",n.textContent="Pair?";else{let e=localStorage.getItem("partnerAgree");if(!e){if(e=confirm("Pair Programming should only be used with the consent of your instructor.Your partner must be a registered member of the class and have agreed to pair with you.By clicking OK you certify that both of these conditions have been met."),!e)return;localStorage.setItem("partnerAgree","true")}this.partner=!0,n.textContent="with: ",i.style.display=""}}.bind(this));var i=document.createElement("input");i.type="text",e.appendChild(i),i.style.display="none",i.addEventListener("change",function(){this.partner=i.value}.bind(this))}enableChatCodes(e){var t=document.createElement("div"),n=document.createElement("span"),i=window.location.host+"-"+this.divid;e.appendChild(t),t.textContent="Chat: ",t.appendChild(n);let r=document.createElement("a");r.classList.add("ac_opt","btn","btn-default"),r.textContent="Create Channel",r.style.marginLeft="10px",r.setAttribute("type","button"),r.setAttribute("target","_blank"),r.setAttribute("href","http://"+_+"/new?"+new URLSearchParams({topic:window.location.host+"-"+this.divid,code:this.editor.getValue(),lang:"Python"}).toString()),this.chatButton=r,t.appendChild(r);var s=function(){var e=p.data,t=1;n.innerHTML="",e.channels.forEach((function(e){if(!e.archived&&i===e.topic){var r=document.createElement("a");r.href="http://"+_+"/"+e.channelName,r.target="_blank",r.textContent=" "+e.channelName+"("+t+") ",n.appendChild(r),t++}})),1===t&&(n.textContent="(no active converstations on this problem)")};p.subscribe(s),p.on("op",s)}enableSaveLoad(){this.runButton.textContent=(0,r.t)("msg_activecode_save_run")}async addHistoryScrubber(e){let t;this.addingScrubber=!0;var n={acid:this.divid};if(void 0!==this.sid&&(n.sid=this.sid),console.log("before get hist"),eBookConfig.practice_mode||!eBookConfig.isLoggedIn||this.isTimed&&!this.assessmentTaken)this.renderScrubber();else{let i=new Request(`${eBookConfig.new_server_prefix}/assessment/gethist`,{method:"POST",headers:this.jsonHeaders,body:JSON.stringify(n)});try{t=await fetch(i);let e=await t.json();if(!t.ok)throw new Error(`Failed to get the history data: ${e.detail}`);if(e=e.detail,void 0!==e.history){this.history=this.history.concat(e.history);for(let t in e.timestamps)this.timestamps.push(new Date(e.timestamps[t]).toLocaleString())}}catch(e){console.log(`unable to fetch history: ${e}`)}this.renderScrubber(e)}return this.addingScrubber=!1,"success"}renderScrubber(e){console.log("making a new scrubber");var t=document.createElement("div");t.classList.add("ac_history_scrubber_box"),t.style.display="inline-block",t.style.marginLeft="10px",t.style.marginRight="10px",t.style.minWidth="200px",t.style.maxWidth="300px";var n=document.createElement("input");if(n.type="range",n.min=0,n.max=this.history.length-1,n.value=this.history.length-1,n.step=1,n.classList.add("ac_history_scrubber"),n.setAttribute("aria-label","History slider"),this.timestampP=document.createElement("span"),this.slideit=function(e){let t=Number(n.value),i=this.history[t],r=this.readdLockedCode(i);this.editor.setValue(r),this.setLockedRegions();var s=this.timestamps[t];let o=this.history.length;this.timestampP.textContent=`${s} - ${t+1} of ${o}`,null!==e&&"input"!=e.type&&this.logBookEvent({event:"activecode",act:"slide:"+s,div_id:this.divid}),this.setHighlightLines()},n.style.margin="10px",n.addEventListener("input",this.slideit.bind(this)),n.addEventListener("change",this.slideit.bind(this)),t.appendChild(n),t.appendChild(this.timestampP),this.deadline){let e=0,t=!1;for(;e<this.history.length&&!t;)new Date(this.timestamps[e])>this.deadline?t=!0:e+=1;e-=1,n.value=Math.max(e,0);let i=this.history[Number(n.value)],r=this.readdLockedCode(i);this.editor.setValue(r),this.setLockedRegions()}else if(e){n.value=this.history.length-1;let e=this.history[Number(n.value)],t=this.readdLockedCode(e);this.editor.setValue(t),this.setLockedRegions()}else n.value=0;this.setHighlightLines();let i=Number(n.value),r=this.history.length,s=this.timestamps[i];this.timestampP.textContent=`${s} - ${i+1} of ${r}`,this.historyScrubber=n,this.runButton.insertAdjacentElement("afterend",t)}createOutput(){var e=document.createElement("div");e.classList.add("ac_output"),this.outDiv=e,this.output=document.createElement("pre"),this.output.id=this.divid+"_stdout",this.output.setAttribute("aria-label","Output"),this.output.setAttribute("aria-live","polite"),this.output.setAttribute("aria-atomic","true"),this.output.setAttribute("role","log"),this.output.innerHTML="",this.output.style.maxHeight="400px",this.output.style.overflow="auto",this.graphics=document.createElement("div"),this.graphics.id=this.divid+"_graphics",this.graphics.classList.add("ac-canvas"),new MutationObserver((()=>{this.graphics.querySelector("canvas")&&this.graphics.classList.add("visible-ac-canvas")})).observe(this.graphics,{childList:!0,subtree:!0});var t=document.createElement("div");t.classList.add("alert","alert-warning","codecoach"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("role","log"),t.style.display="none",t.appendChild(document.createElement("h3")).textContent=(0,r.t)("msg_activecode_code_coach"),this.outerDiv.appendChild(t),this.codecoach=t,e.appendChild(this.output),e.appendChild(this.graphics),this.outerDiv.appendChild(e);var n=document.createElement("div");n.classList.add("codelens"),n.id=`${this.divid}_codelens`,n.style.display="none",this.codelens=n,this.outerDiv.appendChild(n),this.eContainer=document.createElement("div"),this.eContainer.setAttribute("aria-live","polite"),this.eContainer.setAttribute("aria-atomic","true"),this.eContainer.setAttribute("role","log"),this.eContainer.className="error alert alert-danger",this.eContainer.id=this.divid+"_errinfo",this.eContainer.style.visibility="hidden",this.outerDiv.appendChild(this.eContainer)}disableSaveLoad(){this.saveButton&&(this.saveButton.classList.add("disabled"),this.saveButton.title="Login to save your code"),this.loadButton&&(this.loadButton.classList.add("disabled"),this.loadButton.title="Login to load your code")}computeChangesPerSecond(){let e;if(this.editor.getValue(),!this.historyScrubber)return 0;e=this.history[this.historyScrubber.value-1];const t=this.computeEditDistance(),n=((new Date).getTime()-this.startEditTimeStamp)/1e3;return n>36e3?-1:t/n}computeEditDistance(){const e=this.editor.getValue();let t;if(!this.historyScrubber)return 0;t=this.history[this.historyScrubber.value];const n=[];for(let i=0;i<=e.length;i++){n[i]=[];for(let e=0;e<=t.length;e++)n[i][e]=0===i?e:0===e?i:0}for(let i=1;i<=e.length;i++)for(let r=1;r<=t.length;r++)e[i-1]===t[r-1]?n[i][r]=n[i-1][r-1]:n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+1);return n[e.length][t.length]}downloadFile(e){var t=this.divid+"_"+(new Date).toJSON().substring(0,10).split("-").join("")+"."+g[e],n=this.editor.getValue();if("Blob"in window){var i=n.replace(/\n/g,"\r\n"),r=new Blob([i],{type:"text/plain"});if("msSaveOrOpenBlob"in navigator)navigator.msSaveOrOpenBlob(r,t);else{var s=document.createElement("a");s.download=t,s.innerHTML="Download File",s.href=window.URL.createObjectURL(r),s.style.display="none",document.body.appendChild(s),s.click()}}else alert("Your browser does not support the HTML5 Blob.")}async createGradeSummary(){var e={div_id:this.divid};let t=new Request("/assignment/student/getassignmentgrade",{method:"POST",headers:this.jsonHeaders,body:JSON.stringify(e)}),n=await fetch(t),i=await n.json();var r;i?2==i.version?(r="<h4>Grade Report</h4><p>This question: "+i.grade,i.released&&(r+=" out of "+i.max),r+="</p> <p>",0==i.released&&(r+="Preliminary Comments: "),r+=i.comment+"</p>"):r="<h4>Grade Report</h4><p>This assignment: "+i.grade+"</p><p>"+i.comment+"</p><p>Number of graded assignments: "+i.count+"</p><p>Average score: "+i.avg+"</p>":r="<h4>The server did not return any grade information</h4>";var s=document.createElement("dialog");return s.classList.add("ac_grade_summary_dialog"),s.innerHTML=`<div class="modal-content">\n <div class="modal-header">\n <button type="button" class="close" aria-label="Close">&times;</button>\n <h4 class="modal-title">Assignment Feedback</h4>\n </div>\n <div class="modal-body">\n ${r}\n </div>\n </div>`,s.querySelector("button.close").addEventListener("click",(()=>s.close())),s.addEventListener("close",(()=>s.remove())),document.body.appendChild(s),"function"==typeof s.showModal?s.showModal():s.setAttribute("open",""),n}async showCodelens(){if("none"!=this.codelens.style.display)return this.codelens.style.display="none",void(this.clButton.innerText=(0,r.t)("msg_activecode_show_in_codelens"));this.codelens.style.display="block",this.clButton.innerText=(0,r.t)("msg_activecode_hide_codelens");var e=this.codelens.firstChild;e&&this.codelens.removeChild(e);var t=await this.buildProg(!1),n={};n.code=t,n.origin="opt-frontend.js",n.cumulative=!1,n.heapPrimitives=!1,n.drawParentPointers=!1,n.textReferences=!1,n.showOnlyOutputs=!1,n.rawInputLstJSON=JSON.stringify([]),"python"==this.language?this.python3?n.py=3:n.py=2:"javascript"==this.langauge?n.py="js":n.py=this.language,n.curInstr=0,n.codeDivWidth=350,n.codeDivHeight=400;var i=`https://pythontutor.com/iframe-embed.html#${new URLSearchParams(n).toString()}`,s=document.createElement("iframe");s.setAttribute("id",this.divid+"_codelens"),s.setAttribute("width","100%"),s.setAttribute("height","500"),s.setAttribute("style","display:block"),s.style.background="#fff",s.src=i,this.codelens.appendChild(s),this.logBookEvent({event:"codelens",act:"view",div_id:this.divid})}reformat(){const e=this.editor.firstLine(),t=this.editor.lastLine();for(let n=e;n<=t;n++)this.editor.indentLine(n);this.reformatButton.blur()}toggleEditorVisibility(){}addErrorMessage(e){this.errLastRun=!0,console.log(e);var t=document.createElement("h3");t.innerHTML="Error",this.eContainer.appendChild(t);var n=this.eContainer.appendChild(document.createElement("pre"));if(e.traceback&&e.traceback.length>=1){var i=e.traceback[0].lineno;if(i<=this.pretextLines)return void(n.innerHTML="An error occurred in the hidden, included code. Sorry we can't give you a more helpful error message");if(i>this.progLines+this.pretextLines)return void(n.innerHTML=`An error occurred after the end of your code.\nOne possible reason is that you have an unclosed parenthesis or string.\nAnother possibility is that there is an error in the hidden test code.\nYet another is that there is an internal error. The internal error message is: ${e.message}`);this.pretextLines>0&&(e.traceback[0].lineno=e.traceback[0].lineno-this.pretextLines+1)}var r=e.toString(),s=r.indexOf(":"),o=r.substring(0,s);n.innerHTML=r,this.eContainer.insertAdjacentHTML("beforeend","<h3>Description</h3>"),this.eContainer.appendChild(document.createElement("p")).innerHTML=y[o],this.eContainer.insertAdjacentHTML("beforeend","<h3>To Fix</h3>"),this.eContainer.appendChild(document.createElement("p")).innerHTML=y[o+"Fix"],o.toLowerCase()}setTimeLimit(e){var t=this.timelimit;void 0!==e&&(t=e),this.code.indexOf("ontimer")>-1||this.code.indexOf("onclick")>-1||this.code.indexOf("onkey")>-1||this.code.indexOf("setDelay")>-1?Sk.execLimit=null:Sk.execLimit="off"===t?null:t||25e3}builtinRead(e){if(void 0===Sk.builtinFiles||void 0===Sk.builtinFiles.files[e])throw(0,r.t)("msg_activecode_file_not_found",e);return Sk.builtinFiles.files[e]}fileReader(e){let t=document.getElementById(e);if(null===t&&(t=document.querySelector(`[data-filename="${e}"]`)),Sk.builtinFiles.files.hasOwnProperty(e)){let n=Sk.builtinFiles.files[e];if(null===t)return n;console.log("Name conflict for file: "+e+" in Skulpt and in the DOM. Using DOM file.")}if(null!=t){let e;if("textarea"==t.nodeName.toLowerCase())e=t.value;else{let n=t.querySelector("pre");e=n?n.textContent:t.textContent}return e}if(!e.endsWith(".js")&&!e.endsWith(".py")){let t=null,n=new XMLHttpRequest;n.open("GET",`/ns/logger/get_source_code?course_id=${eBookConfig.course}&filename=${e}`,!1);try{n.send(),n.status>=200&&n.status<300&&(t=JSON.parse(n.responseText).detail.file_contents)}catch(t){console.log(`failed to fetch ${e}: ${t}`)}if(t)return t;throw new Sk.builtin.IOError((0,r.t)("msg_activecode_no_file_or_dir",e))}}outputfun(e){this.outputLineCount>1e3||(e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br/>"),this.outputLineCount<1e3?(this.output.insertAdjacentHTML("beforeend",e),this.outputLineCount+=1):(this.output.insertAdjacentHTML("beforeend","Too Much output"),this.outputLineCount+=1,m=!0))}inputfun(e){return new Promise((t=>{this.outDiv.style.visibility="visible",this.removeInputRow();let n=document.createElement("span");n.classList.add("ac-input-row");let i=`${this.divid}_input_${this.inputCount}`;this.inputCount+=1;let s=document.createElement("label");s.classList.add("ac-input-prompt"),s.setAttribute("for",i),s.textContent=e||(0,r.t)("msg_activecode_input_label");let o=document.createElement("input");o.type="text",o.id=i,o.classList.add("ac-input-field"),o.setAttribute("autocomplete","off");let a=document.createElement("button");a.type="button",a.classList.add("ac-input-submit"),a.textContent=(0,r.t)("msg_activecode_input_submit"),n.appendChild(s),n.appendChild(o),n.appendChild(a),this.output.appendChild(n),this.inputRow=n;const l=n=>{this.removeInputRow(),this.outputfun(`${e||""}${n}\n`),t(n)};a.addEventListener("click",(()=>l(o.value))),o.addEventListener("keydown",(e=>{"Enter"===e.key?(e.preventDefault(),l(o.value)):"Escape"===e.key&&(e.preventDefault(),l(""))})),this.output.scrollTop=this.output.scrollHeight,o.focus()}))}removeInputRow(){this.inputRow&&(this.inputRow.remove(),this.inputRow=null)}filewriter(e,t){let n=document.getElementById(e.name);if(n)0==e.pos$&&(n.value="");else{let t=document.createElement("div");t.classList.add("runestone");let i=document.createElement("div");i.classList.add("datafile_caption"),i.innerHTML=`Data file: <code>${e.name}</code>`,n=document.createElement("textarea"),n.rows=10,n.cols=50,n.id=e.name,n.style.marginBottom="5px",n.classList.add("ac_output"),t.appendChild(i),t.appendChild(n),this.outerDiv.appendChild(t)}let i=n.value;return i+=t.v,n.value=i,n.style.display="block",e.pos$=i.length,i.length}async getIncludedCode(e){if(window.componentMap[e])return window.componentMap[e].editor.getValue();{let t=new Request(`/ns/logger/get_source_code?course_id=${eBookConfig.course}&acid=${e}`,{method:"GET",headers:this.jsonHeaders}),n=await fetch(t);return(await n.json()).detail.file_contents}}trimLockedCode(e){let t=this.visiblePrefix?this.visiblePrefix.length:0,n=this.visibleSuffix?this.visibleSuffix.length:0;return n>0?e.slice(t,-n):e.slice(t)}readdLockedCode(e){return(this.visiblePrefix||"")+e+(this.visibleSuffix||"")}async buildProg(e){var t,n=this.editor.getValue()+"\n";if(this.prefix&&(n=this.prefix+n),this.pretext="",this.pretextLines=0,this.progLines=n.match(/\n/g).length+1,this.includes){t="";for(var i=0;i<this.includes.length;i++)t=t+await this.getIncludedCode(this.includes[i])+"\n";this.pretext=t,this.pretext&&(this.pretextLines=(this.pretext.match(/\n/g)||"").length),n=t+n}return e&&this.suffix&&(n+=this.suffix),Promise.resolve(n)}async manage_scrubber(e){null!==this.historyScrubber||this.autorun||await this.addHistoryScrubber();let t=this.trimLockedCode(this.editor.getValue());return this.historyScrubber&&this.history[Number(this.historyScrubber.value)]!=t?(e="True",this.history.push(t),this.timestamps.push((new Date).toLocaleString()),this.historyScrubber.max=this.history.length-1,this.historyScrubber.value=this.history.length-1,this.slideit(null)):e="False",null==this.historyScrubber&&(e="False"),e}async checkCurrentAnswer(){try{await this.runProg()}catch(e){console.log(`error running code ${e}`)}}async logCurrentAnswer(e){let t=this.trimLockedCode(this.editor.getValue()),n={div_id:this.divid,code:t,language:this.language,errinfo:this.errinfo||"",to_save:this.saveCode||"F",prefix:this.pretext,suffix:this.suffix,partner:this.partner};void 0!==e&&(n.sid=e);let i=this.computeEditDistance(),r=this.computeChangesPerSecond();if(n.editDist=i,n.changesPerSecond=r,await this.logRunEvent(n),this.unit_results){let t={act:this.unit_results,div_id:this.divid,event:"unittest"};void 0!==e&&(t.sid=e),await this.logBookEvent(t)}}async runCoaches(){for(;this.codecoach.children.length>1;)this.codecoach.lastElementChild.remove();this.codecoach.style.display="none";let e=this.coachCode,t=[];for(let n of this.codeCoachList)t.push(n.check(e));Promise.allSettled(t).then((e=>{for(let t of e)if("fulfilled"===t.status&&null!==t.value&&""!==t.value.trim()){let e=document.createElement("div");e.classList.add("python_check_results"),e.appendChild(document.createElement("pre")).textContent=t.value,this.codecoach.style.display="block",setTimeout((()=>{this.codecoach.append(e)}),10)}}))}renderFeedback(){if(this.unit_results_divid)if(this.unit_results_divid.indexOf("_offscreen_")>0){let e=`${this.divid}_offscreen_unit_results`,t=document.getElementById(e),n=document.body.removeChild(t),i=this.outerDiv.querySelector(`[id="${e}"]`);i?n=i:this.outerDiv.appendChild(n),n.style.display=""}else{let e=this.divid+"_unit_results";const t=document.getElementById(e).querySelectorAll("tr > td:first-child");for(const e of t){let t="rgb(131, 211, 130)"===e.style.backgroundColor;e.style.backgroundColor=null,e.classList.add(t?"ac-feedback-pass":"ac-feedback-fail")}if(!this.outerDiv.querySelector(`[id="${e}"]`)&&!this.outerDiv.querySelector(`[id="${e}_offscreen_unit_results"]`)){let t=document.getElementById(e);t&&this.outerDiv.appendChild(t)}}}toggleAlert(){this.is_toggle&&3==this.runCount&&("success"==this.errinfo&&100==this?.unit_results.substring(8,11)||(setTimeout((function(){alert("Help is Available Using the Toggle Question Selector! You can try the Mixed-up Question first.")}),500),this.logBookEvent({event:"togglealert",act:"Help is Available Using the Toggle Question Selector",div_id:this.divid})))}async runProg(e,t){console.log("starting runProg"),this.output.innerHTML="",m=!1,this.outputLineCount=0,this.outputLines=[],this.logResults=void 0===t||t,"boolean"!=typeof e&&(e=!1);var n=await this.buildProg(!0);if(this.coachCode=n,this.saveCode="True",this.removeInputRow(),this.output.textContent="",this.unit_results_divid){let e=document.getElementById(this.unit_results_divid+"_unit_results");e&&(e.innerHTML="")}this.eContainer.innerHTML="",this.eContainer.style.visibility="hidden",this.codelens&&(this.codelens.style.display="none"),this.clButton&&(this.clButton.innerText=(0,r.t)("msg_activecode_show_in_codelens")),Sk.configure({output:this.outputfun.bind(this),inputfun:this.inputfun.bind(this),read:this.fileReader,filewrite:this.filewriter.bind(this),__future__:Sk.python3,killableWhile:!0,killableFor:!0,nonreadopen:!0,imageProxy:"/ns/rsproxy/imageproxy",inputfunTakesPrompt:!0,jsonpSites:["https://itunes.apple.com"]}),Sk.divid=this.divid,Sk.logResults=t,this.graderactive&&this.outerDiv.closest(".loading")?Sk.gradeContainer=this.outerDiv.closest(".loading").id:Sk.gradeContainer=this.divid,this.setTimeLimit(),(Sk.TurtleGraphics||(Sk.TurtleGraphics={})).target=this.graphics,Sk.canvas=this.graphics.id,e||(this.saveCode=await this.manage_scrubber(this.saveCode),this.runButton.disabled=!0,this.historyScrubber&&(this.historyScrubber.disabled=!0),this.outDiv.style.visibility="visible");try{await Sk.misceval.asyncToPromise((function(){return Sk.importMainWithBody("<stdin>",!1,n,!0)}),{"*":()=>{if(m)throw console.log("stopExecution is true"),new Error("The program was interrupted")}}),e||this.historyScrubber&&(this.historyScrubber.disabled=!1),this.errLastRun=!1,this.errinfo="success"}catch(t){e||this.historyScrubber&&(this.historyScrubber.disabled=!1),this.errinfo=t.toString(),this.eContainer.style.visibility="visible",setTimeout((()=>{this.addErrorMessage(t)}),10)}finally{if(this.runButton.disabled=!1,this.firstAfterRun=!0,void 0!==window.allVisualizers)for(const e of Object.values(window.allVisualizers))e.redrawConnectors();this.editor.acEditEvent=!1}}disableInteraction(){this.runButton.style.display="none",this.codeDiv.classList.add("ac-disabled")}}var g={python:"py",html:"html",javascript:"js",java:"java",python2:"py",python3:"py",cpp:"cpp",c:"c",sql:"sql",octave:"m",kotlin:"kt"};function k(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}var S=new Set(["java","cpp","c","javascript"]),y={};y.ParseError=(0,r.t)("msg_sctivecode_parse_error"),y.ParseErrorFix=(0,r.t)("msg_sctivecode_parse_error_fix"),y.TypeError=(0,r.t)("msg_activecode_type_error"),y.TypeErrorFix=(0,r.t)("msg_activecode_type_error_fix"),y.NameError=(0,r.t)("msg_activecode_name_error"),y.NameErrorFix=(0,r.t)("msg_activecode_name_error_fix"),y.ValueError=(0,r.t)("msg_activecode_value_error"),y.ValueErrorFix=(0,r.t)("msg_activecode_value_error_fix"),y.AttributeError=(0,r.t)("msg_activecode_attribute_error"),y.AttributeErrorFix=(0,r.t)("msg_activecode_attribute_error_fix"),y.TokenError=(0,r.t)("msg_activecode_token_error"),y.TokenErrorFix=(0,r.t)("msg_activecode_token_error_fix"),y.TimeLimitError=(0,r.t)("msg_activecode_time_limit_error"),y.TimeLimitErrorFix=(0,r.t)("msg_activecode_time_limit_error_fix"),y.TimeoutError=(0,r.t)("msg_activecode_time_limit_error"),y.TimeoutErrorFix=(0,r.t)("msg_activecode_time_limit_error_fix"),y.Error=(0,r.t)("msg_activecode_general_error"),y.ErrorFix=(0,r.t)("msg_activecode_general_error_fix"),y.SyntaxError=(0,r.t)("msg_activecode_syntax_error"),y.SyntaxErrorFix=(0,r.t)("msg_activecode_syntax_error_fix"),y.IndexError=(0,r.t)("msg_activecode_index_error"),y.IndexErrorFix=(0,r.t)("msg_activecode_index_error_fix"),y.URIError=(0,r.t)("msg_activecode_uri_error"),y.URIErrorFix=(0,r.t)("msg_activecode_uri_error_fix"),y.ImportError=(0,r.t)("msg_activecode_import_error"),y.ImportErrorFix=(0,r.t)("msg_activecode_import_error_fix"),y.ReferenceError=(0,r.t)("msg_activecode_reference_error"),y.ReferenceErrorFix=(0,r.t)("msg_activecode_reference_error_fix"),y.ZeroDivisionError=(0,r.t)("msg_activecode_zero_division_error"),y.ZeroDivisionErrorFix=(0,r.t)("msg_activecode_zero_division_error_fix"),y.RangeError=(0,r.t)("msg_activecode_range_error"),y.RangeErrorFix=(0,r.t)("msg_activecode_range_error_fix"),y.InternalError=(0,r.t)("msg_activecode_internal_error"),y.InternalErrorFix=(0,r.t)("msg_activecode_internal_error_fix"),y.IndentationError=(0,r.t)("msg_activecode_indentation_error"),y.IndentationErrorFix=(0,r.t)("msg_activecode_indentation_error_fix"),y.NotImplementedError=(0,r.t)("msg_activecode_not_implemented_error"),y.NotImplementedErrorFix=(0,r.t)("msg_activecode_not_implemented_error_fix"),y.KeyError=(0,r.t)("msg_activecode_key_error"),y.KeyErrorFix=(0,r.t)("msg_activecode_key_error_fix"),y.AssertionError=(0,r.t)("msg_activecode_assertion_error"),y.AssertionErrorFix=(0,r.t)("msg_activecode_assertion_error_fix"),String.prototype.replaceAll=function(e,t){return this.split(e).join(t)}},27377:()=>{Sk.builtinFiles={files:{"src/builtin/this.py":'s = """Gur Mra bs Clguba, ol Gvz Crgref\n\nOrnhgvshy vf orggre guna htyl.\nRkcyvpvg vf orggre guna vzcyvpvg.\nFvzcyr vf orggre guna pbzcyrk.\nPbzcyrk vf orggre guna pbzcyvpngrq.\nSyng vf orggre guna arfgrq.\nFcnefr vf orggre guna qrafr.\nErnqnovyvgl pbhagf.\nFcrpvny pnfrf nera\'g fcrpvny rabhtu gb oernx gur ehyrf.\nNygubhtu cenpgvpnyvgl orngf chevgl.\nReebef fubhyq arire cnff fvyragyl.\nHayrff rkcyvpvgyl fvyraprq.\nVa gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.\nGurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.\nNygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh\'er Qhgpu.\nAbj vf orggre guna arire.\nNygubhtu arire vf bsgra orggre guna *evtug* abj.\nVs gur vzcyrzragngvba vf uneq gb rkcynva, vg\'f n onq vqrn.\nVs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.\nAnzrfcnprf ner bar ubaxvat terng vqrn -- yrg\'f qb zber bs gubfr!"""\n\nd = {}\nfor c in (65, 97):\n for i in range(26):\n d[chr(i+c)] = chr((i+13) % 26 + c)\n\nprint("".join([d.get(c, c) for c in s]))\n',"src/lib/BaseHTTPServer.py":'import _sk_fail; _sk_fail._("BaseHTTPServer")\n',"src/lib/Bastion.py":'import _sk_fail; _sk_fail._("Bastion")\n',"src/lib/CGIHTTPServer.py":'import _sk_fail; _sk_fail._("CGIHTTPServer")\n',"src/lib/ConfigParser.py":'import _sk_fail; _sk_fail._("ConfigParser")\n',"src/lib/Cookie.py":'import _sk_fail; _sk_fail._("Cookie")\n',"src/lib/DocXMLRPCServer.py":'import _sk_fail; _sk_fail._("DocXMLRPCServer")\n',"src/lib/HTMLParser.py":'import _sk_fail; _sk_fail._("HTMLParser")\n',"src/lib/MimeWriter.py":'import _sk_fail; _sk_fail._("MimeWriter")\n',"src/lib/PIL.py":'import image as _image_module\n\n__appname__ = "PIL"\n__author__ = "Marco Sirabella"\n__copyright__ = ""\n__credits__ = ["Marco Sirabella"] # Authors and bug reporters\n__license__ = "GPL"\n__version__ = "1.0"\n__maintainers__ = "Marco Sirabella"\n__email__ = "marco@sirabella.org"\n__status__ = "Prototype" # "Prototype", "Development" or "Production"\n__module__ = "PIL"\n\n\nclass PixelAccess:\n def __init__(self, parent):\n self._parent = parent\n\n def __getitem__(self, key):\n p = self._parent._image.getPixel(*key)\n return p.getRed(), p.getGreen(), p.getBlue()\n\n def __setitem__(self, key, value):\n r, g, b = value\n x, y = key\n self._parent._image.updatePixel(_image_module.Pixel(r, g, b, x, y))\n\n\nclass Image:\n def __init__(self, image):\n self._image = image\n self.size = (self._image.getWidth(), self._image.getHeight())\n\n self.pixels = PixelAccess(self)\n\n def open(filename):\n cls = Image\n self = cls(image=_image_module.Image(filename))\n return self\n\n def load(self):\n return self.pixels\n\n def show(self):\n win = _image_module.ImageWin(*self.size)\n self._image.draw(win)\n',"src/lib/Queue.py":'import _sk_fail; _sk_fail._("Queue")\n',"src/lib/SimpleHTTPServer.py":'import _sk_fail; _sk_fail._("SimpleHTTPServer")\n',"src/lib/SimpleXMLRPCServer.py":'import _sk_fail; _sk_fail._("SimpleXMLRPCServer")\n',"src/lib/SocketServer.py":'import _sk_fail; _sk_fail._("SocketServer")\n',"src/lib/StringIO.py":'r"""File-like objects that read from or write to a string buffer.\n\nThis implements (nearly) all stdio methods.\n\nf = StringIO() # ready for writing\nf = StringIO(buf) # ready for reading\nf.close() # explicitly release resources held\nflag = f.isatty() # always false\npos = f.tell() # get current position\nf.seek(pos) # set current position\nf.seek(pos, mode) # mode 0: absolute; 1: relative; 2: relative to EOF\nbuf = f.read() # read until EOF\nbuf = f.read(n) # read up to n bytes\nbuf = f.readline() # read until end of line (\'\\n\') or EOF\nlist = f.readlines()# list of f.readline() results until EOF\nf.truncate([size]) # truncate file at to at most size (default: current pos)\nf.write(buf) # write at current position\nf.writelines(list) # for line in list: f.write(line)\nf.getvalue() # return whole file\'s contents as a string\n\nNotes:\n- Using a real file is often faster (but less convenient).\n- There\'s also a much faster implementation in C, called cStringIO, but\n it\'s not subclassable.\n- fileno() is left unimplemented so that code which uses it triggers\n an exception early.\n- Seeking far beyond EOF and then writing will insert real null\n bytes that occupy space in the buffer.\n- There\'s a simple test set (see end of this file).\n"""\n\n__all__ = ["StringIO"]\n\ndef _complain_ifclosed(closed):\n if closed:\n raise ValueError("I/O operation on closed file")\n\nclass StringIO:\n """class StringIO([buffer])\n\n When a StringIO object is created, it can be initialized to an existing\n string by passing the string to the constructor. If no string is given,\n the StringIO will start empty.\n\n The StringIO object can accept either Unicode or 8-bit strings, but\n mixing the two may take some care. If both are used, 8-bit strings that\n cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause\n a UnicodeError to be raised when getvalue() is called.\n """\n def __init__(self, buf = \'\'):\n # Force self.buf to be a string or unicode\n if not isinstance(buf, str):\n buf = str(buf)\n self.buf = buf\n self.len = len(buf)\n self.buflist = []\n self.pos = 0\n self.closed = False\n self.softspace = 0\n\n def __iter__(self):\n return self\n\n def next(self):\n """A file object is its own iterator, for example iter(f) returns f\n (unless f is closed). When a file is used as an iterator, typically\n in a for loop (for example, for line in f: print line), the next()\n method is called repeatedly. This method returns the next input line,\n or raises StopIteration when EOF is hit.\n """\n _complain_ifclosed(self.closed)\n r = self.readline()\n if not r:\n raise StopIteration\n return r\n\n def close(self):\n """Free the memory buffer.\n """\n if not self.closed:\n self.closed = True\n self.buf = None\n self.pos = None\n\n def isatty(self):\n """Returns False because StringIO objects are not connected to a\n tty-like device.\n """\n _complain_ifclosed(self.closed)\n return False\n\n def seek(self, pos, mode = 0):\n """Set the file\'s current position.\n\n The mode argument is optional and defaults to 0 (absolute file\n positioning); other values are 1 (seek relative to the current\n position) and 2 (seek relative to the file\'s end).\n\n There is no return value.\n """\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += \'\'.join(self.buflist)\n self.buflist = []\n if mode == 1:\n pos += self.pos\n elif mode == 2:\n pos += self.len\n self.pos = max(0, pos)\n\n def tell(self):\n """Return the file\'s current position."""\n _complain_ifclosed(self.closed)\n return self.pos\n\n def read(self, n = -1):\n """Read at most size bytes from the file\n (less if the read hits EOF before obtaining size bytes).\n\n If the size argument is negative or omitted, read all data until EOF\n is reached. The bytes are returned as a string object. An empty\n string is returned when EOF is encountered immediately.\n """\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += \'\'.join(self.buflist)\n self.buflist = []\n if n is None or n < 0:\n newpos = self.len\n else:\n newpos = min(self.pos+n, self.len)\n r = self.buf[self.pos:newpos]\n self.pos = newpos\n return r\n\n def readline(self, length=None):\n r"""Read one entire line from the file.\n\n A trailing newline character is kept in the string (but may be absent\n when a file ends with an incomplete line). If the size argument is\n present and non-negative, it is a maximum byte count (including the\n trailing newline) and an incomplete line may be returned.\n\n An empty string is returned only when EOF is encountered immediately.\n\n Note: Unlike stdio\'s fgets(), the returned string contains null\n characters (\'\\0\') if they occurred in the input.\n """\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += \'\'.join(self.buflist)\n self.buflist = []\n i = self.buf.find(\'\\n\', self.pos)\n if i < 0:\n newpos = self.len\n else:\n newpos = i+1\n if length is not None and length >= 0:\n if self.pos + length < newpos:\n newpos = self.pos + length\n r = self.buf[self.pos:newpos]\n self.pos = newpos\n return r\n\n def readlines(self, sizehint = 0):\n """Read until EOF using readline() and return a list containing the\n lines thus read.\n\n If the optional sizehint argument is present, instead of reading up\n to EOF, whole lines totalling approximately sizehint bytes (or more\n to accommodate a final whole line).\n """\n total = 0\n lines = []\n line = self.readline()\n while line:\n lines.append(line)\n total += len(line)\n if 0 < sizehint <= total:\n break\n line = self.readline()\n return lines\n\n def truncate(self, size=None):\n """Truncate the file\'s size.\n\n If the optional size argument is present, the file is truncated to\n (at most) that size. The size defaults to the current position.\n The current file position is not changed unless the position\n is beyond the new file size.\n\n If the specified size exceeds the file\'s current size, the\n file remains unchanged.\n """\n _complain_ifclosed(self.closed)\n if size is None:\n size = self.pos\n elif size < 0:\n raise IOError(22, "Negative size not allowed")\n elif size < self.pos:\n self.pos = size\n self.buf = self.getvalue()[:size]\n self.len = size\n\n def write(self, s):\n """Write a string to the file.\n\n There is no return value.\n """\n _complain_ifclosed(self.closed)\n if not s: return\n # Force s to be a string or unicode\n if not isinstance(s, str):\n s = str(s)\n spos = self.pos\n slen = self.len\n if spos == slen:\n self.buflist.append(s)\n self.len = self.pos = spos + len(s)\n return\n if spos > slen:\n self.buflist.append(\'\\0\'*(spos - slen))\n slen = spos\n newpos = spos + len(s)\n if spos < slen:\n if self.buflist:\n self.buf += \'\'.join(self.buflist)\n self.buflist = [self.buf[:spos], s, self.buf[newpos:]]\n self.buf = \'\'\n if newpos > slen:\n slen = newpos\n else:\n self.buflist.append(s)\n slen = newpos\n self.len = slen\n self.pos = newpos\n\n def writelines(self, iterable):\n """Write a sequence of strings to the file. The sequence can be any\n iterable object producing strings, typically a list of strings. There\n is no return value.\n\n (The name is intended to match readlines(); writelines() does not add\n line separators.)\n """\n write = self.write\n for line in iterable:\n write(line)\n\n def flush(self):\n """Flush the internal buffer\n """\n _complain_ifclosed(self.closed)\n\n def getvalue(self):\n """\n Retrieve the entire contents of the "file" at any time before\n the StringIO object\'s close() method is called.\n\n The StringIO object can accept either Unicode or 8-bit strings,\n but mixing the two may take some care. If both are used, 8-bit\n strings that cannot be interpreted as 7-bit ASCII (that use the\n 8th bit) will cause a UnicodeError to be raised when getvalue()\n is called.\n """\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += \'\'.join(self.buflist)\n self.buflist = []\n return self.buf\n\n # The following two methods implement the PEP343 context management protocol\n # for StringIO objects, allowing them to be used in with statements.\n # In standard Python this is done via inheriting from IOBase\n # Possible pure Python implementation: https://github.com/python/cpython/blob/main/Lib/_pyio.py\n def __enter__(self):\n _complain_ifclosed(self.closed)\n return self\n\n def __exit__(self, *args):\n self.close()\n',"src/lib/UserDict.py":'import _sk_fail; _sk_fail._("UserDict")\n',"src/lib/UserList.py":'import _sk_fail; _sk_fail._("UserList")\n',"src/lib/UserString.py":'import _sk_fail; _sk_fail._("UserString")\n',"src/lib/_LWPCookieJar.py":'import _sk_fail; _sk_fail._("_LWPCookieJar")\n',"src/lib/_MozillaCookieJar.py":'import _sk_fail; _sk_fail._("_MozillaCookieJar")\n',"src/lib/__future__.py":'import _sk_fail;_sk_fail._("__future__")\n',"src/lib/__phello__.foo.py":'import _sk_fail; _sk_fail._("__phello__.foo")\n',"src/lib/_abcoll.py":'import _sk_fail; _sk_fail._("_abcoll")\n',"src/lib/_sk_fail.py":'class NotImplementedImportError(ImportError, NotImplementedError): pass\n\ndef _(name):\n msg = "{} is not yet implemented in Skulpt".format(name)\n raise NotImplementedImportError(msg, name=name)\n',"src/lib/_threading_local.py":'import _sk_fail; _sk_fail._("_threading_local")\n',"src/lib/abc.py":'import _sk_fail; _sk_fail._("abc")\n',"src/lib/aifc.py":'import _sk_fail; _sk_fail._("aifc")\n',"src/lib/altair/__init__.py":'import random\n\ntry:\n from vega_caller import render_graph\nexcept:\n print("Mock render")\n\n def render_graph(js):\n print(js)\n\n\nclass Chart:\n # TODO allow data to be specified as a URL to a CSV or DB or json\n def __init__(self, data, title=None):\n self.title = title\n self.data_id = random.randrange(1000000, 5000000)\n self.dsname = "data-{}".format(self.data_id)\n if isinstance(data, dict):\n self.data = Data(**data)\n else:\n self.data = data\n\n self.json = {}\n self.json["$schema"] = "https://vega.github.io/schema/vega-lite/v2.5.json"\n self.json["data"] = {}\n if self.title:\n self.json["title"] = self.title\n\n self.json["data"] = {"values": self.data.vals}\n self.is_composite = False\n\n # mark can be a simple string or a dictionary\n # "mark": {"color": "green", "opacity": 0.2, "type": "rect"}\n\n def mark_json(self, mark_type, **kwargs):\n if kwargs:\n self.json["mark"] = {}\n self.json["mark"]["type"] = mark_type\n self.json["mark"].update(kwargs)\n else:\n self.json["mark"] = mark_type\n\n return self\n\n def mark_bar(self, **kwargs):\n return self.mark_json("bar", **kwargs)\n\n def mark_point(self, **kwargs):\n return self.mark_json("point", **kwargs)\n\n def mark_line(self, **kwargs):\n return self.mark_json("line", **kwargs)\n\n def mark_rect(self, **kwargs):\n return self.mark_json("rect", **kwargs)\n\n def mark_area(self, **kwargs):\n return self.mark_json("area", **kwargs)\n\n def mark_tick(self, **kwargs):\n return self.mark_json("tick", **kwargs)\n\n def encode(self, x="", y="", color="", size="", tooltip=""):\n self.encoding = {}\n if x:\n if isinstance(x, Axis):\n self.encoding["x"] = x.toJson()\n else:\n self.encoding["x"] = Axis(x).toJson()\n if y:\n if isinstance(y, Axis):\n self.encoding["y"] = y.toJson()\n else:\n self.encoding["y"] = Axis(y).toJson()\n\n # "color": {"type": "nominal", "field": "species"}\n if color:\n field, tp = _get_name_type(color)\n self.encoding["color"] = dict(type=tp, field=field)\n\n # "size": {"type": "quantitative", "field": "Acceleration"}\n if size:\n field, tp = _get_name_type(size)\n self.encoding["size"] = dict(type=tp, field=field)\n\n if tooltip:\n field, tp = _get_name_type(tooltip)\n self.encoding["tooltip"] = dict(type=tp, field=field)\n\n self.json["encoding"] = self.encoding\n return self\n\n def interactive(self):\n iconfig = {\n "selector002": {\n "type": "interval",\n "bind": "scales",\n "encodings": ["x", "y"],\n "on": "[mousedown, window:mouseup] > window:mousemove!",\n "translate": "[mousedown, window:mouseup] > window:mousemove!",\n "zoom": "wheel!",\n "mark": {"fill": "#333", "fillOpacity": 0.125, "stroke": "white"},\n "resolve": "global",\n }\n }\n self.json["selection"] = iconfig\n return self\n\n def display(self):\n render_graph(self.json)\n\n def __add__(self, other):\n return self.add_layer(other, "layer")\n\n def __and__(self, other):\n return self.add_layer(other, "vconcat")\n\n def __or__(self, other):\n return self.add_layer(other, "hconcat")\n\n def add_layer(self, other, lname):\n # multle layers are added by concatenating the new element to the\n # existing layer. If the layer does not exist then initialize\n # it from self.\n if lname not in self.json:\n self.json[lname] = []\n self.json["datasets"] = {}\n temp = {}\n temp["data"] = {"name": self.dsname}\n self.json["datasets"][self.dsname] = self.json["data"]["values"]\n del self.json["data"]\n temp["encoding"] = self.json["encoding"]\n del self.json["encoding"]\n temp["mark"] = self.json["mark"]\n del self.json["mark"]\n self.json[lname].append(temp)\n temp = {}\n self.json["datasets"][other.dsname] = other.json["data"]["values"]\n temp["data"] = {"name": other.dsname}\n temp["encoding"] = other.json["encoding"]\n temp["mark"] = other.json["mark"]\n self.json[lname].append(temp)\n return self\n\n\n# "datasets": {\n# "data-e56e43354d9b8f2ab0d1e90cf27cd47f": [\n# {"a": 4, "b": 1, "c": "r"},\n# {"a": 5, "b": 2, "c": "g"},\n# {"a": 6, "b": 3, "c": "b"}\n# ],\n# "data-a4c3047a15bf9380c2e615cf87648369": [\n# {"a": 1, "b": 4, "c": "r"},\n# {"a": 2, "b": 5, "c": "g"},\n# {"a": 3, "b": 6, "c": "b"}\n# ]\n# }\n\n# TODO: add a rect mark type for a heat map\n\n\ndef _get_name_type(name):\n typed = {"Q": "quantitative", "O": "ordinal", "N": "nominal", "T": "temporal"}\n nt = name.split(":")\n tstring = "quantitative"\n if len(nt) == 2:\n tstring = typed[nt[1]]\n return nt[0], tstring\n\n\nclass Axis:\n def __init__(self, name, bin=False):\n self.aggregate = None\n self.name, self.type = _get_name_type(name)\n if "()" in self.name: # aggregate function\n self.aggregate = self.name.replace("()", "")\n self.name = None\n self.bin = bin\n\n def toJson(self):\n json = {}\n if self.name:\n json["field"] = self.name\n if self.type:\n json["type"] = self.type\n if self.bin:\n json["bin"] = True\n if self.aggregate:\n json["aggregate"] = self.aggregate\n\n return json\n\n\nclass X(Axis):\n pass\n\n\nclass Y(Axis):\n pass\n\n\nclass Data:\n def __init__(self, **kwargs):\n """\n input can be the form of a series of keyword args where\n the keyword is the column name, or a single keyword data\n that is a list of json style records as rows.\n could also accept a csv file? or keywords columns and rows\n This accepts a lot more options that "real altair" to make it easier\n to work with non-DataFrame data sets. Internally:\n self.keys contains the list of column names\n self.vals is a list of dictionaries of the form [{col1:val1, col2:val2, ... coln:valn},\n {col1:val3, col2:val4, ... coln:valn},\n {col1:val5, col2:val6, ... coln:valn}]\n """\n # todo: accept a URL as the argument to read a CSV or JSON file\n if len(kwargs) == 1 and "data" in kwargs:\n self.data = kwargs["data"]\n self.keys = self.data[0].keys()\n self.vals = self.data\n elif len(kwargs) == 2 and ("columns" in kwargs) and ("rows" in kwargs):\n self.keys = kwargs["columns"]\n self.vals = []\n for r in kwargs["rows"]:\n self.vals.append(dict(zip(self.keys, r)))\n else:\n keys = kwargs.keys()\n vals = []\n primary_key = list(keys)[0]\n for ix in range(len(kwargs[primary_key])):\n d = {}\n for key in keys:\n d[key] = kwargs[key][ix]\n vals.append(d)\n self.vals = vals\n self.keys = keys\n\n def __str__(self):\n # header = "\\t".join(self.keys) + "\\n"\n header = ""\n for key in self.keys:\n header += key.center(10) + " "\n header += "\\n"\n template = ""\n for key in self.keys:\n template += "{" + key + ": <10} "\n template += "\\n"\n res = ""\n for row in self.vals:\n res += template.format(**row)\n\n return header + res\n\n\nif __name__ == "__main__":\n d = Data(a=[3, 4, 5], b=[1, 2, 3], c=["r", "g", "b"])\n print(d)\n print(\n type(\n Chart({"a": list("abc"), "b": [1, 2, 3]}).mark_bar().encode(x="a:N", y="b")\n )\n )\n aa = (\n Chart(Data(a=[3, 4, 5], b=[1, 2, 3], c=["r", "g", "b"]))\n .mark_point(color="red")\n .encode(x="b", y="a", color="c:O")\n )\n print("aa = ", aa)\n aa.display()\n\n bb = (\n Chart(Data(a=[1, 2, 3], b=[4, 5, 6], c=["r", "g", "b"]))\n .mark_line()\n .encode(x="b", y="a", color="c:O")\n )\n print("bb = ", bb)\n bb.display()\n print("aa+bb", (aa + bb).display())\n # Chart(Data(a=[1,2,3,2,2,4,5,5,6,7,8,8,8,8,8,9,0,0])).mark_bar().encode(Axis(\'a:Q\', bin=True),y=\'count()\')\n\n\n# todo: see if I can work with the repr of an object to get the behavior that altair gets in notebooks\n# todo: implement a Bin object to specifiy maxbins\n',"src/lib/antigravity.py":'import webbrowser\n\nwebbrowser.open("https://xkcd.com/353/")\n',"src/lib/anydbm.py":'import _sk_fail; _sk_fail._("anydbm")\n',"src/lib/ast.py":'import _sk_fail; _sk_fail._("ast")\n',"src/lib/asynchat.py":'import _sk_fail; _sk_fail._("asynchat")\n',"src/lib/asyncore.py":'import _sk_fail; _sk_fail._("asyncore")\n',"src/lib/atexit.py":'import _sk_fail; _sk_fail._("atexit")\n',"src/lib/audiodev.py":'import _sk_fail; _sk_fail._("audiodev")\n',"src/lib/base64.py":'import _sk_fail; _sk_fail._("base64")\n',"src/lib/bdb.py":'import _sk_fail; _sk_fail._("bdb")\n',"src/lib/binhex.py":'import _sk_fail; _sk_fail._("binhex")\n',"src/lib/bisect.py":'"""Bisection algorithms."""\n\ndef insort_right(a, x, lo=0, hi=None):\n """Insert item x in list a, and keep it sorted assuming a is sorted.\n\n If x is already in a, insert it to the right of the rightmost x.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n """\n\n if lo < 0:\n raise ValueError(\'lo must be non-negative\')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if x < a[mid]: hi = mid\n else: lo = mid+1\n a.insert(lo, x)\n\ndef bisect_right(a, x, lo=0, hi=None):\n """Return the index where to insert item x in list a, assuming a is sorted.\n\n The return value i is such that all e in a[:i] have e <= x, and all e in\n a[i:] have e > x. So if x already appears in the list, a.insert(x) will\n insert just after the rightmost x already there.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n """\n\n if lo < 0:\n raise ValueError(\'lo must be non-negative\')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if x < a[mid]: hi = mid\n else: lo = mid+1\n return lo\n\ndef insort_left(a, x, lo=0, hi=None):\n """Insert item x in list a, and keep it sorted assuming a is sorted.\n\n If x is already in a, insert it to the left of the leftmost x.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n """\n\n if lo < 0:\n raise ValueError(\'lo must be non-negative\')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if a[mid] < x: lo = mid+1\n else: hi = mid\n a.insert(lo, x)\n\n\ndef bisect_left(a, x, lo=0, hi=None):\n """Return the index where to insert item x in list a, assuming a is sorted.\n\n The return value i is such that all e in a[:i] have e < x, and all e in\n a[i:] have e >= x. So if x already appears in the list, a.insert(x) will\n insert just before the leftmost x already there.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n """\n\n if lo < 0:\n raise ValueError(\'lo must be non-negative\')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if a[mid] < x: lo = mid+1\n else: hi = mid\n return lo\n\n# Overwrite above definitions with a fast C implementation\ntry:\n from _bisect import *\nexcept ImportError:\n pass\n\n# Create aliases\nbisect = bisect_right\ninsort = insort_right\n',"src/lib/bsddb/__init__.py":'import _sk_fail; _sk_fail._("bsddb")\n',"src/lib/cProfile.py":'import _sk_fail; _sk_fail._("cProfile")\n',"src/lib/cgi.py":'import _sk_fail; _sk_fail._("cgi")\n',"src/lib/cgitb.py":'import _sk_fail; _sk_fail._("cgitb")\n',"src/lib/chunk.py":'import _sk_fail; _sk_fail._("chunk")\n',"src/lib/cmd.py":'import _sk_fail; _sk_fail._("cmd")\n',"src/lib/code.py":'import _sk_fail; _sk_fail._("code")\n',"src/lib/codecs.py":'import _sk_fail; _sk_fail._("codecs")\n',"src/lib/codeop.py":'import _sk_fail; _sk_fail._("codeop")\n',"src/lib/colorsys.py":'import _sk_fail; _sk_fail._("colorsys")\n',"src/lib/commands.py":'import _sk_fail; _sk_fail._("commands")\n',"src/lib/compileall.py":'import _sk_fail; _sk_fail._("compileall")\n',"src/lib/compiler/__init__.py":'import _sk_fail; _sk_fail._("compiler")\n',"src/lib/config/__init__.py":'import _sk_fail; _sk_fail._("config")\n',"src/lib/contextlib.py":'import _sk_fail; _sk_fail._("contextlib")\n',"src/lib/cookielib.py":'import _sk_fail; _sk_fail._("cookielib")\n',"src/lib/copy.py":'"""\nThis file was modified from CPython.\nCopyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved\n"""\nimport types\nclass Error(Exception):\n pass\nerror = Error \nclass _EmptyClass:\n pass\ntry:\n long\nexcept NameError:\n long = int\ntry:\n bytes\nexcept NameError:\n bytes = str\n\ndef check_notimplemented_state(x):\n getstate = getattr(x, "__getstate__", None)\n setstate = getattr(x, "__setstate__", None)\n initargs = getattr(x, "__getinitargs__", None)\n if getstate or setstate or initargs:\n raise NotImplementedError("Skulpt does not yet support copying with user-defined __getstate__, __setstate__ or __getinitargs__()")\n\n\ndef copy(x):\n cls = type(x)\n if callable(x):\n return x\n copier = getattr(cls, "__copy__", None)\n if copier:\n return copier(x)\n if cls in (type(None), int, float, bool, str, bytes, tuple, type, frozenset, long):\n return x\n if (cls == list) or (cls == dict) or (cls == set) or (cls == slice):\n return cls(x)\n reductor = getattr(x, "__reduce_ex__", None)\n if reductor:\n rv = reductor(4)\n else:\n reductor = getattr(x, "__reduce__", None)\n if reductor:\n rv = reductor()\n elif str(cls)[1:6] == "class":\n check_notimplemented_state(x)\n copier = _copy_inst\n return copier(x)\n else:\n raise Error("un(shallow)copyable object of type %s" % cls)\n if isinstance(rv, str):\n return x\n return _reconstruct(x, rv, 0)\n\ndef _copy_inst(x):\n if hasattr(x, \'__copy__\'):\n return x.__copy__()\n if hasattr(x, \'__getinitargs__\'):\n args = x.__getinitargs__()\n y = x.__class__(*args)\n else:\n y = _EmptyClass()\n y.__class__ = x.__class__\n if hasattr(x, \'__getstate__\'):\n state = x.__getstate__()\n else:\n state = x.__dict__\n if hasattr(y, \'__setstate__\'):\n y.__setstate__(state)\n else:\n y.__dict__.update(state)\n return y\n\nd = _deepcopy_dispatch = {}\n\ndef deepcopy(x, memo=None, _nil=[]):\n """Deep copy operation on arbitrary Python objects.\n See the module\'s __doc__ string for more info.\n """\n if memo is None:\n memo = {}\n idx = id(x)\n y = memo.get(idx, _nil)\n if y is not _nil:\n return y\n cls = type(x)\n copier = _deepcopy_dispatch.get(cls)\n if copier:\n y = copier(x, memo)\n else:\n try:\n issc = issubclass(cls, type)\n except TypeError: # cls is not a class (old Boost; see SF #502085)\n issc = 0\n if issc:\n y = _deepcopy_atomic(x, memo)\n else:\n copier = getattr(x, "__deepcopy__", None)\n if copier:\n y = copier(memo)\n else:\n reductor = getattr(x, "__reduce_ex__", None)\n if reductor:\n rv = reductor(2)\n else:\n rv = None\n reductor = getattr(x, "__reduce__", None)\n if reductor:\n rv = reductor()\n elif str(cls)[1:6] == "class":\n check_notimplemented_state(x)\n copier = _deepcopy_dispatch["InstanceType"]\n y = copier(x, memo)\n else:\n raise Error(\n "un(deep)copyable object of type %s" % cls)\n if rv is not None:\n y = _reconstruct(x, rv, 1, memo)\n memo[idx] = y\n _keep_alive(x, memo) # Make sure x lives at least as long as d\n return y\n\ndef _deepcopy_atomic(x, memo):\n return x\nd[type(None)] = _deepcopy_atomic\n# d[type(Ellipsis)] = _deepcopy_atomic\nd[type(NotImplemented)] = _deepcopy_atomic\nd[int] = _deepcopy_atomic\nd[float] = _deepcopy_atomic\nd[bool] = _deepcopy_atomic\nd[complex] = _deepcopy_atomic\nd[bytes] = _deepcopy_atomic\nd[str] = _deepcopy_atomic\n# try:\n# d[types.CodeType] = _deepcopy_atomic\n# except AttributeError:\n# pass\nd[type] = _deepcopy_atomic\n# d[types.BuiltinFunctionType] = _deepcopy_atomic\nd[types.FunctionType] = _deepcopy_atomic\n# d[weakref.ref] = _deepcopy_atomic\n\ndef _deepcopy_list(x, memo):\n y = []\n memo[id(x)] = y\n for a in x:\n y.append(deepcopy(a, memo))\n return y\nd[list] = _deepcopy_list\n\ndef _deepcopy_set(x, memo):\n result = set([]) # make empty set\n memo[id(x)] = result # register this set in the memo for loop checking\n for a in x: # go through elements of set\n result.add(deepcopy(a, memo)) # add the copied elements into the new set\n return result # return the new set\nd[set] = _deepcopy_set\n\ndef _deepcopy_frozenset(x, memo):\n result = frozenset(_deepcopy_set(x,memo)) \n memo[id(x)] = result \n return result\nd[frozenset] = _deepcopy_frozenset\n\ndef _deepcopy_tuple(x, memo):\n y = [deepcopy(a, memo) for a in x]\n # We\'re not going to put the tuple in the memo, but it\'s still important we\n # check for it, in case the tuple contains recursive mutable structures.\n try:\n return memo[id(x)]\n except KeyError:\n pass\n for k, j in zip(x, y):\n if k is not j:\n y = tuple(y)\n break\n else:\n y = x\n return y\nd[tuple] = _deepcopy_tuple\n\ndef _deepcopy_dict(x, memo):\n y = {}\n memo[id(x)] = y\n for key, value in x.items():\n y[deepcopy(key, memo)] = deepcopy(value, memo)\n return y\nd[dict] = _deepcopy_dict\n\n# def _deepcopy_method(x, memo): # Copy instance methods\n# y = type(x)(x.im_func, deepcopy(x.im_self, memo), x.im_class);\n# return y\nd[types.MethodType] = _deepcopy_atomic\n\ndef _deepcopy_inst(x, memo):\n if hasattr(x, \'__deepcopy__\'):\n return x.__deepcopy__(memo)\n if hasattr(x, \'__getinitargs__\'):\n args = x.__getinitargs__()\n args = deepcopy(args, memo)\n y = x.__class__(*args)\n else:\n y = _EmptyClass()\n y.__class__ = x.__class__\n memo[id(x)] = y\n if hasattr(x, \'__getstate__\'):\n state = x.__getstate__()\n else:\n state = x.__dict__\n state = deepcopy(state, memo)\n if hasattr(y, \'__setstate__\'):\n y.__setstate__(state)\n else:\n y.__dict__.update(state)\n return y\nd["InstanceType"] = _deepcopy_inst\n\ndef _keep_alive(x, memo):\n """Keeps a reference to the object x in the memo.\n Because we remember objects by their id, we have\n to assure that possibly temporary objects are kept\n alive by referencing them.\n We store a reference at the id of the memo, which should\n normally not be used unless someone tries to deepcopy\n the memo itself...\n """\n try:\n memo[id(memo)].append(x)\n except KeyError:\n # aha, this is the first one :-)\n memo[id(memo)]=[x]\n\ndef _reconstruct(x, info, deep, memo=None):\n if isinstance(info, str):\n return x\n assert isinstance(info, tuple)\n if memo is None:\n memo = {}\n n = len(info)\n assert n in (2, 3, 4, 5)\n callable, args = info[:2]\n if n > 2:\n state = info[2]\n else:\n state = None\n if n > 3:\n listiter = info[3]\n else:\n listiter = None\n if n > 4:\n dictiter = info[4]\n else:\n dictiter = None\n if deep:\n args = deepcopy(args, memo)\n y = callable(*args)\n memo[id(x)] = y\n\n if state is not None:\n if deep:\n state = deepcopy(state, memo)\n if hasattr(y, \'__setstate__\'):\n y.__setstate__(state)\n else:\n if isinstance(state, tuple) and len(state) == 2:\n state, slotstate = state\n else:\n slotstate = None\n if state is not None:\n y.__dict__.update(state)\n if slotstate is not None:\n for key, value in slotstate.items():\n setattr(y, key, value)\n\n if listiter is not None:\n for item in listiter:\n if deep:\n item = deepcopy(item, memo)\n y.append(item)\n if dictiter is not None:\n for key, value in dictiter:\n if deep:\n key = deepcopy(key, memo)\n value = deepcopy(value, memo)\n y[key] = value\n return y\n\ndel d\n\ndel types\n\n# Helper for instance creation without calling __init__\nclass _EmptyClass:\n pass',"src/lib/copy_reg.py":'import _sk_fail; _sk_fail._("copy_reg")\n',"src/lib/csv.py":'import _sk_fail; _sk_fail._("csv")\n',"src/lib/ctypes/__init__.py":'import _sk_fail; _sk_fail._("ctypes")\n',"src/lib/ctypes/macholib/__init__.py":'import _sk_fail; _sk_fail._("macholib")\n',"src/lib/curses/__init__.py":'import _sk_fail; _sk_fail._("curses")\n',"src/lib/dbhash.py":'import _sk_fail; _sk_fail._("dbhash")\n',"src/lib/decimal.py":'import _sk_fail; _sk_fail._("decimal")\n',"src/lib/difflib.py":'import _sk_fail; _sk_fail._("difflib")\n',"src/lib/dircache.py":'import _sk_fail; _sk_fail._("dircache")\n',"src/lib/dis.py":'import _sk_fail; _sk_fail._("dis")\n',"src/lib/distutils/__init__.py":'import _sk_fail; _sk_fail._("distutils")\n',"src/lib/distutils/command/__init__.py":'import _sk_fail; _sk_fail._("command")\n',"src/lib/distutils/tests/__init__.py":'import _sk_fail; _sk_fail._("tests")\n',"src/lib/doctest.py":'import _sk_fail; _sk_fail._("doctest")\n',"src/lib/dumbdbm.py":'import _sk_fail; _sk_fail._("dumbdbm")\n',"src/lib/dummy_thread.py":'import _sk_fail; _sk_fail._("dummy_thread")\n',"src/lib/dummy_threading.py":'import _sk_fail; _sk_fail._("dummy_threading")\n',"src/lib/email/__init__.py":'import _sk_fail; _sk_fail._("email")\n',"src/lib/email/mime/__init__.py":'import _sk_fail; _sk_fail._("mime")\n',"src/lib/email/test/data/__init__.py":'import _sk_fail; _sk_fail._("data")\n',"src/lib/encodings/__init__.py":'import _sk_fail; _sk_fail._("encodings")\n',"src/lib/filecmp.py":'import _sk_fail; _sk_fail._("filecmp")\n',"src/lib/fileinput.py":'import _sk_fail; _sk_fail._("fileinput")\n',"src/lib/fnmatch.py":'import _sk_fail; _sk_fail._("fnmatch")\n',"src/lib/formatter.py":'import _sk_fail; _sk_fail._("formatter")\n',"src/lib/fpformat.py":'import _sk_fail; _sk_fail._("fpformat")\n',"src/lib/fractions.py":'import _sk_fail; _sk_fail._("fractions")\n',"src/lib/ftplib.py":'import _sk_fail; _sk_fail._("ftplib")\n',"src/lib/genericpath.py":'import _sk_fail; _sk_fail._("genericpath")\n',"src/lib/getopt.py":'import _sk_fail; _sk_fail._("getopt")\n',"src/lib/getpass.py":'import _sk_fail; _sk_fail._("getpass")\n',"src/lib/gettext.py":'import _sk_fail; _sk_fail._("gettext")\n',"src/lib/glob.py":'import _sk_fail; _sk_fail._("glob")\n',"src/lib/gzip.py":'import _sk_fail; _sk_fail._("gzip")\n',"src/lib/hashlib.py":'import _sk_fail; _sk_fail._("hashlib")\n',"src/lib/heapq.py":'"""Heap queue algorithm (a.k.a. priority queue).\n\nHeaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for\nall k, counting elements from 0. For the sake of comparison,\nnon-existing elements are considered to be infinite. The interesting\nproperty of a heap is that a[0] is always its smallest element.\n\nUsage:\n\nheap = [] # creates an empty heap\nheappush(heap, item) # pushes a new item on the heap\nitem = heappop(heap) # pops the smallest item from the heap\nitem = heap[0] # smallest item on the heap without popping it\nheapify(x) # transforms list into a heap, in-place, in linear time\nitem = heapreplace(heap, item) # pops and returns smallest item, and adds\n # new item; the heap size is unchanged\n\nOur API differs from textbook heap algorithms as follows:\n\n- We use 0-based indexing. This makes the relationship between the\n index for a node and the indexes for its children slightly less\n obvious, but is more suitable since Python uses 0-based indexing.\n\n- Our heappop() method returns the smallest item, not the largest.\n\nThese two make it possible to view the heap as a regular Python list\nwithout surprises: heap[0] is the smallest item, and heap.sort()\nmaintains the heap invariant!\n"""\n\n# Original code by Kevin O\'Connor, augmented by Tim Peters and Raymond Hettinger\n\n__about__ = """Heap queues\n\n[explanation by François Pinard]\n\nHeaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for\nall k, counting elements from 0. For the sake of comparison,\nnon-existing elements are considered to be infinite. The interesting\nproperty of a heap is that a[0] is always its smallest element.\n\nThe strange invariant above is meant to be an efficient memory\nrepresentation for a tournament. The numbers below are `k\', not a[k]:\n\n 0\n\n 1 2\n\n 3 4 5 6\n\n 7 8 9 10 11 12 13 14\n\n 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30\n\n\nIn the tree above, each cell `k\' is topping `2*k+1\' and `2*k+2\'. In\na usual binary tournament we see in sports, each cell is the winner\nover the two cells it tops, and we can trace the winner down the tree\nto see all opponents s/he had. However, in many computer applications\nof such tournaments, we do not need to trace the history of a winner.\nTo be more memory efficient, when a winner is promoted, we try to\nreplace it by something else at a lower level, and the rule becomes\nthat a cell and the two cells it tops contain three different items,\nbut the top cell "wins" over the two topped cells.\n\nIf this heap invariant is protected at all time, index 0 is clearly\nthe overall winner. The simplest algorithmic way to remove it and\nfind the "next" winner is to move some loser (let\'s say cell 30 in the\ndiagram above) into the 0 position, and then percolate this new 0 down\nthe tree, exchanging values, until the invariant is re-established.\nThis is clearly logarithmic on the total number of items in the tree.\nBy iterating over all items, you get an O(n ln n) sort.\n\nA nice feature of this sort is that you can efficiently insert new\nitems while the sort is going on, provided that the inserted items are\nnot "better" than the last 0\'th element you extracted. This is\nespecially useful in simulation contexts, where the tree holds all\nincoming events, and the "win" condition means the smallest scheduled\ntime. When an event schedule other events for execution, they are\nscheduled into the future, so they can easily go into the heap. So, a\nheap is a good structure for implementing schedulers (this is what I\nused for my MIDI sequencer :-).\n\nVarious structures for implementing schedulers have been extensively\nstudied, and heaps are good for this, as they are reasonably speedy,\nthe speed is almost constant, and the worst case is not much different\nthan the average case. However, there are other representations which\nare more efficient overall, yet the worst cases might be terrible.\n\nHeaps are also very useful in big disk sorts. You most probably all\nknow that a big sort implies producing "runs" (which are pre-sorted\nsequences, which size is usually related to the amount of CPU memory),\nfollowed by a merging passes for these runs, which merging is often\nvery cleverly organised[1]. It is very important that the initial\nsort produces the longest runs possible. Tournaments are a good way\nto that. If, using all the memory available to hold a tournament, you\nreplace and percolate items that happen to fit the current run, you\'ll\nproduce runs which are twice the size of the memory for random input,\nand much better for input fuzzily ordered.\n\nMoreover, if you output the 0\'th item on disk and get an input which\nmay not fit in the current tournament (because the value "wins" over\nthe last output value), it cannot fit in the heap, so the size of the\nheap decreases. The freed memory could be cleverly reused immediately\nfor progressively building a second heap, which grows at exactly the\nsame rate the first heap is melting. When the first heap completely\nvanishes, you switch heaps and start a new run. Clever and quite\neffective!\n\nIn a word, heaps are useful memory structures to know. I use them in\na few applications, and I think it is good to keep a `heap\' module\naround. :-)\n\n--------------------\n[1] The disk balancing algorithms which are current, nowadays, are\nmore annoying than clever, and this is a consequence of the seeking\ncapabilities of the disks. On devices which cannot seek, like big\ntape drives, the story was quite different, and one had to be very\nclever to ensure (far in advance) that each tape movement will be the\nmost effective possible (that is, will best participate at\n"progressing" the merge). Some tapes were even able to read\nbackwards, and this was also used to avoid the rewinding time.\nBelieve me, real good tape sorts were quite spectacular to watch!\nFrom all times, sorting has always been a Great Art! :-)\n"""\n\n__all__ = [\'heappush\', \'heappop\', \'heapify\', \'heapreplace\',\n \'nlargest\', \'nsmallest\', \'heappushpop\']\n\n\ndef heappush(heap, item):\n """Push item onto heap, maintaining the heap invariant."""\n heap.append(item)\n _siftdown(heap, 0, len(heap) - 1)\n\n\ndef heappop(heap):\n """Pop the smallest item off the heap, maintaining the heap invariant."""\n lastelt = heap.pop() # raises appropriate IndexError if heap is empty\n if heap:\n returnitem = heap[0]\n heap[0] = lastelt\n _siftup(heap, 0)\n return returnitem\n return lastelt\n\n\ndef heapreplace(heap, item):\n """Pop and return the current smallest value, and add the new item.\n\n This is more efficient than heappop() followed by heappush(), and can be\n more appropriate when using a fixed-size heap. Note that the value\n returned may be larger than item! That constrains reasonable uses of\n this routine unless written as part of a conditional replacement:\n\n if item > heap[0]:\n item = heapreplace(heap, item)\n """\n returnitem = heap[0] # raises appropriate IndexError if heap is empty\n heap[0] = item\n _siftup(heap, 0)\n return returnitem\n\n\ndef heappushpop(heap, item):\n """Fast version of a heappush followed by a heappop."""\n if heap and heap[0] < item:\n item, heap[0] = heap[0], item\n _siftup(heap, 0)\n return item\n\n\ndef heapify(x):\n """Transform list into a heap, in-place, in O(len(x)) time."""\n n = len(x)\n # Transform bottom-up. The largest index there\'s any point to looking at\n # is the largest with a child index in-range, so must have 2*i + 1 < n,\n # or i < (n-1)/2. If n is even = 2*j, this is (2*j-1)/2 = j-1/2 so\n # j-1 is the largest, which is n//2 - 1. If n is odd = 2*j+1, this is\n # (2*j+1-1)/2 = j so j-1 is the largest, and that\'s again n//2-1.\n for i in reversed(range(n // 2)):\n _siftup(x, i)\n\n\ndef _heappop_max(heap):\n """Maxheap version of a heappop."""\n lastelt = heap.pop() # raises appropriate IndexError if heap is empty\n if heap:\n returnitem = heap[0]\n heap[0] = lastelt\n _siftup_max(heap, 0)\n return returnitem\n return lastelt\n\n\ndef _heapreplace_max(heap, item):\n """Maxheap version of a heappop followed by a heappush."""\n returnitem = heap[0] # raises appropriate IndexError if heap is empty\n heap[0] = item\n _siftup_max(heap, 0)\n return returnitem\n\n\ndef _heapify_max(x):\n """Transform list into a maxheap, in-place, in O(len(x)) time."""\n n = len(x)\n for i in reversed(range(n // 2)):\n _siftup_max(x, i)\n\n# \'heap\' is a heap at all indices >= startpos, except possibly for pos. pos\n# is the index of a leaf with a possibly out-of-order value. Restore the\n# heap invariant.\n\n\ndef _siftdown(heap, startpos, pos):\n newitem = heap[pos]\n # Follow the path to the root, moving parents down until finding a place\n # newitem fits.\n while pos > startpos:\n parentpos = (pos - 1) >> 1\n parent = heap[parentpos]\n if newitem < parent:\n heap[pos] = parent\n pos = parentpos\n continue\n break\n heap[pos] = newitem\n\n# The child indices of heap index pos are already heaps, and we want to make\n# a heap at index pos too. We do this by bubbling the smaller child of\n# pos up (and so on with that child\'s children, etc) until hitting a leaf,\n# then using _siftdown to move the oddball originally at index pos into place.\n#\n# We *could* break out of the loop as soon as we find a pos where newitem <=\n# both its children, but turns out that\'s not a good idea, and despite that\n# many books write the algorithm that way. During a heap pop, the last array\n# element is sifted in, and that tends to be large, so that comparing it\n# against values starting from the root usually doesn\'t pay (= usually doesn\'t\n# get us out of the loop early). See Knuth, Volume 3, where this is\n# explained and quantified in an exercise.\n#\n# Cutting the # of comparisons is important, since these routines have no\n# way to extract "the priority" from an array element, so that intelligence\n# is likely to be hiding in custom comparison methods, or in array elements\n# storing (priority, record) tuples. Comparisons are thus potentially\n# expensive.\n#\n# On random arrays of length 1000, making this change cut the number of\n# comparisons made by heapify() a little, and those made by exhaustive\n# heappop() a lot, in accord with theory. Here are typical results from 3\n# runs (3 just to demonstrate how small the variance is):\n#\n# Compares needed by heapify Compares needed by 1000 heappops\n# -------------------------- --------------------------------\n# 1837 cut to 1663 14996 cut to 8680\n# 1855 cut to 1659 14966 cut to 8678\n# 1847 cut to 1660 15024 cut to 8703\n#\n# Building the heap by using heappush() 1000 times instead required\n# 2198, 2148, and 2219 compares: heapify() is more efficient, when\n# you can use it.\n#\n# The total compares needed by list.sort() on the same lists were 8627,\n# 8627, and 8632 (this should be compared to the sum of heapify() and\n# heappop() compares): list.sort() is (unsurprisingly!) more efficient\n# for sorting.\n\n\ndef _siftup(heap, pos):\n endpos = len(heap)\n startpos = pos\n newitem = heap[pos]\n # Bubble up the smaller child until hitting a leaf.\n childpos = 2 * pos + 1 # leftmost child position\n while childpos < endpos:\n # Set childpos to index of smaller child.\n rightpos = childpos + 1\n if rightpos < endpos and not heap[childpos] < heap[rightpos]:\n childpos = rightpos\n # Move the smaller child up.\n heap[pos] = heap[childpos]\n pos = childpos\n childpos = 2 * pos + 1\n # The leaf at pos is empty now. Put newitem there, and bubble it up\n # to its final resting place (by sifting its parents down).\n heap[pos] = newitem\n _siftdown(heap, startpos, pos)\n\n\ndef _siftdown_max(heap, startpos, pos):\n \'Maxheap variant of _siftdown\'\n newitem = heap[pos]\n # Follow the path to the root, moving parents down until finding a place\n # newitem fits.\n while pos > startpos:\n parentpos = (pos - 1) >> 1\n parent = heap[parentpos]\n if parent < newitem:\n heap[pos] = parent\n pos = parentpos\n continue\n break\n heap[pos] = newitem\n\n\ndef _siftup_max(heap, pos):\n \'Maxheap variant of _siftup\'\n endpos = len(heap)\n startpos = pos\n newitem = heap[pos]\n # Bubble up the larger child until hitting a leaf.\n childpos = 2 * pos + 1 # leftmost child position\n while childpos < endpos:\n # Set childpos to index of larger child.\n rightpos = childpos + 1\n if rightpos < endpos and not heap[rightpos] < heap[childpos]:\n childpos = rightpos\n # Move the larger child up.\n heap[pos] = heap[childpos]\n pos = childpos\n childpos = 2 * pos + 1\n # The leaf at pos is empty now. Put newitem there, and bubble it up\n # to its final resting place (by sifting its parents down).\n heap[pos] = newitem\n _siftdown_max(heap, startpos, pos)\n\n\n# Algorithm notes for nlargest() and nsmallest()\n# ==============================================\n#\n# Make a single pass over the data while keeping the k most extreme values\n# in a heap. Memory consumption is limited to keeping k values in a list.\n#\n# Measured performance for random inputs:\n#\n# number of comparisons\n# n inputs k-extreme values (average of 5 trials) % more than min()\n# ------------- ---------------- --------------------- -----------------\n# 1,000 100 3,317 231.7%\n# 10,000 100 14,046 40.5%\n# 100,000 100 105,749 5.7%\n# 1,000,000 100 1,007,751 0.8%\n# 10,000,000 100 10,009,401 0.1%\n#\n# Theoretical number of comparisons for k smallest of n random inputs:\n#\n# Step Comparisons Action\n# ---- -------------------------- ---------------------------\n# 1 1.66 * k heapify the first k-inputs\n# 2 n - k compare remaining elements to top of heap\n# 3 k * (1 + lg2(k)) * ln(n/k) replace the topmost value on the heap\n# 4 k * lg2(k) - (k/2) final sort of the k most extreme values\n#\n# Combining and simplifying for a rough estimate gives:\n#\n# comparisons = n + k * (log(k, 2) * log(n/k) + log(k, 2) + log(n/k))\n#\n# Computing the number of comparisons for step 3:\n# -----------------------------------------------\n# * For the i-th new value from the iterable, the probability of being in the\n# k most extreme values is k/i. For example, the probability of the 101st\n# value seen being in the 100 most extreme values is 100/101.\n# * If the value is a new extreme value, the cost of inserting it into the\n# heap is 1 + log(k, 2).\n# * The probability times the cost gives:\n# (k/i) * (1 + log(k, 2))\n# * Summing across the remaining n-k elements gives:\n# sum((k/i) * (1 + log(k, 2)) for i in range(k+1, n+1))\n# * This reduces to:\n# (H(n) - H(k)) * k * (1 + log(k, 2))\n# * Where H(n) is the n-th harmonic number estimated by:\n# gamma = 0.5772156649\n# H(n) = log(n, e) + gamma + 1 / (2 * n)\n# http://en.wikipedia.org/wiki/Harmonic_series_(mathematics)#Rate_of_divergence\n# * Substituting the H(n) formula:\n# comparisons = k * (1 + log(k, 2)) * (log(n/k, e) + (1/n - 1/k) / 2)\n#\n# Worst-case for step 3:\n# ----------------------\n# In the worst case, the input data is reversed sorted so that every new element\n# must be inserted in the heap:\n#\n# comparisons = 1.66 * k + log(k, 2) * (n - k)\n#\n# Alternative Algorithms\n# ----------------------\n# Other algorithms were not used because they:\n# 1) Took much more auxiliary memory,\n# 2) Made multiple passes over the data.\n# 3) Made more comparisons in common cases (small k, large n, semi-random input).\n# See the more detailed comparison of approach at:\n# http://code.activestate.com/recipes/577573-compare-algorithms-for-heapqsmallest\n\ndef nsmallest(n, iterable, key=None):\n """Find the n smallest elements in a dataset.\n\n Equivalent to: sorted(iterable, key=key)[:n]\n """\n\n # Short-cut for n==1 is to use min()\n if n == 1:\n it = iter(iterable)\n sentinel = object()\n result = min(it, default=sentinel, key=key)\n return [] if result is sentinel else [result]\n\n # When n>=size, it\'s faster to use sorted()\n try:\n size = len(iterable)\n except (TypeError, AttributeError):\n pass\n else:\n if n >= size:\n return sorted(iterable, key=key)[:n]\n\n # When key is none, use simpler decoration\n if key is None:\n it = iter(iterable)\n # put the range(n) first so that zip() doesn\'t\n # consume one too many elements from the iterator\n result = [(elem, i) for i, elem in zip(range(n), it)]\n if not result:\n return result\n _heapify_max(result)\n top = result[0][0]\n order = n\n _heapreplace = _heapreplace_max\n for elem in it:\n if elem < top:\n _heapreplace(result, (elem, order))\n top, _order = result[0]\n order += 1\n result.sort()\n return [elem for (elem, order) in result]\n\n # General case, slowest method\n it = iter(iterable)\n result = [(key(elem), i, elem) for i, elem in zip(range(n), it)]\n if not result:\n return result\n _heapify_max(result)\n top = result[0][0]\n order = n\n _heapreplace = _heapreplace_max\n for elem in it:\n k = key(elem)\n if k < top:\n _heapreplace(result, (k, order, elem))\n top, _order, _elem = result[0]\n order += 1\n result.sort()\n return [elem for (k, order, elem) in result]\n\n\ndef nlargest(n, iterable, key=None):\n """Find the n largest elements in a dataset.\n\n Equivalent to: sorted(iterable, key=key, reverse=True)[:n]\n """\n\n # Short-cut for n==1 is to use max()\n if n == 1:\n it = iter(iterable)\n sentinel = object()\n result = max(it, default=sentinel, key=key)\n return [] if result is sentinel else [result]\n\n # When n>=size, it\'s faster to use sorted()\n try:\n size = len(iterable)\n except (TypeError, AttributeError):\n pass\n else:\n if n >= size:\n return sorted(iterable, key=key, reverse=True)[:n]\n\n # When key is none, use simpler decoration\n if key is None:\n it = iter(iterable)\n result = [(elem, i) for i, elem in zip(range(0, -n, -1), it)]\n if not result:\n return result\n heapify(result)\n top = result[0][0]\n order = -n\n _heapreplace = heapreplace\n for elem in it:\n if top < elem:\n _heapreplace(result, (elem, order))\n top, _order = result[0]\n order -= 1\n result.sort(reverse=True)\n return [elem for (elem, order) in result]\n\n # General case, slowest method\n it = iter(iterable)\n result = [(key(elem), i, elem) for i, elem in zip(range(0, -n, -1), it)]\n if not result:\n return result\n heapify(result)\n top = result[0][0]\n order = -n\n _heapreplace = heapreplace\n for elem in it:\n k = key(elem)\n if top < k:\n _heapreplace(result, (k, order, elem))\n top, _order, _elem = result[0]\n order -= 1\n result.sort(reverse=True)\n return [elem for (k, order, elem) in result]\n\n\n# If available, use C implementation\ntry:\n from _heapq import *\nexcept ImportError:\n pass\ntry:\n from _heapq import _heapreplace_max\nexcept ImportError:\n pass\ntry:\n from _heapq import _heapify_max\nexcept ImportError:\n pass\ntry:\n from _heapq import _heappop_max\nexcept ImportError:\n pass\n\n\nif __name__ == "__main__":\n\n import doctest # pragma: no cover\n print(doctest.testmod()) # pragma: no cover\n',"src/lib/hmac.py":'import _sk_fail; _sk_fail._("hmac")\n',"src/lib/hotshot/__init__.py":'import _sk_fail; _sk_fail._("hotshot")\n',"src/lib/htmlentitydefs.py":'import _sk_fail; _sk_fail._("htmlentitydefs")\n',"src/lib/htmllib.py":'import _sk_fail; _sk_fail._("htmllib")\n',"src/lib/httplib.py":'import _sk_fail; _sk_fail._("httplib")\n',"src/lib/idlelib/Icons/__init__.py":'import _sk_fail; _sk_fail._("Icons")\n',"src/lib/idlelib/__init__.py":'import _sk_fail; _sk_fail._("idlelib")\n',"src/lib/ihooks.py":'import _sk_fail; _sk_fail._("ihooks")\n',"src/lib/imaplib.py":'import _sk_fail; _sk_fail._("imaplib")\n',"src/lib/imghdr.py":'import _sk_fail; _sk_fail._("imghdr")\n',"src/lib/imputil.py":'import _sk_fail; _sk_fail._("imputil")\n',"src/lib/io.py":'import _sk_fail; _sk_fail._("io")\n',"src/lib/lib-dynload/__init__.py":'import _sk_fail; _sk_fail._("lib-dynload")\n',"src/lib/lib-tk/__init__.py":'import _sk_fail; _sk_fail._("lib-tk")\n',"src/lib/lib2to3/__init__.py":'import _sk_fail; _sk_fail._("lib2to3")\n',"src/lib/lib2to3/fixes/__init__.py":'import _sk_fail; _sk_fail._("fixes")\n',"src/lib/lib2to3/pgen2/__init__.py":'import _sk_fail; _sk_fail._("pgen2")\n',"src/lib/lib2to3/tests/__init__.py":'import _sk_fail; _sk_fail._("tests")\n',"src/lib/linecache.py":'import _sk_fail; _sk_fail._("linecache")\n',"src/lib/locale.py":'import _sk_fail; _sk_fail._("locale")\n',"src/lib/logging/__init__.py":'# Minimal implementation original from CPython 3.9 source code\n\nimport sys, time, re\n\n\n__all__ = [\n "BASIC_FORMAT",\n "BufferingFormatter",\n "CRITICAL",\n "DEBUG",\n "ERROR",\n "FATAL",\n "FileHandler",\n "Filter",\n "Formatter",\n "Handler",\n "INFO",\n "LogRecord",\n "Logger",\n "LoggerAdapter",\n "NOTSET",\n "NullHandler",\n "StreamHandler",\n "WARN",\n "WARNING",\n "addLevelName",\n "basicConfig",\n "captureWarnings",\n "critical",\n "debug",\n "disable",\n "error",\n "exception",\n "fatal",\n "getLevelName",\n "getLogger",\n "getLoggerClass",\n "info",\n "log",\n "makeLogRecord",\n "setLoggerClass",\n "shutdown",\n "warning",\n "getLogRecordFactory",\n "setLogRecordFactory",\n "lastResort",\n "raiseExceptions",\n]\n\n\n_startTime = time.time()\nraiseExceptions = False\nlogThreads = False\nlogMultiprocessing = False\nlogProcesses = False\nlogAsyncioTasks = False\n\n# ---------------------------------------------------------------------------\n# Level related stuff\n# ---------------------------------------------------------------------------\n\nCRITICAL = 50\nFATAL = CRITICAL\nERROR = 40\nWARNING = 30\nWARN = WARNING\nINFO = 20\nDEBUG = 10\nNOTSET = 0\n\n_levelToName = {\n CRITICAL: "CRITICAL",\n ERROR: "ERROR",\n WARNING: "WARNING",\n INFO: "INFO",\n DEBUG: "DEBUG",\n NOTSET: "NOTSET",\n}\n_nameToLevel = {\n "CRITICAL": CRITICAL,\n "FATAL": FATAL,\n "ERROR": ERROR,\n "WARN": WARNING,\n "WARNING": WARNING,\n "INFO": INFO,\n "DEBUG": DEBUG,\n "NOTSET": NOTSET,\n}\n\n\ndef getLevelName(level):\n result = _levelToName.get(level)\n if result is not None:\n return result\n result = _nameToLevel.get(level)\n if result is not None:\n return result\n return "Level %s" % level\n\n\ndef addLevelName(level, levelName):\n _levelToName[level] = levelName\n _nameToLevel[levelName] = level\n\n\ndef _checkLevel(level):\n if isinstance(level, int):\n rv = level\n elif str(level) == level:\n if level not in _nameToLevel:\n raise ValueError("Unknown level: %r" % level)\n rv = _nameToLevel[level]\n else:\n raise TypeError("Level not an integer or a valid string: %r" % level)\n return rv\n\n\nclass _FakeRlock(object):\n def __enter__(self):\n pass\n\n def __exit__(self, exc_type, exc_value, traceback):\n pass\n\n\n_lock = _FakeRlock()\n\n# ---------------------------------------------------------------------------\n# The logging record\n# ---------------------------------------------------------------------------\n\n\nclass LogRecord(object):\n def __init__(\n self,\n name,\n level,\n pathname,\n lineno,\n msg,\n args,\n exc_info,\n func=None,\n sinfo=None,\n **kwargs,\n ):\n ct = time.time()\n self.name = name\n self.msg = msg\n if args and len(args) == 1 and isinstance(args[0], dict) and args[0]:\n args = args[0]\n self.args = args\n self.levelname = getLevelName(level)\n self.levelno = level\n self.pathname = pathname\n self.filename = pathname\n self.module = "Unknown module"\n self.exc_info = exc_info\n self.exc_text = None # used to cache the traceback text\n self.stack_info = sinfo\n self.lineno = lineno\n self.funcName = func\n self.created = ct\n self.msecs = int((ct - int(ct)) * 1000) + 0.0 # see gh-89047\n self.relativeCreated = (self.created - _startTime) * 1000\n self.thread = None\n self.threadName = None\n self.processName = None\n self.process = None\n self.taskName = None\n\n def __repr__(self):\n return \'<LogRecord: %s, %s, %s, %s, "%s">\' % (\n self.name,\n self.levelno,\n self.pathname,\n self.lineno,\n self.msg,\n )\n\n def getMessage(self):\n msg = str(self.msg)\n if self.args:\n msg = msg % self.args\n return msg\n\n\n#\n# Determine which class to use when instantiating log records.\n#\n_logRecordFactory = LogRecord\n\n\ndef setLogRecordFactory(factory):\n global _logRecordFactory\n _logRecordFactory = factory\n\n\ndef getLogRecordFactory():\n return _logRecordFactory\n\n\ndef makeLogRecord(dict):\n rv = _logRecordFactory(None, None, "", 0, "", (), None, None)\n rv.__dict__.update(dict)\n return rv\n\n\n# ---------------------------------------------------------------------------\n# Formatter classes and functions\n# ---------------------------------------------------------------------------\nclass PercentStyle(object):\n default_format = "%(message)s"\n asctime_format = "%(asctime)s"\n asctime_search = "%(asctime)"\n validation_pattern = re.compile(\n r"%\\(\\w+\\)[#0+ -]*(\\*|\\d+)?(\\.(\\*|\\d+))?[diouxefgcrsa%]", re.I\n )\n\n def __init__(self, fmt, *, defaults=None):\n self._fmt = fmt or self.default_format\n self._defaults = defaults\n\n def usesTime(self):\n return self._fmt.find(self.asctime_search) >= 0\n\n def validate(self):\n if not self.validation_pattern.search(self._fmt):\n raise ValueError(\n "Invalid format \'%s\' for \'%s\' style"\n % (self._fmt, self.default_format[0])\n )\n\n def _format(self, record):\n defaults = self._defaults\n if defaults:\n values = defaults | record.__dict__\n else:\n values = record.__dict__\n return self._fmt % values\n\n def format(self, record):\n try:\n return self._format(record)\n except KeyError as e:\n raise ValueError("Formatting field not found in record: %s" % e)\n\n\nclass StrFormatStyle(PercentStyle):\n default_format = "{message}"\n asctime_format = "{asctime}"\n asctime_search = "{asctime"\n\n fmt_spec = re.compile(\n r"^(.?[<>=^])?[+ -]?#?0?(\\d+|{\\w+})?[,_]?(\\.(\\d+|{\\w+}))?[bcdefgnosx%]?$", re.I\n )\n field_spec = re.compile(r"^(\\d+|\\w+)(\\.\\w+|\\[[^]]+\\])*$")\n\n def _format(self, record):\n defaults = self._defaults\n if defaults:\n values = defaults | record.__dict__\n else:\n values = record.__dict__\n return self._fmt.format(**values)\n\n def validate(self):\n """Validate the input format, ensure it is the correct string formatting style"""\n return # TODO - _str_formatter.parse is not a thing - just assume it\'s valid\n fields = set()\n try:\n for _, fieldname, spec, conversion in _str_formatter.parse(self._fmt):\n if fieldname:\n if not self.field_spec.match(fieldname):\n raise ValueError(\n "invalid field name/expression: %r" % fieldname\n )\n fields.add(fieldname)\n if conversion and conversion not in "rsa":\n raise ValueError("invalid conversion: %r" % conversion)\n if spec and not self.fmt_spec.match(spec):\n raise ValueError("bad specifier: %r" % spec)\n except ValueError as e:\n raise ValueError("invalid format: %s" % e)\n if not fields:\n raise ValueError("invalid format: no fields")\n\n\nclass StringTemplateStyle(PercentStyle):\n default_format = "${message}"\n asctime_format = "${asctime}"\n asctime_search = "${asctime}"\n\n def __init__(self, fmt, *, defaults=None):\n raise NotImplementedError("StringTemplateStyle is not implemented")\n\n\nBASIC_FORMAT = "%(levelname)s:%(name)s:%(message)s"\n\n_STYLES = {\n "%": (PercentStyle, BASIC_FORMAT),\n "{": (StrFormatStyle, "{levelname}:{name}:{message}"),\n "$": (StringTemplateStyle, "${levelname}:${name}:${message}"),\n}\n\n\nclass Formatter(object):\n def converter(self, x):\n return time.localtime(x)\n\n def __init__(self, fmt=None, datefmt=None, style=\'%\', validate=True, *,\n defaults=None):\n if style not in _STYLES:\n raise ValueError("Style must be one of: %s" % ",".join(_STYLES.keys()))\n self._style = _STYLES[style][0](fmt, defaults=defaults)\n if validate:\n self._style.validate()\n\n self._fmt = self._style._fmt\n self.datefmt = datefmt\n\n default_time_format = "%Y-%m-%d %H:%M:%S"\n default_msec_format = "%s,%03d"\n\n def formatTime(self, record, datefmt=None):\n ct = self.converter(record.created)\n if datefmt:\n s = time.strftime(datefmt, ct)\n else:\n s = time.strftime(self.default_time_format, ct)\n if self.default_msec_format:\n s = self.default_msec_format % (s, record.msecs)\n return s\n\n def formatException(self, ei):\n raise NotImplementedError("formatException is not implemented")\n\n def usesTime(self):\n return self._style.usesTime()\n\n def formatMessage(self, record):\n return self._style.format(record)\n\n def formatStack(self, stack_info):\n return stack_info\n\n def format(self, record):\n record.message = record.getMessage()\n if self.usesTime():\n record.asctime = self.formatTime(record, self.datefmt)\n s = self.formatMessage(record)\n if record.exc_info:\n # Cache the traceback text to avoid converting it multiple times\n # (it\'s constant anyway)\n if not record.exc_text:\n record.exc_text = self.formatException(record.exc_info)\n if record.exc_text:\n if s[-1:] != "\\n":\n s = s + "\\n"\n s = s + record.exc_text\n if record.stack_info:\n if s[-1:] != "\\n":\n s = s + "\\n"\n s = s + self.formatStack(record.stack_info)\n return s\n\n\n#\n# The default formatter to use when no other is specified\n#\n_defaultFormatter = Formatter()\n\n\nclass BufferingFormatter(object):\n def __init__(self, linefmt=None):\n if linefmt:\n self.linefmt = linefmt\n else:\n self.linefmt = _defaultFormatter\n\n def formatHeader(self, records):\n return ""\n\n def formatFooter(self, records):\n return ""\n\n def format(self, records):\n rv = ""\n if len(records) > 0:\n rv = rv + self.formatHeader(records)\n for record in records:\n rv = rv + self.linefmt.format(record)\n rv = rv + self.formatFooter(records)\n return rv\n\n\n# ---------------------------------------------------------------------------\n# Filter classes and functions\n# ---------------------------------------------------------------------------\n\n\nclass Filter(object):\n def __init__(self, name=""):\n self.name = name\n self.nlen = len(name)\n\n def filter(self, record):\n if self.nlen == 0:\n return True\n elif self.name == record.name:\n return True\n elif record.name.find(self.name, 0, self.nlen) != 0:\n return False\n return record.name[self.nlen] == "."\n\n\nclass Filterer(object):\n def __init__(self):\n self.filters = []\n\n def addFilter(self, filter):\n if filter not in self.filters:\n self.filters.append(filter)\n\n def removeFilter(self, filter):\n if filter in self.filters:\n self.filters.remove(filter)\n\n def filter(self, record):\n for f in self.filters:\n if hasattr(f, "filter"):\n result = f.filter(record)\n else:\n result = f(record) # assume callable - will raise if not\n if not result:\n return False\n if isinstance(result, LogRecord):\n record = result\n return record\n\n\n# ---------------------------------------------------------------------------\n# Handler classes and functions\n# ---------------------------------------------------------------------------\n\n# _handlers = weakref.WeakValueDictionary() # map of handler names to handlers\n_handlers = {} # map of handler names to handlers\n\n\nclass Handler(Filterer):\n def __init__(self, level=NOTSET):\n Filterer.__init__(self)\n self._name = None\n self.level = _checkLevel(level)\n self.formatter = None\n self._closed = False\n\n def get_name(self):\n return self._name\n\n def set_name(self, name):\n if self._name in _handlers:\n del _handlers[self._name]\n self._name = name\n if name:\n _handlers[name] = self\n\n name = property(get_name, set_name)\n\n def setLevel(self, level):\n self.level = _checkLevel(level)\n\n def format(self, record):\n if self.formatter:\n fmt = self.formatter\n else:\n fmt = _defaultFormatter\n return fmt.format(record)\n\n def emit(self, record):\n raise NotImplementedError("emit must be implemented " "by Handler subclasses")\n\n def handle(self, record):\n rv = self.filter(record)\n if isinstance(rv, LogRecord):\n record = rv\n if rv:\n self.emit(record)\n return rv\n\n def setFormatter(self, fmt):\n self.formatter = fmt\n\n def flush(self):\n pass\n\n def close(self):\n self._closed = True\n if self._name and self._name in _handlers:\n del _handlers[self._name]\n\n def handleError(self, record):\n pass\n\n def __repr__(self):\n level = getLevelName(self.level)\n return "<%s (%s)>" % (self.__class__.__name__, level)\n\n\nclass StreamHandler(Handler):\n terminator = "\\n"\n\n def __init__(self, stream=None):\n Handler.__init__(self)\n if stream is None:\n stream = sys.stderr\n self.stream = stream\n\n def flush(self):\n if self.stream and hasattr(self.stream, "flush"):\n self.stream.flush()\n\n def emit(self, record):\n try:\n msg = self.format(record)\n stream = self.stream\n stream.write(msg + self.terminator)\n self.flush()\n except RecursionError: # See issue 36272\n raise\n except Exception:\n raise # TODO - we can\'t really handle errors so just raise them\n self.handleError(record)\n\n def setStream(self, stream):\n if stream is self.stream:\n result = None\n else:\n result = self.stream\n self.flush()\n self.stream = stream\n return result\n\n def __repr__(self):\n level = getLevelName(self.level)\n name = getattr(self.stream, "name", "")\n # bpo-36015: name can be an int\n name = str(name)\n if name:\n name += " "\n return "<%s %s(%s)>" % (self.__class__.__name__, name, level)\n\n\nclass FileHandler(StreamHandler):\n def __init__(self, filename, mode="a", encoding=None, delay=False, errors=None):\n raise NotImplementedError("FileHandler is not implemented")\n\n\nclass _StderrHandler(StreamHandler):\n def __init__(self, level=NOTSET):\n Handler.__init__(self, level)\n\n @property\n def stream(self):\n return sys.stderr\n\n\n_defaultLastResort = _StderrHandler(WARNING)\nlastResort = _defaultLastResort\n\n# ---------------------------------------------------------------------------\n# Manager classes and functions\n# ---------------------------------------------------------------------------\n\n\nclass PlaceHolder(object):\n def __init__(self, alogger):\n self.loggerMap = {alogger: None}\n\n def append(self, alogger):\n if alogger not in self.loggerMap:\n self.loggerMap[alogger] = None\n\n\ndef setLoggerClass(klass):\n if klass != Logger:\n if not issubclass(klass, Logger):\n raise TypeError("logger not derived from logging.Logger: " + klass.__name__)\n global _loggerClass\n _loggerClass = klass\n\n\ndef getLoggerClass():\n return _loggerClass\n\n\nclass Manager(object):\n def __init__(self, rootnode):\n self.root = rootnode\n self.disable = 0\n self.emittedNoHandlerWarning = False\n self.loggerDict = {}\n self.loggerClass = None\n self.logRecordFactory = None\n\n @property\n def disable(self):\n return self._disable\n\n @disable.setter\n def disable(self, value):\n self._disable = _checkLevel(value)\n\n def getLogger(self, name):\n rv = None\n if not isinstance(name, str):\n raise TypeError("A logger name must be a string")\n if name in self.loggerDict:\n rv = self.loggerDict[name]\n if isinstance(rv, PlaceHolder):\n ph = rv\n rv = (self.loggerClass or _loggerClass)(name)\n rv.manager = self\n self.loggerDict[name] = rv\n self._fixupChildren(ph, rv)\n self._fixupParents(rv)\n else:\n rv = (self.loggerClass or _loggerClass)(name)\n rv.manager = self\n self.loggerDict[name] = rv\n self._fixupParents(rv)\n return rv\n\n def setLoggerClass(self, klass):\n if klass != Logger:\n if not issubclass(klass, Logger):\n raise TypeError(\n "logger not derived from logging.Logger: " + klass.__name__\n )\n self.loggerClass = klass\n\n def setLogRecordFactory(self, factory):\n self.logRecordFactory = factory\n\n def _fixupParents(self, alogger):\n name = alogger.name\n i = name.rfind(".")\n rv = None\n while (i > 0) and not rv:\n substr = name[:i]\n if substr not in self.loggerDict:\n self.loggerDict[substr] = PlaceHolder(alogger)\n else:\n obj = self.loggerDict[substr]\n if isinstance(obj, Logger):\n rv = obj\n else:\n assert isinstance(obj, PlaceHolder)\n obj.append(alogger)\n i = name.rfind(".", 0, i - 1)\n if not rv:\n rv = self.root\n alogger.parent = rv\n\n def _fixupChildren(self, ph, alogger):\n name = alogger.name\n namelen = len(name)\n for c in ph.loggerMap.keys():\n # The if means ... if not c.parent.name.startswith(nm)\n if c.parent.name[:namelen] != name:\n alogger.parent = c.parent\n c.parent = alogger\n\n def _clear_cache(self):\n for logger in self.loggerDict.values():\n if isinstance(logger, Logger):\n logger._cache.clear()\n self.root._cache.clear()\n\n\n# ---------------------------------------------------------------------------\n# Logger classes and functions\n# ---------------------------------------------------------------------------\n\n\nclass Logger(Filterer):\n def __init__(self, name, level=NOTSET):\n Filterer.__init__(self)\n self.name = name\n self.level = _checkLevel(level)\n self.parent = None\n self.propagate = True\n self.handlers = []\n self.disabled = False\n self._cache = {}\n\n def setLevel(self, level):\n self.level = _checkLevel(level)\n self.manager._clear_cache()\n\n def debug(self, msg, *args, **kwargs):\n if self.isEnabledFor(DEBUG):\n self._log(DEBUG, msg, args, **kwargs)\n\n def info(self, msg, *args, **kwargs):\n if self.isEnabledFor(INFO):\n self._log(INFO, msg, args, **kwargs)\n\n def warning(self, msg, *args, **kwargs):\n if self.isEnabledFor(WARNING):\n self._log(WARNING, msg, args, **kwargs)\n\n def error(self, msg, *args, **kwargs):\n if self.isEnabledFor(ERROR):\n self._log(ERROR, msg, args, **kwargs)\n\n def exception(self, msg, *args, exc_info=True, **kwargs):\n self.error(msg, *args, exc_info=exc_info, **kwargs)\n\n def critical(self, msg, *args, **kwargs):\n if self.isEnabledFor(CRITICAL):\n self._log(CRITICAL, msg, args, **kwargs)\n\n fatal = critical\n\n def log(self, level, msg, *args, **kwargs):\n if not isinstance(level, int):\n if raiseExceptions:\n raise TypeError("level must be an integer")\n else:\n return\n if self.isEnabledFor(level):\n self._log(level, msg, args, **kwargs)\n\n def findCaller(self, stack_info=False, stacklevel=1):\n rv = "(unknown file)", 0, "(unknown function)", None\n return rv\n\n def makeRecord(\n self,\n name,\n level,\n fn,\n lno,\n msg,\n args,\n exc_info,\n func=None,\n extra=None,\n sinfo=None,\n ):\n rv = _logRecordFactory(name, level, fn, lno, msg, args, exc_info, func, sinfo)\n if extra is not None:\n for key in extra:\n if (key in ["message", "asctime"]) or (key in rv.__dict__):\n raise KeyError("Attempt to overwrite %r in LogRecord" % key)\n rv.__dict__[key] = extra[key]\n return rv\n\n def _log(\n self,\n level,\n msg,\n args,\n exc_info=None,\n extra=None,\n stack_info=False,\n stacklevel=1,\n ):\n sinfo = None\n fn, lno, func = "(unknown file)", 0, "(unknown function)"\n if exc_info:\n if isinstance(exc_info, BaseException):\n exc_info = (type(exc_info), exc_info, exc_info.__traceback__)\n elif not isinstance(exc_info, tuple):\n exc_info = sys.exc_info()\n record = self.makeRecord(\n self.name, level, fn, lno, msg, args, exc_info, func, extra, sinfo\n )\n self.handle(record)\n\n def handle(self, record):\n if self.disabled:\n return\n maybe_record = self.filter(record)\n if not maybe_record:\n return\n if isinstance(maybe_record, LogRecord):\n record = maybe_record\n self.callHandlers(record)\n\n def addHandler(self, hdlr):\n if hdlr not in self.handlers:\n self.handlers.append(hdlr)\n\n def removeHandler(self, hdlr):\n if hdlr in self.handlers:\n self.handlers.remove(hdlr)\n\n def hasHandlers(self):\n c = self\n rv = False\n while c:\n if c.handlers:\n rv = True\n break\n if not c.propagate:\n break\n else:\n c = c.parent\n return rv\n\n def callHandlers(self, record):\n c = self\n found = 0\n while c:\n for hdlr in c.handlers:\n found = found + 1\n if record.levelno >= hdlr.level:\n hdlr.handle(record)\n if not c.propagate:\n c = None # break out\n else:\n c = c.parent\n if found == 0:\n if lastResort:\n if record.levelno >= lastResort.level:\n lastResort.handle(record)\n elif raiseExceptions and not self.manager.emittedNoHandlerWarning:\n sys.stderr.write(\n "No handlers could be found for logger" \' "%s"\\n\' % self.name\n )\n self.manager.emittedNoHandlerWarning = True\n\n def getEffectiveLevel(self):\n logger = self\n while logger:\n if logger.level:\n return logger.level\n logger = logger.parent\n return NOTSET\n\n def isEnabledFor(self, level):\n if self.disabled:\n return False\n\n try:\n return self._cache[level]\n except KeyError:\n if self.manager.disable >= level:\n is_enabled = self._cache[level] = False\n else:\n is_enabled = self._cache[level] = level >= self.getEffectiveLevel()\n return is_enabled\n\n def getChild(self, suffix):\n if self.root is not self:\n suffix = ".".join((self.name, suffix))\n return self.manager.getLogger(suffix)\n\n\n def getChildren(self):\n\n def _hierlevel(logger):\n if logger is logger.manager.root:\n return 0\n return 1 + logger.name.count(\'.\')\n\n d = self.manager.loggerDict\n return set(item for item in d.values()\n if isinstance(item, Logger) and item.parent is self and\n _hierlevel(item) == 1 + _hierlevel(item.parent))\n\n def __repr__(self):\n level = getLevelName(self.getEffectiveLevel())\n return "<%s %s (%s)>" % (self.__class__.__name__, self.name, level)\n\n\nclass RootLogger(Logger):\n def __init__(self, level):\n Logger.__init__(self, "root", level)\n\n\n_loggerClass = Logger\n\n\nclass LoggerAdapter(object):\n def __init__(self, logger, extra=None):\n self.logger = logger\n self.extra = extra\n\n def process(self, msg, kwargs):\n kwargs["extra"] = self.extra\n return msg, kwargs\n\n def debug(self, msg, *args, **kwargs):\n self.log(DEBUG, msg, *args, **kwargs)\n\n def info(self, msg, *args, **kwargs):\n self.log(INFO, msg, *args, **kwargs)\n\n def warning(self, msg, *args, **kwargs):\n self.log(WARNING, msg, *args, **kwargs)\n\n def error(self, msg, *args, **kwargs):\n self.log(ERROR, msg, *args, **kwargs)\n\n def exception(self, msg, *args, exc_info=True, **kwargs):\n self.log(ERROR, msg, *args, exc_info=exc_info, **kwargs)\n\n def critical(self, msg, *args, **kwargs):\n self.log(CRITICAL, msg, *args, **kwargs)\n\n def log(self, level, msg, *args, **kwargs):\n if self.isEnabledFor(level):\n msg, kwargs = self.process(msg, kwargs)\n self.logger.log(level, msg, *args, **kwargs)\n\n def isEnabledFor(self, level):\n return self.logger.isEnabledFor(level)\n\n def setLevel(self, level):\n self.logger.setLevel(level)\n\n def getEffectiveLevel(self):\n return self.logger.getEffectiveLevel()\n\n def hasHandlers(self):\n return self.logger.hasHandlers()\n\n def _log(self, level, msg, args, **kwargs):\n return self.logger._log(level, msg, args, **kwargs)\n\n @property\n def manager(self):\n return self.logger.manager\n\n @manager.setter\n def manager(self, value):\n self.logger.manager = value\n\n @property\n def name(self):\n return self.logger.name\n\n def __repr__(self):\n logger = self.logger\n level = getLevelName(logger.getEffectiveLevel())\n return "<%s %s (%s)>" % (self.__class__.__name__, logger.name, level)\n\n\nroot = RootLogger(WARNING)\nLogger.root = root\nLogger.manager = Manager(Logger.root)\n\n# ---------------------------------------------------------------------------\n# Configuration classes and functions\n# ---------------------------------------------------------------------------\n\n\ndef basicConfig(**kwargs):\n force = kwargs.pop("force", False)\n encoding = kwargs.pop("encoding", None)\n errors = kwargs.pop("errors", "backslashreplace")\n if force:\n for h in root.handlers[:]:\n root.removeHandler(h)\n h.close()\n if len(root.handlers) == 0:\n handlers = kwargs.pop("handlers", None)\n if handlers is None:\n if "stream" in kwargs and "filename" in kwargs:\n raise ValueError(\n "\'stream\' and \'filename\' should not be " "specified together"\n )\n else:\n if "stream" in kwargs or "filename" in kwargs:\n raise ValueError(\n "\'stream\' or \'filename\' should not be "\n "specified together with \'handlers\'"\n )\n if handlers is None:\n filename = kwargs.pop("filename", None)\n mode = kwargs.pop("filemode", "a")\n if filename:\n if "b" in mode:\n errors = None\n h = FileHandler(filename, mode, encoding=encoding, errors=errors)\n else:\n stream = kwargs.pop("stream", None)\n h = StreamHandler(stream)\n handlers = [h]\n dfs = kwargs.pop("datefmt", None)\n style = kwargs.pop("style", "%")\n if style not in _STYLES:\n raise ValueError("Style must be one of: %s" % ",".join(_STYLES.keys()))\n fs = kwargs.pop("format", _STYLES[style][1])\n fmt = Formatter(fs, dfs, style)\n for h in handlers:\n if h.formatter is None:\n h.setFormatter(fmt)\n root.addHandler(h)\n level = kwargs.pop("level", None)\n if level is not None:\n root.setLevel(level)\n if kwargs:\n keys = ", ".join(kwargs.keys())\n raise ValueError("Unrecognised argument(s): %s" % keys)\n\n\ndef getLogger(name=None):\n if not name or isinstance(name, str) and name == root.name:\n return root\n return Logger.manager.getLogger(name)\n\n\ndef critical(msg, *args, **kwargs):\n if len(root.handlers) == 0:\n basicConfig()\n root.critical(msg, *args, **kwargs)\n\n\nfatal = critical\n\n\ndef error(msg, *args, **kwargs):\n if len(root.handlers) == 0:\n basicConfig()\n root.error(msg, *args, **kwargs)\n\n\ndef exception(msg, *args, exc_info=True, **kwargs):\n error(msg, *args, exc_info=exc_info, **kwargs)\n\n\ndef warning(msg, *args, **kwargs):\n if len(root.handlers) == 0:\n basicConfig()\n root.warning(msg, *args, **kwargs)\n\n\ndef info(msg, *args, **kwargs):\n if len(root.handlers) == 0:\n basicConfig()\n root.info(msg, *args, **kwargs)\n\n\ndef debug(msg, *args, **kwargs):\n if len(root.handlers) == 0:\n basicConfig()\n root.debug(msg, *args, **kwargs)\n\n\ndef log(level, msg, *args, **kwargs):\n if len(root.handlers) == 0:\n basicConfig()\n root.log(level, msg, *args, **kwargs)\n\n\ndef disable(level=CRITICAL):\n root.manager.disable = level\n root.manager._clear_cache()\n\n\ndef shutdown(handlerList=[]):\n raise NotImplementedError("shutdown is not implemented")\n\n\nclass NullHandler(Handler):\n def handle(self, record):\n """Stub."""\n\n def emit(self, record):\n """Stub."""\n\n\ndef captureWarnings(capture):\n raise NotImplementedError("captureWarnings is not implemented")\n',"src/lib/macpath.py":'import _sk_fail; _sk_fail._("macpath")\n',"src/lib/macurl2path.py":'import _sk_fail; _sk_fail._("macurl2path")\n',"src/lib/mailbox.py":'import _sk_fail; _sk_fail._("mailbox")\n',"src/lib/mailcap.py":'import _sk_fail; _sk_fail._("mailcap")\n',"src/lib/markupbase.py":'import _sk_fail; _sk_fail._("markupbase")\n',"src/lib/md5.py":'import _sk_fail; _sk_fail._("md5")\n',"src/lib/mhlib.py":'import _sk_fail; _sk_fail._("mhlib")\n',"src/lib/mimetools.py":'import _sk_fail; _sk_fail._("mimetools")\n',"src/lib/mimetypes.py":'import _sk_fail; _sk_fail._("mimetypes")\n',"src/lib/mimify.py":'import _sk_fail; _sk_fail._("mimify")\n',"src/lib/modulefinder.py":'import _sk_fail; _sk_fail._("modulefinder")\n',"src/lib/multifile.py":'import _sk_fail; _sk_fail._("multifile")\n',"src/lib/multiprocessing/__init__.py":'import _sk_fail; _sk_fail._("multiprocessing")\n',"src/lib/multiprocessing/dummy/__init__.py":'import _sk_fail; _sk_fail._("dummy")\n',"src/lib/mutex.py":'import _sk_fail; _sk_fail._("mutex")\n',"src/lib/netrc.py":'import _sk_fail; _sk_fail._("netrc")\n',"src/lib/new.py":'import _sk_fail; _sk_fail._("new")\n',"src/lib/nntplib.py":'import _sk_fail; _sk_fail._("nntplib")\n',"src/lib/ntpath.py":'import _sk_fail; _sk_fail._("ntpath")\n',"src/lib/nturl2path.py":'import _sk_fail; _sk_fail._("nturl2path")\n',"src/lib/numbers.py":"Number = (int, float, complex)\nIntegral = int\nComplex = complex\n","src/lib/opcode.py":'import _sk_fail; _sk_fail._("opcode")\n',"src/lib/optparse.py":'import _sk_fail; _sk_fail._("optparse")\n',"src/lib/os.py":'import _sk_fail; _sk_fail._("os")\n',"src/lib/os2emxpath.py":'import _sk_fail; _sk_fail._("os2emxpath")\n',"src/lib/pdb.py":'import _sk_fail; _sk_fail._("pdb")\n',"src/lib/pickle.py":'import _sk_fail; _sk_fail._("pickle")\n',"src/lib/pickletools.py":'import _sk_fail; _sk_fail._("pickletools")\n',"src/lib/pipes.py":'import _sk_fail; _sk_fail._("pipes")\n',"src/lib/pkgutil.py":'import _sk_fail; _sk_fail._("pkgutil")\n',"src/lib/platform.py":'import _sk_fail; _sk_fail._("platform")\n',"src/lib/plistlib.py":'import _sk_fail; _sk_fail._("plistlib")\n',"src/lib/popen2.py":'import _sk_fail; _sk_fail._("popen2")\n',"src/lib/poplib.py":'import _sk_fail; _sk_fail._("poplib")\n',"src/lib/posixfile.py":'import _sk_fail; _sk_fail._("posixfile")\n',"src/lib/posixpath.py":'import _sk_fail; _sk_fail._("posixpath")\n',"src/lib/pprint.py":'import _sk_fail; _sk_fail._("pprint")\n',"src/lib/profile.py":'import _sk_fail; _sk_fail._("profile")\n',"src/lib/pstats.py":'import _sk_fail; _sk_fail._("pstats")\n',"src/lib/pty.py":'import _sk_fail; _sk_fail._("pty")\n',"src/lib/py_compile.py":'import _sk_fail; _sk_fail._("py_compile")\n',"src/lib/pyclbr.py":'import _sk_fail; _sk_fail._("pyclbr")\n',"src/lib/pydoc.py":'import _sk_fail; _sk_fail._("pydoc")\n',"src/lib/pydoc_topics.py":'import _sk_fail; _sk_fail._("pydoc_topics")\n',"src/lib/pythonds/__init__.py":"","src/lib/pythonds/basic/__init__.py":'\n#__all__ = ["stack"]\n\n\nfrom .stack import Stack\nfrom .queue import Queue\nfrom .deque import Deque\n\n\n',"src/lib/pythonds/basic/deque.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n#\n# deque.py\n\n\nclass Deque:\n def __init__(self):\n self.items = []\n\n def isEmpty(self):\n return self.items == []\n\n def addFront(self, item):\n self.items.append(item)\n\n def addRear(self, item):\n self.items.insert(0, item)\n\n def removeFront(self):\n return self.items.pop()\n\n def removeRear(self):\n return self.items.pop(0)\n\n def size(self):\n return len(self.items)\n","src/lib/pythonds/basic/queue.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n#\n# queue.py\n\n\nclass Queue:\n def __init__(self):\n self.items = []\n\n def isEmpty(self):\n return self.items == []\n\n def enqueue(self, item):\n self.items.insert(0, item)\n\n def dequeue(self):\n return self.items.pop()\n\n def size(self):\n return len(self.items)\n","src/lib/pythonds/basic/stack.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n#\n# stack.py\n\n\nclass Stack:\n def __init__(self):\n self.items = []\n\n def isEmpty(self):\n return self.items == []\n\n def push(self, item):\n self.items.append(item)\n\n def pop(self):\n return self.items.pop()\n\n def peek(self):\n return self.items[len(self.items) - 1]\n\n def size(self):\n return len(self.items)\n","src/lib/pythonds/graphs/__init__.py":"\n\nfrom .adjGraph import Graph\nfrom .adjGraph import Vertex\nfrom .priorityQueue import PriorityQueue\n","src/lib/pythonds/graphs/adjGraph.py":'#\n# adjGraph\n#\n# Created by Brad Miller on 2005-02-24.\n# Copyright (c) 2005 Brad Miller, David Ranum, Luther College. All rights reserved.\n#\n\nimport sys\nimport os\nimport unittest\n\nclass Graph:\n def __init__(self):\n self.vertices = {}\n self.numVertices = 0\n \n def addVertex(self,key):\n self.numVertices = self.numVertices + 1\n newVertex = Vertex(key)\n self.vertices[key] = newVertex\n return newVertex\n \n def getVertex(self,n):\n if n in self.vertices:\n return self.vertices[n]\n else:\n return None\n\n def __contains__(self,n):\n return n in self.vertices\n \n def addEdge(self,f,t,cost=0):\n if f not in self.vertices:\n nv = self.addVertex(f)\n if t not in self.vertices:\n nv = self.addVertex(t)\n self.vertices[f].addNeighbor(self.vertices[t],cost)\n \n def getVertices(self):\n return list(self.vertices.keys())\n \n def __iter__(self):\n return iter(self.vertices.values())\n \nclass Vertex:\n def __init__(self,num):\n self.id = num\n self.connectedTo = {}\n self.color = \'white\'\n self.dist = sys.maxsize\n self.pred = None\n self.disc = 0\n self.fin = 0\n\n # def __lt__(self,o):\n # return self.id < o.id\n \n def addNeighbor(self,nbr,weight=0):\n self.connectedTo[nbr] = weight\n \n def setColor(self,color):\n self.color = color\n \n def setDistance(self,d):\n self.dist = d\n\n def setPred(self,p):\n self.pred = p\n\n def setDiscovery(self,dtime):\n self.disc = dtime\n \n def setFinish(self,ftime):\n self.fin = ftime\n \n def getFinish(self):\n return self.fin\n \n def getDiscovery(self):\n return self.disc\n \n def getPred(self):\n return self.pred\n \n def getDistance(self):\n return self.dist\n \n def getColor(self):\n return self.color\n \n def getConnections(self):\n return self.connectedTo.keys()\n \n def getWeight(self,nbr):\n return self.connectedTo[nbr]\n \n def __str__(self):\n return str(self.id) + ":color " + self.color + ":disc " + str(self.disc) + ":fin " + str(self.fin) + ":dist " + str(self.dist) + ":pred \\n\\t[" + str(self.pred)+ "]\\n"\n \n def getId(self):\n return self.id\n\nclass adjGraphTests(unittest.TestCase):\n def setUp(self):\n self.tGraph = Graph()\n \n def testMakeGraph(self):\n gFile = open("test.dat")\n for line in gFile:\n fVertex, tVertex = line.split(\'|\')\n fVertex = int(fVertex)\n tVertex = int(tVertex)\n self.tGraph.addEdge(fVertex,tVertex)\n for i in self.tGraph:\n adj = i.getAdj()\n for k in adj:\n print(i, k)\n\n \nif __name__ == \'__main__\':\n unittest.main()\n \n',"src/lib/pythonds/graphs/priorityQueue.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \nimport unittest\n\n# this implementation of binary heap takes key value pairs,\n# we will assume that the keys are all comparable\n\nclass PriorityQueue:\n def __init__(self):\n self.heapArray = [(0,0)]\n self.currentSize = 0\n\n def buildHeap(self,alist):\n self.currentSize = len(alist)\n self.heapArray = [(0,0)]\n for i in alist:\n self.heapArray.append(i)\n i = len(alist) // 2 \n while (i > 0):\n self.percDown(i)\n i = i - 1\n \n def percDown(self,i):\n while (i * 2) <= self.currentSize:\n mc = self.minChild(i)\n if self.heapArray[i][0] > self.heapArray[mc][0]:\n tmp = self.heapArray[i]\n self.heapArray[i] = self.heapArray[mc]\n self.heapArray[mc] = tmp\n i = mc\n \n def minChild(self,i):\n if i*2 > self.currentSize:\n return -1\n else:\n if i*2 + 1 > self.currentSize:\n return i*2\n else:\n if self.heapArray[i*2][0] < self.heapArray[i*2+1][0]:\n return i*2\n else:\n return i*2+1\n\n def percUp(self,i):\n while i // 2 > 0:\n if self.heapArray[i][0] < self.heapArray[i//2][0]:\n tmp = self.heapArray[i//2]\n self.heapArray[i//2] = self.heapArray[i]\n self.heapArray[i] = tmp\n i = i//2\n \n def add(self,k):\n self.heapArray.append(k)\n self.currentSize = self.currentSize + 1\n self.percUp(self.currentSize)\n\n def delMin(self):\n retval = self.heapArray[1][1]\n self.heapArray[1] = self.heapArray[self.currentSize]\n self.currentSize = self.currentSize - 1\n self.heapArray.pop()\n self.percDown(1)\n return retval\n \n def isEmpty(self):\n if self.currentSize == 0:\n return True\n else:\n return False\n\n def decreaseKey(self,val,amt):\n # this is a little wierd, but we need to find the heap thing to decrease by\n # looking at its value\n done = False\n i = 1\n myKey = 0\n while not done and i <= self.currentSize:\n if self.heapArray[i][1] == val:\n done = True\n myKey = i\n else:\n i = i + 1\n if myKey > 0:\n self.heapArray[myKey] = (amt,self.heapArray[myKey][1])\n self.percUp(myKey)\n \n def __contains__(self,vtx):\n for pair in self.heapArray:\n if pair[1] == vtx:\n return True\n return False\n \nclass TestBinHeap(unittest.TestCase):\n def setUp(self):\n self.theHeap = PriorityQueue()\n self.theHeap.add((2,'x'))\n self.theHeap.add((3,'y'))\n self.theHeap.add((5,'z'))\n self.theHeap.add((6,'a'))\n self.theHeap.add((4,'d'))\n\n\n def testInsert(self):\n assert self.theHeap.currentSize == 5\n\n def testDelmin(self):\n assert self.theHeap.delMin() == 'x'\n assert self.theHeap.delMin() == 'y'\n \n def testDecKey(self):\n self.theHeap.decreaseKey('d',1)\n assert self.theHeap.delMin() == 'd'\n \nif __name__ == '__main__':\n unittest.main()\n","src/lib/pythonds/trees/__init__.py":"\nfrom .binaryTree import BinaryTree\nfrom .balance import AVLTree\nfrom .bst import BinarySearchTree\nfrom .binheap import BinHeap\n\n\n","src/lib/pythonds/trees/balance.py":"#!/bin/env python3.1\n# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005, 2010\n# \n\nfrom .bst import BinarySearchTree, TreeNode\n\nclass AVLTree(BinarySearchTree):\n '''\n Author: Brad Miller\n Date: 1/15/2005\n Description: Imlement a binary search tree with the following interface\n functions: \n __contains__(y) <==> y in x\n __getitem__(y) <==> x[y]\n __init__()\n __len__() <==> len(x)\n __setitem__(k,v) <==> x[k] = v\n clear()\n get(k)\n has_key(k)\n items() \n keys() \n values()\n put(k,v)\n '''\n\n\n def _put(self,key,val,currentNode):\n if key < currentNode.key:\n if currentNode.hasLeftChild():\n self._put(key,val,currentNode.leftChild)\n else:\n currentNode.leftChild = TreeNode(key,val,parent=currentNode)\n self.updateBalance(currentNode.leftChild)\n else:\n if currentNode.hasRightChild():\n self._put(key,val,currentNode.rightChild)\n else:\n currentNode.rightChild = TreeNode(key,val,parent=currentNode)\n self.updateBalance(currentNode.rightChild) \n\n def updateBalance(self,node):\n if node.balanceFactor > 1 or node.balanceFactor < -1:\n self.rebalance(node)\n return\n if node.parent != None:\n if node.isLeftChild():\n node.parent.balanceFactor += 1\n elif node.isRightChild():\n node.parent.balanceFactor -= 1\n\n if node.parent.balanceFactor != 0:\n self.updateBalance(node.parent)\n\n def rebalance(self,node):\n if node.balanceFactor < 0:\n if node.rightChild.balanceFactor > 0:\n # Do an LR Rotation\n self.rotateRight(node.rightChild)\n self.rotateLeft(node)\n else:\n # single left\n self.rotateLeft(node)\n elif node.balanceFactor > 0:\n if node.leftChild.balanceFactor < 0:\n # Do an RL Rotation\n self.rotateLeft(node.leftChild)\n self.rotateRight(node)\n else:\n # single right\n self.rotateRight(node)\n\n def rotateLeft(self,rotRoot):\n newRoot = rotRoot.rightChild\n rotRoot.rightChild = newRoot.leftChild\n if newRoot.leftChild != None:\n newRoot.leftChild.parent = rotRoot\n newRoot.parent = rotRoot.parent\n if rotRoot.isRoot():\n self.root = newRoot\n else:\n if rotRoot.isLeftChild():\n rotRoot.parent.leftChild = newRoot\n else:\n rotRoot.parent.rightChild = newRoot\n newRoot.leftChild = rotRoot\n rotRoot.parent = newRoot\n rotRoot.balanceFactor = rotRoot.balanceFactor + 1 - min(newRoot.balanceFactor, 0)\n newRoot.balanceFactor = newRoot.balanceFactor + 1 + max(rotRoot.balanceFactor, 0)\n\n\n def rotateRight(self,rotRoot):\n newRoot = rotRoot.leftChild\n rotRoot.leftChild = newRoot.rightChild\n if newRoot.rightChild != None:\n newRoot.rightChild.parent = rotRoot\n newRoot.parent = rotRoot.parent\n if rotRoot.isRoot():\n self.root = newRoot\n else:\n if rotRoot.isRightChild():\n rotRoot.parent.rightChild = newRoot\n else:\n rotRoot.parent.leftChild = newRoot\n newRoot.rightChild = rotRoot\n rotRoot.parent = newRoot\n rotRoot.balanceFactor = rotRoot.balanceFactor - 1 - max(newRoot.balanceFactor, 0)\n newRoot.balanceFactor = newRoot.balanceFactor - 1 + min(rotRoot.balanceFactor, 0)\n \n","src/lib/pythonds/trees/binaryTree.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n\nclass BinaryTree:\n \"\"\"\n A recursive implementation of Binary Tree\n Using links and Nodes approach.\n \"\"\" \n def __init__(self,rootObj):\n self.key = rootObj\n self.leftChild = None\n self.rightChild = None\n\n def insertLeft(self,newNode):\n if self.leftChild == None:\n self.leftChild = BinaryTree(newNode)\n else:\n t = BinaryTree(newNode)\n t.left = self.leftChild\n self.leftChild = t\n \n def insertRight(self,newNode):\n if self.rightChild == None:\n self.rightChild = BinaryTree(newNode)\n else:\n t = BinaryTree(newNode)\n t.right = self.rightChild\n self.rightChild = t\n\n def isLeaf(self):\n return ((not self.leftChild) and (not self.rightChild))\n\n def getRightChild(self):\n return self.rightChild\n\n def getLeftChild(self):\n return self.leftChild\n\n def setRootVal(self,obj):\n self.key = obj\n\n def getRootVal(self,):\n return self.key\n\n def inorder(self):\n if self.leftChild:\n self.leftChild.inorder()\n print(self.key)\n if self.rightChild:\n self.rightChild.inorder()\n\n def postorder(self):\n if self.leftChild:\n self.leftChild.postorder()\n if self.rightChild:\n self.rightChild.postorder()\n print(self.key)\n\n\n def preorder(self):\n print(self.key)\n if self.leftChild:\n self.leftChild.preorder()\n if self.rightChild:\n self.rightChild.preorder()\n\n def printexp(self):\n if self.leftChild:\n print('(')\n self.leftChild.printexp()\n print(self.key)\n if self.rightChild:\n self.rightChild.printexp()\n print(')')\n\n def postordereval(self):\n opers = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n res1 = None\n res2 = None\n if self.leftChild:\n res1 = self.leftChild.postordereval() #// \\label{peleft}\n if self.rightChild:\n res2 = self.rightChild.postordereval() #// \\label{peright}\n if res1 and res2:\n return opers[self.key](res1,res2) #// \\label{peeval}\n else:\n return self.key\n\ndef inorder(tree):\n if tree != None:\n inorder(tree.getLeftChild())\n print(tree.getRootVal())\n inorder(tree.getRightChild())\n\ndef printexp(tree):\n if tree.leftChild:\n print('(')\n printexp(tree.getLeftChild())\n print(tree.getRootVal())\n if tree.rightChild:\n printexp(tree.getRightChild())\n print(')') \n\ndef printexp(tree):\n sVal = \"\"\n if tree:\n sVal = '(' + printexp(tree.getLeftChild())\n sVal = sVal + str(tree.getRootVal())\n sVal = sVal + printexp(tree.getRightChild()) + ')'\n return sVal\n\ndef postordereval(tree):\n opers = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n res1 = None\n res2 = None\n if tree:\n res1 = postordereval(tree.getLeftChild()) #// \\label{peleft}\n res2 = postordereval(tree.getRightChild()) #// \\label{peright}\n if res1 and res2:\n return opers[tree.getRootVal()](res1,res2) #// \\label{peeval}\n else:\n return tree.getRootVal()\n\ndef height(tree):\n if tree == None:\n return -1\n else:\n return 1 + max(height(tree.leftChild),height(tree.rightChild))\n\n# t = BinaryTree(7)\n# t.insertLeft(3)\n# t.insertRight(9)\n# inorder(t)\n# import operator\n# x = BinaryTree('*')\n# x.insertLeft('+')\n# l = x.getLeftChild()\n# l.insertLeft(4)\n# l.insertRight(5)\n# x.insertRight(7)\n# print(printexp(x))\n# print(postordereval(x))\n# print(height(x))\n","src/lib/pythonds/trees/binheap.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n\n# this heap takes key value pairs, we will assume that the keys are integers\nclass BinHeap:\n def __init__(self):\n self.heapList = [0]\n self.currentSize = 0\n\n\n def buildHeap(self,alist):\n i = len(alist) // 2\n self.currentSize = len(alist)\n self.heapList = [0] + alist[:]\n print(len(self.heapList), i)\n while (i > 0):\n print(self.heapList, i)\n self.percDown(i)\n i = i - 1\n print(self.heapList,i)\n \n def percDown(self,i):\n while (i * 2) <= self.currentSize:\n mc = self.minChild(i)\n if self.heapList[i] > self.heapList[mc]:\n tmp = self.heapList[i]\n self.heapList[i] = self.heapList[mc]\n self.heapList[mc] = tmp\n i = mc\n \n def minChild(self,i):\n if i * 2 + 1 > self.currentSize:\n return i * 2\n else:\n if self.heapList[i * 2] < self.heapList[i * 2 + 1]:\n return i * 2\n else:\n return i * 2 + 1\n\n def percUp(self,i):\n while i // 2 > 0:\n if self.heapList[i] < self.heapList[i//2]:\n tmp = self.heapList[i // 2]\n self.heapList[i // 2] = self.heapList[i]\n self.heapList[i] = tmp\n i = i // 2\n \n def insert(self,k):\n self.heapList.append(k)\n self.currentSize = self.currentSize + 1\n self.percUp(self.currentSize)\n\n def delMin(self):\n retval = self.heapList[1]\n self.heapList[1] = self.heapList[self.currentSize]\n self.currentSize = self.currentSize - 1\n self.heapList.pop()\n self.percDown(1)\n return retval\n \n def isEmpty(self):\n if currentSize == 0:\n return True\n else:\n return False\n","src/lib/pythonds/trees/bst.py":"#!/bin/env python3.1\n# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005, 2010\n# \n\nclass BinarySearchTree:\n '''\n Author: Brad Miller\n Date: 1/15/2005\n Description: Imlement a binary search tree with the following interface\n functions: \n __contains__(y) <==> y in x\n __getitem__(y) <==> x[y]\n __init__()\n __len__() <==> len(x)\n __setitem__(k,v) <==> x[k] = v\n clear()\n get(k)\n items() \n keys() \n values()\n put(k,v)\n in\n del <==> \n '''\n\n def __init__(self):\n self.root = None\n self.size = 0\n \n def put(self,key,val):\n if self.root:\n self._put(key,val,self.root)\n else:\n self.root = TreeNode(key,val)\n self.size = self.size + 1\n\n def _put(self,key,val,currentNode):\n if key < currentNode.key:\n if currentNode.hasLeftChild():\n self._put(key,val,currentNode.leftChild)\n else:\n currentNode.leftChild = TreeNode(key,val,parent=currentNode)\n else:\n if currentNode.hasRightChild():\n self._put(key,val,currentNode.rightChild)\n else:\n currentNode.rightChild = TreeNode(key,val,parent=currentNode)\n \n def __setitem__(self,k,v):\n self.put(k,v)\n\n def get(self,key):\n if self.root:\n res = self._get(key,self.root)\n if res:\n return res.payload\n else:\n return None\n else:\n return None\n \n def _get(self,key,currentNode):\n if not currentNode:\n return None\n elif currentNode.key == key:\n return currentNode\n elif key < currentNode.key:\n return self._get(key,currentNode.leftChild)\n else:\n return self._get(key,currentNode.rightChild)\n \n \n def __getitem__(self,key):\n res = self.get(key)\n if res:\n return res\n else:\n raise KeyError('Error, key not in tree')\n \n\n def __contains__(self,key):\n if self._get(key,self.root):\n return True\n else:\n return False\n \n def length(self):\n return self.size\n\n def __len__(self):\n return self.size\n\n def __iter__(self):\n return self.root.__iter__()\n \n def delete(self,key):\n if self.size > 1:\n nodeToRemove = self._get(key,self.root)\n if nodeToRemove:\n self.remove(nodeToRemove)\n self.size = self.size-1\n else:\n raise KeyError('Error, key not in tree')\n elif self.size == 1 and self.root.key == key:\n self.root = None\n self.size = self.size - 1\n else:\n raise KeyError('Error, key not in tree')\n\n def __delitem__(self,key):\n self.delete(key)\n \n def remove(self,currentNode):\n if currentNode.isLeaf(): #leaf\n if currentNode == currentNode.parent.leftChild:\n currentNode.parent.leftChild = None\n else:\n currentNode.parent.rightChild = None\n elif currentNode.hasBothChildren(): #interior\n succ = currentNode.findSuccessor()\n succ.spliceOut()\n currentNode.key = succ.key\n currentNode.payload = succ.payload\n else: # this node has one child\n if currentNode.hasLeftChild():\n if currentNode.isLeftChild():\n currentNode.leftChild.parent = currentNode.parent\n currentNode.parent.leftChild = currentNode.leftChild\n elif currentNode.isRightChild():\n currentNode.leftChild.parent = currentNode.parent\n currentNode.parent.rightChild = currentNode.leftChild\n else:\n currentNode.replaceNodeData(currentNode.leftChild.key,\n currentNode.leftChild.payload,\n currentNode.leftChild.leftChild,\n currentNode.leftChild.rightChild)\n else:\n if currentNode.isLeftChild():\n currentNode.rightChild.parent = currentNode.parent\n currentNode.parent.leftChild = currentNode.rightChild\n elif currentNode.isRightChild():\n currentNode.rightChild.parent = currentNode.parent\n currentNode.parent.rightChild = currentNode.rightChild\n else:\n currentNode.replaceNodeData(currentNode.rightChild.key,\n currentNode.rightChild.payload,\n currentNode.rightChild.leftChild,\n currentNode.rightChild.rightChild)\n\n def inorder(self):\n self._inorder(self.root)\n\n def _inorder(self,tree):\n if tree != None:\n self._inorder(tree.leftChild)\n print(tree.key)\n self._inorder(tree.rightChild)\n\n def postorder(self):\n self._postorder(self.root)\n\n def _postorder(self, tree):\n if tree:\n self._postorder(tree.rightChild)\n self._postorder(tree.leftChild)\n print(tree.key) \n\n def preorder(self):\n self._preorder(self,self.root)\n\n def _preorder(self,tree):\n if tree:\n print(tree.key) \n self._preorder(tree.leftChild)\n self._preorder(tree.rightChild)\n\n \nclass TreeNode:\n def __init__(self,key,val,left=None,right=None,parent=None):\n self.key = key\n self.payload = val\n self.leftChild = left\n self.rightChild = right\n self.parent = parent\n self.balanceFactor = 0\n \n def hasLeftChild(self):\n return self.leftChild\n\n def hasRightChild(self):\n return self.rightChild\n \n def isLeftChild(self):\n return self.parent and self.parent.leftChild == self\n\n def isRightChild(self):\n return self.parent and self.parent.rightChild == self\n\n def isRoot(self):\n return not self.parent\n\n def isLeaf(self):\n return not (self.rightChild or self.leftChild)\n\n def hasAnyChildren(self):\n return self.rightChild or self.leftChild\n\n def hasBothChildren(self):\n return self.rightChild and self.leftChild\n \n def replaceNodeData(self,key,value,lc,rc):\n self.key = key\n self.payload = value\n self.leftChild = lc\n self.rightChild = rc\n if self.hasLeftChild():\n self.leftChild.parent = self\n if self.hasRightChild():\n self.rightChild.parent = self\n \n def findSuccessor(self):\n succ = None\n if self.hasRightChild():\n succ = self.rightChild.findMin()\n else:\n if self.parent:\n if self.isLeftChild():\n succ = self.parent\n else:\n self.parent.rightChild = None\n succ = self.parent.findSuccessor()\n self.parent.rightChild = self\n return succ\n\n\n def spliceOut(self):\n if self.isLeaf():\n if self.isLeftChild():\n self.parent.leftChild = None\n else:\n self.parent.rightChild = None\n elif self.hasAnyChildren():\n if self.hasLeftChild():\n if self.isLeftChild():\n self.parent.leftChild = self.leftChild\n else:\n self.parent.rightChild = self.leftChild\n self.leftChild.parent = self.parent\n else:\n if self.isLeftChild():\n self.parent.leftChild = self.rightChild\n else:\n self.parent.rightChild = self.rightChild\n self.rightChild.parent = self.parent\n\n def findMin(self):\n current = self\n while current.hasLeftChild():\n current = current.leftChild\n return current\n\n def __iter__(self):\n \"\"\"The standard inorder traversal of a binary tree.\"\"\"\n if self:\n if self.hasLeftChild():\n for elem in self.leftChild:\n yield elem\n yield self.key\n if self.hasRightChild():\n for elem in self.rightChild:\n yield elem\n\n \n","src/lib/pythonds3/__init__.py":'#!/usr/bin/env python3\n"""\npythonds3 import statement\n"""\n\nfrom pythonds3.basic import Stack, Queue, Deque\nfrom pythonds3.graphs import Graph, Vertex\nfrom pythonds3.searching import HashTable\nfrom pythonds3.trees import (\n BinaryTree,\n AVLTree,\n BinarySearchTree,\n BinaryHeap,\n PriorityQueue,\n)\n\n__all__ = [\n "Stack",\n "Queue",\n "Deque",\n "Graph",\n "Vertex",\n "HashTable",\n "BinaryTree",\n "AVLTree",\n "BinarySearchTree",\n "BinaryHeap",\n "BinaryTree",\n "PriorityQueue",\n]\n',"src/lib/pythonds3/basic/__init__.py":'#!/usr/bin/env python3\n"""\npythonds3.basic import statement\n"""\nfrom pythonds3.basic.stack import Stack\nfrom pythonds3.basic.queue import Queue\nfrom pythonds3.basic.deque import Deque\nfrom pythonds3.basic.linked_list import OrderedList\nfrom pythonds3.basic.linked_list import UnorderedList\n\n__all__ = ["Stack", "Queue", "Deque", "OrderedList", "UnorderedList"]\n',"src/lib/pythonds3/basic/deque.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\n\nclass Deque:\n """Queue implementation as a list"""\n\n def __init__(self):\n """Create new deque"""\n self._items = []\n\n def is_empty(self):\n """Check if the deque is empty"""\n return not bool(self._items)\n\n def add_front(self, item):\n """Add an item to the front of the deque"""\n self._items.append(item)\n\n def add_rear(self, item):\n """Add an item to the rear of the deque"""\n self._items.insert(0, item)\n\n def remove_front(self):\n """Remove an item from the front of the deque"""\n return self._items.pop()\n\n def remove_rear(self):\n """Remove an item from the rear of the deque"""\n return self._items.pop(0)\n\n def size(self):\n """Get the number of items in the deque"""\n return len(self._items)\n',"src/lib/pythonds3/basic/linked_list.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\n\nclass LinkedListNode:\n """A node of a linked list"""\n\n def __init__(self, node_data):\n self._data = node_data\n self._next = None\n\n def get_data(self):\n """Get node data"""\n return self._data\n\n def set_data(self, node_data):\n """Set node data"""\n self._data = node_data\n\n data = property(get_data, set_data)\n\n def get_next(self):\n """Get next node"""\n return self._next\n\n def set_next(self, node_next):\n """Set next node"""\n self._next = node_next\n\n next = property(get_next, set_next)\n\n def __str__(self):\n """String"""\n return str(self._data)\n\n\nclass LinkedList:\n """Linked List class implementation"""\n\n def __init__(self):\n """Create a linked list"""\n self._head = None\n self._count = 0\n\n def is_empty(self):\n """Is the list empty"""\n return self._head is None\n\n def size(self):\n """Size of the list"""\n return self._count\n\n def __len__(self):\n """Size of the list"""\n return self._count\n\n def __str__(self):\n """List as a string"""\n list_str = "["\n current = self._head\n\n while current:\n list_str += str(current)\n if current.next:\n list_str += ", "\n current = current.next\n list_str += "]"\n return list_str\n\n def add(self, value):\n """Add a new node"""\n pass\n\n def remove(self, value):\n """Remove a node with a specific value"""\n pass\n\n def search(self, value):\n """Search for a node with a specific value"""\n pass\n\n\nclass UnorderedList(LinkedList):\n """Unordered linked list implementation"""\n\n def __init__(self):\n """Create an unordered linked list"""\n LinkedList.__init__(self)\n\n def add(self, value):\n """Add a new node"""\n new_node = LinkedListNode(value)\n new_node.set_next(self._head)\n self._head = new_node\n self._count = self._count + 1\n\n def remove(self, value):\n """Remove a node with a specific value"""\n current = self._head\n prev = None\n\n while current:\n if current.data == value:\n if prev is None:\n self._head = current.next\n else:\n prev.next = current.next\n self._count = self._count - 1\n return\n prev = current\n current = current.next\n raise ValueError("{} is not in the list".format(value))\n\n def search(self, value):\n """Search for a node with a specific value"""\n current = self._head\n\n while current:\n if current.data == value:\n return True\n current = current.next\n return False\n\n\nclass OrderedList(LinkedList):\n """Ordered linked list implementation"""\n\n def __init__(self):\n """Create an Ordered linked list"""\n LinkedList.__init__(self)\n\n def add(self, value):\n """Add a new node"""\n current = self._head\n prev = None\n new_node = LinkedListNode(value)\n\n while current and current.data < value:\n prev = current\n current = current.next\n\n if prev is None:\n new_node.next = self._head\n self._head = new_node\n else:\n new_node.next = current\n prev.next = new_node\n self._count = self._count + 1\n\n def remove(self, value):\n """Remove a node with a specific value"""\n # This is an exercise\n pass\n\n def search(self, value):\n """Search for a node with a specific value"""\n # This is an exercise\n pass\n',"src/lib/pythonds3/basic/queue.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\n\nclass Queue:\n """Queue implementation as a list"""\n\n def __init__(self):\n """Create new queue"""\n self._items = []\n\n def is_empty(self):\n """Check if the queue is empty"""\n return not bool(self._items)\n\n def enqueue(self, item):\n """Add an item to the queue"""\n self._items.insert(0, item)\n\n def dequeue(self):\n """Remove an item from the queue"""\n return self._items.pop()\n\n def size(self):\n """Get the number of items in the queue"""\n return len(self._items)\n',"src/lib/pythonds3/basic/stack.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\n\nclass Stack:\n """Stack implementation as a list"""\n\n def __init__(self):\n """Create new stack"""\n self._items = []\n\n def is_empty(self):\n """Check if the stack is empty"""\n return not bool(self._items)\n\n def push(self, item):\n """Add an item to the stack"""\n self._items.append(item)\n\n def pop(self):\n """Remove an item from the stack"""\n return self._items.pop()\n\n def peek(self):\n """Get the value of the top item in the stack"""\n return self._items[-1]\n\n def size(self):\n """Get the number of items in the stack"""\n return len(self._items)\n',"src/lib/pythonds3/graphs/__init__.py":'#!/usr/bin/env python3\n"""\npythonds3.graphs import statement\n"""\nfrom pythonds3.graphs.adjacency_graph import Graph\nfrom pythonds3.graphs.adjacency_graph import Vertex\n\n__all__ = ["Graph"]\n',"src/lib/pythonds3/graphs/adjacency_graph.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\nimport heapq\nimport sys\n\n\nclass Vertex:\n """Graph vertex class"""\n\n def __init__(self, key):\n """Create new vertex"""\n self._key = key\n self._neighbors = {}\n self._color = "white"\n self._distance = sys.maxsize\n self._previous = None\n self._discovery_time = 0\n self._closing_time = 0\n\n def __lt__(self, other):\n """Less than operator required for heapify"""\n return self.key < other.key\n\n def get_key(self):\n """Get vertex key"""\n return self._key\n\n key = property(get_key)\n\n def get_neighbor(self, other):\n """Get the distance (edge weight) to an adjacent node (neighbor)"""\n return self._neighbors.get(other, None)\n\n def set_neighbor(self, other, weight=0):\n """Set the distance (add an edge) to an adjacent node (neighbor)"""\n self._neighbors[other] = weight\n\n def get_neighbors(self):\n """Get all adjacent nodes (neighbors)"""\n return self._neighbors.keys()\n\n def get_color(self):\n """Get vertex color"""\n return self._color\n\n def set_color(self, color):\n """Set vertex color"""\n self._color = color\n\n color = property(get_color, set_color)\n\n def get_distance(self):\n """Get distance"""\n return self._distance\n\n def set_distance(self, distance):\n """Set distance"""\n self._distance = distance\n\n distance = property(get_distance, set_distance)\n\n def get_previous(self):\n """Get previous"""\n return self._previous\n\n def set_previous(self, previous):\n """Set previous"""\n self._previous = previous\n\n previous = property(get_previous, set_previous)\n\n def get_discovery_time(self):\n """Get discovery time"""\n return self._discovery_time\n\n def set_discovery_time(self, discovery_time):\n """Set discovery time"""\n self._discovery_time = discovery_time\n\n discovery_time = property(get_discovery_time, set_discovery_time)\n\n def get_closing_time(self):\n """Get closing time"""\n return self._closing_time\n\n def set_closing_time(self, closing_time):\n """Set closing time"""\n self._closing_time = closing_time\n\n closing_time = property(get_closing_time, set_closing_time)\n\n def __str__(self):\n return "{:^8}|{:^8}|{:^8}|{:^8}|{:^8}| {}".format(\n self._key,\n self._color,\n self._distance,\n self._discovery_time,\n self._closing_time,\n self._previous,\n )\n\n\nclass Graph:\n """Graph as an adjacency matrix"""\n\n def __init__(self):\n self._vertices = {}\n self._edges = {}\n self._time = 0\n\n def __iter__(self):\n """Iterator"""\n return iter(self._vertices.values())\n\n def size(self):\n """Graph\'s size"""\n return len(self._vertices)\n\n def __len__(self):\n """Graph\'s size"""\n return len(self._vertices)\n\n def __contains__(self, key):\n """in operator override"""\n return key in self._vertices\n\n def get_vertex(self, key):\n """Find the vertex in the graph named vert_key"""\n return self._vertices.get(key, None)\n\n def set_vertex(self, key):\n """Add an instance of Vertex to the graph"""\n self._vertices[key] = Vertex(key)\n\n def add_edge(self, from_vertex, to_vertex, weight=0):\n """Add a weighted and directed edge to the graph"""\n if from_vertex not in self._vertices:\n self.set_vertex(from_vertex)\n if to_vertex not in self._vertices:\n self.set_vertex(to_vertex)\n self._vertices[from_vertex].set_neighbor(self._vertices[to_vertex], weight)\n self._edges[(from_vertex, to_vertex)] = weight\n\n def get_vertices(self):\n """Return the list of all vertices in the graph"""\n return self._vertices.keys()\n\n def get_edges(self):\n """Return the list of all edges in the graph"""\n return self._edges.keys()\n\n def reset_distances(self, default_distance=sys.maxsize):\n """Reset distances to test Dijkstra\'s"""\n for vertex in self:\n vertex.distance = default_distance\n\n def bfs(self, start):\n """Breadth First Search"""\n start.distance = 0\n start.previous = None\n vert_queue = [start]\n while vert_queue:\n current_vert = vert_queue.pop(0)\n for neigh in current_vert.get_neighbors():\n if neigh.color == "white":\n neigh.color = "gray"\n neigh.distance = current_vert.distance + 1\n neigh.previous = current_vert\n vert_queue.append(neigh)\n current_vert.color = "black"\n\n def dfs(self):\n """Depth First search"""\n for vertex in self:\n if vertex.color == "white":\n self.dfs_visit(vertex)\n\n def dfs_visit(self, start):\n """DFS helper function"""\n start.color = "gray"\n self._time = self._time + 1\n start.discovery_time = self._time\n for next_vertex in start.get_neighbors():\n if next_vertex.color == "white":\n next_vertex.set_previous(start)\n self.dfs_visit(next_vertex)\n start.color = "black"\n self._time = self._time + 1\n start.closing_time = self._time\n\n def traverse(self, src, dst):\n """Traverse a graph"""\n path = []\n current = self.get_vertex(dst)\n while current:\n path.append(current)\n current = current.previous\n print(\n "Path from {} to {} ({}): {}".format(\n self.get_vertex(src).key,\n self.get_vertex(dst).key,\n self.get_vertex(dst).distance,\n " ".join(vertex.key for vertex in reversed(path)),\n )\n )\n\n def dijkstra(self, start):\n """Dijkstra\'s shortest path algorithm"""\n start.distance = 0\n not_yet_visited = [[start.distance, start]]\n heapq.heapify(not_yet_visited)\n while not_yet_visited:\n current_vertex = heapq.heappop(not_yet_visited)[1]\n for next_vertex in current_vertex.get_neighbors():\n new_distance = current_vertex.distance + current_vertex.get_neighbor(\n next_vertex\n )\n if new_distance < next_vertex.distance:\n next_vertex.distance = new_distance\n next_vertex.previous = current_vertex\n found = False\n for vertex in not_yet_visited:\n if vertex[1].key == next_vertex.key:\n vertex[0] = next_vertex.distance\n heapq.heapify(not_yet_visited)\n found = True\n if not found:\n heapq.heappush(\n not_yet_visited, [next_vertex.distance, next_vertex]\n )\n\n def bellman_ford(self, start):\n """Bellman-Ford shortest path algorithm"""\n start.distance = 0\n for _ in range(len(self._vertices)):\n for edge in self._edges:\n if (\n self.get_vertex(edge[0]).distance + self._edges[edge]\n < self.get_vertex(edge[1]).distance\n ):\n self.get_vertex(edge[1]).distance = (\n self.get_vertex(edge[0]).distance + self._edges[edge]\n )\n self.get_vertex(edge[1]).previous = self.get_vertex(edge[0])\n for edge in self._edges:\n if (\n self.get_vertex(edge[0]).distance + self._edges[edge]\n < self.get_vertex(edge[1]).distance\n ):\n raise ValueError("Graph contains a negative-weight cycle")\n\n def prim(self, start):\n """Prim\'s spanning tree algorithm"""\n start.distance = 0\n not_in_a_tree = [[vertex.distance, vertex] for vertex in self]\n heapq.heapify(not_in_a_tree)\n while not_in_a_tree:\n current_vertex = heapq.heappop(not_in_a_tree)[1]\n for next_vertex in current_vertex.get_neighbors():\n new_distance = current_vertex.get_neighbor(next_vertex)\n if (\n any(item[1] == next_vertex for item in not_in_a_tree)\n and new_distance < next_vertex.distance\n ):\n next_vertex.previous = current_vertex\n next_vertex.distance = new_distance\n for item in not_in_a_tree:\n if item[1] == next_vertex:\n item[0] = new_distance\n heapq.heapify(not_in_a_tree)\n break\n',"src/lib/pythonds3/intro/__init__.py":'#!/usr/bin/env python3\n"""\npythonds3.intro import statement\n"""\nfrom pythonds3.intro.oop import Fraction\n\n__all__ = ["Fraction"]\n',"src/lib/pythonds3/intro/oop.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\n\ndef gcd(number1, number2):\n """Helper function to simplify fractions"""\n if not isinstance(number1, int) or not isinstance(number2, int):\n raise TypeError("Numerator and denominator must be integers")\n while number1 % number2:\n number1, number2 = number2, number1 % number2\n return number2\n\n\nclass Fraction:\n """Fraction class"""\n\n def __init__(self, new_numer, new_denom):\n try:\n common = gcd(new_numer, new_denom)\n except TypeError:\n raise\n self._numer = new_numer // common\n self._denom = new_denom // common\n\n @property\n def numer(self):\n """Get numerator"""\n return self._numer\n\n @numer.setter\n def set_numer(self, new_numer):\n """Set numerator"""\n self._numer = new_numer\n\n def get_denom(self):\n """Get deniminator"""\n return self._denom\n\n def set_denom(self, new_denom):\n """Set deniminator"""\n self._denom = new_denom\n\n # Another way to create an attribute\n denom = property(get_denom, set_denom)\n\n def __str__(self):\n """Get the string value"""\n if self._numer > self._denom:\n return "{} {}/{}".format(\n self._numer // self._denom, self._numer % self._denom, self._denom\n )\n return "{}/{}".format(self._numer, self._denom)\n\n def __repr__(self):\n """Fraction representation"""\n return "Fraction({}, {})".format(self._numer, self._denom)\n\n def __eq__(self, other):\n """Equality comparison"""\n return self._numer * other.denom == other.numer * self._denom\n\n def __add__(self, other):\n """Add two fractions"""\n new_numer = self._numer * other.denom + self._denom * other.numer\n new_denom = self._denom * other.denom\n return Fraction(new_numer, new_denom)\n',"src/lib/pythonds3/searching/__init__.py":'#!/usr/bin/env python3\n"""\npythonds3.search import statement\n"""\nfrom pythonds3.searching.hash_table import HashTable\n\n__all__ = ["HashTable"]\n',"src/lib/pythonds3/searching/hash_table.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\n\nclass HashTable:\n """Hash Table implementation"""\n\n def __init__(self, size=16):\n """Create a hash table"""\n self._size = size\n self._slots = [None] * self._size\n self._data = [None] * self._size\n\n def __getitem__(self, key):\n """Magic __get__"""\n return self.get(key)\n\n def __setitem__(self, key, data):\n """Magic __set__"""\n self.put(key, data)\n\n def __len__(self):\n """Magic __len__"""\n return self._size - self._slots.count(None)\n\n def __contains__(self, key):\n """Magin in"""\n return key in self._slots\n\n def _hash_function(self, key, size):\n """Simple hash function"""\n return key % size\n\n def _rehash(self, old_hash, size, step=1):\n """Simple rehash function"""\n return (old_hash + step) % size\n\n def is_empty(self):\n """Check if the table is empty"""\n return self._size == self._slots.count(None)\n\n def size(self):\n """Get number of items in the table"""\n return self._size - self._slots.count(None)\n\n def put(self, key, data):\n """Add an item to the table"""\n hash_value = self._hash_function(key, len(self._slots))\n\n if self._slots[hash_value] is None:\n self._slots[hash_value] = key\n self._data[hash_value] = data\n else:\n if self._slots[hash_value] == key:\n self._data[hash_value] = data # replace\n else:\n j = 0\n next_slot = self._rehash(hash_value, len(self._slots), j)\n while (\n self._slots[next_slot] is not None\n and self._slots[next_slot] != key\n and j < self._size\n ):\n j = j + 1\n next_slot = self._rehash(hash_value, len(self._slots), j)\n\n if self._slots[next_slot] is None:\n self._slots[next_slot] = key\n self._data[next_slot] = data\n elif j == self._size:\n raise Exception("Hash Table is full")\n else:\n self._data[next_slot] = data # replace\n\n def get(self, key):\n """Get an item from the table"""\n start_slot = self._hash_function(key, len(self._slots))\n position = start_slot\n j = 0\n\n while self._slots[position] is not None and j < self._size:\n if self._slots[position] == key:\n return self._data[position]\n j = j + 1\n position = self._rehash(start_slot, len(self._slots), j)\n\n raise KeyError("{} is not in the table".format(key))\n',"src/lib/pythonds3/sorting/__init__.py":'#!/usr/bin/env python3\n"""\npythonds3.sorting import statement\n"""\nfrom pythonds3.sorting.sorting_algorithms import bubble_sort\nfrom pythonds3.sorting.sorting_algorithms import select_sort\nfrom pythonds3.sorting.sorting_algorithms import insert_sort\nfrom pythonds3.sorting.sorting_algorithms import shell_sort\nfrom pythonds3.sorting.sorting_algorithms import merge_sort\nfrom pythonds3.sorting.sorting_algorithms import quick_sort\nfrom pythonds3.sorting.sorting_algorithms import heap_sort\n',"src/lib/pythonds3/sorting/sorting_algorithms.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\nimport heapq\n\n\ndef bubble_sort(lst):\n """Bubble sort"""\n for i in range(len(lst) - 1, 0, -1):\n exchanges = False\n for j in range(i):\n if lst[j] > lst[j + 1]:\n exchanges = True\n lst[j], lst[j + 1] = lst[j + 1], lst[j]\n if not exchanges:\n break\n\n\ndef select_sort(lst):\n """Selection sort"""\n for i, item in enumerate(lst):\n min_idx = len(lst) - 1\n for j in range(i, len(lst)):\n if lst[j] < lst[min_idx]:\n min_idx = j\n if min_idx != i:\n lst[min_idx], lst[i] = lst[i], lst[min_idx]\n\n\ndef insert_sort(lst):\n """Insertion sort"""\n for i in range(1, len(lst)):\n cur_val = lst[i]\n cur_pos = i\n\n while cur_pos > 0 and lst[cur_pos - 1] > cur_val:\n lst[cur_pos] = lst[cur_pos - 1]\n cur_pos = cur_pos - 1\n lst[cur_pos] = cur_val\n\n\ndef shell_sort(lst):\n """Shell sort"""\n sublist_count = len(lst) // 3\n while sublist_count > 0:\n for pos_start in range(sublist_count):\n _gap_insert_sort(lst, pos_start, sublist_count)\n sublist_count = sublist_count // 2\n\n\ndef _gap_insert_sort(lst, start, gap):\n """Shell sort helper function"""\n for i in range(start + gap, len(lst), gap):\n cur_val = lst[i]\n cur_pos = i\n while cur_pos >= gap and lst[cur_pos - gap] > cur_val:\n lst[cur_pos] = lst[cur_pos - gap]\n cur_pos = cur_pos - gap\n lst[cur_pos] = cur_val\n\n\ndef merge_sort(lst):\n """Merge sort"""\n if len(lst) > 1:\n mid = len(lst) // 2\n left_half = lst[:mid]\n right_half = lst[mid:]\n\n merge_sort(left_half)\n merge_sort(right_half)\n\n i, j, k = 0, 0, 0\n while i < len(left_half) and j < len(right_half):\n if left_half[i] <= right_half[j]:\n lst[k] = left_half[i]\n i = i + 1\n else:\n lst[k] = right_half[j]\n j = j + 1\n k = k + 1\n\n while i < len(left_half):\n lst[k] = left_half[i]\n i = i + 1\n k = k + 1\n\n while j < len(right_half):\n lst[k] = right_half[j]\n j = j + 1\n k = k + 1\n\n\ndef quick_sort(lst):\n """Quick sort"""\n _quick_sort_help(lst, 0, len(lst) - 1)\n\n\ndef _quick_sort_help(lst, mark_l, mark_r):\n """Quick sort helper"""\n if mark_l < mark_r:\n split = _quick_sort_part(lst, mark_l, mark_r)\n _quick_sort_help(lst, mark_l, split - 1)\n _quick_sort_help(lst, split + 1, mark_r)\n\n\ndef _quick_sort_part(lst, mark_l, mark_r):\n """Quick sort partition"""\n pivot_val = lst[mark_l]\n mark_l_cur = mark_l + 1\n mark_r_cur = mark_r\n done = False\n\n while not done:\n while mark_l_cur <= mark_r_cur and lst[mark_l_cur] <= pivot_val:\n mark_l_cur = mark_l_cur + 1\n while mark_l_cur <= mark_r_cur and lst[mark_r_cur] >= pivot_val:\n mark_r_cur = mark_r_cur - 1\n if mark_r_cur < mark_l_cur:\n done = True\n else:\n lst[mark_l_cur], lst[mark_r_cur] = lst[mark_r_cur], lst[mark_l_cur]\n lst[mark_l], lst[mark_r_cur] = lst[mark_r_cur], lst[mark_l]\n\n return mark_r_cur\n\n\ndef heap_sort(lst):\n """Heap sort"""\n res = []\n heapq.heapify(lst)\n while lst:\n res.append(heapq.heappop(lst))\n for i in res:\n lst.append(i)\n',"src/lib/pythonds3/trees/__init__.py":'#!/usr/bin/env python3\n"""\npythonds3.trees import statement\n"""\nfrom pythonds3.trees.avl_tree import AVLTree\nfrom pythonds3.trees.binary_search_tree import BinarySearchTree\nfrom pythonds3.trees.binary_heap import BinaryHeap\nfrom pythonds3.trees.binary_tree import BinaryTree\nfrom pythonds3.trees.priority_queue import PriorityQueue\n\n__all__ = ["BinaryTree", "BinaryHeap", "BinarySearchTree", "AVLTree", "PriorityQueue"]\n',"src/lib/pythonds3/trees/avl_tree.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005, 2010\nUpdated by Roman Yasinovskyy, 2017\n"""\n\nfrom pythonds3.trees.binary_search_tree import BinarySearchTree\nfrom pythonds3.trees.binary_search_tree import BinaryTreeNode\n\n\nclass AVLTreeNode(BinaryTreeNode):\n """AVL Tree Node"""\n\n def __init__(self, key, val, balance_factor, left=None, right=None, parent=None):\n """Create an AVL tree node"""\n BinaryTreeNode.__init__(self, key, val, left, right, parent)\n self._balance_factor = balance_factor\n\n def get_balance_factor(self):\n """Get the node balance factor"""\n return self._balance_factor\n\n def set_balance_factor(self, value):\n """Set the node balance factor"""\n self._balance_factor = value\n\n balance_factor = property(get_balance_factor, set_balance_factor)\n\n\nclass AVLTree(BinarySearchTree):\n """AVL tree implementation"""\n\n def __init__(self):\n """Create a new AVL tree"""\n BinarySearchTree.__init__(self)\n\n def put(self, key, value):\n """Add new node"""\n if self._root:\n self._put(key, value, self._root)\n else:\n self._root = AVLTreeNode(key, value, 0)\n self._size = self._size + 1\n\n def _put(self, key, value, current_node):\n """Add a new node to the tree (helper function)"""\n if key < current_node.key:\n if current_node.get_child_left():\n self._put(key, value, current_node.child_left)\n else:\n current_node.child_left = AVLTreeNode(\n key, value, 0, parent=current_node\n )\n self.update_balance(current_node.child_left)\n else:\n if current_node.get_child_right():\n self._put(key, value, current_node.child_right)\n else:\n current_node.child_right = AVLTreeNode(\n key, value, 0, parent=current_node\n )\n self.update_balance(current_node.child_right)\n\n def update_balance(self, node):\n """Update the tree balance"""\n if node.balance_factor > 1 or node.balance_factor < -1:\n self.rebalance(node)\n return\n if node.parent:\n if node.is_child_left():\n node.parent.balance_factor += 1\n elif node.is_child_right():\n node.parent.balance_factor -= 1\n\n if node.parent.balance_factor != 0:\n self.update_balance(node.parent)\n\n def rebalance(self, node):\n """Rebalance the tree"""\n if node.balance_factor < 0:\n if node.child_right.balance_factor > 0:\n # Do an LR Rotation\n self.rotate_right(node.child_right)\n self.rotate_left(node)\n else:\n # single left\n self.rotate_left(node)\n elif node.balance_factor > 0:\n if node.child_left.balance_factor < 0:\n # Do an RL Rotation\n self.rotate_left(node.child_left)\n self.rotate_right(node)\n else:\n # single right\n self.rotate_right(node)\n\n def rotate_left(self, rotation_root):\n """Left rotation"""\n new_root = rotation_root.child_right\n rotation_root.child_right = new_root.child_left\n if new_root.child_left:\n new_root.child_left.parent = rotation_root\n new_root.parent = rotation_root.parent\n if rotation_root.is_root():\n self._root = new_root\n else:\n if rotation_root.is_child_left():\n rotation_root.parent.child_left = new_root\n else:\n rotation_root.parent.child_right = new_root\n new_root.child_left = rotation_root\n rotation_root.parent = new_root\n rotation_root.balance_factor = (\n rotation_root.balance_factor + 1 - min(new_root.balance_factor, 0)\n )\n new_root.balance_factor = (\n new_root.balance_factor + 1 + max(rotation_root.balance_factor, 0)\n )\n\n def rotate_right(self, rotation_root):\n """Right rotation"""\n new_root = rotation_root.child_left\n rotation_root.child_left = new_root.child_right\n if new_root.child_right:\n new_root.child_right.parent = rotation_root\n new_root.parent = rotation_root.parent\n if rotation_root.is_root():\n self._root = new_root\n else:\n if rotation_root.is_child_right():\n rotation_root.parent.child_right = new_root\n else:\n rotation_root.parent.child_left = new_root\n new_root.child_right = rotation_root\n rotation_root.parent = new_root\n rotation_root.balance_factor = (\n rotation_root.balance_factor - 1 - max(new_root.balance_factor, 0)\n )\n new_root.balance_factor = (\n new_root.balance_factor - 1 + min(rotation_root.balance_factor, 0)\n )\n',"src/lib/pythonds3/trees/binary_heap.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\n\nclass BinaryHeap:\n """Minimal Binary Heap"""\n\n def __init__(self):\n """Create a heap"""\n self._heap = []\n\n def _perc_up(self, cur_idx):\n """Move a node up"""\n while (cur_idx - 1) // 2 >= 0:\n parent_idx = (cur_idx - 1) // 2\n if self._heap[cur_idx] < self._heap[parent_idx]:\n self._heap[cur_idx], self._heap[parent_idx] = (\n self._heap[parent_idx],\n self._heap[cur_idx],\n )\n cur_idx = parent_idx\n\n def _perc_down(self, cur_idx):\n """Move a node down"""\n while 2 * cur_idx + 1 < len(self._heap):\n min_child_idx = self._get_min_child(cur_idx)\n if self._heap[cur_idx] > self._heap[min_child_idx]:\n self._heap[cur_idx], self._heap[min_child_idx] = (\n self._heap[min_child_idx],\n self._heap[cur_idx],\n )\n else:\n return\n cur_idx = min_child_idx\n\n def _get_min_child(self, parent_idx):\n """Get a smaller child"""\n if 2 * parent_idx + 2 > len(self._heap) - 1:\n return 2 * parent_idx + 1\n if self._heap[2 * parent_idx + 1] < self._heap[2 * parent_idx + 2]:\n return 2 * parent_idx + 1\n return 2 * parent_idx + 2\n\n def heapify(self, not_a_heap, show_details=False):\n """Build a heap from any list"""\n self._heap = not_a_heap[:]\n cur_idx = len(self._heap) // 2 - 1\n while cur_idx >= 0:\n self._perc_down(cur_idx)\n cur_idx = cur_idx - 1\n if show_details:\n print(self._heap)\n\n def insert(self, item):\n """Add a new item"""\n self._heap.append(item)\n self._perc_up(len(self._heap) - 1)\n\n def delete(self):\n """Remove an item"""\n self._heap[0], self._heap[-1] = self._heap[-1], self._heap[0]\n result = self._heap.pop()\n self._perc_down(0)\n return result\n\n def is_empty(self):\n """Check if the heap is empty"""\n return not bool(self._heap)\n\n def __len__(self):\n """Get heap size"""\n return len(self._heap)\n\n def __str__(self):\n """Heap as a string"""\n return str(self._heap)\n\n def __contains__(self, item):\n """__contains__in method override"""\n return item in self._heap\n',"src/lib/pythonds3/trees/binary_search_tree.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005, 2010\nUpdated by Roman Yasinovskyy, 2017\n"""\n\n\nclass BinaryTreeNode:\n """Binary Tree Node class"""\n\n def __init__(self, key, value, left=None, right=None, parent=None):\n """Create new Tree Node"""\n self._key = key\n self._value = value\n self._child_left = left\n self._child_right = right\n self._parent = parent\n\n def get_child_left(self):\n """Return the node\'s left child"""\n return self._child_left\n\n def set_child_left(self, node):\n """Assign the node\'s left child"""\n self._child_left = node\n\n child_left = property(get_child_left, set_child_left)\n\n def get_child_right(self):\n """Return the node\'s right child"""\n return self._child_right\n\n def set_child_right(self, node):\n """Assign the node\'s right child"""\n self._child_right = node\n\n child_right = property(get_child_right, set_child_right)\n\n def get_parent(self):\n """Return the node\'s parent"""\n return self._parent\n\n def set_parent(self, node):\n """Assign the node\'s parent"""\n self._parent = node\n\n parent = property(get_parent, set_parent)\n\n def is_child_left(self):\n """Check if the node is a left child"""\n return self._parent and self._parent.child_left == self\n\n def is_child_right(self):\n """Check if the node is a right child"""\n return self._parent and self._parent.child_right == self\n\n def is_root(self):\n """Check if the node is a tree root"""\n return not self._parent\n\n def is_leaf(self):\n """Check if the node is a leaf"""\n return not (self._child_right or self._child_left)\n\n def has_a_child(self):\n """Check if the node has any child"""\n return self._child_right or self._child_left\n\n def has_children(self):\n """Check if the node has both children"""\n return self._child_right and self._child_left\n\n def get_key(self):\n """Get node key"""\n return self._key\n\n def set_key(self, key):\n """Set node key"""\n self._key = key\n\n key = property(get_key, set_key)\n\n def get_value(self):\n """Get node value"""\n return self._value\n\n def set_value(self, value):\n """Set node value"""\n self._value = value\n\n value = property(get_value, set_value)\n\n def replace_payload(self, key, value, left, right):\n """Change node payload"""\n self._key = key\n self._value = value\n self._child_left = left\n self._child_right = right\n if self.child_left:\n self._child_left.parent = self\n if self.child_right:\n self._child_right.parent = self\n\n def find_successor(self):\n """Find the node\'s successor"""\n successor = None\n if self._child_right:\n successor = self._child_right.find_min()\n else:\n if self._parent:\n if self.is_child_left():\n successor = self._parent\n else:\n self._parent.child_right = None\n successor = self._parent.find_successor()\n self._parent.child_right = self\n return successor\n\n def find_min(self):\n """Find the smallest node in the right subtree"""\n current = self\n while current.child_left:\n current = current.child_left\n return current\n\n def splice_out(self):\n """Splice out"""\n if self.is_leaf():\n if self.is_child_left():\n self._parent.child_left = None\n else:\n self._parent.child_right = None\n elif self.has_a_child():\n if self.child_left:\n if self.is_child_left():\n self._parent.child_left = self._child_left\n else:\n self._parent.child_right = self._child_left\n self._child_left.parent = self._parent\n else:\n if self.is_child_left():\n self._parent.child_left = self._child_right\n else:\n self._parent.child_right = self._child_right\n self._child_right.parent = self._parent\n\n def __iter__(self):\n """The standard inorder traversal of a binary tree"""\n if self:\n if self._child_left:\n for elem in self._child_left:\n yield elem\n yield self._key\n if self._child_right:\n for elem in self._child_right:\n yield elem\n\n\nclass BinarySearchTree:\n """Binary search tree implementation"""\n\n def __init__(self):\n self._root = None\n self._size = 0\n\n def __len__(self):\n """Tree size"""\n return self._size\n\n def size(self):\n """Tree size"""\n return self._size\n\n def __iter__(self):\n """Iterator"""\n return self._root.__iter__()\n\n def __getitem__(self, key):\n """[] getter operator override"""\n result = self.get(key)\n if result:\n return result\n raise KeyError("Error, key not in tree")\n\n def get_root(self):\n """Get tree root"""\n return self._root\n\n def set_root(self, node):\n """Set tree root"""\n self._root = node\n\n root = property(get_root, set_root)\n\n def get(self, key):\n """Retrieve a value by the key"""\n if self._root:\n result = self._get(key, self._root)\n if result:\n return result.value\n return None\n else:\n return None\n\n def _get(self, key, current_node):\n """Retrieve a value by the key (helper function)"""\n if not current_node:\n return None\n if current_node.key == key:\n return current_node\n elif key < current_node.key:\n return self._get(key, current_node.child_left)\n else:\n return self._get(key, current_node.child_right)\n\n def __setitem__(self, key, value):\n """[] setter operator override"""\n self.put(key, value)\n\n def put(self, key, value):\n """Add new node"""\n if self._root:\n self._put(key, value, self._root)\n else:\n self._root = BinaryTreeNode(key, value)\n self._size = self._size + 1\n\n def _put(self, key, value, current_node):\n """Add new node (helper function)"""\n if key < current_node.key:\n if current_node.child_left:\n self._put(key, value, current_node.child_left)\n else:\n current_node.child_left = BinaryTreeNode(\n key, value, parent=current_node\n )\n else:\n if current_node.child_right:\n self._put(key, value, current_node.child_right)\n else:\n current_node.child_right = BinaryTreeNode(\n key, value, parent=current_node\n )\n\n def __contains__(self, key):\n """in operator override"""\n return bool(self._get(key, self._root))\n\n def __delitem__(self, key):\n """del operator override"""\n self.delete(key)\n\n def delete(self, key):\n """Remove a node by its key"""\n if self._size > 1:\n node_to_remove = self._get(key, self._root)\n if node_to_remove:\n self._delete(node_to_remove)\n self._size = self._size - 1\n else:\n raise KeyError("Error, key not in tree")\n elif self._size == 1 and self._root.key == key:\n self._root = None\n self._size = self._size - 1\n else:\n raise KeyError("Error, key not in tree")\n\n def _delete(self, current_node):\n """Remove a node by its key (helper function)"""\n if current_node.is_leaf(): # removing a leaf\n if current_node == current_node.parent.child_left:\n current_node.parent.child_left = None\n else:\n current_node.parent.child_right = None\n elif current_node.has_children(): # removing a node with two children\n successor = current_node.find_successor()\n successor.splice_out()\n current_node.key = successor.key\n current_node.value = successor.value\n else: # removing a node with one child\n if current_node.get_child_left():\n if current_node.is_child_left():\n current_node.child_left.parent = current_node.parent\n current_node.parent.child_left = current_node.child_left\n elif current_node.is_child_right():\n current_node.child_left.parent = current_node.parent\n current_node.parent.child_right = current_node.child_left\n else:\n current_node.replace_payload(\n current_node.child_left.key,\n current_node.child_left.value,\n current_node.child_left.child_left,\n current_node.child_left.child_right,\n )\n else:\n if current_node.is_child_left():\n current_node.child_right.parent = current_node.parent\n current_node.parent.child_left = current_node.child_right\n elif current_node.is_child_right():\n current_node.child_right.parent = current_node.parent\n current_node.parent.child_right = current_node.child_right\n else:\n current_node.replace_payload(\n current_node.child_right.key,\n current_node.child_right.value,\n current_node.child_right.child_left,\n current_node.child_right.child_right,\n )\n\n def inorder(self):\n """In-order tree traversal"""\n self._inorder(self._root)\n\n def _inorder(self, tree):\n """In-order tree traversal (helper function)"""\n if tree:\n self._inorder(tree.child_left)\n print(tree.key, end=" ")\n self._inorder(tree.child_right)\n\n def postorder(self):\n """Post-order tree traversal"""\n self._postorder(self._root)\n\n def _postorder(self, tree):\n """Post-order tree traversal (helper function)"""\n if tree:\n self._postorder(tree.child_left)\n self._postorder(tree.child_right)\n print(tree.key, end=" ")\n\n def preorder(self):\n """Pre-order tree traversal"""\n self._preorder(self._root)\n\n def _preorder(self, tree):\n """Pre-order tree traversal (helper function)"""\n if tree:\n print(tree.key, end=" ")\n self._preorder(tree.child_left)\n self._preorder(tree.child_right)\n\n def clear(self):\n """Remove all nodes"""\n while self._root:\n self.delete(self._root.key)\n',"src/lib/pythonds3/trees/binary_tree.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\nimport operator\n\n\nclass BinaryTree:\n """\n A recursive implementation of Binary Tree\n Using links and Nodes approach.\n\n Modified to allow for trees to be constructed from other trees\n rather than always creating a new tree in the insert_feft or insert_right\n """\n\n def __init__(self, key):\n """Create new tree"""\n self._key = key\n self._child_left = None\n self._child_right = None\n\n def get_root_val(self):\n """Get root key value"""\n return self._key\n\n def set_root_val(self, key):\n """Set root key value"""\n self._key = key\n\n root = property(get_root_val, set_root_val)\n\n def get_child_left(self):\n """Get left child"""\n return self._child_left\n\n def set_child_left(self, node):\n """Set left child"""\n self._child_left = node\n\n child_left = property(get_child_left, set_child_left)\n\n def get_child_right(self):\n """Get right child"""\n return self._child_right\n\n def set_child_right(self, node):\n """Set right child"""\n self._child_right = node\n\n child_right = property(get_child_right, set_child_right)\n\n def is_leaf(self):\n """Check if a node is leaf"""\n return (not self._child_left) and (not self._child_right)\n\n def insert_left(self, new_node):\n """Insert left subtree"""\n if isinstance(new_node, BinaryTree):\n new_subtree = new_node\n else:\n new_subtree = BinaryTree(new_node)\n\n if self._child_left:\n new_subtree.set_child_left(self._child_left)\n\n self._child_left = new_subtree\n\n def insert_right(self, new_node):\n """Insert right subtree"""\n if isinstance(new_node, BinaryTree):\n new_subtree = new_node\n else:\n new_subtree = BinaryTree(new_node)\n\n if self._child_right:\n new_subtree.set_child_right(self._child_right)\n self._child_right = new_subtree\n\n def preorder(self):\n """Pre-order tree traversal"""\n print(self._key, end=" ")\n if self._child_left:\n self._child_left.preorder()\n if self._child_right:\n self._child_right.preorder()\n\n def inorder(self):\n """In-order tree traversal"""\n if self._child_left:\n self._child_left.inorder()\n print(self._key, end=" ")\n if self._child_right:\n self._child_right.inorder()\n\n def postorder(self):\n """Post-order tree traversal"""\n if self._child_left:\n self._child_left.postorder()\n if self._child_right:\n self._child_right.postorder()\n print(self._key, end=" ")\n\n def print_exp(self):\n """Print an expression"""\n if self._child_left:\n print("(", end=" ")\n self._child_left.print_exp()\n print(self._key, end=" ")\n if self._child_right:\n self._child_right.print_exp()\n print(")", end=" ")\n\n def postorder_eval(self):\n """Postorder evaluation"""\n operations = {\n "+": operator.add,\n "-": operator.sub,\n "*": operator.mul,\n "/": operator.truediv,\n }\n result_1 = None\n result_2 = None\n if self._child_left:\n result_1 = self._child_left.postorder_eval()\n if self._child_right:\n result_2 = self._child_right.postorder_eval()\n if result_1 and result_2:\n return operations[self._key](result_1, result_2)\n return self._key\n\n def height(self):\n """Height of a tree"""\n if not self._key:\n return -1\n if self._child_left:\n height_left = self._child_left.height()\n else:\n height_left = -1\n\n if self._child_right:\n height_right = self._child_right.height()\n else:\n height_right = -1\n\n return 1 + max(height_left, height_right)\n\n def __len__(self):\n """Size of a tree"""\n return self.size()\n\n def size(self):\n """Count nodes in a tree"""\n if not self._key:\n return 0\n if self._child_left:\n children_left = self._child_left.size()\n else:\n children_left = 0\n\n if self._child_right:\n children_right = self._child_right.size()\n else:\n children_right = 0\n\n return 1 + children_left + children_right\n',"src/lib/pythonds3/trees/priority_queue.py":'#!/usr/bin/env python3\n"""\nBradley N. Miller, David L. Ranum\nProblem Solving with Algorithms and Data Structures using Python\nCopyright 2005\nUpdated by Roman Yasinovskyy, 2017\n"""\n\nfrom pythonds3.trees.binary_heap import BinaryHeap\n\n\nclass PriorityQueue(BinaryHeap):\n """\n This implementation of binary heap takes (key, value) pairs where key signifies priority\n We will assume that the keys are all comparable.\n """\n\n def change_priority(self, new_priority, value):\n """Change the priority"""\n key_to_move = 0\n for i in range(len(self._heap)):\n if self._heap[i][1] == value:\n key_to_move = i\n break\n if key_to_move > -1:\n self._heap[key_to_move] = (new_priority, self._heap[key_to_move][1])\n self._perc_up(key_to_move)\n',"src/lib/pythoned/__init__.py":"","src/lib/pythoned/arboles/__init__.py":"\n\n\nfrom .avl import ArbolAVL\nfrom .abb import ArbolBinarioBusqueda\nfrom .monticuloBinario import MonticuloBinario\n\n\n","src/lib/pythoned/arboles/abb.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n#\n#abb.py\n\nclass ArbolBinarioBusqueda:\n\n def __init__(self):\n self.raiz = None\n self.tamano = 0\n\n def agregar(self,clave,valor):\n if self.raiz:\n self._agregar(clave,valor,self.raiz)\n else:\n self.raiz = NodoArbol(clave,valor)\n self.tamano = self.tamano + 1\n\n def _agregar(self,clave,valor,nodoActual):\n if clave < nodoActual.clave:\n if nodoActual.tieneHijoIzquierdo():\n self._agregar(clave,valor,nodoActual.hijoIzquierdo)\n else:\n nodoActual.hijoIzquierdo = NodoArbol(clave,valor,padre=nodoActual)\n else:\n if nodoActual.tieneHijoDerecho():\n self._agregar(clave,valor,nodoActual.hijoDerecho)\n else:\n nodoActual.hijoDerecho = NodoArbol(clave,valor,padre=nodoActual)\n \n def __setitem__(self,c,v):\n self.agregar(c,v)\n\n def obtener(self,clave):\n if self.raiz:\n res = self._obtener(clave,self.raiz)\n if res:\n return res.cargaUtil\n else:\n return None\n else:\n return None\n\n def _obtener(self,clave,nodoActual):\n \tif not nodoActual:\n \t return None\n \telif nodoActual.clave == clave:\n \t return nodoActual\n \telif clave < nodoActual.clave:\n \t return self._obtener(clave,nodoActual.hijoIzquierdo)\n \telse:\n \t return self._obtener(clave,nodoActual.hijoDerecho) \n\n def __getitem__(self,clave):\n res = self.obtener(clave) \n if res:\n return res\n else:\n raise KeyError('Error, la clave no está en el árbol')\n\n def __contains__(self,clave):\n \tif self._obtener(clave,self.raiz):\n \t return True\n \telse:\n \t return False\n \n def longitud(self):\n return self.tamano\n\n def __len__(self):\n return self.tamano\n\n def __iter__(self):\n return self.raiz.__iter__()\n\n def eliminar(self,clave):\n if self.tamano > 1:\n nodoAEliminar = self._obtener(clave,self.raiz)\n \t if nodoAEliminar:\n \t self.remover(nodoAEliminar)\n \t self.tamano = self.tamano-1\n \t else:\n \t raise KeyError('Error, la clave no está en el árbol')\n elif self.tamano == 1 and self.raiz.clave == clave:\n \t self.raiz = None\n \t self.tamano = self.tamano - 1\n else:\n \t raise KeyError('Error, la clave no está en el árbol')\n\n def __delitem__(self,clave):\n self.eliminar(clave)\n\n def remover(self,nodoActual):\n if nodoActual.esHoja(): #hoja\n if nodoActual == nodoActual.padre.hijoIzquierdo:\n nodoActual.padre.hijoIzquierdo = None\n else:\n nodoActual.padre.hijoDerecho = None\n elif nodoActual.tieneAmbosHijos(): #interior\n suc = nodoActual.encontrarSucesor()\n suc.empalmar()\n nodoActual.clave = suc.clave\n nodoActual.cargaUtil = suc.cargaUtil\n\n else: # este nodo tiene un (1) hijo\n if nodoActual.tieneHijoIzquierdo():\n if nodoActual.esHijoIzquierdo():\n nodoActual.hijoIzquierdo.padre = nodoActual.padre\n nodoActual.padre.hijoIzquierdo = nodoActual.hijoIzquierdo\n elif nodoActual.esHijoDerecho():\n nodoActual.hijoIzquierdo.padre = nodoActual.padre\n nodoActual.padre.hijoDerecho = nodoActual.hijoIzquierdo\n else:\n nodoActual.reemplazarDatoDeNodo(nodoActual.hijoIzquierdo.clave, nodoActual.hijoIzquierdo.cargaUtil, nodoActual.hijoIzquierdo.hijoIzquierdo, nodoActual.hijoIzquierdo.hijoDerecho)\n else:\n if nodoActual.esHijoIzquierdo():\n nodoActual.hijoDerecho.padre = nodoActual.padre\n nodoActual.padre.hijoIzquierdo = nodoActual.hijoDerecho\n elif nodoActual.esHijoDerecho():\n nodoActual.hijoDerecho.padre = nodoActual.padre\n nodoActual.padre.hijoDerecho = nodoActual.hijoDerecho\n else:\n nodoActual.reemplazarDatoDeNodo(nodoActual.hijoDerecho.clave, nodoActual.hijoDerecho.cargaUtil, nodoActual.hijoDerecho.hijoIzquierdo, nodoActual.hijoDerecho.hijoDerecho)\n\n def inorden(self):\n self._inorden(self.raiz)\n\n def _inorden(self,arbol):\n if arbol != None:\n self._inorden(arbol.hijoIzquierdo)\n print(arbol.clave)\n self._inorden(arbol.hijoDerecho)\n\n def postorden(self):\n self._postorden(self.raiz)\n\n def _postorden(self, arbol):\n if arbol:\n self._postorden(arbol.hijoDerecho)\n self._postorden(arbol.hijoIzquierdo)\n print(arbol.clave) \n\n def preorden(self):\n self._preorden(self,self.raiz)\n\n def _preorden(self,arbol):\n if arbol:\n print(arbol.clave) \n self._preorden(arbol.hijoIzquierdo)\n self._preorden(arbol.hijoDerecho)\n\n\nclass NodoArbol:\n def __init__(self,clave,valor,izquierdo=None,derecho=None,padre=None):\n self.clave = clave\n self.cargaUtil = valor\n self.hijoIzquierdo = izquierdo\n self.hijoDerecho = derecho\n self.padre = padre\n self.factorEquilibrio = 0\n\n def tieneHijoIzquierdo(self):\n return self.hijoIzquierdo\n \n def tieneHijoDerecho(self):\n return self.hijoDerecho\n\n def esHijoIzquierdo(self):\n return self.padre and self.padre.hijoIzquierdo == self\n \n def esHijoDerecho(self):\n return self.padre and self.padre.hijoDerecho == self\n\n def esRaiz(self):\n return not self.padre\n\n def esHoja(self):\n return not (self.hijoDerecho or self.hijoIzquierdo)\n\n def tieneAlgunHijo(self):\n return self.hijoDerecho or self.hijoIzquierdo\n\n def tieneAmbosHijos(self):\n return self.hijoDerecho and self.hijoIzquierdo\n\n def reemplazarDatoDeNodo(self,clave,valor,hizq,hder):\n self.clave = clave\n self.cargaUtil = valor\n self.hijoIzquierdo = hizq\n self.hijoDerecho = hder\n if self.tieneHijoIzquierdo():\n self.hijoIzquierdo.padre = self\n if self.tieneHijoDerecho():\n self.hijoDerecho.padre = self \n\n def encontrarSucesor(self):\n suc = None\n if self.tieneHijoDerecho():\n suc = self.hijoDerecho.encontrarMin()\n else:\n if self.padre:\n if self.esHijoIzquierdo():\n suc = self.padre\n else:\n self.padre.hijoDerecho = None\n suc = self.padre.encontrarSucesor()\n self.padre.hijoDerecho = self\n return suc\n\n def empalmar(self):\n if self.esHoja():\n if self.esHijoIzquierdo():\n self.padre.hijoIzquierdo = None\n else:\n self.padre.hijoDerecho = None\n elif self.tieneAlgunHijo():\n if self.tieneHijoIzquierdo():\n if self.esHijoIzquierdo():\n self.padre.hijoIzquierdo = self.hijoIzquierdo\n else:\n self.padre.hijoDerecho = self.hijoIzquierdo\n self.hijoIzquierdo.padre = self.padre\n else:\n if self.esHijoIzquierdo():\n self.padre.hijoIzquierdo = self.hijoDerecho\n else:\n self.padre.hijoDerecho = self.hijoDerecho\n self.hijoDerecho.padre = self.padre\n\n def encontrarMin(self):\n actual = self\n while actual.tieneHijoIzquierdo():\n actual = actual.hijoIzquierdo\n return actual\n\n def __iter__(self):\n if self:\n \t if self.tieneHijoIzquierdo():\n \t for elem in self.hijoIzquierdo:\n \t\t yield elem\n yield self.clave\n \t if self.tieneHijoDerecho():\n for elem in self.hijoDerecho:\n \t\t yield elem\n","src/lib/pythoned/arboles/arbolBinario.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n# \n#arbolBinario.py\n\nclass ArbolBinario:\n def __init__(self,objetoRaiz):\n self.clave = objetoRaiz\n self.hijoIzquierdo = None\n self.hijoDerecho = None\n \n def insertarIzquierdo(self,nuevoNodo):\n if self.hijoIzquierdo == None:\n self.hijoIzquierdo = ArbolBinario(nuevoNodo)\n else: \n t = ArbolBinario(nuevoNodo)\n t.hijoIzquierdo = self.hijoIzquierdo\n self.hijoIzquierdo = t\n\n def insertarDerecho(self,nuevoNodo):\n if self.hijoDerecho == None:\n self.hijoDerecho = ArbolBinario(nuevoNodo)\n else:\n t = ArbolBinario(nuevoNodo)\n t.hijoDerecho = self.hijoDerecho\n self.hijoDerecho = t\n\n def esHoja(self):\n return ((not self.hijoIzquierdo) and (not self.hijoDerecho))\n\n def obtenerHijoDerecho(self):\n return self.hijoDerecho\n \n def obtenerHijoIzquierdo(self):\n return self.hijoIzquierdo\n \n def asignarValorRaiz(self,obj):\n self.clave = obj\n\n def obtenerValorRaiz(self):\n return self.clave\n\n def inorden(self):\n if self.hijoIzquierdo:\n self.hijoIzquierdo.inorden()\n print(self.clave)\n if self.hijoDerecho:\n self.hijoDerecho.inorden()\n\n def postorden(self):\n if self.hijoIzquierdo:\n self.hijoIzquierdo.postorden()\n if self.hijoDerecho:\n self.hijoDerecho.postorden()\n print(self.clave)\n\n def preorden(self):\n print(self.clave)\n if self.hijoIzquierdo:\n self.hijoIzquierdo.preorden()\n if self.hijoDerecho:\n self.hijoDerecho.preorden()\n\n def imprimirExpresion(self):\n if self.hijoIzquierdo:\n print('(', end=' ')\n self.hijoIzquierdo.imprimirExpresion()\n print(self.clave, end=' ')\n if self.hijoDerecho:\n self.hijoDerecho.imprimirExpresion()\n print(')', end=' ')\n\n def evalPostorden(self):\n opers = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n res1 = None\n res2 = None\n if self.hijoIzquierdo:\n res1 = self.hijoIzquierdo.evalPostorden() #// \\label{peleft}\n if self.hijoDerecho:\n res2 = self.hijoDerecho.evalPostorden() #// \\label{peright}\n if res1 and res2:\n return opers[self.clave](res1,res2) #// \\label{peeval}\n else:\n return self.clave\n\ndef inorden(arbol):\n if arbol != None:\n inorden(arbol.obtenerHijoIzquierdo())\n print(arbol.obtenerValorRaiz())\n inorden(arbol.obtenerHijoDerecho())\n\ndef imprimirExpresion(arbol):\n if arbol.hijoIzquierdo:\n print('(', end=' ')\n imprimirExpresion(arbol.obtenerHijoIzquierdo())\n print(arbol.obtenerValorRaiz(), end=' ')\n if arbol.hijoDerecho:\n imprimirExpresion(arbol.obtenerHijoDerecho())\n print(')', end=' ') \n\ndef imprimirExpresion(arbol):\n valorCadena = \"\"\n if arbol:\n valorCadena = '(' + imprimirExpresion(arbol.obtenerHijoIzquierdo())\n valorCadena = valorCadena + str(arbol.obtenerValorRaiz())\n valorCadena = valorCadena + imprimirExpresion(arbol.obtenerHijoDerecho())+')'\n return valorCadena\n\ndef evalPostorden(arbol):\n operadores = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n res1 = None\n res2 = None\n if arbol:\n res1 = evalPostorden(arbol.obtenerHijoIzquierdo()) #// \\label{peleft}\n res2 = evalPostorden(arbol.obtenerHijoDerecho()) #// \\label{peright}\n if res1 and res2:\n return operadores[arbol.obtenerValorRaiz()](res1,res2) #// \\label{peeval}\n else:\n return arbol.obtenerValorRaiz()\n\ndef altura(arbol):\n if arbol == None:\n return -1\n else:\n return 1 + max(altura(arbol.hijoIzquierdo),altura(arbol.hijoDerecho))\n\nt = ArbolBinario(7)\nt.insertarIzquierdo(3)\nt.insertarDerecho(9)\ninorden(t)\nimport operator\nx = ArbolBinario('*')\nx.insertarIzquierdo('+')\nl = x.obtenerHijoIzquierdo()\nl.insertarIzquierdo(4)\nl.insertarDerecho(5)\nx.insertarDerecho(7)\nprint(imprimirExpresion(x))\nprint(evalPostorden(x))\nprint(altura(x))\n","src/lib/pythoned/arboles/avl.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n#\n#avl.py\n\nfrom .abb import ArbolBinarioBusqueda, NodoArbol\n\nclass ArbolAVL(ArbolBinarioBusqueda):\n\n def _agregar(self,clave,valor,nodoActual):\n \tif clave < nodoActual.clave:\n \t if nodoActual.tieneHijoIzquierdo():\n \t\tself._agregar(clave,valor,nodoActual.hijoIzquierdo)\n \t else:\n \t\tnodoActual.hijoIzquierdo = NodoArbol(clave,valor,padre=nodoActual)\n \t\tself.actualizarEquilibrio(nodoActual.hijoIzquierdo)\n \telse:\n \t if nodoActual.tieneHijoDerecho():\n \t\tself._agregar(clave,valor,nodoActual.hijoDerecho)\n \t else:\n \t\tnodoActual.hijoDerecho = NodoArbol(clave,valor,padre=nodoActual)\n \t\tself.actualizarEquilibrio(nodoActual.hijoDerecho)\n\n def actualizarEquilibrio(self,nodo):\n \tif nodo.factorEquilibrio > 1 or nodo.factorEquilibrio < -1:\n \t self.reequilibrar(nodo) \n \t return\n \tif nodo.padre != None:\n \t if nodo.esHijoIzquierdo():\n \t\t nodo.padre.factorEquilibrio += 1\n \t elif nodo.esHijoDerecho():\n \t\t nodo.padre.factorEquilibrio -= 1\n\n \t if nodo.padre.factorEquilibrio != 0:\n \t\t self.actualizarEquilibrio(nodo.padre)\n\n def reequilibrar(self,nodo):\n if nodo.factorEquilibrio < 0:\n\t if nodo.hijoDerecho.factorEquilibrio > 0:\n\t self.rotarDerecha(nodo.hijoDerecho)\n\t self.rotarIzquierda(nodo)\n\t else:\n\t self.rotarIzquierda(nodo)\n elif nodo.factorEquilibrio > 0:\n\t if nodo.hijoIzquierdo.factorEquilibrio < 0:\n\t self.rotarIzquierda(nodo.hijoIzquierdo)\n\t self.rotarDerecha(nodo)\n\t else:\n\t self.rotarDerecha(nodo)\n \n def rotarIzquierda(self,rotRaiz):\n \tnuevaRaiz = rotRaiz.hijoDerecho\n \trotRaiz.hijoDerecho = nuevaRaiz.hijoIzquierdo\n \tif nuevaRaiz.hijoIzquierdo != None:\n \t nuevaRaiz.hijoIzquierdo.padre = rotRaiz\n \tnuevaRaiz.padre = rotRaiz.padre\n \tif rotRaiz.esRaiz():\n \t self.raiz = nuevaRaiz\n \telse:\n \t if rotRaiz.esHijoIzquierdo():\n \t rotRaiz.padre.hijoIzquierdo = nuevaRaiz\n \t else:\n \t \trotRaiz.padre.hijoDerecho = nuevaRaiz\n \tnuevaRaiz.hijoIzquierdo = rotRaiz\n \trotRaiz.padre = nuevaRaiz\n \trotRaiz.factorEquilibrio = rotRaiz.factorEquilibrio + 1 - min(nuevaRaiz.factorEquilibrio, 0)\n \tnuevaRaiz.factorEquilibrio = nuevaRaiz.factorEquilibrio + 1 + max(rotRaiz.factorEquilibrio, 0)\n\n def rotarDerecha(self,rotRaiz):\n nuevaRaiz = rotRaiz.hijoIzquierdo\n rotRaiz.hijoIzquierdo = nuevaRaiz.hijoDerecho\n if nuevaRaiz.hijoDerecho != None:\n nuevaRaiz.hijoDerecho.padre = rotRaiz\n nuevaRaiz.padre = rotRaiz.padre\n if rotRaiz.esRaiz():\n self.raiz = nuevaRaiz\n else:\n if rotRaiz.esHijoDerecho():\n rotRaiz.padre.hijoDerecho = nuevaRaiz\n else:\n rotRaiz.padre.hijoIzquierdo = nuevaRaiz\n nuevaRaiz.hijoDerecho = rotRaiz\n rotRaiz.padre = nuevaRaiz\n rotRaiz.factorEquilibrio = rotRaiz.factorEquilibrio - 1 - max(nuevaRaiz.factorEquilibrio, 0)\n nuevaRaiz.factorEquilibrio = nuevaRaiz.factorEquilibrio - 1 + min(rotRaiz.factorEquilibrio, 0) \n\n","src/lib/pythoned/arboles/monticuloBinario.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n# \n#monticuloBinario.py\n\nclass MonticuloBinario:\n def __init__(self):\n self.listaMonticulo = [0]\n self.tamanoActual = 0\n\n def construirMonticulo(self,unaLista):\n i = len(unaLista) // 2\n self.tamanoActual = len(unaLista)\n self.listaMonticulo = [0] + unaLista[:]\n print(len(self.listaMonticulo), i)\n while (i > 0):\n print(self.listaMonticulo, i)\n self.infiltAbajo(i)\n i = i - 1\n print(self.listaMonticulo,i)\n \n def infiltAbajo(self,i):\n while (i * 2) <= self.tamanoActual:\n hm = self.hijoMin(i)\n if self.listaMonticulo[i] > self.listaMonticulo[hm]:\n tmp = self.listaMonticulo[i]\n self.listaMonticulo[i] = self.listaMonticulo[hm]\n self.listaMonticulo[hm] = tmp\n i = hm\n \n def hijoMin(self,i):\n if i * 2 + 1 > self.tamanoActual:\n return i * 2\n else:\n if self.listaMonticulo[i * 2] < self.listaMonticulo[i * 2 + 1]:\n return i * 2\n else:\n return i * 2 + 1\n\n def infiltArriba(self,i):\n while i // 2 > 0:\n if self.listaMonticulo[i] < self.listaMonticulo[i//2]:\n tmp = self.listaMonticulo[i // 2]\n self.listaMonticulo[i // 2] = self.listaMonticulo[i]\n self.listaMonticulo[i] = tmp\n i = i // 2\n \n def insertar(self,k):\n self.listaMonticulo.append(k)\n self.tamanoActual = self.tamanoActual + 1\n self.infiltArriba(self.tamanoActual)\n\n def eliminarMin(self):\n valorSacado = self.listaMonticulo[1]\n self.listaMonticulo[1] = self.listaMonticulo[self.tamanoActual]\n self.tamanoActual = self.tamanoActual - 1\n self.listaMonticulo.pop()\n self.infiltAbajo(1)\n return valorSacado\n \n def estaVacio(self):\n if tamanoActual == 0:\n return True\n else:\n return False\n","src/lib/pythoned/basicas/__init__.py":'\n#__all__ = ["pila"]\n\n\nfrom .pila import Pila\nfrom .cola import Cola\nfrom .coladoble import ColaDoble\n\n\n',"src/lib/pythoned/basicas/cola.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n#\n#cola.py\n\nclass Cola:\n def __init__(self):\n self.items = []\n\n def estaVacia(self):\n return self.items == []\n\n def agregar(self, item):\n self.items.insert(0,item)\n\n def avanzar(self):\n return self.items.pop()\n\n def tamano(self):\n return len(self.items)\n","src/lib/pythoned/basicas/coladoble.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n# \n#coladoble.py\n\nclass ColaDoble:\n def __init__(self):\n self.items = []\n\n def estaVacia(self):\n return self.items == []\n\n def agregarFrente(self, item):\n self.items.append(item)\n\n def agregarFinal(self, item):\n self.items.insert(0,item)\n\n def removerFrente(self):\n return self.items.pop()\n\n def removerFinal(self):\n return self.items.pop(0)\n\n def tamano(self):\n return len(self.items)\n","src/lib/pythoned/basicas/pila.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n# \n#pila.py\n\nclass Pila:\n def __init__(self):\n self.items = []\n\n def estaVacia(self):\n return self.items == []\n\n def incluir(self, item):\n self.items.append(item)\n\n def extraer(self):\n return self.items.pop()\n\n def inspeccionar(self):\n return self.items[len(self.items)-1]\n\n def tamano(self):\n return len(self.items)\n","src/lib/pythoned/grafos/__init__.py":"\n\nfrom .grafoAdy import Grafo\nfrom .grafoAdy import Vertice\nfrom .colaPrioridad import ColaPrioridad\n","src/lib/pythoned/grafos/colaPrioridad.py":"# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n# \n#colaPrioridad.py\n\nclass ColaPrioridad:\n def __init__(self):\n self.arregloMonticulo = [(0,0)]\n self.tamanoActual = 0\n\n def construirMonticulo(self,unaLista):\n self.tamanoActual = len(unaLista)\n self.arregloMonticulo = [(0,0)]\n for i in unaLista:\n self.arregloMonticulo.append(i)\n i = len(unaLista) // 2 \n while (i > 0):\n self.infiltAbajo(i)\n i = i - 1\n \n def infiltAbajo(self,i):\n while (i * 2) <= self.tamanoActual:\n hm = self.hijoMin(i)\n if self.arregloMonticulo[i][0] > self.arregloMonticulo[hm][0]:\n tmp = self.arregloMonticulo[i]\n self.arregloMonticulo[i] = self.arregloMonticulo[hm]\n self.arregloMonticulo[hm] = tmp\n i = hm\n \n def hijoMin(self,i):\n if i*2 > self.tamanoActual:\n return -1\n else:\n if i*2 + 1 > self.tamanoActual:\n return i*2\n else:\n if self.arregloMonticulo[i*2][0] < self.arregloMonticulo[i*2+1][0]:\n return i*2\n else:\n return i*2+1\n\n def infiltArriba(self,i):\n while i // 2 > 0:\n if self.arregloMonticulo[i][0] < self.arregloMonticulo[i//2][0]:\n tmp = self.arregloMonticulo[i//2]\n self.arregloMonticulo[i//2] = self.arregloMonticulo[i]\n self.arregloMonticulo[i] = tmp\n i = i//2\n \n def insertar(self,k):\n self.arregloMonticulo.append(k)\n self.tamanoActual = self.tamanoActual + 1\n self.infiltArriba(self.tamanoActual)\n\n def eliminarMin(self):\n valorSacado = self.arregloMonticulo[1][1]\n self.arregloMonticulo[1] = self.arregloMonticulo[self.tamanoActual]\n self.tamanoActual = self.tamanoActual - 1\n self.arregloMonticulo.pop()\n self.infiltAbajo(1)\n return valorSacado\n \n def estaVacia(self):\n if self.tamanoActual == 0:\n return True\n else:\n return False\n\n def decrementarClave(self,valor,nuevo):\n hecho = False\n i = 1\n miClave = 0\n while not hecho and i <= self.tamanoActual:\n if self.arregloMonticulo[i][1] == valor:\n hecho = True\n miClave = i\n else:\n i = i + 1\n if miClave > 0:\n self.arregloMonticulo[miClave] = (nuevo,self.arregloMonticulo[miClave][1])\n self.infiltArriba(miClave)\n \n def __contains__(self,vertice):\n for pareja in self.arregloMonticulo:\n if pareja[1] == vertice:\n return True\n return False \n\n","src/lib/pythoned/grafos/grafoAdy.py":'# Bradley N. Miller, David L. Ranum\n# Solución de problemas con algoritmos y estructuras de datos usando Python\n# Copyright 2014\n#\n#grafoAdy.py\n\n\nimport sys\n\nclass Grafo:\n def __init__(self):\n self.listaVertices = {}\n self.numVertices = 0\n \n def agregarVertice(self,clave):\n self.numVertices = self.numVertices + 1\n nuevoVertice = Vertice(clave)\n self.listaVertices[clave] = nuevoVertice\n return nuevoVertice\n \n def obtenerVertice(self,n):\n if n in self.listaVertices:\n return self.listaVertices[n]\n else:\n return None\n\n def __contains__(self,n):\n return n in self.listaVertices\n \n def agregarArista(self,de,a,costo=0):\n if de not in self.listaVertices:\n nv = self.agregarVertice(de)\n if a not in self.listaVertices:\n nv = self.agregarVertice(a)\n self.listaVertices[de].agregarVecino(self.listaVertices[a],costo)\n \n def obtenerVertices(self):\n return list(self.listaVertices.keys())\n \n def __iter__(self):\n return iter(self.listaVertices.values())\n \nclass Vertice:\n def __init__(self,clave):\n self.id = clave\n self.conectadoA = {}\n self.color = \'blanco\'\n self.dist = sys.maxsize\n self.predecesor = None\n self.desc = 0\n self.fin = 0\n\n # def __lt__(self,o):\n # return self.id < o.id\n \n def agregarVecino(self,vecino,ponderacion=0):\n self.conectadoA[vecino] = ponderacion\n \n def asignarColor(self,color):\n self.color = color\n \n def asignarDistancia(self,d):\n self.dist = d\n\n def asignarPredecesor(self,p):\n self.predecesor = p\n\n def asignarDescubrimiento(self,tiempoDescubrimiento):\n self.desc = tiempoDescubrimiento\n \n def asignarFinalizacion(self,tiempoFinalizacion):\n self.fin = tiempoFinalizacion\n \n def obtenerFinalizacion(self):\n return self.fin\n \n def obtenerDescubrimiento(self):\n return self.desc\n \n def obtenerPredecesor(self):\n return self.predecesor\n \n def obtenerDistancia(self):\n return self.dist\n \n def obtenerColor(self):\n return self.color\n \n def obtenerConexiones(self):\n return self.conectadoA.keys()\n \n def obtenerPonderacion(self,vecino):\n return self.conectadoA[vecino]\n \n def __str__(self):\n return str(self.id) + ":color " + self.color + ":desc " + str(self.desc) + ":fin " + str(self.fin) + ":distancia " + str(self.dist) + ":predecesor \\n\\t[" + str(self.predecesor)+ "]\\n"\n \n def obtenerId(self):\n return self.id\n',"src/lib/quopri.py":'import _sk_fail; _sk_fail._("quopri")\n',"src/lib/random.py":"from _random import *\nfrom math import floor as _floor, isfinite as _isfinite\nfrom itertools import accumulate as _accumulate, repeat as _repeat\nfrom bisect import bisect as _bisect\n\ndef choices(population, weights=None, *, cum_weights=None, k=1):\n '''Return a k sized list of population elements chosen with replacement.\n\n If the relative weights or cumulative weights are not specified,\n the selections are made with equal probability.\n\n '''\n n = len(population)\n if cum_weights is None:\n if weights is None:\n floor = _floor\n n += 0.0 # convert to float for a small speed improvement\n return [population[floor(random() * n)] for i in _repeat(None, k)]\n try:\n cum_weights = list(_accumulate(weights))\n except TypeError:\n if not isinstance(weights, int):\n raise\n k = weights\n raise TypeError(\n 'The number of choices must be a keyword argument: k=' + k\n )\n elif weights is not None:\n raise TypeError('Cannot specify both weights and cumulative weights')\n if len(cum_weights) != n:\n raise ValueError('The number of weights does not match the population')\n total = cum_weights[-1] + 0.0 # convert to float\n if total <= 0.0:\n raise ValueError('Total of weights must be greater than zero')\n if not _isfinite(total):\n raise ValueError('Total of weights must be finite')\n bisect = _bisect\n hi = n - 1\n return [population[bisect(cum_weights, random() * total, 0, hi)]\n for i in _repeat(None, k)]","src/lib/repr.py":'import _sk_fail; _sk_fail._("repr")\n',"src/lib/requests.py":'# most restricted version\n"""\nThis solution works in runestone - however it is much more limited.\nAn error does not occur in the same way in the textbook as it does\nfor the command line. Since HTTPError is not currently available in\nRunestone, I had to change the exception.\nDecode and Encode are not available in Runestone, so there might be\nissues with reponses.\nDoes not use the status attribute for urlopen, would be nice to have\nthat back.\nDoes not work on regular web pages (like google or the michigan daily) because of cross-site scripting limits.\n"""\nfrom urllib.request import urlopen\nimport json\n\nclass Response:\n def __init__(self, data, url):\n self.text = data\n self.url = url\n\n def json(self):\n try:\n return json.loads(self.text)\n except:\n return {"error": "Response not interpretable as json. Try printing the .text attribute"}\n\n def __str__(self):\n return "<A Response object for the following request: {}>".format(self.url)\n\n\nurl_subs = {" ": "+",\n "!": "%21",\n \'"\': "%22",\n "#": "%23",\n "$": "%24",\n "\'": "%27",\n "(": "%28",\n ")": "%29",\n "*": "%2A",\n "+": "%2B",\n ",": "%2C",\n "/": "%2F",\n ":": "%3A",\n ";": "%3B",\n "=": "%3D",\n "?": "%3F",\n "@": "%40",\n "[": "%5B",\n "]": "%5D",\n }\n\ndef _subst(s, substitutions=url_subs):\n res = ""\n for c in str(s):\n if c in substitutions:\n res += substitutions[c]\n else:\n res += c\n return res\n\n\ndef requestURL(baseurl, params={}):\n try:\n if len(params) == 0:\n return baseurl\n complete_url = baseurl + "?"\n pairs = ["{}={}".format(_subst(k), _subst(params[k])) for k in params]\n complete_url += "&".join(pairs)\n return complete_url\n except:\n return None\n\ndef get(baseurl, params={}):\n full_url = requestURL(baseurl, params)\n if not full_url:\n text_data = "<html><body><h1>invalid request</h1></body></html>"\n full_url = "Couldnt generate a valid URL"\n else:\n data = urlopen(full_url)\n text_data = data.read().strip()\n if len(text_data) == 0:\n text_data = "Failed to retrieve that URL"\n return Response(text_data, full_url)',"src/lib/requests_with_caching.py":'import requests\nimport json\n\nPERMANENT_CACHE_FNAME = "permanent_cache.txt"\nTEMP_CACHE_FNAME = "this_page_cache.txt"\n\ndef _write_to_file(cache, fname):\n with open(fname, \'w\') as outfile:\n outfile.write(json.dumps(cache, indent=2))\n\ndef _read_from_file(fname):\n try:\n with open(fname, \'r\') as infile:\n res = infile.read()\n return json.loads(res)\n except:\n return {}\n\ndef add_to_cache(cache_file, cache_key, cache_value):\n temp_cache = _read_from_file(cache_file)\n temp_cache[cache_key] = cache_value\n _write_to_file(temp_cache, cache_file)\n\ndef clear_cache(cache_file=TEMP_CACHE_FNAME):\n _write_to_file({}, cache_file)\n\ndef make_cache_key(baseurl, params_d, private_keys=["api_key", "apikey"]):\n """Makes a long string representing the query.\n Alphabetize the keys from the params dictionary so we get the same order each time.\n Omit keys with private info."""\n alphabetized_keys = sorted(params_d.keys())\n res = []\n for k in alphabetized_keys:\n if k not in private_keys:\n res.append("{}-{}".format(k, params_d[k]))\n return baseurl + "_".join(res)\n\ndef get(baseurl, params={}, private_keys_to_ignore=["api_key", "apikey"], permanent_cache_file=PERMANENT_CACHE_FNAME, temp_cache_file=TEMP_CACHE_FNAME):\n full_url = requests.requestURL(baseurl, params)\n cache_key = make_cache_key(baseurl, params, private_keys_to_ignore)\n # Load the permanent and page-specific caches from files\n permanent_cache = _read_from_file(permanent_cache_file)\n temp_cache = _read_from_file(temp_cache_file)\n if cache_key in temp_cache:\n print("found in page-specific cache")\n # make a Response object containing text from the change, and the full_url that would have been fetched\n return requests.Response(temp_cache[cache_key], full_url)\n elif cache_key in permanent_cache:\n print("found in permanent_cache")\n # make a Response object containing text from the change, and the full_url that would have been fetched\n return requests.Response(permanent_cache[cache_key], full_url)\n else:\n print("new; adding to cache")\n # actually request it\n resp = requests.get(baseurl, params)\n # save it\n add_to_cache(temp_cache_file, cache_key, resp.text)\n return resp',"src/lib/rexec.py":'import _sk_fail; _sk_fail._("rexec")\n',"src/lib/rfc822.py":'import _sk_fail; _sk_fail._("rfc822")\n',"src/lib/rlcompleter.py":'import _sk_fail; _sk_fail._("rlcompleter")\n',"src/lib/robotparser.py":'import _sk_fail; _sk_fail._("robotparser")\n',"src/lib/runpy.py":'import _sk_fail; _sk_fail._("runpy")\n',"src/lib/sched.py":'import _sk_fail; _sk_fail._("sched")\n',"src/lib/sets.py":'import _sk_fail; _sk_fail._("sets")\n',"src/lib/sgmllib.py":'import _sk_fail; _sk_fail._("sgmllib")\n',"src/lib/sha.py":'import _sk_fail; _sk_fail._("sha")\n',"src/lib/shelve.py":'import _sk_fail; _sk_fail._("shelve")\n',"src/lib/shlex.py":'import _sk_fail; _sk_fail._("shlex")\n',"src/lib/shutil.py":'import _sk_fail; _sk_fail._("shutil")\n',"src/lib/site.py":'import _sk_fail; _sk_fail._("site")\n',"src/lib/smtpd.py":'import _sk_fail; _sk_fail._("smtpd")\n',"src/lib/smtplib.py":'import _sk_fail; _sk_fail._("smtplib")\n',"src/lib/sndhdr.py":'import _sk_fail; _sk_fail._("sndhdr")\n',"src/lib/socket.py":'import _sk_fail; _sk_fail._("socket")\n',"src/lib/sqlite3/__init__.py":'import _sk_fail; _sk_fail._("sqlite3")\n',"src/lib/sre.py":'import _sk_fail; _sk_fail._("sre")\n',"src/lib/sre_compile.py":'import _sk_fail; _sk_fail._("sre_compile")\n',"src/lib/sre_constants.py":'import _sk_fail; _sk_fail._("sre_constants")\n',"src/lib/sre_parse.py":'import _sk_fail; _sk_fail._("sre_parse")\n',"src/lib/ssl.py":'import _sk_fail; _sk_fail._("ssl")\n',"src/lib/stat.py":'import _sk_fail; _sk_fail._("stat")\n',"src/lib/statistics.py":"\"\"\"\nBasic statistics module.\n\nThis module provides functions for calculating statistics of data, including\naverages, variance, and standard deviation.\n\nCalculating averages\n--------------------\n\n================== =============================================\nFunction Description\n================== =============================================\nmean Arithmetic mean (average) of data.\nharmonic_mean Harmonic mean of data.\nmedian Median (middle value) of data.\nmedian_low Low median of data.\nmedian_high High median of data.\nmedian_grouped Median, or 50th percentile, of grouped data.\nmode Mode (most common value) of data.\n================== =============================================\n\nCalculate the arithmetic mean (\"the average\") of data:\n\n>>> mean([-1.0, 2.5, 3.25, 5.75])\n2.625\n\n\nCalculate the standard median of discrete data:\n\n>>> median([2, 3, 4, 5])\n3.5\n\n\nCalculate the median, or 50th percentile, of data grouped into class intervals\ncentred on the data values provided. E.g. if your data points are rounded to\nthe nearest whole number:\n\n>>> median_grouped([2, 2, 3, 3, 3, 4]) #doctest: +ELLIPSIS\n2.8333333333...\n\nThis should be interpreted in this way: you have two data points in the class\ninterval 1.5-2.5, three data points in the class interval 2.5-3.5, and one in\nthe class interval 3.5-4.5. The median of these data points is 2.8333...\n\n\nCalculating variability or spread\n---------------------------------\n\n================== =============================================\nFunction Description\n================== =============================================\npvariance Population variance of data.\nvariance Sample variance of data.\npstdev Population standard deviation of data.\nstdev Sample standard deviation of data.\n================== =============================================\n\nCalculate the standard deviation of sample data:\n\n>>> stdev([2.5, 3.25, 5.5, 11.25, 11.75]) #doctest: +ELLIPSIS\n4.38961843444...\n\nIf you have previously calculated the mean, you can pass it as the optional\nsecond argument to the four \"spread\" functions to avoid recalculating it:\n\n>>> data = [1, 2, 2, 4, 4, 4, 5, 6]\n>>> mu = mean(data)\n>>> pvariance(data, mu)\n2.5\n\n\nExceptions\n----------\n\nA single exception is defined: StatisticsError is a subclass of ValueError.\n\n\"\"\"\n\n__all__ = [ 'StatisticsError',\n 'pstdev', 'pvariance', 'stdev', 'variance',\n 'median', 'median_low', 'median_high', 'median_grouped',\n 'mean', 'mode', 'harmonic_mean',\n ]\n\nfrom collections import Counter\nfrom math import sqrt\n\ndef mean(data):\n return sum(data) / len(data)\n\ndef harmonic_mean(data):\n raise NotImplementedError\n\n\ndef median(data):\n _data = sorted(data)\n l = len(_data)\n if l % 2 == 0:\n _median = (_data[l//2] + _data[l//2-1]) / 2\n else:\n _median = _data[l//2]\n return _median\n\ndef median_low(data):\n _data = sorted(data)\n l = len(_data)\n if l % 2 == 0:\n _median = _data[l//2-1]\n else:\n _median = _data[l//2]\n return _median\n\n\ndef median_high(data):\n _data = sorted(data)\n l = len(_data)\n if l % 2 == 0:\n _median = _data[l//2]\n else:\n _median = _data[l//2]\n return _median\n\n\ndef median_grouped(data):\n return median(data)\n\ndef mode(data):\n counter = Counter(data)\n max_count = max(counter.values())\n _mode = [k for k,v in counter.items() if v == max_count]\n if len(_mode) > 1:\n raise ValueError(\"No Unique Mode, found {} equally common values\".format(len(_mode)))\n else:\n return _mode[0]\n\n\ndef variance(data):\n average=mean(data)\n _variance=0\n for d in data:\n _variance += ((average-d)**2)\n final_variance=_variance/len(data)\n return final_variance\n\ndef pvariance(data):\n average=mean(data)\n _variance=0\n for d in data:\n _variance += ((average-d)**2)\n final_variance=_variance/len(data)\n return final_variance\n\ndef variance(data):\n average=mean(data)\n _variance=0\n for d in data:\n _variance += ((average-d)**2)\n final_variance=_variance/(len(data) -1)\n return final_variance\n\ndef pstdev(data):\n return sqrt(pvariance(data))\n\ndef stdev(data):\n return sqrt(variance(data))\n\n","src/lib/statvfs.py":'import _sk_fail; _sk_fail._("statvfs")\n',"src/lib/stringold.py":'import _sk_fail; _sk_fail._("stringold")\n',"src/lib/stringprep.py":'import _sk_fail; _sk_fail._("stringprep")\n',"src/lib/struct.py":'import _sk_fail; _sk_fail._("struct")\n',"src/lib/subprocess.py":'import _sk_fail; _sk_fail._("subprocess")\n',"src/lib/sunau.py":'import _sk_fail; _sk_fail._("sunau")\n',"src/lib/sunaudio.py":'import _sk_fail; _sk_fail._("sunaudio")\n',"src/lib/symbol.py":'import _sk_fail; _sk_fail._("symbol")\n',"src/lib/symtable.py":'import _sk_fail; _sk_fail._("symtable")\n',"src/lib/tabnanny.py":'import _sk_fail; _sk_fail._("tabnanny")\n',"src/lib/tarfile.py":'import _sk_fail; _sk_fail._("tarfile")\n',"src/lib/telnetlib.py":'import _sk_fail; _sk_fail._("telnetlib")\n',"src/lib/tempfile.py":'import _sk_fail; _sk_fail._("tempfile")\n',"src/lib/test/__init__.py":"__author__ = 'bmiller'\n\ndef testEqual(actual, expected, places=5):\n if isinstance(expected,int):\n if actual == expected:\n print('Pass')\n return True\n elif isinstance(expected,float):\n if abs(actual-expected) < 10**(-places):\n print('Pass')\n return True\n else:\n if actual == expected:\n print('Pass')\n return True\n print('Test Failed: expected ' + str(expected) + ' but got ' + str(actual))\n return False\n\ndef testNotEqual(actual, expected):\n pass\n\n","src/lib/test/ann_module.py":"\n\n\"\"\"\nThe module for testing variable annotations.\nEmpty lines above are for good reason (testing for correct line numbers)\n\"\"\"\n\n# from typing import Optional\n# from functools import wraps\n\n__annotations__[1] = 2\n\nclass C:\n\n x = 5; #y: Optional['C'] = None\n\n# from typing import Tuple\nx: int = 5; y: str = x;# f: Tuple[int, int]\n\nclass M(type):\n\n __annotations__['123'] = 123\n o: type = object\n\n(pars): bool = True\n\nclass D(C):\n j: str = 'hi'; k: str= 'bye'\n\n# from types import new_class\n# h_class = new_class('H', (C,))\n# j_class = new_class('J')\n\nclass F():\n z: int = 5\n def __init__(self, x):\n pass\n\nclass Y(F):\n def __init__(self):\n super(F, self).__init__(123)\n\nclass Meta(type):\n def __new__(meta, name, bases, namespace):\n return super().__new__(meta, name, bases, namespace)\n\nclass S(metaclass = Meta):\n x: str = 'something'\n y: str = 'something else'\n\n# def foo(x: int = 10):\n# def bar(y: List[str]):\n# x: str = 'yes'\n# bar()\n\n# def dec(func):\n# @wraps(func)\n# def wrapper(*args, **kwargs):\n# return func(*args, **kwargs)\n# return wrapper\n","src/lib/test/ann_module2.py":'"""\nSome correct syntax for variable annotation here.\nMore examples are in test_grammar and test_parser.\n"""\n\n# from typing import no_type_check, ClassVar\n\ni: int = 1\nj: int\nx: float = i/10\n\ndef f():\n # class C: ...\n class C: pass\n return C()\n\nf().new_attr: object = object()\n\nclass C:\n def __init__(self, x: int) -> None:\n self.x = x\n\nc = C(5)\nc.new_attr: int = 10\n\n__annotations__ = {}\n\n\n# @no_type_check\n# class NTC:\n# def meth(self, param: complex) -> None:\n# ...\n\n# class CV:\n# var: ClassVar[\'CV\']\n\n# CV.var = CV()\n',"src/lib/test/ann_module3.py":'"""\nCorrect syntax for variable annotation that should fail at runtime\nin a certain manner. More examples are in test_grammar and test_parser.\n"""\n\ndef f_bad_ann():\n __annotations__[1] = 2\n\nclass C_OK:\n def __init__(self, x: int) -> None:\n self.x: no_such_name = x # This one is OK as proposed by Guido\n\nclass D_bad_ann:\n def __init__(self, x: int) -> None:\n sfel.y: int = 0\n\ndef g_bad_ann():\n no_such_name.attr: int = 0\n',"src/lib/test/bad_getattr.py":'x = 1\n\n__getattr__ = "Surprise!"\n__dir__ = "Surprise again!"\n',"src/lib/test/bad_getattr2.py":'def __getattr__():\n "Bad one"\n\nx = 1\n\ndef __dir__(bad_sig):\n return []\n',"src/lib/test/bad_getattr3.py":"def __getattr__(name):\n global __getattr__\n if name != 'delgetattr':\n raise AttributeError\n del __getattr__\n raise AttributeError\n","src/lib/test/decimaltestdata/__init__.py":'import _sk_fail; _sk_fail._("decimaltestdata")\n',"src/lib/test/good_getattr.py":"x = 1\n\ndef __dir__():\n return ['a', 'b', 'c']\n\ndef __getattr__(name):\n if name == \"yolo\":\n raise AttributeError(\"Deprecated, use whatever instead\")\n return f\"There is {name}\"\n\ny = 2\n","src/lib/test/test_support.py":'"""Supporting definitions for the Python regression tests."""\n\nif __name__ != \'test.test_support\':\n raise ImportError(\'test_support must be imported from the test package\')\n\nimport unittest\n\n\n# def run_unittest(*classes):\n# """Run tests from unittest.TestCase-derived classes."""\n# valid_types = (unittest.TestSuite, unittest.TestCase)\n# suite = unittest.TestSuite()\n# for cls in classes:\n# if isinstance(cls, str):\n# if cls in sys.modules:\n# suite.addTest(unittest.findTestCases(sys.modules[cls]))\n# else:\n# raise ValueError("str arguments must be keys in sys.modules")\n# elif isinstance(cls, valid_types):\n# suite.addTest(cls)\n# else:\n# suite.addTest(unittest.makeSuite(cls))\n# _run_suite(suite)\n\ndef run_unittest(*classes):\n """Run tests from unittest.TestCase-derived classes."""\n for cls in classes:\n print cls\n if issubclass(cls, unittest.TestCase):\n cls().main()\n else:\n print "Don\'t know what to do with ", cls\n',"src/lib/textwrap.py":"\"\"\"Text wrapping and filling.\n\"\"\"\n\n# Copyright (C) 1999-2001 Gregory P. Ward.\n# Copyright (C) 2002, 2003 Python Software Foundation.\n# Written by Greg Ward <gward@python.net>\n\nimport re, string\n\n__all__ = ['TextWrapper', 'wrap', 'fill', 'dedent', 'indent', 'shorten']\n\n# Hardcode the recognized whitespace characters to the US-ASCII\n# whitespace characters. The main reason for doing this is that\n# some Unicode spaces (like \\u00a0) are non-breaking whitespaces.\n_whitespace = '\\t\\n\\x0b\\x0c\\r '\n\nclass TextWrapper:\n \"\"\"\n Object for wrapping/filling text. The public interface consists of\n the wrap() and fill() methods; the other methods are just there for\n subclasses to override in order to tweak the default behaviour.\n If you want to completely replace the main wrapping algorithm,\n you'll probably have to override _wrap_chunks().\n Several instance attributes control various aspects of wrapping:\n width (default: 70)\n the maximum width of wrapped lines (unless break_long_words\n is false)\n initial_indent (default: \"\")\n string that will be prepended to the first line of wrapped\n output. Counts towards the line's width.\n subsequent_indent (default: \"\")\n string that will be prepended to all lines save the first\n of wrapped output; also counts towards each line's width.\n expand_tabs (default: true)\n Expand tabs in input text to spaces before further processing.\n Each tab will become 0 .. 'tabsize' spaces, depending on its position\n in its line. If false, each tab is treated as a single character.\n tabsize (default: 8)\n Expand tabs in input text to 0 .. 'tabsize' spaces, unless\n 'expand_tabs' is false.\n replace_whitespace (default: true)\n Replace all whitespace characters in the input text by spaces\n after tab expansion. Note that if expand_tabs is false and\n replace_whitespace is true, every tab will be converted to a\n single space!\n fix_sentence_endings (default: false)\n Ensure that sentence-ending punctuation is always followed\n by two spaces. Off by default because the algorithm is\n (unavoidably) imperfect.\n break_long_words (default: true)\n Break words longer than 'width'. If false, those words will not\n be broken, and some lines might be longer than 'width'.\n break_on_hyphens (default: true)\n Allow breaking hyphenated words. If true, wrapping will occur\n preferably on whitespaces and right after hyphens part of\n compound words.\n drop_whitespace (default: true)\n Drop leading and trailing whitespace from lines.\n max_lines (default: None)\n Truncate wrapped lines.\n placeholder (default: ' [...]')\n Append to the last line of truncated text.\n \"\"\"\n\n unicode_whitespace_trans = {}\n # uspace = ord(' ')\n uspace = ' '\n for x in _whitespace:\n # unicode_whitespace_trans[ord(x)] = uspace\n unicode_whitespace_trans[x] = uspace\n\n # This funky little regex is just the trick for splitting\n # text up into word-wrappable chunks. E.g.\n # \"Hello there -- you goof-ball, use the -b option!\"\n # splits into\n # Hello/ /there/ /--/ /you/ /goof-/ball,/ /use/ /the/ /-b/ /option!\n # (after stripping out empty strings).\n wordsep_re = re.compile(\n r'(\\s+|' # any whitespace\n r'[^\\s\\w]*\\w+[^0-9\\W]-(?=\\w+[^0-9\\W]))') # hyphenated words\n em_dash = re.compile(r'(\\s+|' # any whitespace\n r'[^\\s\\w]*\\w+[^0-9\\W]-(?=\\w+[^0-9\\W])|' # hyphenated words\n r'(?!^)-{2,}(?=\\w))') # em-dash\n\n \n # This less funky little regex just split on recognized spaces. E.g.\n # \"Hello there -- you goof-ball, use the -b option!\"\n # splits into\n # Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/\n wordsep_simple_re = re.compile(r'(\\s+)')\n\n\n # XXX this is not locale- or charset-aware -- string.lowercase\n # is US-ASCII only (and therefore English-only)\n sentence_end_re = re.compile(r'[a-z]' # lowercase letter\n r'[\\.\\!\\?]' # sentence-ending punct.\n r'[\\\"\\']?' # optional end-of-quote\n r'\\Z') # end of chunk\n sentence_end_re = r'[a-z][\\.\\!\\?][\\\"\\']?'\n\n def __init__(self,\n width=70,\n initial_indent=\"\",\n subsequent_indent=\"\",\n expand_tabs=True,\n replace_whitespace=True,\n fix_sentence_endings=False,\n break_long_words=True,\n drop_whitespace=True,\n break_on_hyphens=True,\n tabsize=8,\n max_lines=None,\n placeholder=' [...]'):\n self.width = width\n self.initial_indent = initial_indent\n self.subsequent_indent = subsequent_indent\n self.expand_tabs = expand_tabs\n self.replace_whitespace = replace_whitespace\n self.fix_sentence_endings = fix_sentence_endings\n self.break_long_words = break_long_words\n self.drop_whitespace = drop_whitespace\n self.break_on_hyphens = break_on_hyphens\n self.tabsize = tabsize\n self.max_lines = max_lines\n self.placeholder = placeholder\n\n\n # -- Private methods -----------------------------------------------\n # (possibly useful for subclasses to override)\n\n def _munge_whitespace(self, text):\n \"\"\"_munge_whitespace(text : string) -> string\n Munge whitespace in text: expand tabs and convert all other\n whitespace characters to spaces. Eg. \" foo\\\\tbar\\\\n\\\\nbaz\"\n becomes \" foo bar baz\".\n \"\"\"\n if self.expand_tabs:\n text = text.expandtabs(self.tabsize)\n if self.replace_whitespace:\n for key, val in self.unicode_whitespace_trans.items():\n text = text.replace(key, val)\n return text\n\n\n def _split(self, text):\n \"\"\"_split(text : string) -> [string]\n Split the text to wrap into indivisible chunks. Chunks are\n not quite the same as words; see _wrap_chunks() for full\n details. As an example, the text\n Look, goof-ball -- use the -b option!\n breaks into the following chunks:\n 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',\n 'use', ' ', 'the', ' ', '-b', ' ', 'option!'\n if break_on_hyphens is True, or in:\n 'Look,', ' ', 'goof-ball', ' ', '--', ' ',\n 'use', ' ', 'the', ' ', '-b', ' ', option!'\n otherwise.\n \"\"\"\n if self.break_on_hyphens is True:\n chunks = self.wordsep_re.split(text)\n if \"--\" in text:\n chunks = [item \n for sublist in [self.em_dash.split(chunk) for chunk in chunks] \n for item in sublist]\n else:\n chunks = self.wordsep_simple_re.split(text)\n chunks = [c for c in chunks if c]\n return chunks\n\n def _fix_sentence_endings(self, chunks):\n \"\"\"_fix_sentence_endings(chunks : [string])\n Correct for sentence endings buried in 'chunks'. Eg. when the\n original text contains \"... foo.\\\\nBar ...\", munge_whitespace()\n and split() will convert that to [..., \"foo.\", \" \", \"Bar\", ...]\n which has one too few spaces; this method simply changes the one\n space to two.\n \"\"\"\n i = 0\n # patsearch = self.sentence_end_re.search\n while i < len(chunks)-1:\n if chunks[i+1] == \" \" and re.search(self.sentence_end_re, chunks[i]) and chunks[i][-1] in \".!?\\\"\\'\":\n chunks[i+1] = \" \"\n i += 2\n else:\n i += 1\n\n def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):\n \"\"\"_handle_long_word(chunks : [string],\n cur_line : [string],\n cur_len : int, width : int)\n Handle a chunk of text (most likely a word, not whitespace) that\n is too long to fit in any line.\n \"\"\"\n # Figure out when indent is larger than the specified width, and make\n # sure at least one character is stripped off on every pass\n if width < 1:\n space_left = 1\n else:\n space_left = width - cur_len\n\n # If we're allowed to break long words, then do so: put as much\n # of the next chunk onto the current line as will fit.\n if self.break_long_words:\n cur_line.append(reversed_chunks[-1][:space_left])\n reversed_chunks[-1] = reversed_chunks[-1][space_left:]\n\n # Otherwise, we have to preserve the long word intact. Only add\n # it to the current line if there's nothing already there --\n # that minimizes how much we violate the width constraint.\n elif not cur_line:\n cur_line.append(reversed_chunks.pop())\n\n # If we're not allowed to break long words, and there's already\n # text on the current line, do nothing. Next time through the\n # main loop of _wrap_chunks(), we'll wind up here again, but\n # cur_len will be zero, so the next line will be entirely\n # devoted to the long word that we can't handle right now.\n\n def _wrap_chunks(self, chunks):\n \"\"\"_wrap_chunks(chunks : [string]) -> [string]\n Wrap a sequence of text chunks and return a list of lines of\n length 'self.width' or less. (If 'break_long_words' is false,\n some lines may be longer than this.) Chunks correspond roughly\n to words and the whitespace between them: each chunk is\n indivisible (modulo 'break_long_words'), but a line break can\n come between any two chunks. Chunks should not have internal\n whitespace; ie. a chunk is either all whitespace or a \"word\".\n Whitespace chunks will be removed from the beginning and end of\n lines, but apart from that whitespace is preserved.\n \"\"\"\n lines = []\n if self.width <= 0:\n raise ValueError(\"invalid width %r (must be > 0)\" % self.width)\n if self.max_lines is not None:\n if self.max_lines > 1:\n indent = self.subsequent_indent\n else:\n indent = self.initial_indent\n if len(indent) + len(self.placeholder.lstrip()) > self.width:\n raise ValueError(\"placeholder too large for max width\")\n\n # Arrange in reverse order so items can be efficiently popped\n # from a stack of chucks.\n chunks.reverse()\n\n while chunks:\n\n # Start the list of chunks that will make up the current line.\n # cur_len is just the length of all the chunks in cur_line.\n cur_line = []\n cur_len = 0\n\n # Figure out which static string will prefix this line.\n if lines:\n indent = self.subsequent_indent\n else:\n indent = self.initial_indent\n\n # Maximum width for this line.\n width = self.width - len(indent)\n\n # First chunk on line is whitespace -- drop it, unless this\n # is the very beginning of the text (ie. no lines started yet).\n if self.drop_whitespace and chunks[-1].strip() == '' and lines:\n del chunks[-1]\n\n while chunks:\n l = len(chunks[-1])\n\n # Can at least squeeze this chunk onto the current line.\n if cur_len + l <= width:\n cur_line.append(chunks.pop())\n cur_len += l\n\n # Nope, this line is full.\n else:\n break\n\n # The current line is full, and the next chunk is too big to\n # fit on *any* line (not just this one).\n if chunks and len(chunks[-1]) > width:\n self._handle_long_word(chunks, cur_line, cur_len, width)\n cur_len = sum(map(len, cur_line))\n\n # If the last chunk on this line is all whitespace, drop it.\n if self.drop_whitespace and cur_line and cur_line[-1].strip() == '':\n cur_len -= len(cur_line[-1])\n del cur_line[-1]\n\n if cur_line:\n if (self.max_lines is None or\n len(lines) + 1 < self.max_lines or\n (not chunks or\n self.drop_whitespace and\n len(chunks) == 1 and\n not chunks[0].strip()) and cur_len <= width):\n # Convert current line back to a string and store it in\n # list of all lines (return value).\n lines.append(indent + ''.join(cur_line))\n else:\n while cur_line:\n if (cur_line[-1].strip() and\n cur_len + len(self.placeholder) <= width):\n cur_line.append(self.placeholder)\n lines.append(indent + ''.join(cur_line))\n break\n cur_len -= len(cur_line[-1])\n del cur_line[-1]\n else:\n if lines:\n prev_line = lines[-1].rstrip()\n if (len(prev_line) + len(self.placeholder) <=\n self.width):\n lines[-1] = prev_line + self.placeholder\n break\n lines.append(indent + self.placeholder.lstrip())\n break\n\n return lines\n\n def _split_chunks(self, text):\n text = self._munge_whitespace(text)\n return self._split(text)\n\n # -- Public interface ----------------------------------------------\n\n def wrap(self, text):\n \"\"\"wrap(text : string) -> [string]\n Reformat the single paragraph in 'text' so it fits in lines of\n no more than 'self.width' columns, and return a list of wrapped\n lines. Tabs in 'text' are expanded with string.expandtabs(),\n and all other whitespace characters (including newline) are\n converted to space.\n \"\"\"\n chunks = self._split_chunks(text)\n if self.fix_sentence_endings:\n self._fix_sentence_endings(chunks)\n return self._wrap_chunks(chunks)\n\n def fill(self, text):\n \"\"\"fill(text : string) -> string\n Reformat the single paragraph in 'text' to fit in lines of no\n more than 'self.width' columns, and return a new string\n containing the entire wrapped paragraph.\n \"\"\"\n return \"\\n\".join(self.wrap(text))\n\n\n# -- Convenience interface ---------------------------------------------\n\ndef wrap(text, width=70, **kwargs):\n \"\"\"Wrap a single paragraph of text, returning a list of wrapped lines.\n Reformat the single paragraph in 'text' so it fits in lines of no\n more than 'width' columns, and return a list of wrapped lines. By\n default, tabs in 'text' are expanded with string.expandtabs(), and\n all other whitespace characters (including newline) are converted to\n space. See TextWrapper class for available keyword args to customize\n wrapping behaviour.\n \"\"\"\n w = TextWrapper(width=width, **kwargs)\n return w.wrap(text)\n\ndef fill(text, width=70, **kwargs):\n \"\"\"Fill a single paragraph of text, returning a new string.\n Reformat the single paragraph in 'text' to fit in lines of no more\n than 'width' columns, and return a new string containing the entire\n wrapped paragraph. As with wrap(), tabs are expanded and other\n whitespace characters converted to space. See TextWrapper class for\n available keyword args to customize wrapping behaviour.\n \"\"\"\n w = TextWrapper(width=width, **kwargs)\n return w.fill(text)\n\ndef shorten(text, width, **kwargs):\n \"\"\"Collapse and truncate the given text to fit in the given width.\n The text first has its whitespace collapsed. If it then fits in\n the *width*, it is returned as is. Otherwise, as many words\n as possible are joined and then the placeholder is appended::\n >>> textwrap.shorten(\"Hello world!\", width=12)\n 'Hello world!'\n >>> textwrap.shorten(\"Hello world!\", width=11)\n 'Hello [...]'\n \"\"\"\n w = TextWrapper(width=width, max_lines=1, **kwargs)\n return w.fill(' '.join(text.strip().split()))\n\n\n# -- Loosely related functionality -------------------------------------\n\n# _whitespace_only_re = re.compile('^[ \\t]+$', re.MULTILINE)\n# _leading_whitespace_re = re.compile('(^[ \\t]*)(?:[^ \\t\\n])', re.MULTILINE)\n\ndef dedent(text):\n \"\"\"Remove any common leading whitespace from every line in `text`.\n This can be used to make triple-quoted strings line up with the left\n edge of the display, while still presenting them in the source code\n in indented form.\n Note that tabs and spaces are both treated as whitespace, but they\n are not equal: the lines \" hello\" and \"\\\\thello\" are\n considered to have no common leading whitespace.\n Entirely blank lines are normalized to a newline character.\n \"\"\"\n # Look for the longest leading string of spaces and tabs common to\n # all lines.\n margin = None\n\n indents = re.findall(r'(^[ \\t]*)(?:[^ \\t\\n])',text, re.MULTILINE)\n for indent in indents:\n if margin is None:\n margin = indent\n\n # Current line more deeply indented than previous winner:\n # no change (previous winner is still on top).\n elif indent.startswith(margin):\n pass\n\n # Current line consistent with and no deeper than previous winner:\n # it's the new winner.\n elif margin.startswith(indent):\n margin = indent\n\n # Find the largest common whitespace between current line and previous\n # winner.\n else:\n for i, (x, y) in enumerate(zip(margin, indent)):\n if x != y:\n margin = margin[:i]\n break\n # sanity check (testing/debugging only)\n if 0 and margin:\n for line in text.split(\"\\n\"):\n assert not line or line.startswith(margin), \\\n \"line = %r, margin = %r\" % (line, margin)\n\n if margin:\n lines = [line[len(margin):] \n if line.strip()\n else line.strip() \n for line in text.split(\"\\n\")]\n text = \"\\n\".join(lines)\n return text\n\n\ndef indent(text, prefix, predicate=None):\n \"\"\"Adds 'prefix' to the beginning of selected lines in 'text'.\n If 'predicate' is provided, 'prefix' will only be added to the lines\n where 'predicate(line)' is True. If 'predicate' is not provided,\n it will default to adding 'prefix' to all non-empty lines that do not\n consist solely of whitespace characters.\n \"\"\"\n if predicate is None:\n def predicate(line):\n return line.strip()\n\n def prefixed_lines():\n for line in text.splitlines(True):\n yield (prefix + line if predicate(line) else line)\n return ''.join(prefixed_lines())\n\n\nif __name__ == \"__main__\":\n #print dedent(\"\\tfoo\\n\\tbar\")\n #print dedent(\" \\thello there\\n \\t how are you?\")\n print(dedent(\"Hello there.\\n This is indented.\"))","src/lib/this.py":'\nprint("""\nThe Zen of Python, by Tim Peters\n\nBeautiful is better than ugly.\nExplicit is better than implicit.\nSimple is better than complex.\nComplex is better than complicated.\nFlat is better than nested.\nSparse is better than dense.\nReadability counts.\nSpecial cases aren\'t special enough to break the rules.\nAlthough practicality beats purity.\nErrors should never pass silently.\nUnless explicitly silenced.\nIn the face of ambiguity, refuse the temptation to guess.\nThere should be one-- and preferably only one --obvious way to do it.\nAlthough that way may not be obvious at first unless you\'re Dutch.\nNow is better than never.\nAlthough never is often better than *right* now.\nIf the implementation is hard to explain, it\'s a bad idea.\nIf the implementation is easy to explain, it may be a good idea.\nNamespaces are one honking great idea -- let\'s do more of those!\n"""\n )\n',"src/lib/threading.py":'import _sk_fail; _sk_fail._("threading")\n',"src/lib/timeit.py":'import _sk_fail; _sk_fail._("timeit")\n',"src/lib/toaiff.py":'import _sk_fail; _sk_fail._("toaiff")\n',"src/lib/trace.py":'import _sk_fail; _sk_fail._("trace")\n',"src/lib/traceback.py":'import _sk_fail; _sk_fail._("traceback")\n',"src/lib/tty.py":'import _sk_fail; _sk_fail._("tty")\n',"src/lib/types.py":'"""\nThis file was modified from CPython.\nCopyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved\n"""\n"""Define names for all type symbols known in the standard interpreter.\nTypes that are part of optional modules (e.g. array) are not listed.\n"""\nimport sys\n\n# Iterators in Python aren\'t a matter of type but of protocol. A large\n# and changing number of builtin types implement *some* flavor of\n# iterator. Don\'t check the type! Use hasattr to check for both\n# "__iter__" and "next" attributes instead.\nMappingProxyType = type(type.__dict__)\nWrapperDescriptorType = type(object.__init__)\nMethodWrapperType = type(object().__str__)\nMethodDescriptorType = type(str.join)\nClassMethodDescriptorType = type(dict.__dict__[\'fromkeys\'])\n\nNoneType = type(None)\nTypeType = type\nObjectType = object\nIntType = int\ntry:\n LongType = long\nexcept: pass\nFloatType = float\nBooleanType = bool\ntry:\n ComplexType = complex\nexcept NameError:\n pass\nStringType = str\n\n# StringTypes is already outdated. Instead of writing "type(x) in\n# types.StringTypes", you should use "isinstance(x, basestring)". But\n# we keep around for compatibility with Python 2.2.\ntry:\n UnicodeType = unicode\n StringTypes = (StringType, UnicodeType)\nexcept NameError:\n StringTypes = (StringType,)\n\nBufferType = buffer\n\nTupleType = tuple\nListType = list\nDictType = DictionaryType = dict\n\ndef _f(): pass\nFunctionType = type(_f)\nLambdaType = type(lambda: None) # Same as FunctionType\n#CodeType = type(_f.func_code)\n\ndef _g():\n yield 1\nGeneratorType = type(_g())\n\nclass _C:\n def _m(self): pass\nClassType = type(_C)\nUnboundMethodType = type(_C._m) # Same as MethodType\n_x = _C()\nInstanceType = type(_x)\nMethodType = type(_x._m)\nBuiltinFunctionType = type(len)\nBuiltinMethodType = type([].append) # Same as BuiltinFunctionType\n\nModuleType = type(sys)\nFileType = file\ntry:\n XRangeType = xrange\nexcept NameError:\n pass\n\n# try:\n# raise TypeError\n# except TypeError:\n# tb = sys.exc_info()[2]\n# TracebackType = type(tb)\n# FrameType = type(tb.tb_frame)\n# del tb\n\nSliceType = slice\nEllipsisType = type(Ellipsis)\n\n# DictProxyType = type(TypeType.__dict__)\nNotImplementedType = type(NotImplemented)\n\n# For Jython, the following two types are identical\n# GetSetDescriptorType = type(FunctionType.func_code)\n# MemberDescriptorType = type(FunctionType.func_globals)\n\ndel sys, _f, _g, _C, _x # Not for export\n__all__ = list(n for n in globals() if n[:1] != \'_\')\n\nGenericAlias = type(type[int])',"src/lib/unittest/__init__.py":'__author__ = \'bmiller\'\n\'\'\'\nThis is the start of something that behaves like\nthe unittest module from cpython.\n\n\'\'\'\nimport re\n\nclass _AssertRaisesContext(object):\n """A context manager used to implement TestCase.assertRaises* methods."""\n def __init__(self, expected, test_case, expected_regex=None):\n self.test_case = test_case\n self.expected = expected\n self.exception = None\n if expected_regex is not None:\n expected_regex = re.compile(expected_regex)\n self.expected_regex = expected_regex\n\n def _is_subtype(self, expected, basetype):\n if isinstance(expected, tuple):\n return all(self._is_subtype(e, basetype) for e in expected)\n return isinstance(expected, type) and issubclass(expected, basetype)\n\n def handle(self, name, args, kwargs):\n """\n If args is empty, assertRaises is being used as a\n context manager, so return self.\n If args is not empty, call a callable passing positional and keyword\n arguments.\n """\n try:\n if not self._is_subtype(self.expected, BaseException):\n raise TypeError(\'%s() arg 1 must be an exception type or tuple of exception types\'.format(name))\n if not args:\n return self\n\n callable_obj = args[0]\n args = args[1:]\n with self:\n callable_obj(*args, **kwargs) \n\n finally:\n # bpo-23890: manually break a reference cycle\n self = None\n\n def __enter__(self):\n return self\n\n def __exit__(self, exc_type, exc_value, tb):\n res = True\n feedback = ""\n self.exception = exc_value\n try:\n act_exc = exc_type.__name__\n except AttributeError:\n act_exc = str(exc_type)\n try:\n exp_exc = self.expected.__name__\n except AttributeError:\n exp_exc = str(self.expected)\n\n if exc_type is None:\n res = False\n feedback = "{} not raised".format(exp_exc)\n elif not issubclass(exc_type, self.expected):\n res = False\n feedback = "Expected {} but got {}".format(exp_exc, act_exc)\n\n elif self.expected_regex is not None:\n expected_regex = self.expected_regex\n if not expected_regex.search(str(exc_value)):\n res = False\n feedback = \'"{}" does not match "{}"\'.format(expected_regex.pattern, str(exc_value))\n\n self.test_case.appendResult(res, act_exc, exp_exc, feedback)\n\n return True\n\n\nclass TestCase(object):\n def __init__(self):\n self.numPassed = 0\n self.numFailed = 0\n self.assertPassed = 0\n self.assertFailed = 0\n self.verbosity = 1\n self.tlist = []\n testNames = {}\n for name in dir(self):\n if name[:4] == \'test\' and name not in testNames:\n self.tlist.append(getattr(self,name))\n testNames[name]=True\n\n def setUp(self):\n pass\n\n def tearDown(self):\n pass\n \n def cleanName(self,funcName):\n return funcName.__func__.__name__\n\n def main(self):\n\n for func in self.tlist:\n if self.verbosity > 1:\n print(\'Running %s\' % self.cleanName(func))\n try:\n self.setUp()\n self.assertPassed = 0\n self.assertFailed = 0\n func()\n self.tearDown()\n if self.assertFailed == 0:\n self.numPassed += 1\n else:\n self.numFailed += 1\n print(\'Tests failed in %s \' % self.cleanName(func))\n except Exception as e:\n self.assertFailed += 1\n self.numFailed += 1\n print(\'Test threw exception in %s (%s)\' % (self.cleanName(func), e))\n self.showSummary()\n\n def assertEqual(self, actual, expected, feedback=""):\n res = actual==expected\n if not res and feedback == "":\n feedback = "Expected %s to equal %s" % (str(actual),str(expected))\n self.appendResult(res, actual ,expected, feedback)\n\n def assertNotEqual(self, actual, expected, feedback=""):\n res = actual != expected\n if not res and feedback == "":\n feedback = "Expected %s to not equal %s" % (str(actual),str(expected))\n self.appendResult(res, actual, expected, feedback)\n\n def assertTrue(self,x, feedback=""):\n res = bool(x) is True\n if not res and feedback == "":\n feedback = "Expected %s to be True" % (str(x))\n self.appendResult(res, x, True, feedback)\n\n def assertFalse(self,x, feedback=""):\n res = not bool(x)\n if not res and feedback == "":\n feedback = "Expected %s to be False" % (str(x))\n self.appendResult(res, x, False, feedback)\n\n def assertIs(self,a,b, feedback=""):\n res = a is b\n if not res and feedback == "":\n feedback = "Expected %s to be the same object as %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertIsNot(self,a,b, feedback=""):\n res = a is not b\n if not res and feedback == "":\n feedback = "Expected %s to not be the same object as %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertIsNone(self,x, feedback=""):\n res = x is None\n if not res and feedback == "":\n feedback = "Expected %s to be None" % (str(x))\n self.appendResult(res, x, None, feedback)\n\n def assertIsNotNone(self,x, feedback=""):\n res = x is not None\n if not res and feedback == "":\n feedback = "Expected %s to not be None" % (str(x))\n self.appendResult(res, x, None, feedback)\n\n def assertIn(self, a, b, feedback=""):\n res = a in b\n if not res and feedback == "":\n feedback = "Expected %s to be in %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertNotIn(self, a, b, feedback=""):\n res = a not in b\n if not res and feedback == "":\n feedback = "Expected %s to not be in %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertIsInstance(self,a,b, feedback=""):\n res = isinstance(a,b)\n if not res and feedback == "":\n feedback = "Expected %s to be an instance of %s" % (str(a), str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertNotIsInstance(self,a,b, feedback=""):\n res = not isinstance(a,b)\n if not res and feedback == "":\n feedback = "Expected %s to not be an instance of %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertRegex(self, text, expected_regex, feedback=""):\n """Fail the test unless the text matches the regular expression."""\n if isinstance(expected_regex, (str, )): #bytes\n assert expected_regex, "expected_regex must not be empty."\n expected_regex = re.compile(expected_regex)\n if not expected_regex.search(text):\n res = False\n if feedback == "":\n feedback = "Regex didn\'t match: %r not found in %r" % (\n repr(expected_regex), text)\n else:\n res = True\n self.appendResult(res, text, expected_regex, feedback)\n\n def assertNotRegex(self, text, unexpected_regex, feedback=""):\n """Fail the test if the text matches the regular expression."""\n if isinstance(unexpected_regex, (str, )): # bytes\n unexpected_regex = re.compile(unexpected_regex)\n match = unexpected_regex.search(text)\n if match:\n feedback = \'Regex matched: %r matches %r in %r\' % (\n text[match.start() : match.end()],\n repr(unexpected_regex),\n text)\n # _formatMessage ensures the longMessage option is respected\n self.appendResult(not bool(match), text, unexpected_regex, feedback)\n\n def assertAlmostEqual(self, a, b, places=7, feedback="", delta=None):\n\n if delta is not None:\n res = abs(a-b) <= delta\n else:\n if places is None:\n places = 7\n res = round(a-b, places) == 0\n \n if not res and feedback == "":\n feedback = "Expected %s to equal %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertNotAlmostEqual(self, a, b, places=7, feedback="", delta=None):\n\n if delta is not None:\n res = not (a == b) and abs(a - b) > delta\n else:\n if places is None:\n places = 7\n\n res = round(a-b, places) != 0\n\n if not res and feedback == "":\n feedback = "Expected %s to not equal %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertGreater(self,a,b, feedback=""):\n res = a > b\n if not res and feedback == "":\n feedback = "Expected %s to be greater than %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertGreaterEqual(self,a,b, feedback=""):\n res = a >= b\n if not res and feedback == "":\n feedback = "Expected %s to be >= %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertLess(self, a, b, feedback=""):\n res = a < b\n if not res and feedback == "":\n feedback = "Expected %s to be less than %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertLessEqual(self,a,b, feedback=""):\n res = a <= b\n if not res and feedback == "":\n feedback = "Expected %s to be <= %s" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def appendResult(self,res,actual,expected,feedback):\n if res:\n msg = \'Pass\'\n self.assertPassed += 1\n else:\n msg = \'Fail: \' + feedback\n print(msg)\n self.assertFailed += 1\n\n def assertRaises(self, expected_exception, *args, **kwargs):\n context = _AssertRaisesContext(expected_exception, self)\n try:\n return context.handle(\'assertRaises\', args, kwargs)\n finally:\n # bpo-23890: manually break a reference cycle\n context = None\n\n def assertRaisesRegex(self, expected_exception, expected_regex,\n *args, **kwargs):\n context = _AssertRaisesContext(expected_exception, self, expected_regex)\n return context.handle(\'assertRaisesRegex\', args, kwargs)\n\n def fail(self, msg=None):\n if msg is None:\n msg = \'Fail\'\n else:\n msg = \'Fail: \' + msg\n print(msg)\n self.assertFailed += 1\n\n def showSummary(self):\n # don\'t divde by zero\n # pct = self.numPassed / (self.numPassed+self.numFailed) * 100\n print("Ran %d tests, passed: %d failed: %d\\n" % (self.numPassed+self.numFailed,\n self.numPassed, self.numFailed))\n\n\n\ndef main(verbosity=1):\n glob = globals() # globals() still needs work\n for name in glob:\n if type(glob[name]) == type and issubclass(glob[name], TestCase):\n try:\n tc = glob[name]()\n tc.verbosity = verbosity\n tc.main()\n except:\n print("Uncaught Error in: ", name)\n',"src/lib/unittest/gui.py":'import document\nfrom unittest import TestCase\nfrom urllib.request import urlopen\nfrom time import sleep\n\n\nclass TestCaseGui(TestCase):\n def __init__(self):\n TestCase.__init__(self)\n self.closestDiv = document.currentDiv()\n self.divid = document.currentGradingContainer()\n self.mydiv = document.getElementById(self.divid)\n # If there is no div then create a dummy to avoid errors when running\n # grading "off screen"\n if self.mydiv is None:\n self.mydiv = document.createElement("div")\n self.mydiv.id = self.divid + "_offscreen_unit_results"\n self.mydiv.style.display = "none"\n body = document.getElementsByTagName("body")[0]\n body.appendChild(self.mydiv)\n self.unit_results_divid = self.divid + "_offscreen_unit_results"\n\n res = document.getElementById(self.divid + "_unit_results")\n if res:\n self.resdiv = res\n res.innerHTML = ""\n self.unit_results_divid = self.divid + "_unit_results"\n else:\n self.resdiv = document.createElement("div")\n self.resdiv.id = self.divid + "_unit_results"\n self.resdiv.classList.add("unittest-results")\n self.mydiv.appendChild(self.resdiv)\n self.unit_results_divid = self.divid + "_unit_results"\n\n def main(self):\n t = document.createElement("table")\n self.resTable = t\n x = self.resdiv.closest(".timedComponent")\n if x:\n self.is_timed = True\n else:\n self.is_timed = False\n self.resdiv.appendChild(self.resTable)\n if self.is_timed:\n self.resdiv.style.display = "none"\n\n headers = ["Result", "Actual Value", "Expected Value", "Notes"]\n row = document.createElement("tr")\n for item in headers:\n head = document.createElement("th")\n head.classList.add("ac-feedback")\n head.innerHTML = item\n head.style.textAlign = "center"\n row.appendChild(head)\n self.resTable.appendChild(row)\n\n for func in self.tlist:\n try:\n self.setUp()\n func()\n self.tearDown()\n except Exception as e:\n self.appendResult("Error", None, None, str(e).split("on line")[0])\n self.numFailed += 1\n self.showSummary()\n\n def getOutput(self):\n sleep(0.2)\n # self.divid will be the gradingWrapper when in grading mode\n if self.closestDiv != self.divid:\n output = document.querySelector(\n "#{} #{}_stdout".format(self.divid, self.closestDiv)\n )\n else:\n output = document.getElementById(self.divid + "_stdout")\n return output.innerText\n\n def getEditorText(self):\n return document.getCurrentEditorValue()\n\n def appendResult(self, res, actual, expected, param):\n trimActual = False\n if len(str(actual)) > 15:\n trimActual = True\n actualType = type(actual)\n trimExpected = False\n if len(str(expected)) > 15:\n trimExpected = True\n expectedType = type(expected)\n row = document.createElement("tr")\n err = False\n if res == "Error":\n err = True\n msg = "Error: %s" % param\n errorData = document.createElement("td")\n errorData.classList.add("ac-feedback")\n errorData.innerHTML = "ERROR"\n errorData.style.backgroundColor = "#de8e96"\n errorData.style.textAlign = "center"\n row.appendChild(errorData)\n elif res:\n passed = document.createElement("td")\n passed.classList.add("ac-feedback")\n passed.innerHTML = "Pass"\n passed.style.backgroundColor = "#83d382"\n passed.style.textAlign = "center"\n row.appendChild(passed)\n self.numPassed += 1\n else:\n fail = document.createElement("td")\n fail.classList.add("ac-feedback")\n fail.innerHTML = "Fail"\n fail.style.backgroundColor = "#de8e96"\n fail.style.textAlign = "center"\n row.appendChild(fail)\n self.numFailed += 1\n\n act = document.createElement("td")\n act.classList.add("ac-feedback")\n if trimActual:\n actHTML = str(actual)[:5] + "..." + str(actual)[-5:]\n if actualType == str:\n actHTML = repr(actHTML)\n act.innerHTML = actHTML\n else:\n act.innerHTML = repr(actual)\n act.style.textAlign = "center"\n row.appendChild(act)\n\n expect = document.createElement("td")\n expect.classList.add("ac-feedback")\n\n if trimExpected:\n expectedHTML = str(expected)[:5] + "..." + str(expected)[-5:]\n if expectedType == str:\n expectedHTML = repr(expectedHTML)\n expect.innerHTML = expectedHTML\n else:\n expect.innerHTML = repr(expected)\n expect.style.textAlign = "center"\n row.appendChild(expect)\n inp = document.createElement("td")\n inp.classList.add("ac-feedback")\n\n if err:\n inp.innerHTML = msg\n else:\n inp.innerHTML = param\n inp.style.textAlign = "center"\n row.appendChild(inp)\n\n def foo(evt):\n document.popup(expandmsg)\n\n if trimActual or trimExpected:\n expandbutton = document.createElement("button")\n expandbutton.innerHTML = "Expand Differences"\n expandmsg = "Actual: " + str(actual) + "\\nExpected: " + str(expected)\n expandbutton.value = expandmsg\n expandbutton.type = "button"\n expandbutton.addEventListener("click", foo)\n expandbutton.classList.add("btn", "btn-info")\n row.appendChild(expandbutton)\n\n self.resTable.appendChild(row)\n\n def showSummary(self):\n pct = float(self.numPassed) / (self.numPassed + self.numFailed) * 100\n pctcorrect = (\n "percent:"\n + str(pct)\n + ":passed:"\n + str(self.numPassed)\n + ":failed:"\n + str(self.numFailed)\n )\n pTag = document.createElement("p")\n if not self.is_timed:\n pTag.innerHTML = "You passed: " + str(pct) + "% of the tests"\n self.resdiv.appendChild(pTag)\n try:\n jseval(\n "window.componentMap[\'{}\'].pct_correct = {}".format(\n self.closestDiv, pct\n )\n )\n jseval(\n "window.componentMap[\'{}\'].unit_results = \'{}\'".format(\n self.closestDiv, pctcorrect\n )\n )\n jseval(\n "window.componentMap[\'{}\'].unit_results_divid = \'{}\'".format(\n self.closestDiv, self.mydiv.getAttribute("id")\n )\n )\n\n except:\n print(\n "failed to find object to record unittest results in {}! {}".format(\n self.closestDiv, pctcorrect\n )\n )\n',"src/lib/urllib2.py":'import _sk_fail; _sk_fail._("urllib2")\n',"src/lib/urlparse.py":'import _sk_fail; _sk_fail._("urlparse")\n',"src/lib/user.py":'import _sk_fail; _sk_fail._("user")\n',"src/lib/uu.py":'import _sk_fail; _sk_fail._("uu")\n',"src/lib/warnings.py":'import _sk_fail; _sk_fail._("warnings")\n',"src/lib/wave.py":'import _sk_fail; _sk_fail._("wave")\n',"src/lib/weakref.py":'import _sk_fail; _sk_fail._("weakref")\n',"src/lib/whichdb.py":'import _sk_fail; _sk_fail._("whichdb")\n',"src/lib/wsgiref/__init__.py":'import _sk_fail; _sk_fail._("wsgiref")\n',"src/lib/xdrlib.py":'import _sk_fail; _sk_fail._("xdrlib")\n',"src/lib/xml/__init__.py":'import _sk_fail; _sk_fail._("xml")\n',"src/lib/xml/dom/__init__.py":'import _sk_fail; _sk_fail._("dom")\n',"src/lib/xml/etree/__init__.py":'import _sk_fail; _sk_fail._("etree")\n',"src/lib/xml/parsers/__init__.py":'import _sk_fail; _sk_fail._("parsers")\n',"src/lib/xml/sax/__init__.py":'import _sk_fail; _sk_fail._("sax")\n',"src/lib/xmllib.py":'import _sk_fail; _sk_fail._("xmllib")\n',"src/lib/xmlrpclib.py":'import _sk_fail; _sk_fail._("xmlrpclib")\n',"src/lib/zipfile.py":'import _sk_fail; _sk_fail._("zipfile")\n',"src/builtin/sys.js":'var $builtinmodule=function(i){var t,n={},e=[],u=Sk.getSysArgv();for(t=0;t<u.length;++t)e.push(new Sk.builtin.str(u[t]));n.argv=new Sk.builtins.list(e),n.copyright=new Sk.builtin.str("Copyright 2009-2010 Scott Graham.\\nAll Rights Reserved.\\n"),Sk.__future__.python3?(n.version=new Sk.builtin.str("3.7(ish) [Skulpt]"),n.version_info=new Sk.builtin.tuple([new Sk.builtin.int_(3),new Sk.builtin.int_(7)])):(n.version=new Sk.builtin.str("2.7(ish) [Skulpt]"),n.version_info=new Sk.builtin.tuple([new Sk.builtin.int_(2),new Sk.builtin.int_(7)])),n.maxint=new Sk.builtin.int_(Math.pow(2,53)-1),n.maxsize=new Sk.builtin.int_(Math.pow(2,53)-1),n.modules=Sk.sysmodules,n.path=Sk.realsyspath,n.getdefaultencoding=new Sk.builtin.func((()=>new Sk.builtin.str("utf-8"))),n.getExecutionLimit=new Sk.builtin.func((function(){return null===Sk.execLimit?Sk.builtin.none.none$:new Sk.builtin.int_(Sk.execLimit)})),n.setExecutionLimit=new Sk.builtin.func((function(i){if(null===Sk.execLimit)throw new Sk.builtin.NotImplementedError("Execution limiting is not enabled");void 0!==i&&(Sk.execLimit=Sk.builtin.asnum$(i))})),n.resetTimeout=new Sk.builtin.func((function(){Sk.execStart=new Date})),n.getYieldLimit=new Sk.builtin.func((function(){return null===Sk.yieldLimit?Sk.builtin.none.none$:new Sk.builtin.int_(Sk.yieldLimit)})),n.setYieldLimit=new Sk.builtin.func((function(i){if(null===Sk.yieldLimit)throw new Sk.builtin.NotImplementedError("Yielding is not enabled");void 0!==i&&(Sk.yieldLimit=Sk.builtin.asnum$(i))})),n.debug=new Sk.builtin.func((function(){return Sk.builtin.none.none$}));const s=Sk.builtin.make_structseq("sys","float_info",{max:"DBL_MAX -- maximum representable finite float",max_exp:"DBL_MAX_EXP -- maximum int e such that radix**(e-1) is representable",max_10_exp:"DBL_MAX_10_EXP -- maximum int e such that 10**e is representable",min:"DBL_MIN -- Minimum positive normalized float",min_exp:"DBL_MIN_EXP -- minimum int e such that radix**(e-1) is a normalized float",min_10_exp:"DBL_MIN_10_EXP -- minimum int e such that 10**e is a normalized",dig:"DBL_DIG -- digits",mant_dig:"DBL_MANT_DIG -- mantissa digits",epsilon:"DBL_EPSILON -- Difference between 1 and the next representable float",radix:"FLT_RADIX -- radix of exponent",rounds:"FLT_ROUNDS -- rounding mode"});n.float_info=new s([Number.MAX_VALUE,Math.floor(Math.log2(Number.MAX_VALUE)),Math.floor(Math.log10(Number.MAX_VALUE)),Number.MIN_VALUE,Math.ceil(Math.log2(Number.MIN_VALUE)),Math.ceil(Math.log10(Number.MIN_VALUE)),15,Math.log2(Number.MAX_SAFE_INTEGER),Number.EPSILON,2,1].map((i=>Sk.ffi.remapToPy(i))));const o=Sk.builtin.make_structseq("sys","int_info",{bits_per_digit:"size of a digit in bits",sizeof_digit:"size in bytes of the C type used to represent a digit"});n.int_info=new o([30,4].map((i=>Sk.ffi.remapToPy(i))));const l=Sk.builtin.make_structseq("sys","hash_info",{width:"width of the type used for hashing, in bits",modulus:"prime number giving the modulus on which the hash function is based",inf:"value to be used for hash of a positive infinity",nan:"value to be used for hash of a nan",imag:"multiplier used for the imaginary part of a complex number",algorithm:"name of the algorithm for hashing of str, bytes and memoryviews",hash_bits:"internal output size of hash algorithm",seed_bits:"seed size of hash algorithm",cutoff:"small string optimization cutoff"});return n.hash_info=new l([32,536870911,314159,0,1000003,"siphash24",32,128,0].map((i=>Sk.ffi.remapToPy(i)))),n.__stdout__=new Sk.builtin.file(new Sk.builtin.str("/dev/stdout"),new Sk.builtin.str("w")),n.__stdin__=new Sk.builtin.file(new Sk.builtin.str("/dev/stdin"),new Sk.builtin.str("r")),n.__stderr__=new Sk.builtin.file(new Sk.builtin.str("/dev/stderr"),new Sk.builtin.str("w")),n.stdout=n.__stdout__,n.stdin=n.__stdin__,n.stderr=n.__stderr__,n};',"src/lib/JoBase.js":'const $builtinmodule=()=>{Sk.misceval.print_("Welcome to JoBase\\n");const e=Sk.JoBase,o={},t=[],r=[],n=e.getContext("webgl"),a=n.createProgram(),c=n.createBuffer(),i=n.createShader(n.VERTEX_SHADER),s=n.createShader(n.FRAGMENT_SHADER),str=e=>new Sk.builtin.str(e),def=e=>new Sk.builtin.func(e),float=e=>new Sk.builtin.float_(e),int=e=>new Sk.builtin.int_(e),bool=e=>new Sk.builtin.bool(e),tuple=e=>new Sk.builtin.tuple(e),number=e=>{if(Sk.builtin.checkNumber(e))return e.v;throw new Sk.builtin.TypeError("must be real number, not "+e.tp$name)},string=e=>{if(Sk.builtin.checkString(e))return e.v;throw new Sk.builtin.TypeError("must be str, not "+e.tp$name)},property=(...e)=>call(Sk.builtins.property,...e),build=(...e)=>Sk.misceval.buildClass(o,...e),call=(...e)=>Sk.misceval.callsimOrSuspend(...e),is=(...e)=>Sk.builtin.isinstance(...e).v,wait=e=>Sk.misceval.promiseToSuspension(new Promise(e)),object=e=>{throw new Sk.builtin.TypeError("must be Shape or cursor, not "+e.tp$name)},path=e=>str("https://jobase.org/Browser/JoBase/"+e),width=()=>e.width/devicePixelRatio,height=()=>e.height/devicePixelRatio,x=()=>o.cursor.$x-width()/2,y=()=>height()/2-o.cursor.$y,blank=()=>{},mouseEnter=()=>o.cursor.$enter=!0,mouseLeave=()=>o.cursor.$leave=!0,mouseDown=()=>{o.cursor.$press=!0,o.cursor.$hold=!0},mouseUp=()=>{o.cursor.$release=!0,o.cursor.$hold=!1},mouseMove=t=>{const r=e.getBoundingClientRect();o.cursor.$x=t.clientX-r.left,o.cursor.$y=t.clientY-r.top,o.cursor.$move=!0},keyDown=e=>{const t=Object.keys(o.key.$data).find((t=>o.key.$data[t].code==e.code)),r=o.key.$data[t];e.repeat?(o.key.$repeat=!0,r&&(r.repeat=!0)):(o.key.$press=!0,r&&(r.press=!0)&&(r.hold=!0))},keyUp=e=>{const t=Object.keys(o.key.$data).find((t=>o.key.$data[t].code==e.code)),r=o.key.$data[t];o.key.$release=!0,r&&(r.release=!0)&&(r.hold=!1)},collidePolyPoint=(e,o)=>e.reduce(((e,t,r,n)=>{const a=n[r+1==n.length?0:r+1];return o[0]<(a[0]-t[0])*(o[1]-t[1])/(a[1]-t[1])+t[0]&&(t[1]>o[1]&&a[1]<o[1]||t[1]<o[1]&&a[1]>o[1])?!e:e}),!1),getRectPoly=e=>{const o=e.$anchor[0]+e.$size[0]*e.$scale[0]/2,t=e.$anchor[1]+e.$size[1]*e.$scale[1]/2;return((e,o,t)=>{const r=Math.cos(o*Math.PI/180),n=Math.sin(o*Math.PI/180);return e.map((e=>[e[0]*r-e[1]*n+t[0],e[0]*n+e[1]*r+t[1]]))})([[-o,t],[o,t],[o,-t],[-o,-t]],e.$angle,e.$pos)},createImage=e=>{const o=n.createTexture();return n.bindTexture(n.TEXTURE_2D,o),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),o},renderText=e=>{const o=document.createElement("canvas"),t=o.getContext("2d"),a=e.$fontSize+"px _"+r.indexOf(e.$font);t.font=a;const c=t.measureText(e.$content),i=c.actualBoundingBoxRight-c.actualBoundingBoxLeft,s=t.measureText("Sy"),d=s.actualBoundingBoxDescent+s.actualBoundingBoxAscent;e.$size[0]=o.width=i,e.$size[1]=o.height=d,t.font=a,t.fillStyle="#fff",t.fillText(e.$content,0,s.actualBoundingBoxAscent),n.deleteTexture(e.$texture),e.$texture=createImage(o)},loadFont=e=>new Promise(((o,t)=>{if(r.includes(e))return o();new FontFace("_"+r.length,`url(${e})`).load().then((t=>{document.fonts.add(t),r.push(e),o()})).catch((()=>{return t((o=`failed to load font: "${e}"`,new Sk.builtin.FileNotFoundError(o)));var o}))})),drawShape=(e,o,t,r,c,i)=>{const s=o[0]*e.$scale[0],d=o[1]*e.$scale[1],l=e.$anchor[0],u=e.$anchor[1],$=e.$pos[0],p=e.$pos[1],m=Math.sin(e.$angle*Math.PI/180),f=Math.cos(e.$angle*Math.PI/180);var h,_;h=[s*f,s*m,0,0,d*-m,d*f,0,0,0,0,1,0,l*f+u*-m+$,l*m+u*f+p,0,1],_=e.$color,n.uniform4fv(n.getUniformLocation(a,"color"),new Float32Array(_)),n.uniformMatrix4fv(n.getUniformLocation(a,"object"),!1,new Float32Array(h)),n.bindBuffer(n.ARRAY_BUFFER,t),n.uniform1i(n.getUniformLocation(a,"image"),c),n.drawArrays(r,0,i)},d=def(((e,t)=>{if(is(e,o.Rectangle)){if(is(t,o.Rectangle))return bool((r=getRectPoly(e),n=getRectPoly(t),collidePolyPoint(r,n[0])||collidePolyPoint(n,r[0])||r.find(((e,o,t)=>((e,o,t)=>e.find(((e,r,n)=>((e,o,t,r)=>{const n=(r[1]-t[1])*(o[0]-e[0])-(r[0]-t[0])*(o[1]-e[1]),a=((r[0]-t[0])*(e[1]-t[1])-(r[1]-t[1])*(e[0]-t[0]))/n,c=((o[0]-e[0])*(e[1]-t[1])-(o[1]-e[1])*(e[0]-t[0]))/n;return a>=0&&a<=1&&c>=0&&c<=1})(o,t,e,n[r+1==n.length?0:r+1]))))(n,e,t[o+1==t.length?0:o+1])))));if(t==o.cursor)return bool(collidePolyPoint(getRectPoly(e),[x(),y()]));object(t)}var r,n;if(e==o.cursor){if(is(t,o.Rectangle))return bool(collidePolyPoint(getRectPoly(t),[x(),y()]));if(t==o.cursor)return Sk.builtins.bool.true$;object(t)}object(e)})),l={set:(e,o)=>{if(e.ob$type==l.class)o.forEach(((o,t,r)=>r[t]=t<e.$data.length?e.$get()[t]:o));else{if(!Sk.builtin.checkSequence(e))throw new Sk.builtins.TypeError("attribute must be a sequence of values");o.forEach(((o,t,r)=>r[t]=t<e.v.length?e.v[t].v:o))}return o},new:(e,o,...t)=>{const r=call(l.class);return r.$parent=e,r.$get=o,r.$data=t.map((e=>({name:e[0],set:e[1]}))),r},class:build(((e,o)=>{o.__getattr__=def(((e,o)=>{const t=e.$data.findIndex((e=>e.name==o.v));if(-1!=t)return float(e.$get()[t])})),o.__setattr__=def(((e,o,t)=>{const r=e.$data.find((e=>e.name==o.v));r&&r.set(e.$parent,t)})),o.__str__=def((e=>str(`(${e.$get().join(", ")})`))),o.__repr__=def((e=>str(`[${e.$get().join(", ")}]`)))}),"Vector")},u={new:(e,o,t,r,n)=>{e.$color=l.set(n,[0,0,0,1]),e.$pos=[number(o),number(t)],e.$angle=number(r),e.$anchor=[0,0],e.$scale=[1,1]},class:build(((e,t)=>{t.collides_with=d,t.look_at=def(((e,t)=>{const set=(o,t)=>{const r=Math.atan2(t-e.$pos[1],o-e.$pos[0]);e.$angle=180*r/Math.PI};t==o.cursor?set(x(),y()):is(t,u.class)?set(...t.$pos):object(t)})),t.move_toward=def(((e,t,r)=>{const n=number(r)??1,set=(o,t)=>{const r=o-e.$pos[0],a=t-e.$pos[1];Math.hypot(r,a)<n?(e.$pos[0]+=r,e.$pos[1]+=a):(e.$pos[0]+=Math.cos(Math.atan2(a,r))*n,e.$pos[1]+=Math.sin(Math.atan2(a,r))*n)};t==o.cursor?set(x(),y()):is(t,u.class)?set(...t.$pos):object(t)}));const x=(e,o)=>e.$pos[0]=number(o),y=(e,o)=>e.$pos[1]=number(o);t.x=property(def((e=>float(e.$pos[0]))),def(x)),t.y=property(def((e=>float(e.$pos[1]))),def(y)),t.pos=t.position=property(def((e=>l.new(e,(()=>e.$pos),["x",x],["y",y]))),def(((e,o)=>l.set(o,e.$pos)))),t.top=property(def((e=>float(e.$top()))),def(((e,o)=>e.$pos[1]+=o-e.$top()))),t.left=property(def((e=>float(e.$left()))),def(((e,o)=>e.$pos[0]+=o-e.$left()))),t.bottom=property(def((e=>float(e.$bottom()))),def(((e,o)=>e.$pos[1]+=o-e.$bottom()))),t.right=property(def((e=>float(e.$right()))),def(((e,o)=>e.$pos[0]+=o-e.$right())));const scaleX=(e,o)=>e.$scale[0]=number(o),scaleY=(e,o)=>e.$scale[1]=number(o);t.scale=property(def((e=>l.new(e,(()=>e.$scale),["x",scaleX],["y",scaleY]))),def(((e,o)=>l.set(o,e.$scale))));const anchorX=(e,o)=>e.$anchor[0]=number(o),anchorY=(e,o)=>e.$anchor[1]=number(o);t.anchor=property(def((e=>l.new(e,(()=>e.$anchor),["x",anchorX],["y",anchorY]))),def(((e,o)=>l.set(o,e.$anchor)))),t.angle=property(def((e=>float(e.$angle))),def(((e,o)=>e.$angle=number(o))));const red=(e,o)=>e.$color[0]=number(o),green=(e,o)=>e.$color[1]=number(o),blue=(e,o)=>e.$color[2]=number(o),alpha=(e,o)=>e.$color[3]=number(o);t.red=property(def((e=>float(e.$color[0]))),def(red)),t.green=property(def((e=>float(e.$color[1]))),def(green)),t.blue=property(def((e=>float(e.$color[2]))),def(blue)),t.blue=property(def((e=>float(e.$color[3]))),def(alpha)),t.color=property(def((e=>l.new(e,(()=>e.$color),["red",red],["green",green],["blue",blue],["alpha",alpha]))),def(((e,o)=>l.set(o,e.$color))))}),"Shape")};return o.MAN=path("images/man.png"),o.COIN=path("images/coin.png"),o.ENEMY=path("images/enemy.png"),o.DEFAULT=path("fonts/default.ttf"),o.CODE=path("fonts/code.ttf"),o.PENCIL=path("fonts/pencil.ttf"),o.SERIF=path("fonts/serif.ttf"),o.HANDWRITING=path("fonts/handwriting.ttf"),o.TYPEWRITER=path("fonts/typewriter.ttf"),o.JOINED=path("fonts/joined.ttf"),o.window=call(build(((e,o)=>{const init=(e,o,t,r,a)=>{e.$caption=string(o),e.$color=l.set(a,[1,1,1]),n.clearColor(...e.$color,1)};init.$defaults=[str("JoBase"),null,null,tuple()],init.co_varnames=["self","caption","width","height","color"],o.__init__=def(init),o.close=def((e=>e.$close=!0)),o.maximize=def(blank),o.minimize=def(blank),o.focus=def(blank),o.caption=property(def((e=>str(e.$caption))),def(((e,o)=>e.$caption=string(o))));const red=(e,o)=>{e.$color[0]=number(o),n.clearColor(...e.$color,1)},green=(e,o)=>{e.$color[1]=number(o),n.clearColor(...e.$color,1)},blue=(e,o)=>{e.$color[2]=number(o),n.clearColor(...e.$color,1)};o.red=property(def((e=>float(e.$color[0]))),def(red)),o.green=property(def((e=>float(e.$color[1]))),def(green)),o.blue=property(def((e=>float(e.$color[2]))),def(blue)),o.color=property(def((e=>l.new(e,(()=>e.$color),["red",red],["green",green],["blue",blue]))),def(((e,o)=>n.clearColor(...l.set(o,e.$color),1)))),o.width=property(def((()=>float(width())))),o.height=property(def((()=>float(height())))),o.size=property(def((e=>l.new(e,(()=>[width(),height()]),["x",blank],["y",blank]))),def(((e,o)=>l.set(o,new Array(2))))),o.top=property(def((()=>float(height()/2)))),o.bottom=property(def((()=>float(height()/-2)))),o.left=property(def((()=>float(width()/-2)))),o.right=property(def((()=>float(width()/2)))),o.resize=property(def((e=>bool(e.$resize))))}),"Window")),o.cursor=call(build(((e,o)=>{o.x=property(def((()=>float(x())))),o.y=property(def((()=>float(y())))),o.pos=o.position=property(def((e=>l.new(e,(()=>[x(),y()]),["x",blank],["y",blank]))),def(((e,o)=>l.set(o,new Array(2))))),o.move=property(def((e=>bool(e.$move)))),o.enter=property(def((e=>bool(e.$enter)))),o.leave=property(def((e=>bool(e.$leave)))),o.press=property(def((e=>bool(e.$press)))),o.release=property(def((e=>bool(e.$release)))),o.hold=property(def((e=>bool(e.$hold))))}),"Cursor")),o.cursor.$x=0,o.cursor.$y=0,o.key=call(build(((e,o)=>{o.__getattr__=def(((e,o)=>{const t=e.$data[o.v];if(t)return t.hold||t.release?(r=[str("press"),bool(t.press),str("release"),bool(t.release),str("repeat"),bool(t.repeat)],new Sk.builtin.dict(r)):Sk.builtin.bool.false$;var r})),o.hold=property(def((e=>{for(const o in e.$data)if(e.$data[o].hold)return Sk.builtin.bool.true$;return Sk.builtin.bool.false$}))),o.press=property(def((e=>bool(e.$press)))),o.release=property(def((e=>bool(e.$release)))),o.repeat=property(def((e=>bool(e.$repeat))))}),"Key")),o.key.$data={space:{code:"Space"},apostrophe:{code:"Quote"},comma:{code:"Comma"},minus:{code:"Minus"},period:{code:"Period"},slash:{code:"Slash"},_0:{code:"Digit0"},_1:{code:"Digit1"},_2:{code:"Digit2"},_3:{code:"Digit3"},_4:{code:"Digit4"},_5:{code:"Digit5"},_6:{code:"Digit6"},_7:{code:"Digit7"},_8:{code:"Digit8"},_9:{code:"Digit9"},semicolon:{code:"Semicolon"},equal:{code:"Equal"},a:{code:"KeyA"},b:{code:"KeyB"},c:{code:"KeyC"},d:{code:"KeyD"},e:{code:"KeyE"},f:{code:"KeyF"},g:{code:"KeyG"},h:{code:"KeyH"},i:{code:"KeyI"},j:{code:"KeyJ"},k:{code:"KeyK"},l:{code:"KeyL"},m:{code:"KeyM"},n:{code:"KeyN"},o:{code:"KeyO"},p:{code:"KeyP"},q:{code:"KeyQ"},r:{code:"KeyR"},s:{code:"KeyS"},t:{code:"KeyT"},u:{code:"KeyU"},v:{code:"KeyV"},w:{code:"KeyW"},x:{code:"KeyX"},y:{code:"KeyY"},z:{code:"KeyZ"},left_bracket:{code:"BracketLeft"},backslash:{code:"Backslash"},right_bracket:{code:"BracketRight"},backquote:{code:"Backquote"},escape:{code:"Escape"},enter:{code:"Enter"},tab:{code:"Tab"},backspace:{code:"Backspace"},insert:{code:"Insert"},delete:{code:"Delete"},right:{code:"ArrowRight"},left:{code:"ArrowLeft"},down:{code:"ArrowDown"},up:{code:"ArrowUp"},page_up:{code:"PageUp"},page_down:{code:"PageDown"},home:{code:"Home"},end:{code:"End"},caps_lock:{code:"CapsLock"},scroll_lock:{code:"ScrollLock"},num_lock:{code:"NumLock"},print_screen:{code:"PrintScreen"},pause:{code:"Pause"},f1:{code:"F1"},f2:{code:"F2"},f3:{code:"F3"},f4:{code:"F4"},f5:{code:"F5"},f6:{code:"F6"},f7:{code:"F7"},f8:{code:"F8"},f9:{code:"F9"},f10:{code:"F10"},f11:{code:"F11"},f12:{code:"F12"},f13:{code:"F13"},f14:{code:"F14"},f15:{code:"F15"},f16:{code:"F16"},f17:{code:"F17"},f18:{code:"F18"},f19:{code:"F19"},f20:{code:"F20"},f21:{code:"F21"},f22:{code:"F22"},f23:{code:"F23"},f24:{code:"F24"},f25:{code:"F25"},pad_0:{code:"Numpad0"},pad_1:{code:"Numpad1"},pad_2:{code:"Numpad2"},pad_3:{code:"Numpad3"},pad_4:{code:"Numpad4"},pad_5:{code:"Numpad5"},pad_6:{code:"Numpad6"},pad_7:{code:"Numpad7"},pad_8:{code:"Numpad8"},pad_9:{code:"Numpad9"},decimal:{code:"NumpadDecimal"},divide:{code:"NumpadDivide"},multiply:{code:"NumpadMultiply"},subtract:{code:"NumpadSubtract"},add:{code:"NumpadAdd"},enter:{code:"NumpadEnter"},equal:{code:"NumpadEqual"},left_shift:{code:"ShiftLeft"},left_ctrl:{code:"ControlLeft"},left_alt:{code:"AltLeft"},left_super:{code:"SuperLeft"},right_shift:{code:"ShiftRight"},right_ctrl:{code:"ControlRight"},right_alt:{code:"AltRight"},right_super:{code:"SuperRight"},menu:{code:"Menu"}},o.camera=call(build(((e,o)=>{const init=(e,o,t)=>{e.$pos=[number(o),number(t)]};init.$defaults=[int(),int()],init.co_varnames=["self","x","y"],o.__init__=def(init);const x=(e,o)=>e.$pos[0]=number(o),y=(e,o)=>e.$pos[1]=number(o);o.x=property(def((e=>float(e.$pos[0]))),def(x)),o.y=property(def((e=>float(e.$pos[1]))),def(y)),o.pos=o.position=property(def((e=>l.new(e,(()=>e.$pos),["x",x],["y",y]))),def(((e,o)=>l.set(o,e.$pos))))}),"Camera")),o.Rectangle=build(((e,o)=>{const init=(e,o,t,r,n,a,c)=>{u.new(e,o,t,a,c),e.$size=[number(r),number(n)],e.$top=()=>{return(o=getRectPoly(e)).reduce(((e,o)=>o[1]>e?o[1]:e),o[0][1]);var o},e.$left=()=>{return(o=getRectPoly(e)).reduce(((e,o)=>o[0]<e?o[0]:e),o[0][0]);var o},e.$bottom=()=>{return(o=getRectPoly(e)).reduce(((e,o)=>o[1]<e?o[1]:e),o[0][1]);var o},e.$right=()=>{return(o=getRectPoly(e)).reduce(((e,o)=>o[0]>e?o[0]:e),o[0][0]);var o}};init.$defaults=[int(),int(),int(50),int(50),int(),tuple()],init.co_varnames=["self","x","y","width","height","angle","color"],o.__init__=def(init),o.draw=def((e=>drawShape(e,e.$size,c,n.TRIANGLE_STRIP,!1,4)));const width=(e,o)=>e.$size[0]=number(o),height=(e,o)=>e.$size[1]=number(o);o.width=property(def((e=>float(e.$size[0]))),def(width)),o.height=property(def((e=>float(e.$size[1]))),def(height)),o.size=property(def((e=>l.new(e,(()=>e.$size),["width",width],["height",height]))),def(((e,o)=>l.set(o,e.$size))))}),"Rectangle",[u.class]),o.Image=build(((e,r)=>{const init=(e,r,n,a,c,i,s,d)=>wait(((u,$)=>{call(o.Rectangle.prototype.__init__,e,n,a,i,s,c);const p=t.find((e=>e.name==string(r))),set=o=>{e.$texture=o.source,e.$size[0]||=o.width,e.$size[1]||=o.height};if(e.$color=l.set(d,[1,1,1,1]),p)return set(p),u();const m=new Image;m.crossOrigin="anonymous",m.src=string(r),m.onerror=()=>$(new Sk.builtin.FileNotFoundError(`failed to load image: "${string(r)}"`)),m.onload=()=>{const e={name:string(r),width:m.width,height:m.height,source:createImage(m)};t.push(e),set(e),u()}}));init.$defaults=[o.MAN,int(),int(),int(),int(),int(),tuple()],init.co_varnames=["self","name","x","y","angle","width","height","color"],r.__init__=def(init),r.draw=def((e=>{n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e.$texture),drawShape(e,e.$size,c,n.TRIANGLE_STRIP,!0,4)}))}),"Image",[o.Rectangle]),o.Text=build(((e,t)=>{const init=(e,t,r,n,a,c,i,s)=>wait(((d,l)=>{call(o.Rectangle.prototype.__init__,e,r,n,int(),int(),c,i),e.$font=string(s),e.$fontSize=number(a),e.$content=string(t),loadFont(e.$font).then((()=>{renderText(e),d()})).catch(l)}));init.$defaults=[str("Text"),int(),int(),int(50),int(),tuple(),o.DEFAULT],init.co_varnames=["self","content","x","y","font_size","angle","color","font"],t.__init__=def(init),t.draw=def((e=>{n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e.$texture),drawShape(e,e.$size,c,n.TRIANGLE_STRIP,!0,4)})),t.content=property(def((e=>str(e.$content))),def(((e,o)=>{e.$content=string(o),renderText(e)}))),t.font=property(def((e=>str(e.$font))),def(((e,o)=>wait(((t,r)=>{loadFont(e.$font=string(o)).then((()=>{renderText(e),t()})).catch(r)}))))),t.font_size=property(def((e=>float(e.$font_size))),def(((e,o)=>{e.$font_size=number(o),renderText(e)})))}),"Text",[o.Rectangle]),o.random=def(((e,o)=>{const t=Math.min(number(e),number(o));return float(Math.random()*(Math.max(number(e),number(o))-t)+t)})),o.run=def((()=>wait(((r,i)=>{const update=()=>{const final=o=>{n.deleteBuffer(c),n.deleteProgram(a),t.forEach((e=>n.deleteTexture(e.source))),d.disconnect(),e.removeEventListener("mouseenter",mouseEnter),e.removeEventListener("mouseleave",mouseLeave),e.removeEventListener("mousedown",mouseDown),e.removeEventListener("mouseup",mouseUp),e.removeEventListener("mousemove",mouseMove),e.removeEventListener("keydown",keyDown),e.removeEventListener("keyup",keyUp),cancelAnimationFrame(s.frame),o?i(o):r()};if(o.window.$close||Date.now()-Sk.execStart>Sk.execLimit)return final();const l=o.camera.$pos[0],u=o.camera.$pos[1],$=new Float32Array([2/width(),0,0,0,0,2/height(),0,0,0,0,-2,0,2*-l/width(),2*-u/height(),-1,1]);n.uniformMatrix4fv(n.getUniformLocation(a,"camera"),!1,$),n.clear(n.COLOR_BUFFER_BIT);try{s.main.$d.loop&&call(s.main.$d.loop)}catch(p){final(p)}o.window.$resize=!1,o.cursor.$move=!1,o.cursor.$enter=!1,o.cursor.$leave=!1,o.cursor.$press=!1,o.cursor.$release=!1,o.key.$press=!1,o.key.$release=!1,o.key.$repeat=!1;for(const e in o.key.$data)o.key.$data[e].press=!1,o.key.$data[e].release=!1,o.key.$data[e].repeat=!1},loop=()=>{s.frame=requestAnimationFrame(loop),update()},s={main:Sk.importModule("__main__",!1,!0),frame:requestAnimationFrame(loop)},d=new MutationObserver((()=>{n.viewport(0,0,e.width,e.height),o.window.$resize=!0,update()}));d.observe(e,{attributes:!0})})))),e.addEventListener("mouseenter",mouseEnter),e.addEventListener("mouseleave",mouseLeave),e.addEventListener("mousedown",mouseDown),e.addEventListener("mouseup",mouseUp),e.addEventListener("mousemove",mouseMove),e.addEventListener("keydown",keyDown),e.addEventListener("keyup",keyUp),e.tabIndex=0,e.focus(),n.shaderSource(i,"\\n attribute vec2 vertex;\\n attribute vec2 coordinate;\\n varying vec2 position;\\n \\n uniform mat4 camera;\\n uniform mat4 object;\\n \\n void main(void) {\\n gl_Position = camera * object * vec4(vertex, 0, 1);\\n position = coordinate;\\n }"),n.shaderSource(s,"\\n precision mediump float;\\n varying vec2 position;\\n\\n uniform vec4 color;\\n uniform sampler2D sampler;\\n uniform int image;\\n\\n void main(void) {\\n if (image == 1) gl_FragColor = texture2D(sampler, position) * color;\\n else gl_FragColor = color;\\n }"),n.compileShader(i),n.compileShader(s),n.attachShader(a,i),n.attachShader(a,s),n.linkProgram(a),n.useProgram(a),n.uniform1i(n.getUniformLocation(a,"sampler"),0),n.deleteShader(i),n.deleteShader(s),n.bindBuffer(n.ARRAY_BUFFER,c),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-.5,.5,0,0,.5,.5,1,0,-.5,-.5,0,1,.5,-.5,1,1]),n.STATIC_DRAW),n.vertexAttribPointer(n.getAttribLocation(a,"vertex"),2,n.FLOAT,!1,16,0),n.vertexAttribPointer(n.getAttribLocation(a,"coordinate"),2,n.FLOAT,!1,16,8),n.enableVertexAttribArray(0),n.enableVertexAttribArray(1),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),n.pixelStorei(n.UNPACK_ALIGNMENT,1),o};',"src/lib/_random.js":'var MersenneTwister=function(n){null==n&&(n=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(n)};MersenneTwister.prototype.init_genrand=function(n){for(this.mt[0]=n>>>0,this.mti=1;this.mti<this.N;this.mti++)n=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30,this.mt[this.mti]=(1812433253*((4294901760&n)>>>16)<<16)+1812433253*(65535&n)+this.mti,this.mt[this.mti]>>>=0},MersenneTwister.prototype.init_by_array=function(n,t){var i,e,r;for(this.init_genrand(19650218),i=1,e=0,r=this.N>t?this.N:t;r;r--){var u=this.mt[i-1]^this.mt[i-1]>>>30;this.mt[i]=(this.mt[i]^(1664525*((4294901760&u)>>>16)<<16)+1664525*(65535&u))+n[e]+e,this.mt[i]>>>=0,e++,++i>=this.N&&(this.mt[0]=this.mt[this.N-1],i=1),e>=t&&(e=0)}for(r=this.N-1;r;r--){u=this.mt[i-1]^this.mt[i-1]>>>30;this.mt[i]=(this.mt[i]^(1566083941*((4294901760&u)>>>16)<<16)+1566083941*(65535&u))-i,this.mt[i]>>>=0,++i>=this.N&&(this.mt[0]=this.mt[this.N-1],i=1)}this.mt[0]=2147483648},MersenneTwister.prototype.genrand_int32=function(){var n,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var i;for(this.mti==this.N+1&&this.init_genrand(5489),i=0;i<this.N-this.M;i++)n=this.mt[i]&this.UPPER_MASK|this.mt[i+1]&this.LOWER_MASK,this.mt[i]=this.mt[i+this.M]^n>>>1^t[1&n];for(;i<this.N-1;i++)n=this.mt[i]&this.UPPER_MASK|this.mt[i+1]&this.LOWER_MASK,this.mt[i]=this.mt[i+(this.M-this.N)]^n>>>1^t[1&n];n=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^n>>>1^t[1&n],this.mti=0}return n=this.mt[this.mti++],n^=n>>>11,n^=n<<7&2636928640,n^=n<<15&4022730752,(n^=n>>>18)>>>0},MersenneTwister.prototype.genrand_int31=function(){return this.genrand_int32()>>>1},MersenneTwister.prototype.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)},MersenneTwister.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},MersenneTwister.prototype.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)},MersenneTwister.prototype.genrand_res53=function(){return(67108864*(this.genrand_int32()>>>5)+(this.genrand_int32()>>>6))*(1/9007199254740992)};var $builtinmodule=function(n){var t={},i=new MersenneTwister,e=void 0;t.seed=new Sk.builtin.func((function(n){return Sk.builtin.pyCheckArgsLen("seed",arguments.length,0,1),n=Sk.builtin.asnum$(n),i=arguments.length>0?new MersenneTwister(n):new MersenneTwister,Sk.builtin.none.none$})),t.random=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen("random",arguments.length,0,0),new Sk.builtin.float_(i.genrand_res53())}));var toInt=function(n){return 0|n},randrange=function(n,t,e){var r,u,s;if(!Sk.builtin.checkInt(n))throw new Sk.builtin.ValueError("non-integer first argument for randrange()");if(void 0===t)return s=toInt(i.genrand_res53()*n),new Sk.builtin.int_(s);if(!Sk.builtin.checkInt(t))throw new Sk.builtin.ValueError("non-integer stop for randrange()");if(void 0===e&&(e=1),r=t-n,1==e&&r>0)return s=n+toInt(i.genrand_res53()*r),new Sk.builtin.int_(s);if(1==e)throw new Sk.builtin.ValueError("empty range for randrange() ("+n+", "+t+", "+r+")");if(!Sk.builtin.checkInt(e))throw new Sk.builtin.ValueError("non-integer step for randrange()");if(e>0)u=toInt((r+e-1)/e);else{if(!(e<0))throw new Sk.builtin.ValueError("zero step for randrange()");u=toInt((r+e+1)/e)}if(u<=0)throw new Sk.builtin.ValueError("empty range for randrange()");return s=n+e*toInt(i.genrand_res53()*u),new Sk.builtin.int_(s)};t.randint=new Sk.builtin.func((function(n,t){return Sk.builtin.pyCheckArgsLen("randint",arguments.length,2,2),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t),randrange(n,t+1)})),t.randrange=new Sk.builtin.func((function(n,t,i){return Sk.builtin.pyCheckArgsLen("randrange",arguments.length,1,3),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t),i=Sk.builtin.asnum$(i),randrange(n,t,i)})),t.uniform=new Sk.builtin.func((function(n,t){Sk.builtin.pyCheckArgsLen("uniform",arguments.length,2,2),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t);const e=n+i.genrand_res53()*(t-n);return new Sk.builtin.float_(e)})),t.triangular=new Sk.builtin.func((function(n,t,e){var r,u,s;return Sk.builtin.pyCheckArgsLen("triangular",arguments.length,2,3),Sk.builtin.pyCheckType("low","number",Sk.builtin.checkNumber(n)),Sk.builtin.pyCheckType("high","number",Sk.builtin.checkNumber(t)),(n=Sk.builtin.asnum$(n))>(t=Sk.builtin.asnum$(t))&&(s=n,n=t,t=s),void 0===e||e===Sk.builtin.none.none$?e=(t-n)/2:(Sk.builtin.pyCheckType("mode","number",Sk.builtin.checkNumber(e)),e=Sk.builtin.asnum$(e)),u=(r=i.genrand_res53())<(e-n)/(t-n)?n+Math.sqrt(r*(t-n)*(e-n)):t-Math.sqrt((1-r)*(t-n)*(t-e)),new Sk.builtin.float_(u)}));var normalSample=function(n,t){var r,u,s,h,l;return void 0!==e?(l=e,e=void 0):(r=i.genrand_res53(),u=i.genrand_res53(),s=Math.sqrt(-2*Math.log(r)),h=2*Math.PI*u,l=s*Math.cos(h),e=s*Math.sin(h)),n+t*l};return t.gauss=new Sk.builtin.func((function(n,t){return Sk.builtin.pyCheckArgsLen("gauss",arguments.length,2,2),Sk.builtin.pyCheckType("mu","number",Sk.builtin.checkNumber(n)),Sk.builtin.pyCheckType("sigma","number",Sk.builtin.checkNumber(t)),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t),new Sk.builtin.float_(normalSample(n,t))})),t.normalvariate=t.gauss,t.lognormvariate=new Sk.builtin.func((function(n,t){return Sk.builtin.pyCheckArgsLen("lognormvariate",arguments.length,2,2),Sk.builtin.pyCheckType("mu","number",Sk.builtin.checkNumber(n)),Sk.builtin.pyCheckType("sigma","number",Sk.builtin.checkNumber(t)),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t),new Sk.builtin.float_(Math.exp(normalSample(n,t)))})),t.expovariate=new Sk.builtin.func((function(n){Sk.builtin.pyCheckArgsLen("expovariate",arguments.length,1,1),Sk.builtin.pyCheckType("lambd","number",Sk.builtin.checkNumber(n)),n=Sk.builtin.asnum$(n);var t=i.genrand_res53();return new Sk.builtin.float_(-Math.log(t)/n)})),t.choice=new Sk.builtin.func((function(n){if(Sk.builtin.pyCheckArgsLen("choice",arguments.length,1,1),Sk.builtin.pyCheckType("seq","sequence",Sk.builtin.checkSequence(n)),void 0!==n.sq$length){var t=new Sk.builtin.int_(toInt(i.genrand_res53()*n.sq$length()));return n.mp$subscript(t)}throw new Sk.builtin.TypeError("object has no length")})),t.shuffle=new Sk.builtin.func((function(n){if(Sk.builtin.pyCheckArgsLen("shuffle",arguments.length,1,1),Sk.builtin.pyCheckType("x","sequence",Sk.builtin.checkSequence(n)),n.constructor===Sk.builtin.list){const u=n.v;for(var t=u.length-1;t>0;t-=1){var e=u[r=toInt(i.genrand_res53()*(t+1))];u[r]=u[t],u[t]=e}}else{if(void 0===n.sq$length)throw new Sk.builtin.TypeError("object has no length");if(void 0===n.mp$ass_subscript)throw new Sk.builtin.TypeError("object is immutable");for(t=n.sq$length()-1;t>0;t-=1){var r=new Sk.builtin.int_(toInt(i.genrand_res53()*(t+1)));t=new Sk.builtin.int_(t);e=n.mp$subscript(r);n.mp$ass_subscript(r,n.mp$subscript(t)),n.mp$ass_subscript(t,e)}}return Sk.builtin.none.none$})),t.sample=new Sk.builtin.func((function(n,t){var e,r,u,s,h;for(Sk.builtin.pyCheckArgsLen("sample",arguments.length,2,2),Sk.builtin.pyCheckType("population","iterable",Sk.builtin.checkIterable(n)),Sk.builtin.pyCheckType("k","integer",Sk.builtin.checkInt(t)),t=Sk.builtin.asnum$(t),h=[],e=0,s=(u=Sk.abstr.iter(n)).tp$iternext();void 0!==s;e++,s=u.tp$iternext())r=Math.floor(i.genrand_res53()*(e+1)),e<t?(r<e&&(h[e]=h[r]),h[r]=s):r<t&&(h[r]=s);if(e<t)throw new Sk.builtin.ValueError("sample larger than population");return new Sk.builtin.list(h)})),t};',"src/lib/_strptime.js":'function $builtinmodule(){const e=Sk.builtin.int_,t=Sk.builtin.none.none$,i=Sk.builtin.str,s=Sk.builtin.tuple,n=Sk.misceval.callsimOrSuspendArray,{isTrue:a,richCompareBool:r,chain:l}=Sk.misceval,{typeName:o,setUpModuleMethods:_,buildNativeClass:c}=Sk.abstr,{TypeError:m,ValueError:d,KeyError:h,IndexError:f,checkString:u,asnum$:w}=Sk.builtin,{remapToPy:p,remapToJs:g}=Sk.ffi,{getAttr:$,setAttr:y}=Sk.generic,S=l,k=/^[0-9]+$/;function _as_integer(e){if(!k.test(e))throw new d(`invalid literal for int() with base 10: \'${e}\'`);return parseInt(e)}const b=/([\\\\.^$*+?\\(\\){}\\[\\]|])/g,v=/\\s+/g;let O=Sk.importModule("time",!1,!0),z=Sk.importModule("datetime",!1,!0);const L=S(z,(e=>(z=e.$d,O)),(e=>{O=e.$d}));return S(L,(()=>{function _strftime(e){return t=>e.$strftime(t).toString().toLowerCase()}function _strftime_timetuple(e,t){return O.strftime.tp$call([new i(e),t]).toString().toLowerCase()}const l=new i("fromordinal");function _struct_time(t){return O.struct_time.tp$call([new s(t.map((t=>new e(t))))])}function _localized_month(){const e=[()=>""];for(let t=0;t<12;t++){const i=new k(2001,t+1,1);e.push(_strftime(i))}return e}function _localized_day(){const e=[];for(let t=0;t<7;t++){const i=new k(2001,1,t+1);e.push(_strftime(i))}return e}const S={__name__:new i("_strptime")},k=z.date,L=z.timedelta,E=z.timezone;function _getlang(){return[t,t]}class LocaleTime{constructor(){this.lang=_getlang(),this.__calc_weekday(),this.__calc_month(),this.__calc_am_pm(),this.__calc_timezone(),this.__calc_date_time()}__calc_weekday(){this.a_weekday=_localized_day().map((e=>e("%a"))),this.f_weekday=_localized_day().map((e=>e("%A")))}__calc_month(){this.a_month=_localized_month().map((e=>e("%b"))),this.f_month=_localized_month().map((e=>e("%B")))}__calc_am_pm(){const e=[];[1,22].forEach((t=>{const i=_strftime_timetuple("%p",_struct_time([1999,3,17,t,44,55,2,76,0]));e.push(i)})),this.am_pm=e}__calc_date_time(){const e=_struct_time([1999,3,17,22,44,55,2,76,0]),i=[t,t,t];i[0]=_strftime_timetuple("%c",e),i[1]=_strftime_timetuple("%x",e),i[2]=_strftime_timetuple("%X",e);const s=[["%","%%"],[this.f_weekday[2],"%A"],[this.f_month[3],"%B"],[this.a_weekday[2],"%a"],[this.a_month[3],"%b"],[this.am_pm[1],"%p"],["1999","%Y"],["99","%y"],["22","%H"],["44","%M"],["55","%S"],["76","%j"],["17","%d"],["03","%m"],["3","%m"],["2","%w"],["10","%I"]];s.push(...this.timezone.flat().map((e=>[e,"%Z"]))),[[0,"%c"],[1,"%x"],[2,"%X"]].forEach((([e,t])=>{let n=i[e];s.forEach((([e,t])=>{e&&(n=n.replace(e,t))}));let a;a=_strftime_timetuple(t,_struct_time([1999,1,3,1,1,1,6,3,0])).includes("00")?"%W":"%U",i[e]=n.replace("11",a)})),this.LC_date_time=i[0],this.LC_date=i[1],this.LC_time=i[2]}__calc_timezone(){try{O.tzset.tp$call([])}catch{}this.tzname=O.tzname.v.map((e=>e.toString())),this.daylight=w(O.daylight);const e=[this.tzname[0].toLowerCase(),"utc","gmt"];let t;t=this.daylight?[this.tzname[1].toLowerCase()]:[],this.timezone=[e,t]}}class TimeRE{constructor(e=null){this.locale_time=e||new LocaleTime,Object.assign(this,{d:"(?<d>3[0-1]|[1-2]\\\\d|0[1-9]|[1-9]| [1-9])",f:"(?<f>[0-9]{1,6})",H:"(?<H>2[0-3]|[0-1]\\\\d|\\\\d)",I:"(?<I>1[0-2]|0[1-9]|[1-9])",G:"(?<G>\\\\d\\\\d\\\\d\\\\d)",j:"(?<j>36[0-6]|3[0-5]\\\\d|[1-2]\\\\d\\\\d|0[1-9]\\\\d|00[1-9]|[1-9]\\\\d|0[1-9]|[1-9])",m:"(?<m>1[0-2]|0[1-9]|[1-9])",M:"(?<M>[0-5]\\\\d|\\\\d)",S:"(?<S>6[0-1]|[0-5]\\\\d|\\\\d)",U:"(?<U>5[0-3]|[0-4]\\\\d|\\\\d)",w:"(?<w>[0-6])",u:"(?<u>[1-7])",V:"(?<V>5[0-3]|0[1-9]|[1-4]\\\\d|\\\\d)",y:"(?<y>\\\\d\\\\d)",Y:"(?<Y>\\\\d\\\\d\\\\d\\\\d)",z:"(?<z>[+-]\\\\d\\\\d:?[0-5]\\\\d(:?[0-5]\\\\d(\\\\.\\\\d{1,6})?)?|Z)",A:this.__seqToRE(this.locale_time.f_weekday,"A"),a:this.__seqToRE(this.locale_time.a_weekday,"a"),B:this.__seqToRE(this.locale_time.f_month.slice(1),"B"),b:this.__seqToRE(this.locale_time.a_month.slice(1),"b"),p:this.__seqToRE(this.locale_time.am_pm,"p"),Z:this.__seqToRE(this.locale_time.timezone.flat(),"Z"),"%":"%"}),this.W=this.U.replace("U","W"),this.x=this.pattern(this.locale_time.LC_date),this.X=this.pattern(this.locale_time.LC_time),this.c=this.pattern(this.locale_time.LC_date_time)}__seqToRE(e,t){if((e=e.slice(0).sort(((e,t)=>t.length-e.length))).every((e=>""===e)))return"";return`(?<${t}>${e.map((e=>e)).join("|")})`}pattern(e){let t="";for(e=(e=e.replace(b,"\\\\$1")).replace(v,"\\\\s+");e.includes("%");){const i=e.indexOf("%")+1,s=this[e[i]];if(void 0===s)throw new h(e[i]);t=`${t}${e.slice(0,i-1)}${s}`,e=e.slice(i+1)}return t+e}compile(e){return new RegExp("^"+this.pattern(e),"i")}}let C=new TimeRE;const T=5;let A={};function _strptime(i,s="%a %b %d %H:%M:%S %Y"){function _checkString(e,t){if("string"!=typeof e&&!u(e))throw new m(`strptime() argument ${t} must be a str, not \'${o(e)}\'`)}_checkString(i,0),_checkString(s,1),i=i.toString(),s=s.toString();let n,_=C.locale_time;if(Object.keys(A).length>T&&(A={}),n=A[s],void 0===n)try{n=C.compile(s)}catch(V){if(V instanceof h){let e=V.args.v[0];throw"\\\\"==e&&(e="%"),new d(`\'${e}\' is a bad directive in format \'${s}\'`)}if(V instanceof f)throw new d("stray %% in format \'"+s+"\'");throw V}const c=i.match(n);if(null===c)throw new d(`time data \'${i}\' does not match format \'${s}\'`);if(i.length!==c[0].length)throw new d(`unconverted data remains: ${i.slice(c[0].length)}`);let w=t,p=t,g=1,$=1,y=0,S=0,b=0,v=0,z=-1,L=t,E=0,I=t,M=t,H=t,Y=t,j=t,U=c.groups||{};if(Object.keys(U).forEach((e=>{if(void 0!==U[e])if("y"===e)p=_as_integer(U.y),p+=p<=68?2e3:1900;else if("Y"===e)p=_as_integer(U.Y);else if("G"===e)w=_as_integer(U.G);else if("m"===e)g=_as_integer(U.m);else if("B"===e)g=_.f_month.indexOf(U.B.toLowerCase());else if("b"===e)g=_.a_month.indexOf(U.b.toLowerCase());else if("d"===e)$=_as_integer(U.d);else if("H"===e)y=_as_integer(U.H);else if("H"===e)y=_as_integer(U.H);else if("I"===e){y=_as_integer(U.I);const e=(U.p||"").toLowerCase();["",_.am_pm[0]].includes(e)?12===y&&(y=0):e===_.am_pm[1]&&12!==y&&(y+=12)}else if("M"===e)S=_as_integer(U.M);else if("S"===e)b=_as_integer(U.S);else if("f"===e){let e=U.f;e+="0".repeat(6-e.length),v=_as_integer(e)}else if("A"===e)Y=_.f_weekday.indexOf(U.A.toLowerCase());else if("a"===e)Y=_.a_weekday.indexOf(U.a.toLowerCase());else if("w"===e)Y=_as_integer(U.w),0===Y?Y=6:Y-=1;else if("u"===e)Y=_as_integer(U.u),Y-=1;else if("j"===e)j=_as_integer(U.j);else if(["U","W"].includes(e))M=_as_integer(U[e]),H="U"===e?6:0;else if("V"===e)I=_as_integer(U.V);else if("z"===e){let e=U.z;if("Z"===e)L=0;else{if(":"===e[3]&&(e=e.slice(0,3)+e.slice(4),e.length>5)){if(":"!==e[5]){const e=`Inconsistent use of : in ${U.z}`;throw new d(e)}e=e.slice(0,5)+e.slice(6)}const t=_as_integer(e.slice(1,3)),i=_as_integer(e.slice(3,5)),s=_as_integer(e.slice(5,7)||0);L=3600*t+60*i+s;const n=e.slice(8),a="0".repeat(6-n.length);E=_as_integer(n+a),e.startsWith("-")&&(L=-L,E=-E)}}else if("Z"===e){let e=U.Z.toLowerCase(),t=0;for(let i of _.timezone){if(i.includes(e)){const i=O.tzname.v;if(r(i[0],i[1],"Eq")&&a(O.daylight)&&!["utc","gmt"].includes(e))break;z=t}t++}}})),p===t&&w!==t){if(I===t||Y===t)throw new d("ISO year directive \'%G\' must be used with the ISO week directive \'%V\' and a weekday directive (\'%A\',\'%a\', \'%w\', or \'%u\').");if(j!==t)throw new d("Day of the year directive \'%j\' is not compatible with ISO year directive \'%G\'.Use \'%Y\' instead.")}else if(M===t&&I!==t)throw new d(Y===t?"ISO week directive \'%V\' must be used with the ISO year directive \'%G\' and a weekday directive (\'%A\', \'%a\', \'%w\', or \'%u\').":"ISO week directive \'%V\' is incompatible with the year directive \'%Y\'. Use the ISO year \'%G\' instead.");let x=!1;if(p===t&&2===g&&29===$?(p=1904,x=!0):p===t&&(p=1900),j===t&&Y!==t){if(M!==t){j=function _calc_julian_from_U_or_W(e,t,i,s){let n=(new k(e,1,1).$toOrdinal()+6)%7;return s||(n=(n+1)%7,i=(i+1)%7),0===t?1+i-n:(7-n)%7+7*(t-1)+1+i}(p,M,Y,0===H)}else w!==t&&I!==t&&([p,j]=function _calc_julian_from_V(e,t,i){let s=7*t+i-((new k(e,1,4).$toOrdinal()%7||7)+3);return s<1&&(s+=new k(e,1,1).$toOrdinal(),s-=new k(e-=1,1,1).$toOrdinal()),[e,s]}(w,I,Y+1));if(j!==t&&j<=0){p-=1;const e=function _is_leap(e){return e%4==0&&(e%100!=0||e%400==0)}(p)?366:365;j+=e}}if(j===t)j=new k(p,g,$).$toOrdinal()-new k(p,1,1).$toOrdinal()+1;else{const t=function _fromordinal(t){return k.tp$getattr(l).tp$call([new e(t)])}(j-1+new k(p,1,1).$toOrdinal());p=t.$year,g=t.$month,$=t.$day}Y===t&&(Y=(new k(p,g,$).$toOrdinal()+6)%7);const R=U.Z||t;return x&&(p=1900),[[p,g,$,y,S,b,Y,j,z,R,L],v,E]}return _("_strptime",S,{_strptime_time:{$meth:function _strptime_time(t,i="%a %b %d %H:%M:%S %Y"){let n=_strptime(t,i)[0].slice(0,11);return n=n.map(((t,i)=>i<9?new e(t):p(t))),O.struct_time.tp$call([new s(n)])},$flags:{NamedArgs:["data_string","format"],Defaults:["%a %b %d %H:%M:%S %Y"]}},_strptime_datetime:{$meth:function _strptime_datetime(s,r,l="%a %b %d %H:%M:%S %Y"){const[o,_,c]=_strptime(r,l),[m,d]=o.slice(-2),h=o.slice(0,6);let f,u;return h.push(_),h.map((t=>new e(t))),d!==t&&(f=new L(0,d,c),u=a(m)?new E(f,new i(m)):new E(f),h.push(u)),n(s,h)},$flags:{NamedArgs:["cls","data_string","format"],Defaults:["%a %b %d %H:%M:%S %Y"]}},_strptime:{$meth(i,n){const a=_strptime(i,n);return a[0]=new s(a[0].map((i=>i===t?i:new e(i)))),a[1]=new e(a[1]),a[2]=new e(a[2]),new s(a)},$flags:{NamedArgs:["data_string","format"],Defaults:["%a %b %d %H:%M:%S %Y"]}},_getlang:{$meth:()=>p(_getlang()),$flags:{NoArgs:!0}}}),S.LocaleTime=c("_strptime.LocaleTime",{constructor:function(){this.v=new LocaleTime},slots:{tp$getattr(e,t){return this.v.hasOwnProperty(e.toString())?p(this.v[e.toString()]):$.call(this,e,t)},tp$setattr(e,t){if(!this.v.hasOwnProperty(e.toString()))return y.call(this,e,t);this.v[e.toString()]=g(t)}}}),S}))}',"src/lib/altair/vega_caller.js":'var $builtinmodule=function(e){var n={__file__:"/src/lib/vega_caller.js"};return n.__package__=Sk.builtin.none.none$,n.render_graph=new Sk.builtin.func((function(e){Sk.builtin.pyCheckArgs("render_graph",arguments,1,1);let n="#"+Sk.divid+"_graphics";try{vegaEmbed(n,Sk.ffi.remapToJs(e),{actions:!0})}catch(i){throw new Sk.builtin.Exception("Error in graph specification unable to render the graph\\n"+i.message)}})),n};',"src/lib/array.js":'function $builtinmodule(e){var n={},t=["c","b","B","u","h","H","i","I","l","L","f","d"];return n.__name__=new Sk.builtin.str("array"),n.array=Sk.misceval.buildClass(n,(function(e,n){n.__init__=new Sk.builtin.func((function(e,n,i){if(Sk.builtin.pyCheckArgsLen("__init__",arguments.length,2,3),-1==t.indexOf(Sk.ffi.remapToJs(n)))throw new Sk.builtin.ValueError("bad typecode (must be c, b, B, u, h, H, i, I, l, L, f or d)");if(i&&!Sk.builtin.checkIterable(i))throw new Sk.builtin.TypeError("iteration over non-sequence");if(e.$d.mp$ass_subscript(new Sk.builtin.str("typecode"),n),e.$d.mp$ass_subscript(new Sk.builtin.str("__module__"),new Sk.builtin.str("array")),e.typecode=n,void 0===i)e.internalIterable=new Sk.builtin.list;else if(i instanceof Sk.builtin.list)e.internalIterable=i;else{e.internalIterable=new Sk.builtin.list;for(let n=Sk.abstr.iter(i),t=n.tp$iternext();void 0!==t;t=n.tp$iternext())Sk.misceval.callsimArray(e.internalIterable.append,[e.internalIterable,t])}})),n.__repr__=new Sk.builtin.func((function(e){var n=Sk.ffi.remapToJs(e.typecode),t="";return Sk.ffi.remapToJs(e.internalIterable).length&&(t="c"==Sk.ffi.remapToJs(e.typecode)?", \'"+Sk.ffi.remapToJs(e.internalIterable).join("")+"\'":", "+Sk.ffi.remapToJs(Sk.misceval.callsimArray(e.internalIterable.__repr__,[e.internalIterable]))),new Sk.builtin.str("array(\'"+n+"\'"+t+")")})),n.__str__=n.__repr__,n.__getattribute__=new Sk.builtin.func((function(e,n){return e.tp$getattr(n)})),n.append=new Sk.builtin.func((function(e,n){return Sk.misceval.callsimArray(e.internalIterable.append,[e.internalIterable,n]),Sk.builtin.none.none$})),n.extend=new Sk.builtin.func((function(e,n){if(Sk.builtin.pyCheckArgsLen("__init__",arguments.length,2,2),!Sk.builtin.checkIterable(n))throw new Sk.builtin.TypeError("iteration over non-sequence");for(let t=Sk.abstr.iter(n),i=t.tp$iternext();void 0!==i;i=t.tp$iternext())Sk.misceval.callsimArray(e.internalIterable.append,[e.internalIterable,i])}))}),"array",[]),n}',"src/lib/calendar.js":'function $builtinmodule(e){const t={},{misceval:{chain:n},importModule:r}=Sk,importOrSuspend=e=>r(e,!1,!0);return n(importOrSuspend("datetime"),(e=>(t.datetime=e,importOrSuspend("itertools"))),(e=>(t.iterRepeat=e.$d.repeat,t.iterChain=e.$d.chain,calendarModule(t))))}function calendarModule(e){const{abstr:{setUpModuleMethods:t,numberBinOp:n,iter:r,objectGetItem:o},builtin:{bool:s,bool:{true$:m,false$:d},func:l,int_:i,list:c,none:{none$:f},str:h,slice:w,tuple:y,range:u,max:_,min:g,property:k,print:p,enumerate:$,ValueError:b},ffi:{remapToPy:M},misceval:{isTrue:T,iterator:C,arrayFromIterable:O,buildClass:L,richCompareBool:x,asIndexOrThrow:F,objectRepr:I,callsimArray:A},global:v,global:{strftime:E}}=Sk,S=new i(0),H=new i(1),D=new i(2),N=new i(3),R=new i(6),j=new i(7),J=new i(9),P=new i(12),Y=new i(13),U=new i(24),z=new i(60),le=(e,t)=>x(e,t,"LtE"),eq=(e,t)=>x(e,t,"Eq"),mod=(e,t)=>n(e,t,"Mod"),add=(e,t)=>n(e,t,"Add"),sub=(e,t)=>n(e,t,"Sub"),mul=(e,t)=>n(e,t,"Mult"),inc=e=>add(e,H),dec=e=>sub(e,H),mod7=e=>mod(e,j),getA=(e,t)=>e.tp$getattr(new h(t)),callA=(e,t,...n)=>A(e.tp$getattr(new h(t)),n);function*iterJs(e){const t=r(e);let n;for(;n=t.tp$iternext();)yield n}function iterFn(e,t){return e=r(e),new C((()=>{const n=e.tp$iternext();return n&&t(n)}),!0)}function makePyMethod(e,t,{args:n,name:r,doc:o,defaults:s}){t.co_varnames=["self",...n||[]],t.co_docstring=o?new h(o):f,s&&(t.$defaults=s),t.co_name=new h(r),t.co_qualname=new h(e+"."+r);const m=new l(t);return m.$module=Q.__name__,m}const{datetime:B,iterRepeat:W,iterChain:q}=e;let{MINYEAR:G,MAXYEAR:X,date:V}=B.$d;const K=getA(h,"center"),pyCenter=(e,t)=>A(K,[e,t]),pyRStrip=e=>new h(e.toString().trimRight());G=G.valueOf(),X=X.valueOf();const Q={__name__:new h("calendar"),__all__:M(["IllegalMonthError","IllegalWeekdayError","setfirstweekday","firstweekday","isleap","leapdays","weekday","monthrange","monthcalendar","prmonth","month","prcal","calendar","timegm","month_name","month_abbr","day_name","day_abbr","Calendar","TextCalendar","HTMLCalendar","LocaleTextCalendar","LocaleHTMLCalendar","weekheader"])};function makeErr(e,t){return L(Q,((e,n)=>{n.__init__=new l((function __init__(e,t){e.$attr=t})),n.__str__=new l((function __str__(e){return new h(t.replace("$",I(e.$attr)))}))}),e,[b])}const Z=makeErr("IllegalMonthError","bad month $; must be 1-12"),ee=makeErr("IllegalWeekdayError","bad weekday number $; must be 0 (Monday) to 6 (Sunday)"),te=1,ae=2,ne=[0,31,28,31,30,31,30,31,31,30,31,30,31];function mkLocalizedCls(e,t){t.__init__=new l((function __init__(e,t){e.format=t})),t.__getitem__=new l((function __getitem__(t,n){const r=o(e,n);if(n instanceof w){const e=[];for(const n of r.valueOf())e.push(A(n,[t.format]));return new c(e)}return A(r,[t.format])}));const n=new i(e.valueOf().length);t.__len__=new l((function __len__(e){return n}))}const re=new h("strftime"),oe=L(Q,((e,t)=>{let n=[new l((e=>h.$empty))];for(let r=0;r<12;r++){const e=new V(2001,r+1,1);n.push(e.tp$getattr(re))}n=new c(n),t._months=n,mkLocalizedCls(n,t)}),"_localized_month"),se=L(Q,((e,t)=>{let n=[];for(let r=0;r<7;r++){const e=new V(2001,1,r+1);n.push(e.tp$getattr(re))}n=new c(n),t._days=n,mkLocalizedCls(n,t)}),"_localized_day"),me=A(se,[new h("%A")]),de=A(se,[new h("%a")]),ie=A(oe,[new h("%B")]),ce=A(oe,[new h("%b")]),[fe,he,we,ye,ue,_e,ge]=[0,1,2,3,4,5,6];function isleap(e){return(e=F(e))%4==0&&(e%100!=0||e%400==0)}function weekday(e,t,n){e=F(e),G<=e&&e<=X||(e=2e3+e%400);const r=A(V,[new i(e),t,n]);return callA(V,"weekday",r)}function monthrange(e,t){if(!le(H,t)||!le(t,P))throw A(Z,[t]);const n=weekday(e,t,H);t=F(t);const r=ne[t]+Number(t===ae&&isleap(e));return[n,new i(r)]}function iterweekdays(e){return iterFn(A(u,[e.fwd,add(e.fwd,j)]),mod7)}function itermonthdates(e,t,n){return iterFn(itermonthdays3(e,t,n),(e=>A(V,e.valueOf())))}function itermonthdays(e,t,n){const[r,o]=monthrange(t,n),s=mod7(sub(r,e.fwd)),m=A(W,[S,s]),d=A(u,[H,inc(o)]),l=mod7(sub(e.fwd,add(r,o))),i=A(W,[S,l]);return A(q,[m,d,i])}function itermonthdays2(e,t,n){return iterFn(A($,[itermonthdays(e,t,n),e.fwd]),(e=>{const[t,n]=e.valueOf();return new y([n,mod7(t)])}))}function itermonthdays3(e,t,n){const ymdIter=(e,t,n)=>iterFn(n,(n=>new y([e,t,n]))),[r,o]=monthrange(t,n),s=mod7(sub(r,e.fwd)),m=mod7(sub(e.fwd,add(r,o))),[d,l]=function _prevmonth(e,t){return eq(t,H)?[dec(e),P]:[e,dec(t)]}(t,n),c=inc(function _monthlen(e,t){return t=F(t),new i(ne[t]+Number(t===ae&&isleap(e)))}(d,l)),f=A(u,[sub(c,s),c]),h=A(u,[H,inc(o)]),[w,_]=function _nextmonth(e,t){return eq(t,P)?[inc(e),H]:[e,inc(t)]}(t,n),g=A(u,[H,inc(m)]);return A(q,[ymdIter(d,l,f),ymdIter(t,n,h),ymdIter(w,_,g)])}function itermonthdays4(e,t,n){const r=itermonthdays3(e,t,n);let o=0;return iterFn(r,(t=>new y([...t.valueOf(),mod7(add(e.fwd,new i(o++)))])))}function _monthIter(e,t,n,r){const o=O(e(t,n,r)),s=[];for(let m=0;m<o.length;m+=7)s.push(new c(o.slice(m,m+7)));return new c(s)}function monthdatescalendar(e,t,n){return _monthIter(itermonthdates,e,t,n)}function monthdays2calendar(e,t,n){return _monthIter(itermonthdays2,e,t,n)}function monthdayscalendar(e,t,n){return _monthIter(itermonthdays,e,t,n)}function _yearIter(e,t,n,r){r=F(r);const o=[];for(let m=te;m<te+12;m++)o.push(e(t,n,new i(m)));const s=[];for(let m=0;m<o.length;m+=r)s.push(new c(o.slice(m,m+r)));return new c(s)}function yeardatescalendar(e,t,n){return _yearIter(monthdatescalendar,e,t,n)}function yeardays2calendar(e,t,n){return _yearIter(monthdays2calendar,e,t,n)}function yeardayscalendar(e,t,n){return _yearIter(monthdayscalendar,e,t,n)}const ke=L(Q,((e,t)=>{const n=makePyMethod.bind(null,"Calendar"),r=["firstweekday"],o=["year","month"],s=["year","width"],m={__init__:n((function __init__(e,t){return Object.defineProperty(e,"fwd",{get(){return mod7(this._fwd)},set(e){return this._fwd=e,!0}}),e.fwd=t,f}),{name:"__init__",args:r,defaults:[S]}),getfirstweekday:n((function getfirstweekday(e){return e.fwd}),{name:"getfirstweekday"}),setfirstweekday:n((function setfirstweekday(e,t){return e.fwd=t,f}),{name:"setfirstweekday",args:r}),iterweekdays:n(iterweekdays,{name:"iterweekdays"}),itermonthdates:n(itermonthdates,{name:"itermonthdates",args:o}),itermonthdays:n(itermonthdays,{name:"itermonthdays",args:o}),itermonthdays2:n(itermonthdays2,{name:"itermonthdays2",args:o}),itermonthdays3:n(itermonthdays3,{name:"itermonthdays3",args:o}),itermonthdays4:n(itermonthdays4,{name:"itermonthdays4",args:o}),monthdatescalendar:n(monthdatescalendar,{name:"monthdatescalendar",args:o}),monthdays2calendar:n(monthdays2calendar,{name:"monthdays2calendar",args:o}),monthdayscalendar:n(monthdayscalendar,{name:"monthdayscalendar",args:o}),yeardatescalendar:n(yeardatescalendar,{name:"yeardatescalendar",args:s,defaults:[N]}),yeardays2calendar:n(yeardays2calendar,{name:"yeardays2calendar",args:s,defaults:[N]}),yeardayscalendar:n(yeardayscalendar,{name:"yeardayscalendar",args:s,defaults:[N]})};m.firstweekday=new k(m.getfirstweekday,m.setfirstweekday),Object.assign(t,m)}),"Calendar");function doTextFormatweekday(e,t,n){let r;return r=x(n,J,"GtE")?me:de,pyCenter(o(o(r,t),new w(f,n)),n)}function doTextFormatmonthname(e,t,n,r,s=!0){let m=o(ie,n);return T(s)&&(m=mod(new h("%s %r"),new y([m,t]))),pyCenter(m,r)}const pe=L(Q,((e,t)=>{const txtPrint=e=>p([e],["end",h.$empty]);const n=doTextFormatweekday;function formatweekheader(e,t){const n=[];for(const r of iterJs(iterweekdays(e)))n.push(callA(e,"formatweekday",r,t).toString());return new h(n.join(" "))}const r=doTextFormatmonthname;const o=makePyMethod.bind(null,"TextCalendar"),s={prweek:o((function prweek(e,t,n){txtPrint(callA(e,"formatweek",t,n))}),{name:"prweek",args:["theweek","width"]}),formatday:o((function formatday(e,t,n,r){let o;return o=eq(t,S)?h.$empty:mod(new h("%2i"),t),pyCenter(o,r)}),{name:"formatday",args:["day","weekday","width"]}),formatweek:o((function formatweek(e,t,n){const r=[];for(const o of iterJs(t)){const[t,s]=o.valueOf();r.push(callA(e,"formatday",t,s,n).toString())}return new h(r.join(" "))}),{name:"formatweek",args:["theweek","width"]}),formatweekday:o(n,{name:"formatweekday",args:["day","width"]}),formatweekheader:o(formatweekheader,{name:"formatweekheader",args:["width"]}),formatmonthname:o(r,{name:"formatmonthname",args:["theyear","themonth","width","withyear"],defaults:[m]}),prmonth:o((function prmonth(e,t,n,r,o){txtPrint(callA(e,"formatmonth",t,n,r,o))}),{name:"prmonth",args:["theyear","themonth","w","l"],defaults:[S,S]}),formatmonth:o((function formatmonth(e,t,n,r,o){const addNewLines=e=>new h(e+"\\n".repeat(o.valueOf()));r=_([D,r]),o=_([H,o]);let s=callA(e,"formatmonthname",t,n,dec(mul(j,inc(r))),!0);s=pyRStrip(s),s=addNewLines(s),s=add(s,pyRStrip(callA(e,"formatweekheader",r))),s=addNewLines(s);for(const m of iterJs(monthdays2calendar(e,t,n)))s=add(s,pyRStrip(callA(e,"formatweek",m,r))),s=addNewLines(s);return s}),{name:"formatmonth",args:["thyear","themonth","w","l"],defaults:[S,S]}),formatyear:o((function formatyear(e,t,n,r,o,s){n=_([D,n]),r=_([H,r]),o=_([D,o]);const m=dec(mul(inc(n),j));let d="";const a=e=>d+=e;a(pyRStrip(pyCenter(t.$r(),add(mul(m,s),mul(o,dec(s)))))),a("\\n".repeat(r));const l=formatweekheader(e,n);let f=0;for(const w of iterJs(yeardays2calendar(e,t,s))){const d=new i(f),y=inc(mul(s,d)),_=g([inc(mul(s,inc(d))),Y]),k=A(u,[y,_]);a("\\n".repeat(r));const p=iterFn(k,(n=>callA(e,"formatmonthname",t,n,m,!1)));a(pyRStrip(formatstring(p,m,o))),a("\\n".repeat(r));const $=iterFn(k,(e=>l));a(pyRStrip(formatstring($,m,o))),a("\\n".repeat(r));const b=Math.max(...w.valueOf().map((e=>e.valueOf().length)));for(let t=0;t<b;t++){const s=[];for(let r of w.valueOf())r=r.valueOf(),t>=r.length?s.push(h.$empty):s.push(callA(e,"formatweek",r[t],n));a(pyRStrip(formatstring(new c(s),m,o))),a("\\n".repeat(r))}f++}return new h(d)}),{name:"formatyear",args:["theyear","w","l","c","m"],defaults:[D,H,R,N]}),pryear:o((function pryear(e,t,n,r,o,s){txtPrint(callA(e,"formatyear",t,n,r,o,s))}),{name:"pryear",args:["theyear","w","l","c","m"],defaults:[S,S,R,N]})};Object.assign(t,s)}),"TextCalendar",[ke]);function doHtmlFormatweekday(e,t){return new h(`<th class="${o(getA(e,"cssclasses_weekday_head"),t)}">${o(de,t)}</th>`)}function doHtmlFormatmonthname(e,t,n,r=!0){let s=""+o(ie,n);return T(r)&&(s+=" "+t),new h(`<tr><th colspan="7" class="${getA(e,"cssclass_month_head")}">${s}</th></tr>`)}const $e=L(Q,((e,t)=>{const n=M(["mon","tue","wed","thu","fri","sat","sun"]),r=n,s=new h("noday"),d=new h("month"),l=d,c=new h("year"),w=c,u=new h(\'<td class="%s">&nbsp;</td>\'),g=new h(\'<td class="%s">%d</td>\');const k=doHtmlFormatweekday;function formatweekheader(e){let t="";for(const n of iterJs(iterweekdays(e)))t+=callA(e,"formatweekday",n);return new h(`<tr>${t}</tr>`)}const p=doHtmlFormatmonthname;const $=makePyMethod.bind(null,"HTMLCalendar"),b={formatday:$((function formatday(e,t,n){return eq(t,S)?mod(u,getA(e,"cssclass_noday")):mod(g,new y([o(getA(e,"cssclasses"),n),t]))}),{name:"formatday",args:["day","weekday"]}),formatweek:$((function formatweek(e,t){let n="";for(const r of iterJs(t)){const[t,o]=r.valueOf();n+=callA(e,"formatday",t,o)}return new h(`<tr>${n}</tr>`)}),{name:"formatweek",args:["theweek"]}),formatweekday:$(k,{name:"formatweekday",args:["day"]}),formatweekheader:$(formatweekheader,{name:"formatweekheader"}),formatmonthname:$(p,{name:"formatmonthname",args:["theyear","themonth","withyear"],defaults:[m]}),formatmonth:$((function formatmonth(e,t,n,r=!0){let o="";const a=e=>o+=e+"\\n";a(`<table border="0" cellpadding="0" cellspacing="0" class="${getA(e,"cssclass_month")}">`),a(callA(e,"formatmonthname",t,n,r)),a(formatweekheader(e));for(const s of iterJs(monthdays2calendar(e,t,n)))a(callA(e,"formatweek",s));return a("</table>"),new h(o)}),{name:"formatmonth",args:["thyear","themonth","withyear"],defaults:[m]}),formatyear:$((function formatyear(e,t,n){let r="";const a=e=>r+=e;n=_([n,H]).valueOf(),a(`<table border="0" cellpadding="0" cellspacing="0" class="${getA(e,"cssclass_year")}">`),a("\\n"),a(`<tr><th colspan="${n}" class="${getA(e,"cssclass_year_head")}">${t}</th></tr>`);for(let o=te;o<te+12;o+=n){a("<tr>");const r=Math.min(o+n,13);for(let n=o;n<r;n++)a("<td>"),a(callA(e,"formatmonth",t,new i(n),!1)),a("</td>");a("</tr>")}return a("</table>"),new h(r)}),{name:"formatyear",args:["theyear","width"],defaults:[N]}),formatyearpage:$((function formatyearpage(e,t,n=3,r="calendar.css",o=null){null!==o&&o!==f||(o=new h("utf-8"));let s="";const a=e=>s+=e;return a(`<?xml version="1.0" encoding="${o}"?>\\n`),a(\'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\\n\'),a("<html>\\n"),a("<head>\\n"),a(`<meta http-equiv="Content-Type" content="text/html; charset=${o}" />\\n`),r!==f&&a(`<link rel="stylesheet" type="text/css" href="${r}" />\\n`),a(`<title>Calendar for ${t}</title>\\n`),a("</head>\\n"),a("<body>\\n"),a(callA(e,"formatyear",t,n)),a("</body>\\n"),a("</html>\\n"),callA(h,"encode",new h(s),o,new h("ignore"))}),{name:"formatyearpage",args:["theyear","width","css","encoding"],defaults:[N,new h("calendar.css"),new h("utf-8")]}),cssclasses:n,cssclasses_weekday_head:r,cssclass_noday:s,cssclass_month_head:d,cssclass_month:l,cssclass_year_head:c,cssclass_year:w};Object.assign(t,b)}),"HTMLCalendar",[ke]);function withLocale(e,t){const n=E.localizeByIdentifier(e.toString());v.strftime=n;try{return t()}finally{v.strftime=E}}function localInit(e,t){T(t)||(t=new h("en_US")),e.locale=t}const be=L(Q,((e,t)=>{const n=makePyMethod.bind(null,"LocaleTextCalendar"),r={__init__:n((function __init__(e,t,n){return callA(pe,"__init__",e,t),localInit(e,n),f}),{name:"__init__",args:["firstweekday","locale"],defaults:[S,f]}),formatweekday:n((function formatweekday(e,t,n){return withLocale(e.locale,(()=>doTextFormatweekday(0,t,n)))}),{name:"formatweekday",args:["day","width"]}),formatmonthname:n((function formatmonthname(e,t,n,r,o){return withLocale(e.locale,(()=>doTextFormatmonthname(0,t,n,r,o)))}),{name:"formatmonthname",args:["theyear","themonth","width","withyear"],defaults:[m]})};Object.assign(t,r)}),"LocaleTextCalendar",[pe]),Me=L(Q,((e,t)=>{const n=makePyMethod.bind(null,"LocaleHTMLCalendar"),r={__init__:n((function __init__(e,t,n){return callA($e,"__init__",e,t),localInit(e,n),f}),{name:"__init__",args:["firstweekday","locale"],defaults:[S,f]}),formatweekday:n((function formatweekday(e,t){return withLocale(e.locale,(()=>doHtmlFormatweekday(e,t)))}),{name:"formatweekday",args:["day"]}),formatmonthname:n((function formatmonthname(e,t,n,r){return withLocale(e.locale,(()=>doHtmlFormatmonthname(e,t,n,r)))}),{name:"formatmonthname",args:["theyear","themonth","withyear"],defaults:[m]})};Object.assign(t,r)}),"LocaleHTMLCalendar",[$e]),Te=A(pe,[]);Object.assign(Q,{IllegalMonthError:Z,IllegalWeekdayError:ee,day_name:me,month_name:ie,day_abbr:de,month_abbr:ce,January:new i(te),February:new i(ae),mdays:M(ne),MONDAY:new i(fe),TUESDAY:new i(he),WEDNESDAY:new i(we),THURSDAY:new i(ye),FRIDAY:new i(ue),SATURDAY:new i(_e),SUNDAY:new i(ge),Calendar:ke,TextCalendar:pe,HTMLCalendar:$e,LocaleTextCalendar:be,LocaleHTMLCalendar:Me,c:Te,firstweekday:getA(Te,"getfirstweekday"),monthcalendar:getA(Te,"monthdayscalendar"),prweek:getA(Te,"prweek"),week:getA(Te,"formatweek"),weekheader:getA(Te,"formatweekheader"),prmonth:getA(Te,"prmonth"),month:getA(Te,"formatmonth"),calendar:getA(Te,"formatyear"),prcal:getA(Te,"pryear")});const Ce=new i(20),Oe=R;function formatstring(e,t,n){t||(t=Ce),n||(n=Oe),n=mul(n,new h(" "));const r=[];for(const o of iterJs(e))r.push(pyCenter(o,t).toString());return new h(r.join(n.toString()))}const Le=getA(V,"toordinal"),xe=A(Le,[new V(1970,1,1)]);return t("calendar",Q,{isleap:{$meth:e=>s(isleap(e)),$flags:{NamedArgs:["year"]},$doc:"Return True for leap years, False for non-leap years"},leapdays:{$meth(e,t){e=F(e)-1,t=F(t)-1;const n=Math.floor;return new i(n(t/4)-n(e/4)-(n(t/100)-n(e/100))+(n(t/400)-n(e/400)))},$flags:{MinArgs:2,MaxArgs:2}},weekday:{$meth:weekday,$flags:{NamedArgs:["year","month","day"]},$doc:"Return weekday (0-6 ~ Mon-Sun) for year, month (1-12), day (1-31)."},monthrange:{$meth:(e,t)=>new y(monthrange(e,t)),$flags:{NamedArgs:["year","month"]},$doc:"Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for year, month."},setfirstweekday:{$meth(e){const t=F(e);if(!(fe<=t&&t<=ge))throw A(ee,[e]);Te.fwd=e},$flags:{NamedArgs:["firstweekday"]}},format:{$meth:function format(e,t,n){return p([formatstring(e,t,n)]),f},$flags:{NamedArgs:["cols","colwidth","spacing"],Defaults:[Ce,Oe]}},formatstring:{$meth:formatstring,$flags:{NamedArgs:["cols","colwidth","spacing"],Defaults:[Ce,Oe]}},timegm:{$meth(e){const[t,n,r,o,s,m]=e.valueOf(),d=A(V,[t,n,H]),l=A(Le,[d]),i=add(sub(l,xe),dec(r)),c=add(mul(i,U),o),f=add(mul(c,z),s);return add(mul(f,z),m)},$flags:{OneArg:!0}}}),Q}',"src/lib/cellbotics/__init__.js":'"use strict";function promiseToPy(e){const n=new Sk.misceval.Suspension;let i,t;return n.resume=function(){if(t)throw t;return i},n.data={type:"Sk.promise",promise:e.then((function(e){return i=e,e}),(function(e){return t=e,e}))},n}function remapToPy(e){return e instanceof Promise&&(e=promiseToPy(e)),Sk.ffi.remapToPy(e)}function remapToJsFunc(e,...n){return function(...i){n&&Sk.builtin.pyCheckArgs(e.name,i,...n),i=i.slice(1);return remapToPy(e(...i.map((e=>Sk.ffi.remapToJs(e)))))}}var $builtinmodule=function(e){return remapToPy(Promise.all([runestoneComponents.runestone_import("ble"),runestoneComponents.runestone_import("simple_sensor")]).then((([e,n])=>{const i={__name__:new Sk.builtin.str("cellbotics")},get_self=e=>e&&e.__js_class;i.JsProperty=Sk.misceval.buildClass(i,(function(e,n){n.__init__=new Sk.builtin.func((function(...e){Sk.builtin.pyCheckArgs("__init__",e,2,2);const[n,i]=e;n.__js_property=Sk.ffi.remapToJs(i)})),n.__get__=new Sk.builtin.func((function(...e){Sk.builtin.pyCheckArgs("__get__",e,2,3);const[n,i,t]=e;return remapToPy(get_self(i)[n.__js_property])}))}),"JsProperty",[]);const prop_wrap=e=>Sk.misceval.callsim(i.JsProperty,new Sk.builtins.str(e)),t=e.cell_bot_ble_gui.cell_bot_ble;t&&(i.CellBot=Sk.misceval.buildClass(i,(function(e,n){n.__init__=new Sk.builtin.func((function(e){if(!t.paired())throw"The CellBot is not paired. Click on the Pair button before running your program.";return remapToPy(t.resetHardware().then((()=>{})))})),n.INPUT=new Sk.builtin.int_(t.INPUT),n.OUTPUT=new Sk.builtin.int_(t.OUTPUT);const wrap=(e,n)=>new Sk.builtin.func(remapToJsFunc(e,n,n));n.resetHardware=wrap(t.resetHardware,1),n.pinMode=wrap(t.pinMode,3),n.digitalWrite=wrap(t.digitalWrite,3),n.digitalRead=wrap(t.digitalRead,2),n.ledcSetup=wrap(t.ledcSetup,4),n.ledcAttachPin=wrap(t.ledcAttachPin,3),n.ledcDetachPin=wrap(t.ledcDetachPin,2),n.ledcWrite=wrap(t.ledcWrite,3)}),"CellBot",[]));const method_wrap=(e,n)=>new Sk.builtin.func(((...i)=>remapToJsFunc(get_self(i[0])[e],n,n)(...i)));i._Sensor=Sk.misceval.buildClass(i,(function(e,n){n.start=method_wrap("start",1),n.stop=method_wrap("stop",1)}),"_Sensor",[]),i._XYZSensor=Sk.misceval.buildClass(i,(function(e,n){n.x=prop_wrap("x"),n.y=prop_wrap("y"),n.z=prop_wrap("z")}),"_XYZSensor",[i._Sensor]),i._OrientationSensor=Sk.misceval.buildClass(i,(function(e,n){n.quaternion=prop_wrap("quaternion")}),"_OrientationSensor",[i._Sensor]);const sensor_factory=(e,n,t)=>i[e]=Sk.misceval.buildClass(i,(function(e,n){n.__init__=new Sk.builtin.func((function(...e){Sk.builtin.pyCheckArgs("__init__",[e],1,1),e[0].__js_class=new t}))}),e,[n]);return i.AmbientLightSensor=Sk.misceval.buildClass(i,(function(e,i){i.__init__=new Sk.builtin.func((function(...e){Sk.builtin.pyCheckArgs("__init__",[e],1,1),e[0].__js_class=new n.SimpleAmbientLightSensor})),i.illuminance=prop_wrap("illuminance")}),"AmbientLightSensor",[i._Sensor]),i.GeolocationSensor=Sk.misceval.buildClass(i,(function(e,i){i.__init__=new Sk.builtin.func((function(...e){Sk.builtin.pyCheckArgs("__init__",[e],1,1),e[0].__js_class=new n.SimpleGeolocationSensor})),i.latitude=prop_wrap("latitude"),i.longitude=prop_wrap("longitude"),i.altitude=prop_wrap("altitude"),i.accuracy=prop_wrap("accuracy"),i.altitudeAccuracy=prop_wrap("altitudeAccuracy"),i.heading=prop_wrap("heading"),i.speed=prop_wrap("speed")}),"GeolocationSensor",[i._Sensor]),sensor_factory("Accelerometer",i._XYZSensor,n.SimpleAccelerometer),sensor_factory("Gyroscope",i._XYZSensor,n.SimpleGyroscope),sensor_factory("Magnetometer",i._XYZSensor,n.SimpleMagnetometer),sensor_factory("LinearAccelerationSensor",i._XYZSensor,n.SimpleLinearAccelerationSensor),sensor_factory("GravitySensor",i._XYZSensor,n.SimpleGravitySensor),sensor_factory("AbsoluteOrientationSensor",i._OrientationSensor,n.SimpleAbsoluteOrientationSensor),sensor_factory("RelativeOrientationSensor",i._OrientationSensor,n.SimpleRelativeOrientationSensor),i})))};',"src/lib/collections.js":'function $builtinmodule(t){const e={};return Sk.misceval.chain(Sk.importModule("keyword",!1,!0),(t=>(e._iskeyword=t.$d.iskeyword,Sk.importModule("itertools",!1,!0))),(t=>(e._chain=t.$d.chain,e._starmap=t.$d.starmap,e._repeat=t.$d.repeat,Sk.importModule("operator",!1,!0))),(t=>{e._itemgetter=t.$d.itemgetter}),(()=>collections_mod(e)))}function collections_mod(t){function counterNumberSlot(e){return function(i){if(void 0!==i&&!(i instanceof t.Counter))return Sk.builtin.NotImplemented.NotImplemented$;const s=new t.Counter;return e.call(this,s,i),s}}function counterInplaceSlot(t,e){return function(i){if(!(i instanceof Sk.builtin.dict))throw new Sk.builtin.TypeError("Counter "+t+"= "+Sk.abstr.typeName(i)+" is not supported");return e.call(this,i),this.keep$positive()}}t.__all__=new Sk.builtin.list(["deque","defaultdict","namedtuple","Counter","OrderedDict"].map((t=>new Sk.builtin.str(t)))),t.defaultdict=Sk.abstr.buildNativeClass("collections.defaultdict",{constructor:function defaultdict(t,e){this.default_factory=t,Sk.builtin.dict.call(this,e)},base:Sk.builtin.dict,methods:{copy:{$meth(){return this.$copy()},$flags:{NoArgs:!0}},__copy__:{$meth(){return this.$copy()},$flags:{NoArgs:!0}},__missing__:{$meth(t){if(Sk.builtin.checkNone(this.default_factory))throw new Sk.builtin.KeyError(Sk.misceval.objectRepr(t));{const e=Sk.misceval.callsimArray(this.default_factory,[]);return this.mp$ass_subscript(t,e),e}},$flags:{OneArg:!0}}},getsets:{default_factory:{$get(){return this.default_factory},$set(t){t=t||Sk.builtin.none.none$,this.default_factory=t}}},slots:{tp$doc:"defaultdict(default_factory[, ...]) --\\x3e dict with default factory\\n\\nThe default factory is called without arguments to produce\\na new value when a key is not present, in __getitem__ only.\\nA defaultdict compares equal to a dict with the same items.\\nAll remaining arguments are treated the same as if they were\\npassed to the dict constructor, including keyword arguments.\\n",tp$init(t,e){const i=t.shift();if(void 0===i)this.default_factory=Sk.builtin.none.none$;else{if(!Sk.builtin.checkCallable(i)&&!Sk.builtin.checkNone(i))throw new Sk.builtin.TypeError("first argument must be callable");this.default_factory=i}return Sk.builtin.dict.prototype.tp$init.call(this,t,e)},$r(){const t=Sk.misceval.objectRepr(this.default_factory),e=Sk.builtin.dict.prototype.$r.call(this).v;return new Sk.builtin.str("defaultdict("+t+", "+e+")")}},proto:{$copy(){const e=[];return Sk.misceval.iterFor(Sk.abstr.iter(this),(t=>{e.push(t),e.push(this.mp$subscript(t))})),new t.defaultdict(this.default_factory,e)}}}),t.Counter=Sk.abstr.buildNativeClass("Counter",{constructor:function Counter(){this.$d=new Sk.builtin.dict,Sk.builtin.dict.apply(this)},base:Sk.builtin.dict,methods:{elements:{$flags:{NoArgs:!0},$meth(){const e=t._chain.tp$getattr(new Sk.builtin.str("from_iterable")),i=t._starmap,s=t._repeat,n=Sk.misceval.callsimArray;return n(e,[n(i,[s,n(this.tp$getattr(this.str$items))])])}},most_common:{$flags:{NamedArgs:["n"],Defaults:[Sk.builtin.none.none$]},$meth(t){const e=this.sq$length();t=Sk.builtin.checkNone(t)||(t=Sk.misceval.asIndexOrThrow(t))>e?e:t<0?0:t;const i=this.$items().sort(((t,e)=>Sk.misceval.richCompareBool(t[1],e[1],"Lt")?1:Sk.misceval.richCompareBool(t[1],e[1],"Gt")?-1:0));return new Sk.builtin.list(i.slice(0,t).map((t=>new Sk.builtin.tuple(t))))}},update:{$flags:{FastCall:!0},$meth(t,e){return Sk.abstr.checkArgsLen("update",t,0,1),this.counter$update(t,e)}},subtract:{$flags:{FastCall:!0},$meth(t,e){Sk.abstr.checkArgsLen("subtract",t,0,1);const i=t[0];if(void 0!==i)if(i instanceof Sk.builtin.dict)for(let s=Sk.abstr.iter(i),n=s.tp$iternext();void 0!==n;n=s.tp$iternext()){const t=this.mp$subscript(n);this.mp$ass_subscript(n,Sk.abstr.numberBinOp(t,i.mp$subscript(n),"Sub"))}else for(let s=Sk.abstr.iter(i),n=s.tp$iternext();void 0!==n;n=s.tp$iternext()){const t=this.mp$subscript(n);this.mp$ass_subscript(n,Sk.abstr.numberBinOp(t,this.$one,"Sub"))}e=e||[];for(let s=0;s<e.length;s+=2){const t=new Sk.builtin.str(e[s]),i=this.mp$subscript(t);this.mp$ass_subscript(t,Sk.abstr.numberBinOp(i,e[s+1],"Sub"))}return Sk.builtin.none.none$}},__missing__:{$meth(t){return this.$zero},$flags:{OneArg:!0}},copy:{$meth(){return Sk.misceval.callsimArray(t.Counter,[this])},$flags:{NoArgs:!0}}},getsets:{__dict__:Sk.generic.getSetDict},slots:{tp$doc:"Dict subclass for counting hashable items. Sometimes called a bag\\n or multiset. Elements are stored as dictionary keys and their counts\\n are stored as dictionary values.\\n\\n >>> c = Counter(\'abcdeabcdabcaba\') # count elements from a string\\n\\n >>> c.most_common(3) # three most common elements\\n [(\'a\', 5), (\'b\', 4), (\'c\', 3)]\\n >>> sorted(c) # list all unique elements\\n [\'a\', \'b\', \'c\', \'d\', \'e\']\\n >>> \'\'.join(sorted(c.elements())) # list elements with repetitions\\n \'aaaaabbbbcccdde\'\\n >>> sum(c.values()) # total of all counts\\n 15\\n\\n >>> c[\'a\'] # count of letter \'a\'\\n 5\\n >>> for elem in \'shazam\': # update counts from an iterable\\n ... c[elem] += 1 # by adding 1 to each element\'s count\\n >>> c[\'a\'] # now there are seven \'a\'\\n 7\\n >>> del c[\'b\'] # remove all \'b\'\\n >>> c[\'b\'] # now there are zero \'b\'\\n 0\\n\\n >>> d = Counter(\'simsalabim\') # make another counter\\n >>> c.update(d) # add in the second counter\\n >>> c[\'a\'] # now there are nine \'a\'\\n 9\\n\\n >>> c.clear() # empty the counter\\n >>> c\\n Counter()\\n\\n Note: If a count is set to zero or reduced to zero, it will remain\\n in the counter until the entry is deleted or the counter is cleared:\\n\\n >>> c = Counter(\'aaabbc\')\\n >>> c[\'b\'] -= 2 # reduce the count of \'b\' by two\\n >>> c.most_common() # \'b\' is still in, but its count is zero\\n [(\'a\', 3), (\'c\', 1), (\'b\', 0)]\\n\\n",tp$init(t,e){return Sk.abstr.checkArgsLen(this.tpjs_name,t,0,1),this.counter$update(t,e)},$r(){const t=this.size>0?Sk.builtin.dict.prototype.$r.call(this).v:"";return new Sk.builtin.str(Sk.abstr.typeName(this)+"("+t+")")},tp$as_sequence_or_mapping:!0,mp$ass_subscript(t,e){return void 0===e?this.mp$lookup(t)&&Sk.builtin.dict.prototype.mp$ass_subscript.call(this,t,e):Sk.builtin.dict.prototype.mp$ass_subscript.call(this,t,e)},tp$as_number:!0,nb$positive:counterNumberSlot((function(t){this.$items().forEach((([e,i])=>{Sk.misceval.richCompareBool(i,this.$zero,"Gt")&&t.mp$ass_subscript(e,i)}))})),nb$negative:counterNumberSlot((function(t){this.$items().forEach((([e,i])=>{Sk.misceval.richCompareBool(i,this.$zero,"Lt")&&t.mp$ass_subscript(e,Sk.abstr.numberBinOp(this.$zero,i,"Sub"))}))})),nb$subtract:counterNumberSlot((function(t,e){this.$items().forEach((([i,s])=>{const n=Sk.abstr.numberBinOp(s,e.mp$subscript(i),"Sub");Sk.misceval.richCompareBool(n,this.$zero,"Gt")&&t.mp$ass_subscript(i,n)})),e.$items().forEach((([e,i])=>{void 0===this.mp$lookup(e)&&Sk.misceval.richCompareBool(i,this.$zero,"Lt")&&t.mp$ass_subscript(e,Sk.abstr.numberBinOp(this.$zero,i,"Sub"))}))})),nb$add:counterNumberSlot((function(t,e){this.$items().forEach((([i,s])=>{const n=Sk.abstr.numberBinOp(s,e.mp$subscript(i),"Add");Sk.misceval.richCompareBool(n,this.$zero,"Gt")&&t.mp$ass_subscript(i,n)})),e.$items().forEach((([e,i])=>{void 0===this.mp$lookup(e)&&Sk.misceval.richCompareBool(i,this.$zero,"Gt")&&t.mp$ass_subscript(e,i)}))})),nb$inplace_add:counterInplaceSlot("+",(function(t){t.$items().forEach((([t,e])=>{const i=Sk.abstr.numberInplaceBinOp(this.mp$subscript(t),e,"Add");this.mp$ass_subscript(t,i)}))})),nb$inplace_subtract:counterInplaceSlot("-",(function(t){t.$items().forEach((([t,e])=>{const i=Sk.abstr.numberInplaceBinOp(this.mp$subscript(t),e,"Sub");this.mp$ass_subscript(t,i)}))})),nb$or:counterNumberSlot((function(t,e){this.$items().forEach((([i,s])=>{const n=e.mp$subscript(i),r=Sk.misceval.richCompareBool(s,n,"Lt")?n:s;Sk.misceval.richCompareBool(r,this.$zero,"Gt")&&t.mp$ass_subscript(i,r)})),e.$items().forEach((([e,i])=>{void 0===this.mp$lookup(e)&&Sk.misceval.richCompareBool(i,this.$zero,"Gt")&&t.mp$ass_subscript(e,i)}))})),nb$and:counterNumberSlot((function(t,e){this.$items().forEach((([i,s])=>{const n=e.mp$subscript(i),r=Sk.misceval.richCompareBool(s,n,"Lt")?s:n;Sk.misceval.richCompareBool(r,this.$zero,"Gt")&&t.mp$ass_subscript(i,r)}))})),nb$inplace_and:counterInplaceSlot("&",(function(t){this.$items().forEach((([e,i])=>{const s=t.mp$subscript(e);Sk.misceval.richCompareBool(s,i,"Lt")&&this.mp$ass_subscript(e,s)}))})),nb$inplace_or:counterInplaceSlot("|",(function(t){t.$items().forEach((([t,e])=>{Sk.misceval.richCompareBool(e,this.mp$subscript(t),"Gt")&&this.mp$ass_subscript(t,e)}))})),nb$reflected_and:null,nb$reflected_or:null,nb$reflected_add:null,nb$reflected_subtract:null},proto:{keep$positive(){return this.$items().forEach((([t,e])=>{Sk.misceval.richCompareBool(e,this.$zero,"LtE")&&this.mp$ass_subscript(t)})),this},$zero:new Sk.builtin.int_(0),$one:new Sk.builtin.int_(1),str$items:new Sk.builtin.str("items"),counter$update(t,e){const i=t[0];if(void 0!==i)if(Sk.builtin.checkMapping(i))if(this.sq$length())for(let s=Sk.abstr.iter(i),n=s.tp$iternext();void 0!==n;n=s.tp$iternext()){const t=this.mp$subscript(n);this.mp$ass_subscript(n,Sk.abstr.numberBinOp(t,i.mp$subscript(n),"Add"))}else this.update$common(t,void 0,"update");else for(let s=Sk.abstr.iter(i),n=s.tp$iternext();void 0!==n;n=s.tp$iternext()){const t=this.mp$subscript(n);this.mp$ass_subscript(n,Sk.abstr.numberBinOp(t,this.$one,"Add"))}if(e&&e.length)if(this.sq$length())for(let s=0;s<e.length;s+=2){const t=new Sk.builtin.str(e[s]),i=this.mp$subscript(t);this.mp$ass_subscript(t,Sk.abstr.numberBinOp(i,e[s+1],"Add"))}else this.update$common([],e,"update");return Sk.builtin.none.none$}},classmethods:{fromkeys:{$meth:function fromkeys(){throw new Sk.builtin.NotImplementedError("Counter.fromkeys() is undefined. Use Counter(iterable) instead.")},$flags:{MinArgs:1,MaxArgs:2}}}}),t.OrderedDict=Sk.abstr.buildNativeClass("collections.OrderedDict",{constructor:function OrderedDict(){Sk.builtin.dict.call(this)},base:Sk.builtin.dict,slots:{tp$doc:"Dictionary that remembers insertion order",$r(){if(this.in$repr)return new Sk.builtin.str("...");this.in$repr=!0;let t=this.$items().map((([t,e])=>`(${Sk.misceval.objectRepr(t)}, ${Sk.misceval.objectRepr(e)})`));return t=0===t.length?"":"["+t.join(", ")+"]",this.in$repr=!1,new Sk.builtin.str(Sk.abstr.typeName(this)+"("+t+")")},tp$richcompare(e,i){if("Eq"!==i&&"Ne"!==i)return Sk.builtin.NotImplemented.NotImplemented$;if(!(e instanceof t.OrderedDict))return Sk.builtin.dict.prototype.tp$richcompare.call(this,e,i);const s="Eq"==i,n=this.size;if(n!==e.size)return!s;const r=e.$items(),a=this.$items();for(let t=0;t<n;t++){const e=a[t],i=r[t],n=e[0],o=i[0];if(n!==o&&!Sk.misceval.isTrue(Sk.misceval.richCompareBool(n,o,"Eq")))return!s;const l=e[1],h=i[1];if(l!==h&&!Sk.misceval.isTrue(Sk.misceval.richCompareBool(l,h,"Eq")))return!s}return s}},methods:{popitem:{$flags:{NamedArgs:["last"],Defaults:[Sk.builtin.bool.true$]},$meth(t){const e=this.get$size();if(0===e)throw new Sk.builtin.KeyError("dictionary is empty");const[i,s]=this.$items()[Sk.misceval.isTrue(t)?e-1:0];return this.pop$item(i),new Sk.builtin.tuple([i,s])}},move_to_end:{$flags:{NamedArgs:["key","last"],Defaults:[Sk.builtin.bool.true$]},$meth(t,e){let i;for(let n in this.entries){const e=this.entries[n][0];if(e===t||Sk.misceval.richCompareBool(e,t,"Eq")){i=n;break}}if(void 0===i)throw new Sk.builtin.KeyError(t);const s=this.entries[i];return delete this.entries[i],Sk.misceval.isTrue(e)?this.entries[i]=s:this.entries={[i]:s,...this.entries},Sk.builtin.none.none$}}}}),t.deque=Sk.abstr.buildNativeClass("collections.deque",{constructor:function deque(t,e,i,s,n){this.head=i||0,this.tail=s||0,this.mask=n||1,this.maxlen=e,this.v=t||new Array(2)},slots:{tp$doc:"deque([iterable[, maxlen]]) --\\x3e deque object\\n\\nA list-like sequence optimized for data accesses near its endpoints.",tp$hash:Sk.builtin.none.none$,tp$new:Sk.generic.new,tp$init(t,e){let[i,s]=Sk.abstr.copyKeywordsToNamedArgs("deque",["iterable","maxlen"],t,e);if(void 0!==s&&!Sk.builtin.checkNone(s)){if(s=Sk.misceval.asIndexSized(s,Sk.builtin.OverflowError,"an integer is required"),s<0)throw new Sk.builtin.ValueError("maxlen must be non-negative");this.maxlen=s}this.$clear(),void 0!==i&&this.$extend(i)},tp$getattr:Sk.generic.getAttr,tp$richcompare(e,i){if(this===e&&Sk.misceval.opAllowsEquality(i))return!0;if(!(e instanceof t.deque))return Sk.builtin.NotImplemented.NotImplemented$;const s=e,n=this.v;e=e.v;const r=this.tail-this.head&this.mask,a=s.tail-s.head&s.mask;let o,l=Math.max(r,a);if(r===a)for(l=0;l<r&&l<a&&(o=Sk.misceval.richCompareBool(n[this.head+l&this.mask],e[s.head+l&s.mask],"Eq"),o);++l);if(l>=r||l>=a)switch(i){case"Lt":return r<a;case"LtE":return r<=a;case"Eq":return r===a;case"NotEq":return r!==a;case"Gt":return r>a;case"GtE":return r>=a}return"Eq"!==i&&("NotEq"===i||Sk.misceval.richCompareBool(n[this.head+l&this.mask],e[s.head+l&s.mask],i))},tp$iter(){return new e(this)},$r(){const t=[],e=this.tail-this.head&this.mask;if(this.$entered_repr)return new Sk.builtin.str("[...]");this.$entered_repr=!0;for(let s=0;s<e;s++)t.push(Sk.misceval.objectRepr(this.v[this.head+s&this.mask]));const i=Sk.abstr.typeName(this);return void 0!==this.maxlen?new Sk.builtin.str(i+"(["+t.filter(Boolean).join(", ")+"], maxlen="+this.maxlen+")"):(this.$entered_repr=void 0,new Sk.builtin.str(i+"(["+t.filter(Boolean).join(", ")+"])"))},tp$as_number:!0,nb$bool(){return 0!=(this.tail-this.head&this.mask)},tp$as_sequence_or_mapping:!0,sq$contains(t){for(let e=this.tp$iter(),i=e.tp$iternext();void 0!==i;i=e.tp$iternext())if(Sk.misceval.richCompareBool(i,t,"Eq"))return!0;return!1},sq$concat(e){if(!(e instanceof t.deque))throw new Sk.builtin.TypeError("can only concatenate deque (not \'"+Sk.abstr.typeName(e)+"\') to deque");const i=this.$copy();for(let t=e.tp$iter(),s=t.tp$iternext();void 0!==s;s=t.tp$iternext())i.$push(s);return i},sq$length(){return this.tail-this.head&this.mask},sq$repeat(t){t=Sk.misceval.asIndexOrThrow(t,"can\'t multiply sequence by non-int of type \'{tp$name}\'");const e=this.tail-this.head&this.mask,i=this.$copy();let s;t<=0&&i.$clear();for(let n=1;n<t;n++)for(let t=0;t<e;t++)s=this.head+t&this.mask,i.$push(this.v[s]);return i},mp$subscript(t){t=Sk.misceval.asIndexOrThrow(t);const e=this.tail-this.head&this.mask;if(t>=e||t<-e)throw new Sk.builtin.IndexError("deque index out of range");const i=(t>=0?this.head:this.tail)+t&this.mask;return this.v[i]},mp$ass_subscript(t,e){t=Sk.misceval.asIndexOrThrow(t);const i=this.tail-this.head&this.mask;if(t>=i||t<-i)throw new Sk.builtin.IndexError("deque index out of range");void 0===e?this.del$item(t):this.set$item(t,e)},nb$inplace_add(t){this.maxlen=void 0;for(let e=Sk.abstr.iter(t),i=e.tp$iternext();void 0!==i;i=e.tp$iternext())this.$push(i);return this},nb$inplace_multiply(t){(t=Sk.misceval.asIndexSized(t,Sk.builtin.OverflowError,"can\'t multiply sequence by non-int of type \'{tp$name}\'"))<=0&&this.$clear();const e=this.$copy(),i=this.tail-this.head&this.mask;for(let s=1;s<t;s++)for(let t=0;t<i;t++){const i=this.head+t&this.mask;e.$push(this.v[i])}return this.v=e.v,this.head=e.head,this.tail=e.tail,this.mask=e.mask,this}},methods:{append:{$meth(t){return this.$push(t),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Add an element to the right side of the deque."},appendleft:{$meth(t){return this.$pushLeft(t),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Add an element to the left side of the deque."},clear:{$meth(){return this.$clear(),Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:"Remove all elements from the deque."},__copy__:{$meth(){return this.$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a shallow copy of a deque."},copy:{$meth(){return this.$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a shallow copy of a deque."},count:{$meth(t){const e=this.tail-this.head&this.mask;let i=0;for(let s=0;s<e;s++)Sk.misceval.richCompareBool(this.v[this.head+s&this.mask],t,"Eq")&&i++;return new Sk.builtin.int_(i)},$flags:{OneArg:!0},$textsig:null,$doc:"D.count(value) -> integer -- return number of occurrences of value"},extend:{$meth(t){return this.$extend(t),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Extend the right side of the deque with elements from the iterable"},extendleft:{$meth(t){for(let e=Sk.abstr.iter(t),i=e.tp$iternext();void 0!==i;i=e.tp$iternext())this.$pushLeft(i);return Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Extend the left side of the deque with elements from the iterable"},index:{$meth(t,e,i){const s=this.$index(t,e,i);if(void 0!==s)return new Sk.builtin.int_(s);throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(t)+" is not in deque")},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"D.index(value, [start, [stop]]) -> integer -- return first index of value.\\nRaises ValueError if the value is not present."},insert:{$meth(t,e){t=Sk.misceval.asIndexOrThrow(t,"integer argument expected, got {tp$name}");const i=this.tail-this.head&this.mask;if(void 0!==this.maxlen&&i>=this.maxlen)throw new Sk.builtin.IndexError("deque already at its maximum size");t>i&&(t=i),t<=-i&&(t=0);const s=(t>=0?this.head:this.tail)+t&this.mask;let n=this.tail;for(this.tail=this.tail+1&this.mask;n!==s;){const t=n-1&this.mask;this.v[n]=this.v[t],n=t}return this.v[s]=e,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1),Sk.builtin.none.none$},$flags:{MinArgs:2,MaxArgs:2},$textsig:null,$doc:"D.insert(index, object) -- insert object before index"},pop:{$meth(){return this.$pop()},$flags:{NoArgs:!0},$textsig:null,$doc:"Remove and return the rightmost element."},popleft:{$meth(){return this.$popLeft()},$flags:{NoArgs:!0},$textsig:null,$doc:"Remove and return the leftmost element."},remove:{$meth(t){const e=this.$index(t);if(void 0===e)throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(t)+" is not in deque");let i=this.head+e&this.mask;for(;i!==this.tail;){const t=i+1&this.mask;this.v[i]=this.v[t],i=t}this.tail=this.tail-1&this.mask;var s=this.tail-this.head&this.mask;s<this.mask>>>1&&this.$resize(s,this.v.length>>>1)},$flags:{OneArg:!0},$textsig:null,$doc:"D.remove(value) -- remove first occurrence of value."},__reversed__:{$meth(){return new i(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"D.__reversed__() -- return a reverse iterator over the deque"},reverse:{$meth(){const t=this.head,e=this.tail,i=this.mask,s=this.tail-this.head&this.mask;for(let n=0;n<~~(s/2);n++){const s=e-n-1&i,r=t+n&i,a=this.v[s];this.v[s]=this.v[r],this.v[r]=a}return Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:"D.reverse() -- reverse *IN PLACE*"},rotate:{$meth(t){t=void 0===t?1:Sk.misceval.asIndexSized(t,Sk.builtin.OverflowError);const e=this.head,i=this.tail;if(0===t||e===i)return this;if(this.head=e-t&this.mask,this.tail=i-t&this.mask,t>0)for(let s=1;s<=t;s++){const t=e-s&this.mask,n=i-s&this.mask;this.v[t]=this.v[n],this.v[n]=void 0}else for(let s=0;s>t;s--){const t=i-s&this.mask,n=e-s&this.mask;this.v[t]=this.v[n],this.v[n]=void 0}return Sk.builtin.none.none$},$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:"Rotate the deque n steps to the right (default n=1). If n is negative, rotates left."}},classmethods:Sk.generic.classGetItem,getsets:{maxlen:{$get(){return void 0===this.maxlen?Sk.builtin.none.none$:new Sk.builtin.int_(this.maxlen)},$doc:"maximum size of a deque or None if unbounded"}},proto:{$clear(){this.head=0,this.tail=0,this.mask=1,this.v=new Array(2)},$copy(){return new t.deque(this.v.slice(0),this.maxlen,this.head,this.tail,this.mask)},$extend(t){for(let e=Sk.abstr.iter(t),i=e.tp$iternext();void 0!==i;i=e.tp$iternext())this.$push(i)},set$item(t,e){const i=(t>=0?this.head:this.tail)+t&this.mask;this.v[i]=e},del$item(t){let e=(t>=0?this.head:this.tail)+t&this.mask;for(;e!==this.tail;){const t=e+1&this.mask;this.v[e]=this.v[t],e=t}const i=this.tail-this.head&this.mask;this.tail=this.tail-1&this.mask,i<this.mask>>>1&&this.$resize(i,this.v.length>>>1)},$push(t){this.v[this.tail]=t,this.tail=this.tail+1&this.mask,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1);const e=this.tail-this.head&this.mask;return void 0!==this.maxlen&&e>this.maxlen&&this.$popLeft(),this},$pushLeft(t){this.head=this.head-1&this.mask,this.v[this.head]=t,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1);const e=this.tail-this.head&this.mask;return void 0!==this.maxlen&&e>this.maxlen&&this.$pop(),this},$pop(){if(this.head===this.tail)throw new Sk.builtin.IndexError("pop from an empty deque");this.tail=this.tail-1&this.mask;const t=this.v[this.tail];this.v[this.tail]=void 0;const e=this.tail-this.head&this.mask;return e<this.mask>>>1&&this.$resize(e,this.v.length>>>1),t},$popLeft(){if(this.head===this.tail)throw new Sk.builtin.IndexError("pop from an empty deque");const t=this.v[this.head];this.v[this.head]=void 0,this.head=this.head+1&this.mask;const e=this.tail-this.head&this.mask;return e<this.mask>>>1&&this.$resize(e,this.v.length>>>1),t},$resize(t,e){const i=this.head,s=this.mask;if(this.head=0,this.tail=t,this.mask=e-1,0===i)return void(this.v.length=e);const n=new Array(e);for(let r=0;r<t;r++)n[r]=this.v[i+r&s];this.v=n},$index(t,e,i){const s=this.tail-this.head&this.mask;e=void 0===e?0:Sk.misceval.asIndexOrThrow(e),i=void 0===i?s:Sk.misceval.asIndexOrThrow(i);const n=this.head,r=this.mask,a=this.v;i=i>=0?i:i<-s?0:s+i;for(let o=e>=0?e:e<-s?0:s+e;o<i;o++){const e=a[n+o&r];if(e===t||Sk.misceval.richCompareBool(e,t,"Eq"))return o}},sk$asarray(){const t=[],e=this.tail-this.head&this.mask;for(let i=0;i<e;++i){const e=this.head+i&this.mask;t.push(this.v[e])}return t}}});const e=Sk.abstr.buildIteratorClass("_collections._deque_iterator",{constructor:function _deque_iterator(t){this.$index=0,this.dq=t.v,this.$length=t.tail-t.head&t.mask,this.$head=t.head,this.$tail=t.tail,this.$mask=t.mask},iternext(){if(this.$index>=this.$length)return;const t=(this.$index>=0?this.$head:this.$tail)+this.$index&this.$mask;return this.$index++,this.dq[t]},methods:{__length_hint__:{$meth:function __length_hint__(){return new Sk.builtin.int_(this.$length-this.$index)},$flags:{NoArgs:!0}}}}),i=Sk.abstr.buildIteratorClass("_collections._deque_reverse_iterator",{constructor:function _deque_reverse_iterator(t){this.$index=(t.tail-t.head&t.mask)-1,this.dq=t.v,this.$head=t.head,this.$mask=t.mask},iternext(){if(this.$index<0)return;const t=this.$head+this.$index&this.$mask;return this.$index--,this.dq[t]},methods:{__length_hint__:Sk.generic.iterReverseLengthHintMethodDef}}),s=new RegExp(/^[0-9].*/),n=new RegExp(/^[0-9_].*/),r=new RegExp(/^\\w*$/),a=/,/g,o=/\\s+/;function namedtuple(e,i,l,h,c){if(e=e.tp$str(),Sk.misceval.isTrue(Sk.misceval.callsimArray(t._iskeyword,[e])))throw new Sk.builtin.ValueError("Type names and field names cannot be a keyword: \'"+Sk.misceval.objectRepr(e)+"\'");const u=e.$jsstr();if(s.test(u)||!r.test(u)||!u)throw new Sk.builtin.ValueError("Type names and field names must be valid identifiers: \'"+u+"\'");let m,d;if(Sk.builtin.checkString(i))m=i.$jsstr().replace(a," ").split(o),1==m.length&&""===m[0]&&(m=[]),d=m.map((t=>new Sk.builtin.str(t)));else{m=[],d=[];for(let t=Sk.abstr.iter(i),e=t.tp$iternext();void 0!==e;e=t.tp$iternext())e=e.tp$str(),d.push(e),m.push(e.$jsstr())}let p=new Set;if(Sk.misceval.isTrue(l))for(let s=0;s<m.length;s++)(Sk.misceval.isTrue(Sk.misceval.callsimArray(t._iskeyword,[d[s]]))||n.test(m[s])||!r.test(m[s])||!m[s]||p.has(m[s]))&&(m[s]="_"+s,d[s]=new Sk.builtin.str("_"+s)),p.add(m[s]);else for(let s=0;s<m.length;s++){if(Sk.misceval.isTrue(Sk.misceval.callsimArray(t._iskeyword,[d[s]])))throw new Sk.builtin.ValueError("Type names and field names cannot be a keyword: \'"+m[s]+"\'");if(n.test(m[s]))throw new Sk.builtin.ValueError("Field names cannot start with an underscore: \'"+m[s]+"\'");if(!r.test(m[s])||!m[s])throw new Sk.builtin.ValueError("Type names and field names must be valid identifiers: \'"+m[s]+"\'");if(p.has(m[s]))throw new Sk.builtin.ValueError("Encountered duplicate field name: \'"+m[s]+"\'");p.add(m[s])}const $=new Sk.builtin.tuple(d),k=[];let b=[];if(!Sk.builtin.checkNone(h)){if(b=Sk.misceval.arrayFromIterable(h),b.length>m.length)throw new Sk.builtin.TypeError("Got more default values than field names");for(let t=0,e=d.length-b.length;e<d.length;t++,e++)k.push(d[e]),k.push(b[t])}const f=new Sk.builtin.dict(k);function _make(t,e){return t.prototype.tp$new(Sk.misceval.arrayFromIterable(e))}function _asdict(t){const e=[];for(let i=0;i<t._fields.v.length;i++)e.push(t._fields.v[i]),e.push(t.v[i]);return new Sk.builtin.dict(e)}function _replace(t,e){const i=(t=new Sk.builtin.dict(t)).tp$getattr(new Sk.builtin.str("pop")),s=Sk.abstr.gattr(e,new Sk.builtin.str("_make")),n=Sk.misceval.callsimArray,r=n(s,[n(Sk.builtin.map_,[i,$,e])]);if(t.sq$length()){const e=t.sk$asarray();throw new Sk.builtin.ValueError("Got unexpectd field names: ["+e.map((t=>"\'"+t.$jsstr()+"\'"))+"]")}return r}_make.co_varnames=["_cls","iterable"],_asdict.co_varnames=["self"],_replace.co_kwargs=1,_replace.co_varnames=["_self"];const S={};for(let s=0;s<m.length;s++)S[d[s].$mangled]=new Sk.builtin.property(new t._itemgetter([new Sk.builtin.int_(s)]),void 0,void 0,new Sk.builtin.str("Alias for field number "+s));return Sk.abstr.buildNativeClass(u,{constructor:function NamedTuple(){},base:Sk.builtin.tuple,slots:{tp$doc:u+"("+m.join(", ")+")",tp$new(t,e){t=Sk.abstr.copyKeywordsToNamedArgs("__new__",m,t,e,b);const i=new this.constructor;return Sk.builtin.tuple.call(i,t),i},$r(){const t=this.v.map(((t,e)=>m[e]+"="+Sk.misceval.objectRepr(t)));return new Sk.builtin.str(Sk.abstr.typeName(this)+"("+t.join(", ")+")")}},flags:{sk$klass:!0},proto:Object.assign({__module__:Sk.builtin.checkNone(c)?Sk.globals.__name__:c,__slots__:new Sk.builtin.tuple,_fields:$,_field_defaults:f,_make:new Sk.builtin.classmethod(new Sk.builtin.func(_make)),_asdict:new Sk.builtin.func(_asdict),_replace:new Sk.builtin.func(_replace)},S)})}return namedtuple.co_argcount=2,namedtuple.co_kwonlyargcount=3,namedtuple.$kwdefs=[Sk.builtin.bool.false$,Sk.builtin.none.none$,Sk.builtin.none.none$],namedtuple.co_varnames=["typename","field_names","rename","defaults","module"],t.namedtuple=new Sk.builtin.func(namedtuple),t}',"src/lib/datetime.js":'function $builtinmodule(){const{isTrue:t,richCompareBool:e,asIndexOrThrow:n,asIndexSized:i,objectRepr:s,opAllowsEquality:o,callsimArray:r,callsimOrSuspendArray:a}=Sk.misceval,{numberBinOp:$,typeName:c,buildNativeClass:h,checkArgsLen:m,objectHash:u,copyKeywordsToNamedArgs:l}=Sk.abstr,{int_:f,float_:d,str:w,bytes:_,tuple:p,bool:{true$:g},none:{none$:y},NotImplemented:{NotImplemented$:b},TypeError:z,ValueError:v,OverflowError:M,ZeroDivisionError:A,NotImplementedError:x,checkNumber:N,checkFloat:S,checkString:k,checkInt:O,asnum$:I,round:E,getattr:T}=Sk.builtin,{remapToPy:D,remapToJs:R}=Sk.ffi,intRound=t=>E(t).nb$int(),q=$,C=new w("auto"),U=new w("utcoffset"),Y=new w("tzname"),j=new w("as_integer_ratio"),F=new w("dst"),H=new w("isoformat"),J=new w("replace"),B=new w("fromtimestamp"),G=new w("fromordinal"),L=new w("utcfromtimestamp"),X=new w("strftime"),P=new w("fromutc"),W=new f(0),Z=new d(0),K=new f(7),V=new f(60),Q=new f(3600),tt=new f(1e3),et=new f(1e6),nt=new d(1e6),it=new f(86400),st=new d(86400);let ot=null;function pyDivMod(t,e){return q(t,e,"DivMod").v}function $divMod(t,e){if("number"!=typeof t||"number"!=typeof e)return t=JSBI.BigInt(t),e=JSBI.BigInt(e),[JSBI.toNumber(JSBI.divide(t,e)),JSBI.toNumber(JSBI.remainder(t,e))];if(0===e)throw new A("integer division or modulo by zero");return[Math.floor(t/e),t-Math.floor(t/e)*e]}function modf(t){const e=(t=I(t))<0?-1:1;return t=Math.abs(t),[new d(e*(t-Math.floor(t))),new d(e*Math.floor(t))]}function _d(t,e="0",n=2){return t.toString().padStart(n,e)}const rt=/^[0-9]+$/;function _as_integer(t){if(!rt.test(t))throw new Error;return parseInt(t)}function _as_int_ratio(t){let e=r(t.tp$getattr(j));if(!(e instanceof p))throw new z("unexpected return type from as_integer_ratio(): expected tuple, got \'"+c(e)+"\'");if(e=e.v,2!==e.length)throw new v("as_integer_ratio() must return a 2-tuple");return e}return Sk.misceval.chain(Sk.importModule("time",!1,!0),(a=>{const $=a.$d,E={__name__:new w("datetime"),__all__:new Sk.builtin.list(["date","datetime","time","timedelta","timezone","tzinfo","MINYEAR","MAXYEAR"].map((t=>new w(t))))};function _cmp(t,e){for(let n=0;n<t.length;n++)if(t[n]!==e[n])return t[n]>e[n]?1:-1;return 0}function _do_compare(t,e,n){const i=t.$cmp(e,n);switch(n){case"Lt":return i<0;case"LtE":return i<=0;case"Eq":return 0===i;case"NotEq":return 0!==i;case"Gt":return i>0;case"GtE":return i>=0}}const j=9999;E.MINYEAR=new f(1),E.MAXYEAR=new f(j);const rt=3652059,at=[-1,31,28,31,30,31,30,31,31,30,31,30,31],$t=[-1];let ct=0;function _is_leap(t){return t%4==0&&(t%100!=0||t%400==0)}function _days_before_year(t){const e=t-1;return 365*e+Math.floor(e/4)-Math.floor(e/100)+Math.floor(e/400)}function _days_before_month(t,e){return $t[e]+(e>2&&_is_leap(t))}function _ymd2ord(t,e,n){return _days_before_year(t)+_days_before_month(t,e)+n}at.slice(1).forEach((t=>{$t.push(ct),ct+=t}));const ht=_days_before_year(401),mt=_days_before_year(101),ut=_days_before_year(5);function _ord2ymd(t){if((t=n(t))>Number.MAX_SAFE_INTEGER)throw new M("Python int too large to convert to js number");if(t<1)throw new v("ordinal must be >= 1");let e,i,s,o;t-=1,[e,t]=$divMod(t,ht);let r=400*e+1;if([i,t]=$divMod(t,mt),[s,t]=$divMod(t,ut),[o,t]=$divMod(t,365),r+=100*i+4*s+o,4===o||4===i)return[r-1,12,31].map((t=>new f(t)));const a=3===o&&(24!==s||3===i);let $=t+50>>5,c=$t[$]+($>2&&a);return c>t&&($-=1,c-=at[$]+(2===$&&a)),[r,$,(t-=c)+1].map((t=>new f(t)))}const lt=[null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ft=[null,"Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function _build_struct_time(t,e,n,i,s,o,r){const a=(_ymd2ord(t,e,n)+6)%7,c=_days_before_month(t,e)+n;return $.struct_time.tp$call([new p([t,e,n,i,s,o,a,c,r].map((t=>new f(t))))])}const dt={hours:t=>_d(t),minutes:(t,e)=>_d(t)+":"+_d(e),seconds:(t,e,n)=>_d(t)+":"+_d(e)+":"+_d(n),milliseconds:(t,e,n,i)=>_d(t)+":"+_d(e)+":"+_d(n)+"."+_d(i,"0",3),microseconds:(t,e,n,i)=>_d(t)+":"+_d(e)+":"+_d(n)+"."+_d(i,"0",6)};function _format_time(t,e,n,i,s="auto"){if("string"!=typeof s&&!k(s))throw new z("must be str, not "+c(s));"auto"===(s=s.toString())?s=i?"microseconds":"seconds":"milliseconds"===s&&(i=Math.floor(i/1e3));let o=dt[s];if(void 0===o)throw new v("Unknown timespec value");return o(t,e,n,i)}function _format_offset(t){let e,n="";if(t!==y){let i,s,o;return t.$days<0?(e="-",t=new wt(-t.$days,-t.$secs,-t.$micro)):e="+",[i,s]=pyDivMod(t,pt),[s,o]=pyDivMod(s,gt),n+=e+`${_d(i)}:${_d(s)}`,(o.$secs||o.$micro)&&(n+=":"+_d(o.$secs,"0",2),o.$micro&&(n+="."+_d(o.$micro,"0",6))),n}}function _wrap_strftime(t,e,n){let i=null,s=null,o=null,a=[],c=0;const h=e.length;for(;c<h;){let n=e[c];if(c+=1,"%"===n)if(c<h)if(n=e[c],c+=1,"f"===n)null===i&&(i=_d(t.$micro||0,"0",6)),a.push(i);else if("z"===n){if(null===s){s="";const e=t.tp$getattr(U);if(void 0!==e){let t=r(e);if(t!==y){let e,n,i,o="+";t.$days<0&&(t=new wt(-t.$days,-t.$secs,-t.$micro),o="-"),[e,i]=pyDivMod(t,pt),[n,i]=pyDivMod(i,gt);const r=i.$secs,a=t.$micro;s=a?o+_d(e)+_d(n)+_d(r)+"."+_d(a,"0",6):r?o+_d(e)+_d(n)+_d(r):o+_d(e)+_d(n)}}}a.push(s)}else if("Z"===n){if(null===o){o="";const e=t.tp$getattr(Y);if(void 0!==e){let t=r(e);if(t!==y){const e=t.tp$getattr(J);if(o=r(e,[new w("%"),new w("%%")]),!k(o))throw new z("tzname.replace() did not return a string")}}}a.push(o)}else a.push("%",n);else a.push("%");else a.push(n)}return a=a.join(""),$.strftime.tp$call([new w(a),n])}function _parse_isoformat_date(t){const e=_as_integer(t.slice(0,4));if("-"!==t[4])throw new v("Invalid date separator: "+t[4]);const n=_as_integer(t.slice(5,7));if("-"!==t[7])throw new v("Invalid date separator: "+t[7]);return[e,n,_as_integer(t.slice(8,10))].map((t=>new f(t)))}function _parse_hh_mm_ss_ff(t){const e=t.length,n=[0,0,0,0];let i=0;for(let s=0;s<3;s++){if(e-i<2)throw new v("Incomplete time component");n[s]=_as_integer(t.slice(i,i+2)),i+=2;const o=t.substr(i,1);if(!o||s>=2)break;if(":"!==o)throw new v("Invalid time separator: "+o);i+=1}if(i<e){if("."!==t[i])throw new v("Invalid microsecond component");{i+=1;const s=e-i;if(3!==s&&6!==s)throw new v("Invalid microsecond component");n[3]=_as_integer(t.slice(i)),3===s&&(n[3]*=1e3)}}return n}function _parse_isoformat_time(t){if(t.length<2)throw new v("Isoformat time too short");const e=t.indexOf("-")+1||t.indexOf("+")+1;let n,i=_parse_hh_mm_ss_ff(e>0?t.slice(0,e-1):t),s=y;if(e>0){if(n=t.slice(e),![5,8,15].includes(n.length))throw new v("Malformed time zone string");const i=_parse_hh_mm_ss_ff(n);if(i.every((t=>0===t)))s=St.prototype.utc;else{const n="-"===t[e-1]?-1:1,o=new wt(0,n*(3600*i[0]+60*i[1]+i[2]),n*i[3]);s=new St(o)}}return i=i.map((t=>new f(t))),i.push(s),i}function _check_tzname(t){if(t!==y&&!k(t))throw new z("tzinfo.tzname() must return None or string, not \'"+c(t)+"\'")}function _check_utc_offset(t,n){if(n!==y){if(!(n instanceof wt))throw new z(`tzinfo.${t}() must return None or timedelta, not \'${c(n)}\'`);if(!e(zt,n,"Lt")||!e(n,_t,"Lt"))throw new v(`${t}()=${n.toString()}, must be strictly between -timedelta(hours=24) and timedelta(hours=24)`)}}function _check_date_fields(t,e=null,i=null){if(null===e||null===i){throw new z(`function missing required argument \'${null===i?"day":"month"}\' (pos ${null===i?"3":"2"})`)}if(t=n(t),e=n(e),i=n(i),!(1<=t&&t<=j))throw new v("year must be in 1.."+j,new f(t));if(!(1<=e&&e<=12))throw new v("month must be in 1..12",new f(e));const s=function _days_in_month(t,e){return 2===e&&_is_leap(t)?29:at[e]}(t,e);if(!(1<=i&&i<=s))throw new v("day must be in 1.."+s,new f(i));return[t,e,i]}function _check_time_fields(t,e,i,s,o){if(t=n(t),e=n(e),i=n(i),s=n(s),o=n(o),!(0<=t&&t<=23))throw new v("hour must be in 0..23",new f(t));if(!(0<=e&&e<=59))throw new v("minute must be in 0..59",new f(e));if(!(0<=i&&i<=59))throw new v("second must be in 0..59",new f(i));if(!(0<=s&&s<=999999))throw new v("microsecond must be in 0..999999",new f(s));if(0!==o&&1!==o)throw new v("fold must be either 0 or 1",new f(o));return[t,e,i,s,o]}function _check_tzinfo_arg(t){if(t!==y&&!(t instanceof Mt))throw new z("tzinfo argument must be None or of a tzinfo subclass")}function _divide_and_round(t,e){let[n,i]=$divMod(t,e);return i*=2,((e>0?i>e:i<e)||i===e&&Math.abs(n)%2==1)&&(n+=1),n}const wt=E.timedelta=h("datetime.timedelta",{constructor:function timedelta(t=0,e=0,n=0){let i,s;if([i,n]=$divMod(n,1e6),e+=i,[s,e]=$divMod(e,86400),t+=s,this.$days=t,this.$secs=e,this.$micro=n,this.$hashcode=-1,Math.abs(t)>999999999)throw new M(`days=${t}; must have magnitude <= 999999999`)},slots:{tp$new(t,e){let i,s,o,r,a,$,c,[h,m,u,d,w,_,p]=l("timedelta",["days","seconds","microseconds","milliseconds","minutes","hours","weeks"],t,e,new Array(7).fill(W));i=s=o=W,h=q(h,q(p,K,"Mult"),"Add"),m=q(m,q(q(w,V,"Mult"),q(_,Q,"Mult"),"Add"),"Add"),u=q(u,q(d,tt,"Mult"),"Add"),S(h)?([r,h]=modf(h),[a,$]=modf(q(r,st,"Mult")),s=new f($),i=new f(h)):(a=Z,i=h),S(m)?([c,m]=modf(m),m=new f(m),c=q(c,a,"Add")):c=a,[h,m]=pyDivMod(m,it),i=q(i,h,"Add"),s=q(s,new f(m),"Add");const g=q(c,nt,"Mult");if(S(u)?(u=intRound(q(u,g,"Add")),[m,u]=pyDivMod(u,et),[h,m]=pyDivMod(m,it),i=q(i,h,"Add"),s=q(s,m,"Add")):(u=new f(u),[m,u]=pyDivMod(u,et),[h,m]=pyDivMod(m,it),i=q(i,h,"Add"),s=q(s,m,"Add"),u=intRound(q(u,g,"Add"))),[m,o]=pyDivMod(u,et),s=q(s,m,"Add"),[h,s]=pyDivMod(s,it),i=q(i,h,"Add"),i=n(i),s=n(s),o=n(o),Math.abs(i)>999999999)throw new M("timedelta # of days is too large: "+h.toString());if(this===wt.prototype)return new wt(i,s,o);{const t=new this.constructor;return wt.call(t,i,s,o),t}},$r(){const t=[];return this.$days&&t.push(`days=${this.$days}`),this.$secs&&t.push(`seconds=${this.$secs}`),this.$micro&&t.push(`microseconds=${this.$micro}`),t.length||t.push("0"),new w(`${this.tp$name}(${t.join(", ")})`)},tp$str(){const t=this.$secs%60;let e=Math.floor(this.$secs/60);const n=Math.floor(e/60);e%=60;let i=`${n}:${_d(e)}:${_d(t)}`;if(this.$days){i=`${this.$days} day${function plural(t){return 1!==Math.abs(t)?"s":""}(this.$days)}, `+i}return this.$micro&&(i+=`.${_d(this.$micro,"0",6)}`),new w(i)},tp$as_number:!0,nb$add(t){return t instanceof wt?new wt(this.$days+t.$days,this.$secs+t.$secs,this.$micro+t.$micro):b},nb$subtract(t){return t instanceof wt?new wt(this.$days-t.$days,this.$secs-t.$secs,this.$micro-t.$micro):b},nb$positive(){return this},nb$negative(){return new wt(-this.$days,-this.$secs,-this.$micro)},nb$abs(){return this.$days<0?this.nb$negative():this},nb$multiply(t){if(O(t))return t=i(t,M),new wt(this.$days*t,this.$secs*t,this.$micro*t);if(S(t)){const e=this.$toMicrosecs();let[s,o]=_as_int_ratio(t);return s=i(s,M),o=n(o),new wt(0,0,_divide_and_round(e*s,o))}return b},nb$floor_divide(t){const e=this.$toMicrosecs();if(t instanceof wt){const n=t.$toMicrosecs();if(0===n)throw new A("integer division or modulo by zero");return new f(Math.floor(e/n))}if(O(t)){if(0===(t=i(t,M)))throw new A("integer division or modulo by zero");return new wt(0,0,Math.floor(e/t))}return b},nb$divide(t){const e=this.$toMicrosecs();if(t instanceof wt){if(0===t.$toMicrosecs())throw new A("integer division or modulo by zero");return new d(e/t.$toMicrosecs())}if(O(t))return t=n(t),new wt(0,0,_divide_and_round(e,t));if(S(t)){let[s,o]=_as_int_ratio(t);return s=n(s),o=i(o,M),new wt(0,0,_divide_and_round(o*e,s))}return b},nb$remainder(t){if(!(t instanceof wt))return b;const e=this.$toMicrosecs(),n=t.$toMicrosecs();if(0===n)throw new A("integer division or modulo by zero");const i=e-Math.floor(e/n)*n;return new wt(0,0,i)},nb$divmod(t){if(!(t instanceof wt))return b;const e=this.$toMicrosecs(),n=t.$toMicrosecs(),[i,s]=$divMod(e,n);return new p([new f(i),new wt(0,0,s)])},tp$richcompare(t,e){return t instanceof wt?_do_compare(this,t,e):b},tp$hash(){return-1===this.$hashcode&&(this.$hashcode=u(new p(this.$getState().map((t=>new f(t)))))),this.$hashcode},nb$bool(){return 0!==this.$days||0!==this.$secs||0!==this.$micro}},methods:{total_seconds:{$meth(){return new d(((86400*this.$days+this.$secs)*10**6+this.$micro)/10**6)},$flags:{NoArgs:!0},$doc:"Total seconds in the duration."},__reduce__:{$meth(){return new p([this.ob$type,new p(this.$getState().map((t=>D(t))))])},$flags:{NoArgs:!0},$textsig:null,$doc:"__reduce__() -> (cls, state)"}},getsets:{days:{$get(){return new f(this.$days)},$doc:"Number of days."},seconds:{$get(){return new f(this.$secs)},$doc:"Number of seconds (>= 0 and less than 1 day)."},microseconds:{$get(){return new f(this.$micro)},$doc:"Number of microseconds (>= 0 and less than 1 second)."}},proto:{$toMicrosecs(){return 1e6*(86400*this.$days+this.$secs)+this.$micro},$cmp(t){return _cmp(this.$getState(),t.$getState())},$getState(){return[this.$days,this.$secs,this.$micro]}}});wt.prototype.min=new wt(-999999999),wt.prototype.max=new wt(999999999,86399,999999),wt.prototype.resolution=new wt(0,0,1);const _t=new wt(1),pt=new wt(0,3600),gt=new wt(0,60),yt=new wt(0,1),bt=new wt(0),zt=new wt(-1),vt=E.date=h("datetime.date",{constructor:function date(t,e,n){this.$year=t,this.$month=e,this.$day=n,this.$hashcode=-1},slots:{tp$new(t,e){let n,[i,s,o]=l("date",["year","month","day"],t,e,[null,null]);if(null===s&&i instanceof _&&4===(n=i.valueOf()).length&&1<=n[2]&&n[2]<=12){const t=new this.constructor;return t.$setState(n),t}if([i,s,o]=_check_date_fields(i,s,o),this===vt.prototype)return new vt(i,s,o);{const t=new this.constructor;return vt.call(t,i,s,o),t}},$r(){return new w(`${this.tp$name}(${this.$year}, ${this.$month}, ${this.$day})`)},tp$str(){return this.tp$getattr(H).tp$call([])},tp$richcompare(t,e){return t instanceof vt?_do_compare(this,t,e):b},tp$hash(){return-1===this.$hashcode&&(this.$hashcode=u(this.$getState())),this.$hashcode},tp$as_number:!0,nb$add(t){if(t instanceof wt){const e=this.$toOrdinal()+t.$days;if(0<e&&e<=rt)return this.ob$type.tp$getattr(G).tp$call([new f(e)]);throw new M("result out of range")}return b},nb$subtract(t){if(t instanceof wt)return q(this,new wt(-t.$days),"Add");if(t instanceof vt){const e=this.$toOrdinal(),n=t.$toOrdinal();return new wt(e-n)}return b},nb$reflected_subtract:null},classmethods:{fromtimestamp:{$meth:function fromtimestamp(t){const[e,n,i]=$.localtime.tp$call([t]).v;return this.tp$call([e,n,i])},$flags:{OneArg:!0},$textsig:null,$doc:"timestamp -> local date from a POSIX timestamp (like time.time())."},fromordinal:{$meth:function fromordinal(t){return this.tp$call(_ord2ymd(t))},$flags:{OneArg:!0},$textsig:null,$doc:"int -> date corresponding to a proleptic Gregorian ordinal."},fromisocalendar:{$meth:function fromisocalendar(t,e,i){if(t=n(t),e=n(e),i=n(i),!(1<=t&&t<=j))throw new v(`Year is out of range: ${t}`);let s,o;if(!(0<e&&e<53)&&(s=!0,53===e&&(o=_ymd2ord(t,1,1)%7,(4===o||3===o&&_is_leap(t))&&(s=!1)),s))throw new v(`Invalid week: ${e}`);if(!(0<i&&i<8))throw new v(`Invalid weekday: ${i} (range is [1, 7])`);const r=7*(e-1)+(i-1),a=_isoweek1monday(t)+r;return this.tp$call(_ord2ymd(a))},$flags:{NamedArgs:["year","week","day"]},$textsig:null,$doc:"int -> date corresponding to a proleptic Gregorian ordinal."},fromisoformat:{$meth:function fromisoformat(t){if(!k(t))throw new z("fromisoformat: argument must be str");t=t.toString();try{if(10!==t.length)throw new Error;return this.tp$call(_parse_isoformat_date(t))}catch(e){throw new v("Invalid isoformat string: \'"+t+"\'")}},$flags:{OneArg:!0},$textsig:null,$doc:"str -> Construct a date from the output of date.isoformat()"},today:{$meth:function today(){const t=$.time.tp$call([]);return this.tp$getattr(B).tp$call([t])},$flags:{NoArgs:!0},$textsig:null,$doc:"Current date or datetime: same as self.__class__.fromtimestamp(time.time())."}},methods:{ctime:{$meth:function ctime(){const t=this.$toOrdinal()%7||7,e=ft[t],n=lt[this.$month];return new w(`${e} ${n} ${_d(this.$day," ",2)} 00:00:00 ${_d(this.$year,"0",4)}`)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return ctime() style string."},strftime:{$meth:function strftime(t){if(!k(t))throw new z("must be str, not "+c(t));return _wrap_strftime(this,t=t.toString(),this.$timetuple())},$flags:{OneArg:!0},$textsig:null,$doc:"format -> strftime() style string."},__format__:{$meth:function __format__(t){if(!k(t))throw new z("must be str, not "+c(t));return""!==t.v?this.tp$getattr(X).tp$call([t]):this.tp$str()},$flags:{OneArg:!0},$textsig:null,$doc:"Formats self with strftime."},timetuple:{$meth:function timetuple(){return this.$timetuple()},$flags:{NoArgs:!0},$textsig:null,$doc:"Return time tuple, compatible with time.localtime()."},isocalendar:{$meth:function isocalendar(){let t=this.$year,e=_isoweek1monday(t);const n=_ymd2ord(this.$year,this.$month,this.$day);let[i,s]=$divMod(n-e,7);return i<0?(t-=1,e=_isoweek1monday(t),[i,s]=$divMod(n-e,7)):i>=52&&n>=_isoweek1monday(t+1)&&(t+=1,i=0),new At(new f(t),new f(i+1),new f(s+1))},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a 3-tuple containing ISO year, week number, and weekday."},isoformat:{$meth:function isoformat(){return this.$isoformat()},$flags:{NoArgs:!0},$textsig:null,$doc:"Return string in ISO 8601 format, YYYY-MM-DD."},isoweekday:{$meth:function isoweekday(){return new f(this.$toOrdinal()%7||7)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return the day of the week represented by the date.\\nMonday == 1 ... Sunday == 7"},toordinal:{$meth:function toordinal(){return new f(this.$toOrdinal())},$flags:{NoArgs:!0},$textsig:null,$doc:"Return proleptic Gregorian ordinal. January 1 of year 1 is day 1."},weekday:{$meth:function weekday(){return new f((this.$toOrdinal()+6)%7)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return the day of the week represented by the date.\\nMonday == 0 ... Sunday == 6"},replace:{$meth:function replace(t,e,n){return t===y&&(t=new f(this.$year)),e===y&&(e=new f(this.$month)),n===y&&(n=new f(this.$day)),this.ob$type.tp$call([t,e,n])},$flags:{NamedArgs:["year","month","day"],Defaults:[y,y,y]},$textsig:null,$doc:"Return date with new specified fields."},__reduce__:{$meth(){return new p([this.ob$type,new p([this.$getState()])])},$flags:{NoArgs:!0},$textsig:null,$doc:"__reduce__() -> (cls, state)"}},getsets:{year:{$get(){return new f(this.$year)},$doc:"year (1-9999)"},month:{$get(){return new f(this.$month)},$doc:"month (1-12)"},day:{$get(){return new f(this.$day)},$doc:"day (1-31)"}},proto:{$cmp(t){return _cmp([this.$year,this.$month,this.$day],[t.$year,t.$month,t.$day])},$getState(){const[t,e]=$divMod(this.$year,256);return new _([t,e,this.$month,this.$day])},$setState(t){const[e,n,i,s]=t,o=256*e+n;this.$year=o,this.$month=i,this.$day=s},$toOrdinal(){return _ymd2ord(this.$year,this.$month,this.$day)},$isoformat(){return new w(`${_d(this.$year,"0",4)}-${_d(this.$month,"0",2)}-${_d(this.$day,"0",2)}`)},$timetuple(){return _build_struct_time(this.$year,this.$month,this.$day,this.$hour||0,this.$min||0,this.$sec||0,-1)},$strftime(t=""){return _wrap_strftime(this,t.toString(),this.$timetuple())}}});vt.prototype.min=new vt(1,1,1),vt.prototype.max=new vt(9999,12,31),vt.prototype.resolution=new wt(1);const Mt=E.tzinfo=h("datetime.tzinfo",{constructor:function tzinfo(){},methods:{tzname:{$meth:function tzname(t){throw new x("tzinfo subclass must override tzname()")},$flags:{OneArg:!0},$textsig:null,$doc:"datetime -> string name of time zone."},utcoffset:{$meth:function utcoffset(t){throw new x("tzinfo subclass must override utcoffset()")},$flags:{OneArg:!0},$textsig:null,$doc:"datetime -> timedelta showing offset from UTC, negative values indicating West of UTC"},dst:{$meth:function dst(t){throw new x("tzinfo subclass must override dst()")},$flags:{OneArg:!0},$textsig:null,$doc:"datetime -> DST offset as timedelta positive east of UTC."},fromutc:{$meth:function fromutc(e){if(!(e instanceof Nt))throw new z("fromutc() requires a datetime argument");if(e.$tzinfo!==this)throw new v("dt.tzinfo is not self");const n=r(e.tp$getattr(U));if(n===y)throw new v("fromutc() requires a non-None utcoffset() result");let i=r(e.tp$getattr(F));if(i===y)throw new v("fromutc() requires a non-None dst() result");const s=q(n,i,"Sub");if(t(s)&&(e=q(e,s,"Add"),i=r(e.tp$getattr(F)),i===y))throw new v("fromutc(): dt.dst gave inconsistent results; cannot convert");return q(e,i,"Add")},$flags:{OneArg:!0},$textsig:null,$doc:"datetime in UTC -> datetime in local time."},__reduce__:{$meth(){let e,n;const i=T(this,new w("__getinitargs__"),y);e=i!==y?r(i,[]):new p;const s=T(this,new w("__getstate__"),y);return s!==y?n=r(s,[]):(n=T(this,new w("__dict__"),y),n=t(n)?n:y),new p(n===y?[this.ob$type,e]:[this.ob$type,e,n])},$flags:{NoArgs:!0},$textsig:null,$doc:"-> (cls, state)"}}}),At=h("datetime.IsoCalendarDate",{base:p,constructor:function IsoCalendarDate(t,e,n){this.y=t,this.w=e,this.wd=n,p.call(this,[t,e,n])},slots:{tp$new(t,e){const[n,i,s]=l("IsoCalendarDate",["year","week","weekday"],t,e);return new this.constructor(n,i,s)},$r(){return new w(`${this.tp$name}(year=${this.y}, week=${this.w}, weekday=${this.wd})`)}},getsets:{year:{$get(){return this.y}},week:{$get(){return this.w}},weekday:{$get(){return this.wd}}}}),xt=E.time=h("datetime.time",{constructor:function time(t=0,e=0,n=0,i=0,s=null,o=0){this.$hour=t,this.$min=e,this.$sec=n,this.$micro=i,this.$tzinfo=s||y,this.$fold=o,this.$hashcode=-1},slots:{tp$new(t,e){m("time",t,0,5);let n,[i,s,o,r,a,$]=l("time",["hour","minute","second","microsecond","tzinfo","fold"],t,e,[W,W,W,W,y,W]);if(i instanceof _&&6===(n=i.valueOf()).length&&(127&n[0])<24){const t=new this.constructor;return t.$setState(n,s===W?y:s),t}if([i,s,o,r,$]=_check_time_fields(i,s,o,r,$),_check_tzinfo_arg(a),this===xt.prototype)return new xt(i,s,o,r,a,$);{const t=new this.constructor;return xt.call(t,i,s,o,r,a,$),t}},tp$richcompare(t,e){return t instanceof xt?_do_compare(this,t,e):b},tp$hash(){if(-1===this.$hashcode){const e=this.$fold?r(this.tp$getattr(J),[],["fold",W]):this,n=r(e.tp$getattr(U));if(t(n)){let[t,e]=pyDivMod(new wt(0,3600*this.$hour+60*this.$min).nb$subtract(n),pt);e=e.nb$floor_divide(gt),0<=t&&t<=24?(t=I(t),e=I(e),this.$hashcode=u(new xt(t,e,this.$sec,this.$micro))):this.$hashcode=u(new p([t,e,new f(this.$sec),new f(this.$micro)]))}else this.$hashcode=u(e.$getState()[0])}return this.$hashcode},$r(){let t;return t=0!==this.$micro?`, ${this.$sec}, ${this.$micro}`:0!==this.$sec?`, ${this.$sec}`:"",t=`${this.tp$name}(${this.$hour}, ${this.$min}${t})`,this.$tzinfo!==y&&(t=t.slice(0,-1)+", tzinfo="+s(this.$tzinfo)+")"),this.$fold&&(t=t.slice(0,-1)+", fold=1)"),new w(t)},tp$str(){return this.tp$getattr(H).tp$call([])}},methods:{isoformat:{$meth:function isoformat(t){let e=_format_time(this.$hour,this.$min,this.$sec,this.$micro,t);const n=this.$tzstr();return n&&(e+=n),new w(e)},$flags:{NamedArgs:["timespec"],Defaults:[C]},$textsig:null,$doc:"Return string in ISO 8601 format, [HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].\\n\\ntimespec specifies what components of the time to include.\\n"},strftime:{$meth:function strftime(t){if(!k(t))throw new z("must be str, not "+c(t));return _wrap_strftime(this,t=t.toString(),new p([1900,1,1,this.$hour,this.$min,this.$sec,0,1,-1].map((t=>new f(t)))))},$flags:{OneArg:!0},$textsig:null,$doc:"format -> strftime() style string."},__format__:{$meth:function __format__(t){if(!k(t))throw new z("must be str, not "+c(t));return""!==t.v?this.tp$getattr(X).tp$call([t]):this.tp$str()},$flags:{OneArg:!0},$textsig:null,$doc:"Formats self with strftime."},utcoffset:{$meth:function utcoffset(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(U),e=r(t,[y]);return _check_utc_offset("utcoffset",e),e},$flags:{NoArgs:!0},$textsig:null,$doc:"Return self.tzinfo.utcoffset(self)."},tzname:{$meth:function tzname(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(Y),e=r(t,[y]);return _check_tzname(e),e},$flags:{NoArgs:!0},$textsig:null,$doc:"Return self.tzinfo.tzname(self)."},dst:{$meth:function dst(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(F),e=r(t,[y]);return _check_utc_offset("dst",e),e},$flags:{NoArgs:!0},$textsig:null,$doc:"Return self.tzinfo.dst(self)."},replace:{$meth:function replace(t,e){m("replace",t,0,5);let[n,i,s,o,r,a]=l("replace",["hour","minute","second","microsecond","tzinfo","fold"],t,e,[y,y,y,y,g,y]);return n===y&&(n=new f(this.$hour)),i===y&&(i=new f(this.$min)),s===y&&(s=new f(this.$sec)),o===y&&(o=new f(this.$micro)),r===g&&(r=this.$tzinfo),a===y&&(a=new f(this.$fold)),this.ob$type.tp$call([n,i,s,o,r],["fold",a])},$flags:{FastCall:!0},$textsig:null,$doc:"Return time with new specified fields."},__reduce_ex__:{$meth(t){return new p([this.ob$type,new p(this.$getState(R(t)))])},$flags:{OneArg:!0},$textsig:null,$doc:"__reduce_ex__(proto) -> (cls, state)"},__reduce__:{$meth(){return this.tp$getattr(new w("__reduce_ex__")).tp$call([new f(2)])},$flags:{NoArgs:!0},$textsig:null,$doc:"__reduce__() -> (cls, state)"}},classmethods:{fromisoformat:{$meth:function fromisoformat(t){if(!k(t))throw new z("fromisoformat: argument must be str");t=t.toString();try{return this.tp$call(_parse_isoformat_time(t))}catch{throw new v("Invalid isofrmat string: \'"+t+"\'")}},$flags:{OneArg:!0},$textsig:null,$doc:"string -> time from time.isoformat() output"}},getsets:{hour:{$get(){return new f(this.$hour)}},minute:{$get(){return new f(this.$min)}},second:{$get(){return new f(this.$sec)}},microsecond:{$get(){return new f(this.$micro)}},tzinfo:{$get(){return this.$tzinfo}},fold:{$get(){return new f(this.$fold)}}},proto:{$cmp(t,n){const s=this.$tzinfo,o=t.$tzinfo;let a,$,c;if(a=$=y,s===o?c=!0:(a=r(this.tp$getattr(U)),$=r(t.tp$getattr(U)),c=e(a,$,"Eq")),c)return _cmp([this.$hour,this.$min,this.$sec,this.$micro],[t.$hour,t.$min,t.$sec,t.$micro]);if(a===y||$===y){if("Eq"===n||"NotEq"===n)return 2;throw new z("cannot compare naive and aware times")}const h=60*this.$hour+this.$min-i(a.nb$floor_divide(gt)),m=60*t.$hour+t.$min-i($.nb$floor_divide(gt));return _cmp([h,this.$sec,this.$micro],[m,t.$sec,t.$micro])},$tzstr(){return _format_offset(r(this.tp$getattr(U)))},$getState(t=3){let[e,n]=$divMod(this.$micro,256),[i,s]=$divMod(e,256),o=this.$hour;this.$fold&&t>3&&(o+=128);const r=new _([o,this.$min,this.$sec,i,s,n]);return this.$tzinfo===y?[r]:[r,this.$tzinfo]},$setState(t,e){const[n,i,s,o,r,a]=t;n>127?(this.$fold=1,this.$hour=n-128):(this.$fold=0,this.$hour=n),this.$min=i,this.$sec=s,this.$micro=(o<<8|r)<<8|a,this.$tzinfo=e}}});xt.prototype.min=new xt(0,0,0),xt.prototype.max=new xt(23,59,59,999999),xt.prototype.resolution=new wt;const Nt=E.datetime=h("datetime.datetime",{base:vt,constructor:function datetime(t,e,n,i=0,s=0,o=0,r=0,a=null,$=0){this.$year=t,this.$month=e,this.$day=n,this.$hour=i,this.$min=s,this.$sec=o,this.$micro=r,this.$tzinfo=a||y,this.$fold=$,this.$hashcode=-1},slots:{tp$new(t,e){m("datetime",t,0,9);let n,[i,s,o,r,a,$,c,h,u]=l("time",["year","month","day","hour","minute","second","microsecond","tzinfo","fold"],t,e,[null,null,W,W,W,W,y,W]);if(i instanceof _&&10===(n=i.valueOf()).length&&(127&n[2])<=12){const t=new this.constructor;return t.$setState(n,null===s?y:s),t}if([i,s,o]=_check_date_fields(i,s,o),[r,a,$,c,u]=_check_time_fields(r,a,$,c,u),_check_tzinfo_arg(h),this===Nt.prototype)return new Nt(i,s,o,r,a,$,c,h,u);{const t=new this.constructor;return Nt.call(t,i,s,o,r,a,$,c,h,u),t}},$r(){const t=[this.$year,this.$month,this.$day,this.$hour,this.$min,this.$sec,this.$micro];0===t[t.length-1]&&t.pop(),0===t[t.length-1]&&t.pop();let e=`${this.tp$name}(${t.join(", ")})`;return this.$tzinfo!==y&&(e=e.slice(0,-1)+", tzinfo="+s(this.$tzinfo)+")"),this.$fold&&(e=e.slice(0,-1)+", fold=1)"),new w(e)},tp$str(){return this.tp$getattr(H).tp$call([],["sep",new w(" ")])},tp$richcompare(t,e){if(t instanceof Nt)return _do_compare(this,t,e);if(!(t instanceof vt))return b;if("Eq"===e||"NotEq"===e)return"NotEq"===e;throw new z(`can\'t compare \'${c(this)}\' to \'${c(t)}\'`)},tp$as_number:!0,nb$add(t){if(!(t instanceof wt))return b;let e=new wt(this.$toOrdinal(),3600*this.$hour+60*this.$min+this.$sec,this.$micro);e=q(e,t,"Add");let[n,i]=$divMod(e.$secs,3600),[s,o]=$divMod(i,60);if(0<e.$days&&e.$days<=rt)return this.ob$type.tp$getattr(new w("combine")).tp$call([vt.tp$call(_ord2ymd(e.$days)),new xt(n,s,o,e.$micro,this.$tzinfo)]);throw new M("result out of range")},nb$subtract(t){if(!(t instanceof Nt))return t instanceof wt?this.nb$add(t.nb$negative()):b;const n=this.$toOrdinal(),i=t.$toOrdinal(),s=this.$sec+60*this.$min+3600*this.$hour,o=t.$sec+60*t.$min+3600*t.$hour,a=new wt(n-i,s-o,this.$micro-t.$micro);if(this.$tzinfo===t.$tzinfo)return a;const $=r(this.tp$getattr(U)),c=r(t.tp$getattr(U));if(e($,c,"Eq"))return a;if($===y||c===y)throw new z("cannot mix naive and timezone-aware time");return a.nb$add(c).nb$subtract($)},nb$reflected_subtract:null,tp$hash(){if(-1===this.$hashcode){const t=this.$fold?r(this.tp$getattr(J),[],["fold",W]):this,e=r(t.tp$getattr(U));if(e===y)this.$hashcode=u(t.$getState()[0]);else{const t=_ymd2ord(this.$year,this.$month,this.$day),n=3600*this.$hour+60*this.$min+this.$sec;this.$hashcode=u(new wt(t,n,this.$micro).nb$subtract(e))}}return this.$hashcode}},methods:{date:{$meth:function _date(){return new vt(this.$year,this.$month,this.$day)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return date object with same year, month and day."},time:{$meth:function _time(){return new xt(this.$hour,this.$min,this.$sec,this.$micro,y,this.$fold)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return time object with same time but with tzinfo=None."},timetz:{$meth:function timetz(){return new xt(this.$hour,this.$min,this.$sec,this.$micro,this.$tzinfo,this.$fold)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return time object with same time and tzinfo."},ctime:{$meth:function ctime(){const t=this.$toOrdinal()%7||7,e=ft[t],n=lt[this.$month];return new w(`${e} ${n} ${_d(this.$day," ",2)} ${_d(this.$hour,"0",2)}:${_d(this.$min,"0",2)}:${_d(this.$sec,"0",2)} ${_d(this.$year,"0",4)}`)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return ctime() style string."},timetuple:{$meth:function timetuple(){let e=r(this.tp$getattr(F));return e=e===y?-1:t(e)?1:0,_build_struct_time(this.$year,this.$month,this.$day,this.$hour,this.$min,this.$sec,e)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return time tuple, compatible with time.localtime()."},timestamp:{$meth:function timestamp(){if(this.$tzinfo===y){let t=this.$mkTime();return t=I(t),new d(t+this.$micro/1e6)}{const t=q(this,kt,"Sub");return new d(((86400*t.$days+t.$secs)*10**6+t.$micro)/10**6)}},$flags:{NoArgs:!0},$textsig:null,$doc:"Return POSIX timestamp as float."},utctimetuple:{$meth:function utctimetuple(){const e=r(this.tp$getattr(U));let n=this;return t(e)&&(n=q(n,e,"Sub")),_build_struct_time(n.$year,n.$month,n.$day,n.$hour,n.$min,n.$sec,0)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return UTC time tuple, compatible with time.localtime()."},isoformat:{$meth:function isoformat(t,e){if(!k(t))throw new z("sep must be str, not "+c(t));let n=`${_d(this.$year,"0",4)}-${_d(this.$month,"0",2)}-${_d(this.$day,"0",2)}`+t.toString();n+=_format_time(this.$hour,this.$min,this.$sec,this.$micro,e);const i=_format_offset(r(this.tp$getattr(U)));return i&&(n+=i),new w(n)},$flags:{NamedArgs:["sep","timespec"],Defaults:[new w("T"),C]},$textsig:null,$doc:"[sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].\\nsep is used to separate the year from the time, and defaults to \'T\'.\\ntimespec specifies what components of the time to include (allowed values are \'auto\', \'hours\', \'minutes\', \'seconds\', \'milliseconds\', and \'microseconds\').\\n"},utcoffset:{$meth:function utcoffset(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(U),e=r(t,[this]);return _check_utc_offset("utcoffset",e),e},$flags:{NoArgs:!0},$textsig:null,$doc:"Return self.tzinfo.utcoffset(self)."},tzname:{$meth:function tzname(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(Y),e=r(t,[this]);return _check_tzname(e),e},$flags:{NoArgs:!0},$textsig:null,$doc:"Return self.tzinfo.tzname(self)."},dst:{$meth:function dst(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(F),e=r(t,[this]);return _check_utc_offset("dst",e),e},$flags:{NoArgs:!0},$textsig:null,$doc:"Return self.tzinfo.dst(self)."},replace:{$meth:function replace(t,e){m("replace",t,0,8);let[n,i,s,o,r,a,$,c,h]=l("replace",["year","month","day","hour","minute","second","microsecond","tzinfo","fold"],t,e,[y,y,y,y,y,y,y,g,y]);return n===y&&(n=new f(this.$year)),i===y&&(i=new f(this.$month)),s===y&&(s=new f(this.$day)),o===y&&(o=new f(this.$hour)),r===y&&(r=new f(this.$min)),a===y&&(a=new f(this.$sec)),$===y&&($=new f(this.$micro)),c===g&&(c=this.$tzinfo),h===y&&(h=new f(this.$fold)),this.ob$type.tp$call([n,i,s,o,r,a,$,c],["fold",h])},$flags:{FastCall:!0},$textsig:null,$doc:"Return datetime with new specified fields."},astimezone:{$meth:function astimezone(t){if(t===y)t=this.$localTimezone();else if(!(t instanceof Mt))throw new z("tz argument must be an instance of tzinfo");let e,n=this.$tzinfo;if(n===y?(n=this.$localTimezone(),e=r(n.tp$getattr(U),[this])):(e=r(n.tp$getattr(U),[this]),e===y&&(n=r(this.tp$getattr(J),[],["tzinfo",y]).$localTimezone(),e=r(n.tp$getattr(U),[this]))),t===n)return this;const i=r(this.nb$subtract(e).tp$getattr(J),[],["tzinfo",t]);return t.tp$getattr(P).tp$call([i])},$flags:{NamedArgs:["tz"],Defaults:[y]},$textsig:null,$doc:"tz -> convert to local time in new timezone tz\\n"},__reduce_ex__:{$meth(t){return new p([this.ob$type,new p(this.$getState(R(t)))])},$flags:{OneArg:!0},$textsig:null,$doc:"__reduce_ex__(proto) -> (cls, state)"},__reduce__:{$meth(){return this.tp$getattr(new w("__reduce_ex__")).tp$call([new f(2)])},$flags:{NoArgs:!0},$textsig:null,$doc:"__reduce__() -> (cls, state)"}},classmethods:{now:{$meth:function now(t){const e=$.time.tp$call([]);return this.tp$getattr(B).tp$call([e,t])},$flags:{NamedArgs:["tz"],Defaults:[y]},$textsig:"($type, /, tz=None)",$doc:"Returns new datetime object representing current time local to tz.\\n\\n tz\\n Timezone object.\\n\\nIf no tz is specified, uses local timezone."},utcnow:{$meth:function utcnow(){const t=$.time.tp$call([]);return this.tp$getattr(L).tp$call([t])},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a new datetime representing UTC day and time."},fromtimestamp:{$meth:function fromtimestamp(t,e){return _check_tzinfo_arg(e),this.prototype.$fromtimestamp.call(this,t,e!==y,e)},$flags:{NamedArgs:["timestamp","tz"],Defaults:[y]},$textsig:null,$doc:"timestamp[, tz] -> tz\'s local time from POSIX timestamp."},utcfromtimestamp:{$meth:function utcfromtimestamp(t){return this.prototype.$fromtimestamp.call(this,t,!0,y)},$flags:{OneArg:!0},$textsig:null,$doc:"Construct a naive UTC datetime from a POSIX timestamp."},strptime:{$meth:function strptime(t,e){return null===ot?Sk.misceval.chain(Sk.importModule("_strptime",!1,!0),(n=>(ot=n.tp$getattr(new w("_strptime_datetime")),ot.tp$call([this,t,e])))):ot.tp$call([this,t,e])},$flags:{MinArgs:2,MaxArgs:2},$textsig:null,$doc:"string, format -> new datetime parsed from a string (like time.strptime())."},combine:{$meth:function combine(t,e,n){if(!(t instanceof vt))throw new z("date argument must be a date instance");if(!(e instanceof xt))throw new z("time argument must be a time instance");n===g&&(n=e.$tzinfo);const i=[t.$year,t.$month,t.$day,e.$hour,e.$min,e.$sec,e.$micro].map((t=>new f(t)));return i.push(n),this.tp$call(i,["fold",new f(e.$fold)])},$flags:{NamedArgs:["date","time","tzinfo"],Defaults:[g]},$textsig:null,$doc:"date, time -> datetime with same date and time fields"},fromisoformat:{$meth:function fromisoformat(t){if(!k(t))throw new z("fromisoformat: argument must be str");const e=(t=t.toString()).slice(0,10),n=t.slice(11);let i,s;try{i=_parse_isoformat_date(e)}catch(o){throw new v("Invalid isoformat string: \'"+t+"\'")}if(n)try{s=_parse_isoformat_time(n)}catch(o){throw new v("Invalid isoformat string: \'"+t+"\'")}else s=[W,W,W,W,y];return this.tp$call(i.concat(s))},$flags:{OneArg:!0},$textsig:null,$doc:"string -> datetime from datetime.isoformat() output"}},getsets:{hour:{$get(){return new f(this.$hour)}},minute:{$get(){return new f(this.$min)}},second:{$get(){return new f(this.$sec)}},microsecond:{$get(){return new f(this.$micro)}},tzinfo:{$get(){return this.$tzinfo}},fold:{$get(){return new f(this.$fold)}}},proto:{$cmp(n,i){const s=this.$tzinfo,o=n.$tzinfo;let a,$,c;if(a=$=y,s===o)c=!0;else{if(a=r(this.tp$getattr(U)),$=r(n.tp$getattr(U)),"Eq"===i||"NotEq"===i){const t=r(this.tp$getattr(J),[],["fold",new f(Number(!this.$fold))]);if(e(a,r(t.tp$getattr(U)),"NotEq"))return 2;const i=r(n.tp$getattr(J),[],["fold",new f(Number(!n.$fold))]);if(e($,r(i.tp$getattr(U)),"NotEq"))return 2}c=e(a,$,"Eq")}if(c)return _cmp([this.$year,this.$month,this.$day,this.$hour,this.$min,this.$sec,this.$micro],[n.$year,n.$month,n.$day,n.$hour,n.$min,n.$sec,n.$micro]);if(a===y||$===y){if("Eq"===i||"NotEq"===i)return 2;throw new z("cannot compare naive and aware datetimes")}const h=this.nb$subtract(n);return h.$days<0?-1:t(h)?1:0},$mkTime(){const t=new Nt(1970,1,1),e=this.nb$subtract(t).nb$floor_divide(yt);function local(e){const[n,i,s,o,r,a]=$.localtime.tp$call([e]).v;return Nt.tp$call([n,i,s,o,r,a]).nb$subtract(t).nb$floor_divide(yt)}let n,i,s=local(e).nb$subtract(e),o=e.nb$subtract(s),r=local(o);if(r.ob$eq(e)){if(n=o.nb$add([new f(-86400),new f(86400)][this.$fold]),i=local(n).nb$subtract(n),s.ob$eq(i))return o}else i=r.nb$subtract(o);n=e.nb$subtract(i);if(local(n).ob$eq(e))return n;if(r.ob$eq(e))return o;const a=o.ob$ge(n)?o:n;return[a,o===a?n:o][this.$fold]},$fromtimestamp(t,n,s){let o;if(!N(t))throw new z("a number is required, (got \'"+c(t)+"\'");[o,t]=modf(t);let a=intRound(q(o,nt,"Mult"));a=a.v,t=t.v,a>=1e6?(t+=1,a-=1e6):a<0&&(t-=1,a+=1e6),t=new f(t),Number.isInteger(a)||(a=Math.trunc(a)),a=new f(a);const h=n?$.gmtime:$.localtime;function converter(t){return h.tp$call([t]).v}let[m,u,l,d,_,p]=converter(t);p=new f(Math.min(i(p),59));let g=r(this,[m,u,l,d,_,p,a,s]);if(s===y){const n=86400;[m,u,l,d,_,p]=converter(q(t,new f(n),"Sub"));const i=r(this,[m,u,l,d,_,p,a,s]),o=q(q(g,i,"Sub"),new wt(0,n),"Sub");if(o.$days<0){[m,u,l,d,_,p]=converter(q(t,q(o,yt,"FloorDiv"),"Add"));const n=r(this,[m,u,l,d,_,p,a,s]);e(n,g,"Eq")&&(g.$fold=1)}}else g=r(s.tp$getattr(new w("fromutc")),[g]);return g},$localTimezone(){let t;t=this.$tzinfo===y?this.$mkTime():this.nb$subtract(kt).nb$floor_divide(yt);const e=$.localtime.tp$call([t]),n=(Nt.tp$call(e.v.slice(0,6)),e.tp$getattr(new w("tm_gmtoff"))),i=e.tp$getattr(new w("tm_zone"));return new St(wt.tp$call([W,n]),i)},$getState(t=3){let[e,n]=$divMod(this.$year,256),[i,s]=$divMod(this.$micro,256),[o,r]=$divMod(i,256),a=this.$month;this.$fold&&t>3&&(a+=128);const $=new _([e,n,a,this.$day,this.$hour,this.$min,this.$sec,o,r,s]);return this.$tzinfo===y?[$]:[$,this.$tzinfo]},$setState(t,e){const[n,i,s,o,r,a,$,c,h,m]=t;s>127?(this.$fold=1,this.$month=s-128):(this.$fold=0,this.$month=s),this.$year=256*n+i,this.$day=o,this.$hour=r,this.$min=a,this.$sec=$,this.$micro=(c<<8|h)<<8|m,this.$tzinfo=e}}});function _isoweek1monday(t){const e=_ymd2ord(t,1,1),n=(e+6)%7;let i=e-n;return n>3&&(i+=7),i}Nt.prototype.min=new Nt(1,1,1),Nt.prototype.max=new Nt(9999,12,31,23,59,59,999999),Nt.prototype.resolution=new wt(0,0,1);const St=E.timezone=h("datetime.timezone",{base:Mt,constructor:function timezone(t,n){if(this.$offset=t,this.$name=n||y,!e(this.$minoffset,t,"LtE")||!e(this.$maxoffset,t,"GtE"))throw new v("offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).")},slots:{tp$new(e,n){let[i,s]=l("timezone",["offset","name"],e,n,[null]);if(!(i instanceof wt))throw new z("offset must be a timedelta");if(null===s){if(!t(i))return this.utc;s=y}else if(!k(s))throw new z("name must be a string");if(this===St.prototype)return new St(i,s);{const t=new this.constructor;return St.call(t,i,s),t}},tp$richcompare(t,n){if(!(t instanceof St))return b;const i=e(this.$offset,t.$offset,"Eq");return"NotEq"===n?!i:"Eq"===n||i&&o(n)?i:b},$r(){return this===this.utc?new w("datetime.timezone.utc"):this.$name===y?new w(`${this.tp$name}(${s(this.$offset)})`):new w(`${this.tp$name}(${s(this.$offset)}, ${s(this.$name)})`)},tp$str(){return this.tp$getattr(Y).tp$call([y])},tp$hash(){return u(this.$offset)}},methods:{tzname:{$meth:function tzname(t){if(t instanceof Nt||t===y)return this.$name===y?this.$nameFromOff(this.$offset):this.$name;throw new z("tzname() argument must be a datetime instance or None")},$flags:{OneArg:!0},$textsig:null,$doc:"If name is specified when timezone is created, returns the name. Otherwise returns offset as \'UTC(+|-)HH:MM\'."},utcoffset:{$meth:function utcoffset(t){if(t instanceof Nt||t===y)return this.$offset;throw new z("utcoffset() argument must be a datetime instance or None")},$flags:{OneArg:!0},$textsig:null,$doc:"Return fixed offset."},dst:{$meth:function dst(t){if(t instanceof Nt||t===y)return y;throw new z("dst() argument must be a datetime instance or None")},$flags:{OneArg:!0},$textsig:null,$doc:"Return None."},fromutc:{$meth:function fromutc(t){if(t instanceof Nt){if(t.$tzinfo!==this)throw new v("fromutc: dt.tzinfo is not self");return q(t,this.$offset,"Add")}throw new z("fromutc() argument must be a datetime instance or None")},$flags:{OneArg:!0},$textsig:null,$doc:"datetime in UTC -> datetime in local time."},__getinitargs__:{$meth(){return this.$name===y?new p([this.$offset]):new p([this.$offset,this.$name])},$flags:{NoArgs:!0}}},proto:{$maxoffset:new wt(0,86399,999999),$minoffset:new wt(-1,0,1),$nameFromOff(n){if(!t(n))return new w("UTC");let i,s,o,r,a,$;return e(n,bt,"Lt")?(i="-",n=n.nb$negative()):i="+",[s,o]=pyDivMod(n,pt),[r,o]=pyDivMod(o,gt),a=o.$secs,$=o.$micro,new w($?`UTC${i}${_d(s)}:${_d(r)}:${_d(a)}.${_d($,"0",6)}`:a?`UTC${i}${_d(s)}:${_d(r)}:${_d(a)}`:`UTC${i}${_d(s)}:${_d(r)}`)}}});St.prototype.utc=new St(new wt(0)),St.prototype.min=new St(new wt(0,-86340,0)),St.prototype.max=new St(new wt(0,86340,0));const kt=new Nt(1970,1,1,0,0,0,0,St.prototype.utc);return E}))}',"src/lib/document.js":'function $builtinmodule(){const{builtin:{str:i},misceval:{callsimArray:n},ffi:{toPy:t},abstr:{gattr:e}}=Sk,r={__name__:new i("document")},o=t(Sk.global.document);return Sk.abstr.setUpModuleMethods("document",r,{__getattr__:{$meth:i=>e(o,i,!0),$flags:{OneArg:!0}},__dir__:{$meth:()=>n(o.tp$getattr(i.$dir)),$flags:{NoArgs:!0}}}),r.currentDiv=new Sk.builtin.func((function(){if(void 0!==Sk.divid)return new Sk.builtin.str(Sk.divid);throw new Sk.builtin.AttributeError("There is no value set for divid")})),r.currentCourse=new Sk.builtin.func((function(){if(void 0!==eBookConfig)return new Sk.builtin.str(eBookConfig.course);throw new Sk.builtin.AttributeError("There is no course")})),r.currentGradingContainer=new Sk.builtin.func((function(){if(void 0!==Sk.gradeContainer)return new Sk.builtin.str(Sk.gradeContainer);if(null!=Sk.divid)return new Sk.builtin.str(Sk.divid);throw new Sk.builtin.AttributeError("There is no value set for grading")})),r.getCurrentEditorValue=new Sk.builtin.func((function(){if(void 0!==Sk.divid&&void 0!==window.componentMap){if(Sk.gradeContainer!=Sk.divid){var i=Sk.gradeContainer+" "+Sk.divid;return i in window.componentMap?new Sk.builtin.str(window.componentMap[i].editor.getValue()):new Sk.builtin.str(window.componentMap[Sk.divid].editor.getValue())}return new Sk.builtin.str(window.componentMap[Sk.divid].editor.getValue())}throw new Sk.builtin.AttributeError("Can\'t find editor for this div")})),r.popup=new Sk.builtin.func((function(i){const n=Sk.ffi.remapToJs(i);alert(n)})),r}',"src/lib/fractions.js":'function $builtinmodule(t){const e={};return Sk.misceval.chain(Sk.importModule("math",!1,!0),(t=>(e.math=t,Sk.importModule("sys",!1,!0))),(t=>(e.sys=t,fractionsMod(e))))}function fractionsMod({math:t,sys:e}){const{builtin:{int_:n,bool:{true$:i,false$:r},none:{none$:s},NotImplemented:{NotImplemented$:o},tuple:a,float_:$,complex:u,str:h,isinstance:l,TypeError:m,ZeroDivisionError:d,ValueError:f,NotImplementedError:c,abs:_,round:b,pow:p},ffi:{remapToPy:g},abstr:{buildNativeClass:w,copyKeywordsToNamedArgs:v,numberBinOp:y,typeName:k,lookupSpecial:E,checkArgsLen:N},misceval:{isTrue:F,richCompareBool:A,callsimArray:S,objectRepr:M}}=Sk,O={__name__:new h("fractions"),__all__:g(["Fraction"])},D=/^\\s*(?<sign>[-+]?)(?=\\d|\\.\\d)(?<num>\\d*)(?:(?:\\/(?<denom>\\d+))?|(?:\\.(?<decimal>\\d*))?(?:E(?<exp>[-+]?\\d+))?)\\s*$/i,q=new n(0),x=new n(1),z=new n(2),I=new n(10),T=new h("numerator"),R=new h("denominator"),B=new h("as_integer_ratio"),C=new h("from_float"),getNumer=t=>t.tp$getattr(T),getDenom=t=>t.tp$getattr(R),mul=(t,e)=>y(t,e,"Mult"),div=(t,e)=>y(t,e,"Div"),pow=(t,e)=>y(t,e,"Pow"),add=(t,e)=>y(t,e,"Add"),sub=(t,e)=>y(t,e,"Sub"),floorDiv=(t,e)=>y(t,e,"FloorDiv"),divmod=(t,e)=>y(t,e,"DivMod"),mod=(t,e)=>y(t,e,"Mod"),K=t.tp$getattr(new h("gcd")),eq=(t,e)=>A(t,e,"Eq"),lt=(t,e)=>A(t,e,"Lt"),ge=(t,e)=>A(t,e,"GtE"),L={NoArgs:!0},P={OneArg:!0},j=e.tp$getattr(new h("hash_info")),G=j.tp$getattr(new h("modulus")),V=j.tp$getattr(new h("inf"));function _operator_fallbacks(t,e){return[function(n){return isRational(n)?t(this,n):n instanceof $?e(this.nb$float(),n):n instanceof u?e(S(u,[this]),n):o},function(n){return isRational(n)?t(n,this):n instanceof $?e(n,this.nb$float()):n instanceof u?e(n,S(u,[this])):o}]}const[Z,H]=_operator_fallbacks(((t,e)=>{const n=getDenom(t),i=getDenom(e);return S(ot,[add(mul(getNumer(t),i),mul(getNumer(e),n)),mul(n,i)])}),add),[J,Q]=_operator_fallbacks(((t,e)=>{const n=getDenom(t),i=getDenom(e);return S(ot,[sub(mul(getNumer(t),i),mul(getNumer(e),n)),mul(n,i)])}),sub),[U,W]=_operator_fallbacks(((t,e)=>S(ot,[mul(getNumer(t),getNumer(e)),mul(getDenom(t),getDenom(e))])),mul),[X,Y]=_operator_fallbacks(((t,e)=>S(ot,[mul(getNumer(t),getDenom(e)),mul(getDenom(t),getNumer(e))])),div),[tt,et]=_operator_fallbacks(((t,e)=>floorDiv(mul(getNumer(t),getDenom(e)),mul(getDenom(t),getNumer(e)))),floorDiv),[nt,it]=_operator_fallbacks(((t,e)=>{const n=getDenom(t),i=getDenom(e),[r,s]=divmod(mul(getNumer(t),i),mul(n,getNumer(e))).valueOf();return new a([r,S(ot,[s,mul(n,i)])])}),divmod),[rt,st]=_operator_fallbacks(((t,e)=>{const n=getDenom(t),i=getDenom(e),r=mod(mul(getNumer(t),i),mul(getNumer(e),n));return S(ot,[r,mul(n,i)])}),mod),ot=O.Fraction=w("fractions.Fraction",{constructor:function(t,e){this.$num=t||q,this.$den=e||x},slots:{tp$new(t,e){N("Fraction",t,0,2);let[r,o,a]=v("Fraction",["numerator","denominator","_normalize"],t,e,[q,s,i]);const u=new this.constructor;if(o===s){if(r.ob$type===n)return u.$num=r,u.$den=x,u;if(isRational(r))return u.$num=getNumer(r),u.$den=getDenom(r),u;if(r instanceof $)return[u.$num,u.$den]=S(r.tp$getattr(B)).valueOf(),u;if(!(r instanceof h))throw new m("argument should be a string or a Rational instance");{const t=r.toString().match(D);if(null===t)throw new f("Invalid literal for Fraction: "+M(r));r=new n(t.groups.num||"0");const e=t.groups.denom;if(e)o=new n(e);else{o=x;const e=t.groups.decimal;if(e){const t=new n(""+10**e.length);r=add(mul(r,t),new n(e)),o=mul(o,t)}let i=t.groups.exp;i&&(i=new n(i),lt(i,q)?o=mul(o,pow(I,i.nb$negative())):r=mul(r,pow(I,i)))}"-"==t.groups.sign&&(r=r.nb$negative())}}else if(r.ob$type===n&&o.ob$type===n);else{if(!isRational(r)||!isRational(o))throw new m("both arguments should be Rational instances");[r,o]=[mul(getNumer(r),getDenom(o)),mul(getNumer(o),getDenom(r))]}if(eq(o,q))throw new d(`Fraction(${r}, 0)`);if(F(a)){let t=S(K,[r,o]);lt(o,q)&&(t=t.nb$negative()),r=floorDiv(r,t),o=floorDiv(o,t)}return u.$num=r,u.$den=o,u},$r(){const t=E(this.ob$type,h.$name);return new h(`${t}(${this.$num}, ${this.$den})`)},tp$str(){return eq(this.$den,x)?new h(this.$num):new h(`${this.$num}/${this.$den}`)},tp$hash(){const t=p(this.$den,sub(G,z),G);let e;e=F(t)?mod(mul(_(this.$num),t),G):V;let n=ge(this,q)?e:e.nb$negative();return n=n.tp$hash(),-1===n?-2:n},tp$richcompare(t,e){const op=(t,n)=>A(t,n,e);if("Eq"===e||"NotEq"==e){if(t.ob$type===n){const n=eq(this.$num,t)&&eq(this.$den,x);return"Eq"===e?n:!n}if(t instanceof ot||t instanceof n){const n=eq(this.$num,getNumer(t))&&eq(this.$den,getDenom(t));return"Eq"===e?n:!n}t instanceof u&&eq(t.tp$getattr(new h("imag")),q)&&(t=t.tp$getattr(new h("real")))}return isRational(t)?op(mul(getNumer(this),getDenom(t)),mul(getDenom(this),getNumer(t))):t instanceof $?Number.isFinite(t.valueOf())?op(this,S(this.tp$getattr(C),[t])):op(new $(0),t):o},tp$as_number:!0,nb$add:Z,nb$reflected_add:H,nb$subtract:J,nb$reflected_subtract:Q,nb$multiply:U,nb$reflected_multiply:W,nb$divide:X,nb$reflected_divide:Y,nb$floor_divide:tt,nb$reflected_floor_divide:et,nb$divmod:nt,nb$reflected_divmod:it,nb$remainder:rt,nb$reflected_remainder:st,nb$power(t){if(isRational(t)){if(eq(getDenom(t),x)){let e=getNumer(t);return ge(e,q)?S(ot,[pow(this.$num,e),pow(this.$den,e)],["_normalize",r]):ge(this.$num,q)?(e=e.nb$negative(),S(ot,[pow(this.$den,e),pow(this.$num,e)],["_normalize",r])):(e=e.nb$negative(),S(ot,[pow(this.$den.nb$negative(),e),pow(this.$num.nb$negative(),e)],["_normalize",r]))}return pow(this.nb$float(),S($,[t]))}return pow(this.nb$float(),t)},nb$reflected_power(t){return eq(this.$den,x)&&ge(this.$num,q)?pow(t,this.$num):isRational(t)?pow(new ot(getNumer(t),getDenom(t)),this):eq(this.$den,x)?pow(t,this.$num):pow(t,this.nb$float())},nb$positive(){return new ot(this.$num,this.$den)},nb$negative(){return new ot(this.$num.nb$negative(),this.$den)},nb$abs(){return new ot(this.$num.nb$abs(),this.$den)},nb$bool(){return this.$num.nb$bool()},nb$float(){return div(this.$num,this.$den)}},methods:{as_integer_ratio:{$meth(){return new a([this.$num,this.$den])},$flags:L},limit_denominator:{$meth(t){if(lt(t,x))throw new f("max_denominator should be at least 1");if(ge(t,this.$den))return S(ot,[this]);let[e,n,i,r]=[q,x,x,q],s=this.$num,o=this.$den;for(;;){const a=floorDiv(s,o),$=add(n,mul(a,r));if(lt(t,$))break;[e,n,i,r]=[i,r,add(e,mul(a,i)),$],[s,o]=[o,sub(s,mul(a,o))]}const a=floorDiv(sub(t,n),r),$=S(ot,[add(e,mul(a,i)),add(n,mul(a,r))]),u=S(ot,[i,r]);return ge(_(sub($,this)),_(sub(u,this)))?u:$},$flags:{NamedArgs:["max_denominator"],Defaults:[new n(1e6)]}},__trunc__:{$meth(){return lt(this.$num,q)?floorDiv(this.$num.nb$negative(),this.$den).nb$negative():floorDiv(this.$num,this.$den)},$flags:L},__floor__:{$meth(){return floorDiv(this.$num,this.$den)},$flags:L},__ceil__:{$meth(){return floorDiv(this.$num.nb$negative(),this.$den).nb$negative()},$flags:L},__round__:{$meth(t){if(t===s){const[t,e]=divmod(this.$num,this.$den).valueOf(),n=mul(e,z);return lt(n,this.$den)?t:lt(this.$den,n)?add(t,x):eq(mod(t,z),q)?t:add(t,x)}const e=pow(I,_(t));return lt(q,t)?S(ot,[b(mul(this,e)),e]):S(ot,[mul(b(div(this,e)),e)])},$flags:{NamedArgs:["ndigits"],Defaults:[s]}},__reduce__:{$meth(){return new a([this.ob$type,new a([new h(this)])])},$flags:L},__copy__:{$meth(){return this.ob$type===ot?this:S(this.ob$type,[this.$num,this.$den])},$flags:L},__deepcopy__:{$meth(t){return this.ob$type===ot?this:S(this.ob$type,[this.$num,this.$den])},$flags:P}},classmethods:{from_float:{$meth(t){if(t instanceof n)return S(this,[t]);if(t instanceof $){const[e,n]=S(t.tp$getattr(B)).valueOf();return S(this,[e,n])}throw new m(`${k(this)}.from_float() only takes floats, not ${M(t)}, (${k(t)})`)},$flags:P},from_decimal:{$meth(){throw c("from_decimal not yet implemented in SKulpt")},$flags:P}},getsets:{numerator:{$get(){return this.$num}},denominator:{$get(){return this.$den}},_numerator:{$get(){return this.$num},$set(t){this.$num=t}},_denominator:{$get(){return this.$den},$set(t){this.$den=t}}}}),at=new a([n,ot]),isRational=t=>F(l(t,at));return O}',"src/lib/functools.js":'function $builtinmodule(){const t={};return Sk.misceval.chain(Sk.importModule("collections",!1,!0),(e=>(t._namedtuple=e.$d.namedtuple,functools_mod(t))))}function functools_mod(t){const{object:e,int_:n,str:r,list:s,tuple:a,dict:i,none:{none$:o},bool:{false$:c},NotImplemented:{NotImplemented$:_},bool:l,func:h,method:p,TypeError:u,RuntimeError:d,ValueError:f,NotImplementedError:m,AttributeError:w,OverflowError:g,checkNone:$,checkBool:y,checkCallable:k,checkClass:b}=Sk.builtin,{callsimArray:x,callsimOrSuspendArray:A,iterFor:S,chain:E,isIndex:v,asIndexSized:N,isTrue:P,richCompareBool:j,objectRepr:R,retryOptionalSuspeionOrThrow:z,chain:q}=Sk.misceval,{remapToPy:T}=Sk.ffi,{checkOneArg:I,checkNoKwargs:C,buildNativeClass:D,setUpModuleMethods:M,keywordArrayFromPyDict:O,keywordArrayToPyDict:W,objectHash:U,lookupSpecial:F,copyKeywordsToNamedArgs:G,typeName:B,objectSetItem:K,iter:L,gattr:H}=Sk.abstr,{getSetDict:V,getAttr:J,setAttr:Q}=Sk.generic;function proxyFail(t){return new h((()=>{throw new m(t+" is not yet implemented in skulpt")}))}Object.assign(t,{__name__:new r("functools"),__doc__:new r("Tools for working with functions and callable objects"),__all__:new s(["update_wrapper","wraps","WRAPPER_ASSIGNMENTS","WRAPPER_UPDATES","total_ordering","cmp_to_key","cache","lru_cache","reduce","partial","partialmethod","singledispatch","singledispatchmethod","cached_property"].map((t=>new r(t)))),WRAPPER_ASSIGNMENTS:new a(["__module__","__name__","__qualname__","__doc__","__annotations__"].map((t=>new r(t)))),WRAPPER_UPDATES:new a([new r("__dict__")]),singledispatch:proxyFail("singledispatch"),singledispatchmethod:proxyFail("singledispatchmethod")});const X=new r("cache_parameters");function _lru_cache(e,n){if(n||(n=c),v(e))(e=N(e,g))<0&&(e=0);else{if(k(e)&&y(n)){const r=e,s=new Z(r,e=128,n);return s.tp$setattr(X,new h((()=>T({maxsize:e,typed:n})))),A(t.update_wrapper,[s,r])}if(!$(e))throw new u("Expected first argument to be an integer, a callable, or None")}return new h((r=>{const s=new Z(r,e,n);return s.tp$setattr(X,new h((()=>T({maxsize:e,typed:n})))),A(t.update_wrapper,[s,r])}))}const Y=t._CacheInfo=x(t._namedtuple,["CacheInfo",["hits","misses","maxsize","currsize"]].map((t=>T(t))),["module",new r("functools")]),Z=D("functools._lru_cache_wrapper",{constructor:function _lru_cache_wrapper(t,e,n,r){if(!k(t))throw new u("the first argument must be callable");let s;if($(e))s=infinite_lru_cache_wrapper,e=-1;else{if(!v(e))throw new u("maxsize should be integer or None");(e=N(e,g))<0&&(e=0),s=0===e?uncached_lru_cache_wrapper:bounded_lru_cache_wrapper}this.root={},this.root.prev=this.root.next=this.root,this.wrapper=s,this.maxsize=e,this.typed=n,this.cache=new i([]),this.func=t,this.misses=this.hits=0,this.$d=new i([])},slots:{tp$new(t,e){const[n,r,s,a]=G("_lru_cache_wrapper",["user_function","maxsize","typed","cache_info_type"],t,e);return new Z(n,r,s,a)},tp$call(t,e){return this.wrapper(t,e)},tp$descr_get(t,e){return null===t?this:new p(this,t)},tp$doc:"Create a cached callable that wraps another function.\\n\\nuser_function: the function being cached\\n\\nmaxsize: 0 for no caching\\n None for unlimited cache size\\n n for a bounded cache\\n\\ntyped: False cache f(3) and f(3.0) as identical calls\\n True cache f(3) and f(3.0) as distinct calls\\n\\ncache_info_type: namedtuple class with the fields:\\n hits misses currsize maxsize\\n"},methods:{cache_info:{$meth(){return A(Y,[this.hits,this.misses,-1===this.maxsize?o:this.maxsize,this.cache.get$size()].map((t=>T(t))))},$flags:{NoArgs:!0},$doc:"Report cache statistics"},cache_clear:{$meth(){return this.hits=this.misses=0,this.root={},this.root.next=this.root.prev=this.root,A(this.cache.tp$getattr(new r("clear"),!0))},$flags:{NoArgs:!0},$doc:"Clear the cache and cache statistics"},__deepcopy__:{$meth(t){return this},$flags:{OneArg:!0}},__copy__:{$meth(){return this},$flags:{NoArgs:!0}}},getsets:{__dict__:V}});function infinite_lru_cache_wrapper(t,e){const n=_make_key(t,e,this.typed),r=this.cache.mp$lookup(n);return void 0!==r?(this.hits++,r):(this.misses++,E(A(this.func,t,e),(t=>(this.cache.mp$ass_subscript(n,t),t))))}function uncached_lru_cache_wrapper(t,e){return this.misses++,A(this.func,t,e)}function bounded_lru_cache_wrapper(t,e){const n=_make_key(t,e,this.typed),r=this.cache.mp$lookup(n);if(void 0!==r){const{result:t}=r;return lru_cache_extract_link(r),lru_cache_append_link(this,r),this.hits++,t}return this.misses++,E(A(this.func,t,e),(t=>{if(void 0!==this.cache.mp$lookup(n))return t;if(this.cache.get$size()<this.maxsize||this.root.next===this.root){const e={key:n,result:t};return this.cache.mp$ass_subscript(n,e),lru_cache_append_link(this,e),t}const e=this.root.next;lru_cache_extract_link(e);if(void 0===this.cache.pop$item(e.key))throw function lru_cache_prepend_link(t,e){const n=t.root,r=n.next;r.prev=n.next=e,e.prev=n,e.next=r}(this,e),new d("cached item removed unexpectedly");return e.key=n,e.result=t,this.cache.mp$ass_subscript(n,e),lru_cache_append_link(this,e),t}))}function lru_cache_extract_link(t){const{prev:e,next:n}=t;e.next=t.next,n.prev=t.prev}function lru_cache_append_link(t,e){const n=t.root,r=n.prev;r.next=n.prev=e,e.prev=r,e.next=n}const tt=D("_HachedSeq",{base:s,constructor:function _HachedSeq(t){this.$hashval=U(new a(t)),s.call(this,t)},slots:{tp$hash(){return this.$hashval}}}),et=new e,nt=new Set([n,r]);function _make_key(t,e,n){const s=t.slice(0),i=[];if(e&&e.length){s.push(et);for(let t=0;t<e.length;t+=2){const n=e[t+1];i.push(n),s.push(new a([new r(e[t]),n]))}}if(P(n))s.push(...t.map((t=>t.ob$type)),...i.map((t=>t.ob$type)));else if(1===s.length&&nt.has(s[0].ob$type))return s[0];return new tt(s)}function partial_adjust_args_kwargs(t,e){if(t=this.arg_arr.concat(t),e){e=W(e);const t=this.kwdict.dict$copy();t.dict$merge(e),e=O(t)}else e=O(this.kwdict);return{args:t,kwargs:e}}function partial_new(t,e){if(t.length<1)throw new u("type \'partial\' takes at least 1 argument");let n,r,s=t.shift();if(s instanceof this.sk$builtinBase){const t=s;s=t.fn,n=t.arg_arr,r=t.kwdict}this.check$func(s),n&&(t=n.concat(t));let a=W(e=e||[]);if(r){const t=r.dict$copy();t.dict$merge(a),a=t}if(this.sk$builtinBase===this.constructor)return new this.constructor(s,t,a);{const e=new this.constructor;return this.sk$builtinBase.call(e,s,t,a),e}}function partial_repr(){if(this.in$repr)return new r("...");this.in$repr=!0;const t=[R(this.fn)];return this.arg_arr.forEach((e=>{t.push(R(e))})),this.kwdict.$items().forEach((([e,n])=>{t.push(e.toString()+"="+R(n))})),this.in$repr=!1,new r(this.tp$name+"("+t.join(", ")+")")}t.partial=D("functools.partial",{constructor:function partial(t,e,n){this.fn=t,this.arg_arr=e,this.arg_tup=new a(e),this.kwdict=n,this.in$repr=!1,this.$d=new i([])},slots:{tp$new:partial_new,tp$call(t,e){return({args:t,kwargs:e}=this.adj$args_kws(t,e)),this.fn.tp$call(t,e)},tp$doc:"partial(func, *args, **keywords) - new function with partial application\\n of the given arguments and keywords.\\n",$r:partial_repr,tp$getattr:J,tp$setattr:Q},getsets:{func:{$get(){return this.fn},$doc:"function object to use in future partial calls"},args:{$get(){return this.arg_tup},$doc:"tuple of arguments to future partial calls"},keywords:{$get(){return this.kwdict},$doc:"dictionary of keyword arguments to future partial calls"},__dict__:V},methods:{},classmethods:Sk.generic.classGetItem,proto:{adj$args_kws:partial_adjust_args_kwargs,check$func(t){if(!k(t))throw new u("the first argument must be callable")}}}),t.partialmethod=D("functools.partialmethod",{constructor:function partialmethod(t,e,n){this.fn=t,this.arg_arr=e,this.arg_tup=new a(e),this.kwdict=n},slots:{tp$new:partial_new,tp$doc:"Method descriptor with partial application of the given arguments\\n and keywords.\\n\\n Supports wrapping existing descriptors and handles non-descriptor\\n callables as instance methods.\\n ",$r:partial_repr,tp$descr_get(e,n){let r;if(this.fn.tp$descr_get){const s=this.fn.tp$descr_get(e,n);if(s!==this.fn){if(!k(s))throw new u("type \'partial\' requires a callable");r=new t.partial(s,this.arg_arr.slice(0),this.kwdict.dict$copy());const e=F(s,this.str$self);void 0!==e&&r.tp$setattr(this.str$self,e)}}return void 0===r&&(r=this.make$unbound().tp$descr_get(e,n)),r}},methods:{_make_unbound_method:{$meth(){return this.make$unbound()},$flags:{NoArgs:!0}}},classmethods:Sk.generic.classGetItem,getsets:{func:{$get(){return this.fn},$doc:"function object to use in future partial calls"},args:{$get(){return this.arg_tup},$doc:"tuple of arguments to future partial calls"},keywords:{$get(){return this.kwdict},$doc:"dictionary of keyword arguments to future partial calls"},__dict__:V},proto:{str$self:new r("__self__"),make$unbound(){const t=this;function _method(e,n){const r=e.shift();return({args:e,kwargs:n}=t.adj$args_kws(e,n)),e.unshift(r),A(t.fn,e,n)}return _method.co_fastcall=!0,new h(_method)},adj$args_kws:partial_adjust_args_kwargs,check$func(t){if(!k(t)&&void 0===t.tp$descr_get)throw new u(R(t)+" is not callable or a descriptor")}}});const rt={__lt__:r.$lt,__le__:r.$le,__gt__:r.$gt,__ge__:r.$ge};function from_slot(t,e){const n=rt[t];function compare_slot(t,r){let s=x(t.tp$getattr(n),[r]);return s===_?s:(s=P(s),new l(e(s,t,r)))}return compare_slot.co_name=n,compare_slot}const st=from_slot("__lt__",((t,e,n)=>!t&&j(e,n,"NotEq"))),at=from_slot("__lt__",((t,e,n)=>t||j(e,n,"Eq"))),it=from_slot("__lt__",(t=>!t)),ot=from_slot("__le__",((t,e,n)=>!t||j(e,n,"Eq"))),ct=from_slot("__le__",((t,e,n)=>t&&j(e,n,"NotEq"))),_t=from_slot("__le__",(t=>!t)),lt=from_slot("__gt__",((t,e,n)=>!t&&j(e,n,"NotEq"))),ht=from_slot("__gt__",((t,e,n)=>t||j(e,n,"Eq"))),pt=from_slot("__gt__",(t=>!t)),ut=from_slot("__ge__",((t,e,n)=>!t||j(e,n,"Eq"))),dt=from_slot("__ge__",((t,e,n)=>t&&j(e,n,"NotEq"))),ft=from_slot("__ge__",(t=>!t)),mt={__lt__:{__gt__:new h(st),__le__:new h(at),__ge__:new h(it)},__le__:{__ge__:new h(ot),__lt__:new h(ct),__gt__:new h(_t)},__gt__:{__lt__:new h(lt),__ge__:new h(ht),__le__:new h(pt)},__ge__:{__le__:new h(ut),__gt__:new h(dt),__lt__:new h(ft)}},wt={__lt__:"ob$lt",__le__:"ob$le",__gt__:"ob$gt",__ge__:"ob$ge"};const gt=new r("get"),$t=new e;t.cached_property=D("functools.cached_property",{constructor:function(){},slots:{tp$init(t,e){I("cached_property",t,e),C("cached_property",e),this._func=t[0],this._attr=o},tp$descr_get(t,e,n){if(null==t)return this;if(this._attr===o)throw new u("Cannot use cached_property instance without calling __set_name__ on it.");let s;try{s=H(t,r.$dict)}catch(c){if(c instanceof w){const e=`No \'__dict__\' attribute on \'${B(t)}\' instance to cache ${R(this._attr)} property.`;throw new u(e)}throw c}const a=H(s,gt);let i=x(a,[this._attr,$t]);if(i===$t){const e=A(this._func,[t]);i=q(e,(n=>{try{return K(s,this._attr,e),n}catch(c){if(c instanceof u){const e=`The \'__dict__\' attribute on \'${B(t)}\' instance does not support item assignment for caching ${R(this._attr)} property.`;throw new u(e)}throw c}}))}return n?i:z(i)}},getsets:{__doc__:{$get(){return this._func.tp$getattr(r.$doc)||o}}},methods:{__set_name__:{$meth(t,e){if(this._attr===o)this._attr=e;else if(e.toString()!==this._attr.toString())throw new u(`Cannot assign the same cached_property to two different names (${R(this._attr)} and ${R(e)})`)},$flags:{MinArgs:2,MaxArgs:2}}},classmethods:Sk.generic.classGetItem});const yt=new n(0),kt=D("functools.KeyWrapper",{constructor:function(t,e){this.cmp=t,this.obj=e},slots:{tp$call(t,e){const[n]=G("K",["obj"],t,e,[]);return new kt(this.cmp,n)},tp$richcompare(t,e){if(!(t instanceof kt))throw new u("other argument must be K instance");const n=this.obj,r=t.obj;if(!n||!r)throw new w("object");const s=A(this.cmp,[n,r]);return E(s,(t=>j(t,yt,e)))},tp$getattr:J,tp$hash:o},getsets:{obj:{$get(){return this.obj||o},$set(t){this.obj=t},$doc:"Value wrapped by a key function."}}}),bt=new r("update"),xt=new r("__wrapped__");return M("functools",t,{cache:{$meth:function cache(t){return A(_lru_cache(o),[t])},$flags:{OneArg:!0},$doc:\'Simple lightweight unbounded cache. Sometimes called "memoize".\',$textsig:"($module, user_function, /)"},lru_cache:{$meth:_lru_cache,$flags:{NamedArgs:["maxsize","typed"],Defaults:[new n(128),c]},$doc:"Least-recently-used cache decorator.\\n\\nIf *maxsize* is set to None, the LRU features are disabled and the cache\\ncan grow without bound.\\n\\nIf *typed* is True, arguments of different types will be cached separately.\\nFor example, f(3.0) and f(3) will be treated as distinct calls with\\ndistinct results.\\n\\nArguments to the cached function must be hashable.\\n\\nView the cache statistics named tuple (hits, misses, maxsize, currsize)\\nwith f.cache_info(). Clear the cache and statistics with f.cache_clear().\\nAccess the underlying function with f.__wrapped__.\\n\\nSee: http://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)"},cmp_to_key:{$meth:function cmp_to_key(t){return new kt(t)},$flags:{NamedArgs:["mycmp"],Defaults:[]},$doc:"Convert a cmp= function into a key= function.",$textsig:"($module, cmp, /)"},reduce:{$meth:function reduce(t,e,n){const r=L(e);let s;return n=n||r.tp$iternext(!0),E(n,(e=>{if(void 0===e)throw new u("reduce() of empty sequence with no initial value");return s=e,S(r,(e=>E(A(t,[s,e]),(t=>{s=t}))))}),(()=>s))},$flags:{MinArgs:2,MaxArgs:3},$doc:"reduce(function, sequence[, initial]) -> value\\n\\nApply a function of two arguments cumulatively to the items of a sequence,\\nfrom left to right, so as to reduce the sequence to a single value.\\nFor example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates\\n((((1+2)+3)+4)+5). If initial is present, it is placed before the items\\nof the sequence in the calculation, and serves as a default when the\\nsequence is empty.",$textsig:"($module, function, sequence[, initial], /)"},total_ordering:{$meth:function total_ordering(t){const n=[];if(!b(t))throw new u("total ordering only supported for type objects not \'"+B(t)+"\'");if(Object.keys(mt).forEach((r=>{const s=wt[r];t.prototype[s]!==e.prototype[s]&&n.push(r)})),!n.length)throw new f("must define atleast one ordering operation: <, >, <=, >=");const r=n[0];return Object.entries(mt[r]).forEach((([e,r])=>{n.includes(e)||t.tp$setattr(rt[e],r)})),t},$flags:{OneArg:!0},$doc:"Class decorator that fills in missing ordering methods"},update_wrapper:{$meth:function update_wrapper(t,e,n,r){let s,a=L(n);for(let i=a.tp$iternext();void 0!==i;i=a.tp$iternext())void 0!==(s=e.tp$getattr(i))&&t.tp$setattr(i,s);a=L(r);for(let o=a.tp$iternext();void 0!==o;o=a.tp$iternext()){s=e.tp$getattr(o)||new i([]);const n=H(t,o),r=H(n,bt);x(r,[s])}return t.tp$setattr(xt,e),t},$flags:{NamedArgs:["wrapper","wrapped","assigned","updated"],Defaults:[t.WRAPPER_ASSIGNMENTS,t.WRAPPER_UPDATES]},$doc:"Update a wrapper function to look like the wrapped function\\n\\n wrapper is the function to be updated\\n wrapped is the original function\\n assigned is a tuple naming the attributes assigned directly\\n from the wrapped function to the wrapper function (defaults to\\n functools.WRAPPER_ASSIGNMENTS)\\n updated is a tuple naming the attributes of the wrapper that\\n are updated with the corresponding attribute from the wrapped\\n function (defaults to functools.WRAPPER_UPDATES)\\n ",$textsig:"($module, /, wrapper, wrapped, assigned=(\'__module__\', \'__name__\', \'__qualname__\', \'__doc__\', \'__annotations__\'), updated=(\'__dict__\',))"},wraps:{$meth:function wraps(e,n,r){const s=["wrapped",e,"assigned",n,"updated",r];return A(t.partial,[t.update_wrapper],s)},$flags:{NamedArgs:["wrapped","assigned","updated"],Defaults:[t.WRAPPER_ASSIGNMENTS,t.WRAPPER_UPDATES]},$doc:"Decorator factory to apply update_wrapper() to a wrapper function\\n\\n Returns a decorator that invokes update_wrapper() with the decorated\\n function as the wrapper argument and the arguments to wraps() as the\\n remaining arguments. Default arguments are as for update_wrapper().\\n This is a convenience function to simplify applying partial() to\\n update_wrapper().\\n ",$textsig:"($module, /, wrapped, assigned=(\'__module__\', \'__name__\', \'__qualname__\', \'__doc__\', \'__annotations__\'), updated=(\'__dict__\',))"}}),t}',"src/lib/image.js":'var ImageMod,$builtinmodule;ImageMod||((ImageMod={}).canvasLib=[]),$builtinmodule=function(e){var n,i,t,a,u,l,r,c={__name__:new Sk.builtin.str("image")};return c.Image=Sk.misceval.buildClass(c,(function(e,n){u=function(e){e.width=e.image.width,e.height=e.image.height,e.delay=0,e.updateCount=0,e.updateInterval=1,e.lastx=0,e.lasty=0,e.canvas=document.createElement("canvas"),e.canvas.height=e.height,e.canvas.width=e.width,e.ctx=e.canvas.getContext("2d"),e.ctx.drawImage(e.image,0,0),e.imagedata=e.ctx.getImageData(0,0,e.width,e.height)},n.__init__=new Sk.builtin.func((function(e,n){var i;Sk.builtin.pyCheckArgsLen("__init__",arguments.length,2,2);try{e.image=document.getElementById(Sk.ffi.remapToJs(n)),null==e.image&&(e.image=document.querySelector(`[data-filename="${Sk.ffi.remapToJs(n)}"]`)),u(e)}catch(t){e.image=null}if(null==e.image)return(i=new Sk.misceval.Suspension).resume=function(){if(i.data.error)throw new Sk.builtin.IOError(i.data.error.message)},i.data={type:"Sk.promise",promise:new Promise((function(i,t){var a=new Image;a.crossOrigin="",a.onerror=function(){t(Error("Failed to load URL: "+a.src))},a.onload=function(){e.image=this,u(e),i()},a.src=r(n)}))},i})),r=function(e){let n=Sk.ffi.remapToJs(e);try{let e=Sk.read(n);return`data:image/${n.substring(n.lastIndexOf(".")+1)};base64, ${e}`}catch(u){console.log(`${n} is not in the database ${u}`)}var i,t,a="function"==typeof Sk.imageProxy?Sk.imageProxy:function(e){return(i=document.createElement("a")).href=t,window.location.host!==i.host?Sk.imageProxy+"/"+e:e};return t=a(t=Sk.ffi.remapToJs(e))},l=function(e,n,i){if(n<0||i<0||n>=e.width||i>=e.height)throw new Sk.builtin.ValueError("Pixel index out of range.")};var setdelay=function(e,n,i){var t;Sk.builtin.pyCheckArgsLen("setdelay",arguments.length,2,3),e.delay=Sk.ffi.remapToJs(n),t=Sk.builtin.asnum$(i),e.updateInterval=t||1};n.set_delay=new Sk.builtin.func(setdelay),n.setDelay=new Sk.builtin.func(setdelay);var getpixels=function(e){var n,i=[];for(Sk.builtin.pyCheckArgsLen("getpixels",arguments.length,1,1),n=0;n<e.image.height*e.image.width;n++)i[n]=Sk.misceval.callsimArray(e.getPixel,[e,n%e.image.width,Math.floor(n/e.image.width)]);return new Sk.builtin.tuple(i)};n.get_pixels=new Sk.builtin.func(getpixels),n.getPixels=new Sk.builtin.func(getpixels),n.getData=new Sk.builtin.func((function(e){var n,i,t,a,u,r,c,s=[];for(Sk.builtin.pyCheckArgsLen("getData",arguments.length,1,1),n=0;n<e.image.height*e.image.width;n++)i=n%e.image.width,t=Math.floor(n/e.image.width),l(e,i,t),c=4*t*e.width+4*i,a=e.imagedata.data[c],u=e.imagedata.data[c+1],r=e.imagedata.data[c+2],s[n]=new Sk.builtin.tuple([new Sk.builtin.int_(a),new Sk.builtin.int_(u),new Sk.builtin.int_(r)]);return new Sk.builtin.list(s)}));var getpixel=function(e,n,i){var t,a,u,r;return Sk.builtin.pyCheckArgsLen("getpixel",arguments.length,3,3),n=Sk.builtin.asnum$(n),i=Sk.builtin.asnum$(i),l(e,n,i),r=4*i*e.width+4*n,t=e.imagedata.data[r],u=e.imagedata.data[r+1],a=e.imagedata.data[r+2],Sk.misceval.callsimArray(c.Pixel,[t,u,a,n,i])};n.get_pixel=new Sk.builtin.func(getpixel),n.getPixel=new Sk.builtin.func(getpixel),a=function(e,n,i){var t=new Sk.misceval.Suspension;return t.resume=function(){return Sk.builtin.none.none$},t.data={type:"Sk.promise",promise:new Promise((function(n,i){e.updateCount++,e.updateCount%e.updateInterval==0||e.updateCount===e.width*e.height?(e.lastCtx.putImageData(e.imagedata,0,0),e.delay>0?window.setTimeout(n,e.delay):n()):n()}))},t};var setpixel=function(e,n,i,t){var u;return Sk.builtin.pyCheckArgsLen("setpixel",arguments.length,4,4),n=Sk.builtin.asnum$(n),i=Sk.builtin.asnum$(i),l(e,n,i),u=4*i*e.width+4*n,e.imagedata.data[u]=Sk.builtin.asnum$(Sk.misceval.callsimArray(t.getRed,[t])),e.imagedata.data[u+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(t.getGreen,[t])),e.imagedata.data[u+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(t.getBlue,[t])),e.imagedata.data[u+3]=255,a(e)};n.set_pixel=new Sk.builtin.func(setpixel),n.setPixel=new Sk.builtin.func(setpixel);var setpixelat=function(e,n,i){var t,u,r;return Sk.builtin.pyCheckArgsLen("setpixelat",arguments.length,3,3),t=(n=Sk.builtin.asnum$(n))%e.image.width,u=Math.floor(n/e.image.width),l(e,t,u),r=4*u*e.width+4*t,e.imagedata.data[r]=Sk.builtin.asnum$(Sk.misceval.callsimArray(i.getRed,[i])),e.imagedata.data[r+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(i.getGreen,[i])),e.imagedata.data[r+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(i.getBlue,[i])),e.imagedata.data[r+3]=255,a(e)};n.set_pixel_at=new Sk.builtin.func(setpixelat),n.setPixelAt=new Sk.builtin.func(setpixelat);var updatepixel=function(e,n){var i,t,u;return Sk.builtin.pyCheckArgsLen("updatepixel",arguments.length,2,2),i=Sk.builtin.asnum$(Sk.misceval.callsimArray(n.getX,[n])),t=Sk.builtin.asnum$(Sk.misceval.callsimArray(n.getY,[n])),l(e,i,t),u=4*t*e.width+4*i,e.imagedata.data[u]=Sk.builtin.asnum$(Sk.misceval.callsimArray(n.getRed,[n])),e.imagedata.data[u+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(n.getGreen,[n])),e.imagedata.data[u+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(n.getBlue,[n])),e.imagedata.data[u+3]=255,a(e)};n.update_pixel=new Sk.builtin.func(updatepixel),n.updatePixel=new Sk.builtin.func(updatepixel);var getheight=function(e){return Sk.builtin.pyCheckArgsLen("getheight",arguments.length,1,1),new Sk.builtin.int_(e.height)};n.get_height=new Sk.builtin.func(getheight),n.getHeight=new Sk.builtin.func(getheight);var getwidth=function(e,n){return Sk.builtin.pyCheckArgsLen("getwidth",arguments.length,1,1),new Sk.builtin.int_(e.width)};n.get_width=new Sk.builtin.func(getwidth),n.getWidth=new Sk.builtin.func(getwidth),n.__getattr__=new Sk.builtin.func((function(e,n){return"height"===(n=Sk.ffi.remapToJs(n))?Sk.builtin.assk$(e.height):"width"===n?Sk.builtin.assk$(e.width):void 0})),n.__setattr__=new Sk.builtin.func((function(e,n,i){throw"height"===(n=Sk.ffi.remapToJs(n))||"width"===n?new Sk.builtin.Exception("Cannot change height or width they can only be set on creation"):new Sk.builtin.Exception("Unknown attribute: "+n)})),n.draw=new Sk.builtin.func((function(e,n,i,t){var a;return Sk.builtin.pyCheckArgsLen("draw",arguments.length,2,4),(a=new Sk.misceval.Suspension).resume=function(){return Sk.builtin.none.none$},a.data={type:"Sk.promise",promise:new Promise((function(a,u){var l;n=Sk.builtin.asnum$(n),i=Sk.builtin.asnum$(i),t=Sk.builtin.asnum$(t),l=Sk.misceval.callsimArray(n.getWin,[n]).getContext("2d"),void 0===i&&(i=0,t=0),e.lastUlx=i,e.lastUly=t,e.lastCtx=l,l.putImageData(e.imagedata,i,t),e.delay>0?window.setTimeout(a,e.delay):window.setTimeout(a,200)}))},a}))}),"Image",[]),t=function(e,n){n.__init__=new Sk.builtin.func((function(e,n,i){Sk.builtin.pyCheckArgsLen("__init__",arguments.length,3,3),e.width=Sk.builtin.asnum$(n),e.height=Sk.builtin.asnum$(i),e.canvas=document.createElement("canvas"),e.ctx=e.canvas.getContext("2d"),e.canvas.height=e.height,e.canvas.width=e.width,e.imagedata=e.ctx.getImageData(0,0,e.width,e.height)}))},c.EmptyImage=Sk.misceval.buildClass(c,t,"EmptyImage",[c.Image]),i=function(e,n){n.__init__=new Sk.builtin.func((function(e,n,i,t,a,u){Sk.builtin.pyCheckArgsLen("__init__",arguments.length,4,6),e.red=Sk.builtin.asnum$(n),e.green=Sk.builtin.asnum$(i),e.blue=Sk.builtin.asnum$(t),e.x=Sk.builtin.asnum$(a),e.y=Sk.builtin.asnum$(u)}));var getred=function(e){return Sk.builtin.pyCheckArgsLen("getred",arguments.length,1,1),Sk.builtin.assk$(e.red)};n.get_red=new Sk.builtin.func(getred),n.getRed=new Sk.builtin.func(getred);var getgreen=function(e){return Sk.builtin.pyCheckArgsLen("getgreen",arguments.length,1,1),Sk.builtin.assk$(e.green)};n.get_green=new Sk.builtin.func(getgreen),n.getGreen=new Sk.builtin.func(getgreen);var getblue=function(e){return Sk.builtin.pyCheckArgsLen("getblue",arguments.length,1,1),Sk.builtin.assk$(e.blue)};n.get_blue=new Sk.builtin.func(getblue),n.getBlue=new Sk.builtin.func(getblue);var getx=function(e){return Sk.builtin.pyCheckArgsLen("getx",arguments.length,1,1),Sk.builtin.assk$(e.x)};n.get_x=new Sk.builtin.func(getx),n.getX=new Sk.builtin.func(getx);var gety=function(e){return Sk.builtin.pyCheckArgsLen("gety",arguments.length,1,1),Sk.builtin.assk$(e.y)};n.get_y=new Sk.builtin.func(gety),n.getY=new Sk.builtin.func(gety);var setred=function(e,n){Sk.builtin.pyCheckArgsLen("setred",arguments.length,2,2),e.red=Sk.builtin.asnum$(n)};n.set_red=new Sk.builtin.func(setred),n.setRed=new Sk.builtin.func(setred);var setgreen=function(e,n){Sk.builtin.pyCheckArgsLen("setgreen",arguments.length,2,2),e.green=Sk.builtin.asnum$(n)};n.set_green=new Sk.builtin.func(setgreen),n.setGreen=new Sk.builtin.func(setgreen);var setblue=function(e,n){Sk.builtin.pyCheckArgsLen("setblue",arguments.length,2,2),e.blue=Sk.builtin.asnum$(n)};n.set_blue=new Sk.builtin.func(setblue),n.setBlue=new Sk.builtin.func(setblue),n.__getattr__=new Sk.builtin.func((function(e,n){return"red"===(n=Sk.ffi.remapToJs(n))?Sk.builtin.assk$(e.red):"green"===n?Sk.builtin.assk$(e.green):"blue"===n?Sk.builtin.assk$(e.blue):void 0})),n.__setattr__=new Sk.builtin.func((function(e,n,i){"red"!==(n=Sk.ffi.remapToJs(n))&&"green"!==n&&"blue"!==n||(e[n]=Sk.builtin.asnum$(i))}));var setx=function(e,n){Sk.builtin.pyCheckArgsLen("setx",arguments.length,2,2),e.x=Sk.builtin.asnum$(n)};n.set_x=new Sk.builtin.func(setx),n.setX=new Sk.builtin.func(setx);var sety=function(e,n){Sk.builtin.pyCheckArgsLen("sety",arguments.length,2,2),e.y=Sk.builtin.asnum$(n)};n.set_y=new Sk.builtin.func(sety),n.setY=new Sk.builtin.func(sety),n.__getitem__=new Sk.builtin.func((function(e,n){return 0===(n=Sk.builtin.asnum$(n))?e.red:1==n?e.green:2==n?e.blue:void 0})),n.__str__=new Sk.builtin.func((function(e){return Sk.ffi.remapToPy("["+e.red+","+e.green+","+e.blue+"]")})),n.getColorTuple=new Sk.builtin.func((function(e,n,i){})),n.setRange=new Sk.builtin.func((function(e,n){e.max=Sk.builtin.asnum$(n)}))},c.Pixel=Sk.misceval.buildClass(c,i,"Pixel",[]),n=function(e,n){n.__init__=new Sk.builtin.func((function(e,n,i){var t,a,u;Sk.builtin.pyCheckArgsLen("__init__",arguments.length,1,3),void 0===(t=ImageMod.canvasLib[Sk.canvas])?(a=document.createElement("canvas"),u=document.getElementById(Sk.canvas),e.theScreen=a,u.appendChild(a),ImageMod.canvasLib[Sk.canvas]=a,ImageMod.canvasLib[Sk.canvas]=e.theScreen):(e.theScreen=t,e.theScreen.height=e.theScreen.height),void 0!==n?(e.theScreen.height=i.v,e.theScreen.width=n.v):(Sk.availableHeight&&(e.theScreen.height=Sk.availableHeight),Sk.availableWidth&&(e.theScreen.width=Sk.availableWidth)),e.theScreen.style.display="block"})),n.getWin=new Sk.builtin.func((function(e){return e.theScreen})),n.exitonclick=new Sk.builtin.func((function(e){var n=e.theScreen.id;e.theScreen.onclick=function(){document.getElementById(n).style.display="none",document.getElementById(n).onclick=null,delete ImageMod.canvasLib[n]}}))},c.ImageWin=Sk.misceval.buildClass(c,n,"ImageWin",[]),c};',"src/lib/itertools.js":'var $builtinmodule=function(t){const{abstr:{checkOneArg:e,copyKeywordsToNamedArgs:i,checkArgsLen:r},builtin:{tuple:s,bool:{false$:n}},misceval:{chain:o,retryOptionSuspensionOrThrow:l,isTrue:c,iterFor:a,Break:h}}=Sk,u={};function combinationsNew(t,e,i){let r,s;[r,s]=Sk.abstr.copyKeywordsToNamedArgs(t.tp$name,["iterable","r"],e,i,[]);const n=Sk.misceval.arrayFromIterable(r);if(s=Sk.misceval.asIndexSized(s,Sk.builtin.OverFlowError),s<0)throw new Sk.builtin.ValueError("r must be non-negative");if(this===t)return new t.constructor(n,s);{const e=new this.constructor;return t.constructor.call(e,n,s),e}}return u.accumulate=Sk.abstr.buildIteratorClass("itertools.accumulate",{constructor:function accumulate(t,e,i){this.iter=t,this.func=e,this.total=i,this.tp$iternext=()=>(this.total=Sk.builtin.checkNone(this.total)?this.iter.tp$iternext():this.total,this.tp$iternext=this.constructor.prototype.tp$iternext,this.total)},iternext(t){let e=this.iter.tp$iternext();if(void 0!==e)return this.total=Sk.misceval.callsimArray(this.func,[this.total,e]),this.total},slots:{tp$doc:"accumulate(iterable[, func, initial]) --\\x3e accumulate object\\n\\nReturn series of accumulated sums (or other binary function results).",tp$new(t,e){Sk.abstr.checkArgsLen("accumulate",t,0,2);let[i,r,s]=Sk.abstr.copyKeywordsToNamedArgs("accumulate",["iterable","func","initial"],t,e,[Sk.builtin.none.none$,Sk.builtin.none.none$]);if(i=Sk.abstr.iter(i),r=Sk.builtin.checkNone(r)?new Sk.builtin.func(((t,e)=>Sk.abstr.numberBinOp(t,e,"Add"))):r,this===u.accumulate.prototype)return new u.accumulate(i,r,s);{const t=new this.constructor;return u.accumulate.call(t,i,r,s),t}}}}),u.batched=Sk.abstr.buildIteratorClass("itertools.batched",{constructor:function batched(t,e,i){this.it=t,this.n=e,this.strict=i},slots:{tp$new(t,e){r("batched",t,2,2);let[s,o,l]=i("batched",[null,null,"strict"],t,e,[n]);if(o=Sk.misceval.asIndexSized(o,Sk.builtin.OverFlowError),o<1)throw new Sk.builtin.ValueError("n must be at least one");const a=Sk.abstr.iter(s);return new u.batched(a,o,c(l))},tp$doc:"Batch data into tuples of length n. The last batch may be shorter than n."},iternext(t){let e=0;const i=[],r=o(a(this.it,(t=>{if(e++,i.push(t),e===this.n)return h()})),(()=>{if(0!=e){if(e<this.n&&this.strict)throw new Sk.builtin.ValueError("batched(): incomplete batch");return new s(i)}}));return t?r:l(r)}}),u.chain=Sk.abstr.buildIteratorClass("itertools.chain",{constructor:function chain(t){this.iterables=t,this.current_it=null,this.tp$iternext=()=>{if(this.tp$iternext=this.constructor.prototype.tp$iternext,this.current_it=this.iterables.tp$iternext(),void 0!==this.current_it)return this.current_it=Sk.abstr.iter(this.current_it),this.tp$iternext();this.tp$iternext=()=>{}}},iternext(t){let e;for(;void 0===e;){if(e=this.current_it.tp$iternext(),void 0!==e)return e;if(this.current_it=this.iterables.tp$iternext(),void 0===this.current_it)return void(this.tp$iternext=()=>{});this.current_it=Sk.abstr.iter(this.current_it)}},slots:{tp$doc:"chain(*iterables) --\\x3e chain object\\n\\nReturn a chain object whose .__next__() method returns elements from the\\nfirst iterable until it is exhausted, then elements from the next\\niterable, until all of the iterables are exhausted.",tp$new(t,e){if(Sk.abstr.checkNoKwargs("chain",e),t=new Sk.builtin.tuple(t.slice(0)).tp$iter(),this===u.chain.prototype)return new u.chain(t);{const e=new this.constructor;return u.chain.call(e,t),e}}},classmethods:Object.assign({from_iterable:{$meth(t){const e=Sk.abstr.iter(t);return new u.chain(e)},$flags:{OneArg:!0},$doc:"chain.from_iterable(iterable) --\\x3e chain object\\n\\nAlternate chain() constructor taking a single iterable argument\\nthat evaluates lazily.",$textsig:null}},Sk.generic.classGetItem)}),u.combinations=Sk.abstr.buildIteratorClass("itertools.combinations",{constructor:function combinations(t,e){this.pool=t,this.r=e,this.indices=new Array(e).fill().map(((t,e)=>e)),this.n=t.length,this.tp$iternext=()=>{if(!(this.r>this.n))return this.tp$iternext=this.constructor.prototype.tp$iternext,new Sk.builtin.tuple(this.pool.slice(0,this.r))}},iternext(t){let e,i=!1;for(e=this.r-1;e>=0;e--)if(this.indices[e]!=e+this.n-this.r){i=!0;break}if(!i)return void(this.r=0);this.indices[e]++;for(let s=e+1;s<this.r;s++)this.indices[s]=this.indices[s-1]+1;const r=this.indices.map((t=>this.pool[t]));return new Sk.builtin.tuple(r)},slots:{tp$doc:"combinations(iterable, r) --\\x3e combinations object\\n\\nReturn successive r-length combinations of elements in the iterable.\\n\\ncombinations(range(4), 3) --\\x3e (0,1,2), (0,1,3), (0,2,3), (1,2,3)",tp$new(t,e){return combinationsNew.call(this,u.combinations.prototype,t,e)}}}),u.combinations_with_replacement=Sk.abstr.buildIteratorClass("itertools.combinations_with_replacement",{constructor:function combinations_with_replacement(t,e){this.pool=t,this.r=e,this.indices=new Array(e).fill(0),this.n=t.length,this.tp$iternext=()=>{if(this.r&&!this.n)return;this.tp$iternext=this.constructor.prototype.tp$iternext;const t=this.indices.map((t=>this.pool[t]));return new Sk.builtin.tuple(t)}},iternext(t){let e,i=!1;for(e=this.r-1;e>=0;e--)if(this.indices[e]!=this.n-1){i=!0;break}if(!i)return void(this.r=0);const r=this.indices[e]+1;for(let n=e;n<this.r;n++)this.indices[n]=r;const s=this.indices.map((t=>this.pool[t]));return new Sk.builtin.tuple(s)},slots:{tp$doc:"combinations_with_replacement(iterable, r) --\\x3e combinations_with_replacement object\\n\\nReturn successive r-length combinations of elements in the iterable\\nallowing individual elements to have successive repeats.\\ncombinations_with_replacement(\'ABC\', 2) --\\x3e AA AB AC BB BC CC",tp$new(t,e){return combinationsNew.call(this,u.combinations_with_replacement.prototype,t,e)}}}),u.compress=Sk.abstr.buildIteratorClass("itertools.compress",{constructor:function compress(t,e){this.data=t,this.selectors=e},iternext(){let t=this.data.tp$iternext(),e=this.selectors.tp$iternext();for(;void 0!==t&&void 0!==e;){if(Sk.misceval.isTrue(e))return t;t=this.data.tp$iternext(),e=this.selectors.tp$iternext()}},slots:{tp$doc:"compress(data, selectors) --\\x3e iterator over selected data\\n\\nReturn data elements corresponding to true selector elements.\\nForms a shorter iterator from selected data elements using the\\nselectors to choose the data elements.",tp$new(t,e){let i,r;if([i,r]=Sk.abstr.copyKeywordsToNamedArgs("compress",["data","selectors"],t,e,[]),i=Sk.abstr.iter(i),r=Sk.abstr.iter(r),this===u.count.prototype)return new u.compress(i,r);{const t=new this.constructor;return u.compress.call(t,i,r),t}}}}),u.count=Sk.abstr.buildIteratorClass("itertools.count",{constructor:function count(t,e){this.start=t,this.step=e},iternext(){const t=this.start;return this.start=Sk.abstr.numberBinOp(this.start,this.step,"Add"),t},slots:{tp$doc:"count(start=0, step=1) --\\x3e count object\\n\\nReturn a count object whose .__next__() method returns consecutive values.\\nEquivalent to:\\n\\n def count(firstval=0, step=1):\\n x = firstval\\n while 1:\\n yield x\\n x += step\\n",tp$new(t,e){const[i,r]=Sk.abstr.copyKeywordsToNamedArgs("count",["start","step"],t,e,[new Sk.builtin.int_(0),new Sk.builtin.int_(1)]);if(!Sk.builtin.checkNumber(i)&&!Sk.builtin.checkComplex(i))throw new Sk.builtin.TypeError("a number is required");if(!Sk.builtin.checkNumber(r)&&!Sk.builtin.checkComplex(r))throw new Sk.builtin.TypeError("a number is required");if(this===u.count.prototype)return new u.count(i,r);{const t=new this.constructor;return u.count.call(t,i,r),t}},$r(){const t=Sk.misceval.objectRepr(this.start);let e=Sk.misceval.objectRepr(this.step);return e="1"===e?"":", "+e,new Sk.builtin.str(Sk.abstr.typeName(this)+"("+t+e+")")}}}),u.cycle=Sk.abstr.buildIteratorClass("itertools.cycle",{constructor:function cycle(t){this.iter=t,this.saved=[],this.consumed=!1,this.i=0,this.length},iternext(){let t;if(!this.consumed){if(t=this.iter.tp$iternext(),void 0!==t)return this.saved.push(t),t;if(this.consumed=!0,this.length=this.saved.length,!this.length)return}return t=this.saved[this.i],this.i=(this.i+1)%this.length,t},slots:{tp$doc:"cycle(iterable) --\\x3e cycle object\\n\\nReturn elements from the iterable until it is exhausted.\\nThen repeat the sequence indefinitely.",tp$new(t,e){Sk.abstr.checkOneArg("cycle",t,e);const i=Sk.abstr.iter(t[0]);if(this===u.cycle.prototype)return new u.cycle(i);{const t=new this.constructor;return u.cycle.call(t,i),t}}}}),u.dropwhile=Sk.abstr.buildIteratorClass("itertools.dropwhile",{constructor:function dropwhile(t,e){this.predicate=t,this.iter=e,this.passed},iternext(){let t=this.iter.tp$iternext();for(;void 0===this.passed&&void 0!==t;){const e=Sk.misceval.callsimArray(this.predicate,[t]);if(!Sk.misceval.isTrue(e))return this.passed=!0,t;t=this.iter.tp$iternext()}return t},slots:{tp$doc:"dropwhile(predicate, iterable) --\\x3e dropwhile object\\n\\nDrop items from the iterable while predicate(item) is true.\\nAfterwards, return every element until the iterable is exhausted.",tp$new(t,e){Sk.abstr.checkNoKwargs("dropwhile",e),Sk.abstr.checkArgsLen("dropwhile",t,2,2);const i=t[0],r=Sk.abstr.iter(t[1]);if(this===u.dropwhile.prototype)return new u.dropwhile(i,r);{const t=new this.constructor;return u.dropwhile.call(t,i,r),t}}}}),u.filterfalse=Sk.abstr.buildIteratorClass("itertools.filterfalse",{constructor:function filterfalse(t,e){this.predicate=t,this.iter=e},iternext(t){let e=this.iter.tp$iternext();if(void 0===e)return;let i=Sk.misceval.callsimArray(this.predicate,[e]);for(;Sk.misceval.isTrue(i);){if(e=this.iter.tp$iternext(),void 0===e)return;i=Sk.misceval.callsimArray(this.predicate,[e])}return e},slots:{tp$doc:"filterfalse(function or None, sequence) --\\x3e filterfalse object\\n\\nReturn those items of sequence for which function(item) is false.\\nIf function is None, return the items that are false.",tp$new(t,e){Sk.abstr.checkNoKwargs("filterfalse",e),Sk.abstr.checkArgsLen("filterfalse",t,2,2);const i=Sk.builtin.checkNone(t[0])?Sk.builtin.bool:t[0],r=Sk.abstr.iter(t[1]);if(this===u.filterfalse.prototype)return new u.filterfalse(i,r);{const t=new this.constructor;return u.filterfalse.call(t,i,r),t}}}}),u._grouper=Sk.abstr.buildIteratorClass("itertools._grouper",{constructor:function _grouper(t,e){this.groupby=t,this.tgtkey=t.tgtkey,this.id=t.id},iternext(t){const e=Sk.misceval.richCompareBool(this.groupby.currkey,this.tgtkey,"Eq");if(this.groupby.id===this.id&&e){let t=this.groupby.currval;return this.groupby.currval=this.groupby.iter.tp$iternext(),void 0!==this.groupby.currval&&(this.groupby.currkey=Sk.misceval.callsimArray(this.groupby.keyf,[this.groupby.currval])),t}}}),u.groupby=Sk.abstr.buildIteratorClass("itertools.groupby",{constructor:function groupby(t,e){this.iter=t,this.keyf=e,this.currval,this.currkey=this.tgtkey=new Sk.builtin.object,this.id},iternext(t){this.id=new Object;let e=Sk.misceval.richCompareBool(this.currkey,this.tgtkey,"Eq");for(;e;){if(this.currval=this.iter.tp$iternext(),void 0===this.currval)return;this.currkey=Sk.misceval.callsimArray(this.keyf,[this.currval]),e=Sk.misceval.richCompareBool(this.currkey,this.tgtkey,"Eq")}this.tgtkey=this.currkey;const i=new u._grouper(this);return new Sk.builtin.tuple([this.currkey,i])},slots:{tp$doc:"groupby(iterable, key=None) -> make an iterator that returns consecutive\\nkeys and groups from the iterable. If the key function is not specified or\\nis None, the element itself is used for grouping.\\n",tp$new(t,e){let i,r;if([i,r]=Sk.abstr.copyKeywordsToNamedArgs("groupby",["iterable","key"],t,e,[Sk.builtin.none.none$]),i=Sk.abstr.iter(i),r=Sk.builtin.checkNone(r)?new Sk.builtin.func((t=>t)):r,this===u.groupby.prototype)return new u.groupby(i,r);{const t=new this.constructor;return u.groupby.call(t,i,r),t}}}}),u.islice=Sk.abstr.buildIteratorClass("itertools.islice",{constructor:function islice(t,e,i,r){this.iter=t,this.previt=e,this.stop=i,this.step=r,this.tp$iternext=()=>{if(this.tp$iternext=this.constructor.prototype.tp$iternext,!(this.previt>=this.stop)){for(let t=0;t<this.previt;t++)this.iter.tp$iternext();return this.iter.tp$iternext()}for(let t=0;t<this.stop;t++)this.iter.tp$iternext()}},iternext(t){if(!(this.previt+this.step>=this.stop)){for(let t=this.previt+1;t<this.previt+this.step;t++)this.iter.tp$iternext();return this.previt+=this.step,this.iter.tp$iternext()}for(let e=this.previt+1;e<this.stop;e++)this.previt+=this.step,this.iter.tp$iternext()},slots:{tp$doc:"islice(iterable, stop) --\\x3e islice object\\nislice(iterable, start, stop[, step]) --\\x3e islice object\\n\\nReturn an iterator whose next() method returns selected values from an\\niterable. If start is specified, will skip all preceding elements;\\notherwise, start defaults to zero. Step defaults to one. If\\nspecified as another value, step determines how many values are \\nskipped between successive calls. Works like a slice() on a list\\nbut returns an iterator.",tp$new(t,e){Sk.abstr.checkNoKwargs("islice",e),Sk.abstr.checkArgsLen("islice",t,2,4);const i=Sk.abstr.iter(t[0]);let r=t[1],s=t[2],n=t[3];if(void 0===s?(s=r,r=Sk.builtin.none.none$,n=Sk.builtin.none.none$):void 0===n&&(n=Sk.builtin.none.none$),!Sk.builtin.checkNone(s)&&!Sk.misceval.isIndex(s))throw new Sk.builtin.ValueError("Stop for islice() must be None or an integer: 0 <= x <= sys.maxsize.");if(s=Sk.builtin.checkNone(s)?Number.MAX_SAFE_INTEGER:Sk.misceval.asIndexSized(s),s<0||s>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.ValueError("Stop for islice() must be None or an integer: 0 <= x <= sys.maxsize.");if(!Sk.builtin.checkNone(r)&&!Sk.misceval.isIndex(r))throw new Sk.builtin.ValueError("Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.");if(r=Sk.builtin.checkNone(r)?0:Sk.misceval.asIndexSized(r),r<0||r>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.ValueError("Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.");if(!Sk.builtin.checkNone(n)&&!Sk.misceval.isIndex(n))throw new Sk.builtin.ValueError("Step for islice() must be a positive integer or None");if(n=Sk.builtin.checkNone(n)?1:Sk.misceval.asIndexSized(n),n<=0||n>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.ValueError("Step for islice() must be a positive integer or None.");if(this===u.islice.prototype)return new u.islice(i,r,s,n);{const t=new this.constructor;return u.islice.call(t,i,r,s,n),t}}}}),u.permutations=Sk.abstr.buildIteratorClass("itertools.permutations",{constructor:function permutations(t,e){this.pool=t,this.r=e;const i=t.length;this.indices=new Array(i).fill().map(((t,e)=>e)),this.cycles=new Array(e).fill().map(((t,e)=>i-e)),this.n=i,this.tp$iternext=()=>{if(!(this.r>this.n))return this.tp$iternext=this.constructor.prototype.tp$iternext,new Sk.builtin.tuple(this.pool.slice(0,this.r))}},iternext(t){for(let e=this.r-1;e>=0;e--){if(this.cycles[e]--,0!=this.cycles[e]){const t=this.cycles[e];[this.indices[e],this.indices[this.n-t]]=[this.indices[this.n-t],this.indices[e]];const i=this.indices.map((t=>this.pool[t])).slice(0,this.r);return new Sk.builtin.tuple(i)}this.indices.push(this.indices.splice(e,1)[0]),this.cycles[e]=this.n-e}this.r=0},slots:{tp$doc:"permutations(iterable[, r]) --\\x3e permutations object\\n\\nReturn successive r-length permutations of elements in the iterable.\\n\\npermutations(range(3), 2) --\\x3e (0,1), (0,2), (1,0), (1,2), (2,0), (2,1)",tp$new(t,e){let i,r;[i,r]=Sk.abstr.copyKeywordsToNamedArgs("permutations",["iterable","r"],t,e,[Sk.builtin.none.none$]);const s=Sk.misceval.arrayFromIterable(i);if(r=Sk.builtin.checkNone(r)?s.length:Sk.misceval.asIndexSized(r,Sk.builtin.OverFlowError),r<0)throw new Sk.builtin.ValueError("r must be non-negative");if(this===u.permutations.prototype)return new u.permutations(s,r);{const t=new this.constructor;return u.permutations.call(t,s,r),t}}}}),u.pairwise=Sk.abstr.buildIteratorClass("itertools.pairwise",{constructor:function pairwise(t){this.it=t,this.old=null},slots:{tp$new(t,i){e("pairwise",t,i);const r=t[0],s=Sk.abstr.iter(r);return new u.pairwise(s)},tp$doc:"Return an iterator of overlapping pairs taken from the input iterator.\\n\\n s -> (s0,s1), (s1,s2), (s2, s3), ..."},iternext(t){let e=this.old;const i=[null];null===e&&(i.push((()=>this.it.tp$iternext(t))),i.push((t=>{void 0!==t&&(e=t,this.old=t)})));const r=o(...i,(()=>{if(null!==e)return this.it.tp$iternext(t)}),(t=>{if(void 0!==t)return this.old=t,new s([e,t]);this.old=null}));return t?r:l(r)}}),u.product=Sk.abstr.buildIteratorClass("itertools.product",{constructor:function product(t){this.pools=t,this.n=t.length,this.indices=Array(t.length).fill(0),this.pool_sizes=t.map((t=>t.length)),this.tp$iternext=()=>{this.tp$iternext=this.constructor.prototype.tp$iternext;const t=this.indices.map(((t,e)=>this.pools[e][this.indices[e]]));if(!t.some((t=>void 0===t)))return new Sk.builtin.tuple(t);this.n=0}},iternext(t){let e=this.n-1;for(;e>=0&&e<this.n;)this.indices[e]++,this.indices[e]>=this.pool_sizes[e]?(this.indices[e]=-1,e--):e++;if(this.n&&!this.indices.every((t=>-1===t))){const t=this.indices.map(((t,e)=>this.pools[e][this.indices[e]]));return new Sk.builtin.tuple(t)}this.n=0},slots:{tp$doc:"product(*iterables, repeat=1) --\\x3e product object\\n\\nCartesian product of input iterables. Equivalent to nested for-loops.\\n\\nFor example, product(A, B) returns the same as: ((x,y) for x in A for y in B).\\nThe leftmost iterators are in the outermost for-loop, so the output tuples\\ncycle in a manner similar to an odometer (with the rightmost element changing\\non every iteration).\\n\\nTo compute the product of an iterable with itself, specify the number\\nof repetitions with the optional repeat keyword argument. For example,\\nproduct(A, repeat=4) means the same as product(A, A, A, A).\\n\\nproduct(\'ab\', range(3)) --\\x3e (\'a\',0) (\'a\',1) (\'a\',2) (\'b\',0) (\'b\',1) (\'b\',2)\\nproduct((0,1), (0,1), (0,1)) --\\x3e (0,0,0) (0,0,1) (0,1,0) (0,1,1) (1,0,0) ...",tp$new(t,e){let[i]=Sk.abstr.copyKeywordsToNamedArgs("product",["repeat"],[],e,[new Sk.builtin.int_(1)]);if(i=Sk.misceval.asIndexSized(i,Sk.builtin.OverFlowError),i<0)throw new Sk.builtin.ValueError("repeat argument cannot be negative");const r=[];for(let n=0;n<t.length;n++)r.push(Sk.misceval.arrayFromIterable(t[n]));const s=[].concat(...Array(i).fill(r));if(this===u.product.prototype)return new u.product(s);{const t=new this.constructor;return u.product.call(t,s),t}}}}),u.repeat=Sk.abstr.buildIteratorClass("itertools.repeat",{constructor:function repeat(t,e){this.object=t,this.times=e,void 0===e&&(this.tp$iternext=()=>this.object)},iternext(t){return this.times-- >0?this.object:void 0},slots:{tp$doc:"repeat(object [,times]) -> create an iterator which returns the object\\nfor the specified number of times. If not specified, returns the object\\nendlessly.",tp$new(t,e){let i,r;if([i,r]=Sk.abstr.copyKeywordsToNamedArgs("repeat",["object","times"],t,e,[null]),r=null!==r?Sk.misceval.asIndexSized(r,Sk.builtin.OverFlowError):void 0,this===u.repeat.prototype)return new u.repeat(i,r);{const t=new this.constructor;return u.repeat.call(t,i,r),t}},$r(){const t=Sk.misceval.objectRepr(this.object),e=void 0===this.times?"":", "+(this.times>=0?this.times:0);return new Sk.builtin.str(Sk.abstr.typeName(this)+"("+t+e+")")}},methods:{__lenght_hint__:{$meth(){if(void 0===this.times)throw new Sk.builtin.TypeError("len() of unsized object");return new Sk.builtin.int_(this.times)},$flags:{NoArgs:!0},$textsig:null}}}),u.starmap=Sk.abstr.buildIteratorClass("itertools.starmap",{constructor:function starmap(t,e){this.func=t,this.iter=e},iternext(t){const e=this.iter.tp$iternext();if(void 0===e)return;const i=Sk.misceval.arrayFromIterable(e);return Sk.misceval.callsimArray(this.func,i)},slots:{tp$new(t,e){let i,r;if([i,r]=Sk.abstr.copyKeywordsToNamedArgs("starmap",["func","iterable"],t,e,[]),r=Sk.abstr.iter(r),i=Sk.builtin.checkNone(i)?Sk.builtin.bool:i,this===u.starmap.prototype)return new u.starmap(i,r);{const t=new this.constructor;return u.starmap.call(t,i,r),t}}}}),u.takewhile=Sk.abstr.buildIteratorClass("itertools.takewhile",{constructor:function takewhile(t,e){this.predicate=t,this.iter=e},iternext(){const t=this.iter.tp$iternext();if(void 0!==t){const e=Sk.misceval.callsimArray(this.predicate,[t]);if(Sk.misceval.isTrue(e))return t;this.tp$iternext=()=>{}}},slots:{tp$doc:"takewhile(predicate, iterable) --\\x3e takewhile object\\n\\nReturn successive entries from an iterable as long as the \\npredicate evaluates to true for each entry.",tp$new(t,e){Sk.abstr.checkNoKwargs("takewhile",e),Sk.abstr.checkArgsLen("takewhile",t,2,2);const i=t[0],r=Sk.abstr.iter(t[1]);if(this===u.takewhile.prototype)return new u.takewhile(i,r);{const t=new this.constructor;return u.takewhile.call(t,i,r),t}}}}),u.tee=new Sk.builtin.func((function(){throw new Sk.builtin.NotImplementedError("tee is not yet implemented in Skulpt")})),u.zip_longest=Sk.abstr.buildIteratorClass("itertools.zip_longest",{constructor:function zip_longest(t,e){this.iters=t,this.fillvalue=e,this.active=this.iters.length},iternext(t){if(!this.active)return;let e;const i=[];for(let r=0;r<this.iters.length;r++){if(e=this.iters[r].tp$iternext(),void 0===e){if(this.active--,!this.active)return;this.iters[r]=new u.repeat(this.fillvalue),e=this.fillvalue}i.push(e)}return new Sk.builtin.tuple(i)},slots:{tp$doc:"zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --\\x3e zip_longest object\\n\\nReturn a zip_longest object whose .__next__() method returns a tuple where\\nthe i-th element comes from the i-th iterable argument. The .__next__()\\nmethod continues until the longest iterable in the argument sequence\\nis exhausted and then it raises StopIteration. When the shorter iterables\\nare exhausted, the fillvalue is substituted in their place. The fillvalue\\ndefaults to None or can be specified by a keyword argument.\\n",tp$new(t,e){const[i]=Sk.abstr.copyKeywordsToNamedArgs("zip_longest",["fillvalue"],[],e,[Sk.builtin.none.none$]),r=[];for(let s=0;s<t.length;s++)r.push(Sk.abstr.iter(t[s]));if(this===u.zip_longest.prototype)return new u.zip_longest(r,i);{const t=new this.constructor;return u.zip_longest.call(t,r,i),t}}}}),u.__doc__=new Sk.builtin.str("An implementation of the python itertools module in Skulpt"),u.__package__=new Sk.builtin.str(""),u};',"src/lib/json/__init__.js":'var $builtinmodule=function(t){"use strict";var e={},dumps_f=function(t){Sk.builtin.pyCheckArgs("dumps",arguments,1,1/0,!0,!1);var e,n,i,u=Array.prototype.slice.call(arguments,1),f=new Sk.builtins.dict(t),a=!1;return e={ascii:!0,separators:{item_separator:", ",key_separator:": "}},f=Sk.ffi.remapToJs(f),n=Sk.ffi.remapToJs(u[0]),"boolean"==typeof f.ensure_ascii&&!1===f.ensure_ascii&&(e.ascii=!1),"boolean"==typeof f.sort_keys&&f.sort_keys&&(a=!0),a||(e.cmp=function(t,e){return 0}),"object"==typeof f.separators&&2==f.separators.length&&(e.separators.item_separator=f.separators[0],e.separators.key_separator=f.separators[1]),f.indent&&(e.space=f.indent),f.default,i=stringify(n,e),new Sk.builtin.str(i)};dumps_f.co_kwargs=!0,e.dumps=new Sk.builtin.func(dumps_f);var loads_f=function(t){Sk.builtin.pyCheckArgs("loads",arguments,1,1/0,!0,!1);var e,n,i=Array.prototype.slice.call(arguments,1),u=new Sk.builtins.dict(t);return u=Sk.ffi.remapToJs(u),e=i[0].v,n=JSON.parse(e),Sk.ffi.remapToPy(n)};return loads_f.co_kwargs=!0,e.loads=new Sk.builtin.func(loads_f),e};!function r(t,e,n){function o(u,f){if(!e[u]){if(!t[u]){var a="function"==typeof require&&require;if(!f&&a)return a(u,!0);if(i)return i(u,!0);var s=new Error("Cannot find module \'"+u+"\'");throw s.code="MODULE_NOT_FOUND",s}var c=e[u]={exports:{}};t[u][0].call(c.exports,(function(e){return o(t[u][1][e]||e)}),c,c.exports,r,t,e,n)}return e[u].exports}for(var i="function"==typeof require&&require,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(t,e,n){var i="undefined"!=typeof JSON?JSON:t("jsonify");e.exports=function(t,e){e||(e={}),"function"==typeof e&&(e={cmp:e});var n,a=e.cmp&&(n=e.cmp,function(t){return function(e,i){var u={key:e,value:t[e]},f={key:i,value:t[i]};return n(u,f)}});return function stringify(t){if("object"!=typeof t||null===t)return i.stringify(t);if(u(t)){for(var e=[],n=0;n<t.length;n++)e.push(stringify(t[n]));return"["+e.join(",")+"]"}var s=f(t).sort(a&&a(t));for(e=[],n=0;n<s.length;n++){var c=s[n];e.push(stringify(c)+":"+stringify(t[c]))}return"{"+e.join(",")+"}"}(t)};var u=Array.isArray||function(t){return"[object Array]"==={}.toString.call(t)},f=Object.keys||function(t){var e=Object.prototype.hasOwnProperty||function(){return!0},n=[];for(var i in t)e.call(t,i)&&n.push(i);return n}},{jsonify:2}],2:[function(t,e,n){n.parse=t("./lib/parse"),n.stringify=t("./lib/stringify")},{"./lib/parse":3,"./lib/stringify":4}],3:[function(t,e,n){var i,u,f,a,s={\'"\':\'"\',"\\\\":"\\\\","/":"/",b:"\\b",f:"\\f",n:"\\n",r:"\\r",t:"\\t"},error=function(t){throw{name:"SyntaxError",message:t,at:i,text:f}},next=function(t){return t&&t!==u&&error("Expected \'"+t+"\' instead of \'"+u+"\'"),u=f.charAt(i),i+=1,u},number=function(){var t,e="";for("-"===u&&(e="-",next("-"));u>="0"&&u<="9";)e+=u,next();if("."===u)for(e+=".";next()&&u>="0"&&u<="9";)e+=u;if("e"===u||"E"===u)for(e+=u,next(),"-"!==u&&"+"!==u||(e+=u,next());u>="0"&&u<="9";)e+=u,next();if(t=+e,isFinite(t))return t;error("Bad number")},string=function(){var t,e,n,i="";if(\'"\'===u)for(;next();){if(\'"\'===u)return next(),i;if("\\\\"===u)if(next(),"u"===u){for(n=0,e=0;e<4&&(t=parseInt(next(),16),isFinite(t));e+=1)n=16*n+t;i+=String.fromCharCode(n)}else{if("string"!=typeof s[u])break;i+=s[u]}else i+=u}error("Bad string")},white=function(){for(;u&&u<=" ";)next()};a=function(){switch(white(),u){case"{":return function(){var t,e={};if("{"===u){if(next("{"),white(),"}"===u)return next("}"),e;for(;u;){if(t=string(),white(),next(":"),Object.hasOwnProperty.call(e,t)&&error(\'Duplicate key "\'+t+\'"\'),e[t]=a(),white(),"}"===u)return next("}"),e;next(","),white()}}error("Bad object")}();case"[":return function(){var t=[];if("["===u){if(next("["),white(),"]"===u)return next("]"),t;for(;u;){if(t.push(a()),white(),"]"===u)return next("]"),t;next(","),white()}}error("Bad array")}();case\'"\':return string();case"-":return number();default:return u>="0"&&u<="9"?number():function(){switch(u){case"t":return next("t"),next("r"),next("u"),next("e"),!0;case"f":return next("f"),next("a"),next("l"),next("s"),next("e"),!1;case"n":return next("n"),next("u"),next("l"),next("l"),null}error("Unexpected \'"+u+"\'")}()}},e.exports=function(t,e){var n;return f=t,i=0,u=" ",n=a(),white(),u&&error("Syntax error"),"function"==typeof e?function walk(t,n){var i,u,f=t[n];if(f&&"object"==typeof f)for(i in f)Object.prototype.hasOwnProperty.call(f,i)&&(void 0!==(u=walk(f,i))?f[i]=u:delete f[i]);return e.call(t,n,f)}({"":n},""):n}},{}],4:[function(t,e,n){var i,u,f,a=/[\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,s={"\\b":"\\\\b","\\t":"\\\\t","\\n":"\\\\n","\\f":"\\\\f","\\r":"\\\\r",\'"\':\'\\\\"\',"\\\\":"\\\\\\\\"};function quote(t){return a.lastIndex=0,a.test(t)?\'"\'+t.replace(a,(function(t){var e=s[t];return"string"==typeof e?e:"\\\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}))+\'"\':\'"\'+t+\'"\'}function str(t,e){var n,a,s,c,l,p=i,y=e[t];switch(y&&"object"==typeof y&&"function"==typeof y.toJSON&&(y=y.toJSON(t)),"function"==typeof f&&(y=f.call(e,t,y)),typeof y){case"string":return quote(y);case"number":return isFinite(y)?String(y):"null";case"boolean":case"null":return String(y);case"object":if(!y)return"null";if(i+=u,l=[],"[object Array]"===Object.prototype.toString.apply(y)){for(c=y.length,n=0;n<c;n+=1)l[n]=str(n,y)||"null";return s=0===l.length?"[]":i?"[\\n"+i+l.join(",\\n"+i)+"\\n"+p+"]":"["+l.join(",")+"]",i=p,s}if(f&&"object"==typeof f)for(c=f.length,n=0;n<c;n+=1)"string"==typeof(a=f[n])&&(s=str(a,y))&&l.push(quote(a)+(i?": ":":")+s);else for(a in y)Object.prototype.hasOwnProperty.call(y,a)&&(s=str(a,y))&&l.push(quote(a)+(i?": ":":")+s);return s=0===l.length?"{}":i?"{\\n"+i+l.join(",\\n"+i)+"\\n"+p+"}":"{"+l.join(",")+"}",i=p,s}}e.exports=function(t,e,n){var a;if(i="",u="","number"==typeof n)for(a=0;a<n;a+=1)u+=" ";else"string"==typeof n&&(u=n);if(f=e,e&&"function"!=typeof e&&("object"!=typeof e||"number"!=typeof e.length))throw new Error("JSON.stringify");return str("",{"":t})}},{}],5:[function(t,e,n){var i,u,f=e.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(t){if(i===setTimeout)return setTimeout(t,0);if((i===defaultSetTimout||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(t){i=defaultSetTimout}try{u="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(t){u=defaultClearTimeout}}();var a,s=[],c=!1,l=-1;function cleanUpNextTick(){c&&a&&(c=!1,a.length?s=a.concat(s):l=-1,s.length&&drainQueue())}function drainQueue(){if(!c){var t=runTimeout(cleanUpNextTick);c=!0;for(var e=s.length;e;){for(a=s,s=[];++l<e;)a&&a[l].run();l=-1,e=s.length}a=null,c=!1,function runClearTimeout(t){if(u===clearTimeout)return clearTimeout(t);if((u===defaultClearTimeout||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(t);try{return u(t)}catch(e){try{return u.call(null,t)}catch(e){return u.call(this,t)}}}(t)}}function Item(t,e){this.fun=t,this.array=e}function noop(){}f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new Item(t,e)),1!==s.length||c||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=noop,f.addListener=noop,f.once=noop,f.off=noop,f.removeListener=noop,f.removeAllListeners=noop,f.emit=noop,f.prependListener=noop,f.prependOnceListener=noop,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],6:[function(t,e,n){(function(n){var i=t("json-stable-stringify");n.browser?window.stringify=i:e.exports=i}).call(this,t("_process"))},{_process:5,"json-stable-stringify":1}]},{},[6]);',"src/lib/json/stringify.js":'!function r(t,e,n){function o(u,f){if(!e[u]){if(!t[u]){var c="function"==typeof require&&require;if(!f&&c)return c(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module \'"+u+"\'");throw a.code="MODULE_NOT_FOUND",a}var s=e[u]={exports:{}};t[u][0].call(s.exports,(function(e){return o(t[u][1][e]||e)}),s,s.exports,r,t,e,n)}return e[u].exports}for(var i="function"==typeof require&&require,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(t,e,n){var i="undefined"!=typeof JSON?JSON:t("jsonify");e.exports=function(t,e){e||(e={}),"function"==typeof e&&(e={cmp:e});var n,c=e.cmp&&(n=e.cmp,function(t){return function(e,i){var u={key:e,value:t[e]},f={key:i,value:t[i]};return n(u,f)}});return function stringify(t){if("object"!=typeof t||null===t)return i.stringify(t);if(u(t)){for(var e=[],n=0;n<t.length;n++)e.push(stringify(t[n]));return"["+e.join(",")+"]"}var a=f(t).sort(c&&c(t));for(e=[],n=0;n<a.length;n++){var s=a[n];e.push(stringify(s)+":"+stringify(t[s]))}return"{"+e.join(",")+"}"}(t)};var u=Array.isArray||function(t){return"[object Array]"==={}.toString.call(t)},f=Object.keys||function(t){var e=Object.prototype.hasOwnProperty||function(){return!0},n=[];for(var i in t)e.call(t,i)&&n.push(i);return n}},{jsonify:2}],2:[function(t,e,n){n.parse=t("./lib/parse"),n.stringify=t("./lib/stringify")},{"./lib/parse":3,"./lib/stringify":4}],3:[function(t,e,n){var i,u,f,c,a={\'"\':\'"\',"\\\\":"\\\\","/":"/",b:"\\b",f:"\\f",n:"\\n",r:"\\r",t:"\\t"},error=function(t){throw{name:"SyntaxError",message:t,at:i,text:f}},next=function(t){return t&&t!==u&&error("Expected \'"+t+"\' instead of \'"+u+"\'"),u=f.charAt(i),i+=1,u},number=function(){var t,e="";for("-"===u&&(e="-",next("-"));u>="0"&&u<="9";)e+=u,next();if("."===u)for(e+=".";next()&&u>="0"&&u<="9";)e+=u;if("e"===u||"E"===u)for(e+=u,next(),"-"!==u&&"+"!==u||(e+=u,next());u>="0"&&u<="9";)e+=u,next();if(t=+e,isFinite(t))return t;error("Bad number")},string=function(){var t,e,n,i="";if(\'"\'===u)for(;next();){if(\'"\'===u)return next(),i;if("\\\\"===u)if(next(),"u"===u){for(n=0,e=0;e<4&&(t=parseInt(next(),16),isFinite(t));e+=1)n=16*n+t;i+=String.fromCharCode(n)}else{if("string"!=typeof a[u])break;i+=a[u]}else i+=u}error("Bad string")},white=function(){for(;u&&u<=" ";)next()};c=function(){switch(white(),u){case"{":return function(){var t,e={};if("{"===u){if(next("{"),white(),"}"===u)return next("}"),e;for(;u;){if(t=string(),white(),next(":"),Object.hasOwnProperty.call(e,t)&&error(\'Duplicate key "\'+t+\'"\'),e[t]=c(),white(),"}"===u)return next("}"),e;next(","),white()}}error("Bad object")}();case"[":return function(){var t=[];if("["===u){if(next("["),white(),"]"===u)return next("]"),t;for(;u;){if(t.push(c()),white(),"]"===u)return next("]"),t;next(","),white()}}error("Bad array")}();case\'"\':return string();case"-":return number();default:return u>="0"&&u<="9"?number():function(){switch(u){case"t":return next("t"),next("r"),next("u"),next("e"),!0;case"f":return next("f"),next("a"),next("l"),next("s"),next("e"),!1;case"n":return next("n"),next("u"),next("l"),next("l"),null}error("Unexpected \'"+u+"\'")}()}},e.exports=function(t,e){var n;return f=t,i=0,u=" ",n=c(),white(),u&&error("Syntax error"),"function"==typeof e?function walk(t,n){var i,u,f=t[n];if(f&&"object"==typeof f)for(i in f)Object.prototype.hasOwnProperty.call(f,i)&&(void 0!==(u=walk(f,i))?f[i]=u:delete f[i]);return e.call(t,n,f)}({"":n},""):n}},{}],4:[function(t,e,n){var i,u,f,c=/[\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,a={"\\b":"\\\\b","\\t":"\\\\t","\\n":"\\\\n","\\f":"\\\\f","\\r":"\\\\r",\'"\':\'\\\\"\',"\\\\":"\\\\\\\\"};function quote(t){return c.lastIndex=0,c.test(t)?\'"\'+t.replace(c,(function(t){var e=a[t];return"string"==typeof e?e:"\\\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}))+\'"\':\'"\'+t+\'"\'}function str(t,e){var n,c,a,s,l,p=i,y=e[t];switch(y&&"object"==typeof y&&"function"==typeof y.toJSON&&(y=y.toJSON(t)),"function"==typeof f&&(y=f.call(e,t,y)),typeof y){case"string":return quote(y);case"number":return isFinite(y)?String(y):"null";case"boolean":case"null":return String(y);case"object":if(!y)return"null";if(i+=u,l=[],"[object Array]"===Object.prototype.toString.apply(y)){for(s=y.length,n=0;n<s;n+=1)l[n]=str(n,y)||"null";return a=0===l.length?"[]":i?"[\\n"+i+l.join(",\\n"+i)+"\\n"+p+"]":"["+l.join(",")+"]",i=p,a}if(f&&"object"==typeof f)for(s=f.length,n=0;n<s;n+=1)"string"==typeof(c=f[n])&&(a=str(c,y))&&l.push(quote(c)+(i?": ":":")+a);else for(c in y)Object.prototype.hasOwnProperty.call(y,c)&&(a=str(c,y))&&l.push(quote(c)+(i?": ":":")+a);return a=0===l.length?"{}":i?"{\\n"+i+l.join(",\\n"+i)+"\\n"+p+"}":"{"+l.join(",")+"}",i=p,a}}e.exports=function(t,e,n){var c;if(i="",u="","number"==typeof n)for(c=0;c<n;c+=1)u+=" ";else"string"==typeof n&&(u=n);if(f=e,e&&"function"!=typeof e&&("object"!=typeof e||"number"!=typeof e.length))throw new Error("JSON.stringify");return str("",{"":t})}},{}],5:[function(t,e,n){var i,u,f=e.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(t){if(i===setTimeout)return setTimeout(t,0);if((i===defaultSetTimout||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(t){i=defaultSetTimout}try{u="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(t){u=defaultClearTimeout}}();var c,a=[],s=!1,l=-1;function cleanUpNextTick(){s&&c&&(s=!1,c.length?a=c.concat(a):l=-1,a.length&&drainQueue())}function drainQueue(){if(!s){var t=runTimeout(cleanUpNextTick);s=!0;for(var e=a.length;e;){for(c=a,a=[];++l<e;)c&&c[l].run();l=-1,e=a.length}c=null,s=!1,function runClearTimeout(t){if(u===clearTimeout)return clearTimeout(t);if((u===defaultClearTimeout||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(t);try{return u(t)}catch(e){try{return u.call(null,t)}catch(e){return u.call(this,t)}}}(t)}}function Item(t,e){this.fun=t,this.array=e}function noop(){}f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new Item(t,e)),1!==a.length||s||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=noop,f.addListener=noop,f.once=noop,f.off=noop,f.removeListener=noop,f.removeAllListeners=noop,f.emit=noop,f.prependListener=noop,f.prependOnceListener=noop,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],6:[function(t,e,n){(function(n){var i=t("json-stable-stringify");n.browser?window.stringify=i:e.exports=i}).call(this,t("_process"))},{_process:5,"json-stable-stringify":1}]},{},[6]);',"src/lib/json.js":'function $builtinmodule(){const{builtin:{str:t,float_:e,list:n,tuple:r,dict:o,func:s,TypeError:i,ValueError:l,NotImplementedError:a,sorted:c,none:{none$:u},bool:{true$:h,false$:f},checkString:d,checkBytes:p},ffi:{toPy:m,toJs:g,toPyFloat:w,toPyInt:_,isTrue:y},abstr:{typeName:b,buildNativeClass:N,checkOneArg:O,setUpModuleMethods:k,copyKeywordsToNamedArgs:S},misceval:{objectRepr:J,callsimArray:$}}=Sk,E={__name__:new t("json"),__all__:m(["dump","dumps","load","loads","JSONDecoder","JSONDecodeError","JSONEncoder"]),dump:proxyFail("dump"),load:proxyFail("load"),JSONDecoder:proxyFail("JSONDecoder"),JSONEncoder:proxyFail("JSONEncoder")};function proxyFail(t){return new s((()=>{throw new a(t+" is not yet implemented in skulpt")}))}const j=E.JSONDecodeError=N("json.JSONDecodeError",{base:l,constructor:function JSONDecodeError(t,e,n){const r=e.slice(0,n),o=r.split("\\n").length,s=n-r.lastIndexOf("\\n"),i=`${t}: line ${o} column ${s} (char ${n})`;l.call(this,i),this.$msg=t,this.$doc=e,this.$pos=n,this.$lineno=o,this.$colno=s},getsets:Object.fromEntries(["msg","doc","pos","lineno","colno"].map((t=>[t,{$get(){return m(this["$"+t])}}])))});class JSONEncoder{constructor(t,e,n,r,o,s,i,l){this.skipkeys=t,this.ensure_ascii=e,this.check_circular=n,this.allow_nan=r,this.indent=o,this.separators=s,this.sort_keys=l,this.item_separator=", ",this.key_separator=": ",null!==this.separators?[this.item_separator,this.key_separator]=this.separators:null!==this.indent&&(this.item_separator=","),null!==i&&(this.default=i),this.encoder=this.make_encoder()}default(t){throw new i(`Object of type ${b(t)} is not JSON serializable`)}encode(e){return new t(this.encoder(e))}make_encoder(){let t,e;t=this.check_circular?new Set:null,e=(this.ensure_ascii,JSON.stringify);return function _make_iterencode(t,e,n,r,s,a,u,h,f){null!==r&&"string"!=typeof r&&(r=" ".repeat(r));let d,p,m,w;null!==t?(d=e=>{if(t.has(e))throw new l("Circular reference detected");t.add(e)},p=e=>t.delete(e)):(d=t=>{},p=t=>{});null!==r?(m=(t,e)=>{e+=1;const n="\\n"+r.repeat(e);return[t+=n,e,u+n]},w=(t,e,n)=>(n-=1,t+="\\n"+r.repeat(n)+e)):(m=(t,e)=>[t,e,u],w=(t,e,n)=>t+e);const _unhandled=(t,n)=>{d(t);const r=_iterencode(e(t),n);return p(t),r},_iterencode_list=(t,e)=>{if(!t.length)return"[]";let n,r;d(t),[n,e,r]=m("[",e);let o=!0;for(let s of t)o?o=!1:n+=r,n+=_iterencode(s,e);return p(t),w(n,"]",e)},_iterencode_dict=(t,e)=>{if(!t.sq$length())return"{}";let r,l;d(t),[r,e,l]=m("{",e);let u=!0;if(h){const e=$(t.tp$getattr(v)),n=c(e);t=$(o,[n])}for(let[o,c]of t.$items()){const t=o.valueOf(),h=typeof t;if("string"===h)o=t;else if("number"===h)o=s(o);else if("boolean"===h||null===t)o=String(t);else{if(!JSBI.__isBigInt(t)){if(f)continue;throw new i("keys must be str, int, float, bool or None, not "+b(o))}o=t.toString()}u?u=!1:r+=l,r+=n(o),r+=a,r+=_iterencode(c,e)}return p(t),w(r,"}",e)},_iterencode=(t,e=0)=>String(g(t,{stringHook:t=>n(t),numberHook:(t,e)=>s(e),bigintHook:t=>t.toString(),dictHook:t=>_iterencode_dict(t,e),arrayHook:t=>_iterencode_list(t,e),setHook:t=>_unhandled(t,e),funcHook:(t,n)=>_unhandled(n,e),objecthook:(t,n)=>_unhandled(n,e),unhandledHook:t=>_unhandled(t,e)}));return _iterencode}(t,this.default,e,this.indent,((t,e=this.allow_nan)=>{const n=t.valueOf();let r;if(Number.isFinite(n))return J(t);if(r=n.toString(),!e)throw new l("Out of range float values are not JSON compliant: "+J(t));return r}),this.key_separator,this.item_separator,this.sort_keys,this.skipkeys)}}const v=new t("items");const x=[!1,!0,!0,!0,null,null,null,!1],D=new JSONEncoder(...x),F=/(-?(?:0|[1-9]\\d*))(\\.\\d+)?([eE][-+]?\\d+)?/;const I=/"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"/m;function scanstring(e,n){const r=e.substring(n-1).match(I);if(null===r)throw new j("Unterminated string starting at",e,n-1);try{return[new t(JSON.parse(r[0])),n+r[0].length-1]}catch(o){let t=o.message.match(/(?:column|position) (\\d+)/);t=t&&Number(t[1]);n=n+(t||0)-(void 0===o.columnNumber?1:2);const r=o.message.replace("JSON.parse: ","").replace(/ at line \\d+ column \\d+ of the JSON data/,"").replace(/ in JSON at position \\d+$/,"");throw new j(r,e,n)}}const A=/[ \\t\\n\\r]*/;function JSONArray(t,e,r){const o=[];let s=t[e];const adjust_white_space=()=>{if(" "===s||"\\t"===s||"\\n"===s||"\\r"===s){const n=t.substring(e).match(A);e+=n[0].length,s=t[e]}};if(adjust_white_space(),"]"===s)return[new n([]),e+1];for(;;){let n;if([n,e]=r(t,e),void 0===n)throw new j("Expecting value",t,e);if(o.push(n),s=t[e],adjust_white_space(),e++,"]"===s)break;if(","!==s)throw new j("Expecting \',\' delimiter",t,e-1);s=t[e],adjust_white_space()}return[new n(o),e]}function JSONObject(t,e,s,i,l,a={}){let c=[],u=t[e];const memo_get=function(t){const e=t.toString();return e in a?a[e]:(a[e]=t,t)},adjust_white_space=()=>{if(" "===u||"\\t"===u||"\\n"===u||"\\r"===u){const n=t.substring(e).match(A);e+=n[0].length,u=t[e]}};if(\'"\'!==u){if(adjust_white_space(),"}"===u){if(null!==l){return[l(new n([])),e+1]}return c=new o([]),null!==i&&(c=i(c)),[c,e+1]}if(\'"\'!==u)throw new j("Expecting property name enclosed in double quotes",t,e)}let h,f;for(e+=1;;){if([h,e]=scanstring(t,e),h=memo_get(h),":"!==(u=t[e])&&(adjust_white_space(),":"!==t[e]))throw new j("Expecting \':\' delimiter",t,e);if(u=t[++e],adjust_white_space(),[f,e]=s(t,e),void 0===f)throw new j("Expecting value",t,e);if(u=t[e],c.push([h,f]),adjust_white_space(),e++,"}"===u)break;if(","!==u)throw new j("Expecting \',\' delimiter",t,e-1);if(u=t[e],adjust_white_space(),e++,\'"\'!==u)throw new j("Expecting property name enclosed in double quotes",t,e-1)}if(null!==l){return[l(new n(c.map((t=>new r(t))))),e]}return c=new o(c.flat()),null!==i&&(c=i(c)),[c,e]}const H={NaN:new e(NaN),Infinity:new e(1/0),"-Infinity":new e(-1/0)};class JSONDecoder{constructor(t,e,n,r,o){this.object_hook=t,this.parse_float=e||w,this.parse_int=n||_,this.parse_constant=r||(t=>H[t]),this.object_pairs_hook=o,this.parse_object=JSONObject,this.parse_array=JSONArray,this.parse_string=scanstring,this.memo={},this.scan_once=function make_scanner(t){const{parse_object:e,parse_array:n,parse_string:r,parse_float:o,parse_int:s,parse_constant:i,object_hook:l,object_pairs_hook:a,memo:c}=t,_scan_once=(t,d)=>{const p=t[d];if(void 0===p)return[p,d];if(\'"\'===p)return r(t,d+1);if("{"===p)return e(t,d+1,_scan_once,l,a,c);if("["===p)return n(t,d+1,_scan_once);if("n"===p&&"null"===t.substring(d,d+4))return[u,d+4];if("t"===p&&"true"===t.substring(d,d+4))return[h,d+4];if("f"===p&&"false"===t.substring(d,d+5))return[f,d+5];const m=t.substring(d).match(F);if(null!==m){let t;const[e,n,r,i]=m;return t=r||i?o(n+(r||"")+(i||"")):s(n),[t,d+e.length]}return"N"===p&&"NaN"===t.substring(d,d+3)?[i("NaN"),d+3]:"I"==p&&"Infinity"===t.substring(d,d+8)?[i("Infinity"),d+8]:"-"==p&&"-Infinity"===t.substring(d,d+9)?[i("-Infinity"),d+9]:[void 0,d]};return function scan_once(t,e){try{return _scan_once(t,e)}finally{for(const t in c)delete c[t]}}}(this)}white(t,e){const n=(0===e?t:t.substring(e)).match(A);return null!==n&&(e+=n[0].length),e}decode(t){t=t.toString();let[e,n]=this.scan_once(t,this.white(t,0));if(void 0===e)throw new j("Expecting value",t,n);if(n=this.white(t,n),n!==t.length)throw new j("Extra data",t,n);return e}}const T=Array(5).fill(null),C=new JSONDecoder(...T);function convertToNullOrFunc(t){return null===t||t===u?null:e=>$(t,[m(e)])}return k("json",E,{loads:{$meth(t,e){O("dumps",t);let n=t[0];if(d(n));else{if(!p(n))throw new i(`the JSON object must be str or bytes, not ${b(n)}`);n=(new TextDecoder).decode(n.valueOf())}const r=S("dumps",["object_hook","parse_float","parse_int","parse_constant","object_pairs_hook"],[],e,T).map(convertToNullOrFunc);return r.every((t=>null===t))?C.decode(n):new JSONDecoder(...r).decode(n)},$doc:"Deserialize ``s`` (a ``str`` or ``bytes`` instance containing a JSON document) to a Python object.",$flags:{FastCall:!0}},dumps:{$meth(t,e){O("dumps",t);const n=t[0];let[r,o,s,l,a,c,u,h]=S("loads",["skipkeys","ensure_ascii","check_circular","allow_nan","indent","separators","default","sort_keys"],[],e,x);if(r=y(r),o=y(o),s=y(s),l=y(l),a=g(a),c=g(c),u=convertToNullOrFunc(u),h=y(h),!r&&o&&s&&l&&null===a&&null===c&&null===u&&!h)return D.encode(n);if(null===c);else if(!Array.isArray(c)||2!==c.length||"string"!=typeof c[0]||"string"!=typeof c[1])throw new i("separators shuld be a list or tuple of strings of length 2");return new JSONEncoder(r,o,s,l,a,c,u,h).encode(n)},$doc:"Serialize ``obj`` to a JSON formatted ``str``",$flags:{FastCall:!0}}}),E}',"src/lib/keyword.js":'function $builtinmodule(){const{ffi:{remapToPy:t},builtin:{frozenset:e,str:s}}=Sk,i=new s("keyword"),n=t(["iskeyword","issoftkeyword","kwlist","softkwlist"]),o=t(["False","None","True","and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"]),a=t(["_","case","match"]);return{__name__:i,__all__:n,kwlist:o,softkwlist:a,iskeyword:new e(o).tp$getattr(s.$contains),issoftkeyword:new e(a).tp$getattr(s.$contains)}}',"src/lib/math.js":'const $builtinmodule=function(e){const{builtin:{str:t,int_:n,float_:i,TypeError:r,pyCheckType:u,checkNumber:l},abstr:{lookupSpecial:o},misceval:{callsimOrSuspendArray:a}}=Sk,s={pi:new Sk.builtin.float_(Math.PI),e:new Sk.builtin.float_(Math.E),tau:new Sk.builtin.float_(2*Math.PI),nan:new Sk.builtin.float_(NaN),inf:new Sk.builtin.float_(1/0)},b=new t("__ceil__");const get_sign=function(e){return e=e?e<0?-1:1:1/e<0?-1:1};const c=18;function factorial(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));let t=Sk.builtin.asnum$(e);if((e=Math.floor(t))!=t)throw new Sk.builtin.ValueError("factorial() only accepts integral values");if(e<0)throw new Sk.builtin.ValueError("factorial() not defined for negative numbers");let n=1;for(let i=2;i<=e&&i<=c;i++)n*=i;if(e<=c)return new Sk.builtin.int_(n);n=JSBI.BigInt(n);for(let i=c+1;i<=e;i++)n=JSBI.multiply(n,JSBI.BigInt(i));return new Sk.builtin.int_(n)}const m=new t("__floor__");function _gcd_internal(e,t){let n;return"number"==typeof e&&"number"==typeof t?(n=function _gcd(e,t){return 0==t?e:_gcd(t,e%t)}(e=Math.abs(e),t=Math.abs(t)),n=n<0?-n:n):(n=function _biggcd(e,t){return JSBI.equal(t,JSBI.__ZERO)?e:_biggcd(t,JSBI.remainder(e,t))}(e=JSBI.BigInt(e),t=JSBI.BigInt(t)),JSBI.lessThan(n,JSBI.__ZERO)&&(n=JSBI.multiply(n,JSBI.BigInt(-1)))),n}return Sk.abstr.setUpModuleMethods("math",s,{acos:{$meth:function acos(e){return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.acos(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the arc cosine (measured in radians) of x."},acosh:{$meth:function acosh(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));const t=(e=Sk.builtin.asnum$(e))+Math.sqrt(e*e-1);return new Sk.builtin.float_(Math.log(t))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the inverse hyperbolic cosine of x."},asin:{$meth:function asin(e){return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.asin(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the arc sine (measured in radians) of x."},asinh:{$meth:function asinh(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));const t=(e=Sk.builtin.asnum$(e))+Math.sqrt(e*e+1);return new Sk.builtin.float_(Math.log(t))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the inverse hyperbolic sine of x."},atan:{$meth:function atan(e){return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.atan(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the arc tangent (measured in radians) of x."},atan2:{$meth:function atan2(e,t){return Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(t)),new Sk.builtin.float_(Math.atan2(Sk.builtin.asnum$(e),Sk.builtin.asnum$(t)))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, y, x, /)",$doc:"Return the arc tangent (measured in radians) of y/x.\\n\\nUnlike atan(y/x), the signs of both x and y are considered."},atanh:{$meth:function atanh(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));const t=(1+(e=Sk.builtin.asnum$(e)))/(1-e);return new Sk.builtin.float_(Math.log(t)/2)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the inverse hyperbolic tangent of x."},ceil:{$meth:function ceil(e){let t;if(e.ob$type!==i){const n=o(e,b);if(void 0!==n)return a(n);u("","real number",l(e)),t=Sk.builtin.asnum$(e)}else t=e.v;return new n(Math.ceil(t))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the ceiling of x as an Integral.\\n\\nThis is the smallest integer >= x."},comb:{$meth:function comb(e,t){let n=Sk.misceval.asIndexOrThrow(e),i=Sk.misceval.asIndexOrThrow(t);if(n<0)throw new Sk.builtin.ValueError("n must be an non-negative integer");if(i<0)throw new Sk.builtin.ValueError("k must be a non-negative integer");if(i>e)return new Sk.builtin.int_(0);e=new Sk.builtin.int_(n),t=new Sk.builtin.int_(i);let r=Sk.ffi.remapToJs(e.nb$subtract(t));if(r<i&&(i=r),0===i)return new Sk.builtin.int_(1);if(i>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError("min(n - k, k) must not exceed "+Number.MAX_SAFE_INTEGER);const u=new Sk.builtin.int_(1);let l=e;for(let o=1;o<i;o++)e=e.nb$subtract(u),r=new Sk.builtin.int_(o+1),l=l.nb$multiply(e),l=l.nb$floor_divide(r);return l},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, n, k=None, /)",$doc:"Number of ways to choose k items from n items without repetition and with order.\\n\\nEvaluates to n! / (n - k)! when k <= n and evaluates\\nto zero when k > n.\\n\\nIf k is not specified or is None, then k defaults to n\\nand the function returns n!.\\n\\nRaises TypeError if either of the arguments are not integers.\\nRaises ValueError if either of the arguments are negative."},copysign:{$meth:function copysign(e,t){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(t));const n=Sk.builtin.asnum$(t),i=Sk.builtin.asnum$(e),r=get_sign(i)*get_sign(n);return new Sk.builtin.float_(i*r)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"Return a float with the magnitude (absolute value) of x but the sign of y.\\n\\nOn platforms that support signed zeros, copysign(1.0, -0.0)\\nreturns -1.0.\\n"},cos:{$meth:function cos(e){return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.cos(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the cosine of x (measured in radians)."},cosh:{$meth:function cosh(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e)),e=Sk.builtin.asnum$(e);const t=Math.E,n=Math.pow(t,e),i=(n+1/n)/2;return new Sk.builtin.float_(i)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the hyperbolic cosine of x."},degrees:{$meth:function degrees(e){Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(e));const t=180/Math.PI*Sk.builtin.asnum$(e);return new Sk.builtin.float_(t)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Convert angle x from radians to degrees."},dist:{$meth:function dist(e){throw new Sk.builtin.NotImplementedError("math.dist() is not yet implemented in Skulpt")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, p, q, /)",$doc:"Return the Euclidean distance between 2 points in any dimension."},erf:{$meth:function erf(e){throw new Sk.builtin.NotImplementedError("math.erf() is not yet implemented in Skulpt")},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Error function at x."},erfc:{$meth:function erfc(e){throw new Sk.builtin.NotImplementedError("math.erfc() is not yet implemented in Skulpt")},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Complementary error function at x."},exp:{$meth:function exp(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));let t=e.v;if("number"!=typeof t&&(t=e.nb$float().v),t==1/0||t==-1/0||isNaN(t))return new Sk.builtin.float_(Math.exp(t));const n=Math.exp(t);if(!isFinite(n))throw new Sk.builtin.OverflowError("math range error");return new Sk.builtin.float_(n)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return e raised to the power of x."},expm1:{$meth:function expm1(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e);if(Math.abs(t)<.7){const e=Math.exp(t);if(1==e)return new Sk.builtin.float_(t);{const n=(e-1)*t/Math.log(e);return new Sk.builtin.float_(n)}}{const e=Math.exp(t)-1;return new Sk.builtin.float_(e)}},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return exp(x)-1.\\n\\nThis function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x."},fabs:{$meth:function fabs(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));let t=e.v;return JSBI.__isBigInt(t)&&(t=e.nb$float().v),t=Math.abs(t),new Sk.builtin.float_(t)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the absolute value of the float x."},factorial:{$meth:factorial,$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Find x!.\\n\\nRaise a ValueError if x is negative or non-integral."},floor:{$meth:function floor(e){let t;if(e.ob$type===i)t=e.v;else{const n=o(e,m);if(void 0!==n)return a(n);u("x","number",l(e)),t=Sk.builtin.asnum$(e)}return new n(Math.floor(t))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the floor of x as an Integral.\\n\\nThis is the largest integer <= x."},fmod:{$meth:function fmod(e,t){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(t));let n=e.v,i=t.v;if("number"!=typeof n&&(n=e.nb$float().v),"number"!=typeof i&&(i=t.nb$float().v),(i==1/0||i==-1/0)&&isFinite(n))return new Sk.builtin.float_(n);const r=n%i;if(isNaN(r)&&!isNaN(n)&&!isNaN(i))throw new Sk.builtin.ValueError("math domain error");return new Sk.builtin.float_(r)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"Return fmod(x, y), according to platform C.\\n\\nx % y may differ."},frexp:{$meth:function frexp(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e),n=[t,0];if(0!==t&&Number.isFinite(t)){const e=Math.abs(t);let i=Math.max(-1023,Math.floor(Math.log2(e))+1),r=e*Math.pow(2,-i);for(;r<.5;)r*=2,i--;for(;r>=1;)r*=.5,i++;t<0&&(r=-r),n[0]=r,n[1]=i}return n[0]=new Sk.builtin.float_(n[0]),n[1]=new Sk.builtin.int_(n[1]),new Sk.builtin.tuple(n)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the mantissa and exponent of x, as pair (m, e).\\n\\nm is a float and e is an int, such that x = m * 2.**e.\\nIf x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0."},fsum:{$meth:function fsum(e){if(!Sk.builtin.checkIterable(e))throw new Sk.builtin.TypeError("\'"+Sk.abstr.typeName(e)+"\' object is not iterable");let t,n,i,r=[];for(let l=(e=Sk.abstr.iter(e)).tp$iternext();void 0!==l;l=e.tp$iternext()){Sk.builtin.pyCheckType("","real number",Sk.builtin.checkNumber(l)),t=0;let e=l.v;"number"!=typeof e&&(e=l.nb$float().v),l=e;for(let u=0,o=r.length;u<o;u++){let e=r[u];if(Math.abs(l)<Math.abs(e)){let t=l;l=e,e=t}n=l+e,i=e-(n-l),i&&(r[t]=i,t++),l=n}r=r.slice(0,t).concat([l])}const u=r.reduce((function(e,t){return e+t}),0);return new Sk.builtin.float_(u)},$flags:{OneArg:!0},$textsig:"($module, seq, /)",$doc:"Return an accurate floating point sum of values in the iterable seq.\\n\\nAssumes IEEE-754 floating point arithmetic."},gamma:{$meth:function gamma(e){throw new Sk.builtin.NotImplementedError("math.gamma() is not yet implemented in Skulpt")},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Gamma function at x."},gcd:{$meth:function gcd(e,t){Sk.builtin.pyCheckType("a","integer",Sk.builtin.checkInt(e)),Sk.builtin.pyCheckType("b","integer",Sk.builtin.checkInt(t));const n=_gcd_internal(Sk.builtin.asnum$(e),Sk.builtin.asnum$(t));return"number"==typeof n?new Sk.builtin.int_(n):new Sk.builtin.int_(n.toString())},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"greatest common divisor of x and y"},hypot:{$meth:function hypot(e,t){return Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(t)),e=Sk.builtin.asnum$(e),t=Sk.builtin.asnum$(t),new Sk.builtin.float_(Math.sqrt(e*e+t*t))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"Return the Euclidean distance, sqrt(x*x + y*y)."},isclose:{$meth:function isclose(e,t){Sk.abstr.checkArgsLen("isclose",e,2,2);const n=Sk.abstr.copyKeywordsToNamedArgs("isclose",["rel_tol","abs_tol"],[],t,[new Sk.builtin.float_(1e-9),new Sk.builtin.float_(0)]),i=e[0],r=e[1],u=n[0],l=n[1];Sk.builtin.pyCheckType("a","number",Sk.builtin.checkNumber(i)),Sk.builtin.pyCheckType("b","number",Sk.builtin.checkNumber(r)),Sk.builtin.pyCheckType("rel_tol","number",Sk.builtin.checkNumber(u)),Sk.builtin.pyCheckType("abs_tol","number",Sk.builtin.checkNumber(l));const o=Sk.builtin.asnum$(i),a=Sk.builtin.asnum$(r),s=Sk.builtin.asnum$(u),b=Sk.builtin.asnum$(l);if(s<0||b<0)throw new Sk.builtin.ValueError("tolerances must be non-negative");if(o==a)return Sk.builtin.bool.true$;if(o==1/0||o==-1/0||a==1/0||a==-1/0)return Sk.builtin.bool.false$;const c=Math.abs(a-o),m=c<=Math.abs(s*a)||c<=Math.abs(s*o)||c<=b;return new Sk.builtin.bool(m)},$flags:{FastCall:!0},$textsig:"($module, /, a, b, *, rel_tol=1e-09, abs_tol=0.0)",$doc:\'Determine whether two floating point numbers are close in value.\\n\\n rel_tol\\n maximum difference for being considered "close", relative to the\\n magnitude of the input values\\n abs_tol\\n maximum difference for being considered "close", regardless of the\\n magnitude of the input values\\n\\nReturn True if a is close in value to b, and False otherwise.\\n\\nFor the values to be considered close, the difference between them\\nmust be smaller than at least one of the tolerances.\\n\\n-inf, inf and NaN behave similarly to the IEEE 754 Standard. That\\nis, NaN is not close to anything, even itself. inf and -inf are\\nonly close to themselves.\'},isfinite:{$meth:function isfinite(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e);return Sk.builtin.checkInt(e)||isFinite(t)?Sk.builtin.bool.true$:Sk.builtin.bool.false$},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return True if x is neither an infinity nor a NaN, and False otherwise."},isinf:{$meth:function isinf(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e);return Sk.builtin.checkInt(e)||isFinite(t)||isNaN(t)?Sk.builtin.bool.false$:Sk.builtin.bool.true$},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return True if x is a positive or negative infinity, and False otherwise."},isnan:{$meth:function isnan(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e);return isNaN(t)?Sk.builtin.bool.true$:Sk.builtin.bool.false$},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return True if x is a NaN (not a number), and False otherwise."},isqrt:{$meth:function isqrt(e){let t=Sk.misceval.asIndexOrThrow(e);if(t<0)throw new Sk.builtin.ValueError("isqrt() argument must be nonnegative");return 0==t?new Sk.builtin.int_(0):"number"==typeof t?new Sk.builtin.int_(Math.floor(Math.sqrt(t))):function bigint_isqrt(e){let t=e.toString(2).length;t=Math.floor((t-1)/2);let n=t.toString(2).length;const i=JSBI.BigInt(1),r=JSBI.BigInt(2),u=JSBI.BigInt(t),l=JSBI.multiply(r,u);let o=i,a=JSBI.BigInt(0);for(;n>0;){n--;let t=a;a=JSBI.signedRightShift(u,JSBI.BigInt(n));const r=JSBI.subtract(JSBI.subtract(a,t),i),s=JSBI.leftShift(o,r),b=JSBI.add(JSBI.subtract(JSBI.subtract(l,t),a),i),c=JSBI.signedRightShift(e,b);o=JSBI.add(s,JSBI.divide(c,o))}let s=o;return JSBI.greaterThan(JSBI.multiply(s,s),e)&&(s=JSBI.subtract(s,i)),JSBI.lessThanOrEqual(s,JSBI.BigInt(Number.MAX_SAFE_INTEGER))&&(s=Number(s)),new Sk.builtin.int_(s)}(t)},$flags:{OneArg:!0},$textsig:"($module, n, /)",$doc:"Return the integer part of the square root of the input."},lcm:{$meth:function lcm(...e){function abs(e){return"number"==typeof e?new Sk.builtin.int_(Math.abs(e)):JSBI.lessThan(e,JSBI.__ZERO)?new Sk.builtin.int_(JSBI.unaryMinus(e)):new Sk.builtin.int_(e)}const t=e.length;if(0===t)return new Sk.builtin.int_(1);let n;for(n=0;n<t;++n)e[n]=Sk.misceval.asIndexOrThrow(e[n]);let i,r=e[0];if(1===t)return abs(r);for(n=1;n<t;++n){if(i=e[n],0===i)return new Sk.builtin.int_(0);if("number"==typeof r&&"number"==typeof i){let e=r/_gcd_internal(r,i)*i;e=Math.abs(e),r=e>Number.MAX_SAFE_INTEGER?JSBI.BigInt(r):e}else r=JSBI.BigInt(r);"number"!=typeof r&&(i=JSBI.BigInt(i),r=JSBI.multiply(JSBI.divide(r,_gcd_internal(r,i)),i))}return abs(r)},$flags:{MinArgs:0},$textsig:"($module, *integers, /)",$doc:"Return the least common multiple of the specified integer arguments. If all arguments are nonzero, then the returned value is the smallest positive integer that is a multiple of all arguments. If any of the arguments is zero, then the returned value is 0. lcm() without arguments returns 1."},ldexp:{$meth:function ldexp(e,t){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType("i","integer",Sk.builtin.checkInt(t));let n=e.v;"number"!=typeof n&&(n=e.nb$float().v);const i=Sk.builtin.asnum$(t);if(n==1/0||n==-1/0||0==n||isNaN(n))return new Sk.builtin.float_(n);const r=n*Math.pow(2,i);if(!isFinite(r))throw new Sk.builtin.OverflowError("math range error");return new Sk.builtin.float_(r)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, i, /)",$doc:"Return x * (2**i).\\n\\nThis is essentially the inverse of frexp()."},lgamma:{$meth:function lgamma(e){throw new Sk.builtin.NotImplementedError("math.lgamma() is not yet implemented in Skulpt")},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Natural logarithm of absolute value of Gamma function at x."},log:{$meth:function log(e,t){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));let n,i,r=Sk.builtin.asnum$(e);if(r<=0)throw new Sk.builtin.ValueError("math domain error");if(void 0===t?n=Math.E:(Sk.builtin.pyCheckType("base","number",Sk.builtin.checkNumber(t)),n=Sk.builtin.asnum$(t)),n<=0)throw new Sk.builtin.ValueError("math domain error");if(Sk.builtin.checkFloat(e)||r<Number.MAX_SAFE_INTEGER)i=Math.log(r)/Math.log(n);else{r=new Sk.builtin.str(e).$jsstr();const t=r.length,u=parseFloat("0."+r);i=(t*Math.log(10)+Math.log(u))/Math.log(n)}return new Sk.builtin.float_(i)},$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"log(x, [base=e])\\nReturn the logarithm of x to the given base.\\n\\nIf the base not specified, returns the natural logarithm (base e) of x."},log10:{$meth:function log10(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));let t,n=Sk.builtin.asnum$(e);if(n<=0)throw new Sk.builtin.ValueError("math domain error");if(Sk.builtin.checkFloat(e)||n<Number.MAX_SAFE_INTEGER)t=Math.log10(n);else{n=new Sk.builtin.str(e).$jsstr();const i=n.length,r=parseFloat("0."+n);t=i+Math.log10(r)}return new Sk.builtin.float_(t)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the base 10 logarithm of x."},log1p:{$meth:function log1p(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));let t=e.v;if("number"!=typeof t&&(t=e.nb$float().v),t<=-1)throw new Sk.builtin.ValueError("math domain error");if(0==t)return new Sk.builtin.float_(t);if(Math.abs(t)<Number.EPSILON/2)return new Sk.builtin.float_(t);if(-.5<=t&&t<=1){const e=1+t,n=Math.log(e)-(e-1-t)/e;return new Sk.builtin.float_(n)}{const e=Math.log(1+t);return new Sk.builtin.float_(e)}},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the natural logarithm of 1+x (base e).\\n\\nThe result is computed in a way which is accurate for x near zero."},log2:{$meth:function log2(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));let t,n=Sk.builtin.asnum$(e);if(n<=0)throw new Sk.builtin.ValueError("math domain error");if(Sk.builtin.checkFloat(e)||n<Number.MAX_SAFE_INTEGER)t=Math.log2(n);else{n=new Sk.builtin.str(e).$jsstr();const i=n.length,r=parseFloat("0."+n);t=i*Math.log2(10)+Math.log2(r)}return new Sk.builtin.float_(t)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the base 2 logarithm of x."},modf:{$meth:function modf(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));let t=Sk.builtin.asnum$(e);if(!isFinite(t)){if(t==1/0)return new Sk.builtin.tuple([new Sk.builtin.float_(0),new Sk.builtin.float_(t)]);if(t==-1/0)return new Sk.builtin.tuple([new Sk.builtin.float_(-0),new Sk.builtin.float_(t)]);if(isNaN(t))return new Sk.builtin.tuple([new Sk.builtin.float_(t),new Sk.builtin.float_(t)])}const n=get_sign(t);t=Math.abs(t);const i=n*Math.floor(t),r=n*(t-Math.floor(t));return new Sk.builtin.tuple([new Sk.builtin.float_(r),new Sk.builtin.float_(i)])},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the fractional and integer parts of x.\\n\\nBoth results carry the sign of x and are floats."},perm:{$meth:function perm(e,t){if(void 0===t||Sk.builtin.checkNone(t))return factorial(e);if(e=Sk.misceval.asIndexOrThrow(e),t=Sk.misceval.asIndexOrThrow(t),e<0)throw new Sk.builtin.ValueError("n must be an non-negative integer");if(t<0)throw new Sk.builtin.ValueError("k must be a non-negative integer");if(t>e)return new Sk.builtin.int_(0);if(0===t)return new Sk.builtin.int_(1);if(t>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError("k must not exceed "+Number.MAX_SAFE_INTEGER);const n=new Sk.builtin.int_(1);let i=e=new Sk.builtin.int_(e);for(let r=1;r<t;r++)e=e.nb$subtract(n),i=i.nb$multiply(e);return i},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($module, n, k=None, /)",$doc:"\'Number of ways to choose k items from n items without repetition and with order.\\n\\nEvaluates to n! / (n - k)! when k <= n and evaluates\\nto zero when k > n.\\n\\nIf k is not specified or is None, then k defaults to n\\nand the function returns n!.\\n\\nRaises TypeError if either of the arguments are not integers.\\nRaises ValueError if either of the arguments are negative.\'"},prod:{$meth:function prod(e,t){Sk.abstr.checkArgsLen("prod",e,1,1),e=Sk.abstr.copyKeywordsToNamedArgs("prod",[null,"start"],e,t,[new Sk.builtin.int_(1)]);const n=Sk.abstr.iter(e[0]);let i,r=e[1];return i=r.constructor===Sk.builtin.int_?function fastProdInt(){return Sk.misceval.iterFor(n,(e=>{if(e.constructor!==Sk.builtin.int_)return e.constructor===Sk.builtin.float_?(r=r.nb$float().nb$multiply(e),new Sk.misceval.Break("float")):(r=Sk.abstr.numberBinOp(r,e,"Mult"),new Sk.misceval.Break("slow"));r=r.nb$multiply(e)}))}():r.constructor===Sk.builtin.float_?"float":"slow",Sk.misceval.chain(i,(e=>"float"===e?function fastProdFloat(){return Sk.misceval.iterFor(n,(e=>{if(e.constructor!==Sk.builtin.float_&&e.constructor!==Sk.builtin.int_)return r=Sk.abstr.numberBinOp(r,e,"Mult"),new Sk.misceval.Break("slow");r=r.nb$multiply(e)}))}():e),(e=>{if("slow"===e)return function slowProd(){return Sk.misceval.iterFor(n,(e=>{r=Sk.abstr.numberBinOp(r,e,"Mult")}))}()}),(()=>r))},$flags:{FastCall:!0},$textsig:"($module, iterable, /, *, start=1)",$doc:"Calculate the product of all the elements in the input iterable. The default start value for the product is 1.\\n\\nWhen the iterable is empty, return the start value. This function is intended specifically for use with numeric values and may reject non-numeric types."},pow:{$meth:function pow(e,t){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(t));let n=e.v,i=t.v;if("number"!=typeof n&&(n=e.nb$float().v),"number"!=typeof i&&(i=t.nb$float().v),0==n&&i<0)throw new Sk.builtin.ValueError("math domain error");if(1==n)return new Sk.builtin.float_(1);if(Number.isFinite(n)&&Number.isFinite(i)&&n<0&&!Number.isInteger(i))throw new Sk.builtin.ValueError("math domain error");if(-1==n&&(i==-1/0||i==1/0))return new Sk.builtin.float_(1);const r=Math.pow(n,i);if(!Number.isFinite(n)||!Number.isFinite(i))return new Sk.builtin.float_(r);if(r==1/0||r==-1/0)throw new Sk.builtin.OverflowError("math range error");return new Sk.builtin.float_(r)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"Return x**y (x to the power of y)."},radians:{$meth:function radians(e){Sk.builtin.pyCheckType("deg","number",Sk.builtin.checkNumber(e));const t=Math.PI/180*Sk.builtin.asnum$(e);return new Sk.builtin.float_(t)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Convert angle x from degrees to radians."},remainder:{$meth:function remainder(e,t){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(t));let n=e.v,i=t.v;if("number"!=typeof n&&(n=e.nb$float().v),"number"!=typeof i&&(i=t.nb$float().v),isFinite(n)&&isFinite(i)){let e,t,r,u,l;if(0==i)throw new Sk.builtin.ValueError("math domain error");if(e=Math.abs(n),t=Math.abs(i),u=e%t,r=t-u,u<r)l=u;else if(u>r)l=-r;else{if(u!=r)throw new Sk.builtin.AssertionError;l=u-.5*(e-u)%t*2}return new Sk.builtin.float_(get_sign(n)*l)}if(isNaN(n))return e;if(isNaN(i))return t;if(n==1/0||n==-1/0)throw new Sk.builtin.ValueError("math domain error");if(i!=1/0&&i!=-1/0)throw new Sk.builtin.AssertionError;return new Sk.builtin.float_(n)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"Difference between x and the closest integer multiple of y.\\n\\nReturn x - n*y where n*y is the closest integer multiple of y.\\nIn the case where x is exactly halfway between two multiples of\\ny, the nearest even value of n is used. The result is always exact."},sin:{$meth:function sin(e){return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.sin(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the sine of x (measured in radians)."},sinh:{$meth:function sinh(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e)),e=Sk.builtin.asnum$(e);const t=Math.E,n=Math.pow(t,e),i=(n-1/n)/2;return new Sk.builtin.float_(i)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the hyperbolic sine of x."},sqrt:{$meth:function sqrt(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e);if(t<0)throw new Sk.builtin.ValueError("math domain error");return new Sk.builtin.float_(Math.sqrt(t))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the square root of x."},tan:{$meth:function tan(e){return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.tan(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the tangent of x (measured in radians)."},tanh:{$meth:function tanh(e){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e);if(0===t)return new Sk.builtin.float_(t);const n=Math.E,i=Math.pow(n,t),r=1/i,u=(i-r)/2/((i+r)/2);return new Sk.builtin.float_(u)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the hyperbolic tangent of x."},trunc:{$meth:function trunc(e){if(e.ob$type===i)return e.nb$int();const n=o(e,t.$trunc);if(void 0===n)throw new r(`type ${e.tp$name} doesn\'t define __trunc__ method`);return a(n)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Truncates the Real x to the nearest Integral toward 0.\\n\\nUses the __trunc__ magic method."}}),s};',"src/lib/operator.js":'function $builtinmodule(e){const{builtin:{str:t,tuple:a,list:r,int_:o,bool:n,TypeError:s,ValueError:i,none:{none$:m},NotImplemented:{NotImplemented$:d},abs:l,len:h,checkString:u,checkInt:c},abstr:{buildNativeClass:M,checkNoKwargs:b,checkArgsLen:g,checkOneArg:f,numberUnaryOp:p,numberBinOp:A,numberInplaceBinOp:k,objectGetItem:$,objectDelItem:_,objectSetItem:w,sequenceConcat:v,sequenceContains:x,sequenceGetCountOf:j,sequenceGetIndexOf:O,sequenceInPlaceConcat:I,typeName:S,lookupSpecial:y,gattr:q,setUpModuleMethods:R},misceval:{richCompareBool:B,asIndexOrThrow:N,chain:E,callsimArray:T,callsimOrSuspendArray:C,objectRepr:D},generic:{getAttr:G}}=Sk,L=["abs","add","and_","concat","contains","delitem","eq","floordiv","ge","getitem","gt","iadd","iand","iconcat","ifloordiv","ilshift","imatmul","imod","imul","index","inv","invert","ior","ipow","irshift","isub","itruediv","ixor","le","lshift","lt","matmul","mod","mul","ne","neg","not_","or_","pos","pow","rshift","setitem","sub","truediv","xor"],F=["attrgetter","countOf","indexOf","is_","is_not","itemgetter","length_hint","methodcaller","truth",...L].sort(),P={__name__:new t("operator"),__doc__:new t("Operator interface.\\n\\nThis module exports a set of functions implemented in javascript corresponding\\nto the intrinsic operators of Python. For example, operator.add(x, y)\\nis equivalent to the expression x+y. The function names are those\\nused for special methods; variants without leading and trailing\\n\'__\' are also provided for convenience."),__all__:new r(F.map((e=>new t(e))))};P.itemgetter=M("operator.itemgetter",{constructor:function itemgetter(e){this.items=e,this.oneitem=1===e.length,this.item=e[0],this.in$repr=!1},slots:{tp$getattr:G,tp$new:(e,t)=>(b("itemgetter",t),g("itemgetter",e,1),new P.itemgetter(e)),tp$call(e,t){f("itemgetter",e,t);const r=e[0];return this.oneitem?$(r,this.item,!0):new a(this.items.map((e=>$(r,e))))},tp$doc:"Return a callable object that fetches the given item(s) from its operand.\\n After f = itemgetter(2), the call f(r) returns r[2].\\n After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])",$r(){if(this.in$repr)return new t(this.tp$name+"(...)");this.in$repr=!0;const e=this.tp$name+"("+this.items.map((e=>D(e))).join(", ")+")";return this.in$repr=!1,e}}}),P.attrgetter=M("operator.attrgetter",{constructor:function attrgetter(e){this.attrs=e,this.oneattr=1===e.length,this.attr=e[0],this.in$repr=!1},slots:{tp$getattr:G,tp$new(e,a){b("attrgetter",a),g("attrgetter",e,1);const r=[];for(let o=0;o<e.length;o++){const a=e[o];if(!u(a))throw new s("attribute name must be a string");const n=a.toString();n.includes(".")?r.push(n.split(".").map((e=>new t(e)))):r.push([a])}return new P.attrgetter(r)},tp$call(e,t){f("attrgetter",e,t);const r=e[0];if(this.oneattr)return this.attr.reduce(((e,t)=>q(e,t)),r);const o=this.attrs.map((e=>e.reduce(((e,t)=>q(e,t)),r)));return new a(o)},tp$doc:"attrgetter(attr, ...) --\\x3e attrgetter object\\n\\nReturn a callable object that fetches the given attribute(s) from its operand.\\nAfter f = attrgetter(\'name\'), the call f(r) returns r.name.\\nAfter g = attrgetter(\'name\', \'date\'), the call g(r) returns (r.name, r.date).\\nAfter h = attrgetter(\'name.first\', \'name.last\'), the call h(r) returns\\n(r.name.first, r.name.last).",$r(){if(this.in$repr)return new t(this.tp$name+"(...)");this.in$repr=!0;const e=this.tp$name+"("+this.items.map((e=>D(e))).join(", ")+")";return this.in$repr=!1,e}}}),P.methodcaller=M("operator.methodcaller",{constructor:function methodcaller(e,t,a){this.$name=e,this.args=t,this.kwargs=a||[],this.in$repr=!1},slots:{tp$getattr:G,tp$new(e,t){g("methodcaller",e,1);const a=e[0];if(!u(a))throw new s("method name must be a string");return new P.methodcaller(a,e.slice(1),t)},tp$call(e,t){f("methodcaller",e,t);const a=e[0];return E(q(a,this.$name,!0),(e=>C(e,this.args,this.kwargs)))},tp$doc:"methodcaller(name, ...) --\\x3e methodcaller object\\n\\nReturn a callable object that calls the given method on its operand.\\nAfter f = methodcaller(\'name\'), the call f(r) returns r.name().\\nAfter g = methodcaller(\'name\', \'date\', foo=1), the call g(r) returns\\nr.name(\'date\', foo=1).",$r(){if(this.in$repr)return new t(this.tp$name+"(...)");this.in$repr=!0;let e=[D(this.$name)];e.push(...this.args.map((e=>D(e))));for(let t=0;t<this.kwargs.length;t+=2)e.push(this.kwargs[t]+"="+D(this.kwargs[t+1]));return e=this.tp$name+"("+e.join(", ")+")",this.in$repr=!1,e}}});const U={1:{$flags:{OneArg:!0},$textsig:"($module, a, /)"},2:{$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)"},3:{$flags:{MinArgs:3,MaxArgs:3},$textsig:"($module, a, b, c, /)"}};function makeModuleMethod(e,t){return{$meth:e,$doc:t,...U[e.length]}}function sameAs(e){return"Same as "+e+"."}return R("operator",P,{lt:makeModuleMethod(((e,t)=>n(B(e,t,"Lt"))),sameAs("a < b")),le:makeModuleMethod(((e,t)=>n(B(e,t,"LtE"))),sameAs("a <= b")),eq:makeModuleMethod(((e,t)=>n(B(e,t,"Eq"))),sameAs("a == b")),ne:makeModuleMethod(((e,t)=>n(B(e,t,"NotEq"))),sameAs("a != b")),ge:makeModuleMethod(((e,t)=>n(B(e,t,"GtE"))),sameAs("a >= b")),gt:makeModuleMethod(((e,t)=>n(B(e,t,"Gt"))),sameAs("a > b")),not_:makeModuleMethod((e=>p(e,"Not")),sameAs("not a")),truth:makeModuleMethod((e=>n(e)),"Return True if a is true, False otherwise."),is_:makeModuleMethod(((e,t)=>n(B(e,t,"Is"))),sameAs("a is b")),is_not:makeModuleMethod(((e,t)=>n(B(e,t,"IsNot"))),sameAs("a is not b")),abs:makeModuleMethod((e=>l(e)),sameAs("abs(a)")),add:makeModuleMethod(((e,t)=>A(e,t,"Add")),sameAs("a + b")),and_:makeModuleMethod(((e,t)=>A(e,t,"BitAnd")),sameAs("a & b")),floordiv:makeModuleMethod(((e,t)=>A(e,t,"FloorDiv")),sameAs("a // b")),index:makeModuleMethod((e=>new o(N(e))),sameAs("a.__index__()")),inv:makeModuleMethod((e=>p(e,"Invert")),sameAs("~a")),invert:makeModuleMethod((e=>p(e,"Invert")),sameAs("~a")),lshift:makeModuleMethod(((e,t)=>A(e,t,"LShift")),sameAs("a << b")),mod:makeModuleMethod(((e,t)=>A(e,t,"Mod")),sameAs("a % b")),mul:makeModuleMethod(((e,t)=>A(e,t,"Mult")),sameAs("a * b")),matmul:makeModuleMethod(((e,t)=>A(e,t,"MatMult")),sameAs("a @ b")),neg:makeModuleMethod((e=>p(e,"USub")),sameAs("-a")),or_:makeModuleMethod(((e,t)=>A(e,t,"BitOr")),sameAs("a | b")),pos:makeModuleMethod((e=>p(e,"UAdd")),sameAs("+a")),pow:makeModuleMethod(((e,t)=>A(e,t,"Pow")),sameAs("a ** b")),rshift:makeModuleMethod(((e,t)=>A(e,t,"RShift")),sameAs("a >> b")),sub:makeModuleMethod(((e,t)=>A(e,t,"Sub")),sameAs("a - b")),truediv:makeModuleMethod(((e,t)=>A(e,t,"Div")),sameAs("a / b")),xor:makeModuleMethod(((e,t)=>A(e,t,"BitXor")),sameAs("a ^ b")),concat:makeModuleMethod(((e,t)=>v(e,t)),sameAs("a + b, for a and b sequences")),contains:makeModuleMethod(((e,t)=>E(x(e,t),n)),sameAs("b in a (note reversed operands)")),countOf:makeModuleMethod(((e,t)=>j(e,t)),"Return thenumber of times b occurs in a."),delitem:makeModuleMethod(((e,t)=>E(_(e,t,!0),(()=>m))),sameAs("del a[b]")),getitem:makeModuleMethod(((e,t)=>$(e,t,!0)),sameAs("a[b]")),indexOf:makeModuleMethod(((e,t)=>O(e,t)),"Return the first index of b in a"),setitem:makeModuleMethod(((e,t,a)=>E(w(e,t,a,!0),(()=>m))),sameAs("a[b] = c")),length_hint:{$meth:function length_hint(e,a){if(void 0===a)a=new o(0);else if(!c(a))throw new s("\'"+S(a)+"\' object cannot be interpreted as an integer");try{return h(e)}catch(m){if(!(m instanceof s))throw m}const r=y(e,t.$length_hint);if(void 0===r)return a;let n;try{n=T(r,[])}catch(m){if(!(m instanceof s))throw m;return a}if(n===d)return a;if(!c(n))throw new s("__length_hint__ must be an integer, not "+S(n));if(n.nb$isnegative())throw new i("__length_hint__() should return >= 0");return n},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($module, obj, default=0, /)",$doc:"Return an estimate of the number of items in obj.\\n\\nThis is useful for presizing containers when building from an iterable.\\n\\nIf the object supports len(), the result will be exact.\\nOtherwise, it may over- or under-estimate by an arbitrary amount.\\nThe result will be an integer >= 0."},iadd:makeModuleMethod(((e,t)=>k(e,t,"Add")),sameAs("a += b")),iand:makeModuleMethod(((e,t)=>k(e,t,"BitAnd")),sameAs("a &= b")),iconcat:makeModuleMethod(((e,t)=>I(e,t)),sameAs("a += b, for a and b sequences")),ifloordiv:makeModuleMethod(((e,t)=>k(e,t,"FloorDiv")),sameAs("a //= b")),ilshift:makeModuleMethod(((e,t)=>k(e,t,"LShift")),sameAs("a <<= b")),imod:makeModuleMethod(((e,t)=>k(e,t,"Mod")),sameAs("a %= b")),imul:makeModuleMethod(((e,t)=>k(e,t,"Mult")),sameAs("a *= b")),imatmul:makeModuleMethod(((e,t)=>k(e,t,"MatMult")),sameAs("a @= b")),ior:makeModuleMethod(((e,t)=>k(e,t,"BitOr")),sameAs("a |= b")),ipow:makeModuleMethod(((e,t)=>k(e,t,"Pow")),sameAs("a **= b")),irshift:makeModuleMethod(((e,t)=>k(e,t,"RShift")),sameAs("a >>= b")),isub:makeModuleMethod(((e,t)=>k(e,t,"Sub")),sameAs("a -= b")),itruediv:makeModuleMethod(((e,t)=>k(e,t,"Div")),sameAs("a /= b")),ixor:makeModuleMethod(((e,t)=>k(e,t,"BitXor")),sameAs("a ^= b"))}),L.forEach((e=>{P[`__${e.replace("_","")}__`]=P[e]})),P.div=P.truediv,P.__div__=P.div,P}',"src/lib/platform.js":'var $builtinmodule=function(n){var e={},i="undefined"!=typeof window&&"undefined"!=typeof window.navigator;return e.python_implementation=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen("python_implementation",arguments.length,0,0),new Sk.builtin.str("Skulpt")})),e.node=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen("node",arguments.length,0,0),new Sk.builtin.str("")})),e.version=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen("version",arguments.length,0,0),new Sk.builtin.str("")})),e.python_version=new Sk.builtin.func((function(){var n;return Sk.builtin.pyCheckArgsLen("python_version",arguments.length,0,0),n=Sk.__future__.python_version?"3.2.0":"2.7.0",new Sk.builtin.str(n)})),e.system=new Sk.builtin.func((function(){var n;return Sk.builtin.pyCheckArgsLen("system",arguments.length,0,0),n=i?window.navigator.appCodeName:"",new Sk.builtin.str(n)})),e.machine=new Sk.builtin.func((function(){var n;return Sk.builtin.pyCheckArgsLen("machine",arguments.length,0,0),n=i?window.navigator.platform:"",new Sk.builtin.str(n)})),e.release=new Sk.builtin.func((function(){var n;return Sk.builtin.pyCheckArgsLen("release",arguments.length,0,0),n=i?window.navigator.appVersion:"",new Sk.builtin.str(n)})),e.architecture=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen("architecture",arguments.length,0,0),new Sk.builtin.tuple([new Sk.builtin.str("64bit"),new Sk.builtin.str("")])})),e.processor=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen("processor",arguments.length,0,0),new Sk.builtin.str("")})),e};',"src/lib/processing.js":'var $builtinmodule=function(n){var i,e,t,u,o,s,l,c={__name__:new Sk.builtin.str("processing")},r=[],v=!0,f=null;c.processing=null,c.p=null,c.X=new Sk.builtin.int_(0),c.Y=new Sk.builtin.int_(1),c.Z=new Sk.builtin.int_(2),c.R=new Sk.builtin.int_(3),c.G=new Sk.builtin.int_(4),c.B=new Sk.builtin.int_(5),c.A=new Sk.builtin.int_(6),c.U=new Sk.builtin.int_(7),c.V=new Sk.builtin.int_(8),c.NX=new Sk.builtin.int_(9),c.NY=new Sk.builtin.int_(10),c.NZ=new Sk.builtin.int_(11),c.EDGE=new Sk.builtin.int_(12),c.SR=new Sk.builtin.int_(13),c.SG=new Sk.builtin.int_(14),c.SB=new Sk.builtin.int_(15),c.SA=new Sk.builtin.int_(16),c.SW=new Sk.builtin.int_(17),c.TX=new Sk.builtin.int_(18),c.TY=new Sk.builtin.int_(19),c.TZ=new Sk.builtin.int_(20),c.VX=new Sk.builtin.int_(21),c.VY=new Sk.builtin.int_(22),c.VZ=new Sk.builtin.int_(23),c.VW=new Sk.builtin.int_(24),c.AR=new Sk.builtin.int_(25),c.AG=new Sk.builtin.int_(26),c.AB=new Sk.builtin.int_(27),c.DR=new Sk.builtin.int_(3),c.DG=new Sk.builtin.int_(4),c.DB=new Sk.builtin.int_(5),c.DA=new Sk.builtin.int_(6),c.SPR=new Sk.builtin.int_(28),c.SPG=new Sk.builtin.int_(29),c.SPB=new Sk.builtin.int_(30),c.SHINE=new Sk.builtin.int_(31),c.ER=new Sk.builtin.int_(32),c.EG=new Sk.builtin.int_(33),c.EB=new Sk.builtin.int_(34),c.BEEN_LIT=new Sk.builtin.int_(35),c.VERTEX_FIELD_COUNT=new Sk.builtin.int_(36),c.CENTER=new Sk.builtin.int_(3),c.RADIUS=new Sk.builtin.int_(2),c.CORNERS=new Sk.builtin.int_(1),c.CORNER=new Sk.builtin.int_(0),c.DIAMETER=new Sk.builtin.int_(3),c.BASELINE=new Sk.builtin.int_(0),c.TOP=new Sk.builtin.int_(101),c.BOTTOM=new Sk.builtin.int_(102),c.NORMAL=new Sk.builtin.int_(1),c.NORMALIZED=new Sk.builtin.int_(1),c.IMAGE=new Sk.builtin.int_(2),c.MODEL=new Sk.builtin.int_(4),c.SHAPE=new Sk.builtin.int_(5),c.AMBIENT=new Sk.builtin.int_(0),c.DIRECTIONAL=new Sk.builtin.int_(1),c.SPOT=new Sk.builtin.int_(3),c.RGB=new Sk.builtin.int_(1),c.ARGB=new Sk.builtin.int_(2),c.HSB=new Sk.builtin.int_(3),c.ALPHA=new Sk.builtin.int_(4),c.CMYK=new Sk.builtin.int_(5),c.TIFF=new Sk.builtin.int_(0),c.TARGA=new Sk.builtin.int_(1),c.JPEG=new Sk.builtin.int_(2),c.GIF=new Sk.builtin.int_(3),c.MITER=new Sk.builtin.str("miter"),c.BEVEL=new Sk.builtin.str("bevel"),c.ROUND=new Sk.builtin.str("round"),c.SQUARE=new Sk.builtin.str("butt"),c.PROJECT=new Sk.builtin.str("square"),c.P2D=new Sk.builtin.int_(1),c.JAVA2D=new Sk.builtin.int_(1),c.WEBGL=new Sk.builtin.int_(2),c.P3D=new Sk.builtin.int_(2),c.OPENGL=new Sk.builtin.int_(2),c.PDF=new Sk.builtin.int_(0),c.DXF=new Sk.builtin.int_(0),c.OTHER=new Sk.builtin.int_(0),c.WINDOWS=new Sk.builtin.int_(1),c.MAXOSX=new Sk.builtin.int_(2),c.LINUX=new Sk.builtin.int_(3),c.EPSILON=new Sk.builtin.float_(1e-4),c.MAX_FLOAT=new Sk.builtin.float_(34028235e31),c.MIN_FLOAT=new Sk.builtin.float_(-34028235e31),c.MAX_INT=new Sk.builtin.int_(2147483647),c.MIN_INT=new Sk.builtin.int_(-2147483648),c.HALF_PI=new Sk.builtin.float_(Math.PI/2),c.THIRD_PI=new Sk.builtin.float_(Math.PI/3),c.PI=new Sk.builtin.float_(Math.PI),c.TWO_PI=new Sk.builtin.float_(2*Math.PI),c.TAU=new Sk.builtin.float_(2*Math.PI),c.QUARTER_PI=new Sk.builtin.float_(Math.PI/4),c.DEG_TO_RAD=new Sk.builtin.float_(Math.PI/180),c.RAD_TO_DEG=new Sk.builtin.float_(180/Math.PI),c.WHITESPACE=new Sk.builtin.str(" \\t\\n\\r\\f "),c.POINT=new Sk.builtin.int_(2),c.POINTS=new Sk.builtin.int_(2),c.LINE=new Sk.builtin.int_(4),c.LINES=new Sk.builtin.int_(4),c.TRIANGLE=new Sk.builtin.int_(8),c.TRIANGLES=new Sk.builtin.int_(9),c.TRIANGLE_FAN=new Sk.builtin.int_(11),c.TRIANGLE_STRIP=new Sk.builtin.int_(10),c.QUAD=new Sk.builtin.int_(16),c.QUADS=new Sk.builtin.int_(16),c.QUAD_STRIP=new Sk.builtin.int_(17),c.POLYGON=new Sk.builtin.int_(20),c.PATH=new Sk.builtin.int_(21),c.RECT=new Sk.builtin.int_(30),c.ELLIPSE=new Sk.builtin.int_(31),c.ARC=new Sk.builtin.int_(32),c.SPHERE=new Sk.builtin.int_(40),c.BOX=new Sk.builtin.int_(41),c.GROUP=new Sk.builtin.int_(0),c.PRIMITIVE=new Sk.builtin.int_(1),c.GEOMETRY=new Sk.builtin.int_(3),c.VERTEX=new Sk.builtin.int_(0),c.BEZIER_VERTEX=new Sk.builtin.int_(1),c.CURVE_VERTEX=new Sk.builtin.int_(2),c.BREAK=new Sk.builtin.int_(3),c.CLOSESHAPE=new Sk.builtin.int_(4),c.REPLACE=new Sk.builtin.int_(0),c.BLEND=new Sk.builtin.int_(1),c.ADD=new Sk.builtin.int_(2),c.SUBTRACT=new Sk.builtin.int_(4),c.LIGHTEST=new Sk.builtin.int_(8),c.DARKEST=new Sk.builtin.int_(16),c.DIFFERENCE=new Sk.builtin.int_(32),c.EXCLUSION=new Sk.builtin.int_(64),c.MULTIPLY=new Sk.builtin.int_(128),c.SCREEN=new Sk.builtin.int_(256),c.OVERLAY=new Sk.builtin.int_(512),c.HARD_LIGHT=new Sk.builtin.int_(1024),c.SOFT_LIGHT=new Sk.builtin.int_(2048),c.DODGE=new Sk.builtin.int_(4096),c.BURN=new Sk.builtin.int_(8192),c.ALPHA_MASK=new Sk.builtin.int_(4278190080),c.RED_MASK=new Sk.builtin.int_(16711680),c.GREEN_MASK=new Sk.builtin.int_(65280),c.BLUE_MASK=new Sk.builtin.int_(255),c.CUSTOM=new Sk.builtin.int_(0),c.ORTHOGRAPHIC=new Sk.builtin.int_(2),c.PERSPECTIVE=new Sk.builtin.int_(3),c.ARROW=new Sk.builtin.str("default"),c.CROSS=new Sk.builtin.str("crosshair"),c.HAND=new Sk.builtin.str("pointer"),c.MOVE=new Sk.builtin.str("move"),c.TEXT=new Sk.builtin.str("text"),c.WAIT=new Sk.builtin.str("wait"),c.NOCURSOR=Sk.builtin.assk$("url(\'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\'), auto"),c.DISABLE_OPENGL_2X_SMOOTH=new Sk.builtin.int_(1),c.ENABLE_OPENGL_2X_SMOOTH=new Sk.builtin.int_(-1),c.ENABLE_OPENGL_4X_SMOOTH=new Sk.builtin.int_(2),c.ENABLE_NATIVE_FONTS=new Sk.builtin.int_(3),c.DISABLE_DEPTH_TEST=new Sk.builtin.int_(4),c.ENABLE_DEPTH_TEST=new Sk.builtin.int_(-4),c.ENABLE_DEPTH_SORT=new Sk.builtin.int_(5),c.DISABLE_DEPTH_SORT=new Sk.builtin.int_(-5),c.DISABLE_OPENGL_ERROR_REPORT=new Sk.builtin.int_(6),c.ENABLE_OPENGL_ERROR_REPORT=new Sk.builtin.int_(-6),c.ENABLE_ACCURATE_TEXTURES=new Sk.builtin.int_(7),c.DISABLE_ACCURATE_TEXTURES=new Sk.builtin.int_(-7),c.HINT_COUNT=new Sk.builtin.int_(10),c.OPEN=new Sk.builtin.int_(1),c.CLOSE=new Sk.builtin.int_(2),c.BLUR=new Sk.builtin.int_(11),c.GRAY=new Sk.builtin.int_(12),c.INVERT=new Sk.builtin.int_(13),c.OPAQUE=new Sk.builtin.int_(14),c.POSTERIZE=new Sk.builtin.int_(15),c.THRESHOLD=new Sk.builtin.int_(16),c.ERODE=new Sk.builtin.int_(17),c.DILATE=new Sk.builtin.int_(18),c.BACKSPACE=new Sk.builtin.int_(8),c.TAB=new Sk.builtin.int_(9),c.ENTER=new Sk.builtin.int_(10),c.RETURN=new Sk.builtin.int_(13),c.ESC=new Sk.builtin.int_(27),c.DELETE=new Sk.builtin.int_(127),c.CODED=new Sk.builtin.int_(65535),c.SHIFT=new Sk.builtin.int_(16),c.CONTROL=new Sk.builtin.int_(17),c.ALT=new Sk.builtin.int_(18),c.CAPSLK=new Sk.builtin.int_(20),c.PGUP=new Sk.builtin.int_(33),c.PGDN=new Sk.builtin.int_(34),c.END=new Sk.builtin.int_(35),c.HOME=new Sk.builtin.int_(36),c.LEFT=new Sk.builtin.int_(37),c.UP=new Sk.builtin.int_(38),c.RIGHT=new Sk.builtin.int_(39),c.DOWN=new Sk.builtin.int_(40),c.F1=new Sk.builtin.int_(112),c.F2=new Sk.builtin.int_(113),c.F3=new Sk.builtin.int_(114),c.F4=new Sk.builtin.int_(115),c.F5=new Sk.builtin.int_(116),c.F6=new Sk.builtin.int_(117),c.F7=new Sk.builtin.int_(118),c.F8=new Sk.builtin.int_(119),c.F9=new Sk.builtin.int_(120),c.F10=new Sk.builtin.int_(121),c.F11=new Sk.builtin.int_(122),c.F12=new Sk.builtin.int_(123),c.NUMLK=new Sk.builtin.int_(144),c.META=new Sk.builtin.int_(157),c.INSERT=new Sk.builtin.int_(155),c.SINCOS_LENGTH=new Sk.builtin.int_(720),c.PRECISIONB=new Sk.builtin.int_(15),c.PRECISIONF=new Sk.builtin.int_(32768),c.PREC_MAXVAL=new Sk.builtin.int_(32767),c.PREC_ALPHA_SHIFT=new Sk.builtin.int_(9),c.PREC_RED_SHIFT=new Sk.builtin.int_(1),c.NORMAL_MODE_AUTO=new Sk.builtin.int_(0),c.NORMAL_MODE_SHAPE=new Sk.builtin.int_(1),c.NORMAL_MODE_VERTEX=new Sk.builtin.int_(2),c.MAX_LIGHTS=new Sk.builtin.int_(8),c.line=new Sk.builtin.func((function(n,i,e,t){c.processing.line(n.v,i.v,e.v,t.v)})),c.ellipse=new Sk.builtin.func((function(n,i,e,t){c.processing.ellipse(n.v,i.v,e.v,t.v)})),c.circle=new Sk.builtin.func((function(n,i,e){c.processing.ellipse(n.v,i.v,e.v,e.v)})),c.text=new Sk.builtin.func((function(n,i,e){c.processing.text(n.v,i.v,e.v)})),c.point=new Sk.builtin.func((function(n,i){c.processing.point(n.v,i.v)})),c.arc=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.arc(n.v,i.v,e.v,t.v,u.v,o.v)})),c.quad=new Sk.builtin.func((function(n,i,e,t,u,o,s,l){c.processing.quad(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v)})),c.rect=new Sk.builtin.func((function(n,i,e,t,u){"undefined"==typeof u?c.processing.rect(n.v,i.v,e.v,t.v):c.processing.rect(n.v,i.v,e.v,t.v,u.v)})),c.triangle=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.triangle(n.v,i.v,e.v,t.v,u.v,o.v)})),c.bezier=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r,v,f,S){"undefined"==typeof r?c.processing.bezier(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v):c.processing.bezier(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v,v.v,f.v,S.v)})),c.alpha=new Sk.builtin.func((function(n,i,e){return"undefined"==typeof i?new Sk.builtin.float_(c.processing.alpha(n.v)):"undefined"==typeof e?new Sk.builtin.float_(c.processing.alpha(n.v,i.v)):new Sk.builtin.float_(c.processing.alpha(n.v,i.v,e.v))})),c.ambient=new Sk.builtin.func((function(n,i,e){"undefined"==typeof i?c.processing.ambient(n.v):"undefined"==typeof e?c.processing.ambient(n.v,i.v):c.processing.ambient(n.v,i.v,e.v)})),c.ambientLight=new Sk.builtin.func((function(n,i,e,t,u,o){"undefined"==typeof t?c.processing.ambientLight(n.v,i.v,e.v):"undefined"==typeof u?c.processing.ambientLight(n.v,i.v,e.v,t.v):"undefined"==typeof o?c.processing.ambientLight(n.v,i.v,e.v,t.v,u.v):c.processing.ambientLight(n.v,i.v,e.v,t.v,u.v,o.v)})),c.beginCamera=new Sk.builtin.func((function(){c.processing.beginCamera()})),c.beginShape=new Sk.builtin.func((function(n){"undefined"==typeof n&&(n=c.POLYGON),c.processing.beginShape(n.v)})),c.bezierDetail=new Sk.builtin.func((function(n){n="undefined"!=typeof n?n.v:20,c.processing.bezierDetail(n)})),c.bezierPoint=new Sk.builtin.func((function(n,i,e,t,u){c.processing.bezierPoint(n.v,i.v,e.v,t.v,u.v)})),c.bezierTangent=new Sk.builtin.func((function(n,i,e,t,u){c.processing.bezierTangent(n.v,i.v,e.v,t.v,u.v)})),c.bezierVertex=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r){"undefined"==typeof s?c.processing.bezierVertex(n.v,i.v,e.v,t.v,u.v,o.v):"undefined"==typeof l?c.processing.bezierVertex(n.v,i.v,e.v,t.v,u.v,o.v,s.v):"undefined"==typeof r?c.processing.bezierVertex(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v):c.processing.bezierVertex(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v)})),c.blend=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r,v){n instanceof Sk.builtin.int_||n instanceof Sk.builtin.float_?c.processing.blend(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v):c.processing.blend(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v,v.v)})),c.blendColor=new Sk.builtin.func((function(n,i,e){var t=Sk.misceval.callsimArray(c.color,[new Sk.builtin.int_(0),new Sk.builtin.int_(0),new Sk.builtin.int_(0)]);return t.v=c.processing.blendColor(n.v,i.v,e.v),t})),c.brightness=new Sk.builtin.func((function(n,i,e){return"undefined"==typeof i?new Sk.builtin.float_(c.processing.brightness(n.v)):"undefined"==typeof e?new Sk.builtin.float_(c.processing.brightness(n.v,i.v)):new Sk.builtin.float_(c.processing.brightness(n.v,i.v,e.v))})),c.camera=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r){"undefined"==typeof n?c.processing.camera():c.processing.camera(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v)})),c.constrain=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.constrain(n.v,i.v,e.v))})),c.copy=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r){n instanceof Sk.builtin.int_||n instanceof Sk.builtin.float_?c.processing.copy(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v):c.processing.copy(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v)})),c.createFont=new Sk.builtin.func((function(n,i,e,t){var u=Sk.misceval.callsimArray(c.PFont);return u.v="undefined"==typeof e?c.processing.createFont(n.v,i.v):"undefined"==typeof t?c.processing.createFont(n.v,i.v,e.v):c.processing.createFont(n.v,i.v,e.v,t.v),u})),c.createGraphics=new Sk.builtin.func((function(n,i,e,t){var u=Sk.misceval.callsimArray(c.PGraphics);return u.v="undefined"==typeof t?c.processing.createGraphics(n.v,i.v,e.v):c.processing.createGraphics(n.v,i.v,e.v,t.v),u})),c.createImage=new Sk.builtin.func((function(n,i,e){var t=Sk.misceval.callsimArray(c.PImage);return t.v=c.processing.createImage(n.v,i.v,e.v),t})),c.cursor=new Sk.builtin.func((function(n,i,e){"undefined"==typeof n?c.processing.cursor():"undefined"==typeof i?c.processing.cursor(n.v):"undefined"==typeof e?c.processing.cursor(n.v,i.v):c.processing.cursor(n.v,i.v,e.v)})),c.curve=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r,v,f,S){"undefined"==typeof r?c.processing.curve(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v):"undefined"==typeof v?c.processing.curve(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v):"undefined"==typeof f?c.processing.curve(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v,v.v):"undefined"==typeof S?c.processing.curve(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v,v.v,f.v):c.processing.curve(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v,v.v,f.v,S.v)})),c.curveDetail=new Sk.builtin.func((function(n){c.processing.curveDetail(n.v)})),c.curvePoint=new Sk.builtin.func((function(n,i,e,t,u){c.processing.curvePoint(n.v,i.v,e.v,t.v,u.v)})),c.curveTangent=new Sk.builtin.func((function(n,i,e,t,u){c.processing.curveTangent(n.v,i.v,e.v,t.v,u.v)})),c.curveTightness=new Sk.builtin.func((function(n){c.processing.curveTightness(n.v)})),c.curveVertex=new Sk.builtin.func((function(n,i,e){"undefined"==typeof e?c.processing.curveVertex(n.v,i.v):c.processing.curveVertex(n.v,i.v,e.v)})),c.day=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.day())})),c.degrees=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.degrees(n.v))})),c.directionalLight=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.directionalLight(n.v,i.v,e.v,t.v,u.v,o.v)})),c.dist=new Sk.builtin.func((function(n,i,e,t,u,o){return"undefined"==typeof u?new Sk.builtin.float_(c.processing.dist(n.v,i.v,e.v,t.v)):"undefined"==typeof o?new Sk.builtin.float_(c.processing.dist(n.v,i.v,e.v,t.v,u.v)):new Sk.builtin.float_(c.processing.dist(n.v,i.v,e.v,t.v,u.v,o.v))})),c.emissive=new Sk.builtin.func((function(n,i,e){"undefined"==typeof i?c.processing.emissive(n.v):"undefined"==typeof e?c.processing.emissive(n.v,i.v):c.processing.emissive(n.v,i.v,e.v)})),c.endCamera=new Sk.builtin.func((function(){c.processing.endCamera()})),c.endShape=new Sk.builtin.func((function(n){"undefined"==typeof n?c.processing.endShape():c.processing.endShape(n.v)})),c.filter=new Sk.builtin.func((function(n,i){"undefined"==typeof i?c.processing.filter(n.v):c.processing.filter(n.v,i.v)})),c.frustum=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.frustum(n,i,e,t,u,o)})),c.hint=new Sk.builtin.func((function(n){c.processing.hint(n)})),c.hour=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.hour())})),c.hue=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.hue(n.v))})),c.imageMode=new Sk.builtin.func((function(n){c.processing.imageMode(n.v)})),c.lerp=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.lerp(n.v,i.v,e.v))})),c.lerpColor=new Sk.builtin.func((function(n,i,e){var t=Sk.misceval.callsimArray(c.color,[new Sk.builtin.int_(0),new Sk.builtin.int_(0),new Sk.builtin.int_(0)]);return t.v=c.processing.lerpColor(n.v,i.v,e.v),t})),c.lightFalloff=new Sk.builtin.func((function(n,i,e){c.processing.lightFalloff(n.v,i.v,e.v)})),c.lights=new Sk.builtin.func((function(){c.processing.lights()})),c.lightSpecular=new Sk.builtin.func((function(n,i,e){c.processing.lightSpecular(n.v,i.v,e.v)})),c.loadBytes=new Sk.builtin.func((function(n){return new Sk.builtin.list(c.processing.loadBytes(n.v))})),c.loadFont=new Sk.builtin.func((function(n){var i=Sk.misceval.callsimArray(c.PFont);return i.v=c.processing.loadFont(n.v),i})),c.loadShape=new Sk.builtin.func((function(n){return Sk.misceval.callsimArray(c.PShapeSVG,[new Sk.builtin.str("string"),n])})),c.loadStrings=new Sk.builtin.func((function(n){return new Sk.builtin.list(c.processing.loadStrings(n.v))})),c.mag=new Sk.builtin.func((function(n,i,e){return"undefined"==typeof e?new Sk.builtin.float_(c.processing.mag(n.v,i.v)):new Sk.builtin.float_(c.processing.mag(n.v,i.v,e.v))})),c.map=new Sk.builtin.func((function(n,i,e,t,u){return new Sk.builtin.float_(c.processing.map(n.v,i.v,e.v,t.v,u.v))})),c.millis=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.millis())})),c.minute=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.minute())})),c.modelX=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.modelX(n.v,i.v,e.v))})),c.modelY=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.modelY(n.v,i.v,e.v))})),c.modelZ=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.modelZ(n.v,i.v,e.v))})),c.month=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.month())})),c.noCursor=new Sk.builtin.func((function(){c.processing.noCursor()})),c.noise=new Sk.builtin.func((function(n,i,e){return"undefined"==typeof i?new Sk.builtin.float_(c.processing.noise(n.v)):"undefined"==typeof e?new Sk.builtin.float_(c.processing.noise(n.v,i.v)):new Sk.builtin.float_(c.processing.noise(n.v,i.v,e.v))})),c.noiseDetail=new Sk.builtin.func((function(n,i){c.processing.noiseDetail(n.v,i.v)})),c.noiseSeed=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.noiseSeed(n.v))})),c.noLights=new Sk.builtin.func((function(){c.processing.noLights()})),c.norm=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.norm(n.v,i.v,e.v))})),c.normal=new Sk.builtin.func((function(n,i,e){c.processing.normal(n.v,i.v,e.v)})),c.noTint=new Sk.builtin.func((function(){c.processing.noTint()})),c.ortho=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.ortho(n.v,i.v,e.v,t.v,u.v,o.v)})),c.perspective=new Sk.builtin.func((function(n,i,e,t){"undefined"==typeof n?c.processing.perspective():"undefined"==typeof i?c.processing.perspective(n.v):"undefined"==typeof e?c.processing.perspective(n.v,i.v):"undefined"==typeof t?c.processing.perspective(n.v,i.v,e.v):c.processing.perspective(n.v,i.v,e.v,t.v)})),c.pointLight=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.pointLight(n.v,i.v,e.v,t.v,u.v,o.v)})),c.printCamera=new Sk.builtin.func((function(){c.processing.printCamera()})),c.println=new Sk.builtin.func((function(n){c.processing.println(n.v)})),c.printProjection=new Sk.builtin.func((function(){c.processing.printProjection()})),c.radians=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.radians(n.v))})),c.randomSeed=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.randomSeed(n.v))})),c.random=new Sk.builtin.func((function(n,i){return"undefined"==typeof n?new Sk.builtin.float_(c.processing.random()):"undefined"==typeof i?new Sk.builtin.float_(c.processing.random(n.v)):new Sk.builtin.float_(c.processing.random(n.v,i.v))})),c.requestImage=new Sk.builtin.func((function(n,i){var e=Sk.misceval.callsimArray(c.PImage);return e.v="undefined"==typeof i?c.processing.requestImage(n.v):c.processing.requestImage(n.v,i.v),e})),c.saturation=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.saturation(n.v))})),c.save=new Sk.builtin.func((function(n){c.processing.save(n.v)})),c.saveFrame=new Sk.builtin.func((function(n){"undefined"==typeof n?c.processing.saveFrame():c.processing.saveFrame(n.v)})),c.saveStrings=new Sk.builtin.func((function(n,i){c.processing.saveStrings(n.v,i.v)})),c.screenX=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.screenX(n.v,i.v,e.v))})),c.screenY=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.screenY(n.v,i.v,e.v))})),c.screenZ=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.screenZ(n.v,i.v,e.v))})),c.second=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.second())})),c.shape=new Sk.builtin.func((function(n,i,e,t,u){"undefined"==typeof i?c.processing.shape(n.v):"undefined"==typeof e?c.processing.shape(n.v,i.v):"undefined"==typeof t?c.processing.shape(n.v,i.v,e.v):"undefined"==typeof u?c.processing.shape(n.v,i.v,e.v,t.v):c.processing.shape(n.v,i.v,e.v,t.v,u.v)})),c.shapeMode=new Sk.builtin.func((function(n){c.processing.shapeMode(n.v)})),c.shininess=new Sk.builtin.func((function(n){c.processing.shininess(n.v)})),c.specular=new Sk.builtin.func((function(n,i,e){"undefined"==typeof i?c.processing.specular(n.v):"undefined"==typeof e?c.processing.specular(n.v,i.v):c.processing.specular(n.v,i.v,e.v)})),c.spotLight=new Sk.builtin.func((function(n,i,e,t,u,o,s,l){c.processing.spotLight(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v)})),c.sq=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.sq(n))})),c.status=new Sk.builtin.func((function(n){c.processing.status(n.v)})),c.textAlign=new Sk.builtin.func((function(n,i){"undefined"==typeof i?c.processing.textAlign(n.v):c.processing.textAlign(n.v,i.v)})),c.textAscent=new Sk.builtin.func((function(){return new Sk.builtin.float_(c.processing.textAscent())})),c.textDescent=new Sk.builtin.func((function(){return new Sk.builtin.float_(c.processing.textDescent())})),c.textFont=new Sk.builtin.func((function(n,i){"undefined"==typeof i?c.processing.textFont(n.v):c.processing.textFont(n.v,i.v)})),c.textLeading=new Sk.builtin.func((function(n){c.processing.textLeading(n.v)})),c.textMode=new Sk.builtin.func((function(n){c.processing.textMode(n.v)})),c.textSize=new Sk.builtin.func((function(n){c.processing.textSize(n.v)})),c.texture=new Sk.builtin.func((function(n){c.processing.texture(n.v)})),c.textureMode=new Sk.builtin.func((function(n){c.processing.textureMode(n.v)})),c.textWidth=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.textWidth(n.v))})),c.tint=new Sk.builtin.func((function(n,i,e,t){"undefined"==typeof i?c.processing.tint(n.v):"undefined"==typeof e?c.processing.tint(n.v,i.v):"undefined"==typeof t?c.processing.tint(n.v,i.v,e.v):c.processing.tint(n.v,i.v,e.v,t.v)})),c.updatePixels=new Sk.builtin.func((function(){c.processing.updatePixels()})),c.vertex=new Sk.builtin.func((function(n,i,e,t,u){"undefined"==typeof e?c.processing.vertex(n.v,i.v):"undefined"==typeof t?c.processing.vertex(n.v,i.v,e.v):"undefined"==typeof u?c.processing.vertex(n.v,i.v,e.v,t.v):c.processing.vertex(n.v,i.v,e.v,t.v,u.v)})),c.year=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.year())})),c.box=new Sk.builtin.func((function(n){c.processing.box(n.v)})),c.sphere=new Sk.builtin.func((function(n){c.processing.sphere(n.v)})),c.sphereDetail=new Sk.builtin.func((function(n,i){"undefined"==typeof i?c.processing.sphereDetail(n.v):c.processing.sphereDetail(n.v,i.v)})),c.background=new Sk.builtin.func((function(n,i,e){"undefined"!=typeof i&&(i=i.v),"undefined"!=typeof e&&(e=e.v),c.processing.background(n.v,i,e)})),c.fill=new Sk.builtin.func((function(n,i,e,t){"undefined"!=typeof i&&(i=i.v),"undefined"!=typeof e&&(e=e.v),"undefined"!=typeof t&&(t=t.v),c.processing.fill(n.v,i,e,t)})),c.stroke=new Sk.builtin.func((function(n,i,e,t){"undefined"!=typeof i&&(i=i.v),"undefined"!=typeof e&&(e=e.v),"undefined"!=typeof t&&(t=t.v),c.processing.stroke(n.v,i,e,t)})),c.noStroke=new Sk.builtin.func((function(){c.processing.noStroke()})),c.colorMode=new Sk.builtin.func((function(n,i,e,t,u){i="undefined"==typeof i?255:i.v,"undefined"!=typeof e&&(e=e.v),"undefined"!=typeof t&&(t=t.v),"undefined"!=typeof u&&(u=u.v),c.processing.colorMode(n.v,i,e,t,u)})),c.noFill=new Sk.builtin.func((function(){c.processing.noFill()})),c.loop=new Sk.builtin.func((function(){if(null===c.processing)throw new Sk.builtin.Exception("loop() should be called after run()");v=!0,c.processing.loop()})),c.noLoop=new Sk.builtin.func((function(){if(null===c.processing)throw new Sk.builtin.Exception("noLoop() should be called after run()");v=!1,c.processing.noLoop()})),c.frameRate=new Sk.builtin.func((function(n){c.processing.frameRate(n.v)})),c.width=new Sk.builtin.int_(0),c.height=new Sk.builtin.int_(0),c.renderMode=c.P2D,c.size=new Sk.builtin.func((function(n,i,e){"undefined"==typeof e&&(e=c.P2D),c.processing.size(n.v,i.v,e.v),c.width=new Sk.builtin.int_(c.processing.width),c.height=new Sk.builtin.int_(c.processing.height),c.renderMode=e})),c.exitp=new Sk.builtin.func((function(){c.processing.exit()})),c.mouseX=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.mouseX)})),c.mouseY=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.mouseY)})),c.pmouseX=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.pmouseX)})),c.pmouseY=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.pmouseY)})),c.rectMode=new Sk.builtin.func((function(n){c.processing.rectMode(n.v)})),c.strokeWeight=new Sk.builtin.func((function(n){c.processing.strokeWeight(n.v)})),c.smooth=new Sk.builtin.func((function(){c.processing.smooth()})),c.noSmooth=new Sk.builtin.func((function(){c.processing.noSmooth()})),c.ellipseMode=new Sk.builtin.func((function(n){c.processing.ellipseMode(n.v)})),c.strokeCap=new Sk.builtin.func((function(n){c.processing.strokeCap(n.v)})),c.strokeJoin=new Sk.builtin.func((function(n){c.processing.strokeJoin(n.v)})),c.rotate=new Sk.builtin.func((function(n){c.processing.rotate(n.v)})),c.rotateX=new Sk.builtin.func((function(n){c.processing.rotateX(n.v)})),c.rotateY=new Sk.builtin.func((function(n){c.processing.rotateY(n.v)})),c.rotateZ=new Sk.builtin.func((function(n){c.processing.rotateZ(n.v)})),c.scale=new Sk.builtin.func((function(n,i,e){i="undefined"==typeof i?1:i.v,e="undefined"==typeof e?1:e.v,c.processing.scale(n.v,i,e)})),c.translate=new Sk.builtin.func((function(n,i,e){i="undefined"==typeof i?1:i.v,e="undefined"==typeof e?1:e.v,c.processing.translate(n.v,i,e)})),c.popMatrix=new Sk.builtin.func((function(){c.processing.popMatrix()})),c.pushMatrix=new Sk.builtin.func((function(){c.processing.pushMatrix()})),c.applyMatrix=new Sk.builtin.func((function(){var n,i=Array.prototype.slice.call(arguments,0,16);for(n=0;n<i.length;n++)i[n]="undefined"==typeof i[n]?0:i[n].v;c.processing.applyMatrix.apply(c.processing,i)})),c.resetMatrix=new Sk.builtin.func((function(){c.processing.resetMatrix()})),c.printMatrix=new Sk.builtin.func((function(){return Sk.ffi.remapToPy(c.processing.printMatrix())})),c.run=new Sk.builtin.func((function(){var n=document.getElementById(Sk.canvas);if(!n)throw new Error("Processing module: Canvas element not specified");if(window.Processing.logger={log:function(n){Sk.misceval.print_(n)}},(f=window.Processing.getInstanceById(Sk.canvas))&&f.exit(),c.p=new window.Processing(n,(function sketchProc(n){c.processing=n,n.draw=function(){var i=!1;for(var e in r)0===r[e].width&&(i=!0);if(!0===i)return!0===v?void 0:void n.loop();if(!1===v&&n.noLoop(),c.frameCount=n.frameCount,Sk.globals.draw)try{Sk.misceval.callsimArray(Sk.globals.draw)}catch(t){Sk.uncaughtException(t)}};var i=["setup","mouseMoved","mouseClicked","mouseDragged","mouseMoved","mouseOut","mouseOver","mousePressed","mouseReleased","keyPressed","keyReleased","keyTyped"];for(var e in i)Sk.globals[i[e]]&&(n[i[e]]=new Function("try {Sk.misceval.callsimArray(Sk.globals[\'"+i[e]+"\']);} catch(e) {Sk.uncaughtException(e);}"))})),0===c.width.v&&0===c.height.v){var i=n.offsetWidth,e=n.offsetHeight;Sk.misceval.callsimArray(c.size,[new Sk.builtin.int_(i),new Sk.builtin.int_(e),c.renderMode])}})),s=function(n,i){i.__getattr__=new Sk.builtin.func((function(n,i){return"x"===(i=Sk.ffi.remapToJs(i))?Sk.builtin.assk$(c.processing.mouseX):"y"===i?Sk.builtin.assk$(c.processing.mouseY):"px"===i?Sk.builtin.assk$(c.processing.pmouseX):"py"===i?Sk.builtin.assk$(c.processing.pmouseY):"pressed"===i?new Sk.builtin.bool(c.processing.__mousePressed):"button"===i?Sk.builtin.assk$(c.processing.mouseButton):void 0}))},c.Mouse=Sk.misceval.buildClass(c,s,"Mouse",[]),c.mouse=Sk.misceval.callsimArray(c.Mouse),o=function(n,i){i.__getattr__=new Sk.builtin.func((function(n,i){return"key"===(i=Sk.ffi.remapToJs(i))?new Sk.builtin.str(c.processing.key.toString()):"keyCode"===i?Sk.builtin.assk$(c.processing.keyCode):"keyPressed"===i?new Sk.builtin.str(c.processing.keyPressed):void 0}))},c.Keyboard=Sk.misceval.buildClass(c,o,"Keyboard",[]),c.keyboard=Sk.misceval.callsimArray(c.Keyboard),u=function(n,i){i.__getattr__=new Sk.builtin.func((function(n,i){return"frameCount"===(i=Sk.ffi.remapToJs(i))?Sk.builtin.assk$(c.processing.frameCount):"frameRate"===i?Sk.builtin.assk$(c.processing.frameRate):"height"===i?Sk.builtin.assk$(c.processing.height):"width"===i?Sk.builtin.assk$(c.processing.width):"online"===i?new Sk.builtin.bool(c.processing.online):"focused"===i?new Sk.builtin.bool(c.processing.focused):void 0}))},c.Environment=Sk.misceval.buildClass(c,u,"Environment",[]),c.environment=Sk.misceval.callsimArray(c.Environment),t=function(n,i){i.__init__=new Sk.builtin.func((function(n){n.pixels=null})),i.__getattr__=new Sk.builtin.func((function(n,i){return"height"===(i=Sk.ffi.remapToJs(i))?Sk.builtin.assk$(c.processing.height):"width"===i?Sk.builtin.assk$(c.processing.width):("pixels"===i&&null==n.pixels&&(n.pixels=new Sk.builtin.list(c.processing.pixels.toArray())),n.pixels)}))},c.Screen=Sk.misceval.buildClass(c,t,"Screen",[]),c.screen=Sk.misceval.callsimArray(c.Screen),c.loadPixels=new Sk.builtin.func((function(){c.processing.loadPixels()})),e=function(n,i){i.__init__=new Sk.builtin.func((function(n,i,e,t,u){"undefined"!=typeof e&&(e=e.v),"undefined"!=typeof t&&(t=t.v),"undefined"!=typeof u&&(u=u.v),n.v=c.processing.color(i.v,e,t,u)}))},c.color=Sk.misceval.buildClass(c,e,"color",[]),c.red=new Sk.builtin.func((function(n){return new Sk.builtin.int_(c.processing.red(n.v))})),c.green=new Sk.builtin.func((function(n){return new Sk.builtin.int_(c.processing.green(n.v))})),c.blue=new Sk.builtin.func((function(n){return new Sk.builtin.int_(c.processing.blue(n.v))})),i=function(n,i){i.__init__=new Sk.builtin.func((function(n,i,e,t){n.v="undefined"==typeof i?new c.processing.PImage:"undefined"==typeof e?new c.processing.PImage(i.v):"undefined"==typeof t?new c.processing.PImage(i.v,e.v):new c.processing.PImage(i.v,e.v,t.v)})),i.__getattr__=new Sk.builtin.func((function(n,i){return"width"===(i=Sk.ffi.remapToJs(i))?Sk.builtin.assk$(n.v.width):"height"===i?Sk.builtin.assk$(n.v.height):void 0}))},c.loadImage=new Sk.builtin.func((function(n){var i=c.processing.loadImage(n.v);r.push(i);var e=Sk.misceval.callsimArray(c.PImage);return e.v=i,e})),c.image=new Sk.builtin.func((function(n,i,e,t,u){"undefined"==typeof t?c.processing.image(n.v,i.v,e.v):c.processing.image(n.v,i.v,e.v,t.v,u.v)})),c.get=new Sk.builtin.func((function(n,i){var e=c.processing.get(n.v,i.v);return Sk.misceval.callsimArray(c.color,[new Sk.builtin.int_(c.processing.red(e)),new Sk.builtin.int_(c.processing.green(e)),new Sk.builtin.int_(c.processing.blue(e))])})),c.set=new Sk.builtin.func((function(n,i,e){c.processing.set(n.v,i.v,e.v)})),l=function(n,i){i.__init__=new Sk.builtin.func((function(n,i,e,t){n.v="undefined"==typeof i?new c.processing.PVector:"undefined"==typeof t?new c.processing.PVector(i.v,e.v):new c.processing.PVector(i.v,e.v,t.v)})),i.__getattr__=new Sk.builtin.func((function(n,i){return"x"===(i=Sk.ffi.remapToJs(i))?Sk.builtin.assk$(n.v.x):"y"===i?Sk.builtin.assk$(n.v.y):"z"===i?Sk.builtin.assk$(n.v.z):void 0})),i.get=new Sk.builtin.func((function(n){var i=Sk.misceval.callsimArray(c.PVector);return i.v=n.v.get(),i})),i.set=new Sk.builtin.func((function(n,i,e,t){"undefined"==typeof t?n.v.set(i.v,e.v):n.v.set(i.v,e.v,t.v)})),i.mag=new Sk.builtin.func((function(n){return Sk.builtin.assk$(n.v.mag())})),i.add=new Sk.builtin.func((function(n,i){var e=Sk.misceval.callsimArray(c.PVector);return e.v=n.v.add(i.v),e})),i.sub=new Sk.builtin.func((function(n,i){var e=Sk.misceval.callsimArray(c.PVector);return e.v=n.v.sub(i.v),e})),i.mult=new Sk.builtin.func((function(n,i){var e=Sk.misceval.callsimArray(c.PVector);return e.v=n.v.mult(i.v),e})),i.div=new Sk.builtin.func((function(n,i){var e=Sk.misceval.callsimArray(c.PVector);return e.v=n.v.div(i.v),e})),i.dist=new Sk.builtin.func((function(n,i){return Sk.builtin.assk$(n.v.dist(i.v))})),i.dot=new Sk.builtin.func((function(n,i,e,t){return"undefined"==typeof e?Sk.builtin.assk$(n.v.dot(i.v)):Sk.builtin.assk$(n.v.dot(i.v,e.v,t.v))})),i.cross=new Sk.builtin.func((function(n,i){var e=Sk.misceval.callsimArray(c.PVector);return e.v=n.v.cross(i.v),e})),i.normalize=new Sk.builtin.func((function(n){n.v.normalize()})),i.limit=new Sk.builtin.func((function(n,i){n.v.limit(i.v)})),i.angleBetween=new Sk.builtin.func((function(n,i){return Sk.builtin.assk$(n.v.angleBetween(i.v))})),i.array=new Sk.builtin.func((function(n){return new Sk.builtin.list(n.v.array())}))};return c.PFont=Sk.misceval.buildClass(c,(function(n,i){i.__init__=new Sk.builtin.func((function(n,i){n.v="undefined"==typeof i?new c.processing.PFont:new c.processing.PVector(i.v)})),i.list=new Sk.builtin.func((function(n){return new Sk.builtin.list(n.v.list())}))}),"PFont",[]),c.PGraphics=Sk.misceval.buildClass(c,(function(n,i){i.__init__=new Sk.builtin.func((function(n,i,e,t){n.v="undefined"==typeof i?new c.processing.PVector:"undefined"==typeof t?new c.processing.PVector(i.v,e.v):new c.processing.PVector(i.v,e.v,t.v)})),i.beginDraw=new Sk.builtin.func((function(n){n.v.beginDraw()})),i.endDraw=new Sk.builtin.func((function(n){n.v.endDraw()}))}),"PGraphics",[]),c.PShapeSVG=Sk.misceval.buildClass(c,(function(n,i){i.__init__=new Sk.builtin.func((function(n,i,e,t){n.v="undefined"==typeof i?null:"undefined"==typeof e?new c.processing.PShapeSVG(i.v):"undefined"==typeof t?new c.processing.PShapeSVG(i.v,e.v):new c.processing.PShapeSVG(i.v,e.v,t.v)})),i.__getattr__=new Sk.builtin.func((function(n,i){return"width"===(i=Sk.ffi.remapToJs(i))?Sk.builtin.assk$(n.v.width):"height"===i?Sk.builtin.assk$(n.v.height):void 0})),i.isVisible=new Sk.builtin.func((function(n){return new Sk.builtin.bool(n.v.isVisible())})),i.setVisible=new Sk.builtin.func((function(n,i){n.v.setVisible(i.v)})),i.disableStyle=new Sk.builtin.func((function(n){n.v.disableStyle()})),i.enableStyle=new Sk.builtin.func((function(n){n.v.enableStyle()})),i.getChild=new Sk.builtin.func((function(n,i){var e=n.v.getChild(i.v);if(null!=e){var t=Sk.misceval.callsimArray(c.PShapeSVG);return t.v=e,t}return null})),i.translate=new Sk.builtin.func((function(n,i,e,t){"undefined"==typeof t?n.v.translate(i.v,e.v):n.v.translate(i.v,e.v,t.v)})),i.rotate=new Sk.builtin.func((function(n,i){n.v.rotate(i.v)})),i.rotateX=new Sk.builtin.func((function(n,i){n.v.rotateX(i.v)})),i.rotateY=new Sk.builtin.func((function(n,i){n.v.rotateY(i.v)})),i.rotateZ=new Sk.builtin.func((function(n,i){n.v.rotateZ(i.v)})),i.scale=new Sk.builtin.func((function(n,i,e,t){"undefined"==typeof e?n.v.scale(i.v):"undefined"==typeof t?n.v.scale(i.v,e.v):n.v.scale(i.v,e.v,t.v)}))}),"PShapeSVG",[]),c.PVector=Sk.misceval.buildClass(c,l,"PVector",[]),c.PImage=Sk.misceval.buildClass(c,i,"PImage",[]),c};',"src/lib/re.js":'function $builtinmodule(name){const{builtin:{dict:pyDict,str:pyStr,list:pyList,int_:pyInt,type:pyType,tuple:pyTuple,mappingproxy:pyMappingProxy,slice:pySlice,none:{none$:pyNone},NotImplemented:{NotImplemented$:pyNotImplemented},Exception:Exception,OverflowError:OverflowError,IndexError:IndexError,TypeError:TypeError,ValueError:ValueError,checkInt:checkInt,checkString:checkString,checkCallable:checkCallable,hex:hex},abstr:{buildNativeClass:buildNativeClass,typeName:typeName,checkOneArg:checkOneArg,numberBinOp:numberBinOp,copyKeywordToNamedArgs:copyKeywordToNamedArgs,setUpModuleMethods:setUpModuleMethods},misceval:{iterator:pyIterator,objectRepr:objectRepr,asIndexSized:asIndexSized,isIndex:isIndex,callsimArray:pyCall}}=Sk,re={__name__:new pyStr("re"),__all__:new pyList(["match","fullmatch","search","sub","subn","split","findall","finditer","compile","purge","template","escape","error","Pattern","Match","A","I","L","M","S","X","U","ASCII","IGNORECASE","LOCALE","MULTILINE","DOTALL","VERBOSE","UNICODE"].map((e=>new pyStr(e))))},_value2member={},RegexFlagMeta=buildNativeClass("RegexFlagMeta",{constructor:function RegexFlagMeta(){},base:pyType,slots:{tp$iter(){const e=Object.values(_members)[Symbol.iterator]();return new pyIterator((()=>e.next().value))},sq$contains(e){if(!(e instanceof this))throw new TypeError("unsupported operand type(s) for \'in\': \'"+typeName(e)+"\' and \'"+typeName(this)+"\'");return Object.values(_members).includes(e)}}});re.RegexFlag=buildNativeClass("RegexFlag",{meta:RegexFlagMeta,base:pyInt,constructor:function RegexFlag(e){const t=_value2member[e];if(t)return t;this.v=e,_value2member[e]=this},slots:{tp$new(e,t){checkOneArg("RegexFlag",e,t);const r=e[0].valueOf();if(!checkInt(r))throw new ValueError(objectRepr(r)+" is not a valid RegexFlag");return new re.RegexFlag(r)},$r(){let e=this.valueOf();const t=e<0;e=t?~e:e;const r=[];Object.entries(_members).forEach((([t,n])=>{const s=n.valueOf();e&s&&(e&=~s,r.push("re."+t))})),e&&r.push(hex(e).toString());let n=r.join("|");return t&&(n=r.length>1?"~("+n+")":"~"+n),new pyStr(n)},sq$contains(e){if(!(e instanceof re.RegexFlag))throw new TypeError("\'in\' requires a RegexFlag not "+typeName(e));return this.nb$and(e)===e},nb$and:flagBitSlot(((e,t)=>e&t),JSBI.bitwiseAnd),nb$or:flagBitSlot(((e,t)=>e|t),JSBI.bitwiseOr),nb$xor:flagBitSlot(((e,t)=>e^t),JSBI.bitwiseXor),nb$invert:function(){const e=this.v;return"number"==typeof e?new re.RegexFlag(~e):new re.RegexFlag(JSBI.bitwiseNot(e))}},proto:{valueOf(){return this.v}},flags:{sk$unacceptableBase:!0}}),re.TEMPLATE=re.T=new re.RegexFlag(1),re.IGNORECASE=re.I=new re.RegexFlag(2),re.LOCALE=re.L=new re.RegexFlag(4),re.MULTILINE=re.M=new re.RegexFlag(8),re.DOTALL=re.S=new re.RegexFlag(16),re.UNICODE=re.U=new re.RegexFlag(32),re.VERBOSE=re.X=new re.RegexFlag(64),re.DEBUG=new re.RegexFlag(128),re.ASCII=re.A=new re.RegexFlag(256);const _members={ASCII:re.A,IGNORECASE:re.I,LOCALE:re.L,UNICODE:re.U,MULTILINE:re.M,DOTALL:re.S,VERBOSE:re.X,TEMPLATE:re.T,DEBUG:re.DEBUG};function flagBitSlot(e,t){return function(r){if(r instanceof re.RegexFlag||r instanceof pyInt){let n=this.v,s=r.v;if("number"==typeof n&&"number"==typeof s){let t=e(n,s);return t<0&&(t+=4294967296),new re.RegexFlag(t)}return n=JSBI.BigUp(n),s=JSBI.BigUp(s),new re.RegexFlag(JSBI.numberIfSafe(t(n,s)))}return pyNotImplemented}}const jsFlags={i:re.I,m:re.M,s:re.S,u:re.U},jsInlineFlags={i:re.I,a:re.A,s:re.S,L:re.L,m:re.M,u:re.U,x:re.X};RegExp.prototype.hasOwnProperty("sticky")||delete jsFlags.s,RegExp.prototype.hasOwnProperty("unicode")||delete jsFlags.u;const flagFails=Object.entries({"cannot use LOCALE flag with a str pattern":re.L,"ASCII and UNICODE flags are incompatible":new re.RegexFlag(re.A.valueOf()|re.U.valueOf())}),inline_regex=/\\(\\?([isamux]+)\\)/g;function adjustFlags(e,t){let r=e.toString(),n="g",s=0;return r=r.replace(inline_regex,((e,t)=>{for(let r of t){const e=jsInlineFlags[r];s|=e.valueOf()}return""})),flagFails.forEach((([e,t])=>{if((t.valueOf()&s)===t.valueOf())throw new re.error("bad bad inline flags: "+e)})),t=numberBinOp(new re.RegexFlag(s),t,"BitOr"),flagFails.forEach((([e,r])=>{if(numberBinOp(r,t,"BitAnd")===r)throw new ValueError(e)})),numberBinOp(re.A,t,"BitAnd")!==re.A&&(t=numberBinOp(re.U,t,"BitOr")),Object.entries(jsFlags).forEach((([e,r])=>{numberBinOp(r,t,"BitAnd")===r&&(n+=e)})),t=new re.RegexFlag(t.valueOf()),[r,n,t]}let neg_lookbehind_A="(?<!\\\\\\\\n)";(function checkLookBehindSupport(){try{eval("/(?<!foo)/")}catch{neg_lookbehind_A=""}})();const initialUnescapedBracket=/([^\\\\])(\\[\\^?)\\](\\]|.*[^\\\\]\\])/g,py_to_js_regex=/([^\\\\])({,|\\\\A|\\\\Z|\\$|\\(\\?P=([^\\d\\W]\\w*)\\)|\\(\\?P<([^\\d\\W]\\w*)>)(?!(?:\\]|[^\\[]*[^\\\\]\\]))/g,py_to_js_unicode_escape=/\\\\[\\t\\r\\n \\v\\f#&~"\'!:,;`<>]|\\\\-(?!(?:\\]|[^\\[]*[^\\\\]\\]))/g,quantifierErrors=/Incomplete quantifier|Lone quantifier/g,_compiled_patterns=Object.create(null);function compile_pattern(e,t){let r,n;[r,n,t]=adjustFlags(e,t);const s=_compiled_patterns[e.toString()];if(s&&s.$flags===t)return s;const i={};let o,a;r="_"+r,r=r.replace(initialUnescapedBracket,"$1$2\\\\]$3"),r=r.replace(py_to_js_regex,((t,r,n,s,o,a)=>{switch(n){case"\\\\A":return r+neg_lookbehind_A+"^";case"\\\\Z":return r+"$(?!\\\\n)";case"{,":return r+"{0,";case"$":return r+"(?:(?=\\\\n$)|$)";default:if(n.endsWith(">"))return i[o]=!0,r+"(?<"+o+">";if(!i[s])throw new re.error("unknown group name "+s+" at position "+a+1,e,new pyInt(a+1));return r+"\\\\k<"+s+">"}})),r=r.slice(1);let l=r;n.includes("u")&&(l=r.replace(py_to_js_unicode_escape,(e=>{switch(e){case"\\\\ ":return" ";case"\\\\\\t":return"\\\\t";case"\\\\\\n":return"\\\\n";case"\\\\\\v":return"\\\\v";case"\\\\\\f":return"\\\\f";case"\\\\r":return"\\\\r";default:return e.slice(1)}})));try{o=new RegExp(l,n)}catch(g){if(!quantifierErrors.test(g.message))throw a=g.message.substring(g.message.lastIndexOf(":")+2)+" in pattern: "+e.toString(),new re.error(a,e);try{o=new RegExp(r,n.replace("u",""))}catch(g){throw a=g.message.substring(g.message.lastIndexOf(":")+2)+" in pattern: "+e.toString(),new re.error(a,e)}}const p=new re.Pattern(o,e,t);return _compiled_patterns[e.toString()]=p,p}function _compile(e,t){if(e instanceof re.Pattern){if(t!==zero||t.valueOf())throw new ValueError("cannot process flags argument with compiled pattern");return e}if(!checkString(e))throw new TypeError("first argument must be string or compiled pattern");return compile_pattern(e,t)}re.error=buildNativeClass("re.error",{base:Exception,constructor:function error(e,t,r){this.$pattern=t,this.$msg=e,this.$pos=r||pyNone,Exception.call(this,e)},slots:{tp$doc:"Exception raised for invalid regular expressions.\\n\\n Attributes:\\n\\n msg: The unformatted error message\\n pattern: The regular expression pattern\\n",tp$init(e,t){const[r,n,s]=copyKeywordToNamedArgs("re.error",["msg","pattern","pos"],e,t,[pyNone,pyNone]);this.$pattern=n,this.$pos=s,this.$msg=r}},getsets:{msg:{$get(){return this.$msg}},pattern:{$get(){return this.$pattern}},pos:{$get(){return this.$pos}}}});const zero=new pyInt(0),maxsize=Number.MAX_SAFE_INTEGER;re.Pattern=buildNativeClass("re.Pattern",{constructor:function(e,t,r){this.v=e,this.str=t,this.$flags=r,this.$groups=null,this.$groupindex=null},slots:{$r(){const e=objectRepr(this.str).slice(0,200),t=objectRepr(this.$flags.nb$and(re.U.nb$invert()));return new pyStr("re.compile("+e+(t?", "+t:"")+")")},tp$richcompare(e,t){if("Eq"!==t&&"NotEq"!==t||!(e instanceof re.Pattern))return pyNotImplemented;const r=this.str===e.str&&this.$flags===e.$flags;return"Eq"===t?r:!r},tp$hash(){},tp$doc:"Compiled regular expression object."},methods:{match:{$meth:function match(e,t,r){return this.$match(e,t,r)},$flags:{NamedArgs:["string","pos","endpos"],Defaults:[zero,maxsize]},$textsig:"($self, /, string, pos=0, endpos=sys.maxsize)",$doc:"Matches zero or more characters at the beginning of the string."},fullmatch:{$meth:function fullmatch(e,t,r){return this.full$match(e,t,r)},$flags:{NamedArgs:["string","pos","endpos"],Defaults:[zero,maxsize]},$textsig:"($self, /, string, pos=0, endpos=sys.maxsize)",$doc:"Matches against all of the string."},search:{$meth:function search(e,t,r){return this.$search(e,t,r)},$flags:{NamedArgs:["string","pos","endpos"],Defaults:[zero,maxsize]},$textsig:"($self, /, string, pos=0, endpos=sys.maxsize)",$doc:"Scan through string looking for a match, and return a corresponding match object instance.\\n\\nReturn None if no position in the string matches."},sub:{$meth:function sub(e,t,r){return this.$sub(e,t,r)},$flags:{NamedArgs:["repl","string","count"],Defaults:[zero]},$textsig:"($self, /, repl, string, count=0)",$doc:"Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl."},subn:{$meth:function(e,t,r){return this.$subn(e,t,r)},$flags:{NamedArgs:["repl","string","count"],Defaults:[zero]},$textsig:"($self, /, repl, string, count=0)",$doc:"Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl."},findall:{$meth:function findall(e,t,r){return this.find$all(e,t,r)},$flags:{NamedArgs:["string","pos","endpos"],Defaults:[zero,maxsize]},$textsig:"($self, /, string, pos=0, endpos=sys.maxsize)",$doc:"Return a list of all non-overlapping matches of pattern in string."},split:{$meth:function split(e,t){return this.$split(e,t)},$flags:{NamedArgs:["string","maxsplit"],Defaults:[zero]},$textsig:"($self, /, string, maxsplit=0)",$doc:"Split string by the occurrences of pattern."},finditer:{$meth:function finditer(e,t,r){return this.find$iter(e,t,r)},$flags:{NamedArgs:["string","pos","endpos"],Defaults:[zero,maxsize]},$textsig:"($self, /, string, pos=0, endpos=sys.maxsize)",$doc:"Return an iterator over all non-overlapping matches for the RE pattern in string.\\n\\nFor each match, the iterator returns a match object."},scanner:{$meth:function scanner(e,t,r){return this.$scanner(e,t,r)},$flags:{NamedArgs:["string","pos","endpos"],Defaults:[zero,maxsize]},$textsig:"($self, /, string, pos=0, endpos=sys.maxsize)",$doc:null},__copy__:{$meth:function copy(){return this},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:null},__deepcopy__:{$meth:function(){return this},$flags:{OneArg:!0},$textsig:"($self, memo, /)",$doc:null}},getsets:{pattern:{$get(){return this.str},$doc:"The pattern string from which the RE object was compiled."},flags:{$get(){return this.$flags},$doc:"The regex matching flags."},groups:{$get(){if(null===this.$groups){const e=(this.str.v.match(this.group$regex)||[]).length;this.$groups=new pyInt(e)}return this.$groups},$doc:"The number of capturing groups in the pattern."},groupindex:{$get(){if(null===this.$groupindex){const e=this.str.v.matchAll(this.group$regex),t=[];let r=1;for(const n of e)n[1]&&(t.push(new pyStr(n[1])),t.push(new pyInt(r))),r++;this.$groupindex=new pyMappingProxy(new pyDict(t))}return this.$groupindex},$doc:"A dictionary mapping group names to group numbers."}},proto:{group$regex:/\\((?!\\?(?!P<).*)(?:\\?P<([^\\d\\W]\\w*)>)?(?![^\\[]*\\])/g,get$count:e=>(e=asIndexSized(e,OverflowError))||Number.POSITIVE_INFINITY,get$jsstr(e,t,r){if(!checkString(e))throw new TypeError("expected string or bytes-like object");if(t===zero&&r===maxsize||void 0===t&&void 0===r)return{jsstr:e.toString(),pos:zero.valueOf(),endpos:e.sq$length()};const{start:n,end:s}=pySlice.startEnd$wrt(e,t,r);return{jsstr:e.toString().slice(n,s),pos:n,endpos:s}},find$all(e,t,r){let{jsstr:n}=this.get$jsstr(e,t,r);const s=this.v,i=n.matchAll(s),o=[];for(let a of i)o.push(1===a.length?new pyStr(a[0]):2===a.length?new pyStr(a[1]):new pyTuple(a.slice(1).map((e=>new pyStr(e)))));return new pyList(o)},$split(e,t){t=(t=asIndexSized(t))||Number.POSITIVE_INFINITY;let{jsstr:r}=this.get$jsstr(e);const n=this.v,s=[];let i,o=0,a=0;for(;null!==(i=n.exec(r))&&o<t;)if(s.push(new pyStr(r.substring(a,i.index))),i.length>1&&s.push(...i.slice(1).map((e=>void 0===e?pyNone:new pyStr(e)))),o++,a=n.lastIndex,i.index===n.lastIndex){if(!r)break;r=r.slice(i.index),a=0,n.lastIndex=1}return n.lastIndex=0,s.push(new pyStr(r.slice(a))),new pyList(s)},match$from_repl(e,t,r,n){let s;const i=e[e.length-1];return"object"==typeof i?(s=e.slice(0,e.length-3),Object.assign(s,{groups:i}),s.index=e[e.length-3]):(s=e.slice(0,e.length-2),s.groups=void 0,s.index=e[e.length-2]),new re.Match(s,this.str,t,r,n)},do$sub(e,t,r){const{jsstr:n,pos:s,endpos:i}=this.get$jsstr(t);let o;checkCallable(e)?o=t=>{const r=pyCall(e,[t]);if(!checkString(r))throw new TypeError("expected str instance, "+typeName(r)+" found");return r.toString()}:(e=this.get$jsstr(e).jsstr,o=t=>t.template$repl(e)),r=this.get$count(r);let a=0;const l=n.replace(this.v,((...e)=>{if(a>=r)return e[0];a++;const n=this.match$from_repl(e,t,s,i);return o(n)}));return[new pyStr(l),new pyInt(a)]},$sub(e,t,r){const[n]=this.do$sub(e,t,r);return n},$subn(e,t,r){return new pyTuple(this.do$sub(e,t,r))},do$match(e,t,r,n){let s;({jsstr:s,pos:r,endpos:n}=this.get$jsstr(t,r,n));const i=s.match(e);return null===i?pyNone:new re.Match(i,this,t,r,n)},$search(e,t,r){var n=new RegExp(this.v.source,this.v.flags.replace("g",""));return this.do$match(n,e,t,r)},$match(e,t,r){let n=this.v.source,s=this.v.flags.replace("g","").replace("m","");n="^"+n;var i=new RegExp(n,s);return this.do$match(i,e,t,r)},full$match(e,t,r){let n=this.v.source,s=this.v.flags.replace("g","").replace("m","");n="^(?:"+n+")$";var i=new RegExp(n,s);return this.do$match(i,e,t,r)},find$iter(e,t,r){let n;({jsstr:n,pos:t,endpos:r}=this.get$jsstr(e,t,r));const s=n.matchAll(this.v);return new pyIterator((()=>{const n=s.next().value;if(void 0!==n)return new re.Match(n,this,e,t,r)}))}},flags:{sk$unacceptableBase:!0}}),re.Match=buildNativeClass("re.Match",{constructor:function(e,t,r,n,s){this.v=e,this.$match=new pyStr(this.v[0]),this.str=r,this.$re=t,this.$pos=n,this.$endpos=s,this.$groupdict=null,this.$groups=null,this.$lastindex=null,this.$lastgroup=null,this.$regs=null},slots:{tp$doc:"The result of re.match() and re.search().\\nMatch objects always have a boolean value of True.",$r(){let e="<re.Match object; ";return e+="span=("+this.v.index+", "+(this.v.index+this.$match.sq$length())+"), ",e+="match="+objectRepr(this.$match)+">",new pyStr(e)},tp$as_squence_or_mapping:!0,mp$subscript(e){const t=this.get$group(e);return void 0===t?pyNone:new pyStr(t)}},methods:{group:{$meth:function group(...e){let t;return e.length<=1?(t=this.get$group(e[0]),void 0===t?pyNone:new pyStr(t)):(t=[],e.forEach((e=>{e=this.get$group(e),t.push(void 0===e?pyNone:new pyStr(e))})),new pyTuple(t))},$flags:{MinArgs:0},$textsig:null,$doc:"group([group1, ...]) -> str or tuple.\\n Return subgroup(s) of the match by indices or names.\\n For 0 returns the entire match."},start:{$meth:function start(e){const t=this.get$group(e);return new pyInt(void 0===t?-1:this.str.v.indexOf(t,this.v.index+this.$pos))},$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, group=0, /)",$doc:"Return index of the start of the substring matched by group."},end:{$meth:function end(e){const t=this.get$group(e);return new pyInt(void 0===t?-1:this.str.v.indexOf(t,this.v.index+this.$pos)+[...t].length)},$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, group=0, /)",$doc:"Return index of the end of the substring matched by group."},span:{$meth:function span(e){return this.$span(e)},$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, group=0, /)",$doc:"For match object m, return the 2-tuple (m.start(group), m.end(group))."},groups:{$meth:function groups(e){return null!==this.$groups||(this.$groups=Array.from(this.v.slice(1),(t=>void 0===t?e:new pyStr(t))),this.$groups=new pyTuple(this.$groups)),this.$groups},$flags:{NamedArgs:["default"],Defaults:[pyNone]},$textsig:"($self, /, default=None)",$doc:"Return a tuple containing all the subgroups of the match, from 1.\\n\\n default\\n Is used for groups that did not participate in the match."},groupdict:{$meth:function groupdict(e){if(null!==this.$groupdict)return this.$groupdict;if(void 0===this.v.groups)this.$groupdict=new pyDict;else{const t=[];Object.entries(this.v.groups).forEach((([r,n])=>{t.push(new pyStr(r)),t.push(void 0===n?e:new pyStr(n))})),this.$groupdict=new pyDict(t)}return this.$groupdict},$flags:{NamedArgs:["default"],Defaults:[pyNone]},$textsig:"($self, /, default=None)",$doc:"Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.\\n\\n default\\n Is used for groups that did not participate in the match."},expand:{$meth:function expand(e){if(!checkString(e))throw new TypeError("expected str instance got "+typeName(e));return e=e.toString(),e=this.template$repl(e),new pyStr(e)},$flags:{OneArg:!0},$textsig:"($self, /, template)",$doc:"Return the string obtained by doing backslash substitution on the string template, as done by the sub() method."},__copy__:{$meth:function __copy__(){return this},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:null},__deepcopy__:{$meth:function __deepcopy__(){return this},$flags:{OneArg:!0},$textsig:"($self, memo, /)",$doc:null}},getsets:{lastindex:{$get(){if(null!==this.$lastindex)return this.$lastindex;let e,t=0;return this.v.forEach(((r,n)=>{n&&void 0!==r&&e!==r&&(t=n,e=r)})),this.$lastindex=t?new pyInt(t):pyNone,this.$lastindex},$doc:"The integer index of the last matched capturing group."},lastgroup:{$get(){if(null!==this.$lastgroup)return this.$lastgroup;if(void 0===this.v.groups)this.$lastgroup=pyNone;else{let e;Object.entries(this.v.groups).forEach((([t,r])=>{void 0!==r&&(e=t)})),this.$lastgroup=void 0===e?pyNone:new pyStr(e)}return this.$lastgroup},$doc:"The name of the last matched capturing group."},regs:{$get(){if(null!==this.$regs)return this.$regs;const e=[];return this.v.forEach(((t,r)=>{e.push(this.$span(r))})),this.$regs=new pyTuple(e),this.$regs}},string:{$get(){return this.str},$doc:"The string passed to match() or search()."},re:{$get(){return this.$re},$doc:"The regular expression object."},pos:{$get(){return new pyInt(this.$pos)},$doc:"The index into the string at which the RE engine started looking for a match."},endpos:{$get(){return new pyInt(this.$endpos)},$doc:"The index into the string beyond which the RE engine will not go."}},proto:{get$group(e){if(void 0===e)return this.v[0];if(checkString(e)){if(e=e.toString(),this.v.groups&&Object.prototype.hasOwnProperty.call(this.v.groups,e))return this.v.groups[e]}else if(isIndex(e)&&(e=asIndexSized(e))>=0&&e<this.v.length)return this.v[e];throw new IndexError("no such group")},$span(e){const t=this.get$group(e);if(void 0===t)return new pyTuple([new pyInt(-1),new pyInt(-1)]);let r;return""===t&&""===this.v[0]?(r=new pyInt(this.v.index),new pyTuple([r,r])):(r=this.str.v.indexOf(t,this.v.index+this.$pos),new pyTuple([new pyInt(r),new pyInt(r+[...t].length)]))},hasOwnProperty:Object.prototype.hasOwnProperty,template$regex:/\\\\([1-9][0-9]|[1-9])|\\\\g<([1-9][0-9]*)>|\\\\g<([^\\d\\W]\\w*)>|\\\\g<?.*>?/g,template$repl(e){return e.replace(this.template$regex,((e,t,r,n,s,i)=>{let o;if(void 0!==(t=t||r)?o=t<this.v.length?this.v[t]||"":void 0:this.v.groups&&this.hasOwnProperty.call(this.v.groups,n)&&(o=this.v.groups[n]||""),void 0===o){if(n)throw new IndexError("unknown group name \'"+n+"\'");throw new re.error("invalid group reference "+(t||e.slice(2))+" at position "+(s+1))}return o}))}},flags:{sk$unacceptableBase:!0}}),setUpModuleMethods("re",re,{match:{$meth:function match(e,t,r){return _compile(e,r).$match(t)},$flags:{NamedArgs:["pattern","string","flags"],Defaults:[zero]},$textsig:"($module, / , pattern, string, flags=0)",$doc:"Try to apply the pattern at the start of the string, returning\\n a Match object, or None if no match was found."},fullmatch:{$meth:function fullmatch(e,t,r){return _compile(e,r).full$match(t)},$flags:{NamedArgs:["pattern","string","flags"],Defaults:[zero]},$textsig:"($module, / , pattern, string, flags=0)",$doc:"Try to apply the pattern to all of the string, returning\\n a Match object, or None if no match was found."},search:{$meth:function search(e,t,r){return _compile(e,r).$search(t)},$flags:{NamedArgs:["pattern","string","flags"],Defaults:[zero]},$textsig:"($module, / , pattern, string, flags=0)",$doc:"Scan through string looking for a match to the pattern, returning\\n a Match object, or None if no match was found."},sub:{$meth:function sub(e,t,r,n,s){return _compile(e,s).$sub(t,r,n)},$flags:{NamedArgs:["pattern","repl","string","count","flags"],Defaults:[zero,zero]},$textsig:"($module, / , pattern, string, count=0, flags=0)",$doc:"Return the string obtained by replacing the leftmost\\n non-overlapping occurrences of the pattern in string by the\\n replacement repl. repl can be either a string or a callable;\\n if a string, backslash escapes in it are processed. If it is\\n a callable, it\'s passed the Match object and must return\\n a replacement string to be used."},subn:{$meth:function subn(e,t,r,n,s){return _compile(e,s).$subn(t,r,n)},$flags:{NamedArgs:["pattern","repl","string","count","flags"],Defaults:[zero,zero]},$textsig:"($module, / , pattern, string, count=0, flags=0)",$doc:"Return a 2-tuple containing (new_string, number).\\n new_string is the string obtained by replacing the leftmost\\n non-overlapping occurrences of the pattern in the source\\n string by the replacement repl. number is the number of\\n substitutions that were made. repl can be either a string or a\\n callable; if a string, backslash escapes in it are processed.\\n If it is a callable, it\'s passed the Match object and must\\n return a replacement string to be used."},split:{$meth:function split(e,t,r,n){return _compile(e,n).$split(t,r)},$flags:{NamedArgs:["pattern","string","maxsplit","flags"],Defaults:[zero,zero]},$textsig:"($module, / , pattern, string, maxsplit=0, flags=0)",$doc:"Split the source string by the occurrences of the pattern,\\n returning a list containing the resulting substrings. If\\n capturing parentheses are used in pattern, then the text of all\\n groups in the pattern are also returned as part of the resulting\\n list. If maxsplit is nonzero, at most maxsplit splits occur,\\n and the remainder of the string is returned as the final element\\n of the list."},findall:{$meth:function findall(e,t,r){return _compile(e,r).find$all(t)},$flags:{NamedArgs:["pattern","string","flags"],Defaults:[zero]},$textsig:"($module, / , pattern, string, flags=0)",$doc:"Return a list of all non-overlapping matches in the string.\\n\\n If one or more capturing groups are present in the pattern, return\\n a list of groups; this will be a list of tuples if the pattern\\n has more than one group.\\n\\n Empty matches are included in the result."},finditer:{$meth:function finditer(e,t,r){return _compile(e,r).find$iter(t)},$flags:{NamedArgs:["pattern","string","flags"],Defaults:[zero]},$textsig:"($module, / , pattern, string, flags=0)",$doc:"Return an iterator over all non-overlapping matches in the\\n string. For each match, the iterator returns a Match object.\\n\\n Empty matches are included in the result."},compile:{$meth:function compile(e,t){return _compile(e,t)},$flags:{NamedArgs:["pattern","flags"],Defaults:[zero]},$textsig:"($module, / , pattern, flags=0)",$doc:"Compile a regular expression pattern, returning a Pattern object."},purge:{$meth:function purge(){return Object.keys(_compiled_patterns).forEach((e=>{delete _compiled_patterns[e]})),pyNone},$flags:{NoArgs:!0},$textsig:"($module, / )",$doc:"Clear the regular expression caches"},template:{$meth:function template(e,t){return _compile(e,numberBinOp(re.T,t,"BitOr"))},$flags:{NamedArgs:["pattern","flags"],Defaults:[zero]},$textsig:"($module, / , pattern, flags=0)",$doc:"Compile a template pattern, returning a Pattern object"},escape:{$meth:function(e){if(!checkString(e))throw new TypeError("expected a str instances, got "+typeName(e));return e=(e=e.toString()).replace(escape_chrs,"\\\\$&"),new pyStr(e)},$flags:{NamedArgs:["pattern"],Defaults:[]},$textsig:"($module, / , pattern)",$doc:"\\n Escape special characters in a string.\\n "}});const escape_chrs=/[\\&\\~\\#.*+\\-?^${}()|[\\]\\\\\\t\\r\\v\\f\\n ]/g;return re}',"src/lib/signal.js":'var $builtinmodule=function(n){var i={};return i.SIG_DFL=new Sk.builtin.int_(0),i.SIG_IGN=new Sk.builtin.int_(1),i.CTRL_C_EVENT=new Sk.builtin.int_(0),i.CTRL_BREAK_EVENT=new Sk.builtin.int_(0),i.NSIG=new Sk.builtin.int_(23),i.SIGHUP=new Sk.builtin.int_(1),i.SIGNINT=new Sk.builtin.int_(2),i.SIGILL=new Sk.builtin.int_(4),i.SIGFPE=new Sk.builtin.int_(8),i.SIGKILL=new Sk.builtin.int_(9),i.SIGSEGV=new Sk.builtin.int_(11),i.SIGTERM=new Sk.builtin.int_(15),i.SIGBREAK=new Sk.builtin.int_(21),i.SIGABRT=new Sk.builtin.int_(22),i.pause=new Sk.builtin.func((function(){Sk.builtin.pyCheckArgsLen("pause",arguments.length,0,0);var n=new Sk.misceval.Suspension;return n.resume=function(){return Sk.builtin.none.none$},n.data={type:"Sk.promise",promise:new Promise((function(n,i){if(null!=Sk.signals&&Sk.signals.addEventListener){Sk.signals.addEventListener((function handleSignal(i){Sk.signals.removeEventListener(handleSignal),n()}))}else console.warn("signal.pause() not supported"),Sk.misceval.print_("signal.pause() not supported"),n()}))},n})),i.signal=new Sk.builtin.func((function(){throw new Sk.builtin.NotImplementedError("signal.signal is not supported.")})),i};',"src/lib/string.js":'var $builtinmodule=function(i){var t={};return t.ascii_lowercase=new Sk.builtin.str("abcdefghijklmnopqrstuvwxyz"),t.ascii_uppercase=new Sk.builtin.str("ABCDEFGHIJKLMNOPQRSTUVWXYZ"),t.ascii_letters=new Sk.builtin.str(t.ascii_lowercase.v+t.ascii_uppercase.v),t.lowercase=new Sk.builtin.str("abcdefghijklmnopqrstuvwxyz"),t.uppercase=new Sk.builtin.str("ABCDEFGHIJKLMNOPQRSTUVWXYZ"),t.letters=new Sk.builtin.str(t.lowercase.v+t.uppercase.v),t.digits=new Sk.builtin.str("0123456789"),t.hexdigits=new Sk.builtin.str("0123456789abcdefABCDEF"),t.octdigits=new Sk.builtin.str("01234567"),t.punctuation=new Sk.builtin.str("!\\"#$%&\'()*+,-./:;<=>?@[\\\\]^_`{|}~"),t.whitespace=new Sk.builtin.str("\\t\\n\\v\\f\\r "),t.printable=new Sk.builtin.str(t.digits.v+t.letters.v+t.punctuation.v+" \\t\\n\\r\\v\\f"),t.split=new Sk.builtin.func((function(...i){return Sk.misceval.callsimArray(Sk.builtin.str.prototype.split,i)})),t.capitalize=new Sk.builtin.func((function(i){return Sk.misceval.callsimArray(Sk.builtin.str.prototype.capitalize,[i])})),t.join=new Sk.builtin.func((function(i,t){return void 0===t&&(t=new Sk.builtin.str(" ")),Sk.misceval.callsimArray(Sk.builtin.str.prototype.join,[t,i])})),t.capwords=new Sk.builtin.func((function(i,n){if(Sk.builtin.pyCheckArgsLen("capwords",arguments.length,1,2),!Sk.builtin.checkString(i))throw new Sk.builtin.TypeError("s must be a string");if(void 0===n&&(n=new Sk.builtin.str(" ")),!Sk.builtin.checkString(n))throw new Sk.builtin.TypeError("sep must be a string");for(var e=Sk.misceval.callsimArray(t.split,[i,n]).v,r=[],l=0;l<e.length;l++){var s=e[l],u=Sk.misceval.callsimArray(t.capitalize,[s]);r.push(u)}return Sk.misceval.callsimArray(t.join,[new Sk.builtin.list(r),n])})),t};',"src/lib/time.js":'var $builtinmodule=function(t){var e={};e.__package__=new Sk.builtin.str("");var n=Sk.builtin.make_structseq("time","struct_time",{tm_year:"year, for example, 1993",tm_mon:"month of year, range [1, 12]",tm_mday:"day of month, range [1, 31]",tm_hour:"hours, range [0, 23]",tm_min:"minutes, range [0, 59]",tm_sec:"seconds, range [0, 61]",tm_wday:"day of week, range [0, 6], Monday is 0",tm_yday:"day of year, range [1, 366]",tm_isdst:"1 if summer time is in effect, 0 if not, and -1 if unknown"},{tm_zone:"abbreviation of timezone name",tm_gmtoff:"offset from UTC in seconds"});function padLeft(t,e,n){var i=t.toString();return Array(e-i.length+1).join(n||" ")+i}function getDayOfYear(t,e){var n=(e=e||!1)?t.getUTCMonth():t.getMonth(),i=e?t.getUTCDate():t.getDate(),u=[0,31,59,90,120,151,181,212,243,273,304,334][n]+i;return n>1&&function isLeapYear(t){return 0==(3&t)&&(t%100!=0||t%400==0)}(e?t.getUTCFullYear():t.getFullYear())&&u++,u}function stdTimezoneOffset(){var t=new Date(2002,0,1),e=new Date(2002,6,1);return Math.max(t.getTimezoneOffset(),e.getTimezoneOffset())}function dst(t){return t.getTimezoneOffset()<stdTimezoneOffset()}function timeZoneName(t){var e,n=/\\((.*)\\)/.exec(t.toString());if(null!=Sk.global.navigator&&(e=Sk.global.navigator.userLanguage||Sk.global.navigator.language),n&&n.length>1)return n[1];if(void 0===e)return null;try{return(n=t.toLocaleString(e,{timeZoneName:"short"}).split(" "))[n.length-1]}catch(i){return null}}function from_seconds(t,e){var i=new Date;if(t){Sk.builtin.pyCheckType("secs","number",Sk.builtin.checkNumber(t));var u=Sk.builtin.asnum$(t);i.setTime(1e3*u)}return function date_to_struct_time(t,e){let i;if(e=e||!1)i=[new Sk.builtin.str("UTC"),new Sk.builtin.int_(0)];else{var u=-t.getTimezoneOffset()/60,r=(u<0?"-":"+")+(""+Math.abs(u)).padStart(2,"0");i=[new Sk.builtin.str(r),new Sk.builtin.int_(3600*u)]}return new n([Sk.builtin.assk$(e?t.getUTCFullYear():t.getFullYear()),Sk.builtin.assk$((e?t.getUTCMonth():t.getMonth())+1),Sk.builtin.assk$(e?t.getUTCDate():t.getDate()),Sk.builtin.assk$(e?t.getUTCHours():t.getHours()),Sk.builtin.assk$(e?t.getUTCMinutes():t.getMinutes()),Sk.builtin.assk$(e?t.getUTCSeconds():t.getSeconds()),Sk.builtin.assk$(((e?t.getUTCDay():t.getDay())+6)%7),Sk.builtin.assk$(getDayOfYear(t,e)),Sk.builtin.assk$(e?0:dst(t)?1:0)],i)}(i,e)}e.struct_time=n,e.time=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen("time",arguments.length,0,0),new Sk.builtin.float_(Date.now()/1e3)})),e.sleep=new Sk.builtin.func((function(t){return Sk.builtin.pyCheckArgsLen("sleep",arguments.length,1,1),Sk.builtin.pyCheckType("delay","float",Sk.builtin.checkNumber(t)),new Sk.misceval.promiseToSuspension(new Promise((function(e){Sk.setTimeout((function(){e(Sk.builtin.none.none$)}),1e3*Sk.ffi.remapToJs(t))})))})),e.localtime=new Sk.builtin.func((function(t){return Sk.builtin.pyCheckArgsLen("localtime",arguments.length,0,1),from_seconds(t,!1)})),e.gmtime=new Sk.builtin.func((function(t){return Sk.builtin.pyCheckArgsLen("gmtime",arguments.length,0,1),from_seconds(t,!0)}));var i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function asctime_f(t){if(Sk.builtin.pyCheckArgsLen("asctime",arguments.length,0,1),!t||Sk.builtin.checkNone(t)?t=from_seconds():t instanceof n||(t=new n(t)),t instanceof Sk.builtin.tuple&&9==t.v.length){var e=[];return e.push(u[Sk.builtin.asnum$(t.v[6])]),e.push(i[Sk.builtin.asnum$(t.v[1])-1]),e.push(padLeft(Sk.builtin.asnum$(t.v[2]).toString(),2,"0")),e.push(padLeft(Sk.builtin.asnum$(t.v[3]).toString(),2,"0")+":"+padLeft(Sk.builtin.asnum$(t.v[4]).toString(),2,"0")+":"+padLeft(Sk.builtin.asnum$(t.v[5]).toString(),2,"0")),e.push(padLeft(Sk.builtin.asnum$(t.v[0]).toString(),4,"0")),new Sk.builtin.str(e.join(" "))}}function mktime_f(t){if(Sk.builtin.pyCheckArgsLen("mktime",arguments.length,1,1),t instanceof Sk.builtin.tuple&&9==t.v.length){var e=new Date(Sk.builtin.asnum$(t.v[0]),Sk.builtin.asnum$(t.v[1])-1,Sk.builtin.asnum$(t.v[2]),Sk.builtin.asnum$(t.v[3]),Sk.builtin.asnum$(t.v[4]),Sk.builtin.asnum$(t.v[5]));return Sk.builtin.assk$(e.getTime()/1e3,void 0)}throw new Sk.builtin.TypeError("mktime() requires a struct_time or 9-tuple")}e.asctime=new Sk.builtin.func(asctime_f),e.ctime=new Sk.builtin.func((function(t){return Sk.builtin.pyCheckArgsLen("ctime",arguments.length,0,1),asctime_f(from_seconds(t))})),e.mktime=new Sk.builtin.func(mktime_f),e.timezone=new Sk.builtin.int_(60*stdTimezoneOffset()),e.altzone=new Sk.builtin.int_(60*function altTimezoneOffset(){var t=new Date(2002,0,1),e=new Date(2002,6,1);return Math.min(t.getTimezoneOffset(),e.getTimezoneOffset())}()),e.daylight=new Sk.builtin.int_(function daylight_check(){const t=new Date(2002,0,1),e=new Date(2002,6,1);return t.getTimezoneOffset()!=e.getTimezoneOffset()}()?1:0),e.tzname=new Sk.builtin.tuple(function timeZoneNames(){var t=new Date(2002,0,1),e=new Date(2002,6,1);return dst(t)?[new Sk.builtin.str(timeZoneName(e)),new Sk.builtin.str(timeZoneName(t))]:[new Sk.builtin.str(timeZoneName(t)),new Sk.builtin.str(timeZoneName(e))]}()),e.accept2dyear=Sk.builtin.assk$(1),e.clock=new Sk.builtin.func((function(){var t=0;return t=Sk.global.performance&&Sk.global.performance.now?performance.now()/1e3:(new Date).getTime()/1e3,new Sk.builtin.float_(t)})),e.strftime=new Sk.builtin.func((function strftime_f(t,e){var i;if(Sk.builtin.pyCheckArgsLen("strftime",arguments.length,1,2),!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("format must be a string");return e?e instanceof n||(e=new n(e)):e=from_seconds(),function check_struct_time(t){if(!(t instanceof n))throw new Sk.builtin.TypeError("Required argument \'struct_time\' must be of type: \'struct_time\'");var e,i=t.v.length,u=t.v;for(e=0;e<i;++e)if(!Sk.builtin.checkInt(u[e]))throw new Sk.builtin.TypeError("struct_time may only contain integers");return!0}(e),i=Sk.ffi.remapToJs(t),Sk.ffi.remapToPy(Sk.global.strftime(i,new Date(1e3*mktime_f(e).v)))})),e.tzset=new Sk.builtin.func((function tzset_f(){throw new Sk.builtin.NotImplementedError("time.tzset() is not yet implemented")}));let r=null;return e.strptime=new Sk.builtin.func((function strptime_f(...t){return Sk.builtin.pyCheckArgsLen("strptime",t.length,1,2),null===r?Sk.misceval.chain(Sk.importModule("_strptime",!1,!0),(e=>(r=e.tp$getattr(new Sk.builtin.str("_strptime_time")),r.tp$call(t)))):r.tp$call(t)})),e};',"src/lib/token.js":'var $builtinmodule=function(n){var e={};e.__file__=new Sk.builtin.str("/src/lib/token.py");const t=[];for(let i in Sk.token.tok_name){const n=Sk.token.tok_name[i].slice(2),k=parseInt(i,10);t.push(Sk.ffi.remapToPy(k)),t.push(Sk.ffi.remapToPy(n)),e[n]=Sk.ffi.remapToPy(k)}return e.tok_name=new Sk.builtin.dict(t),e.ISTERMINAL=new Sk.builtin.func((function(n){return Sk.builtin.pyCheckArgsLen("ISTERMINAL",arguments.length,1,1),Sk.token.ISTERMINAL(Sk.ffi.remapToJs(n))})),e.ISNONTERMINAL=new Sk.builtin.func((function(n){return Sk.builtin.pyCheckArgsLen("ISNONTERMINAL",arguments.length,1,1),Sk.token.ISNONTERMINAL(Sk.ffi.remapToJs(n))})),e.ISEOF=new Sk.builtin.func((function(n){return Sk.builtin.pyCheckArgsLen("ISEOF",arguments.length,1,1),Sk.token.ISEOF(Sk.ffi.remapToJs(n))})),e};',"src/lib/tokenize.js":'var $builtinmodule=function(e){var i={};return i.tokenize=new Sk.builtin.func((function(e){Sk.builtin.pyCheckArgsLen("tokenize",1,1),Sk.builtin.checkFunction(e);const i=[];return Sk._tokenize("<stdin>",(function jsReadline(){const i=Sk.misceval.callsimArray(e);return Sk.ffi.remapToJs(i)}),"UTF-8",(function receiveToken(e){i.push(new Sk.builtin.tuple([Sk.ffi.remapToPy(e.type),Sk.ffi.remapToPy(e.string),new Sk.builtin.tuple([Sk.ffi.remapToPy(e.start[0]),Sk.ffi.remapToPy(e.start[1])]),new Sk.builtin.tuple([Sk.ffi.remapToPy(e.end[0]),Sk.ffi.remapToPy(e.end[1])]),Sk.ffi.remapToPy(e.line)]))})),new Sk.builtin.list(i)})),i};',"src/lib/turtle.js":'var $builtinmodule=function(e){"use strict";var t=function getConfiguredTarget(){var e,t;for(t="string"==typeof(e=Sk.TurtleGraphics&&Sk.TurtleGraphics.target||"turtle")?document.getElementById(e):e;t.firstChild;)t.removeChild(t.firstChild);return t}();return t.turtleInstance?t.turtleInstance.reset():t.turtleInstance=function generateTurtleModule(e){var t,n,r,i,s,a,o,l,u={__name__:new Sk.builtin.str("turtle")},c=!0,h=1e3/30,d={},f={},_={target:"turtle",width:400,height:400,worldWidth:0,worldHeight:0,animate:!0,bufferSize:0,allowUndo:!0,assets:{}};function getAsset(e){var t=i.assets,n="function"==typeof t?t(e):t[e];return"string"==typeof n?new Promise((function(t,r){var s=new Image;s.onload=function(){i.assets[e]=this,t(s)},s.onerror=function(){r(new Error("Missing asset: "+n))},s.src=n})):new InstantPromise(void 0,n)}function InstantPromise(e,t){this.lastResult=t,this.lastError=e}function FrameManager(){this.reset()}function getFrameManager(){return o||(o=new FrameManager),o}function MouseHandler(){var e=this;for(var t in this._target=getTarget(),this._managers={},this._handlers={mousedown:function(t){e.onEvent("mousedown",t)},mouseup:function(t){e.onEvent("mouseup",t)},mousemove:function(t){e.onEvent("mousemove",t)}},this._handlers)this._target.addEventListener(t,this._handlers[t])}function EventManager(e,t){this._type=e,this._target=t,this._handlers=void 0,function getMouseHandler(){return a||(a=new MouseHandler),a}().addManager(e,this)}function Turtle(e){if(getFrameManager().addTurtle(this),this._screen=getScreen(),this._managers={},this._shape=e.v,!d.hasOwnProperty(this._shape))throw new Sk.builtin.ValueError("Shape:\'"+this._shape+"\' not in default shape, please check shape again!");this.reset()}function Screen(){var e,t;this._frames=1,this._delay=void 0,this._bgcolor="none",this._mode="standard",this._managers={},this._keyLogger={},e=(i.worldWidth||i.width||getWidth())/2,t=(i.worldHeight||i.height||getHeight())/2,this.setUpWorld(-e,-t,e,t)}function ensureAnonymous(){return s||(s=Sk.misceval.callsimArray(u.Turtle)),s.instance}function getTarget(){return e}function getScreen(){return r||(r=new Screen),r}function getWidth(){return 0|(r&&r._width||i.width||getTarget().clientWidth||_.width)}function getHeight(){return 0|(r&&r._height||i.height||getTarget().clientHeight||_.height)}function createLayer(e,t){var n,r=document.createElement("canvas"),i=getWidth(),s=getHeight(),a=getTarget().firstChild?-s+"px":"0";return r.width=i,r.height=s,r.style.position="relative",r.style.display="block",r.style.setProperty("margin-top",a),r.style.setProperty("z-index",e),t&&(r.style.display="none"),getTarget().appendChild(r),(n=r.getContext("2d")).lineCap="round",n.lineJoin="round",applyWorld(getScreen(),n),n}function cancelAnimationFrame(){t&&((window.cancelAnimationFrame||window.mozCancelAnimationFrame)(t),t=void 0),n&&(window.clearTimeout(n),n=void 0)}function applyWorld(e,t){var n=e.llx,r=(e.lly,e.urx,e.ury),i=e.xScale,s=e.yScale;t&&(clearLayer(t),t.restore(),t.save(),t.scale(1/i,1/s),t.translate(-n,-r))}function pushUndo(e){var t,n,r;if(i.allowUndo&&e._bufferSize){for(e._undoBuffer||(e._undoBuffer=[]);e._undoBuffer.length>e._bufferSize;)e._undoBuffer.shift();for(n={},t="x y angle radians color fill down filling shown shape size".split(" "),r=0;r<t.length;r++)n[t[r]]=e["_"+t[r]];return e._undoBuffer.push(n),e.addUpdate((function(){n.fillBuffer=this.fillBuffer?this.fillBuffer.slice():void 0,e._paper&&e._paper.canvas&&(n.image=e._paper.canvas.toDataURL())}),!1)}}e.hasAttribute("tabindex")||e.setAttribute("tabindex",0),f.FLOAT=function(e){return new Sk.builtin.float_(e)},f.COLOR=function(e){if("string"==typeof e)return new Sk.builtin.str(e);for(var t=0;t<3;t++)e[t]=Sk.builtin.assk$(e[t]);return 4===e.length&&(e[3]=new Sk.builtin.float_(e[3])),new Sk.builtin.tuple(e)},f.TURTLE_LIST=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].skInstance);return new Sk.builtin.tuple(t)},d.arrow=[[-10,0],[10,0],[0,10]],d.square=[[10,-10],[10,10],[-10,10],[-10,-10]],d.triangle=[[10,-5.77],[0,11.55],[-10,-5.77]],d.classic=[[0,0],[-5,-9],[0,-7],[5,-9]],d.turtle=[[0,16],[-2,14],[-1,10],[-4,7],[-7,9],[-9,8],[-6,5],[-7,1],[-5,-3],[-8,-6],[-6,-8],[-4,-5],[0,-7],[4,-5],[6,-8],[8,-6],[5,-3],[7,1],[6,5],[9,8],[7,9],[4,7],[1,10],[2,14]],d.circle=[[10,0],[9.51,3.09],[8.09,5.88],[5.88,8.09],[3.09,9.51],[0,10],[-3.09,9.51],[-5.88,8.09],[-8.09,5.88],[-9.51,3.09],[-10,0],[-9.51,-3.09],[-8.09,-5.88],[-5.88,-8.09],[-3.09,-9.51],[-0,-10],[3.09,-9.51],[5.88,-8.09],[8.09,-5.88],[9.51,-3.09]],i=function(){var e;for(e in Sk.TurtleGraphics||(Sk.TurtleGraphics={}),_)Sk.TurtleGraphics.hasOwnProperty(e)||(Sk.TurtleGraphics[e]=_[e]);return Sk.TurtleGraphics}(),InstantPromise.prototype.then=function(e){if(this.lastError)return this;try{this.lastResult=e(this.lastResult)}catch(t){this.lastResult=void 0,this.lastError=t}return this.lastResult instanceof Promise?this.lastResult:this},InstantPromise.prototype.catch=function(e){if(this.lastError)try{this.lastResult=e(this.lastError),this.lastError=void 0}catch(t){this.lastResult=void 0,this.lastError=t}return this.lastResult instanceof Promise?this.lastResult:this},function(e){var r,s;function animationFrame(e){return i.animate?!e&&r?r:function(t){return n=window.setTimeout(t,e||h)}:function(e){e()}}(s=window.requestAnimationFrame||window.mozRequestAnimationFrame)&&(r=function(e){return t=s(e)}),e.willRenderNext=function(){return!(!this._buffer||this._frameCount+1!==this.frameBuffer())},e.turtles=function(){return this._turtles},e.addTurtle=function(e){this._turtles.push(e)},e.reset=function(){if(this._turtles)for(var e=this._turtles.length;--e>=0;)this._turtles[e].reset();this._turtles=[],this._frames=[],this._frameCount=0,this._buffer=1,this._rate=0,this._animationFrame=animationFrame()},e.addFrame=function(e,t){return t&&(this._frameCount+=1),this.frames().push(e),!i.animate||this._buffer&&this._frameCount===this.frameBuffer()?this.update():new InstantPromise},e.frames=function(){return this._frames},e.frameBuffer=function(e){return"number"==typeof e&&(this._buffer=0|e,e&&e<=this._frameCount)?this.update():this._buffer},e.refreshInterval=function(e){return"number"==typeof e&&(this._rate=0|e,this._animationFrame=animationFrame(e)),this._rate},e.update=function(){return this._frames&&this._frames.length?this.requestAnimationFrame():new InstantPromise},e.requestAnimationFrame=function(){var e,t,n=this._frames,r=this._animationFrame,i=this._turtles,s=getScreen().spriteLayer();return this._frames=[],this._frameCount=0,new Promise((function(a){r((function paint(){for(t=0;t<n.length;t++)n[t]&&n[t]();for(clearLayer(s),t=0;t<i.length;t++)(e=i[t]).getState().shown&&drawTurtle(e.getState(),s);a()}))}))}}(FrameManager.prototype),(l=MouseHandler.prototype).onEvent=function(e,t){var n,r,i,s,a,o=this._managers[e],l=this._managers.mousemove,u=!1;function computeCoordinates(){if(!u){var e=getScreen(),a=e.spriteLayer().canvas.getBoundingClientRect();n=t.clientX-a.left|0,r=t.clientY-a.top|0,i=n*e.xScale+e.llx,s=r*e.yScale+e.ury,u=!0}}if(("mousedown"===e||"mouseup"===e)&&l&&l.length)for(computeCoordinates(),a=l.length;--a>=0;)l[a].test(n,r,i,s)&&l[a].canMove("mousedown"===e);if(o&&o.length)for(computeCoordinates(),a=o.length;--a>=0;)("mousemove"===e&&o[a].canMove()&&o[a].test(n,r,i,s)||"mousedown"===e&&o[a].test(n,r,i,s))&&o[a].trigger([i,s])},l.reset=function(){this._managers={}},l.addManager=function(e,t){this._managers[e]||(this._managers[e]=[]),this._managers[e].push(t)},function(e){e.reset=function(){this._handlers=void 0},e.canMove=function(e){return!(!this._target||!this._target.hitTest)&&(void 0!==e&&(this._target.hitTest.hit=e),this._target.hitTest.hit)},e.test=function(e,t,n,r){return this._target&&this._target.hitTest?this._target.hitTest(e,t,n,r):!!this._target},e.trigger=function(e){var t,n=this._handlers;if(n&&n.length)for(t=0;t<n.length;t++)n[t].apply({},e)},e.addHandler=function(e,t){var n=this._handlers;if(!t&&n&&n.length)for(;n.shift(););"function"==typeof e?(n||(n=this._handlers=[]),n.push(e)):n&&!n.length&&this.reset()}}(EventManager.prototype),Turtle.RADIANS=2*Math.PI,function(e){function circleRotate(e,t,n){return function(){return e.addUpdate(void 0,!1,{angle:t,radians:n})}}function circleSegment(e,t,n,r,i,s){return function(){return e.translate(t,n,r,i,s,!0)}}e.hitTest=function(e,t,n,r){var i=getScreen().hitTestLayer();clearLayer(i),drawTurtle(this.getState(),i);var s=i.getImageData(e,t,1,1).data;return s[3]||s[0]||s[1]||s[2]},e.addUpdate=function(e,t,n){var r=this.getState(),i=Array.prototype.slice.call(arguments,n?2:3);return getFrameManager().addFrame((function(){if(e&&e.apply(r,i),n)for(var t in n)r[t]=n[t]}),t)},e.getState=function(){var e=this;return this._state||(this._state={x:this._x,y:this._y,angle:this._angle,radians:this._radians,shape:this._shape,color:this._color,fill:this._fill,filling:this._filling,size:this._size,speed:this._computed_speed,down:this._down,shown:this._shown,colorMode:this._colorMode,context:function(){return e.getPaper()}}),this._state},e.translate=function(e,t,n,r,i,s){var a=this;return function translate(e,t,n,r,i,s,a){var o,l=e._computed_speed,u=getScreen(),c=Math.abs(u.xScale),h=Math.abs(u.yScale),d=t,f=n,_=Math.sqrt(r*r*c+i*i*h),g=l?Math.round(Math.max(1,_/l)):1,p=r/g,m=i/g,v=getFrameManager().willRenderNext()?Promise.resolve():new InstantPromise,y=!(!l&&a);for(e.addUpdate((function(){this.filling&&this.fillBuffer.push({x:this.x,y:this.y,stroke:this.down,color:this.color,size:this.size})}),!1),o=0;o<g;o++)d=t+p*(o+1),f=n+m*(o+1),v=v.then(partialTranslate(e,d,f,s,y)),s=!1;return v.then((function(){return[t+r,n+i]}))}(this,e,t,n,r,i,s).then((function(e){a._x=e[0],a._y=e[1]}))},e.rotate=function(e,t,n){var r=this;return function rotate(e,t,n,r){var i,s=e._computed_speed,a=n/e._fullCircle*360,o=s?Math.round(Math.max(1,Math.abs(a)/s)):1,l=n/o,u={},c=!(!s&&r),h=getFrameManager().willRenderNext()?Promise.resolve():new InstantPromise;for(i=0;i<o;i++)calculateHeading(e,t+l*(i+1),u),h=h.then(partialRotate(e,u.angle,u.radians,c));return h.then((function(){return calculateHeading(e,t+n)}))}(this,e,t,n).then((function(e){r._angle=e.angle,r._radians=e.radians}))},e.queueMoveBy=function(e,t,n,r){var i=Math.cos(n)*r,s=Math.sin(n)*r;return this.translate(e,t,i,s,!0)},e.queueTurnTo=function(e,t){return(t%=this._fullCircle)<0&&(t+=this._fullCircle),this.rotate(e,t-e)},e.getManager=function(e){return this._managers[e]||(this._managers[e]=new EventManager(e,this)),this._managers[e]},e.getPaper=function(){return this._paper||(this._paper=createLayer(2))},e.reset=function(){for(var e in this._x=0,this._y=0,this._radians=0,this._angle=0,this._shown=!0,this._down=!0,this._color="black",this._fill="black",this._size=1,this._filling=!1,this._undoBuffer=[],this._speed=3,this._computed_speed=6,this._colorMode=1,this._state=void 0,this._managers)this._managers[e].reset();this._isRadians=!1,this._fullCircle=360,this._bufferSize="number"==typeof i.bufferSize?i.bufferSize:0,removeLayer(this._paper),this._paper=void 0},e.$degrees=function(e){return e="number"==typeof e?Math.abs(e):360,this._isRadians=!1,e&&this._fullCircle?this._angle=this._angle/this._fullCircle*e:this._angle=this._radians=0,this._fullCircle=e,this.addUpdate(void 0,!1,{angle:this._angle,radians:this._radians})},e.$degrees.minArgs=0,e.$degrees.co_varnames=["fullcircle"],e.$degrees.returnType=f.FLOAT,e.$radians=function(){return this._isRadians||(this._isRadians=!0,this._angle=this._radians,this._fullCircle=Turtle.RADIANS),this._angle},e.$radians.returnType=f.FLOAT,e.$position=e.$pos=function(){return[this.$xcor(),this.$ycor()]},e.$position.returnType=function(e){return new Sk.builtin.tuple([new Sk.builtin.float_(e[0]),new Sk.builtin.float_(e[1])])},e.$towards=function(e,t){var n=getCoordinates(e,t);return(Math.PI+Math.atan2(this._y-n.y,this._x-n.x))*(this._fullCircle/Turtle.RADIANS)},e.$towards.co_varnames=["x","y"],e.$towards.minArgs=1,e.$towards.returnType=f.FLOAT,e.$distance=function(e,t){var n=getCoordinates(e,t),r=n.x-this._x,i=n.y-this._y;return Math.sqrt(r*r+i*i)},e.$distance.co_varnames=["x","y"],e.$distance.minArgs=1,e.$distance.returnType=f.FLOAT,e.$heading=function(){return Math.abs(this._angle)<1e-13?0:this._angle},e.$heading.returnType=f.FLOAT,e.$xcor=function(){return Math.abs(this._x)<1e-13?0:this._x},e.$xcor.returnType=f.FLOAT,e.$ycor=function(){return Math.abs(this._y)<1e-13?0:this._y},e.$ycor.returnType=f.FLOAT,e.$forward=e.$fd=function(e){return pushUndo(this),this.queueMoveBy(this._x,this._y,this._radians,e)},e.$forward.co_varnames=e.$fd.co_varnames=["distance"],e.$undo=function(){!function popUndo(e){var t;if(e._bufferSize&&e._undoBuffer&&(t=e._undoBuffer.pop())){for(var n in t)"image"!==n&&"fillBuffer"!==n&&(e["_"+n]=t[n]);e.addUpdate((function(){t.image&&(g.src=t.image),clearLayer(this.context(),!1,g),delete t.image}),!0,t)}}(this)},e.$undobufferentries=function(){return this._undoBuffer.length},e.$setundobuffer=function(e){this._bufferSize="number"==typeof e?Math.min(Math.abs(e),1e3):0},e.$setundobuffer.co_varnames=["size"],e.$backward=e.$back=e.$bk=function(e){return pushUndo(this),this.queueMoveBy(this._x,this._y,this._radians,-e)},e.$backward.co_varnames=e.$back.co_varnames=e.$bk.co_varnames=["distance"],e.$goto_$rw$=e.$setpos=e.$setposition=function(e,t){var n=getCoordinates(e,t);return pushUndo(this),this.translate(this._x,this._y,n.x-this._x,n.y-this._y,!0)},e.$goto_$rw$.co_varnames=e.$setpos.co_varnames=e.$setposition.co_varnames=["x","y"],e.$goto_$rw$.minArgs=e.$setpos.minArgs=e.$setposition.minArgs=1,e.$setx=function(e){return this.translate(this._x,this._y,e-this._x,0,!0)},e.$setx.co_varnames=["x"],e.$sety=function(e){return this.translate(this._x,this._y,0,e-this._y,!0)},e.$sety.co_varnames=["y"],e.$home=function(){var e=this,t=this._angle;return pushUndo(this),e.translate(this._x,this._y,-this._x,-this._y,!0).then((function(n){return e.queueTurnTo(t,0)})).then((function(e){}))},e.$right=e.$rt=function(e){return pushUndo(this),this.rotate(this._angle,-e)},e.$right.co_varnames=e.$rt.co_varnames=["angle"],e.$left=e.$lt=function(e){return pushUndo(this),this.rotate(this._angle,e)},e.$left.co_varnames=e.$lt.co_varnames=["angle"],e.$setheading=e.$seth=function(e){return pushUndo(this),this.queueTurnTo(this._angle,e)},e.$setheading.co_varnames=e.$seth.co_varnames=["angle"],e.$circle=function(e,t,n){var r,i,s,a,o,l,u,c,h,d=this,f=this._x,_=this._y,g=this._angle,p={},m=1/getScreen().lineScale,v=!0;for(pushUndo(this),void 0===t&&(t=d._fullCircle),void 0===n&&(i=Math.abs(t)/d._fullCircle,n=1+(Math.min(11+Math.abs(e*m)/6,59)*i|0)),a=.5*(s=t/n),o=2*e*Math.sin(s*Math.PI/d._fullCircle),e<0?(o=-o,s=-s,a=-a,r=g-t):r=g+t,h=getFrameManager().willRenderNext()?Promise.resolve():new InstantPromise,g+=a,l=0;l<n;l++)calculateHeading(d,g+s*l,p),u=Math.cos(p.radians)*o,c=Math.sin(p.radians)*o,h=h.then(circleRotate(d,p.angle,p.radians)).then(circleSegment(d,f,_,u,c,v)),f+=u,_+=c,v=!1;return h.then((function(){return calculateHeading(d,r,p),d._angle=p.angle,d._radians=p.radians,d.addUpdate(void 0,!0,p)}))},e.$circle.co_varnames=["radius","extent","steps"],e.$circle.minArgs=1,e.$penup=e.$up=e.$pu=function(){return this._down=!1,this.addUpdate(void 0,!1,{down:!1})},e.$pendown=e.$down=e.$pd=function(){return this._down=!0,this.addUpdate(void 0,!1,{down:!0})},e.$isdown=function(){return this._down},e.$speed=function(e){if("undefined"==typeof e)return this._speed;const t={fastest:0,fast:10,normal:6,slow:3,slowest:1};if(e in t&&(e=t[e]),"number"!=typeof e){if("string"==typeof e){const e=Object.keys(t).join(", ");throw new Sk.builtin.TypeError("speed string expected one of "+e)}throw new Sk.builtin.TypeError("speed expected a string or number")}return e=e>.5&&e<10.5?Sk.builtin.asnum$(Sk.builtin.round(Sk.builtin.assk$(e))):0,this._speed=e,this._computed_speed=2*e,this.addUpdate(void 0,!1,{speed:this._computed_speed})},e.$speed.minArgs=0,e.$speed.co_varnames=["speed"],e.$pencolor=function(e,t,n,r){return void 0!==e?(this._color=createColor(this._colorMode,e,t,n,r),this.addUpdate(void 0,this._shown,{color:this._color})):hexToRGB(this._color)},e.$pencolor.co_varnames=["r","g","b","a"],e.$pencolor.minArgs=0,e.$pencolor.returnType=f.COLOR,e.$fillcolor=function(e,t,n,r){return void 0!==e?(this._fill=createColor(this._colorMode,e,t,n,r),this.addUpdate(void 0,this._shown,{fill:this._fill})):hexToRGB(this._fill)},e.$fillcolor.co_varnames=["r","g","b","a"],e.$fillcolor.minArgs=0,e.$fillcolor.returnType=f.COLOR,e.$color=function(e,t,n,r){return void 0!==e?(void 0===t||void 0!==n?(this._color=createColor(this._colorMode,e,t,n,r),this._fill=this._color):(this._color=createColor(this._colorMode,e),this._fill=createColor(this._colorMode,t)),this.addUpdate(void 0,this._shown,{color:this._color,fill:this._fill})):[this.$pencolor(),this.$fillcolor()]},e.$color.minArgs=0,e.$color.co_varnames=["color","fill","b","a"],e.$color.returnType=function(e){return new Sk.builtin.tuple([f.COLOR(e[0]),f.COLOR(e[1])])},e.$fill=function(e){if(void 0!==e){if((e=!!e)===this._filling)return;return this._filling=e,e?(pushUndo(this),this.addUpdate(void 0,!1,{filling:!0,fillBuffer:[{x:this._x,y:this._y}]})):(pushUndo(this),this.addUpdate((function(){this.fillBuffer.push(this),drawFill.call(this)}),!0,{filling:!1,fillBuffer:void 0}))}return this._filling},e.$fill.co_varnames=["flag"],e.$fill.minArgs=0,e.$begin_fill=function(){return this.$fill(!0)},e.$end_fill=function(){return this.$fill(!1)},e.$stamp=function(){return pushUndo(this),this.addUpdate((function(){drawTurtle(this,this.context())}),!0)},e.$dot=function(e,t,n,r,i){return pushUndo(this),e="number"==typeof(e=Sk.builtin.asnum$(e))?Math.max(1,0|Math.abs(e)):Math.max(this._size+4,2*this._size),t=void 0!==t?createColor(this._colorMode,t,n,r,i):this._color,this.addUpdate(drawDot,!0,void 0,e,t)},e.$dot.co_varnames=["size","color","g","b","a"],e.$write=function(e,t,n,r){var i,s,a,o,l,u=this;return pushUndo(this),e=String(e),r&&r.constructor===Array&&(s="string"==typeof r[0]?r[0]:"Arial",a=String(r[1]||"12pt"),o="string"==typeof r[2]?r[2]:"normal",/^\\d+$/.test(a)&&(a+="pt"),r=[o,a,s].join(" ")),n||(n="left"),i=this.addUpdate(drawText,!0,void 0,e,n,r),!t||"left"!==n&&"center"!==n||(l=function measureText(e,t){return t&&(p.font=t),p.measureText(e).width}(e,r),"center"===n&&(l/=2),i=i.then((function(){var e=u.getState();return u.translate(e.x,e.y,l,0,!0)}))),i},e.$write.co_varnames=["message","move","align","font"],e.$write.minArgs=1,e.$pensize=e.$width=function(e){return void 0!==e?(this._size=e,this.addUpdate(void 0,this._shown,{size:e})):this._size},e.$pensize.minArgs=e.$width.minArgs=0,e.$pensize.co_varnames=e.$width.co_varnames=["width"],e.$showturtle=e.$st=function(){return this._shown=!0,this.addUpdate(void 0,!0,{shown:!0})},e.$hideturtle=e.$ht=function(){return this._shown=!1,this.addUpdate(void 0,!0,{shown:!1})},e.$isvisible=function(){return this._shown},e.$shape=function(e){return e&&d[e]?(this._shape=e,this.addUpdate(void 0,this._shown,{shape:e})):this._shape},e.$shape.minArgs=0,e.$shape.co_varnames=["name"],e.$window_width=function(){return this._screen.$window_width()},e.$window_height=function(){return this._screen.$window_height()},e.$tracer=function(e,t){return this._screen.$tracer(e,t)},e.$tracer.minArgs=0,e.$tracer.co_varnames=["n","delay"],e.$update=function(){return this._screen.$update()},e.$delay=function(e){return this._screen.$delay(e)},e.$delay.minArgs=0,e.$delay.co_varnames=["delay"],e.$reset=function(){return this.reset(),this.$clear()},e.$mainloop=e.$done=function(){return this._screen.$mainloop()},e.$clear=function(){return this.addUpdate((function(){clearLayer(this.context())}),!0)},e.$dot.minArgs=0,e.$onclick=function(e,t,n){this.getManager("mousedown").addHandler(e,n)},e.$onclick.minArgs=1,e.$onclick.co_varnames=["method","btn","add"],e.$onrelease=function(e,t,n){this.getManager("mouseup").addHandler(e,n)},e.$onrelease.minArgs=1,e.$onrelease.co_varnames=["method","btn","add"],e.$ondrag=function(e,t,n){this.getManager("mousemove").addHandler(e,n)},e.$ondrag.minArgs=1,e.$ondrag.co_varnames=["method","btn","add"],e.$getscreen=function(){return Sk.misceval.callsimArray(u.Screen)},e.$getscreen.isSk=!0,e.$clone=function(){var e=Sk.misceval.callsimOrSuspendArray(u.Turtle);return e.instance._x=this._x,e.instance._y=this._y,e.instance._angle=this._angle,e.instance._radians=this._radians,e.instance._shape=this._shape,e.instance._color=this._color,e.instance._fill=this._fill,e.instance._filling=this._filling,e.instance._size=this._size,e.instance._computed_speed=this._computed_speed,e.instance._down=this._down,e.instance._shown=this._shown,e.instance._colorMode=this._colorMode,e.instance._isRadians=this._isRadians,e.instance._fullCircle=this._fullCircle,e.instance._bufferSize=this._bufferSize,e.instance._undoBuffer=this._undoBuffer,e._clonedFrom=this,e},e.$clone.returnType=function(e){return e},e.$getturtle=e.$getpen=function(){return this.skInstance},e.$getturtle.isSk=!0}(Turtle.prototype),function(e){e.spriteLayer=function(){return this._sprites||(this._sprites=createLayer(3))},e.bgLayer=function(){return this._background||(this._background=createLayer(1))},e.hitTestLayer=function(){return this._hitTest||(this._hitTest=createLayer(0,!0))},e.getManager=function(e){return this._managers[e]||(this._managers[e]=new EventManager(e,this)),this._managers[e]},e.reset=function(){var e;for(e in this._keyListeners=void 0,this._keyLogger)window.clearInterval(this._keyLogger[e]),window.clearTimeout(this._keyLogger[e]),delete this._keyLogger[e];for(e in this._keyDownListener&&(getTarget().removeEventListener("keydown",this._keyDownListener),this._keyDownListener=void 0),this._keyUpListener&&(getTarget().removeEventListener("keyup",this._keyUpListener),this._keyUpListener=void 0),this._timer&&(window.clearTimeout(this._timer),this._timer=void 0),this._managers)this._managers[e].reset();this._mode="standard",removeLayer(this._sprites),this._sprites=void 0,removeLayer(this._background),this._background=void 0},e.setUpWorld=function(e,t,n,r){var i=this;i.llx=e,i.lly=t,i.urx=n,i.ury=r,i.xScale=(n-e)/getWidth(),i.yScale=-1*(r-t)/getHeight(),i.lineScale=Math.min(Math.abs(i.xScale),Math.abs(i.yScale))},e.$setup=function(e,t,n,r){return isNaN(parseFloat(e))&&(e=getWidth()),isNaN(parseFloat(t))&&(t=getHeight()),e<=1&&(e=getWidth()*e),t<=1&&(t=getHeight()*t),this._width=e,this._height=t,this._xOffset=void 0===n||isNaN(parseInt(n))?0:parseInt(n),this._yOffset=void 0===r||isNaN(parseInt(r))?0:parseInt(r),"world"===this._mode?this._setworldcoordinates(this.llx,this.lly,this.urx,this.ury):this._setworldcoordinates(-e/2,-t/2,e/2,t/2)},e.$setup.minArgs=0,e.$setup.co_varnames=["width","height","startx","starty"],e.$register_shape=e.$addshape=function(e,t){if(!t)return getAsset(e).then((function(t){d[e]=t}));d[e]=t},e.$register_shape.minArgs=1,e.$register_shape.co_varnames=["name","shape"],e.$getshapes=function(){return Object.keys(d)},e.$tracer=function(e,t){return void 0!==e||void 0!==t?("number"==typeof t&&(this._delay=t,getFrameManager().refreshInterval(t)),"number"==typeof e?(this._frames=e,getFrameManager().frameBuffer(e)):void 0):this._frames},e.$tracer.co_varnames=["frames","delay"],e.$tracer.minArgs=0,e.$delay=function(e){return void 0!==e?this.$tracer(void 0,e):void 0===this._delay?h:this._delay},e.$delay.co_varnames=["delay"],e._setworldcoordinates=function(e,t,n,r){return getFrameManager().turtles(),this.setUpWorld(e,t,n,r),this._sprites&&applyWorld(this,this._sprites),this._background&&applyWorld(this,this._background),this.$clear()},e.$setworldcoordinates=function(e,t,n,r){return this._mode="world",this._setworldcoordinates(e,t,n,r)},e.$setworldcoordinates.co_varnames=["llx","lly","urx","ury"],e.minArgs=4,e.$clear=e.$clearscreen=function(){return this.reset(),this.$reset()},e.$update=function(){return getFrameManager().update()},e.$reset=e.$resetscreen=function(){var e=this,t=getFrameManager().turtles();return getFrameManager().addFrame((function(){applyWorld(e,e._sprites),applyWorld(e,e._background);for(var n=0;n<t.length;n++)t[n].reset(),applyWorld(e,t[n]._paper)}),!0)},e.$window_width=function(){return getWidth()},e.$window_height=function(){return getHeight()},e.$delay.minArgs=0,e.$turtles=function(){return getFrameManager().turtles()},e.$turtles.returnType=f.TURTLE_LIST,e.$bgpic=function(e){var t;return e?(t=this,getAsset(e).then((function(e){clearLayer(t.bgLayer(),void 0,e)}))):this._bgpic},e.$bgpic.minArgs=0,e.$bgpic.co_varnames=["name"],e.$bgcolor=function(e,t,n,r){return void 0!==e?(this._bgcolor=createColor(this._colorMode,e,t,n,r),void clearLayer(this.bgLayer(),this._bgcolor)):hexToRGB(this._bgcolor)},e.$bgcolor.minArgs=0,e.$bgcolor.co_varnames=["color","g","b","a"],e.$bgcolor.returnType=f.COLOR,e.$colormode=function(e){return void 0!==e?(this._colorMode=255===e?255:1,this.addUpdate(void 0,this._shown,{colorMode:this._colorMode})):this._colorMode},e.$colormode.minArgs=0,e.$colormode.co_varnames=["cmode"],e.$colormode.returnType=function(e){return 255===e?new Sk.builtin.int_(255):new Sk.builtin.float_(1)},e.$mainloop=e.$done=function(){},e.$bye=function(){return Sk.TurtleGraphics.reset()},e.$exitonclick=function(){return this._exitOnClick=!0,this.getManager("mousedown").addHandler((function(){resetTurtle()}),!1)},e.$onclick=function(e,t,n){this._exitOnClick||this.getManager("mousedown").addHandler(e,n)},e.$onclick.minArgs=1,e.$onclick.co_varnames=["method","btn","add"];var t={8:/^back(space)?$/i,9:/^tab$/i,13:/^(enter|return)$/i,16:/^shift$/i,17:/^(ctrl|control)$/i,18:/^alt$/i,27:/^esc(ape)?$/i,32:/^space$/i,33:/^page[\\s\\-]?up$/i,34:/^page[\\s\\-]?down$/i,35:/^end$/i,36:/^home$/i,37:/^left([\\s\\-]?arrow)?$/i,38:/^up([\\s\\-]?arrow)?$/i,39:/^right([\\s\\-]?arrow)?$/i,40:/^down([\\s\\-]?arrow)?$/i,45:/^insert$/i,46:/^del(ete)?$/i};e._createKeyRepeater=function(e,t){var n=this;n._keyLogger[t]=window.setTimeout((function(){n._keyListeners[e](),n._keyLogger[t]=window.setInterval((function(){n._keyListeners[e]()}),50)}),333)},e._createKeyDownListener=function(){var e=this;this._keyDownListener||(this._keyDownListener=function(n){if(focusTurtle()){var r,i,s=n.charCode||n.keyCode,a=String.fromCharCode(s).toLowerCase();if(!e._keyLogger[s])for(r in e._keyListeners)if(i=r.length>1&&t[s]&&t[s].test(r),r===a||i){e._keyListeners[r](),e._createKeyRepeater(r,s),n.preventDefault();break}}},getTarget().addEventListener("keydown",this._keyDownListener))},e._createKeyUpListener=function(){var e=this;this._keyUpListener||(this._keyUpListener=function(t){var n=e._keyLogger[t.charCode||t.keyCode];void 0!==n&&(t.preventDefault(),window.clearInterval(n),window.clearTimeout(n),delete e._keyLogger[t.charCode||t.keyCode])},getTarget().addEventListener("keyup",this._keyUpListener))},e.$title=function(e){document.title=e},e.$title.minArgs=1,e.$title.co_varnames=["title"],e.$listen=function(){this._createKeyUpListener(),this._createKeyDownListener()},e.$onkey=function(e,t){if("function"==typeof t){var n=e;e=t,t=n}t=String(t).toLowerCase(),e&&"function"==typeof e?(this._keyListeners||(this._keyListeners={}),this._keyListeners[t]=e):delete this._keyListeners[t]},e.$onkey.minArgs=2,e.$onkey.co_varnames=["method","keyValue"],e.$onscreenclick=function(e,t,n){this.getManager("mousedown").addHandler(e,n)},e.$onscreenclick.minArgs=1,e.$onscreenclick.co_varnames=["method","btn","add"],e.$ontimer=function(e,t){this._timer&&(window.clearTimeout(this._timer),this._timer=void 0),e&&"number"==typeof t&&(this._timer=window.setTimeout(e,Math.max(0,0|t)))},e.$ontimer.minArgs=0,e.$ontimer.co_varnames=["method","interval"]}(Screen.prototype);var g=new Image;function removeLayer(e){e&&e.canvas&&e.canvas.parentNode&&e.canvas.parentNode.removeChild(e.canvas)}function clearLayer(e,t,n){e&&(e.save(),e.setTransform(1,0,0,1,0,0),t?(e.fillStyle=t,e.fillRect(0,0,e.canvas.width,e.canvas.height)):e.clearRect(0,0,e.canvas.width,e.canvas.height),n&&e.drawImage(n,0,0),e.restore())}function drawTurtle(e,t){var n,r,i,s=d[e.shape],a=getScreen(),o=(getWidth(),getHeight(),a.xScale),l=a.yScale;if(t){if(n=Math.cos(e.radians)/o,r=Math.sin(e.radians)/l,i=Math.atan2(r,n)-Math.PI/2,t.save(),t.translate(e.x,e.y),t.scale(o,l),s.nodeName){var u=s.naturalWidth,c=s.naturalHeight;t.drawImage(s,0,0,u,c,-u/2,-c/2,u,c)}else{t.rotate(i),t.beginPath(),t.lineWidth=1,t.strokeStyle=e.color,t.fillStyle=e.fill,t.moveTo(-s[0][0],s[0][1]);for(var h=1;h<s.length;h++)t.lineTo(-s[h][0],s[h][1]);t.closePath(),t.fill(),t.stroke()}t.restore()}}function drawDot(e,t){var n=this.context(),r=getScreen(),i=r.xScale,s=r.yScale;n&&(n.beginPath(),n.moveTo(this.x,this.y),e*=Math.min(Math.abs(i),Math.abs(s)),n.arc(this.x,this.y,e/2,0,Turtle.RADIANS),n.closePath(),n.fillStyle=t||this.color,n.fill())}var p=document.createElement("canvas").getContext("2d");function drawText(e,t,n){var r=this.context();r&&(r.save(),n&&(r.font=n),t&&t.match(/^(left|right|center)$/)&&(r.textAlign=t),r.scale(1,-1),r.fillStyle=this.fill,r.fillText(e,this.x,-this.y),r.restore())}function drawLine(e,t,n){var r=this.context();r&&(t&&(r.beginPath(),r.moveTo(this.x,this.y)),r.lineWidth=this.size*getScreen().lineScale,r.strokeStyle=this.color,r.lineTo(e.x,e.y),r.stroke())}function drawFill(){var e,t=this.context(),n=this.fillBuffer;if(t&&n&&n.length){for(t.save(),t.beginPath(),t.moveTo(n[0].x,n[0].y),e=1;e<n.length;e++)t.lineTo(n[e].x,n[e].y);for(t.closePath(),t.fillStyle=this.fill,t.fill(),e=1;e<n.length;e++)n[e].stroke&&(t.beginPath(),t.moveTo(n[e-1].x,n[e-1].y),t.lineWidth=n[e].size*getScreen().lineScale,t.strokeStyle=n[e].color,t.lineTo(n[e].x,n[e].y),t.stroke());t.restore()}}function partialTranslate(e,t,n,r,i){return function(){return e.addUpdate((function(e){this.down&&drawLine.call(this,e,r)}),i,{x:t,y:n},r)}}function partialRotate(e,t,n,r){return function(){return e.addUpdate(void 0,r,{angle:t,radians:n})}}function getCoordinates(e,t){return void 0===t&&(t=e&&(e.y||e._y||e[1])||0,e=e&&(e.x||e._x||e[0])||0),{x:e,y:t}}function hexToRGB(e){var t,n,r;return(t=/^rgba?\\((\\d+),(\\d+),(\\d+)(?:,([.\\d]+))?\\)$/.exec(e))?(r=[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])],t[4]&&r.push(parseFloat(t[4]))):/^#?[a-f\\d]{3}|[a-f\\d]{6}$/i.exec(e)?(4===e.length&&(e=e.replace(/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i,(function(e,t,n,r){return t+t+n+n+r+r}))),n=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(e),r=[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]):r=e,r}function createColor(e,t,n,r,i){var s;if(void 0!==n&&(t=[t,n,r,i]),t.constructor===Array&&t.length){if(255===e)for(s=0;s<3;s++){if("number"!=typeof t[s])throw new Sk.builtin.ValueError("bad color sequence");t[s]=Math.max(0,Math.min(255,parseInt(t[s])))}else for(s=0;s<3;s++){if("number"!=typeof t[s])throw new Sk.builtin.ValueError("bad color sequence");if(!(t[s]<=1))throw new Sk.builtin.ValueError("bad color sequence");t[s]=Math.max(0,Math.min(255,parseInt(255*t[s])))}"number"==typeof t[s]?(t[3]=Math.max(0,Math.min(1,t[s])),t="rgba("+t.join(",")+")"):t="rgb("+t.slice(0,3).join(",")+")"}else{if("string"!=typeof t||t.match(/\\s*url\\s*\\(/i))return"black";t=t.replace(/\\s+/g,"")}return t}function calculateHeading(e,t,n){var r=e._angle||0,i=e._radians||0;return n||(n={}),"number"==typeof t&&(e._isRadians?r=i=t%Turtle.RADIANS:e._fullCircle?i=(r=t%e._fullCircle)/e._fullCircle*Turtle.RADIANS:r=i=0,r<0&&(r+=e._fullCircle,i+=Turtle.RADIANS)),n.angle=r,n.radians=i,n}function pythonToJavascriptFunction(e,t){return function(){var n=Array.prototype.slice.call(arguments).map((function(e){return Sk.ffi.remapToPy(e)}));return"undefined"!=typeof t&&n.unshift(t),Sk.misceval.applyAsync(void 0,e,void 0,void 0,void 0,n).catch(Sk.uncaughtException)}}function addModuleMethod(e,t,n,r){var i,s=n.replace(/^\\$/,""),a=s.replace(/_\\$[a-z]+\\$$/i,""),o=e.prototype[n].length,l=e.prototype[n].minArgs,u=e.prototype[n].co_varnames||[],c=e.prototype[n].returnType,h=e.prototype[n].isSk;void 0===l&&(l=o),i=function(){var e,t,i,s,u,d=Array.prototype.slice.call(arguments,0),f=r?r():d.shift().instance;if(d.length<l||d.length>o)throw u=l===o?"exactly "+o:"between "+l+" and "+o,new Sk.builtin.TypeError(a+"() takes "+u+" positional argument(s) ("+d.length+" given)");for(e=d.length;--e>=0;)void 0!==d[e]&&(d[e]instanceof Sk.builtin.func?d[e]=pythonToJavascriptFunction(d[e]):d[e]instanceof Sk.builtin.method?d[e]=pythonToJavascriptFunction(d[e].im_func,d[e].im_self):d[e]&&d[e].$d instanceof Sk.builtin.dict&&d[e].instance?d[e]=d[e].instance:d[e]=Sk.ffi.remapToJs(d[e]));var _=d.slice(0);for(d=[],e=_.length;e>=0;--e)null!==_[e]&&(d[e]=_[e]);try{t=f[n].apply(f,d)}catch(g){throw window&&window.console&&(window.console.log("wrapped method failed"),window.console.log(g.stack)),g}return t instanceof InstantPromise&&(t=t.lastResult),t instanceof Promise?(t=t.catch((function(e){throw window&&window.console&&(window.console.log("promise failed"),window.console.log(e.stack)),e})),(i=new Sk.misceval.Suspension).resume=function(){return void 0===s?Sk.builtin.none.none$:Sk.ffi.remapToPy(s)},i.data={type:"Sk.promise",promise:t.then((function(e){return s=e,e}))},i):void 0===t?Sk.builtin.none.none$:h?t:"function"==typeof c?c(t):Sk.ffi.remapToPy(t)},i.co_name=new Sk.builtin.str(a),i.co_varnames=u.slice(),i.$defaults=[];for(var d=l;d<u.length;d++)i.$defaults.push(Sk.builtin.none.none$);r||i.co_varnames.unshift("self"),t[s]=new Sk.builtin.func(i)}function initTurtle(e,t){Sk.builtin.pyCheckArgs("__init__",arguments,2,3,!1,!1),e.instance=new Turtle(t),e.instance.skInstance=e}for(var m in initTurtle.co_varnames=["self","shape"],initTurtle.co_name=new Sk.builtin.str("Turtle"),initTurtle.co_argcount=2,initTurtle.$defaults=[Sk.builtin.none.none$,new Sk.builtin.str("classic")],Turtle.prototype)/^\\$[a-z_]+/.test(m)&&addModuleMethod(Turtle,u,m,ensureAnonymous);function focusTurtle(e){return void 0!==e&&((c=!!e)?getTarget().focus():getTarget().blur()),c}function resetTurtle(){for(cancelAnimationFrame(),getScreen().reset(),getFrameManager().reset();e.firstChild;)e.removeChild(e.firstChild);a&&a.reset(),r=void 0,s=void 0,a=void 0}return addModuleMethod(Screen,u,"$mainloop",getScreen),addModuleMethod(Screen,u,"$done",getScreen),addModuleMethod(Screen,u,"$bye",getScreen),addModuleMethod(Screen,u,"$tracer",getScreen),addModuleMethod(Screen,u,"$update",getScreen),addModuleMethod(Screen,u,"$delay",getScreen),addModuleMethod(Screen,u,"$window_width",getScreen),addModuleMethod(Screen,u,"$window_height",getScreen),addModuleMethod(Screen,u,"$title",getScreen),addModuleMethod(Screen,u,"$onkey",getScreen),addModuleMethod(Screen,u,"$listen",getScreen),addModuleMethod(Screen,u,"$register_shape",getScreen),addModuleMethod(Screen,u,"$clearscreen",getScreen),addModuleMethod(Screen,u,"$bgcolor",getScreen),addModuleMethod(Screen,u,"$bgpic",getScreen),addModuleMethod(Screen,u,"$setworldcoordinates",getScreen),addModuleMethod(Screen,u,"$ontimer",getScreen),addModuleMethod(Screen,u,"$onscreenclick",getScreen),addModuleMethod(Screen,u,"$exitonclick",getScreen),addModuleMethod(Screen,u,"$resetscreen",getScreen),addModuleMethod(Screen,u,"$setup",getScreen),addModuleMethod(Screen,u,"$turtles",getScreen),u.Turtle=Sk.misceval.buildClass(u,(function TurtleWrapper(e,t){for(var n in t.__init__=new Sk.builtin.func(initTurtle),Turtle.prototype)/^\\$[a-z_]+/.test(n)&&addModuleMethod(Turtle,t,n)}),"Turtle",[]),u.Screen=Sk.misceval.buildClass(u,(function ScreenWrapper(e,t){for(var n in t.__init__=new Sk.builtin.func((function(e){e.instance=getScreen()})),Screen.prototype)/^\\$[a-z_]+/.test(n)&&addModuleMethod(Screen,t,n)}),"Screen",[]),{skModule:u,reset:resetTurtle,stop:function stopTurtle(){cancelAnimationFrame(),a&&a.reset(),r=void 0,s=void 0,a=void 0},focus:focusTurtle,Turtle:Turtle,Screen:Screen}}(t),Sk.TurtleGraphics.module=t.turtleInstance.skModule,Sk.TurtleGraphics.reset=t.turtleInstance.reset,Sk.TurtleGraphics.stop=t.turtleInstance.stop,Sk.TurtleGraphics.focus=t.turtleInstance.focus,Sk.TurtleGraphics.raw={Turtle:t.turtleInstance.Turtle,Screen:t.turtleInstance.Screen},t.turtleInstance.skModule};',"src/lib/urllib/__init__.js":"var $builtinmodule=function(n){return{}};","src/lib/urllib/request/__init__.js":'var $builtinmodule=function(n){var e={};e.Response=Sk.misceval.buildClass(e,(function(n,e){e.__init__=new Sk.builtin.func((function(n,e){n.data$=e.responseText,n.lineList=n.data$.split("\\n"),n.lineList=n.lineList.slice(0,-1);for(var i=0;i<n.lineList.length;i++)n.lineList[i]=n.lineList[i]+"\\n";n.currentLine=0,n.pos$=0})),e.__str__=new Sk.builtin.func((function(n){return Sk.ffi.remapToPy("<Response>")})),e.__iter__=new Sk.builtin.func((function(n){var e=n.lineList;return Sk.builtin.makeGenerator((function(){if(!(this.$index>=this.$lines.length))return new Sk.builtin.str(this.$lines[this.$index++])}),{$obj:n,$index:0,$lines:e})})),e.read=new Sk.builtin.func((function(n,e){if(n.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");var i=n.data$.length;void 0===e&&(e=i);var t=new Sk.builtin.str(n.data$.substr(n.pos$,e));return n.pos$+=e,n.pos$>=i&&(n.pos$=i),t})),e.readline=new Sk.builtin.func((function(n,e){var i="";return n.currentLine<n.lineList.length&&(i=n.lineList[n.currentLine],n.currentLine++),new Sk.builtin.str(i)})),e.readlines=new Sk.builtin.func((function(n,e){for(var i=[],t=n.currentLine;t<n.lineList.length;t++)i.push(new Sk.builtin.str(n.lineList[t]));return new Sk.builtin.list(i)}))}),"Response",[]);return e.urlopen=new Sk.builtin.func((function(n,i,t){var r;r=function(n){var e;if(!Sk.jsonpSites)return!1;for(e=0;e<Sk.jsonpSites.length;e++)if(n.startsWith(Sk.jsonpSites[e]))return!0;return!1}(n.v)?new Promise((function(i,t){var r=document.createElement("script");r.src=n.v+"&callback=Sk.jsonpcallback",r.onerror=function(n){t("An error occured getting the data")},Sk.jsonpcallback=function(n){var t={responseText:JSON.stringify(n)};i(Sk.misceval.callsimArray(e.Response,[t]))};try{document.body.appendChild(r)}catch(s){console.log("caught error in urlopen"+s)}})):new Promise((function(t,r){var s=new XMLHttpRequest;s.addEventListener("loadend",(function(n){t(Sk.misceval.callsimArray(e.Response,[s]))})),i?(s.open("POST",n.v),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.send(i.v)):(s.open("GET",n.v),s.send(null))}));var s,u=new Sk.misceval.Suspension;return u.resume=function(){return s},u.data={type:"Sk.promise",promise:r.then((function(n){return s=n,n}),(function(n){return s="",n}))},u})),e};',"src/lib/uuid.js":'function $builtinmodule(){const{builtin:{bytes:e,str:t,int_:n,TypeError:i,ValueError:s,NotImplementedError:r,none:{none$:o},NotImplemented:{NotImplemented$:l}},abstr:{buildNativeClass:a,checkArgsLen:m,copyKeywordsToNamedArgs:$,lookupSpecial:u,setUpModuleMethods:h},misceval:{callsimArray:d,objectRepr:c,richCompareBool:g}}=Sk,p={__name__:new t("uuid"),RESERVED_NCS:o,RFC_4122:o,RESERVED_FUTURE:o};let f=Sk.global.crypto;"undefined"==typeof f&&(f={getRandomValues(e){let t=e.length;for(;t--;)e[t]=Math.floor(256*Math.random());return e}});const w=n.tp$getattr(new t("from_bytes")),b=n.tp$getattr(new t("to_bytes")),y=new n(1).nb$lshift(new n(128)),_=new n(0),I=new n(4),U=new n(16),v=new t("big"),E=new t("%032x"),S=/-/g;function notImplemented(){throw new r("Not yet implemneted in Skulpt")}function switchBytesBytesLe(e){const t=new Uint8Array(e);return t[0]=e[3],t[1]=e[2],t[2]=e[1],t[3]=e[0],t[4]=e[5],t[5]=e[4],t[6]=e[7],t[7]=e[6],t}const R=p.UUID=a("uuid.UUID",{constructor:function(){},slots:{tp$init(l,a){m("UUID",l,0,6);let[u,h,c,p,f,b,I]=$("UUID",["hex","bytes","bytes_le","fields","int","version","is_safe"],l,a,[o,o,o,o,o,o,o]);if(4!==[u,h,c,p,f].filter((e=>e===o)).length)throw new i("one of the hex, bytes, bytes_le, fields, or int arguments must be given");if(u!==o){u=u.toString().replace("urn:","").replace("uuid:","");let e=0,i=u.length-1;for(;"{}".indexOf(u[e])>=0;)e++;for(;"{}".indexOf(u[i])>=0;)i--;if(u=u.slice(e,i+1),u=u.replace(S,""),32!==u.length)throw new s("badly formed hexadecimal UUID string");f=d(n,[new t(u),U])}if(c!==o){if(!(c instanceof e))throw new i("bytes_le should be a bytes instance");if(c=c.valueOf(),16!==c.length)throw new s("bytes_le is not a 16-char string");h=switchBytesBytesLe(c),h=new e(h)}if(h!==o){if(!(h instanceof e))throw new i("bytes_le should be a bytes instance");if(16!==h.valueOf().length)throw new s("bytes is not a 16-char string");f=d(w,[h],["byteorder",v])}if(p!==o)throw new r("fields argument is not yet supported");if(f!==o&&(g(f,_,"Lt")||((e,t)=>g(e,t,"GtE"))(f,y)))throw new s("int is out of range (need a 128-bit value)");this.$int=f,this.$isSafe=I},tp$str(){const e=E.nb$remainder(this.$int).toString();return new t(`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`)},$r(){const e=u(this.ob$type,t.$name),n=c(this.tp$str());return new t(`${e}(${n})`)},tp$hash(){return this.$int.tp$hash()},tp$richcompare(e,t){return e instanceof R?this.$int.tp$richcompare(e.$int,t):l},tp$as_number:!0,nb$int(){return this.$int}},getsets:{int:{$get(){return this.$int}},is_safe:{$get(){return this.$isSafe}},bytes:{$get(){return d(b,[this.$int,U,v])}},bytes_le:{$get(){const n=this.tp$getattr(new t("bytes")).valueOf();return new e(switchBytesBytesLe(n))}},fields:{$get:()=>notImplemented()},time_low:{$get:()=>notImplemented()},time_mid:{$get:()=>notImplemented()},time_hi_version:{$get:()=>notImplemented()},clock_seq_hi_variant:{$get:()=>notImplemented()},clock_seq_low:{$get:()=>notImplemented()},time:{$get:()=>notImplemented()},clock_seq:{$get:()=>notImplemented()},node:{$get:()=>notImplemented()},hex:{$get(){return E.nb$remainder(this.$int)}},urn:{$get(){return new t(`urn:uuid:${this}`)}},variant:{$get:()=>notImplemented()},version:{$get:()=>notImplemented()}}});return h("uuid",p,{uuid1:{$meth(){notImplemented()},$flags:{FastCall:!0}},uuid2:{$meth(){notImplemented()},$flags:{FastCall:!0}},uuid3:{$meth(){notImplemented()},$flags:{FastCall:!0}},uuid4:{$meth(){const t=new e(f.getRandomValues(new Uint8Array(16)));return d(R,[],["bytes",t,"version",I])},$flags:{NoArgs:!0}},uuid5:{$meth(){notImplemented()},$flags:{FastCall:!0}}}),p}',"src/lib/webbrowser.js":'var $builtinmodule=function(n){var e={},t="undefined"!=typeof window&&"undefined"!=typeof window.navigator;function open_tab(n){return Sk.builtin.pyCheckType("url","string",Sk.builtin.checkString(n)),t?(n=n.$jsstr(),window.open(n,"_blank"),Sk.builtin.bool.true$):Sk.builtin.bool.false$}return e.__name__=new Sk.builtin.str("webbrowser"),e.open=new Sk.builtin.func((function open(n){return Sk.builtin.pyCheckArgsLen("open",arguments.length+1,1,3),open_tab(n)})),e.open_new=new Sk.builtin.func((function open_new(n){return Sk.builtin.pyCheckArgsLen("open_new",arguments.length,1,1),open_tab(n)})),e.open_new_tab=new Sk.builtin.func((function open_new_tab(n){return Sk.builtin.pyCheckArgsLen("open_new_tab",arguments.length,1,1),open_tab(n)})),e.DefaultBrowser=Sk.misceval.buildClass(e,(function dflbrowser(n,e){e.__init__=new Sk.builtin.func((function __init__(n){return Sk.builtin.none.none$})),e.open=new Sk.builtin.func((function open(n,e){return Sk.builtin.pyCheckArgsLen("open",arguments.length,2,4),open_tab(e)})),e.open_new=new Sk.builtin.func((function open_new(n,e){return Sk.builtin.pyCheckArgsLen("open_new",arguments.length,2,2),open_tab(e)})),e.open_new_tab=new Sk.builtin.func((function open_new_tab(n,e){return Sk.builtin.pyCheckArgsLen("open_new_tab",arguments.length,2,2),open_tab(e)}))}),"DefaultBrowser",[]),e.get=new Sk.builtin.func((function get(){return Sk.builtin.pyCheckArgsLen("get",arguments.length,0,1),Sk.misceval.callsimArray(e.DefaultBrowser,[])})),e};',"src/lib/webgl/__init__.js":'var $builtinmodule=function(n){var t={__name__:new Sk.builtin.str("webgl")},makeFailHTML=function(n){return\'<table style="background-color: #8CE; width: 100%; height: 100%;"><tr><td align="center"><div style="display: table-cell; vertical-align: middle;"><div style="">\'+n+"</div></div></td></tr></table>"},e=\'This page requires a browser that supports WebGL.<br/><a href="http://get.webgl.org">Click here to upgrade your browser.</a>\';return t.Context=Sk.misceval.buildClass(t,(function(n,t){t.__init__=new Sk.builtin.func((function(n,t){var i=document.getElementById(t.v),r=function(n,t){var i=document.getElementById(n);if(t||(t=i.getElementsByTagName("canvas")[0]),t){var r=function(n){for(var t=["webgl","experimental-webgl","webkit-3d","moz-webgl"],e=null,i=0;i<t.length;++i){try{e=n.getContext(t[i])}catch(r){}if(e)break}if(e){function returnFalse(){return!1}n.onselectstart=returnFalse,n.onmousedown=returnFalse}return e}(t);if(!r){var u=navigator.userAgent.match(/(\\w+\\/.*? )/g),a={};try{for(var o=0;o<u.length;++o){for(var l=u[o].match(/(\\w+)/g),c=[],f=1;f<l.length;++f)c.push(parseInt(l[f]));a[l[0]]=c}}catch(s){}a.Chrome&&(a.Chrome[0]>7||7==a.Chrome[0]&&a.Chrome[1]>0||7==a.Chrome[0]&&0==a.Chrome[1]&&a.Chrome[2]>=521)?i.innerHTML=makeFailHTML(\'It doesn\\\'t appear your computer can support WebGL.<br/><a href="http://get.webgl.org">Click here for more information.</a>\'):i.innerHTML=makeFailHTML(e)}return r}i.innerHTML=makeFailHTML(e)}(t.v,i);if(!r)throw new Error("Your browser does not appear to support WebGL.");for(var u in n.gl=r,r.__proto__)if("number"==typeof r.__proto__[u])Sk.abstr.objectSetItem(n.$d,new Sk.builtin.str(u),r.__proto__[u]);else if("function"==typeof r.__proto__[u])switch(u){case"bufferData":case"clearColor":case"drawArrays":case"getAttribLocation":case"getUniformLocation":case"shaderSource":case"uniformMatrix4fv":case"vertexAttribPointer":case"viewport":break;default:!function(t){Sk.abstr.objectSetItem(n.$d,new Sk.builtin.str(u),new Sk.builtin.func((function(){return r.__proto__[t].apply(r,arguments)})))}(u)}r.clearColor(100/255,149/255,237/255,1),r.clear(r.COLOR_BUFFER_BIT)})),t.tp$getattr=Sk.generic.getAttr,t.bufferData=new Sk.builtin.func((function(n,t,e,i){n.gl.bufferData(t,e.v,i)})),t.clearColor=new Sk.builtin.func((function(n,t,e,i,r){n.gl.clearColor(Sk.builtin.asnum$(t),Sk.builtin.asnum$(e),Sk.builtin.asnum$(i),Sk.builtin.asnum$(r))})),t.getAttribLocation=new Sk.builtin.func((function(n,t,e){return n.gl.getAttribLocation(t,e.v)})),t.getUniformLocation=new Sk.builtin.func((function(n,t,e){return n.gl.getUniformLocation(t,e.v)})),t.shaderSource=new Sk.builtin.func((function(n,t,e){n.gl.shaderSource(t,e.v)})),t.drawArrays=new Sk.builtin.func((function(n,t,e,i){n.gl.drawArrays(Sk.builtin.asnum$(t),Sk.builtin.asnum$(e),Sk.builtin.asnum$(i))})),t.vertexAttribPointer=new Sk.builtin.func((function(n,t,e,i,r,u,a){n.gl.vertexAttribPointer(t,Sk.builtin.asnum$(e),Sk.builtin.asnum$(i),r,Sk.builtin.asnum$(u),Sk.builtin.asnum$(a))})),t.viewport=new Sk.builtin.func((function(n,t,e,i,r){n.gl.viewport(Sk.builtin.asnum$(t),Sk.builtin.asnum$(e),Sk.builtin.asnum$(i),Sk.builtin.asnum$(r))})),t.uniformMatrix4fv=new Sk.builtin.func((function(n,t,e,i){n.gl.uniformMatrix4fv(Sk.builtin.asnum$(t),e,i.v)})),t.setDrawFunc=new Sk.builtin.func((function(n,t){var e=(new Date).getTime();setInterval((function(){Sk.misceval.callsimArray(t,[n,(new Date).getTime()-e])}),1e3/60)}))}),"Context",[]),t.Float32Array=Sk.misceval.buildClass(t,(function(n,t){t.__init__=new Sk.builtin.func((function(n,t){n.v="number"==typeof t?new Float32Array(t):new Float32Array(Sk.ffi.remapToJs(t))})),t.__repr__=new Sk.builtin.func((function(n){for(var t=[],e=0;e<n.v.length;++e)t.push(n.v[e]);return new Sk.builtin.str("["+t.join(", ")+"]")}))}),"Float32Array",[]),t.Matrix4x4=Sk.misceval.buildClass(t,(function(n,t){t.__init__=new Sk.builtin.func((function(n,t){n.v=new Float32Array(Sk.ffi.remapToJs(t))})),t.identity=new Sk.builtin.func((function(n){var t=n.v;t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1})),t.perspective=new Sk.builtin.func((function(n,t,e,i,r){var u=Math.tan(.5*Math.PI-Sk.builtin.asnum$(t)*Math.PI/180*.5),a=Sk.builtin.asnum$(e),o=Sk.builtin.asnum$(i),l=Sk.builtin.asnum$(r),c=1/(o-l),f=n.v;f[0]=u/a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=u,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=(o+l)*c,f[11]=-1,f[12]=0,f[13]=0,f[14]=o*l*c*2,f[15]=0})),t.translate=new Sk.builtin.func((function(n,t){var e=n.v,i=Sk.ffi.remapToJs(t);e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1})),t.__repr__=new Sk.builtin.func((function(n){for(var t=[],e=0;e<n.v.length;++e)t.push(n.v[e]);return new Sk.builtin.str("["+t.join(", ")+"]")}))}),"Matrix4x4",[]),t};',"src/lib/webgl/math.js":'var $builtinmodule=function(e){var n={};return n.Mat44=Sk.misceval.buildClass(n,(function(e,t){t.__init__=new Sk.builtin.func((function(e){Sk.misceval.callsimArray(t.loadIdentity,[e]),e.stack=[]})),t.push=new Sk.builtin.func((function(e){e.stack.push(e.elements.slice(0))})),t.pop=new Sk.builtin.func((function(e){e.elements=e.stack.pop()})),t.loadIdentity=new Sk.builtin.func((function(e){e.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]})),t.transform3=new Sk.builtin.func((function(e,t){var l=e.elements;return Sk.misceval.callsimArray(n.Vec3,[l[0]*t.x+l[4]*t.y+l[8]*t.z,l[1]*t.x+l[5]*t.y+l[9]*t.z,l[2]*t.x+l[6]*t.y+l[10]*t.z])})),t.scale=new Sk.builtin.func((function(e,n,t,l){return e.elements[0]*=n,e.elements[1]*=n,e.elements[2]*=n,e.elements[3]*=n,e.elements[4]*=t,e.elements[5]*=t,e.elements[6]*=t,e.elements[7]*=t,e.elements[8]*=l,e.elements[9]*=l,e.elements[10]*=l,e.elements[11]*=l,e})),t.translate=new Sk.builtin.func((function(e,n,t,l){return e.elements[12]+=e.elements[0]*n+e.elements[4]*t+e.elements[8]*l,e.elements[13]+=e.elements[1]*n+e.elements[5]*t+e.elements[9]*l,e.elements[14]+=e.elements[2]*n+e.elements[6]*t+e.elements[10]*l,e.elements[15]+=e.elements[3]*n+e.elements[7]*t+e.elements[11]*l,e})),t.rotate=new Sk.builtin.func((function(e,t,l,s,m){var i,a,c,u,r,f,o,k,S,y,b,v=Math.sqrt(l*l+s*s+m*m),_=Math.sin(t*Math.PI/180),w=Math.cos(t*Math.PI/180);v>0&&(i=(l/=v)*l,a=(s/=v)*s,c=(m/=v)*m,u=l*s,r=s*m,f=m*l,o=l*_,k=s*_,S=m*_,y=1-w,(b=Sk.misceval.callsimArray(n.Mat44)).elements[0]=y*i+w,b.elements[1]=y*u-S,b.elements[2]=y*f+k,b.elements[3]=0,b.elements[4]=y*u+S,b.elements[5]=y*a+w,b.elements[6]=y*r-o,b.elements[7]=0,b.elements[8]=y*f-k,b.elements[9]=y*r+o,b.elements[10]=y*c+w,b.elements[11]=0,b.elements[12]=0,b.elements[13]=0,b.elements[14]=0,b.elements[15]=1,b=b.multiply(e),e.elements=b.elements);return e})),t.multiply=new Sk.builtin.func((function(e,t){for(var l=Sk.misceval.callsimArray(n.Mat44),s=0;s<4;s++)l.elements[4*s+0]=e.elements[4*s+0]*t.elements[0]+e.elements[4*s+1]*t.elements[4]+e.elements[4*s+2]*t.elements[8]+e.elements[4*s+3]*t.elements[12],l.elements[4*s+1]=e.elements[4*s+0]*t.elements[1]+e.elements[4*s+1]*t.elements[5]+e.elements[4*s+2]*t.elements[9]+e.elements[4*s+3]*t.elements[13],l.elements[4*s+2]=e.elements[4*s+0]*t.elements[2]+e.elements[4*s+1]*t.elements[6]+e.elements[4*s+2]*t.elements[10]+e.elements[4*s+3]*t.elements[14],l.elements[4*s+3]=e.elements[4*s+0]*t.elements[3]+e.elements[4*s+1]*t.elements[7]+e.elements[4*s+2]*t.elements[11]+e.elements[4*s+3]*t.elements[15];return e.elements=l.elements,e})),t.lookAt=new Sk.builtin.func((function(e,t,l,s,m,i,a,c,u,r){var f=[t-m,l-i,s-a],o=Math.sqrt(f[0]*f[0]+f[1]*f[1]+f[2]*f[2]);o&&(f[0]/=o,f[1]/=o,f[2]/=o);var k=[c,u,r],S=[];S[0]=k[1]*f[2]-k[2]*f[1],S[1]=-k[0]*f[2]+k[2]*f[0],S[2]=k[0]*f[1]-k[1]*f[0],k[0]=f[1]*S[2]-f[2]*S[1],k[1]=-f[0]*S[2]+f[2]*S[0],k[2]=f[0]*S[1]-f[1]*S[0],(o=Math.sqrt(S[0]*S[0]+S[1]*S[1]+S[2]*S[2]))&&(S[0]/=o,S[1]/=o,S[2]/=o),(o=Math.sqrt(k[0]*k[0]+k[1]*k[1]+k[2]*k[2]))&&(k[0]/=o,k[1]/=o,k[2]/=o);var y=Sk.misceval.callsimArray(n.Mat44);return y.elements[0]=S[0],y.elements[4]=S[1],y.elements[8]=S[2],y.elements[12]=0,y.elements[1]=k[0],y.elements[5]=k[1],y.elements[9]=k[2],y.elements[13]=0,y.elements[2]=f[0],y.elements[6]=f[1],y.elements[10]=f[2],y.elements[14]=0,y.elements[3]=0,y.elements[7]=0,y.elements[11]=0,y.elements[15]=1,y=y.multiply(e),e.elements=y.elements,e.translate(-t,-l,-s),e}))}),"Mat44",[]),n.Mat33=Sk.misceval.buildClass(n,(function(e,n){n.__init__=new Sk.builtin.func((function(e){Sk.misceval.callsimArray(n.loadIdentity,[e])})),n.loadIdentity=new Sk.builtin.func((function(e){e.elements=[1,0,0,0,1,0,0,0,1]}))}),"Mat33",[]),n.Vec3=Sk.misceval.buildClass(n,(function(e,t){t.__init__=new Sk.builtin.func((function(e,n,t,l){e.x=n,e.y=t,e.z=l})),t.__sub__=new Sk.builtin.func((function(e,t){return Sk.misceval.callsimArray(n.Vec3,[e.x-t.x,e.y-t.y,e.z-t.z])}))}),"Vec3",[]),n.cross=new Sk.builtin.func((function(e,t){return Sk.asserts.assert(e instanceof n.Vec3&&t instanceof n.Vec3),Sk.misceval.callsimArray(n.Vec3,[e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x])})),n};',"src/lib/webgl/matrix4.js":"var $builtinmodule=function(n){var r={},t=new Float32Array(3),a=new Float32Array(3),u=new Float32Array(3),e=(new Float32Array(4),new Float32Array(4),new Float32Array(4),new Float32Array(16),new Float32Array(16),new Float32Array(16),function(n,r){for(var t=0,a=r.length,u=0;u<a;++u)t+=r[u]*r[u];if((t=Math.sqrt(t))>1e-5)for(u=0;u<a;++u)n[u]=r[u]/t;else for(u=0;u<a;++u)n[u]=0;return n}),cross=function(n,r,t){return n[0]=r[1]*t[2]-r[2]*t[1],n[1]=r[2]*t[0]-r[0]*t[2],n[2]=r[0]*t[1]-r[1]*t[0],n},dot=function(n,r){return n[0]*r[0]+n[1]*r[1]+n[2]*r[2]};return r.lookAt=new Sk.builtin.func((function(n,r,i,o){var v=a,f=u,l=e(t,function(n,r,t){for(var a=r.length,u=0;u<a;++u)n[u]=r[u]-t[u];return n}(t,r.v,i.v)),c=e(v,cross(v,o.v,l)),w=cross(f,l,c),h=n.v;return h[0]=c[0],h[1]=w[0],h[2]=l[0],h[3]=0,h[4]=c[1],h[5]=w[1],h[6]=l[1],h[7]=0,h[8]=c[2],h[9]=w[2],h[10]=l[2],h[11]=0,h[12]=-dot(c,r.v),h[13]=-dot(w,r.v),h[14]=-dot(l,r.v),h[15]=1,n})),r.perspective=new Sk.builtin.func((function(n,r,t,a,u){var e=Math.tan(.5*Math.PI-r*Math.PI/180*.5),i=1/(a-u),o=n.v;return o[0]=e/t,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=e,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(a+u)*i,o[11]=-1,o[12]=0,o[13]=0,o[14]=a*u*i*2,o[15]=0,n})),r.rotationY=new Sk.builtin.func((function(n,r){var t=n.v,a=Math.cos(r*Math.PI/180),u=Math.sin(r*Math.PI/180);return t[0]=a,t[1]=0,t[2]=-u,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=u,t[9]=0,t[10]=a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,n})),r.identity=new Sk.builtin.func((function(n){var r=n.v;return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,n})),r.mul=new Sk.builtin.func((function(n,r,t){var a=n.v,u=r.v,e=t.v,i=u[0],o=u[1],v=u[2],f=u[3],l=u[4],c=u[5],w=u[6],h=u[7],y=u[8],A=u[9],F=u[10],b=u[11],k=u[12],M=u[13],s=u[14],S=u[15],I=e[0],P=e[1],p=e[2],d=e[3],g=e[4],m=e[5],q=e[6],Y=e[7],$=e[8],j=e[9],x=e[10],z=e[11],B=e[12],C=e[13],D=e[14],E=e[15];return a[0]=i*I+o*g+v*$+f*B,a[1]=i*P+o*m+v*j+f*C,a[2]=i*p+o*q+v*x+f*D,a[3]=i*d+o*Y+v*z+f*E,a[4]=l*I+c*g+w*$+h*B,a[5]=l*P+c*m+w*j+h*C,a[6]=l*p+c*q+w*x+h*D,a[7]=l*d+c*Y+w*z+h*E,a[8]=y*I+A*g+F*$+b*B,a[9]=y*P+A*m+F*j+b*C,a[10]=y*p+A*q+F*x+b*D,a[11]=y*d+A*Y+F*z+b*E,a[12]=k*I+M*g+s*$+S*B,a[13]=k*P+M*m+s*j+S*C,a[14]=k*p+M*q+s*x+S*D,a[15]=k*d+M*Y+s*z+S*E,n})),r.invert=new Sk.builtin.func((function(n,r){var t=n.v,a=r.v,u=a[0],e=a[1],i=a[2],o=a[3],v=a[4],f=a[5],l=a[6],c=a[7],w=a[8],h=a[9],y=a[10],A=a[11],F=a[12],b=a[13],k=a[14],M=a[15],s=y*M,S=k*A,I=l*M,P=k*c,p=l*A,d=y*c,g=i*M,m=k*o,q=i*A,Y=y*o,$=i*c,j=l*o,x=w*b,z=F*h,B=v*b,C=F*f,D=v*h,E=w*f,G=u*b,H=F*e,J=u*h,K=w*e,L=u*f,N=v*e,O=s*f+P*h+p*b-(S*f+I*h+d*b),Q=S*e+g*h+Y*b-(s*e+m*h+q*b),R=I*e+m*f+$*b-(P*e+g*f+j*b),T=d*e+q*f+j*h-(p*e+Y*f+$*h),U=1/(u*O+v*Q+w*R+F*T);return t[0]=U*O,t[1]=U*Q,t[2]=U*R,t[3]=U*T,t[4]=U*(S*v+I*w+d*F-(s*v+P*w+p*F)),t[5]=U*(s*u+m*w+q*F-(S*u+g*w+Y*F)),t[6]=U*(P*u+g*v+j*F-(I*u+m*v+$*F)),t[7]=U*(p*u+Y*v+$*w-(d*u+q*v+j*w)),t[8]=U*(x*c+C*A+D*M-(z*c+B*A+E*M)),t[9]=U*(z*o+G*A+K*M-(x*o+H*A+J*M)),t[10]=U*(B*o+H*c+L*M-(C*o+G*c+N*M)),t[11]=U*(E*o+J*c+N*A-(D*o+K*c+L*A)),t[12]=U*(B*y+E*k+z*l-(D*k+x*l+C*y)),t[13]=U*(J*k+x*i+H*y-(G*y+K*k+z*i)),t[14]=U*(G*l+N*k+C*i-(L*k+B*i+H*l)),t[15]=U*(L*y+D*i+K*l-(J*l+N*y+E*i)),n})),r.transpose=new Sk.builtin.func((function(n,r){for(var t=n.v,a=r.v,u=0;u<4;++u)for(var e=0;e<4;++e)t[4*u+e]=a[4*e+u];return t})),r};","src/lib/webgl/models.js":'var $builtinmodule=function(t){return Sk.misceval.chain(Sk.importModule("webgl",!1,!0),(e=>{const n=e.$d;var r={},Buffer=function(t,e){var r=e||n.ARRAY_BUFFER,i=n.createBuffer();if(this.target=r,this.buf=i,this.set(t),this.numComponents_=t.numComponents,this.numElements_=t.numElements,this.totalComponents_=this.numComponents_*this.numElements_,t.buffer instanceof Float32Array)this.type_=n.FLOAT;else if(t.buffer instanceof Uint8Array)this.type_=n.UNSIGNED_BYTE;else if(t.buffer instanceof Int8Array)this.type_=n._BYTE;else if(t.buffer instanceof Uint16Array)this.type_=n.UNSIGNED_SHORT;else{if(!(t.buffer instanceof Int16Array))throw"unhandled type:"+typeof t.buffer;this.type_=n.SHORT}};return Buffer.prototype.set=function(t){n.bindBuffer(this.target,this.buf),n.bufferData(this.target,t.buffer,n.STATIC_DRAW)},Buffer.prototype.type=function(){return this.type_},Buffer.prototype.numComponents=function(){return this.numComponents_},Buffer.prototype.numElements=function(){return this.numElements_},Buffer.prototype.totalComponents=function(){return this.totalComponents_},Buffer.prototype.buffer=function(){return this.buf},Buffer.prototype.stride=function(){return 0},Buffer.prototype.offset=function(){return 0},r.Model=Sk.misceval.buildClass(r,(function(e,r){r.__init__=new Sk.builtin.func((function(e,r,i,f){e.buffers={};var setBuffer=function(t,r){var i="indices"==t?n.ELEMENT_ARRAY_BUFFER:n.ARRAY_BUFFER;let f=e.buffers[t];f?f.set(r):f=new Buffer(r,i),e.buffers[t]=f};for(t in i)setBuffer(t,i[t]);var o={},s=0;for(var u in f)o[u]=s++;e.mode=n.TRIANGLES,e.textures=f.v,e.textureUnits=o,e.shader=r})),r.drawPrep=new Sk.builtin.func((function(t,e){var r=t.shader,i=t.buffers,f=t.textures;for(var o in e=Sk.ffi.remapToJs(e),Sk.misceval.callsimArray(r.use,[r]),i){var s=i[o];if("indices"==o)n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,s.buffer());else{var u=r.attrib[o];u&&u(s)}}for(var a in f){var m=t.textureUnits[a];r.setUniform$impl(r,f,m),f[a].bindToUnit(m)}for(var p in e)r.setUniform$impl(r,p,e[p])})),r.draw=new Sk.builtin.func((function(t,e,r){var i=t.shader;e=Sk.ffi.remapToJs(e);for(let n in e)i.setUniform$impl(i,n,e[n]);if(r)for(var f in r){var o=t.textureUnits[f];i.setUniform$impl(i,f,o),r[f].bindToUnit(o)}var s=t.buffers;n.drawElements(t.mode,s.indices.totalComponents(),n.UNSIGNED_SHORT,0)}))}),"Model",[]),r}))};',"src/lib/webgl/primitives.js":'var $builtinmodule=function(t){var n={},AttribBuffer=function(t,n,e){e=e||"Float32Array";var r=window[e];n.length?(this.buffer=new r(n),n=this.buffer.length/t,this.cursor=n):(this.buffer=new r(t*n),this.cursor=0),this.numComponents=t,this.numElements=n,this.type=e};return AttribBuffer.prototype.stride=function(){return 0},AttribBuffer.prototype.offset=function(){return 0},AttribBuffer.prototype.getElement=function(t){for(var n=t*this.numComponents,e=[],r=0;r<this.numComponents;++r)e.push(this.buffer[n+r]);return e},AttribBuffer.prototype.setElement=function(t,n){for(var e=t*this.numComponents,r=0;r<this.numComponents;++r)this.buffer[e+r]=n[r]},AttribBuffer.prototype.clone=function(){var t=new AttribBuffer(this.numComponents,this.numElements,this.type);return t.pushArray(this),t},AttribBuffer.prototype.push=function(t){this.setElement(this.cursor++,t)},AttribBuffer.prototype.pushArray=function(t){for(var n=0;n<t.numElements;++n)this.push(t.getElement(n))},AttribBuffer.prototype.pushArrayWithOffset=function(t,n){for(var e=0;e<t.numElements;++e){for(var r=t.getElement(e),o=0;o<n.length;++o)r[o]+=n[o];this.push(r)}},AttribBuffer.prototype.computeExtents=function(){for(var t=this.numElements,n=this.numComponents,e=this.getElement(0),r=this.getElement(0),o=1;o<t;++o)for(var s=this.getElement(o),u=0;u<n;++u)e[u]=Math.min(e[u],s[u]),r[u]=Math.max(r[u],s[u]);return{min:e,max:r}},n.createCube=new Sk.builtin.func((function(t){for(var n=[[3,7,5,1],[0,4,6,2],[6,7,3,2],[0,1,5,4],[5,7,6,4],[2,3,1,0]],e=t/2,r=[[-e,-e,-e],[+e,-e,-e],[-e,+e,-e],[+e,+e,-e],[-e,-e,+e],[+e,-e,+e],[-e,+e,+e],[+e,+e,+e]],o=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],s=[[0,0],[1,0],[1,1],[0,1]],u=new AttribBuffer(3,24),i=new AttribBuffer(3,24),h=new AttribBuffer(2,24),p=new AttribBuffer(3,12,"Uint16Array"),m=0;m<6;++m){for(var f=n[m],a=0;a<4;++a){var l=r[f[a]],c=o[m],y=s[a];u.push(l),i.push(c),h.push(y)}var v=4*m;p.push([v+0,v+1,v+2]),p.push([v+0,v+2,v+3])}return{position:u,normal:i,texCoord:h,indices:p}})),n};'}}},29184:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{A:()=>JSActiveCode});var _activecode_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(12477);class JSActiveCode extends _activecode_js__WEBPACK_IMPORTED_MODULE_0__.K{constructor(e){super(e)}outputfun(e){this.output.style.visibility="visible";var t="[";if("object"==typeof e&&e.length)for(var n=0;n<e.length;n++)if("object"==typeof e[n]&&e[n].length){t+=(0==n?"":" ")+"[";for(var i=0;i<e[n].length;i++)t+=e[n][i]+(i==e[n].length-1?"]"+(n==e.length-1?"]":",")+"\n":", ")}else t+=e[n]+(n==e.length-1?"]":", ");else try{t=JSON.stringify(e)}catch(n){t=e}return t}async runProg(){var _this=this,prog=await this.buildProg(!0),saveCode="True",write=function(e){_this.output.innerHTML+=_this.outputfun(e)},writeln=function(e){e||(e=""),_this.output.innerHTML+=_this.outputfun(e)+"<br />"};this.saveCode=await this.manage_scrubber(saveCode),this.eContainer&&this.eContainer.remove(),this.output.textContent="",this.outDiv.style.display="",this.outDiv.style.visibility="visible";try{eval(prog),this.errinfo="success"}catch(e){this.addErrorMessage(e),this.errinfo=e}}addErrorMessage(e){this.errLastRun=!0;var t=document.createElement("h3");t.innerHTML="Error",this.eContainer=this.outerDiv.appendChild(document.createElement("div")),this.eContainer.setAttribute("aria-live","polite"),this.eContainer.setAttribute("aria-atomic","true"),this.eContainer.setAttribute("role","log"),this.eContainer.className="error alert alert-danger",this.eContainer.id=this.divid+"_errinfo",this.eContainer.appendChild(t);var n=this.eContainer.appendChild(document.createElement("pre")),i=e.toString();setTimeout((()=>{n.innerHTML=i}),10),console.log("Runtime Error: "+e.toString())}}},30691:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var i=n(54250);class r{constructor(e,t){const n="===============================================================================";let r,s,o,a=e.split(n);a.length>2?(r=a[0],s=a[1],o=a[2]):(r=a[0],s="",o=a[1]);let l="\n",u=r.split("\n").slice(2);l="Program output:\n";for(let e of u)l+=e+"\n";if(l+=n+"\n",""!=s.trim()){let e=s.split("\n");l+="Test messages:";for(let t of e)l+=t+"\n";l+=n+"\n"}let c=o.split("\n");l+="Test results:";for(let e of c)l+=e+"\n";l=l.trim(),this.stdout=l;let d=new RegExp("\\[doctest\\] assertions: (?<tests>\\d+?) \\| (?<passed>\\d+?) passed \\| (?<failed>\\d+?) failed","g"),f=[...o.matchAll(d)];if(f.length>0){let e=f[0];this.pct=100*e.groups.passed/e.groups.tests;let n=document.createElement("span");n.innerHTML=e[0].replace("[doctest] ",""),this.pctString=n,this.passed=parseInt(e.groups.passed),this.failed=parseInt(e.groups.failed);let r=document.createElement("div");r.classList.add("unittest-results");let s=document.createElement("table");s.classList.add("ac-feedback"),r.appendChild(s),r.setAttribute("id",`${t}_unit_results`);let o=document.createElement("tr");o.innerHTML=`<th class="ac-feedback">Result</th><th class="ac-feedback">${(0,i.t)("msg_activecode_assertions_checked")}</th><th class="ac-feedback">Passed:</th><th class="ac-feedback">Failed:</th>`,s.appendChild(o);let a=document.createElement("tr"),l=document.createElement("td");l.classList.add("ac-feedback"),100==this.pct?(l.innerHTML=(0,i.t)("msg_activecode_passed"),l.classList.add("ac-feedback-pass")):(l.innerHTML=(0,i.t)("msg_activecode_failed"),l.classList.add("ac-feedback-fail")),a.appendChild(l),s.appendChild(a),l=document.createElement("td"),l.innerHTML=this.passed+this.failed,l.classList.add("ac-feedback"),a.appendChild(l),l=document.createElement("td"),l.innerHTML=this.passed,l.classList.add("ac-feedback"),a.appendChild(l),l=document.createElement("td"),l.innerHTML=this.failed,l.classList.add("ac-feedback"),a.appendChild(l),s.appendChild(a),this.table=r}}}},35358:(e,t,n)=>{var i={"./af":25177,"./af.js":25177,"./ar":61509,"./ar-dz":41488,"./ar-dz.js":41488,"./ar-kw":58676,"./ar-kw.js":58676,"./ar-ly":42353,"./ar-ly.js":42353,"./ar-ma":24496,"./ar-ma.js":24496,"./ar-sa":82682,"./ar-sa.js":82682,"./ar-tn":89756,"./ar-tn.js":89756,"./ar.js":61509,"./az":95533,"./az.js":95533,"./be":28959,"./be.js":28959,"./bg":47777,"./bg.js":47777,"./bm":54903,"./bm.js":54903,"./bn":61290,"./bn.js":61290,"./bo":31545,"./bo.js":31545,"./br":11470,"./br.js":11470,"./bs":44429,"./bs.js":44429,"./ca":7306,"./ca.js":7306,"./cs":56464,"./cs.js":56464,"./cv":73635,"./cv.js":73635,"./cy":64226,"./cy.js":64226,"./da":93601,"./da.js":93601,"./de":77853,"./de-at":26111,"./de-at.js":26111,"./de-ch":54697,"./de-ch.js":54697,"./de.js":77853,"./dv":60708,"./dv.js":60708,"./el":54691,"./el.js":54691,"./en-au":53872,"./en-au.js":53872,"./en-ca":28298,"./en-ca.js":28298,"./en-gb":56195,"./en-gb.js":56195,"./en-ie":66584,"./en-ie.js":66584,"./en-nz":79402,"./en-nz.js":79402,"./eo":32934,"./eo.js":32934,"./es":97650,"./es-do":20838,"./es-do.js":20838,"./es-us":56575,"./es-us.js":56575,"./es.js":97650,"./et":3035,"./et.js":3035,"./eu":3508,"./eu.js":3508,"./fa":119,"./fa.js":119,"./fi":90527,"./fi.js":90527,"./fo":52477,"./fo.js":52477,"./fr":85498,"./fr-ca":26435,"./fr-ca.js":26435,"./fr-ch":37892,"./fr-ch.js":37892,"./fr.js":85498,"./fy":37071,"./fy.js":37071,"./gd":70217,"./gd.js":70217,"./gl":77329,"./gl.js":77329,"./gom-latn":93383,"./gom-latn.js":93383,"./gu":95050,"./gu.js":95050,"./he":11713,"./he.js":11713,"./hi":43861,"./hi.js":43861,"./hr":26308,"./hr.js":26308,"./hu":90609,"./hu.js":90609,"./hy-am":17160,"./hy-am.js":17160,"./id":74063,"./id.js":74063,"./is":89374,"./is.js":89374,"./it":88383,"./it.js":88383,"./ja":23827,"./ja.js":23827,"./jv":89722,"./jv.js":89722,"./ka":41794,"./ka.js":41794,"./kk":27088,"./kk.js":27088,"./km":96870,"./km.js":96870,"./kn":84451,"./kn.js":84451,"./ko":63164,"./ko.js":63164,"./ky":78474,"./ky.js":78474,"./lb":79680,"./lb.js":79680,"./lo":15867,"./lo.js":15867,"./lt":45766,"./lt.js":45766,"./lv":69532,"./lv.js":69532,"./me":58076,"./me.js":58076,"./mi":41848,"./mi.js":41848,"./mk":30306,"./mk.js":30306,"./ml":73739,"./ml.js":73739,"./mr":86169,"./mr.js":86169,"./ms":73386,"./ms-my":92297,"./ms-my.js":92297,"./ms.js":73386,"./mt":77075,"./mt.js":77075,"./my":72264,"./my.js":72264,"./nb":22274,"./nb.js":22274,"./ne":8235,"./ne.js":8235,"./nl":92572,"./nl-be":43784,"./nl-be.js":43784,"./nl.js":92572,"./nn":54566,"./nn.js":54566,"./pa-in":29849,"./pa-in.js":29849,"./pl":94418,"./pl.js":94418,"./pt":79834,"./pt-br":48303,"./pt-br.js":48303,"./pt.js":79834,"./ro":24457,"./ro.js":24457,"./ru":82271,"./ru.js":82271,"./sd":1221,"./sd.js":1221,"./se":33478,"./se.js":33478,"./si":17538,"./si.js":17538,"./sk":5784,"./sk.js":5784,"./sl":46637,"./sl.js":46637,"./sq":86794,"./sq.js":86794,"./sr":45719,"./sr-cyrl":3322,"./sr-cyrl.js":3322,"./sr.js":45719,"./ss":56e3,"./ss.js":56e3,"./sv":41011,"./sv.js":41011,"./sw":40748,"./sw.js":40748,"./ta":11025,"./ta.js":11025,"./te":11885,"./te.js":11885,"./tet":28861,"./tet.js":28861,"./th":55802,"./th.js":55802,"./tl-ph":29231,"./tl-ph.js":29231,"./tlh":31052,"./tlh.js":31052,"./tr":85096,"./tr.js":85096,"./tzl":79846,"./tzl.js":79846,"./tzm":81765,"./tzm-latn":97711,"./tzm-latn.js":97711,"./tzm.js":81765,"./uk":16618,"./uk.js":16618,"./ur":57777,"./ur.js":57777,"./uz":57609,"./uz-latn":72475,"./uz-latn.js":72475,"./uz.js":57609,"./vi":21135,"./vi.js":21135,"./x-pseudo":64051,"./x-pseudo.js":64051,"./yo":82218,"./yo.js":82218,"./zh-cn":52648,"./zh-cn.js":52648,"./zh-hk":1632,"./zh-hk.js":1632,"./zh-tw":50304,"./zh-tw.js":50304};function r(e){var t=s(e);return n(t)}function s(e){if(!n.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=35358},39234:()=>{},46490:()=>{},49494:function(e,t,n){(function(){"use strict";var e=e||{};e.scope={},e.ASSUME_ES5=!1,e.ASSUME_NO_NATIVE_MAP=!1,e.ASSUME_NO_NATIVE_SET=!1,e.SIMPLE_FROUND_POLYFILL=!1,e.ISOLATE_POLYFILLS=!1,e.FORCE_POLYFILL_PROMISE=!1,e.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1,e.defineProperty=e.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e},e.getGlobal=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof n.g&&n.g];for(var t=0;t<e.length;++t){var i=e[t];if(i&&i.Math==Math)return i}throw Error("Cannot find global object")},e.global=e.getGlobal(this),e.IS_SYMBOL_NATIVE="function"==typeof Symbol&&"symbol"==typeof Symbol("x"),e.TRUST_ES6_POLYFILLS=!e.ISOLATE_POLYFILLS||e.IS_SYMBOL_NATIVE,e.polyfills={},e.propertyToPolyfillSymbol={},e.POLYFILL_PREFIX="$jscp$",e.polyfill=function(t,n,i,r){n&&(e.ISOLATE_POLYFILLS?e.polyfillIsolated(t,n,i,r):e.polyfillUnisolated(t,n,i,r))},e.polyfillUnisolated=function(t,n,i,r){for(i=e.global,t=t.split("."),r=0;r<t.length-1;r++){var s=t[r];if(!(s in i))return;i=i[s]}(n=n(r=i[t=t[t.length-1]]))!=r&&null!=n&&e.defineProperty(i,t,{configurable:!0,writable:!0,value:n})},e.polyfillIsolated=function(t,n,i,r){var s=t.split(".");t=1===s.length,r=s[0],r=!t&&r in e.polyfills?e.polyfills:e.global;for(var o=0;o<s.length-1;o++){var a=s[o];if(!(a in r))return;r=r[a]}s=s[s.length-1],null!=(n=n(i=e.IS_SYMBOL_NATIVE&&"es6"===i?r[s]:null))&&(t?e.defineProperty(e.polyfills,s,{configurable:!0,writable:!0,value:n}):n!==i&&(void 0===e.propertyToPolyfillSymbol[s]&&(e.propertyToPolyfillSymbol[s]=e.IS_SYMBOL_NATIVE?e.global.Symbol(s):e.POLYFILL_PREFIX+s),e.defineProperty(r,e.propertyToPolyfillSymbol[s],{configurable:!0,writable:!0,value:n})))},e.polyfill("Array.prototype.flat",(function(e){return e||function(e){e=void 0===e?1:e;for(var t=[],n=0;n<this.length;n++){var i=this[n];Array.isArray(i)&&0<e?(i=Array.prototype.flat.call(i,e-1),t.push.apply(t,i)):t.push(i)}return t}}),"es9","es5"),e.arrayIteratorImpl=function(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}},e.arrayIterator=function(t){return{next:e.arrayIteratorImpl(t)}},e.initSymbol=function(){},e.iteratorPrototype=function(e){return(e={next:e})[Symbol.iterator]=function(){return this},e},e.polyfill("String.prototype.matchAll",(function(e){return e||function(e){if(e instanceof RegExp&&!e.global)throw new TypeError("RegExp passed into String.prototype.matchAll() must have global tag.");var t=new RegExp(e,e instanceof RegExp?void 0:"g"),n=this,i=!1,r={next:function(){var e={},r=t.lastIndex;if(i)return{value:void 0,done:!0};var s=t.exec(n);return s?(t.lastIndex===r&&(t.lastIndex+=1),e.value=s,e.done=!1,e):(i=!0,{value:void 0,done:!0})}};return r[Symbol.iterator]=function(){return r},r}}),"es_2020","es3"),e.polyfill("Array.prototype.includes",(function(e){return e||function(e,t){var n=this;n instanceof String&&(n=String(n));var i=n.length;for(0>(t=t||0)&&(t=Math.max(t+i,0));t<i;t++){var r=n[t];if(r===e||Object.is(r,e))return!0}return!1}}),"es7","es3"),e.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e.polyfill("Object.entries",(function(t){return t||function(t){var n,i=[];for(n in t)e.owns(t,n)&&i.push([n,t[n]]);return i}}),"es8","es3"),e.polyfill("Object.fromEntries",(function(e){return e||function(e){var t={};if(!(Symbol.iterator in e))throw new TypeError(e+" is not iterable");for(var n=(e=e[Symbol.iterator].call(e)).next();!n.done;n=e.next()){if(n=n.value,Object(n)!==n)throw new TypeError("iterable for fromEntries should yield objects");t[n[0]]=n[1]}return t}}),"es_2019","es3"),e.checkStringArgs=function(e,t,n){if(null==e)throw new TypeError("The 'this' value for String.prototype."+n+" must not be null or undefined");if(t instanceof RegExp)throw new TypeError("First argument to String.prototype."+n+" must not be a regular expression");return e+""},e.stringPadding=function(e,t){return e=void 0!==e?String(e):" ",0<t&&e?e.repeat(Math.ceil(t/e.length)).substring(0,t):""},e.polyfill("String.prototype.padStart",(function(t){return t||function(t,n){var i=e.checkStringArgs(this,null,"padStart");return e.stringPadding(n,t-i.length)+i}}),"es8","es3"),e.polyfill("Object.values",(function(t){return t||function(t){var n,i=[];for(n in t)e.owns(t,n)&&i.push(t[n]);return i}}),"es8","es3"),e.iteratorFromArray=function(e,t){e instanceof String&&(e+="");var n=0,i=!1,r={next:function(){if(!i&&n<e.length){var r=n++;return{value:t(r,e[r]),done:!1}}return i=!0,{done:!0,value:void 0}}};return r[Symbol.iterator]=function(){return r},r},e.polyfill("Array.prototype.values",(function(t){return t||function(){return e.iteratorFromArray(this,(function(e,t){return t}))}}),"es8","es3"),function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:i})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n||4&n&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(t.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(i,r,function(t){return e[t]}.bind(null,r));return i},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t){t=function(){return this}();try{t=t||new Function("return this")()}catch(e){"object"==typeof window&&(t=window)}e.exports=t},function(e,t,n){n.r(t),(e={Cc:"\\0-\\x1F\\x7F-\\x9F",Cf:"\\xAD\\u0600-\\u0605\\u061C\\u06DD\\u070F\\u08E2\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u2064\\u2066-\\u206F\\uFEFF\\uFFF9-\\uFFFB",Co:"\\uE000-\\uF8FF",Cs:"\\uD800-\\uDFFF",Cn:"\\u0378-\\u0379\\u0380-\\u0383\\u038B\\u038D\\u03A2\\u0530\\u0557-\\u0558\\u0560\\u0588\\u058B-\\u058C\\u0590\\u05C8-\\u05CF\\u05EB-\\u05EF\\u05F5-\\u05FF\\u070E\\u074B-\\u074C\\u07B2-\\u07BF\\u07FB-\\u07FF\\u082E-\\u082F\\u083F\\u085C-\\u085D\\u085F\\u08B5-\\u08B6\\u08BE-\\u08D2\\u0984\\u098D-\\u098E\\u0991-\\u0992\\u09A9\\u09B1\\u09B3-\\u09B5\\u09BA-\\u09BB\\u09C5-\\u09C6\\u09C9-\\u09CA\\u09CF-\\u09D6\\u09D8-\\u09DB\\u09DE\\u09E4-\\u09E5\\u09FC-\\u09FD\\u0A00\\u0A04\\u0A0B-\\u0A0E",Ll:"a-z\\xB5\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F-\\u0293\\u0295-\\u02AF\\u0371\\u0373\\u0377\\u037B-\\u037D\\u0390\\u03AC-\\u03CE\\u03D0\\u03D1\\u03D5-\\u03D7\\u03D9\\u03DB\\u03DD\\u03DF\\u03E1\\u03E3\\u03E5\\u03E7\\u03E9\\u03EB\\u03ED\\u03EF-\\u03F3\\u03F5\\u03F8\\u03FB\\u03FC\\u0430-\\u045F\\u0461\\u0463\\u0465\\u0467\\u0469\\u046B\\u046D\\u046F\\u0471\\u0473\\u0475\\u0477\\u0479\\u047B\\u047D\\u047F\\u0481\\u048B\\u048D\\u048F\\u0491\\u0493\\u0495\\u0497\\u0499\\u049B\\u049D\\u049F\\u04A1\\u04A3\\u04A5\\u04A7\\u04A9\\u04AB\\u04AD\\u04AF\\u04B1\\u04B3\\u04B5\\u04B7\\u04B9\\u04BB\\u04BD\\u04BF\\u04C2\\u04C4\\u04C6\\u04C8\\u04CA\\u04CC\\u04CE\\u04CF\\u04D1\\u04D3\\u04D5\\u04D7\\u04D9\\u04DB\\u04DD\\u04DF\\u04E1\\u04E3\\u04E5\\u04E7\\u04E9\\u04EB\\u04ED\\u04EF\\u04F1\\u04F3\\u04F5\\u04F7\\u04F9\\u04FB\\u04FD\\u04FF\\u0501\\u0503\\u0505\\u0507\\u0509\\u050B\\u050D\\u050F\\u0511\\u0513\\u0515\\u0517\\u0519\\u051B\\u051D\\u051F\\u0521\\u0523\\u0525\\u0527\\u0529\\u052B\\u052D\\u052F\\u0560-\\u0588\\u10D0-\\u10FA\\u10FD-\\u10FF\\u13F8-\\u13FD\\u1C80-\\u1C88\\u1D00-\\u1D2B\\u1D6B-\\u1D77\\u1D79-\\u1D9A\\u1E01\\u1E03\\u1E05\\u1E07\\u1E09\\u1E0B\\u1E0D\\u1E0F\\u1E11\\u1E13\\u1E15\\u1E17\\u1E19\\u1E1B\\u1E1D\\u1E1F\\u1E21\\u1E23\\u1E25\\u1E27\\u1E29\\u1E2B\\u1E2D\\u1E2F\\u1E31\\u1E33\\u1E35\\u1E37\\u1E39\\u1E3B\\u1E3D\\u1E3F\\u1E41\\u1E43\\u1E45\\u1E47\\u1E49\\u1E4B\\u1E4D\\u1E4F\\u1E51\\u1E53\\u1E55\\u1E57\\u1E59\\u1E5B\\u1E5D\\u1E5F\\u1E61\\u1E63\\u1E65\\u1E67\\u1E69\\u1E6B\\u1E6D\\u1E6F\\u1E71\\u1E73\\u1E75\\u1E77\\u1E79\\u1E7B\\u1E7D\\u1E7F\\u1E81\\u1E83\\u1E85\\u1E87\\u1E89\\u1E8B\\u1E8D\\u1E8F\\u1E91\\u1E93\\u1E95-\\u1E9D\\u1E9F\\u1EA1\\u1EA3\\u1EA5\\u1EA7\\u1EA9\\u1EAB\\u1EAD\\u1EAF\\u1EB1\\u1EB3\\u1EB5\\u1EB7\\u1EB9\\u1EBB\\u1EBD\\u1EBF\\u1EC1\\u1EC3\\u1EC5\\u1EC7\\u1EC9\\u1ECB\\u1ECD\\u1ECF\\u1ED1\\u1ED3\\u1ED5\\u1ED7\\u1ED9\\u1EDB\\u1EDD\\u1EDF\\u1EE1\\u1EE3\\u1EE5\\u1EE7\\u1EE9\\u1EEB\\u1EED\\u1EEF\\u1EF1\\u1EF3\\u1EF5\\u1EF7\\u1EF9\\u1EFB\\u1EFD\\u1EFF-\\u1F07\\u1F10-\\u1F15\\u1F20-\\u1F27\\u1F30-\\u1F37\\u1F40-\\u1F45\\u1F50-\\u1F57\\u1F60-\\u1F67\\u1F70-\\u1F7D\\u1F80-\\u1F87\\u1F90-\\u1F97\\u1FA0-\\u1FA7\\u1FB0-\\u1FB4\\u1FB6\\u1FB7\\u1FBE\\u1FC2-\\u1FC4\\u1FC6\\u1FC7\\u1FD0-\\u1FD3\\u1FD6\\u1FD7\\u1FE0-\\u1FE7\\u1FF2-\\u1FF4\\u1FF6\\u1FF7\\u210A\\u210E\\u210F\\u2113\\u212F\\u2134\\u2139\\u213C\\u213D\\u2146-\\u2149\\u214E\\u2184\\u2C30-\\u2C5E\\u2C61\\u2C65\\u2C66\\u2C68\\u2C6A\\u2C6C\\u2C71\\u2C73\\u2C74\\u2C76-\\u2C7B\\u2C81\\u2C83\\u2C85\\u2C87\\u2C89\\u2C8B\\u2C8D\\u2C8F\\u2C91\\u2C93\\u2C95\\u2C97\\u2C99\\u2C9B\\u2C9D\\u2C9F\\u2CA1\\u2CA3\\u2CA5\\u2CA7\\u2CA9\\u2CAB\\u2CAD\\u2CAF\\u2CB1\\u2CB3\\u2CB5\\u2CB7\\u2CB9\\u2CBB\\u2CBD\\u2CBF\\u2CC1\\u2CC3\\u2CC5\\u2CC7\\u2CC9\\u2CCB\\u2CCD\\u2CCF\\u2CD1\\u2CD3\\u2CD5\\u2CD7\\u2CD9\\u2CDB\\u2CDD\\u2CDF\\u2CE1\\u2CE3\\u2CE4\\u2CEC\\u2CEE\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\uA641\\uA643\\uA645\\uA647\\uA649\\uA64B\\uA64D\\uA64F\\uA651\\uA653\\uA655\\uA657\\uA659\\uA65B\\uA65D\\uA65F\\uA661\\uA663\\uA665\\uA667\\uA669\\uA66B\\uA66D\\uA681\\uA683\\uA685\\uA687\\uA689\\uA68B\\uA68D\\uA68F\\uA691\\uA693\\uA695\\uA697\\uA699\\uA69B\\uA723\\uA725\\uA727\\uA729\\uA72B\\uA72D\\uA72F-\\uA731\\uA733\\uA735\\uA737\\uA739\\uA73B\\uA73D\\uA73F\\uA741\\uA743\\uA745\\uA747\\uA749\\uA74B\\uA74D\\uA74F\\uA751\\uA753\\uA755\\uA757\\uA759\\uA75B\\uA75D\\uA75F\\uA761\\uA763\\uA765\\uA767\\uA769\\uA76B\\uA76D\\uA76F\\uA771-\\uA778\\uA77A\\uA77C\\uA77F\\uA781\\uA783\\uA785\\uA787\\uA78C\\uA78E\\uA791\\uA793-\\uA795\\uA797\\uA799\\uA79B\\uA79D\\uA79F\\uA7A1\\uA7A3\\uA7A5\\uA7A7\\uA7A9\\uA7AF\\uA7B5\\uA7B7\\uA7B9\\uA7BB\\uA7BD\\uA7BF\\uA7C3\\uA7C8\\uA7CA\\uA7F6\\uA7FA\\uAB30-\\uAB5A\\uAB60-\\uAB68\\uAB70-\\uABBF\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF41-\\uFF5A",Lm:"\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u0640\\u06E5\\u06E6\\u07F4\\u07F5\\u07FA\\u081A\\u0824\\u0828\\u0971\\u0E46\\u0EC6\\u10FC\\u17D7\\u1843\\u1AA7\\u1C78-\\u1C7D\\u1D2C-\\u1D6A\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7C\\u2C7D\\u2D6F\\u2E2F\\u3005\\u3031-\\u3035\\u303B\\u309D\\u309E\\u30FC-\\u30FE\\uA015\\uA4F8-\\uA4FD\\uA60C\\uA67F\\uA69C\\uA69D\\uA717-\\uA71F\\uA770\\uA788\\uA7F8\\uA7F9\\uA9CF\\uA9E6\\uAA70\\uAADD\\uAAF3\\uAAF4\\uAB5C-\\uAB5F\\uAB69\\uFF70\\uFF9E\\uFF9F",Lo:"\\xAA\\xBA\\u01BB\\u01C0-\\u01C3\\u0294\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u063F\\u0641-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u0800-\\u0815\\u0840-\\u0858\\u0860-\\u086A\\u08A0-\\u08B4\\u08B6-\\u08C7\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0972-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\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\\u0AF9\\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-\\u0C5A\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u1100-\\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\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17DC\\u1820-\\u1842\\u1844-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C77\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5\\u1CF6\\u1CFA\\u2135-\\u2138\\u2D30-\\u2D67\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3006\\u303C\\u3041-\\u3096\\u309F\\u30A1-\\u30FA\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\u9FFC\\uA000-\\uA014\\uA016-\\uA48C\\uA4D0-\\uA4F7\\uA500-\\uA60B\\uA610-\\uA61F\\uA62A\\uA62B\\uA66E\\uA6A0-\\uA6E5\\uA78F\\uA7F7\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9E0-\\uA9E4\\uA9E7-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA6F\\uAA71-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB\\uAADC\\uAAE0-\\uAAEA\\uAAF2\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\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\\uFF66-\\uFF6F\\uFF71-\\uFF9D\\uFFA0-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC",Lt:"\\u01C5\\u01C8\\u01CB\\u01F2\\u1F88-\\u1F8F\\u1F98-\\u1F9F\\u1FA8-\\u1FAF\\u1FBC\\u1FCC\\u1FFC",Lu:"A-Z\\xC0-\\xD6\\xD8-\\xDE\\u0100\\u0102\\u0104\\u0106\\u0108\\u010A\\u010C\\u010E\\u0110\\u0112\\u0114\\u0116\\u0118\\u011A\\u011C\\u011E\\u0120\\u0122\\u0124\\u0126\\u0128\\u012A\\u012C\\u012E\\u0130\\u0132\\u0134\\u0136\\u0139\\u013B\\u013D\\u013F\\u0141\\u0143\\u0145\\u0147\\u014A\\u014C\\u014E\\u0150\\u0152\\u0154\\u0156\\u0158\\u015A\\u015C\\u015E\\u0160\\u0162\\u0164\\u0166\\u0168\\u016A\\u016C\\u016E\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017B\\u017D\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018B\\u018E-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019C\\u019D\\u019F\\u01A0\\u01A2\\u01A4\\u01A6\\u01A7\\u01A9\\u01AC\\u01AE\\u01AF\\u01B1-\\u01B3\\u01B5\\u01B7\\u01B8\\u01BC\\u01C4\\u01C7\\u01CA\\u01CD\\u01CF\\u01D1\\u01D3\\u01D5\\u01D7\\u01D9\\u01DB\\u01DE\\u01E0\\u01E2\\u01E4\\u01E6\\u01E8\\u01EA\\u01EC\\u01EE\\u01F1\\u01F4\\u01F6-\\u01F8\\u01FA\\u01FC\\u01FE\\u0200\\u0202\\u0204\\u0206\\u0208\\u020A\\u020C\\u020E\\u0210\\u0212\\u0214\\u0216\\u0218\\u021A\\u021C\\u021E\\u0220\\u0222\\u0224\\u0226\\u0228\\u022A\\u022C\\u022E\\u0230\\u0232\\u023A\\u023B\\u023D\\u023E\\u0241\\u0243-\\u0246\\u0248\\u024A\\u024C\\u024E\\u0370\\u0372\\u0376\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E\\u038F\\u0391-\\u03A1\\u03A3-\\u03AB\\u03CF\\u03D2-\\u03D4\\u03D8\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2\\u03E4\\u03E6\\u03E8\\u03EA\\u03EC\\u03EE\\u03F4\\u03F7\\u03F9\\u03FA\\u03FD-\\u042F\\u0460\\u0462\\u0464\\u0466\\u0468\\u046A\\u046C\\u046E\\u0470\\u0472\\u0474\\u0476\\u0478\\u047A\\u047C\\u047E\\u0480\\u048A\\u048C\\u048E\\u0490\\u0492\\u0494\\u0496\\u0498\\u049A\\u049C\\u049E\\u04A0\\u04A2\\u04A4\\u04A6\\u04A8\\u04AA\\u04AC\\u04AE\\u04B0\\u04B2\\u04B4\\u04B6\\u04B8\\u04BA\\u04BC\\u04BE\\u04C0\\u04C1\\u04C3\\u04C5\\u04C7\\u04C9\\u04CB\\u04CD\\u04D0\\u04D2\\u04D4\\u04D6\\u04D8\\u04DA\\u04DC\\u04DE\\u04E0\\u04E2\\u04E4\\u04E6\\u04E8\\u04EA\\u04EC\\u04EE\\u04F0\\u04F2\\u04F4\\u04F6\\u04F8\\u04FA\\u04FC\\u04FE\\u0500\\u0502\\u0504\\u0506\\u0508\\u050A\\u050C\\u050E\\u0510\\u0512\\u0514\\u0516\\u0518\\u051A\\u051C\\u051E\\u0520\\u0522\\u0524\\u0526\\u0528\\u052A\\u052C\\u052E\\u0531-\\u0556\\u10A0-\\u10C5\\u10C7\\u10CD\\u13A0-\\u13F5\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1E00\\u1E02\\u1E04\\u1E06\\u1E08\\u1E0A\\u1E0C\\u1E0E\\u1E10\\u1E12\\u1E14\\u1E16\\u1E18\\u1E1A\\u1E1C\\u1E1E\\u1E20\\u1E22\\u1E24\\u1E26\\u1E28\\u1E2A\\u1E2C\\u1E2E\\u1E30\\u1E32\\u1E34\\u1E36\\u1E38\\u1E3A\\u1E3C\\u1E3E\\u1E40\\u1E42\\u1E44\\u1E46\\u1E48\\u1E4A\\u1E4C\\u1E4E\\u1E50\\u1E52\\u1E54\\u1E56\\u1E58\\u1E5A\\u1E5C\\u1E5E\\u1E60\\u1E62\\u1E64\\u1E66\\u1E68\\u1E6A\\u1E6C\\u1E6E\\u1E70\\u1E72\\u1E74\\u1E76\\u1E78\\u1E7A\\u1E7C\\u1E7E\\u1E80\\u1E82\\u1E84\\u1E86\\u1E88\\u1E8A\\u1E8C\\u1E8E\\u1E90\\u1E92\\u1E94\\u1E9E\\u1EA0\\u1EA2\\u1EA4\\u1EA6\\u1EA8\\u1EAA\\u1EAC\\u1EAE\\u1EB0\\u1EB2\\u1EB4\\u1EB6\\u1EB8\\u1EBA\\u1EBC\\u1EBE\\u1EC0\\u1EC2\\u1EC4\\u1EC6\\u1EC8\\u1ECA\\u1ECC\\u1ECE\\u1ED0\\u1ED2\\u1ED4\\u1ED6\\u1ED8\\u1EDA\\u1EDC\\u1EDE\\u1EE0\\u1EE2\\u1EE4\\u1EE6\\u1EE8\\u1EEA\\u1EEC\\u1EEE\\u1EF0\\u1EF2\\u1EF4\\u1EF6\\u1EF8\\u1EFA\\u1EFC\\u1EFE\\u1F08-\\u1F0F\\u1F18-\\u1F1D\\u1F28-\\u1F2F\\u1F38-\\u1F3F\\u1F48-\\u1F4D\\u1F59\\u1F5B\\u1F5D\\u1F5F\\u1F68-\\u1F6F\\u1FB8-\\u1FBB\\u1FC8-\\u1FCB\\u1FD8-\\u1FDB\\u1FE8-\\u1FEC\\u1FF8-\\u1FFB\\u2102\\u2107\\u210B-\\u210D\\u2110-\\u2112\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u2130-\\u2133\\u213E\\u213F\\u2145\\u2183\\u2C00-\\u2C2E\\u2C60\\u2C62-\\u2C64\\u2C67\\u2C69\\u2C6B\\u2C6D-\\u2C70\\u2C72\\u2C75\\u2C7E-\\u2C80\\u2C82\\u2C84\\u2C86\\u2C88\\u2C8A\\u2C8C\\u2C8E\\u2C90\\u2C92\\u2C94\\u2C96\\u2C98\\u2C9A\\u2C9C\\u2C9E\\u2CA0\\u2CA2\\u2CA4\\u2CA6\\u2CA8\\u2CAA\\u2CAC\\u2CAE\\u2CB0\\u2CB2\\u2CB4\\u2CB6\\u2CB8\\u2CBA\\u2CBC\\u2CBE\\u2CC0\\u2CC2\\u2CC4\\u2CC6\\u2CC8\\u2CCA\\u2CCC\\u2CCE\\u2CD0\\u2CD2\\u2CD4\\u2CD6\\u2CD8\\u2CDA\\u2CDC\\u2CDE\\u2CE0\\u2CE2\\u2CEB\\u2CED\\u2CF2\\uA640\\uA642\\uA644\\uA646\\uA648\\uA64A\\uA64C\\uA64E\\uA650\\uA652\\uA654\\uA656\\uA658\\uA65A\\uA65C\\uA65E\\uA660\\uA662\\uA664\\uA666\\uA668\\uA66A\\uA66C\\uA680\\uA682\\uA684\\uA686\\uA688\\uA68A\\uA68C\\uA68E\\uA690\\uA692\\uA694\\uA696\\uA698\\uA69A\\uA722\\uA724\\uA726\\uA728\\uA72A\\uA72C\\uA72E\\uA732\\uA734\\uA736\\uA738\\uA73A\\uA73C\\uA73E\\uA740\\uA742\\uA744\\uA746\\uA748\\uA74A\\uA74C\\uA74E\\uA750\\uA752\\uA754\\uA756\\uA758\\uA75A\\uA75C\\uA75E\\uA760\\uA762\\uA764\\uA766\\uA768\\uA76A\\uA76C\\uA76E\\uA779\\uA77B\\uA77D\\uA77E\\uA780\\uA782\\uA784\\uA786\\uA78B\\uA78D\\uA790\\uA792\\uA796\\uA798\\uA79A\\uA79C\\uA79E\\uA7A0\\uA7A2\\uA7A4\\uA7A6\\uA7A8\\uA7AA-\\uA7AE\\uA7B0-\\uA7B4\\uA7B6\\uA7B8\\uA7BA\\uA7BC\\uA7BE\\uA7C2\\uA7C4-\\uA7C7\\uA7C9\\uA7F5\\uFF21-\\uFF3A",M:"\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08D3-\\u08E1\\u08E3-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0D62\\u0D63\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102B-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1062-\\u1064\\u1067-\\u106D\\u1071-\\u1074\\u1082-\\u108D\\u108F\\u109A-\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u1885\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60-\\u1A7C\\u1A7F\\u1AB0-\\u1AC0\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DF9\\u1DFB-\\u1DFF\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7B-\\uAA7D\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F",Mc:"\\u0903\\u093B\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u094F\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u1A19\\u1A1A\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1BE7\\u1BEA-\\u1BEC\\u1BEE\\u1BF2\\u1BF3\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF7\\u302E\\u302F\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BE-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uAA7D\\uAAEB\\uAAEE\\uAAEF\\uAAF5\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC",Me:"\\u0488\\u0489\\u1ABE\\u20DD-\\u20E0\\u20E2-\\u20E4\\uA670-\\uA672",Mn:"\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08D3-\\u08E1\\u08E3-\\u0902\\u093A\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0957\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u09FE\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B55\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C00\\u0C04\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D00\\u0D01\\u0D3B\\u0D3C\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0D81\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4\\u17B5\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u1885\\u1886\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A1B\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1AB0-\\u1ABD\\u1ABF\\u1AC0\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1BAB-\\u1BAD\\u1BE6\\u1BE8\\u1BE9\\u1BED\\u1BEF-\\u1BF1\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1CF4\\u1CF8\\u1CF9\\u1DC0-\\u1DF9\\u1DFB-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302D\\u3099\\u309A\\uA66F\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA82C\\uA8C4\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uA9BD\\uA9E5\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEC\\uAAED\\uAAF6\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F",Nd:"0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19",Nl:"\\u16EE-\\u16F0\\u2160-\\u2182\\u2185-\\u2188\\u3007\\u3021-\\u3029\\u3038-\\u303A\\uA6E6-\\uA6EF",No:"\\xB2\\xB3\\xB9\\xBC-\\xBE\\u09F4-\\u09F9\\u0B72-\\u0B77\\u0BF0-\\u0BF2\\u0C78-\\u0C7E\\u0D58-\\u0D5E\\u0D70-\\u0D78\\u0F2A-\\u0F33\\u1369-\\u137C\\u17F0-\\u17F9\\u19DA\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u215F\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA830-\\uA835",Pc:"_\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F",Pd:"\\-\\u058A\\u05BE\\u1400\\u1806\\u2010-\\u2015\\u2E17\\u2E1A\\u2E3A\\u2E3B\\u2E40\\u301C\\u3030\\u30A0\\uFE31\\uFE32\\uFE58\\uFE63\\uFF0D",Pe:"\\)\\]\\}\\u0F3B\\u0F3D\\u169C\\u2046\\u207E\\u208E\\u2309\\u230B\\u232A\\u2769\\u276B\\u276D\\u276F\\u2771\\u2773\\u2775\\u27C6\\u27E7\\u27E9\\u27EB\\u27ED\\u27EF\\u2984\\u2986\\u2988\\u298A\\u298C\\u298E\\u2990\\u2992\\u2994\\u2996\\u2998\\u29D9\\u29DB\\u29FD\\u2E23\\u2E25\\u2E27\\u2E29\\u3009\\u300B\\u300D\\u300F\\u3011\\u3015\\u3017\\u3019\\u301B\\u301E\\u301F\\uFD3E\\uFE18\\uFE36\\uFE38\\uFE3A\\uFE3C\\uFE3E\\uFE40\\uFE42\\uFE44\\uFE48\\uFE5A\\uFE5C\\uFE5E\\uFF09\\uFF3D\\uFF5D\\uFF60\\uFF63",Pf:"\\xBB\\u2019\\u201D\\u203A\\u2E03\\u2E05\\u2E0A\\u2E0D\\u2E1D\\u2E21",Pi:"\\xAB\\u2018\\u201B\\u201C\\u201F\\u2039\\u2E02\\u2E04\\u2E09\\u2E0C\\u2E1C\\u2E20",Po:"!-#%-'\\*,\\.\\/:;\\?@\\xA1\\xA7\\xB6\\xB7\\xBF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u09FD\\u0A76\\u0AF0\\u0C77\\u0C84\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u166E\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u1805\\u1807-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2016\\u2017\\u2020-\\u2027\\u2030-\\u2038\\u203B-\\u203E\\u2041-\\u2043\\u2047-\\u2051\\u2053\\u2055-\\u205E\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00\\u2E01\\u2E06-\\u2E08\\u2E0B\\u2E0E-\\u2E16\\u2E18\\u2E19\\u2E1B\\u2E1E\\u2E1F\\u2E2A-\\u2E2E\\u2E30-\\u2E39\\u2E3C-\\u2E3F\\u2E41\\u2E43-\\u2E4F\\u2E52\\u3001-\\u3003\\u303D\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA8FC\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFE10-\\uFE16\\uFE19\\uFE30\\uFE45\\uFE46\\uFE49-\\uFE4C\\uFE50-\\uFE52\\uFE54-\\uFE57\\uFE5F-\\uFE61\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF07\\uFF0A\\uFF0C\\uFF0E\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3C\\uFF61\\uFF64\\uFF65",Ps:"\\(\\[\\{\\u0F3A\\u0F3C\\u169B\\u201A\\u201E\\u2045\\u207D\\u208D\\u2308\\u230A\\u2329\\u2768\\u276A\\u276C\\u276E\\u2770\\u2772\\u2774\\u27C5\\u27E6\\u27E8\\u27EA\\u27EC\\u27EE\\u2983\\u2985\\u2987\\u2989\\u298B\\u298D\\u298F\\u2991\\u2993\\u2995\\u2997\\u29D8\\u29DA\\u29FC\\u2E22\\u2E24\\u2E26\\u2E28\\u2E42\\u3008\\u300A\\u300C\\u300E\\u3010\\u3014\\u3016\\u3018\\u301A\\u301D\\uFD3F\\uFE17\\uFE35\\uFE37\\uFE39\\uFE3B\\uFE3D\\uFE3F\\uFE41\\uFE43\\uFE47\\uFE59\\uFE5B\\uFE5D\\uFF08\\uFF3B\\uFF5B\\uFF5F\\uFF62",Sc:"\\$\\xA2-\\xA5\\u058F\\u060B\\u07FE\\u07FF\\u09F2\\u09F3\\u09FB\\u0AF1\\u0BF9\\u0E3F\\u17DB\\u20A0-\\u20BF\\uA838\\uFDFC\\uFE69\\uFF04\\uFFE0\\uFFE1\\uFFE5\\uFFE6",Sk:"\\^`\\xA8\\xAF\\xB4\\xB8\\u02C2-\\u02C5\\u02D2-\\u02DF\\u02E5-\\u02EB\\u02ED\\u02EF-\\u02FF\\u0375\\u0384\\u0385\\u1FBD\\u1FBF-\\u1FC1\\u1FCD-\\u1FCF\\u1FDD-\\u1FDF\\u1FED-\\u1FEF\\u1FFD\\u1FFE\\u309B\\u309C\\uA700-\\uA716\\uA720\\uA721\\uA789\\uA78A\\uAB5B\\uAB6A\\uAB6B\\uFBB2-\\uFBC1\\uFF3E\\uFF40\\uFFE3",Sm:"\\+<->\\|~\\xAC\\xB1\\xD7\\xF7\\u03F6\\u0606-\\u0608\\u2044\\u2052\\u207A-\\u207C\\u208A-\\u208C\\u2118\\u2140-\\u2144\\u214B\\u2190-\\u2194\\u219A\\u219B\\u21A0\\u21A3\\u21A6\\u21AE\\u21CE\\u21CF\\u21D2\\u21D4\\u21F4-\\u22FF\\u2320\\u2321\\u237C\\u239B-\\u23B3\\u23DC-\\u23E1\\u25B7\\u25C1\\u25F8-\\u25FF\\u266F\\u27C0-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u27FF\\u2900-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2AFF\\u2B30-\\u2B44\\u2B47-\\u2B4C\\uFB29\\uFE62\\uFE64-\\uFE66\\uFF0B\\uFF1C-\\uFF1E\\uFF5C\\uFF5E\\uFFE2\\uFFE9-\\uFFEC",So:"\\xA6\\xA9\\xAE\\xB0\\u0482\\u058D\\u058E\\u060E\\u060F\\u06DE\\u06E9\\u06FD\\u06FE\\u07F6\\u09FA\\u0B70\\u0BF3-\\u0BF8\\u0BFA\\u0C7F\\u0D4F\\u0D79\\u0F01-\\u0F03\\u0F13\\u0F15-\\u0F17\\u0F1A-\\u0F1F\\u0F34\\u0F36\\u0F38\\u0FBE-\\u0FC5\\u0FC7-\\u0FCC\\u0FCE\\u0FCF\\u0FD5-\\u0FD8\\u109E\\u109F\\u1390-\\u1399\\u166D\\u1940\\u19DE-\\u19FF\\u1B61-\\u1B6A\\u1B74-\\u1B7C\\u2100\\u2101\\u2103-\\u2106\\u2108\\u2109\\u2114\\u2116\\u2117\\u211E-\\u2123\\u2125\\u2127\\u2129\\u212E\\u213A\\u213B\\u214A\\u214C\\u214D\\u214F\\u218A\\u218B\\u2195-\\u2199\\u219C-\\u219F\\u21A1\\u21A2\\u21A4\\u21A5\\u21A7-\\u21AD\\u21AF-\\u21CD\\u21D0\\u21D1\\u21D3\\u21D5-\\u21F3\\u2300-\\u2307\\u230C-\\u231F\\u2322-\\u2328\\u232B-\\u237B\\u237D-\\u239A\\u23B4-\\u23DB\\u23E2-\\u2426\\u2440-\\u244A\\u249C-\\u24E9\\u2500-\\u25B6\\u25B8-\\u25C0\\u25C2-\\u25F7\\u2600-\\u266E\\u2670-\\u2767\\u2794-\\u27BF\\u2800-\\u28FF\\u2B00-\\u2B2F\\u2B45\\u2B46\\u2B4D-\\u2B73\\u2B76-\\u2B95\\u2B97-\\u2BFF\\u2CE5-\\u2CEA\\u2E50\\u2E51\\u2E80-\\u2E99\\u2E9B-\\u2EF3\\u2F00-\\u2FD5\\u2FF0-\\u2FFB\\u3004\\u3012\\u3013\\u3020\\u3036\\u3037\\u303E\\u303F\\u3190\\u3191\\u3196-\\u319F\\u31C0-\\u31E3\\u3200-\\u321E\\u322A-\\u3247\\u3250\\u3260-\\u327F\\u328A-\\u32B0\\u32C0-\\u33FF\\u4DC0-\\u4DFF\\uA490-\\uA4C6\\uA828-\\uA82B\\uA836\\uA837\\uA839\\uAA77-\\uAA79\\uFDFD\\uFFE4\\uFFE8\\uFFED\\uFFEE\\uFFFC\\uFFFD",Zl:"\\u2028",Zp:"\\u2029",Zs:" \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000"}).C=e.Cc+e.Cf+e.Cs+e.Co+e.Cn,e.L=e.Lu+e.Ll+e.Lt+e.Lm+e.Mn+e.Lo,e.LC=e.Lu+e.Ll+e.Lt,e.M=e.Mn+e.Mc+e.Me,e.N=e.Nd+e.Nl+e.No,e.P=e.Pc+e.Pd+e.Ps+e.Pe+e.Pi+e.Pf+e.Po,e.S=e.Sm+e.Sc+e.Sk+e.So,e.Z=e.Zs+e.Zl+e.Zp,e.w="_"+e.L+e.N,e.b="(?:["+e.w+"](?:[^"+e.w+"]|$)|(?:^|[^"+e.w+"])["+e.w+"])",e.bOut="(?=[^"+e.w+"]|$)",e.bIn="(?:^|[^"+e.w+"])",e.bInCapture="(?:^|([^"+e.w+"]))",e.B="(?:["+e.w+"]["+e.w+"]|[^"+e.w+"][^"+e.w+"])",e.d=e.N,t.default=e},function(e,t,n){n(3),Sk.global.strftime=n(4),n(5),n(7),n(8),n(10),n(11),n(12),n(13),n(14),n(15),n(16),n(17),n(18),n(19),[Sk.builtin.object,Sk.builtin.type].forEach((e=>{Sk.abstr.setUpSlots(e),Sk.abstr.setUpMethods(e),Sk.abstr.setUpGetSets(e),Sk.abstr.setUpClassMethods(e)})),n(20),n(21),n(22),[Sk.builtin.str,Sk.builtin.none,Sk.builtin.NotImplemented,Sk.builtin.object].forEach((e=>{(e=e.prototype).__doc__=e.hasOwnProperty("tp$doc")?new Sk.builtin.str(e.tp$doc):Sk.builtin.none.none$})),n(23),n(24),n(25),n(26),n(27),n(28),n(29),n(30),n(32),n(33),n(34),n(35),n(36),n(37),n(38),n(39),n(40),n(41),n(42),n(43),n(44),n(45),n(46),n(47),n(48),n(49),n(50),n(51),n(52),n(53),n(54),n(55),n(56),n(57),n(58),n(59),n(60),n(61),n(62),n(63),n(64),n(65),n(66),n(67)},function(e,t,n){(function(e){var t={build:{githash:"0fe28593db57ef5bdfe04e372d61c5fb2b10d235",date:"2025-07-31T16:07:07.506Z"}};t.global=void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t.exportSymbol=function(e,n){e=e.split(".");var i,r=t.global;for(i=0;i<e.length-1;i++){var s=e[i];r=r.hasOwnProperty(s)?r[s]:r[s]={}}void 0!==n&&(r[s=e[i]]=n)},t.isArrayLike=function(e){return!!(e instanceof Array||e&&e.length&&"number"==typeof e.length)},t.js_beautify=function(e){return e},t.exportSymbol("Sk",t),t.exportSymbol("Sk.global",t.global),t.exportSymbol("Sk.build",t.build),t.exportSymbol("Sk.exportSymbol",t.exportSymbol),t.exportSymbol("Sk.isArrayLike",t.isArrayLike),t.exportSymbol("Sk.js_beautify",t.js_beautify)}).call(this,n(0))},function(e,t){!function(){function t(e,t){return""===t||9<e?""+e:(null==t&&(t="0"),t+e)}function n(e){return 99<e?e:9<e?"0"+e:"00"+e}function i(e){return 0===e?12:12<e?e-12:e}function r(e,t){t=t||"sunday";var n=e.getDay();return"monday"===t&&(0===n?n=6:n--),t=Date.UTC(e.getFullYear(),0,1),e=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),Math.floor((Math.floor((e-t)/864e5)+7-n)/7)}function s(e){var t=e%10;if(11<=(e%=100)&&13>=e||0===t||4<=t)return"th";switch(t){case 1:return"st";case 2:return"nd";case 3:return"rd"}}function o(e){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(e)}var a={de_DE:{identifier:"de-DE",days:"Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag".split(" "),shortDays:"So Mo Di Mi Do Fr Sa".split(" "),months:"Januar Februar März April Mai Juni Juli August September Oktober November Dezember".split(" "),shortMonths:"Jan Feb Mär Apr Mai Jun Jul Aug Sep Okt Nov Dez".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d.%m.%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},en_CA:{identifier:"en-CA",days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),shortDays:"Sun Mon Tue Wed Thu Fri Sat".split(" "),months:"January February March April May June July August September October November December".split(" "),shortMonths:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),ordinalSuffixes:"st nd rd th th th th th th th th th th th th th th th th th st nd rd th th th th th th th st".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%r",x:"%D"}},en_US:{identifier:"en-US",days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),shortDays:"Sun Mon Tue Wed Thu Fri Sat".split(" "),months:"January February March April May June July August September October November December".split(" "),shortMonths:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),ordinalSuffixes:"st nd rd th th th th th th th th th th th th th th th th th st nd rd th th th th th th th st".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%m/%d/%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%r",x:"%D"}},es_MX:{identifier:"es-MX",days:"domingo lunes martes miércoles jueves viernes sábado".split(" "),shortDays:"dom lun mar mié jue vie sáb".split(" "),months:"enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre".split(" "),shortMonths:"ene feb mar abr may jun jul ago sep oct nov dic".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},fr_FR:{identifier:"fr-FR",days:"dimanche lundi mardi mercredi jeudi vendredi samedi".split(" "),shortDays:"dim. lun. mar. mer. jeu. ven. sam.".split(" "),months:"janvier février mars avril mai juin juillet août septembre octobre novembre décembre".split(" "),shortMonths:"janv. févr. mars avril mai juin juil. août sept. oct. nov. déc.".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},it_IT:{identifier:"it-IT",days:"domenica lunedì martedì mercoledì giovedì venerdì sabato".split(" "),shortDays:"dom lun mar mer gio ven sab".split(" "),months:"gennaio febbraio marzo aprile maggio giugno luglio agosto settembre ottobre novembre dicembre".split(" "),shortMonths:"gen feb mar apr mag giu lug ago set ott nov dic".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},nl_NL:{identifier:"nl-NL",days:"zondag maandag dinsdag woensdag donderdag vrijdag zaterdag".split(" "),shortDays:"zo ma di wo do vr za".split(" "),months:"januari februari maart april mei juni juli augustus september oktober november december".split(" "),shortMonths:"jan feb mrt apr mei jun jul aug sep okt nov dec".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d-%m-%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},pt_BR:{identifier:"pt-BR",days:"domingo segunda terça quarta quinta sexta sábado".split(" "),shortDays:"Dom Seg Ter Qua Qui Sex Sáb".split(" "),months:"janeiro fevereiro março abril maio junho julho agosto setembro outubro novembro dezembro".split(" "),shortMonths:"Jan Fev Mar Abr Mai Jun Jul Ago Set Out Nov Dez".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d-%m-%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},ru_RU:{identifier:"ru-RU",days:"Воскресенье Понедельник Вторник Среда Четверг Пятница Суббота".split(" "),shortDays:"Вс Пн Вт Ср Чт Пт Сб".split(" "),months:"Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь Ноябрь Декабрь".split(" "),shortMonths:"янв фев мар апр май июн июл авг сен окт ноя дек".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X",D:"%d.%m.%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},tr_TR:{identifier:"tr-TR",days:"Pazar Pazartesi Salı Çarşamba Perşembe Cuma Cumartesi".split(" "),shortDays:"Paz Pzt Sal Çrş Prş Cum Cts".split(" "),months:"Ocak Şubat Mart Nisan Mayıs Haziran Temmuz Ağustos Eylül Ekim Kasım Aralık".split(" "),shortMonths:"Oca Şub Mar Nis May Haz Tem Ağu Eyl Eki Kas Ara".split(" "),AM:"ÖÖ",PM:"ÖS",am:"ÖÖ",pm:"ÖS",formats:{c:"%a %d %b %Y %X %Z",D:"%d-%m-%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},zh_CN:{identifier:"zh-CN",days:"星期日 星期一 星期二 星期三 星期四 星期五 星期六".split(" "),shortDays:"日一二三四五六".split(""),months:"一月份 二月份 三月份 四月份 五月份 六月份 七月份 八月份 九月份 十月份 十一月份 十二月份".split(" "),shortMonths:"一月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十一月 十二月".split(" "),AM:"上午",PM:"下午",am:"上午",pm:"下午",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%r",x:"%D"}}},l=a.en_US,u=new function e(u,c,d){function f(e,a,l,u){for(var c="",d=null,h=!1,p=e.length,b=!1,g=0;g<p;g++){var k=e.charCodeAt(g);if(!0===h)if(45===k)d="";else if(95===k)d=" ";else if(48===k)d="0";else if(58===k)b&&o("[WARNING] detected use of unsupported %:: or %::: modifiers to strftime"),b=!0;else{switch(k){case 37:c+="%";break;case 65:c+=l.days[a.getDay()];break;case 66:c+=l.months[a.getMonth()];break;case 67:c+=t(Math.floor(a.getFullYear()/100),d);break;case 68:c+=f(l.formats.D,a,l,u);break;case 70:c+=f(l.formats.F,a,l,u);break;case 72:c+=t(a.getHours(),d);break;case 73:c+=t(i(a.getHours()),d);break;case 76:c+=n(Math.floor(u%1e3));break;case 77:c+=t(a.getMinutes(),d);break;case 80:c+=12>a.getHours()?l.am:l.pm;break;case 82:c+=f(l.formats.R,a,l,u);break;case 83:c+=t(a.getSeconds(),d);break;case 84:c+=f(l.formats.T,a,l,u);break;case 85:c+=t(r(a,"sunday"),d);break;case 87:c+=t(r(a,"monday"),d);break;case 88:c+=f(l.formats.X,a,l,u);break;case 89:c+=a.getFullYear();break;case 90:c+=_&&0===m?"GMT":(d=(d=(d=a).toString().match(/\(([\w\s]+)\)/))&&d[1])||"";break;case 97:c+=l.shortDays[a.getDay()];break;case 98:case 104:c+=l.shortMonths[a.getMonth()];break;case 99:c+=f(l.formats.c,a,l,u);break;case 100:c+=t(a.getDate(),d);break;case 101:c+=t(a.getDate(),null==d?" ":d);break;case 106:d=new Date(a.getFullYear(),0,1),c+=n(d=Math.ceil((a.getTime()-d.getTime())/864e5));break;case 107:c+=t(a.getHours(),null==d?" ":d);break;case 108:c+=t(i(a.getHours()),null==d?" ":d);break;case 109:c+=t(a.getMonth()+1,d);break;case 110:c+="\n";break;case 111:d=a.getDate(),c=l.ordinalSuffixes?c+(String(d)+(l.ordinalSuffixes[d-1]||s(d))):c+(String(d)+s(d));break;case 112:c+=12>a.getHours()?l.AM:l.PM;break;case 114:c+=f(l.formats.r,a,l,u);break;case 115:c+=Math.floor(u/1e3);break;case 116:c+="\t";break;case 117:c+=0===(d=a.getDay())?7:d;break;case 118:c+=f(l.formats.v,a,l,u);break;case 119:c+=a.getDay();break;case 120:c+=f(l.formats.x,a,l,u);break;case 121:c+=t(h=a.getFullYear()%100,d);break;case 122:_&&0===m?c+=b?"+00:00":"+0000":(d=0!==m?m/6e4:-a.getTimezoneOffset(),h=b?":":"",k=Math.abs(d%60),c+=(0>d?"-":"+")+t(Math.floor(Math.abs(d/60)))+h+t(k));break;default:h&&(c+="%"),c+=e[g]}d=null,h=!1}else 37===k?h=!0:c+=e[g]}return c}var h,p=u||l,m=c||0,_=d||!1,b=0,g=function(e,t){if(t){var n=t.getTime();if(_){var i=6e4*(t.getTimezoneOffset()||0);6e4*((t=new Date(n+i+m)).getTimezoneOffset()||0)!==i&&(t=6e4*(t.getTimezoneOffset()||0),t=new Date(n+t+m))}}else(n=Date.now())>b?(b=n,h=new Date(b),n=b,_&&(h=new Date(b+6e4*(h.getTimezoneOffset()||0)+m))):n=b,t=h;return f(e,t,p,n)};return g.localize=function(t){return new e(t||p,m,_)},g.localizeByIdentifier=function(e){var t=a[e];return t?g.localize(t):(o('[WARNING] No locale found with identifier "'+e+'".'),g)},g.timezone=function(t){var n=m,i=_,r=typeof t;return"number"!==r&&"string"!==r||(i=!0,"string"===r?n=(n="-"===t[0]?-1:1)*(60*(r=parseInt(t.slice(1,3),10))+(t=parseInt(t.slice(3,5),10)))*6e4:"number"===r&&(n=6e4*t)),new e(p,n,i)},g.utc=function(){return new e(p,m,!0)},g}(l,0,!1);void 0!==e?e.exports=u:(function(){return this||(0,eval)("this")}()).strftime=u,"function"!=typeof Date.now&&(Date.now=function(){return+new Date})}()},function(e,t,n){e=n(6);const i=Sk.global.JSBI=void 0!==Sk.global.BigInt?{}:e;void 0===Sk.global.BigInt?(i.__isBigInt||(i.__isBigInt=e=>e instanceof i),i.powermod=(e,t,n)=>{const r=i.BigInt(1);let s=r;for(t=i.greaterThan(t,i.__ZERO)?t:i.unaryMinus(t);i.greaterThan(t,i.__ZERO);)i.bitwiseAnd(t,r)&&(s=i.remainder(i.multiply(s,e),n)),t=i.signedRightShift(t,r),e=i.remainder(i.multiply(e,e),n);return s}):Object.assign(i,{BigInt:Sk.global.BigInt,toNumber:e=>Number(e),toString:e=>e.toString(),__isBigInt:e=>"bigint"==typeof e,unaryMinus:e=>-e,bitwiseNot:e=>~e,bitwiseAnd:(e,t)=>e&t,bitwiseOr:(e,t)=>e|t,bitwiseXor:(e,t)=>e^t,exponentiate:(e,t)=>{const n=i.BigInt(1);let r=n;for(t=t>i.__ZERO?t:-t;t>i.__ZERO;)t&n&&(r*=e),t>>=n,e*=e;return r},powermod:(e,t,n)=>{const r=i.BigInt(1);let s=r;for(t=t>i.__ZERO?t:-t;t>i.__ZERO;)t&r&&(s=s*e%n),t>>=r,e=e*e%n;return s},multiply:(e,t)=>e*t,divide:(e,t)=>e/t,remainder:(e,t)=>e%t,add:(e,t)=>e+t,subtract:(e,t)=>e-t,leftShift:(e,t)=>e<<t,signedRightShift:(e,t)=>e>>t,unsignedRightShift:(e,t)=>e>>>t,lessThan:(e,t)=>e<t,lessThanOrEqual:(e,t)=>e<=t,greaterThan:(e,t)=>e>t,greaterThanOrEqual:(e,t)=>e>=t,equal:(e,t)=>e===t,notEqual:(e,t)=>e!==t}),i.__ZERO=i.BigInt(0),i.__MAX_SAFE=i.BigInt(Number.MAX_SAFE_INTEGER),i.__MIN_SAFE=i.BigInt(-Number.MAX_SAFE_INTEGER),i.numberIfSafe=e=>i.lessThan(e,i.__MAX_SAFE)&&i.greaterThan(e,i.__MIN_SAFE)?i.toNumber(e):e,i.BigUp=e=>i.__isBigInt(e)?e:i.BigInt(e)},function(e,t,n){e.exports=function(){var e=Math.imul,t=Math.clz32,n=Math.abs,i=Math.max,r=Math.floor;class s extends Array{constructor(e,t){if(super(e),this.sign=t,e>s.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt(e){var t=Number.isFinite;if("number"==typeof e){if(0===e)return s.__zero();if(s.__isOneDigitInt(e))return 0>e?s.__oneDigit(-e,!0):s.__oneDigit(e,!1);if(!t(e)||r(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return s.__fromDouble(e)}if("string"==typeof e){if(null===(t=s.__fromString(e)))throw new SyntaxError("Cannot convert "+e+" to a BigInt");return t}if("boolean"==typeof e)return!0===e?s.__oneDigit(1,!1):s.__zero();if("object"==typeof e)return e.constructor===s?e:(e=s.__toPrimitive(e),s.BigInt(e));throw new TypeError("Cannot convert "+e+" to a BigInt")}toDebugString(){const e=["BigInt["];for(const t of this)e.push((t?(t>>>0).toString(16):t)+", ");return e.push("]"),e.join("")}toString(e){if(2>(e=void 0===e?10:e)||36<e)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":e&e-1?s.__toStringGeneric(this,e,!1):s.__toStringBasePowerOfTwo(this,e)}static toNumber(e){var t=e.length;if(0===t)return 0;if(1===t){var n=e.__unsignedDigit(0);return e.sign?-n:n}var i=e.__digit(t-1),r=s.__clz30(i);if(1024<(n=30*t-r))return e.sign?-1/0:1/0;--n;let o=t-1;var a=r+3;r=(32===a?0:i<<a)>>>12;const l=a-12;for(t=12<=a?0:i<<20+a,a=20+a,0<l&&0<o&&(o--,r|=(i=e.__digit(o))>>>30-l,t=i<<l+2,a=l+2);0<a&&0<o;)o--,i=e.__digit(o),t|=30<=a?i<<a-30:i>>>30-a,a-=30;return 1!==(i=s.__decideRounding(e,a,o,i))&&(0!==i||1&~t)||0!=(t=t+1>>>0)||!(0!=++r>>>20&&(r=0,1023<++n))?(e=e.sign?-2147483648:0,n=n+1023<<20,s.__kBitConversionInts[1]=e|n|r,s.__kBitConversionInts[0]=t,s.__kBitConversionDouble[0]):e.sign?-1/0:1/0}static unaryMinus(e){if(0===e.length)return e;const t=e.__copy();return t.sign=!e.sign,t}static bitwiseNot(e){return e.sign?s.__absoluteSubOne(e).__trim():s.__absoluteAddOne(e,!0)}static exponentiate(e,t){if(t.sign)throw new RangeError("Exponent must be positive");if(0===t.length)return s.__oneDigit(1,!1);if(0===e.length)return e;if(1===e.length&&1===e.__digit(0))return!e.sign||1&t.__digit(0)?e:s.unaryMinus(e);if(1<t.length)throw new RangeError("BigInt too big");if(1===(t=t.__unsignedDigit(0)))return e;if(t>=s.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===e.length&&2===e.__digit(0)){var n=1+(0|t/30);return(e=new s(n,e.sign&&!!(1&t))).__initializeDigits(),e.__setDigit(n-1,1<<t%30),e}n=null;let i=e;for(1&t&&(n=e),t>>=1;0!==t;t>>=1)i=s.multiply(i,i),1&t&&(n=null===n?i:s.multiply(n,i));return n}static multiply(e,t){if(0===e.length)return e;if(0===t.length)return t;var n=e.length+t.length;30<=e.__clzmsd()+t.__clzmsd()&&n--,(n=new s(n,e.sign!==t.sign)).__initializeDigits();for(let i=0;i<e.length;i++)s.__multiplyAccumulate(t,e.__digit(i),n,i);return n.__trim()}static divide(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>s.__absoluteCompare(e,t))return s.__zero();const n=e.sign!==t.sign,i=t.__unsignedDigit(0);if(1===t.length&&32767>=i){if(1===i)return n===e.sign?e:s.unaryMinus(e);e=s.__absoluteDivSmall(e,i,null)}else e=s.__absoluteDivLarge(e,t,!0,!1);return e.sign=n,e.__trim()}static remainder(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>s.__absoluteCompare(e,t))return e;const n=t.__unsignedDigit(0);return 1===t.length&&32767>=n?1===n||0===(t=s.__absoluteModSmall(e,n))?s.__zero():s.__oneDigit(t,e.sign):((t=s.__absoluteDivLarge(e,t,!1,!0)).sign=e.sign,t.__trim())}static add(e,t){const n=e.sign;return n===t.sign?s.__absoluteAdd(e,t,n):0<=s.__absoluteCompare(e,t)?s.__absoluteSub(e,t,n):s.__absoluteSub(t,e,!n)}static subtract(e,t){const n=e.sign;return n===t.sign?0<=s.__absoluteCompare(e,t)?s.__absoluteSub(e,t,n):s.__absoluteSub(t,e,!n):s.__absoluteAdd(e,t,n)}static leftShift(e,t){return 0===t.length||0===e.length?e:t.sign?s.__rightShiftByAbsolute(e,t):s.__leftShiftByAbsolute(e,t)}static signedRightShift(e,t){return 0===t.length||0===e.length?e:t.sign?s.__leftShiftByAbsolute(e,t):s.__rightShiftByAbsolute(e,t)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(e,t){return 0>s.__compareToBigInt(e,t)}static lessThanOrEqual(e,t){return 0>=s.__compareToBigInt(e,t)}static greaterThan(e,t){return 0<s.__compareToBigInt(e,t)}static greaterThanOrEqual(e,t){return 0<=s.__compareToBigInt(e,t)}static equal(e,t){if(e.sign!==t.sign||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e.__digit(n)!==t.__digit(n))return!1;return!0}static notEqual(e,t){return!s.equal(e,t)}static bitwiseAnd(e,t){if(!e.sign&&!t.sign)return s.__absoluteAnd(e,t).__trim();if(e.sign&&t.sign){const n=i(e.length,t.length)+1;return e=s.__absoluteSubOne(e,n),t=s.__absoluteSubOne(t),e=s.__absoluteOr(e,t,e),s.__absoluteAddOne(e,!0,e).__trim()}return e.sign&&([e,t]=[t,e]),s.__absoluteAndNot(e,s.__absoluteSubOne(t)).__trim()}static bitwiseXor(e,t){if(!e.sign&&!t.sign)return s.__absoluteXor(e,t).__trim();if(e.sign&&t.sign){var n=i(e.length,t.length);return e=s.__absoluteSubOne(e,n),t=s.__absoluteSubOne(t),s.__absoluteXor(e,t,e).__trim()}return n=i(e.length,t.length)+1,e.sign&&([e,t]=[t,e]),t=s.__absoluteSubOne(t,n),t=s.__absoluteXor(t,e,t),s.__absoluteAddOne(t,!0,t).__trim()}static bitwiseOr(e,t){const n=i(e.length,t.length);return e.sign||t.sign?e.sign&&t.sign?(e=s.__absoluteSubOne(e,n),t=s.__absoluteSubOne(t),e=s.__absoluteAnd(e,t,e),s.__absoluteAddOne(e,!0,e).__trim()):(e.sign&&([e,t]=[t,e]),t=s.__absoluteSubOne(t,n),t=s.__absoluteAndNot(t,e,t),s.__absoluteAddOne(t,!0,t).__trim()):s.__absoluteOr(e,t).__trim()}static asIntN(e,t){if(0===t.length)return t;if(0>(e=r(e)))throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===e)return s.__zero();if(e>=s.__kMaxLengthBits)return t;const n=0|(e+29)/30;if(t.length<n)return t;const i=t.__unsignedDigit(n-1),o=1<<(e-1)%30;if(t.length===n&&i<o)return t;if((i&o)!==o)return s.__truncateToNBits(e,t);if(!t.sign)return s.__truncateAndSubFromPowerOfTwo(e,t,!0);if(!(i&o-1)){for(let i=n-2;0<=i;i--)if(0!==t.__digit(i))return s.__truncateAndSubFromPowerOfTwo(e,t,!1);return t.length===n&&i===o?t:s.__truncateToNBits(e,t)}return s.__truncateAndSubFromPowerOfTwo(e,t,!1)}static asUintN(e,t){if(0===t.length)return t;if(0>(e=r(e)))throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===e)return s.__zero();if(t.sign){if(e>s.__kMaxLengthBits)throw new RangeError("BigInt too big");return s.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=s.__kMaxLengthBits)return t;const n=0|(e+29)/30;if(t.length<n)return t;const i=e%30;return t.length!=n||0!==i&&0!=t.__digit(n-1)>>>i?s.__truncateToNBits(e,t):t}static ADD(e,t){if(e=s.__toPrimitive(e),t=s.__toPrimitive(t),"string"==typeof e)return"string"!=typeof t&&(t=t.toString()),e+t;if("string"==typeof t)return e.toString()+t;if(e=s.__toNumeric(e),t=s.__toNumeric(t),s.__isBigInt(e)&&s.__isBigInt(t))return s.add(e,t);if("number"==typeof e&&"number"==typeof t)return e+t;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(e,t){return s.__compare(e,t,0)}static LE(e,t){return s.__compare(e,t,1)}static GT(e,t){return s.__compare(e,t,2)}static GE(e,t){return s.__compare(e,t,3)}static EQ(e,t){for(;;){if(s.__isBigInt(e))return s.__isBigInt(t)?s.equal(e,t):s.EQ(t,e);if("number"==typeof e){if(s.__isBigInt(t))return s.__equalToNumber(t,e);if("object"!=typeof t)return e==t;t=s.__toPrimitive(t)}else if("string"==typeof e){if(s.__isBigInt(t))return null!==(e=s.__fromString(e))&&s.equal(e,t);if("object"!=typeof t)return e==t;t=s.__toPrimitive(t)}else if("boolean"==typeof e){if(s.__isBigInt(t))return s.__equalToNumber(t,+e);if("object"!=typeof t)return e==t;t=s.__toPrimitive(t)}else if("symbol"==typeof e){if(s.__isBigInt(t))return!1;if("object"!=typeof t)return e==t;t=s.__toPrimitive(t)}else{if("object"!=typeof e)return e==t;if("object"==typeof t&&t.constructor!==s)return e==t;e=s.__toPrimitive(e)}}}static NE(e,t){return!s.EQ(e,t)}static __zero(){return new s(0,!1)}static __oneDigit(e,t){return(t=new s(1,t)).__setDigit(0,e),t}__copy(){const e=new s(this.length,this.sign);for(let t=0;t<this.length;t++)e[t]=this[t];return e}__trim(){let e=this.length,t=this[e-1];for(;0===t;)e--,t=this[e-1],this.pop();return 0===e&&(this.sign=!1),this}__initializeDigits(){for(let e=0;e<this.length;e++)this[e]=0}static __decideRounding(e,t,n,i){if(0<t)return-1;if(0>t)t=-t-1;else{if(0===n)return-1;n--,i=e.__digit(n),t=29}if(!(i&(t=1<<t)))return-1;if(i&--t)return 1;for(;0<n;)if(n--,0!==e.__digit(n))return 1;return 0}static __fromDouble(e){s.__kBitConversionDouble[0]=e;var t=(2047&s.__kBitConversionInts[1]>>>20)-1023,n=1+(0|t/30);e=new s(n,0>e);let i,r=1048575&s.__kBitConversionInts[1]|1048576,o=s.__kBitConversionInts[0];if(20>(t%=30)){var a=20-t;i=a+32,t=r>>>a,r=r<<32-a|o>>>a,o<<=32-a}else 20===t?(i=32,t=r,r=o):(i=32-(a=t-20),t=r<<a|o>>>32-a,r=o<<a),o=0;for(e.__setDigit(n-1,t),n-=2;0<=n;n--)0<i?(i-=30,t=r>>>2,r=r<<30|o>>>2,o<<=30):t=0,e.__setDigit(n,t);return e.__trim()}static __isWhitespace(e){return!!(13>=e&&9<=e)||(159>=e?32==e:131071>=e?160==e||5760==e:196607>=e?10>=(e&=131071)||40==e||41==e||47==e||95==e||4096==e:65279==e)}static __fromString(e,t){t=void 0===t?0:t;let n=0;const i=e.length;let r=0;if(r===i)return s.__zero();let o=e.charCodeAt(r);for(;s.__isWhitespace(o);){if(++r===i)return s.__zero();o=e.charCodeAt(r)}if(43===o){if(++r===i)return null;o=e.charCodeAt(r),n=1}else if(45===o){if(++r===i)return null;o=e.charCodeAt(r),n=-1}if(0===t){if(t=10,48===o){if(++r===i)return s.__zero();if(o=e.charCodeAt(r),88===o||120===o){if(t=16,++r===i)return null;o=e.charCodeAt(r)}else if(79===o||111===o){if(t=8,++r===i)return null;o=e.charCodeAt(r)}else if(66===o||98===o){if(t=2,++r===i)return null;o=e.charCodeAt(r)}}}else if(16===t&&48===o){if(++r===i)return s.__zero();if(o=e.charCodeAt(r),88===o||120===o){if(++r===i)return null;o=e.charCodeAt(r)}}if(0!=n&&10!==t)return null;for(;48===o;){if(++r===i)return s.__zero();o=e.charCodeAt(r)}var a=i-r;let l=s.__kMaxBitsPerChar[t];var u=s.__kBitsPerCharTableMultiplier-1;if(a>1073741824/l)return null;a=new s(0|(29+(l*a+u>>>s.__kBitsPerCharTableShift))/30,!1);const c=10>t?t:10,d=10<t?t-10:0;if(t&t-1){a.__initializeDigits(),f=!1,h=0;do{for(p=0,m=1;;){if(o-48>>>0<c)u=o-48;else{if(!((32|o)-97>>>0<d)){f=!0;break}u=(32|o)-87}const n=m*t;if(1073741823<n)break;if(m=n,p=p*t+u,h++,++r===i){f=!0;break}o=e.charCodeAt(r)}u=30*s.__kBitsPerCharTableMultiplier-1,a.__inplaceMultiplyAdd(m,p,0|(l*h+u>>>s.__kBitsPerCharTableShift)/30)}while(!f)}else{l>>=s.__kBitsPerCharTableShift,t=[];var f=[],h=!1;do{for(var p=0,m=0;;){if(o-48>>>0<c)u=o-48;else{if(!((32|o)-97>>>0<d)){h=!0;break}u=(32|o)-87}if(m+=l,p=p<<l|u,++r===i){h=!0;break}if(o=e.charCodeAt(r),30<m+l)break}t.push(p),f.push(m)}while(!h);s.__fillFromParts(a,t,f)}if(r!==i){if(!s.__isWhitespace(o))return null;for(r++;r<i;r++)if(o=e.charCodeAt(r),!s.__isWhitespace(o))return null}return a.sign=-1==n,a.__trim()}static __fillFromParts(e,t,n){let i=0,r=0,s=0;for(let o=t.length-1;0<=o;o--){const a=t[o],l=n[o];r|=a<<s,s+=l,30===s?(e.__setDigit(i++,r),s=0,r=0):30<s&&(e.__setDigit(i++,1073741823&r),s-=30,r=a>>>l-s)}if(0!==r){if(i>=e.length)throw Error("implementation bug");e.__setDigit(i++,r)}for(;i<e.length;i++)e.__setDigit(i,0)}static __toStringBasePowerOfTwo(e,t){const n=e.length;var i=t-1;i=(15&(i=(51&(i=(85&i>>>1)+(85&i))>>>2)+(51&i))>>>4)+(15&i),--t;const r=e.__digit(n-1);var o=s.__clz30(r),a=0|(30*n-o+i-1)/i;if(e.sign&&a++,268435456<a)throw Error("string too long");o=Array(a),--a;var l=0,u=0;for(let r=0;r<n-1;r++){const n=e.__digit(r);for(l=(l|n<<u)&t,o[a--]=s.__kConversionChars[l],l=n>>>(u=i-u),u=30-u;u>=i;)o[a--]=s.__kConversionChars[l&t],l>>>=i,u-=i}for(o[a--]=s.__kConversionChars[(l|r<<u)&t],l=r>>>i-u;0!==l;)o[a--]=s.__kConversionChars[l&t],l>>>=i;if(e.sign&&(o[a--]="-"),-1!=a)throw Error("implementation bug");return o.join("")}static __toStringGeneric(e,t,n){var i=e.length;if(0===i)return"";if(1===i)return t=e.__unsignedDigit(0).toString(t),!1===n&&e.sign&&(t="-"+t),t;var r=30*i-s.__clz30(e.__digit(i-1));i=s.__kMaxBitsPerChar[t]-1,i=1+(0|((r*=s.__kBitsPerCharTableMultiplier)+(i-1))/i)>>1;var o=(r=s.exponentiate(s.__oneDigit(t,!1),s.__oneDigit(i,!1))).__unsignedDigit(0);if(1===r.length&&32767>=o){(r=new s(e.length,!1)).__initializeDigits();var a=0;for(let t=2*e.length-1;0<=t;t--)a=a<<15|e.__halfDigit(t),r.__setHalfDigit(t,0|a/o),a=0|a%o;o=a.toString(t)}else r=(o=s.__absoluteDivLarge(e,r,!0,!0)).quotient,o=o.remainder.__trim(),o=s.__toStringGeneric(o,t,!0);for(r.__trim(),t=s.__toStringGeneric(r,t,!0);o.length<i;)o="0"+o;return!1===n&&e.sign&&(t="-"+t),t+o}static __unequalSign(e){return e?-1:1}static __absoluteGreater(e){return e?-1:1}static __absoluteLess(e){return e?1:-1}static __compareToBigInt(e,t){const n=e.sign;return n!==t.sign?s.__unequalSign(n):0<(e=s.__absoluteCompare(e,t))?s.__absoluteGreater(n):0>e?s.__absoluteLess(n):0}static __compareToNumber(e,t){if(s.__isOneDigitInt(t)){const i=e.sign,r=0>t;if(i!==r)return s.__unequalSign(i);if(0===e.length){if(r)throw Error("implementation bug");return 0===t?0:-1}return 1<e.length?s.__absoluteGreater(i):(t=n(t),(e=e.__unsignedDigit(0))>t?s.__absoluteGreater(i):e<t?s.__absoluteLess(i):0)}return s.__compareToDouble(e,t)}static __compareToDouble(e,t){if(t!=t)return t;if(t===1/0)return-1;if(-1/0===t)return 1;const n=e.sign;if(n!==0>t)return s.__unequalSign(n);if(0===t)throw Error("implementation bug: should be handled elsewhere");if(0===e.length)return-1;if(s.__kBitConversionDouble[0]=t,2047==(t=2047&s.__kBitConversionInts[1]>>>20))throw Error("implementation bug: handled elsewhere");var i=t-1023;if(0>i)return s.__absoluteGreater(n);t=e.length;var r=e.__digit(t-1),o=s.__clz30(r),a=30*t-o;if(a<(i+=1))return s.__absoluteLess(n);if(a>i)return s.__absoluteGreater(n);i=1048576|1048575&s.__kBitConversionInts[1];let l=s.__kBitConversionInts[0];if((o=29-o)!=(0|(a-1)%30))throw Error("implementation bug");if(20>o){var u=20-o;o=u+32,a=i>>>u,i=i<<32-u|l>>>u,l<<=32-u}else 20===o?(o=32,a=i,i=l):(o=32-(u=o-20),a=i<<u|l>>>32-u,i=l<<u),l=0;if((r>>>=0)>(a>>>=0))return s.__absoluteGreater(n);if(r<a)return s.__absoluteLess(n);for(t-=2;0<=t;t--){if(0<o?(o-=30,a=i>>>2,i=i<<30|l>>>2,l<<=30):a=0,(r=e.__unsignedDigit(t))>a)return s.__absoluteGreater(n);if(r<a)return s.__absoluteLess(n)}if(0!==i||0!==l){if(0===o)throw Error("implementation bug");return s.__absoluteLess(n)}return 0}static __equalToNumber(e,t){return s.__isOneDigitInt(t)?0===t?0===e.length:1===e.length&&e.sign===0>t&&e.__unsignedDigit(0)===n(t):0===s.__compareToDouble(e,t)}static __comparisonResultToBool(e,t){return 0===t?0>e:1===t?0>=e:2===t?0<e:3===t?0<=e:void 0}static __compare(e,t,n){if(e=s.__toPrimitive(e),t=s.__toPrimitive(t),"string"==typeof e&&"string"==typeof t)switch(n){case 0:return e<t;case 1:return e<=t;case 2:return e>t;case 3:return e>=t}if(s.__isBigInt(e)&&"string"==typeof t)return null!==(t=s.__fromString(t))&&s.__comparisonResultToBool(s.__compareToBigInt(e,t),n);if("string"==typeof e&&s.__isBigInt(t))return null!==(e=s.__fromString(e))&&s.__comparisonResultToBool(s.__compareToBigInt(e,t),n);if(e=s.__toNumeric(e),t=s.__toNumeric(t),s.__isBigInt(e)){if(s.__isBigInt(t))return s.__comparisonResultToBool(s.__compareToBigInt(e,t),n);if("number"!=typeof t)throw Error("implementation bug");return s.__comparisonResultToBool(s.__compareToNumber(e,t),n)}if("number"!=typeof e)throw Error("implementation bug");if(s.__isBigInt(t))return s.__comparisonResultToBool(s.__compareToNumber(t,e),2^n);if("number"!=typeof t)throw Error("implementation bug");return 0===n?e<t:1===n?e<=t:2===n?e>t:3===n?e>=t:void 0}__clzmsd(){return s.__clz30(this.__digit(this.length-1))}static __absoluteAdd(e,t,n){if(e.length<t.length)return s.__absoluteAdd(t,e,n);if(0===e.length)return e;if(0===t.length)return e.sign===n?e:s.unaryMinus(e);var i=e.length;(0===e.__clzmsd()||t.length===e.length&&0===t.__clzmsd())&&i++,n=new s(i,n);let r=i=0;for(;r<t.length;r++){const s=e.__digit(r)+t.__digit(r)+i;i=s>>>30,n.__setDigit(r,1073741823&s)}for(;r<e.length;r++)i=(t=e.__digit(r)+i)>>>30,n.__setDigit(r,1073741823&t);return r<n.length&&n.__setDigit(r,i),n.__trim()}static __absoluteSub(e,t,n){if(0===e.length)return e;if(0===t.length)return e.sign===n?e:s.unaryMinus(e);n=new s(e.length,n);let i=0,r=0;for(;r<t.length;r++){const s=e.__digit(r)-t.__digit(r)-i;i=1&s>>>30,n.__setDigit(r,1073741823&s)}for(;r<e.length;r++)i=1&(t=e.__digit(r)-i)>>>30,n.__setDigit(r,1073741823&t);return n.__trim()}static __absoluteAddOne(e,t,n){n=void 0===n?null:n;const i=e.length;null===n?n=new s(i,t):n.sign=t,t=1;for(let r=0;r<i;r++){const i=e.__digit(r)+t;t=i>>>30,n.__setDigit(r,1073741823&i)}return 0!=t&&n.__setDigitGrow(i,1),n}static __absoluteSubOne(e,t){const n=e.length,i=new s(t=t||n,!1);let r=1;for(let t=0;t<n;t++){const n=e.__digit(t)-r;r=1&n>>>30,i.__setDigit(t,1073741823&n)}if(0!=r)throw Error("implementation bug");for(e=n;e<t;e++)i.__setDigit(e,0);return i}static __absoluteAnd(e,t,n){n=void 0===n?null:n;var i=e.length,r=t.length;let o=r;for(i<r&&(o=i,i=e,e=t,t=i),i=o,null===n?n=new s(i,!1):i=n.length,r=0;r<o;r++)n.__setDigit(r,e.__digit(r)&t.__digit(r));for(;r<i;r++)n.__setDigit(r,0);return n}static __absoluteAndNot(e,t,n){n=void 0===n?null:n;const i=e.length;var r=t.length;let o=r;i<r&&(o=i),r=i,null===n?n=new s(r,!1):r=n.length;let a=0;for(;a<o;a++)n.__setDigit(a,e.__digit(a)&~t.__digit(a));for(;a<i;a++)n.__setDigit(a,e.__digit(a));for(;a<r;a++)n.__setDigit(a,0);return n}static __absoluteOr(e,t,n){n=void 0===n?null:n;let i=e.length;var r=t.length;let o=r;if(i<r){o=i;var a=e;e=t,i=r,t=a}for(r=i,null===n?n=new s(r,!1):r=n.length,a=0;a<o;a++)n.__setDigit(a,e.__digit(a)|t.__digit(a));for(;a<i;a++)n.__setDigit(a,e.__digit(a));for(;a<r;a++)n.__setDigit(a,0);return n}static __absoluteXor(e,t,n){n=void 0===n?null:n;let i=e.length;var r=t.length;let o=r;if(i<r){o=i;var a=e;e=t,i=r,t=a}for(r=i,null===n?n=new s(r,!1):r=n.length,a=0;a<o;a++)n.__setDigit(a,e.__digit(a)^t.__digit(a));for(;a<i;a++)n.__setDigit(a,e.__digit(a));for(;a<r;a++)n.__setDigit(a,0);return n}static __absoluteCompare(e,t){var n=e.length-t.length;if(0!=n)return n;for(n=e.length-1;0<=n&&e.__digit(n)===t.__digit(n);)n--;return 0>n?0:e.__unsignedDigit(n)>t.__unsignedDigit(n)?1:-1}static __multiplyAccumulate(e,t,n,i){if(0!==t){var r=32767&t,o=t>>>15,a=t=0;for(let d,f=0;f<e.length;f++,i++){d=n.__digit(i);var l=e.__digit(f),u=32767&l,c=l>>>15;l=s.__imul(u,r),u=s.__imul(u,o);const h=s.__imul(c,r);d+=a+l+t,t=d>>>30,d&=1073741823,d+=((32767&u)<<15)+((32767&h)<<15),t+=d>>>30,a=(c=s.__imul(c,o))+(u>>>15)+(h>>>15),n.__setDigit(i,1073741823&d)}for(;0!=t||0!==a;i++)e=n.__digit(i),e+=t+a,a=0,t=e>>>30,n.__setDigit(i,1073741823&e)}}static __internalMultiplyAdd(e,t,n,i,r){let o=0;for(let u=0;u<i;u++){var a=e.__digit(u),l=s.__imul(32767&a,t);n=(l=l+((32767&(a=s.__imul(a>>>15,t)))<<15)+o+n)>>>30,o=a>>>15,r.__setDigit(u,1073741823&l)}if(r.length>i)for(r.__setDigit(i++,n+o);i<r.length;)r.__setDigit(i++,0);else if(0!==n+o)throw Error("implementation bug")}__inplaceMultiplyAdd(e,t,n){n>this.length&&(n=this.length);const i=32767&e;e>>>=15;let r=0;for(let u=0;u<n;u++){var o=this.__digit(u),a=32767&o,l=o>>>15;o=s.__imul(a,i),a=s.__imul(a,e);const n=s.__imul(l,i);r=(o=t+o+r)>>>30,o&=1073741823,r+=(o+=((32767&a)<<15)+((32767&n)<<15))>>>30,t=(l=s.__imul(l,e))+(a>>>15)+(n>>>15),this.__setDigit(u,1073741823&o)}if(0!=r||0!==t)throw Error("implementation bug")}static __absoluteDivSmall(e,t,n){null===(n=void 0===n?null:n)&&(n=new s(e.length,!1));let i=0;for(let r,s=2*e.length-1;0<=s;s-=2){r=(i<<15|e.__halfDigit(s))>>>0;const o=0|r/t;i=0|r%t,r=(i<<15|e.__halfDigit(s-1))>>>0;const a=0|r/t;i=0|r%t,n.__setDigit(s>>>1,o<<15|a)}return n}static __absoluteModSmall(e,t){let n=0;for(let i=2*e.length-1;0<=i;i--)n=0|((n<<15|e.__halfDigit(i))>>>0)%t;return n}static __absoluteDivLarge(e,t,n,i){const r=t.__halfDigitLength(),o=t.length;var a=e.__halfDigitLength()-r;let l=null;n&&(l=new s(a+2>>>1,!1),l.__initializeDigits());const u=new s(r+2>>>1,!1);u.__initializeDigits();const c=s.__clz15(t.__halfDigit(r-1));0<c&&(t=s.__specialLeftShift(t,c,0)),e=s.__specialLeftShift(e,c,1);const d=t.__halfDigit(r-1);let f=0;for(let i,c=a;0<=c;c--){if(i=32767,(a=e.__halfDigit(c+r))!==d){i=0|(a=(a<<15|e.__halfDigit(c+r-1))>>>0)/d,a=0|a%d;const n=t.__halfDigit(r-2),o=e.__halfDigit(c+r-2);for(;s.__imul(i,n)>>>0>(a<<16|o)>>>0&&(i--,!(32767<(a+=d))););}s.__internalMultiplyAdd(t,i,0,o,u),0!==(a=e.__inplaceSub(u,c,r+1))&&(a=e.__inplaceAdd(t,c,r),e.__setHalfDigit(c+r,32767&e.__halfDigit(c+r)+a),i--),n&&(1&c?f=i<<15:l.__setDigit(c>>>1,f|i))}if(i)return e.__inplaceRightShift(c),n?{quotient:l,remainder:e}:e;if(n)return l;throw Error("unreachable")}static __clz15(e){return s.__clz30(e)-15}__inplaceAdd(e,t,n){let i=0;for(let r=0;r<n;r++){const n=this.__halfDigit(t+r)+e.__halfDigit(r)+i;i=n>>>15,this.__setHalfDigit(t+r,32767&n)}return i}__inplaceSub(e,t,n){let i=0;if(1&t){t>>=1;for(var r=this.__digit(t),s=32767&r,o=0;o<n-1>>>1;o++){var a=e.__digit(o);i=1&(r=(r>>>15)-(32767&a)-i)>>>15,this.__setDigit(t+o,(32767&r)<<15|32767&s),i=1&(s=(32767&(r=this.__digit(t+o+1)))-(a>>>15)-i)>>>15}const l=(r>>>15)-(32767&(a=e.__digit(o)))-i;if(i=1&l>>>15,this.__setDigit(t+o,(32767&l)<<15|32767&s),t+o+1>=this.length)throw new RangeError("out of bounds");!(1&n)&&(i=1&(s=(32767&(r=this.__digit(t+o+1)))-(a>>>15)-i)>>>15,this.__setDigit(t+e.length,1073709056&r|32767&s))}else{for(t>>=1,s=0;s<e.length-1;s++)i=1&(o=(32767&(r=this.__digit(t+s)))-(32767&(a=e.__digit(s)))-i)>>>15,i=1&(r=(r>>>15)-(a>>>15)-i)>>>15,this.__setDigit(t+s,(32767&r)<<15|32767&o);i=1&(r=(32767&(o=this.__digit(t+s)))-(32767&(e=e.__digit(s)))-i)>>>15,a=0,!(1&n)&&(i=1&(a=(o>>>15)-(e>>>15)-i)>>>15),this.__setDigit(t+s,(32767&a)<<15|32767&r)}return i}__inplaceRightShift(e){if(0!==e){var t=this.__digit(0)>>>e,n=this.length-1;for(let i=0;i<n;i++){const n=this.__digit(i+1);this.__setDigit(i,1073741823&n<<30-e|t),t=n>>>e}this.__setDigit(n,t)}}static __specialLeftShift(e,t,n){const i=e.length,r=new s(i+n,!1);if(0===t){for(t=0;t<i;t++)r.__setDigit(t,e.__digit(t));return 0<n&&r.__setDigit(i,0),r}let o=0;for(let n=0;n<i;n++){const i=e.__digit(n);r.__setDigit(n,1073741823&i<<t|o),o=i>>>30-t}return 0<n&&r.__setDigit(i,o),r}static __leftShiftByAbsolute(e,t){var n=s.__toShiftAmount(t);if(0>n)throw new RangeError("BigInt too big");t=0|n/30;var i=n%30;const r=e.length,o=0!==i&&0!=e.__digit(r-1)>>>30-i;var a=r+t+(o?1:0);if(n=new s(a,e.sign),0===i){for(i=0;i<t;i++)n.__setDigit(i,0);for(;i<a;i++)n.__setDigit(i,e.__digit(i-t))}else{a=0;for(var l=0;l<t;l++)n.__setDigit(l,0);for(l=0;l<r;l++){const r=e.__digit(l);n.__setDigit(l+t,1073741823&r<<i|a),a=r>>>30-i}if(o)n.__setDigit(r+t,a);else if(0!==a)throw Error("implementation bug")}return n.__trim()}static __rightShiftByAbsolute(e,t){var n=e.length,i=e.sign,r=s.__toShiftAmount(t);if(0>r)return s.__rightShiftByMaximum(i);var o=r%30,a=n-(t=0|r/30);if(0>=a)return s.__rightShiftByMaximum(i);if(r=!1,i)if(e.__digit(t)&(1<<o)-1)r=!0;else for(var l=0;l<t;l++)if(0!==e.__digit(l)){r=!0;break}if(r&&0===o&&0==~e.__digit(n-1)&&a++,i=new s(a,i),0===o)for(i.__setDigit(a-1,0),o=t;o<n;o++)i.__setDigit(o-t,e.__digit(o));else{for(a=e.__digit(t)>>>o,n=n-t-1,l=0;l<n;l++){const n=e.__digit(l+t+1);i.__setDigit(l,1073741823&n<<30-o|a),a=n>>>o}i.__setDigit(n,a)}return r&&(i=s.__absoluteAddOne(i,!0,i)),i.__trim()}static __rightShiftByMaximum(e){return e?s.__oneDigit(1,!0):s.__zero()}static __toShiftAmount(e){return 1<e.length||(e=e.__unsignedDigit(0))>s.__kMaxLengthBits?-1:e}static __toPrimitive(e,t){if(t=void 0===t?"default":t,"object"!=typeof e||e.constructor===s)return e;if("undefined"!=typeof Symbol&&"symbol"==typeof Symbol.toPrimitive){const n=e[Symbol.toPrimitive];if(n){if("object"!=typeof(e=n(t)))return e;throw new TypeError("Cannot convert object to primitive value")}}if((t=e.valueOf)&&"object"!=typeof(t=t.call(e)))return t;if((t=e.toString)&&"object"!=typeof(e=t.call(e)))return e;throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(e){return s.__isBigInt(e)?e:+e}static __isBigInt(e){return"object"==typeof e&&null!==e&&e.constructor===s}static __truncateToNBits(e,t){var n=0|(e+29)/30;const i=new s(n,t.sign);--n;for(let e=0;e<n;e++)i.__setDigit(e,t.__digit(e));return t=t.__digit(n),0!=e%30&&(t=t<<(e=32-e%30)>>>e),i.__setDigit(n,t),i.__trim()}static __truncateAndSubFromPowerOfTwo(e,t,n){var i=Math.min,r=0|(e+29)/30;n=new s(r,n);let o=0;var a=0;for(i=i(--r,t.length);o<i;o++){const e=0-t.__digit(o)-a;a=1&e>>>30,n.__setDigit(o,1073741823&e)}for(;o<r;o++)n.__setDigit(o,1073741823&-a);return t=r<t.length?t.__digit(r):0,0==(e%=30)?a=0-t-a&1073741823:(t=t<<(e=32-e)>>>e,a=(e=1<<32-e)-t-a,a&=e-1),n.__setDigit(r,a),n.__trim()}__digit(e){return this[e]}__unsignedDigit(e){return this[e]>>>0}__setDigit(e,t){this[e]=0|t}__setDigitGrow(e,t){this[e]=0|t}__halfDigitLength(){const e=this.length;return 32767>=this.__unsignedDigit(e-1)?2*e-1:2*e}__halfDigit(e){return 32767&this[e>>>1]>>>15*(1&e)}__setHalfDigit(e,t){const n=e>>>1,i=this.__digit(n);this.__setDigit(n,1&e?32767&i|t<<15:1073709056&i|32767&t)}static __digitPow(e,t){let n=1;for(;0<t;)1&t&&(n*=e),t>>>=1,e*=e;return n}static __isOneDigitInt(e){return(1073741823&e)===e}}return s.__kMaxLength=33554432,s.__kMaxLengthBits=s.__kMaxLength<<5,s.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],s.__kBitsPerCharTableShift=5,s.__kBitsPerCharTableMultiplier=1<<s.__kBitsPerCharTableShift,s.__kConversionChars="0123456789abcdefghijklmnopqrstuvwxyz".split(""),s.__kBitConversionBuffer=new ArrayBuffer(8),s.__kBitConversionDouble=new Float64Array(s.__kBitConversionBuffer),s.__kBitConversionInts=new Int32Array(s.__kBitConversionBuffer),s.__clz30=t?function(e){return t(e)-2}:function(e){var t=Math.LN2,n=Math.log;return 0===e?30:0|29-(0|n(e>>>0)/t)},s.__imul=e||function(e,t){return 0|e*t},s}()},function(e,t){[..."abc"].flat(),"a".matchAll(/a/g)},function(e,t,n){(function(e,t){!function(e){function n(e){delete o[e]}function i(e){if(a)setTimeout(i,0,e);else{var t=o[e];if(t){a=!0;try{var r=t.callback,s=t.args;switch(s.length){case 0:r();break;case 1:r(s[0]);break;case 2:r(s[0],s[1]);break;case 3:r(s[0],s[1],s[2]);break;default:r.apply(void 0,s)}}finally{n(e),a=!1}}}}if(!e.setImmediate){var r,s=1,o={},a=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){i(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}}()?(c="setImmediate$"+Math.random()+"$",d=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(c)&&i(+t.data.slice(c.length))},e.addEventListener?e.addEventListener("message",d,!1):e.attachEvent("onmessage",d),r=function(t){e.postMessage(c+t,"*")}):e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){i(e.data)},r=function(t){e.port2.postMessage(t)}}():l&&"onreadystatechange"in l.createElement("script")?function(){var e=l.documentElement;r=function(t){var n=l.createElement("script");n.onreadystatechange=function(){i(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():r=function(e){setTimeout(i,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];return o[s]={callback:e,args:t},r(s),s++},u.clearImmediate=n}var c,d}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(0),n(9))},function(e,t){function n(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function r(e){if(u===setTimeout)return setTimeout(e,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function s(){h&&d&&(h=!1,d.length?f=d.concat(f):p=-1,f.length&&o())}function o(){if(!h){var e=r(s);h=!0;for(var t=f.length;t;){for(d=f,f=[];++p<t;)d&&d[p].run();p=-1,t=f.length}d=null,h=!1,function(e){if(c===clearTimeout)return clearTimeout(e);if((c===i||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(e);try{return c(e)}catch(t){try{return c.call(null,e)}catch(t){return c.call(this,e)}}}(e)}}function a(e,t){this.fun=e,this.array=t}function l(){}e=e.exports={};try{var u="function"==typeof setTimeout?setTimeout:n}catch(e){u=n}try{var c="function"==typeof clearTimeout?clearTimeout:i}catch(e){c=i}var d,f=[],h=!1,p=-1;e.nextTick=function(e){var t=Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new a(e,t)),1!==f.length||h||r(o)},a.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=l,e.addListener=l,e.once=l,e.off=l,e.removeListener=l,e.removeAllListeners=l,e.emit=l,e.prependListener=l,e.prependOnceListener=l,e.listeners=function(e){return[]},e.binding=function(e){throw Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(e){throw Error("process.chdir is not supported")},e.umask=function(){return 0}},function(e,t){Sk.asserts={},Sk.asserts.assert=function(e,t){return e},Sk.exportSymbol("Sk.asserts.assert",Sk.asserts.assert),Sk.asserts.fail=function(e){},Sk.exportSymbol("Sk.asserts.fail",Sk.asserts.fail)},function(e,t){Sk.bool_check=function(e,t){if(null==e||"boolean"!=typeof e)throw Error("must specify "+t+" and it must be a boolean")},Sk.python2={print_function:!1,division:!1,absolute_import:null,unicode_literals:!1,python3:!1,class_repr:!1,inherit_from_object:!1,super_args:!1,octal_number_literal:!1,bankers_rounding:!1,python_version:!1,dunder_round:!1,exceptions:!1,no_long_type:!1,ceil_floor_int:!1,silent_octal_literal:!0},Sk.python3={print_function:!0,division:!0,absolute_import:null,unicode_literals:!0,python3:!0,class_repr:!0,inherit_from_object:!0,super_args:!0,octal_number_literal:!0,bankers_rounding:!0,python_version:!0,dunder_round:!0,exceptions:!0,no_long_type:!0,ceil_floor_int:!0,silent_octal_literal:!1},Sk.configure=function(e){Sk.output=e.output||Sk.output,Sk.asserts.assert("function"==typeof Sk.output),Sk.filewriter=e.filewriter||Sk.filewriter,Sk.asserts.assert("function"==typeof Sk.filewriter),Sk.debugout=e.debugout||Sk.debugout,Sk.asserts.assert("function"==typeof Sk.debugout),Sk.uncaughtException=e.uncaughtException||Sk.uncaughtException,Sk.asserts.assert("function"==typeof Sk.uncaughtException),Sk.read=e.read||Sk.read,Sk.asserts.assert("function"==typeof Sk.read),Sk.nonreadopen=e.nonreadopen||!1,Sk.asserts.assert("boolean"==typeof Sk.nonreadopen),Sk.fileopen=e.fileopen||void 0,Sk.asserts.assert("function"==typeof Sk.fileopen||void 0===Sk.fileopen),Sk.filewrite=e.filewrite||void 0,Sk.asserts.assert("function"==typeof Sk.filewrite||void 0===Sk.filewrite),Sk.timeoutMsg=e.timeoutMsg||Sk.timeoutMsg,Sk.asserts.assert("function"==typeof Sk.timeoutMsg),Sk.exportSymbol("Sk.timeoutMsg",Sk.timeoutMsg),Sk.sysargv=e.sysargv||Sk.sysargv,Sk.asserts.assert(Sk.isArrayLike(Sk.sysargv)),Sk.__future__=e.__future__||Sk.python3,Sk.bool_check(Sk.__future__.print_function,"Sk.__future__.print_function"),Sk.bool_check(Sk.__future__.division,"Sk.__future__.division"),Sk.bool_check(Sk.__future__.unicode_literals,"Sk.__future__.unicode_literals"),Sk.bool_check(Sk.__future__.class_repr,"Sk.__future__.class_repr"),Sk.bool_check(Sk.__future__.inherit_from_object,"Sk.__future__.inherit_from_object"),Sk.bool_check(Sk.__future__.super_args,"Sk.__future__.super_args"),Sk.bool_check(Sk.__future__.octal_number_literal,"Sk.__future__.octal_number_literal"),Sk.bool_check(Sk.__future__.bankers_rounding,"Sk.__future__.bankers_rounding"),Sk.bool_check(Sk.__future__.python_version,"Sk.__future__.python_version"),Sk.bool_check(Sk.__future__.dunder_round,"Sk.__future__.dunder_round"),Sk.bool_check(Sk.__future__.exceptions,"Sk.__future__.exceptions"),Sk.bool_check(Sk.__future__.no_long_type,"Sk.__future__.no_long_type"),Sk.bool_check(Sk.__future__.ceil_floor_int,"Sk.__future__.ceil_floor_int"),Sk.bool_check(Sk.__future__.silent_octal_literal,"Sk.__future__.silent_octal_literal"),Sk.imageProxy=e.imageProxy||"http://localhost:8080/320x",Sk.asserts.assert("string"==typeof Sk.imageProxy||"function"==typeof Sk.imageProxy),Sk.inputfun=e.inputfun||Sk.inputfun,Sk.asserts.assert("function"==typeof Sk.inputfun),Sk.inputfunTakesPrompt=e.inputfunTakesPrompt||!1,Sk.asserts.assert("boolean"==typeof Sk.inputfunTakesPrompt),Sk.retainGlobals=e.retainglobals||e.retainGlobals||!1,Sk.asserts.assert("boolean"==typeof Sk.retainGlobals),Sk.debugging=e.debugging||!1,Sk.asserts.assert("boolean"==typeof Sk.debugging),Sk.killableWhile=e.killableWhile||!1,Sk.asserts.assert("boolean"==typeof Sk.killableWhile),Sk.killableFor=e.killableFor||!1,Sk.asserts.assert("boolean"==typeof Sk.killableFor),Sk.signals=e.signals,Sk.signals=!0===Sk.signals?{listeners:[],addEventListener(e){Sk.signals.listeners.push(e)},removeEventListener(e){0<=(e=Sk.signals.listeners.indexOf(e))&&Sk.signals.listeners.splice(e,1)},signal(e,t){for(var n=0;n<Sk.signals.listeners.length;n++)Sk.signals.listeners[n].call(null,e,t)}}:null,Sk.asserts.assert("object"==typeof Sk.signals),Sk.breakpoints=e.breakpoints||function(){return!0},Sk.asserts.assert("function"==typeof Sk.breakpoints),Sk.setTimeout=e.setTimeout,void 0===Sk.setTimeout&&(Sk.setTimeout="function"==typeof setTimeout?function(e,t){setTimeout(e,t)}:function(e,t){e()}),Sk.asserts.assert("function"==typeof Sk.setTimeout),"execLimit"in e&&(Sk.execLimit=e.execLimit),"yieldLimit"in e&&(Sk.yieldLimit=e.yieldLimit),e.syspath&&(Sk.syspath=e.syspath,Sk.asserts.assert(Sk.isArrayLike(Sk.syspath)),Sk.realsyspath=void 0,Sk.sysmodules=new Sk.builtin.dict([])),Sk.misceval.softspace_=!1,Sk.misceval.defaultHandlers=e.suspensionHandlers||{},Sk.switch_version(Sk.__future__.python3),Sk.builtin.str.$next=Sk.__future__.python3?new Sk.builtin.str("__next__"):new Sk.builtin.str("next"),Sk.setupOperators(Sk.__future__.python3),Sk.setupDunderMethods(Sk.__future__.python3),Sk.setupObjects(Sk.__future__.python3),Sk.token.setupTokens(Sk.__future__.python3)},Sk.exportSymbol("Sk.configure",Sk.configure),Sk.uncaughtException=function(e){throw e},Sk.uncaughtException=function(e){throw e},Sk.exportSymbol("Sk.uncaughtException",Sk.uncaughtException),Sk.timeoutMsg=function(){return"Program exceeded run time limit."},Sk.exportSymbol("Sk.timeoutMsg",Sk.timeoutMsg),Sk.execLimit=Number.POSITIVE_INFINITY,Sk.yieldLimit=Number.POSITIVE_INFINITY,Sk.output=function(e){},Sk.read=function(e){if(void 0===Sk.builtinFiles)throw"skulpt-stdlib.js has not been loaded";if(void 0===Sk.builtinFiles.files[e])throw"File not found: '"+e+"'";return Sk.builtinFiles.files[e]},Sk.sysargv=[],Sk.getSysArgv=function(){return Sk.sysargv},Sk.exportSymbol("Sk.getSysArgv",Sk.getSysArgv),Sk.syspath=[],Sk.inBrowser=void 0!==Sk.global.document,Sk.debugout=function(e){},void 0!==Sk.global.write?(Sk.output=Sk.global.write,Sk.filewriter=Sk.global.write):void 0!==Sk.global.console&&void 0!==Sk.global.console.log?(Sk.output=function(e){Sk.global.console.log(e)},Sk.filewriter=Sk.output):void 0!==Sk.global.print&&(Sk.output=Sk.global.print,Sk.filewriter=Sk.output),void 0!==Sk.global.console&&void 0!==Sk.global.console.log?Sk.debugout=function(e){Sk.global.console.log(e)}:void 0!==Sk.global.print&&(Sk.debugout=Sk.global.print),Sk.inputfun=function(e){return window.prompt(e)},Sk.setup_method_mappings=function(){},Sk.setupDictIterators=function(e){},Sk.switch_version=function(e){const t={float_:{method_names:["__round__"],2:[!1],3:[!0]},int_:{method_names:["__round__"],2:[!1],3:[!0]},list:{method_names:["clear","copy","sort"],2:[!1,!1,!0],3:[!0,!0,!0]},dict:{method_names:["has_key","keys","items","values"],2:[!0,!0,!0,!0],3:[!1,!0,!0,!0]}};for(let s in t){const o=Sk.builtin[s],a=t[s].method_names;var n=t[s][3];if(e&&void 0===o.py3$methods)break;if(void 0===o.py3$methods){o.py3$methods={};for(var i=0;i<a.length;i++){var r=a[i];n[i]&&(o.py3$methods[r]=o.prototype[r].d$def)}}for(e?i=o.py3$methods:(n=t[s][2],i=o.py2$methods),r=0;r<a.length;r++){const e=a[r];delete o.prototype[e],n[r]&&(o.prototype[e]=new Sk.builtin.method_descriptor(o,i[e]))}}},Sk.exportSymbol("Sk.__future__",Sk.__future__),Sk.exportSymbol("Sk.inputfun",Sk.inputfun)},function(e,t){function n(e,t,n){if(e.hasOwnProperty(t)){const i=e[t];i instanceof Sk.builtin.func&&(e[t]=new Sk.builtin[n](i))}}function i(e){return this.prototype[e.$mangled]}function r(e){e=e.$mangled;const t=this.prototype.tp$mro;for(let n=0;n<t.length;++n){const i=t[n].prototype;if(i.hasOwnProperty(e))return i[e]}}function s(e){for(;null!==e.prototype.tp$base;){if(void 0===e.sk$klass&&e.prototype.hasOwnProperty("__dict__"))return e=e.prototype.__dict__,Sk.builtin.checkDataDescr(e)?e:void 0;e=e.prototype.tp$base}}function o(e,t,n){if(void 0===e.sk$klass)throw new Sk.builtin.TypeError("can't set "+e.prototype.tp$name+"."+n.$jsstr());if(void 0===t)throw new Sk.builtin.TypeError("can't delete "+e.prototype.tp$name+"."+n.$jsstr())}void 0===Sk.builtin&&(Sk.builtin={}),Sk.builtin.type=function(e){return this instanceof Sk.builtin.type&&Sk.asserts.fail("calling new Sk.builtin.type is not safe"),e.ob$type},Object.defineProperties(Sk.builtin.type.prototype,{call:{value:Function.prototype.call},apply:{value:Function.prototype.apply},tp$slots:{value:{tp$doc:"type(object_or_name, bases, dict)\ntype(object) -> the object's type\ntype(name, bases, dict) -> a new type",tp$call:function(e,t){if(this===Sk.builtin.type){if(1===e.length&&(void 0===t||!t.length))return e[0].ob$type;if(3!==e.length)throw new Sk.builtin.TypeError("type() takes 1 or 3 arguments")}let n=this.prototype.tp$new(e,t);if(n.$isSuspension)return Sk.misceval.chain(n,(i=>{if(n=i,n.ob$type.$isSubType(this))return n.tp$init(e,t)}),(()=>n));if(n.ob$type.$isSubType(this)){const i=n.tp$init(e,t);return void 0!==i&&i.$isSuspension?Sk.misceval.chain(i,(()=>n)):n}return n},tp$new:function(e,t){if(3!==e.length){if(1===e.length&&(void 0===t||!t.length))return e[0].ob$type;throw new Sk.builtin.TypeError("type() takes 1 or 3 arguments")}const s=e[0];var o=e[1];const l=e[2];if("dict"!==l.tp$name)throw new Sk.builtin.TypeError("type() argument 3 must be dict, not "+Sk.abstr.typeName(l));if(!Sk.builtin.checkString(s))throw new Sk.builtin.TypeError("type() argument 1 must be str, not "+Sk.abstr.typeName(s));if("tuple"!==o.tp$name)throw new Sk.builtin.TypeError("type() argument 2 must be tuple, not "+Sk.abstr.typeName(o));o=o.sk$asarray(),function(e,t,n,s){const o=function(e){function t(e){return e.sk$solidBase||e.sk$solidSlotBase?e:t(e.prototype.tp$base)}let n,i,r,s;0===e.length&&e.push(Sk.builtin.object);for(let o=0;o<e.length;o++){if(s=e[o],!Sk.builtin.checkClass(s))throw new Sk.builtin.TypeError("bases must be 'type' objects");if(s.sk$unacceptableBase)throw new Sk.builtin.TypeError("type '"+s.prototype.tp$name+"' is not an acceptable base type");if(r=t(s),void 0===i)i=r,n=s;else if(!i.$isSubType(r)){if(!r.$isSubType(i))throw new Sk.builtin.TypeError("multiple bases have instance layout conflicts");i=r,n=s}}return n}(n),a=t.prototype;Sk.abstr.setUpInheritance(e.v,t,o,s),Object.defineProperties(a,{sk$prototypical:{value:!0,writable:!0},tp$bases:{value:n,writable:!0},tp$mro:{value:null,writable:!0},ht$type:{value:!0,writable:!0},ht$name:{value:e,writable:!0},ht$qualname:{value:e,writable:!0}}),a.tp$mro=t.$buildMRO(),Object.defineProperties(t,{$typeLookup:{value:a.sk$prototypical?i:r,writable:!0},sk$klass:{value:!0,writable:!0}})}(s,e=function(){this.sk$hasDict&&(this.$d=new Sk.builtin.dict),this.$s=[]},o,this.constructor);const u=e.prototype;Sk.globals&&(u.__module__=Sk.globals.__name__),u.__doc__=Sk.builtin.none.none$;let c,d=void 0===(o=l.quick$lookup(Sk.builtin.str.$slots)),f=void 0!==e.$typeLookup(Sk.builtin.str.$dict);if(void 0!==o&&(c=new Set,(o=Sk.builtin.checkString(o)?[o]:Sk.misceval.arrayFromIterable(o)).forEach((e=>{if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("__slots__ items must be strings, not '"+Sk.abstr.typeName(e)+"'");if(!e.$isIdentifier())throw new Sk.builtin.TypeError("__slots__ must be identifiers");if("__dict__"===e.v){if(f)throw new Sk.builtin.TypeError("__dict__ slot disallowed: we already got one");d=!0}else c.add(Sk.mangleName(s,e).v)})),function(e,t){const n=t.prototype,i=n.sk$nslots||0;Object.defineProperty(n,"sk$nslots",{value:i+e.length,writable:!0}),e.length&&Object.defineProperty(t,"sk$solidSlotBase",{value:!0,writable:!0}),e.forEach(((e,r)=>{r+=i;const s=Sk.builtin.str.$fixReserved(e);n[s]=new Sk.builtin.getset_descriptor(t,{$get(){const t=this.$s[r];if(void 0===t)throw new Sk.builtin.AttributeError(e);return t},$set(e){this.$s[r]=e}})}))}(o=[...c].sort(((e,t)=>e.localeCompare(t))),e)),d&&!f&&(u.__dict__=new Sk.builtin.getset_descriptor(e,a),f=!0),Object.defineProperties(u,{ht$slots:{value:o||null,writable:!0},sk$hasDict:{value:f,writable:!0}}),l.$items().forEach((e=>{var[t,n]=e;if(Sk.builtin.checkString(t)){if(c&&c.has(t.v))throw new Sk.builtin.ValueError("'"+t.toString()+"' in __slots__ conflicts with class variable");u[t.$mangled]=n}})),u.hasOwnProperty("__qualname__")){if(o=u.__qualname__,!Sk.builtin.checkString(o))throw new Sk.builtin.TypeError("type __qualname__ must be a str, not '"+Sk.abstr.typeName(o)+"'");u.ht$qualname=o}return n(o=e.prototype,"__init_subclass__","classmethod"),n(o,"__new__","staticmethod"),n(o,"__class_getitem__","classmethod"),e.$allocateSlots(),function(e){const t=e.prototype;Object.keys(t).forEach((n=>{const i=Sk.abstr.lookupSpecial(t[n],Sk.builtin.str.$setname);if(void 0!==i){const r=Sk.unfixReserved(n);try{Sk.misceval.callsimArray(i,[e,new Sk.builtin.str(r)])}catch(i){throw(n=new Sk.builtin.RuntimeError("Error calling __set_name__ on '"+Sk.abstr.typeName(t[n])+"' instance '"+r+"' in '"+e.prototype.tp$name+"'")).$cause=i,n}}}))}(e),function(e,t){e=new Sk.builtin.super_(e,e).tp$getattr(Sk.builtin.str.$initsubclass),Sk.misceval.callsimArray(e,[],t)}(e,t),e},tp$init:function(e,t){if(e&&1==e.length&&t&&t.length)throw new Sk.builtin.TypeError("type.__init__() takes no keyword arguments");if(3!=e.length&&1!=e.length)throw new Sk.builtin.TypeError("type.__init__() takes 1 or 3 arguments");return Sk.builtin.object.prototype.tp$init.call(this,[])},tp$getattr:function(e,t){var n=this.ob$type;const i=n.$typeLookup(e);let r;return void 0!==i&&(r=i.tp$descr_get,void 0!==r&&void 0!==i.tp$descr_set)?r.call(i,this,n,t):void 0!==(e=this.$typeLookup(e))?void 0!==(n=e.tp$descr_get)?t=n.call(e,null,this,t):e:void 0!==r?r.call(i,this,n,t):void 0!==i?i:void 0},tp$setattr:function(e,t,n){if(!this.sk$klass){if(void 0!==t)throw new Sk.builtin.TypeError("can't set attributes of built-in/extension type '"+this.prototype.tp$name+"'");throw new Sk.builtin.TypeError("can't delete attributes on type object '"+this.prototype.tp$name+"'")}const i=this.ob$type.$typeLookup(e);if(void 0!==i){const e=i.tp$descr_set;if(e)return e.call(i,this,t,n)}if(n=e.$mangled,void 0===t){if(!(t=this.prototype).hasOwnProperty(n))throw new Sk.builtin.AttributeError("type object '"+this.prototype.tp$name+"' has no attribute '"+e.$jsstr()+"'");delete t[n],void 0!==(e=Sk.dunderToSkulpt[n])&&(delete this.prototype[e],t.sk$prototypical||this.$allocateGetterSlot(n))}else this.prototype[n]=t,n in Sk.dunderToSkulpt&&this.$allocateSlot(n,t)},$r:function(){let e=this.prototype.__module__,t="",n="class";return e&&Sk.builtin.checkString(e)?t=e.v+".":e=null,e||this.sk$klass||Sk.__future__.class_repr||(n="type"),new Sk.builtin.str("<"+n+" '"+t+this.prototype.tp$name+"'>")}},writable:!0},tp$methods:{value:null,writable:!0},tp$classmethods:{value:null,writable:!0},tp$getsets:{value:null,writable:!0},sk$type:{value:!0},$isSubType:{value:function(e){return this===e||this.prototype instanceof e||!this.prototype.sk$prototypical&&this.prototype.tp$mro.includes(e)}},$allocateSlot:{value:function(e,t){const n=(e=Sk.slots[e]).$slot_name,i=this.prototype;i.hasOwnProperty(n)&&delete i[n],Object.defineProperty(i,n,{value:e.$slot_func(t),writable:!0,configurable:!0})}},$allocateSlots:{value:function(){const e=this.prototype;this.prototype.sk$prototypical?Object.keys(e).forEach((t=>{t in Sk.slots&&this.$allocateSlot(t,e[t])})):Object.keys(Sk.slots).forEach((t=>{e.hasOwnProperty(t)?this.$allocateSlot(t,e[t]):this.$allocateGetterSlot(t)})),e.hasOwnProperty("__eq__")&&!e.hasOwnProperty("__hash__")&&(e.tp$hash=e.__hash__=Sk.builtin.none.none$)}},$allocateGetterSlot:{value:function(e){const t=Sk.slots[e].$slot_name,n=this.prototype;n.hasOwnProperty(t)||Object.defineProperty(n,t,{configurable:!0,get(){const e=n.tp$mro;for(let n=1;n<e.length;n++){const i=Object.getOwnPropertyDescriptor(e[n].prototype,t);if(void 0!==i&&i.value)return i.value}}})}},$typeLookup:{value:function(e){return this.prototype.sk$prototypical?this.prototype[e.$mangled]:r.call(this,e)},writable:!0},$mroMerge:{value:function(e){let t;this.prototype.sk$prototypical=!0;const n=[];for(;;){for(t=0;t<e.length;++t){var i=e[t];if(0!==i.length)break}if(t===e.length)return n;var r=[];for(t=0;t<e.length;++t)if(0!==(i=e[t]).length){const t=i[0];i=0;e:for(;i<e.length;++i){const n=e[i];for(let e=1;e<n.length;++e)if(n[e]===t)break e}i===e.length&&r.push(t)}if(0===r.length)throw new Sk.builtin.TypeError("Inconsistent precedences in type hierarchy");for(r=r[0],n.length&&this.prototype.sk$prototypical&&Object.getPrototypeOf(n[n.length-1].prototype)!==r.prototype&&(this.prototype.sk$prototypical=!1),n.push(r),t=0;t<e.length;++t)0<(i=e[t]).length&&i[0]===r&&i.splice(0,1)}}},$buildMRO:{value:function(){const e=[[this]],t=this.prototype.tp$bases;for(var n=0;n<t.length;++n)e.push([...t[n].prototype.tp$mro]);n=[];for(let e=0;e<t.length;++e)n.push(t[e]);return e.push(n),this.$mroMerge(e)}},sk$attrError:{value(){return"type object '"+this.prototype.tp$name+"'"},writable:!0}}),Sk.builtin.type.prototype.tp$getsets={__base__:{$get(){return this.prototype.tp$base||Sk.builtin.none.none$}},__bases__:{$get(){return void 0===this.sk$tuple_bases&&(this.sk$tuple_bases=new Sk.builtin.tuple(this.prototype.tp$bases)),this.sk$tuple_bases}},__mro__:{$get(){return void 0===this.sk$tuple_mro&&(this.sk$tuple_mro=new Sk.builtin.tuple(this.prototype.tp$mro)),this.sk$tuple_mro}},__dict__:{$get(){return new Sk.builtin.mappingproxy(this.prototype)}},__doc__:{$get(){const e=this.$typeLookup(Sk.builtin.str.$doc);return e?void 0!==e.tp$descr_get?this===Sk.builtin.type?new Sk.builtin.str(this.prototype.tp$doc):e.tp$descr_get(null,this):this.prototype.__doc__:Sk.builtin.none.none$},$set(e){o(this,e,Sk.builtin.str.$doc),this.prototype.__doc__=e}},__name__:{$get(){let e=this.prototype.ht$name;return void 0!==e?e:(e=this.prototype.tp$name,e.includes(".")&&(e=e.slice(e.lastIndexOf(".")+1)),new Sk.builtin.str(e))},$set(e){if(o(this,e,Sk.builtin.str.$name),!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("can only assign string to "+this.prototype.tp$name+".__name__, not '"+Sk.abstr.typeName(e)+"'");this.prototype.ht$name=e,this.prototype.tp$name=e.$jsstr()}},__qualname__:{$get(){return this.prototype.ht$qualname||Sk.abstr.lookupSpecial(this,Sk.builtin.str.$name)},$set(e){if(o(this,e,Sk.builtin.str.$name),!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("can only assign string to "+this.prototype.tp$name+".__qualname__, not '"+Sk.abstr.typeName(e)+"'");this.prototype.ht$qualname=e}},__module__:{$get(){const e=this.prototype,t=e.__module__;return t&&t.ob$type!==Sk.builtin.getset_descriptor?t:e.tp$name.includes(".")?new Sk.builtin.str(e.tp$name.slice(0,e.tp$name.lastIndexOf("."))):new Sk.builtin.str("builtins")},$set(e){o(this,e,Sk.builtin.str.$module),this.prototype.__module__=e}}},Sk.builtin.type.prototype.tp$methods={mro:{$meth(){return new Sk.builtin.list(this.$buildMRO())},$flags:{NoArgs:!0}},__dir__:{$meth:function(){const e=new Sk.builtin.dict([]);return this.$mergeClassDict(e),new Sk.builtin.list(e.sk$asarray())},$flags:{NoArgs:!0},$doc:"Specialized __dir__ implementation for types."}},Sk.builtin.type.tp$classmethods={__prepare__:{$meth:()=>new Sk.builtin.dict([]),$flags:{FastCall:!0}}};const a={$get(){const e=s(this.ob$type);return void 0!==e?e.tp$descr_get(this,this.ob$type):Sk.generic.getSetDict.$get.call(this)},$set(e){const t=s(this.ob$type);return void 0!==t?t.tp$descr_set(this,e):void 0!==e?Sk.generic.getSetDict.$set.call(this,e):void(this.$d=new Sk.builtin.dict([]))},$doc:"dictionary for instance variables (if defined)",$name:"__dict__"}},function(e,t){Sk.generic={},Sk.generic.getAttr=function(e,t){let n;const i=this.ob$type,r=i.$typeLookup(e);if(void 0!==r&&(n=r.tp$descr_get,void 0!==n&&void 0!==r.tp$descr_set))return n.call(r,this,i,t);const s=this.$d;return void 0!==s&&void 0!==(e=s.quick$lookup(e))?e:void 0!==n?n.call(r,this,i,t):void 0!==r?r:void 0},Sk.exportSymbol("Sk.generic.getAttr",Sk.generic.getAttr),Sk.generic.setAttr=function(e,t,n){var i=this.ob$type.$typeLookup(e);if(null!=i){const e=i.tp$descr_set;if(e)return e.call(i,this,t,n)}if(null!=(n=this.$d)){if(n.dict$setItem){if(void 0!==t)return n.dict$setItem(e,t);if(n.dict$delItem(e))throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(this)+"' object has no attribute '"+e.$jsstr()+"'");return}if("object"==typeof n&&!n.sk$object){if(i=e.$mangled,void 0!==t)return void(n[i]=t);if(void 0!==n[i])return void delete n[i]}}throw new Sk.builtin.AttributeError(this.sk$attrError()+" has no attribute '"+e.$jsstr()+"'")},Sk.exportSymbol("Sk.generic.setAttr",Sk.generic.setAttr),Sk.generic.new=function(e){return function(t,n){return this.constructor===e?new this.constructor:(t=new this.constructor,e.call(t),t)}},Sk.generic.newMethodDef={$meth(e,t){const n=this.prototype;if(1>e.length)throw e=n.tp$name,new Sk.builtin.TypeError(e+".__new__(): not enough arguments");var i=e.shift();if(void 0===i.sk$type)throw e=n.tp$name,new Sk.builtin.TypeError(e+"__new__(X): X is not a type object ("+Sk.abstr.typeName(i)+")");if(!i.$isSubType(this))throw e=n.tp$name,i=i.prototype.tp$name,new Sk.builtin.TypeError(e+".__new__("+i+"): "+i+" is not a subtype of "+e);const r=i.prototype.sk$staticNew.prototype;if(r.tp$new!==n.tp$new)throw e=n.tp$name,i=i.prototype.tp$name,new Sk.builtin.TypeError(e+".__new__("+i+") is not safe, use "+r.tp$name+".__new__()");return n.tp$new.call(i.prototype,e,t)},$flags:{FastCall:!0},$textsig:"($type, *args, **kwargs)",$name:"__new__"},Sk.generic.selfIter=function(){return this},Sk.generic.iterNextWithArrayCheckSize=function(){if(this.$seq.length!==this.$orig.get$size()){const e=this.tp$name.split("_")[0];throw new Sk.builtin.RuntimeError(e+" changed size during iteration")}if(!(this.$index>=this.$seq.length))return this.$seq[this.$index++]},Sk.generic.iterNextWithArray=function(){const e=this.$seq[this.$index++];return void 0===e&&(this.tp$iternext=()=>{}),e},Sk.generic.iterLengthHintWithArrayMethodDef={$meth:function(){return new Sk.builtin.int_(this.$seq.length-this.$index)},$flags:{NoArgs:!0}},Sk.generic.iterReverseLengthHintMethodDef={$meth:function(){return new Sk.builtin.int_(this.$index)},$flags:{NoArgs:!0}},Sk.generic.getSetDict={$get(){return this.$d},$set(e){if(void 0===e)throw new Sk.builtin.TypeError("cannot delete __dict__");if(!(e instanceof Sk.builtin.dict))throw new Sk.builtin.TypeError("__dict__ must be set to a dictionary, not a '"+Sk.abstr.typeName(e)+"'");this.$d=e},$doc:"dictionary for instance variables (if defined)",$name:"__dict__"},Sk.generic.seqCompare=function(e,t){if(this===e&&Sk.misceval.opAllowsEquality(t))return!0;if(!(e instanceof this.sk$builtinBase))return Sk.builtin.NotImplemented.NotImplemented$;const n=this.v;let i;if(e=e.v,n.length!==e.length&&("Eq"===t||"NotEq"===t))return"Eq"!==t;for(i=0;i<n.length&&i<e.length&&(n[i]===e[i]||Sk.misceval.richCompareBool(n[i],e[i],"Eq"));++i);const r=n.length,s=e.length;if(i>=r||i>=s)switch(t){case"Lt":return r<s;case"LtE":return r<=s;case"Eq":return r===s;case"NotEq":return r!==s;case"Gt":return r>s;case"GtE":return r>=s;default:Sk.asserts.fail()}return"Eq"!==t&&("NotEq"===t||Sk.misceval.richCompareBool(n[i],e[i],t))},Sk.generic.classGetItem={__class_getitem__:{$meth(e){return new Sk.builtin.GenericAlias(this,e)},$flags:{OneArg:!0}}}},function(e,t){Sk.builtin.pyCheckArgs=function(e,t,n,i,r,s){if(t=t.length,void 0===i&&(i=1/0),r&&--t,s&&--t,t<n||t>i)throw new Sk.builtin.TypeError((n===i?e+"() takes exactly "+n+" arguments":t<n?e+"() takes at least "+n+" arguments":0<n?e+"() takes at most "+i+" arguments":e+"() takes no arguments")+" ("+t+" given)")},Sk.exportSymbol("Sk.builtin.pyCheckArgs",Sk.builtin.pyCheckArgs),Sk.builtin.pyCheckArgsLen=function(e,t,n,i,r,s){if(void 0===i&&(i=1/0),r&&--t,s&&--t,t<n||t>i)throw new Sk.builtin.TypeError((n===i?e+"() takes exactly "+n+" arguments":t<n?e+"() takes at least "+n+" arguments":e+"() takes at most "+i+" arguments")+" ("+t+" given)")},Sk.builtin.pyCheckType=function(e,t,n){if(!n)throw new Sk.builtin.TypeError(e+" must be a "+t)},Sk.exportSymbol("Sk.builtin.pyCheckType",Sk.builtin.pyCheckType),Sk.builtin.checkSequence=function(e){return null!=e&&void 0!==e.mp$subscript},Sk.exportSymbol("Sk.builtin.checkSequence",Sk.builtin.checkSequence),Sk.builtin.checkIterable=function(e){return void 0!==e&&(e.tp$iter?void 0!==e.tp$iter().tp$iternext:void 0!==e.mp$subscript)},Sk.exportSymbol("Sk.builtin.checkIterable",Sk.builtin.checkIterable),Sk.builtin.checkCallable=function(e){return null!=e&&void 0!==e.tp$call},Sk.builtin.checkNumber=function(e){return"number"==typeof e||e instanceof Sk.builtin.int_||e instanceof Sk.builtin.float_||e instanceof Sk.builtin.lng},Sk.exportSymbol("Sk.builtin.checkNumber",Sk.builtin.checkNumber),Sk.builtin.checkComplex=function(e){return e instanceof Sk.builtin.complex},Sk.exportSymbol("Sk.builtin.checkComplex",Sk.builtin.checkComplex),Sk.builtin.checkInt=function(e){return e instanceof Sk.builtin.int_||"number"==typeof e&&Number.isInteger(e)},Sk.exportSymbol("Sk.builtin.checkInt",Sk.builtin.checkInt),Sk.builtin.checkFloat=function(e){return e instanceof Sk.builtin.float_},Sk.exportSymbol("Sk.builtin.checkFloat",Sk.builtin.checkFloat),Sk.builtin.checkString=function(e){return e instanceof Sk.builtin.str},Sk.exportSymbol("Sk.builtin.checkString",Sk.builtin.checkString),Sk.builtin.checkBytes=function(e){return e instanceof Sk.builtin.bytes},Sk.builtin.checkClass=function(e){return e instanceof Sk.builtin.type},Sk.exportSymbol("Sk.builtin.checkClass",Sk.builtin.checkClass),Sk.builtin.checkBool=function(e){return e instanceof Sk.builtin.bool},Sk.exportSymbol("Sk.builtin.checkBool",Sk.builtin.checkBool),Sk.builtin.checkNone=function(e){return e===Sk.builtin.none.none$},Sk.exportSymbol("Sk.builtin.checkNone",Sk.builtin.checkNone),Sk.builtin.checkFunction=function(e){return null!=e&&void 0!==e.tp$call},Sk.exportSymbol("Sk.builtin.checkFunction",Sk.builtin.checkFunction),Sk.builtin.checkDataDescr=function(e){return e&&void 0!==e.tp$descr_set},Sk.exportSymbol("Sk.builtin.checkDataDescr",Sk.builtin.checkDataDescr),Sk.builtin.checkAnySet=function(e){return e instanceof Sk.builtin.set||e instanceof Sk.builtin.frozenset},Sk.builtin.checkMapping=function(e){return e instanceof Sk.builtin.dict||null!=e&&void 0!==e.mp$subscript&&void 0!==Sk.abstr.lookupSpecial(e,Sk.builtin.str.$keys)}},function(e,t){function n(e,t){switch(t){case"Add":return e.nb$reflected_add;case"Sub":return e.nb$reflected_subtract;case"Mult":return e.nb$reflected_multiply;case"MatMult":if(Sk.__future__.python3)return e.nb$reflected_matrix_multiply;case"Div":return e.nb$reflected_divide;case"FloorDiv":return e.nb$reflected_floor_divide;case"Mod":return e.nb$reflected_remainder;case"DivMod":return e.nb$reflected_divmod;case"Pow":return e.nb$reflected_power;case"LShift":return e.nb$reflected_lshift;case"RShift":return e.nb$reflected_rshift;case"BitAnd":return e.nb$reflected_and;case"BitXor":return e.nb$reflected_xor;case"BitOr":return e.nb$reflected_or}}function i(e,t,i){const r=t.constructor,s=e.constructor;let o,a=!1;if(r!==s&&void 0===r.sk$baseClass&&t instanceof s)if(o=n(t,i),void 0===o)a=!0;else if(o!==n(e,i)){a=!0;var l=o.call(t,e);if(l!==Sk.builtin.NotImplemented.NotImplemented$)return l}if(l=function(e,t){switch(t){case"Add":return e.nb$add;case"Sub":return e.nb$subtract;case"Mult":return e.nb$multiply;case"MatMult":if(Sk.__future__.python3)return e.nb$matrix_multiply;case"Div":return e.nb$divide;case"FloorDiv":return e.nb$floor_divide;case"Mod":return e.nb$remainder;case"DivMod":return e.nb$divmod;case"Pow":return e.nb$power;case"LShift":return e.nb$lshift;case"RShift":return e.nb$rshift;case"BitAnd":return e.nb$and;case"BitXor":return e.nb$xor;case"BitOr":return e.nb$or}}(e,i),void 0!==l&&(l=l.call(e,t))!==Sk.builtin.NotImplemented.NotImplemented$||!a&&r!==s&&(o||(o=n(t,i)),void 0!==o&&(l=o.call(t,e))!==Sk.builtin.NotImplemented.NotImplemented$))return l}function r(e,t,n){var r=function(e,t){switch(t){case"Add":return e.nb$inplace_add;case"Sub":return e.nb$inplace_subtract;case"Mult":return e.nb$inplace_multiply;case"MatMult":if(Sk.__future__.python3)return e.nb$inplace_matrix_multiply;case"Div":return e.nb$inplace_divide;case"FloorDiv":return e.nb$inplace_floor_divide;case"Mod":return e.nb$inplace_remainder;case"Pow":return e.nb$inplace_power;case"LShift":return e.nb$inplace_lshift;case"RShift":return e.nb$inplace_rshift;case"BitAnd":return e.nb$inplace_and;case"BitOr":return e.nb$inplace_or;case"BitXor":return e.nb$inplace_xor}}(e,n);return void 0!==r&&(r=r.call(e,t))!==Sk.builtin.NotImplemented.NotImplemented$?r:i(e,t,n)}Sk.abstr={},Sk.abstr.typeName=function(e){if(null!=e&&void 0!==e.tp$name){let t=e.ht$name;return void 0!==t?t.toString():(t=e.tp$name,t.includes(".")&&(t=t.slice(t.lastIndexOf(".")+1)),t)}return Sk.asserts.fail(e+" passed to typeName"),"<invalid type>"};const s={Add:"+",Sub:"-",Mult:"*",MatMult:"@",Div:"/",FloorDiv:"//",Mod:"%",DivMod:"divmod()",Pow:"** or pow()",LShift:"<<",RShift:">>",BitAnd:"&",BitXor:"^",BitOr:"|"},o={UAdd:"+",USub:"-",Invert:"~"};Sk.abstr.numberBinOp=function(e,t,n){var r;if(!(r=i(e,t,n)))throw e=Sk.abstr.typeName(e),t=Sk.abstr.typeName(t),new Sk.builtin.TypeError("unsupported operand type(s) for "+s[n]+": '"+e+"' and '"+t+"'");return r},Sk.exportSymbol("Sk.abstr.numberBinOp",Sk.abstr.numberBinOp),Sk.abstr.numberInplaceBinOp=function(e,t,n){var i;if(!(i=r(e,t,n)))throw e=Sk.abstr.typeName(e),t=Sk.abstr.typeName(t),new Sk.builtin.TypeError("unsupported operand type(s) for "+s[n]+"=: '"+e+"' and '"+t+"'");return i},Sk.exportSymbol("Sk.abstr.numberInplaceBinOp",Sk.abstr.numberInplaceBinOp),Sk.abstr.numberUnaryOp=function(e,t){if("Not"===t)return Sk.misceval.isTrue(e)?Sk.builtin.bool.false$:Sk.builtin.bool.true$;e:{switch(t){case"USub":var n=e.nb$negative;break e;case"UAdd":n=e.nb$positive;break e;case"Invert":n=e.nb$invert;break e}n=void 0}if(!(n=void 0!==n?n.call(e):void 0))throw e=Sk.abstr.typeName(e),new Sk.builtin.TypeError("bad operand type for unary "+o[t]+": '"+e+"'");return n},Sk.exportSymbol("Sk.abstr.numberUnaryOp",Sk.abstr.numberUnaryOp),Sk.abstr.fixSeqIndex_=function(e,t){return 0>(t=Sk.builtin.asnum$(t))&&e.sq$length&&(t+=e.sq$length()),t},Sk.abstr.sequenceContains=function(e,t,n){return e.sq$contains?e.sq$contains(t,n):(e=Sk.misceval.iterFor(Sk.abstr.iter(e),(function(e){return!(e!==t&&!Sk.misceval.richCompareBool(e,t,"Eq"))&&new Sk.misceval.Break(!0)}),!1),n?e:Sk.misceval.retryOptionalSuspensionOrThrow(e))},Sk.abstr.sequenceConcat=function(e,t){if(e.sq$concat)return e.sq$concat(t);if(Sk.builtin.checkSequence(e)&&Sk.builtin.checkSequence(t)&&void 0!==(t=i(e,t,"Add")))return t;throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object can't be concatenated")},Sk.abstr.sequenceInPlaceConcat=function(e,t){if(e.sq$inplace_concat)return e.sq$inplace_concat(t);if(e.sq$concat)return e.sq$concat(t);if(Sk.builtin.checkSequence(e)&&Sk.builtin.checkSequence(t)&&void 0!==(t=r(e,t,"Add")))return t;throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object can't be concatenated")},Sk.abstr.sequenceGetIndexOf=function(e,t){if(e.index)return Sk.misceval.callsimArray(e.index,[e,t]);let n=0;for(let i=Sk.abstr.iter(e),r=i.tp$iternext();void 0!==r;r=i.tp$iternext()){if(Sk.misceval.richCompareBool(t,r,"Eq"))return new Sk.builtin.int_(n);n+=1}throw new Sk.builtin.ValueError("sequence.index(x): x not in sequence")},Sk.abstr.sequenceGetCountOf=function(e,t){if(e.count)return Sk.misceval.callsimArray(e.count,[e,t]);let n=0;for(let i=Sk.abstr.iter(e),r=i.tp$iternext();void 0!==r;r=i.tp$iternext())Sk.misceval.richCompareBool(t,r,"Eq")&&(n+=1);return new Sk.builtin.int_(n)},Sk.abstr.sequenceGetItem=function(e,t,n){return"number"==typeof t&&(t=new Sk.builtin.int_(t)),Sk.abstr.objectGetItem(e,t,n)},Sk.abstr.sequenceSetItem=function(e,t,n,i){return"number"==typeof t&&(t=new Sk.builtin.int_(t)),Sk.abstr.objectSetItem(e,t,n,i)},Sk.abstr.sequenceDelItem=function(e,t,n){return Sk.abstr.objectDelItem(e,t,n)},Sk.abstr.sequenceGetSlice=function(e,t,n){return Sk.abstr.objectGetItem(e,new Sk.builtin.slice(t,n))},Sk.abstr.sequenceDelSlice=function(e,t,n){return Sk.abstr.objectDelItem(e,new Sk.builtin.slice(t,n))},Sk.abstr.sequenceSetSlice=function(e,t,n,i){return Sk.abstr.objectSetItem(e,new Sk.builtin.slice(t,n))},Sk.abstr.sequenceUnpack=function(e,t,n,i){if(!Sk.builtin.checkIterable(e))throw new Sk.builtin.TypeError("cannot unpack non-iterable "+Sk.abstr.typeName(e)+" object");const r=Sk.abstr.iter(e),s=[];let o,a=0;return 0<t&&(o=Sk.misceval.iterFor(r,(e=>{if(s.push(e),++a===t)return new Sk.misceval.Break}))),Sk.misceval.chain(o,(()=>{if(s.length<t)throw new Sk.builtin.ValueError("not enough values to unpack (expected at least "+n+", got "+s.length+")");if(!i)return Sk.misceval.chain(r.tp$iternext(!0),(e=>{if(void 0!==e)throw new Sk.builtin.ValueError("too many values to unpack (expected "+t+")");return s}));const e=[];return Sk.misceval.chain(Sk.misceval.iterFor(r,(t=>{e.push(t)})),(()=>{const i=e.length+t-n;if(0>i)throw new Sk.builtin.ValueError("not enough values to unpack (expected at least "+n+", got "+(n+i)+")");return s.push(new Sk.builtin.list(e.slice(0,i))),s.push(...e.slice(i)),s}))}))},Sk.abstr.mappingUnpackIntoKeywordArray=function(e,t,n){if(!(t instanceof Sk.builtin.dict)){var i=Sk.abstr.lookupSpecial(t,Sk.builtin.str.$keys);if(void 0===i)throw new Sk.builtin.TypeError("Object is not a mapping");return Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(i),(i=>Sk.misceval.iterFor(Sk.abstr.iter(i),(i=>{if(!Sk.builtin.checkString(i))throw new Sk.builtin.TypeError((n.$qualname?n.$qualname+"() ":"")+"keywords must be strings");return Sk.misceval.chain(t.mp$subscript(i,!0),(t=>{e.push(i.v),e.push(t)}))}))))}t.$items().forEach((t=>{var[i,r]=t;if(!Sk.builtin.checkString(i))throw new Sk.builtin.TypeError((n.$qualname?n.$qualname+"() ":"")+"keywords must be strings");e.push(i.v),e.push(r)}))},Sk.abstr.keywordArrayFromPyDict=function(e){const t=[];return e.$items().forEach((e=>{var[n,i]=e;if(!Sk.builtin.checkString(n))throw new Sk.builtin.TypeError("keywords must be strings");t.push(n.toString()),t.push(i)})),t},Sk.abstr.keywordArrayToPyDict=function(e){const t=new Sk.builtin.dict;for(let n=0;n<e.length;n+=2)t.mp$ass_subscript(new Sk.builtin.str(e[n]),e[n+1]);return t},Sk.abstr.copyKeywordsToNamedArgs=function(e,t,n,i,r){i=i||[];var s=n.length+i.length/2;if(s>t.length)throw new Sk.builtin.TypeError(e+"() expected at most "+t.length+" arguments ("+s+" given)");if(!i.length&&void 0===r)return n;if(s===t.length&&!i.length)return n;if(0===s&&t.length===(r&&r.length))return r;for(n=n.slice(0),s=0;s<i.length;s+=2){const r=i[s].toString(),o=i[s+1],a=t.indexOf(r);if(!(0<=a))throw new Sk.builtin.TypeError(e+"() got an unexpected keyword argument '"+r+"'");if(void 0!==n[a])throw new Sk.builtin.TypeError(e+"() got multiple values for argument '"+r+"'");n[a]=o}if(r){for(s=(i=t.length)-1;0<=s;s--)void 0===n[s]&&(n[s]=r[r.length-1-(i-1-s)]);if((t=t.filter(((e,t)=>void 0===n[t]))).length)throw new Sk.builtin.TypeError(e+"() missing "+t.length+" required positional arguments: "+t.join(", "))}return n},Sk.exportSymbol("Sk.abstr.copyKeywordsToNamedArgs",Sk.abstr.copyKeywordsToNamedArgs),Sk.abstr.checkNoKwargs=function(e,t){if(t&&t.length)throw new Sk.builtin.TypeError(e+"() takes no keyword arguments")},Sk.exportSymbol("Sk.abstr.checkNoKwargs",Sk.abstr.checkNoKwargs),Sk.abstr.checkNoArgs=function(e,t,n){if(t=t.length+(n?n.length:0))throw new Sk.builtin.TypeError(e+"() takes no arguments ("+t+" given)")},Sk.exportSymbol("Sk.abstr.checkNoArgs",Sk.abstr.checkNoArgs),Sk.abstr.checkOneArg=function(e,t,n){if(Sk.abstr.checkNoKwargs(e,n),1!==t.length)throw new Sk.builtin.TypeError(e+"() takes exactly one argument ("+t.length+" given)")},Sk.exportSymbol("Sk.abstr.checkOneArg",Sk.abstr.checkOneArg),Sk.abstr.checkArgsLen=function(e,t,n,i){if(void 0===i&&(i=1/0),(t=t.length)<n||t>i)throw new Sk.builtin.TypeError((n===i?e+"() takes exactly "+n+" arguments":t<n?e+"() takes at least "+n+" arguments":e+"() takes at most "+i+" arguments")+" ("+t+" given)")},Sk.exportSymbol("Sk.abstr.checkArgsLen",Sk.abstr.checkArgsLen),Sk.abstr.objectFormat=function(e,t){if(void 0===t)t=Sk.builtin.str.$emptystr;else if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("Format specifier must be a string, not "+Sk.abstr.typeName(t));if(e=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$format),t=Sk.misceval.callsimArray(e,[t]),!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("__format__ must return a str, not "+Sk.abstr.typeName(t));return t},Sk.abstr.objectHash=function(e){const t=e.tp$hash;if(void 0!==t){if(Sk.builtin.checkNone(t))throw new Sk.builtin.TypeError("unhashable type: '"+Sk.abstr.typeName(e)+"'");return e.tp$hash()}throw new Sk.builtin.TypeError("unsupported Javascript type")},Sk.abstr.objectAdd=function(e,t){if(e.nb$add)return e.nb$add(t);throw e=Sk.abstr.typeName(e),t=Sk.abstr.typeName(t),new Sk.builtin.TypeError("unsupported operand type(s) for +: '"+e+"' and '"+t+"'")},Sk.abstr.objectNegative=function(e){if(e.nb$negative)return e.nb$negative();throw new Sk.builtin.TypeError("bad operand type for unary -: '"+Sk.abstr.typeName(e)+"'")},Sk.abstr.objectPositive=function(e){if(e.nb$positive)return e.nb$positive();throw new Sk.builtin.TypeError("bad operand type for unary +: '"+Sk.abstr.typeName(e)+"'")},Sk.abstr.objectDelItem=function(e,t,n){if(e.mp$ass_subscript)return e.mp$ass_subscript(t,void 0,n);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object does not support item deletion")},Sk.exportSymbol("Sk.abstr.objectDelItem",Sk.abstr.objectDelItem),Sk.abstr.objectGetItem=function(e,t,n){if(e.mp$subscript)return e.mp$subscript(t,n);if(Sk.builtin.checkClass(e)){if(e===Sk.builtin.type)return new Sk.builtin.GenericAlias(e,t);const i=Sk.abstr.typeLookup(e,Sk.builtin.str.$class_getitem);if(void 0!==i)return e=Sk.misceval.callsimOrSuspendArray(i,[t]),n?e:Sk.misceval.retryOptionalSuspensionOrThrow(e)}throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' does not support indexing")},Sk.exportSymbol("Sk.abstr.objectGetItem",Sk.abstr.objectGetItem),Sk.abstr.objectSetItem=function(e,t,n,i){if(e.mp$ass_subscript)return e.mp$ass_subscript(t,n,i);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' does not support item assignment")},Sk.exportSymbol("Sk.abstr.objectSetItem",Sk.abstr.objectSetItem),Sk.abstr.gattr=function(e,t,n){if(void 0===(n=e.tp$getattr(t,n)))throw new Sk.builtin.AttributeError(e.sk$attrError()+" has no attribute '"+t.$jsstr()+"'");return n.$isSuspension?Sk.misceval.chain(n,(function(n){if(void 0===n)throw new Sk.builtin.AttributeError(e.sk$attrError()+" has no attribute '"+t.$jsstr()+"'");return n})):n},Sk.exportSymbol("Sk.abstr.gattr",Sk.abstr.gattr),Sk.abstr.sattr=function(e,t,n,i){return e.tp$setattr(t,n,i)},Sk.exportSymbol("Sk.abstr.sattr",Sk.abstr.sattr),Sk.abstr.iternext=function(e,t){return e.tp$iternext(t)},Sk.exportSymbol("Sk.abstr.iternext",Sk.abstr.iternext),Sk.abstr.iter=function(e){if(e.tp$iter){if((e=e.tp$iter()).tp$iternext)return e;throw new Sk.builtin.TypeError("iter() returned non-iterator of type '"+Sk.abstr.typeName(e)+"'")}if(e.mp$subscript)return new Sk.builtin.seq_iter_(e);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not iterable")},Sk.exportSymbol("Sk.abstr.iter",Sk.abstr.iter),Sk.abstr.lookupSpecial=function(e,t){var n=e.ob$type;if(void 0===n)Sk.asserts.fail("javascript object sent to lookupSpecial");else if(void 0!==(t=n.$typeLookup(t)))return void 0!==t.tp$descr_get&&(t=t.tp$descr_get(e,n)),t},Sk.exportSymbol("Sk.abstr.lookupSpecial",Sk.abstr.lookupSpecial),Sk.abstr.lookupAttr=function(e,t){try{return e.tp$getattr(t)}catch(e){if(!(e instanceof Sk.builtin.AttributeError))throw e}},Sk.abstr.typeLookup=function(e,t){return void 0!==(t=e.$typeLookup(t))&&t.tp$descr_get?t.tp$descr_get(null,e):t},Sk.abstr.markUnhashable=function(e){(e=e.prototype).__hash__=Sk.builtin.none.none$,e.tp$hash=Sk.builtin.none.none$},Sk.abstr.setUpInheritance=function(e,t,n,i){i=i||Sk.builtin.type;const r=null!==(n=void 0===n?Sk.builtin.object:n)?n.prototype:null;Object.setPrototypeOf(t,i.prototype),Object.setPrototypeOf(t.prototype,r),Object.defineProperties(t.prototype,{sk$object:{value:!0,writable:!0},ob$type:{value:t,writable:!0},tp$name:{value:e,writable:!0},tp$base:{value:n,writable:!0}})},Sk.abstr.setUpBuiltinMro=function(e){let t=e.prototype.tp$base;const n=null===t?[]:[t];t!==Sk.builtin.object&&null!==t||(Object.defineProperty(e,"sk$baseClass",{value:!0,writable:!0}),Object.defineProperty(e.prototype,"sk$builtinBase",{value:e,writable:!0})),Object.defineProperty(e,"sk$solidBase",{value:!0,writable:!0});const i=[e];for(;null!==t;)i.push(t),t=t.prototype.tp$base;Object.defineProperties(e.prototype,{sk$prototypical:{value:!0,writable:!0},tp$bases:{value:n,writable:!0},tp$mro:{value:i,writable:!0}}),Object.defineProperty(e,"$typeLookup",{value:function(e){return this.prototype[e.$mangled]},writable:!0})};let a=e=>Sk.builtin.str&&Sk.builtin.str.$fixReserved?(a=Sk.builtin.str.$fixReserved,Sk.builtin.str.$fixReserved(e)):e;Sk.abstr.setUpGetSets=function(e,t){if(void 0!==Sk.builtin.getset_descriptor){var n=e.prototype;t=t||n.tp$getsets||{},Object.entries(t).forEach((t=>{var[i,r]=t;r.$name=i,n[a(i)]=new Sk.builtin.getset_descriptor(e,r)})),Object.defineProperty(n,"tp$getsets",{value:null,writable:!0})}},Sk.abstr.setUpMethods=function(e,t){if(void 0!==Sk.builtin.method_descriptor){var n=e.prototype;t=t||n.tp$methods||{},Object.entries(t).forEach((t=>{var[i,r]=t;r.$name=i,n[a(i)]=new Sk.builtin.method_descriptor(e,r)})),Object.defineProperty(n,"tp$methods",{value:null,writable:!0})}},Sk.abstr.setUpClassMethods=function(e,t){if(void 0!==Sk.builtin.classmethod_descriptor){var n=e.prototype;t=t||n.tp$classmethods||{},Object.entries(t).forEach((t=>{var[i,r]=t;r.$name=i,n[a(i)]=new Sk.builtin.classmethod_descriptor(e,r)})),Object.defineProperty(n,"tp$classmethods",{value:null,writable:!0})}};const l={Eq:"ob$eq",NotEq:"ob$ne",Gt:"ob$gt",GtE:"ob$ge",Lt:"ob$lt",LtE:"ob$le"},u=Object.entries(l);Sk.abstr.setUpSlots=function(e,t){function n(t,n){r[t]=new Sk.builtin.wrapper_descriptor(e,Sk.slots[t],n)}function i(e,t){"string"==typeof e?n(e,t):e.forEach((e=>{n(e,t)}))}if(void 0!==Sk.builtin.wrapper_descriptor){var r=e.prototype;(t=t||r.tp$slots||{}).tp$new===Sk.generic.new&&(t.tp$new=Sk.generic.new(e)),t.tp$richcompare?function(e){u.forEach((t=>{var[n,i]=t;e[i]=function(e){return this.tp$richcompare(e,n)}}))}(t):t.ob$eq&&(t.tp$richcompare=function(e,t){return this[l[t]].call(this,e)}),t.tp$as_number&&function(e){const t=Sk.reflectedNumberSlots;Object.keys(t).forEach((n=>{if(void 0!==e[n]){const i=t[n],r=i.reflected,s=e[r];void 0!==s?null===s&&delete e[r]:e[r]=i.slot||e[n]}}))}(t),t.tp$as_sequence_or_mapping&&function(e){const t=Sk.sequenceAndMappingSlots;Object.keys(t).forEach((n=>{void 0!==e[n]&&t[n].forEach((t=>{e[t]=e[n]}))}))}(t),Object.entries(t).forEach((e=>{var[t,n]=e;Object.defineProperty(r,t,{value:n,writable:!0})})),t.tp$new&&(r.__new__=new Sk.builtin.sk_method(Sk.generic.newMethodDef,e),Object.defineProperty(r,"sk$staticNew",{value:e,writable:!0})),Sk.subSlots.main_slots.forEach((e=>{var[n,r]=e;void 0!==(e=t[n])&&i(r,e)}));var s=t.tp$hash;void 0!==s&&("function"==typeof s?n("__hash__",s):s===Sk.builtin.none.none$?r.__hash__=s:Sk.asserts.fail("invalid tp$hash")),t.tp$as_number&&Sk.subSlots.number_slots.forEach((e=>{var[n,r]=e;void 0!==(e=t[n])&&i(r,e)})),t.tp$as_sequence_or_mapping&&Sk.subSlots.sequence_and_mapping_slots.forEach((e=>{var[n,r]=e;void 0!==(e=t[n])&&i(r,e)})),Object.defineProperty(r,"tp$slots",{value:null,writable:!0})}},Sk.abstr.buildNativeClass=function(e,t){t=t||{},Sk.asserts.assert(t.hasOwnProperty("constructor"),"A constructor is required to build a native class");let n=t.constructor;Sk.abstr.setUpInheritance(e,n,t.base,t.meta),Sk.abstr.setUpBuiltinMro(n);const i=n.prototype;return Object.defineProperties(i,{tp$slots:{value:t.slots,writable:!0},tp$getsets:{value:t.getsets,writable:!0},tp$methods:{value:t.methods,writable:!0},tp$classmethods:{value:t.classmethods,writable:!0}}),Sk.abstr.setUpSlots(n,t.slots||{}),Sk.abstr.setUpMethods(n,t.methods),Sk.abstr.setUpGetSets(n,t.getsets),Sk.abstr.setUpClassMethods(n,t.classmethods),Object.entries(t.proto||{}).forEach((e=>{var[t,n]=e;Object.defineProperty(i,t,{value:n,writable:!0,enumerable:!(t.includes("$")||t in Object.prototype)})})),Object.entries(t.flags||{}).forEach((e=>{var[t,i]=e;Object.defineProperty(n,t,{value:i,writable:!0})})),i.hasOwnProperty("tp$iter")&&(i[Symbol.iterator]=function(){return this.tp$iter()[Symbol.iterator]()}),void 0!==Sk.builtin.str&&i.hasOwnProperty("tp$doc")&&!i.hasOwnProperty("__doc__")&&(e=i.tp$doc||null,i.__doc__="string"==typeof e?new Sk.builtin.str(e):Sk.builtin.none.none$),n},Sk.abstr.buildIteratorClass=function(e,t){return Sk.asserts.assert(t.hasOwnProperty("constructor"),"must provide a constructor"),t.slots=t.slots||{},t.slots.tp$iter=Sk.generic.selfIter,t.slots.tp$iternext=t.slots.tp$iternext||t.iternext,t.slots.tp$getattr=t.slots.tp$getattr||Sk.generic.getAttr,e=Sk.abstr.buildNativeClass(e,t),Sk.abstr.built$iterators.push(e),e.prototype[Symbol.iterator]=function(){return{next:()=>{const e=this.tp$iternext();return{value:e,done:void 0===e}}}},e},Sk.abstr.built$iterators=[],Sk.abstr.setUpModuleMethods=function(e,t,n){return Object.entries(n).forEach((n=>{var[i,r]=n;r.$name=r.$name||i,t[i]=new Sk.builtin.sk_method(r,null,e)})),t},Sk.abstr.superConstructor=function(e,t,n){var i=Array.prototype.slice.call(arguments,2);e.prototype.tp$base.apply(t,i)}},function(e,t){function n(e){const t=e.prototype,n=t.tp$base;if(null==n)return!1;const i=n.prototype;return!(n.sk$solidSlotBase||e.sk$solidSlotBase||i.sk$hasDict!==t.sk$hasDict||n.sk$solidBase&&n!==Sk.builtin.module)}const i=new WeakMap;Sk.builtin.object=Sk.abstr.buildNativeClass("object",{constructor:function(){Sk.asserts.assert(this instanceof Sk.builtin.object,"bad call to object, use 'new'")},base:null,slots:{tp$new(e,t){if(e.length||t&&t.length){if(this.tp$new!==Sk.builtin.object.prototype.tp$new)throw new Sk.builtin.TypeError("object.__new__() takes exactly one argument (the type to instantiate)");if(this.tp$init===Sk.builtin.object.prototype.tp$init)throw new Sk.builtin.TypeError(Sk.abstr.typeName(this)+"() takes no arguments")}return new this.constructor},tp$init(e,t){if(e.length||t&&t.length){if(this.tp$init!==Sk.builtin.object.prototype.tp$init)throw new Sk.builtin.TypeError("object.__init__() takes exactly one argument (the instance to initialize)");if(this.tp$new===Sk.builtin.object.prototype.tp$new)throw new Sk.builtin.TypeError(Sk.abstr.typeName(this)+".__init__() takes exactly one argument (the instance to initialize)")}},tp$getattr:Sk.generic.getAttr,tp$setattr:Sk.generic.setAttr,$r(){const e=Sk.abstr.lookupSpecial(this,Sk.builtin.str.$module);let t="";return e&&Sk.builtin.checkString(e)&&(t=e.v+"."),new Sk.builtin.str("<"+t+Sk.abstr.typeName(this)+" object>")},tp$str(){return this.$r()},tp$hash(){let e=i.get(this);return void 0!==e||(e=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER-Number.MAX_SAFE_INTEGER/2),i.set(this,e)),e},tp$richcompare(e,t){switch(t){case"Eq":e=this===e||Sk.builtin.NotImplemented.NotImplemented$;break;case"NotEq":(e=this.ob$eq(e,"Eq"))!==Sk.builtin.NotImplemented.NotImplemented$&&(e=!Sk.misceval.isTrue(e));break;default:e=Sk.builtin.NotImplemented.NotImplemented$}return e},tp$doc:"The most base type"},getsets:{__class__:{$get(){return this.ob$type},$set(e){if(void 0===e)throw new Sk.builtin.TypeError("can't delete __class__ attribute");if(!Sk.builtin.checkClass(e))throw new Sk.builtin.TypeError("__class__ must be set to a class, not '"+Sk.abstr.typeName(e)+"' object");const t=this.ob$type;if(!(t.$isSubType(Sk.builtin.module)&&e.$isSubType(Sk.builtin.module)||void 0!==t.prototype.ht$type&&void 0!==e.prototype.ht$type))throw new Sk.builtin.TypeError(" __class__ assignment only supported for heap types or ModuleType subclasses");{let i=t,r=e;for(;n(i);)i=i.prototype.tp$base;for(;n(r);)r=r.prototype.tp$base;if(i!==r&&(i.prototype.tp$base!==r.prototype.tp$base||!function(e,t){e=e.prototype,t=t.prototype;const n=e.ht$slots,i=t.ht$slots;return e.sk$hasDict===t.sk$hasDict&&(n===i||(n&&i?n.length===i.length&&n.every(((e,t)=>e===i[t])):(n&&(n.length||null))===(i&&(i.length||null))))}(i,r)))throw new Sk.builtin.TypeError("__class__ assignment: '"+e.prototype.tp$name+"' object layout differs from '"+t.prototype.tp$name+"'")}Object.setPrototypeOf(this,e.prototype)},$doc:"the object's class"}},methods:{__dir__:{$meth:function(){let e=Sk.abstr.lookupAttr(this,Sk.builtin.str.$dict);e=void 0===e?new Sk.builtin.dict([]):e instanceof Sk.builtin.dict?e.dict$copy():new Sk.builtin.dict([]);const t=Sk.abstr.lookupAttr(this,Sk.builtin.str.$class);return void 0!==t&&t.$mergeClassDict(e),new Sk.builtin.list(e.sk$asarray())},$flags:{NoArgs:!0},$doc:"Default dir() implementation."},__format__:{$meth(e){if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("__format__() argument must be str, not "+Sk.abstr.typeName(e));if(""!==e.v)throw new Sk.builtin.TypeError(`unsupported format string passed to ${Sk.abstr.typeName(this)}.__format__`);return this.tp$str()},$flags:{OneArg:!0},$doc:"Default object formatter."}},classmethods:{__init_subclass__:{$meth:e=>Sk.builtin.none.none$,$flags:{FastCall:!0,NoKwargs:!0}}},proto:{valueOf:Object.prototype.valueOf,toString(){return this.tp$str().v},hasOwnProperty:Object.prototype.hasOwnProperty,ht$type:void 0,sk$attrError(){return"'"+this.tp$name+"' object"},$mergeClassDict(e){var t=Sk.abstr.lookupAttr(this,Sk.builtin.str.$dict);if(void 0!==t&&e.dict$merge(t),void 0!==(t=Sk.abstr.lookupAttr(this,Sk.builtin.str.$bases))){var n=Sk.builtin.len(t).valueOf();for(let i=0;i<n;i++)Sk.abstr.objectGetItem(t,new Sk.builtin.int_(i)).$mergeClassDict(e)}}}}),Sk.abstr.setUpInheritance("type",Sk.builtin.type,Sk.builtin.object),Sk.abstr.setUpBuiltinMro(Sk.builtin.type)},function(e,t){function n(e,t,n){return Sk.abstr.checkNoArgs(this.$name,t,n),void 0===(e=this.call(e))?Sk.builtin.none.none$:e}function i(e,t,n){return Sk.abstr.checkOneArg(this.$name,t,n),void 0===(e=this.call(e,t[0]))?Sk.builtin.none.none$:e}function r(e,t,n){return Sk.abstr.checkOneArg(this.$name,t,n),e=this.call(e,t[0],!0),Sk.misceval.chain(e,(e=>void 0===e?Sk.builtin.none.none$:e))}function s(e,t,n){return Sk.abstr.checkNoKwargs(this.$name,n),Sk.abstr.checkArgsLen(this.$name,t,1,2),void 0===(e=this.call(e,...t))?Sk.builtin.none.none$:e}function o(e,t,n){return Sk.abstr.checkNoKwargs(this.$name,n),Sk.abstr.checkArgsLen(this.$name,t,2,2),Sk.misceval.chain(this.call(e,t[0],t[1],!0),(()=>Sk.builtin.none.none$))}function a(e,t,n){return Sk.abstr.checkOneArg(this.$name,t,n),e=this.call(e,t[0],void 0,!0),Sk.misceval.chain(e,(e=>void 0===e?Sk.builtin.none.none$:e))}function l(e,t,n){return(e=i.call(this,e,t,n))===Sk.builtin.NotImplemented.NotImplemented$?e:new Sk.builtin.bool(e)}function u(e,t,n){return function(i,r,s){return i=e.call(this,i,r,s),n?Sk.misceval.chain(i,t):t(Sk.misceval.retryOptionalSuspensionOrThrow(i))}}function c(e){return function(){const t=e.tp$descr_get?e.tp$descr_get(this,this.ob$type):e;return Sk.misceval.callsimArray(t,[])}}function d(e,t,n,i){return function(r){return function(){var s=r.tp$descr_get?r.tp$descr_get(this,this.ob$type):r;if(s=Sk.misceval.callsimArray(s,[]),!t(s))throw new Sk.builtin.TypeError(e+" should return "+n+" (returned "+Sk.abstr.typeName(s)+")");return void 0!==i?i(s):s}}}function f(e){return function(t){const n=e.tp$descr_get?e.tp$descr_get(this,this.ob$type):e;return Sk.misceval.callsimArray(n,[t])}}function h(e,t){let n=this.ob$type.$typeLookup(Sk.builtin.str.$getattribute);if(n instanceof Sk.builtin.wrapper_descriptor)return n.d$wrapped.call(this,e,t);n.tp$descr_get&&(n=n.tp$descr_get(this,this.ob$type));const i=Sk.misceval.tryCatch((()=>Sk.misceval.callsimOrSuspendArray(n,[e])),(e=>{if(!(e instanceof Sk.builtin.AttributeError))throw e}));return t?i:Sk.misceval.retryOptionalSuspensionOrThrow(i)}function p(e,t,n){return function(i){return function(i,r,s){let o;void 0===r?(o=t,n=null):o=e;let a=this.ob$type.$typeLookup(new Sk.builtin.str(o));if(a instanceof Sk.builtin.wrapper_descriptor)return a.d$wrapped.call(this,i,r);if(a.tp$descr_get&&(a=a.tp$descr_get(this,this.ob$type,s)),void 0===a){if(n)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this)+"' object "+n);throw new Sk.builtin.AttributeError(o)}return i=Sk.misceval.callsimOrSuspendArray(a,void 0===r?[i]:[i,r]),s?i:Sk.misceval.retryOptionalSuspensionOrThrow(i)}}}function m(e,t){let n=e.ob$type;for(;n&&void 0!==n.sk$klass;)n=n.prototype.tp$base;if(n&&n.prototype.tp$setattr!==t)throw new Sk.builtin.TypeError("can't apply this "+t.$name+" to "+Sk.abstr.typeName(e)+" object")}Sk.slots=Object.create(null),e=Sk.slots,Sk.slots.__init__={$name:"__init__",$slot_name:"tp$init",$slot_func:function(e){return function(t,n){const i=e.tp$descr_get?e.tp$descr_get(this,this.ob$type):e;return t=Sk.misceval.callsimOrSuspendArray(i,t,n),Sk.misceval.chain(t,(e=>{if(!Sk.builtin.checkNone(e)&&void 0!==e)throw new Sk.builtin.TypeError("__init__() should return None, not "+Sk.abstr.typeName(e))}))}},$wrapper:function(e,t,n){return this.call(e,t,n),Sk.builtin.none.none$},$textsig:"($self, /, *args, **kwargs)",$flags:{FastCall:!0},$doc:"Initialize self. See help(type(self)) for accurate signature."},e.__new__={$name:"__new__",$slot_name:"tp$new",$slot_func:function(e){const t=function(t,n){let i=e;return e.tp$descr_get&&(i=e.tp$descr_get(null,this.constructor)),Sk.misceval.callsimOrSuspendArray(i,[this.constructor,...t],n)};return t.sk$static_new=!1,t},$wrapper:null,$textsig:"($self, /, *args, **kwargs)",$flags:{FastCall:!0},$doc:"Create and return a new object."},e.__call__={$name:"__call__",$slot_name:"tp$call",$slot_func:function(e){return function(t,n){const i=e.tp$descr_get?e.tp$descr_get(this,this.ob$type):e;return Sk.misceval.callsimOrSuspendArray(i,t,n)}},$wrapper:function(e,t,n){return void 0===(e=this.call(e,t,n))?Sk.builtin.none.none$:e},$textsig:"($self, /, *args, **kwargs)",$flags:{FastCall:!0},$doc:"Call self as a function."},e.__repr__={$name:"__repr__",$slot_name:"$r",$slot_func:d("__repr__",Sk.builtin.checkString,"str"),$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return repr(self)."},e.__str__={$name:"__str__",$slot_name:"tp$str",$slot_func:d("__str__",Sk.builtin.checkString,"str"),$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return str(self)."};var _=d("__hash__",Sk.builtin.checkInt,"int",(e=>"number"==typeof e.v?e.v:e.tp$hash()));e.__hash__={$name:"__hash__",$slot_name:"tp$hash",$slot_func:function(e){return e===Sk.builtin.none.none$?Sk.builtin.none.none$:_(e)},$wrapper:u(n,(e=>new Sk.builtin.int_(e))),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return hash(self)."},e.__getattribute__={$name:"__getattribute__",$slot_name:"tp$getattr",$slot_func:function(e){return function(e,t){let n=this.ob$type.$typeLookup(Sk.builtin.str.$getattr);if(void 0===n)return h.call(this,e,t);const i=Sk.misceval.chain(h.call(this,e,t),(t=>Sk.misceval.tryCatch((()=>void 0!==t?t:(n.tp$descr_get&&(n=n.tp$descr_get(this,this.ob$type)),Sk.misceval.callsimOrSuspendArray(n,[e]))),(function(e){if(!(e instanceof Sk.builtin.AttributeError))throw e}))));return t?i:Sk.misceval.retryOptionalSuspensionOrThrow(i)}},$wrapper:function(e,t,n){Sk.abstr.checkOneArg(this.$name,t,n);const i=t[0];if(!Sk.builtin.checkString(i))throw new Sk.builtin.TypeError("attribute name must be string, not '"+Sk.abstr.typeName(i)+"'");return t=this.call(e,i,!0),Sk.misceval.chain(t,(t=>{if(void 0===t)throw new Sk.builtin.AttributeError(Sk.abstr.typeName(e)+" has no attribute "+i.$jsstr());return t}))},$textsig:"($self, name, /)",$flags:{OneArg:!0},$doc:"Return getattr(self, name)."},e.__getattr__={$name:"__getattr__",$slot_name:"tp$getattr",$slot_func:e.__getattribute__.$slot_func,$wrapper:null,$textsig:"($self, name, /)",$flags:{OneArg:!0},$doc:"Return getattr(self, name)."},e.__setattr__={$name:"__setattr__",$slot_name:"tp$setattr",$slot_func:p("__setattr__","__delattr__"),$wrapper:function(e,t,n){return Sk.abstr.checkNoKwargs(this.$name,n),Sk.abstr.checkArgsLen(this.$name,t,2,2),m(e,this),Sk.misceval.chain(this.call(e,t[0],t[1],!0),(()=>Sk.builtin.none.none$))},$textsig:"($self, name, value, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Implement setattr(self, name, value)."},e.__delattr__={$name:"__delattr__",$slot_name:"tp$setattr",$slot_func:e.__setattr__.$slot_func,$wrapper:function(e,t,n){return Sk.abstr.checkOneArg(this.$name,t,n),m(e,this),this.call(e,t[0]),Sk.builtin.none.none$},$textsig:"($self, name, /)",$flags:{OneArg:!0},$doc:"Implement delattr(self, name)."},e.__get__={$name:"__get__",$slot_name:"tp$descr_get",$slot_func:function(e){return function(t,n,i){null===t&&(t=Sk.builtin.none.none$),null==n&&(n=Sk.builtin.none.none$);const r=e.tp$descr_get?e.tp$descr_get(this,this.ob$type):e;return t=Sk.misceval.callsimOrSuspendArray(r,[t,n]),i?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)}},$wrapper:function(e,t,n){if(Sk.abstr.checkNoKwargs(this.$name,n),Sk.abstr.checkArgsLen(this.$name,t,1,2),n=t[0],t=t[1],n===Sk.builtin.none.none$&&(n=null),t===Sk.builtin.none.none$&&(t=null),null===t&&null===n)throw new Sk.builtin.TypeError("__get__(None, None) is invalid");return this.call(e,n,t,!0)},$textsig:"($self, instance, owner, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Return an attribute of instance, which is of type owner."},e.__set__={$name:"__set__",$slot_name:"tp$descr_set",$slot_func:p("__set__","__delete__"),$wrapper:o,$textsig:"($self, instance, value, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Set an attribute of instance to value."},e.__delete__={$name:"__delete__",$slot_name:"tp$descr_set",$slot_func:e.__set__.$slot_func,$wrapper:a,$textsig:"($self, instance, /)",$flags:{OneArg:!0},$doc:"Delete an attribute of instance."},e.__eq__={$name:"__eq__",$slot_name:"ob$eq",$slot_func:f,$wrapper:l,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self==value."},e.__ge__={$name:"__ge__",$slot_name:"ob$ge",$slot_func:f,$wrapper:l,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self>=value."},e.__gt__={$name:"__gt__",$slot_name:"ob$gt",$slot_func:f,$wrapper:l,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self>value."},e.__le__={$name:"__le__",$slot_name:"ob$le",$slot_func:f,$wrapper:l,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self<=value."},e.__lt__={$name:"__lt__",$slot_name:"ob$lt",$slot_func:f,$wrapper:l,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self<value."},e.__ne__={$name:"__ne__",$slot_name:"ob$ne",$slot_func:f,$wrapper:l,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self!=value."},e.__iter__={$name:"__iter__",$slot_name:"tp$iter",$slot_func:c,$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Implement iter(self)."},e.__next__={$name:"__next__",$slot_name:"tp$iternext",$slot_func:function(e){return function(t){const n=e.tp$descr_get?e.tp$descr_get(this,this.ob$type):e,i=Sk.misceval.tryCatch((()=>Sk.misceval.callsimOrSuspendArray(n,[])),(e=>{if(!(e instanceof Sk.builtin.StopIteration))throw e;this.gi$ret=e.$value}));return t?i:Sk.misceval.retryOptionalSuspensionOrThrow(i)}},$wrapper:function(e,t,n){return Sk.abstr.checkNoArgs(this.$name,t,n),Sk.misceval.chain(e.tp$iternext(!0),(e=>{if(void 0===e)throw new Sk.builtin.StopIteration;return e}))},$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Implement next(self)."},e.__len__={$name:"__len__",$slot_name:"sq$length",$slot_func:function(e){return function(t){const n=e.tp$descr_get?e.tp$descr_get(this,this.ob$type):e;return t?(t=Sk.misceval.callsimOrSuspendArray(n,[]),Sk.misceval.chain(t,(e=>Sk.misceval.asIndexOrThrow(e)))):(t=Sk.misceval.callsimArray(n,[]),Sk.misceval.asIndexOrThrow(t))}},$wrapper:u((function(e,t,n){return Sk.abstr.checkNoArgs(this.$name,t,n),e=this.call(e,!0),Sk.misceval.chain(e,(e=>void 0===e?Sk.builtin.none.none$:e))}),(e=>new Sk.builtin.int_(e)),!0),$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return len(self)."},e.__contains__={$name:"__contains__",$slot_name:"sq$contains",$slot_func:function(e){return function(t,n){const i=e.tp$descr_get?e.tp$descr_get(this,this.ob$type):e;return t=Sk.misceval.callsimOrSuspendArray(i,[t]),(t=Sk.misceval.chain(t,(e=>Sk.misceval.isTrue(e)))).$isSuspension?n?t:Sk.misceval.retryOptionalSuspensionOrThrow(t):t}},$wrapper:u(r,(e=>new Sk.builtin.bool(e)),!0),$textsig:"($self, key, /)",$flags:{OneArg:!0},$doc:"Return key in self."},e.__getitem__={$name:"__getitem__",$slot_name:"mp$subscript",$slot_func:function(e){return function(t,n){const i=e.tp$descr_get?e.tp$descr_get(this,this.ob$type):e;return t=Sk.misceval.callsimOrSuspendArray(i,[t]),n?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)}},$wrapper:r,$textsig:"($self, key, /)",$flags:{OneArg:!0},$doc:"Return self[key]."},e.__setitem__={$name:"__setitem__",$slot_name:"mp$ass_subscript",$slot_func:p("__setitem__","__delitem__","does not support item assignment"),$wrapper:o,$textsig:"($self, key, value, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Set self[key] to value."},e.__delitem__={$name:"__delitem__",$slot_name:"mp$ass_subscript",$slot_func:e.__setitem__.$slot_func,$wrapper:a,$textsig:"($self, key, /)",$flags:{OneArg:!0},$doc:"Delete self[key]."},e.__add__={$name:"__add__",$slot_name:"nb$add",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self+value."},e.__radd__={$name:"__radd__",$slot_name:"nb$reflected_add",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value+self."},e.__iadd__={$name:"__iadd__",$slot_name:"nb$inplace_add",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self+=value."},e.__sub__={$name:"__sub__",$slot_name:"nb$subtract",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self-value."},e.__rsub__={$name:"__rsub__",$slot_name:"nb$reflected_subtract",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value-self."},e.__imul__={$name:"__imul__",$slot_name:"nb$inplace_multiply",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self*=value."},e.__mul__={$name:"__mul__",$slot_name:"nb$multiply",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self*value."},e.__rmul__={$name:"__rmul__",$slot_name:"nb$reflected_multiply",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value*self."},e.__isub__={$name:"__isub__",$slot_name:"nb$inplace_subtract",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self-=value."},e.__mod__={$name:"__mod__",$slot_name:"nb$remainder",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self%value."},e.__rmod__={$name:"__rmod__",$slot_name:"nb$reflected_remainder",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value%self."},e.__imod__={$name:"__imod__",$slot_name:"nb$inplace_remainder",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement value%=self."},e.__divmod__={$name:"__divmod__",$slot_name:"nb$divmod",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return divmod(self, value)."},e.__rdivmod__={$name:"__rdivmod__",$slot_name:"nb$reflected_divmod",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return divmod(value, self)"},e.__pos__={$name:"__pos__",$slot_name:"nb$positive",$slot_func:c,$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"+self"},e.__neg__={$name:"__neg__",$slot_name:"nb$negative",$slot_func:c,$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"-self"},e.__abs__={$name:"__abs__",$slot_name:"nb$abs",$slot_func:c,$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"abs(self)"},e.__bool__={$name:"__bool__",$slot_name:"nb$bool",$slot_func:d("__bool__",Sk.builtin.checkBool,"bool",(e=>0!==e.v)),$wrapper:u(n,(e=>new Sk.builtin.bool(e))),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"self != 0"},e.__invert__={$name:"__invert__",$slot_name:"nb$invert",$slot_func:c,$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"~self"},e.__lshift__={$name:"__lshift__",$slot_name:"nb$lshift",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self<<value."},e.__rlshift__={$name:"__rlshift__",$slot_name:"nb$reflected_lshift",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value<<self."},e.__rshift__={$name:"__rshift__",$slot_name:"nb$rshift",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self>>value."},e.__rrshift__={$name:"__rrshift__",$slot_name:"nb$reflected_rshift",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value>>self."},e.__ilshift__={$name:"__ilshift__",$slot_name:"nb$inplace_lshift",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self<<=value."},e.__irshift__={$name:"__irshift__",$slot_name:"nb$inplace_rshift",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self=>>value."},e.__and__={$name:"__and__",$slot_name:"nb$and",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self&value."},e.__rand__={$name:"__rand__",$slot_name:"nb$refelcted_and",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value&self."},e.__iand__={$name:"__iand__",$slot_name:"nb$inplace_and",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self&=value."},e.__xor__={$name:"__xor__",$slot_name:"nb$xor",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self^value."},e.__rxor__={$name:"__rxor__",$slot_name:"nb$reflected_xor",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value^self."},e.__ixor__={$name:"__ixor__",$slot_name:"nb$inplace_xor",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self^=value."},e.__or__={$name:"__or__",$slot_name:"nb$or",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self|value."},e.__ror__={$name:"__ror__",$slot_name:"nb$reflected_or",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value|self."},e.__ior__={$name:"__ior__",$slot_name:"nb$inplace_or",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self|=value."},e.__int__={$name:"__int__",$slot_name:"nb$int",$slot_func:d("__int__",Sk.builtin.checkInt,"int"),$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"int(self)"},e.__float__={$name:"__float__",$slot_name:"nb$float",$slot_func:d("__float__",Sk.builtin.checkFloat,"float"),$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"float(self)"},e.__floordiv__={$name:"__floordiv__",$slot_name:"nb$floor_divide",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self//value."},e.__rfloordiv__={$name:"__rfloordiv__",$slot_name:"nb$reflected_floor_divide",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value//self."},e.__ifloordiv__={$name:"__ifloordiv__",$slot_name:"nb$inplace_floor_divide",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self//=value."},e.__truediv__={$name:"__truediv__",$slot_name:"nb$divide",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self/value."},e.__rtruediv__={$name:"__rtruediv__",$slot_name:"nb$reflected_divide",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value/self."},e.__itruediv__={$name:"__itruediv__",$slot_name:"nb$inplace_divide",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self/=value."},e.__index__={$name:"__index__",$slot_name:"nb$index",$slot_func:d("__index__",Sk.builtin.checkInt,"int",(e=>e.v)),$wrapper:u(n,(e=>new Sk.builtin.int_(e))),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return self converted to an integer, if self is suitable for use as an index into a list."},e.__pow__={$name:"__pow__",$slot_name:"nb$power",$slot_func:function(e){return function(t,n){const i=e.tp$descr_get?e.tp$descr_get(this,this.ob$type):e;return null==n?Sk.misceval.callsimArray(i,[t]):Sk.misceval.callsimArray(i,[t,n])}},$wrapper:s,$textsig:"($self, value, mod=None, /)",$flags:{MinArgs:1,MaxArgs:2},$doc:"Return pow(self, value, mod)."},e.__rpow__={$name:"__rpow__",$slot_name:"nb$reflected_power",$slot_func:e.__pow__.$slot_func,$wrapper:s,$textsig:"($self, value, mod=None, /)",$flags:{MinArgs:1,MaxArgs:2},$doc:"Return pow(value, self, mod)."},e.__ipow__={$name:"__ipow__",$slot_name:"nb$inplace_power",$slot_func:e.__pow__.$slot_func,$wrapper:s,$textsig:"($self, value, mod=None, /)",$flags:{MinArgs:1,MaxArgs:2},$doc:"Implement **="},e.__matmul__={$name:"__matmul__",$slot_name:"nb$matrix_multiply",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self@value."},e.__rmatmul__={$name:"__rmatmul__",$slot_name:"nb$reflected_matrix_multiply",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value@self."},e.__imatmul__={$name:"__imatmul__",$slot_name:"nb$inplace_matrix_multiply",$slot_func:f,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self@=value."},e.__long__={$name:"__long__",$slot_name:"nb$long",$slot_func:d("__long__",Sk.builtin.checkInt,"int"),$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"int(self)"};var b,g={next:{$name:"next",$slot_name:"tp$iternext",$slot_func:e.__next__.$slot_func,$wrapper:e.__next__.$wrapper,$textsig:e.__next__.$textsig,$flags:e.__next__.$flags},__nonzero__:{$name:"__nonzero__",$slot_name:"nb$bool",$slot_func:d("__nonzero__",Sk.builtin.checkInt,"int",(e=>0!==e.v)),$wrapper:u(n,(e=>new Sk.builtin.bool(e))),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"x.__nonzero__() <==> x != 0"},__div__:{$name:"__div__",$slot_name:"nb$divide",$slot_func:f,$wrapper:i,$textsig:"($self, other/)",$flags:{OneArg:!0},$doc:"x.__div__(y) <==> x/y"},__rdiv__:{$name:"__rdiv__",$slot_name:"nb$reflected_divide",$slot_func:f,$wrapper:i,$textsig:"($self, other/)",$flags:{OneArg:!0},$doc:"x.__rdiv__(y) <==> x/y"},__idiv__:{$name:"__idiv__",$slot_name:"nb$inplace_divide",$slot_func:f,$wrapper:i,$textsig:"($self, other/)",$flags:{OneArg:!0},$doc:"implement self /= other"}};Sk.subSlots={main_slots:Object.entries({tp$init:"__init__",tp$call:"__call__",$r:"__repr__",tp$str:"__str__",tp$getattr:"__getattribute__",tp$setattr:["__setattr__","__delattr__"],ob$eq:"__eq__",ob$ne:"__ne__",ob$lt:"__lt__",ob$le:"__le__",ob$gt:"__gt__",ob$ge:"__ge__",tp$descr_get:"__get__",tp$descr_set:["__set__","__delete__"],tp$iter:"__iter__",tp$iternext:"__next__"}),number_slots:Object.entries({nb$abs:"__abs__",nb$negative:"__neg__",nb$positive:"__pos__",nb$int:"__int__",nb$long:"__long__",nb$float:"__float__",nb$index:"__index__",nb$add:"__add__",nb$reflected_add:"__radd__",nb$inplace_add:"__iadd__",nb$subtract:"__sub__",nb$reflected_subtract:"__rsub__",nb$inplace_subtract:"__isub__",nb$multiply:"__mul__",nb$reflected_multiply:"__rmul__",nb$inplace_multiply:"__imul__",nb$floor_divide:"__floordiv__",nb$reflected_floor_divide:"__rfloordiv__",nb$inplace_floor_divide:"__ifloordiv__",nb$invert:"__invert__",nb$remainder:"__mod__",nb$reflected_remainder:"__rmod__",nb$inplace_remainder:"__imod__",nb$divmod:"__divmod__",nb$reflected_divmod:"__rdivmod__",nb$power:"__pow__",nb$reflected_power:"__rpow__",nb$inplace_power:"__ipow__",nb$divide:"__truediv__",nb$reflected_divide:"__rtruediv__",nb$inplace_divide:"__itruediv__",nb$bool:"__bool__",nb$and:"__and__",nb$reflected_and:"__rand__",nb$inplace_and:"__iand__",nb$or:"__or__",nb$reflected_or:"__ror__",nb$inplace_or:"__ior__",nb$xor:"__xor__",nb$reflected_xor:"__rxor__",nb$inplace_xor:"__ixor__",nb$lshift:"__lshift__",nb$reflected_lshift:"__rlshift__",nb$rshift:"__rshift__",nb$reflected_rshift:"__rrshift__",nb$inplace_lshift:"__ilshift__",nb$inplace_rshift:"__irshift__",nb$matrix_multiply:"__matmul__",nb$reflected_matrix_multiply:"__rmatmul__",nb$inplace_matrix_multiply:"__imatmul__"}),sequence_and_mapping_slots:Object.entries({sq$length:"__len__",sq$contains:"__contains__",mp$subscript:"__getitem__",mp$ass_subscript:["__setitem__","__delitem__"],nb$add:"__add__",nb$multiply:"__mul__",nb$reflected_multiply:"__rmul__",nb$inplace_add:"__iadd__",nb$inplace_multiply:"__imul__"})},Sk.reflectedNumberSlots={nb$add:{reflected:"nb$reflected_add"},nb$subtract:{reflected:"nb$reflected_subtract",slot:function(e){return e instanceof this.constructor?e.nb$subtract(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$multiply:{reflected:"nb$reflected_multiply"},nb$divide:{reflected:"nb$reflected_divide",slot:function(e){return e instanceof this.constructor?e.nb$divide(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$floor_divide:{reflected:"nb$reflected_floor_divide",slot:function(e){return e instanceof this.constructor?e.nb$floor_divide(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$remainder:{reflected:"nb$reflected_remainder",slot:function(e){return e instanceof this.constructor?e.nb$remainder(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$divmod:{reflected:"nb$reflected_divmod",slot:function(e){return e instanceof this.constructor?e.nb$divmod(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$power:{reflected:"nb$reflected_power",slot:function(e,t){return e instanceof this.constructor?e.nb$power(this,t):Sk.builtin.NotImplemented.NotImplemented$}},nb$and:{reflected:"nb$reflected_and"},nb$or:{reflected:"nb$reflected_or"},nb$xor:{reflected:"nb$reflected_xor"},nb$lshift:{reflected:"nb$reflected_lshift",slot:function(e){return e instanceof this.constructor?e.nb$lshift(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$rshift:{reflected:"nb$reflected_rshift",slot:function(e){return e instanceof this.constructor?e.nb$rshift(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$matrix_multiply:{reflected:"nb$reflexted_matrix_multiply",slot:function(e){return e instanceof this.constructor?e.nb$matrix_multiply(this):Sk.builtin.NotImplemented.NotImplemented$}}},Sk.sequenceAndMappingSlots={sq$concat:["nb$add"],sq$repeat:["nb$multiply","nb$reflected_multiply"],mp$length:["sq$length"],sq$inplace_repeat:["nb$inplace_multiply"],sq$inplace_concat:["nb$inplace_add"]},Sk.dunderToSkulpt={__repr__:"$r",__str__:"tp$str",__init__:"tp$init",__new__:"tp$new",__hash__:"tp$hash",__call__:"tp$call",__iter__:"tp$iter",__next__:"tp$iternext",__eq__:"ob$eq",__ne__:"ob$ne",__lt__:"ob$lt",__le__:"ob$le",__gt__:"ob$gt",__ge__:"ob$ge",__abs__:"nb$abs",__neg__:"nb$negative",__pos__:"nb$positive",__int__:"nb$int",__float__:"nb$float",__index__:"nb$index",__add__:"nb$add",__radd__:"nb$reflected_add",__iadd__:"nb$inplace_add",__sub__:"nb$subtract",__rsub__:"nb$reflected_subtract",__isub__:"nb$inplace_subtract",__mul__:"nb$multiply",__rmul__:"nb$reflected_multiply",__imul__:"nb$inplace_multiply",__truediv__:"nb$divide",__rtruediv__:"nb$reflected_divide",__itruediv__:"nb$inplace_divide",__floordiv__:"nb$floor_divide",__rfloordiv__:"nb$reflected_floor_divide",__ifloordiv__:"nb$inplace_floor_divide",__invert__:"nb$invert",__mod__:"nb$remainder",__rmod__:"nb$reflected_remainder",__imod__:"nb$inplace_remainder",__divmod__:"nb$divmod",__rdivmod__:"nb$reflected_divmod",__pow__:"nb$power",__rpow__:"nb$reflected_power",__ipow__:"nb$inplace_power",__bool__:"nb$bool",__long__:"nb$long",__lshift__:"nb$lshift",__rlshift__:"nb$reflected_lshift",__ilshift__:"nb$inplace_lshift",__rshift__:"nb$rshift",__rrshift__:"nb$reflected_rshift",__irshift__:"nb$inplace_rshift",__and__:"nb$and",__rand__:"nb$reflected_and",__iand__:"nb$inplace_and",__or__:"nb$or",__ror__:"nb$reflected_or",__ior__:"nb$inplace_or",__xor__:"nb$xor",__rxor__:"nb$reflected_xor",__ixor__:"nb$inplace_xor",__matmul__:"nb$matrix_multiply",__rmatmul__:"nb$reflected_matrix_multiply",__imatmul__:"nb$inplace_matrix_multiply",__get__:"tp$descr_get",__set__:"tp$descr_set",__delete__:"tp$descr_set",__getattribute__:"tp$getattr",__getattr__:"tp$getattr",__setattr__:"tp$setattr",__delattr__:"tp$setattr",__len__:"sq$length",__contains__:"sq$contains",__getitem__:"mp$subscript",__setitem__:"mp$ass_subscript",__delitem__:"mp$ass_subscript"},Sk.exportSymbol("Sk.setupDunderMethods",Sk.setupDunderMethods),Sk.setupDunderMethods=function(e){function t(e,t,n){for(let i=0;i<e.length;i++){const r=e[i].prototype;r.hasOwnProperty(n)||(r[n]=r[t],delete r[t])}}var n=Sk.slots;if(!e||void 0!==b){var i=Sk.abstr.built$iterators,r=[Sk.builtin.int_,Sk.builtin.lng,Sk.builtin.float_,Sk.builtin.complex],s=Sk.subSlots.number_slots,o=Sk.subSlots.main_slots,a=o.findIndex((e=>"tp$iternext"===e[0])),l=s.findIndex((e=>"nb$bool"===e[0])),u=Sk.dunderToSkulpt;if(e){u.__bool__="nb$bool",u.__next__="tp$iternext",delete u.__nonzero__,delete u.__div__,delete u.__rdiv__,delete u.__idiv__,delete u.next;for(let e in b)n[e]=b[e];for(let e in g)delete n[e];for(e=0;e<r.length;e++)delete(n=r[e].prototype).__div__,delete n.__rdiv__;o[a][1]="__next__",s[l][1]="__bool__",t(i,"next","__next__"),t(r,"__bool__","__nonzero__")}else{void 0===b&&(n.py3$slots={__next__:n.__next__},b=n.py3$slots),u.next="tp$iternext",u.__nonzero__="nb$bool",u.__div__="nb$divide",u.__rdiv__="nb$reflected_divide",u.__idiv__="nb$inplace_divide",delete u.__bool__,delete u.__next__;for(let e in g)n[e]=g[e];for(let e in b)delete n[e];for(o[a][1]="next",s[l][1]="__nonzero__",t(i,"__next__","next"),t(r,"__nonzero__","__bool__"),i=0;i<r.length;i++)(o=(s=r[i]).prototype).hasOwnProperty("__div__")||(o.__div__=new Sk.builtin.wrapper_descriptor(s,g.__div__,o.nb$divide),o.__rdiv__=new Sk.builtin.wrapper_descriptor(s,g.__rdiv__,Sk.reflectedNumberSlots.nb$divide.slot))}}}},function(e,t){function n(e,t,n){return Sk.abstr.buildNativeClass(e,{constructor:n.constructor,slots:Object.assign({tp$getattr:Sk.generic.getAttr,$r:s},n.slots),getsets:Object.assign(n.getsets||{},o),proto:Object.assign(n.proto||{},{d$repr_name:t||e,d$check:i,d$set_check:r}),flags:{sk$unacceptableBase:!0}})}function i(e){if(null==e)return this;if(!e.ob$type.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(e)+"' object")}function r(e){if(!e.ob$type.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(e)+"' object")}function s(){return new Sk.builtin.str("<"+this.d$repr_name+" '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' objects>")}const o={__doc__:{$get(){return this.d$def.$doc?new Sk.builtin.str(this.d$def.$doc):Sk.builtin.none.none$}},__objclass__:{$get(){return this.d$type}},__name__:{$get(){return new Sk.builtin.str(this.d$name)}}};e={__text_signature__:{$get(){return this.d$def.$textsig?new Sk.builtin.str(this.d$def.$textsig):Sk.builtin.none.none$}}},Sk.builtin.getset_descriptor=n("getset_descriptor",void 0,{constructor:function(e,t){this.d$def=t,this.$get=t.$get,this.$set=t.$set,this.d$type=e,this.d$name=t.$name},slots:{tp$descr_get(e,t,n){if(t=this.d$check(e))return t;if(void 0!==this.$get)return e=this.$get.call(e),n?e:Sk.misceval.retryOptionalSuspensionOrThrow(e);throw new Sk.builtin.AttributeError("getset_descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' objects is not readable")},tp$descr_set(e,t,n){if(this.d$set_check(e),void 0!==this.$set)return e=this.$set.call(e,t),n?e:Sk.misceval.retryOptionalSuspensionOrThrow(e);throw new Sk.builtin.AttributeError("attribute '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' objects is readonly")}}}),Sk.builtin.method_descriptor=n("method_descriptor","method",{constructor:function(e,t){this.d$def=t,this.$meth=t.$meth,this.d$type=e,this.d$name=t.$name||"<native JS>",this.$flags=e=t.$flags||{},e.FastCall&&e.NoKwargs?this.tp$call=this.$methodFastCallNoKwargs:e.FastCall?this.tp$call=this.$methodFastCall:e.NoArgs?this.tp$call=this.$methodCallNoArgs:e.OneArg?this.tp$call=this.$methodCallOneArg:e.NamedArgs?this.tp$call=this.$methodCallNamedArgs:void 0!==e.MinArgs?this.tp$call=this.$methodCallMinArgs:(this.func_code=t.$meth,this.tp$call=this.$defaultCall,this.$memoiseFlags=Sk.builtin.func.prototype.$memoiseFlags,this.$resolveArgs=Sk.builtin.func.prototype.$resolveArgs)},slots:{tp$call(e,t){return this.tp$call(e,t)},tp$descr_get(e,t){let n;return(n=this.d$check(e))?n:new Sk.builtin.sk_method(this.d$def,e)}},getsets:e,proto:{$methodFastCall(e,t){const n=e.shift();return this.m$checkself(n),this.$meth.call(n,e,t)},$methodFastCallNoKwargs(e,t){const n=e.shift();return this.m$checkself(n),Sk.abstr.checkNoKwargs(this.d$name,t),this.$meth.call(n,e)},$methodCallNoArgs(e,t){const n=e.shift();return this.m$checkself(n),Sk.abstr.checkNoArgs(this.d$name,e,t),this.$meth.call(n)},$methodCallOneArg(e,t){const n=e.shift();return this.m$checkself(n),Sk.abstr.checkOneArg(this.d$name,e,t),this.$meth.call(n,e[0])},$methodCallNamedArgs(e,t){const n=e.shift();return this.m$checkself(n),e=Sk.abstr.copyKeywordsToNamedArgs(this.d$name,this.$flags.NamedArgs,e,t,this.$flags.Defaults),this.$meth.call(n,...e)},$methodCallMinArgs(e,t){const n=e.shift();return this.m$checkself(n),Sk.abstr.checkNoKwargs(this.d$name,t),Sk.abstr.checkArgsLen(this.d$name,e,this.$flags.MinArgs,this.$flags.MaxArgs),this.$meth.call(n,...e)},$defaultCall(e,t){return this.m$checkself(e[0]),Sk.builtin.func.prototype.tp$call.call(this,e,t)},m$checkself(e){if(void 0===e)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' object needs an argument");this.d$check(e)}}}),Sk.builtin.wrapper_descriptor=n("wrapper_descriptor","slot wrapper",{constructor:function(e,t,n){this.d$def=t,this.d$type=e,this.d$name=n.$name=t.$name,this.d$wrapped=n},slots:{tp$descr_get(e,t){let n;return(n=this.d$check(e))?n:new Sk.builtin.method_wrapper(this,e)},tp$call(e,t){if(1>e.length)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' object needs an argument");const n=e.shift();if(!n.ob$type.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(n)+"'");return this.raw$call(n,e,t)}},proto:{raw$call(e,t,n){return this.d$wrapped.$name=this.d$name,this.d$def.$wrapper.call(this.d$wrapped,e,t,n)}}}),Sk.builtin.method_wrapper=n("method_wrapper",void 0,{constructor:function(e,t){this.m$descr=e,this.m$self=t,this.d$def=e.d$def,this.d$name=e.d$name,this.d$type=e.d$type},slots:{tp$call(e,t){return this.m$descr.raw$call(this.m$self,e,t)},tp$richcompare(e,t){return("Eq"===t||"NotEq"===t)&&e instanceof Sk.builtin.method_wrapper?(e=this.m$self===e.m$self&&this.m$descr===e.m$descr,"Eq"===t?e:!e):Sk.builtin.NotImplemented.NotImplemented$},$r(){return new Sk.builtin.str("<method-wrapper '"+this.d$name+"' of "+Sk.abstr.typeName(this.m$self)+" object>")}},getsets:{__self__:{$get(){return this.m$self}}}}),Sk.builtin.classmethod_descriptor=n("classmethod_descriptor","method",{constructor:function(e,t){this.d$def=t,this.$meth=t.$meth,this.d$type=e,this.d$name=t.$name||"<native JS>"},slots:{tp$call(e,t){if(1>e.length)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' object needs an argument");const n=e.shift();return this.tp$descr_get(null,n).tp$call(e,t)},tp$descr_get(e,t,n){if(void 0===t){if(null===e)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' for type '"+this.d$type.prototype.tp$name+"' needs an object or a type");t=t||e.ob$type}if(!t.ob$type.$isSubType(Sk.builtin.type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' for type '"+this.d$type.prototype.tp$name+"' needs a type not a '"+Sk.abstr.typeName(t)+"' as arg 2");if(!t.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(t)+"' object");return new Sk.builtin.sk_method(this.d$def,t)}},getsets:e}),[Sk.builtin.method_descriptor,Sk.builtin.getset_descriptor,Sk.builtin.wrapper_descriptor,Sk.builtin.method_wrapper,Sk.builtin.classmethod_descriptor].forEach((e=>{Sk.abstr.setUpSlots(e),Sk.abstr.setUpMethods(e),Sk.abstr.setUpGetSets(e)}))},function(e,t){Sk.builtin.sk_method=Sk.abstr.buildNativeClass("builtin_function_or_method",{constructor:function(e,t,n){this.$meth=e.$meth.bind(t),this.$doc=e.$doc,this.$self=t||null,this.$module=n?new Sk.builtin.str(n):null,this.$name=e.$name||e.$meth.name||"<native JS>",this.m$def=e,this.$textsig=e.$textsig,this.$flags=e=e.$flags||{},e.FastCall&&e.NoKwargs?this.tp$call=this.$fastCallNoKwargs:e.FastCall?this.tp$call=this.$meth:e.NoArgs?this.tp$call=this.$callNoArgs:e.OneArg?this.tp$call=this.$callOneArg:e.NamedArgs?this.tp$call=this.$callNamedArgs:void 0!==e.MinArgs?this.tp$call=this.$callMinArgs:(this.func_code=this.$meth,this.tp$call=this.$defaultCallMethod)},proto:{$fastCallNoKwargs(e,t){return Sk.abstr.checkNoKwargs(this.$name,t),this.$meth(e)},$callNoArgs(e,t){return Sk.abstr.checkNoArgs(this.$name,e,t),this.$meth()},$callOneArg(e,t){return Sk.abstr.checkOneArg(this.$name,e,t),this.$meth(e[0])},$callNamedArgs(e,t){return e=Sk.abstr.copyKeywordsToNamedArgs(this.$name,this.$flags.NamedArgs,e,t,this.$flags.Defaults),this.$meth(...e)},$callMinArgs(e,t){return Sk.abstr.checkNoKwargs(this.$name,t),Sk.abstr.checkArgsLen(this.$name,e,this.$flags.MinArgs,this.$flags.MaxArgs),this.$meth(...e)},$defaultCallMethod(e,t){return null!==this.$self?Sk.builtin.func.prototype.tp$call.call(this,[this.$self,...e],t):Sk.builtin.func.prototype.tp$call.call(this,e,t)},$memoiseFlags(){return Sk.builtin.func.prototype.$memoiseFlags.call(this)},$resolveArgs(){return Sk.builtin.func.prototype.$resolveArgs.call(this)}},flags:{sk$unacceptableBase:!0},slots:{tp$getattr:Sk.generic.getAttr,$r(){return null===this.$self?new Sk.builtin.str("<built-in function "+this.$name+">"):new Sk.builtin.str("<built-in method "+this.$name+" of "+Sk.abstr.typeName(this.$self)+" object>")},tp$call(e,t){return this.tp$call(e,t)},tp$richcompare(e,t){return("Eq"===t||"NotEq"===t)&&e instanceof Sk.builtin.sk_method?(e=this.$self===e.$self&&this.m$def.$meth===e.m$def.$meth,"Eq"===t?e:!e):Sk.builtin.NotImplemented.NotImplemented$}},getsets:{__module__:{$get(){return this.$module||Sk.builtin.none.none$},$set(e){this.$module=e=e||Sk.builtin.none.none$}},__doc__:{$get(){return this.$doc?new Sk.builtin.str(this.$doc):Sk.builtin.none.none$}},__name__:{$get(){return new Sk.builtin.str(this.$name)}},__text_signature__:{$get(){return new Sk.builtin.str(this.$textsig)}},__self__:{$get(){return this.$self||Sk.sysModules.mp$lookup(this.$module)||Sk.builtin.none.none$}}}})},function(e,t){Sk.builtin.none=Sk.abstr.buildNativeClass("NoneType",{constructor:function(){return Sk.builtin.none.none$},slots:{tp$new:(e,t)=>(Sk.abstr.checkNoArgs("NoneType",e,t),Sk.builtin.none.none$),$r:()=>new Sk.builtin.str("None"),tp$as_number:!0,nb$bool:()=>!1},proto:{valueOf:()=>null},flags:{sk$unacceptableBase:!0}}),Sk.builtin.none.none$=Object.create(Sk.builtin.none.prototype,{v:{value:null,enumerable:!0}}),Sk.builtin.NotImplemented=Sk.abstr.buildNativeClass("NotImplementedType",{constructor:function(){return Sk.builtin.NotImplemented.NotImplemented$},slots:{$r:()=>new Sk.builtin.str("NotImplemented"),tp$new:(e,t)=>(Sk.abstr.checkNoArgs("NotImplementedType",e,t),Sk.builtin.NotImplemented.NotImplemented$)},flags:{sk$unacceptableBase:!0}}),Sk.builtin.NotImplemented.NotImplemented$=Object.create(Sk.builtin.NotImplemented.prototype,{v:{value:null,enumerable:!0}}),e=Sk.abstr.buildNativeClass("ellipsis",{constructor:function(){return Sk.builtin.Ellipsis},slots:{tp$new:(e,t)=>(Sk.abstr.checkNoArgs("ellipsis",e,t),Sk.builtin.Ellipsis),$r:()=>new Sk.builtin.str("Ellipsis")},flags:{sk$unacceptableBase:!0}}),Sk.builtin.Ellipsis=Object.create(e.prototype,{v:{value:"..."}})},function(e,t){const n=/^(?:(.)?([<>=\^]))?([\+\-\s])?(#)?(0)?(\d+)?(,|_)?(?:\.(\d+))?([bcdeEfFgGnosxX%])?$/;Sk.formatting={};let i=function(e,t,n,i){if(Sk.asserts.assert("string"==typeof t),e[6]){var r=parseInt(e[6],10);i=e[2]||(e[5]?"=":i?">":"<");let s=r-(t.length+(n?n.length:0));if(0>=s)return n+t;switch(r=(e[1]||(e[5]?"0":" ")).repeat(s),i){case"=":if("s"===e[9])throw new Sk.builtin.ValueError("'=' alignment not allowed in string format specifier");return n+r+t;case">":return r+n+t;case"<":return n+t+r;case"^":return e=Math.floor(s/2),r.substring(0,e)+n+t+r.substring(e)}}return n+t},r=function(e,t){return t?"-":"+"===e[3]?"+":" "===e[3]?" ":""};const s=/\B(?=(\d{3})+(?!\d))/g,o=/\B(?=([A-Za-z0-9]{4})+(?![A-Za-z0-9]))/g;let a=function(e,t,n){if(Sk.asserts.assert(t instanceof Sk.builtin.int_||t instanceof Sk.builtin.lng),e[8])throw new Sk.builtin.ValueError("Precision not allowed in integer format");var a=t.str$(n,!1);t=t.nb$isnegative(),t=r(e,t),e[4]&&(16===n?t+="0x":8===n?t+="0o":2===n&&(t+="0b"));const l=e[9];if("X"===l&&(a=a.toUpperCase()),"n"===e[9])a=(+a).toLocaleString();else if(e[7]){a=a.split(".");const t=e[7];if(","===t&&10!==n)throw new Sk.builtin.ValueError(`Cannot specify ',' with '${l}'`);a[0]=a[0].replace(10===n?s:o,t),a=a.join(".")}return i(e,a,t,!0)};Sk.formatting.mkNumber__format__=e=>function(t){if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("format() argument 2 must be str, not "+Sk.abstr.typeName(t));return new Sk.builtin.str(function(e,t,s){if(!t)return e.str$(10,!0);if(!(t=t.match(n)))throw new Sk.builtin.ValueError("Invalid format specifier");var o=t[9];if(o||(o=s?"g":"d"),-1==(s?"fFeEgG%":"bcdoxXnfFeEgG%").indexOf(o))throw new Sk.builtin.ValueError("Unknown format code '"+t[9]+"' for object of type '"+Sk.abstr.typeName(e)+"'");switch(o){case"d":case"n":return a(t,e,10);case"x":case"X":return a(t,e,16);case"o":return a(t,e,8);case"b":return a(t,e,2);case"c":if(t[3])throw new Sk.builtin.ValueError("Sign not allowed with integer format specifier 'c'");if(t[4])throw new Sk.builtin.ValueError("Alternate form not allowed with integer format specifier 'c'");if(t[7])throw new Sk.builtin.ValueError("Cannot specify ',' with 'c'");if(t[8])throw new Sk.builtin.ValueError("Cannot specify ',' with 'c'");return i(t,String.fromCodePoint(Sk.builtin.asnum$(e)),"",!0);case"f":case"F":case"e":case"E":case"g":case"G":{if(t[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed in float format specifier");if("string"==typeof(s=Sk.builtin.asnum$(e))&&(s=Number(s)),1/0===s)return i(t,"inf","",!0);if(-1/0===s)return i(t,"inf","-",!0);if(isNaN(s))return i(t,"nan","",!0);e=!1,0>s&&(s=-s,e=!0);var l=["toExponential","toFixed","toPrecision"]["efg".indexOf(o.toLowerCase())];let n=t[8]?parseInt(t[8],10):6;if(s=s[l](n),-1!=="EFG".indexOf(o)&&(s=s.toUpperCase()),"g"===o.toLowerCase()||!t[9]){if(l=s.match(/\.(\d*[1-9])?(0+)$/)){let[,e,t]=l;s=s.slice(0,e?-t.length:-(t.length+1))}-1!=s.indexOf(".")||t[9]||(s+=".0")}return"e"===o.toLowerCase()&&(s=s.replace(/^([-+]?[0-9]*\.?[0-9]+[eE][-+]?)([0-9])?$/,"$10$2")),t[7]&&((o=s.toString().split("."))[0]=o[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),s=o.join(".")),i(t,s,r(t,e),!0)}case"%":if(t[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed with format specifier '%'");return"string"==typeof(e=Sk.builtin.asnum$(e))&&(e=Number(e)),1/0===e?i(t,"inf%","",!0):-1/0===e?i(t,"inf%","-",!0):isNaN(e)?i(t,"nan%","",!0):(o=!1,0>e&&(e=-e,o=!0),s=t[8]?parseInt(t[8],10):6,e=(100*e).toFixed(s)+"%",i(t,e,r(t,o),!0));default:throw new Sk.builtin.ValueError("Unknown format code '"+t[9]+"'")}}(this,t.$jsstr(),e))};const l=/^\d+$/,u=/{(((?:\d+)|(?:\w+))?((?:\.(\w+))|(?:\[((?:\d+)|(?:\w+))\])?))?(?:!(.))?(?::([^}]*))?}/g;Sk.formatting.format=function(e,t){t=t||[];const n={};for(let e=0;e<t.length;e+=2)n[t[e]]=t[e+1];let i;const r=e=>{if(void 0===i)i=e;else if(i!==e)throw new Sk.builtin.ValueError(`cannot switch from ${i} to ${e}`)},s=t=>{let i;if("number"==typeof t)r("manual field specification"),i=e[t];else if(l.test(t))r("automatic field numbering"),i=e[t];else if(i=n[t],void 0===i)throw new Sk.builtin.KeyError(t);if(void 0===i)throw new Sk.builtin.IndexError(`Replacement index ${t} out of range for positional args tuple`);return i};let o=0;return t=this.v.replace(u,(function(e,t,n,i,r,a,u,c,d,f){let h;if(void 0!==a&&""!==a?(h=(r=s(n)).constructor===Array?r[a]:l.test(a)?Sk.abstr.objectGetItem(r,new Sk.builtin.int_(parseInt(a,10)),!1):Sk.abstr.objectGetItem(r,new Sk.builtin.str(a),!1),o++):void 0!==r&&""!==r?(a=s(n||o++),h=Sk.abstr.gattr(a,new Sk.builtin.str(r))):void 0!==n&&""!==n?h=s(n):void 0===t||""===t?(h=s(o),o++):l.test(t)&&(h=s(t),o++),"s"===u)h=new Sk.builtin.str(h);else if("r"===u)h=Sk.builtin.repr(h);else if("a"===u)h=Sk.builtin.ascii(h);else if(""!==u&&void 0!==u)throw new Sk.builtin.ValueError("Unknown conversion specifier "+u);return Sk.abstr.objectFormat(h,new Sk.builtin.str(c)).$jsstr()})),new Sk.builtin.str(t)},Sk.formatting.formatString=function(e){if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("format() argument 2 must be str, not "+Sk.abstr.typeName(e));if((e=e.$jsstr().match(n))[9]&&"s"!==e[9])throw new Sk.builtin.ValueError("Unknown format code '"+e[9]+"' for object of type 'str'");if(e[3])throw new Sk.builtin.ValueError("Sign not allowed in string format specifier");if(e[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed with string format specifier");if(e[7])throw new Sk.builtin.ValueError("Cannot specify ',' with 's'");let t=this.v;return e[8]&&(t=t.substring(0,e[8])),new Sk.builtin.str(i(e,t,"",!1))}},function(e,t,n){function i(e){let t;const n=[];for(let i=0;i<e.length;i++)t=e.charAt(i),b.test(t)?n.push(t):"\\000"===t?n.push("\\000"):n.push("\\"+t);return n.join("")}function r(e,t,n){if(null!==(t=Sk.builtin.checkNone(t)?null:e.get$tgt(t))&&!t.length)throw new Sk.builtin.ValueError("empty separator");e=e.v;var i=0;if(null===t){var r=/[\s\xa0]+/g;i=e.length,i-=(e=e.replace(k,"")).length}else r=t.replace(g,"\\$1"),r=new RegExp(r,"g");const s=[];let o,a=0,l=0;for(n=0>n?1/0:n;null!=(o=r.exec(e))&&l<n&&o.index!==r.lastIndex;)s.push(a+i),s.push(o.index+i),a=r.lastIndex,l+=1;return(null!==t||e.length-a)&&(s.push(a+i),s.push(e.length+i)),s}function s(e,t){return function(n){if(void 0===n||Sk.builtin.checkNone(n))n=e;else{if(!(n instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("strip arg must be None or str");n=i(n.v),n=new RegExp(t(n),"g")}return new Sk.builtin.str(this.v.replace(n,""))}}function o(e){return function(t){t=this.get$tgt(t);const n=this.v;let i;if(e){if(i=n.lastIndexOf(t),0>i)return new Sk.builtin.tuple([new Sk.builtin.str(""),new Sk.builtin.str(""),new Sk.builtin.str(n)])}else if(i=n.indexOf(t),0>i)return new Sk.builtin.tuple([new Sk.builtin.str(n),new Sk.builtin.str(""),new Sk.builtin.str("")]);return new Sk.builtin.tuple([new Sk.builtin.str(n.substring(0,i)),new Sk.builtin.str(t),new Sk.builtin.str(n.substring(i+t.length))])}}function a(e,t){return function(n,i){if(n=Sk.misceval.asIndexSized(n,Sk.builtin.OverflowError),void 0===i)i=" ";else{if(!(i instanceof Sk.builtin.str&&1===i.sq$length()))throw new Sk.builtin.TypeError("the fill character must be a str of length 1");i=i.v}var r=this.sq$length();return r>=n?new Sk.builtin.str(this.v):t?(r=n-r,n=Math.floor(r/2)+(r&n&1),i=i.repeat(n)+this.v+i.repeat(r-n),new Sk.builtin.str(i)):(i=i.repeat(n-r),new Sk.builtin.str(e?i+this.v:this.v+i))}}function l(e,t,n){if(({start:t,end:n}=Sk.builtin.slice.startEnd$wrt(e,t,n)),e.$hasAstralCodePoints()){const i=e.codepoints[t];t=void 0===i?t+e.v.length-e.codepoints.length:i,n=void 0===(n=e.codepoints[n])?e.v.length:n}return{start:t,end:n}}function u(e){return function(t,n,i){if(t=this.get$tgt(t),({start:n,end:i}=l(this,n,i)),i<n)return-1;if(i-=t.length,t=(t=e?this.v.lastIndexOf(t,i):this.v.indexOf(t,n))>=n&&t<=i?t:-1,this.codepoints){i=this.sq$length(),n=-1;for(let e=0;e<i;e++)t==this.codepoints[e]&&(n=e)}else n=t;return n}}function c(e,t){return function(n,i,r){if(!(n instanceof Sk.builtin.str||n instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError(e+" first arg must be str or a tuple of str, not "+Sk.abstr.typeName(n));if(({start:i,end:r}=l(this,i,r)),i>r)return Sk.builtin.bool.false$;if(i=this.v.slice(i,r),n instanceof Sk.builtin.tuple){for(let r=Sk.abstr.iter(n),s=r.tp$iternext();void 0!==s;s=r.tp$iternext()){if(!(s instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("tuple for "+e+" must only contain str, not "+Sk.abstr.typeName(s));if(t(i,s.v))return Sk.builtin.bool.true$}return Sk.builtin.bool.false$}return new Sk.builtin.bool(t(i,n.v))}}function d(e){return void 0===y[e]?e:e+"_$rw$"}e=n(1).default;var f=/^[0-9!#_]/;t=e.Zs.replace(" ","").replace("\\u0020","");const h=new RegExp("["+e.C+e.Zl+e.Zp+t+"]","u"),p=new RegExp("^["+e.Nd+"]+$","u");var m=Array(256),_=new Map;Sk.builtin.str=Sk.abstr.buildNativeClass("str",{constructor:function(e,t){if(Sk.asserts.assert(this instanceof Sk.builtin.str,"bad call to str - use 'new'"),"string"!=typeof e)if(void 0===e)e="";else if(null===e)e="None";else{if(void 0!==e.tp$str)return e.tp$str();if("number"!=typeof e)throw new Sk.builtin.TypeError("could not convert object of type '"+Sk.abstr.typeName(e)+"' to str");e=Number.isFinite(e)?String(e):String(e).replace("Infinity","inf").replace("NaN","nan")}var n=e.length;if(void 0!==(n=0===n?v:1!==n?void 0:256>(n=e.charCodeAt(0))?m[n]:void 0))return n;if(t){if(void 0!==(n=_.get(e)))return n;_.set(e,this)}this.$mangled=d(e),this.$savedKeyHash=e.replace(f,"!$&"),this.v=e,this.$hash=-1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$doc:"str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'.",tp$new(e,t){if(t=t||[],this!==Sk.builtin.str.prototype)return this.$subtype_new(e,t);if(1>=e.length&&!t.length)return new Sk.builtin.str(e[0]);if(Sk.__future__.python3){const[n,i,r]=Sk.abstr.copyKeywordsToNamedArgs("str",["object","encoding","errors"],e,t);if(void 0===n||void 0===i&&void 0===r)return new Sk.builtin.str(n);if(Sk.builtin.bytes.check$encodeArgs("str",i,r),!Sk.builtin.checkBytes(n))throw new Sk.builtin.TypeError("decoding to str: need a bytes-like object, "+Sk.abstr.typeName(n)+" found");return Sk.builtin.bytes.$decode.call(n,i,r)}throw new Sk.builtin.TypeError("str takes at most one argument ("+(e.length+t.length)+" given)")},tp$hash(){if(-1!==this.$hash)return this.$hash;const e=this.v;if(0===e.length)return this.$hash=0;let t,n=e.length,i=0;for(t=0xe9b597bd163a6^e.charCodeAt(i)<<7;0<=--n;)t=1000003*t^e.charCodeAt(++i);return t^=e.length,t^=0x621cdb4baf09f,-1===t&&(t=-2),this.$hash=t},$r(){let e="'";-1!==this.v.indexOf("'")&&-1===this.v.indexOf('"')&&(e='"');const t=this.v.length;let n=e;for(let s=0;s<t;s++){var i=this.v.charAt(s),r=this.v.charCodeAt(s);i===e||"\\"===i?n+="\\"+i:"\t"===i?n+="\\t":"\n"===i?n+="\\n":"\r"===i?n+="\\r":(255<r&&55296>r||57344<=r)&&!Sk.__future__.python3?n+="\\u"+("000"+r.toString(16)).slice(-4):55296<=r&&!Sk.__future__.python3?(i=this.v.codePointAt(s),s++,r="0000000"+(i=i.toString(16)).toString(16),n=4<i.length?n+"\\U"+r.slice(-8):n+"\\u"+r.slice(-4)):255<r&&!Sk.__future__.python3?n+="\\ufffd":" ">i||127<=r&&!Sk.__future__.python3?(2>(i=i.charCodeAt(0).toString(16)).length&&(i="0"+i),n+="\\x"+i):n+=i}return new Sk.builtin.str(n+e)},tp$str(){return this.constructor===Sk.builtin.str?this:new Sk.builtin.str(this.v)},tp$iter(){return new S(this)},tp$richcompare(e,t){if(!(e instanceof Sk.builtin.str))return Sk.builtin.NotImplemented.NotImplemented$;switch(t){case"Lt":return this.v<e.v;case"LtE":return this.v<=e.v;case"Eq":return this.v===e.v;case"NotEq":return this.v!==e.v;case"Gt":return this.v>e.v;case"GtE":return this.v>=e.v}},mp$subscript(e){let t;if(Sk.misceval.isIndex(e)){if(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError),t=this.sq$length(),0>e&&(e+=t),0>e||e>=t)throw new Sk.builtin.IndexError("string index out of range");return this.codepoints?new Sk.builtin.str(this.v.substring(this.codepoints[e],this.codepoints[e+1])):new Sk.builtin.str(this.v.charAt(e))}if(e instanceof Sk.builtin.slice){let n="";return t=this.sq$length(),this.codepoints?e.sssiter$(t,(e=>{n+=this.v.substring(this.codepoints[e],this.codepoints[e+1])})):e.sssiter$(t,(e=>{n+=this.v.charAt(e)})),new Sk.builtin.str(n)}throw new Sk.builtin.TypeError("string indices must be integers, not "+Sk.abstr.typeName(e))},sq$length(){return this.$hasAstralCodePoints()?this.codepoints.length:this.v.length},sq$concat(e){if(!(e instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("cannot concatenate 'str' and '"+Sk.abstr.typeName(e)+"' objects");return new Sk.builtin.str(this.v+e.v)},sq$repeat(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(e)+"'");if((e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError))*this.v.length>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;let t="";for(let n=0;n<e;n++)t+=this.v;return new Sk.builtin.str(t)},sq$contains(e){if(!(e instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("'in <string>' requires string as left operand not "+Sk.abstr.typeName(e));return-1!==this.v.indexOf(e.v)},tp$as_number:!0,nb$remainder:function(e){const t=this.sk$builtinBase;e.constructor===Sk.builtin.tuple||e instanceof Sk.builtin.dict||e instanceof Sk.builtin.mappingproxy||(e=new Sk.builtin.tuple([e]));var n=0,i=this.$jsstr().replace(/%(\([a-zA-Z0-9]+\))?([#0 +\-]+)?(\*|[0-9]+)?(\.(\*|[0-9]+))?[hlL]?([diouxXeEfFgGcrsb%])/g,(function(i,r,s,o,a,l,u){var c,d,f,h,p;o=Sk.builtin.asnum$(o),a=Sk.builtin.asnum$(a),void 0!==r&&""!==r||"%"==u||(c=n++),""===a&&(a=void 0);var m=d=f=h=p=!1;if(s&&(-1!==s.indexOf("-")?h=!0:-1!==s.indexOf("0")&&(p=!0),-1!==s.indexOf("+")?d=!0:-1!==s.indexOf(" ")&&(f=!0),m=-1!==s.indexOf("#")),a&&(a=parseInt(a.substr(1),10)),s=function(e,t){var n;t=Sk.builtin.asnum$(t);var i=!1;if("number"==typeof e){0>e&&(e=-e,i=!0);var r=e.toString(t)}else e instanceof Sk.builtin.float_?(2<(r=e.str$(t,!1)).length&&".0"===r.substr(-2)&&(r=r.substr(0,r.length-2)),i=e.nb$isnegative()):(e instanceof Sk.builtin.int_||e instanceof Sk.builtin.lng)&&(r=e.str$(t,!1),i=e.nb$isnegative());if(Sk.asserts.assert(void 0!==r,"unhandled number format"),e=!1,a)for(n=r.length;n<a;++n)r="0"+r,e=!0;return n="",i?n="-":d?n="+"+n:f&&(n=" "+n),m&&(16===t?n+="0x":8!==t||e||"0"===r||(n+="0")),[n,r]},i=function(e){var t=e[0];if(e=e[1],o){o=parseInt(o,10);var n=e.length+t.length;if(p)for(;n<o;++n)e="0"+e;else if(h){for(;n<o;++n)e+=" ";Sk.__future__.python3&&(e+=t,t="")}else for(;n<o;++n)t=" "+t}return t+e},e.constructor===Sk.builtin.tuple)r=e.v[c];else if(void 0!==e.mp$subscript&&void 0!==r)r=r.substring(1,r.length-1),r=e.mp$subscript(new t(r));else{if(e.constructor!==Sk.builtin.dict&&e.constructor!==Sk.builtin.list)throw new Sk.builtin.AttributeError(e.tp$name+" instance has no attribute 'mp$subscript'");r=e}if("d"===u||"i"===u){var _=s(r,10);if(void 0===_[1])throw new Sk.builtin.TypeError("%"+u+" format: a number is required, not "+Sk.abstr.typeName(r));return u=_[1],_[1]=-1!==u.indexOf(".")?parseInt(u,10).toString():u,i(_)}if("o"===u)return i(s(r,8));if("x"===u)return i(s(r,16));if("X"===u)return i(s(r,16)).toUpperCase();if("f"===u||"F"===u||"e"===u||"E"===u||"g"===u||"G"===u)return"string"==typeof(_=Sk.builtin.asnum$(r))&&(_=Number(_)),1/0===_?"inf":-1/0===_?"-inf":isNaN(_)?"nan":(c=["toExponential","toFixed","toPrecision"]["efg".indexOf(u.toLowerCase())],void 0!==a&&""!==a||("e"===u||"E"===u?a=6:"f"!==u&&"F"!==u||(a=Sk.__future__.python3?6:7)),c=_[c](a),Sk.builtin.checkFloat(r)&&0===_&&-1/0==1/_&&(c="-"+c),Sk.__future__.python3&&(7<=c.length&&"0.0000"==c.slice(0,6)&&(c=parseFloat(c).toExponential()),"-"==c.charAt(c.length-2)&&(c=c.slice(0,c.length-1)+"0"+c.charAt(c.length-1))),-1!=="EFG".indexOf(u)&&(c=c.toUpperCase()),i(["",c]));if("c"===u){if("number"==typeof r)return String.fromCharCode(r);if(r instanceof Sk.builtin.int_||r instanceof Sk.builtin.float_)return String.fromCharCode(r.v);if(r instanceof Sk.builtin.lng)return String.fromCharCode(r.str$(10,!1)[0]);if(r.constructor===Sk.builtin.str)return r.v.substr(0,1);throw new Sk.builtin.TypeError("an integer is required")}if("r"===u)return u=Sk.builtin.repr(r),a?u.v.substr(0,a):u.v;if("s"===u&&t===Sk.builtin.str)return u=(u=new Sk.builtin.str(r)).$jsstr(),a?u.substr(0,a):(o&&(u=i([" ",u])),u);if("b"===u||"s"===u){if(t===Sk.builtin.str)throw new Sk.builtin.ValueError("unsupported format character 'b'");if(!(r instanceof Sk.builtin.bytes)&&void 0===(_=Sk.abstr.lookupSpecial(r,Sk.builtin.str.$bytes)))throw new Sk.builtin.TypeError("%b requires a bytes-like object, or an object that implements __bytes__, not '"+Sk.abstr.typeName(r)+"'");return void 0!==_&&(r=new Sk.builtin.bytes(r)),u=r.$jsstr(),a?u.substr(0,a):(o&&(u=i([" ",u])),u)}return"%"===u?"%":void 0}));if(e instanceof Sk.builtin.tuple&&n<e.sq$length())throw new Sk.builtin.TypeError("not all arguments converted during string formatting");return new t(i)}},proto:{toString(){return this.v},$subtype_new(e,t){const n=new this.constructor;return e=Sk.builtin.str.prototype.tp$new(e,t),n.$mangled=e.$mangled,n.$savedKeyHash=e.$savedKeyHash,n.v=e.v,n},$jsstr(){return this.v},$hasAstralCodePoints(){if(null===this.codepoints)return!1;if(void 0!==this.codepoints)return!0;for(var e=0;e<this.v.length;e++){let t=this.v.charCodeAt(e);if(55296<=t&&57344>t){for(this.codepoints=[],e=0;e<this.v.length;e++)this.codepoints.push(e),t=this.v.charCodeAt(e),55296<=t&&56320>t&&e++;return!0}}return this.codepoints=null,!1},sk$asarray(){const e=[];if(this.$hasAstralCodePoints()){var t=this.codepoints;for(let n=0;n<t.length;n++)e.push(new Sk.builtin.str(this.v.substring(t[n],t[n+1])))}else for(t=0;t<this.v.length;t++)e.push(new Sk.builtin.str(this.v[t]));return e},find$left:u(!1),find$right:u(!0),get$tgt(e){if(e instanceof Sk.builtin.str)return e.v;throw new Sk.builtin.TypeError("a str instance is required not '"+Sk.abstr.typeName(e)+"'")},valueOf(){return this.v},$isIdentifier(){return Sk.token.isIdentifier(this.v)}},methods:{encode:{$meth:function(e,t){return({encoding:e,errors:t}=Sk.builtin.bytes.check$encodeArgs("encode",e,t)),e=Sk.builtin.bytes.str$encode(this,e,t),Sk.__future__.python3?e:new Sk.builtin.str(e.$jsstr())},$flags:{NamedArgs:["encoding","errors"]},$textsig:"($self, /, encoding='utf-8', errors='strict')",$doc:"Encode the string using the codec registered for encoding.\n\n encoding\n The encoding in which to encode the string.\n errors\n The error handling scheme to use for encoding errors.\n The default is 'strict' meaning that encoding errors raise a\n UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n 'xmlcharrefreplace' as well as any other name registered with\n codecs.register_error that can handle UnicodeEncodeErrors."},replace:{$meth(e,t,n){if(e=this.get$tgt(e),t=this.get$tgt(t),n=void 0===n?-1:Sk.misceval.asIndexSized(n,Sk.builtin.OverflowError),e=new RegExp(i(e),"g"),0>n)return new Sk.builtin.str(this.v.replace(e,t));let r=0;return e=this.v.replace(e,(e=>r++<n?t:e)),new Sk.builtin.str(e)},$flags:{MinArgs:2,MaxArgs:3},$textsig:"($self, old, new, count=-1, /)",$doc:"Return a copy with all occurrences of substring old replaced by new.\n\n count\n Maximum number of occurrences to replace.\n -1 (the default value) means replace all occurrences.\n\nIf the optional argument count is given, only the first count occurrences are\nreplaced."},split:{$meth:function(e,t){e=r(this,e,t=Sk.misceval.asIndexSized(t,Sk.builtin.OverflowError)),t=[];for(let n=0;n<e.length;n++)t.push(new Sk.builtin.str(this.v.substring(e[n],e[++n])));return new Sk.builtin.list(t)},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the words in the string, using sep as the delimiter string.\n\n sep\n The delimiter according which to split the string.\n None (the default value) means split according to any whitespace,\n and discard empty strings from the result.\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit."},rsplit:{$meth:function(e,t){t=Sk.misceval.asIndexSized(t,Sk.builtin.OverflowError),e=r(this,e,-1);var n=0>t?0:2*(e.length/2-t);for(t=[],0>=n?n=0:t.push(new Sk.builtin.str(this.v.slice(0,e[n-1])));n<e.length;n++)t.push(new Sk.builtin.str(this.v.substring(e[n],e[++n])));return new Sk.builtin.list(t)},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the words in the string, using sep as the delimiter string.\n\n sep\n The delimiter according which to split the string.\n None (the default value) means split according to any whitespace,\n and discard empty strings from the result.\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit.\n\nSplits are done starting at the end of the string and working to the front."},join:{$meth(e){const t=[];return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{if(!(e instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("sequence item "+t.length+": expected str, "+Sk.abstr.typeName(e)+" found");t.push(e.v)})),(()=>new Sk.builtin.str(t.join(this.v))))},$flags:{OneArg:!0},$textsig:"($self, iterable, /)",$doc:"Concatenate any number of strings.\n\nThe string whose method is called is inserted in between each given string.\nThe result is returned as a new string.\n\nExample: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'"},capitalize:{$meth:function(){return new Sk.builtin.str(this.v.charAt(0).toUpperCase()+this.v.slice(1).toLowerCase())},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a capitalized version of the string.\n\nMore specifically, make the first character have upper case and the rest lower\ncase."},title:{$meth:function(){const e=this.v.replace(/[a-z][a-z]*/gi,(e=>e[0].toUpperCase()+e.substr(1).toLowerCase()));return new Sk.builtin.str(e)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a version of the string where each word is titlecased.\n\nMore specifically, words start with uppercased characters and all remaining\ncased characters have lower case."},center:{$meth:a(!1,!0),$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, width, fillchar=' ', /)",$doc:"Return a centered string of length width.\n\nPadding is done using the specified fill character (default is a space)."},count:{$meth:function(e,t,n){return e=this.get$tgt(e),({start:t,end:n}=l(this,t,n)),n<t?new Sk.builtin.int_(0):(e=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),e=new RegExp(e,"g"),(t=this.v.slice(t,n).match(e))?new Sk.builtin.int_(t.length):new Sk.builtin.int_(0))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.count(sub[, start[, end]]) -> int\n\nReturn the number of non-overlapping occurrences of substring sub in\nstring S[start:end]. Optional arguments start and end are\ninterpreted as in slice notation."},expandtabs:{$meth:function(e){if(!Sk.builtin.checkInt(e))throw new Sk.builtin.TypeError("an integer is required, got type"+Sk.abstr.typeName(e));e=Sk.builtin.asnum$(e);const t=Array(e+1).join(" "),n=this.v.replace(/([^\r\n\t]*)\t/g,((n,i)=>i+t.slice(i.length%e)));return new Sk.builtin.str(n)},$flags:{NamedArgs:["tabsize"],Defaults:[8]},$textsig:"($self, /, tabsize=8)",$doc:"Return a copy where all tab characters are expanded using spaces.\n\nIf tabsize is not given, a tab size of 8 characters is assumed."},find:{$meth:function(e,t,n){return new Sk.builtin.int_(this.find$left(e,t,n))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.find(sub[, start[, end]]) -> int\n\nReturn the lowest index in S where substring sub is found,\nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},partition:{$meth:o(!1),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the string into three parts using the given separator.\n\nThis will search for the separator in the string. If the separator is found,\nreturns a 3-tuple containing the part before the separator, the separator\nitself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing the original string\nand two empty strings."},index:{$meth:function(e,t,n){if(-1===(e=this.find$left(e,t,n)))throw new Sk.builtin.ValueError("substring not found");return new Sk.builtin.int_(e)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.index(sub[, start[, end]]) -> int\n\nReturn the lowest index in S where substring sub is found, \nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the substring is not found."},ljust:{$meth:a(!1,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, width, fillchar=' ', /)",$doc:"Return a left-justified string of length width.\n\nPadding is done using the specified fill character (default is a space)."},lower:{$meth(){return new Sk.builtin.str(this.v.toLowerCase())},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a copy of the string converted to lowercase."},lstrip:{$meth:s(/^\s+/g,(e=>"^["+e+"]+")),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, chars=None, /)",$doc:"Return a copy of the string with leading whitespace removed.\n\nIf chars is given and not None, remove characters in chars instead."},removeprefix:{$meth:function(e){e=this.get$tgt(e);const t=this.v;return t.startsWith(e)?new Sk.builtin.str(t.slice(e.length)):this},$flags:{OneArg:!0},$textsig:"($self, prefix, /)",$doc:"Return a str with the given prefix string removed if present.\n\nIf the string starts with the prefix string, return string[len(prefix):].\nOtherwise, return a copy of the original string."},removesuffix:{$meth:function(e){e=this.get$tgt(e);const t=this.v;return t.endsWith(e)?new Sk.builtin.str(t.slice(0,t.length-e.length)):this},$flags:{OneArg:!0},$textsig:"($self, suffix, /)",$doc:"Return a str with the given suffix string removed if present.\n\nIf the string ends with the suffix string and that suffix is not empty,\nreturn string[:-len(suffix)]. Otherwise, return a copy of the original string."},rfind:{$meth(e,t,n){return new Sk.builtin.int_(this.find$right(e,t,n))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.rfind(sub[, start[, end]]) -> int\n\nReturn the highest index in S where substring sub is found,\nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},rindex:{$meth:function(e,t,n){if(-1===(e=this.find$right(e,t,n)))throw new Sk.builtin.ValueError("substring not found");return new Sk.builtin.int_(e)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.rindex(sub[, start[, end]]) -> int\n\nReturn the highest index in S where substring sub is found,\nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the substring is not found."},rjust:{$meth:a(!0,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, width, fillchar=' ', /)",$doc:"Return a right-justified string of length width.\n\nPadding is done using the specified fill character (default is a space)."},rstrip:{$meth:s(/\s+$/g,(e=>"["+e+"]+$")),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, chars=None, /)",$doc:"Return a copy of the string with trailing whitespace removed.\n\nIf chars is given and not None, remove characters in chars instead."},rpartition:{$meth:o(!0),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the string into three parts using the given separator.\n\nThis will search for the separator in the string, starting at the end. If\nthe separator is found, returns a 3-tuple containing the part before the\nseparator, the separator itself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing two empty strings\nand the original string."},splitlines:{$meth:function(e){e=Sk.misceval.isTrue(e);const t=this.v,n=[],i=t.length;var r=0;for(let o=0;o<i;o++){var s=t.charAt(o);"\n"===t.charAt(o+1)&&"\r"===s?(s=o+2,r=t.slice(r,s),e||(r=r.replace(/(\r|\n)/g,"")),n.push(new Sk.builtin.str(r)),r=s):("\n"===s&&"\r"!==t.charAt(o-1)||"\r"===s)&&(s=o+1,r=t.slice(r,s),e||(r=r.replace(/(\r|\n)/g,"")),n.push(new Sk.builtin.str(r)),r=s)}return r<i&&(r=t.slice(r,i),e||(r=r.replace(/(\r|\n)/g,"")),n.push(new Sk.builtin.str(r))),new Sk.builtin.list(n)},$flags:{NamedArgs:["keepends"],Defaults:[!1]},$textsig:"($self, /, keepends=False)",$doc:"Return a list of the lines in the string, breaking at line boundaries.\n\nLine breaks are not included in the resulting list unless keepends is given and\ntrue."},strip:{$meth:s(/^\s+|\s+$/g,(e=>"^["+e+"]+|["+e+"]+$")),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, chars=None, /)",$doc:"Return a copy of the string with leading and trailing whitespace remove.\n\nIf chars is given and not None, remove characters in chars instead."},swapcase:{$meth(){const e=this.v.replace(/[a-z]/gi,(e=>{const t=e.toLowerCase();return t===e?e.toUpperCase():t}));return new Sk.builtin.str(e)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Convert uppercase characters to lowercase and lowercase characters to uppercase."},upper:{$meth(){return new Sk.builtin.str(this.v.toUpperCase())},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a copy of the string converted to uppercase."},startswith:{$meth:c("startswith",((e,t)=>0===e.indexOf(t))),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.startswith(prefix[, start[, end]]) -> bool\n\nReturn True if S starts with the specified prefix, False otherwise.\nWith optional start, test S beginning at that position.\nWith optional end, stop comparing S at that position.\nprefix can also be a tuple of strings to try."},endswith:{$meth:c("endswith",((e,t)=>-1!==e.indexOf(t,e.length-t.length))),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.endswith(suffix[, start[, end]]) -> bool\n\nReturn True if S ends with the specified suffix, False otherwise.\nWith optional start, test S beginning at that position.\nWith optional end, stop comparing S at that position.\nsuffix can also be a tuple of strings to try."},isascii:{$meth(){return new Sk.builtin.bool(/^[\x00-\x7F]*$/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if all characters in the string are ASCII, False otherwise.\n\nASCII characters have code points in the range U+0000-U+007F.\nEmpty string is ASCII too."},islower:{$meth:function(){return new Sk.builtin.bool(this.v.length&&/[a-z]/.test(this.v)&&!/[A-Z]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a lowercase string, False otherwise.\n\nA string is lowercase if all cased characters in the string are lowercase and\nthere is at least one cased character in the string."},isupper:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[a-z]/.test(this.v)&&/[A-Z]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is an uppercase string, False otherwise.\n\nA string is uppercase if all cased characters in the string are uppercase and\nthere is at least one cased character in the string."},istitle:{$meth:function(){const e=this.v;let t,n=!1,i=!1;for(let r=0;r<e.length;r++)if(t=e.charAt(r),!/[a-z]/.test(t)&&/[A-Z]/.test(t)){if(i)return Sk.builtin.bool.false$;n=i=!0}else if(/[a-z]/.test(t)&&!/[A-Z]/.test(t)){if(!i)return Sk.builtin.bool.false$;n=!0}else i=!1;return new Sk.builtin.bool(n)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a title-cased string, False otherwise.\n\nIn a title-cased string, upper- and title-case characters may only\nfollow uncased characters and lowercase characters only cased ones."},isspace:{$meth:function(){return new Sk.builtin.bool(/^\s+$/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a whitespace string, False otherwise.\n\nA string is whitespace if all characters in the string are whitespace and there\nis at least one character in the string."},isdecimal:{$meth:function(){return new Sk.builtin.bool(p.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a decimal string, False otherwise.\n\nA string is a decimal string if all characters in the string are decimal digits\nand the string is not empty."},isdigit:{$meth:function(){return new Sk.builtin.bool(/^\d+$/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a digit string, False otherwise.\n\nA string is a digit string if all characters in the string are digits and there\nis at least one character in the string."},isnumeric:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[^0-9]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a numeric string, False otherwise.\n\nA string is numeric if all characters in the string are numeric and there is at\nleast one character in the string."},isalpha:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[^a-zA-Z]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is an alphabetic string, False otherwise.\n\nA string is alphabetic if all characters in the string are alphabetic and there\nis at least one character in the string."},isalnum:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[^a-zA-Z0-9]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is an alpha-numeric string, False otherwise.\n\nA string is alpha-numeric if all characters in the string are alpha-numeric and\nthere is at least one character in the string."},isidentifier:{$meth:function(){return this.$isIdentifier()?Sk.builtin.bool.true$:Sk.builtin.bool.false$},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:'Return True if the string is a valid Python identifier, False otherwise.\n\nUse keyword.iskeyword() to test for reserved identifiers such as "def" and\n"class".'},isprintable:{$meth:function(){return new Sk.builtin.bool(!h.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is printable, False otherwise.\n\nA string is printable if all of its characters are considered printable in\nrepr() or if it is empty."},zfill:{$meth:function(e){e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError);let t="";e-=this.v.length;const n="+"===this.v[0]||"-"===this.v[0]?1:0;for(let n=0;n<e;n++)t+="0";return new Sk.builtin.str(this.v.substr(0,n)+t+this.v.substr(n))},$flags:{OneArg:!0},$textsig:"($self, width, /)",$doc:"Pad a numeric string with zeros on the left, to fill a field of the given width.\n\nThe string is never truncated."},format:{$meth:Sk.formatting.format,$flags:{FastCall:!0},$textsig:null,$doc:"S.format(*args, **kwargs) -> str\n\nReturn a formatted version of S, using substitutions from args and kwargs.\nThe substitutions are identified by braces ('{' and '}')."},__format__:{$meth:Sk.formatting.formatString,$flags:{OneArg:!0},$textsig:"($self, format_spec, /)",$doc:"Return a formatted version of the string as described by format_spec."},__getnewargs__:{$meth(){return new Sk.builtin.tuple(new Sk.builtin.str(this.v))},$flags:{NoArgs:!0},$textsig:null,$doc:null}}}),Sk.exportSymbol("Sk.builtin.str",Sk.builtin.str);var b=/^[A-Za-z0-9]+$/,g=/([.*+?=|\\\/()\[\]\{\}^$])/g,k=/^[\s\xa0]+/;Sk.builtin.str.$py2decode=new Sk.builtin.method_descriptor(Sk.builtin.str,{$name:"decode",$meth(e,t){const n=new Sk.builtin.bytes(this.v);return Sk.builtin.bytes.$decode.call(n,e,t)},$flags:{NamedArgs:["encoding","errors"]}});var S=Sk.abstr.buildIteratorClass("str_iterator",{constructor:function(e){this.$index=0,e.$hasAstralCodePoints()?(this.$seq=e.codepoints,this.tp$iternext=()=>{const t=this.$seq[this.$index];if(void 0!==t)return new Sk.builtin.str(e.v.substring(t,this.$seq[++this.$index]))}):(this.$seq=e.v,this.tp$iternext=()=>{const e=this.$seq[this.$index++];if(void 0!==e)return new Sk.builtin.str(e)})},iternext(){return this.tp$iternext()},methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$unacceptableBase:!0}}),y={abstract:!0,as:!0,boolean:!0,break:!0,byte:!0,case:!0,catch:!0,char:!0,class:!0,continue:!0,const:!0,debugger:!0,default:!0,delete:!0,do:!0,double:!0,else:!0,enum:!0,export:!0,extends:!0,false:!0,final:!0,finally:!0,float:!0,for:!0,function:!0,goto:!0,if:!0,implements:!0,import:!0,in:!0,instanceof:!0,int:!0,interface:!0,is:!0,long:!0,namespace:!0,native:!0,new:!0,null:!0,package:!0,private:!0,protected:!0,public:!0,return:!0,short:!0,static:!0,super:!0,switch:!0,synchronized:!0,this:!0,throw:!0,throws:!0,transient:!0,true:!0,try:!0,typeof:!0,use:!0,var:!0,void:!0,volatile:!0,while:!0,with:!0,constructor:!0,__defineGetter__:!0,__defineSetter__:!0,apply:!0,arguments:!0,call:!0,caller:!0,eval:!0,hasOwnProperty:!0,isPrototypeOf:!0,__lookupGetter__:!0,__lookupSetter__:!0,__noSuchMethod__:!0,propertyIsEnumerable:!0,prototype:!0,toSource:!0,toLocaleString:!0,toString:!0,unwatch:!0,valueOf:!0,watch:!0,length:!0,name:!0};Sk.builtin.str.reservedWords_=y,Sk.builtin.str.$fixReserved=d;var v=new Sk.builtin.str("");for(e=0;256>e;e++)m[e]=new Sk.builtin.str(String.fromCharCode(e))},function(e,t){Sk.builtin.func=Sk.abstr.buildNativeClass("function",{constructor:function(e,t,n,i){if(Sk.asserts.assert(this instanceof Sk.builtin.func,"builtin func should be called as a class with `new`"),this.func_code=e,this.func_globals=t||null,this.$name=e.co_name||new Sk.builtin.str(e.name||"<native JS>"),this.$d=Sk.builtin.dict?new Sk.builtin.dict:void 0,this.$doc=e.co_docstring||Sk.builtin.none.none$,this.$module=Sk.globals&&Sk.globals.__name__||Sk.builtin.none.none$,this.$qualname=e.co_qualname||this.$name,void 0!==i)for(let e in i)n[e]=i[e];this.func_closure=n,this.func_annotations=null,this.$memoiseFlags(),this.memoised=e.co_fastcall||null,this.tp$call=e.co_fastcall?e.bind(this):Sk.builtin.func.prototype.$funcCall.bind(this)},slots:{tp$getattr:Sk.generic.getAttr,tp$descr_get(e,t){return null===e?this:new Sk.builtin.method(this,e)},$r(){return new Sk.builtin.str("<function "+this.$qualname+">")},tp$call(e,t){return this.tp$call(e,t)}},getsets:{__name__:{$get(){return this.$name},$set(e){if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("__name__ must be set to a string object");this.$name=e}},__qualname__:{$get(){return new Sk.builtin.str(this.$qualname)},$set(e){if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("__qualname__ must be set to a string object");this.$qualname=e}},__dict__:Sk.generic.getSetDict,__annotations__:{$get(){return null===this.func_annotations?this.func_annotations=new Sk.builtin.dict([]):Array.isArray(this.func_annotations)&&(this.func_annotations=Sk.abstr.keywordArrayToPyDict(this.func_annotations)),this.func_annotations},$set(e){if(void 0===e||Sk.builtin.checkNone(e))this.func_annotations=new Sk.builtin.dict([]);else{if(!(e instanceof Sk.builtin.dict))throw new Sk.builtin.TypeError("__annotations__ must be set to a dict object");this.func_annotations=e}}},__defaults__:{$get(){return null==this.$defaults?Sk.builtin.none.none$:new Sk.builtin.tuple(this.$defaults)},$set(e){if(void 0===e||Sk.builtin.checkNone(e))this.$defaults=null;else{if(!(e instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("__defaults__ must be set to a tuple object");this.$defaults=e.valueOf()}}},__doc__:{$get(){return this.$doc},$set(e){this.$doc=e||Sk.builtin.none.none$}},__module__:{$get(){return this.$module},$set(e){this.$module=e||Sk.builtin.none.none$}}},proto:{$memoiseFlags(){this.co_varnames=this.func_code.co_varnames,this.co_argcount=this.func_code.co_argcount,void 0===this.co_argcount&&this.co_varnames&&(this.co_argcount=this.co_varnames.length),this.co_kwonlyargcount=this.func_code.co_kwonlyargcount||0,this.co_varargs=this.func_code.co_varargs,this.co_kwargs=this.func_code.co_kwargs,this.$defaults=this.func_code.$defaults,this.$kwdefs=this.func_code.$kwdefs||[]},$resolveArgs:function(e,t){var n=this.co_argcount;void 0===n&&(n=this.co_varnames?this.co_varnames.length:e.length);var i=this.co_varnames||[],r=this.co_kwonlyargcount||0;let s,o=n+r;if(!(0!==r||this.co_kwargs||t&&0!==t.length||this.co_varargs)){if(e.length==n)return e;if(0===e.length&&this.$defaults&&this.$defaults.length===n){for(i=0;i!=this.$defaults.length;i++)e[i]=this.$defaults[i];return e}}this.co_kwargs&&(s=[]);var a=e.length;let l=e.length<=n?e:e.slice(0,n);if(this.co_varargs)e=e.length>l.length?e.slice(l.length):[],l[o]=new Sk.builtin.tuple(e);else if(a>n)throw new Sk.builtin.TypeError(`${this.$name}() takes ${n} positional ${1==n?"argument":"arguments"} but ${a} ${1==a?"was":"were"} given`);if(t){if(this.func_code.no_kw)throw new Sk.builtin.TypeError(this.$name+"() takes no keyword arguments");for(e=0;e<t.length;e+=2){a=t[e];var u=t[e+1],c=i.indexOf(a);if(0<=c){if(void 0!==l[c])throw new Sk.builtin.TypeError(this.$name+"() got multiple values for argument '"+a+"'");l[c]=u}else{if(!s)throw new Sk.builtin.TypeError(this.$name+"() got an unexpected keyword argument '"+a+"'");s.push(new Sk.builtin.str(a),u)}}}for(e=0,a=[],u=!1,c=n-(t=this.$defaults||[]).length;e<c;e++)void 0===l[e]&&(a.push(i[e]),void 0===i[e]&&(u=!0));if(0!=a.length&&(this.co_argcount||this.co_varnames))throw new Sk.builtin.TypeError(this.$name+"() missing "+a.length+" required argument"+(1==a.length?"":"s")+(u?"":": "+a.map((e=>"'"+e+"'")).join(", ")));for(;e<n;e++)void 0===l[e]&&(l[e]=t[e-c]);if(0<r){for(r=[],t=this.$kwdefs,e=n;e<o;e++)void 0===l[e]&&(void 0!==t[e-n]?l[e]=t[e-n]:r.push(i[e]));if(0!==r.length)throw new Sk.builtin.TypeError(this.$name+"() missing "+r.length+" required keyword argument"+(1==r.length?"":"s")+": "+r.join(", "))}if(this.func_closure&&i)for(n=l.length;n<i.length;n++)l.push(void 0);return s&&l.unshift(s),l},$funcCall(e,t){if(this.memoised||(this.$memoiseFlags(),this.memoised=!0),void 0===this.co_argcount&&void 0===this.co_varnames&&!this.co_kwargs&&!this.func_closure){if(t&&0!==t.length)throw new Sk.builtin.TypeError(this.$name+"() takes no keyword arguments");return this.func_code.apply(this.func_globals,e)}return e=this.$resolveArgs(e,t),this.func_closure&&e.push(this.func_closure),this.func_code.apply(this.func_globals,e)}}})},function(e,t){Sk.builtin.asnum$=function(e){return null==e||"number"==typeof e?e:e instanceof Sk.builtin.int_?"number"==typeof e.v?e.v:e.v.toString():e instanceof Sk.builtin.float_?e.v:e===Sk.builtin.none.none$?null:e},Sk.exportSymbol("Sk.builtin.asnum$",Sk.builtin.asnum$),Sk.builtin.assk$=function(e){return 0==e%1?new Sk.builtin.int_(e):new Sk.builtin.float_(e)},Sk.exportSymbol("Sk.builtin.assk$",Sk.builtin.assk$),Sk.builtin.asnum$nofloat=function(e){if(null==e)return e;if("number"==typeof e)e=e.toString();else if(e instanceof Sk.builtin.int_)e=e.v.toString();else{if(!(e instanceof Sk.builtin.float_))return e===Sk.builtin.none.none$?null:void 0;e=e.v.toString()}if(0>e.indexOf(".")&&0>e.indexOf("e")&&0>e.indexOf("E"))return e;var t=0;if(0<=e.indexOf("e")){var n=e.substr(0,e.indexOf("e"));t=e.substr(e.indexOf("e")+1)}else 0<=e.indexOf("E")?(n=e.substr(0,e.indexOf("e")),t=e.substr(e.indexOf("E")+1)):n=e;if(t=parseInt(t,10),0>(e=n.indexOf("."))){if(0<=t){for(;0<t--;)n+="0";return n}return n.length>-t?n.substr(0,n.length+t):0}for(n=0===e?n.substr(1):e<n.length?n.substr(0,e)+n.substr(e+1):n.substr(0,e),e+=t;e>n.length;)n+="0";return 0>=e?0:n.substr(0,e)},Sk.exportSymbol("Sk.builtin.asnum$nofloat",Sk.builtin.asnum$nofloat),Sk.builtin.round=function(e,t){if(void 0===e)throw new Sk.builtin.TypeError("a float is required");if(!Sk.__future__.dunder_round){if(!Sk.builtin.checkNumber(e))throw new Sk.builtin.TypeError("a float is required");if(e.round$)return e.round$(t);throw new Sk.builtin.AttributeError(Sk.abstr.typeName(e)+" instance has no attribute '__float__'")}if(void 0!==t&&!Sk.builtin.checkNone(t)&&!Sk.misceval.isIndex(t))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(t)+"' object cannot be interpreted as an index");if(void 0!==(e=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$round)))return void 0!==t?Sk.misceval.callsimArray(e,[t]):Sk.misceval.callsimArray(e,[]);throw new Sk.builtin.TypeError("a float is required")},Sk.builtin.len=function(e){if(!e.sq$length)throw new Sk.builtin.TypeError("object of type '"+Sk.abstr.typeName(e)+"' has no len()");return e=e.sq$length(!0),Sk.misceval.chain(e,(e=>new Sk.builtin.int_(e)))},Sk.builtin.min=function(e,t){let n;const i=e.length;if(!i)throw new Sk.builtin.TypeError("min expected 1 argument, got 0");const[r,s]=Sk.abstr.copyKeywordsToNamedArgs("min",["default","key"],[],t,[null,Sk.builtin.none.none$]);if(1<i&&null!==r)throw new Sk.builtin.TypeError("Cannot specify a default for min() with multiple positional arguments");if(n=1==i?Sk.abstr.iter(e[0]):Sk.abstr.iter(new Sk.builtin.tuple(e)),!Sk.builtin.checkNone(s)&&!Sk.builtin.checkCallable(s))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(s)+"' object is not callable");let o;return Sk.misceval.chain(n.tp$iternext(!0),(e=>{if(o=e,void 0!==o)return Sk.builtin.checkNone(s)?Sk.misceval.iterFor(n,(e=>{Sk.misceval.richCompareBool(e,o,"Lt")&&(o=e)})):Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(s,[o]),(e=>Sk.misceval.iterFor(n,(t=>Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(s,[t]),(n=>{Sk.misceval.richCompareBool(n,e,"Lt")&&(o=t,e=n)}))))))}),(()=>{if(void 0===o){if(null===r)throw new Sk.builtin.ValueError("min() arg is an empty sequence");o=r}return o}))},Sk.builtin.max=function(e,t){let n;const i=e.length;if(!i)throw new Sk.builtin.TypeError("max expected 1 argument, got 0");const[r,s]=Sk.abstr.copyKeywordsToNamedArgs("max",["default","key"],[],t,[null,Sk.builtin.none.none$]);if(1<i&&null!==r)throw new Sk.builtin.TypeError("Cannot specify a default for max() with multiple positional arguments");if(n=1===i?Sk.abstr.iter(e[0]):Sk.abstr.iter(new Sk.builtin.tuple(e)),!Sk.builtin.checkNone(s)&&!Sk.builtin.checkCallable(s))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(s)+"' object is not callable");let o;return Sk.misceval.chain(n.tp$iternext(!0),(e=>{if(o=e,void 0!==o)return Sk.builtin.checkNone(s)?Sk.misceval.iterFor(n,(e=>{Sk.misceval.richCompareBool(e,o,"Gt")&&(o=e)})):Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(s,[o]),(e=>Sk.misceval.iterFor(n,(t=>Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(s,[t]),(n=>{Sk.misceval.richCompareBool(n,e,"Gt")&&(o=t,e=n)}))))))}),(()=>{if(void 0===o){if(null===r)throw new Sk.builtin.ValueError("max() arg is an empty sequence");o=r}return o}))},Sk.builtin.min.co_fastcall=Sk.builtin.max.co_fastcall=1,Sk.builtin.any=function(e){return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(function(e){if(Sk.misceval.isTrue(e))return new Sk.misceval.Break(Sk.builtin.bool.true$)})),(e=>e||Sk.builtin.bool.false$))},Sk.builtin.all=function(e){return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(function(e){if(!Sk.misceval.isTrue(e))return new Sk.misceval.Break(Sk.builtin.bool.false$)})),(e=>e||Sk.builtin.bool.true$))},Sk.builtin.sum=function(e,t){const n=Sk.abstr.iter(e);if(void 0===t)var i=new Sk.builtin.int_(0);else{if(Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("sum() can't sum strings [use ''.join(seq) instead]");i=t}return e=void 0===t||t.constructor===Sk.builtin.int_?Sk.misceval.iterFor(n,(e=>{if(e.constructor!==Sk.builtin.int_)return e.constructor===Sk.builtin.float_?(i=i.nb$float().nb$add(e),new Sk.misceval.Break("float")):(i=Sk.abstr.numberBinOp(i,e,"Add"),new Sk.misceval.Break("slow"));i=i.nb$add(e)})):t.constructor===Sk.builtin.float_?"float":"slow",Sk.misceval.chain(e,(e=>"float"===e?Sk.misceval.iterFor(n,(e=>{if(e.constructor!==Sk.builtin.float_&&e.constructor!==Sk.builtin.int_)return i=Sk.abstr.numberBinOp(i,e,"Add"),new Sk.misceval.Break("slow");i=i.nb$add(e)})):e),(e=>{if("slow"===e)return Sk.misceval.iterFor(n,(e=>{i=Sk.abstr.numberBinOp(i,e,"Add")}))}),(()=>i))},Sk.builtin.zip=function(){var e,t;if(0===arguments.length)return new Sk.builtin.list([]);var n=[];for(t=0;t<arguments.length;t++){if(!Sk.builtin.checkIterable(arguments[t]))throw new Sk.builtin.TypeError("argument "+t+" must support iteration");n.push(Sk.abstr.iter(arguments[t]))}var i=[];for(e=!1;!e;){var r=[];for(t=0;t<arguments.length;t++){var s=n[t].tp$iternext();if(void 0===s){e=!0;break}r.push(s)}e||i.push(new Sk.builtin.tuple(r))}return new Sk.builtin.list(i)},Sk.builtin.abs=function(e){if(e.nb$abs)return e.nb$abs();throw new Sk.builtin.TypeError("bad operand type for abs(): '"+Sk.abstr.typeName(e)+"'")},Sk.builtin.fabs=function(e){return Sk.builtin.abs(e)},Sk.builtin.ord=function(e){if(Sk.builtin.checkString(e)){if(1!==e.v.length&&1!==e.sq$length())throw new Sk.builtin.TypeError("ord() expected a character, but string of length "+e.v.length+" found");return new Sk.builtin.int_(e.v.codePointAt(0))}if(Sk.builtin.checkBytes(e)){if(1!==e.sq$length())throw new Sk.builtin.TypeError("ord() expected a character, but string of length "+e.v.length+" found");return new Sk.builtin.int_(e.v[0])}throw new Sk.builtin.TypeError("ord() expected a string of length 1, but "+Sk.abstr.typeName(e)+" found")},Sk.builtin.chr=function(e){if(!Sk.builtin.checkInt(e))throw new Sk.builtin.TypeError("an integer is required");if(e=Sk.builtin.asnum$(e),Sk.__future__.python3){if(0>e||1114112<=e)throw new Sk.builtin.ValueError("chr() arg not in range(0x110000)")}else if(0>e||256<=e)throw new Sk.builtin.ValueError("chr() arg not in range(256)");return new Sk.builtin.str(String.fromCodePoint(e))},Sk.builtin.unichr=function(e){if(Sk.builtin.pyCheckArgsLen("unichr",arguments.length,1,1),!Sk.builtin.checkInt(e))throw new Sk.builtin.TypeError("an integer is required");e=Sk.builtin.asnum$(e);try{return new Sk.builtin.str(String.fromCodePoint(e))}catch(e){if(e instanceof RangeError)throw new Sk.builtin.ValueError(e.message);throw e}},Sk.builtin.int2str_=function(e,t,n){let i=Sk.misceval.asIndexOrThrow(e),r=i.toString(t);return r=0>i?"-"+n+r.slice(1):n+r,2!==t&&!Sk.__future__.python3&&(e instanceof Sk.builtin.lng||JSBI.__isBigInt(i))&&(r+="L"),new Sk.builtin.str(r)},Sk.builtin.hex=function(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("hex() argument can't be converted to hex");return Sk.builtin.int2str_(e,16,"0x")},Sk.builtin.oct=function(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("oct() argument can't be converted to hex");return Sk.__future__.octal_number_literal?Sk.builtin.int2str_(e,8,"0o"):Sk.builtin.int2str_(e,8,"0")},Sk.builtin.bin=function(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object can't be interpreted as an index");return Sk.builtin.int2str_(e,2,"0b")},Sk.builtin.dir=function(e){if(void 0!==e)return e=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$dir),Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(e,[]),(e=>Sk.builtin.sorted(e)));throw new Sk.builtin.NotImplementedError("skulpt does not yet support dir with no args")},Sk.builtin.repr=function(e){return e.$r()},Sk.builtin.ascii=function(e){return Sk.misceval.chain(e.$r(),(e=>{let t,n;for(n=0;n<e.v.length;n++)if(127<=e.v.charCodeAt(n)){t=e.v.substr(0,n);break}if(!t)return e;for(;n<e.v.length;n++){var i=e.v.charAt(n),r=e.v.charCodeAt(n);127<r&&255>=r?(2>(i=r.toString(16)).length&&(i="0"+i),t+="\\x"+i):127<r&&55296>r||57344<=r?t+="\\u"+("000"+r.toString(16)).slice(-4):55296<=r?(i=e.v.codePointAt(n),n++,r="0000000"+(i=i.toString(16)).toString(16),t=4<i.length?t+"\\U"+r.slice(-8):t+"\\u"+r.slice(-4)):t+=i}return new Sk.builtin.str(t)}))},Sk.builtin.open=function(e,t,n){if(void 0===t&&(t=new Sk.builtin.str("r")),/\+/.test(t.v))throw"todo; haven't implemented read/write mode";if(("w"===t.v||"wb"===t.v||"a"===t.v||"ab"===t.v)&&!Sk.nonreadopen)throw"todo; haven't implemented non-read opens";return new Sk.builtin.file(e,t,n)},Sk.builtin.isinstance=function(e,t){if(!(Sk.builtin.checkClass(t)||t instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("isinstance() arg 2 must be a class, type, or tuple of classes and types");var n=e.ob$type;if(n===t)return Sk.builtin.bool.true$;if(!(t instanceof Sk.builtin.tuple))return n.$isSubType(t)||(e=e.tp$getattr(Sk.builtin.str.$class))!=n&&Sk.builtin.checkClass(e)&&e.$isSubType(t)?Sk.builtin.bool.true$:Sk.builtin.bool.false$;for(n=0;n<t.v.length;++n)if(Sk.misceval.isTrue(Sk.builtin.isinstance(e,t.v[n])))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$},Sk.builtin.hash=function(e){return new Sk.builtin.int_(Sk.abstr.objectHash(e))},Sk.builtin.getattr=function(e,t,n){if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("attribute name must be string");const i=Sk.misceval.tryCatch((()=>e.tp$getattr(t,!0)),(e=>{if(!(e instanceof Sk.builtin.AttributeError))throw e}));return Sk.misceval.chain(i,(i=>{if(void 0===i){if(void 0!==n)return n;throw new Sk.builtin.AttributeError(e.sk$attrError()+" has no attribute "+Sk.misceval.objectRepr(t))}return i}))},Sk.builtin.setattr=function(e,t,n){if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("attribute name must be string");return Sk.misceval.chain(e.tp$setattr(t,n,!0),(()=>Sk.builtin.none.none$))},Sk.builtin.raw_input=function(e){var t=e||"";return Sk.misceval.chain(Sk.importModule("sys",!1,!0),(function(e){const n=0===e.$d.stdin.fileno;return Sk.inputfunTakesPrompt&&n?Sk.builtin.file.$readline(e.$d.stdin,null,t):Sk.misceval.chain(void 0,(()=>Sk.misceval.callsimOrSuspendArray(e.$d.stdout.write,[e.$d.stdout,new Sk.builtin.str(t)])),(()=>Sk.misceval.callsimOrSuspendArray(e.$d.stdin.readline,[e.$d.stdin])),(e=>new Sk.builtin.str(e.$jsstr().replace(/[\r\n]+$/,""))))}))},Sk.builtin.input=Sk.builtin.raw_input,Sk.builtin.jseval=function(e){return e=Sk.global.eval(Sk.ffi.remapToJs(e)),Sk.ffi.remapToPy(e)},Sk.builtin.jsmillis=function(){return console.warn("jsmillis is deprecated"),(new Date).valueOf()};const n=Sk.abstr.buildNativeClass("code",{constructor:function(e,t){this.compiled=t,this.code=t.code,this.filename=e},slots:{tp$new(e,t){throw new Sk.builtin.NotImplementedError("cannot construct a code object in skulpt")},$r(){return new Sk.builtin.str("<code object <module>, file "+this.filename+">")}}});Sk.builtin.compile=function(e,t,i,r,s,o){return Sk.builtin.pyCheckType("source","str",Sk.builtin.checkString(e)),Sk.builtin.pyCheckType("filename","str",Sk.builtin.checkString(t)),Sk.builtin.pyCheckType("mode","str",Sk.builtin.checkString(i)),e=e.$jsstr(),t=t.$jsstr(),i=i.$jsstr(),Sk.misceval.chain(Sk.compile(e,t,i,!0),(e=>new n(t,e)))},Sk.builtin.exec=function(e,t,i){let r=t&&t.__file__;if(r=void 0!==r&&Sk.builtin.checkString(r)?r.toString():"<string>",Sk.builtin.checkString(e))e=Sk.compile(e.$jsstr(),r,"exec",!0);else if("string"==typeof e)e=Sk.compile(e,r,"exec",!0);else if(!(e instanceof n))throw new Sk.builtin.TypeError("exec() arg 1 must be a string, bytes or code object");Sk.asserts.assert(void 0===t||t.constructor===Object,"internal calls to exec should be called with a javascript object for globals"),Sk.asserts.assert(void 0===i||i.constructor===Object,"internal calls to exec should be called with a javascript object for locals");const s=Sk.globals;return t=t||s,Sk.misceval.chain(e,(e=>Sk.global.eval(e.code)(t,i)),(e=>(Sk.globals=s,e)))},Sk.builtin.eval=function(e,t,i){if(Sk.builtin.checkString(e))e=e.$jsstr();else if(Sk.builtin.checkBytes(e))throw new Sk.builtin.NotImplementedError("bytes for eval is not yet implemented in skulpt");if("string"==typeof e){e=e.trim();var r=Sk.parse("?",e);if(1<(r=Sk.astFromParse(r.cst,"?",r.flags)).body.length||!(r.body[0]instanceof Sk.astnodes.Expr))throw new Sk.builtin.SyntaxError("invalid syntax");e="__final_res__ = "+e}else if(!(e instanceof n))throw new Sk.builtin.TypeError("eval() arg 1 must be a string, bytes or code object");return Sk.misceval.chain(Sk.builtin.exec(e,t,i),(e=>{const t=e.__final_res__||Sk.builtin.none.none$;return delete e.__final_res__,t}))},Sk.builtin.map=function(e,t){var n,i,r=[];if(Sk.builtin.pyCheckArgsLen("map",arguments.length,2),2<arguments.length){var s=[],o=Array.prototype.slice.apply(arguments).slice(1);for(i=0;i<o.length;i++){if(!Sk.builtin.checkIterable(o[i])){var a=parseInt(i,10)+2;throw new Sk.builtin.TypeError("argument "+a+" to map() must support iteration")}o[i]=Sk.abstr.iter(o[i])}for(;;){var l=[];for(i=n=0;i<o.length;i++)void 0===(a=o[i].tp$iternext())?(l.push(Sk.builtin.none.none$),n++):l.push(a);if(n===o.length)break;s.push(l)}t=new Sk.builtin.list(s)}if(!Sk.builtin.checkIterable(t))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(t)+"' object is not iterable");return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(t),(function(t){if(e!==Sk.builtin.none.none$)return t instanceof Array||(t=[t]),Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(e,t),(function(e){r.push(e)}));t instanceof Array&&(t=new Sk.builtin.tuple(t)),r.push(t)})),(function(){return new Sk.builtin.list(r)}))},Sk.builtin.reduce=function(e,t,n){if(!Sk.builtin.checkIterable(t))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(t)+"' object is not iterable");if(t=Sk.abstr.iter(t),void 0===n&&void 0===(n=t.tp$iternext()))throw new Sk.builtin.TypeError("reduce() of empty sequence with no initial value");var i=n;for(n=t.tp$iternext();void 0!==n;n=t.tp$iternext())i=Sk.misceval.callsimArray(e,[i,n]);return i},Sk.builtin.sorted=function(e,t,n,i){return e=Sk.misceval.arrayFromIterable(e,!0),Sk.misceval.chain(e,(e=>((e=new Sk.builtin.list(e)).list$sort(t,n,i),e)))},Sk.builtin.filter=function(e,t){var n;if(Sk.builtin.pyCheckArgsLen("filter",arguments.length,2,2),!Sk.builtin.checkIterable(t))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(t)+"' object is not iterable");var i=function(){return[]},r=function(e,t){return e.push(t),e},s=function(e){return new Sk.builtin.list(e)};t.ob$type===Sk.builtin.str?(i=function(){return new Sk.builtin.str("")},r=function(e,t){return e.sq$concat(t)},s=function(e){return e}):t.ob$type===Sk.builtin.tuple&&(s=function(e){return new Sk.builtin.tuple(e)});var o=i(),a=Sk.abstr.iter(t);for(n=a.tp$iternext();void 0!==n;n=a.tp$iternext())i=e===Sk.builtin.none.none$?new Sk.builtin.bool(n):Sk.misceval.callsimArray(e,[n]),Sk.misceval.isTrue(i)&&(o=r(o,n));return s(o)},Sk.builtin.hasattr=function(e,t){if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("hasattr(): attribute name must be string");const n=Sk.misceval.tryCatch((()=>e.tp$getattr(t,!0)),(e=>{if(!(e instanceof Sk.builtin.AttributeError))throw e}));return Sk.misceval.chain(n,(e=>void 0===e?Sk.builtin.bool.false$:Sk.builtin.bool.true$))},Sk.builtin.pow=function(e,t,n){if(void 0===n||Sk.builtin.checkNone(n))return Sk.abstr.numberBinOp(e,t,"Pow");if(!(Sk.builtin.checkInt(e)&&Sk.builtin.checkInt(t)&&Sk.builtin.checkInt(n))){if(Sk.builtin.checkFloat(e)||Sk.builtin.checkComplex(e))return e.nb$power(t,n);throw new Sk.builtin.TypeError("unsupported operand type(s) for ** or pow(): '"+Sk.abstr.typeName(e)+"', '"+Sk.abstr.typeName(t)+"', '"+Sk.abstr.typeName(n)+"'")}return e.nb$power(t,n)},Sk.builtin.quit=function(e){throw e=new Sk.builtin.str(e).v,new Sk.builtin.SystemExit(e)},Sk.builtin.issubclass=function(e,t){if(!Sk.builtin.checkClass(e))throw new Sk.builtin.TypeError("issubclass() arg 1 must be a class");var n=Sk.builtin.checkClass(t);if(!(n||t instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("issubclass() arg 2 must be a class or tuple of classes");if(n)return e.$isSubType(t)?Sk.builtin.bool.true$:Sk.builtin.bool.false$;for(n=0;n<t.v.length;++n)if(Sk.misceval.isTrue(Sk.builtin.issubclass(e,t.v[n])))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$},Sk.builtin.globals=function(){var e,t=new Sk.builtin.dict([]);for(e in Sk.globals){var n=Sk.unfixReserved(e);t.mp$ass_subscript(new Sk.builtin.str(n),Sk.globals[e])}return t},Sk.builtin.divmod=function(e,t){return Sk.abstr.numberBinOp(e,t,"DivMod")},Sk.builtin.format=function(e,t){return Sk.abstr.objectFormat(e,t)};const i=new WeakMap;let r=0;Sk.builtin.id=function(e){const t=i.get(e);return void 0!==t?new Sk.builtin.int_(t):(i.set(e,r),new Sk.builtin.int_(r++))},Sk.builtin.bytearray=function(){throw new Sk.builtin.NotImplementedError("bytearray is not yet implemented")},Sk.builtin.callable=function(e){return Sk.builtin.checkCallable(e)?Sk.builtin.bool.true$:Sk.builtin.bool.false$},Sk.builtin.delattr=function(e,t){return Sk.builtin.setattr(e,t,void 0)},Sk.builtin.execfile=function(){throw new Sk.builtin.NotImplementedError("execfile is not yet implemented")},Sk.builtin.help=function(){throw new Sk.builtin.NotImplementedError("help is not yet implemented")},Sk.builtin.iter=function(e,t){return 1===arguments.length?Sk.abstr.iter(e):Sk.abstr.iter(new Sk.builtin.callable_iter_(e,t))},Sk.builtin.locals=function(){throw new Sk.builtin.NotImplementedError("locals is not yet implemented")},Sk.builtin.memoryview=function(){throw new Sk.builtin.NotImplementedError("memoryview is not yet implemented")},Sk.builtin.next_=function(e,t){if(!e.tp$iternext)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not an iterator");return Sk.misceval.chain(e.tp$iternext(!0),(n=>{if(void 0===n){if(t)return t;if(void 0!==(n=e.gi$ret)&&n!==Sk.builtin.none.none$)throw new Sk.builtin.StopIteration(n);throw new Sk.builtin.StopIteration}return n}))},Sk.builtin.reload=function(){throw new Sk.builtin.NotImplementedError("reload is not yet implemented")},Sk.builtin.vars=function(){throw new Sk.builtin.NotImplementedError("vars is not yet implemented")},Sk.builtin.apply_=function(){throw new Sk.builtin.NotImplementedError("apply is not yet implemented")},Sk.builtin.buffer=function(){throw new Sk.builtin.NotImplementedError("buffer is not yet implemented")},Sk.builtin.coerce=function(){throw new Sk.builtin.NotImplementedError("coerce is not yet implemented")},Sk.builtin.intern=function(){throw new Sk.builtin.NotImplementedError("intern is not yet implemented")}},function(e,t){function n(e,t){return t=new this.constructor,this.ht$type&&a.call(t),t.args=new Sk.builtin.tuple(e.slice(0)),t}function i(e,t){Sk.abstr.checkNoKwargs(Sk.abstr.typeName(this),t),this.args=new Sk.builtin.tuple(e.slice(0))}function r(){return 1>=this.args.v.length?new Sk.builtin.str(this.args.v[0]):this.args.$r()}function s(e,t,n,r,s,o){s||(s=[]);const a=r?{}:{sk$solidBase:!1};return n={tp$init:r||i,tp$doc:n},o&&(n.tp$str=o),Sk.abstr.buildNativeClass(t,{base:e,constructor:function(...t){e.apply(this,t),s.forEach(((e,n)=>{this["$"+e]=Sk.ffi.remapToPy(t[n])}))},slots:n,getsets:Object.fromEntries(s.map((e=>[e,{$get(){return this["$"+e]||Sk.builtin.none.none$},$set(t){this["$"+e]=t||Sk.builtin.none.none$}}]))),flags:a})}function o(e,t,r){const s=e.prototype.tp$init;return r={tp$doc:r,tp$init:s},s===i&&(r.tp$new=n),Sk.abstr.buildNativeClass(t,{base:e,constructor:function(...t){e.apply(this,t)},slots:r,flags:{sk$solidBase:!1}})}const a=Sk.abstr.buildNativeClass("BaseException",{constructor:function e(t,...n){Sk.asserts.assert(this instanceof e,"bad call to exception constructor, use 'new'"),"string"==typeof t&&(t=new Sk.builtin.str(t)),this.args=new Sk.builtin.tuple(t?[t]:[]),this.traceback=2<=n.length?[{filename:n[0]||"<unknown>",lineno:n[1]}]:[],this.context=this.cause=null,this.$d=new Sk.builtin.dict},slots:{tp$getattr:Sk.generic.getAttr,tp$doc:"Common base class for all exceptions",tp$new:n,tp$init:i,$r(){let e=this.tp$name;return e+="("+this.args.v.map((e=>Sk.misceval.objectRepr(e))).join(", ")+")",new Sk.builtin.str(e)},tp$str:r},getsets:{args:{$get(){return this.args},$set(e){if(void 0===e)throw new Sk.builtin.TypeError("args may not be deleted");this.args=new Sk.builtin.tuple(e)}},__cause__:{$get(){return this.$cause||Sk.builtin.none.none$},$set(e){if(!(Sk.builtin.checkNone(e)||e instanceof Sk.builtin.BaseException))throw new R("exception cause must be None or derive from BaseException");this.$cause=e}},__dict__:Sk.generic.getSetDict},proto:{toString(){let e=this.tp$name;return e+=": "+this.tp$str().v,0!==this.traceback.length?e+" on line "+this.traceback[0].lineno:e+" at <unknown>"}}});e=o(a,"SystemExit","Request to exit from the interpreter."),t=o(a,"KeyboardInterrupt","Program interrupted by user.");const l=o(a,"GeneratorExit","Request that a generator exit."),u=o(a,"Exception","Common base class for all non-exit exceptions."),c=s(u,"StopIteration","Signal the end from iterator.__next__().",(function(e,t){i.call(this,e,t),this.$value=e[0]||Sk.builtin.none.none$}),["value"]),d=o(u,"StopAsyncIteration","Signal the end from iterator.__anext__()."),f=o(u,"ArithmeticError","Base class for arithmetic errors."),h=o(f,"FloatingPointError","Floating point operation failed."),p=o(f,"OverflowError","Result too large to be represented."),m=o(f,"ZeroDivisionError","Second argument to a division or modulo operation was zero."),_=o(u,"AssertionError","Assertion failed."),b=o(u,"AttributeError","Attribute not found."),g=o(u,"BufferError","Buffer error."),k=o(u,"EOFError","Read beyond end of file."),S=s(u,"ImportError","Import can't find module, or can't find name in module.",(function(e,t){i.call(this,e);const[n,r]=Sk.abstr.copyKeywordsToNamedArgs("ImportError",["name","path"],[],t);this.$name=n,this.$path=r,1===e.length&&(this.$msg=e[0])}),["msg","name","path"],(function(){return Sk.builtin.checkString(this.$msg)?this.$msg:r.call(this)})),y=o(S,"ModuleNotFoundError","Module not found."),v=o(u,"LookupError","Base class for lookup errors."),$=o(v,"IndexError","Sequence index out of range."),w=s(v,"KeyError","Mapping key not found.",null,null,(function(){return 1===this.args.v.length?this.args.v[0].$r():r.call(this)})),x=o(u,"MemoryError","Out of memory."),A=o(u,"NameError","Name not found globally."),E=o(A,"UnboundLocalError","Local name referenced but not bound to a value."),C=s(u,"OSError","Base class for I/O related errors.",(function(e,t){i.call(this,e,t)})),T=o(C,"FileNotFoundError","File not found."),N=o(C,"TimeoutError","Timeout expired."),I=o(u,"ReferenceError","Weak ref proxy used after referent went away."),B=o(u,"RuntimeError","Unspecified run-time error."),F=o(B,"NotImplementedError","Method or function hasn't been implemented yet."),M=o(B,"RecursionError","Recursion limit exceeded."),D=s(u,"SyntaxError","Invalid syntax.",(function(e,t){i.call(this,e,t),1<=e.length&&(this.$msg=e[0]),2===e.length&&(e=new Sk.builtin.tuple(e[1]).v,this.$filename=e[0],this.$lineno=e[1],this.$offset=e[2],this.$text=e[3])}),["msg","filename","lineno","offset","text"],(function(){return r.call(this)})),L=o(D,"IndentationError","Improper indentation."),j=o(L,"TabError","Improper mixture of spaces and tabs."),O=o(u,"SystemError","Internal error in the Skulpt interpreter."),R=o(u,"TypeError","Inappropriate argument type."),P=o(u,"ValueError","Inappropriate argument value (of correct type)."),q=o(P,"UnicodeError","Unicode related error."),z=o(q,"UnicodeDecodeError","Unicode decoding error."),U=o(q,"UnicodeEncodeError","Unicode encoding error.");Object.assign(Sk.builtin,{BaseException:a,SystemExit:e,KeyboardInterrupt:t,GeneratorExit:l,Exception:u,StopIteration:c,StopAsyncIteration:d,ArithmeticError:f,FloatingPointError:h,OverflowError:p,ZeroDivisionError:m,AssertionError:_,AttributeError:b,BufferError:g,EOFError:k,ImportError:S,ModuleNotFoundError:y,LookupError:v,IndexError:$,KeyError:w,MemoryError:x,NameError:A,UnboundLocalError:E,OSError:C,IOError:C,FileNotFoundError:T,TimeoutError:N,ReferenceError:I,RuntimeError:B,NotImplementedError:F,RecursionError:M,SyntaxError:D,IndentationError:L,TabError:j,SystemError:O,TypeError:R,ValueError:P,UnicodeError:q,UnicodeDecodeError:z,UnicodeEncodeError:U}),Sk.builtin.SuspensionError=o(u,"SuspensionError","Unsupported Suspension in code."),Sk.builtin.ExternalError=Sk.abstr.buildNativeClass("ExternalError",{constructor:function(...e){if(this.nativeError=e[0],!Sk.builtin.checkString(this.nativeError)&&(e[0]=this.nativeError.toString(),e[0].startsWith("RangeError: Maximum call")))return e[0]="Maximum call stack size exceeded",new M(...e);u.apply(this,e)},base:u}),Sk.builtin.getExcInfo=function(e){return new Sk.builtin.tuple([e.ob$type||Sk.builtin.none.none$,e,Sk.builtin.none.none$])}},function(e,t){Sk.builtin.method=Sk.abstr.buildNativeClass("method",{constructor:function(e,t){Sk.asserts.assert(this instanceof Sk.builtin.method,"bad call to method constructor, use 'new'"),this.im_func=e,this.im_self=t,this.im_call=e.tp$call},slots:{$r(){let e=this.im_func.tp$getattr(Sk.builtin.str.$qualname)||this.im_func.tp$getattr(Sk.builtin.str.$name);return e=e&&e.v||"?",new Sk.builtin.str("<bound method "+e+" of "+Sk.misceval.objectRepr(this.im_self)+">")},tp$hash(){return Sk.abstr.objectHash(this.im_self)+Sk.abstr.objectHash(this.im_func)},tp$call(e,t){var n=this.im_call;if(void 0===n)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this.im_func)+"' object is not callable");return e=[this.im_self,...e],n.call(this.im_func,e,t)},tp$new(e,t){if(Sk.abstr.checkNoKwargs("method",t),Sk.abstr.checkArgsLen("method",e,2,2),t=e[0],e=e[1],!Sk.builtin.checkCallable(t))throw new Sk.builtin.TypeError("first argument must be callable");if(Sk.builtin.checkNone(e))throw new Sk.builtin.TypeError("self must not be None");return new Sk.builtin.method(t,e)},tp$richcompare(e,t){if("Eq"!=t&&"NotEq"!=t||!(e instanceof Sk.builtin.method))return Sk.builtin.NotImplemented.NotImplemented$;let n;try{n=Sk.misceval.richCompareBool(this.im_self,e.im_self,"Eq",!1)&&this.im_func===e.im_func}catch(e){n=!1}return"Eq"==t?n:!n},tp$descr_get(e,t){return this},tp$getattr(e,t){const n=Sk.abstr.lookupSpecial(this,e);return void 0!==n?n:this.im_func.tp$getattr(e,t)}},getsets:{__func__:{$get(){return this.im_func}},__self__:{$get(){return this.im_self}},__doc__:{$get(){return this.im_func.tp$getattr(Sk.builtin.str.$doc)}}},flags:{sk$unacceptableBase:!0}})},function(e,t){function n(e){if(null!=e){if(!0===e.sk$int)return e.v;if(void 0!==e.nb$index)return e.nb$index();if("number"==typeof e&&Number.isInteger(e))return e}}function i(e,t){const i=n(e);if(void 0!==i)return i;throw t=(t||"'{tp$name}' object cannot be interpreted as an integer").replace("{tp$name}",Sk.abstr.typeName(e)),new Sk.builtin.TypeError(t)}Sk.misceval={},Sk.misceval.Suspension=function(e,t,n){this.$isSuspension=!0,void 0!==e&&void 0!==t&&(this.resume=function(){return e(t.resume())}),this.child=t,this.optional=void 0!==t&&t.optional,this.data=void 0===n&&void 0!==t?t.data:n},Sk.exportSymbol("Sk.misceval.Suspension",Sk.misceval.Suspension),Sk.misceval.retryOptionalSuspensionOrThrow=function(e,t){for(;e instanceof Sk.misceval.Suspension;){if(!e.optional){t=new Sk.builtin.SuspensionError(t||"Cannot call a function that blocks or suspends here");const n=[];for(;null!=e;)e.$lineno&&n.push({filename:e.$filename,lineno:e.$lineno,colno:e.$colno}),e=e.child;throw n.reverse(),t.traceback.push(...n),t}e=e.resume()}return e},Sk.exportSymbol("Sk.misceval.retryOptionalSuspensionOrThrow",Sk.misceval.retryOptionalSuspensionOrThrow),Sk.misceval.isIndex=function(e){return null!=e&&(void 0!==e.nb$index||"number"==typeof e&&Number.isInteger(e))},Sk.exportSymbol("Sk.misceval.isIndex",Sk.misceval.isIndex),Sk.misceval.asIndex=n,Sk.misceval.asIndexSized=function(e,t,n){if("number"==typeof(n=i(e,n)))return n;if(null==t)return JSBI.lessThan(n,JSBI.__ZERO)?-Number.MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER;throw new t("cannot fit '"+Sk.abstr.typeName(e)+"' into an index-sized integer")},Sk.misceval.asIndexOrThrow=i,Sk.misceval.applySlice=function(e,t,n,i){return Sk.abstr.objectGetItem(e,new Sk.builtin.slice(t,n,null),i)},Sk.exportSymbol("Sk.misceval.applySlice",Sk.misceval.applySlice),Sk.misceval.assignSlice=function(e,t,n,i,r){return t=new Sk.builtin.slice(t,n),null===i?Sk.abstr.objectDelItem(e,t):Sk.abstr.objectSetItem(e,t,i,r)},Sk.exportSymbol("Sk.misceval.assignSlice",Sk.misceval.assignSlice),Sk.misceval.arrayFromArguments=function(e){var t;if(1!=e.length)return e;var n=e[0];if(n instanceof Sk.builtin.set?n=n.tp$iter().$obj:n instanceof Sk.builtin.dict&&(n=Sk.builtin.dict.prototype.keys.func_code(n)),n instanceof Sk.builtin.list||n instanceof Sk.builtin.tuple)return n.v;if(Sk.builtin.checkIterable(n)){for(e=[],t=(n=Sk.abstr.iter(n)).tp$iternext();void 0!==t;t=n.tp$iternext())e.push(t);return e}throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(n)+"' object is not iterable")},Sk.exportSymbol("Sk.misceval.arrayFromArguments",Sk.misceval.arrayFromArguments),Sk.misceval.iterator=Sk.abstr.buildIteratorClass("iterator",{constructor:function(e,t){this.tp$iternext=t?e:function(t){let n=e();return t||void 0===n||!n.$isSuspension?n:Sk.misceval.retryOptionalSuspensionOrThrow(n)}},iternext:function(e){return this.tp$iternext(e)},flags:{sk$unacceptableBase:!0}}),Sk.misceval.swappedOp_={Eq:"Eq",NotEq:"NotEq",Lt:"Gt",LtE:"GtE",Gt:"Lt",GtE:"LtE"},Sk.misceval.opSymbols={Eq:"==",NotEq:"!=",Lt:"<",LtE:"<=",Gt:">",GtE:">=",Is:"is",IsNot:"is not",In_:"in",NotIn:"not in"},Sk.misceval.richCompareBool=function(e,t,n,i){Sk.asserts.assert(e.sk$object&&t.sk$object,"JS object passed to richCompareBool");var r=e.ob$type,s=t.ob$type,o=s!==r&&void 0===s.sk$baseClass&&s.$isSubType(r);if(!Sk.__future__.python3&&r!==s&&("GtE"===n||"Gt"===n||"LtE"===n||"Lt"===n)){var a=[Sk.builtin.float_,Sk.builtin.int_,Sk.builtin.lng,Sk.builtin.bool];const i=[Sk.builtin.dict,Sk.builtin.enumerate,Sk.builtin.filter_,Sk.builtin.list,Sk.builtin.map_,Sk.builtin.str,Sk.builtin.tuple,Sk.builtin.zip_];var l=a.indexOf(r);if(r=i.indexOf(r),a=a.indexOf(s),s=i.indexOf(s),e===Sk.builtin.none.none$)switch(n){case"Lt":case"LtE":return!0;case"Gt":case"GtE":return!1}if(t===Sk.builtin.none.none$)switch(n){case"Lt":case"LtE":return!1;case"Gt":case"GtE":return!0}if(-1!==l&&-1!==s)switch(n){case"Lt":case"LtE":return!0;case"Gt":case"GtE":return!1}if(-1!==r&&-1!==a)switch(n){case"Lt":case"LtE":return!1;case"Gt":case"GtE":return!0}if(-1!==r&&-1!==s)switch(n){case"Lt":return r<s;case"LtE":return r<=s;case"Gt":return r>s;case"GtE":return r>=s}}if("Is"===n)return e===t;if("IsNot"===n)return e!==t;if("In"===n)return Sk.misceval.chain(Sk.abstr.sequenceContains(t,e,i),Sk.misceval.isTrue);if("NotIn"===n)return Sk.misceval.chain(Sk.abstr.sequenceContains(t,e,i),(function(e){return!Sk.misceval.isTrue(e)}));if(l=(s={Eq:"ob$eq",NotEq:"ob$ne",Gt:"ob$gt",GtE:"ob$ge",Lt:"ob$lt",LtE:"ob$le"})[n],o&&(i=t[i=s[Sk.misceval.swappedOp_[n]]](e))!==Sk.builtin.NotImplemented.NotImplemented$||(i=e[l](t))!==Sk.builtin.NotImplemented.NotImplemented$||!o&&(i=t[i=s[Sk.misceval.swappedOp_[n]]](e))!==Sk.builtin.NotImplemented.NotImplemented$)return Sk.misceval.isTrue(i);if(!Sk.__future__.python3){if(o=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$cmp))try{if(i=Sk.misceval.callsimArray(o,[t]),Sk.builtin.checkNumber(i)){if(i=Sk.builtin.asnum$(i),"Eq"===n)return 0===i;if("NotEq"===n)return 0!==i;if("Lt"===n)return 0>i;if("Gt"===n)return 0<i;if("LtE"===n)return 0>=i;if("GtE"===n)return 0<=i}if(i!==Sk.builtin.NotImplemented.NotImplemented$)throw new Sk.builtin.TypeError("comparison did not return an int")}catch(e){throw new Sk.builtin.TypeError("comparison did not return an int")}if(o=Sk.abstr.lookupSpecial(t,Sk.builtin.str.$cmp))try{if(i=Sk.misceval.callsimArray(o,[e]),Sk.builtin.checkNumber(i)){if(i=Sk.builtin.asnum$(i),"Eq"===n)return 0===i;if("NotEq"===n)return 0!==i;if("Lt"===n)return 0<i;if("Gt"===n)return 0>i;if("LtE"===n)return 0<=i;if("GtE"===n)return 0>=i}if(i!==Sk.builtin.NotImplemented.NotImplemented$)throw new Sk.builtin.TypeError("comparison did not return an int")}catch(e){throw new Sk.builtin.TypeError("comparison did not return an int")}if(e===Sk.builtin.none.none$&&t===Sk.builtin.none.none$){if("Eq"===n)return e.v===t.v;if("NotEq"===n)return e.v!==t.v;if("Gt"===n)return e.v>t.v;if("GtE"===n)return e.v>=t.v;if("Lt"===n)return e.v<t.v;if("LtE"===n)return e.v<=t.v}}if("Eq"===n)return e===t;if("NotEq"===n)return e!==t;throw e=Sk.abstr.typeName(e),t=Sk.abstr.typeName(t),new Sk.builtin.TypeError("'"+Sk.misceval.opSymbols[n]+"' not supported between instances of '"+e+"' and '"+t+"'")},Sk.exportSymbol("Sk.misceval.richCompareBool",Sk.misceval.richCompareBool),Sk.misceval.objectRepr=function(e){if(Sk.asserts.assert(void 0!==e,"trying to repr undefined"),null!==e&&e.$r)return e.$r().v;try{return new Sk.builtin.str(e).v}catch(e){if(e instanceof Sk.builtin.TypeError)return"<unknown>";throw e}},Sk.exportSymbol("Sk.misceval.objectRepr",Sk.misceval.objectRepr),Sk.misceval.opAllowsEquality=function(e){switch(e){case"LtE":case"Eq":case"GtE":return!0}return!1},Sk.exportSymbol("Sk.misceval.opAllowsEquality",Sk.misceval.opAllowsEquality),Sk.misceval.isTrue=function(e){return!0===e||e===Sk.builtin.bool.true$||!1!==e&&e!==Sk.builtin.bool.false$&&null!=e&&(e.nb$bool?e.nb$bool():e.sq$length?0!==e.sq$length():!!e)},Sk.exportSymbol("Sk.misceval.isTrue",Sk.misceval.isTrue),Sk.misceval.softspace_=!1,Sk.misceval.print_=function(e){Sk.misceval.softspace_&&("\n"!==e&&Sk.output(" "),Sk.misceval.softspace_=!1);var t=new Sk.builtin.str(e);return Sk.misceval.chain(Sk.importModule("sys",!1,!0),(function(e){return Sk.misceval.apply(e.$d.stdout.write,void 0,void 0,void 0,[e.$d.stdout,t])}),(function(){var e;(e=0===t.v.length)||(e=!("\n"===(e=t.v[t.v.length-1])||"\t"===e||"\r"===e)),(e||" "===t.v[t.v.length-1])&&(Sk.misceval.softspace_=!0)}))},Sk.exportSymbol("Sk.misceval.print_",Sk.misceval.print_),Sk.misceval.loadname=function(e,t){if(void 0!==(t=t[e]))return t;if(void 0!==(t=Sk.builtins[e]))return t;throw new Sk.builtin.NameError("name '"+Sk.unfixReserved(e)+"' is not defined")},Sk.exportSymbol("Sk.misceval.loadname",Sk.misceval.loadname),Sk.misceval.call=function(e,t,n,i,r){return r=Array.prototype.slice.call(arguments,4),Sk.misceval.apply(e,t,n,i,r)},Sk.exportSymbol("Sk.misceval.call",Sk.misceval.call),Sk.misceval.callAsync=function(e,t,n,i,r,s){return s=Array.prototype.slice.call(arguments,5),Sk.misceval.applyAsync(e,t,n,i,r,s)},Sk.exportSymbol("Sk.misceval.callAsync",Sk.misceval.callAsync),Sk.misceval.callOrSuspend=function(e,t,n,i,r){return r=Array.prototype.slice.call(arguments,4),Sk.misceval.applyOrSuspend(e,t,n,i,r)},Sk.exportSymbol("Sk.misceval.callOrSuspend",Sk.misceval.callOrSuspend),Sk.misceval.callsim=function(e,t){return t=Array.prototype.slice.call(arguments,1),Sk.misceval.apply(e,void 0,void 0,void 0,t)},Sk.exportSymbol("Sk.misceval.callsim",Sk.misceval.callsim),Sk.misceval.callsimArray=function(e,t,n){return t=t||[],Sk.misceval.retryOptionalSuspensionOrThrow(Sk.misceval.callsimOrSuspendArray(e,t,n))},Sk.exportSymbol("Sk.misceval.callsimArray",Sk.misceval.callsimArray),Sk.misceval.callsimAsync=function(e,t,n){return n=Array.prototype.slice.call(arguments,2),Sk.misceval.applyAsync(e,t,void 0,void 0,void 0,n)},Sk.exportSymbol("Sk.misceval.callsimAsync",Sk.misceval.callsimAsync),Sk.misceval.callsimOrSuspend=function(e,t){return t=Array.prototype.slice.call(arguments,1),Sk.misceval.applyOrSuspend(e,void 0,void 0,void 0,t)},Sk.exportSymbol("Sk.misceval.callsimOrSuspend",Sk.misceval.callsimOrSuspend),Sk.misceval.callsimOrSuspendArray=function(e,t,n){return t=t||[],void 0!==e&&e.tp$call?e.tp$call(t,n):Sk.misceval.applyOrSuspend(e,void 0,void 0,n,t)},Sk.exportSymbol("Sk.misceval.callsimOrSuspendArray",Sk.misceval.callsimOrSuspendArray),Sk.misceval.apply=function(e,t,n,i,r){return(e=Sk.misceval.applyOrSuspend(e,t,n,i,r))instanceof Sk.misceval.Suspension?Sk.misceval.retryOptionalSuspensionOrThrow(e):e},Sk.exportSymbol("Sk.misceval.apply",Sk.misceval.apply),Sk.misceval.defaultHandlers={},Sk.misceval.asyncToPromise=function(e,t){return new Promise((function(n,i){try{!function e(r){try{for(var s=function(){try{e(r.resume())}catch(e){i(e)}},o=function(e){try{r.data.result=e,s()}catch(e){i(e)}},a=function(e){try{r.data.error=e,s()}catch(e){i(e)}};r instanceof Sk.misceval.Suspension;){const n=r.data.type;let u=t&&(t[n]||t["*"]);if(u||(u=Sk.misceval.defaultHandlers[n]||Sk.misceval.defaultHandlers["*"]),u){var l=u(r);if(l)return void l.then(e,i)}if("Sk.promise"===n)return void r.data.promise.then(o,a);if("Sk.yield"===n)return void Sk.global.setImmediate(s);if("Sk.delay"===n)return void Sk.global.setImmediate(s);if(!r.optional)throw new Sk.builtin.SuspensionError("Unhandled non-optional suspension of type '"+r.data.type+"'");r=r.resume()}n(r)}catch(e){i(e)}}(e())}catch(e){i(e)}}))},Sk.exportSymbol("Sk.misceval.asyncToPromise",Sk.misceval.asyncToPromise),Sk.misceval.applyAsync=function(e,t,n,i,r,s){return Sk.misceval.asyncToPromise((function(){return Sk.misceval.applyOrSuspend(t,n,i,r,s)}),e)},Sk.exportSymbol("Sk.misceval.applyAsync",Sk.misceval.applyAsync),Sk.misceval.chain=function(e,t){for(var n,i,r=1,s=e;;){if(r==arguments.length)return s;if(s&&s.$isSuspension)break;s=arguments[r](s),r++}for(i=Array(arguments.length-r),n=0;n<arguments.length-r;n++)i[n]=arguments[r+n];return n=0,function e(t){for(;n<i.length;){if(t instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(e,t);t=i[n](t),n++}return t}(s)},Sk.exportSymbol("Sk.misceval.chain",Sk.misceval.chain),Sk.misceval.tryCatch=function(e,t){try{var n=e()}catch(e){return t(e)}return n instanceof Sk.misceval.Suspension?((e=new Sk.misceval.Suspension(void 0,n)).resume=function(){return Sk.misceval.tryCatch(n.resume,t)},e):n},Sk.exportSymbol("Sk.misceval.tryCatch",Sk.misceval.tryCatch),Sk.misceval.iterFor=function(e,t,n){var i=n,r=function(t){return i=t,t instanceof Sk.misceval.Break?t:e.tp$iternext(!0)};return function e(n){for(;void 0!==n;){if(n instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(e,n);if(n===Sk.misceval.Break||n instanceof Sk.misceval.Break)return n.brValue;n=Sk.misceval.chain(t(n,i),r)}return i}(e.tp$iternext(!0))},Sk.exportSymbol("Sk.misceval.iterFor",Sk.misceval.iterFor),Sk.misceval.iterArray=function(e,t,n){Sk.asserts.assert(Array.isArray(e),"iterArgs requires an array");let i=0;return Sk.misceval.iterFor({tp$iternext:()=>e[i++]},t,n)},Sk.misceval.arrayFromIterable=function(e,t){if(void 0===e)return[];if(void 0===e.ht$type&&void 0!==e.sk$asarray)return e.sk$asarray();const n=[];return e=Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{n.push(e)})),(()=>n)),t?e:Sk.misceval.retryOptionalSuspensionOrThrow(e)},Sk.misceval.Break=function(e){if(!(this instanceof Sk.misceval.Break))return new Sk.misceval.Break(e);this.brValue=e},Sk.exportSymbol("Sk.misceval.Break",Sk.misceval.Break),Sk.misceval.applyOrSuspend=function(e,t,n,i,r){var s;if(null==e||e===Sk.builtin.none.none$)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not callable");"function"==typeof e&&void 0===e.tp$call&&(e=new Sk.builtin.func(e));var o=e.tp$call;if(void 0!==o){if(n)for(s=(n=n.tp$iter()).tp$iternext();void 0!==s;s=n.tp$iternext())r.push(s);if(t)for(s=(n=Sk.abstr.iter(t)).tp$iternext();void 0!==s;s=n.tp$iternext()){if(!Sk.builtin.checkString(s))throw new Sk.builtin.TypeError("Function keywords must be strings");i.push(s.v),i.push(Sk.abstr.objectGetItem(t,s,!1))}return o.call(e,r,i,t)}if(void 0!==(o=e.__call__))return r.unshift(e),Sk.misceval.apply(o,t,n,i,r);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not callable")},Sk.exportSymbol("Sk.misceval.applyOrSuspend",Sk.misceval.applyOrSuspend),Sk.misceval.promiseToSuspension=function(e){var t=new Sk.misceval.Suspension;return t.resume=function(){if(t.data.error)throw t.data.error;return t.data.result},t.data={type:"Sk.promise",promise:e},t},Sk.exportSymbol("Sk.misceval.promiseToSuspension",Sk.misceval.promiseToSuspension),Sk.misceval.buildClass=function(e,t,n,i,r,s){n=new Sk.builtin.str(n);const o=new Sk.builtin.tuple(i);let a;i=i||[];var l=!0;const u=(s=s||[]).indexOf("metaclass");-1<u?(a=s[u+1],s[u]=s[s.length-2],s[u+1]=s[s.length-1],s.pop(),s.pop(),l=Sk.builtin.checkClass(a)):a=i.length?i[0].ob$type:Sk.builtin.type,l&&(a=function(e,t){let n=e;return t.forEach((e=>{if(e=e.ob$type,!n.$isSubType(e)){if(!e.$isSubType(n))throw new Sk.builtin.TypeError("metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases");n=e}})),n}(a,i));let c=null;a!==Sk.builtin.type&&([c,f]=function(e,t,n,i,r){const s=e.tp$getattr(Sk.builtin.str.$prepare);let o,a=null;if(void 0===s)return[a,o];if(a=Sk.misceval.callsimArray(s,[t,n],i),!Sk.builtin.checkMapping(a))throw new Sk.builtin.TypeError(r?e.prototype.tp$name:"<metaclass>.__prepare__() must return a mapping not '"+Sk.abstr.typeName(a)+"'");return o={get(e,t){try{return Sk.abstr.objectGetItem(e,new Sk.builtin.str(Sk.unfixReserved(t)))}catch(e){if(!(e instanceof Sk.builtin.KeyError))throw e}},set:(e,t,n)=>(Sk.abstr.objectSetItem(e,new Sk.builtin.str(Sk.unfixReserved(t)),n),!0)},[a,o]}(a,n,o,s,l)),i=!1;let d={};if(null===c)c=new Sk.builtin.dict([]);else if(c.constructor===Sk.builtin.dict||function(){const e=(Sk.global.navigator||{}).userAgent||"";return-1<e.indexOf("MSIE ")||-1<e.indexOf("Trident/")}()){var f=Sk.abstr.iter(Sk.misceval.callsimArray(c.tp$getattr(Sk.builtin.str.$keys)));for(l=f.tp$iternext();void 0!==l;l=f.tp$iternext())Sk.builtin.checkString(l)&&(d[l.toString()]=c.mp$subscript(l))}else d=new Proxy(c,f),i=!0;return e.__name__&&(d.__module__=e.__name__),t(e,d,void 0===r?{}:r),i||Object.keys(d).forEach((e=>{Sk.abstr.objectSetItem(c,new Sk.builtin.str(e),d[e])})),Sk.misceval.callsimOrSuspendArray(a,[n,o,c],s)},Sk.exportSymbol("Sk.misceval.buildClass",Sk.misceval.buildClass)},function(e,t){Sk.builtin.callable_iter_=Sk.abstr.buildIteratorClass("callable_iterator",{constructor:function(e,t){if(!Sk.builtin.checkCallable(e))throw new Sk.builtin.TypeError("iter(v, w): v must be callable");this.$callable=e,this.$sentinel=t,this.$flag=!1},iternext(e){if(!0!==this.$flag){if(e)return e=Sk.misceval.callsimOrSuspendArray(this.$callable,[]),Sk.misceval.chain(e,(e=>{if(!Sk.misceval.richCompareBool(e,this.$sentinel,"Eq",!0))return e;this.$flag=!0}));if(e=Sk.misceval.callsimArray(this.$callable,[]),!Sk.misceval.richCompareBool(e,this.$sentinel,"Eq",!1))return e;this.$flag=!0}},flags:{sk$unacceptableBase:!0}}),Sk.builtin.seq_iter_=Sk.abstr.buildIteratorClass("iterator",{constructor:function(e){this.$index=0,this.$seq=e},iternext(e){let t;return t=Sk.misceval.tryCatch((()=>this.$seq.mp$subscript(new Sk.builtin.int_(this.$index++),e)),(e=>{if(!(e instanceof Sk.builtin.IndexError||e instanceof Sk.builtin.StopIteration))throw e;this.gi$ret=e.$value||Sk.builtin.none.none$})),e?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)},methods:{__length_hint__:{$flags:{NoArgs:!0},$meth(){if(this.$seq.sq$length)return this.$seq.sq$length()-this.$index;throw new Sk.builtin.NotImplementedError("len is not implemented for "+Sk.abstr.typeName(this.$seq))}}},flags:{sk$unacceptableBase:!0}}),Sk.exportSymbol("Sk.builtin.callable_iter_",Sk.builtin.callable_iter_)},function(e,t){Sk.builtin.list=Sk.abstr.buildNativeClass("list",{constructor:function(e){void 0===e?e=[]:Array.isArray(e)||(e=Sk.misceval.arrayFromIterable(e)),Sk.asserts.assert(this instanceof Sk.builtin.list,"bad call to list, use 'new' with an Array of python objects"),this.v=e,this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,tp$doc:"Built-in mutable sequence.\n\nIf no argument is given, the constructor creates a new empty list.\nThe argument must be an iterable if specified.",tp$new:Sk.generic.new,tp$init(e,t){return Sk.abstr.checkNoKwargs("list",t),Sk.abstr.checkArgsLen("list",e,0,1),Sk.misceval.chain(Sk.misceval.arrayFromIterable(e[0],!0),(e=>{this.v=e}))},$r(){if(this.in$repr)return new Sk.builtin.str("[...]");this.in$repr=!0;const e=this.v.map((e=>Sk.misceval.objectRepr(e)));return this.in$repr=!1,new Sk.builtin.str("["+e.join(", ")+"]")},tp$richcompare:Sk.generic.seqCompare,tp$iter(){return new n(this)},sq$length(){return this.v.length},sq$concat(e){if(!(e instanceof Sk.builtin.list))throw new Sk.builtin.TypeError("can only concatenate list to list");return new Sk.builtin.list(this.v.concat(e.v))},sq$contains(e){for(let t=this.tp$iter(),n=t.tp$iternext();void 0!==n;n=t.tp$iternext())if(n===e||Sk.misceval.richCompareBool(n,e,"Eq"))return!0;return!1},sq$repeat(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(e)+"'");if((e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError))*this.v.length>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;const t=[];for(let n=0;n<e;n++)for(let e=0;e<this.v.length;e++)t.push(this.v[e]);return new Sk.builtin.list(t)},mp$subscript(e){if(Sk.misceval.isIndex(e))return e=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError),e=this.list$inRange(e,"list index out of range"),this.v[e];if(e instanceof Sk.builtin.slice){const t=[];return e.sssiter$(this.v.length,(e=>{t.push(this.v[e])})),new Sk.builtin.list(t)}throw new Sk.builtin.TypeError("list indices must be integers or slices, not "+Sk.abstr.typeName(e))},mp$ass_subscript(e,t){void 0===t?this.del$subscript(e):this.ass$subscript(e,t)},sq$inplace_concat(e){return e===this?(this.v.push(...this.v),this):Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{this.v.push(e)})),(()=>this))},sq$inplace_repeat(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(e)+"'");e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError);const t=this.v.length;if(0>=e)this.v.length=0;else if(e*t>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;for(let n=1;n<e;n++)for(let e=0;e<t;e++)this.v.push(this.v[e]);return this}},methods:{__reversed__:{$meth(){return new i(this)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a reverse iterator over the list."},clear:{$meth(){return this.v.length=0,Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Remove all items from list."},copy:{$meth(){return new Sk.builtin.list(this.v.slice(0))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a shallow copy of the list."},append:{$meth(e){return this.v.push(e),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:"($self, object, /)",$doc:"Append object to the end of the list."},insert:{$meth(e,t){return e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError),({start:e}=Sk.builtin.slice.startEnd$wrt(this,e)),this.v.splice(e,0,t),Sk.builtin.none.none$},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($self, index, object, /)",$doc:"Insert object before index."},extend:{$meth(e){return e===this?(this.v.push(...this.v),Sk.builtin.none.none$):Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{this.v.push(e)})),(()=>Sk.builtin.none.none$))},$flags:{OneArg:!0},$textsig:"($self, iterable, /)",$doc:"Extend list by appending elements from the iterable."},pop:{$meth(e){e=void 0===e?this.v.length-1:Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError),e=this.list$inRange(e,"pop index out of range");const t=this.v[e];return this.v.splice(e,1),t},$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, index=-1, /)",$doc:"Remove and return item at index (default last).\n\nRaises IndexError if list is empty or index is out of range."},remove:{$meth(e){if(-1===(e=this.list$indexOf(e)))throw new Sk.builtin.ValueError("list.remove(x): x not in list");return this.v.splice(e,1),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:"($self, value, /)",$doc:"Remove first occurrence of value.\n\nRaises ValueError if the value is not present."},sort:{$meth(e,t){if(e.length)throw new Sk.builtin.TypeError("sort() takes no positional arguments");const[n,i]=Sk.abstr.copyKeywordsToNamedArgs("sort",["key","reverse"],e,t,[Sk.builtin.none.none$,Sk.builtin.bool.false$]);return this.list$sort(void 0,n,i)},$flags:{FastCall:!0},$textsig:"($self, /, *, key=None, reverse=False)",$doc:"Stable sort *IN PLACE*."},index:{$meth(e,t,n){if(void 0!==t&&!Sk.misceval.isIndex(t)||void 0!==n&&!Sk.misceval.isIndex(n))throw new Sk.builtin.TypeError("slice indices must be integers or have an __index__ method");if(-1===(t=this.list$indexOf(e,t,n)))throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(e)+" is not in list");return new Sk.builtin.int_(t)},$flags:{MinArgs:1,MaxArgs:3},$textsig:"($self, value, start=0, stop=sys.maxsize, /)",$doc:"Return first index of value.\n\nRaises ValueError if the value is not present."},count:{$meth(e){let t=0;const n=this.v.length;for(let i=0;i<n;i++)(this.v[i]===e||Sk.misceval.richCompareBool(this.v[i],e,"Eq"))&&(t+=1);return new Sk.builtin.int_(t)},$flags:{OneArg:!0},$textsig:"($self, value, /)",$doc:"Return number of occurrences of value."},reverse:{$meth(){return this.list$reverse(),Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Reverse *IN PLACE*."}},classmethods:Sk.generic.classGetItem,proto:{sk$asarray(){return this.v.slice(0)},list$sort:function(e,t,n){const i=null!=t&&t!==Sk.builtin.none.none$;var r=null!=e&&e!==Sk.builtin.none.none$;let s;if(void 0===n)s=!1;else{if(!Sk.builtin.checkInt(n))throw new Sk.builtin.TypeError("an integer is required");s=Sk.misceval.isTrue(n)}n=new Sk.builtin.timSort(this),this.v=[];const o=new Sk.builtin.int_(0);if(i){n.lt=r?function(t,n){return t=Sk.misceval.callsimArray(e,[t[0],n[0]]),Sk.misceval.richCompareBool(t,o,"Lt")}:function(e,t){return Sk.misceval.richCompareBool(e[0],t[0],"Lt")};for(let e=0;e<n.listlength;e++){r=n.list.v[e];const i=Sk.misceval.callsimArray(t,[r]);n.list.v[e]=[i,r]}}else r&&(n.lt=function(t,n){return t=Sk.misceval.callsimArray(e,[t,n]),Sk.misceval.richCompareBool(t,o,"Lt")});if(s&&n.list.list$reverse(),n.sort(),s&&n.list.list$reverse(),i)for(t=0;t<n.listlength;t++)r=n.list.v[t][1],n.list.v[t]=r;if(t=0<this.sq$length(),this.v=n.list.v,t)throw new Sk.builtin.ValueError("list modified during sort");return Sk.builtin.none.none$},list$inRange(e,t){if(0>e&&(e+=this.v.length),0<=e&&e<this.v.length)return e;throw new Sk.builtin.IndexError(t)},list$indexOf(e,t,n){for(({start:t,end:n}=Sk.builtin.slice.startEnd$wrt(this,t,n));t<n&&t<this.v.length;t++)if(this.v[t]===e||Sk.misceval.richCompareBool(this.v[t],e,"Eq"))return t;return-1},list$reverse(){this.v.reverse()},ass$subscript(e,t){if(Sk.misceval.isIndex(e))this.ass$index(e,t);else{if(!(e instanceof Sk.builtin.slice))throw new Sk.builtin.TypeError("list indices must be integers or slices, not "+Sk.abstr.typeName(e));{const{start:n,stop:i,step:r}=e.slice$indices(this.v.length);1===r?this.ass$slice(n,i,t):this.ass$ext_slice(e,t)}}},ass$index(e,t){e=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError),e=this.list$inRange(e,"list assignment index out of range"),this.v[e]=t},ass$slice(e,t,n){if(!Sk.builtin.checkIterable(n))throw new Sk.builtin.TypeError("can only assign an iterable");n=Sk.misceval.arrayFromIterable(n),this.v.splice(e,t-e,...n)},ass$ext_slice(e,t){const n=[];if(e.sssiter$(this.v.length,(e=>{n.push(e)})),!Sk.builtin.checkIterable(t))throw new Sk.builtin.TypeError("must assign iterable to extended slice");if(e=Sk.misceval.arrayFromIterable(t),n.length!==e.length)throw new Sk.builtin.ValueError("attempt to assign sequence of size "+e.length+" to extended slice of size "+n.length);for(t=0;t<n.length;t++)this.v.splice(n[t],1,e[t])},del$subscript(e){if(Sk.misceval.isIndex(e))this.del$index(e);else{if(!(e instanceof Sk.builtin.slice))throw new Sk.builtin.TypeError("list indices must be integers, not "+Sk.abstr.typeName(e));{const{start:t,stop:n,step:i}=e.slice$indices(this.v.length);1===i?this.del$slice(t,n):this.del$ext_slice(e,0<i?1:0)}}},del$index(e){e=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError),e=this.list$inRange(e,"list assignment index out of range"),this.v.splice(e,1)},del$slice(e,t){this.v.splice(e,t-e)},del$ext_slice(e,t){let n=0;e.sssiter$(this.v.length,(e=>{this.v.splice(e-n,1),n+=t}))},valueOf(){return this.v}}}),Sk.exportSymbol("Sk.builtin.list",Sk.builtin.list),Sk.builtin.list.py2$methods={sort:{$name:"sort",$meth(e,t){const[n,i,r]=Sk.abstr.copyKeywordsToNamedArgs("sort",["cmp","key","reverse"],e,t,[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.bool.false$]);return this.list$sort(n,i,r)},$flags:{FastCall:!0},$textsig:"($self, cmp=None, key=None, reverse=False)",$doc:"Stable sort *IN PLACE*."}};var n=Sk.abstr.buildIteratorClass("list_iterator",{constructor:function(e){this.$index=0,this.$seq=e.v},iternext:Sk.generic.iterNextWithArray,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$unacceptableBase:!0}}),i=Sk.abstr.buildIteratorClass("list_reverseiterator",{constructor:function(e){this.$index=e.v.length-1,this.$seq=e.v},iternext(){const e=this.$seq[this.$index--];if(void 0!==e)return e;this.tp$iternext=()=>{}},methods:{__length_hint__:Sk.generic.iterReverseLengthHintMethodDef},flags:{sk$unacceptableBase:!0}})},function(e,t,n){function i(e){var t=e.replace($,"").replace(w,"_").toLowerCase();return void 0===(t=v[t])?e:t}function r(e,t,n){if(void 0===t)t="utf-8";else{if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError(e+"() argument "+("bytesstr".includes(e)?2:1)+" must be str not "+Sk.abstr.typeName(t));t=t.$jsstr()}if(void 0===n)n="strict";else{if(!Sk.builtin.checkString(n))throw new Sk.builtin.TypeError(e+"() argument "+("bytesstr".includes(e)?3:2)+" must be str not "+Sk.abstr.typeName(n));n=n.$jsstr()}return{encoding:t,errors:n}}function s(e){if("strict"!==e&&"ignore"!==e&&"replace"!==e)throw new Sk.builtin.LookupError("Unsupported or invalid error type '"+e+"'")}function o(e,t,n){if(e=e.$jsstr(),t=i(t),s(n),"ascii"===t){for(r in t=[],e){const i=e.charCodeAt(r);if(127<i){if("strict"===n)throw n=a(i),new Sk.builtin.UnicodeEncodeError("'ascii' codec can't encode character '"+n+"' in position "+r+": ordinal not in range(128)");"replace"===n&&t.push(63)}else t.push(i)}var r=new Uint8Array(t)}else{if("utf-8"!==t)throw new Sk.builtin.LookupError("Unsupported or unknown encoding: '"+t+"'");r=x.encode(e)}return new Sk.builtin.bytes(r)}function a(e){var t=265>=e?"\\x":"\\u";return 3===(e=e.toString(16)).length&&(e=e.slice(1,3)),1===e.length?t+"0"+e:t+e}function l(e,t,n,i){if(e=e.decode(t),"replace"===n)return e;if("strict"===n){if(-1===(n=e.indexOf("")))return e;throw new Sk.builtin.UnicodeDecodeError(`'${i}' codec can't decode byte 0x ${t[n].toString(16)} in position ${n}: invalid start byte`)}return e.replace(/\ufffd/g,"")}function u(e,t){if(({encoding:e,errors:t}=r("decode",e,t)),e=i(e),s(t),"ascii"===e){e=this.v;var n="";for(let i=0;i<e.length;i++){const r=e[i];if(127<r){if("strict"===t)throw new Sk.builtin.UnicodeDecodeError("'ascii' codec can't decode byte 0x"+r.toString(16)+" in position "+i+": ordinal not in range(128)");"replace"===t&&(n+=String.fromCharCode(65533))}else n+=String.fromCharCode(r)}e=n}else if("utf-8"===e)e=l(A,this.v,t,e);else{try{n=new TextDecoder(e)}catch(t){throw new Sk.builtin.LookupError(`Unsupported or unknown encoding: ${e}. ${t.message}`)}e=l(n,this.v,t,e)}return new Sk.builtin.str(e)}function c(e,t){return function(n,i,r){if(!(n instanceof Sk.builtin.bytes||n instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError(e+" first arg must be bytes or a tuple of bytes, not "+Sk.abstr.typeName(n));if(({start:i,end:r}=Sk.builtin.slice.startEnd$wrt(this,i,r)),r<i)return Sk.builtin.bool.false$;if(i=this.v.subarray(i,r),n instanceof Sk.builtin.tuple){for(let e=Sk.abstr.iter(n),r=e.tp$iternext();void 0!==r;r=e.tp$iternext())if(r=this.get$raw(r),t(i,r))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$}return t(i,n.v)?Sk.builtin.bool.true$:Sk.builtin.bool.false$}}function d(e){return function(t,n,i){return t=this.get$tgt(t),({start:n,end:i}=Sk.builtin.slice.startEnd$wrt(this,n,i)),i<n?-1:"number"==typeof t?(t=e?this.v.lastIndexOf(t,i-1):this.v.indexOf(t,n))>=n&&t<i?t:-1:e?this.find$subright(t,n,i):this.find$subleft(t,n,i)}}function f(e){return function(t){let n;if(t=this.get$raw(t),e){if(n=this.find$subright(t,0,this.v.length),0>n)return new Sk.builtin.tuple([new Sk.builtin.bytes,new Sk.builtin.bytes,this])}else if(n=this.find$subleft(t,0,this.v.length),0>n)return new Sk.builtin.tuple([this,new Sk.builtin.bytes,new Sk.builtin.bytes]);return new Sk.builtin.tuple([new Sk.builtin.bytes(this.v.subarray(0,n)),new Sk.builtin.bytes(t),new Sk.builtin.bytes(this.v.subarray(n+t.length))])}}function h(e,t){return function(n){var i=void 0===n||n===Sk.builtin.none.none$?new Uint8Array([9,10,11,12,13,32,133]):this.get$raw(n);n=0;var r=this.v.length;if(e)for(;n<r&&i.includes(this.v[n]);)n++;if(t)for(;r>n&&i.includes(this.v[r-1]);)r--;for(i=new Uint8Array(r-n),r=0;r<i.length;r++)i[r]=this.v[r+n];return new Sk.builtin.bytes(i)}}function p(e,t,n){return function(i,r){if(void 0===r)r=32;else{if(!(r instanceof Sk.builtin.bytes&&1==r.v.length))throw new Sk.builtin.TypeError(e+"() argument 2 must be a byte string of length 1, not "+Sk.abstr.typeName(r));r=r.v[0]}const s=this.v.length;if((i=Sk.misceval.asIndexSized(i,Sk.builtin.OverflowError))<=s)return new Sk.builtin.bytes(this.v);const o=new Uint8Array(i);let a,l;n?(a=Math.floor((i-s)/2),l=(i-s)%2?a+1:a):t?(a=i-s,l=0):(a=0,l=i-s),o.fill(r,0,a);for(let e=0;e<s;e++)o[e+a]=this.v[e];return o.fill(r,i-l),new Sk.builtin.bytes(o)}}function m(e){return 9<=e&&13>=e||32===e}function _(e){return 97<=e&&122>=e}function b(e){return 65<=e&&90>=e}function g(e){return 48<=e&&57>=e}function k(e,t){return function(){return 0===this.v.length?t?Sk.builtin.bool.true$:Sk.builtin.bool.false$:this.v.every((t=>e(t)))?Sk.builtin.bool.true$:Sk.builtin.bool.false$}}function S(e,t){return function(){let n=!1;for(let i=0;i<this.v.length;i++){if(t(this.v[i]))return Sk.builtin.bool.false$;!n&&e(this.v[i])&&(n=!0)}return n?Sk.builtin.bool.true$:Sk.builtin.bool.false$}}function y(e){return function(){const t=new Uint8Array(this.v.length);for(let n=0;n<this.v.length;n++)t[n]=e(this.v[n]);return new Sk.builtin.bytes(t)}}n(31);const v={utf:"utf-8",utf8:"utf-8",utf_8:"utf-8",latin_1:"latin1",ascii:"ascii",utf16:"utf-16",utf_16:"utf-16"};var $=/\s+/g,w=/[_-]+/g;const x=new TextEncoder,A=new TextDecoder;Sk.builtin.bytes=Sk.abstr.buildNativeClass("bytes",{constructor:function(e){if(!(this instanceof Sk.builtin.bytes))throw new TypeError("bytes is a constructor use 'new'");if(void 0===e)this.v=new Uint8Array;else if(e instanceof Uint8Array)this.v=e;else if(Array.isArray(e))Sk.asserts.assert(e.every((e=>0<=e&&255>=e)),"bad internal call to bytes with array"),this.v=new Uint8Array(e);else if("string"==typeof e){let t;const n=new Uint8Array(e.length),i=e.length;for(let r=0;r<i;r++){if(t=e.charCodeAt(r),255<t)throw new Sk.builtin.UnicodeDecodeError("invalid string at index "+r+" (possibly contains a unicode character)");n[r]=t}this.v=n}else{if("number"!=typeof e)throw new TypeError(`bad internal argument to bytes constructor (got '${typeof e}': ${e})`);this.v=new Uint8Array(e)}},slots:{tp$getattr:Sk.generic.getAttr,tp$doc:"bytes(iterable_of_ints) -> bytes\nbytes(string, encoding[, errors]) -> bytes\nbytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\nbytes(int) -> bytes object of size given by the parameter initialized with null bytes\nbytes() -> empty bytes object\n\nConstruct an immutable array of bytes from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - any object implementing the buffer API.\n - an integer",tp$new(e,t){if(this!==Sk.builtin.bytes.prototype)return this.$subtype_new(e,t);let n;if(t=t||[],!(1>=e.length&&0==+t.length)){if([e,t,n]=Sk.abstr.copyKeywordsToNamedArgs("bytes",[null,"encoding","errors"],e,t),({encoding:t,errors:n}=r("bytes",t,n)),!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("encoding or errors without a string argument");return o(e,t,n)}if(void 0===(e=e[0]))return new Sk.builtin.bytes;if(void 0!==(t=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$bytes)))return e=Sk.misceval.callsimOrSuspendArray(t,[]),Sk.misceval.chain(e,(e=>{if(!Sk.builtin.checkBytes(e))throw new Sk.builtin.TypeError("__bytes__ returned non-bytes (type "+Sk.abstr.typeName(e)+")");return e}));if(Sk.misceval.isIndex(e)){if(0>(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError)))throw new Sk.builtin.ValueError("negative count");return new Sk.builtin.bytes(e)}if(Sk.builtin.checkBytes(e))return new Sk.builtin.bytes(e.v);if(Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("string argument without an encoding");if(Sk.builtin.checkIterable(e)){let t=[];return e=Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{if(0>(e=Sk.misceval.asIndexSized(e))||255<e)throw new Sk.builtin.ValueError("bytes must be in range(0, 256)");t.push(e)})),Sk.misceval.chain(e,(()=>new Sk.builtin.bytes(t)))}throw new Sk.builtin.TypeError("cannot convert '"+Sk.abstr.typeName(e)+"' object into bytes")},$r(){let e,t="'";const n=-1!==this.v.indexOf(34);let i="";for(let r=0;r<this.v.length;r++)if(e=this.v[r],9>e||10<e&&13>e||13<e&&32>e||126<e)i+=a(e);else if(9===e||10===e||13===e||39===e||92===e)switch(e){case 9:i+="\\t";break;case 10:i+="\\n";break;case 13:i+="\\r";break;case 39:n?i+="\\'":(i+="'",t='"');break;case 92:i+="\\\\"}else i+=String.fromCharCode(e);return new Sk.builtin.str("b"+t+i+t)},tp$str(){return this.$r()},tp$iter(){return new E(this)},tp$richcompare(e,t){if(this===e&&Sk.misceval.opAllowsEquality(t))return!0;if(!(e instanceof Sk.builtin.bytes))return Sk.builtin.NotImplemented.NotImplemented$;const n=this.v;if(e=e.v,n.length!==e.length&&("Eq"===t||"NotEq"===t))return"Eq"!==t;let i;const r=Math.min(n.length,e.length);for(i=0;i<r&&n[i]===e[i];i++);switch(t){case"Lt":return i===r&&n.length<e.length||n[i]<e[i];case"LtE":return i===r&&n.length<=e.length||n[i]<=e[i];case"Eq":return i===r;case"NotEq":return i<r;case"Gt":return i===r&&n.length>e.length||n[i]>e[i];case"GtE":return i===r&&n.length>=e.length||n[i]>=e[i]}},tp$hash(){return new Sk.builtin.str(this.$jsstr()).tp$hash()},tp$as_sequence_or_mapping:!0,mp$subscript(e){if(Sk.misceval.isIndex(e)){let t=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError);if(void 0!==t){if(0>t&&(t=this.v.length+t),0>t||t>=this.v.length)throw new Sk.builtin.IndexError("index out of range");return new Sk.builtin.int_(this.v[t])}}else if(e instanceof Sk.builtin.slice){const t=[];return e.sssiter$(this.v.length,(e=>{t.push(this.v[e])})),new Sk.builtin.bytes(new Uint8Array(t))}throw new Sk.builtin.TypeError("byte indices must be integers or slices, not "+Sk.abstr.typeName(e))},sq$length(){return this.v.length},sq$concat(e){if(!(e instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("can't concat "+Sk.abstr.typeName(e)+" to bytes");const t=new Uint8Array(this.v.length+e.v.length);let n;for(n=0;n<this.v.length;n++)t[n]=this.v[n];for(let i=0;i<e.v.length;i++,n++)t[n]=e.v[i];return new Sk.builtin.bytes(t)},sq$repeat(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(e)+"'");const t=(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError))*this.v.length;if(t>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;if(0>=e)return new Sk.builtin.bytes;e=new Uint8Array(t);let n=0;for(;n<t;)for(let t=0;t<this.v.length;t++)e[n++]=this.v[t];return new Sk.builtin.bytes(e)},sq$contains(e){return-1!==this.find$left(e)},tp$as_number:!0,nb$remainder:Sk.builtin.str.prototype.nb$remainder},proto:{$jsstr(){let e="";for(let t=0;t<this.v.length;t++)e+=String.fromCharCode(this.v[t]);return e},get$tgt(e){if(e instanceof Sk.builtin.bytes)return e.v;if(0>(e=Sk.misceval.asIndexOrThrow(e,"argument should be integer or bytes-like object, not {tp$name}"))||255<e)throw new Sk.builtin.ValueError("bytes must be in range(0, 256)");return e},get$raw(e){if(e instanceof Sk.builtin.bytes)return e.v;throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(e)+"'")},get$splitArgs:function(e,t){if(t=0>(t=Sk.misceval.asIndexSized(t,Sk.builtin.OverflowError))?1/0:t,null!==(e=Sk.builtin.checkNone(e)?null:this.get$raw(e))&&!e.length)throw new Sk.builtin.ValueError("empty separator");return{sep:e,maxsplit:t}},find$left:d(!1),find$right:d(!0),find$subleft:function(e,t,n){n=n-e.length+1;let i=t;for(;i<n;){if(e.every(((e,t)=>e===this.v[i+t])))return i;i++}return-1},find$subright(e,t,n){let i=n-e.length;for(;i>=t;){if(e.every(((e,t)=>e===this.v[i+t])))return i;i--}return-1},$subtype_new(e,t){const n=new this.constructor;return e=Sk.builtin.bytes.prototype.tp$new(e,t),n.v=e.v,n},sk$asarray(){const e=[];return this.v.forEach((t=>{e.push(new Sk.builtin.int_(t))})),e},valueOf(){return this.v}},flags:{str$encode:o,$decode:u,check$encodeArgs:r},methods:{__getnewargs__:{$meth(){return new Sk.builtin.tuple(new Sk.builtin.bytes(this.v))},$flags:{NoArgs:!0},$textsig:null,$doc:null},capitalize:{$meth(){const e=this.v.length;if(0===e)return new Sk.builtin.bytes(this.v);const t=new Uint8Array(e);let n=this.v[0];t[0]=_(n)?n-32:n;for(let i=1;i<e;i++)n=this.v[i],t[i]=b(n)?n+32:n;return new Sk.builtin.bytes(t)},$flags:{NoArgs:!0},$textsig:null,$doc:"B.capitalize() -> copy of B\n\nReturn a copy of B with only its first character capitalized (ASCII)\nand the rest lower-cased."},center:{$meth:p("center",!1,!0),$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"B.center(width[, fillchar]) -> copy of B\n\nReturn B centered in a string of length width. Padding is\ndone using the specified fill character (default is a space)."},count:{$meth(e,t,n){e=this.get$tgt(e),({start:t,end:n}=Sk.builtin.slice.startEnd$wrt(this,t,n));let i=0;if("number"==typeof e)for(;t<n;t++)this.v[t]===e&&i++;else{n=n-e.length+1;for(let r=t;r<n;r++)e.every(((e,t)=>e===this.v[r+t]))&&(i++,r+=e.length-1)}return new Sk.builtin.int_(i)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.count(sub[, start[, end]]) -> int\n\nReturn the number of non-overlapping occurrences of subsection sub in\nbytes B[start:end]. Optional arguments start and end are interpreted\nas in slice notation."},decode:{$meth:u,$flags:{NamedArgs:["encoding","errors"]},$textsig:"($self, /, encoding='utf-8', errors='strict')",$doc:"Decode the bytes using the codec registered for encoding.\n\n encoding\n The encoding with which to decode the bytes.\n errors\n The error handling scheme to use for the handling of decoding errors.\n The default is 'strict' meaning that decoding errors raise a\n UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n as well as any other name registered with codecs.register_error that\n can handle UnicodeDecodeErrors."},endswith:{$meth:c("endswith",((e,t)=>{const n=e.length-t.length;return 0<=n&&t.every(((t,i)=>t===e[n+i]))})),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.endswith(suffix[, start[, end]]) -> bool\n\nReturn True if B ends with the specified suffix, False otherwise.\nWith optional start, test B beginning at that position.\nWith optional end, stop comparing B at that position.\nsuffix can also be a tuple of bytes to try."},expandtabs:{$meth(e){e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError,"an integer is required (got type {tp$nam})");const t=[];let n=0;for(let r=0;r<this.v.length;r++){var i=this.v[r];9===i?(i=e-n%e,t.push(...Array(i).fill(32)),n+=i):10===i||13===i?(t.push(i),n=0):(t.push(i),n++)}return new Sk.builtin.bytes(new Uint8Array(t))},$flags:{NamedArgs:["tabsize"],Defaults:[8]},$textsig:null,$doc:"B.expandtabs(tabsize=8) -> copy of B\n\nReturn a copy of B where all tab characters are expanded using spaces.\nIf tabsize is not given, a tab size of 8 characters is assumed."},find:{$meth:function(e,t,n){return new Sk.builtin.int_(this.find$left(e,t,n))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.find(sub[, start[, end]]) -> int\n\nReturn the lowest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},hex:{$meth(){let e="";for(let t=0;t<this.v.length;t++)e+=this.v[t].toString(16).padStart(2,"0");return new Sk.builtin.str(e)},$flags:{NoArgs:!0},$textsig:null,$doc:"B.hex() -> string\n\nCreate a string of hexadecimal numbers from a bytes object.\nExample: b'\\xb9\\x01\\xef'.hex() -> 'b901ef'."},index:{$meth:function(e,t,n){if(-1===(e=this.find$left(e,t,n)))throw new Sk.builtin.ValueError("subsection not found");return new Sk.builtin.int_(e)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.index(sub[, start[, end]]) -> int\n\nReturn the lowest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the subsection is not found."},isalnum:{$meth:k((e=>g(e)||_(e)||b(e))),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isalnum() -> bool\n\nReturn True if all characters in B are alphanumeric\nand there is at least one character in B, False otherwise."},isalpha:{$meth:k((e=>65<=e&&90>=e||97<=e&&122>=e)),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isalpha() -> bool\n\nReturn True if all characters in B are alphabetic\nand there is at least one character in B, False otherwise."},isascii:{$meth:k((e=>0<=e&&127>=e),!0),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isascii() -> bool\n\nReturn True if B is empty or all characters in B are ASCII,\nFalse otherwise."},isdigit:{$meth:k(g),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isdigit() -> bool\n\nReturn True if all characters in B are digits\nand there is at least one character in B, False otherwise."},islower:{$meth:S(_,b),$flags:{NoArgs:!0},$textsig:null,$doc:"B.islower() -> bool\n\nReturn True if all cased characters in B are lowercase and there is\nat least one cased character in B, False otherwise."},isspace:{$meth:k(m),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isspace() -> bool\n\nReturn True if all characters in B are whitespace\nand there is at least one character in B, False otherwise."},istitle:{$meth:function(){let e=!1,t=!1;for(let n=0;n<this.v.length;n++){const i=this.v[n];if(b(i)){if(e)return Sk.builtin.bool.false$;t=e=!0}else if(_(i)){if(!e)return Sk.builtin.bool.false$;t=!0}else e=!1}return t?Sk.builtin.bool.true$:Sk.builtin.bool.false$},$flags:{NoArgs:!0},$textsig:null,$doc:"B.istitle() -> bool\n\nReturn True if B is a titlecased string and there is at least one\ncharacter in B, i.e. uppercase characters may only follow uncased\ncharacters and lowercase characters only cased ones. Return False\notherwise."},isupper:{$meth:S(b,_),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isupper() -> bool\n\nReturn True if all cased characters in B are uppercase and there is\nat least one cased character in B, False otherwise."},join:{$meth(e){const t=[];let n=0;return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{if(!(e instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("sequence item "+n+": expected a bytes-like object, "+Sk.abstr.typeName(e)+" found");n++,t.length&&t.push(...this.v),t.push(...e.v)})),(()=>new Sk.builtin.bytes(new Uint8Array(t))))},$flags:{OneArg:!0},$textsig:"($self, iterable_of_bytes, /)",$doc:"Concatenate any number of bytes objects.\n\nThe bytes whose method is called is inserted in between each pair.\n\nThe result is returned as a new bytes object.\n\nExample: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'."},ljust:{$meth:p("ljust",!1,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"B.ljust(width[, fillchar]) -> copy of B\n\nReturn B left justified in a string of length width. Padding is\ndone using the specified fill character (default is a space)."},lower:{$meth:y((e=>b(e)?e+32:e)),$flags:{NoArgs:!0},$textsig:null,$doc:"B.lower() -> copy of B\n\nReturn a copy of B with all ASCII characters converted to lowercase."},lstrip:{$meth:h(!0,!1),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, bytes=None, /)",$doc:"Strip leading bytes contained in the argument.\n\nIf the argument is omitted or None, strip leading ASCII whitespace."},partition:{$meth:f(!1),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the bytes into three parts using the given separator.\n\nThis will search for the separator sep in the bytes. If the separator is found,\nreturns a 3-tuple containing the part before the separator, the separator\nitself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing the original bytes\nobject and two empty bytes objects."},replace:{$meth(e,t,n){e=this.get$raw(e),t=this.get$raw(t),n=0>(n=void 0===n?-1:Sk.misceval.asIndexSized(n,Sk.builtin.OverflowError))?1/0:n;const i=[];let r=0;for(var s=0;s<this.v.length&&r<n;){const n=this.find$subleft(e,s,this.v.length);if(-1===n)break;for(;s<n;s++)i.push(this.v[s]);i.push(...t),s=n+e.length,r++}for(;s<this.v.length;s++)i.push(this.v[s]);return new Sk.builtin.bytes(new Uint8Array(i))},$flags:{MinArgs:2,MaxArgs:3},$textsig:"($self, old, new, count=-1, /)",$doc:"Return a copy with all occurrences of substring old replaced by new.\n\n count\n Maximum number of occurrences to replace.\n -1 (the default value) means replace all occurrences.\n\nIf the optional argument count is given, only the first count occurrences are\nreplaced."},rfind:{$meth(e,t,n){return new Sk.builtin.int_(this.find$right(e,t,n))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.rfind(sub[, start[, end]]) -> int\n\nReturn the highest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},rindex:{$meth:function(e,t,n){if(-1===(e=this.find$right(e,t,n)))throw new Sk.builtin.ValueError("subsection not found");return new Sk.builtin.int_(e)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.rindex(sub[, start[, end]]) -> int\n\nReturn the highest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaise ValueError when the subsection is not found."},rjust:{$meth:p("rjust",!0,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"B.rjust(width[, fillchar]) -> copy of B\n\nReturn B right justified in a string of length width. Padding is\ndone using the specified fill character (default is a space)"},rpartition:{$meth:f(!0),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the bytes into three parts using the given separator.\n\nThis will search for the separator sep in the bytes, starting at the end. If\nthe separator is found, returns a 3-tuple containing the part before the\nseparator, the separator itself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing two empty bytes\nobjects and the original bytes object."},rsplit:{$meth:function(e,t){({sep:e,maxsplit:t}=this.get$splitArgs(e,t));const n=[];let i=0,r=this.v.length;if(null!==e){for(;0<=r&&i<t;){const t=this.find$subright(e,0,r);if(-1===t)break;n.push(new Sk.builtin.bytes(this.v.subarray(t+e.length,r))),r=t,i++}n.push(new Sk.builtin.bytes(this.v.subarray(0,r)))}else{for(r--;i<t;){for(;m(this.v[r]);)r--;if(0>r)break;for(e=r+1,r--;0<=r&&!m(this.v[r]);)r--;n.push(new Sk.builtin.bytes(this.v.subarray(r+1,e))),i++}if(0<=r){for(;m(this.v[r]);)r--;0<=r&&n.push(new Sk.builtin.bytes(this.v.subarray(0,r+1)))}}return new Sk.builtin.list(n.reverse())},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the sections in the bytes, using sep as the delimiter.\n\n sep\n The delimiter according which to split the bytes.\n None (the default value) means split on ASCII whitespace characters\n (space, tab, return, newline, formfeed, vertical tab).\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit.\n\nSplitting is done starting at the end of the bytes and working to the front."},rstrip:{$meth:h(!1,!0),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, bytes=None, /)",$doc:"Strip trailing bytes contained in the argument.\n\nIf the argument is omitted or None, strip trailing ASCII whitespace."},split:{$meth:function(e,t){({sep:e,maxsplit:t}=this.get$splitArgs(e,t));const n=[],i=this.v.length;let r=0,s=0;if(null!==e){for(;s<i&&r<t;){const t=this.find$subleft(e,s,i);if(-1===t)break;n.push(new Sk.builtin.bytes(this.v.subarray(s,t))),s=t+e.length,r++}n.push(new Sk.builtin.bytes(this.v.subarray(s,i)))}else{for(;r<t;){for(;m(this.v[s]);)s++;if(s===i)break;for(e=s,s++;s<i&&!m(this.v[s]);)s++;n.push(new Sk.builtin.bytes(this.v.subarray(e,s))),r++}if(s<i){for(;m(this.v[s]);)s++;s<i&&n.push(new Sk.builtin.bytes(this.v.subarray(s,i)))}}return new Sk.builtin.list(n)},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the sections in the bytes, using sep as the delimiter.\n\n sep\n The delimiter according which to split the bytes.\n None (the default value) means split on ASCII whitespace characters\n (space, tab, return, newline, formfeed, vertical tab).\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit."},splitlines:{$meth(e){e=Sk.misceval.isTrue(e);const t=[];let n=0,i=0;const r=this.v.length;for(;i<r;){var s=this.v[i];if(13===s){const r=10===this.v[i+1];s=e?r?i+2:i+1:i,t.push(new Sk.builtin.bytes(this.v.subarray(n,s))),i=n=r?i+2:i+1}else 10===s?(s=e?i+1:i,t.push(new Sk.builtin.bytes(this.v.subarray(n,s))),i=n=i+1):i++}return n<r&&t.push(new Sk.builtin.bytes(this.v.subarray(n,r))),new Sk.builtin.list(t)},$flags:{NamedArgs:["keepends"],Defaults:[!1]},$textsig:"($self, /, keepends=False)",$doc:"Return a list of the lines in the bytes, breaking at line boundaries.\n\nLine breaks are not included in the resulting list unless keepends is given and\ntrue."},startswith:{$meth:c("startswith",((e,t)=>t.length<=e.length&&t.every(((t,n)=>t===e[n])))),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.startswith(prefix[, start[, end]]) -> bool\n\nReturn True if B starts with the specified prefix, False otherwise.\nWith optional start, test B beginning at that position.\nWith optional end, stop comparing B at that position.\nprefix can also be a tuple of bytes to try."},strip:{$meth:h(!0,!0),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, bytes=None, /)",$doc:"Strip leading and trailing bytes contained in the argument.\n\nIf the argument is omitted or None, strip leading and trailing ASCII whitespace."},swapcase:{$meth:y((e=>b(e)?e+32:_(e)?e-32:e)),$flags:{NoArgs:!0},$textsig:null,$doc:"B.swapcase() -> copy of B\n\nReturn a copy of B with uppercase ASCII characters converted\nto lowercase ASCII and vice versa."},title:{$meth(){const e=this.v.length,t=new Uint8Array(e);let n=!1;for(let i=0;i<e;i++){const e=this.v[i];b(e)?(t[i]=n?e+32:e,n=!0):_(e)?(t[i]=n?e:e-32,n=!0):(t[i]=e,n=!1)}return new Sk.builtin.bytes(t)},$flags:{NoArgs:!0},$textsig:null,$doc:"B.title() -> copy of B\n\nReturn a titlecased version of B, i.e. ASCII words start with uppercase\ncharacters, all remaining cased characters have lowercase."},upper:{$meth:y((e=>_(e)?e-32:e)),$flags:{NoArgs:!0},$textsig:null,$doc:"B.upper() -> copy of B\n\nReturn a copy of B with all ASCII characters converted to uppercase."},zfill:{$meth(e){const t=(e=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError))-this.v.length;if(0>=t)return new Sk.builtin.bytes(this.v);const n=new Uint8Array(e);let i,r=0;for(43!==this.v[0]&&45!==this.v[0]||(n[0]=this.v[0],r++),n.fill(48,r,r+t),i=r,r+=t;r<e;r++,i++)n[r]=this.v[i];return new Sk.builtin.bytes(n)},$flags:{OneArg:!0},$textsig:null,$doc:"B.zfill(width) -> copy of B\n\nPad a numeric string B with zeros on the left, to fill a field\nof the specified width. B is never truncated."}},classmethods:{fromhex:{$meth:function(e){function t(t){for(let n=o;n<t;n+=2){let t=e.substr(n,2);if(!i.test(t))throw new Sk.builtin.ValueError("non-hexadecimal number found in fromhex() arg at position "+(n+1));r.push(parseInt(t,16))}}if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("fromhex() argument must be str, not "+Sk.abstr.typeName(e));e=e.$jsstr();const n=/\s+/g,i=/^[abcdefABCDEF0123456789]{2}$/,r=[];let s,o=0;for(;null!==(s=n.exec(e));)t(s.index),o=n.lastIndex;return t(e.length),new this(r)},$flags:{OneArg:!0},$textsig:"($type, string, /)",$doc:"Create a bytes object from a string of hexadecimal numbers.\n\nSpaces between two numbers are accepted.\nExample: bytes.fromhex('B9 01EF') -> b'\\\\xb9\\\\x01\\\\xef'."}}});var E=Sk.abstr.buildIteratorClass("bytes_iterator",{constructor:function(e){this.$index=0,this.$seq=e.v},iternext(){const e=this.$seq[this.$index++];if(void 0!==e)return new Sk.builtin.int_(e)},methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$unacceptableBase:!0}});Sk.exportSymbol("Sk.builtin.bytes",Sk.builtin.bytes)},function(e,t,n){(function(e){!function(e){function t(){}function n(){}var i=String.fromCharCode,r={}.toString,s=r.call(e.SharedArrayBuffer),o=r(),a=e.Uint8Array,l=a||Array,u=a?ArrayBuffer:l,c=u.isView||function(e){return e&&"length"in e},d=r.call(u.prototype);u=n.prototype;var f=e.TextEncoder,h=new(a?Uint16Array:l)(32);t.prototype.decode=function(e){if(!c(e)){var t=r.call(e);if(t!==d&&t!==s&&t!==o)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");e=a?new l(e):e||[]}for(var n,u,f,p=t="",m=0,_=0|e.length,b=_-32|0,g=0,k=0,S=0,y=-1;m<_;){for(n=m<=b?32:_-m|0;S<n;m=m+1|0,S=S+1|0){switch((u=255&e[m])>>4){case 15:if(2!=(f=255&e[m=m+1|0])>>6||247<u){m=m-1|0;break}g=(7&u)<<6|63&f,k=5,u=256;case 14:g<<=6,g|=(15&u)<<6|63&(f=255&e[m=m+1|0]),k=2==f>>6?k+4|0:24,u=u+256&768;case 13:case 12:g<<=6,g|=(31&u)<<6|63&(f=255&e[m=m+1|0]),k=k+7|0,m<_&&2==f>>6&&g>>k&&1114112>g?(u=g,0<=(g=g-65536|0)&&(y=55296+(g>>10)|0,u=56320+(1023&g)|0,31>S?(h[S]=y,S=S+1|0,y=-1):(f=y,y=u,u=f))):(m=m-(u>>=8)-1|0,u=65533),g=k=0,n=m<=b?32:_-m|0;default:h[S]=u;continue;case 11:case 10:case 9:case 8:}h[S]=65533}if(p+=i(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15],h[16],h[17],h[18],h[19],h[20],h[21],h[22],h[23],h[24],h[25],h[26],h[27],h[28],h[29],h[30],h[31]),32>S&&(p=p.slice(0,S-32|0)),m<_){if(h[0]=y,S=~y>>>31,y=-1,p.length<t.length)continue}else-1!==y&&(p+=i(y));t+=p,p=""}return t},u.encode=function(e){var t,n=0|(e=void 0===e?"":""+e).length,i=new l(8+(n<<1)|0),r=0,s=!a;for(t=0;t<n;t=t+1|0,r=r+1|0){var o=0|e.charCodeAt(t);if(127>=o)i[r]=o;else{if(2047>=o)i[r]=192|o>>6;else{e:{if(55296<=o)if(56319>=o){var u=0|e.charCodeAt(t=t+1|0);if(56320<=u&&57343>=u){if(65535<(o=(o<<10)+u-56613888|0)){i[r]=240|o>>18,i[r=r+1|0]=128|o>>12&63,i[r=r+1|0]=128|o>>6&63,i[r=r+1|0]=128|63&o;continue}break e}o=65533}else 57343>=o&&(o=65533);!s&&t<<1<r&&t<<1<(r-7|0)&&(s=!0,(u=new l(3*n)).set(i),i=u)}i[r]=224|o>>12,i[r=r+1|0]=128|o>>6&63}i[r=r+1|0]=128|63&o}}return a?i.subarray(0,r):i.slice(0,r)},f||(e.TextDecoder=t,e.TextEncoder=n)}(void 0===e?"undefined"==typeof self?this:self:e)}).call(this,n(0))},function(e,t){Sk.builtin.tuple=Sk.abstr.buildNativeClass("tuple",{constructor:function(e){void 0===e?e=[]:Array.isArray(e)||(e=Sk.misceval.arrayFromIterable(e)),Sk.asserts.assert(this instanceof Sk.builtin.tuple,"bad call to tuple, use 'new' with an Array of python objects"),this.v=e,this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$doc:"Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object.",$r(){if(this.in$repr)return new Sk.builtin.str("(...)");this.in$repr=!0;let e=this.v.map((e=>Sk.misceval.objectRepr(e)));return this.in$repr=!1,e=e.join(", "),1===this.v.length&&(e+=","),new Sk.builtin.str("("+e+")")},tp$new(e,t){return this!==Sk.builtin.tuple.prototype?this.$subtype_new(e,t):(Sk.abstr.checkNoKwargs("tuple",t),Sk.abstr.checkArgsLen("tuple",e,0,1),void 0===(e=e[0])?new Sk.builtin.tuple([]):e.constructor===Sk.builtin.tuple?e:Sk.misceval.chain(Sk.misceval.arrayFromIterable(e,!0),(e=>new Sk.builtin.tuple(e))))},tp$hash(){let e,t=3430008,n=1000003;const i=this.v.length;for(let r=0;r<i;++r){if(e=Sk.abstr.objectHash(this.v[r]),-1===e)return-1;t=(t^e)*n,n+=82520+i+i}return t+=97531,-1===t&&(t=-2),0|t},tp$richcompare:Sk.generic.seqCompare,tp$iter(){return new n(this)},mp$subscript(e){if(Sk.misceval.isIndex(e)){if(0>(e=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError))&&(e=this.v.length+e),0>e||e>=this.v.length)throw new Sk.builtin.IndexError("tuple index out of range");return this.v[e]}if(e instanceof Sk.builtin.slice){const t=[];return e.sssiter$(this.v.length,(e=>{t.push(this.v[e])})),new Sk.builtin.tuple(t)}throw new Sk.builtin.TypeError("tuple indices must be integers or slices, not "+Sk.abstr.typeName(e))},sq$length(){return this.v.length},sq$repeat(e){if(1===(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError))&&this.constructor===Sk.builtin.tuple)return this;const t=[];for(let n=0;n<e;n++)for(let e=0;e<this.v.length;e++)t.push(this.v[e]);return new Sk.builtin.tuple(t)},sq$concat(e){if(!(e instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("can only concatenate tuple (not '"+Sk.abstr.typeName(e)+"') to tuple");return new Sk.builtin.tuple(this.v.concat(e.v))},sq$contains(e){for(let t=this.tp$iter(),n=t.tp$iternext();void 0!==n;n=t.tp$iternext())if(n===e||Sk.misceval.richCompareBool(n,e,"Eq"))return!0;return!1}},proto:{$subtype_new(e,t){return t=new this.constructor,e=Sk.builtin.tuple.prototype.tp$new(e),t.v=e.v,t},sk$asarray(){return this.v.slice(0)},valueOf(){return this.v}},methods:{__getnewargs__:{$meth(){return new Sk.builtin.tuple(this.v.slice(0))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:null},index:{$meth(e,t,n){if(void 0!==t&&!Sk.misceval.isIndex(t)||void 0!==n&&!Sk.misceval.isIndex(n))throw new Sk.builtin.TypeError("slice indices must be integers or have an __index__ method");({start:t,end:n}=Sk.builtin.slice.startEnd$wrt(this,t,n));const i=this.v;for(;t<n;t++)if(i[t]===e||Sk.misceval.richCompareBool(i[t],e,"Eq"))return new Sk.builtin.int_(t);throw new Sk.builtin.ValueError("tuple.index(x): x not in tuple")},$flags:{MinArgs:1,MaxArgs:3},$textsig:"($self, value, start=0, stop=sys.maxsize, /)",$doc:"Return first index of value.\n\nRaises ValueError if the value is not present."},count:{$meth(e){const t=this.v.length,n=this.v;let i=0;for(let r=0;r<t;++r)(n[r]===e||Sk.misceval.richCompareBool(n[r],e,"Eq"))&&(i+=1);return new Sk.builtin.int_(i)},$flags:{OneArg:!0},$textsig:"($self, value, /)",$doc:"Return number of occurrences of value."}},classmethods:Sk.generic.classGetItem}),Sk.exportSymbol("Sk.builtin.tuple",Sk.builtin.tuple);var n=Sk.abstr.buildIteratorClass("tuple_iterator",{constructor:function(e){this.$index=0,this.$seq=e.sk$asarray()},iternext:Sk.generic.iterNextWithArray,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$unacceptableBase:!0}})},function(e,t){function n(e){let t=e.$savedKeyHash;return void 0!==t?t:t=Sk.abstr.objectHash(e)}function i(e){return new Sk.builtin.set(Sk.misceval.arrayFromIterable(e))}function r(e,t){for(let n=Sk.abstr.iter(e),i=n.tp$iternext();void 0!==i;i=n.tp$iternext())if(!Sk.abstr.sequenceContains(t,i))return!1;return!0}function s(e,t,n){const r={constructor:function(e){if(1!==arguments.length)throw new Sk.builtin.TypeError("cannot create '"+Sk.abstr.typeName(this)+"' instances");this.dict=e,this.in$repr=!1}};return r.slots=Object.assign(t,l),r.methods={isdisjoint:{$meth(e){const t=i(this);return t.isdisjoint.$meth.call(t,e)},$flags:{OneArg:!0},$textsig:null,$doc:"Return True if the view and the given iterable have a null intersection."},__reversed__:{$meth:n,$flags:{NoArgs:!0},$textsig:null,$doc:"Return a reverse iterator over the dict keys."}},r.flags={sk$unacceptableBase:!0},"dict_values"===e&&(delete r.slots.tp$as_number,delete r.slots.tp$richcompare),Sk.abstr.buildNativeClass(e,r)}function o(e,t,n){return Sk.abstr.buildIteratorClass(e,{constructor:function(e){this.$index=0,this.$orig=e,this.tp$iternext=()=>(this.$seq=e.$items(),this.$version=e.$version,n&&(this.$seq=this.$seq.reverse()),this.tp$iternext=this.constructor.prototype.tp$iternext,this.tp$iternext())},iternext:t,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$unacceptableBase:!0},proto:{next$item:a}})}function a(){if(this.$version!==this.$orig.$version){if(this.$seq.length!==this.$orig.get$size())throw new Sk.builtin.RuntimeError("dict changed size during iteration");throw new Sk.builtin.RuntimeError("dictionary keys changed during iteration")}return this.$seq[this.$index++]}Sk.builtin.dict=Sk.abstr.buildNativeClass("dict",{constructor:function(e){void 0===e&&(e=[]),Sk.asserts.assert(Array.isArray(e)&&0==e.length%2&&this instanceof Sk.builtin.dict,"bad call to dict constructor"),this.size=0,this.entries=Object.create(null),this.buckets={};for(let t=0;t<e.length;t+=2)this.dict$setItem(e[t],e[t+1]);this.in$repr=!1,this.$version=0},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$as_number:!0,tp$hash:Sk.builtin.none.none$,tp$doc:"dict() -> new empty dictionary\ndict(mapping) -> new dictionary initialized from a mapping object's\n (key, value) pairs\ndict(iterable) -> new dictionary initialized as if via:\n d = {}\n for k, v in iterable:\n d[k] = v\ndict(**kwargs) -> new dictionary initialized with the name=value pairs\n in the keyword argument list. For example: dict(one=1, two=2)",$r(){if(this.in$repr)return new Sk.builtin.str("{...}");this.in$repr=!0;const e=this.$items().map((e=>{var[t,n]=e;return Sk.misceval.objectRepr(t)+": "+Sk.misceval.objectRepr(n)}));return this.in$repr=!1,new Sk.builtin.str("{"+e.join(", ")+"}")},tp$new:Sk.generic.new,tp$init(e,t){return this.update$common(e,t,"dict")},tp$iter(){return new f(this)},tp$richcompare(e,t){let n;if(!(e instanceof Sk.builtin.dict)||"Eq"!==t&&"NotEq"!==t)return Sk.builtin.NotImplemented.NotImplemented$;if(e===this)n=!0;else if(this.size!==e.size)n=!1;else{let t;n=this.$items().every((n=>{var[i,r]=n;return t=e.mp$lookup(i),void 0!==t&&(t===r||Sk.misceval.richCompareBool(r,t,"Eq"))}))}return"Eq"===t?n:!n},nb$or(e){if(!(e instanceof Sk.builtin.dict))return Sk.builtin.NotImplemented.NotImplemented$;const t=this.dict$copy();return t.dict$merge(e),t},nb$reflected_or(e){return e instanceof Sk.builtin.dict?((e=e.dict$copy()).dict$merge(this),e):Sk.builtin.NotImplemented.NotImplemented$},nb$inplace_or(e){return Sk.misceval.chain(this.update$onearg(e),(()=>this))},sq$length(){return this.get$size()},sq$contains(e){return void 0!==this.mp$lookup(e)},mp$subscript(e,t){var n=this.mp$lookup(e);if(void 0!==n)return n;if(void 0!==(n=Sk.abstr.lookupSpecial(this,Sk.builtin.str.$missing)))return e=Sk.misceval.callsimOrSuspendArray(n,[e]),t?e:Sk.misceval.retryOptionalSuspensionOrThrow(e);throw new Sk.builtin.KeyError(e)},mp$ass_subscript(e,t){if(void 0===t){if(e=this.dict$delItem(e))throw e}else this.dict$setItem(e,t)}},methods:{__reversed__:{$meth(){return new m(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a reverse iterator over the dict keys."},get:{$meth(e,t){return this.mp$lookup(e)||t||Sk.builtin.none.none$},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, key, default=None, /)",$doc:"Return the value for key if key is in the dictionary, else default."},setdefault:{$meth(e,t){if(this.ob$type!==Sk.builtin.dict){var i=this.mp$lookup(e);if(void 0!==i)return i;t||(t=Sk.builtin.none.none$),this.dict$setItem(e,t)}else{const r=n(e);if(void 0!==(i="string"==typeof r?this.entries[r]:this.get$bucket_item(e,r)))return i[1];t||(t=Sk.builtin.none.none$),"string"==typeof r?this.entries[r]=[e,t]:this.set$bucket_item(e,t,r),this.size++,this.$version++}return t},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, key, default=None, /)",$doc:"Insert key with a value of default if key is not in the dictionary.\n\nReturn the value for key if key is in the dictionary, else default."},pop:{$meth(e,t){const n=this.pop$item(e);if(void 0!==n)return n[1];if(void 0!==t)return t;throw new Sk.builtin.KeyError(e)},$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\nIf key is not found, d is returned if given, otherwise KeyError is raised"},popitem:{$meth(){const e=this.get$size();if(0===e)throw new Sk.builtin.KeyError("popitem(): dictionary is empty");const[t,n]=this.$items()[e-1];return this.pop$item(t),new Sk.builtin.tuple([t,n])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.popitem() -> (k, v), remove and return some (key, value) pair as a\n2-tuple; but raise KeyError if D is empty."},keys:{$meth(){return new u(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"D.keys() -> a set-like object providing a view on D's keys"},items:{$meth(){return new d(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"D.items() -> a set-like object providing a view on D's items"},values:{$meth(){return new c(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"D.values() -> an object providing a view on D's values"},update:{$meth(e,t){return Sk.misceval.chain(this.update$common(e,t,"update"),(()=>Sk.builtin.none.none$))},$flags:{FastCall:!0},$textsig:null,$doc:"D.update([E, ]**F) -> None. Update D from dict/iterable E and F.\nIf E is present and has a .keys() method, then does: for k in E: D[k] = E[k]\nIf E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v\nIn either case, this is followed by: for k in F: D[k] = F[k]"},clear:{$meth(){return this.dict$clear(),Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:"D.clear() -> None. Remove all items from D."},copy:{$meth(){return this.dict$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:"D.copy() -> a shallow copy of D"}},classmethods:Object.assign({fromkeys:{$meth:function(e,t){t=t||Sk.builtin.none.none$;let n=this===Sk.builtin.dict?new this:this.tp$call([],[]);return Sk.misceval.chain(n,(i=>(n=i,Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>n.mp$ass_subscript(e,t,!0))))),(()=>n))},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($type, iterable, value=None, /)",$doc:"Create a new dictionary with keys from iterable and values set to value."}},Sk.generic.classGetItem),proto:{quick$lookup:function(e){if(void 0!==(e=this.entries[e.$savedKeyHash]))return e[1]},mp$lookup:function(e){const t=n(e);if(void 0!==(e="string"==typeof t?this.entries[t]:this.get$bucket_item(e,t)))return e[1]},get$size(){return this.size},sk$asarray(){return this.$items().map((e=>e[0]))},update$common:function(e,t,n){let i;return Sk.abstr.checkArgsLen(n,e,0,1),void 0!==(e=e[0])&&(i=this.update$onearg(e)),Sk.misceval.chain(i,(()=>{if(t)for(let e=0;e<t.length;e+=2)this.dict$setItem(new Sk.builtin.str(t[e]),t[e+1])}))},update$onearg(e){return e instanceof Sk.builtin.dict||void 0!==Sk.abstr.lookupSpecial(e,Sk.builtin.str.$keys)?this.dict$merge(e):this.dict$merge_seq(e)},dict$copy(){const e=new Sk.builtin.dict([]);e.size=this.size;var t=Object.entries(this.entries);for(var n in t){var i=t[n][1];e.entries[t[n][0]]=[i[0],i[1]]}for(let r in this.buckets)for(n=this.buckets[r],e.buckets[r]=t=[],i=0;i<n.length;i++)t.push(e.entries["#"+r+"_"+i]);return e},$items(){return Object.values(this.entries)},dict$clear(){this.size=0,this.$version++,this.entries=Object.create(null),this.buckets={}},dict$setItem:function(e,t){const i=n(e);let r;"string"==typeof i?(r=this.entries[i],void 0===r?(this.entries[i]=[e,t],this.size++,this.$version++):r[1]=t):(r=this.get$bucket_item(e,i),void 0===r?(this.set$bucket_item(e,t,i),this.size++,this.$version++):r[1]=t)},dict$delItem:function(e){if(void 0===this.pop$item(e))return new Sk.builtin.KeyError(e)},get$bucket_item:function(e,t){if(void 0!==(t=this.buckets[t]))for(let i=0;i<t.length;i++){var n=t[i];if(void 0!==n&&(n[0]===e||Sk.misceval.richCompareBool(e,n[0],"Eq")))return n}},pop$bucket_item:function(e,t){const n=this.buckets[t];let i;if(void 0!==n)for(let r=0;r<n.length;r++)if(i=n[r],void 0!==i&&(i[0]===e||Sk.misceval.richCompareBool(e,i[0],"Eq")))return delete this.entries["#"+t+"_"+r],n[r]=void 0,n.every((e=>void 0===e))&&delete this.buckets[t],i},set$bucket_item:function(e,t,n){let i=this.buckets[n];e=[e,t],void 0===i?(this.buckets[n]=[e],n="#"+n+"_0"):-1!==(t=i.indexOf(void 0))?(n="#"+n+"_"+t,i[t]=e):(n="#"+n+"_"+i.length,i.push(e)),this.entries[n]=e},pop$item:function(e){const t=n(e);if("string"==typeof t?(e=this.entries[t],delete this.entries[t]):e=this.pop$bucket_item(e,t),void 0!==e)return this.size--,this.$version++,e},dict$merge:function(e){if(e.tp$iter!==Sk.builtin.dict.prototype.tp$iter){if(void 0===(t=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$keys)))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not a mapping");return Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(t),(t=>Sk.misceval.iterFor(Sk.abstr.iter(t),(t=>Sk.misceval.chain(Sk.abstr.objectGetItem(e,t,!0),(e=>{this.dict$setItem(t,e)}))))))}var t=e.tp$iter();for(let n=t.tp$iternext();void 0!==n;n=t.tp$iternext()){const t=e.mp$subscript(n);this.dict$setItem(n,t)}},dict$merge_seq:function(e){let t=0;return Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{if(!Sk.builtin.checkIterable(e))throw new Sk.builtin.TypeError("cannot convert dictionary update sequence element #"+t+" to a sequence");if(2!==(e=Sk.misceval.arrayFromIterable(e)).length)throw new Sk.builtin.ValueError("dictionary update sequence element #"+t+" has length "+e.length+"; 2 is required");this.dict$setItem(e[0],e[1]),t++}))}}});const l={tp$getattr:Sk.generic.getAttr,tp$as_number:!0,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,$r(){if(this.in$repr)return new Sk.builtin.str("...");this.in$repr=!0;let e=Sk.misceval.arrayFromIterable(this);return e=e.map((e=>Sk.misceval.objectRepr(e))),this.in$repr=!1,new Sk.builtin.str(Sk.abstr.typeName(this)+"(["+e.join(", ")+"])")},tp$richcompare(e,t){if(!(Sk.builtin.checkAnySet(e)||e instanceof u||e instanceof d))return Sk.builtin.NotImplemented.NotImplemented$;const n=this.sq$length(),i=e.sq$length();switch(t){case"NotEq":case"Eq":let s;return this===e?s=!0:n===i&&(s=r(this,e)),"NotEq"===t?!s:s;case"Lt":return n<i&&r(this,e);case"LtE":return n<=i&&r(this,e);case"Gt":return n>i&&r(e,this);case"GtE":return n>=i&&r(e,this)}},nb$subtract(e){const t=i(this);return t.difference.$meth.call(t,e)},nb$and(e){const t=i(this);return t.intersection.$meth.call(t,e)},nb$or(e){const t=i(this);return t.union.$meth.call(t,e)},nb$xor(e){const t=i(this);return t.symmetric_difference.$meth.call(t,e)},sq$length(){return this.dict.get$size()}};var u=s("dict_keys",{sq$contains(e){return void 0!==this.dict.mp$lookup(e)},tp$iter(){return new f(this.dict)}},(function(){return new m(this.dict)})),c=s("dict_values",{tp$iter(){return new p(this.dict)}},(function(){return new b(this.dict)})),d=s("dict_items",{sq$contains(e){if(!(e instanceof Sk.builtin.tuple&&2===e.sq$length()))return!1;var t=e.mp$subscript(new Sk.builtin.int_(0));return e=e.mp$subscript(new Sk.builtin.int_(1)),void 0!==(t=this.dict.mp$lookup(t))&&(t===e||Sk.misceval.richCompareBool(t,e,"Eq"))},tp$iter(){return new h(this.dict)}},(function(){return new _(this.dict)})),f=o("dict_keyiterator",(function(){const e=this.next$item();return e&&e[0]})),h=o("dict_itemiterator",(function(){const e=this.next$item();return e&&new Sk.builtin.tuple([e[0],e[1]])})),p=o("dict_valueiterator",(function(){const e=this.next$item();return e&&e[1]})),m=o("dict_reversekeyiterator",f.prototype.tp$iternext,!0),_=o("dict_reverseitemiterator",h.prototype.tp$iternext,!0),b=o("dict_reversevalueiterator",p.prototype.tp$iternext,!0);Sk.builtin.dict.py2$methods={has_key:{$name:"has_key",$flags:{OneArg:!0},$meth(e){return new Sk.builtin.bool(this.sq$contains(e))},$doc:"D.has_key(k) -> True if D has a key k, else False"},keys:{$name:"keys",$meth(){return new Sk.builtin.list(this.sk$asarray())},$flags:{NoArgs:!0},$textsig:null,$doc:"D.keys() -> a set-like object providing a view on D's keys"},items:{$name:"items",$meth(){return new Sk.builtin.list(this.$items().map((e=>{var[t,n]=e;return new Sk.builtin.tuple([t,n])})))},$flags:{NoArgs:!0},$textsig:null,$doc:"D.items() -> a set-like object providing a view on D's items"},values:{$name:"values",$meth(){return new Sk.builtin.list(this.$items().map((e=>([,e]=e,e))))},$flags:{NoArgs:!0},$textsig:null,$doc:"D.values() -> an object providing a view on D's values"}}},function(e,t){Sk.builtin.mappingproxy=Sk.abstr.buildNativeClass("mappingproxy",{constructor:function(e){if(Sk.asserts.assert(this instanceof Sk.builtin.mappingproxy,"bad call to mapping proxy, use 'new'"),void 0!==e){const t=e.constructor;t===Object||null===t||e.hasOwnProperty("sk$object")?(this.mapping=new Sk.builtin.dict([]),function(e,t){Object.defineProperties(e,{entries:{get:()=>{const e=Object.create(null);return Object.entries(t).forEach((t=>{var[n,i]=t;(n=Sk.unfixReserved(n)).includes("$")||(n=new Sk.builtin.str(n),e[n.$savedKeyHash]=[n,i])})),e},configurable:!0},size:{get:()=>Object.keys(t).map((e=>Sk.unfixReserved(e))).filter((e=>!e.includes("$"))).length,configurable:!0}})}(this.mapping,e)):Sk.builtin.checkMapping(e)?this.mapping=e:Sk.asserts.fail("unhandled case for mappingproxy")}},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,tp$new(e,t){if(Sk.abstr.checkNoKwargs("mappingproxy",t),Sk.abstr.checkOneArg("mappingproxy",e,t),e=e[0],!Sk.builtin.checkMapping(e))throw new Sk.builtin.TypeError("mappingproxy() argument must be a mapping, not "+Sk.abstr.typeName(e));return(t=new Sk.builtin.mappingproxy).mapping=e,t},tp$richcompare(e,t){return Sk.misceval.richCompareBool(this.mapping,e,t)},tp$str(){return this.mapping.tp$str()},$r(){return new Sk.builtin.str("mappingproxy("+Sk.misceval.objectRepr(this.mapping)+")")},mp$subscript(e,t){return this.mapping.mp$subscript(e,t)},sq$contains(e){return this.mapping.sq$contains(e)},sq$length(){return this.mapping.sq$length()},tp$iter(){return this.mapping.tp$iter()},tp$as_number:!0,nb$or(e){return e instanceof Sk.builtin.mappingproxy&&(e=e.mapping),Sk.abstr.numberBinOp(this.mapping,e,"BitOr")},nb$reflected_or(e){return e instanceof Sk.builtin.mappingproxy&&(e=e.mapping),Sk.abstr.numberBinOp(e,this.mapping,"BitOr")},nb$inplace_or(e){throw new Sk.builtin.TypeError("'|=' is not supported by "+Sk.abstr.typeName(this)+"; use '|' instead")}},methods:{get:{$meth(e,t){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$get),e,t)},$flags:{FastCall:!0},$textsig:null,$doc:"D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."},keys:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$keys),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.keys() -> a set-like object providing a view on D's keys"},items:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$items),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.items() -> a set-like object providing a view on D's items"},values:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$values),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.values() -> a set-like object providing a view on D's values"},copy:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$copy),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.copy() -> a shallow copy of D"}},classmethods:Sk.generic.classGetItem,proto:{str$get:new Sk.builtin.str("get"),str$copy:new Sk.builtin.str("copy"),str$keys:new Sk.builtin.str("keys"),str$items:new Sk.builtin.str("items"),str$values:new Sk.builtin.str("values"),mp$lookup(e){return this.mapping.mp$lookup(e)}},flags:{sk$unacceptableBase:!0}})},function(e,t){function n(e,t,n){try{const i=t.tp$getattr(n);e.tp$setattr(n,i)}catch(e){}}function i(e,t){n(e,t,Sk.builtin.str.$module),n(e,t,Sk.builtin.str.$name),n(e,t,Sk.builtin.str.$qualname),n(e,t,Sk.builtin.str.$doc),n(e,t,Sk.builtin.str.$ann)}Sk.builtin.property=Sk.abstr.buildNativeClass("property",{constructor:function(e,t,n,i){this.prop$get=e||Sk.builtin.none.none$,this.prop$set=t||Sk.builtin.none.none$,this.prop$del=n||Sk.builtin.none.none$,this.getter$doc=e&&!i,this.prop$doc=i||e&&e.$doc||Sk.builtin.none.none$},slots:{tp$getattr:Sk.generic.getAttr,tp$new:Sk.generic.new,tp$init(e,t){e=Sk.abstr.copyKeywordsToNamedArgs("property",["fget","fset","fdel","doc"],e,t,Array(4).fill(Sk.builtin.none.none$)),this.prop$get=e[0],this.prop$set=e[1],this.prop$del=e[2],Sk.builtin.checkNone(e[3])?(this.getter$doc=!0,Sk.builtin.checkNone(e[0])||(this.prop$doc=e[0].$doc||e[3])):this.prop$doc=e[3],this.ob$type!==Sk.builtin.property&&this.tp$setattr(Sk.builtin.str.$doc,this.prop$doc)},tp$doc:"Property attribute.\n\n fget\n function to be used for getting an attribute value\n fset\n function to be used for setting an attribute value\n fdel\n function to be used for del'ing an attribute\n doc\n docstring\n\nTypical use is to define a managed attribute x:\n\nclass C(object):\n def getx(self): return self._x\n def setx(self, value): self._x = value\n def delx(self): del self._x\n x = property(getx, setx, delx, 'I'm the 'x' property.')\n\nDecorators make defining new properties or modifying existing ones easy:\n\nclass C(object):\n @property\n def x(self):\n 'I am the 'x' property.'\n return self._x\n @x.setter\n def x(self, value):\n self._x = value\n @x.deleter\n def x(self):\n del self._x",tp$descr_get(e,t,n){if(null===e)return this;if(void 0===this.prop$get)throw new Sk.builtin.AttributeError("unreadable attribute");return e=Sk.misceval.callsimOrSuspendArray(this.prop$get,[e]),n?e:Sk.misceval.retryOptionalSuspensionOrThrow(e)},tp$descr_set(e,t,n){let i;if(i=null==t?this.prop$del:this.prop$set,Sk.builtin.checkNone(i))throw new Sk.builtin.AttributeError("can't "+(null==t?"delete":"set")+" attribute");if(!i.tp$call)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(i)+"' is not callable");return e=null==t?i.tp$call([e]):i.tp$call([e,t]),n?e:Sk.misceval.retryOptionalSuspensionOrThrow(e)}},methods:{getter:{$meth(e){return this.$copy([e,this.prop$set,this.prop$del])},$flags:{OneArg:!0}},setter:{$meth(e){return this.$copy([this.prop$get,e,this.prop$del])},$flags:{OneArg:!0}},deleter:{$meth(e){return this.$copy([this.prop$get,this.prop$set,e])},$flags:{OneArg:!0}}},getsets:{fget:{$get(){return this.prop$get}},fset:{$get(){return this.prop$set}},fdel:{$get(){return this.prop$del}},__doc__:{$get(){return this.prop$doc},$set(e){this.prop$doc=e=e||Sk.builtin.none.none$}}},proto:{$copy(e){const t=this.ob$type;return this.getter$doc||e.push(this.prop$doc),t===Sk.builtin.property?new t(...e):t.tp$call(e)}}}),Sk.builtin.classmethod=Sk.abstr.buildNativeClass("classmethod",{constructor:function(e){this.cm$callable=e,this.$d=new Sk.builtin.dict},slots:{tp$getattr:Sk.generic.getAttr,tp$new:Sk.generic.new,tp$init(e,t){Sk.abstr.checkNoKwargs("classmethod",t),Sk.abstr.checkArgsLen("classmethod",e,1,1),this.cm$callable=e[0],i(this,e[0])},$r(){return new Sk.builtin.str(`<classmethod(${Sk.misceval.objectRepr(this.cm$callable)})>`)},tp$doc:"classmethod(function) -> method\n\nConvert a function to be a class method.\n\nA class method receives the class as implicit first argument,\njust like an instance method receives the instance.\nTo declare a class method, use this idiom:\n\n class C:\n @classmethod\n def f(cls, arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\nIf a class method is called for a derived class, the derived class\nobject is passed as the implied first argument.\n\nClass methods are different than C++ or Java static methods.\nIf you want those, see the staticmethod builtin.",tp$descr_get(e,t,n){const i=this.cm$callable;if(void 0===i)throw new Sk.builtin.RuntimeError("uninitialized classmethod object");return null==t&&(t=e.ob$type),(e=i.tp$descr_get)?e.call(i,t,null,n):new Sk.builtin.method(i,t)}},getsets:{__func__:{$get(){return this.cm$callable}},__wrapped__:{$get(){return this.cm$callable}},__dict__:Sk.generic.getSetDict}}),Sk.builtin.staticmethod=Sk.abstr.buildNativeClass("staticmethod",{constructor:function(e){this.sm$callable=e,this.$d=new Sk.builtin.dict},slots:{tp$getattr:Sk.generic.getAttr,tp$new:Sk.generic.new,tp$init(e,t){Sk.abstr.checkNoKwargs("staticmethod",t),Sk.abstr.checkArgsLen("staticmethod",e,1,1),this.sm$callable=e[0],i(this,e[0])},$r(){return new Sk.builtin.str(`<staticmethod(${Sk.misceval.objectRepr(this.sm$callable)})>`)},tp$call(e,t){return Sk.misceval.callsimOrSuspendArray(this.sm$callable,e,t)},tp$doc:"staticmethod(function) -> method\n\nConvert a function to be a static method.\n\nA static method does not receive an implicit first argument.\nTo declare a static method, use this idiom:\n\n class C:\n @staticmethod\n def f(arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\n\nStatic methods in Python are similar to those found in Java or C++.\nFor a more advanced concept, see the classmethod builtin.",tp$descr_get(e,t){if(void 0===this.sm$callable)throw new Sk.builtin.RuntimeError("uninitialized staticmethod object");return this.sm$callable}},getsets:{__func__:{$get(){return this.sm$callable}},__wrapped__:{$get(){return this.sm$callable}},__dict__:Sk.generic.getSetDict}})},function(e,t){function n(e,t){return function(n){if(!(n instanceof Sk.builtin.int_))return Sk.builtin.NotImplemented.NotImplemented$;let i=this.v;if(n=n.v,"number"==typeof i&&"number"==typeof n){const t=e(i,n);if(d(t))return new Sk.builtin.int_(t)}return i=h(i),n=h(n),new Sk.builtin.int_(t(i,n))}}function i(e,t){return function(n){if(!(n instanceof Sk.builtin.int_))return Sk.builtin.NotImplemented.NotImplemented$;let i=this.v;return n=n.v,"number"==typeof i&&"number"==typeof n?e(i,n):(i=h(i),n=h(n),t(i,n))}}function r(e,t){return function(){let n=this.v;if("number"==typeof n){const t=e(n);if(void 0!==t)return new Sk.builtin.int_(t);n=h(n)}return new Sk.builtin.int_(t(n))}}function s(){return new Sk.builtin.int_(this.v)}function o(e,t){return function(n){if(!(n instanceof Sk.builtin.int_))return Sk.builtin.NotImplemented.NotImplemented$;let i=this.v;if(0===(n=n.v))throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return"number"==typeof i&&"number"==typeof n?new Sk.builtin.int_(e(i,n)):(i=h(i),n=h(n),new Sk.builtin.int_(JSBI.numberIfSafe(t(i,n))))}}function a(e,t){return function(n){if(!(n instanceof Sk.builtin.int_))return Sk.builtin.NotImplemented.NotImplemented$;if(n.nb$isnegative())throw new Sk.builtin.ValueError("negative shift count");let i=this.v;if(0===i)return new Sk.builtin.int_(0);if(n=n.v,"number"==typeof i&&"number"==typeof n&&53>n){const t=e(i,n);if(void 0!==t)return new Sk.builtin.int_(t)}return i=h(i),n=h(n),new Sk.builtin.int_(t(i,n))}}function l(e,t){return function(n){if(!(n instanceof Sk.builtin.int_))return Sk.builtin.NotImplemented.NotImplemented$;let i=this.v;return n=n.v,"number"==typeof i&&"number"==typeof n&&Math.abs(i)<Math.pow(2,31)&&Math.abs(n)<Math.pow(2,31)?new Sk.builtin.int_(e(i,n)):(i=h(i),n=h(n),new Sk.builtin.int_(JSBI.numberIfSafe(t(i,n))))}}function u(e){return JSBI.lessThan(e,JSBI.__ZERO)?JSBI.unaryMinus(e):e}function c(e,t){return JSBI.greaterThanOrEqual(JSBI.bitwiseXor(e,t),JSBI.__ZERO)?JSBI.divide(e,t):(e=JSBI.lessThan(e,JSBI.__ZERO)?JSBI.add(e,k):JSBI.subtract(e,k),JSBI.subtract(JSBI.divide(e,t),k))}function d(e){return e<=Number.MAX_SAFE_INTEGER&&e>=-Number.MAX_SAFE_INTEGER}function f(e){return e<=Number.MAX_SAFE_INTEGER&&e>=-Number.MAX_SAFE_INTEGER?+e:JSBI.BigInt(e)}function h(e){return"number"==typeof e?JSBI.BigInt(e):e}function p(e){if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("'byteorder' must be str, not "+Sk.abstr.typeName(e));if("little"===(e=e.toString()))return 1;if("big"===e)return 0;throw new Sk.builtin.ValueError("byteorder must be either 'little' or 'big'")}Sk.builtin.int_=Sk.abstr.buildNativeClass("int",{constructor:function(e){let t;if(Sk.asserts.assert(this instanceof Sk.builtin.int_,"bad call to int use 'new'"),"number"==typeof e){if(-6<e&&257>e)return w[e];t=e}else if(JSBI.__isBigInt(e))t=e;else{if(void 0===e)return x;if("string"==typeof e)t=f(e);else{if(e.nb$int)return e.nb$int();Sk.asserts.fail("bad argument to int constructor")}}this.v=t},slots:{tp$as_number:!0,tp$doc:"int(x=0) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4",$r(){return new Sk.builtin.str(this.v.toString())},tp$hash(){var e=this.v;if("number"==typeof e){if(-1===e)return-2;if(536870911>e&&-536870911<e)return e;e=h(e)}return-1===(e=JSBI.toNumber(JSBI.remainder(e,m)))?-2:e},tp$new(e,t){return 1===e.length+(t?t.length:0)?(t=e[0],e=Sk.builtin.none.none$):(t=(e=Sk.abstr.copyKeywordsToNamedArgs("int",[null,"base"],e,t,[x,Sk.builtin.none.none$]))[0],e=e[1]),t=function(e,t){if(t=t!==Sk.builtin.none.none$?Sk.misceval.asIndexOrThrow(t):null,e instanceof Sk.builtin.str)return null===t&&(t=10),new Sk.builtin.int_(Sk.str2number(e.v,t));if(null!==t)throw new Sk.builtin.TypeError("int() can't convert non-string with explicit base");if(void 0!==e.nb$int)return e.nb$int();if(void 0!==e.nb$index)return new Sk.builtin.int_(e.nb$index());if(t=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$trunc)){if(t=Sk.misceval.callsimArray(t,[]),!Sk.builtin.checkInt(t))throw new Sk.builtin.TypeError(Sk.builtin.str.$trunc.$jsstr()+" returned non-Integral (type "+Sk.abstr.typeName(e)+")");return new Sk.builtin.int_(t.v)}throw new Sk.builtin.TypeError("int() argument must be a string, a bytes-like object or a number, not '"+Sk.abstr.typeName(e)+"'")}(t,e),this===Sk.builtin.int_.prototype?t:((e=new this.constructor).v=t.v,e)},tp$getattr:Sk.generic.getAttr,ob$eq:i(((e,t)=>e==t),JSBI.equal),ob$ne:i(((e,t)=>e!=t),JSBI.notEqual),ob$gt:i(((e,t)=>e>t),JSBI.greaterThan),ob$ge:i(((e,t)=>e>=t),JSBI.greaterThanOrEqual),ob$lt:i(((e,t)=>e<t),JSBI.lessThan),ob$le:i(((e,t)=>e<=t),JSBI.lessThanOrEqual),nb$int:s,nb$index(){return this.v},nb$float(){var e=this.v;if("number"==typeof e)return new Sk.builtin.float_(e);if(1/0===(e=parseFloat(JSBI.toNumber(e)))||-1/0===e)throw new Sk.builtin.OverflowError("int too large to convert to float");return new Sk.builtin.float_(e)},nb$isnegative(){const e=this.v;return"number"==typeof e?0>e:JSBI.lessThan(e,JSBI.__ZERO)},nb$ispositive(){const e=this.v;return"number"==typeof e?0<=e:JSBI.greaterThanOrEqual(e,JSBI.__ZERO)},nb$bool(){return 0!==this.v},nb$positive:s,nb$negative:r((e=>-e),JSBI.unaryMinus),nb$add:n(((e,t)=>e+t),((e,t)=>JSBI.numberIfSafe(JSBI.add(e,t)))),nb$subtract:n(((e,t)=>e-t),((e,t)=>JSBI.numberIfSafe(JSBI.subtract(e,t)))),nb$multiply:n(((e,t)=>e*t),((e,t)=>e===JSBI.__ZERO||t===JSBI.__ZERO?0:JSBI.multiply(e,t))),nb$divide:function(e){if(!Sk.__future__.python3)return this.nb$floor_divide(e);if(!(e instanceof Sk.builtin.int_))return Sk.builtin.NotImplemented.NotImplemented$;var t=this.v,n=e.v;if(0===n)throw new Sk.builtin.ZeroDivisionError("division by zero");if("number"==typeof t&&"number"==typeof n)return new Sk.builtin.float_(t/n);if(t=h(t),n=h(n),e=JSBI.lessThan(JSBI.bitwiseXor(t,n),JSBI.__ZERO),JSBI.equal(t,JSBI.__ZERO))return new Sk.builtin.float_(e?-0:0);if(t=u(t),n=u(n),JSBI.greaterThanOrEqual(t,JSBI.multiply(S,n)))throw new Sk.builtin.OverflowError("int/int too large to represent as a float");var i=t.toString(2).length-n.toString(2).length,r=JSBI.BigInt(0>i?-i:i);if((0<=i&&JSBI.greaterThanOrEqual(t,JSBI.multiply(JSBI.exponentiate(g,r),n))||0>i&&JSBI.greaterThanOrEqual(JSBI.multiply(t,JSBI.exponentiate(g,r)),n))&&(i+=1),i=Math.max(i,b)-_,t=JSBI.leftShift(t,JSBI.BigInt(Math.max(-i,0))),n=JSBI.leftShift(n,JSBI.BigInt(Math.max(i,0))),r=JSBI.divide(t,n),t=JSBI.remainder(t,n),t=JSBI.multiply(g,t),(JSBI.greaterThan(t,n)||JSBI.equal(t,n)&&JSBI.equal(JSBI.remainder(r,g),k))&&(r=JSBI.add(r,k)),1/0===(r=JSBI.toNumber(r))||-1/0===r)throw new Sk.builtin.OverflowError("int/int too large to represent as a float");return n=r*Math.pow(2,i),new Sk.builtin.float_(e?-n:n)},nb$floor_divide:o(((e,t)=>Math.floor(e/t)),c),nb$remainder:o(((e,t)=>e-Math.floor(e/t)*t),((e,t)=>JSBI.subtract(e,JSBI.multiply(t,c(e,t))))),nb$divmod(e){const t=this.nb$floor_divide(e);return e=this.nb$remainder(e),t===Sk.builtin.NotImplemented.NotImplemented$||e===Sk.builtin.NotImplemented.NotImplemented$?Sk.builtin.NotImplemented.NotImplemented$:new Sk.builtin.tuple([t,e])},nb$and:l(((e,t)=>e&t),JSBI.bitwiseAnd),nb$or:l(((e,t)=>e|t),JSBI.bitwiseOr),nb$xor:l(((e,t)=>e^t),JSBI.bitwiseXor),nb$abs:r(Math.abs,u),nb$lshift:a(((e,t)=>{if(d(e=2*e*v[t]))return e}),JSBI.leftShift),nb$rshift:a(((e,t)=>{Math.floor(e/v[t+1])}),((e,t)=>JSBI.numberIfSafe(JSBI.signedRightShift(e,t)))),nb$invert:r((e=>Math.abs(e)<Math.pow(2,31)?~e:void 0),(e=>JSBI.numberIfSafe(JSBI.bitwiseNot(e)))),nb$power(e,t){let n;if(void 0!==t&&Sk.builtin.checkNone(t)&&(t=void 0),!(e instanceof Sk.builtin.int_&&(void 0===t||t instanceof Sk.builtin.int_)))return Sk.builtin.NotImplemented.NotImplemented$;const i=e.nb$isnegative();if(i&&void 0===t)return this.nb$float().nb$power(e.nb$float());let r=this.v;if(e=e.v,"number"==typeof r&&"number"==typeof e){const i=Math.pow(r,e);if(d(i)&&(n=new Sk.builtin.int_(i),void 0===t))return n}if(void 0!==t){if(i)throw new Sk.builtin.ValueError("pow() 2nd argument cannot be negative when 3rd argument specified");if(0===t.v)throw new Sk.builtin.ValueError("pow() 3rd argument cannot be 0");return void 0!==n?n.nb$remainder(t):new Sk.builtin.int_(JSBI.numberIfSafe(JSBI.powermod(h(r),h(e),h(t.v))))}return new Sk.builtin.int_(JSBI.exponentiate(h(r),h(e)))},nb$long(){return new Sk.builtin.lng(this.v)}},getsets:{real:{$get:s,$doc:"the real part of a complex number"},imag:{$get:()=>x,$doc:"the imaginary part of a complex number"},numerator:{$get:s},denominator:{$get:()=>A}},classmethods:{from_bytes:{$meth(e,t){Sk.abstr.checkArgsLen("from_bytes",e,0,2);let[n,i,r]=Sk.abstr.copyKeywordsToNamedArgs("from_bytes",["bytes","byteorder","signed"],e,t,[Sk.builtin.bool.false$]);if(e=p(i),n instanceof Sk.builtin.bytes||(n=Sk.misceval.callsimArray(Sk.builtin.bytes,[n])),Sk.misceval.isTrue(r))throw new Sk.builtin.NotImplementedError("from_bytes with signed=True is not yet implemented in Skulpt");const s=[];return n.valueOf().forEach((e=>{s.push(e.toString(16).padStart(2,"0"))})),e&&s.reverse(),e=new Sk.builtin.int_(JSBI.numberIfSafe(JSBI.BigInt("0x"+(s.join("")||"0")))),this===Sk.builtin.int_?e:Sk.misceval.callsimArray(this,[e])},$flags:{FastCall:!0}}},methods:{conjugate:{$meth:s,$flags:{NoArgs:!0},$textsig:null,$doc:"Returns self, the complex conjugate of any int."},bit_length:{$meth(){let e=this.v;return 0===e?new Sk.builtin.int_(0):(e="number"==typeof e?Math.abs(e):u(e),new Sk.builtin.int_(e.toString(2).length))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Number of bits necessary to represent self in binary.\n\n>>> bin(37)\n'0b100101'\n>>> (37).bit_length()\n6"},to_bytes:{$meth(e,t){Sk.abstr.checkArgsLen("to_bytes",e,0,2);let[n,i,r]=Sk.abstr.copyKeywordsToNamedArgs("to_bytes",["length","byteorder","signed"],e,t,[Sk.builtin.bool.false$]);if(e=p(i),n=Sk.misceval.asIndexSized(n,Sk.builtin.OverflowError),0>n)throw new Sk.builtin.ValueError("length argument must be non-negative");if(Sk.misceval.isTrue(r))throw new Sk.builtin.NotImplementedError("to_bytes with signed=True is not yet implemented in Skulpt");if(this.nb$isnegative())throw new Sk.builtin.OverflowError("can't convert negative int to unsigned");(t=JSBI.BigInt(this.v).toString(16)).length%2&&(t="0"+t);var s=t.length/2;if(s>n){if(0===n&&"00"===t)return new Sk.builtin.bytes;throw new Sk.builtin.OverflowError("int too big to convert")}const o=Array(n).fill(0);s=n-s;let a=0;for(;s<n;)o[s]=parseInt(t.slice(a,a+2),16),s+=1,a+=2;return e&&o.reverse(),new Sk.builtin.bytes(o)},$flags:{FastCall:!0},$textsig:"($self, /, length, byteorder, *, signed=False)",$doc:"Return an array of bytes representing an integer.\n\n length\n Length of bytes object to use. An OverflowError is raised if the\n integer is not representable with the given number of bytes.\n byteorder\n The byte order used to represent the integer. If byteorder is 'big',\n the most significant byte is at the beginning of the byte array. If\n byteorder is 'little', the most significant byte is at the end of the\n byte array. To request the native byte order of the host system, use\n `sys.byteorder' as the byte order value.\n signed\n Determines whether two's complement is used to represent the integer.\n If signed is False and a negative integer is given, an OverflowError\n is raised."},__trunc__:{$meth:s,$flags:{NoArgs:!0},$textsig:null,$doc:"Truncating an Integral returns itself."},__floor__:{$meth:s,$flags:{NoArgs:!0},$textsig:null,$doc:"Flooring an Integral returns itself."},__ceil__:{$meth:s,$flags:{NoArgs:!0},$textsig:null,$doc:"Ceiling of an Integral returns itself."},__round__:{$meth(e){return this.round$(e)},$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:"Rounding an Integral returns itself.\nRounding with an ndigits argument also returns an integer."},__getnewargs__:{$meth(){return new Sk.builtin.tuple([new Sk.builtin.int_(this.v)])},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:Sk.builtin.none.none$},__format__:{$meth:Sk.formatting.mkNumber__format__(!1),$flags:{OneArg:!0},$textsig:"($self, format_spec, /)",$doc:Sk.builtin.none.none$}},proto:{str$(e,t){return e=void 0===e||10===e?this.v.toString():this.v.toString(e),t||void 0===t||"-"===e[0]&&(e=e.substring(1)),e},round$(e){e=void 0===e?0:Sk.misceval.asIndexSized(e);var t=this.v;if(0<=e)return new Sk.builtin.int_(t);if("number"!=typeof t){{var n=e;(e=JSBI.lessThan(t,JSBI.__ZERO))&&(t=JSBI.unaryMinus(t)),n=JSBI.exponentiate(JSBI.BigInt(10),JSBI.unaryMinus(JSBI.BigInt(n)));let i=JSBI.divide(t,n);t=JSBI.remainder(t,n),t=JSBI.multiply(t,g),JSBI.greaterThan(t,n)?i=JSBI.add(i,k):JSBI.equal(t,n)&&(Sk.__future__.bankers_rounding?JSBI.equal(JSBI.remainder(i,g),k)&&(i=JSBI.add(i,k)):i=JSBI.add(i,k)),i=JSBI.multiply(i,n),e&&(i=JSBI.unaryMinus(i)),e=new Sk.builtin.int_(i)}return e}return(e=Math.pow(10,-e))/10>Math.abs(t)?new Sk.builtin.int_(0):Sk.__future__.bankers_rounding?(t/=e,n=Math.round(t),new Sk.builtin.int_((.5==(0<t?t:-t)%1?0==n%2?n:n-1:n)*e)):new Sk.builtin.int_(Math.round(t/e)*e)},valueOf(){return this.v},sk$int:!0}}),Sk.exportSymbol("Sk.builtin.int_",Sk.builtin.int_);const m=JSBI.BigInt("536870911"),_=Math.log2(Number.MAX_SAFE_INTEGER);e=JSBI.BigInt(Math.floor(Math.log2(Number.MAX_VALUE)));const b=Math.ceil(Math.log2(Number.MIN_VALUE)),g=JSBI.BigInt(2),k=JSBI.BigInt(1),S=JSBI.subtract(JSBI.exponentiate(g,e),JSBI.exponentiate(g,JSBI.subtract(e,JSBI.add(JSBI.BigInt(_),k)))),y=/_(?=[^_])/g;Sk.str2number=function(e,t){var n,i=e,r=!1;if("-"===(e=e.replace(/^\s+|\s+$/g,"")).charAt(0)&&(r=!0,e=e.substring(1)),"+"===e.charAt(0)&&(e=e.substring(1)),null==t&&(t=10),(2>t||36<t)&&0!==t)throw new Sk.builtin.ValueError("int() base must be >= 2 and <= 36");if("string"==typeof t&&(t=Number(t)),"0x"===e.substring(0,2).toLowerCase()){if(16===t||0===t)e=e.substring(2),t=16;else if(34>t)throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'")}else if("0b"===e.substring(0,2).toLowerCase()){if(2===t||0===t)e=e.substring(2),t=2;else if(12>t)throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'")}else if("0o"===e.substring(0,2).toLowerCase()){if(8===t||0===t)e=e.substring(2),t=8;else if(25>t)throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'")}else if("0"===e.charAt(0)){if("0"===e)return 0;8!==t&&0!==t||(t=8)}if(0===t&&(t=10),-1!==e.indexOf("_")){if(-1!==e.indexOf("__"))throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'");e=10!==t?e.replace(y,""):e.charAt(0)+e.substring(1).replace(y,"")}if(0===e.length)throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'");for(n=0;n<e.length;n+=1){var s=e.charCodeAt(n),o=t;if(48<=s&&57>=s?o=s-48:65<=s&&90>=s?o=s-65+10:97<=s&&122>=s&&(o=s-97+10),o>=t)throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'")}if(r&&(e="-"+e),d(o=parseInt(e,t)))return o;for(i=!1,"-"===e[0]&&(i=!0,e=e.substring(1)),t=JSBI.BigInt(t),r=k,n=JSBI.__ZERO,s=e.length-1;0<=s;s--)48<=(o=e.charCodeAt(s))&&57>=o?o-=48:65<=o&&90>=o?o=o-65+10:97<=o&&122>=o&&(o=o-97+10),o=JSBI.multiply(JSBI.BigInt(o),r),n=JSBI.add(n,o),r=JSBI.multiply(r,t);return i&&(n=JSBI.multiply(n,JSBI.BigInt(-1))),n},Sk.builtin.int_.py2$methods={},Sk.longFromStr=function(e,t){return Sk.__future__.python3?new Sk.builtin.int_(f(e)):(e=Sk.str2number(e,t),new Sk.builtin.lng(e))},Sk.exportSymbol("Sk.longFromStr",Sk.longFromStr),Sk.builtin.int_.withinThreshold=d,Sk.builtin.int_.stringToNumberOrBig=f;const v=[.5,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,4294967296,8589934592,17179869184,34359738368,68719476736,137438953472,274877906944,549755813888,1099511627776,2199023255552,4398046511104,8796093022208,17592186044416,35184372088832,70368744177664,0x800000000000,281474976710656,562949953421312,0x4000000000000,0x8000000000000,4503599627370496,9007199254740992];Sk.builtin.lng=Sk.abstr.buildNativeClass("long",{base:Sk.builtin.int_,constructor:function(e){void 0!==(e=Sk.builtin.int_.call(this,e))&&(this.v=e.v)},slots:{$r(){return new Sk.builtin.str(this.v.toString()+"L")},tp$as_number:!0,nb$negative(){return new Sk.builtin.lng($.nb$negative.call(this).v)},nb$positive(){return new Sk.builtin.lng($.nb$positive.call(this).v)}}});const $=Sk.builtin.int_.prototype,w=[];for(e=-5;257>e;e++)w[e]=Object.create(Sk.builtin.int_.prototype,{v:{value:e}});const x=w[0],A=w[1]},function(e,t){const n=Sk.builtin.int_.prototype;Sk.builtin.bool=Sk.abstr.buildNativeClass("bool",{constructor:function(e){return Sk.misceval.isTrue(e)?Sk.builtin.bool.true$:Sk.builtin.bool.false$},base:Sk.builtin.int_,slots:{tp$doc:"bool(x) -> bool\n\nReturns True when the argument x is true, False otherwise.\nThe builtins True and False are the only two instances of the class bool.\nThe class bool is a subclass of the class int, and cannot be subclassed.",tp$new:(e,t)=>(Sk.abstr.checkNoKwargs("bool",t),Sk.abstr.checkArgsLen("bool",e,0,1),new Sk.builtin.bool(e[0])),$r(){return this.v?this.str$True:this.str$False},tp$as_number:!0,nb$and(e){return e.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v&e.v):n.nb$and.call(this,e)},nb$or(e){return e.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v|e.v):n.nb$or.call(this,e)},nb$xor(e){return e.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v^e.v):n.nb$xor.call(this,e)}},flags:{sk$unacceptableBase:!0},methods:{__format__:{$meth(){return this.$r()},$flags:{OneArg:!0}}},proto:{str$False:new Sk.builtin.str("False"),str$True:new Sk.builtin.str("True"),valueOf(){return!!this.v}}}),Sk.exportSymbol("Sk.builtin.bool",Sk.builtin.bool),Sk.builtin.bool.true$=Object.create(Sk.builtin.bool.prototype,{v:{value:1,enumerable:!0}}),Sk.builtin.bool.false$=Object.create(Sk.builtin.bool.prototype,{v:{value:0,enumerable:!0}})},function(e,t){function n(e){const t=[e,0];if(0===e)return t;var n=Math.abs(e);let i=Math.max(-1023,Math.floor(Math.log2(n))+1);for(n*=Math.pow(2,-i);.5>n;)n*=2,i--;for(;1<=n;)n*=.5,i++;return 0>e&&(n=-n),t[0]=n,t[1]=i,t}function i(){return new Sk.builtin.float_(this.v)}function r(e){return function(t){const n=this.v;if("number"!=typeof(t=t.v)){if(!JSBI.__isBigInt(t))return Sk.builtin.NotImplemented.NotImplemented$;if(1/0==(t=parseFloat(JSBI.toNumber(t)))||-1/0==t)throw new Sk.builtin.OverflowError("int too large to convert to float")}return e(n,t)}}function s(e,t){return function(n){const i=this.v;if("number"!=typeof(n=n.v)){if(!JSBI.__isBigInt(n))return Sk.builtin.NotImplemented.NotImplemented$;if(void 0!==t)return t(i,n)}return e(i,n)}}function o(e){const t=r(e);return function(e,n){if(void 0!==n&&!Sk.builtin.checkNone(n))throw new Sk.builtin.TypeError("pow() 3rd argument not allowed unless all arguments are integers");return t.call(this,e)}}function a(e,t){if(0===t)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return 1/0===e?1/0===t||-1/0===e?new Sk.builtin.float_(NaN):0>t?new Sk.builtin.float_(-1/0):new Sk.builtin.float_(1/0):-1/0===e?1/0===t||-1/0===e?new Sk.builtin.float_(NaN):0>t?new Sk.builtin.float_(1/0):new Sk.builtin.float_(-1/0):new Sk.builtin.float_(e/t)}function l(e,t){if(1/0===e||-1/0===e)return new Sk.builtin.float_(NaN);if(0===t)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return 1/0===t?0>e?new Sk.builtin.float_(-1):new Sk.builtin.float_(0):-1/0===t?0>e||0!==e?new Sk.builtin.float_(0):new Sk.builtin.float_(-1):new Sk.builtin.float_(Math.floor(e/t))}function u(e,t){if(0===t)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");if(0===e)return new Sk.builtin.float_(0);if(1/0===t)return 1/0===e||-1/0===e?new Sk.builtin.float_(NaN):0<e?new Sk.builtin.float_(e):new Sk.builtin.float_(1/0);let n=e%t;return 0>e?0<t&&0>n&&(n+=t):0>t&&0!==n&&(n+=t),0===n&&(0>t?n=-0:-1/0==1/0/n&&(n=0)),new Sk.builtin.float_(n)}function c(e,t){if(0>e&&0!=t%1)return new Sk.builtin.complex(e,0).nb$power(new Sk.builtin.complex(t,0));if(0===e&&0>t)throw new Sk.builtin.ZeroDivisionError("0.0 cannot be raised to a negative power");const n=Math.pow(e,t);if(1/0===Math.abs(n)&&1/0!==Math.abs(e)&&1/0!==Math.abs(t))throw new Sk.builtin.OverflowError("Numerical result out of range");return new Sk.builtin.float_(n)}Sk.builtin.float_=Sk.abstr.buildNativeClass("float",{constructor:function(e){if(Sk.asserts.assert(this instanceof Sk.builtin.float_,"bad call to float use 'new'"),"number"==typeof e)this.v=e;else if(void 0===e)this.v=0;else if("string"==typeof e)this.v=parseFloat(e);else{if(e.nb$float)return e.nb$float();Sk.asserts.fail("bad argument to float constructor")}},slots:{tp$getattr:Sk.generic.getAttr,tp$as_number:!0,tp$doc:"Convert a string or number to a floating point number, if possible.",tp$hash(){var e=this.v;if(!Number.isFinite(e))return Number.isNaN(e)?0:0<e?314159:-314159;let[t,i]=n(e);e=1,0>t&&(e=-1,t=-t);let r,s=0;for(;t;)s=s<<28&536870911|s>>1,t*=268435456,i-=28,r=Math.trunc(t),t-=r,s+=r,536870911<=s&&(s-=536870911);return i=0<=i?i%29:28-(-1-i)%29,s=(s<<i&536870911|s>>29-i)*e,-1===s?-2:s},$r(){return new Sk.builtin.str(this.str$(10,!0))},tp$new(e,t){if(t&&t.length)throw new Sk.builtin.TypeError("float() takes no keyword arguments");if(e&&1<e.length)throw new Sk.builtin.TypeError("float expected at most 1 arguments, got "+e.length);if(void 0===(e=e[0]))var n=new Sk.builtin.float_(0);else if(void 0!==e.nb$float)n=e.nb$float();else if(void 0!==e.nb$index)n=new Sk.builtin.int_(e.nb$index()).nb$float();else if(Sk.builtin.checkString(e)){if(e=n=e.v,-1!==n.indexOf("_")){if(d.test(n))throw new Sk.builtin.ValueError("could not convert string to float: '"+n+"'");e=n.charAt(0)+n.substring(1).replace(f,"")}if(n.match(/^-inf$/i))var i=-1/0;else n.match(/^[+]?inf$/i)?i=1/0:n.match(/^[-+]?nan$/i)?i=NaN:isNaN(e)||(i=parseFloat(e),Number.isNaN(i)&&(i=void 0));if(void 0===i)throw new Sk.builtin.ValueError("could not convert string to float: "+Sk.misceval.objectRepr(new Sk.builtin.str(n)));n=new Sk.builtin.float_(i)}if(void 0===n)throw new Sk.builtin.TypeError("float() argument must be a string or a number");return this===Sk.builtin.float_.prototype?n:((i=new this.constructor).v=n.v,i)},nb$int(){let e=this.v;if(!Number.isFinite(e)){if(1/0===e||-1/0===e)throw new Sk.builtin.OverflowError("cannot convert float infinity to integer");throw new Sk.builtin.ValueError("cannot convert float NaN to integer")}return e=0>e?Math.ceil(e):Math.floor(e),Sk.builtin.int_.withinThreshold(e)?new Sk.builtin.int_(e):new Sk.builtin.int_(JSBI.BigInt(e))},nb$float:i,nb$long(){return new Sk.builtin.lng(this.nb$int().v)},nb$add:r(((e,t)=>new Sk.builtin.float_(e+t))),nb$subtract:r(((e,t)=>new Sk.builtin.float_(e-t))),nb$reflected_subtract:r(((e,t)=>new Sk.builtin.float_(t-e))),nb$multiply:r(((e,t)=>new Sk.builtin.float_(e*t))),nb$divide:r(a),nb$reflected_divide:r(((e,t)=>a(t,e))),nb$floor_divide:r(l),nb$reflected_floor_divide:r(((e,t)=>l(t,e))),nb$remainder:r(u),nb$reflected_remainder:r(((e,t)=>u(t,e))),nb$divmod:r(((e,t)=>new Sk.builtin.tuple([l(e,t),u(e,t)]))),nb$reflected_divmod:r(((e,t)=>new Sk.builtin.tuple([l(t,e),u(t,e)]))),nb$power:o(c),nb$reflected_power:o(((e,t)=>c(t,e))),nb$abs(){return new Sk.builtin.float_(Math.abs(this.v))},nb$negative(){return new Sk.builtin.float_(-this.v)},nb$positive(){return new Sk.builtin.float_(this.v)},nb$bool(){return 0!==this.v},nb$isnegative(){return 0>this.v},nb$ispositive(){return 0<=this.v},ob$eq:s(((e,t)=>e==t),JSBI.EQ),ob$ne:s(((e,t)=>e!=t),JSBI.NE),ob$gt:s(((e,t)=>e>t),JSBI.GT),ob$ge:s(((e,t)=>e>=t),JSBI.GE),ob$lt:s(((e,t)=>e<t),JSBI.LT),ob$le:s(((e,t)=>e<=t),JSBI.LE)},getsets:{real:{$get:i,$doc:"the real part of a complex number"},imag:{$get:()=>new Sk.builtin.float_(0),$doc:"the imaginary part of a complex number"}},methods:{conjugate:{$meth:i,$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return self, the complex conjugate of any float."},__trunc__:{$meth(){return this.nb$int()},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return the Integral closest to x between 0 and x."},__round__:{$meth(e){return this.round$(e)},$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, ndigits=None, /)",$doc:"Return the Integral closest to x, rounding half toward even.\n\nWhen an argument is passed, work like built-in round(x, ndigits)."},as_integer_ratio:{$meth(){if(!Number.isFinite(this.v)){if(Number.isNaN(this.v))throw new Sk.builtin.ValueError("cannot convert NaN to integer ratio");throw new Sk.builtin.OverflowError("cannot convert Infinity to integer ratio")}let[e,t]=n(this.v);for(var i=0;300>i&&e!=Math.floor(e);i++)e*=2,t--;i=new Sk.builtin.int_(Math.abs(t));let r=new Sk.builtin.int_(e),s=new Sk.builtin.int_(1);return 0<t?r=r.nb$lshift(i):s=s.nb$lshift(i),new Sk.builtin.tuple([r,s])},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return integer ratio.\n\nReturn a pair of integers, whose ratio is exactly equal to the original float\nand with a positive denominator.\n\nRaise OverflowError on infinities and a ValueError on NaNs.\n\n>>> (10.0).as_integer_ratio()\n(10, 1)\n>>> (0.0).as_integer_ratio()\n(0, 1)\n>>> (-.25).as_integer_ratio()\n(-1, 4)"},is_integer:{$meth(){return new Sk.builtin.bool(Number.isInteger(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the float is an integer."},__getnewargs__:{$meth(){return new Sk.builtin.tuple([this])},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:Sk.builtin.none.none$},__format__:{$meth:Sk.formatting.mkNumber__format__(!0),$flags:{OneArg:!0},$textsig:"($self, format_spec, /)",$doc:Sk.builtin.none.none$}},proto:{valueOf(){return this.v}}});const d=/_[eE]|[eE]_|\._|_\.|[+-]_|__/,f=/_(?=[^_])/g;Sk.builtin.float_.PyFloat_Check=function(e){return void 0!==e&&!!(Sk.builtin.checkNumber(e)||Sk.builtin.checkFloat(e)||e.ob$type.$isSubType(Sk.builtin.float_))},Sk.builtin.float_.prototype.toFixed=function(e){return e=Sk.builtin.asnum$(e),this.v.toFixed(e)},Sk.builtin.float_.prototype.round$=function(e){var t=Sk.builtin.asnum$(this),n=void 0===e?0:Sk.misceval.asIndexSized(e);if(Sk.__future__.bankers_rounding){t*=Math.pow(10,n);var i=Math.round(t);return n=(.5==(0<t?t:-t)%1?0==i%2?i:i-1:i)/Math.pow(10,n),void 0===e?new Sk.builtin.int_(n):new Sk.builtin.float_(n)}return e=Math.pow(10,n),n=Math.round(t*e)/e,new Sk.builtin.float_(n)},Sk.builtin.float_.prototype.str$=function(e,t){if(isNaN(this.v))return"nan";if(void 0===t&&(t=!0),1/0==this.v)return"inf";if(-1/0==this.v&&t)return"-inf";if(-1/0==this.v&&!t)return"inf";if(t=t?this.v:Math.abs(this.v),void 0===e||10===e){var n=Sk.__future__.python3?t.toPrecision(16):t.toPrecision(12),i=n.indexOf(".");if(e=t.toString().slice(0,i),i=t.toString().slice(i),e.match(/^-?0$/)&&i.slice(1).match(/^0{4,}/)&&(n=12>n.length?t.toExponential():t.toExponential(11)),0>n.indexOf("e")&&0<=n.indexOf(".")){for(;"0"==n.charAt(n.length-1);)n=n.substring(0,n.length-1);"."==n.charAt(n.length-1)&&(n+="0")}n=(n=(n=n.replace(/\.0+e/,"e","i")).replace(/(e[-+])([1-9])$/,"$10$2")).replace(/0+(e.*)/,"$1")}else n=t.toString(e);return 0===this.v&&-1/0==1/this.v&&(n="-"+n),0>n.indexOf(".")&&0>n.indexOf("E")&&0>n.indexOf("e")&&(n+=".0"),n},Sk.builtin.float_.py2$methods={}},function(e,t){function n(e){let t=e.v;if("number"==typeof t)return t;if(e.nb$float&&(t=e.nb$float()),void 0===t)throw new Sk.builtin.TypeError("a float is required");return t.v}function i(e,t,n){return n===Sk.builtin.complex.prototype?new Sk.builtin.complex(e,t):(n=new n.constructor,Sk.builtin.complex.call(n,e,t),n)}function r(e,t){return function(n){const i=this.real,r=this.imag;var s=n.real;const o=n.v;if("number"==typeof s)n=n.imag;else if("number"==typeof o)s=o,n=0;else{if(!JSBI.__isBigInt(o))return Sk.builtin.NotImplemented.NotImplemented$;if(void 0===t){if(1/0==(s=parseFloat(JSBI.toNumber(o)))||-1/0==s)throw new Sk.builtin.OverflowError("int too large to convert to float")}else s=o.toString();n=0}return e(i,r,s,n)}}function s(e,t,n,i){var r=Math.abs(n);const s=Math.abs(i);if(r>=s){if(0===r)throw new Sk.builtin.ZeroDivisionError("complex division by zero");i=(e+t*(r=i/n))/(n+=i*r),e=(t-e*r)/n}else s>=r?(n=n*(r=n/i)+i,Sk.asserts.assert(0!==i),i=(e*r+t)/n,e=(t*r-e)/n):e=i=NaN;return new Sk.builtin.complex(i,e)}function o(e,t,n,i){if(0===n&&0===i){i=1;var r=0}else if(0===e&&0===t){if(0!==i||0>n)throw new Sk.builtin.ZeroDivisionError("complex division by zero");r=i=0}else{const s=Math.hypot(e,t);r=Math.pow(s,n),n*=e=Math.atan2(t,e),0!==i&&(r/=Math.exp(e*i),n+=i*Math.log(s)),i=r*Math.cos(n),r*=Math.sin(n)}return new Sk.builtin.complex(i,r)}function a(e,t,n){let i=1;var r=new Sk.builtin.complex(1,0);for(e=new Sk.builtin.complex(e,t);0<i&&n>=i;)n&i&&(r=new Sk.builtin.complex(r.real*e.real-r.imag*e.imag,r.real*e.imag+e.real*r.imag)),i<<=1,e=new Sk.builtin.complex(e.real*e.real-e.imag*e.imag,2*e.real*e.imag);return r}function l(e,t,n,i,r){switch(r=!1,t){case"e":case"f":case"g":break;case"E":r=!0,t="e";break;case"F":r=!0,t="f";break;case"r":if(0!==n)throw Error("Bad internall call");n=17,t="g";break;default:throw Error("Bad internall call")}if(isNaN(e))e="nan";else if(1/0===e)e="inf";else if(-1/0===e)e="-inf";else{i&l.Py_DTSF_ADD_DOT_0&&(t="g");var s="%"+(i&l.Py_DTSF_ALT?"#":"");null!=n&&(s=s+"."+n),e=(e=(s=new Sk.builtin.str(s+t)).nb$remainder(new Sk.builtin.float_(e))).v}return i&l.Py_DTSF_SIGN&&"-"!==e[0]&&(e="+"+e),r&&(e=e.toUpperCase()),e}Sk.builtin.complex=Sk.abstr.buildNativeClass("complex",{constructor:function(e,t){Sk.asserts.assert(this instanceof Sk.builtin.complex,"bad call to complex constructor, use 'new'"),this.real=e,this.imag=t},slots:{tp$as_number:!0,tp$doc:"Create a complex number from a real part and an optional imaginary part.\n\nThis is equivalent to (real + imag*1j) where imag defaults to 0.",tp$hash(){var e=new Sk.builtin.float_(this.real).tp$hash();return e=1003*new Sk.builtin.float_(this.imag).tp$hash()+e,Sk.builtin.int_.withinThreshold(e)?e:new Sk.builtin.int_(JSBI.BigInt(e)).tp$hash()},tp$getattr:Sk.generic.getAttr,tp$new(e,t){{var r,s=(e=Sk.abstr.copyKeywordsToNamedArgs("complex",["real","imag"],e,t,[null,null]))[1];let a=t=!1;var o=e[0];if(null!=o&&o.constructor===Sk.builtin.complex&&null==s)t=o;else if(Sk.builtin.checkString(o)){if(null!=s)throw new Sk.builtin.TypeError("complex() can't take second arg if first is a string");t=Sk.builtin.complex.complex_subtype_from_string(o,this)}else{if(null!=s&&Sk.builtin.checkString(s))throw new Sk.builtin.TypeError("complex() second arg can't be a string");if(null!=(e=null==o?null:void 0!==(e=Sk.abstr.lookupSpecial(o,Sk.builtin.str.$complex))?Sk.misceval.callsimArray(e,[]):null)&&e!==Sk.builtin.NotImplemented.NotImplemented$){if(!u(e))throw new Sk.builtin.TypeError("__complex__ should return a complex object");o=e}if(null!=o&&void 0===o.nb$float)throw new Sk.builtin.TypeError("complex() first argument must be a string or a number, not '"+Sk.abstr.typeName(o)+"'");if(null!=s&&void 0===s.nb$float)throw new Sk.builtin.TypeError("complex() second argument must be a number, not '"+Sk.abstr.typeName(o)+"'");null==o?o=e=0:u(o)?(e=o.real,o=o.imag,t=!0):(e=n(o),o=0),null==s?s=r=0:u(s)?(r=s.real,s=s.imag,a=!0):(r=n(s),s=0),!0===a&&(e-=s),!0===t&&(r+=o),t=i(e,r,this)}}return t},tp$richcompare(e,t){if("Eq"!==t&&"NotEq"!==t){if(Sk.builtin.checkNumber(e)||u(e))throw new Sk.builtin.TypeError("no ordering relation is defined for complex numbers");return Sk.builtin.NotImplemented.NotImplemented$}return r((function(e,n,i,r){return e=e==i&&n==r,"Eq"===t?e:!e}),!0).call(this,e)},$r(){{var e,t;let r=e="";var n=this.real,i=this.imag;(t=0===n)&&(t=1==(n?0>n?-1:1:0>1/n?-1:1)),t?(n="",t=l(i,"g",null,0,null)):(n=e=l(n,"g",null,0,null),t=l(i,"g",null,l.Py_DTSF_SIGN,null),0===i&&-1/0==1/i&&t&&"-"!==t[0]&&(t="-"+t),e="(",r=")"),i=new Sk.builtin.str(""+e+n+t+"j"+r)}return i},nb$int(){throw new Sk.builtin.TypeError("can't convert complex to int")},nb$long(){throw new Sk.builtin.TypeError("can't convert complex to long")},nb$float(){throw new Sk.builtin.TypeError("can't convert complex to float")},nb$positive(){return new Sk.builtin.complex(this.real,this.imag)},nb$negative(){return new Sk.builtin.complex(-this.real,-this.imag)},nb$bool(){return this.real||this.imag},nb$add:r(((e,t,n,i)=>new Sk.builtin.complex(e+n,t+i))),nb$subtract:r(((e,t,n,i)=>new Sk.builtin.complex(e-n,t-i))),nb$reflected_subtract:r(((e,t,n,i)=>new Sk.builtin.complex(n-e,i-t))),nb$multiply:r(((e,t,n,i)=>new Sk.builtin.complex(n*e-i*t,e*i+t*n))),nb$divide:r(s),nb$reflected_divide:r(((e,t,n,i)=>s(n,i,e,t))),nb$floor_divide(e){throw new Sk.builtin.TypeError("can't take floor of complex number.")},nb$reflected_floor_divide(e){throw new Sk.builtin.TypeError("can't take floor of complex number.")},nb$remainder(e){throw new Sk.builtin.TypeError("can't mod complex numbers.")},nb$reflected_remainder(e){throw new Sk.builtin.TypeError("can't mod complex numbers.")},nb$divmod(e){throw new Sk.builtin.TypeError("can't take floor or mod of complex number.")},nb$power(e,t){if(null!=t&&!Sk.builtin.checkNone(t))throw new Sk.builtin.ValueError("complex modulo");return h.call(this,e)},nb$reflected_power(e,t){if(null!=t&&!Sk.builtin.checkNone(t))throw new Sk.builtin.ValueError("complex modulo");return p.call(this,e)},nb$abs(){var e=this.real;const t=this.imag;if(!Number.isFinite(e)||!Number.isFinite(t))return 1/0===e||-1/0===e?new Sk.builtin.float_(Math.abs(e)):1/0===t||-1/0===t?new Sk.builtin.float_(Math.abs(t)):new Sk.builtin.float_(NaN);if(e=Math.hypot(e,t),!Number.isFinite(e))throw new Sk.builtin.OverflowError("absolute value too large");return new Sk.builtin.float_(e)}},getsets:{real:{$get(){return new Sk.builtin.float_(this.real)},$doc:"the real part of a complex number"},imag:{$get(){return new Sk.builtin.float_(this.imag)},$doc:"the imaginary part of a complex number"}},methods:{conjugate:{$meth(){return new Sk.builtin.complex(this.real,-this.imag)},$flags:{NoArgs:!0},$textsig:null,$doc:"complex.conjugate() -> complex\n\nReturn the complex conjugate of its argument. (3-4j).conjugate() == 3+4j."},__getnewargs__:{$meth(){return new Sk.builtin.tuple([new Sk.builtin.float_(this.real),new Sk.builtin.float_(this.imag)])},$flags:{NoArgs:!0},$textsig:null,$doc:Sk.builtin.none.none$},__format__:{$meth(e){if(Sk.builtin.checkString(e))throw new Sk.builtin.NotImplementedError("__format__ is not implemented for complex type.");throw new Sk.builtin.TypeError("__format__ requires str")},$flags:{OneArg:!0},$textsig:null,$doc:"complex.__format__() -> str\n\nConvert to a string according to format_spec."}}}),Sk.exportSymbol("Sk.builtin.complex",Sk.builtin.complex);const u=Sk.builtin.checkComplex,c=/_[eE]|[eE]_|\._|_\.|[+-]_|_j|j_/,d=/_(?=[^_])/g;Sk.builtin.complex.complex_subtype_from_string=function(e,t){t=t||Sk.builtin.complex.prototype;var n=0,r=0,s=!1;if(Sk.builtin.checkString(e))e=Sk.ffi.remapToJs(e);else if("string"!=typeof e)throw new TypeError("provided unsupported string-alike argument");if(-1!==e.indexOf("\0")||0===e.length||""===e)throw new Sk.builtin.ValueError("complex() arg is a malformed string");var o=0;for(e=(e=e.replace(/inf|infinity/gi,"Infinity")).replace(/nan/gi,"NaN");" "===e[o];)o++;if("("===e[o])for(s=!0,o++;" "===e[o];)o++;if(-1!==e.indexOf("_")){if(c.test(e))throw new Sk.builtin.ValueError("could not convert string to complex: '"+e+"'");e=e.charAt(0)+e.substring(1).replace(d,"")}var a=/^(?:[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+\.?))(?:[eE][+-]?\d+)?|NaN|Infinity))/,l=e.substr(o),u=l.match(a);if(null!==u)if("j"===e[o+=u[0].length]||"J"===e[o])r=parseFloat(u[0]),o++;else if("+"===e[o]||"-"===e[o]){if(n=parseFloat(u[0]),null!==(u=e.substr(o).match(a))?(r=parseFloat(u[0]),o+=u[0].length):(r="+"===e[o]?1:-1,o++),"j"!==e[o]&&"J"!==e[o])throw new Sk.builtin.ValueError("complex() arg is malformed string");o++}else n=parseFloat(u[0]);else null!==(u=u=l.match(/^([+-]?[jJ])/))&&(r=1===u[0].length||"+"===u[0][0]?1:-1,o+=u[0].length);for(;" "===e[o];)o++;if(s){if(")"!==e[o])throw new Sk.builtin.ValueError("complex() arg is malformed string");for(o++;" "===e[o];)o++}if(e.length!==o)throw new Sk.builtin.ValueError("complex() arg is malformed string");return i(n,r,t)};const f=(e,t,n,i)=>{const r=0|n;return 0===i&&n===r?e=100<r||-100>r?o(e,t,r,0):0<r?a(e,t,r):s(1,0,(e=a(e,t,-r)).real,e.imag):o(e,t,n,i)},h=r(f),p=r(((e,t,n,i)=>f(n,i,e,t)));l.Py_DTSF_SIGN=1,l.Py_DTSF_ADD_DOT_0=2,l.Py_DTSF_ALT=4,l.Py_DTST_FINITE=0,l.Py_DTST_INFINITE=1,l.Py_DTST_NAN=2},function(e,t){Sk.builtin.slice=Sk.abstr.buildNativeClass("slice",{constructor:function(e,t,n){void 0===t&&void 0===n&&(t=e,e=Sk.builtin.none.none$),void 0===t&&(t=Sk.builtin.none.none$),void 0===n&&(n=Sk.builtin.none.none$),this.start=e,this.stop=t,this.step=n},slots:{tp$getattr:Sk.generic.getAttr,tp$doc:"slice(stop)\nslice(start, stop[, step])\n\nCreate a slice object. This is used for extended slicing (e.g. a[0:10:2]).",tp$hash:Sk.builtin.none.none$,tp$new:(e,t)=>(Sk.abstr.checkNoKwargs("slice",t),Sk.abstr.checkArgsLen("slice",e,1,3),new Sk.builtin.slice(...e)),$r(){const e=Sk.misceval.objectRepr(this.start),t=Sk.misceval.objectRepr(this.stop),n=Sk.misceval.objectRepr(this.step);return new Sk.builtin.str("slice("+e+", "+t+", "+n+")")},tp$richcompare(e,t){if(e.ob$type!==Sk.builtin.slice)return Sk.builtin.NotImplemented.NotImplemented$;const n=new Sk.builtin.tuple([this.start,this.stop,this.step]);return e=new Sk.builtin.tuple([e.start,e.stop,e.step]),n.tp$richcompare(e,t)}},getsets:{start:{$get(){return this.start}},step:{$get(){return this.step}},stop:{$get(){return this.stop}}},methods:{indices:{$meth:function(e){if(0>(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError)))throw new Sk.builtin.TypeError("length should not be negative");const{start:t,stop:n,step:i}=this.slice$indices(e);return new Sk.builtin.tuple([new Sk.builtin.int_(t),new Sk.builtin.int_(n),new Sk.builtin.int_(i)])},$doc:"S.indices(len) -> (start, stop, stride)\n\nAssuming a sequence of length len, calculate the start and stop\nindices, and the stride length of the extended slice described by\nS. Out of bounds indices are clipped in a manner consistent with the\nhandling of normal slices.",$textsig:null,$flags:{OneArg:!0}}},proto:{slice$as_indices(e){let t;var n=e?e=>Sk.misceval.asIndexSized(e,null,"slice indices must be integers or None or have an __index__ method"):e=>Sk.misceval.asIndexOrThrow(e,"slice indices must be integers or None or have an __index__ method");if(Sk.builtin.checkNone(this.step))t=1;else if(t=n(this.step),0===t)throw new Sk.builtin.ValueError("slice step cannot be zero");return{start:e=Sk.builtin.checkNone(this.start)?null:n(this.start),stop:n=Sk.builtin.checkNone(this.stop)?null:n(this.stop),step:t}},$wrt:(e,t,n,i,r)=>(r=r?t=>JSBI.__isBigInt(t)?JSBI.add(t,JSBI.BigInt(e)):t+e:t=>t+e,0<i?((null===t||0>t&&0>(t=r(t)))&&(t=0),null===n||n>e?n=e:0>n&&(n=r(n))):(null===t||t>=e?t=e-1:0>t&&(t=r(t)),(null===n||0>n&&0>(n=r(n)))&&(n=-1)),{start:t,stop:n,step:i}),slice$indices(e,t){let{start:n,stop:i,step:r}=this.slice$as_indices(!0,t);return this.$wrt(e,n,i,r,t)},sssiter$(e,t){let{start:n,stop:i,step:r}=this.slice$indices(e,!0);if(0<r)for(e=n;e<i;e+=r)t(e);else for(e=n;e>i;e+=r)t(e)}},flags:{sk$unacceptableBase:!0}}),Sk.builtin.slice.startEnd$wrt=function(e,t,n){return e=e.sq$length(),(void 0===t||Sk.builtin.checkNone(t)||0>(t=Sk.misceval.asIndexSized(t,null,"slice indices must be integers or have an __index__ method"))&&0>(t+=e))&&(t=0),void 0===n||Sk.builtin.checkNone(n)?n=e:0>(n=Sk.misceval.asIndexSized(n,null,"slice indices must be integers or have an __index__ method"))?0>(n+=e)&&(n=0):n>e&&(n=e),{start:t,end:n}}},function(e,t){function n(e){return function(t){return Sk.builtin.checkAnySet(t)?e.call(this,t):Sk.builtin.NotImplemented.NotImplemented$}}function i(e){return e instanceof Sk.builtin.set&&e.tp$hash===Sk.builtin.none.none$&&(e=new Sk.builtin.frozenset(Sk.misceval.arrayFromIterable(e))),e}e={},Sk.builtin.set=Sk.abstr.buildNativeClass("set",{constructor:function(e){void 0===e?e=[]:Array.isArray(e)||(e=Sk.misceval.arrayFromIterable(e)),Sk.asserts.assert(this instanceof Sk.builtin.set,"Bad call to set - must be called with an Array and 'new'");const t=[];for(let n=0;n<e.length;n++)t.push(e[n]),t.push(!0);this.v=new Sk.builtin.dict(t),this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_number:!0,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,tp$doc:"set() -> new empty set object\nset(iterable) -> new set object\n\nBuild an unordered collection of unique elements.",tp$init(e,t){return Sk.abstr.checkNoKwargs("set",t),Sk.abstr.checkArgsLen("set",e,0,1),this.set$clear(),(e=e[0])&&this.set$update(e)},tp$new:Sk.generic.new,$r(){if(this.in$repr)return new Sk.builtin.str(Sk.abstr.typeName(this)+"(...)");this.in$repr=!0;const e=this.sk$asarray().map((e=>Sk.misceval.objectRepr(e)));return this.in$repr=!1,Sk.__future__.python3?0===e.length?new Sk.builtin.str(Sk.abstr.typeName(this)+"()"):this.ob$type!==Sk.builtin.set?new Sk.builtin.str(Sk.abstr.typeName(this)+"({"+e.join(", ")+"})"):new Sk.builtin.str("{"+e.join(", ")+"}"):new Sk.builtin.str(Sk.abstr.typeName(this)+"(["+e.join(", ")+"])")},tp$iter(){return new r(this)},tp$richcompare(e,t){if(!Sk.builtin.checkAnySet(e))return Sk.builtin.NotImplemented.NotImplemented$;switch(t){case"NotEq":case"Eq":return e=this===e||this.get$size()===e.get$size()&&Sk.misceval.isTrue(this.set$issubset(e)),"Eq"===t?e:!e;case"LtE":return this===e||Sk.misceval.isTrue(this.set$issubset(e));case"GtE":return this===e||Sk.misceval.isTrue(e.set$issubset(this));case"Lt":return this.get$size()<e.get$size()&&Sk.misceval.isTrue(this.set$issubset(e));case"Gt":return this.get$size()>e.get$size()&&Sk.misceval.isTrue(e.set$issubset(this))}},nb$subtract:n((function(e){return this.difference.$meth.call(this,e)})),nb$and:n((function(e){return this.intersection.$meth.call(this,e)})),nb$or:n((function(e){return this.union.$meth.call(this,e)})),nb$xor:n((function(e){return this.symmetric_difference.$meth.call(this,e)})),nb$inplace_subtract:n((function(e){return e===this&&(e=e.set$copy()),Sk.misceval.chain(this.difference_update.$meth.call(this,e),(()=>this))})),nb$inplace_and:n((function(e){return Sk.misceval.chain(this.intersection_update.$meth.call(this,e),(()=>this))})),nb$inplace_or:n((function(e){return Sk.misceval.chain(this.update.$meth.call(this,e),(()=>this))})),nb$inplace_xor:n((function(e){return e===this&&(e=e.set$copy()),Sk.misceval.chain(this.symmetric_difference_update.$meth.call(this,e),(()=>this))})),sq$length(){return this.get$size()},sq$contains(e){return e=i(e),this.v.sq$contains(e)}},methods:{add:{$meth(e){return this.set$add(e),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Add an element to a set.\n\nThis has no effect if the element is already present."},clear:{$meth(){return this.set$clear(),Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:"Remove all elements from this set."},copy:{$meth(){return this.set$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a shallow copy of a set."},discard:{$meth(e){return e=i(e),this.set$discard(e),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Remove an element from a set if it is a member.\n\nIf the element is not a member, do nothing."},difference:{$meth(...e){const t=this.set$copy();return Sk.misceval.chain(Sk.misceval.iterArray(e,(e=>t.set$difference_update(e))),(()=>t))},$flags:{MinArgs:0},$textsig:null,$doc:"Return the difference of two or more sets as a new set.\n\n(i.e. all elements that are in this set but not the others.)"},difference_update:{$meth(...e){return Sk.misceval.chain(Sk.misceval.iterArray(e,(e=>this.set$difference_update(e))),(()=>Sk.builtin.none.none$))},$flags:{MinArgs:0},$textsig:null,$doc:"Remove all elements of another set from this set."},intersection:{$meth(...e){return this.set$intersection_multi(...e)},$flags:{MinArgs:0},$textsig:null,$doc:"Return the intersection of two sets as a new set.\n\n(i.e. all elements that are in both sets.)"},intersection_update:{$meth(...e){return Sk.misceval.chain(this.set$intersection_multi(...e),(e=>(this.swap$bodies(e),Sk.builtin.none.none$)))},$flags:{MinArgs:0},$textsig:null,$doc:"Update a set with the intersection of itself and another."},isdisjoint:{$meth(e){return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{if(this.sq$contains(e))return new Sk.misceval.Break(Sk.builtin.bool.false$)})),(e=>e||Sk.builtin.bool.true$))},$flags:{OneArg:!0},$textsig:null,$doc:"Return True if two sets have a null intersection."},issubset:{$meth(e){return Sk.builtin.checkAnySet(e)||(e=this.set$make_basetype(e)),Sk.misceval.chain(e,(e=>this.set$issubset(e)))},$flags:{OneArg:!0},$textsig:null,$doc:"Report whether another set contains this set."},issuperset:{$meth(e){return Sk.builtin.checkAnySet(e)||(e=this.set$make_basetype(e)),Sk.misceval.chain(e,(e=>e.set$issubset(this)))},$flags:{OneArg:!0},$textsig:null,$doc:"Report whether this set contains another set."},pop:{$meth(){if(0===this.get$size())throw new Sk.builtin.KeyError("pop from an empty set");return Sk.misceval.callsimArray(this.v.popitem,[this.v]).v[0]},$flags:{NoArgs:!0},$textsig:null,$doc:"Remove and return an arbitrary set element.\nRaises KeyError if the set is empty."},remove:{$meth(e){const t=i(e);if(this.v.mp$lookup(t))return this.v.mp$ass_subscript(t),Sk.builtin.none.none$;throw new Sk.builtin.KeyError(e)},$flags:{OneArg:!0},$textsig:null,$doc:"Remove an element from a set; it must be a member.\n\nIf the element is not a member, raise a KeyError."},symmetric_difference:{$meth(e){let t;return Sk.misceval.chain(this.set$make_basetype(e),(e=>(t=e,t.set$symmetric_diff_update(this))),(()=>t))},$flags:{OneArg:!0},$textsig:null,$doc:"Return the symmetric difference of two sets as a new set.\n\n(i.e. all elements that are in exactly one of the sets.)"},symmetric_difference_update:{$meth(e){return Sk.builtin.checkAnySet(e)||(e=this.set$make_basetype(e)),Sk.misceval.chain(e,(e=>this.set$symmetric_diff_update(e)),(()=>Sk.builtin.none.none$))},$flags:{OneArg:!0},$textsig:null,$doc:"Update a set with the symmetric difference of itself and another."},union:{$meth(...e){const t=this.set$copy();return Sk.misceval.chain(Sk.misceval.iterArray(e,(e=>t.set$update(e))),(()=>t))},$flags:{MinArgs:0},$textsig:null,$doc:"Return the union of sets as a new set.\n\n(i.e. all elements that are in either set.)"},update:{$meth(...e){return Sk.misceval.chain(Sk.misceval.iterArray(e,(e=>this.set$update(e))),(()=>Sk.builtin.none.none$))},$flags:{MinArgs:0},$textsig:null,$doc:"Update a set with the union of itself and others."}},classmethods:Sk.generic.classGetItem,proto:Object.assign(e,{sk$asarray(){return this.v.sk$asarray()},get$size(){return this.v.sq$length()},set$add(e){this.v.mp$ass_subscript(e,!0)},set$make_basetype(e){return Sk.misceval.chain(Sk.misceval.arrayFromIterable(e,!0),(e=>new this.sk$builtinBase(e)))},set$discard(e){return this.v.pop$item(e)},set$clear(){this.v.dict$clear()},set$copy(){const e=new this.sk$builtinBase;return e.v=this.v.dict$copy(),e},set$difference_update(e){return Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{this.set$discard(e)}))},set$intersection(e){const t=new this.sk$builtinBase;return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{this.sq$contains(e)&&t.set$add(e)})),(()=>t))},set$intersection_multi(...e){if(!e.length)return this.set$copy();let t=this;return Sk.misceval.chain(Sk.misceval.iterArray(e,(e=>Sk.misceval.chain(t.set$intersection(e),(e=>{t=e})))),(()=>t))},set$issubset(e){if(this.get$size()>e.get$size())return Sk.builtin.bool.false$;for(let t=this.tp$iter(),n=t.tp$iternext();void 0!==n;n=t.tp$iternext())if(!e.sq$contains(n))return Sk.builtin.bool.false$;return Sk.builtin.bool.true$},set$symmetric_diff_update(e){return Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{void 0===this.set$discard(e)&&this.set$add(e)}))},set$update(e){return Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{this.set$add(e)}))},swap$bodies(e){this.v=e.v}})}),Sk.exportSymbol("Sk.builtin.set",Sk.builtin.set),t=Sk.builtin.set.prototype,Sk.builtin.frozenset=Sk.abstr.buildNativeClass("frozenset",{constructor:function(e){void 0===e?e=[]:Array.isArray(e)||(e=Sk.misceval.arrayFromIterable(e)),Sk.asserts.assert(this instanceof Sk.builtin.frozenset,"bad call to frozen set - must be called with 'new'");const t=[];for(let n=0;n<e.length;n++)t.push(e[n]),t.push(!0);this.v=new Sk.builtin.dict(t),this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_number:!0,tp$as_sequence_or_mapping:!0,tp$doc:"frozenset() -> empty frozenset object\nfrozenset(iterable) -> frozenset object\n\nBuild an immutable unordered collection of unique elements.",tp$hash(){let e=1927868237;const t=this.sk$asarray();e*=t.length+1;for(let n=0;n<t.length;n++){const i=Sk.abstr.objectHash(t[n]);e^=3644798167*(i^i<<16^89869747)}return 69069*e+907133923},tp$new(e,t){return this!==Sk.builtin.frozenset.prototype?this.$subtype_new(e,t):(Sk.abstr.checkNoKwargs("frozenset",t),Sk.abstr.checkArgsLen("frozenset",e,0,1),void 0!==(e=e[0])&&e.ob$type===Sk.builtin.frozenset?e:Sk.misceval.chain(Sk.misceval.arrayFromIterable(e,!0),(e=>e.length?new Sk.builtin.frozenset(e):Sk.builtin.frozenset.$emptyset)))},$r:t.$r,tp$iter:t.tp$iter,tp$richcompare:t.tp$richcompare,nb$subtract:t.nb$subtract,nb$and:t.nb$and,nb$or:t.nb$or,nb$xor:t.nb$xor,sq$length:t.sq$length,sq$contains:t.sq$contains},methods:{copy:Object.assign({},t.copy.d$def,{$meth(){return this.constructor===this.sk$builtinBase?this:new Sk.builtin.frozenset(this.sk$asarray())}}),difference:t.difference.d$def,intersection:t.intersection.d$def,isdisjoint:t.isdisjoint.d$def,issubset:t.issubset.d$def,issuperset:t.issuperset.d$def,symmetric_difference:t.symmetric_difference.d$def,union:t.union.d$def},classmethods:Sk.generic.classGetItem,proto:Object.assign({$subtype_new(e,t){const n=new this.constructor;return Sk.misceval.chain(Sk.builtin.frozenset.prototype.tp$new(e),(e=>(n.v=e.v,n)))}},e)}),Sk.builtin.frozenset.$emptyset=new Sk.builtin.frozenset([]),Sk.exportSymbol("Sk.builtin.frozenset",Sk.builtin.frozenset);var r=Sk.abstr.buildIteratorClass("set_iterator",{constructor:function(e){this.$index=0,this.$seq=e.sk$asarray(),this.$orig=e},iternext:Sk.generic.iterNextWithArrayCheckSize,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$unacceptableBase:!0}})},function(e,t){Sk.builtin.print=function(e,t){let n,[i,r,s]=Sk.abstr.copyKeywordsToNamedArgs("print",["sep","end","file","flush"],[],t);if(void 0===i||Sk.builtin.checkNone(i))i=" ";else{if(!Sk.builtin.checkString(i))throw new Sk.builtin.TypeError("sep must be None or a string, not "+Sk.abstr.typeName(i));i=i.$jsstr()}if(void 0===r||Sk.builtin.checkNone(r))r="\n";else{if(!Sk.builtin.checkString(r))throw new Sk.builtin.TypeError("end must be None or a string, not "+Sk.abstr.typeName(r));r=r.$jsstr()}if(void 0!==s&&!Sk.builtin.checkNone(s)&&(n=Sk.abstr.lookupSpecial(s,Sk.builtin.str.$write),void 0===n))throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(s)+"' object has no attribute 'write'");const o=new Sk.builtin.str(e.map((e=>new Sk.builtin.str(e).toString())).join(i)+r);if(void 0===n)return Sk.misceval.chain(Sk.importModule("sys",!1,!0),(e=>(n=Sk.abstr.lookupSpecial(e.$d.stdout,Sk.builtin.str.$write))&&Sk.misceval.callsimOrSuspendArray(n,[o])));Sk.misceval.callsimArray(n,[o])},Sk.builtin.print.co_fastcall=1},function(e,t){Sk.builtin.module=Sk.abstr.buildNativeClass("module",{constructor:function(){this.$d={}},slots:{tp$doc:"Create a module object.\n\nThe name must be a string; the optional doc argument can have any type.",tp$getattr(e,t){var n=this.$d[e.$mangled];if(void 0!==n)return n;if(void 0!==(n=this.ob$type.$typeLookup(e))){const e=n.tp$descr_get;return e?e.call(n,this,this.ob$type,t):n}const i=this.$d.__getattr__;return void 0!==i?(n=Sk.misceval.tryCatch((()=>Sk.misceval.callsimOrSuspendArray(i,[e])),(e=>{if(!(e instanceof Sk.builtin.AttributeError))throw e})),t?n:Sk.misceval.retryOptionalSuspensionOrThrow(n)):void 0},tp$setattr:Sk.generic.setAttr,tp$new:Sk.generic.new,tp$init(e,t){const[n,i]=Sk.abstr.copyKeywordsToNamedArgs("module",["name","doc"],e,t,[Sk.builtin.none.none$]);Sk.builtin.pyCheckType("module","string",n),this.init$dict(n,i)},$r(){let e=this.get$name();if(void 0!==e){var t=this.get$mod_reprf();if(void 0!==t)return Sk.misceval.callsimOrSuspendArray(t,[this])}return e=void 0===e?"'?'":e,t=void 0===(t=this.from$file())?this.empty_or$loader():t,new Sk.builtin.str("<module "+e+t+">")}},getsets:{__dict__:{$get(){return new Sk.builtin.mappingproxy(this.$d)}}},methods:{__dir__:{$meth(){const e=this.tp$getattr(Sk.builtin.str.$dict);if(!Sk.builtin.checkMapping(e))throw new Sk.builtin.TypeError("__dict__ is not a dictionary");const t=e.mp$lookup(Sk.builtin.str.$dir);return void 0!==t?Sk.misceval.callsimOrSuspendArray(t,[]):new Sk.builtin.list(Sk.misceval.arrayFromIterable(e))},$flags:{NoArgs:!0},$doc:"__dir__() -> list\nspecialized dir() implementation"}},proto:{sk$hasDict:!0,init$dict(e,t){this.$d.__name__=e,this.$d.__doc__=t,this.$d.__package__=Sk.builtin.none.none$,this.$d.__spec__=Sk.builtin.none.none$,this.$d.__loader__=Sk.builtin.none.none$},sk$attrError(){let e=this.get$name();return e=void 0===e?"module":"module "+e,this.$initializing&&(e="(most likely due to a circular import) partially initialized "+e),e},get$name(){const e=this.tp$getattr(Sk.builtin.str.$name);return e&&Sk.misceval.objectRepr(e)},from$file(){const e=this.tp$getattr(Sk.builtin.str.$file);return e&&" from "+Sk.misceval.objectRepr(e)},empty_or$loader(){if(this.$js&&this.$js.includes("$builtinmodule"))return" (built-in)";const e=this.tp$getattr(Sk.builtin.str.$loader);return void 0===e||Sk.builtin.checkNone(e)?"":" ("+Sk.misceval.objectRepr(e)+")"},get$mod_reprf(){const e=this.tp$getattr(Sk.builtin.str.$loader);return e&&e.tp$getattr(this.str$mod_repr)},str$mod_repr:new Sk.builtin.str("module_repr")}}),Sk.exportSymbol("Sk.builtin.module",Sk.builtin.module)},function(e,t){Sk.builtin.structseq_types={},Sk.builtin.make_structseq=function(e,t,n,i,r){i=void 0===i?{}:i,r=void 0===r?null:r;const s=e+"."+t,o=[],a={};Object.keys(n).forEach(((e,t)=>{o.push(e),a[e]={$get(){return this.v[t]},$doc:n[e]}}));const l=o.length;let u=l;Object.keys(i).forEach(((e,t)=>{a[e]={$get(){return this.$hidden[t]||Sk.builtin.none.none$},$doc:i[e]},u++}));var c=Sk.abstr.buildNativeClass(s,{constructor:function(e,t){Sk.asserts.assert(this instanceof c),Sk.builtin.tuple.call(this,e),this.$hidden=t||[]},base:Sk.builtin.tuple,slots:{tp$new(e,t){if(Sk.abstr.checkOneArg(s,e,t),(e=Sk.misceval.arrayFromIterable(e[0])).length<l)throw new Sk.builtin.TypeError(s+"() takes an at least "+l+"-sequence ("+e.length+"-sequence given)");if(e.length>u)throw new Sk.builtin.TypeError(s+"() takes an at most "+u+"-sequence ("+e.length+"-sequence given)");return new c(e.slice(0,l),e.slice(l))},tp$doc:r||Sk.builtin.none.none$,$r(){var e;if(0===this.v.length)return new Sk.builtin.str(s+"()");var t=[];for(e=0;e<o.length;++e)t[e]=o[e]+"="+Sk.misceval.objectRepr(this.v[e]);return e=t.join(", "),1===this.v.length&&(e+=","),new Sk.builtin.str(s+"("+e+")")}},methods:{__reduce__:{$meth(){throw new Sk.builtin.NotImplementedError("__reduce__ is not implemented")},$flags:{NoArgs:!0}}},getsets:a,proto:{num_sequence_fields:new Sk.builtin.int_(l)}});return c},Sk.exportSymbol("Sk.builtin.make_structseq",Sk.builtin.make_structseq)},function(e,t){Sk.builtin.generator=Sk.abstr.buildIteratorClass("generator",{constructor:function(e,t,n,i,r){var s;if(e){if(!(this instanceof Sk.builtin.generator))throw new TypeError("bad internal call to generator, use 'new'");if(this.func_code=e,this.func_globals=t||null,this.gi$running=!1,this.gi$resumeat=0,this.gi$sentvalue=Sk.builtin.none.none$,this.gi$locals={},this.gi$cells={},0<n.length)for(t=0;t<e.co_varnames.length;++t)this.gi$locals[e.co_varnames[t]]=n[t];if(void 0!==r)for(s in r)i[s]=r[s];this.func_closure=i}},slots:{$r(){return new Sk.builtin.str("<generator object "+this.func_code.co_name.v+">")}},iternext(e,t){var n=this;if(this.gi$running)throw new Sk.builtin.ValueError("generator already executing");return this.gi$running=!0,void 0===t&&(t=Sk.builtin.none.none$),this.gi$sentvalue=t,t=[this],this.func_closure&&t.push(this.func_closure),function t(i){if(i instanceof Sk.misceval.Suspension){if(e)return new Sk.misceval.Suspension(t,i);i=Sk.misceval.retryOptionalSuspensionOrThrow(i)}if(n.gi$running=!1,Sk.asserts.assert(void 0!==i),Array.isArray(i))return n.gi$resumeat=i[0],i[1];n.gi$ret=i}(this.func_code.apply(this.func_globals,t))},methods:{send:{$meth(e){return Sk.misceval.chain(this.tp$iternext(!0,e),(e=>{if(void 0===e)throw void 0!==(e=this.gi$ret)&&e!==Sk.builtin.none.none$?new Sk.builtin.StopIteration(e):new Sk.builtin.StopIteration;return e}))},$flags:{OneArg:!0},$doc:"send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration."}}}),Sk.exportSymbol("Sk.builtin.generator",Sk.builtin.generator),Sk.builtin.makeGenerator=function(e,t){var n,i=new Sk.builtin.generator(null,null,null);for(n in i.tp$iternext=e,t)t.hasOwnProperty(n)&&(i[n]=t[n]);return i},Sk.exportSymbol("Sk.builtin.makeGenerator",Sk.builtin.makeGenerator)},function(e,t){Sk.builtin.file=function(e,t,n){var i;if(!(this instanceof Sk.builtin.file))return new Sk.builtin.file(e,t,n);if(this.mode=t,this.name=Sk.ffi.remapToJs(e),this.closed=!1,"/dev/stdout"===this.name)this.data$=Sk.builtin.none.none$,this.fileno=1;else if("/dev/stdin"===this.name)this.fileno=0;else if("/dev/stderr"===this.name)this.fileno=2;else{if("w"===Sk.ffi.remapToJs(this.mode))this.fileno=Sk.builtin.file.currentFileno++;else for(i in this.fileno=Sk.inBrowser?10:11,this.data$=Sk.read(e.v),this.lineList=this.data$.split("\n"),this.lineList=this.lineList.slice(0,-1),this.lineList)this.lineList[i]+="\n";this.currentLine=0}return this.pos$=0,Sk.fileopen&&10<=this.fileno&&Sk.fileopen(this),this},Sk.builtin.file.currentFileno=12,Sk.abstr.setUpInheritance("file",Sk.builtin.file,Sk.builtin.object),Sk.abstr.setUpBuiltinMro(Sk.builtin.file),Sk.builtin.file.prototype.$r=function(){return new Sk.builtin.str("<"+(this.closed?"closed":"open")+"file '"+this.name+"', mode '"+Sk.ffi.remapToJs(this.mode)+"'>")},Sk.builtin.file.prototype.tp$iter=function(){var e={tp$iter:function(){return e},$obj:this,$index:this.currentLine,$lines:this.lineList,tp$iternext:function(){if(!(e.$index>=e.$lines.length))return new Sk.builtin.str(e.$lines[e.$index++])}};return e},Sk.abstr.setUpSlots(Sk.builtin.file),Sk.builtin.file.prototype.__enter__=new Sk.builtin.func((function(e){return e})),Sk.builtin.file.prototype.__exit__=new Sk.builtin.func((function(e){return Sk.misceval.callsimArray(Sk.builtin.file.prototype.close,[e])})),Sk.builtin.file.prototype.close=new Sk.builtin.func((function(e){return e.closed=!0,Sk.builtin.none.none$})),Sk.builtin.file.prototype.flush=new Sk.builtin.func((function(e){})),Sk.builtin.file.prototype.fileno=new Sk.builtin.func((function(e){return this.fileno})),Sk.builtin.file.prototype.isatty=new Sk.builtin.func((function(e){return!1})),Sk.builtin.file.prototype.read=new Sk.builtin.func((function(e,t){var n=e.data$.length;if(e.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");var i=void 0===t?n:Sk.ffi.remapToJs(t);return i=new Sk.builtin.str(e.data$.substr(e.pos$,i)),e.pos$=void 0===t?n:e.pos$+Sk.ffi.remapToJs(t),e.pos$>=n&&(e.pos$=n),i})),Sk.builtin.file.$readline=function(e,t,n){if(0===e.fileno){if(e=Sk.ffi.remapToJs(n),(e=Sk.inputfun(e||""))instanceof Promise||e&&"function"==typeof e.then){var i=new Sk.misceval.Suspension;return i.resume=function(){if(i.data.error)throw i.data.error;return new Sk.builtin.str(i.data.result)},i.data={type:"Sk.promise",promise:e},i}return new Sk.builtin.str(e)}return t="",e.currentLine<e.lineList.length&&(t=e.lineList[e.currentLine],e.currentLine++),new Sk.builtin.str(t)},Sk.builtin.file.prototype.readline=new Sk.builtin.func((function(e,t){return Sk.builtin.file.$readline(e,t,void 0)})),Sk.builtin.file.prototype.readlines=new Sk.builtin.func((function(e,t){if(0===e.fileno)return new Sk.builtin.NotImplementedError("readlines ins't implemented because the web doesn't support Ctrl+D");var n=[];for(t=e.currentLine;t<e.lineList.length;t++)n.push(new Sk.builtin.str(e.lineList[t]));return new Sk.builtin.list(n)})),Sk.builtin.file.prototype.seek=new Sk.builtin.func((function(e,t,n){return t=Sk.ffi.remapToJs(t),void 0===n&&(n=0),0===n?e.pos$=t:(1==n||2==n)&&(e.pos$=e.data$.length+t),Sk.builtin.none.none$})),Sk.builtin.file.prototype.tell=new Sk.builtin.func((function(e){return Sk.ffi.remapToPy(e.pos$)})),Sk.builtin.file.prototype.truncate=new Sk.builtin.func((function(e,t){Sk.asserts.fail()})),Sk.builtin.file.prototype.write=new Sk.builtin.func((function(e,t){var n=Sk.ffi.remapToJs(e.mode);if(Sk.ffi.remapToJs(t),"w"===n||"wb"===n||"a"===n||"ab"===n)if(Sk.filewrite){if(e.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");1===e.fileno?Sk.output(Sk.ffi.remapToJs(t)):Sk.filewrite(e,t)}else 1===e.fileno?Sk.output(Sk.ffi.remapToJs(t)):Sk.asserts.fail();return Sk.builtin.none.none$})),Sk.exportSymbol("Sk.builtin.file",Sk.builtin.file)},function(e,t){function n(e,t){if(null==e)return Sk.builtin.none.none$;var i=typeof e;if("object"===i||"function"===i){if("sk$object"in e&&!0===e.sk$object)return e;if("$isPyWrapped"in e&&!0===e.$isPyWrapped&&e.unwrap)return e.unwrap()}if(t=t||{},"string"===i)return new Sk.builtin.str(e);if("symbol"===i)return new H(e);if("number"===i)return o(e);if("boolean"===i)return new Sk.builtin.bool(e);if("function"===i)return t.funcHook?t.funcHook(e):c(e);if(JSBI.__isBigInt(e))return new Sk.builtin.int_(JSBI.numberIfSafe(e));if(Array.isArray(e))return t.arrayHook?t.arrayHook(e):new Sk.builtin.list(e.map((e=>n(e,t))));if("object"===i){if((i=e.constructor)===Object&&Object.getPrototypeOf(e)===g||void 0===i)return t.dictHook?t.dictHook(e):u(e,t);if(i===Uint8Array)return new Sk.builtin.bytes(e);if(i===Set)return t.setHook?t.setHook(e):l(e,t);if(i===Map){if(t.mapHook)return t.mapHook(e);const i=new Sk.builtin.dict;return e.forEach(((e,r)=>{i.mp$ass_subscript(n(r,t),n(e,t))})),i}return i===Sk.misceval.Suspension?e:t.proxyHook?t.proxyHook(e):c(e)}if(t.unhandledHook)return t.unhandledHook(e);Sk.asserts.fail("unhandled remap case of type "+i)}function i(e,t){if(null==e)return e;const n=e.valueOf();if(null===n)return n;const o=typeof n;return t=t||{},"string"===o?t.stringHook?t.stringHook(n):n:"symbol"===o||"boolean"===o?n:"number"===o?t.numberHook?t.numberHook(n,e):n:JSBI.__isBigInt(n)?t.bigintHook?t.bigintHook(n,e):n:Array.isArray(n)?t.arrayHook?t.arrayHook(n,e):n.map((e=>i(e,t))):n.sk$object?e instanceof Sk.builtin.dict?t.dictHook?t.dictHook(e):s(e,t):e instanceof Sk.builtin.set?t.setHook?t.setHook(e):new Set(r(e,t)):t.unhandledHook?t.unhandledHook(e):void 0:"object"===o?t.objectHook?t.objectHook(n,e):n:"function"===o?t.funcHook?t.funcHook(n,e):n:void Sk.asserts.fail("unhandled type "+o)}function r(e,t){return Array.from(e,(e=>i(e,t)))}function s(e,t){const n={};return e.$items().forEach((e=>{var[r,s]=e;n[r.valueOf()]=i(s,t)})),n}function o(e){return Number.isInteger(e)?Math.abs(e)<Number.MAX_SAFE_INTEGER?new Sk.builtin.int_(e):new Sk.builtin.int_(JSBI.BigInt(e)):new Sk.builtin.float_(e)}function a(e,t){return new Sk.builtin.list(Array.from(e,(e=>n(e,t))))}function l(e,t){return new Sk.builtin.set(Array.from(e,(e=>n(e,t))))}function u(e,t){const i=new Sk.builtin.dict;return Object.entries(e).forEach((e=>{var[r,s]=e;i.mp$ass_subscript(new Sk.builtin.str(r),n(s,t))})),i}function c(e,t){if(null==e)return Sk.builtin.none.none$;var i=typeof e;if("object"!==i&&"function"!==i)return n(e);t=t||{};const r=$.get(e);if(r){if(t.bound===r.$bound)return r;t.name||(t.name=r.$name)}return t="function"===i?new I(e,t):Array.isArray(e)?new P(e):(i=Object.getPrototypeOf(e))===S?new B(e):i===y?new M(e):new I(e,t),$.set(e,t),t}function d(e,t){e=e.toString(),void 0===t?delete this.js$wrapped[e]:this.js$wrapped[e]=i(t,N)}function f(e){return Sk.generic.getAttr.call(this,e)||this.$lookup(e)}function h(){this.js$wrapped.clear()}function p(){return Sk.misceval.callsimOrSuspendArray(Sk.builtin.dict,[this])}function m(){return this.js$wrapped.size}function _(e){if(e=i(e,N),this.js$wrapped.has(e))return this.proxy$getItem(e)}function b(e){if(e=i(e,N),this.js$wrapped.has(e)){const t=this.proxy$getItem(e);return this.js$wrapped.delete(e),t}}Sk.ffi={remapToPy:n,remapToJs:i,remapToJsOrWrap:function(e){return i(e,N)},toPy:n,toJs:i,isTrue:function(e){return null!=e&&e.nb$bool?e.nb$bool():e.sq$length?0!==e.sq$length():!!e},toJsString:function(e){return String(e)},toJsNumber:function(e){return Number(e)},toJsArray:r,toJsHashMap:s,toPyDict:u,toPyFloat:function(e){return new Sk.builtin.float_(Number(e))},toPyInt:function(e){if("number"==typeof e)return e=Math.trunc(e),Math.abs(e)<Number.MAX_SAFE_INTEGER?new Sk.builtin.int_(e):new Sk.builtin.int_(JSBI.BigInt(e));if(JSBI.__isBigInt(e))return new Sk.builtin.int_(JSBI.numberIfSafe(e));if("string"==typeof e&&e.match(v))return new Sk.builtin.int_(e);throw new TypeError("bad type passed to toPyInt() got "+e)},toPyNumber:function(e){const t=typeof e;return"number"===t?o(e):"string"===t?e.match(v)?new Sk.builtin.int_(e):new Sk.builtin.float_(parseFloat(e)):JSBI.__isBigInt(e)?new Sk.builtin.int_(JSBI.numberIfSafe(e)):new Sk.builtin.float_(Number(e))},toPyStr:function(e){return new Sk.builtin.str(e)},toPyList:a,toPyTuple:function(e,t){return new Sk.builtin.tuple(Array.from(e,(e=>n(e,t))))},toPySet:l,numberToPy:o,proxy:c};const g=Object.prototype,k=Function.prototype,S=Map.prototype,y=Set.prototype,v=/^-?\d+$/,$=new WeakMap,w=new WeakMap,x=e=>c(e),A=e=>Object.isFrozen(e)?a(e,C):c(e),E=e=>String(e),C={arrayHook:A,dictHook:x,unhandledHook:E,setHook:x,mapHook:x},T=(e,t)=>({dictHook:x,funcHook:n=>c(n,{bound:e,name:t}),unhandledHook:E,arrayHook:A,setHook:x,mapHook:x}),N={unhandledHook:e=>{var t=$.get(e);if(t)return t;if(t={v:e,$isPyWrapped:!0,unwrap:()=>e},void 0===e.tp$call)return $.set(e,t),t;if(e.ob$type===Sk.builtin.method){var r=e.im_self,s=e.im_func;let t=w.get(r);if(void 0===t&&(t=new Map,w.set(r,t)),void 0===(r=t.get(s)))r=e,t.set(s,e);else if(e=r,s=$.get(e))return s}return s=(...t)=>{t=t.map((e=>n(e,C)));let r=Sk.misceval.tryCatch((()=>Sk.misceval.chain(e.tp$call(t),(e=>i(e,N)))),(e=>{if(!Sk.uncaughtException)throw e;Sk.uncaughtException(e)}));for(;r instanceof Sk.misceval.Suspension;){if(!r.optional||r.data&&"Sk.debug"===r.data.type&&"Sk.debug"in Sk.misceval.defaultHandlers)return Sk.misceval.asyncToPromise((()=>r));r=r.resume()}return r},$.set(e,Object.assign(s,t)),s},arrayHook:e=>e[O]||e.map((e=>i(e,N)))};e={__dir__:{$meth:function(){const e=[];for(var t=this.js$wrapped;null!=t&&t!==g&&t!==k;)e.push(...Object.getOwnPropertyNames(t)),t=Object.getPrototypeOf(t);return t=r(Sk.misceval.callsimArray(Sk.builtin.type.prototype.__dir__,[this.ob$type])),new a(new Set([...t,...e]))},$flags:{NoArgs:!0}}};const I=Sk.abstr.buildNativeClass("Proxy",{constructor:function(e,t){if(void 0===e)throw new Sk.builtin.TypeError("Proxy cannot be called from python");this.js$wrapped=e,this.$module=null,this.$methods=Object.create(null),this.in$repr=!1,t||(t={}),Object.defineProperties(this,this.memoized$slots),"function"==typeof e?(this.is$callable=!0,this.$bound=t.bound,this.$name=t.name||e.name||"(native JS)",2>=this.$name.length&&(this.$name+=" (native JS)")):(this.is$callable=!1,delete this.is$type,this.is$type=!1,this.$name=t.name)},slots:{tp$doc:"proxy for a javascript object",tp$hash(){return Sk.builtin.object.prototype.tp$hash.call(this.js$wrapped)},tp$getattr(e){return this.$lookup(e)||Sk.generic.getAttr.call(this,e)},tp$setattr:d,$r(){if(this.is$callable){if(this.is$type||!this.$bound)return new Sk.builtin.str("<"+this.tp$name+" '"+this.$name+"'>");var e=Sk.misceval.objectRepr(c(this.$bound));return new Sk.builtin.str("<bound "+this.tp$name+" '"+this.$name+"' of "+e+">")}return this.js$proto===g?this.in$repr?new Sk.builtin.str("{...}"):(this.in$repr=!0,e=Object.entries(this.js$wrapped).map((e=>{var[t,i]=e;return i=n(i,T(this.js$wrapped,t)),"'"+t+"': "+Sk.misceval.objectRepr(i)})),e=new Sk.builtin.str("proxyobject({"+e.join(", ")+"})"),this.in$repr=!1,e):new Sk.builtin.str("<"+this.tp$name+" "+("proxyobject"===this.tp$name?"object":"proxyobject")+">")},tp$as_sequence_or_mapping:!0,mp$subscript(e){const t=this.$lookup(e);if(void 0===t)throw new Sk.builtin.LookupError(e);return t},mp$ass_subscript(e,t){return this.tp$setattr(e,t)},sq$contains(e){return i(e)in this.js$wrapped},ob$eq(e){return this.js$wrapped===e.js$wrapped},ob$ne(e){return this.js$wrapped!==e.js$wrapped},tp$as_number:!0,nb$bool(){return this.js$proto===g?0<Object.keys(this.js$wrapped).length:!this.sq$length||0<this.sq$length()}},methods:Object.assign({},e,{__new__:{$meth(e,...t){if(!(e instanceof I))throw new Sk.builtin.TypeError("expected a proxy object as the first argument not "+Sk.abstr.typeName(e));try{return e.$new(t)}catch(t){if(t instanceof TypeError&&t.message.includes("not a constructor"))throw new Sk.builtin.TypeError(Sk.misceval.objectRepr(e)+" is not a constructor");throw t}},$flags:{MinArgs:1}},__call__:{$meth(e,t){if("function"!=typeof this.js$wrapped)throw new Sk.builtin.TypeError("'"+this.tp$name+"' object is not callable");return this.$call(e,t)},$flags:{FastCall:!0}},keys:{$meth(){return new Sk.builtin.list(Object.keys(this.js$wrapped).map((e=>new Sk.builtin.str(e))))},$flags:{NoArgs:!0}},get:{$meth(e,t){return this.$lookup(e)||t||Sk.builtin.none.none$},$flags:{MinArgs:1,MaxArgs:2}}}),getsets:{__class__:{$get(){return n(this.js$wrapped.constructor,C)},$set(){throw new Sk.builtin.TypeError("not writable")}},__name__:{$get(){return new Sk.builtin.str(this.$name)}},__module__:{$get(){return this.$module||Sk.builtin.none.none$},$set(e){this.$module=e}}},proto:{valueOf(){return this.js$wrapped},$new(e,t){return Sk.abstr.checkNoKwargs("__new__",t),n(new this.js$wrapped(...e.map((e=>i(e,N)))),(e=>({dictHook:x,proxyHook:t=>c(t,{name:e}),arrayHook:A,setHook:x,mapHook:x}))(this.$name))},$call(e,t){return Sk.abstr.checkNoKwargs("__call__",t),Sk.misceval.chain(this.js$wrapped.apply(this.$bound,e.map((e=>i(e,N)))),(e=>e instanceof Promise?Sk.misceval.promiseToSuspension(e):e),(e=>n(e,C)))},$lookup(e){e=e.toString();const t=this.js$wrapped[e];return void 0!==t?null!==t&&"object"==typeof t&&t.window===t&&null===Object.getPrototypeOf(t)?c(t,{name:"CrossOriginWindow"}):n(t,T(this.js$wrapped,e)):e in this.js$wrapped?Sk.builtin.none.none$:void 0},memoized$slots:{js$proto:{configurable:!0,get(){return delete this.js$proto,this.js$proto=Object.getPrototypeOf(this.js$wrapped)}},tp$iter:{configurable:!0,get(){return delete this.tp$iter,void 0!==this.js$wrapped[Symbol.iterator]?this.tp$iter=()=>c(this.js$wrapped[Symbol.iterator]()):this.tp$iter=()=>{throw new Sk.builtin.TypeError(Sk.misceval.objectRepr(this)+" is not iterable")}}},tp$iternext:{configurable:!0,get(){if(delete this.tp$iternext,void 0!==this.js$wrapped.next)return this.tp$iternext=()=>{const e=this.js$wrapped.next().value;return e&&n(e,C)}}},sq$length:{configurable:!0,get(){if(delete this.sq$length,!this.is$callable&&void 0!==this.js$wrapped.length)return this.sq$length=()=>this.js$wrapped.length}},tp$call:{configurable:!0,get(){if(delete this.tp$call,this.is$callable)return this.tp$call=this.is$type?this.$new:this.$call}},tp$name:{configurable:!0,get(){if(delete this.tp$name,this.is$callable)return this.tp$name=this.is$type?"proxyclass":this.$bound?"proxymethod":"proxyfunction";{const e=this.js$wrapped;let t=e[Symbol.toStringTag]||this.$name||e.constructor&&e.constructor.name||"proxyobject";return"Object"===t?t="proxyobject":2>=t.length&&(t=c(e.constructor).$name),this.tp$name=t}}},is$type:{configurable:!0,get(){delete this.is$type;var e=this.js$wrapped;const t=e.prototype;if(void 0===t)return this.is$type=e===Sk.global.Proxy;{const t=z.call(e).match(q);e=null===t?null:"class"===t[0]||!U.has(e)}return!0===e?this.is$type=!0:!1===e?this.is$type=!1:1<Object.getOwnPropertyNames(t).length?this.is$type=!0:this.is$type=Object.getPrototypeOf(t)!==g}}}},flags:{sk$unacceptableBase:!0}});Sk.abstr.buildNativeClass("ProxyObject",{constructor:function(e){Sk.builtin.dict.call(this),this.js$wrapped=e}});const B=Sk.abstr.buildNativeClass("ProxyMap",{base:Sk.builtin.dict,constructor:function(e){Sk.builtin.dict.call(this),this.js$wrapped=e},slots:{tp$getattr:f,$r(){return new Sk.builtin.str(`ProxyMap(${Sk.builtin.dict.prototype.$r.call(this)})`)}},methods:e,proto:{$lookup:I.prototype.$lookup,proxy$getItem(e){return n(this.js$wrapped.get(e),C)},mp$lookup:_,dict$setItem(e,t){this.js$wrapped.set(i(e,N),i(t,N))},dict$clear:h,pop$item:b,dict$copy:p,get$size:m,$items(){return[...this.js$wrapped].map((e=>{var[t,i]=e;return[n(t,C),n(i,C)]}))},valueOf:I.prototype.valueOf},flags:{sk$unacceptableBase:!0}}),F=Sk.abstr.buildNativeClass("InternalProxySet",{base:Sk.builtin.dict,constructor:function(e){Sk.builtin.dict.call(this),this.js$wrapped=e},proto:{proxy$getItem:e=>!0,mp$lookup:_,dict$setItem(e,t){this.js$wrapped.add(i(e,N))},dict$clear:h,pop$item:b,dict$copy:p,get$size:m,$items(){return[...this.js$wrapped].map((e=>[n(e,C),!0]))}},flags:{sk$unacceptableBase:!0}}),M=Sk.abstr.buildNativeClass("ProxySet",{base:Sk.builtin.set,constructor:function(e){Sk.builtin.set.call(this),this.v=new F(e),this.js$wrapped=e},slots:{tp$getattr:f},methods:e,proto:{$lookup:I.prototype.$lookup,valueOf:I.prototype.valueOf},flags:{sk$unacceptableBase:!0}}),D={apply:(e,t,n)=>(n=r(n,N),e.apply(t,n))},L={},j=Array.prototype,O=Symbol("$proxy"),R={get(e,t){if(t===O)return e;const i=e[t];return t in j?"function"==typeof i?L[t]||(L[t]=new Proxy(i,D)):i:void 0!==i||t in e?n(i,C):i},set:(e,t,n)=>(e[t]=i(n,N),!0)},P=Sk.abstr.buildNativeClass("ProxyList",{base:Sk.builtin.list,constructor:function(e){Sk.builtin.list.call(this,e),this.js$wrapped=this.v,this.v=new Proxy(this.v,R)},slots:{tp$getattr:f,tp$setattr:d,$r(){return new Sk.builtin.str("proxylist("+Sk.builtin.list.prototype.$r.call(this)+")")}},methods:e,proto:{$lookup:I.prototype.$lookup}}),q=/^class|^function[a-zA-Z\d\(\)\{\s]+\[native code\]\s+\}$/,z=k.toString,U=new Set([Number,String,Symbol,Boolean]);void 0!==Sk.global.BigInt&&U.add(Sk.global.BigInt);const H=Sk.abstr.buildNativeClass("ProxySymbol",{constructor:function(e){this.v=e},slots:{$r(){return new Sk.builtin.str(this.toString())}},proto:{toString(){return this.v.toString()},valueOf(){return this.v}}})},function(e,t){function n(e,t,n){if(e=void 0===e?e:Sk.misceval.asIndexOrThrow(e),t=void 0===t?t:Sk.misceval.asIndexOrThrow(t),n=void 0===n?n:Sk.misceval.asIndexOrThrow(n),void 0===t&&void 0===n)t=e,e=0,n=1;else if(void 0===n)n=1;else if(0===n)throw new Sk.builtin.ValueError("range() step argument must not be zero");const r=[];if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)if(0<n)for(var s=e;s<t;s+=n)r.push(new Sk.builtin.int_(s));else for(s=e;s>t;s+=n)r.push(new Sk.builtin.int_(s));else{if(e=s=JSBI.BigInt(e),n=JSBI.BigInt(n),t=JSBI.BigInt(t),JSBI.greaterThan(n,JSBI.__ZERO))for(;JSBI.lessThan(s,t);)r.push(new Sk.builtin.int_(i(s))),s=JSBI.add(s,n);else for(;JSBI.greaterThan(s,t);)r.push(new Sk.builtin.int_(i(s))),s=JSBI.add(s,n);e=i(e),n=i(n),t=i(t)}return new Sk.builtin.range_(e,t,n,r)}function i(e){return JSBI.lessThan(e,JSBI.__MAX_SAFE)&&JSBI.greaterThan(e,JSBI.__MIN_SAFE)?JSBI.toNumber(e):e}Sk.builtin.range_=Sk.abstr.buildNativeClass("range",{constructor:function(e,t,n,i){this.start=e,this.stop=t,this.step=n,this.v=i},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$doc:"range(stop) -> range object\nrange(start, stop[, step]) -> range object\n\nReturn an object that produces a sequence of integers from start (inclusive)\nto stop (exclusive) by step. range(i, j) produces i, i+1, i+2, ..., j-1.\nstart defaults to 0, and stop is omitted! range(4) produces 0, 1, 2, 3.\nThese are exactly the valid indices for a list of 4 elements.\nWhen step is given, it specifies the increment (or decrement).",tp$new:(e,t)=>(Sk.abstr.checkNoKwargs("range",t),Sk.abstr.checkArgsLen("range",e,1,3),n(e[0],e[1],e[2])),$r(){let e="range("+this.start+", "+this.stop;return 1!=this.step&&(e+=", "+this.step),new Sk.builtin.str(e+")")},tp$richcompare(e,t){return"Eq"!==t&&"NotEq"!==t||e.ob$type!==Sk.builtin.range_?Sk.builtin.NotImplemented.NotImplemented$:(e=new Sk.builtin.list(e.v),new Sk.builtin.list(this.v).tp$richcompare(e,t))},tp$iter(){return new r(this)},nb$bool(){return 0!==this.v.length},sq$contains(e){const t=this.v;for(let n=0;n<t.length;n++)if(Sk.misceval.richCompareBool(e,t[n],"Eq"))return!0;return!1},sq$length(){return this.v.length},mp$subscript(e){if(Sk.misceval.isIndex(e)){if(0>(e=Sk.misceval.asIndexSized(e))&&(e=this.v.length+e),0>e||e>=this.v.length)throw new Sk.builtin.IndexError("range object index out of range");return this.v[e]}if(e.constructor===Sk.builtin.slice){const t=[],n=this.v;e.sssiter$(n.length,(e=>{t.push(n[e])}));let{start:i,stop:r,step:s}=e.slice$indices(n.length);return i=Sk.misceval.asIndex(n[i])||this.start,r=Sk.misceval.asIndex(n[r])||this.stop,s="number"==typeof this.step?s*this.step:JSBI.multiply(this.step,JSBI.BigInt(s)),new Sk.builtin.range_(i,r,s,t)}throw new Sk.builtin.TypeError("range indices must be integers or slices, not "+Sk.abstr.typeName(e))}},getsets:{start:{$get(){return new Sk.builtin.int_(this.start)}},step:{$get(){return new Sk.builtin.int_(this.step)}},stop:{$get(){return new Sk.builtin.int_(this.stop)}}},methods:{__reversed__:{$meth(){return new s(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a reverse iterator."},count:{$meth(e){let t=0;for(let n=0;n<this.v.length;n++)Sk.misceval.richCompareBool(e,this.v[n],"Eq")&&t++;return new Sk.builtin.int_(t)},$flags:{OneArg:!0},$textsig:null,$doc:"rangeobject.count(value) -> integer -- return number of occurrences of value"},index:{$meth(e){for(let t=0;t<this.v.length;t++)if(Sk.misceval.richCompareBool(e,this.v[t],"Eq"))return new Sk.builtin.int_(t);throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(e)+"is not in range")},$flags:{OneArg:!0},$textsig:null,$doc:"rangeobject.index(value, [start, [stop]]) -> integer -- return index of value.\nRaise ValueError if the value is not present."}},proto:{sk$asarray(){return this.v.slice(0)}},flags:{sk$unacceptableBase:!0}});var r=Sk.abstr.buildIteratorClass("range_iterator",{constructor:function(e){this.$index=0,this.$seq=e.v},iternext(){return this.$seq[this.$index++]},methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$unacceptableBase:!0}}),s=Sk.abstr.buildIteratorClass("range_reverseiterator",{constructor:function(e){this.$seq=e.v,this.$index=this.$seq.length-1},iternext(){return this.$seq[this.$index--]},methods:{__length_hint__:Sk.generic.iterReverseLengthHintMethodDef},flags:{sk$unacceptableBase:!0}});Sk.builtin.range=Sk.builtin.xrange=function(e,t,i){return e=n(e,t,i),new Sk.builtin.list(e.v)}},function(e,t){Sk.builtin.enumerate=Sk.abstr.buildIteratorClass("enumerate",{constructor:function(e,t){if(!(this instanceof Sk.builtin.enumerate))throw TypeError("Failed to construct 'enumerate': Please use the 'new' operator");return this.$iterable=e,this.$index=t,this},iternext(e){const t=Sk.misceval.chain(this.$iterable.tp$iternext(e),(e=>{if(void 0!==e)return new Sk.builtin.tuple([new Sk.builtin.int_(this.$index++),e])}));return e?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)},slots:{tp$doc:"Return an enumerate object.\n\n iterable\n an object supporting iteration\n\nThe enumerate object yields pairs containing a count (from start, which\ndefaults to zero) and a value yielded by the iterable argument.\n\nenumerate is useful for obtaining an indexed list:\n (0, seq[0]), (1, seq[1]), (2, seq[2]), ...",tp$new(e,t){let[n,i]=Sk.abstr.copyKeywordsToNamedArgs("enumerate",["iterable","start"],e,t,[new Sk.builtin.int_(0)]);return n=Sk.abstr.iter(n),i=Sk.misceval.asIndexOrThrow(i),this===Sk.builtin.enumerate.prototype?new Sk.builtin.enumerate(n,i):(e=new this.constructor,Sk.builtin.enumerate.call(e,n,i),e)}},classmethods:Sk.generic.classGetItem}),Sk.exportSymbol("Sk.builtin.enumerate",Sk.builtin.enumerate)},function(e,t){Sk.builtin.filter_=Sk.abstr.buildIteratorClass("filter",{constructor:function(e,t){this.$func=e,this.$iterable=t},iternext(e){const t=Sk.misceval.iterFor(this.$iterable,(e=>Sk.misceval.chain(this.check$filter(e),(e=>e?new Sk.misceval.Break(e):void 0))));return e?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)},slots:{tp$doc:"Return an iterator yielding those items of iterable for which function(item)\nis true. If function is None, return the items that are true.",tp$new(e,t){let[n,i]=Sk.abstr.copyKeywordsToNamedArgs("filter",["predicate","iterable"],e,t,[]);return n=Sk.builtin.checkNone(n)?null:n,i=Sk.abstr.iter(i),this===Sk.builtin.filter_.prototype?new Sk.builtin.filter_(n,i):(e=new this.constructor,Sk.builtin.filter_.call(e,n,i),e)}},proto:{check$filter(e){let t;return t=null===this.$func?e:Sk.misceval.callsimOrSuspendArray(this.$func,[e]),Sk.misceval.chain(t,(t=>Sk.misceval.isTrue(t)?e:void 0))}}}),Sk.exportSymbol("Sk.builtin.filter_",Sk.builtin.filter_)},function(e,t){Sk.builtin.map_=Sk.abstr.buildIteratorClass("map",{constructor:function(e,t){this.$func=e,this.$iters=t},iternext(e){const t=[],n=Sk.misceval.chain(Sk.misceval.iterArray(this.$iters,(n=>Sk.misceval.chain(n.tp$iternext(e),(e=>{if(void 0===e)return new Sk.misceval.Break(!0);t.push(e)})))),(e=>e?void 0:Sk.misceval.callsimOrSuspendArray(this.$func,t)));return e?n:Sk.misceval.retryOptionalSuspensionOrThrow(n)},slots:{tp$doc:"map(func, *iterables) --\x3e map object\n\nMake an iterator that computes the function using arguments from\neach of the iterables. Stops when the shortest iterable is exhausted.",tp$new(e,t){this===Sk.builtin.map_.prototype&&Sk.abstr.checkNoKwargs("map",t),Sk.abstr.checkArgsLen("map",e,2),t=e[0];const n=[];for(let t=1;t<e.length;t++)n.push(Sk.abstr.iter(e[t]));return this===Sk.builtin.map_.prototype?new Sk.builtin.map_(t,n):(e=new this.constructor,Sk.builtin.map_.call(e,t,n),e)}}}),Sk.exportSymbol("Sk.builtin.map_",Sk.builtin.map_)},function(e,t){Sk.builtin.reversed=Sk.abstr.buildIteratorClass("reversed",{constructor:function(e){return this.$idx=e.sq$length()-1,this.$seq=e,this},iternext(e){if(!(0>this.$idx)){var t=Sk.misceval.tryCatch((()=>Sk.abstr.objectGetItem(this.$seq,new Sk.builtin.int_(this.$idx--),e)),(e=>{if(!(e instanceof Sk.builtin.IndexError))throw e;this.$idx=-1}));return e?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)}},slots:{tp$doc:"Return a reverse iterator over the values of the given sequence.",tp$new(e,t){if(this===Sk.builtin.reversed.prototype&&Sk.abstr.checkNoKwargs("reversed",t),Sk.abstr.checkArgsLen("reversed",e,1,1),e=e[0],void 0!==(t=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$reversed)))return Sk.misceval.callsimArray(t,[]);if(!Sk.builtin.checkSequence(e)||void 0===Sk.abstr.lookupSpecial(e,Sk.builtin.str.$len))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not a sequence");return this===Sk.builtin.reversed.prototype?new Sk.builtin.reversed(e):(t=new this.constructor,Sk.builtin.reversed.call(t,e),t)}},methods:{__length_hint__:{$meth:function(){return 0<=this.$idx?new Sk.builtin.int_(this.$idx):new Sk.builtin.int_(0)},$flags:{NoArgs:!0}}}})},function(e,t){Sk.builtin.zip_=Sk.abstr.buildIteratorClass("zip",{constructor:function(e){this.$iters=e,0===e.length&&(this.tp$iternext=()=>{})},iternext(e){const t=[],n=Sk.misceval.chain(Sk.misceval.iterArray(this.$iters,(n=>Sk.misceval.chain(n.tp$iternext(e),(e=>{if(void 0===e)return new Sk.misceval.Break(!0);t.push(e)})))),(e=>e?void 0:new Sk.builtin.tuple(t)));return e?n:Sk.misceval.retryOptionalSuspensionOrThrow(n)},slots:{tp$doc:"zip(iter1 [,iter2 [...]]) --\x3e zip object\n\nReturn a zip object whose .__next__() method returns a tuple where\nthe i-th element comes from the i-th iterable argument. The .__next__()\nmethod continues until the shortest iterable in the argument sequence\nis exhausted and then it raises StopIteration.",tp$new(e,t){this===Sk.builtin.zip_.prototype&&Sk.abstr.checkNoKwargs("zip",t),t=[];for(let n=0;n<e.length;n++)try{t.push(Sk.abstr.iter(e[n]))}catch(e){if(e instanceof Sk.builtin.TypeError)throw new Sk.builtin.TypeError("zip argument #"+(n+1)+" must support iteration");throw e}return this===Sk.builtin.zip_.prototype?new Sk.builtin.zip_(t):(e=new this.constructor,Sk.builtin.zip_.call(e,t),e)}}}),Sk.exportSymbol("Sk.builtin.zip_",Sk.builtin.zip_)},function(e,t){var n={T_ENDMARKER:0,T_NAME:1,T_NUMBER:2,T_STRING:3,T_NEWLINE:4,T_INDENT:5,T_DEDENT:6,T_LPAR:7,T_RPAR:8,T_LSQB:9,T_RSQB:10,T_COLON:11,T_COMMA:12,T_SEMI:13,T_PLUS:14,T_MINUS:15,T_STAR:16,T_SLASH:17,T_VBAR:18,T_AMPER:19,T_LESS:20,T_GREATER:21,T_EQUAL:22,T_DOT:23,T_PERCENT:24,T_LBRACE:25,T_RBRACE:26,T_EQEQUAL:27,T_NOTEQUAL:28,T_LESSEQUAL:29,T_GREATEREQUAL:30,T_TILDE:31,T_CIRCUMFLEX:32,T_LEFTSHIFT:33,T_RIGHTSHIFT:34,T_DOUBLESTAR:35,T_PLUSEQUAL:36,T_MINEQUAL:37,T_STAREQUAL:38,T_SLASHEQUAL:39,T_PERCENTEQUAL:40,T_AMPEREQUAL:41,T_VBAREQUAL:42,T_CIRCUMFLEXEQUAL:43,T_LEFTSHIFTEQUAL:44,T_RIGHTSHIFTEQUAL:45,T_DOUBLESTAREQUAL:46,T_DOUBLESLASH:47,T_DOUBLESLASHEQUAL:48,T_AT:49,T_ATEQUAL:50,T_RARROW:51,T_ELLIPSIS:52,T_OP:53,T_AWAIT:54,T_ASYNC:55,T_ERRORTOKEN:56,T_NT_OFFSET:256,T_N_TOKENS:60,T_COMMENT:57,T_NL:58,T_ENCODING:59};e={"!=":n.T_NOTEQUAL,"%":n.T_PERCENT,"%=":n.T_PERCENTEQUAL,"&":n.T_AMPER,"&=":n.T_AMPEREQUAL,"(":n.T_LPAR,")":n.T_RPAR,"*":n.T_STAR,"**":n.T_DOUBLESTAR,"**=":n.T_DOUBLESTAREQUAL,"*=":n.T_STAREQUAL,"+":n.T_PLUS,"+=":n.T_PLUSEQUAL,",":n.T_COMMA,"-":n.T_MINUS,"-=":n.T_MINEQUAL,"->":n.T_RARROW,".":n.T_DOT,"...":n.T_ELLIPSIS,"/":n.T_SLASH,"//":n.T_DOUBLESLASH,"//=":n.T_DOUBLESLASHEQUAL,"/=":n.T_SLASHEQUAL,":":n.T_COLON,";":n.T_SEMI,"<":n.T_LESS,"<<":n.T_LEFTSHIFT,"<<=":n.T_LEFTSHIFTEQUAL,"<=":n.T_LESSEQUAL,"=":n.T_EQUAL,"==":n.T_EQEQUAL,">":n.T_GREATER,">=":n.T_GREATEREQUAL,">>":n.T_RIGHTSHIFT,">>=":n.T_RIGHTSHIFTEQUAL,"@":n.T_AT,"@=":n.T_ATEQUAL,"[":n.T_LSQB,"]":n.T_RSQB,"^":n.T_CIRCUMFLEX,"^=":n.T_CIRCUMFLEXEQUAL,"{":n.T_LBRACE,"|":n.T_VBAR,"|=":n.T_VBAREQUAL,"}":n.T_RBRACE,"~":n.T_TILDE};var i={};!function(){for(var e in n)i[n[e]]=e}(),["tok_name","ISTERMINAL","ISNONTERMINAL","ISEOF"].concat(Object.keys(i).map((function(e){return i[e]}))),Sk.token={},Sk.token.tokens=n,Sk.token.tok_name=i,Sk.token.EXACT_TOKEN_TYPES=e,Sk.token.ISTERMINAL=function(e){return e<n.T_NT_OFFSET},Sk.token.ISNONTERMINAL=function(e){return e>=n.T_NT_OFFSET},Sk.token.ISEOF=function(e){return e==n.T_ENDMARKER},Sk.exportSymbol("Sk.token",Sk.token),Sk.exportSymbol("Sk.token.tokens",Sk.token.tokens),Sk.exportSymbol("Sk.token.tok_name",Sk.token.tok_name),Sk.exportSymbol("Sk.token.EXACT_TOKEN_TYPES"),Sk.exportSymbol("Sk.token.ISTERMINAL",Sk.token.ISTERMINAL),Sk.exportSymbol("Sk.token.ISNONTERMINAL",Sk.token.ISNONTERMINAL),Sk.exportSymbol("Sk.token.ISEOF",Sk.token.ISEOF)},function(e,t,n){function i(e,t,n,i,r){this.type=e,this.string=t,this.start=n,this.end=i,this.line=r}function r(e){return"("+Array.prototype.slice.call(arguments).join("|")+")"}function s(e){return r.apply(null,arguments)+"?"}function o(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1}function a(e){return e=e.normalize("NFKC"),A.test(e)}function l(){return" FR RF Br BR Fr r B R b bR f rb rB F Rf U rF u RB br fR fr rf Rb".split(" ")}function u(e){e?delete Sk.token.EXACT_TOKEN_TYPES["<>"]:Sk.token.EXACT_TOKEN_TYPES["<>"]=Sk.token.tokens.T_NOTEQUAL,E=Object.keys(Sk.token.EXACT_TOKEN_TYPES).sort(),C=r.apply(this,E.reverse().map((function(e){return e&&p.test(e)?e.replace(h,"\\$&"):e}))),T=r("\\r?\\n",C)}n.r(t),e=n(1);var c=Sk.token.tokens;const d=Sk.builtin.SyntaxError,f=Sk.builtin.SyntaxError;i.prototype.exact_type=function(){return this.type==c.T_OP&&this.string in Sk.token.EXACT_TOKEN_TYPES?Sk.token.EXACT_TOKEN_TYPES[this.string]:this.type};var h=/[\\^$.*+?()[\]{}|]/g,p=RegExp(h.source);const{Lu:m,Ll:_,Lt:b,Lm:g,Lo:k,Nl:S,Mn:y,Mc:v,Nd:$,Pc:w}=e.default,x="["+(e=m+_+b+g+k+S+"_\\u1885-\\u1886\\u2118\\u212E\\u309B-\\u309C")+"]+["+(e+y+v+$+w)+"\\u00B7\\u0387\\u1369-\\u1371\\u19DA]*",A=new RegExp("^"+x+"$");Sk.token.isIdentifier=a,function(e){r.apply(null,arguments)}("\\\\\\r?\\n[ \\f\\t]*"),s("#[^\\r\\n]*"),e=r("[0-9](?:_?[0-9])*\\.(?:[0-9](?:_?[0-9])*)?","\\.[0-9](?:_?[0-9])*")+s("[eE][-+]?[0-9](?:_?[0-9])*");var E,C,T,N=r(e,"[0-9](?:_?[0-9])*[eE][-+]?[0-9](?:_?[0-9])*"),I=r("[0-9](?:_?[0-9])*[jJ]",N+"[jJ]");e=r.apply(null,l()),t=r(e+"'''",e+'"""'),r(e+"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'",e+'"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*"'),u(!0),Sk.token.setupTokens=u;var B=r(e+"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*"+r("'","\\\\\\r?\\n"),e+'"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*'+r('"',"\\\\\\r?\\n")),F=r("\\\\\\r?\\n|$","#[^\\r\\n]*",t),M={};e=l();for(let t of e)M[t+"'"]="^[^'\\\\]*(?:\\\\.[^'\\\\]*)*'",M[t+'"']='^[^"\\\\]*(?:\\\\.[^"\\\\]*)*"',M[t+"'''"]="^[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''",M[t+'"""']='^[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""';let D=[],L=[];for(let t of e)D.push(t+'"'),D.push(t+"'"),L.push(t+'"""'),L.push(t+"'''");var j=new Map;Sk._tokenize=function(e,t,n,s){var l=Sk.__future__.python3;if(j.has(l))l=j.get(l);else{var u=l?"":"(?:L?)";u=r("0[xX](?:_?[0-9a-fA-F])+"+u,"0[bB](?:_?[01])+"+u,Sk.__future__.silent_octal_literal?"0([oO]?)(?:_?[0-7])+"+u:"0([oO])(?:_?[0-7])+"+u,"(?:0(?:_?0)*|[1-9](?:_?[0-9])*)"+u),u=r(I,N,u),u="[ \\f\\t]*"+r(F,u,T,B,x),u=new RegExp(u),j.set(l,u),l=u}var h,p,m,_=u=0,b=0,g="",k=0,S=null,y=[0],v=void 0,$=void 0;void 0!==n&&("utf-8-sig"==n&&(n="utf-8"),s(new i(c.T_ENCODING,n,[0,0],[0,0],"")));for(var w=n="";;){try{n=w,w=t()}catch(e){w=""}u+=1;var A=0,E=w.length;if(g){if(!w)throw new d("EOF in multi-line string",e,$[0],$[1]);v.lastIndex=0;var C=v.exec(w);if(!C){k&&"\\\n"!==w.substring(w.length-2)&&"\\\r\n"!==w.substring(w.length-3)?(s(new i(c.T_ERRORTOKEN,g+w,$,[u,w.length],S)),g="",S=null):(g+=w,S+=w);continue}A=p=C[0].length,s(new i(c.T_STRING,g+w.substring(0,p),$,[u,p],S+w)),g="",k=0,S=null}else if(0!=_||b){if(!w)throw new d("EOF in multi-line statement",e,u,0);b=0}else{if(!w)break;for(h=0;A<E;){if(" "==w[A])h+=1;else if("\t"==w[A])h=8*Math.floor(h/8+1);else{if("\f"!=w[A])break;h=0}A+=1}if(A==E)break;if(o("#\r\n",w[A])){if("#"==w[A]){for(E=(h=w.substring(A)).length;0<E&&-1!=="\r\n".indexOf(h.charAt(E-1));--E);E=h.substring(0,E),s(new i(c.T_COMMENT,E,[u,A],[u,A+E.length],w)),A+=E.length}s(new i(c.T_NL,w.substring(A),[u,A],[u,w.length],w));continue}for(h>y[y.length-1]&&(y.push(h),s(new i(c.T_INDENT,w.substring(A),[u,0],[u,A],w)));h<y[y.length-1];){if(!o(y,h))throw new f("unindent does not match any outer indentation level",e,u,A);y=y.slice(0,-1),s(new i(c.T_DEDENT,"",[u,A],[u,A],w))}}for(;A<E;){for(h=w.charAt(A);" "===h||"\f"===h||"\t"===h;)A+=1,h=w.charAt(A);if(m=l.exec(w.substring(A))){if(p=(h=A)+m[1].length,m=[u,h],C=[u,p],A=p,h!=p){p=w.substring(h,p);var O=w[h];if(o("0123456789",O)||"."==O&&"."!=p&&"..."!=p)s(new i(c.T_NUMBER,p,m,C,w));else if(o("\r\n",O))s(new i(0<_?c.T_NL:c.T_NEWLINE,p,m,C,w));else if("#"==O)s(new i(c.T_COMMENT,p,m,C,w));else if(o(L,p)){if(!(C=(v=RegExp(M[p])).exec(w.substring(A)))){$=[u,h],g=w.substring(h),S=w;break}A=C[0].length+A,p=w.substring(h,A),s(new i(c.T_STRING,p,m,[u,A],w))}else if(o(D,O)||o(D,p.substring(0,2))||o(D,p.substring(0,3))){if("\n"==p[p.length-1]){$=[u,h],v=RegExp(M[O]||M[p[1]]||M[p[2]]),g=w.substring(h),k=1,S=w;break}s(new i(c.T_STRING,p,m,C,w))}else a(O)?s(new i(c.T_NAME,p,m,C,w)):"\\"==O?b=1:(o("([{",O)?_+=1:o(")]}",O)&&--_,s(new i(c.T_OP,p,m,C,w)))}}else s(new i(c.T_ERRORTOKEN,w[A],[u,A],[u,A+1],w)),A+=1}}for(var R in n&&!o("\r\n",n[n.length-1])&&s(new i(c.T_NEWLINE,"",[u-1,n.length],[u-1,n.length+1],"")),y.slice(1))s(new i(c.T_DEDENT,"",[u,0],[u,0],""));s(new i(c.T_ENDMARKER,"",[u,0],[u,0],""))},Sk._tokenize.Floatnumber=N,Sk.exportSymbol("Sk._tokenize",Sk._tokenize)},function(e,t){Sk.OpMap={"(":Sk.token.tokens.T_LPAR,")":Sk.token.tokens.T_RPAR,"[":Sk.token.tokens.T_LSQB,"]":Sk.token.tokens.T_RSQB,":":Sk.token.tokens.T_COLON,",":Sk.token.tokens.T_COMMA,";":Sk.token.tokens.T_SEMI,"+":Sk.token.tokens.T_PLUS,"-":Sk.token.tokens.T_MINUS,"*":Sk.token.tokens.T_STAR,"/":Sk.token.tokens.T_SLASH,"|":Sk.token.tokens.T_VBAR,"&":Sk.token.tokens.T_AMPER,"<":Sk.token.tokens.T_LESS,">":Sk.token.tokens.T_GREATER,"=":Sk.token.tokens.T_EQUAL,".":Sk.token.tokens.T_DOT,"%":Sk.token.tokens.T_PERCENT,"`":Sk.token.tokens.T_BACKQUOTE,"{":Sk.token.tokens.T_LBRACE,"}":Sk.token.tokens.T_RBRACE,"@":Sk.token.tokens.T_AT,"@=":Sk.token.tokens.T_ATEQUAL,"==":Sk.token.tokens.T_EQEQUAL,"!=":Sk.token.tokens.T_NOTEQUAL,"<>":Sk.token.tokens.T_NOTEQUAL,"<=":Sk.token.tokens.T_LESSEQUAL,">=":Sk.token.tokens.T_GREATEREQUAL,"~":Sk.token.tokens.T_TILDE,"^":Sk.token.tokens.T_CIRCUMFLEX,"<<":Sk.token.tokens.T_LEFTSHIFT,">>":Sk.token.tokens.T_RIGHTSHIFT,"**":Sk.token.tokens.T_DOUBLESTAR,"+=":Sk.token.tokens.T_PLUSEQUAL,"-=":Sk.token.tokens.T_MINEQUAL,"*=":Sk.token.tokens.T_STAREQUAL,"/=":Sk.token.tokens.T_SLASHEQUAL,"%=":Sk.token.tokens.T_PERCENTEQUAL,"&=":Sk.token.tokens.T_AMPEREQUAL,"|=":Sk.token.tokens.T_VBAREQUAL,"^=":Sk.token.tokens.T_CIRCUMFLEXEQUAL,"<<=":Sk.token.tokens.T_LEFTSHIFTEQUAL,">>=":Sk.token.tokens.T_RIGHTSHIFTEQUAL,"**=":Sk.token.tokens.T_DOUBLESTAREQUAL,"//":Sk.token.tokens.T_DOUBLESLASH,"//=":Sk.token.tokens.T_DOUBLESLASHEQUAL,"->":Sk.token.tokens.T_RARROW,"...":Sk.token.tokens.T_ELLIPSIS},Sk.ParseTables={sym:{and_expr:257,and_test:258,annassign:259,arglist:260,argument:261,arith_expr:262,assert_stmt:263,async_funcdef:264,async_stmt:265,atom:266,atom_expr:267,augassign:268,break_stmt:269,classdef:270,comp_for:271,comp_if:272,comp_iter:273,comp_op:274,comparison:275,compound_stmt:276,continue_stmt:277,debugger_stmt:278,decorated:279,decorator:280,decorators:281,del_stmt:282,dictorsetmaker:283,dotted_as_name:284,dotted_as_names:285,dotted_name:286,encoding_decl:287,eval_input:288,except_clause:289,expr:290,expr_stmt:291,exprlist:292,factor:293,file_input:294,flow_stmt:295,for_stmt:296,funcdef:297,global_stmt:298,if_stmt:299,import_as_name:300,import_as_names:301,import_from:302,import_name:303,import_stmt:304,lambdef:305,lambdef_nocond:306,nonlocal_stmt:307,not_test:308,or_test:309,parameters:310,pass_stmt:311,power:312,print_stmt:313,raise_stmt:314,return_stmt:315,shift_expr:316,simple_stmt:317,single_input:256,sliceop:318,small_stmt:319,star_expr:320,stmt:321,subscript:322,subscriptlist:323,suite:324,term:325,test:326,test_nocond:327,testlist:328,testlist_comp:329,testlist_star_expr:330,tfpdef:331,trailer:332,try_stmt:333,typedargslist:334,varargslist:335,vfpdef:336,while_stmt:337,with_item:338,with_stmt:339,xor_expr:340,yield_arg:341,yield_expr:342,yield_stmt:343},number2symbol:{256:"single_input",257:"and_expr",258:"and_test",259:"annassign",260:"arglist",261:"argument",262:"arith_expr",263:"assert_stmt",264:"async_funcdef",265:"async_stmt",266:"atom",267:"atom_expr",268:"augassign",269:"break_stmt",270:"classdef",271:"comp_for",272:"comp_if",273:"comp_iter",274:"comp_op",275:"comparison",276:"compound_stmt",277:"continue_stmt",278:"debugger_stmt",279:"decorated",280:"decorator",281:"decorators",282:"del_stmt",283:"dictorsetmaker",284:"dotted_as_name",285:"dotted_as_names",286:"dotted_name",287:"encoding_decl",288:"eval_input",289:"except_clause",290:"expr",291:"expr_stmt",292:"exprlist",293:"factor",294:"file_input",295:"flow_stmt",296:"for_stmt",297:"funcdef",298:"global_stmt",299:"if_stmt",300:"import_as_name",301:"import_as_names",302:"import_from",303:"import_name",304:"import_stmt",305:"lambdef",306:"lambdef_nocond",307:"nonlocal_stmt",308:"not_test",309:"or_test",310:"parameters",311:"pass_stmt",312:"power",313:"print_stmt",314:"raise_stmt",315:"return_stmt",316:"shift_expr",317:"simple_stmt",318:"sliceop",319:"small_stmt",320:"star_expr",321:"stmt",322:"subscript",323:"subscriptlist",324:"suite",325:"term",326:"test",327:"test_nocond",328:"testlist",329:"testlist_comp",330:"testlist_star_expr",331:"tfpdef",332:"trailer",333:"try_stmt",334:"typedargslist",335:"varargslist",336:"vfpdef",337:"while_stmt",338:"with_item",339:"with_stmt",340:"xor_expr",341:"yield_arg",342:"yield_expr",343:"yield_stmt"},dfas:{256:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],{2:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,41:1,42:1,43:1}],257:[[[[44,1]],[[45,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],258:[[[[46,1]],[[47,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],259:[[[[48,1]],[[49,2]],[[50,3],[0,2]],[[49,4]],[[0,4]]],{48:1}],260:[[[[51,1]],[[52,2],[0,1]],[[51,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,53:1}],261:[[[[49,1],[15,2],[53,2]],[[50,2],[54,3],[0,1]],[[49,3]],[[0,3]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,53:1}],262:[[[[55,1]],[[30,0],[43,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],263:[[[[24,1]],[[49,2]],[[52,3],[0,2]],[[49,4]],[[0,4]]],{24:1}],264:[[[[10,1]],[[56,2]],[[0,2]]],{10:1}],265:[[[[10,1]],[[57,2],[56,2],[58,2]],[[0,2]]],{10:1}],266:[[[[6,1],[25,1],[33,1],[9,1],[11,1],[12,2],[35,3],[38,4],[19,1],[7,5]],[[0,1]],[[59,1],[60,6]],[[61,1],[62,7],[63,7]],[[64,1],[63,8]],[[7,5],[0,5]],[[59,1]],[[61,1]],[[64,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,25:1,33:1,35:1,38:1}],267:[[[[29,1],[65,2]],[[65,2]],[[66,2],[0,2]]],{6:1,7:1,9:1,11:1,12:1,19:1,25:1,29:1,33:1,35:1,38:1}],268:[[[[67,1],[68,1],[69,1],[70,1],[71,1],[72,1],[73,1],[74,1],[75,1],[76,1],[77,1],[78,1],[79,1]],[[0,1]]],{67:1,68:1,69:1,70:1,71:1,72:1,73:1,74:1,75:1,76:1,77:1,78:1,79:1}],269:[[[[39,1]],[[0,1]]],{39:1}],270:[[[[13,1]],[[25,2]],[[48,3],[35,4]],[[80,5]],[[61,6],[81,7]],[[0,5]],[[48,3]],[[61,6]]],{13:1}],271:[[[[10,1],[34,2]],[[34,2]],[[82,3]],[[83,4]],[[84,5]],[[85,6],[0,5]],[[0,6]]],{10:1,34:1}],272:[[[[37,1]],[[86,2]],[[85,3],[0,2]],[[0,3]]],{37:1}],273:[[[[87,1],[54,1]],[[0,1]]],{10:1,34:1,37:1}],274:[[[[88,1],[89,1],[8,2],[90,1],[88,1],[83,1],[91,1],[92,3],[93,1],[94,1]],[[0,1]],[[83,1]],[[8,1],[0,3]]],{8:1,83:1,88:1,89:1,90:1,91:1,92:1,93:1,94:1}],275:[[[[95,1]],[[96,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],276:[[[[97,1],[98,1],[58,1],[99,1],[57,1],[100,1],[56,1],[101,1],[102,1]],[[0,1]]],{4:1,10:1,13:1,20:1,21:1,34:1,37:1,41:1,42:1}],277:[[[[40,1]],[[0,1]]],{40:1}],278:[[[[17,1]],[[0,1]]],{17:1}],279:[[[[103,1]],[[56,2],[104,2],[99,2]],[[0,2]]],{41:1}],280:[[[[41,1]],[[105,2]],[[2,4],[35,3]],[[61,5],[81,6]],[[0,4]],[[2,4]],[[61,5]]],{41:1}],281:[[[[106,1]],[[106,1],[0,1]]],{41:1}],282:[[[[27,1]],[[82,2]],[[0,2]]],{27:1}],283:[[[[49,1],[107,2],[53,3]],[[48,4],[54,5],[52,6],[0,1]],[[54,5],[52,6],[0,2]],[[95,7]],[[49,7]],[[0,5]],[[49,8],[107,8],[0,6]],[[54,5],[52,9],[0,7]],[[52,6],[0,8]],[[49,10],[53,11],[0,9]],[[48,12]],[[95,13]],[[49,13]],[[52,9],[0,13]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,53:1}],284:[[[[105,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],{25:1}],285:[[[[109,1]],[[52,0],[0,1]]],{25:1}],286:[[[[25,1]],[[110,0],[0,1]]],{25:1}],287:[[[[25,1]],[[0,1]]],{25:1}],288:[[[[111,1]],[[2,1],[112,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],289:[[[[113,1]],[[49,2],[0,1]],[[108,3],[52,3],[0,2]],[[49,4]],[[0,4]]],{113:1}],290:[[[[114,1]],[[115,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],291:[[[[116,1]],[[117,2],[50,3],[118,4],[0,1]],[[111,4],[62,4]],[[116,5],[62,5]],[[0,4]],[[50,3],[0,5]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],292:[[[[95,1],[107,1]],[[52,2],[0,1]],[[95,1],[107,1],[0,2]]],{6:1,7:1,9:1,11:1,12:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],293:[[[[119,2],[30,1],[22,1],[43,1]],[[120,2]],[[0,2]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],294:[[[[2,0],[112,1],[121,0]],[[0,1]]],{2:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,41:1,42:1,43:1,112:1}],295:[[[[122,1],[123,1],[124,1],[125,1],[126,1]],[[0,1]]],{5:1,23:1,31:1,39:1,40:1}],296:[[[[34,1]],[[82,2]],[[83,3]],[[111,4]],[[48,5]],[[80,6]],[[127,7],[0,6]],[[48,8]],[[80,9]],[[0,9]]],{34:1}],297:[[[[4,1]],[[25,2]],[[128,3]],[[48,4],[129,5]],[[80,6]],[[49,7]],[[0,6]],[[48,4]]],{4:1}],298:[[[[26,1]],[[25,2]],[[52,1],[0,2]]],{26:1}],299:[[[[37,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[130,1],[0,4]],[[48,6]],[[80,7]],[[0,7]]],{37:1}],300:[[[[25,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],{25:1}],301:[[[[131,1]],[[52,2],[0,1]],[[131,1],[0,2]]],{25:1}],302:[[[[36,1]],[[105,2],[19,3],[110,3]],[[32,4]],[[105,2],[19,3],[32,4],[110,3]],[[132,5],[15,5],[35,6]],[[0,5]],[[132,7]],[[61,5]]],{36:1}],303:[[[[32,1]],[[133,2]],[[0,2]]],{32:1}],304:[[[[134,1],[135,1]],[[0,1]]],{32:1,36:1}],305:[[[[14,1]],[[48,2],[136,3]],[[49,4]],[[48,2]],[[0,4]]],{14:1}],306:[[[[14,1]],[[48,2],[136,3]],[[86,4]],[[48,2]],[[0,4]]],{14:1}],307:[[[[18,1]],[[25,2]],[[52,1],[0,2]]],{18:1}],308:[[[[8,1],[137,2]],[[46,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],309:[[[[138,1]],[[139,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],310:[[[[35,1]],[[61,2],[140,3]],[[0,2]],[[61,2]]],{35:1}],311:[[[[28,1]],[[0,1]]],{28:1}],312:[[[[141,1]],[[53,2],[0,1]],[[120,3]],[[0,3]]],{6:1,7:1,9:1,11:1,12:1,19:1,25:1,29:1,33:1,35:1,38:1}],313:[[[[16,1]],[[49,2],[142,3],[0,1]],[[52,4],[0,2]],[[49,5]],[[49,2],[0,4]],[[52,6],[0,5]],[[49,7]],[[52,8],[0,7]],[[49,7],[0,8]]],{16:1}],314:[[[[5,1]],[[49,2],[0,1]],[[36,3],[52,3],[0,2]],[[49,4]],[[52,5],[0,4]],[[49,6]],[[0,6]]],{5:1}],315:[[[[23,1]],[[111,2],[0,1]],[[0,2]]],{23:1}],316:[[[[143,1]],[[144,0],[142,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],317:[[[[145,1]],[[2,2],[146,3]],[[0,2]],[[145,1],[2,2]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,16:1,17:1,18:1,19:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,35:1,36:1,38:1,39:1,40:1,43:1}],318:[[[[48,1]],[[49,2],[0,1]],[[0,2]]],{48:1}],319:[[[[147,1],[148,1],[149,1],[150,1],[151,1],[152,1],[153,1],[154,1],[155,1],[156,1]],[[0,1]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,16:1,17:1,18:1,19:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,35:1,36:1,38:1,39:1,40:1,43:1}],320:[[[[15,1]],[[95,2]],[[0,2]]],{15:1}],321:[[[[1,1],[3,1]],[[0,1]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,41:1,42:1,43:1}],322:[[[[49,1],[48,2]],[[48,2],[0,1]],[[49,3],[157,4],[0,2]],[[157,4],[0,3]],[[0,4]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,48:1}],323:[[[[158,1]],[[52,2],[0,1]],[[158,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,48:1}],324:[[[[1,1],[2,2]],[[0,1]],[[159,3]],[[121,4]],[[160,1],[121,4]]],{2:1,5:1,6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,16:1,17:1,18:1,19:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,35:1,36:1,38:1,39:1,40:1,43:1}],325:[[[[120,1]],[[161,0],[15,0],[162,0],[41,0],[163,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],326:[[[[84,1],[164,2]],[[37,3],[0,1]],[[0,2]],[[84,4]],[[127,5]],[[49,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],327:[[[[165,1],[84,1]],[[0,1]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],328:[[[[49,1]],[[52,2],[0,1]],[[49,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],329:[[[[49,1],[107,1]],[[54,2],[52,3],[0,1]],[[0,2]],[[49,4],[107,4],[0,3]],[[52,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],330:[[[[49,1],[107,1]],[[52,2],[0,1]],[[49,1],[107,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],331:[[[[25,1]],[[48,2],[0,1]],[[49,3]],[[0,3]]],{25:1}],332:[[[[35,1],[110,2],[38,3]],[[61,4],[81,5]],[[25,4]],[[166,6]],[[0,4]],[[61,4]],[[64,4]]],{35:1,38:1,110:1}],333:[[[[20,1]],[[48,2]],[[80,3]],[[167,4],[168,5]],[[48,6]],[[48,7]],[[80,8]],[[80,9]],[[167,4],[127,10],[168,5],[0,8]],[[0,9]],[[48,11]],[[80,12]],[[168,5],[0,12]]],{20:1}],334:[[[[15,1],[169,2],[53,3]],[[169,4],[52,5],[0,1]],[[50,6],[52,7],[0,2]],[[169,8]],[[52,5],[0,4]],[[169,9],[53,3],[0,5]],[[49,10]],[[15,11],[169,2],[53,3],[0,7]],[[52,12],[0,8]],[[50,13],[52,5],[0,9]],[[52,7],[0,10]],[[169,14],[52,15],[0,11]],[[0,12]],[[49,4]],[[52,15],[0,14]],[[169,16],[53,3],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],{15:1,25:1,53:1}],335:[[[[15,1],[53,2],[170,3]],[[170,5],[52,4],[0,1]],[[170,6]],[[50,7],[52,8],[0,3]],[[53,2],[170,9],[0,4]],[[52,4],[0,5]],[[52,10],[0,6]],[[49,11]],[[15,12],[53,2],[170,3],[0,8]],[[50,13],[52,4],[0,9]],[[0,10]],[[52,8],[0,11]],[[52,15],[170,14],[0,12]],[[49,5]],[[52,15],[0,14]],[[53,2],[170,16],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],{15:1,25:1,53:1}],336:[[[[25,1]],[[0,1]]],{25:1}],337:[[[[21,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[0,4]],[[48,6]],[[80,7]],[[0,7]]],{21:1}],338:[[[[49,1]],[[108,2],[0,1]],[[95,3]],[[0,3]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],339:[[[[42,1]],[[171,2]],[[48,3],[52,1]],[[80,4]],[[0,4]]],{42:1}],340:[[[[172,1]],[[173,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],341:[[[[111,2],[36,1]],[[49,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,36:1,38:1,43:1}],342:[[[[31,1]],[[174,2],[0,1]],[[0,2]]],{31:1}],343:[[[[62,1]],[[0,1]]],{31:1}]},states:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],[[[44,1]],[[45,0],[0,1]]],[[[46,1]],[[47,0],[0,1]]],[[[48,1]],[[49,2]],[[50,3],[0,2]],[[49,4]],[[0,4]]],[[[51,1]],[[52,2],[0,1]],[[51,1],[0,2]]],[[[49,1],[15,2],[53,2]],[[50,2],[54,3],[0,1]],[[49,3]],[[0,3]]],[[[55,1]],[[30,0],[43,0],[0,1]]],[[[24,1]],[[49,2]],[[52,3],[0,2]],[[49,4]],[[0,4]]],[[[10,1]],[[56,2]],[[0,2]]],[[[10,1]],[[57,2],[56,2],[58,2]],[[0,2]]],[[[6,1],[25,1],[33,1],[9,1],[11,1],[12,2],[35,3],[38,4],[19,1],[7,5]],[[0,1]],[[59,1],[60,6]],[[61,1],[62,7],[63,7]],[[64,1],[63,8]],[[7,5],[0,5]],[[59,1]],[[61,1]],[[64,1]]],[[[29,1],[65,2]],[[65,2]],[[66,2],[0,2]]],[[[67,1],[68,1],[69,1],[70,1],[71,1],[72,1],[73,1],[74,1],[75,1],[76,1],[77,1],[78,1],[79,1]],[[0,1]]],[[[39,1]],[[0,1]]],[[[13,1]],[[25,2]],[[48,3],[35,4]],[[80,5]],[[61,6],[81,7]],[[0,5]],[[48,3]],[[61,6]]],[[[10,1],[34,2]],[[34,2]],[[82,3]],[[83,4]],[[84,5]],[[85,6],[0,5]],[[0,6]]],[[[37,1]],[[86,2]],[[85,3],[0,2]],[[0,3]]],[[[87,1],[54,1]],[[0,1]]],[[[88,1],[89,1],[8,2],[90,1],[88,1],[83,1],[91,1],[92,3],[93,1],[94,1]],[[0,1]],[[83,1]],[[8,1],[0,3]]],[[[95,1]],[[96,0],[0,1]]],[[[97,1],[98,1],[58,1],[99,1],[57,1],[100,1],[56,1],[101,1],[102,1]],[[0,1]]],[[[40,1]],[[0,1]]],[[[17,1]],[[0,1]]],[[[103,1]],[[56,2],[104,2],[99,2]],[[0,2]]],[[[41,1]],[[105,2]],[[2,4],[35,3]],[[61,5],[81,6]],[[0,4]],[[2,4]],[[61,5]]],[[[106,1]],[[106,1],[0,1]]],[[[27,1]],[[82,2]],[[0,2]]],[[[49,1],[107,2],[53,3]],[[48,4],[54,5],[52,6],[0,1]],[[54,5],[52,6],[0,2]],[[95,7]],[[49,7]],[[0,5]],[[49,8],[107,8],[0,6]],[[54,5],[52,9],[0,7]],[[52,6],[0,8]],[[49,10],[53,11],[0,9]],[[48,12]],[[95,13]],[[49,13]],[[52,9],[0,13]]],[[[105,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],[[[109,1]],[[52,0],[0,1]]],[[[25,1]],[[110,0],[0,1]]],[[[25,1]],[[0,1]]],[[[111,1]],[[2,1],[112,2]],[[0,2]]],[[[113,1]],[[49,2],[0,1]],[[108,3],[52,3],[0,2]],[[49,4]],[[0,4]]],[[[114,1]],[[115,0],[0,1]]],[[[116,1]],[[117,2],[50,3],[118,4],[0,1]],[[111,4],[62,4]],[[116,5],[62,5]],[[0,4]],[[50,3],[0,5]]],[[[95,1],[107,1]],[[52,2],[0,1]],[[95,1],[107,1],[0,2]]],[[[119,2],[30,1],[22,1],[43,1]],[[120,2]],[[0,2]]],[[[2,0],[112,1],[121,0]],[[0,1]]],[[[122,1],[123,1],[124,1],[125,1],[126,1]],[[0,1]]],[[[34,1]],[[82,2]],[[83,3]],[[111,4]],[[48,5]],[[80,6]],[[127,7],[0,6]],[[48,8]],[[80,9]],[[0,9]]],[[[4,1]],[[25,2]],[[128,3]],[[48,4],[129,5]],[[80,6]],[[49,7]],[[0,6]],[[48,4]]],[[[26,1]],[[25,2]],[[52,1],[0,2]]],[[[37,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[130,1],[0,4]],[[48,6]],[[80,7]],[[0,7]]],[[[25,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],[[[131,1]],[[52,2],[0,1]],[[131,1],[0,2]]],[[[36,1]],[[105,2],[19,3],[110,3]],[[32,4]],[[105,2],[19,3],[32,4],[110,3]],[[132,5],[15,5],[35,6]],[[0,5]],[[132,7]],[[61,5]]],[[[32,1]],[[133,2]],[[0,2]]],[[[134,1],[135,1]],[[0,1]]],[[[14,1]],[[48,2],[136,3]],[[49,4]],[[48,2]],[[0,4]]],[[[14,1]],[[48,2],[136,3]],[[86,4]],[[48,2]],[[0,4]]],[[[18,1]],[[25,2]],[[52,1],[0,2]]],[[[8,1],[137,2]],[[46,2]],[[0,2]]],[[[138,1]],[[139,0],[0,1]]],[[[35,1]],[[61,2],[140,3]],[[0,2]],[[61,2]]],[[[28,1]],[[0,1]]],[[[141,1]],[[53,2],[0,1]],[[120,3]],[[0,3]]],[[[16,1]],[[49,2],[142,3],[0,1]],[[52,4],[0,2]],[[49,5]],[[49,2],[0,4]],[[52,6],[0,5]],[[49,7]],[[52,8],[0,7]],[[49,7],[0,8]]],[[[5,1]],[[49,2],[0,1]],[[36,3],[52,3],[0,2]],[[49,4]],[[52,5],[0,4]],[[49,6]],[[0,6]]],[[[23,1]],[[111,2],[0,1]],[[0,2]]],[[[143,1]],[[144,0],[142,0],[0,1]]],[[[145,1]],[[2,2],[146,3]],[[0,2]],[[145,1],[2,2]]],[[[48,1]],[[49,2],[0,1]],[[0,2]]],[[[147,1],[148,1],[149,1],[150,1],[151,1],[152,1],[153,1],[154,1],[155,1],[156,1]],[[0,1]]],[[[15,1]],[[95,2]],[[0,2]]],[[[1,1],[3,1]],[[0,1]]],[[[49,1],[48,2]],[[48,2],[0,1]],[[49,3],[157,4],[0,2]],[[157,4],[0,3]],[[0,4]]],[[[158,1]],[[52,2],[0,1]],[[158,1],[0,2]]],[[[1,1],[2,2]],[[0,1]],[[159,3]],[[121,4]],[[160,1],[121,4]]],[[[120,1]],[[161,0],[15,0],[162,0],[41,0],[163,0],[0,1]]],[[[84,1],[164,2]],[[37,3],[0,1]],[[0,2]],[[84,4]],[[127,5]],[[49,2]]],[[[165,1],[84,1]],[[0,1]]],[[[49,1]],[[52,2],[0,1]],[[49,1],[0,2]]],[[[49,1],[107,1]],[[54,2],[52,3],[0,1]],[[0,2]],[[49,4],[107,4],[0,3]],[[52,3],[0,4]]],[[[49,1],[107,1]],[[52,2],[0,1]],[[49,1],[107,1],[0,2]]],[[[25,1]],[[48,2],[0,1]],[[49,3]],[[0,3]]],[[[35,1],[110,2],[38,3]],[[61,4],[81,5]],[[25,4]],[[166,6]],[[0,4]],[[61,4]],[[64,4]]],[[[20,1]],[[48,2]],[[80,3]],[[167,4],[168,5]],[[48,6]],[[48,7]],[[80,8]],[[80,9]],[[167,4],[127,10],[168,5],[0,8]],[[0,9]],[[48,11]],[[80,12]],[[168,5],[0,12]]],[[[15,1],[169,2],[53,3]],[[169,4],[52,5],[0,1]],[[50,6],[52,7],[0,2]],[[169,8]],[[52,5],[0,4]],[[169,9],[53,3],[0,5]],[[49,10]],[[15,11],[169,2],[53,3],[0,7]],[[52,12],[0,8]],[[50,13],[52,5],[0,9]],[[52,7],[0,10]],[[169,14],[52,15],[0,11]],[[0,12]],[[49,4]],[[52,15],[0,14]],[[169,16],[53,3],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],[[[15,1],[53,2],[170,3]],[[170,5],[52,4],[0,1]],[[170,6]],[[50,7],[52,8],[0,3]],[[53,2],[170,9],[0,4]],[[52,4],[0,5]],[[52,10],[0,6]],[[49,11]],[[15,12],[53,2],[170,3],[0,8]],[[50,13],[52,4],[0,9]],[[0,10]],[[52,8],[0,11]],[[52,15],[170,14],[0,12]],[[49,5]],[[52,15],[0,14]],[[53,2],[170,16],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],[[[25,1]],[[0,1]]],[[[21,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[0,4]],[[48,6]],[[80,7]],[[0,7]]],[[[49,1]],[[108,2],[0,1]],[[95,3]],[[0,3]]],[[[42,1]],[[171,2]],[[48,3],[52,1]],[[80,4]],[[0,4]]],[[[172,1]],[[173,0],[0,1]]],[[[111,2],[36,1]],[[49,2]],[[0,2]]],[[[31,1]],[[174,2],[0,1]],[[0,2]]],[[[62,1]],[[0,1]]]],labels:[[0,"EMPTY"],[317,null],[4,null],[276,null],[1,"def"],[1,"raise"],[1,"True"],[3,null],[1,"not"],[1,"None"],[55,null],[2,null],[25,null],[1,"class"],[1,"lambda"],[16,null],[1,"print"],[1,"debugger"],[1,"nonlocal"],[52,null],[1,"try"],[1,"while"],[31,null],[1,"return"],[1,"assert"],[1,null],[1,"global"],[1,"del"],[1,"pass"],[54,null],[15,null],[1,"yield"],[1,"import"],[1,"False"],[1,"for"],[7,null],[1,"from"],[1,"if"],[9,null],[1,"break"],[1,"continue"],[49,null],[1,"with"],[14,null],[316,null],[19,null],[308,null],[1,"and"],[11,null],[326,null],[22,null],[261,null],[12,null],[35,null],[271,null],[325,null],[297,null],[339,null],[296,null],[26,null],[283,null],[8,null],[342,null],[329,null],[10,null],[266,null],[332,null],[45,null],[38,null],[40,null],[50,null],[46,null],[41,null],[42,null],[36,null],[43,null],[48,null],[44,null],[37,null],[39,null],[324,null],[260,null],[292,null],[1,"in"],[309,null],[273,null],[327,null],[272,null],[28,null],[21,null],[27,null],[29,null],[1,"is"],[30,null],[20,null],[290,null],[274,null],[333,null],[299,null],[270,null],[337,null],[279,null],[265,null],[281,null],[264,null],[286,null],[280,null],[320,null],[1,"as"],[284,null],[23,null],[328,null],[0,null],[1,"except"],[340,null],[18,null],[330,null],[268,null],[259,null],[312,null],[293,null],[321,null],[269,null],[277,null],[314,null],[315,null],[343,null],[1,"else"],[310,null],[51,null],[1,"elif"],[300,null],[301,null],[285,null],[303,null],[302,null],[335,null],[275,null],[258,null],[1,"or"],[334,null],[267,null],[34,null],[262,null],[33,null],[319,null],[13,null],[295,null],[263,null],[291,null],[311,null],[307,null],[313,null],[282,null],[298,null],[304,null],[278,null],[318,null],[322,null],[5,null],[6,null],[47,null],[17,null],[24,null],[305,null],[306,null],[323,null],[289,null],[1,"finally"],[331,null],[336,null],[338,null],[257,null],[32,null],[341,null]],keywords:{False:33,None:9,True:6,and:47,as:108,assert:24,break:39,class:13,continue:40,debugger:17,def:4,del:27,elif:130,else:127,except:113,finally:168,for:34,from:36,global:26,if:37,import:32,in:83,is:92,lambda:14,nonlocal:18,not:8,or:139,pass:28,print:16,raise:5,return:23,try:20,while:21,with:42,yield:31},tokens:{0:112,1:25,2:11,3:7,4:2,5:159,6:160,7:35,8:61,9:38,10:64,11:48,12:52,13:146,14:43,15:30,16:15,17:162,18:115,19:45,20:94,21:89,22:50,23:110,24:163,25:12,26:59,27:90,28:88,29:91,30:93,31:22,32:173,33:144,34:142,35:53,36:74,37:78,38:68,39:79,40:69,41:72,42:73,43:75,44:77,45:67,46:71,47:161,48:76,49:41,50:70,51:129,52:19,54:29,55:10},start:256}},function(e,t){function n(e,t){return this.filename=e,this.grammar=t,this.p_flags=0,this}n.FUTURE_PRINT_FUNCTION="print_function",n.FUTURE_UNICODE_LITERALS="unicode_literals",n.FUTURE_DIVISION="division",n.FUTURE_ABSOLUTE_IMPORT="absolute_import",n.FUTURE_WITH_STATEMENT="with_statement",n.FUTURE_NESTED_SCOPES="nested_scopes",n.FUTURE_GENERATORS="generators",n.CO_FUTURE_PRINT_FUNCTION=65536,n.CO_FUTURE_UNICODE_LITERALS=131072,n.CO_FUTURE_DIVISON=8192,n.CO_FUTURE_ABSOLUTE_IMPORT=16384,n.CO_FUTURE_WITH_STATEMENT=32768,n.prototype.setup=function(e){e=e||this.grammar.start,this.stack=[{dfa:this.grammar.dfas[e],state:0,node:{type:e,value:null,context:null,children:[]}}],this.used_names={}},n.prototype.addtoken=function(e,t,n){var i,r=this.classify(e,t,n);e:for(;;){var s=this.stack[this.stack.length-1],o=s.dfa[0],a=o[s.state];for(i=0;i<a.length;++i){var l=a[i][0],u=a[i][1],c=this.grammar.labels[l][0];if(r===l){for(Sk.asserts.assert(256>c),this.shift(e,t,u,n),n=u;1===o[n].length&&0===o[n][0][0]&&o[n][0][1]===n;){if(this.pop(),0===this.stack.length)return!0;n=(s=this.stack[this.stack.length-1]).state,o=s.dfa[0]}return!1}if(256<=c&&(l=(l=this.grammar.dfas[c])[1]).hasOwnProperty(r)){this.push(c,this.grammar.dfas[c],u,n);continue e}}t:{for(o=[0,s.state],s=a.length;s--;)if(a[s][0]===o[0]&&a[s][1]===o[1]){a=!0;break t}a=!1}if(!a)throw e=n[0][0],new Sk.builtin.SyntaxError("bad input",this.filename,e,n);if(this.pop(),0===this.stack.length)throw new Sk.builtin.SyntaxError("too much input",this.filename)}},n.prototype.classify=function(e,t,i){if(e===Sk.token.tokens.T_NAME){this.used_names[t]=!0;var r=this.grammar.keywords.hasOwnProperty(t)&&this.grammar.keywords[t];if("print"===t&&(this.p_flags&n.CO_FUTURE_PRINT_FUNCTION||!0===Sk.__future__.print_function)&&(r=!1),r)return r}if(!(r=this.grammar.tokens.hasOwnProperty(e)&&this.grammar.tokens[e])){t="#"+e;for(let n in Sk.token.tokens)if(Sk.token.tokens[n]==e){t=n;break}throw new Sk.builtin.SyntaxError("bad token "+t,this.filename,i[0][0],i)}return r},n.prototype.shift=function(e,t,n,i){var r=this.stack[this.stack.length-1].dfa,s=this.stack[this.stack.length-1].node;s.children.push({type:e,value:t,lineno:i[0][0],col_offset:i[0][1],children:null}),this.stack[this.stack.length-1]={dfa:r,state:n,node:s}},n.prototype.push=function(e,t,n,i){e={type:e,value:null,lineno:i[0][0],col_offset:i[0][1],children:[]},this.stack[this.stack.length-1]={dfa:this.stack[this.stack.length-1].dfa,state:n,node:this.stack[this.stack.length-1].node},this.stack.push({dfa:t,state:0,node:e})},n.prototype.pop=function(){var e=this.stack.pop().node;e&&(0!==this.stack.length?this.stack[this.stack.length-1].node.children.push(e):(this.rootnode=e,this.rootnode.used_names=this.used_names))},Sk.parse=function(e,t){var i,r=Sk.token.tokens.T_COMMENT,s=Sk.token.tokens.T_NL,o=Sk.token.tokens.T_OP,a=Sk.token.tokens.T_ENDMARKER,l=Sk.token.tokens.T_ENCODING,u=!1,c=function(e,t){return void 0===t&&(t="file_input"),e=new n(e,Sk.ParseTables),"file_input"===t?e.setup(Sk.ParseTables.sym.file_input):Sk.asserts.fail("todo;"),e}(e);if(Sk._tokenize(e,(i=t.split("\n").reverse().map((function(e){return e+"\n"})),function(){if(0===i.length)throw new Sk.builtin.Exception("EOF");return i.pop()}),"utf-8",(function(e){var t=null;e.type!==r&&e.type!==s&&e.type!==l&&(e.type===o&&(t=Sk.OpMap[e.string]),c.addtoken(t||e.type,e.string,[e.start,e.end,e.line]),e.type===a&&(u=!0))})),!u)throw new Sk.builtin.SyntaxError("incomplete input",this.filename);return{cst:c.rootnode,flags:c.p_flags}},Sk.parseTreeDump=function(e,t){var n,i=""+(t=t||"");if(256<=e.type)for(i+=Sk.ParseTables.number2symbol[e.type]+"\n",n=0;n<e.children.length;++n)i+=Sk.parseTreeDump(e.children[n],t+" ");else i+=Sk.token.tok_name[e.type]+": "+new Sk.builtin.str(e.value).$r().v+"\n";return i},Sk.exportSymbol("Sk.Parser",n),Sk.exportSymbol("Sk.parse",Sk.parse),Sk.exportSymbol("Sk.parseTreeDump",Sk.parseTreeDump)},function(e,t){Sk.astnodes={},Sk.astnodes.Load=function(){},Sk.astnodes.Store=function(){},Sk.astnodes.Del=function(){},Sk.astnodes.AugLoad=function(){},Sk.astnodes.AugStore=function(){},Sk.astnodes.Param=function(){},Sk.astnodes.And=function(){},Sk.astnodes.Or=function(){},Sk.astnodes.Add=function(){},Sk.astnodes.Sub=function(){},Sk.astnodes.Mult=function(){},Sk.astnodes.MatMult=function(){},Sk.astnodes.Div=function(){},Sk.astnodes.Mod=function(){},Sk.astnodes.Pow=function(){},Sk.astnodes.LShift=function(){},Sk.astnodes.RShift=function(){},Sk.astnodes.BitOr=function(){},Sk.astnodes.BitXor=function(){},Sk.astnodes.BitAnd=function(){},Sk.astnodes.FloorDiv=function(){},Sk.astnodes.Invert=function(){},Sk.astnodes.Not=function(){},Sk.astnodes.UAdd=function(){},Sk.astnodes.USub=function(){},Sk.astnodes.Eq=function(){},Sk.astnodes.NotEq=function(){},Sk.astnodes.Lt=function(){},Sk.astnodes.LtE=function(){},Sk.astnodes.Gt=function(){},Sk.astnodes.GtE=function(){},Sk.astnodes.Is=function(){},Sk.astnodes.IsNot=function(){},Sk.astnodes.In=function(){},Sk.astnodes.NotIn=function(){},Sk.astnodes.Module=function(e,t){return this.body=e,this.docstring=t,this},Sk.astnodes.Interactive=function(e){return this.body=e,this},Sk.astnodes.Expression=function(e){return this.body=e,this},Sk.astnodes.Suite=function(e){return this.body=e,this},Sk.astnodes.FunctionDef=function(e,t,n,i,r,s,o,a){return Sk.asserts.assert(null!=o),Sk.asserts.assert(null!=a),this.name=e,this.args=t,this.body=n,this.decorator_list=i,this.returns=r,this.docstring=s,this.lineno=o,this.col_offset=a,this},Sk.astnodes.AsyncFunctionDef=function(e,t,n,i,r,s,o,a){return Sk.asserts.assert(null!=o),Sk.asserts.assert(null!=a),this.name=e,this.args=t,this.body=n,this.decorator_list=i,this.returns=r,this.docstring=s,this.lineno=o,this.col_offset=a,this},Sk.astnodes.ClassDef=function(e,t,n,i,r,s,o,a){return Sk.asserts.assert(null!=o),Sk.asserts.assert(null!=a),this.name=e,this.bases=t,this.keywords=n,this.body=i,this.decorator_list=r,this.docstring=s,this.lineno=o,this.col_offset=a,this},Sk.astnodes.Return=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Delete=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.targets=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Assign=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.targets=e,this.value=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.AugAssign=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.target=e,this.op=t,this.value=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.AnnAssign=function(e,t,n,i,r,s){return Sk.asserts.assert(null!=r),Sk.asserts.assert(null!=s),this.target=e,this.annotation=t,this.value=n,this.simple=i,this.lineno=r,this.col_offset=s,this},Sk.astnodes.For=function(e,t,n,i,r,s){return Sk.asserts.assert(null!=r),Sk.asserts.assert(null!=s),this.target=e,this.iter=t,this.body=n,this.orelse=i,this.lineno=r,this.col_offset=s,this},Sk.astnodes.AsyncFor=function(e,t,n,i,r,s){return Sk.asserts.assert(null!=r),Sk.asserts.assert(null!=s),this.target=e,this.iter=t,this.body=n,this.orelse=i,this.lineno=r,this.col_offset=s,this},Sk.astnodes.While=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.test=e,this.body=t,this.orelse=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.If=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.test=e,this.body=t,this.orelse=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.With=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.items=e,this.body=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.AsyncWith=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.items=e,this.body=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Raise=function(e,t,n,i,r,s){return Sk.asserts.assert(null!=r),Sk.asserts.assert(null!=s),this.exc=e,this.cause=t,this.inst=n,this.tback=i,this.lineno=r,this.col_offset=s,this},Sk.astnodes.Try=function(e,t,n,i,r,s){return Sk.asserts.assert(null!=r),Sk.asserts.assert(null!=s),this.body=e,this.handlers=t,this.orelse=n,this.finalbody=i,this.lineno=r,this.col_offset=s,this},Sk.astnodes.Assert=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.test=e,this.msg=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Import=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.names=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.ImportFrom=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.module=e,this.names=t,this.level=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Global=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.names=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Nonlocal=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.names=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Expr=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Pass=function(e,t){return Sk.asserts.assert(null!=e),Sk.asserts.assert(null!=t),this.lineno=e,this.col_offset=t,this},Sk.astnodes.Break=function(e,t){return Sk.asserts.assert(null!=e),Sk.asserts.assert(null!=t),this.lineno=e,this.col_offset=t,this},Sk.astnodes.Continue=function(e,t){return Sk.asserts.assert(null!=e),Sk.asserts.assert(null!=t),this.lineno=e,this.col_offset=t,this},Sk.astnodes.Print=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.dest=e,this.values=t,this.nl=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Debugger=function(e,t){return Sk.asserts.assert(null!=e),Sk.asserts.assert(null!=t),this.lineno=e,this.col_offset=t,this},Sk.astnodes.BoolOp=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.op=e,this.values=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.BinOp=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.left=e,this.op=t,this.right=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.UnaryOp=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.op=e,this.operand=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Lambda=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.args=e,this.body=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.IfExp=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.test=e,this.body=t,this.orelse=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Dict=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.keys=e,this.values=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Set=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.elts=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.ListComp=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.elt=e,this.generators=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.SetComp=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.elt=e,this.generators=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.DictComp=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.key=e,this.value=t,this.generators=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.GeneratorExp=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.elt=e,this.generators=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Await=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Yield=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.YieldFrom=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Compare=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.left=e,this.ops=t,this.comparators=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Call=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.func=e,this.args=t,this.keywords=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Num=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.n=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Str=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.s=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.FormattedValue=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.value=e,this.conversion=t,this.format_spec=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.JoinedStr=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.values=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Bytes=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.s=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.NameConstant=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Ellipsis=function(e,t){return Sk.asserts.assert(null!=e),Sk.asserts.assert(null!=t),this.lineno=e,this.col_offset=t,this},Sk.astnodes.Constant=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Attribute=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.value=e,this.attr=t,this.ctx=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Subscript=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.value=e,this.slice=t,this.ctx=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Starred=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.value=e,this.ctx=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Name=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.id=e,this.ctx=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.List=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.elts=e,this.ctx=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Tuple=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.elts=e,this.ctx=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Slice=function(e,t,n){return this.lower=e,this.upper=t,this.step=n,this},Sk.astnodes.ExtSlice=function(e){return this.dims=e,this},Sk.astnodes.Index=function(e){return this.value=e,this},Sk.astnodes.comprehension=function(e,t,n,i){return this.target=e,this.iter=t,this.ifs=n,this.is_async=i,this},Sk.astnodes.ExceptHandler=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.type=e,this.name=t,this.body=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.arguments_=function(e,t,n,i,r,s){return this.args=e,this.vararg=t,this.kwonlyargs=n,this.kw_defaults=i,this.kwarg=r,this.defaults=s,this},Sk.astnodes.arg=function(e,t){return this.arg=e,this.annotation=t,this},Sk.astnodes.keyword=function(e,t){return this.arg=e,this.value=t,this},Sk.astnodes.alias=function(e,t,n,i){return this.name=e,this.asname=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.withitem=function(e,t){return this.context_expr=e,this.optional_vars=t,this},Sk.astnodes.Module.prototype._astname="Module",Sk.astnodes.Module.prototype._fields=["body",function(e){return e.body},"docstring",function(e){return e.docstring}],Sk.astnodes.Interactive.prototype._astname="Interactive",Sk.astnodes.Interactive.prototype._fields=["body",function(e){return e.body}],Sk.astnodes.Expression.prototype._astname="Expression",Sk.astnodes.Expression.prototype._fields=["body",function(e){return e.body}],Sk.astnodes.Suite.prototype._astname="Suite",Sk.astnodes.Suite.prototype._fields=["body",function(e){return e.body}],Sk.astnodes.FunctionDef.prototype._astname="FunctionDef",Sk.astnodes.FunctionDef.prototype._fields=["name",function(e){return e.name},"args",function(e){return e.args},"body",function(e){return e.body},"decorator_list",function(e){return e.decorator_list},"returns",function(e){return e.returns},"docstring",function(e){return e.docstring}],Sk.astnodes.AsyncFunctionDef.prototype._astname="AsyncFunctionDef",Sk.astnodes.AsyncFunctionDef.prototype._fields=["name",function(e){return e.name},"args",function(e){return e.args},"body",function(e){return e.body},"decorator_list",function(e){return e.decorator_list},"returns",function(e){return e.returns},"docstring",function(e){return e.docstring}],Sk.astnodes.ClassDef.prototype._astname="ClassDef",Sk.astnodes.ClassDef.prototype._fields=["name",function(e){return e.name},"bases",function(e){return e.bases},"keywords",function(e){return e.keywords},"body",function(e){return e.body},"decorator_list",function(e){return e.decorator_list},"docstring",function(e){return e.docstring}],Sk.astnodes.Return.prototype._astname="Return",Sk.astnodes.Return.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Delete.prototype._astname="Delete",Sk.astnodes.Delete.prototype._fields=["targets",function(e){return e.targets}],Sk.astnodes.Assign.prototype._astname="Assign",Sk.astnodes.Assign.prototype._fields=["targets",function(e){return e.targets},"value",function(e){return e.value}],Sk.astnodes.AugAssign.prototype._astname="AugAssign",Sk.astnodes.AugAssign.prototype._fields=["target",function(e){return e.target},"op",function(e){return e.op},"value",function(e){return e.value}],Sk.astnodes.AnnAssign.prototype._astname="AnnAssign",Sk.astnodes.AnnAssign.prototype._fields=["target",function(e){return e.target},"annotation",function(e){return e.annotation},"value",function(e){return e.value},"simple",function(e){return e.simple}],Sk.astnodes.For.prototype._astname="For",Sk.astnodes.For.prototype._fields=["target",function(e){return e.target},"iter",function(e){return e.iter},"body",function(e){return e.body},"orelse",function(e){return e.orelse}],Sk.astnodes.AsyncFor.prototype._astname="AsyncFor",Sk.astnodes.AsyncFor.prototype._fields=["target",function(e){return e.target},"iter",function(e){return e.iter},"body",function(e){return e.body},"orelse",function(e){return e.orelse}],Sk.astnodes.While.prototype._astname="While",Sk.astnodes.While.prototype._fields=["test",function(e){return e.test},"body",function(e){return e.body},"orelse",function(e){return e.orelse}],Sk.astnodes.If.prototype._astname="If",Sk.astnodes.If.prototype._fields=["test",function(e){return e.test},"body",function(e){return e.body},"orelse",function(e){return e.orelse}],Sk.astnodes.With.prototype._astname="With",Sk.astnodes.With.prototype._fields=["items",function(e){return e.items},"body",function(e){return e.body}],Sk.astnodes.AsyncWith.prototype._astname="AsyncWith",Sk.astnodes.AsyncWith.prototype._fields=["items",function(e){return e.items},"body",function(e){return e.body}],Sk.astnodes.Raise.prototype._astname="Raise",Sk.astnodes.Raise.prototype._fields=["exc",function(e){return e.exc},"cause",function(e){return e.cause},"inst",function(e){return e.inst},"tback",function(e){return e.tback}],Sk.astnodes.Try.prototype._astname="Try",Sk.astnodes.Try.prototype._fields=["body",function(e){return e.body},"handlers",function(e){return e.handlers},"orelse",function(e){return e.orelse},"finalbody",function(e){return e.finalbody}],Sk.astnodes.Assert.prototype._astname="Assert",Sk.astnodes.Assert.prototype._fields=["test",function(e){return e.test},"msg",function(e){return e.msg}],Sk.astnodes.Import.prototype._astname="Import",Sk.astnodes.Import.prototype._fields=["names",function(e){return e.names}],Sk.astnodes.ImportFrom.prototype._astname="ImportFrom",Sk.astnodes.ImportFrom.prototype._fields=["module",function(e){return e.module},"names",function(e){return e.names},"level",function(e){return e.level}],Sk.astnodes.Global.prototype._astname="Global",Sk.astnodes.Global.prototype._fields=["names",function(e){return e.names}],Sk.astnodes.Nonlocal.prototype._astname="Nonlocal",Sk.astnodes.Nonlocal.prototype._fields=["names",function(e){return e.names}],Sk.astnodes.Expr.prototype._astname="Expr",Sk.astnodes.Expr.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Pass.prototype._astname="Pass",Sk.astnodes.Pass.prototype._fields=[],Sk.astnodes.Break.prototype._astname="Break",Sk.astnodes.Break.prototype._fields=[],Sk.astnodes.Continue.prototype._astname="Continue",Sk.astnodes.Continue.prototype._fields=[],Sk.astnodes.Print.prototype._astname="Print",Sk.astnodes.Print.prototype._fields=["dest",function(e){return e.dest},"values",function(e){return e.values},"nl",function(e){return e.nl}],Sk.astnodes.Debugger.prototype._astname="Debugger",Sk.astnodes.Debugger.prototype._fields=[],Sk.astnodes.BoolOp.prototype._astname="BoolOp",Sk.astnodes.BoolOp.prototype._fields=["op",function(e){return e.op},"values",function(e){return e.values}],Sk.astnodes.BinOp.prototype._astname="BinOp",Sk.astnodes.BinOp.prototype._fields=["left",function(e){return e.left},"op",function(e){return e.op},"right",function(e){return e.right}],Sk.astnodes.UnaryOp.prototype._astname="UnaryOp",Sk.astnodes.UnaryOp.prototype._fields=["op",function(e){return e.op},"operand",function(e){return e.operand}],Sk.astnodes.Lambda.prototype._astname="Lambda",Sk.astnodes.Lambda.prototype._fields=["args",function(e){return e.args},"body",function(e){return e.body}],Sk.astnodes.IfExp.prototype._astname="IfExp",Sk.astnodes.IfExp.prototype._fields=["test",function(e){return e.test},"body",function(e){return e.body},"orelse",function(e){return e.orelse}],Sk.astnodes.Dict.prototype._astname="Dict",Sk.astnodes.Dict.prototype._fields=["keys",function(e){return e.keys},"values",function(e){return e.values}],Sk.astnodes.Set.prototype._astname="Set",Sk.astnodes.Set.prototype._fields=["elts",function(e){return e.elts}],Sk.astnodes.ListComp.prototype._astname="ListComp",Sk.astnodes.ListComp.prototype._fields=["elt",function(e){return e.elt},"generators",function(e){return e.generators}],Sk.astnodes.SetComp.prototype._astname="SetComp",Sk.astnodes.SetComp.prototype._fields=["elt",function(e){return e.elt},"generators",function(e){return e.generators}],Sk.astnodes.DictComp.prototype._astname="DictComp",Sk.astnodes.DictComp.prototype._fields=["key",function(e){return e.key},"value",function(e){return e.value},"generators",function(e){return e.generators}],Sk.astnodes.GeneratorExp.prototype._astname="GeneratorExp",Sk.astnodes.GeneratorExp.prototype._fields=["elt",function(e){return e.elt},"generators",function(e){return e.generators}],Sk.astnodes.Await.prototype._astname="Await",Sk.astnodes.Await.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Yield.prototype._astname="Yield",Sk.astnodes.Yield.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.YieldFrom.prototype._astname="YieldFrom",Sk.astnodes.YieldFrom.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Compare.prototype._astname="Compare",Sk.astnodes.Compare.prototype._fields=["left",function(e){return e.left},"ops",function(e){return e.ops},"comparators",function(e){return e.comparators}],Sk.astnodes.Call.prototype._astname="Call",Sk.astnodes.Call.prototype._fields=["func",function(e){return e.func},"args",function(e){return e.args},"keywords",function(e){return e.keywords}],Sk.astnodes.Num.prototype._astname="Num",Sk.astnodes.Num.prototype._fields=["n",function(e){return e.n}],Sk.astnodes.Str.prototype._astname="Str",Sk.astnodes.Str.prototype._fields=["s",function(e){return e.s}],Sk.astnodes.FormattedValue.prototype._astname="FormattedValue",Sk.astnodes.FormattedValue.prototype._fields=["value",function(e){return e.value},"conversion",function(e){return e.conversion},"format_spec",function(e){return e.format_spec}],Sk.astnodes.JoinedStr.prototype._astname="JoinedStr",Sk.astnodes.JoinedStr.prototype._fields=["values",function(e){return e.values}],Sk.astnodes.Bytes.prototype._astname="Bytes",Sk.astnodes.Bytes.prototype._fields=["s",function(e){return e.s}],Sk.astnodes.NameConstant.prototype._astname="NameConstant",Sk.astnodes.NameConstant.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Ellipsis.prototype._astname="Ellipsis",Sk.astnodes.Ellipsis.prototype._fields=[],Sk.astnodes.Constant.prototype._astname="Constant",Sk.astnodes.Constant.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Attribute.prototype._astname="Attribute",Sk.astnodes.Attribute.prototype._fields=["value",function(e){return e.value},"attr",function(e){return e.attr},"ctx",function(e){return e.ctx}],Sk.astnodes.Subscript.prototype._astname="Subscript",Sk.astnodes.Subscript.prototype._fields=["value",function(e){return e.value},"slice",function(e){return e.slice},"ctx",function(e){return e.ctx}],Sk.astnodes.Starred.prototype._astname="Starred",Sk.astnodes.Starred.prototype._fields=["value",function(e){return e.value},"ctx",function(e){return e.ctx}],Sk.astnodes.Name.prototype._astname="Name",Sk.astnodes.Name.prototype._fields=["id",function(e){return e.id},"ctx",function(e){return e.ctx}],Sk.astnodes.List.prototype._astname="List",Sk.astnodes.List.prototype._fields=["elts",function(e){return e.elts},"ctx",function(e){return e.ctx}],Sk.astnodes.Tuple.prototype._astname="Tuple",Sk.astnodes.Tuple.prototype._fields=["elts",function(e){return e.elts},"ctx",function(e){return e.ctx}],Sk.astnodes.Load.prototype._astname="Load",Sk.astnodes.Load.prototype._isenum=!0,Sk.astnodes.Store.prototype._astname="Store",Sk.astnodes.Store.prototype._isenum=!0,Sk.astnodes.Del.prototype._astname="Del",Sk.astnodes.Del.prototype._isenum=!0,Sk.astnodes.AugLoad.prototype._astname="AugLoad",Sk.astnodes.AugLoad.prototype._isenum=!0,Sk.astnodes.AugStore.prototype._astname="AugStore",Sk.astnodes.AugStore.prototype._isenum=!0,Sk.astnodes.Param.prototype._astname="Param",Sk.astnodes.Param.prototype._isenum=!0,Sk.astnodes.Slice.prototype._astname="Slice",Sk.astnodes.Slice.prototype._fields=["lower",function(e){return e.lower},"upper",function(e){return e.upper},"step",function(e){return e.step}],Sk.astnodes.ExtSlice.prototype._astname="ExtSlice",Sk.astnodes.ExtSlice.prototype._fields=["dims",function(e){return e.dims}],Sk.astnodes.Index.prototype._astname="Index",Sk.astnodes.Index.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.And.prototype._astname="And",Sk.astnodes.And.prototype._isenum=!0,Sk.astnodes.Or.prototype._astname="Or",Sk.astnodes.Or.prototype._isenum=!0,Sk.astnodes.Add.prototype._astname="Add",Sk.astnodes.Add.prototype._isenum=!0,Sk.astnodes.Sub.prototype._astname="Sub",Sk.astnodes.Sub.prototype._isenum=!0,Sk.astnodes.Mult.prototype._astname="Mult",Sk.astnodes.Mult.prototype._isenum=!0,Sk.astnodes.MatMult.prototype._astname="MatMult",Sk.astnodes.MatMult.prototype._isenum=!0,Sk.astnodes.Div.prototype._astname="Div",Sk.astnodes.Div.prototype._isenum=!0,Sk.astnodes.Mod.prototype._astname="Mod",Sk.astnodes.Mod.prototype._isenum=!0,Sk.astnodes.Pow.prototype._astname="Pow",Sk.astnodes.Pow.prototype._isenum=!0,Sk.astnodes.LShift.prototype._astname="LShift",Sk.astnodes.LShift.prototype._isenum=!0,Sk.astnodes.RShift.prototype._astname="RShift",Sk.astnodes.RShift.prototype._isenum=!0,Sk.astnodes.BitOr.prototype._astname="BitOr",Sk.astnodes.BitOr.prototype._isenum=!0,Sk.astnodes.BitXor.prototype._astname="BitXor",Sk.astnodes.BitXor.prototype._isenum=!0,Sk.astnodes.BitAnd.prototype._astname="BitAnd",Sk.astnodes.BitAnd.prototype._isenum=!0,Sk.astnodes.FloorDiv.prototype._astname="FloorDiv",Sk.astnodes.FloorDiv.prototype._isenum=!0,Sk.astnodes.Invert.prototype._astname="Invert",Sk.astnodes.Invert.prototype._isenum=!0,Sk.astnodes.Not.prototype._astname="Not",Sk.astnodes.Not.prototype._isenum=!0,Sk.astnodes.UAdd.prototype._astname="UAdd",Sk.astnodes.UAdd.prototype._isenum=!0,Sk.astnodes.USub.prototype._astname="USub",Sk.astnodes.USub.prototype._isenum=!0,Sk.astnodes.Eq.prototype._astname="Eq",Sk.astnodes.Eq.prototype._isenum=!0,Sk.astnodes.NotEq.prototype._astname="NotEq",Sk.astnodes.NotEq.prototype._isenum=!0,Sk.astnodes.Lt.prototype._astname="Lt",Sk.astnodes.Lt.prototype._isenum=!0,Sk.astnodes.LtE.prototype._astname="LtE",Sk.astnodes.LtE.prototype._isenum=!0,Sk.astnodes.Gt.prototype._astname="Gt",Sk.astnodes.Gt.prototype._isenum=!0,Sk.astnodes.GtE.prototype._astname="GtE",Sk.astnodes.GtE.prototype._isenum=!0,Sk.astnodes.Is.prototype._astname="Is",Sk.astnodes.Is.prototype._isenum=!0,Sk.astnodes.IsNot.prototype._astname="IsNot",Sk.astnodes.IsNot.prototype._isenum=!0,Sk.astnodes.In.prototype._astname="In",Sk.astnodes.In.prototype._isenum=!0,Sk.astnodes.NotIn.prototype._astname="NotIn",Sk.astnodes.NotIn.prototype._isenum=!0,Sk.astnodes.comprehension.prototype._astname="comprehension",Sk.astnodes.comprehension.prototype._fields=["target",function(e){return e.target},"iter",function(e){return e.iter},"ifs",function(e){return e.ifs},"is_async",function(e){return e.is_async}],Sk.astnodes.ExceptHandler.prototype._astname="ExceptHandler",Sk.astnodes.ExceptHandler.prototype._fields=["type",function(e){return e.type},"name",function(e){return e.name},"body",function(e){return e.body}],Sk.astnodes.arguments_.prototype._astname="arguments",Sk.astnodes.arguments_.prototype._fields=["args",function(e){return e.args},"vararg",function(e){return e.vararg},"kwonlyargs",function(e){return e.kwonlyargs},"kw_defaults",function(e){return e.kw_defaults},"kwarg",function(e){return e.kwarg},"defaults",function(e){return e.defaults}],Sk.astnodes.arg.prototype._astname="arg",Sk.astnodes.arg.prototype._fields=["arg",function(e){return e.arg},"annotation",function(e){return e.annotation}],Sk.astnodes.keyword.prototype._astname="keyword",Sk.astnodes.keyword.prototype._fields=["arg",function(e){return e.arg},"value",function(e){return e.value}],Sk.astnodes.alias.prototype._astname="alias",Sk.astnodes.alias.prototype._fields=["name",function(e){return e.name},"asname",function(e){return e.asname}],Sk.astnodes.withitem.prototype._astname="withitem",Sk.astnodes.withitem.prototype._fields=["context_expr",function(e){return e.context_expr},"optional_vars",function(e){return e.optional_vars}],Sk.exportSymbol("Sk.astnodes",Sk.astnodes)},function(e,t){function n(e,t,n){this.c_encoding=e,this.c_filename=t,this.c_flags=n||0}function i(e){return Sk.asserts.assert(void 0!==e,"node must be defined"),null===e.children?0:e.children.length}function r(e,t){return Sk.asserts.assert(void 0!==e,"node must be defined"),Sk.asserts.assert(void 0!==t,"index of child must be specified"),e.children[t]}function s(e,t){Sk.asserts.assert(e.type===t,"node wasn't expected type")}function o(e,t,n){throw new Sk.builtin.SyntaxError(n,e.c_filename,t.lineno)}function a(e){return Sk.asserts.assert("string"==typeof e,"expecting string, got "+typeof e),new Sk.builtin.str(e)}function l(e){var t,n;switch(e.type){case O.single_input:if(r(e,0).type===R.T_NEWLINE)break;return l(r(e,0));case O.file_input:for(t=n=0;t<i(e);++t){var s=r(e,t);s.type===O.stmt&&(n+=l(s))}return n;case O.stmt:return l(r(e,0));case O.compound_stmt:return 1;case O.simple_stmt:return Math.floor(i(e)/2);case O.suite:if(1===i(e))return l(r(e,0));for(n=0,t=2;t<i(e)-1;++t)n+=l(r(e,t));return n;default:Sk.asserts.fail("Non-statement found")}return 0}function u(e,t,n,i){if(n instanceof Sk.builtin.str&&(n=n.v),"None"===n)throw new Sk.builtin.SyntaxError("assignment to None",e.c_filename,i);if("True"===n||"False"===n)throw new Sk.builtin.SyntaxError("assignment to True or False is forbidden",e.c_filename,i)}function c(e,t,n,i){var r;Sk.asserts.assert(n!==Sk.astnodes.AugStore&&n!==Sk.astnodes.AugLoad,"context not AugStore or AugLoad");var s=r=null;switch(t.constructor){case Sk.astnodes.Attribute:case Sk.astnodes.Name:n===Sk.astnodes.Store&&u(e,0,t.attr,i.lineno),t.ctx=n;break;case Sk.astnodes.Starred:t.ctx=n,c(e,t.value,n,i);break;case Sk.astnodes.Subscript:t.ctx=n;break;case Sk.astnodes.List:t.ctx=n,r=t.elts;break;case Sk.astnodes.Tuple:if(0===t.elts.length)throw new Sk.builtin.SyntaxError("can't assign to ()",e.c_filename,i.lineno);t.ctx=n,r=t.elts;break;case Sk.astnodes.Lambda:s="lambda";break;case Sk.astnodes.Call:s="function call";break;case Sk.astnodes.BoolOp:case Sk.astnodes.BinOp:case Sk.astnodes.UnaryOp:s="operator";break;case Sk.astnodes.GeneratorExp:s="generator expression";break;case Sk.astnodes.Yield:s="yield expression";break;case Sk.astnodes.ListComp:s="list comprehension";break;case Sk.astnodes.SetComp:s="set comprehension";break;case Sk.astnodes.DictComp:s="dict comprehension";break;case Sk.astnodes.Dict:case Sk.astnodes.Set:case Sk.astnodes.Num:case Sk.astnodes.Str:s="literal";break;case Sk.astnodes.NameConstant:s="True, False or None";break;case Sk.astnodes.Compare:s="comparison";break;case Sk.astnodes.Repr:s="repr";break;case Sk.astnodes.IfExp:s="conditional expression";break;default:Sk.asserts.fail("unhandled expression in assignment")}if(s)throw new Sk.builtin.SyntaxError("can't "+(n===Sk.astnodes.Store?"assign to":"delete")+" "+s,e.c_filename,i.lineno);if(r)for(t=0;t<r.length;++t)c(e,r[t],n,i)}function d(e){if(void 0===q[e.type])throw new Sk.builtin.SyntaxError("invalid syntax",e.type,e.lineno);return q[e.type]}function f(e,t){return e.value?new Sk.builtin.str(e.value):new Sk.builtin.str(e)}function h(e,t){if(s(t,O.comp_op),1===i(t))switch(t=r(t,0),t.type){case R.T_LESS:return Sk.astnodes.Lt;case R.T_GREATER:return Sk.astnodes.Gt;case R.T_EQEQUAL:return Sk.astnodes.Eq;case R.T_LESSEQUAL:return Sk.astnodes.LtE;case R.T_GREATEREQUAL:return Sk.astnodes.GtE;case R.T_NOTEQUAL:return Sk.astnodes.NotEq;case R.T_NAME:if("in"===t.value)return Sk.astnodes.In;if("is"===t.value)return Sk.astnodes.Is}else if(2===i(t)&&r(t,0).type===R.T_NAME){if("in"===r(t,1).value)return Sk.astnodes.NotIn;if("is"===r(t,0).value)return Sk.astnodes.IsNot}Sk.asserts.fail("invalid comp_op")}function p(e,t){return e&&(e.lineno=t.lineno,e.col_offset=t.col_offset,e.end_lineno=t.end_lineno,e.end_col_offset=t.end_col_offset),e}function m(e,t){var n,s=[];for(Sk.asserts.assert(t.type===O.testlist||t.type===O.testlist_star_expr||t.type===O.listmaker||t.type===O.testlist_comp||t.type===O.testlist_safe||t.type===O.testlist1,"node type must be listlike"),n=0;n<i(t);n+=2)Sk.asserts.assert(r(t,n).type===O.test||r(t,n).type===O.old_test||r(t,n).type===O.star_expr),s[n/2]=L(e,r(t,n));return s}function _(e,t){var n;s(t,O.suite);var o=[],a=0;if(r(t,0).type===O.simple_stmt){var u=i(t=r(t,0))-1;for(r(t,u-1).type===R.T_SEMI&&--u,n=0;n<u;n+=2)o[a++]=j(e,r(t,n))}else for(n=2;n<i(t)-1;++n){s(u=r(t,n),O.stmt);var c=l(u);if(1===c)o[a++]=j(e,u);else for(s(u=r(u,0),O.simple_stmt),c=0;c<i(u);c+=2){if(0===i(r(u,c))){Sk.asserts.assert(c+1===i(u));break}o[a++]=j(e,r(u,c))}}return Sk.asserts.assert(a===l(t)),o}function b(e,t,n){var o;s(t,O.exprlist);var a=[];for(o=0;o<i(t);o+=2){var l=L(e,r(t,o));a[o/2]=l,n&&c(e,l,n,r(t,o))}return a}function g(e,t){e:for(;;)switch(t.type){case O.import_as_name:e=null;var n=a(r(t,0).value);return 3===i(t)&&(e=r(t,2).value),new Sk.astnodes.alias(n,null==e?null:a(e),t.lineno,t.col_offset);case O.dotted_as_name:if(1===i(t)){t=r(t,0);continue e}return e=g(e,r(t,0)),Sk.asserts.assert(!e.asname),e.asname=a(r(t,2).value),e;case O.dotted_name:if(1===i(t))return new Sk.astnodes.alias(a(r(t,0).value),null,t.lineno,t.col_offset);for(e="",n=0;n<i(t);n+=2)e+=r(t,n).value+".";return new Sk.astnodes.alias(a(e.substr(0,e.length-1)),null,t.lineno,t.col_offset);case R.T_STAR:return new Sk.astnodes.alias(a("*"),null,t.lineno,t.col_offset);default:throw new Sk.builtin.SyntaxError("unexpected import name",e.c_filename,t.lineno)}}function k(e,t){return Sk.asserts.assert(t.type==O.testlist_comp||t.type==O.argument),T(e,t,0)}function S(e,t){if(r(t,0).type===R.T_MINUS&&2===i(t)){var n=r(t,1);if(n.type===O.factor&&1===i(n)&&(n=r(n,0)).type===O.power&&1===i(n)){var s=r(n,0);if(s.type===O.atom&&(n=r(s,0)).type===R.T_NUMBER)return n.value="-"+n.value,M(e,s)}}switch(e=L(e,r(t,1)),r(t,0).type){case R.T_PLUS:return new Sk.astnodes.UnaryOp(Sk.astnodes.UAdd,e,t.lineno,t.col_offset);case R.T_MINUS:return new Sk.astnodes.UnaryOp(Sk.astnodes.USub,e,t.lineno,t.col_offset);case R.T_TILDE:return new Sk.astnodes.UnaryOp(Sk.astnodes.Invert,e,t.lineno,t.col_offset)}Sk.asserts.fail("unhandled factor")}function y(e,t,n,a){var l,c,d;for(s(t,O.arglist),l=d=c=0;l<i(t);l++){var f=r(t,l);f.type==O.argument&&(1==i(f)?c++:r(f,1).type==O.comp_for?(c++,a||o(e,f,"invalid syntax"),1<i(t)&&o(e,f,"Generator expression must be parenthesized")):r(f,0).type==R.T_STAR?c++:d++)}var h=[],p=[];for(l=a=d=c=0;l<i(t);l++)if((f=r(t,l)).type==O.argument){var m=r(f,0);if(1==i(f)){d&&o(e,m,a?"positional argument follows keyword argument unpacking":"positional argument follows keyword argument");var _=L(e,m);if(!_)return null;h[c++]=_}else if(m.type==R.T_STAR){if(a)return o(e,m,"iterable argument unpacking follows keyword argument unpacking"),null;if(!(_=L(e,r(f,1))))return null;f=new Sk.astnodes.Starred(_,Sk.astnodes.Load,m.lineno,m.col_offset),h[c++]=f}else if(m.type==R.T_DOUBLESTAR){if(l++,!(_=L(e,r(f,1))))return null;f=new Sk.astnodes.keyword(null,_),p[d++]=f,a++}else if(r(f,1).type==O.comp_for){if(!(_=k(e,f)))return null;h[c++]=_}else{var b;if(!(_=L(e,m)))return null;if(_.constructor===Sk.astnodes.Lambda)return o(e,m,"lambda cannot contain assignment"),null;if(_.constructor!==Sk.astnodes.Name)return o(e,m,"keyword can't be an expression"),null;if(u(e,_.id,f,1))return null;var g=_.id;for(b=0;b<d;b++)if((_=p[b].arg)&&_.v===g.v)return o(e,m,"keyword argument repeated"),null;if(!(_=L(e,r(f,2))))return null;f=new Sk.astnodes.keyword(g,_),p[d++]=f}}return new Sk.astnodes.Call(n,h,p,n.lineno,n.col_offset)}function v(e,t,n){if(s(t,O.trailer),r(t,0).type==R.T_LPAR)return 2==i(t)?new Sk.astnodes.Call(n,null,null,t.lineno,t.col_offset):y(e,r(t,1),n,!0);if(r(t,0).type==R.T_DOT){var o=f(r(t,1));return o?new Sk.astnodes.Attribute(n,o,Sk.astnodes.Load,t.lineno,t.col_offset):null}if(s(r(t,0),R.T_LSQB),s(r(t,2),R.T_RSQB),1==i(t=r(t,1)))return(o=F(e,r(t,0)))?new Sk.astnodes.Subscript(n,o,Sk.astnodes.Load,t.lineno,t.col_offset):null;var a,l=1,u=[];for(a=0;a<i(t);a+=2){if(!(o=F(e,r(t,a))))return null;o.kind!=P.Index_kind&&(l=0),u[a/2]=o}if(!l)return new Sk.astnodes.Subscript(n,new Sk.astnodes.ExtSlice(u),Sk.astnodes.Load,t.lineno,t.col_offset);for(e=[],a=0;a<u.length;++a)o=u[a],Sk.asserts.assert(o.kind==P.Index_kind&&o.v.Index.value),e[a]=o.v.Index.value;return o=new Sk.astnodes.Tuple(e,Sk.astnodes.Load,t.lineno,t.col_offset),new Sk.astnodes.Subscript(n,new Sk.astnodes.Index(o),Sk.astnodes.Load,t.lineno,t.col_offset)}function $(e,t){var n=null;Sk.asserts.assert(t.type===O.tfpdef||t.type===O.vfpdef);var s=r(t,0);return u(e,0,s.value,s.lineno),s=a(s.value),3==i(t)&&r(t,1).type===R.T_COLON&&(n=L(e,r(t,2))),new Sk.astnodes.arg(s,n,t.lineno,t.col_offset)}function w(e,t,n,s,l){var c=n,d=0;for(s||o(e,r(t,n),"named arguments must follow bare *"),Sk.asserts.assert(l);c<i(t);){var f=r(t,c);switch(f.type){case O.vfpdef:case O.tfpdef:c+1<i(t)&&r(t,c+1).type==R.T_EQUAL?(l[d]=L(e,r(t,c+2)),c+=2):l[d]=null;var h=3==i(f)?L(e,r(f,2)):null;u(e,0,(f=r(f,0)).value,f.lineno),n=a(f.value),s[d++]=new Sk.astnodes.arg(n,h,f.lineno,f.col_offset),c+=2;break;case R.T_DOUBLESTAR:return c;default:o(e,f,"unexpected node")}}return c}function x(e,t){var n,s,o,a=[],l=[],u=[],c=[],d=null,f=null;if(t.type===O.parameters){if(2===i(t))return new Sk.astnodes.arguments_([],null,[],[],null,[]);t=r(t,1)}for(Sk.asserts.assert(t.type===O.varargslist||t.type===O.typedargslist),n=s=o=0;o<i(t);){var h=r(t,o);switch(h.type){case O.tfpdef:case O.vfpdef:if(o+1<i(t)&&r(t,o+1).type==R.T_EQUAL){l[s++]=L(e,r(t,o+2)),o+=2;var p=1}else if(p)throw new Sk.builtin.SyntaxError("non-default argument follows default argument",e.c_filename,t.lineno);a[n++]=$(e,h),o+=2;break;case R.T_STAR:if(o+1>=i(t)||o+2==i(t)&&r(t,o+1).type==R.T_COMMA)throw new Sk.builtin.SyntaxError("named arguments must follow bare *",e.c_filename,t.lineno);(h=r(t,o+1)).type==R.T_COMMA?o=w(e,t,o+=2,u,c):(d=$(e,h),(o+=3)<i(t)&&(r(t,o).type==O.tfpdef||r(t,o).type==O.vfpdef)&&(o=w(e,t,o,u,c)));break;case R.T_DOUBLESTAR:h=r(t,o+1),Sk.asserts.assert(h.type==O.tfpdef||h.type==O.vfpdef),f=$(e,h),o+=3;break;default:return void Sk.asserts.fail("unexpected node in varargslist")}}return new Sk.astnodes.arguments_(a,d,u,c,f,l)}function A(e,t,n,a){var l=a?r(t,1):t,c=null,d=1,h=null;if(a&&5>e.c_feature_version)return o(e,l,"Async functions are only supported in Python 3.5 and greater"),null;s(l,O.funcdef);var p=f(r(l,d));if(u(e,0,r(l,d),0))return null;var m=x(e,r(l,d+1));if(!m)return null;if(r(l,d+2).type==R.T_RARROW){if(!(c=L(e,r(l,d+3))))return null;d+=2}if(r(l,d+3).type==R.T_TYPE_COMMENT){if(!(h=R.T_NEW_TYPE_COMMENT(r(l,d+3))))return null;d+=1}var b=_(e,r(l,d+3));if(!b)return null;if(1<i(r(l,d+3))&&(d=r(r(l,d+3),1)).type==R.T_TYPE_COMMENT){if(null!=h)return o(e,l,"Cannot have two type comments on def"),null;if(!(h=R.T_NEW_TYPE_COMMENT(d)))return null}return a?new Sk.astnodes.AsyncFunctionDef(p,m,b,n,c,h,t.lineno,t.col_offset,void 0,void 0):new Sk.astnodes.FunctionDef(p,m,b,n,c,h,l.lineno,l.col_offset,void 0,void 0)}function E(e,t,n){if(s(t,O.classdef),4==i(t)){var o=_(e,r(t,3)),a=f(r(t,1).value);return u(e,r(t,3),a,t.lineno),new Sk.astnodes.ClassDef(a,[],[],o,n,null,t.lineno,t.col_offset)}if(r(t,3).type===R.T_RPAR)return o=_(e,r(t,5)),a=f(r(t,1).value),u(e,r(t,3),a,r(t,3).lineno),new Sk.astnodes.ClassDef(a,[],[],o,n,null,t.lineno,t.col_offset);a=f(r(t,1)),a=new Sk.astnodes.Name(a,Sk.astnodes.Load,t.lineno,t.col_offset);var l=y(e,r(t,3),a,!1);return o=_(e,r(t,6)),a=f(r(t,1).value),u(e,r(t,1),a,r(t,1).lineno),new Sk.astnodes.ClassDef(a,l.args,l.keywords,o,n,null,t.lineno,t.col_offset)}function C(e,t){function n(e,t){for(e=0;;){if(s(t,O.comp_iter),r(t,0).type===O.comp_for)return e;if(s(t=r(t,0),O.comp_if),e++,2===i(t))return e;t=r(t,2)}}var o,a=function(e,t){e=0;e:for(;;){if(e++,s(t,O.comp_for),5!==i(t))return e;t=r(t,4);t:for(;;){if(s(t,O.comp_iter),(t=r(t,0)).type===O.comp_for)continue e;if(t.type===O.comp_if){if(3===i(t)){t=r(t,2);continue t}return e}break}break}Sk.asserts.fail("logic error in countCompFors")}(e,t),l=[];for(o=0;o<a;++o){s(t,O.comp_for);var u=r(t,1),c=b(e,u,Sk.astnodes.Store),d=L(e,r(t,3)),f=1===i(u)?new Sk.astnodes.comprehension(c[0],d,[]):new Sk.astnodes.comprehension(new Sk.astnodes.Tuple(c,Sk.astnodes.Store,t.lineno,t.col_offset),d,[]);if(5===i(t)){var h=n(e,t=r(t,4));for(u=[],c=0;c<h;++c)s(t,O.comp_iter),s(t=r(t,0),O.comp_if),d=L(e,r(t,1)),u[c]=d,3===i(t)&&(t=r(t,2));t.type===O.comp_iter&&(t=r(t,0)),f.ifs=u}l[o]=f}return l}function T(e,t,n){Sk.asserts.assert(1<i(t));var a=r(t,0),l=L(e,a);return l.constructor===Sk.astnodes.Starred?(o(e,a,"iterable unpacking cannot be used in comprehension"),null):(e=function(e,t){var n=[];e:{var o=t,a=0;t:for(;;){var l=0;if(a++,s(o,O.comp_for),r(o,0).type==R.T_ASYNC&&(l=1),i(o)!=5+l)break e;o=r(o,4+l);n:for(;;){if(s(o,O.comp_iter),(o=r(o,0)).type===O.comp_for)continue t;if(o.type===O.comp_if){if(3===i(o)){o=r(o,2);continue n}break e}break}break}a=void 0}for(o=0;o<a;o++){var u=0;r(t,0).type==R.T_ASYNC&&(u=1);var c=r(t,1+u),d=b(e,c,Sk.astnodes.Store);if(!d)return null;if(!(l=L(e,r(t,3+u))))return null;var f=d[0];if(d=1==i(c)?new Sk.astnodes.comprehension(f,l,null,u):new Sk.astnodes.comprehension(new Sk.astnodes.Tuple(d,Sk.astnodes.Store,f.lineno,f.col_offset,c.end_lineno,c.end_col_offset),l,null,u),i(t)==5+u){f=[];e:for(l=t=r(t,4+u),u=0;;){if(s(l,O.comp_iter),r(l,0).type==O.comp_for){c=u;break e}if(s(l=r(l,0),O.comp_if),u++,2==i(l)){c=u;break e}l=r(l,2)}if(-1==c)return null;for(u=0;u<c;u++){if(s(t,O.comp_iter),s(t=r(t,0),O.comp_if),!(l=L(e,r(t,1))))return null;f[u]=l,3==i(t)&&(t=r(t,2))}t.type==O.comp_iter&&(t=r(t,0)),d.ifs=f}n[o]=d}return n}(e,r(t,1)),0==n?new Sk.astnodes.GeneratorExp(l,e,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):1==n?new Sk.astnodes.ListComp(l,e,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):2==n?new Sk.astnodes.SetComp(l,e,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):null)}function N(e,t){return Sk.asserts.assert(0<i(t)),t.type===O.testlist_comp?1<i(t)&&Sk.asserts.assert(r(t,1).type!==O.comp_for):Sk.asserts.assert(t.type===O.testlist||t.type===O.testlist_star_expr),1===i(t)?L(e,r(t,0)):new Sk.astnodes.Tuple(m(e,t),Sk.astnodes.Load,t.lineno,t.col_offset)}function I(e,t,n,i,r,s,a){Sk.asserts.assert("{"==e.charAt(t));var l=++t;let u,c,d=null,f=0,h=0,p=()=>o(s,a,"f-string: expecting '}'");for(Sk.asserts.assert(t<=n);t<n;t++){let i=e.charAt(t);if("\\"==i&&o(s,a,"f-string expression part cannot include a backslash"),d)i==d&&(3==f?t+2<n&&e.charAt(t+1)==i&&e.charAt(t+2)==i&&(t+=2,d=f=0):f=d=0);else if("'"==i||'"'==i)t+2<n&&e.charAt(t+1)==i&&e.charAt(t+2)==i?(f=3,t+=2):f=1,d=i;else if("["==i||"{"==i||"("==i)h++;else if(0==h||"]"!=i&&"}"!=i&&")"!=i){if("#"==i)o(s,a,"f-string expression part cannot include '#'");else if(!(0!=h||"!"!=i&&":"!=i&&"}"!=i||"!"==i&&t+1<n&&"="==e.charAt(t+1)))break}else h--}return d&&o(s,a,"f-string: unterminated string"),h&&o(s,a,"f-string: mismatched '(', '{', or '['"),l=function(e,t,n,i,r){Sk.asserts.assert(n>=t),Sk.asserts.assert("{"==e.charAt(t-1)),Sk.asserts.assert("}"==e.charAt(n)||"!"==e.charAt(n)||":"==e.charAt(n)),e=e.substring(t,n),/^\s*$/.test(e)&&o(i,r,"f-string: empty expression not allowed");try{let t=Sk.parse("<fstring>","("+e+")");var s=Sk.astFromParse(t.cst,"<fstring>",t.flags)}catch(e){throw e.traceback&&e.traceback[0]&&((s=e.traceback[0]).lineno=(s.lineno||1)-1+r.lineno,s.filename=i.c_filename),e}return Sk.asserts.assert(1==s.body.length&&s.body[0].constructor===Sk.astnodes.Expr),s.body[0].value}(e,l,t,s,a),"!"==e.charAt(t)&&(++t>=n&&p(),c=e.charAt(t),t++,"s"!=c&&"r"!=c&&"a"!=c&&o(s,a,"f-string: invalid conversion character: expected 's', 'r', or 'a'")),t>=n&&p(),":"==e.charAt(t)&&(++t>=n&&p(),[u,t]=B(e,t,n,i,r+1,s,a)),(t>=n||"}"!=e.charAt(t))&&p(),t++,[new Sk.astnodes.FormattedValue(l,c,u,a.lineno,a.col_offset),t]}function B(e,t,n,i,r,s,o){let a=[],l=e=>{if(-1!==e.indexOf("}")){if(/(^|[^}])}(}})*($|[^}])/.test(e))throw new Sk.builtin.SyntaxError("f-string: single '}' is not allowed",s.c_filename,o.lineno,o.col_offset);e=e.replace(/}}/g,"}")}a.push(new Sk.astnodes.Str(new Sk.builtin.str(e),o.lineno,o.col_offset,s.end_lineno,o.end_col_offset))};for(;t<n;){let u=e.indexOf("{",t);if(0!==r){let i=e.indexOf("}",t);-1!==i&&(-1===u?n=i:u>i&&(u=-1,n=i))}if(-1===u){l(e.substring(t,n)),t=n;break}if(u+1<n&&"{"===e.charAt(u+1))l(e.substring(t,u+1)),t=u+2;else{l(e.substring(t,u)),t=u;let[c,d]=I(e,u,n,i,r,s,o);a.push(c),t=d}}return[new Sk.astnodes.JoinedStr(a,o.lineno,o.col_offset),t]}function F(e,t){var n,o;s(t,O.subscript);var a=r(t,0),l=n=o=null;return a.type===R.T_DOT?new Sk.astnodes.Ellipsis:1===i(t)&&a.type===O.test?new Sk.astnodes.Index(L(e,a)):(a.type===O.test&&(o=L(e,a)),a.type===R.T_COLON?1<i(t)&&(a=r(t,1)).type===O.test&&(n=L(e,a)):2<i(t)&&(a=r(t,2)).type===O.test&&(n=L(e,a)),(a=r(t,i(t)-1)).type===O.sliceop&&(1===i(a)?(a=r(a,0),l=new Sk.astnodes.NameConstant(Sk.builtin.none.none$,Sk.astnodes.Load,a.lineno,a.col_offset)):(a=r(a,1)).type===O.test&&(l=L(e,a))),new Sk.astnodes.Slice(o,n,l))}function M(e,t){var n=r(t,0);switch(n.type){case R.T_NAME:var l=n.value;if(4<=l.length&&5>=l.length){if("None"===l)return new Sk.astnodes.NameConstant(Sk.builtin.none.none$,t.lineno,t.col_offset);if("True"===l)return new Sk.astnodes.NameConstant(Sk.builtin.bool.true$,t.lineno,t.col_offset);if("False"===l)return new Sk.astnodes.NameConstant(Sk.builtin.bool.false$,t.lineno,t.col_offset)}return e=f(l),new Sk.astnodes.Name(e,Sk.astnodes.Load,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);case R.T_STRING:n=[];for(var u=0;u<i(t);++u){for(var c=r(t,u).value,d=e,h=r(t,u),_=c,b=_.charAt(0),g=!1,S=c=!1;;){if("u"!==b&&"U"!==b)if("r"===b||"R"===b)g=!0;else if("b"===b||"B"===b)S=!0;else{if("f"!==b&&"F"!==b)break;c=!0}b=(_=_.substr(1)).charAt(0)}if(Sk.asserts.assert("'"===b||'"'===b&&_.charAt(_.length-1)===b),4<=(_=_.substr(1,_.length-2)).length&&_.charAt(0)===b&&_.charAt(1)===b&&(Sk.asserts.assert(_.charAt(_.length-1)===b&&_.charAt(_.length-2)===b),_=_.substr(2,_.length-4)),g||-1===_.indexOf("\\")){if(S)for(b=0;b<_.length;b++)127<_.charCodeAt(b)&&o(d,h,"bytes can only contain ASCII literal characters");d=[a(_),c,S]}else{var y=(g=_).length,v="";for(_=0;_<y;++_)"\\"===(b=g.charAt(_))?(++_,"n"===(b=g.charAt(_))?v+="\n":"\\"===b?v+="\\":"t"===b?v+="\t":"r"===b?v+="\r":"b"===b?v+="\b":"f"===b?v+="\f":"v"===b?v+="\v":"0"===b?v+="\0":'"'===b?v+='"':"'"===b?v+="'":"\n"!==b&&("x"===b?(_+2>=y&&o(d,h,"Truncated \\xNN escape"),v+=String.fromCharCode(parseInt(g.substr(_+1,2),16)),_+=2):S||"u"!==b?S||"U"!==b?v+="\\"+b:(_+8>=y&&o(d,h,"Truncated \\UXXXXXXXX escape"),v+=String.fromCodePoint(parseInt(g.substr(_+1,8),16)),_+=8):(_+4>=y&&o(d,h,"Truncated \\uXXXX escape"),v+=String.fromCharCode(parseInt(g.substr(_+1,4),16)),_+=4))):S&&127<b.charCodeAt(0)?o(d,h,"bytes can only contain ASCII literal characters"):v+=b;d=[a(d=v),c,S]}if(d=(c=d)[0],h=c[1],c=c[2],0!=u&&l!==c&&o(e,t,"cannot mix bytes and nonbytes literals"),l=c,h){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("invalid string (f-strings are not supported in Python 2)",e.c_filename,r(t,u).lineno);var $=d.$jsstr();[$]=B($,0,$.length,!1,0,e,r(t,u)),n.push.apply(n,$.values),$=null}else $?$.s=$.s.sq$concat(d):($=new(l?Sk.astnodes.Bytes:Sk.astnodes.Str)(d,t.lineno,t.col_offset,e.end_lineno,t.end_col_offset),n.push($))}return 1===n.length&&n[0].constructor===Sk.astnodes.Str?n[0]:new Sk.astnodes.JoinedStr(n,t.lineno,t.col_offset,e.end_lineno,t.end_col_offset);case R.T_NUMBER:return e=Sk.astnodes.Num,"j"===(u=(l=(l=n.value).replace(U,""))[l.length-1])||"J"===u?l=new Sk.builtin.complex(0,parseFloat(l.slice(0,-1))):z.test(l)?l=new Sk.builtin.float_(parseFloat(l)):("0"===l[0]&&"0"!==l&&65>l.charCodeAt(1)&&(l="0o"+l.substring(1)),n=!0,"l"!==u&&"L"!==u||(l=l.slice(0,-1),n=!1),l=(u=Number(l))>Number.MAX_SAFE_INTEGER?n?new Sk.builtin.int_(JSBI.BigInt(l)):new Sk.builtin.lng(JSBI.BigInt(l)):n?new Sk.builtin.int_(u):new Sk.builtin.lng(u)),new e(l,t.lineno,t.col_offset);case R.T_ELLIPSIS:return new Sk.astnodes.Ellipsis(t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);case R.T_LPAR:return(n=r(t,1)).type==R.T_RPAR?new Sk.astnodes.Tuple([],Sk.astnodes.Load,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):n.type==O.yield_expr?L(e,n):1==i(n)?N(e,n):r(n,1).type==O.comp_for?p(k(e,n),t):p(N(e,n),t);case R.T_LSQB:return(n=r(t,1)).type==R.T_RSQB?new Sk.astnodes.List([],Sk.astnodes.Load,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):(s(n,O.testlist_comp),1==i(n)||r(n,1).type==R.T_COMMA?(e=m(e,n))?new Sk.astnodes.List(e,Sk.astnodes.Load,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):null:(l=n,Sk.asserts.assert(l.type==O.testlist_comp),p(e=T(e,l,1),t)));case R.T_LBRACE:if((n=r(t,1)).type==R.T_RBRACE)return new Sk.astnodes.Dict(null,null,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);if(l=r(n,0).type==R.T_DOUBLESTAR,1==i(n)||1<i(n)&&r(n,1).type==R.T_COMMA){for(l=n,u=[],Sk.asserts.assert(l.type===O.dictorsetmaker),n=0;n<i(l);n+=2)$=L(e,r(l,n)),u[n/2]=$;e=new Sk.astnodes.Set(u,l.lineno,l.col_offset)}else if(1<i(n)&&r(n,1).type==O.comp_for)l=n,Sk.asserts.assert(l.type===O.dictorsetmaker),Sk.asserts.assert(1<i(l)),n=L(e,r(l,0)),e=C(e,r(l,1)),e=new Sk.astnodes.SetComp(n,e,l.lineno,l.col_offset);else if(i(n)>3-l&&r(n,3-l).type==O.comp_for){if(l)return o(e,t,"dict unpacking cannot be used in dict comprehension"),null;l=n,Sk.asserts.assert(3<i(l)),s(r(l,1),R.T_COLON),n=L(e,r(l,0)),u=L(e,r(l,2)),e=C(e,r(l,3)),e=new Sk.astnodes.DictComp(n,u,e,l.lineno,l.col_offset)}else{for(l=n,u=[],$=[],c=n=0;c<i(l);c++)d=e,r(h=l,S=c).type==R.T_DOUBLESTAR?(Sk.asserts.assert(2<=i(h)-S),d={key:null,value:c=L(d,r(h,S+1)),i:S+2}):(Sk.asserts.assert(3<=i(h)-S),(c=L(d,r(h,S)))?(_=c,s(r(h,S+1),R.T_COLON),d=!!(c=L(d,r(h,S+2)))&&{key:_,value:c,i:S+3}):d=0),c=d.i,u[n]=d.key,$[n]=d.value,n++;e=new Sk.astnodes.Dict(u,$,l.lineno,l.col_offset,l.end_lineno,l.end_col_offset)}return p(e,t);default:return Sk.asserts.fail("unhandled atom "+n.type),null}}function D(e,t){var n,o=0;s(t,O.atom_expr);var a=i(t);r(t,0).type===R.T_AWAIT&&(o=1,Sk.asserts.assert(1<a));var l=M(e,r(t,o));if(!l)return null;if(1===a)return l;if(o&&2===a)return new Sk.astnodes.Await(l,t.lineno,t.col_offset);for(n=o+1;n<a;n++){var u=r(t,n);if(u.type!==O.trailer)break;if(!(u=v(e,u,l)))return null;u.lineno=l.lineno,u.col_offset=l.col_offset,l=u}return o?new Sk.astnodes.Await(l,t.line,t.col_offset):l}function L(e,t){e:for(;;){switch(t.type){case O.test:case O.test_nocond:if(r(t,0).type===O.lambdef||r(t,0).type===O.lambdef_nocond){var n=r(t,0);return 3===i(n)?(t=new Sk.astnodes.arguments_([],null,null,[]),e=L(e,r(n,2))):(t=x(e,r(n,1)),e=L(e,r(n,3))),new Sk.astnodes.Lambda(t,e,n.lineno,n.col_offset)}if(1<i(t))return Sk.asserts.assert(5===i(t)),new Sk.astnodes.IfExp(L(e,r(t,2)),L(e,r(t,0)),L(e,r(t,4)),t.lineno,t.col_offset);case O.or_test:case O.and_test:if(1===i(t)){t=r(t,0);continue e}var o=[];for(n=0;n<i(t);n+=2)o[n/2]=L(e,r(t,n));return"and"===r(t,1).value?new Sk.astnodes.BoolOp(Sk.astnodes.And,o,t.lineno,t.col_offset):(Sk.asserts.assert("or"===r(t,1).value),new Sk.astnodes.BoolOp(Sk.astnodes.Or,o,t.lineno,t.col_offset));case O.not_test:if(1===i(t)){t=r(t,0);continue e}return new Sk.astnodes.UnaryOp(Sk.astnodes.Not,L(e,r(t,1)),t.lineno,t.col_offset);case O.comparison:if(1===i(t)){t=r(t,0);continue e}var a=[];for(o=[],n=1;n<i(t);n+=2)a[(n-1)/2]=h(0,r(t,n)),o[(n-1)/2]=L(e,r(t,n+1));return new Sk.astnodes.Compare(L(e,r(t,0)),a,o,t.lineno,t.col_offset);case O.star_expr:return s(t,O.star_expr),new Sk.astnodes.Starred(L(e,r(t,1)),Sk.astnodes.Load,t.lineno,t.col_offset);case O.expr:case O.xor_expr:case O.and_expr:case O.shift_expr:case O.arith_expr:case O.term:if(1===i(t)){t=r(t,0);continue e}var l=t,u=new Sk.astnodes.BinOp(L(e,r(l,0)),d(r(l,1)),L(e,r(l,2)),l.lineno,l.col_offset),c=(i(l)-1)/2;for(t=1;t<c;++t)o=d(n=r(l,2*t+1)),a=L(e,r(l,2*t+2)),u=new Sk.astnodes.BinOp(u,o,a,n.lineno,n.col_offset);return u;case O.yield_expr:return o=!1,a=null,1<i(t)&&(n=r(t,1)),n&&(a=r(n,i(n)-1),2==i(n)?(o=!0,a=L(e,a)):a=N(e,a)),o?new Sk.astnodes.YieldFrom(a,t.lineno,t.col_offset):new Sk.astnodes.Yield(a,t.lineno,t.col_offset);case O.factor:if(1===i(t)){t=r(t,0);continue e}return S(e,t);case O.power:return s(n=t,O.power),t=D(e,r(n,0)),1!==i(n)&&r(n,i(n)-1).type===O.factor&&(e=L(e,r(n,i(n)-1)),t=new Sk.astnodes.BinOp(t,Sk.astnodes.Pow,e,n.lineno,n.col_offset)),t;default:Sk.asserts.fail("unhandled expr","n.type: %d",t.type)}break}}function j(e,t){if(t.type===O.stmt&&(Sk.asserts.assert(1===i(t)),t=r(t,0)),t.type===O.simple_stmt&&(Sk.asserts.assert(1===l(t)),t=r(t,0)),t.type===O.small_stmt)switch(t=r(t,0),t.type){case O.expr_stmt:return function(e,t){if(s(t,O.expr_stmt),1===i(t))return new Sk.astnodes.Expr(N(e,r(t,0)),t.lineno,t.col_offset);if(r(t,1).type===O.augassign){var n=r(t,0),o=N(e,n);switch(c(e,o,Sk.astnodes.Store,n),o.constructor){case Sk.astnodes.Name:var a=o.id;u(e,0,a,t.lineno);break;case Sk.astnodes.Attribute:case Sk.astnodes.Subscript:break;case Sk.astnodes.GeneratorExp:throw new Sk.builtin.SyntaxError("augmented assignment to generator expression not possible",e.c_filename,t.lineno);case Sk.astnodes.Yield:throw new Sk.builtin.SyntaxError("augmented assignment to yield expression not possible",e.c_filename,t.lineno);default:throw new Sk.builtin.SyntaxError("illegal expression for augmented assignment",e.c_filename,t.lineno)}return a=(n=r(t,2)).type===O.testlist?N(e,n):L(e,n),new Sk.astnodes.AugAssign(o,function(e,t){switch(s(t,O.augassign),(t=r(t,0)).value.charAt(0)){case"+":return Sk.astnodes.Add;case"-":return Sk.astnodes.Sub;case"/":return"/"===t.value.charAt(1)?Sk.astnodes.FloorDiv:Sk.astnodes.Div;case"%":return Sk.astnodes.Mod;case"<":return Sk.astnodes.LShift;case">":return Sk.astnodes.RShift;case"&":return Sk.astnodes.BitAnd;case"^":return Sk.astnodes.BitXor;case"|":return Sk.astnodes.BitOr;case"*":return"*"===t.value.charAt(1)?Sk.astnodes.Pow:Sk.astnodes.Mult;case"@":if(Sk.__future__.python3)return Sk.astnodes.MatMult;default:Sk.asserts.fail("invalid augassign")}}(0,r(t,1)),a,t.lineno,t.col_offset)}if(r(t,1).type===O.annassign){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("Annotated assignment is not supported in Python 2",e.c_filename,t.lineno);n=r(t,0);var l=r(t,1),d=1;for(o=n;1==i(o);)o=r(o,0);switch(0<i(o)&&r(o,0).type==R.T_LPAR&&(d=0),(o=N(e,n)).constructor){case Sk.astnodes.Name:u(e,0,a=o.id,t.lineno),c(e,o,Sk.astnodes.Store,n);break;case Sk.astnodes.Attribute:u(e,0,a=o.attr,t.lineno),c(e,o,Sk.astnodes.Store,n);break;case Sk.astnodes.Subscript:c(e,o,Sk.astnodes.Store,n);break;case Sk.astnodes.List:throw new Sk.builtin.SyntaxError("only single target (not list) can be annotated",e.c_filename,t.lineno);case Sk.astnodes.Tuple:throw new Sk.builtin.SyntaxError("only single target (not tuple) can be annotated",e.c_filename,t.lineno);default:throw new Sk.builtin.SyntaxError("illegal target for annotation",e.c_filename,t.lineno)}return o.constructor!=Sk.astnodes.Name&&(d=0),a=L(e,n=r(l,1)),2==i(l)?new Sk.astnodes.AnnAssign(o,a,null,d,t.lineno,t.col_offset):(e=L(e,n=r(l,3)),new Sk.astnodes.AnnAssign(o,a,e,d,t.lineno,t.col_offset))}for(s(r(t,1),R.T_EQUAL),d=[],o=0;o<i(t)-2;o+=2){if((n=r(t,o)).type===O.yield_expr)throw new Sk.builtin.SyntaxError("assignment to yield expression not possible",e.c_filename,t.lineno);c(e,n=N(e,n),Sk.astnodes.Store,r(t,o)),d[o/2]=n}return e=(n=r(t,i(t)-1)).type===O.testlist_star_expr?N(e,n):L(e,n),new Sk.astnodes.Assign(d,e,t.lineno,t.col_offset)}(e,t);case O.del_stmt:var n=t;return s(n,O.del_stmt),new Sk.astnodes.Delete(b(e,r(n,1),Sk.astnodes.Del),n.lineno,n.col_offset);case O.pass_stmt:return new Sk.astnodes.Pass(t.lineno,t.col_offset);case O.flow_stmt:return function(e,t){s(t,O.flow_stmt);var n=r(t,0);switch(n.type){case O.break_stmt:return new Sk.astnodes.Break(t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);case O.continue_stmt:return new Sk.astnodes.Continue(t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);case O.yield_stmt:return(e=L(e,r(n,0)))?new Sk.astnodes.Expr(e,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):null;case O.return_stmt:if(1==i(n))return new Sk.astnodes.Return(null,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);var a=N(e,r(n,1));return a?new Sk.astnodes.Return(a,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):null;case O.raise_stmt:if(1==i(n))return new Sk.astnodes.Raise(null,null,null,null,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);if(2<=i(n)){var l=null;a=L(e,r(n,1));var u=null,c=null;return 4==i(n)&&"from"==r(n,2).value?(Sk.__future__.python3||o(e,r(n,2),"raise ... from ... is not available in Python 2"),l=L(e,r(n,3))):4<=i(n)&&","==r(n,2).value&&(Sk.__future__.python3&&o(e,t,"Old raise syntax is not available in Python 3"),u=L(e,r(n,3)),6==i(n)&&(c=L(e,r(n,5)))),new Sk.astnodes.Raise(a,l,u,c,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset)}default:return Sk.asserts.fail("unexpected flow_stmt: ",n.type),null}}(e,t);case O.import_stmt:var d,f=t;s(f,O.import_stmt);var h=f.lineno;if(t=f.col_offset,(f=r(f,0)).type===O.import_name){s(f=r(f,1),O.dotted_as_names);var p=[];for(d=0;d<i(f);d+=2)p[d/2]=g(e,r(f,d));e=new Sk.astnodes.Import(p,h,t)}else{if(f.type!==O.import_from)throw new Sk.builtin.SyntaxError("unknown import statement",e.c_filename,f.lineno);var m=null;for(n=0,p=1;p<i(f);++p){if(r(f,p).type===O.dotted_name){m=g(e,r(f,p)),p++;break}if(r(f,p).type===R.T_DOT)n++;else{if(r(f,p).type!==R.T_ELLIPSIS)break;n+=3}}switch(r(f,++p).type){case R.T_STAR:f=r(f,p);break;case R.T_LPAR:i(f=r(f,p+1));break;case O.import_as_names:if(0==(p=i(f=r(f,p)))%2)throw new Sk.builtin.SyntaxError("trailing comma not allowed without surrounding parentheses",e.c_filename,f.lineno);break;default:throw new Sk.builtin.SyntaxError("Unexpected node-type in from-import",e.c_filename,f.lineno)}if(p=[],f.type===R.T_STAR)p[0]=g(e,f);else for(d=0;d<i(f);d+=2)p[d/2]=g(e,r(f,d));e=m?m.name.v:"",e=new Sk.astnodes.ImportFrom(a(e),p,n,h,t)}return e;case O.global_stmt:for(e=t,t=[],s(e,O.global_stmt),n=1;n<i(e);n+=2)t[(n-1)/2]=a(r(e,n).value);return new Sk.astnodes.Global(t,e.lineno,e.col_offset);case O.nonlocal_stmt:o(e,t,"Not implemented: nonlocal");break;case O.assert_stmt:return s(n=t,O.assert_stmt),2===i(n)?e=new Sk.astnodes.Assert(L(e,r(n,1)),null,n.lineno,n.col_offset):4===i(n)?e=new Sk.astnodes.Assert(L(e,r(n,1)),L(e,r(n,3)),n.lineno,n.col_offset):(Sk.asserts.fail("improper number of parts to assert stmt"),e=void 0),e;case O.print_stmt:for(n=t,Sk.__future__.print_function&&o(e,n,"Missing parentheses in call to 'print'"),f=1,h=null,s(n,O.print_stmt),2<=i(n)&&r(n,1).type===R.T_RIGHTSHIFT&&(h=L(e,r(n,2)),f=4),t=[],m=0;f<i(n);f+=2,++m)t[m]=L(e,r(n,f));return e=r(n,i(n)-1).type!==R.T_COMMA,new Sk.astnodes.Print(h,t,e,n.lineno,n.col_offset);case O.debugger_stmt:return new Sk.astnodes.Debugger(t.lineno,t.col_offset);default:Sk.asserts.fail("unhandled small_stmt")}else switch(n=r(t,0),s(t,O.compound_stmt),n.type){case O.if_stmt:if(s(n,O.if_stmt),4===i(n))e=new Sk.astnodes.If(L(e,r(n,1)),_(e,r(n,3)),[],n.lineno,n.col_offset);else if("s"===(t=r(n,4).value.charAt(2)))e=new Sk.astnodes.If(L(e,r(n,1)),_(e,r(n,3)),_(e,r(n,6)),n.lineno,n.col_offset);else if("i"===t){for(f=!1,t=[],r(n,1+(h=i(n)-4)).type===R.T_NAME&&"s"===r(n,h+1).value.charAt(2)&&(f=!0,h-=3),h/=4,f&&(t=[new Sk.astnodes.If(L(e,r(n,i(n)-6)),_(e,r(n,i(n)-4)),_(e,r(n,i(n)-1)),r(n,i(n)-6).lineno,r(n,i(n)-6).col_offset)],h--),m=0;m<h;++m)f=5+4*(h-m-1),t=[new Sk.astnodes.If(L(e,r(n,f)),_(e,r(n,f+2)),t,r(n,f).lineno,r(n,f).col_offset)];e=new Sk.astnodes.If(L(e,r(n,1)),_(e,r(n,3)),t,n.lineno,n.col_offset)}else Sk.asserts.fail("unexpected token in 'if' statement"),e=void 0;return e;case O.while_stmt:return s(n,O.while_stmt),4===i(n)?e=new Sk.astnodes.While(L(e,r(n,1)),_(e,r(n,3)),[],n.lineno,n.col_offset):7===i(n)?e=new Sk.astnodes.While(L(e,r(n,1)),_(e,r(n,3)),_(e,r(n,6)),n.lineno,n.col_offset):(Sk.asserts.fail("wrong number of tokens for 'while' stmt"),e=void 0),e;case O.for_stmt:return t=[],s(n,O.for_stmt),9===i(n)&&(t=_(e,r(n,8))),h=b(e,f=r(n,1),Sk.astnodes.Store),h=1===i(f)?h[0]:new Sk.astnodes.Tuple(h,Sk.astnodes.Store,n.lineno,n.col_offset),new Sk.astnodes.For(h,N(e,r(n,3)),_(e,r(n,5)),t,n.lineno,n.col_offset);case O.try_stmt:if(t=[],h=((d=i(n))-3)/3,m=[],p=null,s(n,O.try_stmt),f=_(e,r(n,2)),r(n,d-3).type===R.T_NAME)"finally"===r(n,d-3).value?(9<=d&&r(n,d-6).type===R.T_NAME&&(m=_(e,r(n,d-4)),h--),p=_(e,r(n,d-1))):m=_(e,r(n,d-1)),h--;else if(r(n,d-3).type!==O.except_clause)throw new Sk.builtin.SyntaxError("malformed 'try' statement",e.c_filename,n.lineno);if(0<h)for(d=0;d<h;d++){var k=d,S=e,v=r(n,3+3*d),$=r(n,5+3*d);if(s(v,O.except_clause),s($,O.suite),1===i(v))var w=new Sk.astnodes.ExceptHandler(null,null,_(S,$),v.lineno,v.col_offset);else 2===i(v)?w=new Sk.astnodes.ExceptHandler(L(S,r(v,1)),null,_(S,$),v.lineno,v.col_offset):4===i(v)?(Sk.__future__.python3&&","==r(v,2).value&&o(S,v,"Old-style 'except' clauses are not supported in Python 3"),L(S,r(v,1)),c(S,w=L(S,r(v,3)),Sk.astnodes.Store,r(v,3)),w=new Sk.astnodes.ExceptHandler(L(S,r(v,1)),w,_(S,$),v.lineno,v.col_offset)):(Sk.asserts.fail("wrong number of children for except clause"),w=void 0);t[k]=w}return Sk.asserts.assert(!!p||0!=t.length),new Sk.astnodes.Try(f,t,m,p,n.lineno,n.col_offset);case O.with_stmt:for(t=[],s(n,O.with_stmt),h=1;h<i(n)-2;h+=2)f=void 0,p=e,s(d=r(n,h),O.with_item),m=L(p,r(d,0)),3==i(d)&&c(p,f=L(p,r(d,2)),Sk.astnodes.Store,d),f=new Sk.astnodes.withitem(m,f),t[(h-1)/2]=f;return e=_(e,r(n,i(n)-1)),new Sk.astnodes.With(t,e,n.lineno,n.col_offset);case O.funcdef:return A(e,n,[],!1);case O.classdef:return E(e,n,[]);case O.decorated:for(h=null,s(n,O.decorated),s(f=r(n,0),O.decorators),t=[],m=0;m<i(f);++m){p=t,d=m,k=e,s(w=r(f,m),O.decorator),s(r(w,0),R.T_AT),s(r(w,i(w)-1),R.T_NEWLINE);var x,C=r(w,1);s(C,O.dotted_name),S=C.lineno,v=C.col_offset,$=a(r(C,0).value);var T=new Sk.astnodes.Name($,Sk.astnodes.Load,S,v);for(x=2;x<i(C);x+=2)$=a(r(C,x).value),T=new Sk.astnodes.Attribute(T,$,Sk.astnodes.Load,S,v);S=T,k=3===i(w)?S:5===i(w)?new Sk.astnodes.Call(S,[],[],w.lineno,w.col_offset):y(k,r(w,3),S),p[d]=k}return Sk.asserts.assert(r(n,1).type==O.funcdef||r(n,1).type==O.async_funcdef||r(n,1).type==O.classdef),r(n,1).type==O.funcdef?h=A(e,h=r(n,1),t,!1):r(n,1).type==O.classdef?h=E(e,r(n,1),t):r(n,1).type==O.async_funcdef&&(s(h=r(n,1),O.async_funcdef),s(r(h,0),R.T_NAME),Sk.asserts.assert(("async"===r(h,0)).value),s(r(h,1),O.funcdef),h=A(e,h,t,!0)),h&&(h.lineno=n.lineno,h.col_offset=n.col_offset),h;case O.async_stmt:o(e,n,"Not implemented: async");break;default:Sk.asserts.assert("unhandled compound_stmt")}}var O=Sk.ParseTables.sym,R=Sk.token.tokens,P={Slice_kind:1,ExtSlice_kind:2,Index_kind:3},q={};q[R.T_VBAR]=Sk.astnodes.BitOr,q[R.T_CIRCUMFLEX]=Sk.astnodes.BitXor,q[R.T_AMPER]=Sk.astnodes.BitAnd,q[R.T_LEFTSHIFT]=Sk.astnodes.LShift,q[R.T_RIGHTSHIFT]=Sk.astnodes.RShift,q[R.T_PLUS]=Sk.astnodes.Add,q[R.T_MINUS]=Sk.astnodes.Sub,q[R.T_STAR]=Sk.astnodes.Mult,q[R.T_SLASH]=Sk.astnodes.Div,q[R.T_DOUBLESLASH]=Sk.astnodes.FloorDiv,q[R.T_PERCENT]=Sk.astnodes.Mod,Sk.setupOperators=function(e){e?q[R.T_AT]=Sk.astnodes.MatMult:q[R.T_AT]&&delete q[R.T_AT]},Sk.exportSymbol("Sk.setupOperators",Sk.setupOperators);const z=new RegExp("^"+Sk._tokenize.Floatnumber+"$"),U=/_/g;Sk.astFromParse=function(e,t,o){var a,u=new n("utf-8",t,o),c=[],d=0;switch(e.type){case O.file_input:for(a=0;a<i(e)-1;++a){var f=r(e,a);if(f.type!==R.T_NEWLINE)if(s(f,O.stmt),1===(o=l(f)))c[d++]=j(u,f);else for(s(f=r(f,0),O.simple_stmt),t=0;t<o;++t)c[d++]=j(u,r(f,2*t))}return new Sk.astnodes.Module(c);case O.eval_input:Sk.asserts.fail("todo;");case O.single_input:Sk.asserts.fail("todo;");default:Sk.asserts.fail("todo;")}},Sk.astDump=function(e){var t=function(e){var t,n="";for(t=0;t<e;++t)n+=" ";return n},n=function(e,i){var r;if(null===e)return i+"None";if(e.prototype&&void 0!==e.prototype._astname&&e.prototype._isenum)return i+e.prototype._astname+"()";if(void 0!==e._astname){var s=t(e._astname.length+1),o=[];for(r=0;r<e._fields.length;r+=2){var a=e._fields[r],l=e._fields[r+1](e),u=t(a.length+1);o.push([a,n(l,i+s+u)])}for(l=[],r=0;r<o.length;++r)u=o[r],l.push(u[0]+"="+u[1].replace(/^\s+/,""));return r=l.join(",\n"+i+s),i+e._astname+"("+r+")"}if(Sk.isArrayLike(e)){for(s=[],r=0;r<e.length;++r)o=e[r],s.push(n(o,i+" "));return i+"["+(e=s.join(",\n")).replace(/^\s+/,"")+"]"}return i+(!0===e?"True":!1===e?"False":e instanceof Sk.builtin.lng?e.tp$str().v:e instanceof Sk.builtin.str?e.$r().v:""+e)};return n(e,"")},Sk.exportSymbol("Sk.astFromParse",Sk.astFromParse),Sk.exportSymbol("Sk.astDump",Sk.astDump)},function(e,t){function n(e,t,n){this.__name=e,this.__flags=t,this.__scope=t>>11&7,this.__namespaces=n||[]}function i(e,t,n,i,r){this.symFlags={},this.name=t,this.varnames=[],this.children=[],this.blockType=n,this.returnsValue=this.varkeywords=this.varargs=this.generator=this.childHasFree=this.hasFree=this.isNested=!1,this.lineno=r,this.table=e,e.cur&&(e.cur.nested||"function"===e.cur.blockType)&&(this.isNested=!0),i.scopeId=a++,e.stss[i.scopeId]=this,this.symbols={}}function r(e){this.filename=e,this.top=this.cur=null,this.stack=[],this.curClass=this.global=null,this.tmpname=0,this.stss={}}function s(e,t){var n;for(n=0;n<t.length;n++)e(t[n])}function o(e,t){for(var n in t)e[n]=t[n]}Sk.exportSymbol("Sk.SYMTAB_CONSTS",{DEF_GLOBAL:1,DEF_LOCAL:2,DEF_PARAM:4,USE:8,DEF_STAR:16,DEF_DOUBLESTAR:32,DEF_INTUPLE:64,DEF_FREE:128,DEF_FREE_GLOBAL:256,DEF_FREE_CLASS:512,DEF_IMPORT:1024,DEF_BOUND:1030,SCOPE_OFF:11,SCOPE_MASK:7,LOCAL:1,GLOBAL_EXPLICIT:2,GLOBAL_IMPLICIT:3,FREE:4,CELL:5,OPT_IMPORT_STAR:1,OPT_EXEC:2,OPT_BARE_EXEC:4,OPT_TOPLEVEL:8,GENERATOR:2,GENERATOR_EXPRESSION:2,ModuleBlock:"module",FunctionBlock:"function",ClassBlock:"class"}),n.prototype.get_name=function(){return this.__name},n.prototype.is_referenced=function(){return!!(8&this.__flags)},n.prototype.is_parameter=function(){return!!(4&this.__flags)},n.prototype.is_global=function(){return 3===this.__scope||2==this.__scope},n.prototype.is_declared_global=function(){return 2==this.__scope},n.prototype.is_local=function(){return!!(1030&this.__flags)},n.prototype.is_free=function(){return 4==this.__scope},n.prototype.is_imported=function(){return!!(1024&this.__flags)},n.prototype.is_assigned=function(){return!!(2&this.__flags)},n.prototype.is_namespace=function(){return this.__namespaces&&0<this.__namespaces.length},n.prototype.get_namespaces=function(){return this.__namespaces};var a=0;i.prototype.get_type=function(){return this.blockType},i.prototype.get_name=function(){return this.name},i.prototype.get_lineno=function(){return this.lineno},i.prototype.is_nested=function(){return this.isNested},i.prototype.has_children=function(){return 0<this.children.length},i.prototype.get_identifiers=function(){return this._identsMatching((function(){return!0}))},i.prototype.lookup=function(e){if(this.symbols.hasOwnProperty(e))e=this.symbols[e];else{var t=this.symFlags[e],i=this.__check_children(e);e=this.symbols[e]=new n(e,t,i)}return e},i.prototype.__check_children=function(e){var t,n=[];for(t=0;t<this.children.length;++t){var i=this.children[t];i.name===e&&n.push(i)}return n},i.prototype._identsMatching=function(e){var t,n=[];for(t in this.symFlags)this.symFlags.hasOwnProperty(t)&&e(this.symFlags[t])&&n.push(t);return n.sort(),n},i.prototype.get_parameters=function(){return Sk.asserts.assert("function"==this.get_type(),"get_parameters only valid for function scopes"),this._funcParams||(this._funcParams=this._identsMatching((function(e){return 4&e}))),this._funcParams},i.prototype.get_locals=function(){return Sk.asserts.assert("function"==this.get_type(),"get_locals only valid for function scopes"),this._funcLocals||(this._funcLocals=this._identsMatching((function(e){return 1030&e}))),this._funcLocals},i.prototype.get_globals=function(){return Sk.asserts.assert("function"==this.get_type(),"get_globals only valid for function scopes"),this._funcGlobals||(this._funcGlobals=this._identsMatching((function(e){return 3==(e=e>>11&7)||2==e}))),this._funcGlobals},i.prototype.get_frees=function(){return Sk.asserts.assert("function"==this.get_type(),"get_frees only valid for function scopes"),this._funcFrees||(this._funcFrees=this._identsMatching((function(e){return 4==(e>>11&7)}))),this._funcFrees},i.prototype.get_methods=function(){var e;if(Sk.asserts.assert("class"==this.get_type(),"get_methods only valid for class scopes"),!this._classMethods){var t=[];for(e=0;e<this.children.length;++e)t.push(this.children[e].name);t.sort(),this._classMethods=t}return this._classMethods},i.prototype.getScope=function(e){return void 0===(e=this.symFlags[e])?0:e>>11&7},r.prototype.getStsForAst=function(e){return Sk.asserts.assert(void 0!==e.scopeId,"ast wasn't added to st?"),e=this.stss[e.scopeId],Sk.asserts.assert(void 0!==e,"unknown sym tab entry"),e},r.prototype.SEQStmt=function(e){var t,n;if(null!==e){Sk.asserts.assert(Sk.isArrayLike(e),"SEQ: nodes isn't array? got "+e.toString());var i=e.length;for(n=0;n<i;++n)(t=e[n])&&this.visitStmt(t)}},r.prototype.SEQExpr=function(e){var t,n;if(null!==e){Sk.asserts.assert(Sk.isArrayLike(e),"SEQ: nodes isn't array? got "+e.toString());var i=e.length;for(n=0;n<i;++n)(t=e[n])&&this.visitExpr(t)}},r.prototype.enterBlock=function(e,t,n,r){e=Sk.fixReserved(e);var s=null;this.cur&&(s=this.cur,this.stack.push(this.cur)),this.cur=new i(this,e,t,n,r),"top"===e&&(this.global=this.cur.symFlags),s&&s.children.push(this.cur)},r.prototype.exitBlock=function(){this.cur=null,0<this.stack.length&&(this.cur=this.stack.pop())},r.prototype.visitParams=function(e,t){var n;for(n=0;n<e.length;++n){if((t=e[n]).constructor!==Sk.astnodes.arg)throw new Sk.builtin.SyntaxError("invalid expression in parameter list",this.filename);this.addDef(t.arg,4,t.lineno)}},r.prototype.visitAnnotations=function(e,t){e.posonlyargs&&this.visitArgAnnotations(e.posonlyargs),e.args&&this.visitArgAnnotations(e.args),e.vararg&&e.vararg.annotation&&this.visitExpr(e.vararg.annotation),e.kwarg&&e.kwarg.annotation&&this.visitExpr(e.kwarg.annotation),e.kwonlyargs&&this.visitArgAnnotations(e.kwonlyargs),t&&this.visitExpr(t)},r.prototype.visitArgAnnotations=function(e){for(let t=0;t<e.length;t++){const n=e[t];n.annotation&&this.visitExpr(n.annotation)}},r.prototype.visitArguments=function(e,t){e.args&&this.visitParams(e.args,!0),e.kwonlyargs&&this.visitParams(e.kwonlyargs,!0),e.vararg&&(this.addDef(e.vararg.arg,4,t),this.cur.varargs=!0),e.kwarg&&(this.addDef(e.kwarg.arg,4,t),this.cur.varkeywords=!0)},r.prototype.newTmpname=function(e){this.addDef(new Sk.builtin.str("_["+ ++this.tmpname+"]"),2,e)},r.prototype.addDef=function(e,t,n){var i=Sk.mangleName(this.curClass,e).v;i=Sk.fixReserved(i);var r=this.cur.symFlags[i];if(void 0!==r){if(4&t&&4&r)throw new Sk.builtin.SyntaxError("duplicate argument '"+e.v+"' in function definition",this.filename,n);r|=t}else r=t;this.cur.symFlags[i]=r,4&t?this.cur.varnames.push(i):1&t&&(r=t,void 0!==(e=this.global[i])&&(r|=e),this.global[i]=r)},r.prototype.visitSlice=function(e){var t;switch(e.constructor){case Sk.astnodes.Slice:e.lower&&this.visitExpr(e.lower),e.upper&&this.visitExpr(e.upper),e.step&&this.visitExpr(e.step);break;case Sk.astnodes.ExtSlice:for(t=0;t<e.dims.length;++t)this.visitSlice(e.dims[t]);break;case Sk.astnodes.Index:this.visitExpr(e.value)}},r.prototype.visitStmt=function(e){var t;switch(Sk.asserts.assert(void 0!==e,"visitStmt called with undefined"),e.constructor){case Sk.astnodes.FunctionDef:this.addDef(e.name,2,e.lineno),e.args.defaults&&this.SEQExpr(e.args.defaults),e.decorator_list&&this.SEQExpr(e.decorator_list),this.visitAnnotations(e.args,e.returns),this.enterBlock(e.name.v,"function",e,e.lineno),this.visitArguments(e.args,e.lineno),this.SEQStmt(e.body),this.exitBlock();break;case Sk.astnodes.ClassDef:this.addDef(e.name,2,e.lineno),this.SEQExpr(e.bases),e.decorator_list&&this.SEQExpr(e.decorator_list),this.enterBlock(e.name.v,"class",e,e.lineno),this.curClass=e.name,this.SEQStmt(e.body),this.exitBlock();break;case Sk.astnodes.Return:e.value&&(this.visitExpr(e.value),this.cur.returnsValue=!0);break;case Sk.astnodes.Delete:this.SEQExpr(e.targets);break;case Sk.astnodes.Assign:this.SEQExpr(e.targets),this.visitExpr(e.value);break;case Sk.astnodes.AnnAssign:if(e.target.constructor==Sk.astnodes.Name){var n=e.target,i=Sk.mangleName(this.curClass,n.id).v;if(i=Sk.fixReserved(i),2049&(n=this.cur.symFlags[i])&&this.global!=this.cur.symFlags&&e.simple)throw new Sk.builtin.SyntaxError("annotated name '"+i+"' can't be global",this.filename,e.lineno);e.simple?this.addDef(new Sk.builtin.str(i),4098,e.lineno):e.value&&this.addDef(new Sk.builtin.str(i),2,e.lineno)}else this.visitExpr(e.target);this.visitExpr(e.annotation),e.value&&this.visitExpr(e.value);break;case Sk.astnodes.AugAssign:this.visitExpr(e.target),this.visitExpr(e.value);break;case Sk.astnodes.Print:e.dest&&this.visitExpr(e.dest),this.SEQExpr(e.values);break;case Sk.astnodes.For:this.visitExpr(e.target),this.visitExpr(e.iter),this.SEQStmt(e.body),e.orelse&&this.SEQStmt(e.orelse);break;case Sk.astnodes.While:case Sk.astnodes.If:this.visitExpr(e.test),this.SEQStmt(e.body),e.orelse&&this.SEQStmt(e.orelse);break;case Sk.astnodes.Raise:e.exc&&(this.visitExpr(e.exc),e.inst&&(this.visitExpr(e.inst),e.tback&&this.visitExpr(e.tback)),e.cause&&this.visitExpr(e.cause));break;case Sk.astnodes.Assert:this.visitExpr(e.test),e.msg&&this.visitExpr(e.msg);break;case Sk.astnodes.Import:case Sk.astnodes.ImportFrom:this.visitAlias(e.names,e.lineno);break;case Sk.astnodes.Global:var r=e.names.length;for(t=0;t<r;++t){if(i=Sk.mangleName(this.curClass,e.names[t]).v,i=Sk.fixReserved(i),10&(n=this.cur.symFlags[i])){if(2&n)throw new Sk.builtin.SyntaxError("name '"+i+"' is assigned to before global declaration",this.filename,e.lineno);throw new Sk.builtin.SyntaxError("name '"+i+"' is used prior to global declaration",this.filename,e.lineno)}this.addDef(new Sk.builtin.str(i),1,e.lineno)}break;case Sk.astnodes.Expr:this.visitExpr(e.value);break;case Sk.astnodes.Pass:case Sk.astnodes.Break:case Sk.astnodes.Continue:case Sk.astnodes.Debugger:break;case Sk.astnodes.With:s(this.visit_withitem.bind(this),e.items),s(this.visitStmt.bind(this),e.body);break;case Sk.astnodes.Try:this.SEQStmt(e.body),this.visitExcepthandlers(e.handlers),this.SEQStmt(e.orelse),this.SEQStmt(e.finalbody);break;default:Sk.asserts.fail("Unhandled type "+e.constructor.name+" in visitStmt")}},r.prototype.visit_withitem=function(e){this.visitExpr(e.context_expr),e.optional_vars&&this.visitExpr(e.optional_vars)},r.prototype.visitExpr=function(e){switch(Sk.asserts.assert(void 0!==e,"visitExpr called with undefined"),e.constructor){case Sk.astnodes.BoolOp:this.SEQExpr(e.values);break;case Sk.astnodes.BinOp:this.visitExpr(e.left),this.visitExpr(e.right);break;case Sk.astnodes.UnaryOp:this.visitExpr(e.operand);break;case Sk.astnodes.Lambda:this.addDef(new Sk.builtin.str("lambda"),2,e.lineno),e.args.defaults&&this.SEQExpr(e.args.defaults),this.enterBlock("lambda","function",e,e.lineno),this.visitArguments(e.args,e.lineno),this.visitExpr(e.body),this.exitBlock();break;case Sk.astnodes.IfExp:this.visitExpr(e.test),this.visitExpr(e.body),this.visitExpr(e.orelse);break;case Sk.astnodes.Dict:this.SEQExpr(e.keys),this.SEQExpr(e.values);break;case Sk.astnodes.DictComp:case Sk.astnodes.SetComp:this.visitComprehension(e.generators,0);break;case Sk.astnodes.ListComp:this.newTmpname(e.lineno),this.visitExpr(e.elt),this.visitComprehension(e.generators,0);break;case Sk.astnodes.GeneratorExp:this.visitGenexp(e);break;case Sk.astnodes.YieldFrom:case Sk.astnodes.Yield:if(e.value&&this.visitExpr(e.value),this.cur.generator=!0,this.cur.returnsValue)throw new Sk.builtin.SyntaxError("'return' with argument inside generator",this.filename);break;case Sk.astnodes.Compare:this.visitExpr(e.left),this.SEQExpr(e.comparators);break;case Sk.astnodes.Call:if(this.visitExpr(e.func),e.args)for(let t of e.args)t.constructor===Sk.astnodes.Starred?this.visitExpr(t.value):this.visitExpr(t);if(e.keywords)for(let t of e.keywords)this.visitExpr(t.value);break;case Sk.astnodes.Num:case Sk.astnodes.Str:case Sk.astnodes.Bytes:break;case Sk.astnodes.JoinedStr:for(let t of e.values)this.visitExpr(t);break;case Sk.astnodes.FormattedValue:this.visitExpr(e.value),e.format_spec&&this.visitExpr(e.format_spec);break;case Sk.astnodes.Attribute:this.visitExpr(e.value);break;case Sk.astnodes.Subscript:this.visitExpr(e.value),this.visitSlice(e.slice);break;case Sk.astnodes.Name:this.addDef(e.id,e.ctx===Sk.astnodes.Load?8:2,e.lineno);break;case Sk.astnodes.NameConstant:break;case Sk.astnodes.List:case Sk.astnodes.Tuple:case Sk.astnodes.Set:this.SEQExpr(e.elts);break;case Sk.astnodes.Starred:this.visitExpr(e.value);break;case Sk.astnodes.Ellipsis:break;default:Sk.asserts.fail("Unhandled type "+e.constructor.name+" in visitExpr")}},r.prototype.visitComprehension=function(e,t){var n,i=e.length;for(n=t;n<i;++n)t=e[n],this.visitExpr(t.target),this.visitExpr(t.iter),this.SEQExpr(t.ifs)},r.prototype.visitAlias=function(e,t){var n,i;for(i=0;i<e.length;++i){var r=e[i],s=n=null===r.asname?r.name.v:r.asname.v;if(-1!==(r=n.indexOf("."))&&(s=n.substr(0,r)),"*"!==n)this.addDef(new Sk.builtin.str(s),1024,t);else if("module"!==this.cur.blockType)throw new Sk.builtin.SyntaxError("import * only allowed at module level",this.filename)}},r.prototype.visitGenexp=function(e){var t=e.generators[0];this.visitExpr(t.iter),this.enterBlock("genexpr","function",e,e.lineno),this.cur.generator=!0,this.addDef(new Sk.builtin.str(".0"),4,e.lineno),this.visitExpr(t.target),this.SEQExpr(t.ifs),this.visitComprehension(e.generators,1),this.visitExpr(e.elt),this.exitBlock()},r.prototype.visitExcepthandlers=function(e){var t,n;for(t=0;n=e[t];++t)n.type&&this.visitExpr(n.type),n.name&&this.visitExpr(n.name),this.SEQStmt(n.body)},r.prototype.analyzeBlock=function(e,t,n,i){var r={},s={},a={},l={},u={};for(d in"class"==e.blockType&&(o(a,i),t&&o(l,t)),e.symFlags){var c=e.symFlags[d];this.analyzeName(e,s,d,c,t,r,n,i)}"class"!==e.blockType&&("function"===e.blockType&&o(l,r),t&&o(l,t),o(a,i)),r={};var d=e.children.length;for(c=0;c<d;++c)i=e.children[c],this.analyzeChildBlock(i,l,u,a,r),(i.hasFree||i.childHasFree)&&(e.childHasFree=!0);o(u,r),"function"===e.blockType&&this.analyzeCells(s,u),t=this.updateSymbols(e.symFlags,s,t,u,"class"===e.blockType),e.hasFree=e.hasFree||t,o(n,u)},r.prototype.analyzeChildBlock=function(e,t,n,i,r){var s={};o(s,t),o(t={},n),o(n={},i),this.analyzeBlock(e,s,t,n),o(r,t)},r.prototype.analyzeCells=function(e,t){var n;for(n in e)1===e[n]&&void 0!==t[n]&&(e[n]=5,delete t[n])},r.prototype.updateSymbols=function(e,t,n,i,r){var s,o=!1;for(s in e){var a=e[s];a|=t[s]<<11,e[s]=a}for(s in i)void 0!==(t=e[s])?r&&1031&t&&(t|=512,e[s]=t):void 0!==n[s]&&(e[s]=8192,o=!0);return o},r.prototype.analyzeName=function(e,t,n,i,r,s,o,a){if(1&i){if(4&i)throw new Sk.builtin.SyntaxError("name '"+n+"' is local and global",this.filename,e.lineno);t[n]=2,a[n]=null,r&&void 0!==r[n]&&delete r[n]}else 1030&i?(t[n]=1,s[n]=null,delete a[n]):r&&void 0!==r[n]?(t[n]=4,e.hasFree=!0,o[n]=null):(a&&void 0!==a[n]||!e.isNested||(e.hasFree=!0),t[n]=3)},r.prototype.analyze=function(){this.analyzeBlock(this.top,null,{},{})},Sk.symboltable=function(e,t){var n=new r(t);for(n.enterBlock("top","module",e,0),n.top=n.cur,t=0;t<e.body.length;++t)n.visitStmt(e.body[t]);return n.exitBlock(),n.analyze(),n},Sk.dumpSymtab=function(e){var t=function(e){return e?"True":"False"},n=function(e){var t,n=[];for(t=0;t<e.length;++t)n.push(new Sk.builtin.str(e[t]).$r().v);return"["+n.join(", ")+"]"},i=function(e,r){var s,o;void 0===r&&(r="");var a=r+"Sym_type: "+e.get_type()+"\n";a+=r+"Sym_name: "+e.get_name()+"\n",a+=r+"Sym_lineno: "+e.get_lineno()+"\n",a+=r+"Sym_nested: "+t(e.is_nested())+"\n",a+=r+"Sym_haschildren: "+t(e.has_children())+"\n","class"===e.get_type()?a+=r+"Class_methods: "+n(e.get_methods())+"\n":"function"===e.get_type()&&(a+=r+"Func_params: "+n(e.get_parameters())+"\n",a+=r+"Func_locals: "+n(e.get_locals())+"\n",a+=r+"Func_globals: "+n(e.get_globals())+"\n",a+=r+"Func_frees: "+n(e.get_frees())+"\n"),a+=r+"-- Identifiers --\n";var l=e.get_identifiers(),u=l.length;for(o=0;o<u;++o){var c=e.lookup(l[o]);a+=r+"name: "+c.get_name()+"\n",a+=r+" is_referenced: "+t(c.is_referenced())+"\n",a+=r+" is_imported: "+t(c.is_imported())+"\n",a+=r+" is_parameter: "+t(c.is_parameter())+"\n",a+=r+" is_global: "+t(c.is_global())+"\n",a+=r+" is_declared_global: "+t(c.is_declared_global())+"\n",a+=r+" is_local: "+t(c.is_local())+"\n",a+=r+" is_free: "+t(c.is_free())+"\n",a+=r+" is_assigned: "+t(c.is_assigned())+"\n",a+=r+" is_namespace: "+t(c.is_namespace())+"\n";var d=c.get_namespaces(),f=d.length;a+=r+" namespaces: [\n";var h=[];for(s=0;s<f;++s)c=d[s],h.push(i(c,r+" "));a+=h.join("\n"),a+=r+" ]\n"}return a};return i(e.top,"")},Sk.exportSymbol("Sk.symboltable",Sk.symboltable),Sk.exportSymbol("Sk.dumpSymtab",Sk.dumpSymtab)},function(e,t){function n(e,t,n,i,r){this.filename=e,this.st=t,this.flags=n,this.canSuspend=i,this.interactive=!1,this.nestlevel=0,this.u=null,this.stack=[],this.result=[],this.allUnits=[],this.source=!!r&&r.split("\n")}function i(){this.name=this.ste=null,this.doesSuspend=this.canSuspend=!1,this.private_=null,this.lineno=this.firstlineno=0,this.linenoSet=!1,this.localnames=[],this.localtemps=[],this.tempsToSave=[],this.blocknum=0,this.blocks=[],this.curblock=0,this.consts={},this.scopename=null,this.suffixCode=this.switchCode=this.varDeclsCode=this.prefixCode="",this.breakBlocks=[],this.continueBlocks=[],this.exceptBlocks=[],this.finallyBlocks=[]}function r(e){return void 0===a[e]?e:e+"_$rw$"}function s(e,t){var n=t.v;if(null===e||null===n||"_"!==n.charAt(0)||"_"!==n.charAt(1)||"_"===n.charAt(n.length-1)&&"_"===n.charAt(n.length-2))return t;var i=e.v;return i.replace(/_/g,""),""===i?t:((i=e.v).replace(/^_*/,""),new Sk.builtin.str("_"+i+n))}var o;Sk.gensymcount=0,i.prototype.activateScope=function(){var e=this;o=function(){var t,n=e.blocks[e.curblock];if(null===n._next)for(t=0;t<arguments.length;++t)n.push(arguments[t])}},n.prototype.getSourceLine=function(e){return Sk.asserts.assert(this.source),this.source[e-1]},n.prototype.annotateSource=function(e){var t;if(this.source){var n=e.lineno,i=e.col_offset;for(o("\n//\n// line ",n,":\n// ",this.getSourceLine(n),"\n// "),t=0;t<i;++t)o(" ");o("^\n//\n"),Sk.asserts.assert(void 0!==e.lineno&&void 0!==e.col_offset),o("$currLineNo = ",n,";\n$currColNo = ",i,";\n\n")}},n.prototype.gensym=function(e){return"$"+(e||"")+Sk.gensymcount++},n.prototype.niceName=function(e){return this.gensym(e.replace("<","").replace(">","").replace(" ","_"))};var a=Sk.builtin.str.reservedWords_;const l=/_\$rw\$$/;n.prototype.makeConstant=function(e){var t,n="";for(t=0;t<arguments.length;++t)n+=arguments[t];for(i in this.u.consts)if(this.u.consts.hasOwnProperty(i)&&(t=this.u.consts[i])==n)return i;var i=this.u.scopename+"."+this.gensym("const");return this.u.consts[i]=n,i},n.prototype._gr=function(e,t){var n,i=this.gensym(e);for(this.u.localtemps.push(i),o("var ",i,"="),n=1;n<arguments.length;++n)o(arguments[n]);return o(";"),i},n.prototype.outputInterruptTest=function(){var e="";return(null!==Sk.execLimit||null!==Sk.yieldLimit&&this.u.canSuspend)&&(e+="var $dateNow = Date.now();",null!==Sk.execLimit&&(e+="if ($dateNow - Sk.execStart > Sk.execLimit) {throw new Sk.builtin.TimeoutError(Sk.timeoutMsg())}"),null!==Sk.yieldLimit&&this.u.canSuspend&&(e=e+"if (!$waking && ($dateNow - Sk.lastYield > Sk.yieldLimit)) {var $susp = $saveSuspension({data: {type: 'Sk.yield'}, resume: function() {}}, '"+this.filename+"',$currLineNo,$currColNo);",e+="$susp.$blk = $blk;$susp.optional = true;return $susp;}$waking = false;",this.u.doesSuspend=!0)),e},n.prototype._jumpfalse=function(e,t){e=this._gr("jfalse","(",e,"===false||!Sk.misceval.isTrue(",e,"))"),o("if(",e,"){/*test failed */$blk=",t,";continue;}")},n.prototype._jumpundef=function(e,t){o("if(",e,"===undefined){$blk=",t,";continue;}")},n.prototype._jumpnotundef=function(e,t){o("if(",e,"!==undefined){$blk=",t,";continue;}")},n.prototype._jumptrue=function(e,t){e=this._gr("jtrue","(",e,"===true||Sk.misceval.isTrue(",e,"))"),o("if(",e,"){/*test passed */$blk=",t,";continue;}")},n.prototype._jump=function(e){null===this.u.blocks[this.u.curblock]._next&&(o("$blk=",e,";"),this.u.blocks[this.u.curblock]._next=e)},n.prototype._checkSuspension=function(e){if(this.u.canSuspend){var t=this.newBlock("function return or resume suspension");this._jump(t),this.setBlock(t),e=e||{lineno:"$currLineNo",col_offset:"$currColNo"},o("if ($ret && $ret.$isSuspension) { return $saveSuspension($ret,'"+this.filename+"',"+e.lineno+","+e.col_offset+"); }"),this.u.doesSuspend=!0,this.u.tempsToSave=this.u.tempsToSave.concat(this.u.localtemps)}else o("if ($ret && $ret.$isSuspension) { $ret = Sk.misceval.retryOptionalSuspensionOrThrow($ret); }")},n.prototype.cunpackstarstoarray=function(e,t){if(!e||0==e.length)return"[]";let n=!1;for(let i of e){if(t&&n)throw new Sk.builtin.SyntaxError("Extended argument unpacking is not permitted in Python 2");i.constructor===Sk.astnodes.Starred&&(n=!0)}if(n){t=this._gr("unpack","[]");for(let n of e)n.constructor!==Sk.astnodes.Starred?o(t,".push(",this.vexpr(n),");"):(o("$ret = Sk.misceval.iterFor(Sk.abstr.iter(",this.vexpr(n.value),"), function(e) { ",t,".push(e); });"),this._checkSuspension());return t}return"["+e.map((e=>this.vexpr(e))).join(",")+"]"},n.prototype.cunpackkwstoarray=function(e,t){var n="undefined";if(e&&0<e.length){let i=!1;n=[];for(let t of e){if(i&&!Sk.__future__.python3)throw new SyntaxError("Advanced unpacking of function arguments is not supported in Python 2");t.arg?(n.push("'"+t.arg.v+"'"),n.push(this.vexpr(t.value))):i=!0}if(n="["+n.join(",")+"]",i){n=this._gr("keywordArgs",n);for(let i of e)i.arg||(o("$ret = Sk.abstr.mappingUnpackIntoKeywordArray(",n,",",this.vexpr(i.value),",",t,");"),this._checkSuspension())}}return n},n.prototype.ctuplelistorset=function(e,t,n){var i;Sk.asserts.assert("tuple"===n||"list"===n||"set"===n);var r=!1;for(i=0;i<e.elts.length;i++)if(e.elts[i].constructor===Sk.astnodes.Starred){r=!0;var s=i;break}if(e.ctx===Sk.astnodes.Store){if(r){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("assignment unpacking with stars is not supported in Python 2",this.filename,e.lineno);for(i=s+1;i<e.elts.length;i++)if(e.elts[i].constructor===Sk.astnodes.Starred)throw new Sk.builtin.SyntaxError("multiple starred expressions in assignment",this.filename,e.lineno)}for(n=r?s:e.elts.length,o("$ret = Sk.abstr.sequenceUnpack("+t+","+n+","+(r?e.elts.length-1:n)+", "+r+");"),this._checkSuspension(),t=this._gr("items","$ret"),i=0;i<e.elts.length;++i)i===s?this.vexpr(e.elts[i].value,t+"["+i+"]"):this.vexpr(e.elts[i],t+"["+i+"]")}else if(e.ctx===Sk.astnodes.Load||"set"===n){if(r){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("List packing with stars is not supported in Python 2");return this._gr("load"+n,"new Sk.builtins['",n,"'](",this.cunpackstarstoarray(e.elts),")")}if("tuple"===n){for(r=!0,t=[],i=0;i<e.elts.length;++i)s=this.vexpr(e.elts[i]),r&&-1==s.indexOf("$const")&&(r=!1),t.push(s);if(r)return this.makeConstant("new Sk.builtin.tuple(["+t+"])");for(i=0;i<t.length;++i)t[i]=this._gr("elem",t[i]);return this._gr("load"+n,"new Sk.builtins['",n,"']([",t,"])")}for(t=[],i=0;i<e.elts.length;++i)t.push(this._gr("elem",this.vexpr(e.elts[i])));return this._gr("load"+n,"new Sk.builtins['",n,"']([",t,"])")}},n.prototype.csubdict=function(e,t,n){const i=[];for(;t<n;t++)i.push(this.vexpr(e.keys[t])),i.push(this.vexpr(e.values[t]));return this._gr("loaddict","new Sk.builtins['dict']([",i,"])")},n.prototype.cdict=function(e){let t=0;var n;const i=e.values?e.values.length:0;let r,s=0;for(let a=0;a<i;a++)(n=null===e.keys[a])?(s&&(n=this.csubdict(e,a-s,a),t?o(r,".dict$merge(",n,");"):(r=n,t=1),s=0),0===t&&(r=this._gr("loaddict","new Sk.builtins.dict([])"),t=1),n=this.vexpr(e.values[a]),o("$ret = ",r,".dict$merge(",n,");"),this._checkSuspension(e)):s++;return s&&(n=this.csubdict(e,i-s,i),t?o(r,".dict$merge(",n,");"):(r=n,t=1)),0===t&&(r=this._gr("loaddict","new Sk.builtins.dict([])")),r},n.prototype.clistcomp=function(e){Sk.asserts.assert(e instanceof Sk.astnodes.ListComp);var t=this._gr("_compr","new Sk.builtins['list']([])");return this.ccompgen("list",t,e.generators,0,e.elt,null,e)},n.prototype.cdictcomp=function(e){Sk.asserts.assert(e instanceof Sk.astnodes.DictComp);var t=this._gr("_dcompr","new Sk.builtins.dict([])");return this.ccompgen("dict",t,e.generators,0,e.value,e.key,e)},n.prototype.csetcomp=function(e){Sk.asserts.assert(e instanceof Sk.astnodes.SetComp);var t=this._gr("_setcompr","new Sk.builtins.set([])");return this.ccompgen("set",t,e.generators,0,e.elt,null,e)},n.prototype.ccompgen=function(e,t,n,i,r,s,a){var l,u=this.newBlock(e+" comp start"),c=this.newBlock(e+" comp skip"),d=this.newBlock(e+" comp anchor"),f=n[i],h=this.vexpr(f.iter);h=this._gr("iter","Sk.abstr.iter(",h,")"),this._jump(u),this.setBlock(u),o("$ret = Sk.abstr.iternext(",h,", true);"),this._checkSuspension(a),h=this._gr("next","$ret"),this._jumpundef(h,d),this.vexpr(f.target,h);var p=f.ifs?f.ifs.length:0;for(l=0;l<p;++l)h=this.vexpr(f.ifs[l]),this._jumpfalse(h,u);return++i<n.length&&this.ccompgen(e,t,n,i,r,s,a),i>=n.length&&(n=this.vexpr(r),"dict"===e?(e=this.vexpr(s),o(t,".mp$ass_subscript(",e,",",n,");")):"list"===e?o(t,".v.push(",n,");"):"set"===e&&o(t,".v.mp$ass_subscript(",n,", true);"),this._jump(c),this.setBlock(c)),this._jump(u),this.setBlock(d),t},n.prototype.cyield=function(e){if(this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock)throw new Sk.builtin.SyntaxError("'yield' outside function",this.filename,e.lineno);var t="Sk.builtin.none.none$";return e.value&&(t=this.vexpr(e.value)),e=this.newBlock("after yield"),o("return [/*resume*/",e,",/*ret*/",t,"];"),this.setBlock(e),"$gen.gi$sentvalue"},n.prototype.cyieldfrom=function(e){if(this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock)throw new Sk.builtin.SyntaxError("'yield' outside function",this.filename,e.lineno);var t=this.vexpr(e.value);t=this._gr("iter","Sk.abstr.iter(",t,")"),o("$gen."+t+"=",t,";");var n=this.newBlock("after iter"),i=this.newBlock("after yield from");this._jump(n),this.setBlock(n);var r=this.gensym("retval");o(t,"=$gen.",t,";"),o("var ",r,";"),o("if ($gen.gi$sentvalue === Sk.builtin.none.none$ || "+t+".constructor === Sk.builtin.generator) {"),o("$ret=",t,".tp$iternext(true, $gen.gi$sentvalue);"),o("} else {");var s=this.makeConstant("new Sk.builtin.str('send');");return o("$ret=Sk.misceval.tryCatch("),o("function(){"),o("return Sk.misceval.callsimOrSuspendArray(Sk.abstr.gattr(",t,",",s,"), [$gen.gi$sentvalue]);},"),o("function (e) { "),o("if (e instanceof Sk.builtin.StopIteration) { "),o(t,".gi$ret = e.$value;"),o("return undefined;"),o("} else { throw e; }"),o("}"),o(");"),o("}"),this._checkSuspension(e),o(r,"=$ret;"),o("if(",r,"===undefined) {"),o("$gen.gi$sentvalue=$gen."+t+".gi$ret;"),o("$blk=",i,";continue;"),o("}"),o("return [/*resume*/",n,",/*ret*/",r,"];"),this.setBlock(i),"$gen.gi$sentvalue"},n.prototype.ccompare=function(e){var t;Sk.asserts.assert(e.ops.length===e.comparators.length);var n=this.vexpr(e.left),i=e.ops.length,r=this.newBlock("done"),s=this._gr("compareres","null");for(t=0;t<i;++t){var a=this.vexpr(e.comparators[t]);const i=e.ops[t];i===Sk.astnodes.Is?o("$ret = ",n,"===",a,";"):i===Sk.astnodes.IsNot?o("$ret = ",n,"!==",a,";"):(o("$ret = Sk.misceval.richCompareBool(",n,",",a,",'",i.prototype._astname,"', true);"),this._checkSuspension(e)),o(s,"=Sk.builtin.bool($ret);"),this._jumpfalse("$ret",r),n=a}return this._jump(r),this.setBlock(r),s},n.prototype.ccall=function(e){var t=this.vexpr(e.func);let n=this.cunpackstarstoarray(e.args,!Sk.__future__.python3),i=this.cunpackkwstoarray(e.keywords,t);return Sk.__future__.super_args&&e.func.id&&"super"===e.func.id.v&&"[]"===n&&(this.u.tempsToSave.push("$sup"),o('if (typeof $sup === "undefined") { throw new Sk.builtin.RuntimeError("super(): no arguments") };'),n="[$gbl.__class__,$sup]"),o("$ret = (",t,".tp$call)?",t,".tp$call(",n,",",i,") : Sk.misceval.applyOrSuspend(",t,",undefined,undefined,",i,",",n,");"),this._checkSuspension(e),this._gr("call","$ret")},n.prototype.cslice=function(e){if(Sk.asserts.assert(e instanceof Sk.astnodes.Slice),Sk.__future__.python3)var t=e.lower?this.vexpr(e.lower):"Sk.builtin.none.none$",n=e.upper?this.vexpr(e.upper):"Sk.builtin.none.none$";else t=e.lower?this.vexpr(e.lower):e.step?"Sk.builtin.none.none$":"new Sk.builtin.int_(0)",n=e.upper?this.vexpr(e.upper):e.step?"Sk.builtin.none.none$":"new Sk.builtin.int_(2147483647)";return e=e.step?this.vexpr(e.step):"Sk.builtin.none.none$",this._gr("slice","new Sk.builtins['slice'](",t,",",n,",",e,")")},n.prototype.eslice=function(e){var t;Sk.asserts.assert(e instanceof Array);var n=[];for(t=0;t<e.length;t++)n.push(this.vslicesub(e[t]));return this._gr("extslice","new Sk.builtins['tuple']([",n,"])")},n.prototype.vslicesub=function(e){switch(e.constructor){case Sk.astnodes.Index:var t=this.vexpr(e.value);break;case Sk.astnodes.Slice:t=this.cslice(e);break;case Sk.astnodes.Ellipsis:Sk.asserts.fail("todo compile.js Ellipsis;");break;case Sk.astnodes.ExtSlice:t=this.eslice(e.dims);break;default:Sk.asserts.fail("invalid subscript kind")}return t},n.prototype.vslice=function(e,t,n,i){return e=this.vslicesub(e),this.chandlesubscr(t,n,e,i)},n.prototype.chandlesubscr=function(e,t,n,i){if(e===Sk.astnodes.Load||e===Sk.astnodes.AugLoad)return o("$ret = Sk.abstr.objectGetItem(",t,",",n,", true);"),this._checkSuspension(),this._gr("lsubscr","$ret");e===Sk.astnodes.Store||e===Sk.astnodes.AugStore?(o("$ret = Sk.abstr.objectSetItem(",t,",",n,",",i,", true);"),this._checkSuspension()):e===Sk.astnodes.Del?o("Sk.abstr.objectDelItem(",t,",",n,");"):Sk.asserts.fail("handlesubscr fail")},n.prototype.cboolop=function(e){var t,n;Sk.asserts.assert(e instanceof Sk.astnodes.BoolOp);var i=e.op===Sk.astnodes.And?this._jumpfalse:this._jumptrue,r=this.newBlock("end of boolop"),s=e.values,a=s.length;for(t=0;t<a;++t)e=this.vexpr(s[t]),0===t&&(n=this._gr("boolopsucc",e)),o(n,"=",e,";"),i.call(this,e,r);return this._jump(r),this.setBlock(r),n},n.prototype.cjoinedstr=function(e){let t;Sk.asserts.assert(e instanceof Sk.astnodes.JoinedStr);for(let n of e.values)e=this.vexpr(n),t?o(t,"=",t,".sq$concat(",e,");"):t=this._gr("joinedstr",e);return t||(t="Sk.builtin.str.$emptystr"),t},n.prototype.cformattedvalue=function(e){let t=this.vexpr(e.value);switch(e.conversion){case"s":t=this._gr("value","new Sk.builtin.str(",t,")");break;case"a":t=this._gr("value","Sk.builtin.ascii(",t,")");break;case"r":t=this._gr("value","Sk.builtin.repr(",t,")")}return e=e.format_spec?this.vexpr(e.format_spec):"Sk.builtin.str.$emptystr",this._gr("formatted","Sk.abstr.objectFormat("+t+","+e+")")},n.prototype.vexpr=function(e,t,n,i){var r;switch(e.lineno>this.u.lineno&&(this.u.lineno=e.lineno,this.u.linenoSet=!1),e.constructor){case Sk.astnodes.BoolOp:return this.cboolop(e);case Sk.astnodes.BinOp:return this._gr("binop","Sk.abstr.numberBinOp(",this.vexpr(e.left),",",this.vexpr(e.right),",'",e.op.prototype._astname,"')");case Sk.astnodes.UnaryOp:return this._gr("unaryop","Sk.abstr.numberUnaryOp(",this.vexpr(e.operand),",'",e.op.prototype._astname,"')");case Sk.astnodes.Lambda:return this.clambda(e);case Sk.astnodes.IfExp:return this.cifexp(e);case Sk.astnodes.Dict:return this.cdict(e);case Sk.astnodes.ListComp:return this.clistcomp(e);case Sk.astnodes.DictComp:return this.cdictcomp(e);case Sk.astnodes.SetComp:return this.csetcomp(e);case Sk.astnodes.GeneratorExp:return this.cgenexp(e);case Sk.astnodes.Yield:return this.cyield(e);case Sk.astnodes.YieldFrom:return this.cyieldfrom(e);case Sk.astnodes.Compare:return this.ccompare(e);case Sk.astnodes.Call:return t=this.ccall(e),this.annotateSource(e),t;case Sk.astnodes.Num:if("number"==typeof e.n)return e.n;if(e.n instanceof Sk.builtin.lng)return this.makeConstant("new Sk.builtin.lng('"+e.n.v.toString()+"')");if(e.n instanceof Sk.builtin.int_)return"number"==typeof e.n.v?this.makeConstant("new Sk.builtin.int_("+e.n.v+")"):this.makeConstant("new Sk.builtin.int_('"+e.n.v.toString()+"')");if(e.n instanceof Sk.builtin.float_)return e=0===e.n.v&&-1/0==1/e.n.v?"-0":e.n.v,this.makeConstant("new Sk.builtin.float_("+e+")");if(e.n instanceof Sk.builtin.complex)return this.makeConstant("new Sk.builtin.complex("+(0===e.n.real&&-1/0==1/e.n.real?"-0":e.n.real)+", "+(0===e.n.imag&&-1/0==1/e.n.imag?"-0":e.n.imag)+")");Sk.asserts.fail("unhandled Num type");case Sk.astnodes.Bytes:if(Sk.__future__.python3){for(t=[],e=e.s.$jsstr(),n=0;n<e.length;n++)t.push(e.charCodeAt(n));return this.makeConstant("new Sk.builtin.bytes([",t.join(", "),"])")}case Sk.astnodes.Str:for(t=this.makeConstant,e=e.s.$jsstr(),n='"',r=0;r<e.length;r++)n=10==(i=e.charCodeAt(r))?n+"\\n":92==i?n+"\\\\":34==i||32>i||127<=i&&256>i?n+"\\x"+("0"+i.toString(16)).substr(-2):256<=i?n+"\\u"+("000"+i.toString(16)).substr(-4):n+e.charAt(r);return e=n+'"',t.call(this,"new Sk.builtin.str(",e,",true)");case Sk.astnodes.Attribute:switch(e.ctx!==Sk.astnodes.AugLoad&&e.ctx!==Sk.astnodes.AugStore&&(r=this.vexpr(e.value)),i=(i=e.attr.$r().v).substring(1,i.length-1),i=s(this.u.private_,new Sk.builtin.str(i)).v,i=this.makeConstant("new Sk.builtin.str('"+i+"')"),e.ctx){case Sk.astnodes.AugLoad:return o("$ret = ",n,".tp$getattr(",i,", true);"),this._checkSuspension(e),o("\nif ($ret === undefined) {"),o("\nthrow new Sk.builtin.AttributeError(",n,'.sk$attrError() + " has no attribute \'" + ',i,'.$jsstr() + "\'");'),o("\n};"),this._gr("lattr","$ret");case Sk.astnodes.Load:return o("$ret = ",r,".tp$getattr(",i,", true);"),this._checkSuspension(e),o("\nif ($ret === undefined) {"),o("\nthrow new Sk.builtin.AttributeError(",r,'.sk$attrError() + " has no attribute \'" + ',i,'.$jsstr() + "\'");'),o("\n};"),this._gr("lattr","$ret");case Sk.astnodes.AugStore:o("$ret = undefined;"),o("if(",t,"!==undefined){"),o("$ret = ",n,".tp$setattr(",i,",",t,", true);"),o("}"),this._checkSuspension(e);break;case Sk.astnodes.Store:o("$ret = ",r,".tp$setattr(",i,",",t,", true);"),this._checkSuspension(e);break;case Sk.astnodes.Del:o("$ret = ",r,".tp$setattr(",i,", undefined, true);"),this._checkSuspension(e);break;default:Sk.asserts.fail("invalid attribute expression")}break;case Sk.astnodes.Subscript:switch(e.ctx){case Sk.astnodes.AugLoad:return o("$ret = Sk.abstr.objectGetItem(",n,",",i,", true);"),this._checkSuspension(e),this._gr("gitem","$ret");case Sk.astnodes.Load:case Sk.astnodes.Store:case Sk.astnodes.Del:return this.vslice(e.slice,e.ctx,this.vexpr(e.value),t);case Sk.astnodes.AugStore:o("$ret=undefined;"),o("if(",t,"!==undefined){"),o("$ret=Sk.abstr.objectSetItem(",n,",",i,",",t,", true)"),o("}"),this._checkSuspension(e);break;default:Sk.asserts.fail("invalid subscript expression")}break;case Sk.astnodes.Name:return this.nameop(e.id,e.ctx,t);case Sk.astnodes.NameConstant:if(e.ctx===Sk.astnodes.Store||e.ctx===Sk.astnodes.AugStore||e.ctx===Sk.astnodes.Del)throw new Sk.builtin.SyntaxError("can not assign to a constant name");switch(e.value){case Sk.builtin.none.none$:return"Sk.builtin.none.none$";case Sk.builtin.bool.true$:return"Sk.builtin.bool.true$";case Sk.builtin.bool.false$:return"Sk.builtin.bool.false$";default:Sk.asserts.fail("invalid named constant")}break;case Sk.astnodes.List:return this.ctuplelistorset(e,t,"list");case Sk.astnodes.Tuple:return this.ctuplelistorset(e,t,"tuple");case Sk.astnodes.Set:return this.ctuplelistorset(e,t,"set");case Sk.astnodes.Starred:if(e.ctx===Sk.astnodes.Store)throw new Sk.builtin.SyntaxError("starred assignment target must be in a list or tuple",this.filename,e.lineno);throw new Sk.builtin.SyntaxError("can't use starred expression here",this.filename,e.lineno);case Sk.astnodes.JoinedStr:return this.cjoinedstr(e);case Sk.astnodes.FormattedValue:return this.cformattedvalue(e);case Sk.astnodes.Ellipsis:return this.makeConstant("Sk.builtin.Ellipsis");default:Sk.asserts.fail("unhandled case "+e.constructor.name+" vexpr")}},n.prototype.vseqexpr=function(e,t){var n;Sk.asserts.assert(void 0===t||e.length===t.length);var i=[];for(n=0;n<e.length;++n)i.push(this.vexpr(e[n],void 0===t?void 0:t[n]));return i},n.prototype.cannassign=function(e){var t=e.target;let n=e.value;n&&(n=this.vexpr(e.value),this.vexpr(t,n)),t.constructor===Sk.astnodes.Name&&(!e.simple||this.u.ste.blockType!==Sk.SYMTAB_CONSTS.ClassBlock&&this.u.ste.blockType!=Sk.SYMTAB_CONSTS.ModuleBlock||(this.u.hasAnnotations=!0,e=this.vexpr(e.annotation),t=s(this.u.private_,t.id).v,t=this.makeConstant("new Sk.builtin.str('"+t+"')"),this.chandlesubscr(Sk.astnodes.Store,"$loc.__annotations__",t,e)))},n.prototype.caugassign=function(e){Sk.asserts.assert(e instanceof Sk.astnodes.AugAssign);var t=e.target;switch(t.constructor){case Sk.astnodes.Attribute:var n=this.vexpr(t.value);t=new Sk.astnodes.Attribute(t.value,t.attr,Sk.astnodes.AugLoad,t.lineno,t.col_offset);var i=this.vexpr(t,void 0,n),r=this.vexpr(e.value);return e=this._gr("inplbinopattr","Sk.abstr.numberInplaceBinOp(",i,",",r,",'",e.op.prototype._astname,"')"),t.ctx=Sk.astnodes.AugStore,this.vexpr(t,e,n);case Sk.astnodes.Subscript:n=this.vexpr(t.value);var s=this.vslicesub(t.slice);return t=new Sk.astnodes.Subscript(t.value,s,Sk.astnodes.AugLoad,t.lineno,t.col_offset),i=this.vexpr(t,void 0,n,s),r=this.vexpr(e.value),e=this._gr("inplbinopsubscr","Sk.abstr.numberInplaceBinOp(",i,",",r,",'",e.op.prototype._astname,"')"),t.ctx=Sk.astnodes.AugStore,this.vexpr(t,e,n,s);case Sk.astnodes.Name:return n=this.nameop(t.id,Sk.astnodes.Load),r=this.vexpr(e.value),e=this._gr("inplbinop","Sk.abstr.numberInplaceBinOp(",n,",",r,",'",e.op.prototype._astname,"')"),this.nameop(t.id,Sk.astnodes.Store,e);default:Sk.asserts.fail("unhandled case in augassign")}},n.prototype.exprConstant=function(e){switch(e.constructor){case Sk.astnodes.Num:return Sk.misceval.isTrue(e.n)?1:0;case Sk.astnodes.Str:return Sk.misceval.isTrue(e.s)?1:0;default:return-1}},n.prototype.newBlock=function(e){var t=this.u.blocknum++;return this.u.blocks[t]=[],this.u.blocks[t]._name=e||"<unnamed>",this.u.blocks[t]._next=null,t},n.prototype.setBlock=function(e){Sk.asserts.assert(0<=e&&e<this.u.blocknum),this.u.curblock=e},n.prototype.pushBreakBlock=function(e){Sk.asserts.assert(0<=e&&e<this.u.blocknum),this.u.breakBlocks.push(e)},n.prototype.popBreakBlock=function(){this.u.breakBlocks.pop()},n.prototype.pushContinueBlock=function(e){Sk.asserts.assert(0<=e&&e<this.u.blocknum),this.u.continueBlocks.push(e)},n.prototype.popContinueBlock=function(){this.u.continueBlocks.pop()},n.prototype.pushExceptBlock=function(e){Sk.asserts.assert(0<=e&&e<this.u.blocknum),this.u.exceptBlocks.push(e)},n.prototype.popExceptBlock=function(){this.u.exceptBlocks.pop()},n.prototype.pushFinallyBlock=function(e){Sk.asserts.assert(0<=e&&e<this.u.blocknum),Sk.asserts.assert(this.u.breakBlocks.length===this.u.continueBlocks.length),this.u.finallyBlocks.push({blk:e,breakDepth:this.u.breakBlocks.length})},n.prototype.popFinallyBlock=function(){this.u.finallyBlocks.pop()},n.prototype.peekFinallyBlock=function(){return 0<this.u.finallyBlocks.length?this.u.finallyBlocks[this.u.finallyBlocks.length-1]:void 0},n.prototype.setupExcept=function(e){o("$exc.push(",e,");")},n.prototype.endExcept=function(){o("$exc.pop();")},n.prototype.outputLocals=function(e){var t,n={};for(t=0;e.argnames&&t<e.argnames.length;++t)n[e.argnames[t]]=!0;e.localnames.sort();var i=[];for(t=0;t<e.localnames.length;++t){var r=e.localnames[t];void 0===n[r]&&(i.push(r),n[r]=!0)}return 0<i.length?"var "+i.join(",")+"; /* locals */":""},n.prototype.outputSuspensionHelpers=function(e){var t,n=[],i=e.localnames.concat(e.tempsToSave),r={},s=e.ste.blockType===Sk.SYMTAB_CONSTS.FunctionBlock&&e.ste.childHasFree,o=(0<i.length?"var "+i.join(",")+";":"")+"var $wakeFromSuspension = function() {var susp = "+e.scopename+".$wakingSuspension; "+e.scopename+".$wakingSuspension = undefined;$blk=susp.$blk; $loc=susp.$loc; $gbl=susp.$gbl; $exc=susp.$exc; $err=susp.$err; $postfinally=susp.$postfinally;$currLineNo=susp.$lineno; $currColNo=susp.$colno; Sk.lastYield=Date.now();"+(s?"$cell=susp.$cell;":"");for(t=0;t<i.length;t++){var a=i[t];void 0===r[a]&&(o+=a+"=susp.$tmps."+a+";",r[a]=!0)}for(o+="try { $ret=susp.child.resume(); } catch(err) { if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '"+this.filename+"'}); if($exc.length>0) { $err=err; $blk=$exc.pop(); } else { throw err; } }};",o+="var $saveSuspension = function($child, $filename, $lineno, $colno) {var susp = new Sk.misceval.Suspension(); susp.child=$child;susp.resume=function(){"+e.scopename+".$wakingSuspension=susp; return "+e.scopename+"("+(e.ste.generator?"$gen":"")+"); };susp.data=susp.child.data;susp.$blk=$blk;susp.$loc=$loc;susp.$gbl=$gbl;susp.$exc=$exc;susp.$err=$err;susp.$postfinally=$postfinally;susp.$filename=$filename;susp.$lineno=$lineno;susp.$colno=$colno;susp.optional=susp.child.optional;"+(s?"susp.$cell=$cell;":""),r={},t=0;t<i.length;t++)void 0===r[a=i[t]]&&(n.push('"'+a+'":'+a),r[a]=!0);return o+"susp.$tmps={"+n.join(",")+"};return susp;};"},n.prototype.outputAllUnits=function(){var e,t,n="";for(t=0;t<this.allUnits.length;++t){var i=this.allUnits[t];n+=i.prefixCode,n+=this.outputLocals(i),i.doesSuspend&&(n+=this.outputSuspensionHelpers(i)),n+=i.varDeclsCode,n+=i.switchCode;var r=i.blocks,s=Object.create(null);for(e=0;e<r.length;++e){var o=e;if(!(o in s))for(;;){if(s[o]=!0,n+="case "+o+": /* --- "+r[o]._name+" --- */",n+=r[o].join(""),null===r[o]._next){n+="throw new Sk.builtin.SystemError('internal error: unterminated block');";break}if(r[o]._next in s){n+="/* jump */ continue;";break}n+="/* allowing case fallthrough */",o=r[o]._next}}n+=i.suffixCode}return n},n.prototype.cif=function(e){var t;Sk.asserts.assert(e instanceof Sk.astnodes.If);var n=this.exprConstant(e.test);if(0===n)e.orelse&&0<e.orelse.length&&this.vseqstmt(e.orelse);else if(1===n)this.vseqstmt(e.body);else{var i=this.newBlock("end of if");e.orelse&&0<e.orelse.length&&(t=this.newBlock("next branch of if")),n=this.vexpr(e.test),e.orelse&&0<e.orelse.length?(this._jumpfalse(n,t),this.vseqstmt(e.body),this._jump(i),this.setBlock(t),this.vseqstmt(e.orelse)):(this._jumpfalse(n,i),this.vseqstmt(e.body)),this._jump(i),this.setBlock(i)}},n.prototype.cwhile=function(e){if(0===this.exprConstant(e.test))e.orelse&&this.vseqstmt(e.orelse);else{var t=this.newBlock("while test");if(this._jump(t),this.setBlock(t),(Sk.debugging||Sk.killableWhile)&&this.u.canSuspend){var n=this.newBlock("debug breakpoint for line "+e.lineno);o("if (Sk.breakpoints('"+this.filename+"',"+e.lineno+","+e.col_offset+")) {","var $susp = $saveSuspension({data: {type: 'Sk.delay'}, resume: function() {}}, '"+this.filename+"',"+e.lineno+","+e.col_offset+");","$susp.$blk = "+n+";","$susp.optional = true;","return $susp;","}"),this._jump(n),this.setBlock(n),this.u.doesSuspend=!0}var i=this.newBlock("after while"),r=0<e.orelse.length?this.newBlock("while orelse"):null;n=this.newBlock("while body"),this.annotateSource(e),this._jumpfalse(this.vexpr(e.test),r||i),this._jump(n),this.pushBreakBlock(i),this.pushContinueBlock(t),this.setBlock(n),this.vseqstmt(e.body),this._jump(t),this.popContinueBlock(),this.popBreakBlock(),0<e.orelse.length&&(this.setBlock(r),this.vseqstmt(e.orelse),this._jump(i)),this.setBlock(i)}},n.prototype.cfor=function(e){var t=this.newBlock("for start"),n=this.newBlock("for cleanup"),i=this.newBlock("for end");this.pushBreakBlock(i),this.pushContinueBlock(t);var r=this.vexpr(e.iter);if(this.u.ste.generator){var s="$loc."+this.gensym("iter");o(s,"=Sk.abstr.iter(",r,");")}else s=this._gr("iter","Sk.abstr.iter(",r,")"),this.u.tempsToSave.push(s);this._jump(t),this.setBlock(t),o("$ret = Sk.abstr.iternext(",s,this.u.canSuspend?", true":", false",");"),this._checkSuspension(e),s=this._gr("next","$ret"),this._jumpundef(s,n),this.vexpr(e.target,s),(Sk.debugging||Sk.killableFor)&&this.u.canSuspend&&(s=this.newBlock("debug breakpoint for line "+e.lineno),o("if (Sk.breakpoints('"+this.filename+"',"+e.lineno+","+e.col_offset+")) {","var $susp = $saveSuspension({data: {type: 'Sk.delay'}, resume: function() {}}, '"+this.filename+"',"+e.lineno+","+e.col_offset+");","$susp.$blk = "+s+";","$susp.optional = true;","return $susp;","}"),this._jump(s),this.setBlock(s),this.u.doesSuspend=!0),this.vseqstmt(e.body),this._jump(t),this.setBlock(n),this.popContinueBlock(),this.popBreakBlock(),this.vseqstmt(e.orelse),this._jump(i),this.setBlock(i)},n.prototype.craise=function(e){if(e.exc){var t=this._gr("exc",this.vexpr(e.exc)),n=this.newBlock("exception now instantiated"),i=this._gr("isclass",t+".prototype instanceof Sk.builtin.BaseException");this._jumpfalse(i,n),e.inst?(i=this._gr("inst",this.vexpr(e.inst)),o("if(!(",i," instanceof Sk.builtin.tuple)) {",i,"= new Sk.builtin.tuple([",i,"]);","}"),o("$ret = Sk.misceval.callsimOrSuspendArray(",t,",",i,".v);")):o("$ret = Sk.misceval.callsimOrSuspend(",t,");"),this._checkSuspension(e),o(t,"=$ret;"),this._jump(n),this.setBlock(n),o("if (",t," instanceof Sk.builtin.BaseException) {throw ",t,";} else {throw new Sk.builtin.TypeError('exceptions must derive from BaseException');};")}else o("throw $err;")},n.prototype.outputFinallyCascade=function(e){if(0==this.u.finallyBlocks.length)o("if($postfinally!==undefined) { if ($postfinally.returning) { return $postfinally.returning; } else { $blk=$postfinally.gotoBlock; $postfinally=undefined; continue; } }");else{var t=this.peekFinallyBlock();o("if($postfinally!==undefined) {","if ($postfinally.returning",t.breakDepth==e.breakDepth?"|| $postfinally.isBreak":"",") {","$blk=",t.blk,";continue;","} else {","$blk=$postfinally.gotoBlock;$postfinally=undefined;continue;","}","}")}},n.prototype.ctry=function(e){var t,n=e.handlers.length;if(e.finalbody){var i=this.newBlock("finalbody"),r=this.newBlock("finalexh"),s=this._gr("finally_reraise","undefined");this.u.tempsToSave.push(s),this.pushFinallyBlock(i);var a=this.peekFinallyBlock();this.setupExcept(r)}var l=[];for(t=0;t<n;++t)l.push(this.newBlock("except_"+t+"_"));var u=this.newBlock("unhandled"),c=this.newBlock("orelse"),d=this.newBlock("end");for(0!=l.length&&this.setupExcept(l[0]),this.vseqstmt(e.body),0!=l.length&&this.endExcept(),this._jump(c),t=0;t<n;++t){this.setBlock(l[t]);var f=e.handlers[t];if(!f.type&&t<n-1)throw new Sk.builtin.SyntaxError("default 'except:' must be last",this.filename,f.lineno);if(f.type){var h=this.vexpr(f.type),p=t==n-1?u:l[t+1];h=this._gr("instance","Sk.misceval.isTrue(Sk.builtin.isinstance($err, ",h,"))"),this._jumpfalse(h,p)}f.name&&this.vexpr(f.name,"$err"),this.vseqstmt(f.body),this._jump(d)}this.setBlock(u),o("throw $err;"),this.setBlock(c),this.vseqstmt(e.orelse),this._jump(d),this.setBlock(d),e.finalbody&&(this.endExcept(),this._jump(i),this.setBlock(r),o(s,"=$err;"),this._jump(i),this.setBlock(i),this.popFinallyBlock(),this.vseqstmt(e.finalbody),o("if(",s,"!==undefined) { throw ",s,";}"),this.outputFinallyCascade(a))},n.prototype.cwith=function(e,t){var n=this.newBlock("withexh"),i=this.newBlock("withtidyup"),r=this.newBlock("withcarryon"),s=this._gr("mgr",this.vexpr(e.items[t].context_expr));o("$ret = Sk.abstr.lookupSpecial(",s,",Sk.builtin.str.$exit);"),this._checkSuspension(e);var a=this._gr("exit","$ret");this.u.tempsToSave.push(a),o("$ret = Sk.abstr.lookupSpecial(",s,",Sk.builtin.str.$enter);"),this._checkSuspension(e),o("$ret = Sk.misceval.callsimOrSuspendArray($ret);"),this._checkSuspension(e),s=this._gr("value","$ret"),this.pushFinallyBlock(i);var l=this.u.finallyBlocks[this.u.finallyBlocks.length-1];this.setupExcept(n),e.items[t].optional_vars&&this.nameop(e.items[t].optional_vars.id,Sk.astnodes.Store,s),t+1<e.items.length?this.cwith(e,t+1):this.vseqstmt(e.body),this.endExcept(),this._jump(i),this.setBlock(n),o("$ret = Sk.misceval.applyOrSuspend(",a,",undefined,Sk.builtin.getExcInfo($err),undefined,[]);"),this._checkSuspension(e),this._jumptrue("$ret",r),o("throw $err;"),this.setBlock(i),this.popFinallyBlock(),o("$ret = Sk.misceval.callsimOrSuspendArray(",a,",[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.none.none$]);"),this._checkSuspension(e),this.outputFinallyCascade(l),this._jump(r),this.setBlock(r)},n.prototype.cassert=function(e){var t=this.vexpr(e.test),n=this.newBlock("end");this._jumptrue(t,n),o("throw new Sk.builtin.AssertionError(",e.msg?this.vexpr(e.msg):"",");"),this.setBlock(n)},n.prototype.cimportas=function(e,t,n){var i=(e=e.v).indexOf("."),r=n;if(-1!==i)for(e=e.substr(i+1);-1!==i;)n=-1!==(i=e.indexOf("."))?e.substr(0,i):e,r=this._gr("lattr","Sk.abstr.gattr(",r,", new Sk.builtin.str('",n,"'))"),e=e.substr(i+1);return this.nameop(t,Sk.astnodes.Store,r)},n.prototype.cimport=function(e){var t,n=e.names.length;for(t=0;t<n;++t){var i=e.names[t];o("$ret = Sk.builtin.__import__(",i.name.$r().v,",$gbl,$loc,[],",Sk.__future__.absolute_import?0:-1,");"),this._checkSuspension(e);var r=this._gr("module","$ret");if(i.asname)this.cimportas(i.name,i.asname,r);else{var s=i.name;-1!==(i=s.v.indexOf("."))&&(s=new Sk.builtin.str(s.v.substr(0,i))),this.nameop(s,Sk.astnodes.Store,r)}}},n.prototype.cfromimport=function(e){var t,n=e.names.length,i=[],r=e.level;for(0!=r||Sk.__future__.absolute_import||(r=-1),t=0;t<n;++t)i[t]="'"+e.names[t].name.v+"'";for(o("$ret = Sk.builtin.__import__(",e.module.$r().v,",$gbl,$loc,[",i,"],",r,");"),this._checkSuspension(e),r=this._gr("module","$ret"),t=0;t<n;++t){var s="'"+(i=e.names[t]).name.v+"'";if(0===t&&"*"===i.name.v){Sk.asserts.assert(1===n),o("Sk.importStar(",r,",$loc, $gbl);");break}var a=this._gr("item","Sk.abstr.gattr(",r,", new Sk.builtin.str(",s,"), undefined)");s=i.name,i.asname&&(s=i.asname),this.nameop(s,Sk.astnodes.Store,a)}},n.prototype.buildcodeobj=function(e,t,n,i,a,l){var u,c=[],d=[],f=[],h=[],p=null,m=null;n&&(d=this.vseqexpr(n)),i&&i.defaults&&(f=this.vseqexpr(i.defaults)),n=this.cannotations(i,e.returns),i&&i.kw_defaults&&(h=i.kw_defaults.map((e=>e?this.vexpr(e):"undefined"))),i&&i.vararg&&(p=i.vararg),i&&i.kwarg&&(m=i.kwarg);var _=this.enterScope(t,e,e.lineno,this.canSuspend),b=this.u.ste.generator,g=this.u.ste.hasFree,k=this.u.ste.childHasFree,S=this.newBlock("codeobj entry");this.u.prefixCode="var "+_+"=(function "+this.niceName(t.v)+"$(";var y=[];if(b){if(m)throw new Sk.builtin.SyntaxError(t.v+"(): keyword arguments in generators not supported",this.filename,e.lineno);if(p)throw new Sk.builtin.SyntaxError(t.v+"(): variable number of arguments in generators not supported",this.filename,e.lineno);y.push("$gen")}else{for(m&&(y.push("$kwa"),this.u.tempsToSave.push("$kwa")),u=0;i&&u<i.args.length;++u)y.push(this.nameop(i.args[u].arg,Sk.astnodes.Param));for(u=0;i&&i.kwonlyargs&&u<i.kwonlyargs.length;++u)y.push(this.nameop(i.kwonlyargs[u].arg,Sk.astnodes.Param));p&&y.push(this.nameop(i.vararg.arg,Sk.astnodes.Param))}let v=!b;g&&(v||y.push("$free"),this.u.tempsToSave.push("$free")),this.u.prefixCode=v?this.u.prefixCode+"$posargs,$kwargs":this.u.prefixCode+y.join(","),this.u.prefixCode+="){",b&&(this.u.prefixCode+="\n// generator\n"),g&&(this.u.prefixCode+="\n// has free\n"),k&&(this.u.prefixCode+="\n// has cell\n"),v&&(this.u.prefixCode+="\n// fast call\n");var $="{}";if(b&&(S="$gen.gi$resumeat",$="$gen.gi$locals"),u=",$cell={}",k&&b&&(u=",$cell=$gen.gi$cells"),this.u.varDeclsCode+="var $blk="+S+",$exc=[],$loc="+$+u+",$gbl="+(v?"this && this.func_globals":"this")+(v&&g?",$free=this && this.func_closure":"")+",$err=undefined,$ret=undefined,$postfinally=undefined,$currLineNo=undefined,$currColNo=undefined;",null!==Sk.execLimit&&(this.u.varDeclsCode+="if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}"),null!==Sk.yieldLimit&&this.u.canSuspend&&(this.u.varDeclsCode+="if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}"),this.u.varDeclsCode+="var $waking=false; if ("+_+".$wakingSuspension!==undefined) { $wakeFromSuspension(); $waking=true; } else {",v){for(this.u.varDeclsCode=m||p||i&&i.kwonlyargs&&0!==i.kwonlyargs.length?this.u.varDeclsCode+"\nvar $args = this.$resolveArgs($posargs,$kwargs)\n":this.u.varDeclsCode+"var $args = ((!$kwargs || $kwargs.length===0) && $posargs.length==="+y.length+") ? $posargs : this.$resolveArgs($posargs,$kwargs)",u=0;u<y.length;u++)this.u.varDeclsCode+=","+y[u]+"=$args["+u+"]";(u=y[m?1:0])&&(this.u.varDeclsCode+=`,$sup=${u}`),this.u.varDeclsCode+=";\n"}if(b&&0<f.length)for(S=i.args.length-f.length,u=0;u<f.length;++u)y=this.nameop(i.args[u+S].arg,Sk.astnodes.Param),this.u.varDeclsCode+="if("+y+"===undefined)"+y+"="+_+".$defaults["+u+"];";for(u=0;i&&u<i.args.length;++u)y=i.args[u].arg,this.isCell(y)&&(y=r(s(this.u.private_,y).v),this.u.varDeclsCode+="$cell."+y+"="+y+";");for(u=0;i&&i.kwonlyargs&&u<i.kwonlyargs.length;++u)y=i.kwonlyargs[u].arg,this.isCell(y)&&(y=r(s(this.u.private_,y).v),this.u.varDeclsCode+="$cell."+y+"="+y+";");if(p&&this.isCell(p.arg)&&(u=r(s(this.u.private_,p.arg).v),this.u.varDeclsCode+="$cell."+u+"="+u+";"),m&&(this.u.localnames.push(m.arg.v),this.u.varDeclsCode+=m.arg.v+"=new Sk.builtins['dict']($kwa);",this.isCell(m.arg)&&(u=r(s(this.u.private_,m.arg).v),this.u.varDeclsCode+="$cell."+u+"="+u+";")),this.u.varDeclsCode+="}",Sk.__future__.super_args&&l&&(this.u.varDeclsCode+="$gbl.__class__=$gbl."+l.v+";"),this.u.switchCode="while(true){try{",this.u.switchCode+=this.outputInterruptTest(),this.u.switchCode+="switch($blk){",this.u.suffixCode="} }catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} }});",a.call(this,_),i){for(let e of i.args)c.push(e.arg.v);for(let e of i.kwonlyargs||[])c.push(e.arg.v);this.u.argnames=c}if(this.exitScope(),0<f.length&&o(_,".$defaults=[",f.join(","),"];"),i&&i.kwonlyargs&&0<i.kwonlyargs.length&&(o(_,".co_argcount=",i.args.length,";"),o(_,".co_kwonlyargcount=",i.kwonlyargs.length,";"),o(_,".$kwdefs=[",h.join(","),"];")),0<c.length?o(_,".co_varnames=['",c.join("','"),"'];"):o(_,".co_varnames=[];"),o(_,".co_docstring=",this.cDocstringOfCode(e),";"),m&&o(_,".co_kwargs=1;"),p&&o(_,".co_varargs=1;"),b||o(_,".co_fastcall=1;"),e="",g&&(e=",$cell",(a=this.u.ste.hasFree)&&(e+=",$free")),b)return i&&0<i.args.length?this._gr("gener","new Sk.builtins['function']((function(){var $origargs=Array.prototype.slice.call(arguments);Sk.builtin.pyCheckArgsLen(\"",t.v,'",arguments.length,',i.args.length-f.length,",",i.args.length,");return new Sk.builtins['generator'](",_,",$gbl,$origargs",e,");}))"):this._gr("gener","new Sk.builtins['function']((function(){Sk.builtin.pyCheckArgsLen(\"",t.v,"\",arguments.length,0,0);return new Sk.builtins['generator'](",_,",$gbl,[]",e,");}))");if(0<d.length){o("$ret = new Sk.builtins['function'](",_,",$gbl",e,");");for(let e of d.reverse())o("$ret = Sk.misceval.callsimOrSuspendArray(",e,",[$ret]);"),this._checkSuspension();t=this._gr("funcobj","$ret")}else t=this._gr("funcobj","new Sk.builtins['function'](",_,",$gbl",e,")");return n&&o(t,".func_annotations=",n,";"),t},n.prototype.cargannotation=function(e,t,n){t&&(e=s(this.u.private_,e).v,n.push(`'${e}'`),n.push(this.vexpr(t)))},n.prototype.cargannotations=function(e,t){if(e)for(let n=0;n<e.length;n++){const i=e[n];this.cargannotation(i.arg,i.annotation,t)}};const u=new Sk.builtin.str("return");n.prototype.cannotations=function(e,t){const n=[];if(e&&(this.cargannotations(e.posonlyargs,n),this.cargannotations(e.args,n),e.vararg&&e.vararg.annotation&&this.cargannotation(e.vararg.arg,e.vararg.annotation,n),this.cargannotations(e.kwonlyargs,n),e.kwarg&&e.kwarg.annotation&&this.cargannotation(e.kwarg.arg,e.kwarg.annotation,n)),t&&this.cargannotation(u,t,n),0!==n.length)return"["+n.join(",")+"]"},n.prototype.maybeCDocstringOfBody=function(e){return 0===e.length||(e=e[0]).constructor!==Sk.astnodes.Expr||(e=e.value).constructor!==Sk.astnodes.Str?null:this.vexpr(e)},n.prototype.cDocstringOfCode=function(e){switch(e.constructor){case Sk.astnodes.AsyncFunctionDef:case Sk.astnodes.FunctionDef:return this.maybeCDocstringOfBody(e.body)||"Sk.builtin.none.none$";case Sk.astnodes.Lambda:case Sk.astnodes.GeneratorExp:return"Sk.builtin.none.none$";default:Sk.asserts.fail(`unexpected node kind ${e.constructor.name}`)}},n.prototype.cfunction=function(e,t){Sk.asserts.assert(e instanceof Sk.astnodes.FunctionDef),t=this.buildcodeobj(e,e.name,e.decorator_list,e.args,(function(t){this.vseqstmt(e.body),o("return Sk.builtin.none.none$;")}),t),this.nameop(e.name,Sk.astnodes.Store,t)},n.prototype.clambda=function(e){return Sk.asserts.assert(e instanceof Sk.astnodes.Lambda),this.buildcodeobj(e,new Sk.builtin.str("<lambda>"),null,e.args,(function(t){t=this.vexpr(e.body),o("return ",t,";")}))},n.prototype.cifexp=function(e){var t=this.newBlock("next of ifexp"),n=this.newBlock("end of ifexp"),i=this._gr("res","null"),r=this.vexpr(e.test);return this._jumpfalse(r,t),o(i,"=",this.vexpr(e.body),";"),this._jump(n),this.setBlock(t),o(i,"=",this.vexpr(e.orelse),";"),this._jump(n),this.setBlock(n),i},n.prototype.cgenexpgen=function(e,t,n){var i=this.newBlock("start for "+t),r=this.newBlock("skip for "+t);this.newBlock("if cleanup for "+t);var s=this.newBlock("end for "+t),a=e[t];if(0===t)var l="$loc.$iter0";else{var u=this.vexpr(a.iter);l="$loc."+this.gensym("iter"),o(l,"=","Sk.abstr.iter(",u,");")}this._jump(i),this.setBlock(i),this.annotateSource(n),o("$ret = Sk.abstr.iternext(",l,this.u.canSuspend?", true":", false",");"),this._checkSuspension(n),u=this._gr("next","$ret"),this._jumpundef(u,s),this.vexpr(a.target,u);var c=a.ifs?a.ifs.length:0;for(l=0;l<c;++l)this.annotateSource(a.ifs[l]),u=this.vexpr(a.ifs[l]),this._jumpfalse(u,i);++t<e.length&&this.cgenexpgen(e,t,n),t>=e.length&&(this.annotateSource(n),e=this.vexpr(n),o("return [",r,"/*resume*/,",e,"/*ret*/];"),this.setBlock(r)),this._jump(i),this.setBlock(s),1===t&&o("return Sk.builtin.none.none$;")},n.prototype.cgenexp=function(e){var t=this.buildcodeobj(e,new Sk.builtin.str("<genexpr>"),null,null,(function(t){this.cgenexpgen(e.generators,0,e.elt)}));return t=this._gr("gener","Sk.misceval.callsimArray(",t,");"),o(t,".gi$locals.$iter0=Sk.abstr.iter(",this.vexpr(e.generators[0].iter),");"),t},n.prototype.cclass=function(e){Sk.asserts.assert(e instanceof Sk.astnodes.ClassDef);var t=this.vseqexpr(e.decorator_list),n=this.vseqexpr(e.bases);let i=this.cunpackkwstoarray(e.keywords);var r=this.enterScope(e.name,e,e.lineno),s=this.newBlock("class entry");this.u.prefixCode="var "+r+"=(function $"+e.name.v+"$class_outer($globals,$locals,$cell){var $gbl=$globals,$loc=$locals,$free=$globals;",this.u.switchCode+="(function $"+e.name.v+"$_closure($cell){",this.u.switchCode+="var $blk="+s+",$exc=[],$ret=undefined,$postfinally=undefined,$currLineNo=undefined,$currColNo=undefined;",null!==Sk.execLimit&&(this.u.switchCode+="if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}"),null!==Sk.yieldLimit&&this.u.canSuspend&&(this.u.switchCode+="if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}"),this.u.switchCode+="while(true){try{",this.u.switchCode+=this.outputInterruptTest(),this.u.switchCode+="switch($blk){",this.u.suffixCode="}}catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }}}",this.u.suffixCode+="}).call(null, $cell);});",this.u.private_=e.name,this.cbody(e.body,e.name),o("return;"),this.exitScope(),o("$ret = Sk.misceval.buildClass($gbl,",r,",",e.name.$r().v,",[",n,"], $cell, ",i,");"),this._checkSuspension();for(let e of t.reverse())o("$ret = Sk.misceval.callsimOrSuspendArray(",e,", [$ret]);"),this._checkSuspension();this.nameop(e.name,Sk.astnodes.Store,"$ret")},n.prototype.ccontinue=function(e){var t=this.peekFinallyBlock();if(0==this.u.continueBlocks.length)throw new Sk.builtin.SyntaxError("'continue' outside loop",this.filename,e.lineno);e=this.u.continueBlocks[this.u.continueBlocks.length-1],Sk.asserts.assert(this.u.breakBlocks.length===this.u.continueBlocks.length),t&&t.breakDepth==this.u.continueBlocks.length?o("$postfinally={isBreak:true,gotoBlock:",e,"};"):this._jump(e)},n.prototype.cbreak=function(e){var t=this.peekFinallyBlock();if(0===this.u.breakBlocks.length)throw new Sk.builtin.SyntaxError("'break' outside loop",this.filename,e.lineno);e=this.u.breakBlocks[this.u.breakBlocks.length-1],t&&t.breakDepth==this.u.breakBlocks.length?o("$postfinally={isBreak:true,gotoBlock:",e,"};"):this._jump(e)},n.prototype.vstmt=function(e,t){if(this.u.lineno=e.lineno,this.u.linenoSet=!1,this.u.localtemps=[],Sk.debugging&&this.u.canSuspend){var n=this.newBlock("debug breakpoint for line "+e.lineno);o("if (Sk.breakpoints('"+this.filename+"',"+e.lineno+","+e.col_offset+")) {","var $susp = $saveSuspension({data: {type: 'Sk.debug'}, resume: function() {}}, '"+this.filename+"',"+e.lineno+","+e.col_offset+");","$susp.$blk = "+n+";","$susp.optional = true;","return $susp;","}"),this._jump(n),this.setBlock(n),this.u.doesSuspend=!0}switch(this.annotateSource(e),e.constructor){case Sk.astnodes.FunctionDef:this.cfunction(e,t);break;case Sk.astnodes.ClassDef:this.cclass(e);break;case Sk.astnodes.Return:if(this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock)throw new Sk.builtin.SyntaxError("'return' outside function",this.filename,e.lineno);n=e.value?this.vexpr(e.value):"Sk.builtin.none.none$",0==this.u.finallyBlocks.length?o("return ",n,";"):(o("$postfinally={returning:",n,"};"),this._jump(this.peekFinallyBlock().blk));break;case Sk.astnodes.Delete:this.vseqexpr(e.targets);break;case Sk.astnodes.Assign:var i=e.targets.length;for(n=this.vexpr(e.value),t=0;t<i;++t)this.vexpr(e.targets[t],n);break;case Sk.astnodes.AnnAssign:return this.cannassign(e);case Sk.astnodes.AugAssign:return this.caugassign(e);case Sk.astnodes.Print:this.cprint(e);break;case Sk.astnodes.For:return this.cfor(e);case Sk.astnodes.While:return this.cwhile(e);case Sk.astnodes.If:return this.cif(e);case Sk.astnodes.Raise:return this.craise(e);case Sk.astnodes.Try:return this.ctry(e);case Sk.astnodes.With:return this.cwith(e,0);case Sk.astnodes.Assert:return this.cassert(e);case Sk.astnodes.Import:return this.cimport(e);case Sk.astnodes.ImportFrom:return this.cfromimport(e);case Sk.astnodes.Global:break;case Sk.astnodes.Expr:this.vexpr(e.value);break;case Sk.astnodes.Pass:break;case Sk.astnodes.Break:this.cbreak(e);break;case Sk.astnodes.Continue:this.ccontinue(e);break;case Sk.astnodes.Debugger:o("debugger;");break;default:Sk.asserts.fail("unhandled case in vstmt: "+JSON.stringify(e))}},n.prototype.vseqstmt=function(e){var t;for(t=0;t<e.length;++t)this.vstmt(e[t])},n.prototype.isCell=function(e){return e=r(s(this.u.private_,e).v),this.u.ste.getScope(e)===Sk.SYMTAB_CONSTS.CELL},n.prototype.nameop=function(e,t,n){if((t===Sk.astnodes.Store||t===Sk.astnodes.AugStore||t===Sk.astnodes.Del)&&"__debug__"===e.v)throw new Sk.builtin.SyntaxError("can not assign to __debug__",this.filename,this.u.lineno);if(Sk.asserts.assert("None"!==e.v),"NotImplemented"===e.v)return"Sk.builtin.NotImplemented.NotImplemented$";var i=s(this.u.private_,e).v;i=r(i);var a=3,l=this.u.ste.getScope(i),u=null;switch(l){case Sk.SYMTAB_CONSTS.FREE:u="$free",a=2;break;case Sk.SYMTAB_CONSTS.CELL:u="$cell",a=2;break;case Sk.SYMTAB_CONSTS.LOCAL:this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock||this.u.ste.generator||(a=0);break;case Sk.SYMTAB_CONSTS.GLOBAL_IMPLICIT:this.u.ste.blockType===Sk.SYMTAB_CONSTS.FunctionBlock&&(a=1);break;case Sk.SYMTAB_CONSTS.GLOBAL_EXPLICIT:a=1}switch(Sk.asserts.assert(l||"_"===e.v.charAt(1)),e=i,this.u.ste.generator||this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock?i="$loc."+i:(0===a||3===a)&&this.u.localnames.push(i),a){case 0:switch(t){case Sk.astnodes.Load:case Sk.astnodes.Param:return o("if (",i," === undefined) { throw new Sk.builtin.UnboundLocalError('local variable \\'",i,"\\' referenced before assignment'); }\n"),i;case Sk.astnodes.Store:o(i,"=",n,";");break;case Sk.astnodes.Del:o("delete ",i,";");break;default:Sk.asserts.fail("unhandled")}break;case 3:switch(t){case Sk.astnodes.Load:return this._gr("loadname",i,"!==undefined?",i,":Sk.misceval.loadname('",e,"',$gbl);");case Sk.astnodes.Store:o(i,"=",n,";");break;case Sk.astnodes.Del:o("delete ",i,";");break;case Sk.astnodes.Param:return i;default:Sk.asserts.fail("unhandled")}break;case 1:switch(t){case Sk.astnodes.Load:return this._gr("loadgbl","Sk.misceval.loadname('",e,"',$gbl)");case Sk.astnodes.Store:o("$gbl.",e,"=",n,";");break;case Sk.astnodes.Del:o("delete $gbl.",e);break;default:Sk.asserts.fail("unhandled case in name op_global")}break;case 2:switch(t){case Sk.astnodes.Load:return u+"."+e;case Sk.astnodes.Store:o(u,".",e,"=",n,";");break;case Sk.astnodes.Param:return e;default:Sk.asserts.fail("unhandled case in name op_deref")}break;default:Sk.asserts.fail("unhandled case")}},n.prototype.enterScope=function(e,t,n,r){var s=new i;return s.ste=this.st.getStsForAst(t),s.name=e,s.firstlineno=n,s.canSuspend=r||!1,this.u&&this.u.private_&&(s.private_=this.u.private_),this.stack.push(this.u),this.allUnits.push(s),e=this.gensym("scope"),s.scopename=e,this.u=s,this.u.activateScope(),this.nestlevel++,e},n.prototype.exitScope=function(){var e=this.u;if(this.nestlevel--,(this.u=0<=this.stack.length-1?this.stack.pop():null)&&this.u.activateScope(),"<module>"!==e.name.v){var t=e.name.$r().v;t=t.substring(1,t.length-1),o(e.scopename,".co_name=new Sk.builtins['str']('",t,"');"),this.stack.length&&"class"==this.u.ste.blockType&&o(e.scopename,".co_qualname=new Sk.builtins['str']('"+this.u.name.v+"."+t+"');")}for(var n in e.consts)e.consts.hasOwnProperty(n)&&(e.suffixCode+=n+" = "+e.consts[n]+";")},n.prototype.cbody=function(e,t){var n=0;const i=this.maybeCDocstringOfBody(e);for(null!==i&&(o("$loc.__doc__ = ",i,";"),n=1);n<e.length;++n)this.vstmt(e[n],t);this.u.hasAnnotations&&(this.u.varDeclsCode+="$loc.__annotations__ || ($loc.__annotations__ = new Sk.builtin.dict());")},n.prototype.cprint=function(e){var t;Sk.asserts.assert(e instanceof Sk.astnodes.Print),e.dest&&this.vexpr(e.dest);var n=e.values.length;for(t=0;t<n;++t)o("$ret = Sk.misceval.print_(","new Sk.builtins['str'](",this.vexpr(e.values[t]),").v);"),this._checkSuspension(e);e.nl&&(o("$ret = Sk.misceval.print_(",'"\\n");'),this._checkSuspension(e))},n.prototype.cmod=function(e){var t=this.enterScope(new Sk.builtin.str("<module>"),e,0,this.canSuspend),n=this.newBlock("module entry");return this.u.prefixCode="var "+t+"=(function($forcegbl, $forceloc){",this.u.varDeclsCode="var $gbl = $forcegbl || {}, $blk="+n+",$exc=[],$loc=$forceloc || $gbl,$cell={},$err=undefined;var $ret=undefined,$postfinally=undefined,$currLineNo=undefined,$currColNo=undefined;",null!==Sk.execLimit&&(this.u.varDeclsCode+="if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}"),null!==Sk.yieldLimit&&this.u.canSuspend&&(this.u.varDeclsCode+="if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}"),this.u.varDeclsCode+="var $waking=false; if ("+t+".$wakingSuspension!==undefined) { $wakeFromSuspension(); $waking=true; }if (Sk.retainGlobals) { if (Sk.globals) { $gbl = Sk.globals; Sk.globals = $gbl; $loc = $gbl; } else { Sk.globals = $gbl; }} else { Sk.globals = $gbl; }",this.u.switchCode="while(true){try{",this.u.switchCode+=this.outputInterruptTest(),this.u.switchCode+="switch($blk){",this.u.suffixCode="}",this.u.suffixCode+="}catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} } });",e.constructor===Sk.astnodes.Module?(this.cbody(e.body),o("return $loc;")):Sk.asserts.fail("todo; unhandled case in compilerMod"),this.exitScope(),this.result.push(this.outputAllUnits()),t},Sk.compile=function(e,t,i,r){i=Sk.__future__,Sk.__future__=Object.create(Sk.__future__);var s=Sk.parse(t,e),o=Sk.astFromParse(s.cst,t,s.flags);return s=s.flags,r=(e=new n(t,Sk.symboltable(o,t),s,r,e)).cmod(o),Sk.__future__=i,{funcname:"$compiledmod",code:`var $compiledmod = function() {${e.result.join("")}\nreturn ${r};}();\n$compiledmod;`,filename:t}},Sk.exportSymbol("Sk.compile",Sk.compile),Sk.resetCompiler=function(){Sk.gensymcount=0},Sk.exportSymbol("Sk.resetCompiler",Sk.resetCompiler),Sk.fixReserved=r,Sk.exportSymbol("Sk.fixReserved",Sk.fixReserved),Sk.unfixReserved=function(e){return e.replace(l,"")},Sk.exportSymbol("Sk.unfixReserved",Sk.unfixReserved),Sk.mangleName=s,Sk.exportSymbol("Sk.mangleName",Sk.mangleName),Sk.reservedWords_=a,Sk.exportSymbol("Sk.reservedWords_",Sk.reservedWords_)},function(e,t){Sk.sysmodules=new Sk.builtin.dict([]),Sk.realsyspath=void 0,Sk.importSearchPathForName=function(e,t,n){var i=e.replace(/\./g,"/"),r=function(e,t){return Sk.misceval.chain(Sk.misceval.tryCatch((function(){return Sk.read(e)}),(function(e){})),(function(n){if(void 0!==n)return new Sk.misceval.Break({filename:e,code:n,packagePath:t})}))};return void 0===n&&(n=Sk.realsyspath),Sk.misceval.iterFor(n.tp$iter(),(function(e){return Sk.misceval.chain(r(e.v+"/"+i+t,!1),(function(n){return n||r(e.v+"/"+i+"/__init__"+t,e.v+"/"+i)}))}))},Sk.importSetUpPath=function(e){if(!Sk.realsyspath){var t=[new Sk.builtin.str("src/builtin"),new Sk.builtin.str("src/lib"),new Sk.builtin.str(".")];for(e=0;e<Sk.syspath.length;++e)t.push(new Sk.builtin.str(Sk.syspath[e]));Sk.realsyspath=new Sk.builtin.list(t)}},Sk.importModuleInternal_=function(e,t,n,i,r,s,o){var a,l,u,c,d=null,f=void 0!==r?r.tp$getattr(Sk.builtin.str.$name):void 0,h=void 0!==f?f.v+".":"",p=void 0!==r?r.tp$getattr(Sk.builtin.str.$path):void 0;if(Sk.importSetUpPath(o),r&&!f){if(s)return;throw new Sk.builtin.ValueError("Attempted to import relative to invalid package (no name)")}void 0===n&&(n=h+e);var m=e.split(".");if(1<m.length){var _=m.slice(0,m.length-1).join(".");d=Sk.importModuleInternal_(_,t,void 0,void 0,r,s,o)}var b=Sk.misceval.chain(d,(function(b){return d=b,void 0!==(l=Sk.sysmodules.quick$lookup(new Sk.builtin.str(n)))?d||l:Sk.misceval.chain(void 0,(function(){var t=e;if(1<m.length){if(!d)return;u=Sk.sysmodules.mp$subscript(new Sk.builtin.str(h+_)),t=m[m.length-1],p=u.tp$getattr(Sk.builtin.str.$path)}if(c=new Sk.builtin.module,"string"==typeof i){a=e+".py";var n=Sk.compile(i,a,"exec",o)}else n=Sk.misceval.chain(void 0,(function(){if(Sk.onBeforeImport&&"function"==typeof Sk.onBeforeImport)return Sk.onBeforeImport(e)}),(function(n){if(!1===n)throw new Sk.builtin.ImportError("Importing "+e+" is not allowed");if("string"==typeof n)throw new Sk.builtin.ImportError(n);return Sk.importSearchPathForName(t,".js",p)}),(function(e){return e?{funcname:"$builtinmodule",code:e.code,filename:e.filename,packagePath:e.packagePath}:Sk.misceval.chain(Sk.importSearchPathForName(t,".py",p),(function(t){if(e=t)return Sk.compile(e.code,e.filename,"exec",o)}),(function(t){if(t)return t.packagePath=e.packagePath,t}))}));return n}),(function(i){if(i){var s=c.$js=i.code;null==a&&(a=i.filename),null!=Sk.dateSet&&Sk.dateSet||(s="Sk.execStart = Sk.lastYield = new Date();\n"+i.code,Sk.dateSet=!0),t&&(s=function(e){var t,n=Sk.js_beautify(e).split("\n");for(t=1;t<=n.length;++t){var i=(""+t).length;for(e="";5>i;++i)e+=" ";n[t-1]="/* "+e+t+" */ "+n[t-1]}return n.join("\n")}(s),Sk.debugout(s)),"$compiledmod"!==i.funcname&&(s+="\n"+i.funcname+";");var o=new Sk.builtin.str(n),l=new Sk.builtin.str(e);Sk.sysmodules.mp$ass_subscript(o,c),r&&r.tp$setattr(l,c);var u=Sk.global.eval(s);c.init$dict(o,Sk.builtin.none.none$),c.$d.__package__=i.packagePath?o:_?new Sk.builtin.str(h+_):f||Sk.builtin.none.none$,i.packagePath&&(c.$d.__path__=new Sk.builtin.tuple([new Sk.builtin.str(i.packagePath)])),i.filename&&"$builtinmodule"!==i.funcname&&(c.$d.__file__=new Sk.builtin.str(i.filename));var d=r&&r.$initializing;return c.$initializing=!0,r&&!d&&(r.$initializing=!0),Sk.misceval.tryCatch((()=>Sk.misceval.chain(u(c.$d),(e=>(c.$initializing=!1,r&&!d&&(r.$initializing=!1),e)))),(e=>{try{Sk.abstr.objectDelItem(Sk.sysmodules,o)}catch(e){}if(r)try{r.tp$setattr(l,void 0)}catch(e){}throw c.$initializing=!1,r&&!d&&(r.$initializing=!1),e}))}}),(function(t){var n;if(void 0===t){if(s&&!d)return;throw new Sk.builtin.ModuleNotFoundError("No module named "+Sk.misceval.objectRepr(new Sk.builtin.str(e)))}if(t!==c.$d){for(n in c.$d)t[n]||(t[n]=c.$d[n]);c.$d=t}if(Sk.onAfterImport&&"function"==typeof Sk.onAfterImport)try{Sk.onAfterImport(e)}catch(e){}return d?(u.tp$setattr(new Sk.builtin.str(m[m.length-1]),c),d):c}))}));return o?b:Sk.misceval.retryOptionalSuspensionOrThrow(b)},Sk.importModule=function(e,t,n){return Sk.importModuleInternal_(e,t,void 0,void 0,void 0,!1,n)},Sk.importMain=function(e,t,n){return Sk.dateSet=!1,Sk.filesLoaded=!1,Sk.sysmodules=new Sk.builtin.dict([]),Sk.realsyspath=void 0,Sk.resetCompiler(),Sk.importModuleInternal_(e,t,"__main__",void 0,void 0,!1,n)},Sk.importMainWithBody=function(e,t,n,i){return Sk.dateSet=!1,Sk.filesLoaded=!1,Sk.sysmodules=new Sk.builtin.dict([]),Sk.realsyspath=void 0,Sk.resetCompiler(),Sk.importModuleInternal_(e,t,"__main__",n,void 0,!1,i)},Sk.importBuiltinWithBody=function(e,t,n,i){return Sk.importModuleInternal_(e,t,"__builtin__."+e,n,void 0,!1,i)},Sk.builtin.__import__=function(e,t,n,i,r){e=e.toString();var s,o=Sk.globals;if(null==r&&(r=Sk.__future__.absolute_import?0:-1),0!==r&&t.__package__&&t.__package__!==Sk.builtin.none.none$){if((s=t.__package__.v)&&0<r){if(t=s.split("."),r-1>=t.length)throw new Sk.builtin.ImportError("Attempted relative import beyond toplevel package");t.length-=r-1,s=t.join(".")}var a=Sk.sysmodules.quick$lookup(new Sk.builtin.str(s))}if(0<r&&void 0===a)throw new Sk.builtin.ImportError("Attempted relative import in non-package");return e.split("."),Sk.misceval.chain(void 0,(function(){if(0!==r&&void 0!==a)return""===e?a:Sk.importModuleInternal_(e,void 0,s+"."+e,void 0,a,-1==r,!0)}),(function(t){return void 0===t?(s=a=void 0,Sk.importModuleInternal_(e,void 0,void 0,void 0,void 0,!1,!0)):t}),(function(t){if(i&&0!==i.length){t=[null];const n=Sk.sysmodules.mp$subscript(new Sk.builtin.str((s||"")+(s&&e?".":"")+e));for(let e=0;e<i.length;e++){const r=i[e];"*"!==r&&void 0===n.tp$getattr(new Sk.builtin.str(r))&&t.push((()=>Sk.importModuleInternal_(r,void 0,void 0,void 0,n,!0,!0)))}return Sk.misceval.chain(...t,(function(){return Sk.asserts.assert(n),n}))}return t}),(function(e){return o!==Sk.globals&&(Sk.globals=o),e}))},Sk.importStar=function(e,t,n){if(n=e.tp$getattr(new Sk.builtin.str("__all__")))for(let i=Sk.abstr.iter(n),r=i.tp$iternext();void 0!==r;r=i.tp$iternext())t[r.v]=Sk.abstr.gattr(e,r);else{n=Object.getOwnPropertyNames(e.$d);for(let i in n)"_"!=n[i].charAt(0)&&(t[n[i]]=e.$d[n[i]])}},Sk.exportSymbol("Sk.importMain",Sk.importMain),Sk.exportSymbol("Sk.importMainWithBody",Sk.importMainWithBody),Sk.exportSymbol("Sk.importBuiltinWithBody",Sk.importBuiltinWithBody),Sk.exportSymbol("Sk.builtin.__import__",Sk.builtin.__import__),Sk.exportSymbol("Sk.importStar",Sk.importStar)},function(e,t){Sk.builtin.timSort=function(e,t){this.list=new Sk.builtin.list(e.v),this.MIN_GALLOP=7,this.listlength=t||e.sq$length()},Sk.builtin.timSort.prototype.lt=function(e,t){return Sk.misceval.richCompareBool(e,t,"Lt")},Sk.builtin.timSort.prototype.le=function(e,t){return!this.lt(t,e)},Sk.builtin.timSort.prototype.setitem=function(e,t){this.list.v[e]=t},Sk.builtin.timSort.prototype.binary_sort=function(e,t){var n;for(n=e.base+t;n<e.base+e.len;n++){var i=e.base,r=n;for(t=e.getitem(r);i<r;){var s=i+(r-i>>1);this.lt(t,e.getitem(s))?r=s:i=s+1}for(Sk.asserts.assert(i===r),s=n;s>i;s--)e.setitem(s,e.getitem(s-1));e.setitem(i,t)}},Sk.builtin.timSort.prototype.count_run=function(e){var t;if(1>=e.len)var n=e.len,i=!1;else if(n=2,this.lt(e.getitem(e.base+1),e.getitem(e.base)))for(i=!0,t=e.base+2;t<e.base+e.len&&this.lt(e.getitem(t),e.getitem(t-1));t++)n++;else for(i=!1,t=e.base+2;t<e.base+e.len&&!this.lt(e.getitem(t),e.getitem(t-1));t++)n++;return{run:new Sk.builtin.listSlice(e.list,e.base,n),descending:i}},Sk.builtin.timSort.prototype.sort=function(){var e,t=new Sk.builtin.listSlice(this.list,0,this.listlength);if(!(2>t.len)){for(this.merge_init(),e=this.merge_compute_minrun(t.len);0<t.len;){var n=this.count_run(t);if(n.descending&&n.run.reverse(),n.run.len<e){var i=n.run.len;n.run.len=e<t.len?e:t.len,this.binary_sort(n.run,i)}t.advance(n.run.len),this.pending.push(n.run),this.merge_collapse()}Sk.asserts.assert(t.base==this.listlength),this.merge_force_collapse(),Sk.asserts.assert(1==this.pending.length),Sk.asserts.assert(0===this.pending[0].base),Sk.asserts.assert(this.pending[0].len==this.listlength)}},Sk.builtin.timSort.prototype.gallop=function(e,t,n,i){var r;Sk.asserts.assert(0<=n&&n<t.len);var s=this;i=i?function(e,t){return s.le(e,t)}:function(e,t){return s.lt(e,t)};var o=t.base+n,a=0,l=1;if(i(t.getitem(o),e)){for(r=t.len-n;l<r&&i(t.getitem(o+l),e);){a=l;try{l=1+(l<<1)}catch(e){l=r}}l>r&&(l=r),a+=n,l+=n}else{for(r=n+1;l<r&&!i(t.getitem(o-l),e);){a=l;try{l=1+(l<<1)}catch(e){l=r}}l>r&&(l=r),o=n-a,a=n-l,l=o}for(Sk.asserts.assert(-1<=a<l<=t.len),a+=1;a<l;)n=a+(l-a>>1),i(t.getitem(t.base+n),e)?a=n+1:l=n;return Sk.asserts.assert(a==l),l},Sk.builtin.timSort.prototype.merge_init=function(){this.min_gallop=this.MIN_GALLOP,this.pending=[]},Sk.builtin.timSort.prototype.merge_lo=function(e,t){var n,i,r;Sk.asserts.assert(0<e.len&&0<t.len&&e.base+e.len==t.base);var s=this.min_gallop,o=e.base;e=e.copyitems();try{if(this.setitem(o,t.popleft()),o++,1!=e.len&&0!==t.len)for(;;){for(i=n=0;;)if(this.lt(t.getitem(t.base),e.getitem(e.base))){if(this.setitem(o,t.popleft()),o++,0===t.len)return;if(n=0,++i>=s)break}else{if(this.setitem(o,e.popleft()),o++,1==e.len)return;if(i=0,++n>=s)break}for(s+=1;;){for(this.min_gallop=s-=1<s,n=this.gallop(t.getitem(t.base),e,0,!0),r=e.base;r<e.base+n;r++)this.setitem(o,e.getitem(r)),o++;if(e.advance(n),1>=e.len)return;if(this.setitem(o,t.popleft()),o++,0===t.len)return;for(i=this.gallop(e.getitem(e.base),t,0,!1),r=t.base;r<t.base+i;r++)this.setitem(o,t.getitem(r)),o++;if(t.advance(i),0===t.len)return;if(this.setitem(o,e.popleft()),o++,1==e.len)return;if(n<this.MIN_GALLOP&&i<this.MIN_GALLOP)break;s++,this.min_gallop=s}}}finally{for(Sk.asserts.assert(0<=e.len&&0<=t.len),r=t.base;r<t.base+t.len;r++)this.setitem(o,t.getitem(r)),o++;for(r=e.base;r<e.base+e.len;r++)this.setitem(o,e.getitem(r)),o++}},Sk.builtin.timSort.prototype.merge_hi=function(e,t){var n,i,r;Sk.asserts.assert(0<e.len&&0<t.len&&e.base+e.len==t.base);var s=this.min_gallop,o=t.base+t.len;t=t.copyitems();try{if(o--,this.setitem(o,e.popright()),0!==e.len&&1!=t.len)for(;;){for(i=n=0;;){var a=e.getitem(e.base+e.len-1),l=t.getitem(t.base+t.len-1);if(this.lt(l,a)){if(o--,this.setitem(o,a),e.len--,0===e.len)return;if(i=0,++n>=s)break}else{if(o--,this.setitem(o,l),t.len--,1==t.len)return;if(n=0,++i>=s)break}}for(s+=1;;){this.min_gallop=s-=1<s,l=t.getitem(t.base+t.len-1);var u=this.gallop(l,e,e.len-1,!0);for(n=e.len-u,r=e.base+e.len-1;r>e.base+u-1;r--)o--,this.setitem(o,e.getitem(r));if(e.len-=n,0===e.len)return;if(o--,this.setitem(o,t.popright()),1==t.len)return;for(a=e.getitem(e.base+e.len-1),u=this.gallop(a,t,t.len-1,!1),i=t.len-u,r=t.base+t.len-1;r>t.base+u-1;r--)o--,this.setitem(o,t.getitem(r));if(t.len-=i,1>=t.len)return;if(o--,this.setitem(o,e.popright()),0===e.len)return;if(n<this.MIN_GALLOP&&i<this.MIN_GALLOP)break;s++,this.min_gallop=s}}}finally{for(Sk.asserts.assert(0<=e.len&&0<=t.len),r=e.base+e.len-1;r>e.base-1;r--)o--,this.setitem(o,e.getitem(r));for(r=t.base+t.len-1;r>t.base-1;r--)o--,this.setitem(o,t.getitem(r))}},Sk.builtin.timSort.prototype.merge_at=function(e){0>e&&(e=this.pending.length+e);var t=this.pending[e],n=this.pending[e+1];Sk.asserts.assert(0<t.len&&0<n.len),Sk.asserts.assert(t.base+t.len==n.base),this.pending[e]=new Sk.builtin.listSlice(this.list,t.base,t.len+n.len),this.pending.splice(e+1,1),e=this.gallop(n.getitem(n.base),t,0,!0),t.advance(e),0!==t.len&&(n.len=this.gallop(t.getitem(t.base+t.len-1),n,n.len-1,!1),0!==n.len&&(t.len<=n.len?this.merge_lo(t,n):this.merge_hi(t,n)))},Sk.builtin.timSort.prototype.merge_collapse=function(){for(var e=this.pending;1<e.length;)if(3<=e.length&&e[e.length-3].len<=e[e.length-2].len+e[e.length-1].len)e[e.length-3].len<e[e.length-1].len?this.merge_at(-3):this.merge_at(-2);else{if(!(e[e.length-2].len<=e[e.length-1].len))break;this.merge_at(-2)}},Sk.builtin.timSort.prototype.merge_force_collapse=function(){for(var e=this.pending;1<e.length;)3<=e.length&&e[e.length-3].len<e[e.length-1].len?this.merge_at(-3):this.merge_at(-2)},Sk.builtin.timSort.prototype.merge_compute_minrun=function(e){for(var t=0;64<=e;)t|=1&e,e>>=1;return e+t},Sk.builtin.listSlice=function(e,t,n){this.list=e,this.base=t,this.len=n},Sk.builtin.listSlice.prototype.copyitems=function(){var e=this.base,t=this.base+this.len;return Sk.asserts.assert(0<=e<=t),new Sk.builtin.listSlice(new Sk.builtin.list(this.list.v.slice(e,t)),0,this.len)},Sk.builtin.listSlice.prototype.advance=function(e){this.base+=e,this.len-=e,Sk.asserts.assert(this.base<=this.list.sq$length())},Sk.builtin.listSlice.prototype.getitem=function(e){return this.list.v[e]},Sk.builtin.listSlice.prototype.setitem=function(e,t){this.list.v[e]=t},Sk.builtin.listSlice.prototype.popleft=function(){var e=this.list.v[this.base];return this.base++,this.len--,e},Sk.builtin.listSlice.prototype.popright=function(){return this.len--,this.list.v[this.base+this.len]},Sk.builtin.listSlice.prototype.reverse=function(){for(var e,t,n=this.list,i=this.base,r=i+this.len-1;i<r;)e=n.v[r],t=n.v[i],n.v[i]=e,n.v[r]=t,i++,r--},Sk.exportSymbol("Sk.builtin.listSlice",Sk.builtin.listSlice),Sk.exportSymbol("Sk.builtin.timSort",Sk.builtin.timSort)},function(e,t){Sk.builtin.super_=Sk.abstr.buildNativeClass("super",{constructor:function(e,t){if(Sk.asserts.assert(this instanceof Sk.builtin.super_,"bad call to super, use 'new'"),this.type=e,this.obj=t,void 0!==e&&!Sk.builtin.checkClass(e))throw new Sk.builtin.TypeError("must be type, not "+Sk.abstr.typeName(e));this.obj_type=void 0!==this.obj?this.$supercheck(e,this.obj):null},slots:{tp$doc:"super() -> same as super(__class__, <first argument>)\nsuper(type) -> unbound super object\nsuper(type, obj) -> bound super object; requires isinstance(obj, type)\nsuper(type, type2) -> bound super object; requires issubclass(type2, type)\nTypical use to call a cooperative superclass method:\nclass C(B):\n def meth(self, arg):\n super().meth(arg)\nThis works for class methods too:\nclass C(B):\n @classmethod\n def cmeth(cls, arg):\n super().cmeth(arg)\n",tp$new:Sk.generic.new,tp$init(e,t){if(Sk.abstr.checkNoKwargs("super",t),Sk.abstr.checkArgsLen("super",e,1,2),t=e[0],e=e[1],!Sk.builtin.checkClass(t))throw new Sk.builtin.TypeError("must be type, not "+Sk.abstr.typeName(t));this.obj=e,this.type=t,null!=this.obj&&(this.obj_type=this.$supercheck(t,this.obj))},$r(){return this.obj?new Sk.builtin.str("<super: <class '"+this.type.prototype.tp$name+"'>, <"+Sk.abstr.typeName(this.obj)+" object>>"):new Sk.builtin.str("<super: <class '"+this.type.prototype.tp$name+"'>, NULL>")},tp$getattr(e,t){let n=this.obj_type;if(null==n)return Sk.generic.getAttr.call(this,e,t);var i=n.prototype.tp$mro;const r=i.length;if("__class__"===e.v)return Sk.generic.getAttr.call(this,e,t);let s,o;for(s=0;s+1<r&&this.type!==i[s];s++);if(s++,s>=r)return Sk.generic.getAttr.call(this,e,t);for(e=e.$mangled;s<r;){if((t=i[s].prototype).hasOwnProperty(e)&&(o=t[e]),void 0!==o)return void 0!==(i=o.tp$descr_get)&&(o=i.call(o,this.obj===n?null:this.obj,n)),o;s++}},tp$descr_get(e,t,n){return null===e||null!=this.obj?this:this.ob$type!==Sk.builtin.super_?(e=Sk.misceval.callsimOrSuspendArray(this.ob$type,[this.type,e]),n?e:Sk.misceval.retryOptionalSuspensionOrThrow(e)):(n=this.$supercheck(this.type,e),(t=new Sk.builtin.super_).type=this.type,t.obj=e,t.obj_type=n,t)}},getsets:{__thisclass__:{$get(){return this.type},$doc:"the class invoking super()"},__self__:{$get(){return this.obj||Sk.builtin.none.none$},$doc:"the instance invoking super(); may be None"},__self_class__:{$get(){return this.obj_type||Sk.builtin.none.none$},$doc:"the type of the instance invoking super(); may be None"}},proto:{$supercheck(e,t){if(Sk.builtin.checkClass(t)&&t.$isSubType(e))return t;if(t.ob$type.$isSubType(e))return t.ob$type;{const n=t.tp$getattr(Sk.builtin.str.$class);if(void 0!==n&&n!==t.ob$type&&Sk.builtin.checkClass(n)&&n.$isSubType(e))return n}throw new Sk.builtin.TypeError("super(type, obj): obj must be an instance or subtype of type")}}})},function(e,t){Sk.builtin.GenericAlias=Sk.abstr.buildNativeClass("types.GenericAlias",{constructor:function(e,t){this.$origin=e,t instanceof Sk.builtin.tuple||(t=new Sk.builtin.tuple([t])),this.$args=t,this.$params=null},slots:{tp$new:(e,t)=>(Sk.abstr.checkNoKwargs("GenericAlias",t),Sk.abstr.checkArgsLen("GenericAlias",e,2,2),new Sk.builtin.GenericAlias(e[0],e[1])),tp$getattr(e,t){return Sk.builtin.checkString(e)&&!this.attr$exc.includes(e.v)?this.$origin.tp$getattr(e,t):Sk.generic.getAttr.call(this,e,t)},$r(){const e=this.ga$repr(this.$origin);let t="";return this.$args.v.forEach(((e,n)=>{t+=0<n?", ":"",t+=this.ga$repr(e)})),t||(t="()"),new Sk.builtin.str(e+"["+t+"]")},tp$doc:"Represent a PEP 585 generic type\n\nE.g. for t = list[int], t.origin is list and t.args is (int,).",tp$hash(){const e=Sk.abstr.objectHash(this.$origin);if(-1==e)return-1;const t=Sk.abstr.objectHash(this.$args);return-1==t?-1:e^t},tp$call(e,t){e=Sk.misceval.callsimArray(this.$origin,e,t);try{e.tp$setattr(new Sk.builtin.str("__orig_class__"),this)}catch(e){if(!(e instanceof Sk.builtin.AttributeError||e instanceof Sk.builtin.TypeError))throw e}return e},tp$richcompare(e,t){if(!(e instanceof Sk.builtin.GenericAlias)||"Eq"!==t&&"NotEq"!==t)return Sk.builtin.NotImplemented.NotImplemented$;const n=Sk.misceval.richCompareBool(this.$origin,e.$origin,"Eq");return n?(e=Sk.misceval.richCompareBool(this.$args,e.$args,"Eq"),"Eq"===t?e:!e):"Eq"===t?n:!n},tp$as_sequence_or_mapping:!0,mp$subscript(e){if(null===this.$params&&this.mk$params(),0===this.$params.sq$length())throw new Sk.builtin.TypeError("There are no type variables left in "+Sk.misceval.objectRepr(this))}},methods:{__mro_entries__:{$meth(){return new Sk.builtin.tuple([this.$origin])},$flags:{NoArgs:!0}},__instancecheck__:{$meth(e){throw new Sk.builtin.TypeError("isinstance() argument 2 cannot be a parameterized generic")},$flags:{OneArg:!0}},__subclasscheck__:{$meth(e){throw new Sk.builtin.TypeError("issubclass() argument 2 cannot be a parameterized generic")},$flags:{OneArg:!0}}},getsets:{__parameters__:{$get(){return null===this.$params&&this.mk$params(),this.$params},$doc:"Type variables in the GenericAlias."},__origin__:{$get(){return this.$origin}},__args__:{$get(){return this.$args}}},proto:{mk$params(){const e=[];this.$args.v.forEach((t=>{this.is$typevar(t)&&0>this.tuple$index(e,t)&&e.push(t)})),this.$params=new Sk.builtin.tuple(e)},tuple$index:(e,t)=>e.indexOf(t),is$typevar(e){if("TypeVar"!==e.tp$name)return!1;if(void 0===(e=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$module)))throw Sk.builtin.RuntimeError("found object withought a __module__");return"typing"===e.toString()},ga$repr(e){if(e===Sk.builtin.Ellipsis)return"...";if(Sk.abstr.lookupSpecial(e,this.str$orig)&&Sk.abstr.lookupSpecial(e,this.str$args))return Sk.misceval.objectRepr(e);const t=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$qualname);if(void 0===t)return Sk.misceval.objectRepr(e);const n=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$module);return void 0===n||Sk.builtin.checkNone(n)?Sk.misceval.objectRepr(e):"builtins"===n.toString()?t.toString():n.toString()+"."+t.toString()},str$orig:new Sk.builtin.str("__origin__"),str$args:new Sk.builtin.str("__args__"),attr$exc:"__origin__ __args__ __parameters__ __mro_entries__ __reduce_ex__ __reduce__".split(" ")}})},function(e,t){function n(e,t){let n;if(void 0===e||Sk.builtin.checkNone(e))e=void 0;else{if(!(e instanceof Sk.builtin.dict))throw new Sk.builtin.TypeError(t+" must be a dict or None, not "+Sk.abstr.typeName(e));n={},e.$items().forEach((e=>{var[t,i]=e;Sk.builtin.checkString(t)&&(n[t.$mangled]=i)}))}return n}function i(e,t){if(void 0!==e&&!Sk.builtin.checkNone(e))for(let n in t)e.mp$ass_subscript(new Sk.builtin.str(Sk.unfixReserved(n)),t[n])}Sk.builtins={round:null,len:null,min:null,max:null,sum:null,abs:null,fabs:null,ord:null,chr:null,hex:null,oct:null,bin:null,dir:null,repr:null,open:null,isinstance:null,hash:null,getattr:null,hasattr:null,id:null,sorted:null,any:null,all:null,enumerate:Sk.builtin.enumerate,filter:Sk.builtin.filter_,map:Sk.builtin.map_,range:Sk.builtin.range_,reversed:Sk.builtin.reversed,zip:Sk.builtin.zip_,BaseException:Sk.builtin.BaseException,AttributeError:Sk.builtin.AttributeError,ArithmeticError:Sk.builtin.ArithmeticError,ValueError:Sk.builtin.ValueError,Exception:Sk.builtin.Exception,ZeroDivisionError:Sk.builtin.ZeroDivisionError,AssertionError:Sk.builtin.AssertionError,ImportError:Sk.builtin.ImportError,ModuleNotFoundError:Sk.builtin.ModuleNotFoundError,IndentationError:Sk.builtin.IndentationError,IndexError:Sk.builtin.IndexError,LookupError:Sk.builtin.LookupError,KeyError:Sk.builtin.KeyError,TypeError:Sk.builtin.TypeError,UnicodeDecodeError:Sk.builtin.UnicodeDecodeError,UnicodeEncodeError:Sk.builtin.UnicodeEncodeError,NameError:Sk.builtin.NameError,UnboundLocalError:Sk.builtin.UnboundLocalError,IOError:Sk.builtin.IOError,NotImplementedError:Sk.builtin.NotImplementedError,SystemExit:Sk.builtin.SystemExit,OverflowError:Sk.builtin.OverflowError,OperationError:Sk.builtin.OperationError,NegativePowerError:Sk.builtin.NegativePowerError,RuntimeError:Sk.builtin.RuntimeError,RecursionError:Sk.builtin.RecursionError,StopIteration:Sk.builtin.StopIteration,SyntaxError:Sk.builtin.SyntaxError,SystemError:Sk.builtin.SystemError,KeyboardInterrupt:Sk.builtin.KeyboardInterrupt,float_$rw$:Sk.builtin.float_,int_$rw$:Sk.builtin.int_,bool:Sk.builtin.bool,complex:Sk.builtin.complex,dict:Sk.builtin.dict,file:Sk.builtin.file,frozenset:Sk.builtin.frozenset,function:Sk.builtin.func,generator:Sk.builtin.generator,list:Sk.builtin.list,long_$rw$:Sk.builtin.lng,method:Sk.builtin.method,object:Sk.builtin.object,slice:Sk.builtin.slice,str:Sk.builtin.str,set:Sk.builtin.set,tuple:Sk.builtin.tuple,type:Sk.builtin.type,input:null,raw_input:new Sk.builtin.func(Sk.builtin.raw_input),setattr:null,jseval:Sk.builtin.jseval,jsmillis:Sk.builtin.jsmillis,quit:new Sk.builtin.func(Sk.builtin.quit),exit:new Sk.builtin.func(Sk.builtin.quit),print:null,divmod:null,format:null,globals:null,issubclass:null,iter:null,execfile:Sk.builtin.execfile,help:Sk.builtin.help,memoryview:Sk.builtin.memoryview,reload:Sk.builtin.reload,super_$rw$:Sk.builtin.super_,unichr:new Sk.builtin.func(Sk.builtin.unichr),vars:Sk.builtin.vars,apply_$rw$:Sk.builtin.apply_,buffer:Sk.builtin.buffer,coerce:Sk.builtin.coerce,intern:Sk.builtin.intern,property:Sk.builtin.property,classmethod:Sk.builtin.classmethod,staticmethod:Sk.builtin.staticmethod,Ellipsis:Sk.builtin.Ellipsis},e=Sk.builtin.none.none$,t=new Sk.builtin.tuple;const r=new Sk.builtin.int_(0);Sk.abstr.setUpModuleMethods("builtins",Sk.builtins,{__import__:{$meth(e,t,i,r,s){if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("__import__() argument 1 must be str, not "+e.tp$name);if(""===e.v&&0===s.v)throw new Sk.builtin.ValueError("Empty module name");return t=n(t,"globals")||{},r=Sk.ffi.remapToJs(r),s=Sk.ffi.remapToJs(s),Sk.builtin.__import__(e,t,void 0,r,s)},$flags:{NamedArgs:["name","globals","locals","fromlist","level"],Defaults:[e,e,t,r]},$textsig:null,$doc:"__import__(name, globals=None, locals=None, fromlist=(), level=0) -> module\n\nImport a module. Because this function is meant for use by the Python\ninterpreter and not for general use, it is better to use\nimportlib.import_module() to programmatically import a module.\n\nThe globals argument is only used to determine the context;\nthey are not modified. The locals argument is unused. The fromlist\nshould be a list of names to emulate ``from name import ...'', or an\nempty list to emulate ``import name''.\nWhen importing a module from a package, note that __import__('A.B', ...)\nreturns package A when fromlist is empty, but its submodule B when\nfromlist is not empty. The level argument is used to determine whether to\nperform absolute or relative imports: 0 is absolute, while a positive number\nis the number of parent directories to search relative to the current module."},abs:{$meth:Sk.builtin.abs,$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the absolute value of the argument."},all:{$meth:Sk.builtin.all,$flags:{OneArg:!0},$textsig:"($module, iterable, /)",$doc:"Return True if bool(x) is True for all values x in the iterable.\n\nIf the iterable is empty, return True."},any:{$meth:Sk.builtin.any,$flags:{OneArg:!0},$textsig:"($module, iterable, /)",$doc:"Return True if bool(x) is True for any x in the iterable.\n\nIf the iterable is empty, return False."},ascii:{$meth:Sk.builtin.ascii,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return an ASCII-only representation of an object.\n\nAs repr(), return a string containing a printable representation of an\nobject, but escape the non-ASCII characters in the string returned by\nrepr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\nto that returned by repr() in Python 2."},bin:{$meth:Sk.builtin.bin,$flags:{OneArg:!0},$textsig:"($module, number, /)",$doc:"Return the binary representation of an integer.\n\n >>> bin(2796202)\n '0b1010101010101010101010'"},callable:{$meth:Sk.builtin.callable,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return whether the object is callable (i.e., some kind of function).\n\nNote that classes are callable, as are instances of classes with a\n__call__() method."},chr:{$meth:Sk.builtin.chr,$flags:{OneArg:!0},$textsig:"($module, i, /)",$doc:"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."},compile:{$meth:Sk.builtin.compile,$flags:{MinArgs:3,MaxArgs:6},$textsig:"($module, /, source, filename, mode, flags=0,\n dont_inherit=False, optimize=-1)",$doc:"Compile source into a code object that can be executed by exec() or eval().\n\nThe source code may represent a Python module, statement or expression.\nThe filename will be used for run-time error messages.\nThe mode must be 'exec' to compile a module, 'single' to compile a\nsingle (interactive) statement, or 'eval' to compile an expression.\nThe flags argument, if present, controls which future statements influence\nthe compilation of the code.\nThe dont_inherit argument, if true, stops the compilation inheriting\nthe effects of any future statements in effect in the code calling\ncompile; if absent or false these statements do influence the compilation,\nin addition to any features explicitly specified."},delattr:{$meth:Sk.builtin.delattr,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, obj, name, /)",$doc:"Deletes the named attribute from the given object.\n\ndelattr(x, 'y') is equivalent to ``del x.y''"},dir:{$meth:Sk.builtin.dir,$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:"dir([object]) -> list of strings\n\nIf called without an argument, return the names in the current scope.\nElse, return an alphabetized list of names comprising (some of) the attributes\nof the given object, and of attributes reachable from it.\nIf the object supplies a method named __dir__, it will be used; otherwise\nthe default dir() logic is used and returns:\n for a module object: the module's attributes.\n for a class object: its attributes, and recursively the attributes\n of its bases.\n for any other object: its attributes, its class's attributes, and\n recursively the attributes of its class's base classes."},divmod:{$meth:Sk.builtin.divmod,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"Return the tuple (x//y, x%y). Invariant: div*y + mod == x."},eval_$rw$:{$name:"eval",$meth:function(e,t,r){const s=n(t,"globals"),o=n(r,"locals");return Sk.misceval.chain(Sk.builtin.eval(e,s,o),(e=>(i(t,s),i(r,o),e)))},$flags:{MinArgs:1,MaxArgs:3},$textsig:"($module, source, globals=None, locals=None, /)",$doc:"Evaluate the given source in the context of globals and locals.\n\nThe source may be a string representing a Python expression\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it."},exec:{$meth:function(e,t,r){const s=n(t,"globals"),o=n(r,"locals");return Sk.misceval.chain(Sk.builtin.exec(e,s,o),(e=>(i(t,s),i(r,o),Sk.builtin.none.none$)))},$flags:{MinArgs:1,MaxArgs:3},$textsig:"($module, source, globals=None, locals=None, /)",$doc:"Execute the given source in the context of globals and locals.\n\nThe source may be a string representing one or more Python statements\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it."},format:{$meth:Sk.builtin.format,$flags:{MinArgs:1,MaxArgs:2},$textsig:"($module, value, format_spec='', /)",$doc:"Return value.__format__(format_spec)\n\nformat_spec defaults to the empty string.\nSee the Format Specification Mini-Language section of help('FORMATTING') for\ndetails."},getattr:{$meth:Sk.builtin.getattr,$flags:{MinArgs:2,MaxArgs:3},$textsig:null,$doc:"getattr(object, name[, default]) -> value\n\nGet a named attribute from an object; getattr(x, 'y') is equivalent to x.y.\nWhen a default argument is given, it is returned when the attribute doesn't\nexist; without it, an exception is raised in that case."},globals:{$meth:Sk.builtin.globals,$flags:{NoArgs:!0},$textsig:"($module, /)",$doc:"Return the dictionary containing the current scope's global variables.\n\nNOTE: Updates to this dictionary *will* affect name lookups in the current\nglobal scope and vice-versa."},hasattr:{$meth:Sk.builtin.hasattr,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, obj, name, /)",$doc:"Return whether the object has an attribute with the given name.\n\nThis is done by calling getattr(obj, name) and catching AttributeError."},hash:{$meth:Sk.builtin.hash,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the hash value for the given object.\n\nTwo objects that compare equal must also have the same hash value, but the\nreverse is not necessarily true."},hex:{$meth:Sk.builtin.hex,$flags:{OneArg:!0},$textsig:"($module, number, /)",$doc:"Return the hexadecimal representation of an integer.\n\n >>> hex(12648430)\n '0xc0ffee'"},id:{$meth:Sk.builtin.id,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the identity of an object.\n\nThis is guaranteed to be unique among simultaneously existing objects.\n(CPython uses the object's memory address.)"},input:{$meth:Sk.builtin.input,$flags:{MinArgs:0,MaxArgs:1},$textsig:"($module, prompt=None, /)",$doc:"Read a string from standard input. The trailing newline is stripped.\n\nThe prompt string, if given, is printed to standard output without a\ntrailing newline before reading input.\n\nIf the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\nOn *nix systems, readline is used if available."},isinstance:{$meth:Sk.builtin.isinstance,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, obj, class_or_tuple, /)",$doc:"Return whether an object is an instance of a class or of a subclass thereof.\n\nA tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\nor ...`` etc."},issubclass:{$meth:Sk.builtin.issubclass,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, cls, class_or_tuple, /)",$doc:"Return whether 'cls' is a derived from another class or is the same class.\n\nA tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\nor ...`` etc."},iter:{$meth:Sk.builtin.iter,$flags:{MinArgs:1,MaxArgs:2},$textsig:"($module, iterable /)",$doc:"iter(iterable) -> iterator\niter(callable, sentinel) -> iterator\n\nGet an iterator from an object. In the first form, the argument must\nsupply its own iterator, or be a sequence.\nIn the second form, the callable is called until it returns the sentinel."},len:{$meth:Sk.builtin.len,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the number of items in a container."},locals:{$meth:Sk.builtin.locals,$flags:{NoArgs:!0},$textsig:"($module, /)",$doc:"Return a dictionary containing the current scope's local variables.\n\nNOTE: Whether or not updates to this dictionary will affect name lookups in\nthe local scope and vice-versa is *implementation dependent* and not\ncovered by any backwards compatibility guarantees."},max:{$meth:Sk.builtin.max,$flags:{FastCall:!0},$textsig:null,$doc:"max(iterable, *[, default=obj, key=func]) -> value\nmax(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its biggest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the largest argument."},min:{$meth:Sk.builtin.min,$flags:{FastCall:!0},$textsig:null,$doc:"min(iterable, *[, default=obj, key=func]) -> value\nmin(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its smallest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the smallest argument."},next:{$name:"next",$meth:Sk.builtin.next_,$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"next(iterator[, default])\n\nReturn the next item from the iterator. If default is given and the iterator\nis exhausted, it is returned instead of raising StopIteration."},oct:{$meth:Sk.builtin.oct,$flags:{OneArg:!0},$textsig:"($module, number, /)",$doc:"Return the octal representation of an integer.\n\n >>> oct(342391)\n '0o1234567'"},open:{$meth:Sk.builtin.open,$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"open(name[, mode[, buffering]]) -> file object\n\nOpen a file using the file() type, returns a file object. This is the\npreferred way to open a file. See file.__doc__ for further information."},ord:{$meth:Sk.builtin.ord,$flags:{OneArg:!0},$textsig:"($module, c, /)",$doc:"Return the Unicode code point for a one-character string."},pow:{$meth:Sk.builtin.pow,$flags:{MinArgs:2,MaxArgs:3},$textsig:"($module, x, y, z=None, /)",$doc:"Equivalent to x**y (with two arguments) or x**y % z (with three arguments)\n\nSome types, such as ints, are able to use a more efficient algorithm when\ninvoked using the three argument form."},print:{$meth:Sk.builtin.print,$flags:{FastCall:!0},$textsig:null,$doc:"print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n\nPrints the values to a stream, or to sys.stdout by default.\nOptional keyword arguments:\nfile: a file-like object (stream); defaults to the current sys.stdout.\nsep: string inserted between values, default a space.\nend: string appended after the last value, default a newline.\nflush: whether to forcibly flush the stream."},repr:{$meth:Sk.builtin.repr,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the canonical string representation of the object.\n\nFor many object types, including most builtins, eval(repr(obj)) == obj."},round:{$meth:Sk.builtin.round,$flags:{NamedArgs:["number","ndigits"]},$textsig:"($module, /, number, ndigits=None)",$doc:"Round a number to a given precision in decimal digits.\n\nThe return value is an integer if ndigits is omitted or None. Otherwise\nthe return value has the same type as the number. ndigits may be negative."},setattr:{$meth:Sk.builtin.setattr,$flags:{MinArgs:3,MaxArgs:3},$textsig:"($module, obj, name, value, /)",$doc:"Sets the named attribute on the given object to the specified value.\n\nsetattr(x, 'y', v) is equivalent to ``x.y = v''"},sorted:{$meth:Sk.builtin.sorted,$flags:{NamedArgs:[null,"cmp","key","reverse"],Defaults:[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.bool.false$]},$textsig:"($module, iterable, /, *, key=None, reverse=False)",$doc:"Return a new list containing all items from the iterable in ascending order.\n\nA custom key function can be supplied to customize the sort order, and the\nreverse flag can be set to request the result in descending order."},sum:{$meth:Sk.builtin.sum,$flags:{NamedArgs:[null,"start"],Defaults:[new Sk.builtin.int_(0)]},$textsig:"($module, iterable, /, start=0)",$doc:"Return the sum of a 'start' value (default: 0) plus an iterable of numbers\n\nWhen the iterable is empty, return the start value.\nThis function is intended specifically for use with numeric values and may\nreject non-numeric types."},vars:{$meth:Sk.builtin.vars,$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:"vars([object]) -> dictionary\n\nWithout arguments, equivalent to locals().\nWith an argument, equivalent to object.__dict__."}}),Sk.setupObjects=function(e){e?(Sk.builtins.filter=Sk.builtin.filter_,Sk.builtins.map=Sk.builtin.map_,Sk.builtins.zip=Sk.builtin.zip_,Sk.builtins.range=Sk.builtin.range_,delete Sk.builtins.reduce,delete Sk.builtins.xrange,delete Sk.builtins.StandardError,delete Sk.builtins.unicode,delete Sk.builtins.basestring,delete Sk.builtins.long_$rw$,Sk.builtin.int_.prototype.$r=function(){return new Sk.builtin.str(this.v.toString())},delete Sk.builtin.int_.prototype.tp$str,delete Sk.builtin.bool.prototype.tp$str,delete Sk.builtins.raw_input,delete Sk.builtins.unichr,delete Sk.builtin.str.prototype.decode,Sk.builtins.bytes=Sk.builtin.bytes,Sk.builtins.ascii=new Sk.builtin.sk_method({$meth:Sk.builtin.ascii,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return an ASCII-only representation of an object.\n\nAs repr(), return a string containing a printable representation of an\nobject, but escape the non-ASCII characters in the string returned by\nrepr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\nto that returned by repr() in Python 2."},null,"builtins")):(Sk.builtins.range=new Sk.builtin.sk_method({$meth:Sk.builtin.range,$name:"range",$flags:{MinArgs:1,MaxArgs:3}},void 0,"builtins"),Sk.builtins.xrange=new Sk.builtin.sk_method({$meth:Sk.builtin.xrange,$name:"xrange",$flags:{MinArgs:1,MaxArgs:3}},null,"builtins"),Sk.builtins.reduce=new Sk.builtin.sk_method({$meth:Sk.builtin.reduce,$name:"reduce",$flags:{MinArgs:2,MaxArgs:3}},null,"builtins"),Sk.builtins.filter=new Sk.builtin.func(Sk.builtin.filter),Sk.builtins.map=new Sk.builtin.func(Sk.builtin.map),Sk.builtins.zip=new Sk.builtin.func(Sk.builtin.zip),Sk.builtins.StandardError=Sk.builtin.Exception,Sk.builtins.unicode=Sk.builtin.str,Sk.builtins.basestring=Sk.builtin.str,Sk.builtins.long_$rw$=Sk.builtin.lng,Sk.builtin.int_.prototype.$r=function(){const e=this.v;return"number"==typeof e?new Sk.builtin.str(e.toString()):new Sk.builtin.str(e.toString()+"L")},Sk.builtin.int_.prototype.tp$str=function(){return new Sk.builtin.str(this.v.toString())},Sk.builtin.bool.prototype.tp$str=function(){return this.$r()},Sk.builtins.raw_input=new Sk.builtin.func(Sk.builtin.raw_input),Sk.builtins.unichr=new Sk.builtin.func(Sk.builtin.unichr),Sk.builtin.str.prototype.decode=Sk.builtin.str.$py2decode,delete Sk.builtins.bytes,delete Sk.builtins.ascii)},Sk.exportSymbol("Sk.setupObjects",Sk.setupObjects),Sk.exportSymbol("Sk.builtins",Sk.builtins)},function(e,t){Sk.builtin.str.$empty=new Sk.builtin.str(""),Sk.builtin.str.$emptystr=Sk.builtin.str.$empty,Sk.builtin.str.$utf8=new Sk.builtin.str("utf-8"),Sk.builtin.str.$ascii=new Sk.builtin.str("ascii"),Sk.builtin.str.$default_factory=new Sk.builtin.str("default_factory"),Sk.builtin.str.$imag=new Sk.builtin.str("imag"),Sk.builtin.str.$real=new Sk.builtin.str("real"),Sk.builtin.str.$abs=new Sk.builtin.str("__abs__"),Sk.builtin.str.$ann=new Sk.builtin.str("__annotations__"),Sk.builtin.str.$bases=new Sk.builtin.str("__bases__"),Sk.builtin.str.$bytes=new Sk.builtin.str("__bytes__"),Sk.builtin.str.$call=new Sk.builtin.str("__call__"),Sk.builtin.str.$class=new Sk.builtin.str("__class__"),Sk.builtin.str.$class_getitem=new Sk.builtin.str("__class_getitem__"),Sk.builtin.str.$cmp=new Sk.builtin.str("__cmp__"),Sk.builtin.str.$complex=new Sk.builtin.str("__complex__"),Sk.builtin.str.$contains=new Sk.builtin.str("__contains__"),Sk.builtin.str.$copy=new Sk.builtin.str("__copy__"),Sk.builtin.str.$dict=new Sk.builtin.str("__dict__"),Sk.builtin.str.$dir=new Sk.builtin.str("__dir__"),Sk.builtin.str.$doc=new Sk.builtin.str("__doc__"),Sk.builtin.str.$enter=new Sk.builtin.str("__enter__"),Sk.builtin.str.$eq=new Sk.builtin.str("__eq__"),Sk.builtin.str.$exit=new Sk.builtin.str("__exit__"),Sk.builtin.str.$index=new Sk.builtin.str("__index__"),Sk.builtin.str.$init=new Sk.builtin.str("__init__"),Sk.builtin.str.$initsubclass=new Sk.builtin.str("__init_subclass__"),Sk.builtin.str.$int_=new Sk.builtin.str("__int__"),Sk.builtin.str.$iter=new Sk.builtin.str("__iter__"),Sk.builtin.str.$file=new Sk.builtin.str("__file__"),Sk.builtin.str.$float_=new Sk.builtin.str("__float__"),Sk.builtin.str.$format=new Sk.builtin.str("__format__"),Sk.builtin.str.$ge=new Sk.builtin.str("__ge__"),Sk.builtin.str.$getattr=new Sk.builtin.str("__getattr__"),Sk.builtin.str.$getattribute=new Sk.builtin.str("__getattribute__"),Sk.builtin.str.$getitem=new Sk.builtin.str("__getitem__"),Sk.builtin.str.$gt=new Sk.builtin.str("__gt__"),Sk.builtin.str.$keys=new Sk.builtin.str("keys"),Sk.builtin.str.$le=new Sk.builtin.str("__le__"),Sk.builtin.str.$len=new Sk.builtin.str("__len__"),Sk.builtin.str.$length_hint=new Sk.builtin.str("__length_hint__"),Sk.builtin.str.$loader=new Sk.builtin.str("__loader__"),Sk.builtin.str.$lt=new Sk.builtin.str("__lt__"),Sk.builtin.str.$module=new Sk.builtin.str("__module__"),Sk.builtin.str.$missing=new Sk.builtin.str("__missing__"),Sk.builtin.str.$name=new Sk.builtin.str("__name__"),Sk.builtin.str.$ne=new Sk.builtin.str("__ne__"),Sk.builtin.str.$new=new Sk.builtin.str("__new__"),Sk.builtin.str.$next=new Sk.builtin.str("__next__"),Sk.builtin.str.$path=new Sk.builtin.str("__path__"),Sk.builtin.str.$prepare=new Sk.builtin.str("__prepare__"),Sk.builtin.str.$qualname=new Sk.builtin.str("__qualname__"),Sk.builtin.str.$repr=new Sk.builtin.str("__repr__"),Sk.builtin.str.$reversed=new Sk.builtin.str("__reversed__"),Sk.builtin.str.$round=new Sk.builtin.str("__round__"),Sk.builtin.str.$setattr=new Sk.builtin.str("__setattr__"),Sk.builtin.str.$setitem=new Sk.builtin.str("__setitem__"),Sk.builtin.str.$slots=new Sk.builtin.str("__slots__"),Sk.builtin.str.$str=new Sk.builtin.str("__str__"),Sk.builtin.str.$setname=new Sk.builtin.str("__set_name__"),Sk.builtin.str.$trunc=new Sk.builtin.str("__trunc__"),Sk.builtin.str.$write=new Sk.builtin.str("write"),Sk.misceval.op2method_={Eq:Sk.builtin.str.$eq,NotEq:Sk.builtin.str.$ne,Gt:Sk.builtin.str.$gt,GtE:Sk.builtin.str.$ge,Lt:Sk.builtin.str.$lt,LtE:Sk.builtin.str.$le}}])}).call(this||window)},54250:(e,t,n)=>{"use strict";n.d(t,{Hh:()=>a,t:()=>l});const i="en",r={};function s(e){return String(e||"").toLowerCase()}let o=s("undefined"!=typeof document&&document.documentElement.lang||"undefined"!=typeof navigator&&navigator.language||i);function a(e){for(const[t,n]of Object.entries(e)){const e=s(t);r[e]=Object.assign(r[e]||{},n)}}function l(e,...t){const n=function(e){for(const t of function(e){const t=[];if(e){t.push(e);const n=e.split("-")[0];n&&n!==e&&t.push(n)}return-1===t.indexOf(i)&&t.push(i),t}(o)){const n=r[t];if(n&&void 0!==n[e])return n[e]}}(e);return void 0===n?e:n.replace(/\$(\d+)/g,((e,n)=>{const i=t[Number(n)-1];return void 0===i?e:String(i)}))}},60893:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var i=n(54250);class r{constructor(e,t){let n=new RegExp("Expected:\\s+(.*?)Actual:\\s+(.*?)Message:\\s+(.*?)Passed:\\s+(true|false)","g");this.textResults="";let r=e.matchAll(n),s=document.createElement("div");s.classList.add("unittest-results");let o=document.createElement("table");o.classList.add("ac-feedback"),s.appendChild(o),s.setAttribute("id",`${t}_unit_results`);let a=document.createElement("tr");a.innerHTML='<th class="ac-feedback">Result</th><th class="ac-feedback">Expected</th><th class="ac-feedback">Actual</th><th class="ac-feedback">Notes</th>',o.appendChild(a);for(const t of r){let n=document.createElement("tr"),r=document.createElement("td");r.classList.add("ac-feedback"),"true"==t[t.length-1]?(r.classList.add("ac-feedback-pass"),r.innerHTML=(0,i.t)("msg_activecode_passed")):(r.classList.add("ac-feedback-fail"),r.innerHTML=(0,i.t)("msg_activecode_failed")),n.appendChild(r),o.appendChild(n);for(let e=1;e<t.length-1;e++){let i=document.createElement("td");i.innerHTML=t[e],i.classList.add("ac-feedback"),n.appendChild(i)}o.appendChild(n),this.table=s,this.textResults+=t[0]+"\n",e=e.replace(t[0],"")}let l=e.match(/You got\s+(\d+) out of (\d+) correct.\s+(\d+\.\d+)%/);if(l){e=e.replace(l[0],"");let t=document.createElement("span");t.innerHTML=l[0],this.pctString=t,this.pct=l[3],this.passed=l[1],this.failed=l[2]-l[1]}e=(e=(e=(e=(e=e.replace("Starting Tests","")).replace("Ending Tests","")).replace(/\n/g,"<br>")).replace(/(<br>)+/g,"<br>")).replaceAll("&lt;img","<img"),this.stdout=e}}},65678:()=>{},67476:()=>{},67920:()=>{},73565:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>v});var i=n(12477),r=n(29184),s=n(54250);class o extends i.K{constructor(e){super(e),this.runButton.textContent="Render",this.editor.setValue(this.code),this._messageHandler=null}async runProg(){if(this.saveCode=await this.manage_scrubber("True"),this.outDiv.style.visibility="visible",this.suffix){const t=e=await this.buildProg(!1);this.testResultsDiv.innerHTML="",this.testResultsDiv.style.display="none",this._messageHandler&&window.removeEventListener("message",this._messageHandler),this._messageHandler=e=>{e.data&&"rsTestResults"===e.data.type&&e.source===this.output.contentWindow&&(this.displayTestResults(e.data.results),window.removeEventListener("message",this._messageHandler),this._messageHandler=null)},window.addEventListener("message",this._messageHandler),e="<script type=text/javascript>window.onerror = function(msg,url,line) {alert(msg+' on line: '+line);};<\/script>"+e+this._testHarnessScript(t)+`<script type=text/javascript>\nwindow.addEventListener('load', function() {\ntry {\n${this.suffix}\n} catch(e) { window.__rsTestError(e); }\n__rsRunTests();\n});\n<\/script>`}else{var e;e="<script type=text/javascript>window.onerror = function(msg,url,line) {alert(msg+' on line: '+line);};<\/script>"+(e=await this.buildProg(!0))}if(this.output.textContent="",this.output.srcdoc=e,this.unit_results){let e={act:this.unit_results,div_id:this.divid,event:"unittest"};"undefined"!=typeof sid&&(e.sid=sid),this.logBookEvent(e)}}_testHarnessScript(e){return`<script type=text/javascript>\n(function() {\n var __rsRawHtmlSource = ${JSON.stringify(e||"").replace(/<\//g,"<\\/")};\n var __rsResults = [];\n\n function __pass(msg) { __rsResults.push({ pass: true, message: msg }); }\n function __fail(msg) { __rsResults.push({ pass: false, message: msg }); }\n\n window.__rsTestError = function(e) {\n __fail("Test error: " + e.message);\n };\n\n window.assertExists = function(selector, msg) {\n msg = msg || ("Element '" + selector + "' exists");\n if (document.querySelector(selector)) { __pass(msg); }\n else { __fail(msg + " — not found"); }\n };\n\n window.assertNotExists = function(selector, msg) {\n msg = msg || ("Element '" + selector + "' does not exist");\n if (!document.querySelector(selector)) { __pass(msg); }\n else { __fail(msg + " — unexpectedly found"); }\n };\n\n window.assertText = function(selector, expected, msg) {\n msg = msg || ("'" + selector + "' text equals '" + expected + "'");\n var el = document.querySelector(selector);\n if (!el) { __fail(msg + " — element not found"); return; }\n var actual = el.textContent.trim();\n if (actual === String(expected)) { __pass(msg); }\n else { __fail(msg + " — got '" + actual + "'"); }\n };\n\n window.assertContainsText = function(selector, expected, msg) {\n msg = msg || ("'" + selector + "' contains '" + expected + "'");\n var el = document.querySelector(selector);\n if (!el) { __fail(msg + " — element not found"); return; }\n if (el.textContent.includes(expected)) { __pass(msg); }\n else { __fail(msg + " — got '" + el.textContent.trim() + "'"); }\n };\n\n window.assertCount = function(selector, expected, msg) {\n msg = msg || ("'" + selector + "' count equals " + expected);\n var actual = document.querySelectorAll(selector).length;\n if (actual === expected) { __pass(msg); }\n else { __fail(msg + " — got " + actual); }\n };\n\n window.assertStyle = function(selector, property, expected, msg) {\n msg = msg || ("'" + selector + "' style." + property + " is '" + expected + "'");\n var el = document.querySelector(selector);\n if (!el) { __fail(msg + " — element not found"); return; }\n var actual = window.getComputedStyle(el)[property];\n if (actual === expected) { __pass(msg); }\n else { __fail(msg + " — got '" + actual + "'"); }\n };\n\n window.assertAttribute = function(selector, attr, expected, msg) {\n msg = msg || ("'" + selector + "' [" + attr + "] is '" + expected + "'");\n var el = document.querySelector(selector);\n if (!el) { __fail(msg + " — element not found"); return; }\n var actual = el.getAttribute(attr);\n if (actual === expected) { __pass(msg); }\n else { __fail(msg + " — got '" + actual + "'"); }\n };\n\n window.assertEqual = function(actual, expected, msg) {\n msg = msg || ("Expected '" + expected + "'");\n if (actual === expected) { __pass(msg); }\n else { __fail(msg + " — got '" + actual + "'"); }\n };\n\n window.assertNotEqual = function(actual, expected, msg) {\n msg = msg || ("Expected value not equal to '" + expected + "'");\n if (actual !== expected) { __pass(msg); }\n else { __fail(msg + " — got '" + actual + "'"); }\n };\n\n window.assertValidHTML = function(msg) {\n msg = msg || "Document has properly nested HTML tags";\n try {\n var html = __rsRawHtmlSource || "";\n var voidTags = new Set([\n "area", "base", "br", "col", "embed", "hr", "img", "input",\n "link", "meta", "param", "source", "track", "wbr",\n ]);\n var validTags = new Set([\n "a", "abbr", "address", "article", "aside", "audio", "b", "base",\n "bdi", "bdo", "blockquote", "body", "br", "button", "canvas",\n "caption", "cite", "code", "col", "colgroup", "data", "datalist",\n "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em",\n "embed", "fieldset", "figcaption", "figure", "footer", "form",\n "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup",\n "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label",\n "legend", "li", "link", "main", "map", "mark", "menu", "meta",\n "meter", "nav", "noscript", "object", "ol", "optgroup", "option",\n "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby",\n "s", "samp", "script", "search", "section", "select", "slot", "small",\n "source", "span", "strong", "style", "sub", "summary", "sup", "table",\n "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time",\n "title", "tr", "track", "u", "ul", "var", "video", "wbr",\n // Common deprecated tags still seen in instructional content.\n "acronym", "applet", "basefont", "big", "center", "font", "frame",\n "frameset", "marquee", "noframes", "strike", "tt",\n // Common SVG/MathML container/content tags.\n "svg", "g", "path", "circle", "rect", "line", "polyline", "polygon",\n "ellipse", "text", "defs", "lineargradient", "radialgradient", "stop",\n "clippath", "mask", "pattern", "symbol", "use", "view", "math", "mrow",\n "mi", "mn", "mo", "msup", "msub", "msubsup", "mfrac", "msqrt", "mroot",\n ]);\n\n // Ignore regions where '<' is common text, not markup.\n var sanitized = html\n .replace(/\x3c!--[\\s\\S]*?--\x3e/g, "")\n .replace(/<!DOCTYPE[^>]*>/gi, "")\n .replace(/<!\\[CDATA\\[[\\s\\S]*?\\]\\]>/g, "")\n .replace(/<script\\b[^>]*>[\\s\\S]*?<\\/script\\s*>/gi, "")\n .replace(/<style\\b[^>]*>[\\s\\S]*?<\\/style\\s*>/gi, "")\n .replace(/<textarea\\b[^>]*>[\\s\\S]*?<\\/textarea\\s*>/gi, "");\n\n var tagRe = /<\\/?([a-zA-Z][\\w:-]*)(\\s[^>]*?)?>/g;\n var stack = [];\n var match;\n\n while ((match = tagRe.exec(sanitized)) !== null) {\n var fullTag = match[0];\n var name = match[1].toLowerCase();\n var isClosing = fullTag[1] === "/";\n var isCustomElement = /^[a-z][a-z0-9._-]*-[a-z0-9._-]*$/.test(name);\n\n if (!validTags.has(name) && !isCustomElement) {\n __fail(msg + " — invalid tag name <" + (isClosing ? "/" : "") + name + ">"\n );\n return;\n }\n\n if (isClosing) {\n if (stack.length === 0) {\n __fail(msg + " — unexpected closing tag </" + name + ">");\n return;\n }\n var openTag = stack.pop();\n if (openTag.name !== name) {\n __fail(\n msg +\n " — mismatched closing tag </" +\n name +\n "> for <" +\n openTag.name +\n ">",\n );\n return;\n }\n } else {\n var isSelfClosing = /\\/\\s*>$/.test(fullTag) || voidTags.has(name);\n if (!isSelfClosing) {\n stack.push({ name: name });\n }\n }\n }\n\n if (stack.length > 0) {\n var unclosed = stack\n .slice(-3)\n .map(function (t) {\n return "<" + t.name + ">";\n })\n .join(", ");\n __fail(msg + " — unclosed tag(s): " + unclosed);\n return;\n }\n\n __pass(msg);\n } catch (e) {\n __fail(msg + " — " + e.message);\n }\n };\n \n\n window.__rsRunTests = function() {\n window.parent.postMessage({ type: "rsTestResults", results: __rsResults }, "*");\n };\n})();\n<\/script>`}displayTestResults(e){var t=e.filter((function(e){return e.pass})).length,n=e.length;if(0!==n){var i=Math.round(t/n*100);this.unit_results=`percent:${i}:passed:${t}:failed:${n-t}`;var r=this.testResultsDiv;r.innerHTML="";var s=document.createElement("table");s.className="ac-feedback",s.style.width="100%",e.forEach((function(e){var t=document.createElement("tr"),n=document.createElement("td");n.className="ac-feedback "+(e.pass?"ac-feedback-pass":"ac-feedback-fail"),n.textContent=(e.pass?"✓ ":"✗ ")+e.message,t.appendChild(n),s.appendChild(t)}));var o=document.createElement("p");o.className="ac-feedback "+(t===n?"ac-feedback-pass":"ac-feedback-fail"),o.style.textAlign="center",o.style.marginTop="4px",o.textContent=t+" of "+n+" test"+(1!==n?"s":"")+" passed",r.appendChild(s),r.appendChild(o),r.style.display="block"}}createOutput(){var e=document.createElement("div");e.classList.add("ac_output"),this.outDiv=e,this.output=document.createElement("iframe"),this.output.style.backgroundColor="white",this.output.style.position="relative",this.output.style.height="400px",this.output.style.width="100%",e.appendChild(this.output),this.testResultsDiv=document.createElement("div"),this.testResultsDiv.className="unittest-results",this.testResultsDiv.style.display="none",e.appendChild(this.testResultsDiv),this.outerDiv.appendChild(e);var t=document.createElement("div");t.style.clear="both",this.outerDiv.appendChild(t)}enableSaveLoad(){this.runButton.textContent=(0,s.t)("msg_activecode_render")}}var a=n(34089),l=n(12307),u=n(15826),c=n.n(u),d={};class f extends i.K{constructor(e){var t,n;super(e),eBookConfig.useRunestoneServices||window.location.search.includes("mode=browsing")?(t=`/ns/books/published/${eBookConfig.basecourse}`,n=t+"/_static"):n="_static",this.config={locateFile:e=>`${n}/${e}`},this.showLast=(0,a.Qt)(this.origElem,"showlastsql");var i=this;c()(this.config).then((function(e){if(i.dburl){i.dburl.startsWith("/_static")?i.dburl=`${t}${i.dburl}`:i.dburl.startsWith("external")&&(eBookConfig.useRunestoneServices||window.location.search.includes("mode=browsing")?i.dburl=`${t}/${i.dburl}`:i.dburl=`${i.dburl}`),i.runButton.disabled=!0;let r=i.runButton.textContent;if(i.runButton.textContent=(0,s.t)("msg_activecode_load_db"),i.dburl in d)return"loading"==d[i.dburl].status?void d[i.dburl].xWaitFor.then((function(){i.db=d[i.dburl].dbObject,i.runButton.disabled=!1,i.runButton.textContent=r})):(i.db=d[i.dburl].dbObject,i.runButton.disabled=!1,void(i.runButton.textContent=r));{let e,t=new Promise((t=>{e=t}));d[i.dburl]={status:"loading",xWaitFor:t,resolveWait:e}}var n=new XMLHttpRequest;n.open("GET",i.dburl,!0),n.responseType="arraybuffer",n.onload=t=>{var s=new Uint8Array(n.response);i.db=new e.Database(s),d[i.dburl].dbObject=i.db,i.runButton.textContent=r,i.runButton.disabled=!1,d[i.dburl].db=s,d[i.dburl].status="ready",d[i.dburl].resolveWait()},n.send()}else i.db=new e.Database}))}async runProg(e,t){this.logResults=void 0===t||t,"boolean"!=typeof e&&(e=!1),this.saveCode="True";let n=this.divid+"_sql_out",i=document.getElementById(n);i&&i.parentElement.removeChild(i),this.output.textContent="";let r=await this.buildProg(!1);if(!this.db)return void(this.output.textContent=`Error: Database not initialized! DBURL: ${this.dburl}`);let s=this.db.iterateStatements(r);this.results=[];try{for(let e of s){let t=e.getColumnNames();if(t.length>0){let n=[];for(;e.step();)n.push(e.get());this.results.push({status:"success",columns:t,values:n,rowcount:n.length})}else{let t=e.getNormalizedSQL().substr(0,6).toLowerCase();e.step(),"insert"===t||"update"===t||"delete"===t?this.results.push({status:"success",operation:t,rowcount:this.db.getRowsModified()}):this.results.push({status:"success"})}}}catch(e){this.results.push({status:"failure",message:e.toString(),sql:s.getRemainingSQL()})}0===this.results.length&&this.results.push({status:"failure",message:"No queries submitted."});try{this.saveCode=await this.manage_scrubber(this.saveCode),this.historyScrubber&&(this.historyScrubber.disabled=!1)}catch(e){console.log(`Failed to update scrubber ${e}`)}i=document.createElement("div"),i.id=n,this.outDiv.appendChild(i),this.outDiv.style.visibility="visible";let o=this.results;this.showLast&&(o=this.results.slice(-1));for(let e of o){let t=document.createElement("div");if(t.setAttribute("class","ac_sql_result"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("role","log"),i.appendChild(t),"success"===e.status)if(e.columns){let n=document.createElement("div");t.appendChild(n);let i=350;o.length>1&&(i=200),h(e,n,i);let r=document.createElement("pre"),s=1!==e.rowcount?" rows ":" row ",a=""+e.rowcount+s+"returned";e.rowcount>100&&(a+=" (only first 100 rows displayed)"),a+=".",r.textContent=a,r.setAttribute("class","ac_sql_result_success"),t.appendChild(r)}else if(e.rowcount){let n=document.createElement("pre"),i=e.operation;i+="e"===i.charAt(i.length-1)?"d.":"ed.";let r=1!==e.rowcount?" rows ":" row ";n.textContent=""+e.rowcount+r+i,n.setAttribute("class","ac_sql_result_success"),t.appendChild(n)}else{let e=document.createElement("pre");e.textContent="Operation succeeded.",e.setAttribute("class","ac_sql_result_success"),t.appendChild(e)}else{let n=document.createElement("pre");n.textContent=e.message,t.classList.add("ac_sql_result_failure"),setTimeout((()=>{t.appendChild(n)}),10)}}return this.suffix?this.testResult=this.autograde(this.results[this.results.length-1]):this.output.style.visibility="hidden",Promise.resolve("done")}async logCurrentAnswer(e){let t={div_id:this.divid,code:this.editor.getValue(),language:this.language,errinfo:this.results[this.results.length-1].status,to_save:this.saveCode,prefix:this.pretext,suffix:this.suffix,partner:this.partner};if(void 0!==e&&(t.sid=e),await this.logRunEvent(t),this.unit_results){let t={event:"unittest",div_id:this.divid,course:eBookConfig.course,act:this.unit_results};void 0!==e&&(t.sid=e),await this.logBookEvent(t)}}renderFeedback(){this.testResult&&(this.output.textContent=this.testResult,this.output.style.visibility="visible")}autograde(e){var t=this.suffix.split(/\n/);this.passed=0,this.failed=0;var n="";t=t.filter((function(e){return e.indexOf("assert")>-1}));for(let i of t){let t=i.split(/\s+/);t.shift();let r=t.shift(),s=t.shift(),o=t.join(" "),[a,l]=r.split(",");n+=this.testOneAssert(a,l,s,o,e),n+="\n"}let i=100*this.passed/(this.passed+this.failed);return isNaN(i)&&(i=0),i=i.toLocaleString(void 0,{maximumFractionDigits:2}),n+=`You passed ${this.passed} out of ${this.passed+this.failed} tests for ${i}%`,this.unit_results=`percent:${i}:passed:${this.passed}:failed:${this.failed}`,n}testOneAssert(e,t,n,i,r){let s,o="";try{s=r.values[e][t]}catch(n){return o=`Failed Not enough data to check row ${e} or column ${t}`,this.failed++,o}return{"==":function(e,t){return e==t},"!=":function(e,t){return e!=t},">":function(e,t){return e>t},"<":function(e,t){return e>t}}[n](s,i)?(o=`Pass: ${s} ${n} ${i} in row ${e} column ${r.columns[t]}`,this.passed++):(o=`Failed ${s} ${n} ${i} in row ${e} column ${r.columns[t]}`,this.failed++),o}}function h(e,t,n){let i,r=e.values;0===r.length&&(r=[e.columns.map((e=>null))],i=[0]);var s=new l.A(t,{data:r,trimRows:i,width:"100%",height:n,autoRowSize:!0,autoColumnSize:{useHeaders:!0},rowHeaders:!1,colHeaders:e.columns,editor:!1,maxRows:100,filters:!1,dropdownMenu:!1,licenseKey:"non-commercial-and-evaluation"});let o=40;if(e.values.length>0)for(let e=0;e<r.length&&(o+=s.getRowHeight(e),!(o>n));e++);return s.updateSettings({height:o}),s}var p,m=n(99872),_={timedInit:async function(e){return this.isTimed=!0,this.hideButtons(),this.needsReinitialization=!0,this.containerDiv.classList.add("timedComponent"),window.componentMap[this.divid]=this,!0},hideButtons:function(){for(var e=[this.saveButton,this.loadButton,this.gradeButton,this.showHideButt,this.coachButton,this.atButton],t=0;t<e.length;t++)void 0!==e[t]&&null!==e[t]&&(e[t].style.display="none")},renderTimedIcon:function(e){var t=document.createElement("div"),n=document.createElement("img");n.setAttribute("src","../_static/clock.png"),n.setAttribute("style","width:15px;height:15px"),t.className="timeTip",t.title="",t.appendChild(n),e.prepend(t)},checkCorrectTimed:function(){return this.isAnswered?this.pct_correct>=100?"T":"F":"I"},hideFeedback:function(){this.output.style.visibility="hidden"},reinitializeListeners:function(e){if(this.runButton.onclick||(console.log("reattaching runbuttonhandler"),this.runButton.onclick=this.runButtonHander.bind(this)),this.codeDiv.style.display="",this.runButton.disabled=!1,this.codeDiv.classList.remove("ac-disabled"),this.editor.refresh(),null!==this.historyScrubber&&(this.historyScrubber.max=this.history.length-1,this.historyScrubber.value=this.history.length-1,this.slideit(null)),e){let e=document.getElementById(`${this.divid}_unit_results`);e&&(e.style.display="")}}};class b extends m.A{constructor(e){super(e),this.timedInit(e)}}Object.assign(b.prototype,_);class g extends i.K{constructor(e){super(e),this.timedInitComplete=this.timedInit(e)}async checkCurrentAnswer(){await this.timedInitComplete,this.isAnswered&&await this.runProg(!0,!1)}}Object.assign(g.prototype,_);class k extends r.A{constructor(e){super(e),this.timedInit(e)}}Object.assign(k.prototype,_);class S extends o{constructor(e){super(e),this.timedInit(e)}}Object.assign(S.prototype,_);class y extends f{constructor(e){super(e),this.timedInit(e)}}Object.assign(y.prototype,_);class v{constructor(){this.foo="bar"}static createActiveCode(e,t,n){var s={orig:e,useRunestoneServices:eBookConfig.useRunestoneServices,python3:eBookConfig.python3};if(n)for(var a in n)s[a]=n[a];if(void 0===t){let e=s.orig.querySelector("[data-lang]");t=e?e.dataset.lang:void 0}return 1==s.timed?"python"===t?new g(s):"java"===t||"cpp"===t||"c"===t||"python3"===t?new b(s):"javascript"===t?new k(s):"htmlmixed"===t||"html"===t?new S(s):"sql"===t?new y(s):new g(s):"javascript"===t?new r.A(s):"htmlmixed"===t||"html"===t?new o(s):"sql"===t?new f(s):["java","cpp","c","python3","python2","octave","kotlin"].indexOf(t)>-1?new m.A(s):new i.K(s)}static addActiveCodeToDiv(e,t,n,i,r){var s=document.getElementById(t);s.innerHTML="";var o=document.createElement("textarea");o["data-component"]="activecode",o.id=e,o.dataset.lang=r,s.appendChild(o);var a={sid:n,graderactive:!0},l=v.createActiveCode(o,r,a),u=l.divid;l.divid=u,l.editor.setSize(500,300),setTimeout((function(){l.editor.refresh()}),500)}static createActiveCodeFromOpts(e){return v.createActiveCode(e.orig,e.lang,e)}static createScratchActivecode(){if(0==eBookConfig.enableScratchAC)return;var e=eBookConfig.course+"_scratch_ac";e=e.replace(/[#.]/g,""),eBookConfig.scratchDiv=e;let t="";var n=eBookConfig.acDefaultLanguage?eBookConfig.acDefaultLanguage:"python";"java"!==n&&"cpp"!==n&&"python3"!==n||(t='data-stdin="text for stdin"');var r=`<div class="ptx-runestone-container">\n <div id="ac_modal_${e}" class="scratch-ac-modal">\n <div class="ac-modal-content">\n <div class="ac-modal-header">\n <button type="button" class="close first-focusable" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>\n <h4 class="ac-modal-title">Scratch ActiveCode (${{cpp:"C++",c:"C",html:"HTML",htmlmixed:"HTML",java:"Java",javascript:"JavaScript",js:"JavaScript",kotlin:"Kotlin",octave:"Octave",python:"Python",py2:"Python 2",python2:"Python 2",py3:"Python 3",py3anaconda:"Python 3 with Anaconda",python3:"Python 3",ruby:"Ruby",sql:"SQL",ts:"TypeScript"}[n.toLowerCase()]||n})</h4>\n </div>\n <div class="ac-modal-body">\n <div data-component="activecode" id=${e}>\n <div id=${e}_question class="ac_question"><p>Use this area for writing code or taking notes.</p></div>\n <textarea data-codelens="true" data-lang="${n}" ${t} aria-label="Scratch ActiveCode">\n </textarea>\n </div>\n </div>\n </div>\n </div>\n </div>`,s=document.createElement("div");s.innerHTML=r,document.body.appendChild(s);let o=document.getElementById("ac_modal_"+e);new MutationObserver((e=>{e.forEach((e=>{"style"!==e.attributeName&&"class"!==e.attributeName||(0,i.c)(o)&&o.querySelectorAll(".CodeMirror").forEach((function(e){e.CodeMirror.refresh()}))}))})).observe(o,{attributes:!0,attributeFilter:["style","class"]}),document.querySelector(".ac-modal-header button.close").addEventListener("click",(function(){document.getElementById("ac_modal_"+e).style.display="none",document.querySelector(".activecode-toggle").focus()}))}static toggleScratchActivecode(){if(!eBookConfig.enableScratchAC)return;var e="ac_modal_"+eBookConfig.scratchDiv,t=document.getElementById(e);t.classList.remove("ac_section"),t.style.display="none"===t.style.display||""===t.style.display?"block":"none";const n='.first-focusable, button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';let i=t.querySelector(n),r=t.querySelectorAll(n),s=r[r.length-1];t.addEventListener("keydown",(e=>{"Tab"===e.key?(i=t.querySelector(n),r=t.querySelectorAll(n),s=r[r.length-1],e.shiftKey?document.activeElement===i&&(e.preventDefault(),s.focus()):document.activeElement===s&&(e.preventDefault(),i.focus())):"Escape"===e.key&&(t.style.display="none",document.querySelector(".activecode-toggle").focus())})),i&&(console.log(`focus on ${i}`),i.focus())}}document.addEventListener("runestone:login-complete",(function(){if(v.createScratchActivecode(),document.querySelectorAll("[data-component='activecode']").forEach((function(e){if(null===e.closest("[data-component='timedAssessment']"))try{let t=e.querySelector("textarea");window.componentMap[e.id]=v.createActiveCode(e,t?t.dataset.lang:null)}catch(t){console.error(`Error rendering Activecode Problem ${e.id}\n Details: ${t}`),console.error(t.stack)}})),p)for(let e in window.componentMap)window.componentMap[e].disableSaveLoad&&window.componentMap[e].disableSaveLoad();else for(let e in window.componentMap)window.componentMap[e].enableSaveLoad&&window.componentMap[e].enableSaveLoad()})),void 0===window.component_factory&&(window.component_factory={}),window.component_factory.activecode=v.createActiveCodeFromOpts,window.ACFactory=v,document.addEventListener("runestone:logout",(function(){p=!0})),document.addEventListener("runestone:logout",(function(){for(let e in window.componentMap)window.componentMap.hasOwnProperty(e)&&"activecode"==window.componentMap[e].attributes["data-component"]&&window.componentMap[e].disableSaveLoad()}))},97887:(e,t,n)=>{"use strict";function i(e){function t(e,t){return e<<t|e>>>32-t}function n(e,t){var n,i,r,s,o;return r=2147483648&e,s=2147483648&t,o=(1073741823&e)+(1073741823&t),(n=1073741824&e)&(i=1073741824&t)?2147483648^o^r^s:n|i?1073741824&o?3221225472^o^r^s:1073741824^o^r^s:o^r^s}function i(e,i,r,s,o,a,l){return e=n(e,n(n(function(e,t,n){return e&t|~e&n}(i,r,s),o),l)),n(t(e,a),i)}function r(e,i,r,s,o,a,l){return e=n(e,n(n(function(e,t,n){return e&n|t&~n}(i,r,s),o),l)),n(t(e,a),i)}function s(e,i,r,s,o,a,l){return e=n(e,n(n(function(e,t,n){return e^t^n}(i,r,s),o),l)),n(t(e,a),i)}function o(e,i,r,s,o,a,l){return e=n(e,n(n(function(e,t,n){return t^(e|~n)}(i,r,s),o),l)),n(t(e,a),i)}function a(e){var t,n="",i="";for(t=0;t<=3;t++)n+=(i="0"+(e>>>8*t&255).toString(16)).substr(i.length-2,2);return n}var l,u,c,d,f,h,p,m,_,b=Array();for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t+=String.fromCharCode(i):i>127&&i<2048?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(63&i|128)):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(63&i|128))}return t}(e),b=function(e){for(var t,n=e.length,i=n+8,r=16*((i-i%64)/64+1),s=Array(r-1),o=0,a=0;a<n;)o=a%4*8,s[t=(a-a%4)/4]=s[t]|e.charCodeAt(a)<<o,a++;return o=a%4*8,s[t=(a-a%4)/4]=s[t]|128<<o,s[r-2]=n<<3,s[r-1]=n>>>29,s}(e),h=1732584193,p=4023233417,m=2562383102,_=271733878,l=0;l<b.length;l+=16)u=h,c=p,d=m,f=_,h=i(h,p,m,_,b[l+0],7,3614090360),_=i(_,h,p,m,b[l+1],12,3905402710),m=i(m,_,h,p,b[l+2],17,606105819),p=i(p,m,_,h,b[l+3],22,3250441966),h=i(h,p,m,_,b[l+4],7,4118548399),_=i(_,h,p,m,b[l+5],12,1200080426),m=i(m,_,h,p,b[l+6],17,2821735955),p=i(p,m,_,h,b[l+7],22,4249261313),h=i(h,p,m,_,b[l+8],7,1770035416),_=i(_,h,p,m,b[l+9],12,2336552879),m=i(m,_,h,p,b[l+10],17,4294925233),p=i(p,m,_,h,b[l+11],22,2304563134),h=i(h,p,m,_,b[l+12],7,1804603682),_=i(_,h,p,m,b[l+13],12,4254626195),m=i(m,_,h,p,b[l+14],17,2792965006),h=r(h,p=i(p,m,_,h,b[l+15],22,1236535329),m,_,b[l+1],5,4129170786),_=r(_,h,p,m,b[l+6],9,3225465664),m=r(m,_,h,p,b[l+11],14,643717713),p=r(p,m,_,h,b[l+0],20,3921069994),h=r(h,p,m,_,b[l+5],5,3593408605),_=r(_,h,p,m,b[l+10],9,38016083),m=r(m,_,h,p,b[l+15],14,3634488961),p=r(p,m,_,h,b[l+4],20,3889429448),h=r(h,p,m,_,b[l+9],5,568446438),_=r(_,h,p,m,b[l+14],9,3275163606),m=r(m,_,h,p,b[l+3],14,4107603335),p=r(p,m,_,h,b[l+8],20,1163531501),h=r(h,p,m,_,b[l+13],5,2850285829),_=r(_,h,p,m,b[l+2],9,4243563512),m=r(m,_,h,p,b[l+7],14,1735328473),h=s(h,p=r(p,m,_,h,b[l+12],20,2368359562),m,_,b[l+5],4,4294588738),_=s(_,h,p,m,b[l+8],11,2272392833),m=s(m,_,h,p,b[l+11],16,1839030562),p=s(p,m,_,h,b[l+14],23,4259657740),h=s(h,p,m,_,b[l+1],4,2763975236),_=s(_,h,p,m,b[l+4],11,1272893353),m=s(m,_,h,p,b[l+7],16,4139469664),p=s(p,m,_,h,b[l+10],23,3200236656),h=s(h,p,m,_,b[l+13],4,681279174),_=s(_,h,p,m,b[l+0],11,3936430074),m=s(m,_,h,p,b[l+3],16,3572445317),p=s(p,m,_,h,b[l+6],23,76029189),h=s(h,p,m,_,b[l+9],4,3654602809),_=s(_,h,p,m,b[l+12],11,3873151461),m=s(m,_,h,p,b[l+15],16,530742520),h=o(h,p=s(p,m,_,h,b[l+2],23,3299628645),m,_,b[l+0],6,4096336452),_=o(_,h,p,m,b[l+7],10,1126891415),m=o(m,_,h,p,b[l+14],15,2878612391),p=o(p,m,_,h,b[l+5],21,4237533241),h=o(h,p,m,_,b[l+12],6,1700485571),_=o(_,h,p,m,b[l+3],10,2399980690),m=o(m,_,h,p,b[l+10],15,4293915773),p=o(p,m,_,h,b[l+1],21,2240044497),h=o(h,p,m,_,b[l+8],6,1873313359),_=o(_,h,p,m,b[l+15],10,4264355552),m=o(m,_,h,p,b[l+6],15,2734768916),p=o(p,m,_,h,b[l+13],21,1309151649),h=o(h,p,m,_,b[l+4],6,4149444226),_=o(_,h,p,m,b[l+11],10,3174756917),m=o(m,_,h,p,b[l+2],15,718787259),p=o(p,m,_,h,b[l+9],21,3951481745),h=n(h,u),p=n(p,c),m=n(m,d),_=n(_,f);return(a(h)+a(p)+a(m)+a(_)).toLowerCase()}n.d(t,{A:()=>i})},99872:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{A:()=>LiveCode});var _activecode_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(12477),_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(54250),_common_js_domutil_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(34089),_md5_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(97887),_extractUnitResults_JUnit_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(60893),_extractUnitResults_Doctest_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(30691),_codelens_js_pytutor_embed_bundle_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(60764),_codelens_js_pytutor_embed_bundle_js__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(_codelens_js_pytutor_embed_bundle_js__WEBPACK_IMPORTED_MODULE_5__),byte_base64__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(96042);class LiveCode extends _activecode_js__WEBPACK_IMPORTED_MODULE_0__.K{constructor(e){var t=e.orig.querySelector("textarea");super(e),this.stdin=(0,_common_js_domutil_js__WEBPACK_IMPORTED_MODULE_2__.Qt)(t,"stdin"),this.additional_files=(0,_common_js_domutil_js__WEBPACK_IMPORTED_MODULE_2__.Qt)(t,"add-files"),this.datafiles=(0,_common_js_domutil_js__WEBPACK_IMPORTED_MODULE_2__.Qt)(t,"datafile"),this.sourcefile=(0,_common_js_domutil_js__WEBPACK_IMPORTED_MODULE_2__.Qt)(t,"sourcefile"),this.compileargs=unescapeHtml((0,_common_js_domutil_js__WEBPACK_IMPORTED_MODULE_2__.Qt)(t,"compileargs"))||"",this.compileAlso=unescapeHtml((0,_common_js_domutil_js__WEBPACK_IMPORTED_MODULE_2__.Qt)(t,"compile-also")),this.linkargs=unescapeHtml((0,_common_js_domutil_js__WEBPACK_IMPORTED_MODULE_2__.Qt)(t,"linkargs")),this.runargs=unescapeHtml((0,_common_js_domutil_js__WEBPACK_IMPORTED_MODULE_2__.Qt)(t,"runargs")),this.interpreterargs=unescapeHtml((0,_common_js_domutil_js__WEBPACK_IMPORTED_MODULE_2__.Qt)(t,"interpreterargs")),this.API_KEY="67033pV7eUUvqo07OJDIV8UZ049aLEK1",this.USE_API_KEY=!0,this.JOBE_SERVER=eBookConfig.jobehost||eBookConfig.host,this.resource=eBookConfig.proxyuri_runs||"/ns/rsproxy/jobeRun",this.jobePutFiles=eBookConfig.proxyuri_files||"/ns/rsproxy/jobePushFile/",this.jobeCheckFiles=eBookConfig.proxyuri_files||"/ns/rsproxy/jobeCheckFile/",this.div2id={},void 0!==this.stdin&&this.createInputElement(),this.createErrorOutput()}outputfun(e){}createInputElement(){let e=document.createElement("div");var t=document.createElement("label");t.for=this.divid+"_stdin",t.textContent=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_input_prg");var n=document.createElement("textarea");n.id=this.divid+"_stdin",n.classList.add("activecode__stdin"),n.value=this.stdin,n.setAttribute("rows","3"),this.outerDiv.appendChild(e),e.appendChild(t),e.appendChild(n),this.stdin_el=n}createErrorOutput(){}getCombinedSuffixes(){return this.suffix&&this.visibleSuffix?this.suffix+this.visibleSuffix:this.suffix?this.suffix:this.visibleSuffix?this.visibleSuffix:""}hasUnitTests(){let e=this.getCombinedSuffixes();return"java"===this.language?e.indexOf("import org.junit")>-1:"cpp"===this.language&&(e.indexOf("doctest.h")>-1||this.prefix&&this.prefix.indexOf("doctest.h")>-1)}async runProg(e,t){this.logResults=void 0===t||t,"boolean"!=typeof e&&(e=!1),await this.runSetup();try{if(this.iotests)if(this.hasUnitTests())console.log(`IO tests are not supported with unit tests. They will be ignored in ${this.divid}`);else{let e=[];for(let t of this.iotests){let n=JSON.parse(this.json_runspec);n.run_spec.input=t.input,this.json_runspec=JSON.stringify(n);let i=await this.submitToJobe();if(!i.ok)return this.addJobeErrorMessage((0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)(`Server Error: ${i.statusText}`)),this.runButton.disabled=!1,"fail";let r=await i.json();r.test=t,e.push(r)}this.processJobeIOResponses(e)}else{let e=await this.submitToJobe();if(!e.ok)return this.addJobeErrorMessage((0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)(`Server Error: ${e.statusText}`)),this.runButton.disabled=!1,"fail";let t=await e.json();this.processJobeResponse(t)}}catch(e){return this.addJobeErrorMessage((0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_server_comm_err")+e.toString()),this.runButton.disabled=!1,`fail: ${e}`}return"success"}async runSetup(){var stdin,source,saveCode="True",sfilemap={java:"",cpp:"test.cpp",c:"test.c",python3:"test.py",python2:"test.py",octave:"octatest.m"},sourcefilename="",testdrivername="",file_checkp;if(this.suffix&&"java"==this.language){this.suffix.indexOf("import org.junit")<0&&(console.log(`Missing imports in unit tests:\n ${this.suffix}`),this.suffix="\n import static org.junit.Assert.*;\n import org.junit.*;\n import java.io.*;\n "+this.suffix);let e=new RegExp(/public\s+class\s+(\w+)/);source=await this.buildProg(!1);let t=source.match(e);if(!t)throw alert("Error: Could not find the class name in the source, this will not compile."),new Error("No class name in source");sourcefilename=t[1]+".java",t=this.suffix.match(e),t&&(testdrivername=t[1]+".java")}else source=await this.buildProg(!0);try{btoa(source)}catch(e){return void alert("Error: Bad Characters in the activecode window. Likely a quote character that has been copy/pasted. 🙁")}this.saveCode=await this.manage_scrubber(saveCode);var paramlist=["compileargs","linkargs","runargs","interpreterargs","memorylimit"],paramobj={};for(let param of paramlist)this[param]&&(paramobj[param]=eval(this[param]));if("octave"===this.language&&(paramobj.memorylimit=2e5),this.compileargs&&this.compileargs.toString().indexOf("fsanitize")>-1&&(paramobj.memorylimit=2e9),this.timelimit){let e=this.timelimit/1e3;paramobj.cputime=e}this.stdin&&(stdin=this.stdin_el.value),this.sourcefile||(this.sourcefile=sfilemap[this.language]),this.output.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_compiling_running");let allFilesRaw=[];if(null!=this.datafiles){let e=this.datafiles.split(",");for(let t of e){let e=t.trim();allFilesRaw.push({filename:e,type:"datafile"})}}if(null!=this.additional_files){let e=this.additional_files.split(",");for(let t of e){let e=t.trim();allFilesRaw.push({acid:e})}}var files=[];for(let e of allFilesRaw){let t,n,i;if("datafile"===e.type?(i=document.querySelector(`[data-filename="${e.filename}"]`),i||(i=document.getElementById(e.filename))):i=document.getElementById(e.acid),i){if(window.componentMap&&window.componentMap.hasOwnProperty(i.id)){let e=window.componentMap[i.id].editor;n=e.getValue()}else n=i.value?i.value:i.textContent;t=i.dataset.filename||e.filename}else{let i=null,r=null,s;if("datafile"===e.type)s=`/ns/logger/get_source_code?course_id=${eBookConfig.course}&filename=${e.filename}`;else{s=`/ns/logger/get_source_code?course_id=${eBookConfig.course}&acid=${e.acid}`;let t=new Request(`${eBookConfig.new_server_prefix}/assessment/get_latest_code?acid=${e.acid}`,{method:"POST",headers:this.jsonHeaders});try{let e=await fetch(t),n=await e.json();n=n.detail,n&&n.code&&(r=n.code)}catch(e){console.log("Error getting student code: "+e)}}try{let e=await fetch(s);e.ok&&(i=(await e.json()).detail)}catch(e){console.log(`failed to fetch ${s}: ${e}`)}i&&(n=r||i.file_contents,t=i.filename)}if(t){let e=t.substring(t.lastIndexOf(".")+1);if("jar"===e)files=files.concat(this.parseJavaClasses(n));else if(["jpg","png","gif"].indexOf(e)>-1){let r;i?i.toDataURL?(r=i.toDataURL("image/"+e),r=r.substring(r.indexOf(",")+1)):r=i.src.substring(i.src.indexOf(",")+1):r=n,files.push({name:t,content:r})}else files.push({name:t,content:n})}else(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_no_file_or_dir")}if(this.junitDriverCode=`\n import org.junit.runner.JUnitCore;\n import org.junit.runner.Result;\n import org.junit.runner.notification.Failure;\n\n public class TestRunner {\n public static void main(String[] args) {\n CodeTestHelper.resetFinalResults();\n Result result = JUnitCore.runClasses(${testdrivername.replace(".java",".class")});\n System.out.println(CodeTestHelper.getFinalResults());\n\n int total = result.getRunCount();\n int fails = result.getFailureCount();\n int corr = total - fails;\n System.out.println("You got " + corr + " out of " + total + " correct. " + String.format("%.2f", (100.0 * corr / total)) + "%");\n }\n }\n `,this.suffix&&"java"==this.language&&(files.push({name:sourcefilename,content:source}),files.push({name:testdrivername,content:this.suffix}),source=this.junitDriverCode,paramobj.compileargs?paramobj.compileargs.push(sourcefilename):paramobj.compileargs=[sourcefilename]),this.compileAlso){paramobj.compileargs=paramobj.compileargs||[];let e=this.compileAlso.split(",");paramobj.compileargs=paramobj.compileargs.concat(e)}let runspec={language_id:this.language,sourcecode:source,parameters:paramobj,sourcefilename:this.sourcefile};if(stdin&&(runspec.input=stdin),0===files.length)this.json_runspec=JSON.stringify({run_spec:runspec}),file_checkp=Promise.resolve("ready");else{runspec.file_list=[];var promises=[],instance=this;for(let e=0;e<files.length;e++){var fileName=files[e].name,fileContent=files[e].content;instance.div2id[fileName]="runestone"+(0,_md5_js__WEBPACK_IMPORTED_MODULE_7__.A)(fileName+fileContent),runspec.file_list.push([instance.div2id[fileName],fileName]),promises.push(new Promise(((t,n)=>{instance.checkFile(files[e],t,n)})))}this.json_runspec=JSON.stringify({run_spec:runspec}),this.div2id=instance.div2id,file_checkp=Promise.all(promises).catch((function(e){console.log("Error: "+e)}))}return file_checkp}async submitToJobe(){var e=this.json_runspec;let t=this.JOBE_SERVER+this.resource;this.runButton.disabled=!0,this.outDiv.style.display="",this.outDiv.style.visibility="visible",this.errDiv&&this.errDiv.remove(),this.output.style.visibility="visible";let n=new Headers({"Content-type":"application/json; charset=utf-8",Accept:"application/json","X-API-KEY":this.API_KEY}),i=new Request(t,{method:"POST",headers:n,body:e});return fetch(i)}processJobeResponse(e){var t,n=this.output;switch(this.parsedOutput={},this.runButton.disabled=!1,t=15===e.outcome?"success":e.outcome,this.errinfo=t,e.outcome){case 15:if("java"===this.language)this.parsedOutput=new _extractUnitResults_JUnit_js__WEBPACK_IMPORTED_MODULE_3__.A(e.stdout,this.divid),n.innerHTML=this.parsedOutput.stdout;else if("cpp"===this.language&&e.stdout.includes("[doctest]"))this.parsedOutput=new _extractUnitResults_Doctest_js__WEBPACK_IMPORTED_MODULE_4__.A(e.stdout,this.divid),n.innerHTML=this.parsedOutput.stdout;else{let t=e.stdout?e.stdout:"";n.innerHTML=t}(this.hasUnitTests()||this.iotests)&&(void 0===this.parsedOutput.pct&&(this.parsedOutput.pct=this.parsedOutput.passed=this.parsedOutput.failed=0),this.unit_results=`percent:${this.parsedOutput.pct}:passed:${this.parsedOutput.passed}:failed:${this.parsedOutput.failed}`);break;case 11:n.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_were_compiling_err"),this.addJobeErrorMessage(e.cmpinfo),this.errinfo=e.cmpinfo;break;case 12:("cpp"===this.language||"c"===this.language)&&e.stderr.includes("Permission denied")&&this.compileargs&&this.compileargs.includes("-c")?n.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_compile_only"):(n.innerHTML=e.stdout.replace(/\n/g,"<br>"),e.stderr&&this.addJobeErrorMessage(e.stderr));break;case 13:n.innerHTML=escapeHtml(e.stdout).replace(/\n/g,"<br>"),this.addJobeErrorMessage((0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_time_limit_exc"));break;default:e.stderr?n.innerHTML=e.stderr.replace(/\n/g,"<br>"):this.addJobeErrorMessage((0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_server_err"))}}processJobeIOResponses(e){this.output.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_iotest_results"),this.runButton.disabled=!1;const t=this.output;this.parsedOutput={};const n=document.createElement("div"),i=document.createElement("div");i.classList.add("unittest-results__heading"),i.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_unit_test_results"),n.appendChild(i),n.classList.add("unittest-results");const r=document.createElement("table");r.classList.add("ac-feedback"),n.appendChild(r),n.setAttribute("id",`${this.divid}_unit_results`);const s=document.createElement("tr");s.innerHTML='<th class="ac-feedback">Input:</th><th class="ac-feedback">Expected Output:</th><th class="ac-feedback">Your Output:</th><th class="ac-feedback">Result:</th>',r.appendChild(s),this.parsedOutput.table=n;let o=0;this.errinfo=null;const a=e=>e.trimEnd().split("\n").map((e=>e.trimEnd())).join("\n");for(let n of e){const e=a(n.stdout),i=a(n.test.out),s=document.createElement("tr"),l=document.createElement("td");l.classList.add("ac-feedback"),l.innerHTML=`<pre>${n.test.input}\n\n</pre>`,s.appendChild(l);const u=document.createElement("td");u.classList.add("ac-feedback"),u.innerHTML=`<pre>${i}</pre>`,s.appendChild(u);const c=document.createElement("td");c.classList.add("ac-feedback");let d=e.replaceAll(" ","&nbsp;").replaceAll("\n","<br>");c.innerHTML=`<pre>${d}</pre>`,s.appendChild(c);const f=document.createElement("td");switch(f.classList.add("ac-feedback"),s.appendChild(f),r.appendChild(s),n.outcome){case 15:e===i?(o++,f.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_passed"),f.classList.add("ac-feedback-pass")):(f.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_failed"),f.classList.add("ac-feedback-fail"));break;case 11:t.innerHTML=n.cmpinfo.replace(/\n/g,"<br>"),f.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_test_compile_error"),f.classList.add("ac-feedback-fail"),this.errinfo=n.cmpinfo;break;case 12:t.innerHTML=n.stderr.replace(/\n/g,"<br>"),f.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_test_run_error"),f.classList.add("ac-feedback-fail"),this.errinfo=n.stderr;break;case 13:t.innerHTML=escapeHtml(n.stdout).replace(/\n/g,"<br>"),f.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_time_limit_exc"),f.classList.add("ac-feedback-fail"),this.errinfo="time exceeded "+n.stdout;break;default:n.stderr&&(t.innerHTML=n.stderr.replace(/\n/g,"<br>")),f.innerHTML=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_server_err"),f.classList.add("ac-feedback-fail"),this.errinfo=n.stderr}if(this.errinfo)break}const l=o/e.length*100;this.unit_results=`percent:${l}:passed:${o}:failed:${e.length-o}`;const u=document.createElement("div");u.classList.add("unittest-results__percent"),u.innerHTML=`${Math.round(l)}% `+(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_passed"),this.parsedOutput.pctString=u,this.errinfo||(this.errinfo="success")}renderFeedback(){let e=document.getElementById(`${this.divid}_unit_results`);e&&e.remove(),this.parsedOutput&&this.parsedOutput.table&&this.outDiv.parentNode.appendChild(this.parsedOutput.table),e=document.getElementById(`${this.divid}_unit_results`),e&&e.appendChild(this.parsedOutput.pctString)}addJobeErrorMessage(e){this.errDiv&&this.errDiv.remove();var t=document.createElement("h3");t.innerHTML="Error";var n=this.outerDiv.appendChild(document.createElement("div"));this.errDiv=n,n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.setAttribute("role","log"),n.className="error alert alert-danger",n.id=this.divid+"_errinfo",n.appendChild(t);var i=n.appendChild(document.createElement("pre"));setTimeout((()=>{i.innerHTML=escapeHtml(e)}),10)}checkFile(e,t,n){var i=this.div2id[e.name],r=this.jobeCheckFiles+i,s=this.JOBE_SERVER+r,o=new XMLHttpRequest;o.open("HEAD",s,!0),o.setRequestHeader("Content-type","application/json"),o.setRequestHeader("Accept","text/plain"),o.setRequestHeader("X-API-KEY",this.API_KEY),o.onerror=function(){},o.onload=function(){switch(o.status){case 208:case 404:this.pushDataFile(e,t,n);break;case 400:default:n();break;case 204:t()}}.bind(this),o.send()}pushDataFile(e,t,n){var i,r=e.name,s=r.substring(r.indexOf(".")+1),o=this.div2id[r],a=e.content;i=-1===["jar","zip","png","jpg","jpeg"].indexOf(s)?(0,byte_base64__WEBPACK_IMPORTED_MODULE_6__.Cw)(a):a;var l=JSON.stringify({file_contents:i}),u=this.jobePutFiles+o,c=this.JOBE_SERVER+u,d=new XMLHttpRequest;d.open("PUT",c,!0),d.setRequestHeader("Content-type","application/json"),d.setRequestHeader("Accept","text/plain"),d.setRequestHeader("X-API-KEY",this.API_KEY),d.onload=function(){switch(d.status){case 403:case 400:default:n();break;case 204:t()}}.bind(this),d.onerror=function(){n()},d.send(l)}async showCodelens(){let e="";if("none"!=this.codelens.style.display)return this.codelens.style.display="none",void(this.clButton.innerText=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_show_in_codelens"));this.codelens.style.display="block",e="Building your visualization",this.codelens.innerHTML=e,this.clButton.innerText=(0,_common_js_rsi18n_js__WEBPACK_IMPORTED_MODULE_1__.t)("msg_activecode_hide_codelens");var t=this.codelens.firstChild;t&&(this.codelens.removeChild(t),this.codelens.innerHTML=e);var n=await this.buildProg(!1);n.match(/System.exit/)&&(alert("Sorry... System.exit breaks the visualizer temporarily removing"),n=n.replace(/System.exit\(\d+\);/,""));var i={};i.code=n,i.lang=this.language,this.stdin&&(i.stdin=this.stdin_el.value);var r=this.codelens.id;let s=new Request("/ns/rsproxy/pytutor_trace",{method:"POST",body:JSON.stringify(i),headers:this.jsonHeaders});try{let e=await fetch(s),t=await e.json();addVisualizerToPage(t,r,{startingInstruction:0,editCodeBaseURL:null,hideCode:!1,lang:i.lang})}catch(e){document.getElementById(r).innerHTML="Sorry, an error occurred while creating your visualization.",console.log("Get Trace Failed -- "),console.log(e)}this.logBookEvent({event:"codelens",act:"view",div_id:this.divid})}parseJavaClasses(e){e=e.trim();for(var t=!1,n=0,i=0,r=[],s=0,o=0,a=0;a<e.length;a++){var l=e.charAt(a);if("/"===l){if(a++,"/"===e.charAt(a)){for(a++;"\n"!==e.charAt(a)&&a<e.length;)a++;t||(o=a)}else if("*"==e.charAt(a)){for(a++;("*"!==e.charAt(a)||"/"!==e.charAt(a+1))&&a+1<e.length;)a++;t||(o=a)}}else if('"'===l)for(a++;'"'!==e.charAt(a)&&a<e.length;)a++;else if("'"===l)for(;"'"!==e.charAt(a)&&a<e.length;)a++;else if("("===l){var u=1;for(a++;u>0&&a<e.length;)"("===e.charAt(a)?u++:")"===e.charAt(a)&&u--,a++}if(t||"{"!==e.charAt(a)?t&&("{"===e.charAt(a)&&n++,"}"===e.charAt(a)&&n--):(i=a,t=!0,n=1),t&&0===n){let n=a+1;for(var c=e.substring(o,i).trim().split(" "),d="",f=0;f<c.length;f++)d=c[f],"extends"!==c[f]&&"implements"!==c[f]||(d=c[f-1],f=c.length);d=d.trim()+".java",r.push({name:d,content:e.substring(s,n)}),t=!1,s=n,o=n}}return r}}function unescapeHtml(e){if(e)return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function escapeHtml(e){return e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#x27;").replace(/"/g,"&quot;"):""}}}]);
//# sourceMappingURL=877.8eff87f848d0e77a.js.map