blockly 13.4.0 → 13.4.1-beta.0

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.
@@ -64,8 +64,10 @@ export declare class MiniWorkspaceBubble extends Bubble {
64
64
  /**
65
65
  * Updates the size of this bubble to account for the size of the
66
66
  * mini workspace.
67
+ *
68
+ * @internal
67
69
  */
68
- private updateBubbleSize;
70
+ updateBubbleSize(): void;
69
71
  /**
70
72
  * Calculates the size of the mini workspace for use in resizing the bubble.
71
73
  */
@@ -35,7 +35,11 @@ export declare class TextBubble extends Bubble {
35
35
  private createTextFragments;
36
36
  /** Right aligns the given text fragments. */
37
37
  private rightAlignTextFragments;
38
- /** Updates the size of this bubble to account for the size of the text. */
39
- private updateBubbleSize;
38
+ /**
39
+ * Updates the size of this bubble to account for the size of the text.
40
+ *
41
+ * @internal
42
+ */
43
+ updateBubbleSize(): void;
40
44
  }
41
45
  //# sourceMappingURL=text_bubble.d.ts.map
@@ -19,7 +19,12 @@ import { EventType } from './type.js';
19
19
  */
20
20
  export declare class CommentMove extends CommentBase {
21
21
  type: EventType;
22
- /** The comment that is being moved. */
22
+ /**
23
+ * The comment that is being moved.
24
+ *
25
+ * @deprecated This field will be removed in v14. Use `workspaceId` and
26
+ * `commentId` to get a reference to the comment object if needed.
27
+ */
23
28
  comment_?: WorkspaceComment;
24
29
  /** The location of the comment before the move, in workspace coordinates. */
25
30
  oldCoordinate_?: Coordinate;
package/core/field.d.ts CHANGED
@@ -726,8 +726,9 @@ export declare abstract class Field<T = any> implements IKeyboardAccessible, IRe
726
726
  */
727
727
  protected getAbsoluteXY_(): Coordinate;
728
728
  /**
729
- * Whether this field references any Blockly variables. If true it may need
730
- * to be handled differently during serialization and deserialization.
729
+ * Whether this field references any Blockly variables. If true it may need
730
+ * to be handled differently during serialization and deserialization, and
731
+ * this field's value must correspond to the ID of an existing variable.
731
732
  * Subclasses may override this.
732
733
  *
733
734
  * @returns True if this field has any variable references.
@@ -292,11 +292,12 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
292
292
  * separators as needed.
293
293
  *
294
294
  * When multiple separators occur one after another, the value of the last one
295
- * takes precedence and the earlier separators in the group are removed.
295
+ * takes precedence and the earlier separators in the group are removed. A
296
+ * separator at the end is removed outright.
296
297
  *
297
298
  * @param contents The list of flyout contents to flatten separators in.
298
299
  * @returns An updated list of flyout contents with only one separator between
299
- * each non-separator item.
300
+ * each non-separator item, and none at the end.
300
301
  */
301
302
  protected normalizeSeparators(contents: FlyoutItem[]): FlyoutItem[];
302
303
  /**
@@ -53,6 +53,12 @@ export declare class HorizontalFlyout extends Flyout {
53
53
  * @param e Mouse wheel scroll event.
54
54
  */
55
55
  protected wheel_(e: WheelEvent): void;
56
+ /**
57
+ * Sets the items that will be displayed in this flyout.
58
+ *
59
+ * @param contents The new items to display in the flyout.
60
+ */
61
+ setContents(contents: FlyoutItem[]): void;
56
62
  /**
57
63
  * Lay out the blocks in the flyout.
58
64
  *
@@ -72,5 +78,12 @@ export declare class HorizontalFlyout extends Flyout {
72
78
  * For RTL: Lay out the blocks right-aligned.
73
79
  */
74
80
  protected reflowInternal_(): void;
81
+ /**
82
+ * Shifts the contents so they end at the flyout's right padding. Contents
83
+ * wider than the flyout start at the left padding instead, keeping them
84
+ * within the scrollable area; scrollToStart then scrolls to the right end,
85
+ * so they still read from the right and overflow to the left.
86
+ */
87
+ private alignContentsRight;
75
88
  }
76
89
  //# sourceMappingURL=flyout_horizontal.d.ts.map
@@ -112,6 +112,17 @@ export declare function stopTextWidthCache(): void;
112
112
  * @returns Width of element.
113
113
  */
114
114
  export declare function getTextWidth(textElement: SVGTextElement): number;
115
+ /**
116
+ * Gets the size of a text element, caching it in the process.
117
+ *
118
+ * @internal
119
+ * @param textElement An SVG 'text' element.
120
+ * @returns Height and width of the element.
121
+ */
122
+ export declare function getTextSize(textElement: SVGTextElement): {
123
+ width: number;
124
+ height: number;
125
+ };
115
126
  /**
116
127
  * Gets the width of a text element using a faster method than `getTextWidth`.
117
128
  * This method requires that we know the text element's font family and size in
@@ -121,9 +132,11 @@ export declare function getTextWidth(textElement: SVGTextElement): number;
121
132
  * @param fontSize The font size to use.
122
133
  * @param fontWeight The font weight to use.
123
134
  * @param fontFamily The font family to use.
135
+ * @param letterSpacing The letter spacing to use.
136
+ * @param wordSpacing The word spacing to use.
124
137
  * @returns Width of element.
125
138
  */
126
- export declare function getFastTextWidth(textElement: SVGTextElement, fontSize: number, fontWeight: string, fontFamily: string): number;
139
+ export declare function getFastTextWidth(textElement: SVGTextElement, fontSize: number, fontWeight: string, fontFamily: string, letterSpacing?: string, wordSpacing?: string): number;
127
140
  /**
128
141
  * Gets the width of a text element using a faster method than `getTextWidth`.
129
142
  * This method requires that we know the text element's font family and size in
@@ -135,9 +148,11 @@ export declare function getFastTextWidth(textElement: SVGTextElement, fontSize:
135
148
  * @param fontSize The font size to use.
136
149
  * @param fontWeight The font weight to use.
137
150
  * @param fontFamily The font family to use.
151
+ * @param letterSpacing The letter spacing to use.
152
+ * @param wordSpacing The word spacing to use.
138
153
  * @returns Width of element.
139
154
  */
140
- export declare function getFastTextWidthWithSizeString(textElement: SVGTextElement, fontSize: string, fontWeight: string, fontFamily: string): number;
155
+ export declare function getFastTextWidthWithSizeString(textElement: SVGTextElement, fontSize: string, fontWeight: string, fontFamily: string, letterSpacing?: string, wordSpacing?: string): number;
141
156
  /**
142
157
  * Measure a font's metrics. The height and baseline values.
143
158
  *
@@ -12,25 +12,25 @@
12
12
  }
13
13
  }(this, function(__parent__) {
14
14
  var $=__parent__.__namespace__;
15
- var kt=function(a,b){var c=0,d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do{var e=b.valueToCode(a,"IF"+c,Z.NONE)||"false";var f=b.statementToCode(a,"DO"+c);b.STATEMENT_SUFFIX&&(f=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+f);d+=(c>0?"else ":"")+"if ("+e+") {\n"+f+"}";c++}while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)f=a.getInput("ELSE")?b.statementToCode(a,"ELSE"):"",b.STATEMENT_SUFFIX&&(f=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+
16
- f),d+=" else {\n"+f+"}";return d+"\n"},lt=function(a,b){var c=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):b.valueToCode(a,"TIMES",Z.ASSIGNMENT)||"0";var d=b.statementToCode(a,"DO");d=b.addLoopTrap(d,a);a="";var e=b.nameDB_.getDistinctName("count",$.P.VARIABLE),f=c;c.match(/^\w+$/)||$.zf(c)||(f=b.nameDB_.getDistinctName("repeat_end",$.P.VARIABLE),a+="var "+f+" = "+c+";\n");return a+("for (int "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},mt=function(a,b){var c=a.getFieldValue("OP");
15
+ var mt=function(a,b){var c=0,d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do{var e=b.valueToCode(a,"IF"+c,Z.NONE)||"false";var f=b.statementToCode(a,"DO"+c);b.STATEMENT_SUFFIX&&(f=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+f);d+=(c>0?"else ":"")+"if ("+e+") {\n"+f+"}";c++}while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)f=a.getInput("ELSE")?b.statementToCode(a,"ELSE"):"",b.STATEMENT_SUFFIX&&(f=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+
16
+ f),d+=" else {\n"+f+"}";return d+"\n"},nt=function(a,b){var c=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):b.valueToCode(a,"TIMES",Z.ASSIGNMENT)||"0";var d=b.statementToCode(a,"DO");d=b.addLoopTrap(d,a);a="";var e=b.nameDB_.getDistinctName("count",$.P.VARIABLE),f=c;c.match(/^\w+$/)||$.Bf(c)||(f=b.nameDB_.getDistinctName("repeat_end",$.P.VARIABLE),a+="var "+f+" = "+c+";\n");return a+("for (int "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},ot=function(a,b){var c=a.getFieldValue("OP");
17
17
  if(c==="NEG")return a=b.valueToCode(a,"NUM",Z.UNARY_PREFIX)||"0",a[0]==="-"&&(a=" "+a),["-"+a,Z.UNARY_PREFIX];b.definitions_.import_dart_math="import 'dart:math' as Math;";a=c==="ABS"||c.substring(0,5)==="ROUND"?b.valueToCode(a,"NUM",Z.UNARY_POSTFIX)||"0":c==="SIN"||c==="COS"||c==="TAN"?b.valueToCode(a,"NUM",Z.MULTIPLICATIVE)||"0":b.valueToCode(a,"NUM",Z.NONE)||"0";switch(c){case "ABS":var d=a+".abs()";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+
18
18
  a+")";break;case "POW10":d="Math.pow(10,"+a+")";break;case "ROUND":d=a+".round()";break;case "ROUNDUP":d=a+".ceil()";break;case "ROUNDDOWN":d=a+".floor()";break;case "SIN":d="Math.sin("+a+" / 180 * Math.pi)";break;case "COS":d="Math.cos("+a+" / 180 * Math.pi)";break;case "TAN":d="Math.tan("+a+" / 180 * Math.pi)"}if(d)return[d,Z.UNARY_POSTFIX];switch(c){case "LOG10":d="Math.log("+a+") / Math.log(10)";break;case "ASIN":d="Math.asin("+a+") / Math.pi * 180";break;case "ACOS":d="Math.acos("+a+") / Math.pi * 180";
19
- break;case "ATAN":d="Math.atan("+a+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,Z.MULTIPLICATIVE]},nt=function(a,b){var c=b.getProcedureName(a.getFieldValue("NAME")),d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(d+=b.injectId(b.STATEMENT_SUFFIX,a));d&&(d=b.prefixLines(d,b.INDENT));var e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));var f="";a.getInput("STACK")&&(f=b.statementToCode(a,
20
- "STACK"));var g="";a.getInput("RETURN")&&(g=b.valueToCode(a,"RETURN",Z.NONE)||"");var h="";f&&g&&(h=d);g&&(g=b.INDENT+"return "+g+";\n");var m=g?"dynamic":"void",z=[],F=a.getVarModels();for(let J=0;J<F.length;J++)z[J]=b.getVariableName(F[J].getId());d=m+" "+c+"("+z.join(", ")+") {\n"+d+e+f+h+g+"}";d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},ot=function(a,b){b.definitions_.import_dart_html="import 'dart:html' as Html;";var c="Html.window.prompt("+(a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):
21
- b.valueToCode(a,"TEXT",Z.NONE)||"''")+", '')";a.getFieldValue("TYPE")==="NUMBER"&&(b.definitions_.import_dart_math="import 'dart:math' as Math;",c="Math.parseDouble("+c+")");return[c,Z.UNARY_POSTFIX]},pt=function(a,b){return[b.getVariableName(a.getFieldValue("VAR")),Z.ATOMIC]},qt=function(a,b){var c=b.valueToCode(a,"VALUE",Z.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+";\n"},Z,rt=Z||(Z={});rt[rt.ATOMIC=0]="ATOMIC";rt[rt.UNARY_POSTFIX=1]="UNARY_POSTFIX";
22
- rt[rt.UNARY_PREFIX=2]="UNARY_PREFIX";rt[rt.MULTIPLICATIVE=3]="MULTIPLICATIVE";rt[rt.ADDITIVE=4]="ADDITIVE";rt[rt.SHIFT=5]="SHIFT";rt[rt.BITWISE_AND=6]="BITWISE_AND";rt[rt.BITWISE_XOR=7]="BITWISE_XOR";rt[rt.BITWISE_OR=8]="BITWISE_OR";rt[rt.RELATIONAL=9]="RELATIONAL";rt[rt.EQUALITY=10]="EQUALITY";rt[rt.LOGICAL_AND=11]="LOGICAL_AND";rt[rt.LOGICAL_OR=12]="LOGICAL_OR";rt[rt.IF_NULL=13]="IF_NULL";rt[rt.CONDITIONAL=14]="CONDITIONAL";rt[rt.CASCADE=15]="CASCADE";rt[rt.ASSIGNMENT=16]="ASSIGNMENT";
23
- rt[rt.NONE=99]="NONE";
24
- var st=class extends $.zq{constructor(a="Dart"){super(a);this.isInitialized=!1;for(let b in Z)a=Z[b],typeof a!=="string"&&(this["ORDER_"+b]=a);this.addReservedWords("assert,break,case,catch,class,const,continue,default,do,else,enum,extends,false,final,finally,for,if,in,is,new,null,rethrow,return,super,switch,this,throw,true,try,var,void,while,with,print,identityHashCode,identical,BidirectionalIterator,Comparable,double,Function,int,Invocation,Iterable,Iterator,List,Map,Match,num,Pattern,RegExp,Set,StackTrace,String,StringSink,Type,bool,DateTime,Deprecated,Duration,Expando,Null,Object,RuneIterator,Runes,Stopwatch,StringBuffer,Symbol,Uri,Comparator,AbstractClassInstantiationError,ArgumentError,AssertionError,CastError,ConcurrentModificationError,CyclicInitializationError,Error,Exception,FallThroughError,FormatException,IntegerDivisionByZeroException,NoSuchMethodError,NullThrownError,OutOfMemoryError,RangeError,StackOverflowError,StateError,TypeError,UnimplementedError,UnsupportedError")}init(a){super.init(a);this.nameDB_?
25
- this.nameDB_.reset():this.nameDB_=new $.Cj(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);var b=[],c=$.Cd(a);for(let d=0;d<c.length;d++)b.push(this.nameDB_.getName(c[d],$.P.DEVELOPER_VARIABLE));a=$.Bd(a);for(c=0;c<a.length;c++)b.push(this.nameDB_.getName(a[c].getId(),$.P.VARIABLE));b.length&&(this.definitions_.variables="var "+b.join(", ")+";");this.isInitialized=!0}finish(a){a&&(a=this.prefixLines(a,this.INDENT));
19
+ break;case "ATAN":d="Math.atan("+a+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,Z.MULTIPLICATIVE]},pt=function(a,b){var c=b.getProcedureName(a.getFieldValue("NAME")),d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(d+=b.injectId(b.STATEMENT_SUFFIX,a));d&&(d=b.prefixLines(d,b.INDENT));var e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));var f="";a.getInput("STACK")&&(f=b.statementToCode(a,
20
+ "STACK"));var g="";a.getInput("RETURN")&&(g=b.valueToCode(a,"RETURN",Z.NONE)||"");var h="";f&&g&&(h=d);g&&(g=b.INDENT+"return "+g+";\n");var l=g?"dynamic":"void",z=[],F=a.getVarModels();for(let J=0;J<F.length;J++)z[J]=b.getVariableName(F[J].getId());d=l+" "+c+"("+z.join(", ")+") {\n"+d+e+f+h+g+"}";d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},qt=function(a,b){b.definitions_.import_dart_html="import 'dart:html' as Html;";var c="Html.window.prompt("+(a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):
21
+ b.valueToCode(a,"TEXT",Z.NONE)||"''")+", '')";a.getFieldValue("TYPE")==="NUMBER"&&(b.definitions_.import_dart_math="import 'dart:math' as Math;",c="Math.parseDouble("+c+")");return[c,Z.UNARY_POSTFIX]},rt=function(a,b){return[b.getVariableName(a.getFieldValue("VAR")),Z.ATOMIC]},st=function(a,b){var c=b.valueToCode(a,"VALUE",Z.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+";\n"},Z,tt=Z||(Z={});tt[tt.ATOMIC=0]="ATOMIC";tt[tt.UNARY_POSTFIX=1]="UNARY_POSTFIX";
22
+ tt[tt.UNARY_PREFIX=2]="UNARY_PREFIX";tt[tt.MULTIPLICATIVE=3]="MULTIPLICATIVE";tt[tt.ADDITIVE=4]="ADDITIVE";tt[tt.SHIFT=5]="SHIFT";tt[tt.BITWISE_AND=6]="BITWISE_AND";tt[tt.BITWISE_XOR=7]="BITWISE_XOR";tt[tt.BITWISE_OR=8]="BITWISE_OR";tt[tt.RELATIONAL=9]="RELATIONAL";tt[tt.EQUALITY=10]="EQUALITY";tt[tt.LOGICAL_AND=11]="LOGICAL_AND";tt[tt.LOGICAL_OR=12]="LOGICAL_OR";tt[tt.IF_NULL=13]="IF_NULL";tt[tt.CONDITIONAL=14]="CONDITIONAL";tt[tt.CASCADE=15]="CASCADE";tt[tt.ASSIGNMENT=16]="ASSIGNMENT";
23
+ tt[tt.NONE=99]="NONE";
24
+ var ut=class extends $.Bq{constructor(a="Dart"){super(a);this.isInitialized=!1;for(let b in Z)a=Z[b],typeof a!=="string"&&(this["ORDER_"+b]=a);this.addReservedWords("assert,break,case,catch,class,const,continue,default,do,else,enum,extends,false,final,finally,for,if,in,is,new,null,rethrow,return,super,switch,this,throw,true,try,var,void,while,with,print,identityHashCode,identical,BidirectionalIterator,Comparable,double,Function,int,Invocation,Iterable,Iterator,List,Map,Match,num,Pattern,RegExp,Set,StackTrace,String,StringSink,Type,bool,DateTime,Deprecated,Duration,Expando,Null,Object,RuneIterator,Runes,Stopwatch,StringBuffer,Symbol,Uri,Comparator,AbstractClassInstantiationError,ArgumentError,AssertionError,CastError,ConcurrentModificationError,CyclicInitializationError,Error,Exception,FallThroughError,FormatException,IntegerDivisionByZeroException,NoSuchMethodError,NullThrownError,OutOfMemoryError,RangeError,StackOverflowError,StateError,TypeError,UnimplementedError,UnsupportedError")}init(a){super.init(a);this.nameDB_?
25
+ this.nameDB_.reset():this.nameDB_=new $.Ej(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);var b=[],c=$.Ed(a);for(let d=0;d<c.length;d++)b.push(this.nameDB_.getName(c[d],$.P.DEVELOPER_VARIABLE));a=$.Dd(a);for(c=0;c<a.length;c++)b.push(this.nameDB_.getName(a[c].getId(),$.P.VARIABLE));b.length&&(this.definitions_.variables="var "+b.join(", ")+";");this.isInitialized=!0}finish(a){a&&(a=this.prefixLines(a,this.INDENT));
26
26
  a="main() {\n"+a+"}";var b=[],c=[];for(let d in this.definitions_){let e=this.definitions_[d];e.match(/^import\s/)?b.push(e):c.push(e)}a=super.finish(a);this.isInitialized=!1;this.nameDB_.reset();return(b.join("\n")+"\n\n"+c.join("\n\n")).replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n\n\n")+a}scrubNakedValue(a){return a+";\n"}quote_(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/\$/g,"\\$").replace(/'/g,"\\'");return"'"+a+"'"}multiline_quote_(a){return a.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")}scrub_(a,
27
- b,c=!1){var d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.yf(e,this.COMMENT_WRAP-3),d="getProcedureDef"in a?d+this.prefixLines(e+"\n","/// "):d+this.prefixLines(e+"\n","// "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===$.je.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,"// "))}a=a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c}getAdjusted(a,
28
- b,c=0,d=!1,e=Z.NONE){a.workspace.options.oneBasedIndex&&c--;var f=a.workspace.options.oneBasedIndex?"1":"0",g=e;c?g=Z.ADDITIVE:d&&(g=Z.UNARY_PREFIX);a=this.valueToCode(a,b,g)||f;if(c===0&&!d)return a;if($.zf(a))return a=String(Number(a)+c),d&&(a=String(-Number(a))),a;c>0?a=`${a} + ${c}`:c<0&&(a=`${a} - ${-c}`);d&&(a=c?`-(${a})`:`-${a}`);Math.floor(e)>=Math.floor(g)&&(a=`(${a})`);return a}};var tt={};tt.controls_if=kt;tt.controls_ifelse=kt;tt.logic_boolean=function(a){return[a.getFieldValue("BOOL")==="TRUE"?"true":"false",Z.ATOMIC]};tt.logic_compare=function(a,b){var c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d=c==="=="||c==="!="?Z.EQUALITY:Z.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]};tt.logic_negate=function(a,b){var c=Z.UNARY_PREFIX;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]};
29
- tt.logic_null=function(){return["null",Z.ATOMIC]};tt.logic_operation=function(a,b){var c=a.getFieldValue("OP")==="AND"?"&&":"||",d=c==="&&"?Z.LOGICAL_AND:Z.LOGICAL_OR,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]};
30
- tt.logic_ternary=function(a,b){var c=b.valueToCode(a,"IF",Z.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Z.CONDITIONAL)||"null";a=b.valueToCode(a,"ELSE",Z.CONDITIONAL)||"null";return[c+" ? "+d+" : "+a,Z.CONDITIONAL]};var ut={controls_flow_statements:function(a,b){var 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){let 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.");},controls_for:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),
31
- d=b.valueToCode(a,"FROM",Z.ASSIGNMENT)||"0",e=b.valueToCode(a,"TO",Z.ASSIGNMENT)||"0",f=b.valueToCode(a,"BY",Z.ASSIGNMENT)||"1",g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a);if($.zf(d)&&$.zf(e)&&$.zf(f))b=Number(d)<=Number(e),a="for ("+c+" = "+d+"; "+c+(b?" <= ":" >= ")+e+"; "+c,c=Math.abs(Number(f)),a=c===1?a+(b?"++":"--"):a+((b?" += ":" -= ")+c),a+=") {\n"+g+"}\n";else{a="";let h=d;d.match(/^\w+$/)||$.zf(d)||(h=b.nameDB_.getDistinctName(c+"_start",$.P.VARIABLE),a+="var "+h+" = "+d+";\n");d=e;
32
- e.match(/^\w+$/)||$.zf(e)||(d=b.nameDB_.getDistinctName(c+"_end",$.P.VARIABLE),a+="var "+d+" = "+e+";\n");e=b.nameDB_.getDistinctName(c+"_inc",$.P.VARIABLE);a+="num "+e+" = ";a=$.zf(f)?a+(Math.abs(Number(f))+";\n"):a+("("+f+").abs();\n");a+="if ("+h+" > "+d+") {\n";a+=b.INDENT+e+" = -"+e+";\n";a=a+"}\nfor ("+(c+" = "+h+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+g+"}\n")}return a},controls_forEach:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,
33
- "LIST",Z.ASSIGNMENT)||"[]",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);return"for (var "+c+" in "+d+") {\n"+e+"}\n"}};ut.controls_repeat=lt;ut.controls_repeat_ext=lt;ut.controls_whileUntil=function(a,b){var c=a.getFieldValue("MODE")==="UNTIL",d=b.valueToCode(a,"BOOL",c?Z.UNARY_PREFIX:Z.NONE)||"false",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"};var vt={math_arithmetic:function(a,b){var c={ADD:[" + ",Z.ADDITIVE],MINUS:[" - ",Z.ADDITIVE],MULTIPLY:[" * ",Z.MULTIPLICATIVE],DIVIDE:[" / ",Z.MULTIPLICATIVE],POWER:[null,Z.NONE]}[a.getFieldValue("OP")],d=c[0];c=c[1];var e=b.valueToCode(a,"A",c)||"0";a=b.valueToCode(a,"B",c)||"0";return d?[e+d+a,c]:(b.definitions_.import_dart_math="import 'dart:math' as Math;",["Math.pow("+e+", "+a+")",Z.UNARY_POSTFIX])},math_atan2:function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";var c=
27
+ b,c=!1){var d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.Af(e,this.COMMENT_WRAP-3),d="getProcedureDef"in a?d+this.prefixLines(e+"\n","/// "):d+this.prefixLines(e+"\n","// "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===$.le.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,"// "))}a=a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c}getAdjusted(a,
28
+ b,c=0,d=!1,e=Z.NONE){a.workspace.options.oneBasedIndex&&c--;var f=a.workspace.options.oneBasedIndex?"1":"0",g=e;c?g=Z.ADDITIVE:d&&(g=Z.UNARY_PREFIX);a=this.valueToCode(a,b,g)||f;if(c===0&&!d)return a;if($.Bf(a))return a=String(Number(a)+c),d&&(a=String(-Number(a))),a;c>0?a=`${a} + ${c}`:c<0&&(a=`${a} - ${-c}`);d&&(a=c?`-(${a})`:`-${a}`);Math.floor(e)>=Math.floor(g)&&(a=`(${a})`);return a}};var vt={};vt.controls_if=mt;vt.controls_ifelse=mt;vt.logic_boolean=function(a){return[a.getFieldValue("BOOL")==="TRUE"?"true":"false",Z.ATOMIC]};vt.logic_compare=function(a,b){var c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d=c==="=="||c==="!="?Z.EQUALITY:Z.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]};vt.logic_negate=function(a,b){var c=Z.UNARY_PREFIX;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]};
29
+ vt.logic_null=function(){return["null",Z.ATOMIC]};vt.logic_operation=function(a,b){var c=a.getFieldValue("OP")==="AND"?"&&":"||",d=c==="&&"?Z.LOGICAL_AND:Z.LOGICAL_OR,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]};
30
+ vt.logic_ternary=function(a,b){var c=b.valueToCode(a,"IF",Z.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Z.CONDITIONAL)||"null";a=b.valueToCode(a,"ELSE",Z.CONDITIONAL)||"null";return[c+" ? "+d+" : "+a,Z.CONDITIONAL]};var wt={controls_flow_statements:function(a,b){var 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){let 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.");},controls_for:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),
31
+ d=b.valueToCode(a,"FROM",Z.ASSIGNMENT)||"0",e=b.valueToCode(a,"TO",Z.ASSIGNMENT)||"0",f=b.valueToCode(a,"BY",Z.ASSIGNMENT)||"1",g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a);if($.Bf(d)&&$.Bf(e)&&$.Bf(f))b=Number(d)<=Number(e),a="for ("+c+" = "+d+"; "+c+(b?" <= ":" >= ")+e+"; "+c,c=Math.abs(Number(f)),a=c===1?a+(b?"++":"--"):a+((b?" += ":" -= ")+c),a+=") {\n"+g+"}\n";else{a="";let h=d;d.match(/^\w+$/)||$.Bf(d)||(h=b.nameDB_.getDistinctName(c+"_start",$.P.VARIABLE),a+="var "+h+" = "+d+";\n");d=e;
32
+ e.match(/^\w+$/)||$.Bf(e)||(d=b.nameDB_.getDistinctName(c+"_end",$.P.VARIABLE),a+="var "+d+" = "+e+";\n");e=b.nameDB_.getDistinctName(c+"_inc",$.P.VARIABLE);a+="num "+e+" = ";a=$.Bf(f)?a+(Math.abs(Number(f))+";\n"):a+("("+f+").abs();\n");a+="if ("+h+" > "+d+") {\n";a+=b.INDENT+e+" = -"+e+";\n";a=a+"}\nfor ("+(c+" = "+h+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+g+"}\n")}return a},controls_forEach:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,
33
+ "LIST",Z.ASSIGNMENT)||"[]",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);return"for (var "+c+" in "+d+") {\n"+e+"}\n"}};wt.controls_repeat=nt;wt.controls_repeat_ext=nt;wt.controls_whileUntil=function(a,b){var c=a.getFieldValue("MODE")==="UNTIL",d=b.valueToCode(a,"BOOL",c?Z.UNARY_PREFIX:Z.NONE)||"false",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"};var xt={math_arithmetic:function(a,b){var c={ADD:[" + ",Z.ADDITIVE],MINUS:[" - ",Z.ADDITIVE],MULTIPLY:[" * ",Z.MULTIPLICATIVE],DIVIDE:[" / ",Z.MULTIPLICATIVE],POWER:[null,Z.NONE]}[a.getFieldValue("OP")],d=c[0];c=c[1];var e=b.valueToCode(a,"A",c)||"0";a=b.valueToCode(a,"B",c)||"0";return d?[e+d+a,c]:(b.definitions_.import_dart_math="import 'dart:math' as Math;",["Math.pow("+e+", "+a+")",Z.UNARY_POSTFIX])},math_atan2:function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";var c=
34
34
  b.valueToCode(a,"X",Z.NONE)||"0";return["Math.atan2("+(b.valueToCode(a,"Y",Z.NONE)||"0")+", "+c+") / Math.pi * 180",Z.MULTIPLICATIVE]},math_change:function(a,b){var c=b.valueToCode(a,"DELTA",Z.ADDITIVE)||"0";a=b.getVariableName(a.getFieldValue("VAR"));return a+" = ("+a+" is num ? "+a+" : 0) + "+c+";\n"},math_constant:function(a,b){var c={PI:["Math.pi",Z.UNARY_POSTFIX],E:["Math.e",Z.UNARY_POSTFIX],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",Z.MULTIPLICATIVE],SQRT2:["Math.sqrt2",Z.UNARY_POSTFIX],SQRT1_2:["Math.sqrt1_2",
35
35
  Z.UNARY_POSTFIX],INFINITY:["double.infinity",Z.ATOMIC]};a=a.getFieldValue("CONSTANT");a!=="INFINITY"&&(b.definitions_.import_dart_math="import 'dart:math' as Math;");return c[a]},math_constrain:function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";var c=b.valueToCode(a,"VALUE",Z.NONE)||"0",d=b.valueToCode(a,"LOW",Z.NONE)||"0";a=b.valueToCode(a,"HIGH",Z.NONE)||"double.infinity";return["Math.min(Math.max("+c+", "+d+"), "+a+")",Z.UNARY_POSTFIX]},math_modulo:function(a,b){var c=
36
36
  b.valueToCode(a,"DIVIDEND",Z.MULTIPLICATIVE)||"0";a=b.valueToCode(a,"DIVISOR",Z.MULTIPLICATIVE)||"0";return[c+" % "+a,Z.MULTIPLICATIVE]},math_number:function(a){a=Number(a.getFieldValue("NUM"));return a===Infinity?["double.infinity",Z.UNARY_POSTFIX]:a===-Infinity?["-double.infinity",Z.UNARY_PREFIX]:[String(a),a<0?Z.UNARY_PREFIX:Z.ATOMIC]},math_number_property:function(a,b){var c={EVEN:[" % 2 == 0",Z.MULTIPLICATIVE,Z.EQUALITY],ODD:[" % 2 == 1",Z.MULTIPLICATIVE,Z.EQUALITY],WHOLE:[" % 1 == 0",Z.MULTIPLICATIVE,
@@ -156,8 +156,8 @@ int ${b.FUNCTION_NAME_PLACEHOLDER_}(num a, num b) {
156
156
  }
157
157
  return new Math.Random().nextInt(b - a + 1) + a;
158
158
  }
159
- `)+"("+c+", "+a+")",Z.UNARY_POSTFIX]}};vt.math_round=mt;vt.math_single=mt;vt.math_trig=mt;var wt={procedures_callnoreturn:function(a,b){return b.forBlock.procedures_callreturn(a,b)[0]+";\n"},procedures_callreturn:function(a,b){var c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVarModels();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Z.NONE)||"null";return[c+"("+d.join(", ")+")",Z.UNARY_POSTFIX]}};wt.procedures_defnoreturn=nt;wt.procedures_defreturn=nt;
160
- wt.procedures_ifreturn=function(a,b){var c="if ("+(b.valueToCode(a,"CONDITION",Z.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Z.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"};var xt={text:function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Z.ATOMIC]},text_append:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Z.NONE)||"''";return c+" = ["+c+", "+a+"].join();\n"},text_changeCase:function(a,b){var c={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[a.getFieldValue("CASE")];a=b.valueToCode(a,"TEXT",c?Z.UNARY_POSTFIX:Z.NONE)||"''";return[c?a+c:b.provideFunction_("text_toTitleCase",`
159
+ `)+"("+c+", "+a+")",Z.UNARY_POSTFIX]}};xt.math_round=ot;xt.math_single=ot;xt.math_trig=ot;var yt={procedures_callnoreturn:function(a,b){return b.forBlock.procedures_callreturn(a,b)[0]+";\n"},procedures_callreturn:function(a,b){var c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVarModels();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Z.NONE)||"null";return[c+"("+d.join(", ")+")",Z.UNARY_POSTFIX]}};yt.procedures_defnoreturn=pt;yt.procedures_defreturn=pt;
160
+ yt.procedures_ifreturn=function(a,b){var c="if ("+(b.valueToCode(a,"CONDITION",Z.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Z.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"};var zt={text:function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Z.ATOMIC]},text_append:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Z.NONE)||"''";return c+" = ["+c+", "+a+"].join();\n"},text_changeCase:function(a,b){var c={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[a.getFieldValue("CASE")];a=b.valueToCode(a,"TEXT",c?Z.UNARY_POSTFIX:Z.NONE)||"''";return[c?a+c:b.provideFunction_("text_toTitleCase",`
161
161
  String ${b.FUNCTION_NAME_PLACEHOLDER_}(String str) {
162
162
  RegExp exp = new RegExp(r'\\b');
163
163
  List<String> list = str.split(exp);
@@ -217,10 +217,10 @@ String ${b.FUNCTION_NAME_PLACEHOLDER_}(String text, String where1, num at1, Stri
217
217
  return text.substring(at1, at2);
218
218
  }
219
219
  `)+"("+f+", '"+c+"', "+g+", '"+d+"', "+a+")";return[b,Z.UNARY_POSTFIX]},text_indexOf:function(a,b){var c=a.getFieldValue("END")==="FIRST"?"indexOf":"lastIndexOf",d=b.valueToCode(a,"FIND",Z.NONE)||"''";b=(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+"."+c+"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Z.ADDITIVE]:[b,Z.UNARY_POSTFIX]},text_isEmpty:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+".isEmpty",Z.UNARY_POSTFIX]},text_join:function(a,b){switch(a.itemCount_){case 0:return["''",
220
- Z.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Z.UNARY_POSTFIX)||"''")+".toString()",Z.UNARY_POSTFIX];default:let c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"''";return["["+c.join(",")+"].join()",Z.UNARY_POSTFIX]}},text_length:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+".length",Z.UNARY_POSTFIX]},text_print:function(a,b){return"print("+(b.valueToCode(a,"TEXT",Z.NONE)||"''")+");\n"}};xt.text_prompt=ot;xt.text_prompt_ext=ot;
221
- xt.text_replace=function(a,b){var c=b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''",d=b.valueToCode(a,"FROM",Z.NONE)||"''";a=b.valueToCode(a,"TO",Z.NONE)||"''";return[c+".replaceAll("+d+", "+a+")",Z.UNARY_POSTFIX]};xt.text_reverse=function(a,b){return["new String.fromCharCodes("+(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+".runes.toList().reversed)",Z.UNARY_PREFIX]};
222
- xt.text_trim=function(a,b){var c={LEFT:".replaceFirst(new RegExp(r'^\\s+'), '')",RIGHT:".replaceFirst(new RegExp(r'\\s+$'), '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+c,Z.UNARY_POSTFIX]};var yt={};yt.variables_get=pt;yt.variables_set=qt;var zt={};zt.variables_get_dynamic=pt;zt.variables_set_dynamic=qt;var At=new st;At.addReservedWords("Html,Math");
223
- var Bt=Object.assign({},{lists_create_empty:function(){return["[]",Z.ATOMIC]},lists_create_with:function(a,b){var c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"null";return["["+c.join(", ")+"]",Z.ATOMIC]},lists_getIndex:function(a,b){function c(){var g=b.nameDB_.getDistinctName("tmp_list",$.P.VARIABLE),h="List "+g+" = "+f+";\n";f=g;return h}var d=a.getFieldValue("MODE")||"GET",e=a.getFieldValue("WHERE")||"FROM_START",f=b.valueToCode(a,"VALUE",e==="RANDOM"||
220
+ Z.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Z.UNARY_POSTFIX)||"''")+".toString()",Z.UNARY_POSTFIX];default:let c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"''";return["["+c.join(",")+"].join()",Z.UNARY_POSTFIX]}},text_length:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+".length",Z.UNARY_POSTFIX]},text_print:function(a,b){return"print("+(b.valueToCode(a,"TEXT",Z.NONE)||"''")+");\n"}};zt.text_prompt=qt;zt.text_prompt_ext=qt;
221
+ zt.text_replace=function(a,b){var c=b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''",d=b.valueToCode(a,"FROM",Z.NONE)||"''";a=b.valueToCode(a,"TO",Z.NONE)||"''";return[c+".replaceAll("+d+", "+a+")",Z.UNARY_POSTFIX]};zt.text_reverse=function(a,b){return["new String.fromCharCodes("+(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+".runes.toList().reversed)",Z.UNARY_PREFIX]};
222
+ zt.text_trim=function(a,b){var c={LEFT:".replaceFirst(new RegExp(r'^\\s+'), '')",RIGHT:".replaceFirst(new RegExp(r'\\s+$'), '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+c,Z.UNARY_POSTFIX]};var At={};At.variables_get=rt;At.variables_set=st;var Bt={};Bt.variables_get_dynamic=rt;Bt.variables_set_dynamic=st;var Ct=new ut;Ct.addReservedWords("Html,Math");
223
+ var Dt=Object.assign({},{lists_create_empty:function(){return["[]",Z.ATOMIC]},lists_create_with:function(a,b){var c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"null";return["["+c.join(", ")+"]",Z.ATOMIC]},lists_getIndex:function(a,b){function c(){var g=b.nameDB_.getDistinctName("tmp_list",$.P.VARIABLE),h="List "+g+" = "+f+";\n";f=g;return h}var d=a.getFieldValue("MODE")||"GET",e=a.getFieldValue("WHERE")||"FROM_START",f=b.valueToCode(a,"VALUE",e==="RANDOM"||
224
224
  e==="FROM_END"?Z.NONE:Z.UNARY_POSTFIX)||"[]";if((e!=="RANDOM"||d!=="REMOVE")&&e!=="FROM_END"||f.match(/^\w+$/))switch(e){case "FIRST":if(d==="GET")return[f+".first",Z.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeAt(0)",Z.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeAt(0);\n";break;case "LAST":if(d==="GET")return[f+".last",Z.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeLast()",Z.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeLast();\n";break;case "FROM_START":a=b.getAdjusted(a,"AT");
225
225
  if(d==="GET")return[f+"["+a+"]",Z.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeAt("+a+")",Z.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeAt("+a+");\n";break;case "FROM_END":a=b.getAdjusted(a,"AT",1,!1,Z.ADDITIVE);if(d==="GET")return[f+"["+f+".length - "+a+"]",Z.UNARY_POSTFIX];if(d==="GET_REMOVE"||d==="REMOVE"){a=f+".removeAt("+f+".length - "+a+")";if(d==="GET_REMOVE")return[a,Z.UNARY_POSTFIX];if(d==="REMOVE")return a+";\n"}break;case "RANDOM":b.definitions_.import_dart_math="import 'dart:math' as Math;";
226
226
  if(d==="REMOVE")return d=b.nameDB_.getDistinctName("tmp_x",$.P.VARIABLE),"int "+d+" = new Math.Random().nextInt("+f+".length);\n"+(f+".removeAt("+d+");\n");if(d==="GET")return[b.provideFunction_("lists_get_random_item",`
@@ -263,8 +263,8 @@ List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String where1, num at1, String w
263
263
  return list.sublist(at1, at2);
264
264
  }
265
265
  `)+"("+c+", '"+d+"', "+f+", '"+e+"', "+a+")";return[b,Z.UNARY_POSTFIX]},lists_indexOf:function(a,b){var c=a.getFieldValue("END")==="FIRST"?"indexOf":"lastIndexOf",d=b.valueToCode(a,"FIND",Z.NONE)||"''";b=(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"[]")+"."+c+"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Z.ADDITIVE]:[b,Z.UNARY_POSTFIX]},lists_isEmpty:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"[]")+".isEmpty",Z.UNARY_POSTFIX]},lists_length:function(a,b){return[(b.valueToCode(a,
266
- "VALUE",Z.UNARY_POSTFIX)||"[]")+".length",Z.UNARY_POSTFIX]},lists_repeat:function(a,b){var c=b.valueToCode(a,"ITEM",Z.NONE)||"null";return["new List.filled("+(b.valueToCode(a,"NUM",Z.NONE)||"0")+", "+c+")",Z.UNARY_POSTFIX]},lists_reverse:function(a,b){return["new List.from("+(b.valueToCode(a,"LIST",Z.NONE)||"[]")+".reversed)",Z.UNARY_POSTFIX]},lists_setIndex:function(a,b){function c(){if(f.match(/^\w+$/))return"";var h=b.nameDB_.getDistinctName("tmp_list",$.P.VARIABLE),m="List "+h+" = "+f+";\n";f=
267
- h;return m}var d=a.getFieldValue("MODE")||"GET",e=a.getFieldValue("WHERE")||"FROM_START",f=b.valueToCode(a,"LIST",Z.UNARY_POSTFIX)||"[]",g=b.valueToCode(a,"TO",Z.ASSIGNMENT)||"null";switch(e){case "FIRST":if(d==="SET")return f+"[0] = "+g+";\n";if(d==="INSERT")return f+".insert(0, "+g+");\n";break;case "LAST":if(d==="SET")return c()+(f+"["+f+".length - 1] = "+g+";\n");if(d==="INSERT")return f+".add("+g+");\n";break;case "FROM_START":a=b.getAdjusted(a,"AT");if(d==="SET")return f+"["+a+"] = "+g+";\n";
266
+ "VALUE",Z.UNARY_POSTFIX)||"[]")+".length",Z.UNARY_POSTFIX]},lists_repeat:function(a,b){var c=b.valueToCode(a,"ITEM",Z.NONE)||"null";return["new List.filled("+(b.valueToCode(a,"NUM",Z.NONE)||"0")+", "+c+")",Z.UNARY_POSTFIX]},lists_reverse:function(a,b){return["new List.from("+(b.valueToCode(a,"LIST",Z.NONE)||"[]")+".reversed)",Z.UNARY_POSTFIX]},lists_setIndex:function(a,b){function c(){if(f.match(/^\w+$/))return"";var h=b.nameDB_.getDistinctName("tmp_list",$.P.VARIABLE),l="List "+h+" = "+f+";\n";f=
267
+ h;return l}var d=a.getFieldValue("MODE")||"GET",e=a.getFieldValue("WHERE")||"FROM_START",f=b.valueToCode(a,"LIST",Z.UNARY_POSTFIX)||"[]",g=b.valueToCode(a,"TO",Z.ASSIGNMENT)||"null";switch(e){case "FIRST":if(d==="SET")return f+"[0] = "+g+";\n";if(d==="INSERT")return f+".insert(0, "+g+");\n";break;case "LAST":if(d==="SET")return c()+(f+"["+f+".length - 1] = "+g+";\n");if(d==="INSERT")return f+".add("+g+");\n";break;case "FROM_START":a=b.getAdjusted(a,"AT");if(d==="SET")return f+"["+a+"] = "+g+";\n";
268
268
  if(d==="INSERT")return f+".insert("+a+", "+g+");\n";break;case "FROM_END":a=b.getAdjusted(a,"AT",1,!1,Z.ADDITIVE);e=c();if(d==="SET")return e+(f+"["+f+".length - "+a+"] = "+g+";\n");if(d==="INSERT")return e+(f+".insert("+f+".length - "+a+", "+g+");\n");break;case "RANDOM":b.definitions_.import_dart_math="import 'dart:math' as Math;";a=c();e=b.nameDB_.getDistinctName("tmp_x",$.P.VARIABLE);a+="int "+e+" = new Math.Random().nextInt("+f+".length);\n";if(d==="SET")return a+(f+"["+e+"] = "+g+";\n");if(d===
269
269
  "INSERT")return a+(f+".insert("+e+", "+g+");\n")}throw Error("Unhandled combination (lists_setIndex).");},lists_sort:function(a,b){var c=b.valueToCode(a,"LIST",Z.NONE)||"[]",d=a.getFieldValue("DIRECTION")==="1"?1:-1;a=a.getFieldValue("TYPE");return[b.provideFunction_("lists_sort",`
270
270
  List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {
@@ -280,7 +280,7 @@ List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {
280
280
  list.sort(compare);
281
281
  return list;
282
282
  }
283
- `)+"("+c+', "'+a+'", '+d+")",Z.UNARY_POSTFIX]},lists_split:function(a,b){var c=b.valueToCode(a,"INPUT",Z.UNARY_POSTFIX);b=b.valueToCode(a,"DELIM",Z.NONE)||"''";a=a.getFieldValue("MODE");if(a==="SPLIT")c||(c="''"),a="split";else if(a==="JOIN")c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+b+")",Z.UNARY_POSTFIX]}},tt,ut,vt,wt,xt,yt,zt);for(let a in Bt)At.forBlock[a]=Bt[a];var Ct={};Ct.DartGenerator=st;Ct.Order=Z;Ct.dartGenerator=At;$.__chunk_dart=Ct;
283
+ `)+"("+c+', "'+a+'", '+d+")",Z.UNARY_POSTFIX]},lists_split:function(a,b){var c=b.valueToCode(a,"INPUT",Z.UNARY_POSTFIX);b=b.valueToCode(a,"DELIM",Z.NONE)||"''";a=a.getFieldValue("MODE");if(a==="SPLIT")c||(c="''"),a="split";else if(a==="JOIN")c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+b+")",Z.UNARY_POSTFIX]}},vt,wt,xt,yt,zt,At,Bt);for(let a in Dt)Ct.forBlock[a]=Dt[a];var Et={};Et.DartGenerator=ut;Et.Order=Z;Et.dartGenerator=Ct;$.__chunk_dart=Et;
284
284
  $.__chunk_dart.__namespace__=$;
285
285
  return $.__chunk_dart;
286
286
  }));