// 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 { // Script
    root.php = factory(root.Blockly);
    root.Blockly.PHP = root.php.phpGenerator;
  }
}(this, function(__parent__) {
var $=__parent__.__namespace__;
var colour_picker$$module$build$src$generators$php$colour=function(a,b){return[b.quote_(a.getFieldValue("COLOUR")),Order$$module$build$src$generators$php$php_generator.ATOMIC]},colour_random$$module$build$src$generators$php$colour=function(a,b){return[b.provideFunction_("colour_random",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}() {
  return '#' . str_pad(dechex(mt_rand(0, 0xFFFFFF)), 6, '0', STR_PAD_LEFT);
}
`)+"()",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},colour_rgb$$module$build$src$generators$php$colour=function(a,b){const c=b.valueToCode(a,"RED",Order$$module$build$src$generators$php$php_generator.NONE)||0,d=b.valueToCode(a,"GREEN",Order$$module$build$src$generators$php$php_generator.NONE)||0;a=b.valueToCode(a,"BLUE",Order$$module$build$src$generators$php$php_generator.NONE)||0;return[b.provideFunction_("colour_rgb",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($r, $g, $b) {
  $r = round(max(min($r, 100), 0) * 2.55);
  $g = round(max(min($g, 100), 0) * 2.55);
  $b = round(max(min($b, 100), 0) * 2.55);
  $hex = '#';
  $hex .= str_pad(dechex($r), 2, '0', STR_PAD_LEFT);
  $hex .= str_pad(dechex($g), 2, '0', STR_PAD_LEFT);
  $hex .= str_pad(dechex($b), 2, '0', STR_PAD_LEFT);
  return $hex;
}
`)+"("+c+", "+d+", "+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},colour_blend$$module$build$src$generators$php$colour=function(a,b){const c=b.valueToCode(a,"COLOUR1",Order$$module$build$src$generators$php$php_generator.NONE)||"'#000000'",d=b.valueToCode(a,"COLOUR2",Order$$module$build$src$generators$php$php_generator.NONE)||"'#000000'";a=b.valueToCode(a,"RATIO",Order$$module$build$src$generators$php$php_generator.NONE)||.5;return[b.provideFunction_("colour_blend",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($c1, $c2, $ratio) {
  $ratio = max(min($ratio, 1), 0);
  $r1 = hexdec(substr($c1, 1, 2));
  $g1 = hexdec(substr($c1, 3, 2));
  $b1 = hexdec(substr($c1, 5, 2));
  $r2 = hexdec(substr($c2, 1, 2));
  $g2 = hexdec(substr($c2, 3, 2));
  $b2 = hexdec(substr($c2, 5, 2));
  $r = round($r1 * (1 - $ratio) + $r2 * $ratio);
  $g = round($g1 * (1 - $ratio) + $g2 * $ratio);
  $b = round($b1 * (1 - $ratio) + $b2 * $ratio);
  $hex = '#';
  $hex .= str_pad(dechex($r), 2, '0', STR_PAD_LEFT);
  $hex .= str_pad(dechex($g), 2, '0', STR_PAD_LEFT);
  $hex .= str_pad(dechex($b), 2, '0', STR_PAD_LEFT);
  return $hex;
}
`)+"("+c+", "+d+", "+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_create_empty$$module$build$src$generators$php$lists=function(a,b){return["array()",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_create_with$$module$build$src$generators$php$lists=function(a,b){let c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$php$php_generator.NONE)||"null";c="array("+c.join(", ")+
")";return[c,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_repeat$$module$build$src$generators$php$lists=function(a,b){const c=b.provideFunction_("lists_repeat",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($value, $count) {
  $array = array();
  for ($index = 0; $index < $count; $index++) {
    $array[] = $value;
  }
  return $array;
}
`),d=b.valueToCode(a,"ITEM",Order$$module$build$src$generators$php$php_generator.NONE)||"null";a=b.valueToCode(a,"NUM",Order$$module$build$src$generators$php$php_generator.NONE)||"0";return[c+"("+d+", "+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_length$$module$build$src$generators$php$lists=function(a,b){const c=b.provideFunction_("length",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($value) {
  if (is_string($value)) {
    return strlen($value);
  } else {
    return count($value);
  }
}
`);a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''";return[c+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_isEmpty$$module$build$src$generators$php$lists=function(a,b){return["empty("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL)||"array()")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_indexOf$$module$build$src$generators$php$lists=function(a,
b){const c=b.valueToCode(a,"FIND",Order$$module$build$src$generators$php$php_generator.NONE)||"''",d=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.MEMBER)||"[]";let e=" -1",f="";a.workspace.options.oneBasedIndex&&(e=" 0",f=" + 1");return[("FIRST"===a.getFieldValue("END")?b.provideFunction_("indexOf",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($haystack, $needle) {
  for ($index = 0; $index < count($haystack); $index++) {
    if ($haystack[$index] == $needle) return $index${f};
  }
  return ${e};
}
`):b.provideFunction_("lastIndexOf",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($haystack, $needle) {
  $last = ${e};
  for ($index = 0; $index < count($haystack); $index++) {
    if ($haystack[$index] == $needle) $last = $index${f};
  }
  return $last;
}
`))+"("+d+", "+c+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_getIndex$$module$build$src$generators$php$lists=function(a,b){var c=a.getFieldValue("MODE")||"GET";switch(a.getFieldValue("WHERE")||"FROM_START"){case "FIRST":if("GET"===c)return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.MEMBER)||"array()")+"[0]",Order$$module$build$src$generators$php$php_generator.MEMBER];if("GET_REMOVE"===c)return["array_shift("+(b.valueToCode(a,"VALUE",
Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return"array_shift("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+");\n";break;case "LAST":if("GET"===c)return["end("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("GET_REMOVE"===
c)return["array_pop("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return"array_pop("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+");\n";break;case "FROM_START":var d=b.getAdjusted(a,"AT");if("GET"===c)return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.MEMBER)||"array()")+"["+
d+"]",Order$$module$build$src$generators$php$php_generator.MEMBER];if("GET_REMOVE"===c)return["array_splice("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+", "+d+", 1)[0]",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return"array_splice("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+", "+d+", 1);\n";break;case "FROM_END":if("GET"===c)return c=b.valueToCode(a,
"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()",b=b.getAdjusted(a,"AT",1,!0),["array_slice("+c+", "+b+", 1)[0]",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("GET_REMOVE"===c||"REMOVE"===c){d=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()";b=b.getAdjusted(a,"AT",1,!1,Order$$module$build$src$generators$php$php_generator.SUBTRACTION);b="array_splice("+d+", count("+d+") - "+b+", 1)[0]";if("GET_REMOVE"===
c)return[b,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return b+";\n"}break;case "RANDOM":a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()";if("GET"===c)return[b.provideFunction_("lists_get_random_item",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($list) {
  return $list[rand(0,count($list)-1)];
}
`)+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("GET_REMOVE"===c)return[b.provideFunction_("lists_get_remove_random_item",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list) {
  $x = rand(0,count($list)-1);
  unset($list[$x]);
  return array_values($list);
}
`)+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return b.provideFunction_("lists_remove_random_item",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list) {
  unset($list[rand(0,count($list)-1)]);
}
`)+"("+a+");\n"}throw Error("Unhandled combination (lists_getIndex).");},lists_setIndex$$module$build$src$generators$php$lists=function(a,b){const c=a.getFieldValue("MODE")||"GET";var d=a.getFieldValue("WHERE")||"FROM_START";const e=b.valueToCode(a,"TO",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"null";switch(d){case "FIRST":if("SET"===c)return(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.MEMBER)||"array()")+"[0] = "+e+";\n";if("INSERT"===c)return"array_unshift("+
(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+", "+e+");\n";break;case "LAST":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()";if("SET"===c)return b.provideFunction_("lists_set_last_item",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list, $value) {
  $list[count($list) - 1] = $value;
}
`)+"("+a+", "+e+");\n";if("INSERT"===c)return"array_push("+a+", "+e+");\n";break;case "FROM_START":d=b.getAdjusted(a,"AT");if("SET"===c)return(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.MEMBER)||"array()")+"["+d+"] = "+e+";\n";if("INSERT"===c)return"array_splice("+(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+", "+d+", 0, "+e+");\n";break;case "FROM_END":d=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||
"array()";a=b.getAdjusted(a,"AT",1);if("SET"===c)return b.provideFunction_("lists_set_from_end",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list, $at, $value) {
  $list[count($list) - $at] = $value;
}
`)+"("+d+", "+a+", "+e+");\n";if("INSERT"===c)return b.provideFunction_("lists_insert_from_end",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list, $at, $value) {
  return array_splice($list, count($list) - $at, 0, $value);
}
`)+"("+d+", "+a+", "+e+");\n";break;case "RANDOM":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.REFERENCE)||"array()";if(a.match(/^\$\w+$/))d="";else{d=b.nameDB_.getDistinctName("tmp_list",$.NameType$$module$build$src$core$names.VARIABLE);var f=d+" = &"+a+";\n";a=d;d=f}b=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE);d+=b+" = rand(0, count("+a+")-1);\n";if("SET"===c)return d+(a+"["+b+"] = "+e+";\n");if("INSERT"===c)return d+("array_splice("+
a+", "+b+", 0, "+e+");\n")}throw Error("Unhandled combination (lists_setIndex).");},lists_getSublist$$module$build$src$generators$php$lists=function(a,b){var c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()",d=a.getFieldValue("WHERE1");const e=a.getFieldValue("WHERE2");if("FIRST"!==d||"LAST"!==e)if(c.match(/^\$\w+$/)||"FROM_END"!==d&&"FROM_START"===e){switch(d){case "FROM_START":d=b.getAdjusted(a,"AT1");break;case "FROM_END":d=b.getAdjusted(a,"AT1",1,!1,
Order$$module$build$src$generators$php$php_generator.SUBTRACTION);d="count("+c+") - "+d;break;case "FIRST":d="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(e){case "FROM_START":b=b.getAdjusted(a,"AT2",0,!1,Order$$module$build$src$generators$php$php_generator.SUBTRACTION);b+=" - ";b=$.isNumber$$module$build$src$core$utils$string(String(d))||String(d).match(/^\(.+\)$/)?b+d:b+("("+d+")");b+=" + 1";break;case "FROM_END":b=b.getAdjusted(a,"AT2",0,!1,Order$$module$build$src$generators$php$php_generator.SUBTRACTION);
b="count("+c+") - "+b+" - ";b=$.isNumber$$module$build$src$core$utils$string(String(d))||String(d).match(/^\(.+\)$/)?b+d:b+("("+d+")");break;case "LAST":b="count("+c+") - ";b=$.isNumber$$module$build$src$core$utils$string(String(d))||String(d).match(/^\(.+\)$/)?b+d:b+("("+d+")");break;default:throw Error("Unhandled option (lists_getSublist).");}c="array_slice("+c+", "+d+", "+b+")"}else{const f=b.getAdjusted(a,"AT1");a=b.getAdjusted(a,"AT2");c=b.provideFunction_("lists_get_sublist",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($list, $where1, $at1, $where2, $at2) {
  if ($where1 == 'FROM_END') {
    $at1 = count($list) - 1 - $at1;
  } else if ($where1 == 'FIRST') {
    $at1 = 0;
  } else if ($where1 != 'FROM_START') {
    throw new Exception('Unhandled option (lists_get_sublist).');
  }
  $length = 0;
  if ($where2 == 'FROM_START') {
    $length = $at2 - $at1 + 1;
  } else if ($where2 == 'FROM_END') {
    $length = count($list) - $at1 - $at2;
  } else if ($where2 == 'LAST') {
    $length = count($list) - $at1;
  } else {
    throw new Exception('Unhandled option (lists_get_sublist).');
  }
  return array_slice($list, $at1, $length);
}
`)+"("+c+", '"+d+"', "+f+", '"+e+"', "+a+")"}return[c,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_sort$$module$build$src$generators$php$lists=function(a,b){const c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()",d="1"===a.getFieldValue("DIRECTION")?1:-1;a=a.getFieldValue("TYPE");return[b.provideFunction_("lists_sort",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($list, $type, $direction) {
  $sortCmpFuncs = array(
    'NUMERIC' => 'strnatcasecmp',
    'TEXT' => 'strcmp',
    'IGNORE_CASE' => 'strcasecmp'
  );
  $sortCmp = $sortCmpFuncs[$type];
  $list2 = $list;
  usort($list2, $sortCmp);
  if ($direction == -1) {
    $list2 = array_reverse($list2);
  }
  return $list2;
}
`)+"("+c+', "'+a+'", '+d+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_split$$module$build$src$generators$php$lists=function(a,b){let c=b.valueToCode(a,"INPUT",Order$$module$build$src$generators$php$php_generator.NONE);b=b.valueToCode(a,"DELIM",Order$$module$build$src$generators$php$php_generator.NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"===a)c||(c="''"),a="explode";else if("JOIN"===a)c||(c="array()"),a="implode";else throw Error("Unknown mode: "+a);return[a+
"("+b+", "+c+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_reverse$$module$build$src$generators$php$lists=function(a,b){return["array_reverse("+(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"[]")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},controls_if$$module$build$src$generators$php$logic=function(a,b){let c=0,d="",e,f;b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do f=b.valueToCode(a,
"IF"+c,Order$$module$build$src$generators$php$php_generator.NONE)||"false",e=b.statementToCode(a,"DO"+c),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=(0<c?" else ":"")+"if ("+f+") {\n"+e+"}",c++;while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)e=b.statementToCode(a,"ELSE"),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=" else {\n"+e+"}";return d+"\n"},logic_compare$$module$build$src$generators$php$logic=
function(a,b){const c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d="=="===c||"!="===c?Order$$module$build$src$generators$php$php_generator.EQUALITY:Order$$module$build$src$generators$php$php_generator.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]},logic_operation$$module$build$src$generators$php$logic=function(a,b){const c="AND"===a.getFieldValue("OP")?"&&":"||",d="&&"===c?Order$$module$build$src$generators$php$php_generator.LOGICAL_AND:
Order$$module$build$src$generators$php$php_generator.LOGICAL_OR;let e=b.valueToCode(a,"A",d);a=b.valueToCode(a,"B",d);e||a?(b="&&"===c?"true":"false",e||(e=b),a||(a=b)):a=e="false";return[e+" "+c+" "+a,d]},logic_negate$$module$build$src$generators$php$logic=function(a,b){const c=Order$$module$build$src$generators$php$php_generator.LOGICAL_NOT;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]},logic_boolean$$module$build$src$generators$php$logic=function(a,b){return["TRUE"===a.getFieldValue("BOOL")?
"true":"false",Order$$module$build$src$generators$php$php_generator.ATOMIC]},logic_null$$module$build$src$generators$php$logic=function(a,b){return["null",Order$$module$build$src$generators$php$php_generator.ATOMIC]},logic_ternary$$module$build$src$generators$php$logic=function(a,b){const c=b.valueToCode(a,"IF",Order$$module$build$src$generators$php$php_generator.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Order$$module$build$src$generators$php$php_generator.CONDITIONAL)||"null";a=b.valueToCode(a,
"ELSE",Order$$module$build$src$generators$php$php_generator.CONDITIONAL)||"null";return[c+" ? "+d+" : "+a,Order$$module$build$src$generators$php$php_generator.CONDITIONAL]},controls_repeat_ext$$module$build$src$generators$php$loops=function(a,b){let c;c=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):b.valueToCode(a,"TIMES",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"0";let d=b.statementToCode(a,"DO");d=b.addLoopTrap(d,a);a="";const e=b.nameDB_.getDistinctName("count",
$.NameType$$module$build$src$core$names.VARIABLE);let f=c;c.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(c)||(f=b.nameDB_.getDistinctName("repeat_end",$.NameType$$module$build$src$core$names.VARIABLE),a+=f+" = "+c+";\n");return a+("for ("+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},controls_whileUntil$$module$build$src$generators$php$loops=function(a,b){const c="UNTIL"===a.getFieldValue("MODE");let d=b.valueToCode(a,"BOOL",c?Order$$module$build$src$generators$php$php_generator.LOGICAL_NOT:
Order$$module$build$src$generators$php$php_generator.NONE)||"false",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"},controls_for$$module$build$src$generators$php$loops=function(a,b){var c=b.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),d=b.valueToCode(a,"FROM",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"0",e=b.valueToCode(a,"TO",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||
"0";const f=b.valueToCode(a,"BY",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"1";let g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a);if($.isNumber$$module$build$src$core$utils$string(d)&&$.isNumber$$module$build$src$core$utils$string(e)&&$.isNumber$$module$build$src$core$utils$string(f))b=Number(d)<=Number(e),a="for ("+c+" = "+d+"; "+c+(b?" <= ":" >= ")+e+"; "+c,c=Math.abs(Number(f)),a=1===c?a+(b?"++":"--"):a+((b?" += ":" -= ")+c),a+=") {\n"+g+"}\n";else{a="";let h=d;d.match(/^\w+$/)||
$.isNumber$$module$build$src$core$utils$string(d)||(h=b.nameDB_.getDistinctName(c+"_start",$.NameType$$module$build$src$core$names.VARIABLE),a+=h+" = "+d+";\n");d=e;e.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(e)||(d=b.nameDB_.getDistinctName(c+"_end",$.NameType$$module$build$src$core$names.VARIABLE),a+=d+" = "+e+";\n");e=b.nameDB_.getDistinctName(c+"_inc",$.NameType$$module$build$src$core$names.VARIABLE);a+=e+" = ";a=$.isNumber$$module$build$src$core$utils$string(f)?a+(Math.abs(f)+
";\n"):a+("abs("+f+");\n");a+="if ("+h+" > "+d+") {\n";a+=b.INDENT+e+" = -"+e+";\n";a=a+"}\nfor ("+(c+" = "+h+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+g+"}\n")}return a},controls_forEach$$module$build$src$generators$php$loops=function(a,b){const c=b.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),d=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"[]";let e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,
a);return"foreach ("+d+" as "+c+") {\n"+e+"}\n"},controls_flow_statements$$module$build$src$generators$php$loops=function(a,b){let c="";b.STATEMENT_PREFIX&&(c+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(c+=b.injectId(b.STATEMENT_SUFFIX,a));if(b.STATEMENT_PREFIX){const d=a.getSurroundLoop();d&&!d.suppressPrefixSuffix&&(c+=b.injectId(b.STATEMENT_PREFIX,d))}switch(a.getFieldValue("FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");
},math_number$$module$build$src$generators$php$math=function(a,b){a=Number(a.getFieldValue("NUM"));b=0<=a?Order$$module$build$src$generators$php$php_generator.ATOMIC:Order$$module$build$src$generators$php$php_generator.UNARY_NEGATION;Infinity===a?a="INF":-Infinity===a&&(a="-INF");return[a,b]},math_arithmetic$$module$build$src$generators$php$math=function(a,b){var c={ADD:[" + ",Order$$module$build$src$generators$php$php_generator.ADDITION],MINUS:[" - ",Order$$module$build$src$generators$php$php_generator.SUBTRACTION],
MULTIPLY:[" * ",Order$$module$build$src$generators$php$php_generator.MULTIPLICATION],DIVIDE:[" / ",Order$$module$build$src$generators$php$php_generator.DIVISION],POWER:[" ** ",Order$$module$build$src$generators$php$php_generator.POWER]}[a.getFieldValue("OP")];const d=c[0];c=c[1];const e=b.valueToCode(a,"A",c)||"0";a=b.valueToCode(a,"B",c)||"0";return[e+d+a,c]},math_single$$module$build$src$generators$php$math=function(a,b){const c=a.getFieldValue("OP");let d;if("NEG"===c)return a=b.valueToCode(a,
"NUM",Order$$module$build$src$generators$php$php_generator.UNARY_NEGATION)||"0","-"===a[0]&&(a=" "+a),["-"+a,Order$$module$build$src$generators$php$php_generator.UNARY_NEGATION];a="SIN"===c||"COS"===c||"TAN"===c?b.valueToCode(a,"NUM",Order$$module$build$src$generators$php$php_generator.DIVISION)||"0":b.valueToCode(a,"NUM",Order$$module$build$src$generators$php$php_generator.NONE)||"0";switch(c){case "ABS":d="abs("+a+")";break;case "ROOT":d="sqrt("+a+")";break;case "LN":d="log("+a+")";break;case "EXP":d=
"exp("+a+")";break;case "POW10":d="pow(10,"+a+")";break;case "ROUND":d="round("+a+")";break;case "ROUNDUP":d="ceil("+a+")";break;case "ROUNDDOWN":d="floor("+a+")";break;case "SIN":d="sin("+a+" / 180 * pi())";break;case "COS":d="cos("+a+" / 180 * pi())";break;case "TAN":d="tan("+a+" / 180 * pi())"}if(d)return[d,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];switch(c){case "LOG10":d="log("+a+") / log(10)";break;case "ASIN":d="asin("+a+") / pi() * 180";break;case "ACOS":d="acos("+
a+") / pi() * 180";break;case "ATAN":d="atan("+a+") / pi() * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,Order$$module$build$src$generators$php$php_generator.DIVISION]},math_constant$$module$build$src$generators$php$math=function(a,b){return{PI:["M_PI",Order$$module$build$src$generators$php$php_generator.ATOMIC],E:["M_E",Order$$module$build$src$generators$php$php_generator.ATOMIC],GOLDEN_RATIO:["(1 + sqrt(5)) / 2",Order$$module$build$src$generators$php$php_generator.DIVISION],
SQRT2:["M_SQRT2",Order$$module$build$src$generators$php$php_generator.ATOMIC],SQRT1_2:["M_SQRT1_2",Order$$module$build$src$generators$php$php_generator.ATOMIC],INFINITY:["INF",Order$$module$build$src$generators$php$php_generator.ATOMIC]}[a.getFieldValue("CONSTANT")]},math_number_property$$module$build$src$generators$php$math=function(a,b){var c={EVEN:[""," % 2 == 0",Order$$module$build$src$generators$php$php_generator.MODULUS,Order$$module$build$src$generators$php$php_generator.EQUALITY],ODD:["",
" % 2 == 1",Order$$module$build$src$generators$php$php_generator.MODULUS,Order$$module$build$src$generators$php$php_generator.EQUALITY],WHOLE:["is_int(",")",Order$$module$build$src$generators$php$php_generator.NONE,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL],POSITIVE:[""," > 0",Order$$module$build$src$generators$php$php_generator.RELATIONAL,Order$$module$build$src$generators$php$php_generator.RELATIONAL],NEGATIVE:[""," < 0",Order$$module$build$src$generators$php$php_generator.RELATIONAL,
Order$$module$build$src$generators$php$php_generator.RELATIONAL],DIVISIBLE_BY:[null,null,Order$$module$build$src$generators$php$php_generator.MODULUS,Order$$module$build$src$generators$php$php_generator.EQUALITY],PRIME:[null,null,Order$$module$build$src$generators$php$php_generator.NONE,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]};const d=a.getFieldValue("PROPERTY"),[e,f,g,h]=c[d];c=b.valueToCode(a,"NUMBER_TO_CHECK",g)||"0";if("PRIME"===d)a=b.provideFunction_("math_isPrime",
`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($n) {
  // https://en.wikipedia.org/wiki/Primality_test#Naive_methods
  if ($n == 2 || $n == 3) {
    return true;
  }
  // False if n is NaN, negative, is 1, or not whole.
  // And false if n is divisible by 2 or 3.
  if (!is_numeric($n) || $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 ($x = 6; $x <= sqrt($n) + 1; $x += 6) {
    if ($n % ($x - 1) == 0 || $n % ($x + 1) == 0) {
      return false;
    }
  }
  return true;
}
`)+"("+c+")";else if("DIVISIBLE_BY"===d){a=b.valueToCode(a,"DIVISOR",Order$$module$build$src$generators$php$php_generator.MODULUS)||"0";if("0"===a)return["false",Order$$module$build$src$generators$php$php_generator.ATOMIC];a=c+" % "+a+" == 0"}else a=e+c+f;return[a,h]},math_change$$module$build$src$generators$php$math=function(a,b){const c=b.valueToCode(a,"DELTA",Order$$module$build$src$generators$php$php_generator.ADDITION)||"0";return b.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE)+
" += "+c+";\n"},math_on_list$$module$build$src$generators$php$math=function(a,b){var c=a.getFieldValue("OP");switch(c){case "SUM":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL)||"array()";a="array_sum("+a+")";break;case "MIN":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL)||"array()";a="min("+a+")";break;case "MAX":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL)||
"array()";a="max("+a+")";break;case "AVERAGE":c=b.provideFunction_("math_mean",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($myList) {
  return array_sum($myList) / count($myList);
}
`);a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()";a=c+"("+a+")";break;case "MEDIAN":c=b.provideFunction_("math_median",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($arr) {
  sort($arr,SORT_NUMERIC);
  return (count($arr) % 2) ? $arr[floor(count($arr) / 2)] :
      ($arr[floor(count($arr) / 2)] + $arr[floor(count($arr) / 2) - 1]) / 2;
}
`);a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"[]";a=c+"("+a+")";break;case "MODE":c=b.provideFunction_("math_modes",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($values) {
  if (empty($values)) return array();
  $counts = array_count_values($values);
  arsort($counts); // Sort counts in descending order
  $modes = array_keys($counts, current($counts), true);
  return $modes;
}
`);a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"[]";a=c+"("+a+")";break;case "STD_DEV":c=b.provideFunction_("math_standard_deviation",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($numbers) {
  $n = count($numbers);
  if (!$n) return null;
  $mean = array_sum($numbers) / count($numbers);
  foreach($numbers as $key => $num) $devs[$key] = pow($num - $mean, 2);
  return sqrt(array_sum($devs) / (count($devs) - 1));
}
`);a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"[]";a=c+"("+a+")";break;case "RANDOM":c=b.provideFunction_("math_random_list",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($list) {
  $x = rand(0, count($list)-1);
  return $list[$x];
}
`);a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"[]";a=c+"("+a+")";break;default:throw Error("Unknown operator: "+c);}return[a,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},math_modulo$$module$build$src$generators$php$math=function(a,b){const c=b.valueToCode(a,"DIVIDEND",Order$$module$build$src$generators$php$php_generator.MODULUS)||"0";a=b.valueToCode(a,"DIVISOR",Order$$module$build$src$generators$php$php_generator.MODULUS)||"0";return[c+
" % "+a,Order$$module$build$src$generators$php$php_generator.MODULUS]},math_constrain$$module$build$src$generators$php$math=function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"0",d=b.valueToCode(a,"LOW",Order$$module$build$src$generators$php$php_generator.NONE)||"0";a=b.valueToCode(a,"HIGH",Order$$module$build$src$generators$php$php_generator.NONE)||"Infinity";return["min(max("+c+", "+d+"), "+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},
math_random_int$$module$build$src$generators$php$math=function(a,b){const c=b.valueToCode(a,"FROM",Order$$module$build$src$generators$php$php_generator.NONE)||"0";a=b.valueToCode(a,"TO",Order$$module$build$src$generators$php$php_generator.NONE)||"0";return[b.provideFunction_("math_random_int",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($a, $b) {
  if ($a > $b) {
    return rand($b, $a);
  }
  return rand($a, $b);
}
`)+"("+c+", "+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},math_random_float$$module$build$src$generators$php$math=function(a,b){return["(float)rand()/(float)getrandmax()",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},math_atan2$$module$build$src$generators$php$math=function(a,b){const c=b.valueToCode(a,"X",Order$$module$build$src$generators$php$php_generator.NONE)||"0";return["atan2("+(b.valueToCode(a,"Y",Order$$module$build$src$generators$php$php_generator.NONE)||
"0")+", "+c+") / pi() * 180",Order$$module$build$src$generators$php$php_generator.DIVISION]},procedures_defreturn$$module$build$src$generators$php$procedures=function(a,b){var c=[],d=a.workspace,e=$.allUsedVarModels$$module$build$src$core$variables(d)||[];for(let m=0,p;p=e[m];m++){var f=p.name;-1===a.getVars().indexOf(f)&&c.push(b.nameDB_.getName(f,$.NameType$$module$build$src$core$names.VARIABLE))}d=$.allDeveloperVariables$$module$build$src$core$variables(d);for(e=0;e<d.length;e++)c.push(b.nameDB_.getName(d[e],
$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));d=c.length?b.INDENT+"global "+c.join(", ")+";\n":"";c=b.nameDB_.getName(a.getFieldValue("NAME"),$.NameType$$module$build$src$core$names.PROCEDURE);e="";b.STATEMENT_PREFIX&&(e+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(e+=b.injectId(b.STATEMENT_SUFFIX,a));e&&(e=b.prefixLines(e,b.INDENT));f="";b.INFINITE_LOOP_TRAP&&(f=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));const g=b.statementToCode(a,"STACK");let h=b.valueToCode(a,
"RETURN",Order$$module$build$src$generators$php$php_generator.NONE)||"",k="";g&&h&&(k=e);h&&(h=b.INDENT+"return "+h+";\n");const l=[],n=a.getVars();for(let m=0;m<n.length;m++)l[m]=b.nameDB_.getName(n[m],$.NameType$$module$build$src$core$names.VARIABLE);d="function "+c+"("+l.join(", ")+") {\n"+d+e+f+g+k+h+"}";d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},procedures_callreturn$$module$build$src$generators$php$procedures=function(a,b){const c=b.nameDB_.getName(a.getFieldValue("NAME"),$.NameType$$module$build$src$core$names.PROCEDURE),
d=[],e=a.getVars();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Order$$module$build$src$generators$php$php_generator.NONE)||"null";return[c+"("+d.join(", ")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},procedures_callnoreturn$$module$build$src$generators$php$procedures=function(a,b){return b.forBlock.procedures_callreturn(a,b)[0]+";\n"},procedures_ifreturn$$module$build$src$generators$php$procedures=function(a,b){let c="if ("+(b.valueToCode(a,"CONDITION",Order$$module$build$src$generators$php$php_generator.NONE)||
"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"},text$$module$build$src$generators$php$text=function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Order$$module$build$src$generators$php$php_generator.ATOMIC]},text_multiline$$module$build$src$generators$php$text=function(a,
b){a=b.multiline_quote_(a.getFieldValue("TEXT"));b=-1!==a.indexOf(".")?Order$$module$build$src$generators$php$php_generator.STRING_CONCAT:Order$$module$build$src$generators$php$php_generator.ATOMIC;return[a,b]},text_join$$module$build$src$generators$php$text=function(a,b){if(0===a.itemCount_)return["''",Order$$module$build$src$generators$php$php_generator.ATOMIC];if(1===a.itemCount_)return[b.valueToCode(a,"ADD0",Order$$module$build$src$generators$php$php_generator.NONE)||"''",Order$$module$build$src$generators$php$php_generator.NONE];
if(2===a.itemCount_){var c=b.valueToCode(a,"ADD0",Order$$module$build$src$generators$php$php_generator.STRING_CONCAT)||"''";a=b.valueToCode(a,"ADD1",Order$$module$build$src$generators$php$php_generator.STRING_CONCAT)||"''";return[c+" . "+a,Order$$module$build$src$generators$php$php_generator.STRING_CONCAT]}c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$php$php_generator.NONE)||"''";return["implode('', array("+c.join(",")+"))",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},
text_append$$module$build$src$generators$php$text=function(a,b){const c=b.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE);a=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"''";return c+" .= "+a+";\n"},text_length$$module$build$src$generators$php$text=function(a,b){const c=b.provideFunction_("length",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($value) {
  if (is_string($value)) {
    return strlen($value);
  }
  return count($value);
}
`);a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''";return[c+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_isEmpty$$module$build$src$generators$php$text=function(a,b){return["empty("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_indexOf$$module$build$src$generators$php$text=function(a,b){const c="FIRST"===
a.getFieldValue("END")?"strpos":"strrpos",d=b.valueToCode(a,"FIND",Order$$module$build$src$generators$php$php_generator.NONE)||"''",e=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''";let f=" -1",g="";a.workspace.options.oneBasedIndex&&(f=" 0",g=" + 1");return[b.provideFunction_("FIRST"===a.getFieldValue("END")?"text_indexOf":"text_lastIndexOf",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($text, $search) {
  $pos = ${c}($text, $search);
  return $pos === false ? ${f} : $pos${g};
}
`)+"("+e+", "+d+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_charAt$$module$build$src$generators$php$text=function(a,b){const c=a.getFieldValue("WHERE")||"FROM_START",d=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''";switch(c){case "FIRST":return["substr("+d+", 0, 1)",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];case "LAST":return["substr("+d+", -1)",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];
case "FROM_START":return a=b.getAdjusted(a,"AT"),["substr("+d+", "+a+", 1)",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];case "FROM_END":return a=b.getAdjusted(a,"AT",1,!0),["substr("+d+", "+a+", 1)",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];case "RANDOM":return[b.provideFunction_("text_random_letter",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($text) {
  return $text[rand(0, strlen($text) - 1)];
}
`)+"("+d+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");},text_getSubstring$$module$build$src$generators$php$text=function(a,b){const c=a.getFieldValue("WHERE1"),d=a.getFieldValue("WHERE2"),e=b.valueToCode(a,"STRING",Order$$module$build$src$generators$php$php_generator.NONE)||"''";if("FIRST"===c&&"LAST"===d)return[e,Order$$module$build$src$generators$php$php_generator.NONE];const f=b.getAdjusted(a,"AT1");a=b.getAdjusted(a,"AT2");
return[b.provideFunction_("text_get_substring",`
function ${b.FUNCTION_NAME_PLACEHOLDER_}($text, $where1, $at1, $where2, $at2) {
  if ($where1 == 'FROM_END') {
    $at1 = strlen($text) - 1 - $at1;
  } else if ($where1 == 'FIRST') {
    $at1 = 0;
  } else if ($where1 != 'FROM_START') {
    throw new Exception('Unhandled option (text_get_substring).');
  }
  $length = 0;
  if ($where2 == 'FROM_START') {
    $length = $at2 - $at1 + 1;
  } else if ($where2 == 'FROM_END') {
    $length = strlen($text) - $at1 - $at2;
  } else if ($where2 == 'LAST') {
    $length = strlen($text) - $at1;
  } else {
    throw new Exception('Unhandled option (text_get_substring).');
  }
  return substr($text, $at1, $length);
}
`)+"("+e+", '"+c+"', "+f+", '"+d+"', "+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_changeCase$$module$build$src$generators$php$text=function(a,b){b=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''";let c;"UPPERCASE"===a.getFieldValue("CASE")?c="strtoupper("+b+")":"LOWERCASE"===a.getFieldValue("CASE")?c="strtolower("+b+")":"TITLECASE"===a.getFieldValue("CASE")&&(c="ucwords(strtolower("+b+"))");return[c,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},
text_trim$$module$build$src$generators$php$text=function(a,b){const c={LEFT:"ltrim",RIGHT:"rtrim",BOTH:"trim"}[a.getFieldValue("MODE")];a=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''";return[c+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_print$$module$build$src$generators$php$text=function(a,b){return"print("+(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''")+");\n"},text_prompt_ext$$module$build$src$generators$php$text=
function(a,b){b="readline("+(a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''")+")";"NUMBER"===a.getFieldValue("TYPE")&&(b="floatval("+b+")");return[b,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_count$$module$build$src$generators$php$text=function(a,b){const c=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''";a=b.valueToCode(a,"SUB",Order$$module$build$src$generators$php$php_generator.NONE)||
"''";return["strlen("+a+") === 0 ? strlen("+c+") + 1 : substr_count("+c+", "+a+")",Order$$module$build$src$generators$php$php_generator.CONDITIONAL]},text_replace$$module$build$src$generators$php$text=function(a,b){const c=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''",d=b.valueToCode(a,"FROM",Order$$module$build$src$generators$php$php_generator.NONE)||"''";a=b.valueToCode(a,"TO",Order$$module$build$src$generators$php$php_generator.NONE)||"''";return["str_replace("+
d+", "+a+", "+c+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_reverse$$module$build$src$generators$php$text=function(a,b){return["strrev("+(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},variables_get$$module$build$src$generators$php$variables=function(a,b){return[b.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),
Order$$module$build$src$generators$php$php_generator.ATOMIC]},variables_set$$module$build$src$generators$php$variables=function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"0";return b.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE)+" = "+c+";\n"},Order$$module$build$src$generators$php$php_generator={ATOMIC:0,CLONE:1,NEW:1,MEMBER:2.1,FUNCTION_CALL:2.2,POWER:3,INCREMENT:4,DECREMENT:4,BITWISE_NOT:4,CAST:4,
SUPPRESS_ERROR:4,INSTANCEOF:5,LOGICAL_NOT:6,UNARY_PLUS:7.1,UNARY_NEGATION:7.2,MULTIPLICATION:8.1,DIVISION:8.2,MODULUS:8.3,ADDITION:9.1,SUBTRACTION:9.2,STRING_CONCAT:9.3,BITWISE_SHIFT:10,RELATIONAL:11,EQUALITY:12,REFERENCE:13,BITWISE_AND:13,BITWISE_XOR:14,BITWISE_OR:15,LOGICAL_AND:16,LOGICAL_OR:17,IF_NULL:18,CONDITIONAL:19,ASSIGNMENT:20,LOGICAL_AND_WEAK:21,LOGICAL_XOR:22,LOGICAL_OR_WEAK:23,NONE:99},PhpGenerator$$module$build$src$generators$php$php_generator=class extends $.CodeGenerator$$module$build$src$core$generator{constructor(a){super(null!=
a?a:"PHP");this.ORDER_OVERRIDES=[[Order$$module$build$src$generators$php$php_generator.MEMBER,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL],[Order$$module$build$src$generators$php$php_generator.MEMBER,Order$$module$build$src$generators$php$php_generator.MEMBER],[Order$$module$build$src$generators$php$php_generator.LOGICAL_NOT,Order$$module$build$src$generators$php$php_generator.LOGICAL_NOT],[Order$$module$build$src$generators$php$php_generator.MULTIPLICATION,Order$$module$build$src$generators$php$php_generator.MULTIPLICATION],
[Order$$module$build$src$generators$php$php_generator.ADDITION,Order$$module$build$src$generators$php$php_generator.ADDITION],[Order$$module$build$src$generators$php$php_generator.LOGICAL_AND,Order$$module$build$src$generators$php$php_generator.LOGICAL_AND],[Order$$module$build$src$generators$php$php_generator.LOGICAL_OR,Order$$module$build$src$generators$php$php_generator.LOGICAL_OR]];this.isInitialized=!1;for(const b in Order$$module$build$src$generators$php$php_generator)this["ORDER_"+b]=Order$$module$build$src$generators$php$php_generator[b];
this.addReservedWords("__halt_compiler,abstract,and,array,as,break,callable,case,catch,class,clone,const,continue,declare,default,die,do,echo,else,elseif,empty,enddeclare,endfor,endforeach,endif,endswitch,endwhile,eval,exit,extends,final,for,foreach,function,global,goto,if,implements,include,include_once,instanceof,insteadof,interface,isset,list,namespace,new,or,print,private,protected,public,require,require_once,return,static,switch,throw,trait,try,unset,use,var,while,xor,PHP_VERSION,PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_VERSION_ID,PHP_EXTRA_VERSION,PHP_ZTS,PHP_DEBUG,PHP_MAXPATHLEN,PHP_OS,PHP_SAPI,PHP_EOL,PHP_INT_MAX,PHP_INT_SIZE,DEFAULT_INCLUDE_PATH,PEAR_INSTALL_DIR,PEAR_EXTENSION_DIR,PHP_EXTENSION_DIR,PHP_PREFIX,PHP_BINDIR,PHP_BINARY,PHP_MANDIR,PHP_LIBDIR,PHP_DATADIR,PHP_SYSCONFDIR,PHP_LOCALSTATEDIR,PHP_CONFIG_FILE_PATH,PHP_CONFIG_FILE_SCAN_DIR,PHP_SHLIB_SUFFIX,E_ERROR,E_WARNING,E_PARSE,E_NOTICE,E_CORE_ERROR,E_CORE_WARNING,E_COMPILE_ERROR,E_COMPILE_WARNING,E_USER_ERROR,E_USER_WARNING,E_USER_NOTICE,E_DEPRECATED,E_USER_DEPRECATED,E_ALL,E_STRICT,__COMPILER_HALT_OFFSET__,TRUE,FALSE,NULL,__CLASS__,__DIR__,__FILE__,__FUNCTION__,__LINE__,__METHOD__,__NAMESPACE__,__TRAIT__")}init(a){super.init(a);
this.nameDB_?this.nameDB_.reset():this.nameDB_=new $.Names$$module$build$src$core$names(this.RESERVED_WORDS_,"$");this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);this.isInitialized=!0}finish(a){const b=Object.values(this.definitions_);a=super.finish(a);this.isInitialized=!1;this.nameDB_.reset();return b.join("\n\n")+"\n\n\n"+a}scrubNakedValue(a){return a+";\n"}quote_(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/'/g,
"\\'");return"'"+a+"'"}multiline_quote_(a){return a.split(/\n/g).map(this.quote_).join(' . "\\n" .\n')}scrub_(a,b,c){let d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.wrap$$module$build$src$core$utils$string(e,this.COMMENT_WRAP-3),d+=this.prefixLines(e,"// ")+"\n");for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===$.inputTypes$$module$build$src$core$inputs$input_types.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}getAdjusted(a,b,c,d,e){c=c||0;e=e||this.ORDER_NONE;a.workspace.options.oneBasedIndex&&c--;let f=a.workspace.options.oneBasedIndex?"1":"0",g=e,h;0<c?h=g=this.ORDER_ADDITION:0>c?h=g=this.ORDER_SUBTRACTION:d&&(h=g=this.ORDER_UNARY_NEGATION);a=this.valueToCode(a,b,g)||f;$.isNumber$$module$build$src$core$utils$string(a)?(a=Number(a)+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}},module$build$src$generators$php$php_generator={};module$build$src$generators$php$php_generator.Order=Order$$module$build$src$generators$php$php_generator;module$build$src$generators$php$php_generator.PhpGenerator=PhpGenerator$$module$build$src$generators$php$php_generator;var module$build$src$generators$php$colour={};module$build$src$generators$php$colour.colour_blend=colour_blend$$module$build$src$generators$php$colour;module$build$src$generators$php$colour.colour_picker=colour_picker$$module$build$src$generators$php$colour;module$build$src$generators$php$colour.colour_random=colour_random$$module$build$src$generators$php$colour;module$build$src$generators$php$colour.colour_rgb=colour_rgb$$module$build$src$generators$php$colour;var module$build$src$generators$php$lists={};module$build$src$generators$php$lists.lists_create_empty=lists_create_empty$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_create_with=lists_create_with$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_getIndex=lists_getIndex$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_getSublist=lists_getSublist$$module$build$src$generators$php$lists;
module$build$src$generators$php$lists.lists_indexOf=lists_indexOf$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_isEmpty=lists_isEmpty$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_length=lists_length$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_repeat=lists_repeat$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_reverse=lists_reverse$$module$build$src$generators$php$lists;
module$build$src$generators$php$lists.lists_setIndex=lists_setIndex$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_sort=lists_sort$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_split=lists_split$$module$build$src$generators$php$lists;var controls_ifelse$$module$build$src$generators$php$logic=controls_if$$module$build$src$generators$php$logic,module$build$src$generators$php$logic={};module$build$src$generators$php$logic.controls_if=controls_if$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.controls_ifelse=controls_if$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.logic_boolean=logic_boolean$$module$build$src$generators$php$logic;
module$build$src$generators$php$logic.logic_compare=logic_compare$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.logic_negate=logic_negate$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.logic_null=logic_null$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.logic_operation=logic_operation$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.logic_ternary=logic_ternary$$module$build$src$generators$php$logic;var controls_repeat$$module$build$src$generators$php$loops=controls_repeat_ext$$module$build$src$generators$php$loops,module$build$src$generators$php$loops={};module$build$src$generators$php$loops.controls_flow_statements=controls_flow_statements$$module$build$src$generators$php$loops;module$build$src$generators$php$loops.controls_for=controls_for$$module$build$src$generators$php$loops;module$build$src$generators$php$loops.controls_forEach=controls_forEach$$module$build$src$generators$php$loops;
module$build$src$generators$php$loops.controls_repeat=controls_repeat_ext$$module$build$src$generators$php$loops;module$build$src$generators$php$loops.controls_repeat_ext=controls_repeat_ext$$module$build$src$generators$php$loops;module$build$src$generators$php$loops.controls_whileUntil=controls_whileUntil$$module$build$src$generators$php$loops;var math_round$$module$build$src$generators$php$math=math_single$$module$build$src$generators$php$math,math_trig$$module$build$src$generators$php$math=math_single$$module$build$src$generators$php$math,module$build$src$generators$php$math={};module$build$src$generators$php$math.math_arithmetic=math_arithmetic$$module$build$src$generators$php$math;module$build$src$generators$php$math.math_atan2=math_atan2$$module$build$src$generators$php$math;module$build$src$generators$php$math.math_change=math_change$$module$build$src$generators$php$math;
module$build$src$generators$php$math.math_constant=math_constant$$module$build$src$generators$php$math;module$build$src$generators$php$math.math_constrain=math_constrain$$module$build$src$generators$php$math;module$build$src$generators$php$math.math_modulo=math_modulo$$module$build$src$generators$php$math;module$build$src$generators$php$math.math_number=math_number$$module$build$src$generators$php$math;module$build$src$generators$php$math.math_number_property=math_number_property$$module$build$src$generators$php$math;
module$build$src$generators$php$math.math_on_list=math_on_list$$module$build$src$generators$php$math;module$build$src$generators$php$math.math_random_float=math_random_float$$module$build$src$generators$php$math;module$build$src$generators$php$math.math_random_int=math_random_int$$module$build$src$generators$php$math;module$build$src$generators$php$math.math_round=math_single$$module$build$src$generators$php$math;module$build$src$generators$php$math.math_single=math_single$$module$build$src$generators$php$math;
module$build$src$generators$php$math.math_trig=math_single$$module$build$src$generators$php$math;var procedures_defnoreturn$$module$build$src$generators$php$procedures=procedures_defreturn$$module$build$src$generators$php$procedures,module$build$src$generators$php$procedures={};module$build$src$generators$php$procedures.procedures_callnoreturn=procedures_callnoreturn$$module$build$src$generators$php$procedures;module$build$src$generators$php$procedures.procedures_callreturn=procedures_callreturn$$module$build$src$generators$php$procedures;
module$build$src$generators$php$procedures.procedures_defnoreturn=procedures_defreturn$$module$build$src$generators$php$procedures;module$build$src$generators$php$procedures.procedures_defreturn=procedures_defreturn$$module$build$src$generators$php$procedures;module$build$src$generators$php$procedures.procedures_ifreturn=procedures_ifreturn$$module$build$src$generators$php$procedures;var text_prompt$$module$build$src$generators$php$text=text_prompt_ext$$module$build$src$generators$php$text,module$build$src$generators$php$text={};module$build$src$generators$php$text.text=text$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_append=text_append$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_changeCase=text_changeCase$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_charAt=text_charAt$$module$build$src$generators$php$text;
module$build$src$generators$php$text.text_count=text_count$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_getSubstring=text_getSubstring$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_indexOf=text_indexOf$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_isEmpty=text_isEmpty$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_join=text_join$$module$build$src$generators$php$text;
module$build$src$generators$php$text.text_length=text_length$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_multiline=text_multiline$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_print=text_print$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_prompt=text_prompt_ext$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_prompt_ext=text_prompt_ext$$module$build$src$generators$php$text;
module$build$src$generators$php$text.text_replace=text_replace$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_reverse=text_reverse$$module$build$src$generators$php$text;module$build$src$generators$php$text.text_trim=text_trim$$module$build$src$generators$php$text;var module$build$src$generators$php$variables={};module$build$src$generators$php$variables.variables_get=variables_get$$module$build$src$generators$php$variables;module$build$src$generators$php$variables.variables_set=variables_set$$module$build$src$generators$php$variables;var module$build$src$generators$php$variables_dynamic={};module$build$src$generators$php$variables_dynamic.variables_get_dynamic=variables_get$$module$build$src$generators$php$variables;module$build$src$generators$php$variables_dynamic.variables_set_dynamic=variables_set$$module$build$src$generators$php$variables;var phpGenerator$$module$build$src$generators$php=new PhpGenerator$$module$build$src$generators$php$php_generator;Object.assign(phpGenerator$$module$build$src$generators$php.forBlock,module$build$src$generators$php$colour,module$build$src$generators$php$lists,module$build$src$generators$php$logic,module$build$src$generators$php$loops,module$build$src$generators$php$math,module$build$src$generators$php$procedures,module$build$src$generators$php$text,module$build$src$generators$php$variables,module$build$src$generators$php$variables_dynamic);
var module$build$src$generators$php={};module$build$src$generators$php.Order=Order$$module$build$src$generators$php$php_generator;module$build$src$generators$php.PhpGenerator=PhpGenerator$$module$build$src$generators$php$php_generator;module$build$src$generators$php.phpGenerator=phpGenerator$$module$build$src$generators$php;
module$build$src$generators$php.__namespace__=$;
return module$build$src$generators$php;
}));


//# sourceMappingURL=php_compressed.js.map
