blockly 10.2.0-beta.3 → 10.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/php_compressed.js CHANGED
@@ -12,11 +12,11 @@
12
12
  }
13
13
  }(this, function(__parent__) {
14
14
  var $=__parent__.__namespace__;
15
- var colour_picker$$module$generators$php$colour=function(a,b){return[b.quote_(a.getFieldValue("COLOUR")),Order$$module$generators$php$php_generator.ATOMIC]},colour_random$$module$generators$php$colour=function(a,b){return[b.provideFunction_("colour_random",`
15
+ 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",`
16
16
  function ${b.FUNCTION_NAME_PLACEHOLDER_}() {
17
17
  return '#' . str_pad(dechex(mt_rand(0, 0xFFFFFF)), 6, '0', STR_PAD_LEFT);
18
18
  }
19
- `)+"()",Order$$module$generators$php$php_generator.FUNCTION_CALL]},colour_rgb$$module$generators$php$colour=function(a,b){const c=b.valueToCode(a,"RED",Order$$module$generators$php$php_generator.NONE)||0,d=b.valueToCode(a,"GREEN",Order$$module$generators$php$php_generator.NONE)||0;a=b.valueToCode(a,"BLUE",Order$$module$generators$php$php_generator.NONE)||0;return[b.provideFunction_("colour_rgb",`
19
+ `)+"()",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",`
20
20
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($r, $g, $b) {
21
21
  $r = round(max(min($r, 100), 0) * 2.55);
22
22
  $g = round(max(min($g, 100), 0) * 2.55);
@@ -27,7 +27,7 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($r, $g, $b) {
27
27
  $hex .= str_pad(dechex($b), 2, '0', STR_PAD_LEFT);
28
28
  return $hex;
29
29
  }
30
- `)+"("+c+", "+d+", "+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},colour_blend$$module$generators$php$colour=function(a,b){const c=b.valueToCode(a,"COLOUR1",Order$$module$generators$php$php_generator.NONE)||"'#000000'",d=b.valueToCode(a,"COLOUR2",Order$$module$generators$php$php_generator.NONE)||"'#000000'";a=b.valueToCode(a,"RATIO",Order$$module$generators$php$php_generator.NONE)||.5;return[b.provideFunction_("colour_blend",`
30
+ `)+"("+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",`
31
31
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($c1, $c2, $ratio) {
32
32
  $ratio = max(min($ratio, 1), 0);
33
33
  $r1 = hexdec(substr($c1, 1, 2));
@@ -45,8 +45,8 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($c1, $c2, $ratio) {
45
45
  $hex .= str_pad(dechex($b), 2, '0', STR_PAD_LEFT);
46
46
  return $hex;
47
47
  }
48
- `)+"("+c+", "+d+", "+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},lists_create_empty$$module$generators$php$lists=function(a,b){return["array()",Order$$module$generators$php$php_generator.FUNCTION_CALL]},lists_create_with$$module$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$generators$php$php_generator.NONE)||"null";c="array("+c.join(", ")+")";return[c,Order$$module$generators$php$php_generator.FUNCTION_CALL]},
49
- lists_repeat$$module$generators$php$lists=function(a,b){const c=b.provideFunction_("lists_repeat",`
48
+ `)+"("+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(", ")+
49
+ ")";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",`
50
50
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($value, $count) {
51
51
  $array = array();
52
52
  for ($index = 0; $index < $count; $index++) {
@@ -54,7 +54,7 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($value, $count) {
54
54
  }
55
55
  return $array;
56
56
  }
57
- `),d=b.valueToCode(a,"ITEM",Order$$module$generators$php$php_generator.NONE)||"null";a=b.valueToCode(a,"NUM",Order$$module$generators$php$php_generator.NONE)||"0";return[c+"("+d+", "+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},lists_length$$module$generators$php$lists=function(a,b){const c=b.provideFunction_("length",`
57
+ `),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",`
58
58
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($value) {
59
59
  if (is_string($value)) {
60
60
  return strlen($value);
@@ -62,8 +62,8 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($value) {
62
62
  return count($value);
63
63
  }
64
64
  }
65
- `);a=b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"''";return[c+"("+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},lists_isEmpty$$module$generators$php$lists=function(a,b){return["empty("+(b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.FUNCTION_CALL)||"array()")+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},lists_indexOf$$module$generators$php$lists=function(a,b){const c=b.valueToCode(a,"FIND",Order$$module$generators$php$php_generator.NONE)||
66
- "''",d=b.valueToCode(a,"VALUE",Order$$module$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",`
65
+ `);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,
66
+ 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",`
67
67
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($haystack, $needle) {
68
68
  for ($index = 0; $index < count($haystack); $index++) {
69
69
  if ($haystack[$index] == $needle) return $index${f};
@@ -78,32 +78,32 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($haystack, $needle) {
78
78
  }
79
79
  return $last;
80
80
  }
81
- `))+"("+d+", "+c+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},lists_getIndex$$module$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$generators$php$php_generator.MEMBER)||"array()")+"[0]",Order$$module$generators$php$php_generator.MEMBER];if("GET_REMOVE"===c)return["array_shift("+(b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||
82
- "array()")+")",Order$$module$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return"array_shift("+(b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"array()")+");\n";break;case "LAST":if("GET"===c)return["end("+(b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"array()")+")",Order$$module$generators$php$php_generator.FUNCTION_CALL];if("GET_REMOVE"===c)return["array_pop("+(b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||
83
- "array()")+")",Order$$module$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return"array_pop("+(b.valueToCode(a,"VALUE",Order$$module$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$generators$php$php_generator.MEMBER)||"array()")+"["+d+"]",Order$$module$generators$php$php_generator.MEMBER];if("GET_REMOVE"===c)return["array_splice("+(b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||
84
- "array()")+", "+d+", 1)[0]",Order$$module$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return"array_splice("+(b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"array()")+", "+d+", 1);\n";break;case "FROM_END":if("GET"===c)return c=b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"array()",b=b.getAdjusted(a,"AT",1,!0),["array_slice("+c+", "+b+", 1)[0]",Order$$module$generators$php$php_generator.FUNCTION_CALL];if("GET_REMOVE"===c||"REMOVE"===
85
- c){d=b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"array()";b=b.getAdjusted(a,"AT",1,!1,Order$$module$generators$php$php_generator.SUBTRACTION);b="array_splice("+d+", count("+d+") - "+b+", 1)[0]";if("GET_REMOVE"===c)return[b,Order$$module$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return b+";\n"}break;case "RANDOM":a=b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"array()";if("GET"===c)return[b.provideFunction_("lists_get_random_item",
86
- `
81
+ `))+"("+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",
82
+ 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"===
83
+ 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()")+"["+
84
+ 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,
85
+ "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"===
86
+ 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",`
87
87
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($list) {
88
88
  return $list[rand(0,count($list)-1)];
89
89
  }
90
- `)+"("+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL];if("GET_REMOVE"===c)return[b.provideFunction_("lists_get_remove_random_item",`
90
+ `)+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("GET_REMOVE"===c)return[b.provideFunction_("lists_get_remove_random_item",`
91
91
  function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list) {
92
92
  $x = rand(0,count($list)-1);
93
93
  unset($list[$x]);
94
94
  return array_values($list);
95
95
  }
96
- `)+"("+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return b.provideFunction_("lists_remove_random_item",`
96
+ `)+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"===c)return b.provideFunction_("lists_remove_random_item",`
97
97
  function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list) {
98
98
  unset($list[rand(0,count($list)-1)]);
99
99
  }
100
- `)+"("+a+");\n"}throw Error("Unhandled combination (lists_getIndex).");},lists_setIndex$$module$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$generators$php$php_generator.ASSIGNMENT)||"null";switch(d){case "FIRST":if("SET"===c)return(b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.MEMBER)||"array()")+"[0] = "+e+";\n";if("INSERT"===c)return"array_unshift("+(b.valueToCode(a,
101
- "LIST",Order$$module$generators$php$php_generator.NONE)||"array()")+", "+e+");\n";break;case "LAST":a=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.NONE)||"array()";if("SET"===c)return b.provideFunction_("lists_set_last_item",`
100
+ `)+"("+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("+
101
+ (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",`
102
102
  function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list, $value) {
103
103
  $list[count($list) - 1] = $value;
104
104
  }
105
- `)+"("+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$generators$php$php_generator.MEMBER)||"array()")+"["+d+"] = "+e+";\n";if("INSERT"===c)return"array_splice("+(b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.NONE)||"array()")+", "+d+", 0, "+e+");\n";break;case "FROM_END":d=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.NONE)||"array()";
106
- a=b.getAdjusted(a,"AT",1);if("SET"===c)return b.provideFunction_("lists_set_from_end",`
105
+ `)+"("+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)||
106
+ "array()";a=b.getAdjusted(a,"AT",1);if("SET"===c)return b.provideFunction_("lists_set_from_end",`
107
107
  function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list, $at, $value) {
108
108
  $list[count($list) - $at] = $value;
109
109
  }
@@ -111,10 +111,10 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list, $at, $value) {
111
111
  function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list, $at, $value) {
112
112
  return array_splice($list, count($list) - $at, 0, $value);
113
113
  }
114
- `)+"("+d+", "+a+", "+e+");\n";break;case "RANDOM":a=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.REFERENCE)||"array()";if(a.match(/^\$\w+$/))d="";else{d=b.nameDB_.getDistinctName("tmp_list",$.NameType$$module$core$names.VARIABLE);var f=d+" = &"+a+";\n";a=d;d=f}b=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$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, "+
115
- e+");\n")}throw Error("Unhandled combination (lists_setIndex).");},lists_getSublist$$module$generators$php$lists=function(a,b){var c=b.valueToCode(a,"LIST",Order$$module$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$generators$php$php_generator.SUBTRACTION);
116
- 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$generators$php$php_generator.SUBTRACTION);b+=" - ";b=$.isNumber$$module$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$generators$php$php_generator.SUBTRACTION);b="count("+c+") - "+b+" - ";b=$.isNumber$$module$core$utils$string(String(d))||
117
- String(d).match(/^\(.+\)$/)?b+d:b+("("+d+")");break;case "LAST":b="count("+c+") - ";b=$.isNumber$$module$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",`
114
+ `)+"("+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("+
115
+ 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,
116
+ 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);
117
+ 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",`
118
118
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($list, $where1, $at1, $where2, $at2) {
119
119
  if ($where1 == 'FROM_END') {
120
120
  $at1 = count($list) - 1 - $at1;
@@ -135,7 +135,7 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($list, $where1, $at1, $where2, $at2) {
135
135
  }
136
136
  return array_slice($list, $at1, $length);
137
137
  }
138
- `)+"("+c+", '"+d+"', "+f+", '"+e+"', "+a+")"}return[c,Order$$module$generators$php$php_generator.FUNCTION_CALL]},lists_sort$$module$generators$php$lists=function(a,b){const c=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.NONE)||"array()",d="1"===a.getFieldValue("DIRECTION")?1:-1;a=a.getFieldValue("TYPE");return[b.provideFunction_("lists_sort",`
138
+ `)+"("+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",`
139
139
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($list, $type, $direction) {
140
140
  $sortCmpFuncs = array(
141
141
  'NUMERIC' => 'strnatcasecmp',
@@ -150,25 +150,27 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($list, $type, $direction) {
150
150
  }
151
151
  return $list2;
152
152
  }
153
- `)+"("+c+', "'+a+'", '+d+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},lists_split$$module$generators$php$lists=function(a,b){let c=b.valueToCode(a,"INPUT",Order$$module$generators$php$php_generator.NONE);b=b.valueToCode(a,"DELIM",Order$$module$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$generators$php$php_generator.FUNCTION_CALL]},
154
- lists_reverse$$module$generators$php$lists=function(a,b){return["array_reverse("+(b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.NONE)||"[]")+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},controls_if$$module$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$generators$php$php_generator.NONE)||"false",e=b.statementToCode(a,"DO"+c),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,
155
- 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$generators$php$logic=function(a,b){const c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d="=="===c||"!="===c?Order$$module$generators$php$php_generator.EQUALITY:Order$$module$generators$php$php_generator.RELATIONAL,
156
- e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]},logic_operation$$module$generators$php$logic=function(a,b){const c="AND"===a.getFieldValue("OP")?"&&":"||",d="&&"===c?Order$$module$generators$php$php_generator.LOGICAL_AND:Order$$module$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$generators$php$logic=function(a,
157
- b){const c=Order$$module$generators$php$php_generator.LOGICAL_NOT;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]},logic_boolean$$module$generators$php$logic=function(a,b){return["TRUE"===a.getFieldValue("BOOL")?"true":"false",Order$$module$generators$php$php_generator.ATOMIC]},logic_null$$module$generators$php$logic=function(a,b){return["null",Order$$module$generators$php$php_generator.ATOMIC]},logic_ternary$$module$generators$php$logic=function(a,b){const c=b.valueToCode(a,"IF",Order$$module$generators$php$php_generator.CONDITIONAL)||
158
- "false",d=b.valueToCode(a,"THEN",Order$$module$generators$php$php_generator.CONDITIONAL)||"null";a=b.valueToCode(a,"ELSE",Order$$module$generators$php$php_generator.CONDITIONAL)||"null";return[c+" ? "+d+" : "+a,Order$$module$generators$php$php_generator.CONDITIONAL]},controls_repeat_ext$$module$generators$php$loops=function(a,b){let c;c=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):b.valueToCode(a,"TIMES",Order$$module$generators$php$php_generator.ASSIGNMENT)||"0";let d=b.statementToCode(a,
159
- "DO");d=b.addLoopTrap(d,a);a="";const e=b.nameDB_.getDistinctName("count",$.NameType$$module$core$names.VARIABLE);let f=c;c.match(/^\w+$/)||$.isNumber$$module$core$utils$string(c)||(f=b.nameDB_.getDistinctName("repeat_end",$.NameType$$module$core$names.VARIABLE),a+=f+" = "+c+";\n");return a+("for ("+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},controls_whileUntil$$module$generators$php$loops=function(a,b){const c="UNTIL"===a.getFieldValue("MODE");let d=b.valueToCode(a,"BOOL",c?Order$$module$generators$php$php_generator.LOGICAL_NOT:
160
- Order$$module$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$generators$php$loops=function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,"FROM",Order$$module$generators$php$php_generator.ASSIGNMENT)||"0",e=b.valueToCode(a,"TO",Order$$module$generators$php$php_generator.ASSIGNMENT)||"0";const f=b.valueToCode(a,"BY",Order$$module$generators$php$php_generator.ASSIGNMENT)||
161
- "1";let g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a);if($.isNumber$$module$core$utils$string(d)&&$.isNumber$$module$core$utils$string(e)&&$.isNumber$$module$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$core$utils$string(d)||(h=b.nameDB_.getDistinctName(c+"_start",$.NameType$$module$core$names.VARIABLE),
162
- a+=h+" = "+d+";\n");d=e;e.match(/^\w+$/)||$.isNumber$$module$core$utils$string(e)||(d=b.nameDB_.getDistinctName(c+"_end",$.NameType$$module$core$names.VARIABLE),a+=d+" = "+e+";\n");e=b.nameDB_.getDistinctName(c+"_inc",$.NameType$$module$core$names.VARIABLE);a+=e+" = ";a=$.isNumber$$module$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"+
163
- g+"}\n")}return a},controls_forEach$$module$generators$php$loops=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,"LIST",Order$$module$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$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,
164
- 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$generators$php$math=function(a,b){a=Number(a.getFieldValue("NUM"));b=0<=a?Order$$module$generators$php$php_generator.ATOMIC:Order$$module$generators$php$php_generator.UNARY_NEGATION;Infinity===a?a="INF":-Infinity===
165
- a&&(a="-INF");return[a,b]},math_arithmetic$$module$generators$php$math=function(a,b){var c={ADD:[" + ",Order$$module$generators$php$php_generator.ADDITION],MINUS:[" - ",Order$$module$generators$php$php_generator.SUBTRACTION],MULTIPLY:[" * ",Order$$module$generators$php$php_generator.MULTIPLICATION],DIVIDE:[" / ",Order$$module$generators$php$php_generator.DIVISION],POWER:[" ** ",Order$$module$generators$php$php_generator.POWER]}[a.getFieldValue("OP")];const d=c[0];c=c[1];const e=b.valueToCode(a,"A",
166
- c)||"0";a=b.valueToCode(a,"B",c)||"0";return[e+d+a,c]},math_single$$module$generators$php$math=function(a,b){const c=a.getFieldValue("OP");let d;if("NEG"===c)return a=b.valueToCode(a,"NUM",Order$$module$generators$php$php_generator.UNARY_NEGATION)||"0","-"===a[0]&&(a=" "+a),["-"+a,Order$$module$generators$php$php_generator.UNARY_NEGATION];a="SIN"===c||"COS"===c||"TAN"===c?b.valueToCode(a,"NUM",Order$$module$generators$php$php_generator.DIVISION)||"0":b.valueToCode(a,"NUM",Order$$module$generators$php$php_generator.NONE)||
167
- "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$generators$php$php_generator.FUNCTION_CALL];switch(c){case "LOG10":d=
168
- "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$generators$php$php_generator.DIVISION]},math_constant$$module$generators$php$math=function(a,b){return{PI:["M_PI",Order$$module$generators$php$php_generator.ATOMIC],E:["M_E",Order$$module$generators$php$php_generator.ATOMIC],GOLDEN_RATIO:["(1 + sqrt(5)) / 2",
169
- Order$$module$generators$php$php_generator.DIVISION],SQRT2:["M_SQRT2",Order$$module$generators$php$php_generator.ATOMIC],SQRT1_2:["M_SQRT1_2",Order$$module$generators$php$php_generator.ATOMIC],INFINITY:["INF",Order$$module$generators$php$php_generator.ATOMIC]}[a.getFieldValue("CONSTANT")]},math_number_property$$module$generators$php$math=function(a,b){var c={EVEN:[""," % 2 == 0",Order$$module$generators$php$php_generator.MODULUS,Order$$module$generators$php$php_generator.EQUALITY],ODD:[""," % 2 == 1",
170
- Order$$module$generators$php$php_generator.MODULUS,Order$$module$generators$php$php_generator.EQUALITY],WHOLE:["is_int(",")",Order$$module$generators$php$php_generator.NONE,Order$$module$generators$php$php_generator.FUNCTION_CALL],POSITIVE:[""," > 0",Order$$module$generators$php$php_generator.RELATIONAL,Order$$module$generators$php$php_generator.RELATIONAL],NEGATIVE:[""," < 0",Order$$module$generators$php$php_generator.RELATIONAL,Order$$module$generators$php$php_generator.RELATIONAL],DIVISIBLE_BY:[null,
171
- null,Order$$module$generators$php$php_generator.MODULUS,Order$$module$generators$php$php_generator.EQUALITY],PRIME:[null,null,Order$$module$generators$php$php_generator.NONE,Order$$module$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",`
153
+ `)+"("+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+
154
+ "("+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,
155
+ "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=
156
+ 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:
157
+ 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")?
158
+ "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,
159
+ "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",
160
+ $.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:
161
+ 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.getVariableName(a.getFieldValue("VAR")),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)||
162
+ "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",
163
+ $.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=
164
+ 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.getVariableName(a.getFieldValue("VAR")),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,
165
+ 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:
166
+ 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],
167
+ 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];
168
+ 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=
169
+ "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]},
170
+ 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")]},
171
+ 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],
172
+ 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,
173
+ 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",`
172
174
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($n) {
173
175
  // https://en.wikipedia.org/wiki/Primality_test#Naive_methods
174
176
  if ($n == 2 || $n == 3) {
@@ -187,18 +189,19 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($n) {
187
189
  }
188
190
  return true;
189
191
  }
190
- `)+"("+c+")";else if("DIVISIBLE_BY"===d){a=b.valueToCode(a,"DIVISOR",Order$$module$generators$php$php_generator.MODULUS)||"0";if("0"===a)return["false",Order$$module$generators$php$php_generator.ATOMIC];a=c+" % "+a+" == 0"}else a=e+c+f;return[a,h]},math_change$$module$generators$php$math=function(a,b){const c=b.valueToCode(a,"DELTA",Order$$module$generators$php$php_generator.ADDITION)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" += "+c+";\n"},math_on_list$$module$generators$php$math=function(a,
191
- b){var c=a.getFieldValue("OP");switch(c){case "SUM":a=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.FUNCTION_CALL)||"array()";a="array_sum("+a+")";break;case "MIN":a=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.FUNCTION_CALL)||"array()";a="min("+a+")";break;case "MAX":a=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.FUNCTION_CALL)||"array()";a="max("+a+")";break;case "AVERAGE":c=b.provideFunction_("math_mean",`
192
+ `)+"("+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.getVariableName(a.getFieldValue("VAR"))+" += "+c+";\n"},math_on_list$$module$build$src$generators$php$math=
193
+ 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",
194
+ `
192
195
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($myList) {
193
196
  return array_sum($myList) / count($myList);
194
197
  }
195
- `);a=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.NONE)||"array()";a=c+"("+a+")";break;case "MEDIAN":c=b.provideFunction_("math_median",`
198
+ `);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",`
196
199
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($arr) {
197
200
  sort($arr,SORT_NUMERIC);
198
201
  return (count($arr) % 2) ? $arr[floor(count($arr) / 2)] :
199
202
  ($arr[floor(count($arr) / 2)] + $arr[floor(count($arr) / 2) - 1]) / 2;
200
203
  }
201
- `);a=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.NONE)||"[]";a=c+"("+a+")";break;case "MODE":c=b.provideFunction_("math_modes",`
204
+ `);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",`
202
205
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($values) {
203
206
  if (empty($values)) return array();
204
207
  $counts = array_count_values($values);
@@ -206,7 +209,7 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($values) {
206
209
  $modes = array_keys($counts, current($counts), true);
207
210
  return $modes;
208
211
  }
209
- `);a=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.NONE)||"[]";a=c+"("+a+")";break;case "STD_DEV":c=b.provideFunction_("math_standard_deviation",`
212
+ `);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",`
210
213
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($numbers) {
211
214
  $n = count($numbers);
212
215
  if (!$n) return null;
@@ -214,47 +217,48 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($numbers) {
214
217
  foreach($numbers as $key => $num) $devs[$key] = pow($num - $mean, 2);
215
218
  return sqrt(array_sum($devs) / (count($devs) - 1));
216
219
  }
217
- `);a=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.NONE)||"[]";a=c+"("+a+")";break;case "RANDOM":c=b.provideFunction_("math_random_list",`
220
+ `);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",`
218
221
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($list) {
219
222
  $x = rand(0, count($list)-1);
220
223
  return $list[$x];
221
224
  }
222
- `);a=b.valueToCode(a,"LIST",Order$$module$generators$php$php_generator.NONE)||"[]";a=c+"("+a+")";break;default:throw Error("Unknown operator: "+c);}return[a,Order$$module$generators$php$php_generator.FUNCTION_CALL]},math_modulo$$module$generators$php$math=function(a,b){const c=b.valueToCode(a,"DIVIDEND",Order$$module$generators$php$php_generator.MODULUS)||"0";a=b.valueToCode(a,"DIVISOR",Order$$module$generators$php$php_generator.MODULUS)||"0";return[c+" % "+a,Order$$module$generators$php$php_generator.MODULUS]},
223
- math_constrain$$module$generators$php$math=function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"0",d=b.valueToCode(a,"LOW",Order$$module$generators$php$php_generator.NONE)||"0";a=b.valueToCode(a,"HIGH",Order$$module$generators$php$php_generator.NONE)||"Infinity";return["min(max("+c+", "+d+"), "+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},math_random_int$$module$generators$php$math=function(a,b){const c=b.valueToCode(a,"FROM",Order$$module$generators$php$php_generator.NONE)||
224
- "0";a=b.valueToCode(a,"TO",Order$$module$generators$php$php_generator.NONE)||"0";return[b.provideFunction_("math_random_int",`
225
+ `);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+
226
+ " % "+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]},
227
+ 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",`
225
228
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($a, $b) {
226
229
  if ($a > $b) {
227
230
  return rand($b, $a);
228
231
  }
229
232
  return rand($a, $b);
230
233
  }
231
- `)+"("+c+", "+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},math_random_float$$module$generators$php$math=function(a,b){return["(float)rand()/(float)getrandmax()",Order$$module$generators$php$php_generator.FUNCTION_CALL]},math_atan2$$module$generators$php$math=function(a,b){const c=b.valueToCode(a,"X",Order$$module$generators$php$php_generator.NONE)||"0";return["atan2("+(b.valueToCode(a,"Y",Order$$module$generators$php$php_generator.NONE)||"0")+", "+c+") / pi() * 180",Order$$module$generators$php$php_generator.DIVISION]},
232
- procedures_defreturn$$module$generators$php$procedures=function(a,b){var c=[],d=a.workspace,e=$.allUsedVarModels$$module$core$variables(d)||[];for(var f of e)e=f.name,-1===a.getVars().indexOf(e)&&c.push(b.getVariableName(e));d=$.allDeveloperVariables$$module$core$variables(d);for(f=0;f<d.length;f++)c.push(b.nameDB_.getName(d[f],$.NameType$$module$core$names.DEVELOPER_VARIABLE));d=c.length?b.INDENT+"global "+c.join(", ")+";\n":"";c=b.getProcedureName(a.getFieldValue("NAME"));f="";b.STATEMENT_PREFIX&&
233
- (f+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(f+=b.injectId(b.STATEMENT_SUFFIX,a));f&&(f=b.prefixLines(f,b.INDENT));e="";b.INFINITE_LOOP_TRAP&&(e=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$generators$php$php_generator.NONE)||"",k="";g&&h&&(k=f);h&&(h=b.INDENT+"return "+h+";\n");const l=[],m=a.getVars();for(let n=0;n<m.length;n++)l[n]=b.getVariableName(m[n]);d="function "+c+"("+l.join(", ")+
234
- ") {\n"+d+f+e+g+k+h+"}";d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},procedures_callreturn$$module$generators$php$procedures=function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVars();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Order$$module$generators$php$php_generator.NONE)||"null";return[c+"("+d.join(", ")+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},procedures_callnoreturn$$module$generators$php$procedures=function(a,b){return b.forBlock.procedures_callreturn(a,
235
- b)[0]+";\n"},procedures_ifreturn$$module$generators$php$procedures=function(a,b){let c="if ("+(b.valueToCode(a,"CONDITION",Order$$module$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$generators$php$php_generator.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"},text$$module$generators$php$text=function(a,b){return[b.quote_(a.getFieldValue("TEXT")),
236
- Order$$module$generators$php$php_generator.ATOMIC]},text_multiline$$module$generators$php$text=function(a,b){a=b.multiline_quote_(a.getFieldValue("TEXT"));b=-1!==a.indexOf(".")?Order$$module$generators$php$php_generator.STRING_CONCAT:Order$$module$generators$php$php_generator.ATOMIC;return[a,b]},text_join$$module$generators$php$text=function(a,b){if(0===a.itemCount_)return["''",Order$$module$generators$php$php_generator.ATOMIC];if(1===a.itemCount_)return[b.valueToCode(a,"ADD0",Order$$module$generators$php$php_generator.NONE)||
237
- "''",Order$$module$generators$php$php_generator.NONE];if(2===a.itemCount_){var c=b.valueToCode(a,"ADD0",Order$$module$generators$php$php_generator.STRING_CONCAT)||"''";a=b.valueToCode(a,"ADD1",Order$$module$generators$php$php_generator.STRING_CONCAT)||"''";return[c+" . "+a,Order$$module$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$generators$php$php_generator.NONE)||"''";return["implode('', array("+c.join(",")+
238
- "))",Order$$module$generators$php$php_generator.FUNCTION_CALL]},text_append$$module$generators$php$text=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Order$$module$generators$php$php_generator.ASSIGNMENT)||"''";return c+" .= "+a+";\n"},text_length$$module$generators$php$text=function(a,b){const c=b.provideFunction_("length",`
234
+ `)+"("+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)||
235
+ "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(var f of e)e=f.name,-1===a.getVars().indexOf(e)&&c.push(b.getVariableName(e));d=$.allDeveloperVariables$$module$build$src$core$variables(d);for(f=0;f<d.length;f++)c.push(b.nameDB_.getName(d[f],$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));
236
+ d=c.length?b.INDENT+"global "+c.join(", ")+";\n":"";c=b.getProcedureName(a.getFieldValue("NAME"));f="";b.STATEMENT_PREFIX&&(f+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(f+=b.injectId(b.STATEMENT_SUFFIX,a));f&&(f=b.prefixLines(f,b.INDENT));e="";b.INFINITE_LOOP_TRAP&&(e=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=f);h&&(h=b.INDENT+
237
+ "return "+h+";\n");const l=[],m=a.getVars();for(let n=0;n<m.length;n++)l[n]=b.getVariableName(m[n]);d="function "+c+"("+l.join(", ")+") {\n"+d+f+e+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.getProcedureName(a.getFieldValue("NAME")),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(", ")+
238
+ ")",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_?
239
+ (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:
240
+ 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)||
241
+ "''";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,
242
+ b){const c=b.getVariableName(a.getFieldValue("VAR"));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",`
239
243
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($value) {
240
244
  if (is_string($value)) {
241
245
  return strlen($value);
242
246
  }
243
247
  return count($value);
244
248
  }
245
- `);a=b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"''";return[c+"("+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},text_isEmpty$$module$generators$php$text=function(a,b){return["empty("+(b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"''")+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},text_indexOf$$module$generators$php$text=function(a,b){const c="FIRST"===a.getFieldValue("END")?"strpos":"strrpos",d=b.valueToCode(a,
246
- "FIND",Order$$module$generators$php$php_generator.NONE)||"''",e=b.valueToCode(a,"VALUE",Order$$module$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",`
249
+ `);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"===
250
+ 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",`
247
251
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($text, $search) {
248
252
  $pos = ${c}($text, $search);
249
253
  return $pos === false ? ${f} : $pos${g};
250
254
  }
251
- `)+"("+e+", "+d+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},text_charAt$$module$generators$php$text=function(a,b){const c=a.getFieldValue("WHERE")||"FROM_START",d=b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.NONE)||"''";switch(c){case "FIRST":return["substr("+d+", 0, 1)",Order$$module$generators$php$php_generator.FUNCTION_CALL];case "LAST":return["substr("+d+", -1)",Order$$module$generators$php$php_generator.FUNCTION_CALL];case "FROM_START":return a=b.getAdjusted(a,
252
- "AT"),["substr("+d+", "+a+", 1)",Order$$module$generators$php$php_generator.FUNCTION_CALL];case "FROM_END":return a=b.getAdjusted(a,"AT",1,!0),["substr("+d+", "+a+", 1)",Order$$module$generators$php$php_generator.FUNCTION_CALL];case "RANDOM":return[b.provideFunction_("text_random_letter",`
255
+ `)+"("+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];
256
+ 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",`
253
257
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($text) {
254
258
  return $text[rand(0, strlen($text) - 1)];
255
259
  }
256
- `)+"("+d+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");},text_getSubstring$$module$generators$php$text=function(a,b){const c=a.getFieldValue("WHERE1"),d=a.getFieldValue("WHERE2"),e=b.valueToCode(a,"STRING",Order$$module$generators$php$php_generator.NONE)||"''";if("FIRST"===c&&"LAST"===d)return[e,Order$$module$generators$php$php_generator.NONE];const f=b.getAdjusted(a,"AT1");a=b.getAdjusted(a,"AT2");return[b.provideFunction_("text_get_substring",
257
- `
260
+ `)+"("+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");
261
+ return[b.provideFunction_("text_get_substring",`
258
262
  function ${b.FUNCTION_NAME_PLACEHOLDER_}($text, $where1, $at1, $where2, $at2) {
259
263
  if ($where1 == 'FROM_END') {
260
264
  $at1 = strlen($text) - 1 - $at1;
@@ -275,31 +279,33 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($text, $where1, $at1, $where2, $at2) {
275
279
  }
276
280
  return substr($text, $at1, $length);
277
281
  }
278
- `)+"("+e+", '"+c+"', "+f+", '"+d+"', "+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},text_changeCase$$module$generators$php$text=function(a,b){b=b.valueToCode(a,"TEXT",Order$$module$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$generators$php$php_generator.FUNCTION_CALL]},
279
- text_trim$$module$generators$php$text=function(a,b){const c={LEFT:"ltrim",RIGHT:"rtrim",BOTH:"trim"}[a.getFieldValue("MODE")];a=b.valueToCode(a,"TEXT",Order$$module$generators$php$php_generator.NONE)||"''";return[c+"("+a+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},text_print$$module$generators$php$text=function(a,b){return"print("+(b.valueToCode(a,"TEXT",Order$$module$generators$php$php_generator.NONE)||"''")+");\n"},text_prompt_ext$$module$generators$php$text=function(a,b){b="readline("+
280
- (a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):b.valueToCode(a,"TEXT",Order$$module$generators$php$php_generator.NONE)||"''")+")";"NUMBER"===a.getFieldValue("TYPE")&&(b="floatval("+b+")");return[b,Order$$module$generators$php$php_generator.FUNCTION_CALL]},text_count$$module$generators$php$text=function(a,b){const c=b.valueToCode(a,"TEXT",Order$$module$generators$php$php_generator.NONE)||"''";a=b.valueToCode(a,"SUB",Order$$module$generators$php$php_generator.NONE)||"''";return["strlen("+a+") === 0 ? strlen("+
281
- c+") + 1 : substr_count("+c+", "+a+")",Order$$module$generators$php$php_generator.CONDITIONAL]},text_replace$$module$generators$php$text=function(a,b){const c=b.valueToCode(a,"TEXT",Order$$module$generators$php$php_generator.NONE)||"''",d=b.valueToCode(a,"FROM",Order$$module$generators$php$php_generator.NONE)||"''";a=b.valueToCode(a,"TO",Order$$module$generators$php$php_generator.NONE)||"''";return["str_replace("+d+", "+a+", "+c+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},text_reverse$$module$generators$php$text=
282
- function(a,b){return["strrev("+(b.valueToCode(a,"TEXT",Order$$module$generators$php$php_generator.NONE)||"''")+")",Order$$module$generators$php$php_generator.FUNCTION_CALL]},variables_get$$module$generators$php$variables=function(a,b){return[b.getVariableName(a.getFieldValue("VAR")),Order$$module$generators$php$php_generator.ATOMIC]},variables_set$$module$generators$php$variables=function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$generators$php$php_generator.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+
283
- " = "+c+";\n"},Order$$module$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,
284
- LOGICAL_AND_WEAK:21,LOGICAL_XOR:22,LOGICAL_OR_WEAK:23,NONE:99},PhpGenerator$$module$generators$php$php_generator=class extends $.CodeGenerator$$module$core$generator{constructor(a){super(null!=a?a:"PHP");this.ORDER_OVERRIDES=[[Order$$module$generators$php$php_generator.MEMBER,Order$$module$generators$php$php_generator.FUNCTION_CALL],[Order$$module$generators$php$php_generator.MEMBER,Order$$module$generators$php$php_generator.MEMBER],[Order$$module$generators$php$php_generator.LOGICAL_NOT,Order$$module$generators$php$php_generator.LOGICAL_NOT],
285
- [Order$$module$generators$php$php_generator.MULTIPLICATION,Order$$module$generators$php$php_generator.MULTIPLICATION],[Order$$module$generators$php$php_generator.ADDITION,Order$$module$generators$php$php_generator.ADDITION],[Order$$module$generators$php$php_generator.LOGICAL_AND,Order$$module$generators$php$php_generator.LOGICAL_AND],[Order$$module$generators$php$php_generator.LOGICAL_OR,Order$$module$generators$php$php_generator.LOGICAL_OR]];this.isInitialized=!1;for(const b in Order$$module$generators$php$php_generator)this["ORDER_"+
286
- b]=Order$$module$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);
287
- this.nameDB_?this.nameDB_.reset():this.nameDB_=new $.Names$$module$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"'"+
288
- 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$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$core$inputs$input_types.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,
289
- "// "))}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$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),
290
- e=Math.floor(e),h&&e>=h&&(a="("+a+")"));return a}},module$generators$php$php_generator={Order:Order$$module$generators$php$php_generator};module$generators$php$php_generator.PhpGenerator=PhpGenerator$$module$generators$php$php_generator;var module$generators$php$colour={};module$generators$php$colour.colour_blend=colour_blend$$module$generators$php$colour;module$generators$php$colour.colour_picker=colour_picker$$module$generators$php$colour;module$generators$php$colour.colour_random=colour_random$$module$generators$php$colour;module$generators$php$colour.colour_rgb=colour_rgb$$module$generators$php$colour;var module$generators$php$lists={};module$generators$php$lists.lists_create_empty=lists_create_empty$$module$generators$php$lists;module$generators$php$lists.lists_create_with=lists_create_with$$module$generators$php$lists;module$generators$php$lists.lists_getIndex=lists_getIndex$$module$generators$php$lists;module$generators$php$lists.lists_getSublist=lists_getSublist$$module$generators$php$lists;module$generators$php$lists.lists_indexOf=lists_indexOf$$module$generators$php$lists;
291
- module$generators$php$lists.lists_isEmpty=lists_isEmpty$$module$generators$php$lists;module$generators$php$lists.lists_length=lists_length$$module$generators$php$lists;module$generators$php$lists.lists_repeat=lists_repeat$$module$generators$php$lists;module$generators$php$lists.lists_reverse=lists_reverse$$module$generators$php$lists;module$generators$php$lists.lists_setIndex=lists_setIndex$$module$generators$php$lists;module$generators$php$lists.lists_sort=lists_sort$$module$generators$php$lists;
292
- module$generators$php$lists.lists_split=lists_split$$module$generators$php$lists;var controls_ifelse$$module$generators$php$logic=controls_if$$module$generators$php$logic,module$generators$php$logic={};module$generators$php$logic.controls_if=controls_if$$module$generators$php$logic;module$generators$php$logic.controls_ifelse=controls_if$$module$generators$php$logic;module$generators$php$logic.logic_boolean=logic_boolean$$module$generators$php$logic;module$generators$php$logic.logic_compare=logic_compare$$module$generators$php$logic;module$generators$php$logic.logic_negate=logic_negate$$module$generators$php$logic;
293
- module$generators$php$logic.logic_null=logic_null$$module$generators$php$logic;module$generators$php$logic.logic_operation=logic_operation$$module$generators$php$logic;module$generators$php$logic.logic_ternary=logic_ternary$$module$generators$php$logic;var controls_repeat$$module$generators$php$loops=controls_repeat_ext$$module$generators$php$loops,module$generators$php$loops={};module$generators$php$loops.controls_flow_statements=controls_flow_statements$$module$generators$php$loops;module$generators$php$loops.controls_for=controls_for$$module$generators$php$loops;module$generators$php$loops.controls_forEach=controls_forEach$$module$generators$php$loops;module$generators$php$loops.controls_repeat=controls_repeat_ext$$module$generators$php$loops;
294
- module$generators$php$loops.controls_repeat_ext=controls_repeat_ext$$module$generators$php$loops;module$generators$php$loops.controls_whileUntil=controls_whileUntil$$module$generators$php$loops;var math_round$$module$generators$php$math=math_single$$module$generators$php$math,math_trig$$module$generators$php$math=math_single$$module$generators$php$math,module$generators$php$math={};module$generators$php$math.math_arithmetic=math_arithmetic$$module$generators$php$math;module$generators$php$math.math_atan2=math_atan2$$module$generators$php$math;module$generators$php$math.math_change=math_change$$module$generators$php$math;module$generators$php$math.math_constant=math_constant$$module$generators$php$math;
295
- module$generators$php$math.math_constrain=math_constrain$$module$generators$php$math;module$generators$php$math.math_modulo=math_modulo$$module$generators$php$math;module$generators$php$math.math_number=math_number$$module$generators$php$math;module$generators$php$math.math_number_property=math_number_property$$module$generators$php$math;module$generators$php$math.math_on_list=math_on_list$$module$generators$php$math;module$generators$php$math.math_random_float=math_random_float$$module$generators$php$math;
296
- module$generators$php$math.math_random_int=math_random_int$$module$generators$php$math;module$generators$php$math.math_round=math_single$$module$generators$php$math;module$generators$php$math.math_single=math_single$$module$generators$php$math;module$generators$php$math.math_trig=math_single$$module$generators$php$math;var procedures_defnoreturn$$module$generators$php$procedures=procedures_defreturn$$module$generators$php$procedures,module$generators$php$procedures={};module$generators$php$procedures.procedures_callnoreturn=procedures_callnoreturn$$module$generators$php$procedures;module$generators$php$procedures.procedures_callreturn=procedures_callreturn$$module$generators$php$procedures;module$generators$php$procedures.procedures_defnoreturn=procedures_defreturn$$module$generators$php$procedures;
297
- module$generators$php$procedures.procedures_defreturn=procedures_defreturn$$module$generators$php$procedures;module$generators$php$procedures.procedures_ifreturn=procedures_ifreturn$$module$generators$php$procedures;var text_prompt$$module$generators$php$text=text_prompt_ext$$module$generators$php$text,module$generators$php$text={};module$generators$php$text.text=text$$module$generators$php$text;module$generators$php$text.text_append=text_append$$module$generators$php$text;module$generators$php$text.text_changeCase=text_changeCase$$module$generators$php$text;module$generators$php$text.text_charAt=text_charAt$$module$generators$php$text;module$generators$php$text.text_count=text_count$$module$generators$php$text;
298
- module$generators$php$text.text_getSubstring=text_getSubstring$$module$generators$php$text;module$generators$php$text.text_indexOf=text_indexOf$$module$generators$php$text;module$generators$php$text.text_isEmpty=text_isEmpty$$module$generators$php$text;module$generators$php$text.text_join=text_join$$module$generators$php$text;module$generators$php$text.text_length=text_length$$module$generators$php$text;module$generators$php$text.text_multiline=text_multiline$$module$generators$php$text;
299
- module$generators$php$text.text_print=text_print$$module$generators$php$text;module$generators$php$text.text_prompt=text_prompt_ext$$module$generators$php$text;module$generators$php$text.text_prompt_ext=text_prompt_ext$$module$generators$php$text;module$generators$php$text.text_replace=text_replace$$module$generators$php$text;module$generators$php$text.text_reverse=text_reverse$$module$generators$php$text;module$generators$php$text.text_trim=text_trim$$module$generators$php$text;var module$generators$php$variables={};module$generators$php$variables.variables_get=variables_get$$module$generators$php$variables;module$generators$php$variables.variables_set=variables_set$$module$generators$php$variables;var module$generators$php$variables_dynamic={};module$generators$php$variables_dynamic.variables_get_dynamic=variables_get$$module$generators$php$variables;module$generators$php$variables_dynamic.variables_set_dynamic=variables_set$$module$generators$php$variables;var phpGenerator$$module$generators$php=new PhpGenerator$$module$generators$php$php_generator;Object.assign(phpGenerator$$module$generators$php.forBlock,module$generators$php$colour,module$generators$php$lists,module$generators$php$logic,module$generators$php$loops,module$generators$php$math,module$generators$php$procedures,module$generators$php$text,module$generators$php$variables,module$generators$php$variables_dynamic);var module$generators$php={Order:Order$$module$generators$php$php_generator};
300
- module$generators$php.PhpGenerator=PhpGenerator$$module$generators$php$php_generator;module$generators$php.phpGenerator=phpGenerator$$module$generators$php;
301
- module$generators$php.__namespace__=$;
302
- return module$generators$php;
282
+ `)+"("+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]},
283
+ 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=
284
+ 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)||
285
+ "''";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("+
286
+ 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.getVariableName(a.getFieldValue("VAR")),Order$$module$build$src$generators$php$php_generator.ATOMIC]},
287
+ 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.getVariableName(a.getFieldValue("VAR"))+" = "+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,
288
+ 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,
289
+ 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,
290
+ 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);
291
+ 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,
292
+ "\\'");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))&&
293
+ (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),
294
+ 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={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;
295
+ 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;
296
+ 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;
297
+ 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;
298
+ 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;
299
+ 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;
300
+ 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;
301
+ 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;
302
+ 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;
303
+ 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;
304
+ 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;
305
+ 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);
306
+ var 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;
307
+ module$build$src$generators$php.__namespace__=$;
308
+ return module$build$src$generators$php;
303
309
  }));
304
310
 
305
311