Files
blockly/dart_compressed.js
2022-10-04 19:38:53 +01:00

406 lines
59 KiB
JavaScript

// Do not edit this file; automatically generated.
/* eslint-disable */
;(function(root, factory) {
if (typeof define === 'function' && define.amd) { // AMD
define(["./blockly_compressed.js"], factory);
} else if (typeof exports === 'object') { // Node.js
module.exports = factory(require("./blockly_compressed.js"));
} else { // Browser
var factoryExports = factory(root.Blockly);
root.Blockly.Dart = factoryExports.dartGenerator;
root.Blockly.Dart.__namespace__ = factoryExports.__namespace__;
}
}(this, function(__parent__) {
var $=__parent__.__namespace__;
var module$exports$Blockly$Dart={},module$contents$Blockly$Dart_Variables=$.module$build$src$core$variables,module$contents$Blockly$Dart_stringUtils=$.module$build$src$core$utils$string,module$contents$Blockly$Dart_Generator=$.Generator$$module$build$src$core$generator,module$contents$Blockly$Dart_Names=$.module$build$src$core$names.Names,module$contents$Blockly$Dart_NameType=$.NameType$$module$build$src$core$names,module$contents$Blockly$Dart_inputTypes=$.module$build$src$core$input_types.inputTypes;
module$exports$Blockly$Dart.dartGenerator=new $.Generator$$module$build$src$core$generator("Dart");module$exports$Blockly$Dart.dartGenerator.addReservedWords("assert,break,case,catch,class,const,continue,default,do,else,enum,extends,false,final,finally,for,if,in,is,new,null,rethrow,return,super,switch,this,throw,true,try,var,void,while,with,print,identityHashCode,identical,BidirectionalIterator,Comparable,double,Function,int,Invocation,Iterable,Iterator,List,Map,Match,num,Pattern,RegExp,Set,StackTrace,String,StringSink,Type,bool,DateTime,Deprecated,Duration,Expando,Null,Object,RuneIterator,Runes,Stopwatch,StringBuffer,Symbol,Uri,Comparator,AbstractClassInstantiationError,ArgumentError,AssertionError,CastError,ConcurrentModificationError,CyclicInitializationError,Error,Exception,FallThroughError,FormatException,IntegerDivisionByZeroException,NoSuchMethodError,NullThrownError,OutOfMemoryError,RangeError,StackOverflowError,StateError,TypeError,UnimplementedError,UnsupportedError");
module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC=0;module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX=1;module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX=2;module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE=3;module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE=4;module$exports$Blockly$Dart.dartGenerator.ORDER_SHIFT=5;module$exports$Blockly$Dart.dartGenerator.ORDER_BITWISE_AND=6;module$exports$Blockly$Dart.dartGenerator.ORDER_BITWISE_XOR=7;
module$exports$Blockly$Dart.dartGenerator.ORDER_BITWISE_OR=8;module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL=9;module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY=10;module$exports$Blockly$Dart.dartGenerator.ORDER_LOGICAL_AND=11;module$exports$Blockly$Dart.dartGenerator.ORDER_LOGICAL_OR=12;module$exports$Blockly$Dart.dartGenerator.ORDER_IF_NULL=13;module$exports$Blockly$Dart.dartGenerator.ORDER_CONDITIONAL=14;module$exports$Blockly$Dart.dartGenerator.ORDER_CASCADE=15;
module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT=16;module$exports$Blockly$Dart.dartGenerator.ORDER_NONE=99;module$exports$Blockly$Dart.dartGenerator.isInitialized=!1;
module$exports$Blockly$Dart.dartGenerator.init=function(a){Object.getPrototypeOf(this).init.call(this);this.nameDB_?this.nameDB_.reset():this.nameDB_=new $.module$build$src$core$names.Names(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);const b=[];var c=$.module$build$src$core$variables.allDeveloperVariables(a);for(let d=0;d<c.length;d++)b.push(this.nameDB_.getName(c[d],$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));
a=$.module$build$src$core$variables.allUsedVarModels(a);for(c=0;c<a.length;c++)b.push(this.nameDB_.getName(a[c].getId(),$.NameType$$module$build$src$core$names.VARIABLE));b.length&&(this.definitions_.variables="var "+b.join(", ")+";");this.isInitialized=!0};
module$exports$Blockly$Dart.dartGenerator.finish=function(a){a&&(a=this.prefixLines(a,this.INDENT));a="main() {\n"+a+"}";const b=[],c=[];for(let d in this.definitions_){const e=this.definitions_[d];e.match(/^import\s/)?b.push(e):c.push(e)}a=Object.getPrototypeOf(this).finish.call(this,a);this.isInitialized=!1;this.nameDB_.reset();return(b.join("\n")+"\n\n"+c.join("\n\n")).replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n\n\n")+a};
module$exports$Blockly$Dart.dartGenerator.scrubNakedValue=function(a){return a+";\n"};module$exports$Blockly$Dart.dartGenerator.quote_=function(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/\$/g,"\\$").replace(/'/g,"\\'");return"'"+a+"'"};module$exports$Blockly$Dart.dartGenerator.multiline_quote_=function(a){return a.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")};
module$exports$Blockly$Dart.dartGenerator.scrub_=function(a,b,c){let d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.module$build$src$core$utils$string.wrap(e,this.COMMENT_WRAP-3),d=a.getProcedureDef?d+this.prefixLines(e+"\n","/// "):d+this.prefixLines(e+"\n","// "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===$.module$build$src$core$input_types.inputTypes.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&
(d+=this.prefixLines(e,"// "))}a=a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c};
module$exports$Blockly$Dart.dartGenerator.getAdjusted=function(a,b,c,d,e){c=c||0;e=e||this.ORDER_NONE;a.workspace.options.oneBasedIndex&&c--;const f=a.workspace.options.oneBasedIndex?"1":"0";let g,h;c?h=g=this.ORDER_ADDITIVE:d?h=g=this.ORDER_UNARY_PREFIX:g=e;a=this.valueToCode(a,b,g)||f;$.module$build$src$core$utils$string.isNumber(a)?(a=parseInt(a,10)+c,d&&(a=-a)):(0<c?a=a+" + "+c:0>c&&(a=a+" - "+-c),d&&(a=c?"-("+a+")":"-"+a),h=Math.floor(h),e=Math.floor(e),h&&e>=h&&(a="("+a+")"));return a};var module$exports$Blockly$Dart$variables={},module$contents$Blockly$Dart$variables_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$Dart.dartGenerator.variables_get=function(a){return[module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]};
module$exports$Blockly$Dart.dartGenerator.variables_set=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"0";return module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE)+" = "+b+";\n"};var module$exports$Blockly$Dart$variablesDynamic={};module$exports$Blockly$Dart.dartGenerator.variables_get_dynamic=module$exports$Blockly$Dart.dartGenerator.variables_get;module$exports$Blockly$Dart.dartGenerator.variables_set_dynamic=module$exports$Blockly$Dart.dartGenerator.variables_set;var module$exports$Blockly$Dart$texts={},module$contents$Blockly$Dart$texts_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$Dart.dartGenerator.addReservedWords("Html,Math");module$exports$Blockly$Dart.dartGenerator.text=function(a){return[module$exports$Blockly$Dart.dartGenerator.quote_(a.getFieldValue("TEXT")),module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]};
module$exports$Blockly$Dart.dartGenerator.text_multiline=function(a){a=module$exports$Blockly$Dart.dartGenerator.multiline_quote_(a.getFieldValue("TEXT"));const b=-1!==a.indexOf("+")?module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE:module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC;return[a,b]};
module$exports$Blockly$Dart.dartGenerator.text_join=function(a){switch(a.itemCount_){case 0:return["''",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC];case 1:return[(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"ADD0",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''")+".toString()",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];default:const b=Array(a.itemCount_);for(let c=0;c<a.itemCount_;c++)b[c]=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,
"ADD"+c,module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";return["["+b.join(",")+"].join()",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}};
module$exports$Blockly$Dart.dartGenerator.text_append=function(a){const b=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE);a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";return b+" = ["+b+", "+a+"].join();\n"};
module$exports$Blockly$Dart.dartGenerator.text_length=function(a){return[(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''")+".length",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.text_isEmpty=function(a){return[(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''")+".isEmpty",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.text_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf";const c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"FIND",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";b=(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?[b+" + 1",module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE]:
[b,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.text_charAt=function(a){const b=a.getFieldValue("WHERE")||"FROM_START",c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE","FIRST"===b||"FROM_START"===b?module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX:module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";switch(b){case "FIRST":return[c+"[0]",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];case "FROM_START":return a=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,
"AT"),[c+"["+a+"]",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];case "LAST":case "FROM_END":return a=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT",1),[module$exports$Blockly$Dart.dartGenerator.provideFunction_("text_get_from_end",`
String ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(String text, num x) {
return text[text.length - x];
}
`)+"("+c+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];case "RANDOM":return module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;",[module$exports$Blockly$Dart.dartGenerator.provideFunction_("text_random_letter",`
String ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(String text) {
int x = new Math.Random().nextInt(text.length);
return text[x];
}
`)+"("+c+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}throw Error("Unhandled option (text_charAt).");};
module$exports$Blockly$Dart.dartGenerator.text_getSubstring=function(a){var b=a.getFieldValue("WHERE1"),c=a.getFieldValue("WHERE2");const d="FROM_END"!==b&&"FROM_START"===c,e=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"STRING",d?module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX:module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";if("FIRST"===b&&"LAST"===c)return[e,module$exports$Blockly$Dart.dartGenerator.ORDER_NONE];if(e.match(/^'?\w+'?$/)||d){switch(b){case "FROM_START":b=
module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT1");break;case "FROM_END":b=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT1",1,!1,module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE);b=e+".length - "+b;break;case "FIRST":b="0";break;default:throw Error("Unhandled option (text_getSubstring).");}switch(c){case "FROM_START":var f=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT2",1);break;case "FROM_END":f=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,
"AT2",0,!1,module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE);f=e+".length - "+f;break;case "LAST":break;default:throw Error("Unhandled option (text_getSubstring).");}c="LAST"===c?e+".substring("+b+")":e+".substring("+b+", "+f+")"}else f=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT1"),a=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT2"),c=module$exports$Blockly$Dart.dartGenerator.provideFunction_("text_get_substring",`
String ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(String text, String where1, num at1, String where2, num at2) {
int getAt(String where, num at) {
if (where == 'FROM_END') {
at = text.length - 1 - at;
} else if (where == 'FIRST') {
at = 0;
} else if (where == 'LAST') {
at = text.length - 1;
} else if (where != 'FROM_START') {
throw 'Unhandled option (text_getSubstring).';
}
return at;
}
at1 = getAt(where1, at1);
at2 = getAt(where2, at2) + 1;
return text.substring(at1, at2);
}
`)+"("+e+", '"+b+"', "+f+", '"+c+"', "+a+")";return[c,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.text_changeCase=function(a){const b={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[a.getFieldValue("CASE")];a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",b?module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX:module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";return[b?a+b:module$exports$Blockly$Dart.dartGenerator.provideFunction_("text_toTitleCase",`
String ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(String str) {
RegExp exp = new RegExp(r'\\b');
List<String> list = str.split(exp);
final title = new StringBuffer();
for (String part in list) {
if (part.length > 0) {
title.write(part[0].toUpperCase());
if (part.length > 0) {
title.write(part.substring(1).toLowerCase());
}
}
}
return title.toString();
}
`)+"("+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};module$exports$Blockly$Dart.dartGenerator.text_trim=function(a){const b={LEFT:".replaceFirst(new RegExp(r'^\\s+'), '')",RIGHT:".replaceFirst(new RegExp(r'\\s+$'), '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''")+b,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.text_print=function(a){return"print("+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''")+");\n"};
module$exports$Blockly$Dart.dartGenerator.text_prompt_ext=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_html="import 'dart:html' as Html;";let b="Html.window.prompt("+(a.getField("TEXT")?module$exports$Blockly$Dart.dartGenerator.quote_(a.getFieldValue("TEXT")):module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''")+", '')";"NUMBER"===a.getFieldValue("TYPE")&&(module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math=
"import 'dart:math' as Math;",b="Math.parseDouble("+b+")");return[b,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};module$exports$Blockly$Dart.dartGenerator.text_prompt=module$exports$Blockly$Dart.dartGenerator.text_prompt_ext;
module$exports$Blockly$Dart.dartGenerator.text_count=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"SUB",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("text_count",`
int ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(String haystack, String needle) {
if (needle.length == 0) {
return haystack.length + 1;
}
int index = 0;
int count = 0;
while (index != -1) {
index = haystack.indexOf(needle, index);
if (index != -1) {
count++;
index += needle.length;
}
}
return count;
}
`)+"("+b+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.text_replace=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''",c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"FROM",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TO",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";return[b+".replaceAll("+c+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.text_reverse=function(a){return["new String.fromCharCodes("+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''")+".runes.toList().reversed)",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX]};var module$exports$Blockly$Dart$procedures={},module$contents$Blockly$Dart$procedures_NameType=$.NameType$$module$build$src$core$names;
module$exports$Blockly$Dart.dartGenerator.procedures_defreturn=function(a){const b=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("NAME"),$.NameType$$module$build$src$core$names.PROCEDURE);var c="";module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX&&(c+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX,a));module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX&&(c+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX,
a));c&&(c=module$exports$Blockly$Dart.dartGenerator.prefixLines(c,module$exports$Blockly$Dart.dartGenerator.INDENT));let d="";module$exports$Blockly$Dart.dartGenerator.INFINITE_LOOP_TRAP&&(d=module$exports$Blockly$Dart.dartGenerator.prefixLines(module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.INFINITE_LOOP_TRAP,a),module$exports$Blockly$Dart.dartGenerator.INDENT));const e=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"STACK");let f=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,
"RETURN",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"",g="";e&&f&&(g=c);f&&(f=module$exports$Blockly$Dart.dartGenerator.INDENT+"return "+f+";\n");const h=f?"dynamic":"void",k=[],l=a.getVars();for(let m=0;m<l.length;m++)k[m]=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(l[m],$.NameType$$module$build$src$core$names.VARIABLE);c=h+" "+b+"("+k.join(", ")+") {\n"+c+d+e+g+f+"}";c=module$exports$Blockly$Dart.dartGenerator.scrub_(a,c);module$exports$Blockly$Dart.dartGenerator.definitions_["%"+
b]=c;return null};module$exports$Blockly$Dart.dartGenerator.procedures_defnoreturn=module$exports$Blockly$Dart.dartGenerator.procedures_defreturn;
module$exports$Blockly$Dart.dartGenerator.procedures_callreturn=function(a){const b=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("NAME"),$.NameType$$module$build$src$core$names.PROCEDURE),c=[],d=a.getVars();for(let e=0;e<d.length;e++)c[e]=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"ARG"+e,module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"null";return[b+"("+c.join(", ")+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.procedures_callnoreturn=function(a){return module$exports$Blockly$Dart.dartGenerator.procedures_callreturn(a)[0]+";\n"};
module$exports$Blockly$Dart.dartGenerator.procedures_ifreturn=function(a){let b="if ("+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"CONDITION",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"false")+") {\n";module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX&&(b+=module$exports$Blockly$Dart.dartGenerator.prefixLines(module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX,a),module$exports$Blockly$Dart.dartGenerator.INDENT));
a.hasReturnValue_?(a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"null",b+=module$exports$Blockly$Dart.dartGenerator.INDENT+"return "+a+";\n"):b+=module$exports$Blockly$Dart.dartGenerator.INDENT+"return;\n";return b+"}\n"};var module$exports$Blockly$Dart$math={},module$contents$Blockly$Dart$math_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$Dart.dartGenerator.addReservedWords("Math");
module$exports$Blockly$Dart.dartGenerator.math_number=function(a){a=Number(a.getFieldValue("NUM"));let b;Infinity===a?(a="double.infinity",b=module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX):-Infinity===a?(a="-double.infinity",b=module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX):b=0>a?module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX:module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC;return[a,b]};
module$exports$Blockly$Dart.dartGenerator.math_arithmetic=function(a){var b={ADD:[" + ",module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE],MINUS:[" - ",module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE],MULTIPLY:[" * ",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE],DIVIDE:[" / ",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE],POWER:[null,module$exports$Blockly$Dart.dartGenerator.ORDER_NONE]}[a.getFieldValue("OP")];const c=b[0];b=b[1];const d=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,
"A",b)||"0";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"B",b)||"0";return c?[d+c+a,b]:(module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;",["Math.pow("+d+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX])};
module$exports$Blockly$Dart.dartGenerator.math_single=function(a){const b=a.getFieldValue("OP");let c;if("NEG"===b)return a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"NUM",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX)||"0","-"===a[0]&&(a=" "+a),["-"+a,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX];module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";a="ABS"===b||"ROUND"===b.substring(0,5)?module$exports$Blockly$Dart.dartGenerator.valueToCode(a,
"NUM",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"0":"SIN"===b||"COS"===b||"TAN"===b?module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"NUM",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE)||"0":module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"NUM",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0";switch(b){case "ABS":c=a+".abs()";break;case "ROOT":c="Math.sqrt("+a+")";break;case "LN":c="Math.log("+a+")";break;case "EXP":c="Math.exp("+a+")";
break;case "POW10":c="Math.pow(10,"+a+")";break;case "ROUND":c=a+".round()";break;case "ROUNDUP":c=a+".ceil()";break;case "ROUNDDOWN":c=a+".floor()";break;case "SIN":c="Math.sin("+a+" / 180 * Math.pi)";break;case "COS":c="Math.cos("+a+" / 180 * Math.pi)";break;case "TAN":c="Math.tan("+a+" / 180 * Math.pi)"}if(c)return[c,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];switch(b){case "LOG10":c="Math.log("+a+") / Math.log(10)";break;case "ASIN":c="Math.asin("+a+") / Math.pi * 180";break;
case "ACOS":c="Math.acos("+a+") / Math.pi * 180";break;case "ATAN":c="Math.atan("+a+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+b);}return[c,module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE]};
module$exports$Blockly$Dart.dartGenerator.math_constant=function(a){const b={PI:["Math.pi",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX],E:["Math.e",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE],SQRT2:["Math.sqrt2",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX],SQRT1_2:["Math.sqrt1_2",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX],
INFINITY:["double.infinity",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]};a=a.getFieldValue("CONSTANT");"INFINITY"!==a&&(module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;");return b[a]};
module$exports$Blockly$Dart.dartGenerator.math_number_property=function(a){var b={EVEN:[" % 2 == 0",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE,module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY],ODD:[" % 2 == 1",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE,module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY],WHOLE:[" % 1 == 0",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE,module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY],POSITIVE:[" > 0",
module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL,module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL],NEGATIVE:[" < 0",module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL,module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL],DIVISIBLE_BY:[null,module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE,module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY],PRIME:[null,module$exports$Blockly$Dart.dartGenerator.ORDER_NONE,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
const c=a.getFieldValue("PROPERTY"),[d,e,f]=b[c];b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"NUMBER_TO_CHECK",e)||"0";if("PRIME"===c)module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;",a=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_isPrime",`
bool ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(n) {
// https://en.wikipedia.org/wiki/Primality_test#Naive_methods
if (n == 2 || n == 3) {
return true;
}
// False if n is null, negative, is 1, or not whole.
// And false if n is divisible by 2 or 3.
if (n == null || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {
return false;
}
// Check all the numbers of form 6k +/- 1, up to sqrt(n).
for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {
if (n % (x - 1) == 0 || n % (x + 1) == 0) {
return false;
}
}
return true;
}
`)+"("+b+")";else if("DIVISIBLE_BY"===c){a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"DIVISOR",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE)||"0";if("0"===a)return["false",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC];a=b+" % "+a+" == 0"}else a=b+d;return[a,f]};
module$exports$Blockly$Dart.dartGenerator.math_change=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"DELTA",module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE)||"0";a=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE);return a+" = ("+a+" is num ? "+a+" : 0) + "+b+";\n"};module$exports$Blockly$Dart.dartGenerator.math_round=module$exports$Blockly$Dart.dartGenerator.math_single;
module$exports$Blockly$Dart.dartGenerator.math_trig=module$exports$Blockly$Dart.dartGenerator.math_single;module$exports$Blockly$Dart.dartGenerator.math_on_list=function(a){var b=a.getFieldValue("OP");a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LIST",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"[]";switch(b){case "SUM":b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_sum",`
num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List<num> myList) {
num sumVal = 0;
myList.forEach((num entry) {sumVal += entry;});
return sumVal;
}
`)+"("+a+")";break;case "MIN":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_min",`
num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List<num> myList) {
if (myList.isEmpty) return null;
num minVal = myList[0];
myList.forEach((num entry) {minVal = Math.min(minVal, entry);});
return minVal;
}
`)+"("+a+")";break;case "MAX":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_max",`
num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List<num> myList) {
if (myList.isEmpty) return null;
num maxVal = myList[0];
myList.forEach((num entry) {maxVal = Math.max(maxVal, entry);});
return maxVal;
}
`)+"("+a+")";break;case "AVERAGE":b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_mean",`
num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) {
// First filter list for numbers only.
List localList = new List.from(myList);
localList.removeWhere((a) => a is! num);
if (localList.isEmpty) return null;
num sumVal = 0;
localList.forEach((var entry) {sumVal += entry;});
return sumVal / localList.length;
}
`)+"("+a+")";break;case "MEDIAN":b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_median",`
num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) {
// First filter list for numbers only, then sort, then return middle value
// or the average of two middle values if list has an even number of elements.
List localList = new List.from(myList);
localList.removeWhere((a) => a is! num);
if (localList.isEmpty) return null;
localList.sort((a, b) => (a - b));
int index = localList.length ~/ 2;
if (localList.length % 2 == 1) {
return localList[index];
} else {
return (localList[index - 1] + localList[index]) / 2;
}
}
`)+"("+a+")";break;case "MODE":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_modes",`
List ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List values) {
List modes = [];
List counts = [];
int maxCount = 0;
for (int i = 0; i < values.length; i++) {
var value = values[i];
bool found = false;
int thisCount;
for (int j = 0; j < counts.length; j++) {
if (counts[j][0] == value) {
thisCount = ++counts[j][1];
found = true;
break;
}
}
if (!found) {
counts.add([value, 1]);
thisCount = 1;
}
maxCount = Math.max(thisCount, maxCount);
}
for (int j = 0; j < counts.length; j++) {
if (counts[j][1] == maxCount) {
modes.add(counts[j][0]);
}
}
return modes;
}
`)+"("+a+")";break;case "STD_DEV":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_standard_deviation",`
num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) {
// First filter list for numbers only.
List numbers = new List.from(myList);
numbers.removeWhere((a) => a is! num);
if (numbers.isEmpty) return null;
num n = numbers.length;
num sum = 0;
numbers.forEach((x) => sum += x);
num mean = sum / n;
num sumSquare = 0;
numbers.forEach((x) => sumSquare += Math.pow(x - mean, 2));
return Math.sqrt(sumSquare / n);
}
`)+"("+a+")";break;case "RANDOM":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_random_item",`
dynamic ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) {
int x = new Math.Random().nextInt(myList.length);
return myList[x];
}
`)+"("+a+")";break;default:throw Error("Unknown operator: "+b);}return[b,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.math_modulo=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"DIVIDEND",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE)||"0";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"DIVISOR",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE)||"0";return[b+" % "+a,module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE]};
module$exports$Blockly$Dart.dartGenerator.math_constrain=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0",c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LOW",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"HIGH",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||
"double.infinity";return["Math.min(Math.max("+b+", "+c+"), "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.math_random_int=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"FROM",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TO",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0";return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_random_int",
`
int ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(num a, num b) {
if (a > b) {
// Swap a and b to ensure a is smaller.
num c = a;
a = b;
b = c;
}
return new Math.Random().nextInt(b - a + 1) + a;
}
`)+"("+b+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};module$exports$Blockly$Dart.dartGenerator.math_random_float=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";return["new Math.Random().nextDouble()",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.math_atan2=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"X",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0";return["Math.atan2("+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"Y",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0")+", "+b+") / Math.pi * 180",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE]};var module$exports$Blockly$Dart$loops={},module$contents$Blockly$Dart$loops_stringUtils=$.module$build$src$core$utils$string,module$contents$Blockly$Dart$loops_NameType=$.NameType$$module$build$src$core$names;
module$exports$Blockly$Dart.dartGenerator.controls_repeat_ext=function(a){let b;b=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TIMES",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"0";let c=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"DO");c=module$exports$Blockly$Dart.dartGenerator.addLoopTrap(c,a);a="";const d=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName("count",$.NameType$$module$build$src$core$names.VARIABLE);
let e=b;b.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(b)||(e=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName("repeat_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+e+" = "+b+";\n");return a+("for (int "+d+" = 0; "+d+" < "+e+"; "+d+"++) {\n"+c+"}\n")};module$exports$Blockly$Dart.dartGenerator.controls_repeat=module$exports$Blockly$Dart.dartGenerator.controls_repeat_ext;
module$exports$Blockly$Dart.dartGenerator.controls_whileUntil=function(a){const b="UNTIL"===a.getFieldValue("MODE");let c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"BOOL",b?module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX:module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"false",d=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"DO");d=module$exports$Blockly$Dart.dartGenerator.addLoopTrap(d,a);b&&(c="!"+c);return"while ("+c+") {\n"+d+"}\n"};
module$exports$Blockly$Dart.dartGenerator.controls_for=function(a){var b=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"FROM",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"0",d=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TO",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"0";const e=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,
"BY",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"1";let f=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"DO");f=module$exports$Blockly$Dart.dartGenerator.addLoopTrap(f,a);if($.module$build$src$core$utils$string.isNumber(c)&&$.module$build$src$core$utils$string.isNumber(d)&&$.module$build$src$core$utils$string.isNumber(e)){var g=Number(c)<=Number(d);a="for ("+b+" = "+c+"; "+b+(g?" <= ":" >= ")+d+"; "+b;b=Math.abs(Number(e));a=1===b?a+(g?"++":"--"):a+((g?" += ":" -= ")+
b);a+=") {\n"+f+"}\n"}else a="",g=c,c.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(c)||(g=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName(b+"_start",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+g+" = "+c+";\n"),c=d,d.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(d)||(c=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName(b+"_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+c+" = "+d+";\n"),d=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName(b+
"_inc",$.NameType$$module$build$src$core$names.VARIABLE),a+="num "+d+" = ",a=$.module$build$src$core$utils$string.isNumber(e)?a+(Math.abs(e)+";\n"):a+("("+e+").abs();\n"),a+="if ("+g+" > "+c+") {\n",a+=module$exports$Blockly$Dart.dartGenerator.INDENT+d+" = -"+d+";\n",a=a+"}\nfor ("+(b+" = "+g+"; "+d+" >= 0 ? "+b+" <= "+c+" : "+b+" >= "+c+"; "+b+" += "+d+") {\n"+f+"}\n");return a};
module$exports$Blockly$Dart.dartGenerator.controls_forEach=function(a){const b=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LIST",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"[]";let d=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"DO");d=module$exports$Blockly$Dart.dartGenerator.addLoopTrap(d,a);return"for (var "+b+" in "+
c+") {\n"+d+"}\n"};
module$exports$Blockly$Dart.dartGenerator.controls_flow_statements=function(a){let b="";module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX&&(b+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX,a));module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX&&(b+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX,a));if(module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX){const c=a.getSurroundLoop();
c&&!c.suppressPrefixSuffix&&(b+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX,c))}switch(a.getFieldValue("FLOW")){case "BREAK":return b+"break;\n";case "CONTINUE":return b+"continue;\n"}throw Error("Unknown flow statement.");};var module$exports$Blockly$Dart$logic={};
module$exports$Blockly$Dart.dartGenerator.controls_if=function(a){let b=0,c="",d,e;module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX&&(c+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX,a));do e=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"IF"+b,module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"false",d=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"DO"+b),module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX&&
(d=module$exports$Blockly$Dart.dartGenerator.prefixLines(module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX,a),module$exports$Blockly$Dart.dartGenerator.INDENT)+d),c+=(0<b?"else ":"")+"if ("+e+") {\n"+d+"}",b++;while(a.getInput("IF"+b));if(a.getInput("ELSE")||module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX)d=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"ELSE"),module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX&&
(d=module$exports$Blockly$Dart.dartGenerator.prefixLines(module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX,a),module$exports$Blockly$Dart.dartGenerator.INDENT)+d),c+=" else {\n"+d+"}";return c+"\n"};module$exports$Blockly$Dart.dartGenerator.controls_ifelse=module$exports$Blockly$Dart.dartGenerator.controls_if;
module$exports$Blockly$Dart.dartGenerator.logic_compare=function(a){const b={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],c="=="===b||"!="===b?module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY:module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL,d=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"A",c)||"0";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"B",c)||"0";return[d+" "+b+" "+a,c]};
module$exports$Blockly$Dart.dartGenerator.logic_operation=function(a){const b="AND"===a.getFieldValue("OP")?"&&":"||",c="&&"===b?module$exports$Blockly$Dart.dartGenerator.ORDER_LOGICAL_AND:module$exports$Blockly$Dart.dartGenerator.ORDER_LOGICAL_OR;let d=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"A",c);a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"B",c);if(d||a){const e="&&"===b?"true":"false";d||(d=e);a||(a=e)}else a=d="false";return[d+" "+b+" "+a,c]};
module$exports$Blockly$Dart.dartGenerator.logic_negate=function(a){const b=module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX;return["!"+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"BOOL",b)||"true"),b]};module$exports$Blockly$Dart.dartGenerator.logic_boolean=function(a){return["TRUE"===a.getFieldValue("BOOL")?"true":"false",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]};module$exports$Blockly$Dart.dartGenerator.logic_null=function(a){return["null",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]};
module$exports$Blockly$Dart.dartGenerator.logic_ternary=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"IF",module$exports$Blockly$Dart.dartGenerator.ORDER_CONDITIONAL)||"false",c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"THEN",module$exports$Blockly$Dart.dartGenerator.ORDER_CONDITIONAL)||"null";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"ELSE",module$exports$Blockly$Dart.dartGenerator.ORDER_CONDITIONAL)||"null";return[b+" ? "+c+" : "+a,module$exports$Blockly$Dart.dartGenerator.ORDER_CONDITIONAL]};var module$exports$Blockly$Dart$lists={},module$contents$Blockly$Dart$lists_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$Dart.dartGenerator.addReservedWords("Math");module$exports$Blockly$Dart.dartGenerator.lists_create_empty=function(a){return["[]",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]};
module$exports$Blockly$Dart.dartGenerator.lists_create_with=function(a){const b=Array(a.itemCount_);for(let c=0;c<a.itemCount_;c++)b[c]=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"ADD"+c,module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"null";return["["+b.join(", ")+"]",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]};
module$exports$Blockly$Dart.dartGenerator.lists_repeat=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"ITEM",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"null";return["new List.filled("+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"NUM",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0")+", "+b+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.lists_length=function(a){return[(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"[]")+".length",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.lists_isEmpty=function(a){return[(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"[]")+".isEmpty",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.lists_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf";const c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"FIND",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";b=(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"[]")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?[b+" + 1",module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE]:
[b,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.lists_getIndex=function(a){function b(){const f=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName("tmp_list",$.NameType$$module$build$src$core$names.VARIABLE),g="List "+f+" = "+e+";\n";e=f;return g}var c=a.getFieldValue("MODE")||"GET";const d=a.getFieldValue("WHERE")||"FROM_START";let e=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE","RANDOM"===d||"FROM_END"===d?module$exports$Blockly$Dart.dartGenerator.ORDER_NONE:module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||
"[]";if(("RANDOM"!==d||"REMOVE"!==c)&&"FROM_END"!==d||e.match(/^\w+$/))switch(d){case "FIRST":if("GET"===c)return[e+".first",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];if("GET_REMOVE"===c)return[e+".removeAt(0)",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];if("REMOVE"===c)return e+".removeAt(0);\n";break;case "LAST":if("GET"===c)return[e+".last",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];if("GET_REMOVE"===c)return[e+".removeLast()",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];
if("REMOVE"===c)return e+".removeLast();\n";break;case "FROM_START":a=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT");if("GET"===c)return[e+"["+a+"]",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];if("GET_REMOVE"===c)return[e+".removeAt("+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];if("REMOVE"===c)return e+".removeAt("+a+");\n";break;case "FROM_END":a=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT",1,!1,module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE);
if("GET"===c)return[e+"["+e+".length - "+a+"]",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];if("GET_REMOVE"===c||"REMOVE"===c){a=e+".removeAt("+e+".length - "+a+")";if("GET_REMOVE"===c)return[a,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];if("REMOVE"===c)return a+";\n"}break;case "RANDOM":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";if("REMOVE"===c)return c=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName("tmp_x",
$.NameType$$module$build$src$core$names.VARIABLE),"int "+c+" = new Math.Random().nextInt("+e+".length);\n"+(e+".removeAt("+c+");\n");if("GET"===c)return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("lists_get_random_item",`
dynamic ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List my_list) {
int x = new Math.Random().nextInt(my_list.length);
return my_list[x];
}
`)+"("+e+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];if("GET_REMOVE"===c)return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("lists_remove_random_item",`
dynamic ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List my_list) {
int x = new Math.Random().nextInt(my_list.length);
return my_list.removeAt(x);
}
`)+"("+e+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}else{if("RANDOM"===d)return module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;",c=b(),a=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE),c+("int "+a+" = new Math.Random().nextInt("+e+".length);\n")+(e+".removeAt("+a+");\n");if("REMOVE"===c)return c=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,
"AT",1,!1,module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE),b()+(e+".removeAt("+e+".length - "+c+");\n");if("GET"===c)return c=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT",1),[module$exports$Blockly$Dart.dartGenerator.provideFunction_("lists_get_from_end",`
dynamic ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List my_list, num x) {
x = my_list.length - x;
return my_list[x];
}
`)+"("+e+", "+c+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];if("GET_REMOVE"===c)return c=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT",1),[module$exports$Blockly$Dart.dartGenerator.provideFunction_("lists_remove_from_end",`
dynamic ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List my_list, num x) {
x = my_list.length - x;
return my_list.removeAt(x);
}
`)+"("+e+", "+c+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}throw Error("Unhandled combination (lists_getIndex).");};
module$exports$Blockly$Dart.dartGenerator.lists_setIndex=function(a){function b(){if(e.match(/^\w+$/))return"";const g=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName("tmp_list",$.NameType$$module$build$src$core$names.VARIABLE),h="List "+g+" = "+e+";\n";e=g;return h}const c=a.getFieldValue("MODE")||"GET";var d=a.getFieldValue("WHERE")||"FROM_START";let e=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LIST",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||
"[]";const f=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TO",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"null";switch(d){case "FIRST":if("SET"===c)return e+"[0] = "+f+";\n";if("INSERT"===c)return e+".insert(0, "+f+");\n";break;case "LAST":if("SET"===c)return b()+(e+"["+e+".length - 1] = "+f+";\n");if("INSERT"===c)return e+".add("+f+");\n";break;case "FROM_START":a=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT");if("SET"===c)return e+"["+a+"] = "+f+";\n";
if("INSERT"===c)return e+".insert("+a+", "+f+");\n";break;case "FROM_END":a=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT",1,!1,module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE);d=b();if("SET"===c)return d+(e+"["+e+".length - "+a+"] = "+f+";\n");if("INSERT"===c)return d+(e+".insert("+e+".length - "+a+", "+f+");\n");break;case "RANDOM":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";a=b();d=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName("tmp_x",
$.NameType$$module$build$src$core$names.VARIABLE);a+="int "+d+" = new Math.Random().nextInt("+e+".length);\n";if("SET"===c)return a+(e+"["+d+"] = "+f+";\n");if("INSERT"===c)return a+(e+".insert("+d+", "+f+");\n")}throw Error("Unhandled combination (lists_setIndex).");};
module$exports$Blockly$Dart.dartGenerator.lists_getSublist=function(a){var b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LIST",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"[]",c=a.getFieldValue("WHERE1");const d=a.getFieldValue("WHERE2");if(b.match(/^\w+$/)||"FROM_END"!==c&&"FROM_START"===d){switch(c){case "FROM_START":c=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT1");break;case "FROM_END":c=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT1",
1,!1,module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE);c=b+".length - "+c;break;case "FIRST":c="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(d){case "FROM_START":var e=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT2",1);break;case "FROM_END":e=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT2",0,!1,module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE);e=b+".length - "+e;break;case "LAST":break;default:throw Error("Unhandled option (lists_getSublist).");
}b="LAST"===d?b+".sublist("+c+")":b+".sublist("+c+", "+e+")"}else e=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT1"),a=module$exports$Blockly$Dart.dartGenerator.getAdjusted(a,"AT2"),b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("lists_get_sublist",`
List ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List list, String where1, num at1, String where2, num at2) {
int getAt(String where, num at) {
if (where == 'FROM_END') {
at = list.length - 1 - at;
} else if (where == 'FIRST') {
at = 0;
} else if (where == 'LAST') {
at = list.length - 1;
} else if (where != 'FROM_START') {
throw 'Unhandled option (lists_getSublist).';
}
return at;
}
at1 = getAt(where1, at1);
at2 = getAt(where2, at2) + 1;
return list.sublist(at1, at2);
}
`)+"("+b+", '"+c+"', "+e+", '"+d+"', "+a+")";return[b,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};module$exports$Blockly$Dart.dartGenerator.lists_sort=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LIST",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"[]",c="1"===a.getFieldValue("DIRECTION")?1:-1;a=a.getFieldValue("TYPE");return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("lists_sort",`
List ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {
var compareFuncs = {
'NUMERIC': (a, b) => (direction * a.compareTo(b)).toInt(),
'TEXT': (a, b) => direction * a.toString().compareTo(b.toString()),
'IGNORE_CASE':
(a, b) => direction *
a.toString().toLowerCase().compareTo(b.toString().toLowerCase())
};
list = new List.from(list);
var compare = compareFuncs[type];
list.sort(compare);
return list;
}
`)+"("+b+', "'+a+'", '+c+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.lists_split=function(a){let b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"INPUT",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX);const c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"DELIM",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"===a)b||(b="''"),a="split";else if("JOIN"===a)b||(b="[]"),a="join";else throw Error("Unknown mode: "+a);return[b+"."+a+"("+c+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.lists_reverse=function(a){return["new List.from("+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LIST",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"[]")+".reversed)",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};var module$exports$Blockly$Dart$colour={};module$exports$Blockly$Dart.dartGenerator.addReservedWords("Math");module$exports$Blockly$Dart.dartGenerator.colour_picker=function(a){return[module$exports$Blockly$Dart.dartGenerator.quote_(a.getFieldValue("COLOUR")),module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]};
module$exports$Blockly$Dart.dartGenerator.colour_random=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("colour_random",`
String ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}() {
String hex = '0123456789abcdef';
var rnd = new Math.Random();
return '#\${hex[rnd.nextInt(16)]}\${hex[rnd.nextInt(16)]}'
'\${hex[rnd.nextInt(16)]}\${hex[rnd.nextInt(16)]}'
'\${hex[rnd.nextInt(16)]}\${hex[rnd.nextInt(16)]}';
}
`)+"()",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.colour_rgb=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"RED",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||0,c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"GREEN",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||0;a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"BLUE",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||0;module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math=
"import 'dart:math' as Math;";return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("colour_rgb",`
String ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(num r, num g, num b) {
num rn = (Math.max(Math.min(r, 100), 0) * 2.55).round();
String rs = rn.toInt().toRadixString(16);
rs = '0$rs';
rs = rs.substring(rs.length - 2);
num gn = (Math.max(Math.min(g, 100), 0) * 2.55).round();
String gs = gn.toInt().toRadixString(16);
gs = '0$gs';
gs = gs.substring(gs.length - 2);
num bn = (Math.max(Math.min(b, 100), 0) * 2.55).round();
String bs = bn.toInt().toRadixString(16);
bs = '0$bs';
bs = bs.substring(bs.length - 2);
return '#$rs$gs$bs';
}
`)+"("+b+", "+c+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};
module$exports$Blockly$Dart.dartGenerator.colour_blend=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"COLOUR1",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"'#000000'",c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"COLOUR2",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"'#000000'";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"RATIO",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||.5;module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math=
"import 'dart:math' as Math;";return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("colour_blend",`
String ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(String c1, String c2, num ratio) {
ratio = Math.max(Math.min(ratio, 1), 0);
int r1 = int.parse('0x\${c1.substring(1, 3)}');
int g1 = int.parse('0x\${c1.substring(3, 5)}');
int b1 = int.parse('0x\${c1.substring(5, 7)}');
int r2 = int.parse('0x\${c2.substring(1, 3)}');
int g2 = int.parse('0x\${c2.substring(3, 5)}');
int b2 = int.parse('0x\${c2.substring(5, 7)}');
num rn = (r1 * (1 - ratio) + r2 * ratio).round();
String rs = rn.toInt().toRadixString(16);
num gn = (g1 * (1 - ratio) + g2 * ratio).round();
String gs = gn.toInt().toRadixString(16);
num bn = (b1 * (1 - ratio) + b2 * ratio).round();
String bs = bn.toInt().toRadixString(16);
rs = '0$rs';
rs = rs.substring(rs.length - 2);
gs = '0$gs';
gs = gs.substring(gs.length - 2);
bs = '0$bs';
bs = bs.substring(bs.length - 2);
return '#$rs$gs$bs';
}
`)+"("+b+", "+c+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};var module$exports$Blockly$Dart$all=module$exports$Blockly$Dart;
module$exports$Blockly$Dart.__namespace__=$;
return module$exports$Blockly$Dart;
}));
//# sourceMappingURL=dart_compressed.js.map